
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
babel-plugin-transform-commonjs-es2015-modules
Advanced tools
CommonJS to ES2015 modules (export/import) transformation plugin for Babel
CommonJS to ES2015 modules (export/import) transformation plugin for Babel
Converting the CommonJS-formatted scripts in node_modules
to ES2015 Modules syntax. Then Babel can transform to other formats such as AMD, UMD, or SystemJS.
Should support most popular CommonJS patterns. Especially code generated by Babel (so this should work with Browserify's Babelify).
// in:
var foo = require('bar');
// out:
import foo from 'bar';
// in:
var foo = require('bar').foo;
// out:
import { foo } from 'bar';
// in:
var foo = require('bar').baz;
// out:
import { baz as foo } from 'bar';
// in:
module.exports = require('foo');
// out:
export * from 'foo';
// in:
module.exports = foo;
// out:
export default foo;
// in:
module.exports.foo = require('bar');
// out:
export { default as foo } from 'bar';
// in:
module.exports.foo = bar;
// out:
export var foo = bar;
// in:
exports.foo = require('bar');
// out:
export { default as foo } from 'bar';
// in:
exports.default = foo;
// out:
export default foo;
// in:
exports.foo = bar;
// out:
export var foo = bar;
$ npm install babel-plugin-transform-commonjs-es2015-modules
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-commonjs-es2015-modules"]
}
$ babel --plugins transform-commonjs-es2015-modules script.js
require("babel-core").transform("code", {
plugins: ["transform-commonjs-es2015-modules"]
});
FAQs
CommonJS to ES2015 modules (export/import) transformation plugin for Babel
The npm package babel-plugin-transform-commonjs-es2015-modules receives a total of 752 weekly downloads. As such, babel-plugin-transform-commonjs-es2015-modules popularity was classified as not popular.
We found that babel-plugin-transform-commonjs-es2015-modules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.