@opentui/core 0.1.55 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bunfs.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export declare function isBunfsPath(path: string): boolean;
2
+ export declare function getBunfsRootPath(): string;
3
+ /**
4
+ * Normalizes a path to the embedded root.
5
+ * Flattens directory structure to ensure file exists at root.
6
+ */
7
+ export declare function normalizeBunfsPath(fileName: string): string;
@@ -6,6 +6,9 @@ export interface KeyBinding<Action extends string = string> {
6
6
  super?: boolean;
7
7
  action: Action;
8
8
  }
9
+ export type KeyAliasMap = Record<string, string>;
10
+ export declare const defaultKeyAliases: KeyAliasMap;
11
+ export declare function mergeKeyAliases(defaults: KeyAliasMap, custom: KeyAliasMap): KeyAliasMap;
9
12
  export declare function mergeKeyBindings<Action extends string>(defaults: KeyBinding<Action>[], custom: KeyBinding<Action>[]): KeyBinding<Action>[];
10
13
  export declare function getKeyBindingKey<Action extends string>(binding: KeyBinding<Action>): string;
11
- export declare function buildKeyBindingsMap<Action extends string>(bindings: KeyBinding<Action>[]): Map<string, Action>;
14
+ export declare function buildKeyBindingsMap<Action extends string>(bindings: KeyBinding<Action>[], aliasMap?: KeyAliasMap): Map<string, Action>;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
- "version": "0.1.55",
7
+ "version": "0.1.57",
8
8
  "description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -56,11 +56,11 @@
56
56
  "bun-webgpu": "0.1.4",
57
57
  "planck": "^1.4.2",
58
58
  "three": "0.177.0",
59
- "@opentui/core-darwin-x64": "0.1.55",
60
- "@opentui/core-darwin-arm64": "0.1.55",
61
- "@opentui/core-linux-x64": "0.1.55",
62
- "@opentui/core-linux-arm64": "0.1.55",
63
- "@opentui/core-win32-x64": "0.1.55",
64
- "@opentui/core-win32-arm64": "0.1.55"
59
+ "@opentui/core-darwin-x64": "0.1.57",
60
+ "@opentui/core-darwin-arm64": "0.1.57",
61
+ "@opentui/core-linux-x64": "0.1.57",
62
+ "@opentui/core-linux-arm64": "0.1.57",
63
+ "@opentui/core-win32-x64": "0.1.57",
64
+ "@opentui/core-win32-arm64": "0.1.57"
65
65
  }
66
66
  }
