/** * WASM compatibility shim for @ast-grep/napi. * * This module is aliased in place of @ast-grep/napi during the esbuild lite build. * It re-exports the same API surface that ast-grep-query.ts uses, backed by * @ast-grep/wasm instead of native NAPI bindings. * * NOT imported in the normal build — only used via esbuild alias in the lite binary. */ /** * Compatible NapiConfig type — ast-grep compound rule config. * The WASM API accepts the same shape as `any` matcher argument. */ export type NapiConfig = { rule: Record; constraints?: Record>; language?: string; utils?: Record>; }; /** * Mimics the @ast-grep/napi Lang enum. * The WASM API uses plain strings; the napi API uses a numeric enum. * This object provides the same property names with string values. * * Note: In the lite build, only TypeScript, Tsx, and JavaScript are * registered. Html and Css are included for type compatibility but * will throw at runtime (no parsers registered). */ export declare const Lang: { readonly TypeScript: "typescript"; readonly Tsx: "tsx"; readonly JavaScript: "javascript"; readonly Html: "html"; readonly Css: "css"; }; export type Lang = (typeof Lang)[keyof typeof Lang]; /** * Initialize the WASM runtime and register JS/TS language parsers. * Must be called (and awaited) before the first `parse()` call. * Safe to call multiple times — initialization happens only once. */ export declare function ensureInit(): Promise; export type { SgNode, SgRoot } from '@ast-grep/wasm'; /** * Parse source code into an AST. * Matches the @ast-grep/napi signature: parse(lang: Lang, src: string) => SgRoot * * The lang parameter accepts a Lang enum value (string). * Unlike @ast-grep/napi which uses numeric enums, the WASM API uses strings. */ export declare function parse(lang: Lang | string, src: string): import('@ast-grep/wasm').SgRoot; //# sourceMappingURL=ast-grep-wasm-shim.d.ts.map