diff --git a/lib/6to5/transformation/modules/common.js b/lib/6to5/transformation/modules/common.js index cceb8fd833..b4950484b3 100644 --- a/lib/6to5/transformation/modules/common.js +++ b/lib/6to5/transformation/modules/common.js @@ -10,7 +10,8 @@ function CommonJSFormatter(file) { CommonJSFormatter.prototype.import = function (node, nodes) { // import "foo"; nodes.push(util.template("require", { - inherits: node, + //inherits: node, + MODULE_NAME: node.source.raw }, true)); }; @@ -29,7 +30,7 @@ CommonJSFormatter.prototype.importSpecifier = function (specifier, node, nodes) if (specifier.type !== "ImportBatchSpecifier") templateName += "-key"; nodes.push(util.template(templateName, { - inherits: node.specifiers.length === 1 && node, + //inherits: node.specifiers.length === 1 && node, VARIABLE_NAME: variableName, MODULE_NAME: node.source.raw, @@ -51,7 +52,7 @@ CommonJSFormatter.prototype.export = function (node, nodes) { } nodes.push(util.template("exports-default", { - inherits: node, + //inherits: node, VALUE: ref }, true)); @@ -59,11 +60,11 @@ CommonJSFormatter.prototype.export = function (node, nodes) { var assign; if (t.isVariableDeclaration(declar)) { - var decl = declar.declarations[0] + var decl = declar.declarations[0]; if (decl.init) { decl.init = util.template("exports-assign", { - inherits: node, + //inherits: node, VALUE: decl.init, KEY: decl.id @@ -73,7 +74,7 @@ CommonJSFormatter.prototype.export = function (node, nodes) { nodes.push(declar); } else { assign = util.template("exports-assign", { - inherits: node, + //inherits: node, VALUE: declar.id, KEY: declar.id @@ -99,14 +100,14 @@ CommonJSFormatter.prototype._exportSpecifier = function (getRef, specifier, node if (t.isExportBatchSpecifier(specifier)) { // export * from "foo"; nodes.push(util.template("exports-wildcard", { - inherits: inherits, + //inherits: inherits, OBJECT: getRef() }, true)); } else { // export { foo } from "test"; nodes.push(util.template("exports-assign-key", { - inherits: inherits, + //inherits: inherits, VARIABLE_NAME: variableName.name, OBJECT: getRef(), @@ -116,7 +117,7 @@ CommonJSFormatter.prototype._exportSpecifier = function (getRef, specifier, node } else { // export { foo }; nodes.push(util.template("exports-assign", { - inherits: inherits, + //inherits: inherits, VALUE: specifier.id, KEY: variableName diff --git a/lib/6to5/transformation/modules/ignore.js b/lib/6to5/transformation/modules/ignore.js index f601016c9c..28fbb4e026 100644 --- a/lib/6to5/transformation/modules/ignore.js +++ b/lib/6to5/transformation/modules/ignore.js @@ -16,7 +16,7 @@ IgnoreFormatter.prototype.importSpecifier = function () { IgnoreFormatter.prototype.export = function (node, nodes) { var declar = t.toStatement(node.declaration, true); - if (declar) nodes.push(declar); + if (declar) nodes.push(t.inherits(declar, node)); }; IgnoreFormatter.prototype.exportSpecifier = function () {