UNPKG

astx

Version:

super powerful structural search and replace for JavaScript and TypeScript to automate your refactoring

20 lines (19 loc) 743 B
import { Node, NodePath, Debugger } from '../types'; import { Backend } from '../backend/Backend'; export interface ReplaceableMatch { captures?: Record<string, Node>; arrayCaptures?: Record<string, Node[]>; stringCaptures?: Record<string, string>; } export interface CompiledReplacement { generate: (match: ReplaceableMatch) => Node | Node[]; } export declare type RootCompileReplacementOptions = { debug?: Debugger; backend: Backend; }; export declare type CompileReplacementOptions = { debug: Debugger; backend: Backend; }; export default function compileReplacement(pattern: NodePath | NodePath<Node, Node[]> | NodePath[], rootCompileReplacementOptions: RootCompileReplacementOptions): CompiledReplacement;