es6-module-crosspiler
Advanced tools
Comparing version 0.0.0 to 0.0.2
@@ -27,4 +27,4 @@ | ||
if (node.default) { | ||
if (declaration.type !== 'Identifier') throw new Error('wtf') | ||
exports.push([declaration.name, 'default']) | ||
var id = node._varname = this.sourceToVariableName('default') | ||
exports.push([id, 'default']) | ||
return | ||
@@ -60,3 +60,3 @@ } | ||
throw new Error('wtf') | ||
}) | ||
}, this) | ||
@@ -77,3 +77,8 @@ if (!exports.length) return // nothing to export | ||
// remove `export default`s | ||
path.replace() | ||
path.replace(b.variableDeclaration('var', [ | ||
b.variableDeclarator( | ||
b.identifier(path.node._varname), | ||
path.node.declaration | ||
) | ||
])) | ||
} else if (path.node.specifiers) { | ||
@@ -80,0 +85,0 @@ // remove `export { x, y }`s |
@@ -20,2 +20,15 @@ | ||
Module.prototype.inspect = function () { | ||
return this.toJSON() | ||
} | ||
Module.prototype.toJSON = function () { | ||
return { | ||
type: this.type, | ||
default: this.default, | ||
dependencies: this.dependencies, | ||
renames: this.renames, | ||
} | ||
} | ||
Module.prototype.rename = function (from, to) { | ||
@@ -22,0 +35,0 @@ this.renames[from] = to |
{ | ||
"name": "es6-module-crosspiler", | ||
"description": "An ES6 and CommonJS cross-compatible transpiler", | ||
"version": "0.0.0", | ||
"version": "0.0.2", | ||
"author": { | ||
@@ -38,3 +38,5 @@ "name": "Jonathan Ong", | ||
"main": "lib", | ||
"files": ["lib"] | ||
"files": [ | ||
"lib" | ||
] | ||
} |
@@ -209,2 +209,6 @@ | ||
#### .requires[] | ||
Get the raw AST `require()` nodes. | ||
#### .renameRequires() | ||
@@ -211,0 +215,0 @@ |
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
19546
438
231