Socket
Socket
Sign inDemoInstall

babel-plugin-transform-cjs-system-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-cjs-system-wrapper - npm Package Compare versions

Comparing version 0.0.3 to 0.2.0

test/fixtures/replace-system-node-require-2/actual.js

11

lib/index.js

@@ -41,10 +41,5 @@ 'use strict';

// test if require.resolve is present
if (!this.usesRequireResolve && t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: 'require' }) && t.isIdentifier(callee.property, { name: 'resolve' })) {
if (!this.usesRequireResolve && t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: opts.requireName || 'require' }) && t.isIdentifier(callee.property, { name: 'resolve' })) {
this.usesRequireResolve = true;
}
if (opts.systemGlobal != 'System' && t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: 'System' }) && t.isIdentifier(callee.property, { name: '_nodeRequire' })) {
callee.object = t.identifier(opts.systemGlobal);
}
},

@@ -61,2 +56,6 @@ MemberExpression: function MemberExpression(path, _ref4) {

}
if (opts.systemGlobal != 'System' && t.isIdentifier(node.object, { name: 'System' }) && t.isIdentifier(node.property, { name: '_nodeRequire' })) {
node.object = t.identifier(opts.systemGlobal);
}
},

@@ -63,0 +62,0 @@ Identifier: function Identifier(_ref5) {

{
"name": "babel-plugin-transform-cjs-system-wrapper",
"version": "0.0.3",
"version": "0.2.0",
"description": "Wraps CommonJS scripts into System.registerDynamic(...",

@@ -26,7 +26,6 @@ "repository": {

"scripts": {
"clean": "rimraf lib",
"build": "babel src -d lib",
"test": "mocha --compilers js:babel-register",
"test:watch": "npm run test -- --watch",
"prepublish": "npm run clean && npm run build"
"prepublish": "npm run build"
},

@@ -33,0 +32,0 @@ "keywords": [

@@ -88,2 +88,3 @@ # babel-plugin-transform-cjs-system-wrapper

["transform-cjs-system-wrapper", {
requireName: 'require' // (default: 'require')
systemGlobal: "SystemJS", // optional (default: 'SystemJS')

@@ -93,3 +94,6 @@ path: "/path/to/foobar", // optional (default: '')

static: true, // optional (default: false)
deps: ['bar'], // optional (default: [])
deps: ['bar'], // optional (default: []),
map: function(dep) {
return mappedDep
}, // (default: identity)
globals: { // optional (default: {})

@@ -96,0 +100,0 @@ f: foo

System._nodeRequire("foo");
SystemJS._nodeRequire("bar");
module.exports = {
systemGlobal: 'SystemJS'
};
module.exports = {
deps: ['foo', 'bar']
};

@@ -0,0 +0,0 @@ module.exports = {

module.exports = {
moduleName: 'foobar'
};
module.exports = {
systemGlobal: 'foo'
};

@@ -6,4 +6,4 @@ SystemJS.registerDynamic('foobar', ['bar'], true, function ($__require, exports, module) {

var define,
global = this,
GLOBAL = this;
global = this || self,
GLOBAL = global;
var $__pathVars = SystemJS.get('@@cjs-helpers').getPathVars(module.id),

@@ -10,0 +10,0 @@ __filename = $__pathVars.filename,

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ import path from 'path';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc