|
123456789101112131415161718192021222324252627282930313233343536 |
- import { Program, Node, CallExpression, Literal, TemplateLiteral, ObjectExpression, ObjectMethod, ObjectProperty, Function } from '@babel/types';
- import { ParserOptions } from '@babel/parser';
-
- declare function babelParse(code: string, lang?: string, options?: ParserOptions): Program;
- declare function isCallOf(node: Node | null | undefined, test: string | string[] | ((id: string) => boolean)): node is CallExpression;
- declare function checkInvalidScopeReference(node: Node | undefined, method: string, setupBindings: string[]): void;
- declare function isStaticExpression(node: Node, options?: Partial<Record<'object' | 'fn' | 'objectMethod' | 'array' | 'unary', boolean> & {
- magicComment?: string;
- }>): boolean;
- declare function isLiteralType(node: Node): node is Literal;
- declare function resolveTemplateLiteral(node: TemplateLiteral): string;
- declare function resolveLiteral(node: Literal): string | number | boolean | null | RegExp | bigint;
- declare function isStaticObjectKey(node: ObjectExpression): boolean;
- /**
- * @param node must be a static expression, SpreadElement is not supported
- */
- declare function resolveObjectExpression(node: ObjectExpression): Record<string | number, ObjectMethod | ObjectProperty> | undefined;
- declare function resolveObjectKey(node: Node, computed?: boolean, raw?: true): string;
- declare function resolveObjectKey(node: Node, computed: boolean | undefined, raw: false): string | number;
- declare function walkAST<T = Node>(node: T, options: {
- enter?: (this: {
- skip: () => void;
- remove: () => void;
- replace: (node: T) => void;
- }, node: T, parent: T, key: string, index: number) => void;
- leave?: (this: {
- skip: () => void;
- remove: () => void;
- replace: (node: T) => void;
- }, node: T, parent: T, key: string, index: number) => void;
- }): T;
- declare function isFunctionType(node: Node): node is Function;
- declare const TS_NODE_TYPES: string[];
- declare function unwrapTSNode(node: Node): Node;
-
- export { TS_NODE_TYPES, babelParse, checkInvalidScopeReference, isCallOf, isFunctionType, isLiteralType, isStaticExpression, isStaticObjectKey, resolveLiteral, resolveObjectExpression, resolveObjectKey, resolveTemplateLiteral, unwrapTSNode, walkAST };
|