Comparing version 0.1.4 to 0.1.5
@@ -5,3 +5,3 @@ const cherow = require('cherow'); | ||
const asDefault = name => name === 'default' ? babelified : `exports.${name}`; | ||
const fromDefault = defaultImport => `(m => m.__esModule ? m : {default: m})(${defaultImport})`; | ||
const fromDefault = defaultImport => `(m => m.__esModule ? m.default : m)(${defaultImport})`; | ||
@@ -26,5 +26,4 @@ const replace = { | ||
imported.push( | ||
`const ${specifier.local.name} = ${fromDefault(defaultImport)}.default${EOL}` | ||
`const ${specifier.local.name} = ${fromDefault(defaultImport)}${EOL}` | ||
); | ||
defaultImport = specifier.local.name; | ||
break; | ||
@@ -147,3 +146,3 @@ case 'ImportNamespaceSpecifier': | ||
out.push(length ? code.slice(chunks[length - 1].end) : code); | ||
return out.join(''); | ||
return "'use strict';\n" + out.join(''); | ||
}; | ||
@@ -150,0 +149,0 @@ |
{ | ||
"name": "ascjs", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "ES2015 to CommonJS import/export transformer", | ||
@@ -5,0 +5,0 @@ "bin": "bin.js", |
@@ -80,4 +80,5 @@ # ascjs | ||
```js | ||
const func = (m => m.__esModule ? m : {default: m})(require('./module.js')).default; | ||
const {a, b} = func; | ||
'use strict'; | ||
const func = (m => m.__esModule ? m.default : m)(require('./module.js')); | ||
const {a, b} = require('./module.js'); | ||
const tmp = require('other'); | ||
@@ -84,0 +85,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
94
11838
225