es6-module-crosspiler
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -27,3 +27,8 @@ | ||
if (node.default) { | ||
var id = node._varname = this.sourceToVariableName('default') | ||
var id | ||
if (n.FunctionExpression.check(declaration) && declaration.id) { | ||
id = node._varname = declaration.id.name | ||
} else { | ||
id = node._varname = this.sourceToVariableName('default') | ||
} | ||
exports.push([id, 'default']) | ||
@@ -74,10 +79,15 @@ return | ||
visitExportDeclaration: function (path) { | ||
var declaration = path.node.declaration | ||
if (path.node.default) { | ||
// remove `export default`s | ||
path.replace(b.variableDeclaration('var', [ | ||
b.variableDeclarator( | ||
b.identifier(path.node._varname), | ||
path.node.declaration | ||
) | ||
])) | ||
if (n.FunctionExpression.check(declaration) && declaration.id) { | ||
path.replace(b.functionDeclaration(declaration.id, declaration.params, declaration.body)) | ||
} else { | ||
path.replace(b.variableDeclaration('var', [ | ||
b.variableDeclarator( | ||
b.identifier(path.node._varname), | ||
declaration | ||
) | ||
])) | ||
} | ||
} else if (path.node.specifiers) { | ||
@@ -88,3 +98,3 @@ // remove `export { x, y }`s | ||
// remove the `export` from `export <expression>` | ||
path.replace(path.node.declaration) | ||
path.replace(declaration) | ||
} | ||
@@ -91,0 +101,0 @@ |
{ | ||
"name": "es6-module-crosspiler", | ||
"description": "An ES6 and CommonJS cross-compatible transpiler", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Jonathan Ong", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20790
478