Skip to main content
This release is 2 versions behind 0.13.1 — the latest version of @unplugin/ast. Jump to latest

@unplugin/ast@0.12.0
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
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
It is unknown whether this package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
88%
Published
2 months ago (0.12.0)
interface Transformer

Type Parameters

T extends Node = Node

Properties

optional
transformInclude: (id: string) => Awaitable<boolean>
optional
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
>
optional
finalize: (s: MagicStringAST) => Awaitable<void>

Add Package

deno add jsr:@unplugin/ast

Import symbol

import { type Transformer } from "@unplugin/ast/index";

---- OR ----

Import directly with a jsr specifier

import { type Transformer } from "jsr:@unplugin/ast/index";

Add Package

npx jsr add @unplugin/ast

Import symbol

import { type Transformer } from "@unplugin/ast/index";

Add Package

yarn dlx jsr add @unplugin/ast

Import symbol

import { type Transformer } from "@unplugin/ast/index";

Add Package

pnpm dlx jsr add @unplugin/ast

Import symbol

import { type Transformer } from "@unplugin/ast/index";

Add Package

bunx jsr add @unplugin/ast

Import symbol

import { type Transformer } from "@unplugin/ast/index";