Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
range: [0, 1],
loc: {
start: {
line: 0,
column: 0,
},
end: {
line: 0,
column: 1,
},
},
value: code,
};
// @ts-ignore
const scopeManager = new ScopeManager({});
// @ts-ignore
const globalScope = new Scope(scopeManager, 'module', null, ast, false);
preprocessNode(ast);
return {
ast,
scopeManager,
visitorKeys: KEYS,
services: {
convertNodeSourceSpanToLoc(sourceSpan: {
start: { line: number; col: any };
end: { line: number; col: any };
}) {
return {
start: {
ignoreEval: true,
optimistic: false,
directive: false,
nodejsScope:
ast.sourceType === "script" &&
(parserOptions.ecmaFeatures &&
parserOptions.ecmaFeatures.globalReturn) === true,
impliedStrict: false,
sourceType: ast.sourceType,
ecmaVersion: parserOptions.ecmaVersion,
fallback,
};
options.childVisitorKeys = childVisitorKeys;
const scopeManager = new escope.ScopeManager(options);
const referencer = new Referencer(options, scopeManager);
referencer.visit(ast);
return scopeManager;
}
const options = {
ignoreEval: true,
optimistic: false,
directive: false,
nodejsScope:
ast.sourceType === "script" &&
(parserOptions.ecmaFeatures &&
parserOptions.ecmaFeatures.globalReturn) === true,
impliedStrict: false,
sourceType: extraOptions.sourceType,
ecmaVersion: parserOptions.ecmaVersion || 2018,
childVisitorKeys,
fallback
};
const scopeManager = new escope.ScopeManager(options);
const referencer = new Referencer(options, scopeManager);
referencer.visit(ast);
return scopeManager;
};