babel-plugin-transform-es2015-modules-commonjs
Advanced tools
Comparing version 7.0.0-beta.0 to 7.0.0-beta.1
572
lib/index.js
@@ -5,516 +5,64 @@ "use strict"; | ||
exports.default = function () { | ||
var REASSIGN_REMAP_SKIP = Symbol(); | ||
var reassignmentVisitor = { | ||
ReferencedIdentifier: function ReferencedIdentifier(path) { | ||
var name = path.node.name; | ||
var remap = this.remaps[name]; | ||
if (!remap) return; | ||
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; | ||
if (path.parentPath.isCallExpression({ | ||
callee: path.node | ||
})) { | ||
path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap])); | ||
} else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) { | ||
var object = remap.object, | ||
property = remap.property; | ||
path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name))); | ||
} else { | ||
path.replaceWith(t.cloneWithoutLoc(remap)); | ||
} | ||
this.requeueInParent(path); | ||
}, | ||
AssignmentExpression: function AssignmentExpression(path) { | ||
var node = path.node; | ||
if (node[REASSIGN_REMAP_SKIP]) return; | ||
var left = path.get("left"); | ||
if (left.isIdentifier()) { | ||
var name = left.node.name; | ||
var exports = this.exports[name]; | ||
if (!exports) return; | ||
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; | ||
node[REASSIGN_REMAP_SKIP] = true; | ||
for (var _iterator = exports, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _reid = _ref; | ||
node = buildExportsAssignment(_reid, node).expression; | ||
} | ||
path.replaceWith(node); | ||
this.requeueInParent(path); | ||
} else if (left.isObjectPattern()) { | ||
for (var _iterator2 = left.node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { | ||
var _ref2; | ||
if (_isArray2) { | ||
if (_i2 >= _iterator2.length) break; | ||
_ref2 = _iterator2[_i2++]; | ||
} else { | ||
_i2 = _iterator2.next(); | ||
if (_i2.done) break; | ||
_ref2 = _i2.value; | ||
} | ||
var _property = _ref2; | ||
var _name2 = _property.value.name; | ||
var _exports2 = this.exports[_name2]; | ||
if (!_exports2) continue; | ||
if (this.scope.getBinding(_name2) !== path.scope.getBinding(_name2)) { | ||
return; | ||
} | ||
node[REASSIGN_REMAP_SKIP] = true; | ||
path.insertAfter(buildExportsAssignment(t.identifier(_name2), t.identifier(_name2))); | ||
} | ||
} else if (left.isArrayPattern()) { | ||
for (var _iterator3 = left.node.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (_isArray3) { | ||
if (_i3 >= _iterator3.length) break; | ||
_ref3 = _iterator3[_i3++]; | ||
} else { | ||
_i3 = _iterator3.next(); | ||
if (_i3.done) break; | ||
_ref3 = _i3.value; | ||
} | ||
var _element = _ref3; | ||
if (!_element) continue; | ||
var _name4 = _element.name; | ||
var _exports4 = this.exports[_name4]; | ||
if (!_exports4) continue; | ||
if (this.scope.getBinding(_name4) !== path.scope.getBinding(_name4)) { | ||
return; | ||
} | ||
node[REASSIGN_REMAP_SKIP] = true; | ||
path.insertAfter(buildExportsAssignment(t.identifier(_name4), t.identifier(_name4))); | ||
} | ||
} | ||
}, | ||
UpdateExpression: function UpdateExpression(path) { | ||
var arg = path.get("argument"); | ||
if (!arg.isIdentifier()) return; | ||
var name = arg.node.name; | ||
var exports = this.exports[name]; | ||
if (!exports) return; | ||
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; | ||
var node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1)); | ||
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord() || path.node.prefix) { | ||
path.replaceWith(node); | ||
this.requeueInParent(path); | ||
return; | ||
} | ||
var nodes = []; | ||
nodes.push(node); | ||
var operator = void 0; | ||
if (path.node.operator === "--") { | ||
operator = "+"; | ||
} else { | ||
operator = "-"; | ||
} | ||
nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1))); | ||
path.replaceWithMultiple(t.sequenceExpression(nodes)); | ||
} | ||
}; | ||
exports.default = function (_ref) { | ||
var t = _ref.types; | ||
return { | ||
inherits: _babelPluginTransformStrictMode2.default, | ||
visitor: { | ||
ThisExpression: function ThisExpression(path, state) { | ||
if (this.ranCommonJS) return; | ||
if (state.opts.allowTopLevelThis !== true && !path.findParent(function (path) { | ||
return THIS_BREAK_KEYS.indexOf(path.type) >= 0; | ||
})) { | ||
path.replaceWith(path.scope.buildUndefinedNode()); | ||
} | ||
}, | ||
Program: { | ||
exit: function exit(path) { | ||
this.ranCommonJS = true; | ||
var strict = !!this.opts.strict; | ||
var noInterop = !!this.opts.noInterop; | ||
var scope = path.scope; | ||
scope.rename("module"); | ||
scope.rename("exports"); | ||
scope.rename("require"); | ||
var hasExports = false; | ||
var hasImports = false; | ||
var body = path.get("body"); | ||
var imports = Object.create(null); | ||
var exports = Object.create(null); | ||
var nonHoistedExportNames = Object.create(null); | ||
var topNodes = []; | ||
var remaps = Object.create(null); | ||
var requires = Object.create(null); | ||
exit: function exit(path, state) { | ||
var _state$opts = state.opts, | ||
loose = _state$opts.loose, | ||
allowTopLevelThis = _state$opts.allowTopLevelThis, | ||
strict = _state$opts.strict, | ||
strictMode = _state$opts.strictMode, | ||
noInterop = _state$opts.noInterop; | ||
path.scope.rename("exports"); | ||
path.scope.rename("module"); | ||
path.scope.rename("require"); | ||
path.scope.rename("__filename"); | ||
path.scope.rename("__dirname"); | ||
var moduleName = this.getModuleName(); | ||
if (moduleName) moduleName = t.stringLiteral(moduleName); | ||
function addRequire(source, blockHoist) { | ||
var cached = requires[source]; | ||
if (cached) return cached; | ||
var ref = path.scope.generateUidIdentifier((0, _path3.basename)(source, (0, _path3.extname)(source))); | ||
var varDecl = t.variableDeclaration("var", [t.variableDeclarator(ref, buildRequire(t.stringLiteral(source)).expression)]); | ||
var _rewriteModuleStateme = (0, _babelHelperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, { | ||
exportName: "exports", | ||
loose: loose, | ||
strict: strict, | ||
strictMode: strictMode, | ||
allowTopLevelThis: allowTopLevelThis, | ||
noInterop: noInterop | ||
}), | ||
meta = _rewriteModuleStateme.meta, | ||
headers = _rewriteModuleStateme.headers; | ||
if (imports[source]) { | ||
varDecl.loc = imports[source].loc; | ||
} | ||
for (var _iterator = meta.source, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref3; | ||
if (typeof blockHoist === "number" && blockHoist > 0) { | ||
varDecl._blockHoist = blockHoist; | ||
} | ||
topNodes.push(varDecl); | ||
return requires[source] = ref; | ||
} | ||
function addTo(obj, key, arr) { | ||
var existing = obj[key] || []; | ||
obj[key] = existing.concat(arr); | ||
} | ||
for (var _iterator4 = body, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { | ||
var _ref4; | ||
if (_isArray4) { | ||
if (_i4 >= _iterator4.length) break; | ||
_ref4 = _iterator4[_i4++]; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref3 = _iterator[_i++]; | ||
} else { | ||
_i4 = _iterator4.next(); | ||
if (_i4.done) break; | ||
_ref4 = _i4.value; | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref3 = _i.value; | ||
} | ||
var _path2 = _ref4; | ||
var _ref4 = _ref3; | ||
var _source = _ref4[0]; | ||
var _metadata = _ref4[1]; | ||
var loadExpr = t.callExpression(t.identifier("require"), [t.stringLiteral(_source)]); | ||
var header = void 0; | ||
if (_path2.isExportDeclaration()) { | ||
hasExports = true; | ||
var _specifiers = [].concat(_path2.get("declaration"), _path2.get("specifiers")); | ||
for (var _iterator6 = _specifiers, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { | ||
var _ref6; | ||
if (_isArray6) { | ||
if (_i6 >= _iterator6.length) break; | ||
_ref6 = _iterator6[_i6++]; | ||
} else { | ||
_i6 = _iterator6.next(); | ||
if (_i6.done) break; | ||
_ref6 = _i6.value; | ||
} | ||
var _specifier4 = _ref6; | ||
var ids = _specifier4.getBindingIdentifiers(); | ||
if (ids.__esModule) { | ||
throw _specifier4.buildCodeFrameError('Illegal export "__esModule"'); | ||
} | ||
} | ||
} | ||
if (_path2.isImportDeclaration()) { | ||
var _importsEntry$specifi; | ||
hasImports = true; | ||
var key = _path2.node.source.value; | ||
var importsEntry = imports[key] || { | ||
specifiers: [], | ||
maxBlockHoist: 0, | ||
loc: _path2.node.loc | ||
}; | ||
(_importsEntry$specifi = importsEntry.specifiers).push.apply(_importsEntry$specifi, _path2.node.specifiers); | ||
if (typeof _path2.node._blockHoist === "number") { | ||
importsEntry.maxBlockHoist = Math.max(_path2.node._blockHoist, importsEntry.maxBlockHoist); | ||
} | ||
imports[key] = importsEntry; | ||
_path2.remove(); | ||
} else if (_path2.isExportDefaultDeclaration()) { | ||
var declaration = _path2.get("declaration"); | ||
if (declaration.isFunctionDeclaration()) { | ||
var id = declaration.node.id; | ||
var defNode = t.identifier("default"); | ||
if (id) { | ||
addTo(exports, id.name, defNode); | ||
topNodes.push(buildExportsAssignment(defNode, id)); | ||
_path2.replaceWith(declaration.node); | ||
} else { | ||
topNodes.push(buildExportsAssignment(defNode, t.toExpression(declaration.node))); | ||
_path2.remove(); | ||
} | ||
} else if (declaration.isClassDeclaration()) { | ||
var _id = declaration.node.id; | ||
var _defNode = t.identifier("default"); | ||
if (_id) { | ||
addTo(exports, _id.name, _defNode); | ||
_path2.replaceWithMultiple([declaration.node, buildExportsAssignment(_defNode, _id)]); | ||
} else { | ||
_path2.replaceWith(buildExportsAssignment(_defNode, t.toExpression(declaration.node))); | ||
_path2.parentPath.requeue(_path2.get("expression.left")); | ||
} | ||
} else { | ||
_path2.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node)); | ||
_path2.parentPath.requeue(_path2.get("expression.left")); | ||
} | ||
} else if (_path2.isExportNamedDeclaration()) { | ||
var _declaration = _path2.get("declaration"); | ||
if (_declaration.node) { | ||
if (_declaration.isFunctionDeclaration()) { | ||
var _id2 = _declaration.node.id; | ||
addTo(exports, _id2.name, _id2); | ||
topNodes.push(buildExportsAssignment(_id2, _id2)); | ||
_path2.replaceWith(_declaration.node); | ||
} else if (_declaration.isClassDeclaration()) { | ||
var _id3 = _declaration.node.id; | ||
addTo(exports, _id3.name, _id3); | ||
_path2.replaceWithMultiple([_declaration.node, buildExportsAssignment(_id3, _id3)]); | ||
nonHoistedExportNames[_id3.name] = true; | ||
} else if (_declaration.isVariableDeclaration()) { | ||
var _ids = _declaration.getBindingIdentifierPaths(); | ||
var exportsToInsert = []; | ||
for (var name in _ids) { | ||
var _id4 = _ids[name]; | ||
var parentPath = _id4.parentPath, | ||
node = _id4.node; | ||
addTo(exports, name, node); | ||
nonHoistedExportNames[name] = true; | ||
if (parentPath.isVariableDeclarator()) { | ||
var init = parentPath.get("init"); | ||
var assignment = buildExportsAssignment(node, init.node || _path2.scope.buildUndefinedNode()); | ||
init.replaceWith(assignment.expression); | ||
} else { | ||
exportsToInsert.push(buildExportsAssignment(node, node)); | ||
} | ||
} | ||
_path2.insertAfter(exportsToInsert); | ||
_path2.replaceWith(_declaration.node); | ||
} | ||
continue; | ||
} | ||
var _specifiers2 = _path2.get("specifiers"); | ||
var nodes = []; | ||
var _source = _path2.node.source; | ||
if (_source) { | ||
var ref = addRequire(_source.value, _path2.node._blockHoist); | ||
for (var _iterator7 = _specifiers2, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : _iterator7[Symbol.iterator]();;) { | ||
var _ref7; | ||
if (_isArray7) { | ||
if (_i7 >= _iterator7.length) break; | ||
_ref7 = _iterator7[_i7++]; | ||
} else { | ||
_i7 = _iterator7.next(); | ||
if (_i7.done) break; | ||
_ref7 = _i7.value; | ||
} | ||
var _specifier6 = _ref7; | ||
if (_specifier6.isExportNamespaceSpecifier()) {} else if (_specifier6.isExportDefaultSpecifier()) {} else if (_specifier6.isExportSpecifier()) { | ||
if (!noInterop && _specifier6.node.local.name === "default") { | ||
topNodes.push(buildExportsFrom(t.stringLiteral(_specifier6.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), _specifier6.node.local))); | ||
} else { | ||
topNodes.push(buildExportsFrom(t.stringLiteral(_specifier6.node.exported.name), t.memberExpression(ref, _specifier6.node.local))); | ||
} | ||
nonHoistedExportNames[_specifier6.node.exported.name] = true; | ||
} | ||
} | ||
} else { | ||
for (var _iterator8 = _specifiers2, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : _iterator8[Symbol.iterator]();;) { | ||
var _ref8; | ||
if (_isArray8) { | ||
if (_i8 >= _iterator8.length) break; | ||
_ref8 = _iterator8[_i8++]; | ||
} else { | ||
_i8 = _iterator8.next(); | ||
if (_i8.done) break; | ||
_ref8 = _i8.value; | ||
} | ||
var _specifier8 = _ref8; | ||
if (_specifier8.isExportSpecifier()) { | ||
addTo(exports, _specifier8.node.local.name, _specifier8.node.exported); | ||
nonHoistedExportNames[_specifier8.node.exported.name] = true; | ||
nodes.push(buildExportsAssignment(_specifier8.node.exported, _specifier8.node.local)); | ||
} | ||
} | ||
} | ||
_path2.replaceWithMultiple(nodes); | ||
} else if (_path2.isExportAllDeclaration()) { | ||
var exportNode = buildExportAll({ | ||
OBJECT: addRequire(_path2.node.source.value, _path2.node._blockHoist) | ||
}); | ||
exportNode.loc = _path2.node.loc; | ||
topNodes.push(exportNode); | ||
_path2.remove(); | ||
} | ||
} | ||
for (var source in imports) { | ||
var _imports$source = imports[source], | ||
specifiers = _imports$source.specifiers, | ||
maxBlockHoist = _imports$source.maxBlockHoist; | ||
if (specifiers.length) { | ||
var uid = addRequire(source, maxBlockHoist); | ||
var wildcard = void 0; | ||
for (var i = 0; i < specifiers.length; i++) { | ||
var specifier = specifiers[i]; | ||
if (t.isImportNamespaceSpecifier(specifier)) { | ||
if (strict || noInterop) { | ||
remaps[specifier.local.name] = uid; | ||
} else { | ||
var varDecl = t.variableDeclaration("var", [t.variableDeclarator(specifier.local, t.callExpression(this.addHelper("interopRequireWildcard"), [uid]))]); | ||
if (maxBlockHoist > 0) { | ||
varDecl._blockHoist = maxBlockHoist; | ||
} | ||
topNodes.push(varDecl); | ||
} | ||
wildcard = specifier.local; | ||
} else if (t.isImportDefaultSpecifier(specifier)) { | ||
specifiers[i] = t.importSpecifier(specifier.local, t.identifier("default")); | ||
} | ||
} | ||
for (var _iterator5 = specifiers, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { | ||
var _ref5; | ||
if (_isArray5) { | ||
if (_i5 >= _iterator5.length) break; | ||
_ref5 = _iterator5[_i5++]; | ||
} else { | ||
_i5 = _iterator5.next(); | ||
if (_i5.done) break; | ||
_ref5 = _i5.value; | ||
} | ||
var _specifier2 = _ref5; | ||
if (t.isImportSpecifier(_specifier2)) { | ||
var target = uid; | ||
if (_specifier2.imported.name === "default") { | ||
if (wildcard) { | ||
target = wildcard; | ||
} else if (!noInterop) { | ||
target = wildcard = path.scope.generateUidIdentifier(uid.name); | ||
var _varDecl = t.variableDeclaration("var", [t.variableDeclarator(target, t.callExpression(this.addHelper("interopRequireDefault"), [uid]))]); | ||
if (maxBlockHoist > 0) { | ||
_varDecl._blockHoist = maxBlockHoist; | ||
} | ||
topNodes.push(_varDecl); | ||
} | ||
} | ||
remaps[_specifier2.local.name] = t.memberExpression(target, t.cloneWithoutLoc(_specifier2.imported)); | ||
} | ||
} | ||
if ((0, _babelHelperModuleTransforms.isSideEffectImport)(_metadata)) { | ||
header = t.expressionStatement(loadExpr); | ||
} else { | ||
var requireNode = buildRequire(t.stringLiteral(source)); | ||
requireNode.loc = imports[source].loc; | ||
topNodes.push(requireNode); | ||
header = t.variableDeclaration("var", [t.variableDeclarator(t.identifier(_metadata.name), (0, _babelHelperModuleTransforms.wrapInterop)(path, loadExpr, _metadata.interop) || loadExpr)]); | ||
} | ||
} | ||
if (hasImports && Object.keys(nonHoistedExportNames).length) { | ||
var maxHoistedExportsNodeAssignmentLength = 100; | ||
var nonHoistedExportNamesArr = Object.keys(nonHoistedExportNames); | ||
var _loop = function _loop(currentExportsNodeAssignmentLength) { | ||
var nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice(currentExportsNodeAssignmentLength, currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength); | ||
var hoistedExportsNode = scope.buildUndefinedNode(); | ||
nonHoistedExportNamesChunk.forEach(function (name) { | ||
hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; | ||
}); | ||
var node = t.expressionStatement(hoistedExportsNode); | ||
node._blockHoist = 3; | ||
topNodes.unshift(node); | ||
}; | ||
for (var currentExportsNodeAssignmentLength = 0; currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength) { | ||
_loop(currentExportsNodeAssignmentLength); | ||
} | ||
header.loc = _metadata.loc; | ||
headers.push(header); | ||
headers.push.apply(headers, (0, _babelHelperModuleTransforms.buildNamespaceInitStatements)(meta, _metadata)); | ||
} | ||
if (hasExports && !strict) { | ||
var buildTemplate = buildExportsModuleDeclaration; | ||
if (this.opts.loose) { | ||
buildTemplate = buildLooseExportsModuleDeclaration; | ||
} | ||
var declar = buildTemplate(); | ||
declar._blockHoist = 3; | ||
topNodes.unshift(declar); | ||
} | ||
path.unshiftContainer("body", topNodes); | ||
path.traverse(reassignmentVisitor, { | ||
remaps: remaps, | ||
scope: scope, | ||
exports: exports, | ||
requeueInParent: function requeueInParent(newPath) { | ||
return path.requeue(newPath); | ||
} | ||
}); | ||
(0, _babelHelperModuleTransforms.ensureStatementsHoisted)(headers); | ||
path.unshiftContainer("body", headers); | ||
} | ||
@@ -526,26 +74,2 @@ } | ||
var _path3 = require("path"); | ||
var _babelTemplate = require("babel-template"); | ||
var _babelTemplate2 = _interopRequireDefault(_babelTemplate); | ||
var _babelTypes = require("babel-types"); | ||
var t = _interopRequireWildcard(_babelTypes); | ||
var _babelPluginTransformStrictMode = require("babel-plugin-transform-strict-mode"); | ||
var _babelPluginTransformStrictMode2 = _interopRequireDefault(_babelPluginTransformStrictMode); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var buildRequire = (0, _babelTemplate2.default)("\n require($0);\n"); | ||
var buildExportsModuleDeclaration = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n"); | ||
var buildExportsFrom = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, $0, {\n enumerable: true,\n get: function () {\n return $1;\n }\n });\n"); | ||
var buildLooseExportsModuleDeclaration = (0, _babelTemplate2.default)("\n exports.__esModule = true;\n"); | ||
var buildExportsAssignment = (0, _babelTemplate2.default)("\n exports.$0 = $1;\n"); | ||
var buildExportAll = (0, _babelTemplate2.default)("\n Object.keys(OBJECT).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function () {\n return OBJECT[key];\n }\n });\n });\n"); | ||
var THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"]; | ||
var _babelHelperModuleTransforms = require("babel-helper-module-transforms"); |
{ | ||
"name": "babel-plugin-transform-es2015-modules-commonjs", | ||
"version": "7.0.0-beta.0", | ||
"version": "7.0.0-beta.1", | ||
"description": "This plugin transforms ES2015 modules to CommonJS", | ||
@@ -9,5 +9,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-commonjs", | ||
"dependencies": { | ||
"babel-plugin-transform-strict-mode": "7.0.0-beta.0", | ||
"babel-template": "7.0.0-beta.0", | ||
"babel-types": "7.0.0-beta.0" | ||
"babel-helper-module-transforms": "7.0.0-beta.1", | ||
"babel-types": "7.0.0-beta.1" | ||
}, | ||
@@ -18,5 +17,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-helper-plugin-test-runner": "7.0.0-beta.0", | ||
"babel-plugin-syntax-object-rest-spread": "7.0.0-beta.0" | ||
"babel-helper-plugin-test-runner": "7.0.0-beta.1", | ||
"babel-plugin-syntax-object-rest-spread": "7.0.0-beta.1" | ||
} | ||
} |
@@ -123,6 +123,4 @@ # babel-plugin-transform-es2015-modules-commonjs | ||
var _foo = require("foo"); | ||
var _foo = _interopRequireDefault(require("foo")); | ||
var _foo2 = _interopRequireDefault(_foo); | ||
function _interopRequireDefault(obj) { | ||
@@ -129,0 +127,0 @@ return obj && obj.__esModule ? obj : { default: obj }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
2
6086
3
62
133
+ Addedbabel-code-frame@7.0.0-beta.1(transitive)
+ Addedbabel-helper-function-name@7.0.0-beta.1(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-beta.1(transitive)
+ Addedbabel-helper-module-transforms@7.0.0-beta.1(transitive)
+ Addedbabel-messages@7.0.0-beta.1(transitive)
+ Addedbabel-template@7.0.0-beta.1(transitive)
+ Addedbabel-traverse@7.0.0-beta.1(transitive)
+ Addedbabel-types@7.0.0-beta.1(transitive)
- Removedbabel-template@7.0.0-beta.0
- Removedbabel-code-frame@7.0.0-beta.0(transitive)
- Removedbabel-helper-function-name@7.0.0-beta.0(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-beta.0(transitive)
- Removedbabel-messages@7.0.0-beta.0(transitive)
- Removedbabel-plugin-transform-strict-mode@7.0.0-beta.0(transitive)
- Removedbabel-template@7.0.0-beta.0(transitive)
- Removedbabel-traverse@7.0.0-beta.0(transitive)
- Removedbabel-types@7.0.0-beta.0(transitive)
Updatedbabel-types@7.0.0-beta.1