rollup-plugin-external-globals
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -14,3 +14,3 @@ const MagicString = require("magic-string"); | ||
function transform(code, id) { | ||
if (!filter(id)) { | ||
if (id[0] !== "\0" && !filter(id)) { | ||
return; | ||
@@ -17,0 +17,0 @@ } |
@@ -51,3 +51,3 @@ const {walk} = require("estree-walker"); | ||
function analyzeExportNamed(node, code, names) { | ||
function analyzeExportNamed(node, code, names, tempNames) { | ||
if (node.declaration || !node.source) { | ||
@@ -62,3 +62,6 @@ return false; | ||
} else { | ||
code.appendRight(node.start, `const ${legalName} = ${globalName};\n`); | ||
if (!tempNames.has(legalName)) { | ||
code.appendRight(node.start, `const ${legalName} = ${globalName};\n`); | ||
tempNames.add(legalName); | ||
} | ||
writeSpecLocal(code, spec, legalName); | ||
@@ -80,2 +83,3 @@ } | ||
let isTouched = false; | ||
const tempNames = new Set; | ||
@@ -86,3 +90,3 @@ for (const node of ast.body) { | ||
} else if (node.type === "ExportNamedDeclaration") { | ||
isTouched = analyzeExportNamed(node, code, names) || isTouched; | ||
isTouched = analyzeExportNamed(node, code, names, tempNames) || isTouched; | ||
} | ||
@@ -89,0 +93,0 @@ } |
{ | ||
"name": "rollup-plugin-external-globals", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Transform external imports into global variables like output.globals.", | ||
@@ -28,14 +28,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"endent": "^1.1.2", | ||
"eslint": "^5.1.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^12.0.2", | ||
"rollup": "^0.63.2", | ||
"endent": "^1.3.0", | ||
"eslint": "^5.15.3", | ||
"mocha": "^6.0.2", | ||
"nyc": "^13.3.0", | ||
"rollup": "^1.7.3", | ||
"tempdir-yaml": "^0.2.1" | ||
}, | ||
"dependencies": { | ||
"estree-walker": "^0.5.2", | ||
"is-reference": "^1.1.0", | ||
"magic-string": "^0.25.0", | ||
"rollup-pluginutils": "^2.3.0" | ||
"estree-walker": "^0.6.0", | ||
"is-reference": "^1.1.2", | ||
"magic-string": "^0.25.2", | ||
"rollup-pluginutils": "^2.5.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "peerDependencies": { |
@@ -51,2 +51,4 @@ rollup-plugin-external-globals | ||
Note that this plugin only works with import/export syntax. If you are using a module loader transformer e.g. `rollup-plugin-commonjs`, you have to put this plugin *after* the transformer plugin. | ||
API | ||
@@ -81,5 +83,13 @@ ---- | ||
Virtual modules are always transformed. | ||
Changelog | ||
--------- | ||
* 0.3.0 (Mar 25, 2019) | ||
- Fix: temporary variable name conflicts. | ||
- **Breaking: transform virtual modules.** Now the plugin transforms proxy modules generated by commonjs plugin. | ||
- Bump dependencies. | ||
* 0.2.1 (Oct 2, 2018) | ||
@@ -86,0 +96,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
9026
137
106
- Removedestree-walker@0.5.2(transitive)
Updatedestree-walker@^0.6.0
Updatedis-reference@^1.1.2
Updatedmagic-string@^0.25.2
Updatedrollup-pluginutils@^2.5.0