UNPKG

astx

Version:

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

25 lines (24 loc) 961 B
import { Statement, Expression, Location, Comment } from '../types'; import { Backend } from '../backend/Backend'; import * as defaultRecast from 'recast'; import * as AstTypes from 'ast-types'; import * as k from 'ast-types/gen/kinds'; declare type Node = k.NodeKind; export default class RecastBackend extends Backend<Node> { readonly wrapped: Backend; readonly t: typeof AstTypes; readonly parse: (code: string) => Node; readonly parseExpression: (code: string) => Expression; readonly parseStatements: (code: string) => Statement[]; readonly generate: (node: Node) => { code: string; }; readonly location: (node: Node) => Location; readonly comments: (node: Node, kind?: 'leading' | 'trailing' | 'inner') => Iterable<Comment>; constructor({ wrapped, recast, parseOptions, }: { wrapped: Backend; recast?: typeof defaultRecast; parseOptions?: defaultRecast.Options; }); } export {};