UNPKG

@builder.io/mitosis

Version:

Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io

28 lines (27 loc) 988 B
import { types } from '@babel/core'; export type ReplaceTo = string | ((accessedProperty: string, matchedIdentifier: string) => string) | null; type ReplaceArgs = { code: string; from: string | string[]; to: ReplaceTo; }; export type NodeMap = { from: types.Node; condition?: (path: babel.NodePath<types.Node>) => boolean; to: types.Node; }; /** * @deprecated Use `replaceNodes` instead. */ export declare const replaceIdentifiers: ({ code, from, to }: ReplaceArgs) => string; export declare const replaceStateIdentifier: (to: ReplaceArgs['to']) => (code: string) => string; export declare const replacePropsIdentifier: (to: ReplaceArgs['to']) => (code: string) => string; /** * Replaces all instances of a Babel AST Node with a new Node within a code string. * Uses `generate()` to convert the Node to a string and compare them. */ export declare const replaceNodes: ({ code, nodeMaps }: { code: string; nodeMaps: NodeMap[]; }) => string; export {};