import Parser from "web-tree-sitter"; export interface ParserConfig { languagePath?: string; /** Language type: "typescript" (default) or "tsx" */ language?: "typescript" | "tsx"; } export declare function setLogger(logger: (...args: unknown[]) => void): void; export declare class TreeSitterParser { private parser; private languages; private currentLanguageName; private initialized; /** * Initializes the tree-sitter parser with TypeScript and TSX support. * * Loads both grammars from the local wasm/ directory. * The core tree-sitter WASM is resolved automatically from the npm package. */ initialize(config?: ParserConfig): Promise; /** * Parses source code using the currently active language. * Backward-compatible: works exactly like the old parse(). */ parse(source: string): Parser.Tree; /** * Auto-detect the language for a file path and parse its content. * Switches the parser language if needed. */ parseFile(filePath: string, content: string): Parser.Tree; /** * Switch the parser language based on file extension. * - .ts, .tsx → TSX grammar (TSX handles both .ts and .tsx) * - .js, .jsx, .mjs, .cjs → TSX grammar (JS is a subset) */ setLanguageForFile(filePath: string): void; /** * Returns the currently active language. */ getLanguage(): Parser.Language | null; /** * Returns a specific language by name ("typescript" or "tsx"). */ getLanguageByName(name: string): Parser.Language | undefined; /** * Returns the name of the currently active language. */ getCurrentLanguageName(): string; /** * Checks if parser is ready. */ isInitialized(): boolean; /** * Load a grammar WASM file as a Uint8Array. */ private loadLanguageWasm; } //# sourceMappingURL=parser.d.ts.map