diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js')
-rw-r--r-- | node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js b/node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js index 2fcce5090..04f017474 100644 --- a/node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js +++ b/node_modules/babel-plugin-transform-es2015-modules-commonjs/lib/index.js @@ -29,15 +29,19 @@ exports.default = function () { if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; + var replacement = t.cloneDeep(remap); + + replacement.loc = path.node.loc; + 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.sequenceExpression([t.numericLiteral(0), replacement])); + } else if (path.isJSXIdentifier() && t.isMemberExpression(replacement)) { + var object = replacement.object, + property = replacement.property; path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name))); } else { - path.replaceWith(remap); + path.replaceWith(replacement); } this.requeueInParent(path); }, @@ -515,7 +519,7 @@ exports.default = function () { topNodes.push(_varDecl); } } - remaps[_specifier.local.name] = t.memberExpression(target, t.cloneWithoutLoc(_specifier.imported)); + remaps[_specifier.local.name] = t.memberExpression(t.cloneWithoutLoc(target), t.cloneWithoutLoc(_specifier.imported)); } } } else { |