Socket
Socket
Sign inDemoInstall

es6-module-transpiler-amd-formatter

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-module-transpiler-amd-formatter - npm Package Compare versions

Comparing version 0.1.2 to 0.2.2

37

index.js

@@ -137,32 +137,19 @@ /* jshint node:true, undef:true, unused:true */

AMDFormatter.prototype.defaultExport = function(mod, declaration) {
if (n.FunctionExpression.check(declaration)) {
// export default function <name> () {}
if (!declaration.id) {
// anonymous functionDeclaration
return [b.expressionStatement(
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), b.functionExpression(null, declaration.params, declaration.body)])
)];
} else {
// named functionDeclaration
return [
b.functionDeclaration(declaration.id, declaration.params, declaration.body),
b.expressionStatement(
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), declaration.id])
)
];
}
} else if (n.VariableDeclaration.check(declaration)) {
// export default var foo = 1, bar = 2;
if (n.FunctionDeclaration.check(declaration) ||
n.ClassDeclaration.check(declaration)) {
// export default function foo () {}
// -> becomes:
// function foo () {}
// __es6_export__('default', foo);
return [
b.variableDeclaration('var', declaration.declarations),
declaration,
b.expressionStatement(
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), declaration.declarations[0].id])
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), declaration.id])
)
];
} else {
// export default {foo: 1};
return [b.expressionStatement(
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), declaration])
)];
}
// export default {foo: 1};
return [b.expressionStatement(
b.callExpression(b.identifier('__es6_export__'), [b.literal("default"), declaration])
)];
};

@@ -169,0 +156,0 @@

{
"name": "es6-module-transpiler-amd-formatter",
"version": "0.1.2",
"version": "0.2.2",
"description": "ES6 Module Transpiler Extension to Output AMD define() Format.",

@@ -26,7 +26,7 @@ "author": "Caridy Patino <caridy@gmail.com>",

"dependencies": {
"recast": "^0.7.2"
"recast": "~0.8.0"
},
"devDependencies": {
"requirejs": "^2.1.14",
"es6-module-transpiler": "^0.8.0",
"es6-module-transpiler": "~0.8.2",
"chai": "~1.8.1",

@@ -33,0 +33,0 @@ "mocha": "~1.15.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc