Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
babel-plugin-transform-cjs-system-wrapper
Advanced tools
Wraps CommonJS scripts into System.registerDynamic(...
Wraps CommonJS scripts into System.registerDynamic(...
For SystemJS 0.19 and below support, use the 0.3.0 version.
In
'use strict';
var foo = require('foo/');
Babel Options
{
moduleId: 'foobar'
plugins: [
['transform-cjs-system-wrapper', {
deps: ['bar'],
globals: {
f: foo
}
}]
]
}
Out
System.registerDynamic('foobar', ['bar'], function ($__require, exports, module) {
'use strict';
var f = $__require('foo');
var global = this,
GLOBAL = this;
var foo = $__require('foo');
});
$ npm install babel-plugin-transform-cjs-system-wrapper
.babelrc
.babelrc
{
"moduleId": "foobar",
"plugins": [
["transform-cjs-system-wrapper", {
"systemGlobal": "SystemJS",
"path": "/path/to/foobar",
"optimize": true,
"static": true,
"deps": ["bar"],
"globals": {
"f": "foo"
}
}]
]
}
$ babel --plugins transform-cjs-system-wrapper script.js
require("babel-core").transform("code", {
moduleId: 'foobar', // optional (default: '')
plugins: [
["transform-cjs-system-wrapper", {
requireName: 'require' // (default: 'require')
systemGlobal: "SystemJS", // optional (default: 'SystemJS')
path: "/path/to/foobar", // optional (default: '')
optimize: true, // optional (default: false)
static: true, // optional (default: false)
deps: ['bar'], // optional (default: []),
map: function(dep) {
return mappedDep
}, // (default: identity)
globals: { // optional (default: {})
f: foo
}
}]
]
});
FAQs
Wraps CommonJS scripts into System.registerDynamic(...
The npm package babel-plugin-transform-cjs-system-wrapper receives a total of 10,992 weekly downloads. As such, babel-plugin-transform-cjs-system-wrapper popularity was classified as popular.
We found that babel-plugin-transform-cjs-system-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.