
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@jenkins-cd/js-modules
Advanced tools
This is a JavaScript "module bundle" loader for Jenkins (NPM package) i.e. a loader for loading a JavaScript file that contains one or more CommonJS/node.js style modules in a single HTTP request (i.e. a "bundle").
For more information on "module bundle" loading, read the What does "module loading" mean FAQ.
Table of Contents:
For the most part, you don't actually use js-modules
directly (aside from installing the package). In general,
you use it via js-builder
i.e. you use js-builder
to build browser-loadable bundles, and those
bundles will use js-modules
to load/"import" the modules/packages that they depend on, but do not contain
within their bundle.
Install Package:
npm install --save @jenkins-cd/js-modules
After installing js-modules
, your next step is to start using js-builder and, as stated above, that's
mostly all you'll ever need to know about js-modules
because the rest of it happens under the hood via
js-builder.
That said, it's probably useful to have an understanding of how js-modules
actually loads modules/packages.
For that, take a look at MODULE_LOADING.md.
For the most part, the Jenkins GUI is constructed on the server side from Jelly files (Stapler etc). Client-side JavaScript has not played a big part in the Jenkins GUI.
If the Jenkins GUI is to be modernized and improved (from a user experience perspective), client-side JavaScript needs to be able to play a bigger part. If that's so, we need to modernize/improve the development patterns around how JavaScript is currently used in Jenkins.
As we see it, the main issues today are:
hudson-behaviour.js
.JenkinsRule
(HtmlUnit and it's WebClient
).These are the problems that js-modules
(this NPM package) is targeted at helping to solve.
It is hoped that js-modules
will help those that are interested (see next section) in maintaining modular,
unit testable, evolvable (see note below) JavaScript code that runs in a more predictable/stable environment that
is more immune to plugin updates etc (e.g. an upgrade to the
jQuery plugin doesn't break the plugin GUI).
Using CommonJS style modularity also makes it possible to more easily leverage the growing set of publicly available
NPM/node.js packages, which is a huge benefit.
What do we mean by "evolvable"?:
js-modules
makes it possible to safely run multiple versions of core JavaScript Framework libs on the same page (jQuery, Bootstrap etc). This makes it possible for modular code (built onjs-modules
) to depend on an explicit version of a JS lib that is guaranteed to remain available on e.g. plugin upgrades. Conversely, the same modular code can upgrade the version of a lib it depends on without effecting other modular code that still depends on an older version.
No, this is totally optional. See FAQ
The following slides attempt to bring you through js-modules
in some more detail.
Also check out the FAQs.
The following NPM packages are designed to aid the use and adoption of js-modules
:
js-modules
.js-modules
. This package's functionality is indirectly available via js-builder.As stated earlier, using CommonJS style modularity makes it possible to more easily leverage the growing set of publicly available
NPM/node.js packages. If you want to use some really cool NPM package that you just found, all you need to do is follow the
"standard" NPM package installation process, adding it to your "app" bundle e.g. npm install --save cool-new-lib
.
This is great, but if followed all the way, your JavaScript "app" bundles will soon become quite heavy for the browser to load because they will contain all JavaScript required by all the modules in the bundle.
The main feature of js-modules
is it's ability to load module bundles that can export
/ import
modules to/from
other modules bundles i.e. share common modules between bundles (see above slides). This means we can create js-modules
style
module bundles for different versions of all of the major JavaScript Framework libs out there (jQuery, Bootstrap etc), making it possible for
"app" bundles to share common Framework libs and to not have them in their "app" bundle, making them considerably lighter for
browser load and helping to avoid the bundle bloat problem.
We have already created Framework lib bundles for a number of common JavaScript libs (jQuery, Bootstrap and more).
FAQs
Jenkins CI JavaScript module bundle loader
We found that @jenkins-cd/js-modules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.