es6-module-transpiler-amd-formatter
Advanced tools
Comparing version 0.2.2 to 0.2.3
46
index.js
@@ -11,11 +11,2 @@ /* jshint node:true, undef:true, unused:true */ | ||
function sourcePosition(mod, node) { | ||
var loc = node && node.loc; | ||
if (loc) { | ||
return mod.relativePath + ':' + loc.start.line + ':' + (loc.start.column + 1); | ||
} else { | ||
return mod.relativePath; | ||
} | ||
} | ||
/** | ||
@@ -332,14 +323,29 @@ * The 'YUI.add' setting for referencing exports aims to produce code that can | ||
mod.imports.names.forEach(function (name) { | ||
var importDeclaration = mod.imports.findSpecifierByName(name), | ||
id = mod.getModule(importDeclaration.declaration.node.source.value).id; | ||
var specifier = mod.imports.findSpecifierByName(name), | ||
id = mod.getModule(specifier.declaration.node.source.value).id; | ||
prelude.push(b.variableDeclaration('var', [b.identifier(importDeclaration.name)])); | ||
prelude.push(b.expressionStatement(b.assignmentExpression("=", | ||
b.identifier(importDeclaration.name), | ||
b.memberExpression( | ||
b.identifier(id), | ||
b.literal(importDeclaration.from), | ||
true | ||
) | ||
))); | ||
if (!specifier) { | ||
return null; | ||
} | ||
prelude.push(b.variableDeclaration('var', [b.identifier(specifier.name)])); | ||
if (specifier.from) { | ||
// import { value } from './a'; | ||
// import a from './a'; | ||
prelude.push(b.expressionStatement(b.assignmentExpression("=", | ||
b.identifier(specifier.name), | ||
b.memberExpression( | ||
b.identifier(id), | ||
b.literal(specifier.from), | ||
true | ||
) | ||
))); | ||
} else { | ||
// import * as a from './a' | ||
prelude.push(b.expressionStatement(b.assignmentExpression("=", | ||
b.identifier(specifier.name), | ||
b.identifier(id) | ||
))); | ||
} | ||
}); | ||
@@ -346,0 +352,0 @@ |
{ | ||
"name": "es6-module-transpiler-amd-formatter", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "ES6 Module Transpiler Extension to Output AMD define() Format.", | ||
@@ -30,3 +30,3 @@ "author": "Caridy Patino <caridy@gmail.com>", | ||
"requirejs": "^2.1.14", | ||
"es6-module-transpiler": "~0.8.2", | ||
"es6-module-transpiler": "~0.9.0", | ||
"chai": "~1.8.1", | ||
@@ -33,0 +33,0 @@ "mocha": "~1.15.1", |
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
19195
422