xnr
Version:
Easily, quickly and reliably run a Node.js script from the CLI.
16 lines (15 loc) • 753 B
TypeScript
import { AnyNode, Literal } from "acorn";
export declare const getStringNodeValue: (node: AnyNode | null | undefined) => string | undefined;
export declare const replaceNode: (nodeToReplace: AnyNode, replacement: AnyNode) => void;
export declare const asLiteral: (value: string) => Literal & {
value: string;
raw: string;
};
export declare const isCreateRequire: (node: AnyNode) => boolean;
export declare const isRequire: (node: AnyNode) => boolean;
export declare const isRequireMainRequire: (node: AnyNode) => boolean;
export declare const isNodeStringLiteral: (node: AnyNode | null | undefined) => node is Literal & {
value: string;
raw: string;
};
export declare const determineModuleTypeFromAST: (ast: AnyNode) => ".mjs" | ".cjs";