This release is 3 versions behind 0.14.0 — the latest version of @unplugin/ast. Jump to latest
Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
Manipulate the AST to transform your code.
This package works with Node.js, BunIt is unknown whether this package works with Cloudflare Workers, Deno, Browsers




JSR Score
88%
Published
2 months ago (0.12.0)
import type { Awaitable } from 'npm:@antfu/utils@^0.7.10' import type { Node } from 'npm:@babel/types@^7.26.0' import type { MagicStringAST } from 'npm:magic-string-ast@^0.6.3' export interface TransformerParsed { transformer: Transformer nodes: { node: NodeRef<Node | undefined> }[] } export interface NodeRef<T = Node> { value: T set: (node: T) => void } export interface Transformer<T extends Node = Node> { transformInclude?: (id: string) => Awaitable<boolean> onNode?: | (( node: Node, parent: Node | null | undefined, index: number | null | undefined, ) => Awaitable<boolean>) | (( node: Node, parent: Node | null | undefined, index: number | null | undefined, ) => node is T) transform: ( node: T, code: string, context: { id: string }, ) => Awaitable<string | Node | false | undefined | null> finalize?: (s: MagicStringAST) => Awaitable<void> }