@babel/helper-module-transforms
Advanced tools
Comparing version
@@ -178,3 +178,3 @@ "use strict"; | ||
const getTemplateForReexport = loose => { | ||
return loose ? _template.default.statement`EXPORTS.EXPORT_NAME = NAMESPACE.IMPORT_NAME;` : _template.default` | ||
return loose ? _template.default.statement`EXPORTS.EXPORT_NAME = NAMESPACE.IMPORT_NAME;` : (0, _template.default)` | ||
Object.defineProperty(EXPORTS, "EXPORT_NAME", { | ||
@@ -235,3 +235,3 @@ enumerable: true, | ||
EXPORTS: metadata.exportName, | ||
VERIFY_NAME_LIST: metadata.exportNameListName ? _template.default` | ||
VERIFY_NAME_LIST: metadata.exportNameListName ? (0, _template.default)` | ||
if (Object.prototype.hasOwnProperty.call(EXPORTS_LIST, key)) return; | ||
@@ -238,0 +238,0 @@ `({ |
@@ -251,3 +251,43 @@ "use strict"; | ||
}, | ||
"ForOfStatement|ForInStatement"(path) { | ||
const { | ||
scope, | ||
node | ||
} = path; | ||
const { | ||
left | ||
} = node; | ||
const { | ||
exported, | ||
scope: programScope | ||
} = this; | ||
if (!t.isVariableDeclaration(left)) { | ||
let didTransform = false; | ||
const bodyPath = path.get("body"); | ||
const loopBodyScope = bodyPath.scope; | ||
for (const name of Object.keys(t.getOuterBindingIdentifiers(left))) { | ||
if (exported.get(name) && programScope.getBinding(name) === scope.getBinding(name)) { | ||
didTransform = true; | ||
if (loopBodyScope.hasOwnBinding(name)) { | ||
loopBodyScope.rename(name); | ||
} | ||
} | ||
} | ||
if (!didTransform) { | ||
return; | ||
} | ||
const newLoopId = scope.generateUidIdentifierBasedOnNode(left); | ||
bodyPath.unshiftContainer("body", t.expressionStatement(t.assignmentExpression("=", left, newLoopId))); | ||
path.get("left").replaceWith(t.variableDeclaration("let", [t.variableDeclarator(newLoopId)])); | ||
scope.registerDeclaration(path.get("left")); | ||
} | ||
} | ||
}; |
@@ -8,2 +8,4 @@ "use strict"; | ||
var _helperReplaceSupers = require("@babel/helper-replace-supers"); | ||
function rewriteThis(programPath) { | ||
@@ -19,7 +21,7 @@ programPath.traverse(rewriteThisVisitor); | ||
Function(path) { | ||
if (!path.isArrowFunctionExpression()) path.skip(); | ||
if (path.isMethod()) (0, _helperReplaceSupers.skipAllButComputedKey)(path);else if (!path.isArrowFunctionExpression()) path.skip(); | ||
}, | ||
ClassProperty(path) { | ||
path.skip(); | ||
(0, _helperReplaceSupers.skipAllButComputedKey)(path); | ||
}, | ||
@@ -26,0 +28,0 @@ |
{ | ||
"name": "@babel/helper-module-transforms", | ||
"version": "7.8.3", | ||
"version": "7.8.6", | ||
"description": "Babel helper functions for implementing ES6 module transformations", | ||
@@ -15,9 +15,10 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>", | ||
"@babel/helper-module-imports": "^7.8.3", | ||
"@babel/helper-replace-supers": "^7.8.6", | ||
"@babel/helper-simple-access": "^7.8.3", | ||
"@babel/helper-split-export-declaration": "^7.8.3", | ||
"@babel/template": "^7.8.3", | ||
"@babel/types": "^7.8.3", | ||
"@babel/template": "^7.8.6", | ||
"@babel/types": "^7.8.6", | ||
"lodash": "^4.17.13" | ||
}, | ||
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017" | ||
"gitHead": "750d3dde3bd2d390819820fd22c05441da78751b" | ||
} |
32657
4.23%819
4.33%7
16.67%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
Updated
Updated