import { createRequire } from "node:module"; import type { GrammarArtifact } from "./types.js"; export interface NativeTree { readonly rootNode: { readonly type: string; readonly hasError: boolean; readonly endIndex: number; readonly startIndex?: number; walk?(): NativeTreeCursor; }; delete(): void; } export interface NativeTreeCursor { delete(): void; } export interface NativeQueryNode { readonly type: string; readonly startIndex: number; readonly endIndex: number; readonly namedChildren?: readonly NativeQueryNode[]; readonly children?: readonly NativeQueryNode[]; readonly parent?: NativeQueryNode | null; childForFieldName?(fieldName: string): NativeQueryNode | null; } export interface NativeQueryCapture { readonly name: string; readonly node: NativeQueryNode; } export interface NativeQueryInstance { matches(node: NativeQueryNode, options?: { matchLimit?: number; }): readonly { readonly captures: readonly NativeQueryCapture[]; }[]; didExceedMatchLimit(): boolean; } export interface NativeQueryConstructor { new (language: unknown, source: string | Buffer): NativeQueryInstance; } export interface NativeParserInstance { setLanguage(language: unknown): void; parse(source: string | ((index: number) => string | null)): NativeTree; } export interface NativeParserConstructor { new (): NativeParserInstance; Query?: NativeQueryConstructor; } export interface LoadedNativeGrammarSet { Parser: NativeParserConstructor; grammars: ReadonlyMap; } export interface BunMaskAdapter { target: object; property?: PropertyKey; getDescriptor?: (target: object, property: PropertyKey) => PropertyDescriptor | undefined; deleteProperty?: (target: object, property: PropertyKey) => boolean; restoreProperty?: (target: object, property: PropertyKey, descriptor: PropertyDescriptor) => void; } type RuntimeRequire = ReturnType; /** * Serialize the process-global Bun compatibility mutation and restore the * complete property descriptor before the caller can use a loaded grammar. */ export declare function withMaskedBunVersion(callback: () => T | Promise, adapter?: BunMaskAdapter): Promise; export declare function grammarArtifactKey(artifact: GrammarArtifact): string; /** Load a deduplicated package+selector grammar set without parsing while masked. */ export declare function loadNativeGrammarSet(artifacts: readonly GrammarArtifact[], requireFromCore?: RuntimeRequire): Promise; export {}; //# sourceMappingURL=grammar-loaders.d.ts.map