rollup-plugin-external-globals
Advanced tools
Comparing version
@@ -33,3 +33,3 @@ const MagicString = require("magic-string"); | ||
function transform(code, id) { | ||
async function transform(code, id) { | ||
if ((id[0] !== "\0" && !filter(id)) || (isGlobalsObj && Object.keys(globals).every(id => !code.includes(id)))) { | ||
@@ -40,3 +40,3 @@ return; | ||
code = new MagicString(code); | ||
const isTouched = importToGlobals({ | ||
const isTouched = await importToGlobals({ | ||
ast, | ||
@@ -43,0 +43,0 @@ code, |
@@ -1,5 +0,12 @@ | ||
const {walk} = require("estree-walker"); | ||
const isReference = require("is-reference"); | ||
const {attachScopes, makeLegalIdentifier} = require("@rollup/pluginutils"); | ||
let walk, isReference; | ||
async function prepare() { | ||
[{walk}, {default: isReference}] = await Promise.all([ | ||
import("estree-walker"), | ||
import("is-reference") | ||
]); | ||
} | ||
function analyzeImport(node, importBindings, code, getName, globals) { | ||
@@ -97,3 +104,4 @@ const name = node.source.value && getName(node.source.value); | ||
function importToGlobals({ast, code, getName, getDynamicWrapper}) { | ||
async function importToGlobals({ast, code, getName, getDynamicWrapper}) { | ||
await prepare(); | ||
let scope = attachScopes(ast, "scope"); | ||
@@ -100,0 +108,0 @@ const bindings = new Map; |
{ | ||
"name": "rollup-plugin-external-globals", | ||
"version": "0.6.1", | ||
"version": "0.7.1", | ||
"description": "Transform external imports into global variables like output.globals.", | ||
@@ -28,18 +28,18 @@ "keywords": [ | ||
"devDependencies": { | ||
"c8": "^7.3.4", | ||
"endent": "^2.0.1", | ||
"eslint": "^7.11.0", | ||
"mocha": "^8.2.0", | ||
"rollup": "^2.32.0", | ||
"c8": "^7.12.0", | ||
"endent": "^2.1.0", | ||
"eslint": "^8.28.0", | ||
"mocha": "^10.1.0", | ||
"rollup": "^3.3.0", | ||
"tempdir-yaml": "^0.3.0" | ||
}, | ||
"dependencies": { | ||
"@rollup/pluginutils": "^4.0.0", | ||
"estree-walker": "^2.0.1", | ||
"is-reference": "^1.2.1", | ||
"magic-string": "^0.25.7" | ||
"@rollup/pluginutils": "^5.0.2", | ||
"estree-walker": "^3.0.1", | ||
"is-reference": "^3.0.0", | ||
"magic-string": "^0.26.7" | ||
}, | ||
"peerDependencies": { | ||
"rollup": "^2.25.0" | ||
"rollup": "^2.25.0 || ^3.3.0" | ||
} | ||
} |
rollup-plugin-external-globals | ||
============================== | ||
[](https://travis-ci.com/eight04/rollup-plugin-external-globals) | ||
[](https://github.com/eight04/rollup-plugin-external-globals/actions/workflows/test.yml) | ||
[](https://codecov.io/gh/eight04/rollup-plugin-external-globals) | ||
@@ -125,2 +125,6 @@ [](https://packagephobia.now.sh/result?p=rollup-plugin-external-globals) | ||
* 0.7.0 (Nov 21, 2022) | ||
- **Breaking: bump to rollup@3.** | ||
* 0.6.1 (Oct 21, 2020) | ||
@@ -127,0 +131,0 @@ |
12538
0.2%197
3.14%171
2.4%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated