Comparing version 0.3.11 to 0.3.12
@@ -152,3 +152,3 @@ var acorn = require('acorn'); | ||
// Special case - `export var foo = 'bar'` | ||
if ( isVarDeclaration( node.declaration ) ) { | ||
if ( name = getDeclarationName( node.declaration ) ) { | ||
if ( options.defaultOnly ) { | ||
@@ -158,4 +158,2 @@ throw new Error( 'A named export was used in defaultOnly mode' ); | ||
name = node.declaration.declarations[0].id.name; | ||
declaration = value + '\n' + indent; | ||
@@ -203,5 +201,10 @@ declaration += 'exports.' + name + ' = ' + name; | ||
function isVarDeclaration ( node ) { | ||
// TODO support let and class declarations, once Acorn supports them | ||
return node.type === 'VariableDeclaration'; | ||
function getDeclarationName ( declaration ) { | ||
if ( declaration.type === 'VariableDeclaration' ) { | ||
return declaration.declarations[0].id.name; | ||
} | ||
if ( declaration.type === 'FunctionDeclaration' ) { | ||
return declaration.id.name; | ||
} | ||
} | ||
@@ -208,0 +211,0 @@ |
{ | ||
"name": "esperanto", | ||
"description": "An easier way to convert ES6 modules to AMD and CommonJS", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"author": "Rich Harris", | ||
@@ -11,14 +11,14 @@ "dependencies": { | ||
"devDependencies": { | ||
"promo": "~0.1.1", | ||
"colors": "~0.6.2", | ||
"glob": "~4.0.5", | ||
"rimraf": "~2.2.8", | ||
"mkdirp": "~0.5.0", | ||
"gobble": "~0.2.0", | ||
"gobble-requirejs": "~0.1.0", | ||
"gobble": "^0.5.11", | ||
"gobble-amdclean": "~0.1.0", | ||
"gobble-esperanto": "~0.1.0", | ||
"gobble-jsbeautify": "~0.1.0", | ||
"gobble-esperanto": "~0.1.0", | ||
"gobble-requirejs": "~0.1.0", | ||
"gobble-uglifyjs": "^0.1.0", | ||
"mkdirp": "~0.5.0", | ||
"promise-map-series": "~0.2.0", | ||
"colors": "~0.6.2", | ||
"gobble-uglifyjs": "^0.1.0" | ||
"promo": "~0.1.1", | ||
"rimraf": "~2.2.8" | ||
}, | ||
@@ -25,0 +25,0 @@ "files": [ |
14569
285