@nodesecure/js-x-ray
Version:
JavaScript AST XRay analysis
24 lines • 902 B
TypeScript
import type { ESTree } from "meriyah";
export interface SplitResult {
/**
* A virtual variable name that replaces the require() call
*/
virtualIdentifier: string;
/**
* Virtual variable declaration: const __virtual_require_0__ = require("xxx")
* Can be walked with standard ESTree walkers.
*/
virtualDeclaration: ESTree.VariableDeclaration;
/**
* The rebuilt expression with require() replaced by the virtual identifier.
* For `require("x").spawn("y")`, this would be `__virtual_require_0__.spawn("y")`
* Can be walked with standard ESTree walkers.
*/
rebuildExpression: ESTree.Node | null;
}
export declare class InlinedRequire {
static assertNode(node: ESTree.Node): node is ESTree.CallExpression;
static split(expectedCallExpr: ESTree.Node): SplitResult | null;
}
//# sourceMappingURL=InlinedRequire.d.ts.map