|
|
@ -1,6 +1,7 @@
|
|
|
|
import MagicString, { Bundle } from 'magic-string';
|
|
|
|
import MagicString, { Bundle } from 'magic-string';
|
|
|
|
import { walk, childKeys } from 'estree-walker';
|
|
|
|
import { walk, childKeys } from 'estree-walker';
|
|
|
|
import { getLocator } from 'locate-character';
|
|
|
|
import { getLocator } from 'locate-character';
|
|
|
|
|
|
|
|
import detectGlobals from 'acorn-globals';
|
|
|
|
import deindent from '../utils/deindent';
|
|
|
|
import deindent from '../utils/deindent';
|
|
|
|
import CodeBuilder from '../utils/CodeBuilder';
|
|
|
|
import CodeBuilder from '../utils/CodeBuilder';
|
|
|
|
import getCodeFrame from '../utils/getCodeFrame';
|
|
|
|
import getCodeFrame from '../utils/getCodeFrame';
|
|
|
@ -414,6 +415,9 @@ export default class Generator {
|
|
|
|
scope.declarations.forEach(name => {
|
|
|
|
scope.declarations.forEach(name => {
|
|
|
|
this.userVars.add(name);
|
|
|
|
this.userVars.add(name);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
detectGlobals(js.content).forEach(({ name }) => {
|
|
|
|
|
|
|
|
this.userVars.add(name);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const body = js.content.body.slice(); // slice, because we're going to be mutating the original
|
|
|
|
const body = js.content.body.slice(); // slice, because we're going to be mutating the original
|
|
|
|
|
|
|
|
|
|
|
|