The transmute function; star of the library. See Transmute.
const transmute: Transmute;The interface of the transmute function, which has 4 different call signatures.
interface Transmute {
(code: string, transform: (ast: AST) => Promise<void>): Promise<Result>;
(
code: string,
options: Options,
transform: (ast: types.Node) => Promise<void>,
): Promise<Result>;
(code: string, transform: (ast: AST) => void): Result;
(
code: string,
options: Options,
transform: (ast: types.Node) => void,
): Result;
}Parses code into an AST, then passes that to transform, which is
expected to mutate the AST somehow.
Once the Promise returned by transform has resolved, it converts the AST
back into a string, and returns you a Result, which has
the transformed string on it as its code property.
(code: string, transform: (ast: AST) => Promise<void>): Promise<Result>;Parses code into an AST, then passes that to transform, which is
expected to mutate the AST somehow.
Once the Promise returned by transform has resolved, it converts the AST
back into a string, and returns you a Result, which has
the transformed string on it as its code property.
The contents of options will determine what syntax options to use to
parse the code, and whether to consume/generate source maps. See
Options for more details.
(code: string, options: Options, transform: (ast: types.Node) => Promise<void>): Promise<Result>;Parses code into an AST, then passes that to transform, which
is expected to mutate the AST somehow.
Then, it converts the AST back into a string, and returns you a
Result, which has the transformed string on it as its
code property.
(code: string, transform: (ast: AST) => void): Result;Parses code into an AST, then passes that to transform, which is
expected to mutate the AST somehow.
Then, it converts the AST back into a string, and returns you a
Result, which has the transformed string on it as its
code property.
The contents of options will determine what syntax options to use to
parse the code, and whether to consume/generate source maps. See
Options for more details.
(code: string, options: Options, transform: (ast: types.Node) => void): Result;Parser (code-to-AST) function used by transmute. See parse.
export { parse };Type of the parse function. See Parse.
export { Parse };Printer (AST-to-code) function used by transmute. See print.
export { print };Re-export of @babel/traverse's default export.
export { traverse };Contains the named exports of both @babel/types and @babel/traverse.
export { types };Re-export of @babel/template's default export.
export { template };Type returned by parse. See AST.
export { type AST };Type used by transmute, parse, and print. See Options.
export { type Options };Type returned by print. See Result.
export { type Result };AST node cloner utility function. See clone.
export { clone };Deep object property comparison checker utility function. See hasShape.
export { hasShape };Bulk file content transform utility functions. See mapFiles.fromPaths.
export { mapFiles };