package/parser.worker.js CHANGED
@@ -132,6 +132,20 @@ class DownloadUtils {
132
132
 
133
133
  // src/lib/tree-sitter/parser.worker.ts
134
134
  import { isMainThread } from "worker_threads";
135
+
136
+ // src/lib/bunfs.ts
137
+ import { basename as basename2, join as join2 } from "path";
138
+ function isBunfsPath(path2) {
139
+ return path2.includes("$bunfs") || /^B:[\\/]~BUN/i.test(path2);
140
+ }
141
+ function getBunfsRootPath() {
142
+ return process.platform === "win32" ? "B:\\~BUN\\root" : "/$bunfs/root";
143
+ }
144
+ function normalizeBunfsPath(fileName) {
145
+ return join2(getBunfsRootPath(), basename2(fileName));
146
+ }
147
+
148
+ // src/lib/tree-sitter/parser.worker.ts
135
149
  var self = globalThis;
136
150
 
137
151
  class ParserWorker {
@@ -173,8 +187,8 @@ class ParserWorker {
173
187
  let { default: treeWasm } = await import("web-tree-sitter/tree-sitter.wasm", {
174
188
  with: { type: "wasm" }
175
189
  });
176
- if (/\$bunfs/.test(treeWasm)) {
177
- treeWasm = "/$bunfs/root/" + path2.parse(treeWasm).base;
190
+ if (isBunfsPath(treeWasm)) {
191
+ treeWasm = normalizeBunfsPath(path2.parse(treeWasm).base);
178
192
  }
179
193
  await Parser.init({
180
194
  locateFile() {
@@ -860,5 +874,5 @@ if (!isMainThread) {
860
874
  };
861
875
  }
862
876
 
863
- //# debugId=5CEDC1D15B3DD4B964756E2164756E21
877
+ //# debugId=F5C8191D269AAAF964756E2164756E21
864
878
  //# sourceMappingURL=parser.worker.js.map
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/lib/tree-sitter/parser.worker.ts", "../src/lib/tree-sitter/download-utils.ts"],
3
+ "sources": ["../src/lib/tree-sitter/parser.worker.ts", "../src/lib/tree-sitter/download-utils.ts", "../src/lib/bunfs.ts"],
4
4
  "sourcesContent": [
5
- "import { Parser, Query, Tree, Language } from \"web-tree-sitter\"\nimport type { Edit, QueryCapture, Range } from \"web-tree-sitter\"\nimport { mkdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport type {\n HighlightRange,\n HighlightResponse,\n SimpleHighlight,\n FiletypeParserOptions,\n PerformanceStats,\n InjectionMapping,\n} from \"./types\"\nimport { DownloadUtils } from \"./download-utils\"\nimport { isMainThread } from \"worker_threads\"\n\nconst self = globalThis\n\ntype ParserState = {\n parser: Parser\n tree: Tree\n queries: {\n highlights: Query\n injections?: Query\n }\n filetype: string\n content: string\n injectionMapping?: InjectionMapping\n}\n\ninterface FiletypeParser {\n filetype: string\n queries: {\n highlights: Query\n injections?: Query\n }\n language: Language\n injectionMapping?: InjectionMapping\n}\n\ninterface ReusableParserState {\n parser: Parser\n filetypeParser: FiletypeParser\n queries: {\n highlights: Query\n injections?: Query\n }\n}\n\nclass ParserWorker {\n private bufferParsers: Map<number, ParserState> = new Map()\n private filetypeParserOptions: Map<string, FiletypeParserOptions> = new Map()\n private filetypeParsers: Map<string, FiletypeParser> = new Map()\n private filetypeParserPromises: Map<string, Promise<FiletypeParser | undefined>> = new Map()\n private reusableParsers: Map<string, ReusableParserState> = new Map()\n private reusableParserPromises: Map<string, Promise<ReusableParserState | undefined>> = new Map()\n private initializePromise: Promise<void> | undefined\n public performance: PerformanceStats\n private dataPath: string | undefined\n private tsDataPath: string | undefined\n private initialized: boolean = false\n\n constructor() {\n this.performance = {\n averageParseTime: 0,\n parseTimes: [],\n averageQueryTime: 0,\n queryTimes: [],\n }\n }\n\n private async fetchQueries(sources: string[], filetype: string): Promise<string> {\n if (!this.tsDataPath) {\n return \"\"\n }\n return DownloadUtils.fetchHighlightQueries(sources, this.tsDataPath, filetype)\n }\n\n async initialize({ dataPath }: { dataPath: string }) {\n if (this.initializePromise) {\n return this.initializePromise\n }\n this.initializePromise = new Promise(async (resolve, reject) => {\n this.dataPath = dataPath\n this.tsDataPath = path.join(dataPath, \"tree-sitter\")\n\n try {\n await mkdir(path.join(this.tsDataPath, \"languages\"), { recursive: true })\n await mkdir(path.join(this.tsDataPath, \"queries\"), { recursive: true })\n\n let { default: treeWasm } = await import(\"web-tree-sitter/tree-sitter.wasm\" as string, {\n with: { type: \"wasm\" },\n })\n\n if (/\\$bunfs/.test(treeWasm)) {\n treeWasm = \"/$bunfs/root/\" + path.parse(treeWasm).base\n }\n\n await Parser.init({\n locateFile() {\n return treeWasm\n },\n })\n\n this.initialized = true\n resolve()\n } catch (error) {\n reject(error)\n }\n })\n return this.initializePromise\n }\n\n public addFiletypeParser(filetypeParser: FiletypeParserOptions) {\n this.filetypeParserOptions.set(filetypeParser.filetype, filetypeParser)\n }\n\n private async createQueries(\n filetypeParser: FiletypeParserOptions,\n language: Language,\n ): Promise<\n | {\n highlights: Query\n injections?: Query\n }\n | undefined\n > {\n try {\n const highlightQueryContent = await this.fetchQueries(filetypeParser.queries.highlights, filetypeParser.filetype)\n if (!highlightQueryContent) {\n console.error(\"Failed to fetch highlight queries for:\", filetypeParser.filetype)\n return undefined\n }\n\n const highlightsQuery = new Query(language, highlightQueryContent)\n const result: { highlights: Query; injections?: Query } = {\n highlights: highlightsQuery,\n }\n\n if (filetypeParser.queries.injections && filetypeParser.queries.injections.length > 0) {\n const injectionQueryContent = await this.fetchQueries(\n filetypeParser.queries.injections,\n filetypeParser.filetype,\n )\n if (injectionQueryContent) {\n result.injections = new Query(language, injectionQueryContent)\n }\n }\n\n return result\n } catch (error) {\n console.error(\"Error creating queries for\", filetypeParser.filetype, filetypeParser.queries)\n console.error(error)\n return undefined\n }\n }\n\n private async loadLanguage(languageSource: string): Promise<Language | undefined> {\n if (!this.initialized || !this.tsDataPath) {\n return undefined\n }\n\n const result = await DownloadUtils.downloadOrLoad(languageSource, this.tsDataPath, \"languages\", \".wasm\", false)\n\n if (result.error) {\n console.error(`Error loading language ${languageSource}:`, result.error)\n return undefined\n }\n\n if (!result.filePath) {\n return undefined\n }\n\n // Normalize path for Windows compatibility - tree-sitter expects forward slashes\n const normalizedPath = result.filePath.replaceAll(\"\\\\\", \"/\")\n\n try {\n const language = await Language.load(normalizedPath)\n return language\n } catch (error) {\n console.error(`Error loading language from ${normalizedPath}:`, error)\n return undefined\n }\n }\n\n private async resolveFiletypeParser(filetype: string): Promise<FiletypeParser | undefined> {\n if (this.filetypeParsers.has(filetype)) {\n return this.filetypeParsers.get(filetype)\n }\n\n if (this.filetypeParserPromises.has(filetype)) {\n return this.filetypeParserPromises.get(filetype)\n }\n\n const loadingPromise = this.loadFiletypeParser(filetype)\n this.filetypeParserPromises.set(filetype, loadingPromise)\n\n try {\n const result = await loadingPromise\n if (result) {\n this.filetypeParsers.set(filetype, result)\n }\n return result\n } finally {\n this.filetypeParserPromises.delete(filetype)\n }\n }\n\n private async loadFiletypeParser(filetype: string): Promise<FiletypeParser | undefined> {\n const filetypeParserOptions = this.filetypeParserOptions.get(filetype)\n if (!filetypeParserOptions) {\n return undefined\n }\n const language = await this.loadLanguage(filetypeParserOptions.wasm)\n if (!language) {\n return undefined\n }\n const queries = await this.createQueries(filetypeParserOptions, language)\n if (!queries) {\n console.error(\"Failed to create queries for:\", filetype)\n return undefined\n }\n const filetypeParser: FiletypeParser = {\n ...filetypeParserOptions,\n queries,\n language,\n }\n return filetypeParser\n }\n\n public async preloadParser(filetype: string) {\n return this.resolveFiletypeParser(filetype)\n }\n\n private async getReusableParser(filetype: string): Promise<ReusableParserState | undefined> {\n if (this.reusableParsers.has(filetype)) {\n return this.reusableParsers.get(filetype)\n }\n\n if (this.reusableParserPromises.has(filetype)) {\n return this.reusableParserPromises.get(filetype)\n }\n\n const creationPromise = this.createReusableParser(filetype)\n this.reusableParserPromises.set(filetype, creationPromise)\n\n try {\n const result = await creationPromise\n if (result) {\n this.reusableParsers.set(filetype, result)\n }\n return result\n } finally {\n this.reusableParserPromises.delete(filetype)\n }\n }\n\n private async createReusableParser(filetype: string): Promise<ReusableParserState | undefined> {\n const filetypeParser = await this.resolveFiletypeParser(filetype)\n if (!filetypeParser) {\n return undefined\n }\n\n const parser = new Parser()\n parser.setLanguage(filetypeParser.language)\n\n const reusableState: ReusableParserState = {\n parser,\n filetypeParser,\n queries: filetypeParser.queries,\n }\n\n return reusableState\n }\n\n async handleInitializeParser(\n bufferId: number,\n version: number,\n content: string,\n filetype: string,\n messageId: string,\n ) {\n const filetypeParser = await this.resolveFiletypeParser(filetype)\n\n if (!filetypeParser) {\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: false,\n warning: `No parser available for filetype ${filetype}`,\n })\n return\n }\n\n const parser = new Parser()\n parser.setLanguage(filetypeParser.language)\n const tree = parser.parse(content)\n if (!tree) {\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: false,\n error: \"Failed to parse buffer\",\n })\n return\n }\n\n const parserState: ParserState = {\n parser,\n tree,\n queries: filetypeParser.queries,\n filetype,\n content,\n injectionMapping: filetypeParser.injectionMapping,\n }\n this.bufferParsers.set(bufferId, parserState)\n\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: true,\n })\n const highlights = await this.initialQuery(parserState)\n self.postMessage({\n type: \"HIGHLIGHT_RESPONSE\",\n bufferId,\n version,\n ...highlights,\n })\n }\n\n private async initialQuery(parserState: ParserState) {\n const query = parserState.queries.highlights\n const matches: QueryCapture[] = query.captures(parserState.tree.rootNode)\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n private getNodeText(node: any, content: string): string {\n return content.substring(node.startIndex, node.endIndex)\n }\n\n private async processInjections(\n parserState: ParserState,\n ): Promise<{ captures: QueryCapture[]; injectionRanges: Map<string, Array<{ start: number; end: number }>> }> {\n const injectionMatches: QueryCapture[] = []\n const injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n\n if (!parserState.queries.injections) {\n return { captures: injectionMatches, injectionRanges }\n }\n\n const content = parserState.content\n const injectionCaptures = parserState.queries.injections.captures(parserState.tree.rootNode)\n const languageGroups = new Map<string, Array<{ node: any; name: string }>>()\n\n // Use the injection mapping stored in the parser state\n const injectionMapping = parserState.injectionMapping\n\n for (const capture of injectionCaptures) {\n const captureName = capture.name\n\n if (captureName === \"injection.content\" || captureName.includes(\"injection\")) {\n const nodeType = capture.node.type\n let targetLanguage: string | undefined\n\n // First, check if there's a direct node type mapping\n if (injectionMapping?.nodeTypes && injectionMapping.nodeTypes[nodeType]) {\n targetLanguage = injectionMapping.nodeTypes[nodeType]\n } else if (nodeType === \"code_fence_content\") {\n // For code fence content, try to extract language from info_string\n const parent = capture.node.parent\n if (parent) {\n const infoString = parent.children.find((child: any) => child.type === \"info_string\")\n if (infoString) {\n const languageNode = infoString.children.find((child: any) => child.type === \"language\")\n if (languageNode) {\n const languageName = this.getNodeText(languageNode, content)\n\n if (injectionMapping?.infoStringMap && injectionMapping.infoStringMap[languageName]) {\n targetLanguage = injectionMapping.infoStringMap[languageName]\n } else {\n targetLanguage = languageName\n }\n }\n }\n }\n }\n\n if (targetLanguage) {\n if (!languageGroups.has(targetLanguage)) {\n languageGroups.set(targetLanguage, [])\n }\n languageGroups.get(targetLanguage)!.push({ node: capture.node, name: capture.name })\n }\n }\n }\n\n // Process each language group\n for (const [language, captures] of languageGroups.entries()) {\n const injectedParser = await this.getReusableParser(language)\n\n if (!injectedParser) {\n console.warn(`No parser found for injection language: ${language}`)\n continue\n }\n\n // Track injection ranges for this language\n if (!injectionRanges.has(language)) {\n injectionRanges.set(language, [])\n }\n\n const parser = injectedParser.parser\n for (const { node: injectionNode } of captures) {\n try {\n // Record the injection range\n injectionRanges.get(language)!.push({\n start: injectionNode.startIndex,\n end: injectionNode.endIndex,\n })\n\n const injectionContent = this.getNodeText(injectionNode, content)\n const tree = parser.parse(injectionContent)\n\n if (tree) {\n const matches = injectedParser.queries.highlights.captures(tree.rootNode)\n\n // Create new QueryCapture objects with offset positions\n for (const match of matches) {\n // Calculate offset positions by creating a new capture with adjusted node properties\n // Store the injected query reference so we can look up properties correctly\n const offsetCapture: QueryCapture & { _injectedQuery?: Query } = {\n name: match.name,\n patternIndex: match.patternIndex,\n _injectedQuery: injectedParser.queries.highlights, // Store the correct query reference\n node: {\n ...match.node,\n startPosition: {\n row: match.node.startPosition.row + injectionNode.startPosition.row,\n column:\n match.node.startPosition.row === 0\n ? match.node.startPosition.column + injectionNode.startPosition.column\n : match.node.startPosition.column,\n },\n endPosition: {\n row: match.node.endPosition.row + injectionNode.startPosition.row,\n column:\n match.node.endPosition.row === 0\n ? match.node.endPosition.column + injectionNode.startPosition.column\n : match.node.endPosition.column,\n },\n startIndex: match.node.startIndex + injectionNode.startIndex,\n endIndex: match.node.endIndex + injectionNode.startIndex,\n } as any, // Cast to any since we're creating a pseudo-node\n }\n\n injectionMatches.push(offsetCapture)\n }\n\n tree.delete()\n }\n } catch (error) {\n console.error(`Error processing injection for language ${language}:`, error)\n }\n }\n\n // NOTE: Do NOT call parser.delete() here - this is a reusable parser!\n }\n\n return { captures: injectionMatches, injectionRanges }\n }\n\n private editToRange(edit: Edit): Range {\n return {\n startPosition: {\n column: edit.startPosition.column,\n row: edit.startPosition.row,\n },\n endPosition: {\n column: edit.newEndPosition.column,\n row: edit.newEndPosition.row,\n },\n startIndex: edit.startIndex,\n endIndex: edit.newEndIndex,\n }\n }\n\n async handleEdits(\n bufferId: number,\n content: string,\n edits: Edit[],\n ): Promise<{ highlights?: HighlightResponse[]; warning?: string; error?: string }> {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return { warning: \"No parser state found for buffer\" }\n }\n\n parserState.content = content\n\n for (const edit of edits) {\n parserState.tree.edit(edit)\n }\n\n const startParse = performance.now()\n\n const newTree = parserState.parser.parse(content, parserState.tree)\n\n const endParse = performance.now()\n const parseTime = endParse - startParse\n this.performance.parseTimes.push(parseTime)\n if (this.performance.parseTimes.length > 10) {\n this.performance.parseTimes.shift()\n }\n this.performance.averageParseTime =\n this.performance.parseTimes.reduce((acc, time) => acc + time, 0) / this.performance.parseTimes.length\n\n if (!newTree) {\n return { error: \"Failed to parse buffer\" }\n }\n\n const changedRanges = parserState.tree.getChangedRanges(newTree)\n parserState.tree = newTree\n\n const startQuery = performance.now()\n const matches: QueryCapture[] = []\n\n if (changedRanges.length === 0) {\n edits.forEach((edit) => {\n const range = this.editToRange(edit)\n changedRanges.push(range)\n })\n }\n\n for (const range of changedRanges) {\n let node = parserState.tree.rootNode.descendantForPosition(range.startPosition, range.endPosition)\n\n if (!node) {\n continue\n }\n\n // If we got the root node, query with range to limit scope\n if (node.equals(parserState.tree.rootNode)) {\n // WHY ARE RANGES NOT WORKING!?\n // The changed ranges are not returning anything in some cases\n // Even this shit somehow returns many lines before the actual range,\n // and even though expanded by 1000 bytes it does not capture much beyond the actual range.\n // So freaking weird.\n const rangeCaptures = parserState.queries.highlights.captures(\n node,\n // WTF!?\n {\n startIndex: range.startIndex - 100,\n endIndex: range.endIndex + 1000,\n },\n )\n matches.push(...rangeCaptures)\n continue\n }\n\n while (node && !this.nodeContainsRange(node, range)) {\n node = node.parent\n }\n\n if (!node) {\n node = parserState.tree.rootNode\n }\n\n const nodeCaptures = parserState.queries.highlights.captures(node)\n matches.push(...nodeCaptures)\n }\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n // Only add injection matches that are in the changed ranges\n // This is a simplification - ideally we'd only process injections in changed ranges\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n const endQuery = performance.now()\n const queryTime = endQuery - startQuery\n this.performance.queryTimes.push(queryTime)\n if (this.performance.queryTimes.length > 10) {\n this.performance.queryTimes.shift()\n }\n this.performance.averageQueryTime =\n this.performance.queryTimes.reduce((acc, time) => acc + time, 0) / this.performance.queryTimes.length\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n private nodeContainsRange(node: any, range: any): boolean {\n return (\n node.startPosition.row <= range.startPosition.row &&\n node.endPosition.row >= range.endPosition.row &&\n (node.startPosition.row < range.startPosition.row || node.startPosition.column <= range.startPosition.column) &&\n (node.endPosition.row > range.endPosition.row || node.endPosition.column >= range.endPosition.column)\n )\n }\n\n private getHighlights(\n parserState: ParserState,\n matches: QueryCapture[],\n injectionRanges?: Map<string, Array<{ start: number; end: number }>>,\n ): { highlights: HighlightResponse[] } {\n const lineHighlights: Map<number, Map<number, HighlightRange>> = new Map()\n const droppedHighlights: Map<number, Map<number, HighlightRange>> = new Map()\n\n for (const match of matches) {\n const node = match.node\n const startLine = node.startPosition.row\n const endLine = node.endPosition.row\n\n const highlight = {\n startCol: node.startPosition.column,\n endCol: node.endPosition.column,\n group: match.name,\n }\n\n if (!lineHighlights.has(startLine)) {\n lineHighlights.set(startLine, new Map())\n droppedHighlights.set(startLine, new Map())\n }\n if (lineHighlights.get(startLine)?.has(node.id)) {\n droppedHighlights.get(startLine)?.set(node.id, lineHighlights.get(startLine)?.get(node.id)!)\n }\n lineHighlights.get(startLine)?.set(node.id, highlight)\n\n if (startLine !== endLine) {\n for (let line = startLine + 1; line <= endLine; line++) {\n if (!lineHighlights.has(line)) {\n lineHighlights.set(line, new Map())\n }\n const hl: HighlightRange = {\n startCol: 0,\n endCol: node.endPosition.column,\n group: match.name,\n }\n lineHighlights.get(line)?.set(node.id, hl)\n }\n }\n }\n\n return {\n highlights: Array.from(lineHighlights.entries()).map(([line, lineHighlights]) => ({\n line,\n highlights: Array.from(lineHighlights.values()),\n droppedHighlights: droppedHighlights.get(line) ? Array.from(droppedHighlights.get(line)!.values()) : [],\n })),\n }\n }\n\n private getSimpleHighlights(\n matches: QueryCapture[],\n injectionRanges: Map<string, Array<{ start: number; end: number }>>,\n ): SimpleHighlight[] {\n const highlights: SimpleHighlight[] = []\n\n const flatInjectionRanges: Array<{ start: number; end: number; lang: string }> = []\n for (const [lang, ranges] of injectionRanges.entries()) {\n for (const range of ranges) {\n flatInjectionRanges.push({ ...range, lang })\n }\n }\n\n for (const match of matches) {\n const node = match.node\n\n let isInjection = false\n let injectionLang: string | undefined\n let containsInjection = false\n for (const injRange of flatInjectionRanges) {\n if (node.startIndex >= injRange.start && node.endIndex <= injRange.end) {\n isInjection = true\n injectionLang = injRange.lang\n break\n } else if (node.startIndex <= injRange.start && node.endIndex >= injRange.end) {\n containsInjection = true\n break\n }\n }\n\n const matchQuery = (match as any)._injectedQuery\n const patternProperties = matchQuery?.setProperties?.[match.patternIndex]\n\n const concealValue = patternProperties?.conceal ?? match.setProperties?.conceal\n const concealLines = patternProperties?.conceal_lines ?? match.setProperties?.conceal_lines\n\n const meta: any = {}\n if (isInjection && injectionLang) {\n meta.isInjection = true\n meta.injectionLang = injectionLang\n }\n if (containsInjection) {\n meta.containsInjection = true\n }\n if (concealValue !== undefined) {\n meta.conceal = concealValue\n }\n if (concealLines !== undefined) {\n meta.concealLines = concealLines\n }\n\n if (Object.keys(meta).length > 0) {\n highlights.push([node.startIndex, node.endIndex, match.name, meta])\n } else {\n highlights.push([node.startIndex, node.endIndex, match.name])\n }\n }\n\n highlights.sort((a, b) => a[0] - b[0])\n\n return highlights\n }\n\n async handleResetBuffer(\n bufferId: number,\n version: number,\n content: string,\n ): Promise<{ highlights?: HighlightResponse[]; warning?: string; error?: string }> {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return { warning: \"No parser state found for buffer\" }\n }\n\n parserState.content = content\n\n const newTree = parserState.parser.parse(content)\n\n if (!newTree) {\n return { error: \"Failed to parse buffer during reset\" }\n }\n\n parserState.tree = newTree\n const matches = parserState.queries.highlights.captures(parserState.tree.rootNode)\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n disposeBuffer(bufferId: number): void {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return\n }\n\n parserState.tree.delete()\n parserState.parser.delete()\n\n this.bufferParsers.delete(bufferId)\n }\n\n async handleOneShotHighlight(content: string, filetype: string, messageId: string): Promise<void> {\n const reusableState = await this.getReusableParser(filetype)\n\n if (!reusableState) {\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: false,\n warning: `No parser available for filetype ${filetype}`,\n })\n return\n }\n\n // Markdown Parser BUG: For markdown, ensure content ends with newline so closing delimiters are parsed correctly\n // The tree-sitter markdown parser only creates closing delimiter nodes when followed by newline\n const parseContent = filetype === \"markdown\" && content.endsWith(\"```\") ? content + \"\\n\" : content\n\n const tree = reusableState.parser.parse(parseContent)\n\n if (!tree) {\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: false,\n error: \"Failed to parse content\",\n })\n return\n }\n\n try {\n const matches = reusableState.filetypeParser.queries.highlights.captures(tree.rootNode)\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (reusableState.filetypeParser.queries.injections) {\n const parserState: ParserState = {\n parser: reusableState.parser,\n tree,\n queries: reusableState.filetypeParser.queries,\n filetype,\n content,\n injectionMapping: reusableState.filetypeParser.injectionMapping,\n }\n const injectionResult = await this.processInjections(parserState)\n\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n const highlights = this.getSimpleHighlights(matches, injectionRanges)\n\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: true,\n highlights,\n })\n } finally {\n tree.delete()\n }\n }\n\n async updateDataPath(dataPath: string): Promise<void> {\n this.dataPath = dataPath\n this.tsDataPath = path.join(dataPath, \"tree-sitter\")\n\n try {\n await mkdir(path.join(this.tsDataPath, \"languages\"), { recursive: true })\n await mkdir(path.join(this.tsDataPath, \"queries\"), { recursive: true })\n } catch (error) {\n throw new Error(`Failed to update data path: ${error}`)\n }\n }\n\n async clearCache(): Promise<void> {\n if (!this.dataPath || !this.tsDataPath) {\n throw new Error(\"No data path configured\")\n }\n\n const { rm } = await import(\"fs/promises\")\n\n try {\n const treeSitterPath = path.join(this.dataPath, \"tree-sitter\")\n\n await rm(treeSitterPath, { recursive: true, force: true })\n\n await mkdir(path.join(treeSitterPath, \"languages\"), { recursive: true })\n await mkdir(path.join(treeSitterPath, \"queries\"), { recursive: true })\n\n this.filetypeParsers.clear()\n this.filetypeParserPromises.clear()\n this.reusableParsers.clear()\n this.reusableParserPromises.clear()\n } catch (error) {\n throw new Error(`Failed to clear cache: ${error}`)\n }\n }\n}\nif (!isMainThread) {\n const worker = new ParserWorker()\n\n function logMessage(type: \"log\" | \"error\" | \"warn\", ...args: any[]) {\n self.postMessage({\n type: \"WORKER_LOG\",\n logType: type,\n data: args,\n })\n }\n console.log = (...args) => logMessage(\"log\", ...args)\n console.error = (...args) => logMessage(\"error\", ...args)\n console.warn = (...args) => logMessage(\"warn\", ...args)\n\n // @ts-ignore - we'll fix this in the future for sure\n self.onmessage = async (e: MessageEvent) => {\n const { type, bufferId, version, content, filetype, edits, filetypeParser, messageId, dataPath } = e.data\n\n try {\n switch (type) {\n case \"INIT\":\n try {\n await worker.initialize({ dataPath })\n self.postMessage({ type: \"INIT_RESPONSE\" })\n } catch (error) {\n self.postMessage({\n type: \"INIT_RESPONSE\",\n error: error instanceof Error ? error.stack || error.message : String(error),\n })\n }\n break\n\n case \"ADD_FILETYPE_PARSER\":\n worker.addFiletypeParser(filetypeParser)\n break\n\n case \"PRELOAD_PARSER\":\n const maybeParser = await worker.preloadParser(filetype)\n self.postMessage({ type: \"PRELOAD_PARSER_RESPONSE\", messageId, hasParser: !!maybeParser })\n break\n\n case \"INITIALIZE_PARSER\":\n await worker.handleInitializeParser(bufferId, version, content, filetype, messageId)\n break\n\n case \"HANDLE_EDITS\":\n const response = await worker.handleEdits(bufferId, content, edits)\n if (response.highlights && response.highlights.length > 0) {\n self.postMessage({ type: \"HIGHLIGHT_RESPONSE\", bufferId, version, ...response })\n } else if (response.warning) {\n self.postMessage({ type: \"WARNING\", bufferId, warning: response.warning })\n } else if (response.error) {\n self.postMessage({ type: \"ERROR\", bufferId, error: response.error })\n }\n break\n\n case \"GET_PERFORMANCE\":\n self.postMessage({ type: \"PERFORMANCE_RESPONSE\", performance: worker.performance, messageId })\n break\n\n case \"RESET_BUFFER\":\n const resetResponse = await worker.handleResetBuffer(bufferId, version, content)\n if (resetResponse.highlights && resetResponse.highlights.length > 0) {\n self.postMessage({ type: \"HIGHLIGHT_RESPONSE\", bufferId, version, ...resetResponse })\n } else if (resetResponse.warning) {\n self.postMessage({ type: \"WARNING\", bufferId, warning: resetResponse.warning })\n } else if (resetResponse.error) {\n self.postMessage({ type: \"ERROR\", bufferId, error: resetResponse.error })\n }\n break\n\n case \"DISPOSE_BUFFER\":\n worker.disposeBuffer(bufferId)\n self.postMessage({ type: \"BUFFER_DISPOSED\", bufferId })\n break\n\n case \"ONESHOT_HIGHLIGHT\":\n await worker.handleOneShotHighlight(content, filetype, messageId)\n break\n\n case \"UPDATE_DATA_PATH\":\n try {\n await worker.updateDataPath(dataPath)\n self.postMessage({ type: \"UPDATE_DATA_PATH_RESPONSE\", messageId })\n } catch (error) {\n self.postMessage({\n type: \"UPDATE_DATA_PATH_RESPONSE\",\n messageId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n break\n\n case \"CLEAR_CACHE\":\n try {\n await worker.clearCache()\n self.postMessage({ type: \"CLEAR_CACHE_RESPONSE\", messageId })\n } catch (error) {\n self.postMessage({\n type: \"CLEAR_CACHE_RESPONSE\",\n messageId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n break\n\n default:\n self.postMessage({\n type: \"ERROR\",\n bufferId,\n error: `Unknown message type: ${type}`,\n })\n }\n } catch (error) {\n self.postMessage({\n type: \"ERROR\",\n bufferId,\n error: error instanceof Error ? error.stack || error.message : String(error),\n })\n }\n }\n}\n",
6
- "import { mkdir, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport interface DownloadResult {\n content?: ArrayBuffer\n filePath?: string\n error?: string\n}\n\nexport class DownloadUtils {\n private static hashUrl(url: string): string {\n let hash = 0\n for (let i = 0; i < url.length; i++) {\n const char = url.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash = hash & hash\n }\n return Math.abs(hash).toString(16)\n }\n\n /**\n * Download a file from URL or load from local path, with caching support\n */\n static async downloadOrLoad(\n source: string,\n cacheDir: string,\n cacheSubdir: string,\n fileExtension: string,\n useHashForCache: boolean = true,\n filetype?: string,\n ): Promise<DownloadResult> {\n const isUrl = source.startsWith(\"http://\") || source.startsWith(\"https://\")\n\n if (isUrl) {\n let cacheFileName: string\n if (useHashForCache) {\n const hash = this.hashUrl(source)\n cacheFileName = filetype ? `${filetype}-${hash}${fileExtension}` : `${hash}${fileExtension}`\n } else {\n cacheFileName = path.basename(source)\n }\n const cacheFile = path.join(cacheDir, cacheSubdir, cacheFileName)\n\n // Ensure cache directory exists\n await mkdir(path.dirname(cacheFile), { recursive: true })\n\n try {\n const cachedContent = await Bun.file(cacheFile).arrayBuffer()\n if (cachedContent.byteLength > 0) {\n console.log(`Loaded from cache: ${cacheFile} (${source})`)\n return { content: cachedContent, filePath: cacheFile }\n }\n } catch (error) {\n // Cache miss, continue to fetch\n }\n\n try {\n console.log(`Downloading from URL: ${source}`)\n const response = await fetch(source)\n if (!response.ok) {\n return { error: `Failed to fetch from ${source}: ${response.statusText}` }\n }\n const content = await response.arrayBuffer()\n\n try {\n await writeFile(cacheFile, Buffer.from(content))\n console.log(`Cached: ${source}`)\n } catch (cacheError) {\n console.warn(`Failed to cache: ${cacheError}`)\n }\n\n return { content, filePath: cacheFile }\n } catch (error) {\n return { error: `Error downloading from ${source}: ${error}` }\n }\n } else {\n try {\n console.log(`Loading from local path: ${source}`)\n const content = await Bun.file(source).arrayBuffer()\n return { content, filePath: source }\n } catch (error) {\n return { error: `Error loading from local path ${source}: ${error}` }\n }\n }\n }\n\n /**\n * Download and save a file to a specific target path\n */\n static async downloadToPath(source: string, targetPath: string): Promise<DownloadResult> {\n const isUrl = source.startsWith(\"http://\") || source.startsWith(\"https://\")\n\n await mkdir(path.dirname(targetPath), { recursive: true })\n\n if (isUrl) {\n try {\n console.log(`Downloading from URL: ${source}`)\n const response = await fetch(source)\n if (!response.ok) {\n return { error: `Failed to fetch from ${source}: ${response.statusText}` }\n }\n const content = await response.arrayBuffer()\n\n await writeFile(targetPath, Buffer.from(content))\n console.log(`Downloaded: ${source} -> ${targetPath}`)\n\n return { content, filePath: targetPath }\n } catch (error) {\n return { error: `Error downloading from ${source}: ${error}` }\n }\n } else {\n try {\n console.log(`Copying from local path: ${source}`)\n const content = await Bun.file(source).arrayBuffer()\n await writeFile(targetPath, Buffer.from(content))\n return { content, filePath: targetPath }\n } catch (error) {\n return { error: `Error copying from local path ${source}: ${error}` }\n }\n }\n }\n\n /**\n * Fetch multiple highlight queries and concatenate them\n */\n static async fetchHighlightQueries(sources: string[], cacheDir: string, filetype: string): Promise<string> {\n const queryPromises = sources.map((source) => this.fetchHighlightQuery(source, cacheDir, filetype))\n const queryResults = await Promise.all(queryPromises)\n\n const validQueries = queryResults.filter((query) => query.trim().length > 0)\n return validQueries.join(\"\\n\")\n }\n\n private static async fetchHighlightQuery(source: string, cacheDir: string, filetype: string): Promise<string> {\n const result = await this.downloadOrLoad(source, cacheDir, \"queries\", \".scm\", true, filetype)\n\n if (result.error) {\n console.error(`Error fetching highlight query from ${source}:`, result.error)\n return \"\"\n }\n\n if (result.content) {\n return new TextDecoder().decode(result.content)\n }\n\n return \"\"\n }\n}\n"
5
+ "import { Parser, Query, Tree, Language } from \"web-tree-sitter\"\nimport type { Edit, QueryCapture, Range } from \"web-tree-sitter\"\nimport { mkdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport type {\n HighlightRange,\n HighlightResponse,\n SimpleHighlight,\n FiletypeParserOptions,\n PerformanceStats,\n InjectionMapping,\n} from \"./types\"\nimport { DownloadUtils } from \"./download-utils\"\nimport { isMainThread } from \"worker_threads\"\nimport { isBunfsPath, normalizeBunfsPath } from \"../bunfs\"\n\nconst self = globalThis\n\ntype ParserState = {\n parser: Parser\n tree: Tree\n queries: {\n highlights: Query\n injections?: Query\n }\n filetype: string\n content: string\n injectionMapping?: InjectionMapping\n}\n\ninterface FiletypeParser {\n filetype: string\n queries: {\n highlights: Query\n injections?: Query\n }\n language: Language\n injectionMapping?: InjectionMapping\n}\n\ninterface ReusableParserState {\n parser: Parser\n filetypeParser: FiletypeParser\n queries: {\n highlights: Query\n injections?: Query\n }\n}\n\nclass ParserWorker {\n private bufferParsers: Map<number, ParserState> = new Map()\n private filetypeParserOptions: Map<string, FiletypeParserOptions> = new Map()\n private filetypeParsers: Map<string, FiletypeParser> = new Map()\n private filetypeParserPromises: Map<string, Promise<FiletypeParser | undefined>> = new Map()\n private reusableParsers: Map<string, ReusableParserState> = new Map()\n private reusableParserPromises: Map<string, Promise<ReusableParserState | undefined>> = new Map()\n private initializePromise: Promise<void> | undefined\n public performance: PerformanceStats\n private dataPath: string | undefined\n private tsDataPath: string | undefined\n private initialized: boolean = false\n\n constructor() {\n this.performance = {\n averageParseTime: 0,\n parseTimes: [],\n averageQueryTime: 0,\n queryTimes: [],\n }\n }\n\n private async fetchQueries(sources: string[], filetype: string): Promise<string> {\n if (!this.tsDataPath) {\n return \"\"\n }\n return DownloadUtils.fetchHighlightQueries(sources, this.tsDataPath, filetype)\n }\n\n async initialize({ dataPath }: { dataPath: string }) {\n if (this.initializePromise) {\n return this.initializePromise\n }\n this.initializePromise = new Promise(async (resolve, reject) => {\n this.dataPath = dataPath\n this.tsDataPath = path.join(dataPath, \"tree-sitter\")\n\n try {\n await mkdir(path.join(this.tsDataPath, \"languages\"), { recursive: true })\n await mkdir(path.join(this.tsDataPath, \"queries\"), { recursive: true })\n\n let { default: treeWasm } = await import(\"web-tree-sitter/tree-sitter.wasm\" as string, {\n with: { type: \"wasm\" },\n })\n\n if (isBunfsPath(treeWasm)) {\n treeWasm = normalizeBunfsPath(path.parse(treeWasm).base)\n }\n\n await Parser.init({\n locateFile() {\n return treeWasm\n },\n })\n\n this.initialized = true\n resolve()\n } catch (error) {\n reject(error)\n }\n })\n return this.initializePromise\n }\n\n public addFiletypeParser(filetypeParser: FiletypeParserOptions) {\n this.filetypeParserOptions.set(filetypeParser.filetype, filetypeParser)\n }\n\n private async createQueries(\n filetypeParser: FiletypeParserOptions,\n language: Language,\n ): Promise<\n | {\n highlights: Query\n injections?: Query\n }\n | undefined\n > {\n try {\n const highlightQueryContent = await this.fetchQueries(filetypeParser.queries.highlights, filetypeParser.filetype)\n if (!highlightQueryContent) {\n console.error(\"Failed to fetch highlight queries for:\", filetypeParser.filetype)\n return undefined\n }\n\n const highlightsQuery = new Query(language, highlightQueryContent)\n const result: { highlights: Query; injections?: Query } = {\n highlights: highlightsQuery,\n }\n\n if (filetypeParser.queries.injections && filetypeParser.queries.injections.length > 0) {\n const injectionQueryContent = await this.fetchQueries(\n filetypeParser.queries.injections,\n filetypeParser.filetype,\n )\n if (injectionQueryContent) {\n result.injections = new Query(language, injectionQueryContent)\n }\n }\n\n return result\n } catch (error) {\n console.error(\"Error creating queries for\", filetypeParser.filetype, filetypeParser.queries)\n console.error(error)\n return undefined\n }\n }\n\n private async loadLanguage(languageSource: string): Promise<Language | undefined> {\n if (!this.initialized || !this.tsDataPath) {\n return undefined\n }\n\n const result = await DownloadUtils.downloadOrLoad(languageSource, this.tsDataPath, \"languages\", \".wasm\", false)\n\n if (result.error) {\n console.error(`Error loading language ${languageSource}:`, result.error)\n return undefined\n }\n\n if (!result.filePath) {\n return undefined\n }\n\n // Normalize path for Windows compatibility - tree-sitter expects forward slashes\n const normalizedPath = result.filePath.replaceAll(\"\\\\\", \"/\")\n\n try {\n const language = await Language.load(normalizedPath)\n return language\n } catch (error) {\n console.error(`Error loading language from ${normalizedPath}:`, error)\n return undefined\n }\n }\n\n private async resolveFiletypeParser(filetype: string): Promise<FiletypeParser | undefined> {\n if (this.filetypeParsers.has(filetype)) {\n return this.filetypeParsers.get(filetype)\n }\n\n if (this.filetypeParserPromises.has(filetype)) {\n return this.filetypeParserPromises.get(filetype)\n }\n\n const loadingPromise = this.loadFiletypeParser(filetype)\n this.filetypeParserPromises.set(filetype, loadingPromise)\n\n try {\n const result = await loadingPromise\n if (result) {\n this.filetypeParsers.set(filetype, result)\n }\n return result\n } finally {\n this.filetypeParserPromises.delete(filetype)\n }\n }\n\n private async loadFiletypeParser(filetype: string): Promise<FiletypeParser | undefined> {\n const filetypeParserOptions = this.filetypeParserOptions.get(filetype)\n if (!filetypeParserOptions) {\n return undefined\n }\n const language = await this.loadLanguage(filetypeParserOptions.wasm)\n if (!language) {\n return undefined\n }\n const queries = await this.createQueries(filetypeParserOptions, language)\n if (!queries) {\n console.error(\"Failed to create queries for:\", filetype)\n return undefined\n }\n const filetypeParser: FiletypeParser = {\n ...filetypeParserOptions,\n queries,\n language,\n }\n return filetypeParser\n }\n\n public async preloadParser(filetype: string) {\n return this.resolveFiletypeParser(filetype)\n }\n\n private async getReusableParser(filetype: string): Promise<ReusableParserState | undefined> {\n if (this.reusableParsers.has(filetype)) {\n return this.reusableParsers.get(filetype)\n }\n\n if (this.reusableParserPromises.has(filetype)) {\n return this.reusableParserPromises.get(filetype)\n }\n\n const creationPromise = this.createReusableParser(filetype)\n this.reusableParserPromises.set(filetype, creationPromise)\n\n try {\n const result = await creationPromise\n if (result) {\n this.reusableParsers.set(filetype, result)\n }\n return result\n } finally {\n this.reusableParserPromises.delete(filetype)\n }\n }\n\n private async createReusableParser(filetype: string): Promise<ReusableParserState | undefined> {\n const filetypeParser = await this.resolveFiletypeParser(filetype)\n if (!filetypeParser) {\n return undefined\n }\n\n const parser = new Parser()\n parser.setLanguage(filetypeParser.language)\n\n const reusableState: ReusableParserState = {\n parser,\n filetypeParser,\n queries: filetypeParser.queries,\n }\n\n return reusableState\n }\n\n async handleInitializeParser(\n bufferId: number,\n version: number,\n content: string,\n filetype: string,\n messageId: string,\n ) {\n const filetypeParser = await this.resolveFiletypeParser(filetype)\n\n if (!filetypeParser) {\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: false,\n warning: `No parser available for filetype ${filetype}`,\n })\n return\n }\n\n const parser = new Parser()\n parser.setLanguage(filetypeParser.language)\n const tree = parser.parse(content)\n if (!tree) {\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: false,\n error: \"Failed to parse buffer\",\n })\n return\n }\n\n const parserState: ParserState = {\n parser,\n tree,\n queries: filetypeParser.queries,\n filetype,\n content,\n injectionMapping: filetypeParser.injectionMapping,\n }\n this.bufferParsers.set(bufferId, parserState)\n\n self.postMessage({\n type: \"PARSER_INIT_RESPONSE\",\n bufferId,\n messageId,\n hasParser: true,\n })\n const highlights = await this.initialQuery(parserState)\n self.postMessage({\n type: \"HIGHLIGHT_RESPONSE\",\n bufferId,\n version,\n ...highlights,\n })\n }\n\n private async initialQuery(parserState: ParserState) {\n const query = parserState.queries.highlights\n const matches: QueryCapture[] = query.captures(parserState.tree.rootNode)\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n private getNodeText(node: any, content: string): string {\n return content.substring(node.startIndex, node.endIndex)\n }\n\n private async processInjections(\n parserState: ParserState,\n ): Promise<{ captures: QueryCapture[]; injectionRanges: Map<string, Array<{ start: number; end: number }>> }> {\n const injectionMatches: QueryCapture[] = []\n const injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n\n if (!parserState.queries.injections) {\n return { captures: injectionMatches, injectionRanges }\n }\n\n const content = parserState.content\n const injectionCaptures = parserState.queries.injections.captures(parserState.tree.rootNode)\n const languageGroups = new Map<string, Array<{ node: any; name: string }>>()\n\n // Use the injection mapping stored in the parser state\n const injectionMapping = parserState.injectionMapping\n\n for (const capture of injectionCaptures) {\n const captureName = capture.name\n\n if (captureName === \"injection.content\" || captureName.includes(\"injection\")) {\n const nodeType = capture.node.type\n let targetLanguage: string | undefined\n\n // First, check if there's a direct node type mapping\n if (injectionMapping?.nodeTypes && injectionMapping.nodeTypes[nodeType]) {\n targetLanguage = injectionMapping.nodeTypes[nodeType]\n } else if (nodeType === \"code_fence_content\") {\n // For code fence content, try to extract language from info_string\n const parent = capture.node.parent\n if (parent) {\n const infoString = parent.children.find((child: any) => child.type === \"info_string\")\n if (infoString) {\n const languageNode = infoString.children.find((child: any) => child.type === \"language\")\n if (languageNode) {\n const languageName = this.getNodeText(languageNode, content)\n\n if (injectionMapping?.infoStringMap && injectionMapping.infoStringMap[languageName]) {\n targetLanguage = injectionMapping.infoStringMap[languageName]\n } else {\n targetLanguage = languageName\n }\n }\n }\n }\n }\n\n if (targetLanguage) {\n if (!languageGroups.has(targetLanguage)) {\n languageGroups.set(targetLanguage, [])\n }\n languageGroups.get(targetLanguage)!.push({ node: capture.node, name: capture.name })\n }\n }\n }\n\n // Process each language group\n for (const [language, captures] of languageGroups.entries()) {\n const injectedParser = await this.getReusableParser(language)\n\n if (!injectedParser) {\n console.warn(`No parser found for injection language: ${language}`)\n continue\n }\n\n // Track injection ranges for this language\n if (!injectionRanges.has(language)) {\n injectionRanges.set(language, [])\n }\n\n const parser = injectedParser.parser\n for (const { node: injectionNode } of captures) {\n try {\n // Record the injection range\n injectionRanges.get(language)!.push({\n start: injectionNode.startIndex,\n end: injectionNode.endIndex,\n })\n\n const injectionContent = this.getNodeText(injectionNode, content)\n const tree = parser.parse(injectionContent)\n\n if (tree) {\n const matches = injectedParser.queries.highlights.captures(tree.rootNode)\n\n // Create new QueryCapture objects with offset positions\n for (const match of matches) {\n // Calculate offset positions by creating a new capture with adjusted node properties\n // Store the injected query reference so we can look up properties correctly\n const offsetCapture: QueryCapture & { _injectedQuery?: Query } = {\n name: match.name,\n patternIndex: match.patternIndex,\n _injectedQuery: injectedParser.queries.highlights, // Store the correct query reference\n node: {\n ...match.node,\n startPosition: {\n row: match.node.startPosition.row + injectionNode.startPosition.row,\n column:\n match.node.startPosition.row === 0\n ? match.node.startPosition.column + injectionNode.startPosition.column\n : match.node.startPosition.column,\n },\n endPosition: {\n row: match.node.endPosition.row + injectionNode.startPosition.row,\n column:\n match.node.endPosition.row === 0\n ? match.node.endPosition.column + injectionNode.startPosition.column\n : match.node.endPosition.column,\n },\n startIndex: match.node.startIndex + injectionNode.startIndex,\n endIndex: match.node.endIndex + injectionNode.startIndex,\n } as any, // Cast to any since we're creating a pseudo-node\n }\n\n injectionMatches.push(offsetCapture)\n }\n\n tree.delete()\n }\n } catch (error) {\n console.error(`Error processing injection for language ${language}:`, error)\n }\n }\n\n // NOTE: Do NOT call parser.delete() here - this is a reusable parser!\n }\n\n return { captures: injectionMatches, injectionRanges }\n }\n\n private editToRange(edit: Edit): Range {\n return {\n startPosition: {\n column: edit.startPosition.column,\n row: edit.startPosition.row,\n },\n endPosition: {\n column: edit.newEndPosition.column,\n row: edit.newEndPosition.row,\n },\n startIndex: edit.startIndex,\n endIndex: edit.newEndIndex,\n }\n }\n\n async handleEdits(\n bufferId: number,\n content: string,\n edits: Edit[],\n ): Promise<{ highlights?: HighlightResponse[]; warning?: string; error?: string }> {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return { warning: \"No parser state found for buffer\" }\n }\n\n parserState.content = content\n\n for (const edit of edits) {\n parserState.tree.edit(edit)\n }\n\n const startParse = performance.now()\n\n const newTree = parserState.parser.parse(content, parserState.tree)\n\n const endParse = performance.now()\n const parseTime = endParse - startParse\n this.performance.parseTimes.push(parseTime)\n if (this.performance.parseTimes.length > 10) {\n this.performance.parseTimes.shift()\n }\n this.performance.averageParseTime =\n this.performance.parseTimes.reduce((acc, time) => acc + time, 0) / this.performance.parseTimes.length\n\n if (!newTree) {\n return { error: \"Failed to parse buffer\" }\n }\n\n const changedRanges = parserState.tree.getChangedRanges(newTree)\n parserState.tree = newTree\n\n const startQuery = performance.now()\n const matches: QueryCapture[] = []\n\n if (changedRanges.length === 0) {\n edits.forEach((edit) => {\n const range = this.editToRange(edit)\n changedRanges.push(range)\n })\n }\n\n for (const range of changedRanges) {\n let node = parserState.tree.rootNode.descendantForPosition(range.startPosition, range.endPosition)\n\n if (!node) {\n continue\n }\n\n // If we got the root node, query with range to limit scope\n if (node.equals(parserState.tree.rootNode)) {\n // WHY ARE RANGES NOT WORKING!?\n // The changed ranges are not returning anything in some cases\n // Even this shit somehow returns many lines before the actual range,\n // and even though expanded by 1000 bytes it does not capture much beyond the actual range.\n // So freaking weird.\n const rangeCaptures = parserState.queries.highlights.captures(\n node,\n // WTF!?\n {\n startIndex: range.startIndex - 100,\n endIndex: range.endIndex + 1000,\n },\n )\n matches.push(...rangeCaptures)\n continue\n }\n\n while (node && !this.nodeContainsRange(node, range)) {\n node = node.parent\n }\n\n if (!node) {\n node = parserState.tree.rootNode\n }\n\n const nodeCaptures = parserState.queries.highlights.captures(node)\n matches.push(...nodeCaptures)\n }\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n // Only add injection matches that are in the changed ranges\n // This is a simplification - ideally we'd only process injections in changed ranges\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n const endQuery = performance.now()\n const queryTime = endQuery - startQuery\n this.performance.queryTimes.push(queryTime)\n if (this.performance.queryTimes.length > 10) {\n this.performance.queryTimes.shift()\n }\n this.performance.averageQueryTime =\n this.performance.queryTimes.reduce((acc, time) => acc + time, 0) / this.performance.queryTimes.length\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n private nodeContainsRange(node: any, range: any): boolean {\n return (\n node.startPosition.row <= range.startPosition.row &&\n node.endPosition.row >= range.endPosition.row &&\n (node.startPosition.row < range.startPosition.row || node.startPosition.column <= range.startPosition.column) &&\n (node.endPosition.row > range.endPosition.row || node.endPosition.column >= range.endPosition.column)\n )\n }\n\n private getHighlights(\n parserState: ParserState,\n matches: QueryCapture[],\n injectionRanges?: Map<string, Array<{ start: number; end: number }>>,\n ): { highlights: HighlightResponse[] } {\n const lineHighlights: Map<number, Map<number, HighlightRange>> = new Map()\n const droppedHighlights: Map<number, Map<number, HighlightRange>> = new Map()\n\n for (const match of matches) {\n const node = match.node\n const startLine = node.startPosition.row\n const endLine = node.endPosition.row\n\n const highlight = {\n startCol: node.startPosition.column,\n endCol: node.endPosition.column,\n group: match.name,\n }\n\n if (!lineHighlights.has(startLine)) {\n lineHighlights.set(startLine, new Map())\n droppedHighlights.set(startLine, new Map())\n }\n if (lineHighlights.get(startLine)?.has(node.id)) {\n droppedHighlights.get(startLine)?.set(node.id, lineHighlights.get(startLine)?.get(node.id)!)\n }\n lineHighlights.get(startLine)?.set(node.id, highlight)\n\n if (startLine !== endLine) {\n for (let line = startLine + 1; line <= endLine; line++) {\n if (!lineHighlights.has(line)) {\n lineHighlights.set(line, new Map())\n }\n const hl: HighlightRange = {\n startCol: 0,\n endCol: node.endPosition.column,\n group: match.name,\n }\n lineHighlights.get(line)?.set(node.id, hl)\n }\n }\n }\n\n return {\n highlights: Array.from(lineHighlights.entries()).map(([line, lineHighlights]) => ({\n line,\n highlights: Array.from(lineHighlights.values()),\n droppedHighlights: droppedHighlights.get(line) ? Array.from(droppedHighlights.get(line)!.values()) : [],\n })),\n }\n }\n\n private getSimpleHighlights(\n matches: QueryCapture[],\n injectionRanges: Map<string, Array<{ start: number; end: number }>>,\n ): SimpleHighlight[] {\n const highlights: SimpleHighlight[] = []\n\n const flatInjectionRanges: Array<{ start: number; end: number; lang: string }> = []\n for (const [lang, ranges] of injectionRanges.entries()) {\n for (const range of ranges) {\n flatInjectionRanges.push({ ...range, lang })\n }\n }\n\n for (const match of matches) {\n const node = match.node\n\n let isInjection = false\n let injectionLang: string | undefined\n let containsInjection = false\n for (const injRange of flatInjectionRanges) {\n if (node.startIndex >= injRange.start && node.endIndex <= injRange.end) {\n isInjection = true\n injectionLang = injRange.lang\n break\n } else if (node.startIndex <= injRange.start && node.endIndex >= injRange.end) {\n containsInjection = true\n break\n }\n }\n\n const matchQuery = (match as any)._injectedQuery\n const patternProperties = matchQuery?.setProperties?.[match.patternIndex]\n\n const concealValue = patternProperties?.conceal ?? match.setProperties?.conceal\n const concealLines = patternProperties?.conceal_lines ?? match.setProperties?.conceal_lines\n\n const meta: any = {}\n if (isInjection && injectionLang) {\n meta.isInjection = true\n meta.injectionLang = injectionLang\n }\n if (containsInjection) {\n meta.containsInjection = true\n }\n if (concealValue !== undefined) {\n meta.conceal = concealValue\n }\n if (concealLines !== undefined) {\n meta.concealLines = concealLines\n }\n\n if (Object.keys(meta).length > 0) {\n highlights.push([node.startIndex, node.endIndex, match.name, meta])\n } else {\n highlights.push([node.startIndex, node.endIndex, match.name])\n }\n }\n\n highlights.sort((a, b) => a[0] - b[0])\n\n return highlights\n }\n\n async handleResetBuffer(\n bufferId: number,\n version: number,\n content: string,\n ): Promise<{ highlights?: HighlightResponse[]; warning?: string; error?: string }> {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return { warning: \"No parser state found for buffer\" }\n }\n\n parserState.content = content\n\n const newTree = parserState.parser.parse(content)\n\n if (!newTree) {\n return { error: \"Failed to parse buffer during reset\" }\n }\n\n parserState.tree = newTree\n const matches = parserState.queries.highlights.captures(parserState.tree.rootNode)\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (parserState.queries.injections) {\n const injectionResult = await this.processInjections(parserState)\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n return this.getHighlights(parserState, matches, injectionRanges)\n }\n\n disposeBuffer(bufferId: number): void {\n const parserState = this.bufferParsers.get(bufferId)\n if (!parserState) {\n return\n }\n\n parserState.tree.delete()\n parserState.parser.delete()\n\n this.bufferParsers.delete(bufferId)\n }\n\n async handleOneShotHighlight(content: string, filetype: string, messageId: string): Promise<void> {\n const reusableState = await this.getReusableParser(filetype)\n\n if (!reusableState) {\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: false,\n warning: `No parser available for filetype ${filetype}`,\n })\n return\n }\n\n // Markdown Parser BUG: For markdown, ensure content ends with newline so closing delimiters are parsed correctly\n // The tree-sitter markdown parser only creates closing delimiter nodes when followed by newline\n const parseContent = filetype === \"markdown\" && content.endsWith(\"```\") ? content + \"\\n\" : content\n\n const tree = reusableState.parser.parse(parseContent)\n\n if (!tree) {\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: false,\n error: \"Failed to parse content\",\n })\n return\n }\n\n try {\n const matches = reusableState.filetypeParser.queries.highlights.captures(tree.rootNode)\n\n let injectionRanges = new Map<string, Array<{ start: number; end: number }>>()\n if (reusableState.filetypeParser.queries.injections) {\n const parserState: ParserState = {\n parser: reusableState.parser,\n tree,\n queries: reusableState.filetypeParser.queries,\n filetype,\n content,\n injectionMapping: reusableState.filetypeParser.injectionMapping,\n }\n const injectionResult = await this.processInjections(parserState)\n\n matches.push(...injectionResult.captures)\n injectionRanges = injectionResult.injectionRanges\n }\n\n const highlights = this.getSimpleHighlights(matches, injectionRanges)\n\n self.postMessage({\n type: \"ONESHOT_HIGHLIGHT_RESPONSE\",\n messageId,\n hasParser: true,\n highlights,\n })\n } finally {\n tree.delete()\n }\n }\n\n async updateDataPath(dataPath: string): Promise<void> {\n this.dataPath = dataPath\n this.tsDataPath = path.join(dataPath, \"tree-sitter\")\n\n try {\n await mkdir(path.join(this.tsDataPath, \"languages\"), { recursive: true })\n await mkdir(path.join(this.tsDataPath, \"queries\"), { recursive: true })\n } catch (error) {\n throw new Error(`Failed to update data path: ${error}`)\n }\n }\n\n async clearCache(): Promise<void> {\n if (!this.dataPath || !this.tsDataPath) {\n throw new Error(\"No data path configured\")\n }\n\n const { rm } = await import(\"fs/promises\")\n\n try {\n const treeSitterPath = path.join(this.dataPath, \"tree-sitter\")\n\n await rm(treeSitterPath, { recursive: true, force: true })\n\n await mkdir(path.join(treeSitterPath, \"languages\"), { recursive: true })\n await mkdir(path.join(treeSitterPath, \"queries\"), { recursive: true })\n\n this.filetypeParsers.clear()\n this.filetypeParserPromises.clear()\n this.reusableParsers.clear()\n this.reusableParserPromises.clear()\n } catch (error) {\n throw new Error(`Failed to clear cache: ${error}`)\n }\n }\n}\nif (!isMainThread) {\n const worker = new ParserWorker()\n\n function logMessage(type: \"log\" | \"error\" | \"warn\", ...args: any[]) {\n self.postMessage({\n type: \"WORKER_LOG\",\n logType: type,\n data: args,\n })\n }\n console.log = (...args) => logMessage(\"log\", ...args)\n console.error = (...args) => logMessage(\"error\", ...args)\n console.warn = (...args) => logMessage(\"warn\", ...args)\n\n // @ts-ignore - we'll fix this in the future for sure\n self.onmessage = async (e: MessageEvent) => {\n const { type, bufferId, version, content, filetype, edits, filetypeParser, messageId, dataPath } = e.data\n\n try {\n switch (type) {\n case \"INIT\":\n try {\n await worker.initialize({ dataPath })\n self.postMessage({ type: \"INIT_RESPONSE\" })\n } catch (error) {\n self.postMessage({\n type: \"INIT_RESPONSE\",\n error: error instanceof Error ? error.stack || error.message : String(error),\n })\n }\n break\n\n case \"ADD_FILETYPE_PARSER\":\n worker.addFiletypeParser(filetypeParser)\n break\n\n case \"PRELOAD_PARSER\":\n const maybeParser = await worker.preloadParser(filetype)\n self.postMessage({ type: \"PRELOAD_PARSER_RESPONSE\", messageId, hasParser: !!maybeParser })\n break\n\n case \"INITIALIZE_PARSER\":\n await worker.handleInitializeParser(bufferId, version, content, filetype, messageId)\n break\n\n case \"HANDLE_EDITS\":\n const response = await worker.handleEdits(bufferId, content, edits)\n if (response.highlights && response.highlights.length > 0) {\n self.postMessage({ type: \"HIGHLIGHT_RESPONSE\", bufferId, version, ...response })\n } else if (response.warning) {\n self.postMessage({ type: \"WARNING\", bufferId, warning: response.warning })\n } else if (response.error) {\n self.postMessage({ type: \"ERROR\", bufferId, error: response.error })\n }\n break\n\n case \"GET_PERFORMANCE\":\n self.postMessage({ type: \"PERFORMANCE_RESPONSE\", performance: worker.performance, messageId })\n break\n\n case \"RESET_BUFFER\":\n const resetResponse = await worker.handleResetBuffer(bufferId, version, content)\n if (resetResponse.highlights && resetResponse.highlights.length > 0) {\n self.postMessage({ type: \"HIGHLIGHT_RESPONSE\", bufferId, version, ...resetResponse })\n } else if (resetResponse.warning) {\n self.postMessage({ type: \"WARNING\", bufferId, warning: resetResponse.warning })\n } else if (resetResponse.error) {\n self.postMessage({ type: \"ERROR\", bufferId, error: resetResponse.error })\n }\n break\n\n case \"DISPOSE_BUFFER\":\n worker.disposeBuffer(bufferId)\n self.postMessage({ type: \"BUFFER_DISPOSED\", bufferId })\n break\n\n case \"ONESHOT_HIGHLIGHT\":\n await worker.handleOneShotHighlight(content, filetype, messageId)\n break\n\n case \"UPDATE_DATA_PATH\":\n try {\n await worker.updateDataPath(dataPath)\n self.postMessage({ type: \"UPDATE_DATA_PATH_RESPONSE\", messageId })\n } catch (error) {\n self.postMessage({\n type: \"UPDATE_DATA_PATH_RESPONSE\",\n messageId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n break\n\n case \"CLEAR_CACHE\":\n try {\n await worker.clearCache()\n self.postMessage({ type: \"CLEAR_CACHE_RESPONSE\", messageId })\n } catch (error) {\n self.postMessage({\n type: \"CLEAR_CACHE_RESPONSE\",\n messageId,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n break\n\n default:\n self.postMessage({\n type: \"ERROR\",\n bufferId,\n error: `Unknown message type: ${type}`,\n })\n }\n } catch (error) {\n self.postMessage({\n type: \"ERROR\",\n bufferId,\n error: error instanceof Error ? error.stack || error.message : String(error),\n })\n }\n }\n}\n",
6
+ "import { mkdir, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport interface DownloadResult {\n content?: ArrayBuffer\n filePath?: string\n error?: string\n}\n\nexport class DownloadUtils {\n private static hashUrl(url: string): string {\n let hash = 0\n for (let i = 0; i < url.length; i++) {\n const char = url.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash = hash & hash\n }\n return Math.abs(hash).toString(16)\n }\n\n /**\n * Download a file from URL or load from local path, with caching support\n */\n static async downloadOrLoad(\n source: string,\n cacheDir: string,\n cacheSubdir: string,\n fileExtension: string,\n useHashForCache: boolean = true,\n filetype?: string,\n ): Promise<DownloadResult> {\n const isUrl = source.startsWith(\"http://\") || source.startsWith(\"https://\")\n\n if (isUrl) {\n let cacheFileName: string\n if (useHashForCache) {\n const hash = this.hashUrl(source)\n cacheFileName = filetype ? `${filetype}-${hash}${fileExtension}` : `${hash}${fileExtension}`\n } else {\n cacheFileName = path.basename(source)\n }\n const cacheFile = path.join(cacheDir, cacheSubdir, cacheFileName)\n\n // Ensure cache directory exists\n await mkdir(path.dirname(cacheFile), { recursive: true })\n\n try {\n const cachedContent = await Bun.file(cacheFile).arrayBuffer()\n if (cachedContent.byteLength > 0) {\n console.log(`Loaded from cache: ${cacheFile} (${source})`)\n return { content: cachedContent, filePath: cacheFile }\n }\n } catch (error) {\n // Cache miss, continue to fetch\n }\n\n try {\n console.log(`Downloading from URL: ${source}`)\n const response = await fetch(source)\n if (!response.ok) {\n return { error: `Failed to fetch from ${source}: ${response.statusText}` }\n }\n const content = await response.arrayBuffer()\n\n try {\n await writeFile(cacheFile, Buffer.from(content))\n console.log(`Cached: ${source}`)\n } catch (cacheError) {\n console.warn(`Failed to cache: ${cacheError}`)\n }\n\n return { content, filePath: cacheFile }\n } catch (error) {\n return { error: `Error downloading from ${source}: ${error}` }\n }\n } else {\n try {\n console.log(`Loading from local path: ${source}`)\n const content = await Bun.file(source).arrayBuffer()\n return { content, filePath: source }\n } catch (error) {\n return { error: `Error loading from local path ${source}: ${error}` }\n }\n }\n }\n\n /**\n * Download and save a file to a specific target path\n */\n static async downloadToPath(source: string, targetPath: string): Promise<DownloadResult> {\n const isUrl = source.startsWith(\"http://\") || source.startsWith(\"https://\")\n\n await mkdir(path.dirname(targetPath), { recursive: true })\n\n if (isUrl) {\n try {\n console.log(`Downloading from URL: ${source}`)\n const response = await fetch(source)\n if (!response.ok) {\n return { error: `Failed to fetch from ${source}: ${response.statusText}` }\n }\n const content = await response.arrayBuffer()\n\n await writeFile(targetPath, Buffer.from(content))\n console.log(`Downloaded: ${source} -> ${targetPath}`)\n\n return { content, filePath: targetPath }\n } catch (error) {\n return { error: `Error downloading from ${source}: ${error}` }\n }\n } else {\n try {\n console.log(`Copying from local path: ${source}`)\n const content = await Bun.file(source).arrayBuffer()\n await writeFile(targetPath, Buffer.from(content))\n return { content, filePath: targetPath }\n } catch (error) {\n return { error: `Error copying from local path ${source}: ${error}` }\n }\n }\n }\n\n /**\n * Fetch multiple highlight queries and concatenate them\n */\n static async fetchHighlightQueries(sources: string[], cacheDir: string, filetype: string): Promise<string> {\n const queryPromises = sources.map((source) => this.fetchHighlightQuery(source, cacheDir, filetype))\n const queryResults = await Promise.all(queryPromises)\n\n const validQueries = queryResults.filter((query) => query.trim().length > 0)\n return validQueries.join(\"\\n\")\n }\n\n private static async fetchHighlightQuery(source: string, cacheDir: string, filetype: string): Promise<string> {\n const result = await this.downloadOrLoad(source, cacheDir, \"queries\", \".scm\", true, filetype)\n\n if (result.error) {\n console.error(`Error fetching highlight query from ${source}:`, result.error)\n return \"\"\n }\n\n if (result.content) {\n return new TextDecoder().decode(result.content)\n }\n\n return \"\"\n }\n}\n",
7
+ "import { basename, join } from \"node:path\"\n\nexport function isBunfsPath(path: string): boolean {\n // Removed ambiguous '//' check\n return path.includes(\"$bunfs\") || /^B:[\\\\/]~BUN/i.test(path)\n}\n\nexport function getBunfsRootPath(): string {\n return process.platform === \"win32\" ? \"B:\\\\~BUN\\\\root\" : \"/$bunfs/root\"\n}\n\n/**\n * Normalizes a path to the embedded root.\n * Flattens directory structure to ensure file exists at root.\n */\nexport function normalizeBunfsPath(fileName: string): string {\n return join(getBunfsRootPath(), basename(fileName))\n}\n"
7
8
  ],
8
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAEA,kBAAS;AACT;;;ACHA;AACA;AAAA;AAQO,MAAM,cAAc;AAAA,SACV,OAAO,CAAC,KAAqB;AAAA,IAC1C,IAAI,OAAO;AAAA,IACX,SAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AAAA,MACnC,MAAM,OAAO,IAAI,WAAW,CAAC;AAAA,MAC7B,QAAQ,QAAQ,KAAK,OAAO;AAAA,MAC5B,OAAO,OAAO;AAAA,IAChB;AAAA,IACA,OAAO,KAAK,IAAI,IAAI,EAAE,SAAS,EAAE;AAAA;AAAA,cAMtB,eAAc,CACzB,QACA,UACA,aACA,eACA,kBAA2B,MAC3B,UACyB;AAAA,IACzB,MAAM,QAAQ,OAAO,WAAW,SAAS,KAAK,OAAO,WAAW,UAAU;AAAA,IAE1E,IAAI,OAAO;AAAA,MACT,IAAI;AAAA,MACJ,IAAI,iBAAiB;AAAA,QACnB,MAAM,OAAO,KAAK,QAAQ,MAAM;AAAA,QAChC,gBAAgB,WAAW,GAAG,YAAY,OAAO,kBAAkB,GAAG,OAAO;AAAA,MAC/E,EAAO;AAAA,QACL,gBAAqB,cAAS,MAAM;AAAA;AAAA,MAEtC,MAAM,YAAiB,UAAK,UAAU,aAAa,aAAa;AAAA,MAGhE,MAAM,MAAW,aAAQ,SAAS,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,MAExD,IAAI;AAAA,QACF,MAAM,gBAAgB,MAAM,IAAI,KAAK,SAAS,EAAE,YAAY;AAAA,QAC5D,IAAI,c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,UACH,IAAI;AAAA,YACF,MAAM,OAAO,WAAW;AAAA,YACxB,KAAK,YAAY,EAAE,MAAM,wBAAwB,UAAU,CAAC;AAAA,YAC5D,OAAO,OAAO;AAAA,YACd,KAAK,YAAY;AAAA,cACf,MAAM;AAAA,cACN;AAAA,cACA,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,YAC9D,CAAC;AAAA;AAAA,UAEH;AAAA;AAAA,UAGA,KAAK,YAAY;AAAA,YACf,MAAM;AAAA,YACN;AAAA,YACA,OAAO,yBAAyB;AAAA,UAClC,CAAC;AAAA;AAAA,MAEL,OAAO,OAAO;AAAA,MACd,KAAK,YAAY;AAAA,QACf,MAAM;AAAA,QACN;AAAA,QACA,OAAO,iBAAiB,QAAQ,MAAM,SAAS,MAAM,UAAU,OAAO,KAAK;AAAA,MAC7E,CAAC;AAAA;AAAA;AAGP;",
10
+ "debugId": "F5C8191D269AAAF964756E2164756E21",
10
11
  "names": []
11
12
  }
@@ -3,6 +3,9 @@ import type { KeyEvent } from "../lib/KeyHandler";
3
3
  import { type ColorInput } from "../lib/RGBA";
4
4
  import { Renderable, type RenderableOptions } from "../Renderable";
5
5
  import type { RenderContext, CursorStyleOptions } from "../types";
6
+ import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
7
+ export type InputAction = "move-left" | "move-right" | "move-home" | "move-end" | "delete-backward" | "delete-forward" | "submit";
8
+ export type InputKeyBinding = BaseKeyBinding<InputAction>;
6
9
  export interface InputRenderableOptions extends RenderableOptions<InputRenderable> {
7
10
  backgroundColor?: ColorInput;
8
11
  textColor?: ColorInput;
@@ -14,6 +17,8 @@ export interface InputRenderableOptions extends RenderableOptions<InputRenderabl
14
17
  cursorStyle?: CursorStyleOptions;
15
18
  maxLength?: number;
16
19
  value?: string;
20
+ keyBindings?: InputKeyBinding[];
21
+ keyAliasMap?: KeyAliasMap;
17
22
  }
18
23
  export declare enum InputRenderableEvents {
19
24
  INPUT = "input",
@@ -34,6 +39,9 @@ export declare class InputRenderable extends Renderable {
34
39
  private _cursorStyle;
35
40
  private _maxLength;
36
41
  private _lastCommittedValue;
42
+ private _keyBindingsMap;
43
+ private _keyAliasMap;
44
+ private _keyBindings;
37
45
  protected _defaultOptions: {
38
46
  backgroundColor: string;
39
47
  textColor: string;
@@ -75,4 +83,6 @@ export declare class InputRenderable extends Renderable {
75
83
  updateFromLayout(): void;
76
84
  protected onResize(width: number, height: number): void;
77
85
  protected onRemove(): void;
86
+ set keyBindings(bindings: InputKeyBinding[]);
87
+ set keyAliasMap(aliases: KeyAliasMap);
78
88
  }
@@ -4,11 +4,14 @@ import type { KeyEvent } from "../lib/KeyHandler";
4
4
  import { type ColorInput } from "../lib/RGBA";
5
5
  import { Renderable, type RenderableOptions } from "../Renderable";
6
6
  import type { RenderContext } from "../types";
7
+ import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
7
8
  export interface SelectOption {
8
9
  name: string;
9
10
  description: string;
10
11
  value?: any;
11
12
  }
13
+ export type SelectAction = "move-up" | "move-down" | "move-up-fast" | "move-down-fast" | "select-current";
14
+ export type SelectKeyBinding = BaseKeyBinding<SelectAction>;
12
15
  export interface SelectRenderableOptions extends RenderableOptions<SelectRenderable> {
13
16
  backgroundColor?: ColorInput;
14
17
  textColor?: ColorInput;
@@ -26,6 +29,8 @@ export interface SelectRenderableOptions extends RenderableOptions<SelectRendera
26
29
  font?: keyof typeof fonts;
27
30
  itemSpacing?: number;
28
31
  fastScrollStep?: number;
32
+ keyBindings?: SelectKeyBinding[];
33
+ keyAliasMap?: KeyAliasMap;
29
34
  }
30
35
  export declare enum SelectRenderableEvents {
31
36
  SELECTION_CHANGED = "selectionChanged",
@@ -53,6 +58,9 @@ export declare class SelectRenderable extends Renderable {
53
58
  private linesPerItem;
54
59
  private fontHeight;
55
60
  private _fastScrollStep;
61
+ private _keyBindingsMap;
62
+ private _keyAliasMap;
63
+ private _keyBindings;
56
64
  protected _defaultOptions: {
57
65
  backgroundColor: string;
58
66
  textColor: string;
@@ -101,5 +109,7 @@ export declare class SelectRenderable extends Renderable {
101
109
  set font(font: keyof typeof fonts);
102
110
  set itemSpacing(spacing: number);
103
111
  set fastScrollStep(step: number);
112
+ set keyBindings(bindings: SelectKeyBinding[]);
113
+ set keyAliasMap(aliases: KeyAliasMap);
104
114
  set selectedIndex(value: number);
105
115
  }
@@ -3,11 +3,14 @@ import { OptimizedBuffer } from "../buffer";
3
3
  import { type ColorInput } from "../lib/RGBA";
4
4
  import type { KeyEvent } from "../lib/KeyHandler";
5
5
  import type { RenderContext } from "../types";
6
+ import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
6
7
  export interface TabSelectOption {
7
8
  name: string;
8
9
  description: string;
9
10
  value?: any;
10
11
  }
12
+ export type TabSelectAction = "move-left" | "move-right" | "select-current";
13
+ export type TabSelectKeyBinding = BaseKeyBinding<TabSelectAction>;
11
14
  export interface TabSelectRenderableOptions extends Omit<RenderableOptions<TabSelectRenderable>, "height"> {
12
15
  height?: number;
13
16
  options?: TabSelectOption[];
@@ -23,6 +26,8 @@ export interface TabSelectRenderableOptions extends Omit<RenderableOptions<TabSe
23
26
  showDescription?: boolean;
24
27
  showUnderline?: boolean;
25
28
  wrapSelection?: boolean;
29
+ keyBindings?: TabSelectKeyBinding[];
30
+ keyAliasMap?: KeyAliasMap;
26
31
  }
27
32
  export declare enum TabSelectRenderableEvents {
28
33
  SELECTION_CHANGED = "selectionChanged",
@@ -46,6 +51,9 @@ export declare class TabSelectRenderable extends Renderable {
46
51
  private _showDescription;
47
52
  private _showUnderline;
48
53
  private _wrapSelection;
54
+ private _keyBindingsMap;
55
+ private _keyAliasMap;
56
+ private _keyBindings;
49
57
  constructor(ctx: RenderContext, options: TabSelectRenderableOptions);
50
58
  private calculateDynamicHeight;
51
59
  protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
@@ -83,4 +91,6 @@ export declare class TabSelectRenderable extends Renderable {
83
91
  set wrapSelection(wrap: boolean);
84
92
  get tabWidth(): number;
85
93
  set tabWidth(tabWidth: number);
94
+ set keyBindings(bindings: TabSelectKeyBinding[]);
95
+ set keyAliasMap(aliases: KeyAliasMap);
86
96
  }
@@ -2,7 +2,7 @@ import { type RenderContext } from "../types";
2
2
  import { EditBufferRenderable, type EditBufferOptions } from "./EditBufferRenderable";
3
3
  import type { KeyEvent, PasteEvent } from "../lib/KeyHandler";
4
4
  import { RGBA, type ColorInput } from "../lib/RGBA";
5
- import { type KeyBinding as BaseKeyBinding } from "../lib/keymapping";
5
+ import { type KeyBinding as BaseKeyBinding, type KeyAliasMap } from "../lib/keymapping";
6
6
  import { type StyledText } from "../lib/styled-text";
7
7
  import type { ExtmarksController } from "../lib/extmarks";
8
8
  export type TextareaAction = "move-left" | "move-right" | "move-up" | "move-down" | "select-left" | "select-right" | "select-up" | "select-down" | "line-home" | "line-end" | "select-line-home" | "select-line-end" | "buffer-home" | "buffer-end" | "select-buffer-home" | "select-buffer-end" | "delete-line" | "delete-to-line-end" | "delete-to-line-start" | "backspace" | "delete" | "newline" | "undo" | "redo" | "word-forward" | "word-backward" | "select-word-forward" | "select-word-backward" | "delete-word-forward" | "delete-word-backward" | "submit";
@@ -17,6 +17,7 @@ export interface TextareaOptions extends EditBufferOptions {
17
17
  focusedTextColor?: ColorInput;
18
18
  placeholder?: StyledText | string | null;
19
19
  keyBindings?: KeyBinding[];
20
+ keyAliasMap?: KeyAliasMap;
20
21
  onSubmit?: (event: SubmitEvent) => void;
21
22
  }
22
23
  export declare class TextareaRenderable extends EditBufferRenderable {
@@ -26,6 +27,8 @@ export declare class TextareaRenderable extends EditBufferRenderable {
26
27
  private _focusedBackgroundColor;
27
28
  private _focusedTextColor;
28
29
  private _keyBindingsMap;
30
+ private _keyAliasMap;
31
+ private _keyBindings;
29
32
  private _actionHandlers;
30
33
  private _initialValueSet;
31
34
  private _submitListener;
@@ -95,5 +98,6 @@ export declare class TextareaRenderable extends EditBufferRenderable {
95
98
  set onSubmit(handler: ((event: SubmitEvent) => void) | undefined);
96
99
  get onSubmit(): ((event: SubmitEvent) => void) | undefined;
97
100
  set keyBindings(bindings: KeyBinding[]);
101
+ set keyAliasMap(aliases: KeyAliasMap);
98
102
  get extmarks(): ExtmarksController;
99
103
  }
package/renderer.d.ts CHANGED
@@ -14,6 +14,7 @@ export interface CliRendererConfig {
14
14
  stdin?: NodeJS.ReadStream;
15
15
  stdout?: NodeJS.WriteStream;
16
16
  exitOnCtrlC?: boolean;
17
+ exitSignals?: NodeJS.Signals[];
17
18
  debounceDelay?: number;
18
19
  targetFps?: number;
19
20
  maxFps?: number;
@@ -90,6 +91,8 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
90
91
  stdin: NodeJS.ReadStream;
91
92
  private stdout;
92
93
  private exitOnCtrlC;
94
+ private exitSignals;
95
+ private _exitListenersAdded;
93
96
  private _isDestroyed;
94
97
  nextRenderBuffer: OptimizedBuffer;
95
98
  currentRenderBuffer: OptimizedBuffer;
@@ -168,12 +171,16 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
168
171
  private inputHandlers;
169
172
  private prependedInputHandlers;
170
173
  private idleResolvers;
174
+ private _debugInputs;
175
+ private _debugModeEnabled;
171
176
  private handleError;
172
177
  private dumpOutputCache;
173
178
  private exitHandler;
174
179
  private warningHandler;
175
180
  get controlState(): RendererControlState;
176
181
  constructor(lib: RenderLib, rendererPtr: Pointer, stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, width: number, height: number, config?: CliRendererConfig);
182
+ private addExitListeners;
183
+ private removeExitListeners;
177
184
  get isDestroyed(): boolean;
178
185
  registerLifecyclePass(renderable: Renderable): void;
179
186
  unregisterLifecyclePass(renderable: Renderable): void;
@@ -204,6 +211,10 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
204
211
  get liveRequestCount(): number;
205
212
  get currentControlState(): string;
206
213
  get capabilities(): any | null;
214
+ getDebugInputs(): Array<{
215
+ timestamp: string;
216
+ sequence: string;
217
+ }>;
207
218
  get useKittyKeyboard(): boolean;
208
219
  set useKittyKeyboard(use: boolean);
209
220
  set experimental_splitHeight(splitHeight: number);
package/testing.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  CliRenderer,
5
5
  TreeSitterClient,
6
6
  resolveRenderLib
7
- } from "./index-0razn4m6.js";
7
+ } from "./index-crebvcxc.js";
8
8
 
9
9
  // src/testing/test-renderer.ts
10
10
  import { Readable } from "stream";