@opentui/core
Advanced tools
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { after, afterEach, before, beforeEach, describe, it, test } from "node:test"; | ||
| type ThrowMatcher = RegExp | string | Error | ((value: unknown) => boolean) | (new (...args: any[]) => Error); | ||
| declare class Expectation<T> { | ||
| private readonly received; | ||
| constructor(received: T); | ||
| toBe(expected: T): void; | ||
| toBeNull(): void; | ||
| toEqual(expected: unknown): void; | ||
| toThrow(expected?: ThrowMatcher): void; | ||
| } | ||
| export declare function expect<T>(received: T): Expectation<T>; | ||
| export { after, afterEach, before, beforeEach, describe, it, test }; |
| export {}; |
| const errorMessage = "@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint." | ||
| export function ensureRuntimePluginSupport() { | ||
| throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function createRuntimePlugin() { | ||
| throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function runtimeModuleIdForSpecifier() { | ||
| throw new Error("@opentui/core/runtime-plugin-support/configure is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| throw new Error(errorMessage) |
| const errorMessage = "@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint." | ||
| export function ensureRuntimePluginSupport() { | ||
| throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function createRuntimePlugin() { | ||
| throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function runtimeModuleIdForSpecifier() { | ||
| throw new Error("@opentui/core/runtime-plugin-support is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| throw new Error(errorMessage) |
| const errorMessage = "@opentui/core/runtime-plugin is Bun-only and is not available in Node.js. Use Bun to import this entrypoint." | ||
| export function createRuntimePlugin() { | ||
| throw new Error("@opentui/core/runtime-plugin is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function isCoreRuntimeModuleSpecifier() { | ||
| throw new Error("@opentui/core/runtime-plugin is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| export function runtimeModuleIdForSpecifier() { | ||
| throw new Error("@opentui/core/runtime-plugin is Bun-only and is not available in Node.js. Use Bun to import this entrypoint.") | ||
| } | ||
| throw new Error(errorMessage) |
| import { after, afterEach, before, beforeEach, describe as nodeDescribe, test as nodeTest } from "node:test"; | ||
| type AnyFunction = (...args: any[]) => any; | ||
| type ThrowMatcher = RegExp | string | Error | ((value: unknown) => boolean) | (new (...args: any[]) => Error); | ||
| declare const asymmetricMatcher: unique symbol; | ||
| interface AsymmetricMatcher { | ||
| readonly [asymmetricMatcher]: true; | ||
| matches(received: unknown): boolean; | ||
| } | ||
| interface MockedFunction<Fn extends AnyFunction = AnyFunction> { | ||
| (...args: Parameters<Fn>): ReturnType<Fn>; | ||
| mock: { | ||
| calls: unknown[][]; | ||
| }; | ||
| mockImplementation(implementation: Fn): MockedFunction<Fn>; | ||
| mockRestore(): void; | ||
| mockClear(): void; | ||
| } | ||
| declare function createEach(base: AnyFunction): (cases: readonly unknown[]) => (name: string, optionsOrFn?: unknown, maybeFn?: unknown) => void; | ||
| declare class AsyncExpectation<T> { | ||
| private readonly received; | ||
| private readonly mode; | ||
| private readonly inverted; | ||
| constructor(received: PromiseLike<T> | T, mode: "resolves" | "rejects", inverted?: boolean); | ||
| get not(): AsyncExpectation<T>; | ||
| toBe(expected: unknown): Promise<void>; | ||
| toEqual(expected: unknown): Promise<void>; | ||
| toBeNull(): Promise<void>; | ||
| toBeUndefined(): Promise<void>; | ||
| toContain(expected: unknown): Promise<void>; | ||
| toMatchSnapshot(snapshotName?: string): Promise<void>; | ||
| toMatchInlineSnapshot(snapshot: string): Promise<void>; | ||
| toThrow(expected?: ThrowMatcher): Promise<void>; | ||
| toHaveBeenCalled(): Promise<void>; | ||
| toHaveBeenCalledTimes(expected: number): Promise<void>; | ||
| toHaveBeenCalledWith(...expectedArgs: unknown[]): Promise<void>; | ||
| private unwrap; | ||
| } | ||
| declare class Expectation<T> { | ||
| private readonly received; | ||
| private readonly inverted; | ||
| constructor(received: T, inverted?: boolean); | ||
| get not(): Expectation<T>; | ||
| get resolves(): AsyncExpectation<T>; | ||
| get rejects(): AsyncExpectation<T>; | ||
| toBe(expected: unknown): void; | ||
| toEqual(expected: unknown): void; | ||
| toBeNull(): void; | ||
| toBeUndefined(): void; | ||
| toBeDefined(): void; | ||
| toContain(expected: unknown): void; | ||
| toHaveLength(expected: number): void; | ||
| toBeInstanceOf(expected: new (...args: any[]) => unknown): void; | ||
| toMatchObject(expected: object): void; | ||
| toBeTruthy(): void; | ||
| toBeFalsy(): void; | ||
| toBeGreaterThan(expected: number | bigint): void; | ||
| toBeGreaterThanOrEqual(expected: number | bigint): void; | ||
| toBeLessThan(expected: number | bigint): void; | ||
| toBeLessThanOrEqual(expected: number | bigint): void; | ||
| toBeCloseTo(expected: number, precision?: number): void; | ||
| toMatch(expected: RegExp | string): void; | ||
| toMatchSnapshot(snapshotName?: string): void; | ||
| toMatchInlineSnapshot(snapshot: string): void; | ||
| toThrow(expected?: ThrowMatcher): void; | ||
| toHaveBeenCalled(): void; | ||
| toHaveBeenCalledTimes(expected: number): void; | ||
| toHaveBeenCalledWith(...expectedArgs: unknown[]): void; | ||
| toHaveProperty(property: PropertyKey, expectedValue?: unknown): void; | ||
| private assertMatch; | ||
| } | ||
| interface ExpectApi { | ||
| <T>(received: T): Expectation<T>; | ||
| any(expectedType: unknown): AsymmetricMatcher; | ||
| } | ||
| export declare const expect: ExpectApi; | ||
| export declare function mock<Fn extends AnyFunction = () => undefined>(implementation?: Fn): MockedFunction<Fn>; | ||
| export declare function spyOn(object: object, key: string | symbol): MockedFunction; | ||
| export declare const beforeAll: typeof before; | ||
| export declare const afterAll: typeof after; | ||
| export declare const test: typeof nodeTest & { | ||
| each: ReturnType<typeof createEach>; | ||
| }; | ||
| export declare const it: typeof nodeTest & { | ||
| each: ReturnType<typeof createEach>; | ||
| }; | ||
| export declare const describe: typeof nodeDescribe; | ||
| export { afterEach, beforeEach }; |
@@ -1,2 +0,3 @@ | ||
| import { Renderable, type ViewportBounds } from "../index.js"; | ||
| import { Renderable } from "../Renderable.js"; | ||
| import type { ViewportBounds } from "../types.js"; | ||
| import { fonts } from "./ascii.font.js"; | ||
@@ -3,0 +4,0 @@ export declare class Selection { |
@@ -6,3 +6,4 @@ /** | ||
| export declare function singleton<T>(key: string, factory: () => T): T; | ||
| export declare function getSingleton<T>(key: string): T | undefined; | ||
| export declare function destroySingleton(key: string): void; | ||
| export declare function hasSingleton(key: string): boolean; |
@@ -6,2 +6,5 @@ import { EventEmitter } from "events"; | ||
| } | ||
| interface TreeSitterClientInternalOptions { | ||
| autoStartWorker?: boolean; | ||
| } | ||
| export declare function addDefaultParsers(parsers: FiletypeParserOptions[]): void; | ||
@@ -19,6 +22,16 @@ export declare class TreeSitterClient extends EventEmitter<TreeSitterClientEvents> { | ||
| private options; | ||
| constructor(options: TreeSitterClientOptions); | ||
| private destroyCallbacks; | ||
| private lifecycleGeneration; | ||
| private rejectInitialization; | ||
| private destroyPromise; | ||
| private workerTerminationFailed; | ||
| constructor(options: TreeSitterClientOptions, internalOptions?: TreeSitterClientInternalOptions); | ||
| onDestroy(callback: () => void): () => void; | ||
| private emitError; | ||
| private emitWarning; | ||
| private startWorker; | ||
| private sendWorkerMessage; | ||
| private rejectPendingRequests; | ||
| private rejectActiveInitialization; | ||
| private handleWorkerFailure; | ||
| private resolveWorkerPath; | ||
@@ -28,2 +41,3 @@ private stopWorker; | ||
| initialize(): Promise<void>; | ||
| private assertCurrentInitialization; | ||
| private initializeClient; | ||
@@ -33,2 +47,3 @@ private registerDefaultParsers; | ||
| addFiletypeParser(filetypeParser: FiletypeParserOptions): void; | ||
| private resolveFiletypeParser; | ||
| getPerformance(): Promise<PerformanceStats>; | ||
@@ -54,1 +69,2 @@ highlightOnce(content: string, filetype: string): Promise<{ | ||
| } | ||
| export {}; |
@@ -7,1 +7,2 @@ import { TreeSitterClient } from "./client.js"; | ||
| export declare function getTreeSitterClient(): TreeSitterClient; | ||
| export declare function destroyTreeSitterClient(): Promise<void>; |
@@ -47,2 +47,105 @@ export interface HighlightRange { | ||
| } | ||
| export type TreeSitterWorkerLogType = "log" | "error" | "warn"; | ||
| export type TreeSitterWorkerRequest = { | ||
| type: "INIT"; | ||
| dataPath: string; | ||
| } | { | ||
| type: "ADD_FILETYPE_PARSER"; | ||
| filetypeParser: FiletypeParserOptions; | ||
| } | { | ||
| type: "PRELOAD_PARSER"; | ||
| filetype: string; | ||
| messageId: string; | ||
| } | { | ||
| type: "INITIALIZE_PARSER"; | ||
| bufferId: number; | ||
| version: number; | ||
| content: string; | ||
| filetype: string; | ||
| messageId: string; | ||
| } | { | ||
| type: "HANDLE_EDITS"; | ||
| bufferId: number; | ||
| version: number; | ||
| content: string; | ||
| edits: Edit[]; | ||
| } | { | ||
| type: "GET_PERFORMANCE"; | ||
| messageId: string; | ||
| } | { | ||
| type: "RESET_BUFFER"; | ||
| bufferId: number; | ||
| version: number; | ||
| content: string; | ||
| edits: Edit[]; | ||
| } | { | ||
| type: "DISPOSE_BUFFER"; | ||
| bufferId: number; | ||
| } | { | ||
| type: "ONESHOT_HIGHLIGHT"; | ||
| content: string; | ||
| filetype: string; | ||
| messageId: string; | ||
| } | { | ||
| type: "UPDATE_DATA_PATH"; | ||
| dataPath: string; | ||
| messageId: string; | ||
| } | { | ||
| type: "CLEAR_CACHE"; | ||
| messageId: string; | ||
| }; | ||
| export type TreeSitterWorkerResponse = { | ||
| type: "INIT_RESPONSE"; | ||
| error?: string; | ||
| } | { | ||
| type: "PARSER_INIT_RESPONSE"; | ||
| bufferId: number; | ||
| messageId: string; | ||
| hasParser: boolean; | ||
| warning?: string; | ||
| error?: string; | ||
| } | { | ||
| type: "HIGHLIGHT_RESPONSE"; | ||
| bufferId: number; | ||
| version: number; | ||
| highlights: HighlightResponse[]; | ||
| } | { | ||
| type: "PRELOAD_PARSER_RESPONSE"; | ||
| messageId: string; | ||
| hasParser: boolean; | ||
| } | { | ||
| type: "BUFFER_DISPOSED"; | ||
| bufferId: number; | ||
| } | { | ||
| type: "PERFORMANCE_RESPONSE"; | ||
| performance: PerformanceStats; | ||
| messageId: string; | ||
| } | { | ||
| type: "ONESHOT_HIGHLIGHT_RESPONSE"; | ||
| messageId: string; | ||
| hasParser: boolean; | ||
| highlights?: SimpleHighlight[]; | ||
| warning?: string; | ||
| error?: string; | ||
| } | { | ||
| type: "UPDATE_DATA_PATH_RESPONSE"; | ||
| messageId: string; | ||
| error?: string; | ||
| } | { | ||
| type: "CLEAR_CACHE_RESPONSE"; | ||
| messageId: string; | ||
| error?: string; | ||
| } | { | ||
| type: "WARNING"; | ||
| bufferId?: number; | ||
| warning: string; | ||
| } | { | ||
| type: "ERROR"; | ||
| bufferId?: number; | ||
| error: string; | ||
| } | { | ||
| type: "WORKER_LOG"; | ||
| logType: TreeSitterWorkerLogType; | ||
| data: unknown[]; | ||
| }; | ||
| export interface TreeSitterClientEvents { | ||
@@ -52,3 +155,3 @@ "highlights:response": [bufferId: number, version: number, highlights: HighlightResponse[]]; | ||
| "buffer:disposed": [bufferId: number]; | ||
| "worker:log": [logType: "log" | "error", message: string]; | ||
| "worker:log": [logType: TreeSitterWorkerLogType, message: string]; | ||
| error: [error: string, bufferId?: number]; | ||
@@ -55,0 +158,0 @@ warning: [warning: string, bufferId?: number]; |
@@ -119,8 +119,10 @@ #!/usr/bin/env bun | ||
| import { readdir } from "fs/promises"; | ||
| var __dirname = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets"; | ||
| import { fileURLToPath } from "url"; | ||
| var __filename2 = fileURLToPath(import.meta.url); | ||
| var __dirname2 = path2.dirname(__filename2); | ||
| function getDefaultOptions() { | ||
| return { | ||
| configPath: path2.resolve(__dirname, "../parsers-config"), | ||
| assetsDir: path2.resolve(__dirname), | ||
| outputPath: path2.resolve(__dirname, "../default-parsers.ts") | ||
| configPath: path2.resolve(__dirname2, "../parsers-config"), | ||
| assetsDir: path2.resolve(__dirname2), | ||
| outputPath: path2.resolve(__dirname2, "../default-parsers.ts") | ||
| }; | ||
@@ -320,3 +322,3 @@ } | ||
| const { values } = parseArgs({ | ||
| args: Bun.argv.slice(2), | ||
| args: process.argv.slice(2), | ||
| options: { | ||
@@ -378,3 +380,3 @@ config: { type: "string" }, | ||
| //# debugId=3D069CA846BE4B5364756E2164756E21 | ||
| //# debugId=1A2D716CBBE1018664756E2164756E21 | ||
| //# sourceMappingURL=update-assets.js.map |
@@ -5,9 +5,9 @@ { | ||
| "sourcesContent": [ | ||
| "#!/usr/bin/env bun\n\nimport { readFile, writeFile, mkdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport { DownloadUtils } from \"../download-utils.js\"\nimport { parseArgs } from \"util\"\nimport type { FiletypeParserOptions } from \"../types.js\"\nimport { readdir } from \"fs/promises\"\n\ninterface ParsersConfig {\n parsers: FiletypeParserOptions[]\n}\n\ninterface GeneratedParser {\n filetype: string\n aliases?: string[]\n languagePath: string\n highlightsPath: string\n injectionsPath?: string\n injectionMapping?: any\n}\n\nexport interface UpdateOptions {\n /** Path to parsers-config.json */\n configPath: string\n /** Directory where .wasm and .scm files will be downloaded */\n assetsDir: string\n /** Path where the generated TypeScript file will be written */\n outputPath: string\n}\n\nfunction getDefaultOptions(): UpdateOptions {\n return {\n configPath: path.resolve(__dirname, \"../parsers-config\"),\n assetsDir: path.resolve(__dirname),\n outputPath: path.resolve(__dirname, \"../default-parsers.ts\"),\n }\n}\n\nasync function loadConfig(configPath: string): Promise<ParsersConfig> {\n let ext = path.extname(configPath)\n let resolvedConfigPath = configPath\n\n if (ext === \"\") {\n const files = await readdir(path.dirname(configPath))\n const file = files.find(\n (file) =>\n file.startsWith(path.basename(configPath)) &&\n (file.endsWith(\".json\") || file.endsWith(\".ts\") || file.endsWith(\".js\")),\n )\n if (!file) {\n throw new Error(`No config file found for ${configPath}`)\n }\n resolvedConfigPath = path.join(path.dirname(configPath), file)\n ext = path.extname(resolvedConfigPath)\n }\n\n if (ext === \".json\") {\n const configContent = await readFile(resolvedConfigPath, \"utf-8\")\n return JSON.parse(configContent)\n } else if (ext === \".ts\" || ext === \".js\") {\n const { default: configContent } = await import(resolvedConfigPath)\n return configContent\n }\n throw new Error(`Unsupported config file extension: ${ext}`)\n}\n\nasync function downloadLanguage(\n filetype: string,\n languageUrl: string,\n assetsDir: string,\n outputPath: string,\n): Promise<string> {\n const languageDir = path.join(assetsDir, filetype)\n const languageFilename = path.basename(languageUrl)\n const languagePath = path.join(languageDir, languageFilename)\n\n const result = await DownloadUtils.downloadToPath(languageUrl, languagePath)\n\n if (result.error) {\n throw new Error(`Failed to download language for ${filetype}: ${result.error}`)\n }\n\n return \"./\" + path.relative(path.dirname(outputPath), languagePath)\n}\n\nasync function downloadAndCombineQueries(\n filetype: string,\n queryUrls: string[],\n assetsDir: string,\n outputPath: string,\n queryType: \"highlights\" | \"injections\",\n configPath: string,\n): Promise<string> {\n const queriesDir = path.join(assetsDir, filetype)\n const queryPath = path.join(queriesDir, `${queryType}.scm`)\n\n const queryContents: string[] = []\n\n for (let i = 0; i < queryUrls.length; i++) {\n const queryUrl = queryUrls[i]\n\n if (queryUrl.startsWith(\"./\")) {\n console.log(` Using local query ${i + 1}/${queryUrls.length}: ${queryUrl}`)\n\n try {\n const localPath = path.resolve(path.dirname(configPath), queryUrl)\n const content = await readFile(localPath, \"utf-8\")\n\n if (content.trim()) {\n queryContents.push(content)\n console.log(` ✓ Loaded ${content.split(\"\\n\").length} lines from local file`)\n }\n } catch (error) {\n console.warn(`Failed to read local query from ${queryUrl}: ${error}`)\n continue\n }\n } else {\n console.log(` Downloading query ${i + 1}/${queryUrls.length}: ${queryUrl}`)\n\n try {\n const response = await fetch(queryUrl)\n if (!response.ok) {\n console.warn(`Failed to download query from ${queryUrl}: ${response.statusText}`)\n continue\n }\n\n const content = await response.text()\n if (content.trim()) {\n queryContents.push(`; Query from: ${queryUrl}\\n${content}`)\n console.log(` ✓ Downloaded ${content.split(\"\\n\").length} lines`)\n }\n } catch (error) {\n console.warn(`Failed to download query from ${queryUrl}: ${error}`)\n continue\n }\n }\n }\n\n const combinedContent = queryContents.join(\"\\n\\n\")\n await writeFile(queryPath, combinedContent, \"utf-8\")\n\n console.log(` Combined ${queryContents.length} queries into ${queryPath}`)\n\n return \"./\" + path.relative(path.dirname(outputPath), queryPath)\n}\n\nasync function generateDefaultParsersFile(parsers: GeneratedParser[], outputPath: string): Promise<void> {\n const assetPaths = parsers\n .map((parser) => {\n const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, \"_\")\n const lines = [\n `const ${safeFiletype}_highlights = await resolveBundledFilePath(`,\n ` () => import(\"${parser.highlightsPath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.highlightsPath}\",`,\n ` import.meta.url,`,\n `)`,\n `const ${safeFiletype}_language = await resolveBundledFilePath(`,\n ` () => import(\"${parser.languagePath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.languagePath}\",`,\n ` import.meta.url,`,\n `)`,\n ]\n\n if (parser.injectionsPath) {\n lines.push(\n `const ${safeFiletype}_injections = await resolveBundledFilePath(`,\n ` () => import(\"${parser.injectionsPath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.injectionsPath}\",`,\n ` import.meta.url,`,\n `)`,\n )\n }\n\n return lines.join(\"\\n\")\n })\n .join(\"\\n\")\n\n const parserDefinitions = parsers\n .map((parser) => {\n const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, \"_\")\n const queriesLines = [` highlights: [${safeFiletype}_highlights],`]\n\n if (parser.injectionsPath) {\n queriesLines.push(` injections: [${safeFiletype}_injections],`)\n }\n\n const injectionMappingLine = parser.injectionMapping\n ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},`\n : \"\"\n const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : \"\"\n\n return ` {\n filetype: \"${parser.filetype}\",\n${aliasesLine ? aliasesLine + \"\\n\" : \"\"} queries: {\n${queriesLines.join(\"\\n\")}\n },\n wasm: ${safeFiletype}_language,${injectionMappingLine ? \"\\n\" + injectionMappingLine : \"\"}\n }`\n })\n .join(\",\\n\")\n\n const fileContent = `// This file is generated by assets/update.ts - DO NOT EDIT MANUALLY\n// Run 'bun assets/update.ts' to regenerate this file\n// Last generated: ${new Date().toISOString()}\n\nimport type { FiletypeParserOptions } from \"./types.js\"\nimport { resolveBundledFilePath } from \"../../platform/runtime.js\"\n\n// Cached parsers to avoid re-resolving paths on every call\nlet _cachedParsers: Promise<FiletypeParserOptions[]> | undefined\n\nexport function getParsers(): Promise<FiletypeParserOptions[]> {\n if (!_cachedParsers) {\n _cachedParsers = loadParsers()\n }\n return _cachedParsers\n}\n\nasync function loadParsers(): Promise<FiletypeParserOptions[]> {\n${assetPaths}\n\n return [\n${parserDefinitions},\n ]\n}\n`\n\n await mkdir(path.dirname(outputPath), { recursive: true })\n await writeFile(outputPath, fileContent, \"utf-8\")\n console.log(`Generated ${path.basename(outputPath)} with ${parsers.length} parsers`)\n}\n\nasync function main(options?: Partial<UpdateOptions>): Promise<void> {\n const opts = { ...getDefaultOptions(), ...options }\n\n try {\n console.log(\"Loading parsers configuration...\")\n console.log(` Config: ${opts.configPath}`)\n console.log(` Assets Dir: ${opts.assetsDir}`)\n console.log(` Output: ${opts.outputPath}`)\n\n const config = await loadConfig(opts.configPath)\n\n console.log(`Found ${config.parsers.length} parsers to process`)\n\n const generatedParsers: GeneratedParser[] = []\n\n for (const parser of config.parsers) {\n console.log(`Processing ${parser.filetype}...`)\n\n console.log(` Downloading language...`)\n const languagePath = await downloadLanguage(parser.filetype, parser.wasm, opts.assetsDir, opts.outputPath)\n\n console.log(` Downloading ${parser.queries.highlights.length} highlight queries...`)\n const highlightsPath = await downloadAndCombineQueries(\n parser.filetype,\n parser.queries.highlights,\n opts.assetsDir,\n opts.outputPath,\n \"highlights\",\n opts.configPath,\n )\n\n let injectionsPath: string | undefined\n if (parser.queries.injections && parser.queries.injections.length > 0) {\n console.log(` Downloading ${parser.queries.injections.length} injection queries...`)\n injectionsPath = await downloadAndCombineQueries(\n parser.filetype,\n parser.queries.injections,\n opts.assetsDir,\n opts.outputPath,\n \"injections\",\n opts.configPath,\n )\n }\n\n generatedParsers.push({\n filetype: parser.filetype,\n aliases: parser.aliases,\n languagePath,\n highlightsPath,\n injectionsPath,\n injectionMapping: parser.injectionMapping,\n })\n\n console.log(` ✓ Completed ${parser.filetype}`)\n }\n\n console.log(\"Generating output file...\")\n await generateDefaultParsersFile(generatedParsers, opts.outputPath)\n\n console.log(\"✅ Update completed successfully!\")\n } catch (error) {\n console.error(\"❌ Update failed:\", error)\n process.exit(1)\n }\n}\n\nfunction parseCLIArgs(): Partial<UpdateOptions> | null {\n try {\n const { values } = parseArgs({\n args: Bun.argv.slice(2),\n options: {\n config: { type: \"string\" },\n assets: { type: \"string\" },\n output: { type: \"string\" },\n help: { type: \"boolean\" },\n },\n strict: true,\n })\n\n if (values.help) {\n const command = path.basename(Bun.argv[1] ?? \"update-assets.js\")\n\n console.log(`Usage: bun ${command} [options]\n\nOptions:\n --config <path> Path to parsers-config.json\n --assets <path> Directory where .wasm and .scm files will be downloaded\n --output <path> Path where the generated TypeScript file will be written\n --help Show this help message\n\nExamples:\n # Use default paths (for OpenTUI core development)\n bun ${command}\n\n # Use custom paths (for application integration)\n bun ${command} --config ./my-parsers.json --assets ./src/parsers --output ./src/parsers.ts\n`)\n process.exit(0)\n }\n\n const options: Partial<UpdateOptions> = {}\n if (values.config) options.configPath = path.resolve(values.config)\n if (values.assets) options.assetsDir = path.resolve(values.assets)\n if (values.output) options.outputPath = path.resolve(values.output)\n\n return Object.keys(options).length > 0 ? options : null\n } catch (error) {\n console.error(`Error parsing arguments: ${error}`)\n console.log(\"Run with --help for usage information\")\n process.exit(1)\n }\n}\n\nexport function runUpdateAssetsCli(): Promise<void> {\n const cliOptions = parseCLIArgs()\n return main(cliOptions || undefined)\n}\n\nif (import.meta.main) {\n await runUpdateAssetsCli()\n}\n\nexport { main as updateAssets }\n", | ||
| "#!/usr/bin/env bun\n\nimport { readFile, writeFile, mkdir } from \"fs/promises\"\nimport * as path from \"path\"\nimport { DownloadUtils } from \"../download-utils.js\"\nimport { parseArgs } from \"util\"\nimport type { FiletypeParserOptions } from \"../types.js\"\nimport { readdir } from \"fs/promises\"\nimport { fileURLToPath } from \"node:url\"\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\ninterface ParsersConfig {\n parsers: FiletypeParserOptions[]\n}\n\ninterface GeneratedParser {\n filetype: string\n aliases?: string[]\n languagePath: string\n highlightsPath: string\n injectionsPath?: string\n injectionMapping?: any\n}\n\nexport interface UpdateOptions {\n /** Path to parsers-config.json */\n configPath: string\n /** Directory where .wasm and .scm files will be downloaded */\n assetsDir: string\n /** Path where the generated TypeScript file will be written */\n outputPath: string\n}\n\nfunction getDefaultOptions(): UpdateOptions {\n return {\n configPath: path.resolve(__dirname, \"../parsers-config\"),\n assetsDir: path.resolve(__dirname),\n outputPath: path.resolve(__dirname, \"../default-parsers.ts\"),\n }\n}\n\nasync function loadConfig(configPath: string): Promise<ParsersConfig> {\n let ext = path.extname(configPath)\n let resolvedConfigPath = configPath\n\n if (ext === \"\") {\n const files = await readdir(path.dirname(configPath))\n const file = files.find(\n (file) =>\n file.startsWith(path.basename(configPath)) &&\n (file.endsWith(\".json\") || file.endsWith(\".ts\") || file.endsWith(\".js\")),\n )\n if (!file) {\n throw new Error(`No config file found for ${configPath}`)\n }\n resolvedConfigPath = path.join(path.dirname(configPath), file)\n ext = path.extname(resolvedConfigPath)\n }\n\n if (ext === \".json\") {\n const configContent = await readFile(resolvedConfigPath, \"utf-8\")\n return JSON.parse(configContent)\n } else if (ext === \".ts\" || ext === \".js\") {\n const { default: configContent } = await import(resolvedConfigPath)\n return configContent\n }\n throw new Error(`Unsupported config file extension: ${ext}`)\n}\n\nasync function downloadLanguage(\n filetype: string,\n languageUrl: string,\n assetsDir: string,\n outputPath: string,\n): Promise<string> {\n const languageDir = path.join(assetsDir, filetype)\n const languageFilename = path.basename(languageUrl)\n const languagePath = path.join(languageDir, languageFilename)\n\n const result = await DownloadUtils.downloadToPath(languageUrl, languagePath)\n\n if (result.error) {\n throw new Error(`Failed to download language for ${filetype}: ${result.error}`)\n }\n\n return \"./\" + path.relative(path.dirname(outputPath), languagePath)\n}\n\nasync function downloadAndCombineQueries(\n filetype: string,\n queryUrls: string[],\n assetsDir: string,\n outputPath: string,\n queryType: \"highlights\" | \"injections\",\n configPath: string,\n): Promise<string> {\n const queriesDir = path.join(assetsDir, filetype)\n const queryPath = path.join(queriesDir, `${queryType}.scm`)\n\n const queryContents: string[] = []\n\n for (let i = 0; i < queryUrls.length; i++) {\n const queryUrl = queryUrls[i]\n\n if (queryUrl.startsWith(\"./\")) {\n console.log(` Using local query ${i + 1}/${queryUrls.length}: ${queryUrl}`)\n\n try {\n const localPath = path.resolve(path.dirname(configPath), queryUrl)\n const content = await readFile(localPath, \"utf-8\")\n\n if (content.trim()) {\n queryContents.push(content)\n console.log(` ✓ Loaded ${content.split(\"\\n\").length} lines from local file`)\n }\n } catch (error) {\n console.warn(`Failed to read local query from ${queryUrl}: ${error}`)\n continue\n }\n } else {\n console.log(` Downloading query ${i + 1}/${queryUrls.length}: ${queryUrl}`)\n\n try {\n const response = await fetch(queryUrl)\n if (!response.ok) {\n console.warn(`Failed to download query from ${queryUrl}: ${response.statusText}`)\n continue\n }\n\n const content = await response.text()\n if (content.trim()) {\n queryContents.push(`; Query from: ${queryUrl}\\n${content}`)\n console.log(` ✓ Downloaded ${content.split(\"\\n\").length} lines`)\n }\n } catch (error) {\n console.warn(`Failed to download query from ${queryUrl}: ${error}`)\n continue\n }\n }\n }\n\n const combinedContent = queryContents.join(\"\\n\\n\")\n await writeFile(queryPath, combinedContent, \"utf-8\")\n\n console.log(` Combined ${queryContents.length} queries into ${queryPath}`)\n\n return \"./\" + path.relative(path.dirname(outputPath), queryPath)\n}\n\nasync function generateDefaultParsersFile(parsers: GeneratedParser[], outputPath: string): Promise<void> {\n const assetPaths = parsers\n .map((parser) => {\n const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, \"_\")\n const lines = [\n `const ${safeFiletype}_highlights = await resolveBundledFilePath(`,\n ` () => import(\"${parser.highlightsPath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.highlightsPath}\",`,\n ` import.meta.url,`,\n `)`,\n `const ${safeFiletype}_language = await resolveBundledFilePath(`,\n ` () => import(\"${parser.languagePath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.languagePath}\",`,\n ` import.meta.url,`,\n `)`,\n ]\n\n if (parser.injectionsPath) {\n lines.push(\n `const ${safeFiletype}_injections = await resolveBundledFilePath(`,\n ` () => import(\"${parser.injectionsPath}\" as string, { with: { type: \"file\" } }),`,\n ` \"${parser.injectionsPath}\",`,\n ` import.meta.url,`,\n `)`,\n )\n }\n\n return lines.join(\"\\n\")\n })\n .join(\"\\n\")\n\n const parserDefinitions = parsers\n .map((parser) => {\n const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, \"_\")\n const queriesLines = [` highlights: [${safeFiletype}_highlights],`]\n\n if (parser.injectionsPath) {\n queriesLines.push(` injections: [${safeFiletype}_injections],`)\n }\n\n const injectionMappingLine = parser.injectionMapping\n ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},`\n : \"\"\n const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : \"\"\n\n return ` {\n filetype: \"${parser.filetype}\",\n${aliasesLine ? aliasesLine + \"\\n\" : \"\"} queries: {\n${queriesLines.join(\"\\n\")}\n },\n wasm: ${safeFiletype}_language,${injectionMappingLine ? \"\\n\" + injectionMappingLine : \"\"}\n }`\n })\n .join(\",\\n\")\n\n const fileContent = `// This file is generated by assets/update.ts - DO NOT EDIT MANUALLY\n// Run 'bun assets/update.ts' to regenerate this file\n// Last generated: ${new Date().toISOString()}\n\nimport type { FiletypeParserOptions } from \"./types.js\"\nimport { resolveBundledFilePath } from \"../../platform/runtime.js\"\n\n// Cached parsers to avoid re-resolving paths on every call\nlet _cachedParsers: Promise<FiletypeParserOptions[]> | undefined\n\nexport function getParsers(): Promise<FiletypeParserOptions[]> {\n if (!_cachedParsers) {\n _cachedParsers = loadParsers()\n }\n return _cachedParsers\n}\n\nasync function loadParsers(): Promise<FiletypeParserOptions[]> {\n${assetPaths}\n\n return [\n${parserDefinitions},\n ]\n}\n`\n\n await mkdir(path.dirname(outputPath), { recursive: true })\n await writeFile(outputPath, fileContent, \"utf-8\")\n console.log(`Generated ${path.basename(outputPath)} with ${parsers.length} parsers`)\n}\n\nasync function main(options?: Partial<UpdateOptions>): Promise<void> {\n const opts = { ...getDefaultOptions(), ...options }\n\n try {\n console.log(\"Loading parsers configuration...\")\n console.log(` Config: ${opts.configPath}`)\n console.log(` Assets Dir: ${opts.assetsDir}`)\n console.log(` Output: ${opts.outputPath}`)\n\n const config = await loadConfig(opts.configPath)\n\n console.log(`Found ${config.parsers.length} parsers to process`)\n\n const generatedParsers: GeneratedParser[] = []\n\n for (const parser of config.parsers) {\n console.log(`Processing ${parser.filetype}...`)\n\n console.log(` Downloading language...`)\n const languagePath = await downloadLanguage(parser.filetype, parser.wasm, opts.assetsDir, opts.outputPath)\n\n console.log(` Downloading ${parser.queries.highlights.length} highlight queries...`)\n const highlightsPath = await downloadAndCombineQueries(\n parser.filetype,\n parser.queries.highlights,\n opts.assetsDir,\n opts.outputPath,\n \"highlights\",\n opts.configPath,\n )\n\n let injectionsPath: string | undefined\n if (parser.queries.injections && parser.queries.injections.length > 0) {\n console.log(` Downloading ${parser.queries.injections.length} injection queries...`)\n injectionsPath = await downloadAndCombineQueries(\n parser.filetype,\n parser.queries.injections,\n opts.assetsDir,\n opts.outputPath,\n \"injections\",\n opts.configPath,\n )\n }\n\n generatedParsers.push({\n filetype: parser.filetype,\n aliases: parser.aliases,\n languagePath,\n highlightsPath,\n injectionsPath,\n injectionMapping: parser.injectionMapping,\n })\n\n console.log(` ✓ Completed ${parser.filetype}`)\n }\n\n console.log(\"Generating output file...\")\n await generateDefaultParsersFile(generatedParsers, opts.outputPath)\n\n console.log(\"✅ Update completed successfully!\")\n } catch (error) {\n console.error(\"❌ Update failed:\", error)\n process.exit(1)\n }\n}\n\nfunction parseCLIArgs(): Partial<UpdateOptions> | null {\n try {\n const { values } = parseArgs({\n args: process.argv.slice(2),\n options: {\n config: { type: \"string\" },\n assets: { type: \"string\" },\n output: { type: \"string\" },\n help: { type: \"boolean\" },\n },\n strict: true,\n })\n\n if (values.help) {\n const command = path.basename(Bun.argv[1] ?? \"update-assets.js\")\n\n console.log(`Usage: bun ${command} [options]\n\nOptions:\n --config <path> Path to parsers-config.json\n --assets <path> Directory where .wasm and .scm files will be downloaded\n --output <path> Path where the generated TypeScript file will be written\n --help Show this help message\n\nExamples:\n # Use default paths (for OpenTUI core development)\n bun ${command}\n\n # Use custom paths (for application integration)\n bun ${command} --config ./my-parsers.json --assets ./src/parsers --output ./src/parsers.ts\n`)\n process.exit(0)\n }\n\n const options: Partial<UpdateOptions> = {}\n if (values.config) options.configPath = path.resolve(values.config)\n if (values.assets) options.assetsDir = path.resolve(values.assets)\n if (values.output) options.outputPath = path.resolve(values.output)\n\n return Object.keys(options).length > 0 ? options : null\n } catch (error) {\n console.error(`Error parsing arguments: ${error}`)\n console.log(\"Run with --help for usage information\")\n process.exit(1)\n }\n}\n\nexport function runUpdateAssetsCli(): Promise<void> {\n const cliOptions = parseCLIArgs()\n return main(cliOptions || undefined)\n}\n\nif (import.meta.main) {\n await runUpdateAssetsCli()\n}\n\nexport { main as updateAssets }\n", | ||
| "import { mkdir, readFile, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\n\nexport interface DownloadResult {\n content?: Buffer\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 readFile(cacheFile)\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 = Buffer.from(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 readFile(source)\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 = Buffer.from(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 readFile(source)\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", | ||
| "#!/usr/bin/env bun\n\nimport { runUpdateAssetsCli } from \"./assets/update.js\"\n\nexport { runUpdateAssetsCli, updateAssets } from \"./assets/update.js\"\nexport type { UpdateOptions } from \"./assets/update.js\"\n\nif (import.meta.main) {\n await runUpdateAssetsCli()\n}\n" | ||
| ], | ||
| "mappings": ";;;;AAEA,qBAAS,wBAAU,qBAAW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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAUxB;AAAA;AAAA;AAAA,QAGA;AAAA,CACP;AAAA,MACK,QAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,IAEA,MAAM,UAAkC,CAAC;AAAA,IACzC,IAAI,OAAO;AAAA,MAAQ,QAAQ,aAAkB,cAAQ,OAAO,MAAM;AAAA,IAClE,IAAI,OAAO;AAAA,MAAQ,QAAQ,YAAiB,cAAQ,OAAO,MAAM;AAAA,IACjE,IAAI,OAAO;AAAA,MAAQ,QAAQ,aAAkB,cAAQ,OAAO,MAAM;AAAA,IAElE,OAAO,OAAO,KAAK,OAAO,EAAE,SAAS,IAAI,UAAU;AAAA,IACnD,OAAO,OAAO;AAAA,IACd,QAAQ,MAAM,4BAA4B,OAAO;AAAA,IACjD,QAAQ,IAAI,uCAAuC;AAAA,IACnD,QAAQ,KAAK,CAAC;AAAA;AAAA;AAIX,SAAS,kBAAkB,GAAkB;AAAA,EAClD,MAAM,aAAa,aAAa;AAAA,EAChC,OAAO,KAAK,cAAc,SAAS;AAAA;AAGrC,IAAI,OAAkB,CAEtB;;;AE9VA,IAAI,kBAAkB;AAAA,EACpB,MAAM,mBAAmB;AAC3B;", | ||
| "debugId": "1A2D716CBBE1018664756E2164756E21", | ||
| "names": [] | ||
| } |
@@ -31,2 +31,4 @@ import { type Pointer } from "./platform/ffi.js"; | ||
| private idleResolvers; | ||
| private pendingHandlerError; | ||
| private pendingHandlerErrorQueued; | ||
| private constructor(); | ||
@@ -47,4 +49,6 @@ private ensureDrainBuffer; | ||
| private decrementRefcount; | ||
| private queuePendingHandlerError; | ||
| private throwPendingHandlerError; | ||
| private drainOnce; | ||
| drainAll(): void; | ||
| } |
+27
-34
@@ -7,3 +7,3 @@ { | ||
| "type": "module", | ||
| "version": "0.3.4", | ||
| "version": "0.4.0", | ||
| "description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)", | ||
@@ -19,3 +19,2 @@ "license": "MIT", | ||
| "import": "./index.js", | ||
| "require": "./index.js", | ||
| "types": "./index.d.ts" | ||
@@ -25,28 +24,30 @@ }, | ||
| "import": "./testing.js", | ||
| "require": "./testing.js", | ||
| "types": "./testing.d.ts" | ||
| }, | ||
| "./runtime-plugin": { | ||
| "import": "./runtime-plugin.js", | ||
| "require": "./runtime-plugin.js", | ||
| "types": "./runtime-plugin.d.ts" | ||
| "types": "./runtime-plugin.d.ts", | ||
| "bun": "./runtime-plugin.js", | ||
| "node": "./runtime-plugin.node.js", | ||
| "default": "./runtime-plugin.node.js" | ||
| }, | ||
| "./runtime-plugin-support": { | ||
| "import": "./runtime-plugin-support.js", | ||
| "require": "./runtime-plugin-support.js", | ||
| "types": "./runtime-plugin-support.d.ts" | ||
| "types": "./runtime-plugin-support.d.ts", | ||
| "bun": "./runtime-plugin-support.js", | ||
| "node": "./runtime-plugin-support.node.js", | ||
| "default": "./runtime-plugin-support.node.js" | ||
| }, | ||
| "./runtime-plugin-support/configure": { | ||
| "import": "./runtime-plugin-support-configure.js", | ||
| "require": "./runtime-plugin-support-configure.js", | ||
| "types": "./runtime-plugin-support-configure.d.ts" | ||
| "types": "./runtime-plugin-support-configure.d.ts", | ||
| "bun": "./runtime-plugin-support-configure.js", | ||
| "node": "./runtime-plugin-support-configure.node.js", | ||
| "default": "./runtime-plugin-support-configure.node.js" | ||
| }, | ||
| "./tree-sitter/update-assets": { | ||
| "import": "./lib/tree-sitter/update-assets.js", | ||
| "require": "./lib/tree-sitter/update-assets.js", | ||
| "types": "./lib/tree-sitter/update-assets.d.ts" | ||
| "types": "./lib/tree-sitter/update-assets.d.ts", | ||
| "bun": "./lib/tree-sitter/update-assets.js", | ||
| "import": "./lib/tree-sitter/update-assets.js" | ||
| }, | ||
| "./parser.worker": { | ||
| "import": "./lib/tree-sitter/parser.worker.js", | ||
| "require": "./lib/tree-sitter/parser.worker.js", | ||
| "import": "./parser.worker.js", | ||
| "require": "./parser.worker.js", | ||
| "types": "./lib/tree-sitter/parser.worker.d.ts" | ||
@@ -56,3 +57,3 @@ } | ||
| "dependencies": { | ||
| "bun-ffi-structs": "0.2.2", | ||
| "bun-ffi-structs": "0.2.3", | ||
| "diff": "9.0.0", | ||
@@ -64,10 +65,2 @@ "marked": "17.0.1", | ||
| }, | ||
| "devDependencies": { | ||
| "@opentui/keymap": "workspace:*", | ||
| "@types/bun": "latest", | ||
| "@types/node": "^24.0.0", | ||
| "commander": "^13.1.0", | ||
| "typescript": "^5", | ||
| "web-tree-sitter": "0.25.10" | ||
| }, | ||
| "peerDependencies": { | ||
@@ -77,11 +70,11 @@ "web-tree-sitter": "0.25.10" | ||
| "optionalDependencies": { | ||
| "@opentui/core-darwin-x64": "0.3.4", | ||
| "@opentui/core-darwin-arm64": "0.3.4", | ||
| "@opentui/core-linux-x64": "0.3.4", | ||
| "@opentui/core-linux-arm64": "0.3.4", | ||
| "@opentui/core-win32-x64": "0.3.4", | ||
| "@opentui/core-win32-arm64": "0.3.4", | ||
| "@opentui/core-linux-x64-musl": "0.3.4", | ||
| "@opentui/core-linux-arm64-musl": "0.3.4" | ||
| "@opentui/core-darwin-x64": "0.4.0", | ||
| "@opentui/core-darwin-arm64": "0.4.0", | ||
| "@opentui/core-linux-x64": "0.4.0", | ||
| "@opentui/core-linux-arm64": "0.4.0", | ||
| "@opentui/core-win32-x64": "0.4.0", | ||
| "@opentui/core-win32-arm64": "0.4.0", | ||
| "@opentui/core-linux-x64-musl": "0.4.0", | ||
| "@opentui/core-linux-arm64-musl": "0.4.0" | ||
| } | ||
| } |
@@ -89,4 +89,4 @@ declare const pointerBrand: unique symbol; | ||
| interface NodeFFIFunction { | ||
| readonly parameters: readonly string[]; | ||
| readonly result: string; | ||
| readonly arguments: readonly string[]; | ||
| readonly return: string; | ||
| } | ||
@@ -114,6 +114,9 @@ interface NodeDynamicLibrary { | ||
| export declare const NODE_POINTER_OVERRIDE = "Node FFI backend does not support FFIFunction.ptr overrides"; | ||
| export declare const NODE_POINTER_ARGUMENT = "Node FFI pointer arguments must be a Pointer, ArrayBuffer, or ArrayBufferView"; | ||
| export declare const NODE_PTR_VALUE = "node:ffi ptr() only supports ArrayBuffer and ArrayBufferView values backed by ArrayBuffer"; | ||
| export declare const NODE_STRING_RETURN = "Node FFI backend does not normalize string return values (yet)"; | ||
| export declare const NODE_USIZE_UNSUPPORTED = "Node FFI backend does not support usize until (yet)"; | ||
| export declare const NODE_USIZE_UNSUPPORTED = "Node FFI backend does not support usize yet"; | ||
| export declare const POINTER_NEGATIVE = "Pointer must be non-negative"; | ||
| export declare const POINTER_OFFSET_NEGATIVE = "Pointer offset must be non-negative"; | ||
| export declare const POINTER_OFFSET_UNSAFE = "Pointer offset must be a safe integer"; | ||
| export declare const POINTER_UNSAFE = "Pointer exceeds safe integer range"; | ||
@@ -120,0 +123,0 @@ export declare function toPointer(value: PointerInput): Pointer; |
+26
-4
@@ -1,4 +0,26 @@ | ||
| export declare const Worker: { | ||
| new (scriptURL: string | URL, options?: WorkerOptions): Worker; | ||
| prototype: Worker; | ||
| }; | ||
| export declare const WORKER_UNAVAILABLE = "OpenTUI tree-sitter workers are not available for this runtime yet."; | ||
| export interface WorkerMessageEvent<T = unknown> { | ||
| readonly data: T; | ||
| } | ||
| export interface WorkerErrorEvent { | ||
| readonly error?: unknown; | ||
| readonly message: string; | ||
| } | ||
| export type WorkerMessageHandler<T = unknown> = (event: WorkerMessageEvent<T>) => void | Promise<void>; | ||
| export type WorkerErrorHandler = (event: WorkerErrorEvent) => void; | ||
| export interface PlatformWorkerOptions { | ||
| name?: string; | ||
| } | ||
| export interface PlatformWorkerHandle { | ||
| onmessage: WorkerMessageHandler | null; | ||
| onerror: WorkerErrorHandler | null; | ||
| postMessage(value: unknown): void; | ||
| terminate(): void | Promise<number>; | ||
| addEventListener(type: "message" | "error", listener: WorkerMessageHandler | WorkerErrorHandler): void; | ||
| removeEventListener(type: "message" | "error", listener: WorkerMessageHandler | WorkerErrorHandler): void; | ||
| } | ||
| export type PlatformWorkerConstructor = new (specifier: string | URL, options?: PlatformWorkerOptions) => PlatformWorkerHandle; | ||
| export declare const Worker: PlatformWorkerConstructor; | ||
| export declare const isWorkerRuntime: boolean; | ||
| export declare function postWorkerMessage(value: unknown): void; | ||
| export declare function setWorkerMessageHandler<T>(handler: WorkerMessageHandler<T>): () => void; |
@@ -1,18 +0,36 @@ | ||
| // @bun | ||
| import { | ||
| ensureRuntimePluginSupport | ||
| } from "./index-8t841rbx.js"; | ||
| import { | ||
| createRuntimePlugin, | ||
| runtimeModuleIdForSpecifier | ||
| } from "./index-r49y8kdq.js"; | ||
| import"./index-0nvgrgam.js"; | ||
| import"./index-54s7pk0d.js"; | ||
| export { | ||
| runtimeModuleIdForSpecifier, | ||
| ensureRuntimePluginSupport, | ||
| createRuntimePlugin | ||
| }; | ||
| //# debugId=20E180CC53AAFA2A64756E2164756E21 | ||
| //# sourceMappingURL=runtime-plugin-support-configure.js.map | ||
| import { plugin as registerBunPlugin } from "bun"; | ||
| import { createRuntimePlugin } from "./runtime-plugin.js"; | ||
| const runtimePluginSupportInstalledKey = "__opentuiCoreRuntimePluginSupportInstalled__"; | ||
| function normalizeRewriteKey(rewrite) { | ||
| return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`; | ||
| } | ||
| function assertCompatibleInstall(install, options) { | ||
| for (const specifier of Object.keys(options.additional ?? {})) { | ||
| if (!install.additionalSpecifiers.has(specifier)) { | ||
| throw new Error(`OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`); | ||
| } | ||
| } | ||
| if (options.core && options.core !== install.core) { | ||
| throw new Error("OpenTUI Core runtime plugin support is already installed with a different core runtime module."); | ||
| } | ||
| if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) { | ||
| throw new Error("OpenTUI Core runtime plugin support is already installed with different rewrite options."); | ||
| } | ||
| } | ||
| export function ensureRuntimePluginSupport(options = {}) { | ||
| const state = globalThis; | ||
| const install = state[runtimePluginSupportInstalledKey]; | ||
| if (install) { | ||
| assertCompatibleInstall(install, options); | ||
| return false; | ||
| } | ||
| registerBunPlugin(createRuntimePlugin(options)); | ||
| state[runtimePluginSupportInstalledKey] = { | ||
| additionalSpecifiers: new Set(Object.keys(options.additional ?? {})), | ||
| core: options.core, | ||
| rewriteKey: normalizeRewriteKey(options.rewrite), | ||
| }; | ||
| return true; | ||
| } | ||
| export { createRuntimePlugin, runtimeModuleIdForSpecifier } from "./runtime-plugin.js"; | ||
| //# sourceMappingURL=runtime-plugin-support-configure.js.map |
@@ -1,9 +0,1 @@ | ||
| { | ||
| "version": 3, | ||
| "sources": [], | ||
| "sourcesContent": [ | ||
| ], | ||
| "mappings": "", | ||
| "debugId": "20E180CC53AAFA2A64756E2164756E21", | ||
| "names": [] | ||
| } | ||
| {"version":3,"file":"runtime-plugin-support-configure.js","sourceRoot":"","sources":["runtime-plugin-support-configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAA4D,MAAM,qBAAqB,CAAA;AAEnH,MAAM,gCAAgC,GAAG,8CAA8C,CAAA;AAYvF,SAAS,mBAAmB,CAAC,OAA0D;IACrF,OAAO,GAAG,OAAO,EAAE,4BAA4B,IAAI,IAAI,IAAI,OAAO,EAAE,yBAAyB,IAAI,KAAK,EAAE,CAAA;AAC1G,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAoC,EAAE,OAAmC;IACxG,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CACb,oEAAoE,SAAS,8JAA8J,CAC5O,CAAA;QACH,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAA;IACnH,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,EAAE,CAAC;QACnF,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAA;IAC7G,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,UAAsC,EAAE;IACjF,MAAM,KAAK,GAAG,UAAuC,CAAA;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,gCAAgC,CAAC,CAAA;IAEvD,IAAI,OAAO,EAAE,CAAC;QACZ,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACzC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,iBAAiB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IAE/C,KAAK,CAAC,gCAAgC,CAAC,GAAG;QACxC,oBAAoB,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;QACpE,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;KACjD,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA"} |
@@ -1,20 +0,5 @@ | ||
| // @bun | ||
| import { | ||
| ensureRuntimePluginSupport | ||
| } from "./index-8t841rbx.js"; | ||
| import { | ||
| createRuntimePlugin, | ||
| runtimeModuleIdForSpecifier | ||
| } from "./index-r49y8kdq.js"; | ||
| import"./index-0nvgrgam.js"; | ||
| import"./index-54s7pk0d.js"; | ||
| // src/runtime-plugin-support.ts | ||
| import { ensureRuntimePluginSupport } from "./runtime-plugin-support-configure.js"; | ||
| export { ensureRuntimePluginSupport }; | ||
| export { createRuntimePlugin, runtimeModuleIdForSpecifier, } from "./runtime-plugin-support-configure.js"; | ||
| ensureRuntimePluginSupport(); | ||
| export { | ||
| runtimeModuleIdForSpecifier, | ||
| ensureRuntimePluginSupport, | ||
| createRuntimePlugin | ||
| }; | ||
| //# debugId=77F70D7DCCE5C8F764756E2164756E21 | ||
| //# sourceMappingURL=runtime-plugin-support.js.map | ||
| //# sourceMappingURL=runtime-plugin-support.js.map |
@@ -1,10 +0,1 @@ | ||
| { | ||
| "version": 3, | ||
| "sources": ["../src/runtime-plugin-support.ts"], | ||
| "sourcesContent": [ | ||
| "import { ensureRuntimePluginSupport } from \"./runtime-plugin-support-configure.js\"\n\nexport { ensureRuntimePluginSupport }\nexport {\n createRuntimePlugin,\n runtimeModuleIdForSpecifier,\n type CreateRuntimePluginOptions,\n type RuntimeModuleEntry,\n type RuntimeModuleExports,\n type RuntimeModuleLoader,\n} from \"./runtime-plugin-support-configure.js\"\n\nensureRuntimePluginSupport()\n" | ||
| ], | ||
| "mappings": ";;;;;;;;;;;AAYA,2BAA2B;", | ||
| "debugId": "77F70D7DCCE5C8F764756E2164756E21", | ||
| "names": [] | ||
| } | ||
| {"version":3,"file":"runtime-plugin-support.js","sourceRoot":"","sources":["runtime-plugin-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAElF,OAAO,EAAE,0BAA0B,EAAE,CAAA;AACrC,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAK5B,MAAM,uCAAuC,CAAA;AAE9C,0BAA0B,EAAE,CAAA"} |
+472
-15
@@ -1,16 +0,473 @@ | ||
| // @bun | ||
| import { | ||
| createRuntimePlugin, | ||
| isCoreRuntimeModuleSpecifier, | ||
| runtimeModuleIdForSpecifier | ||
| } from "./index-r49y8kdq.js"; | ||
| import"./index-0nvgrgam.js"; | ||
| import"./index-54s7pk0d.js"; | ||
| export { | ||
| runtimeModuleIdForSpecifier, | ||
| isCoreRuntimeModuleSpecifier, | ||
| createRuntimePlugin | ||
| /* | ||
| * Exposes runtime-only modules (for example `@opentui/core`, `@opentui/solid`, | ||
| * `solid-js`) to externally loaded plugins by rewriting matching imports to | ||
| * virtual `opentui:runtime-module:*` ids. | ||
| * | ||
| * Why this is exact-path + prescan instead of one broad `onLoad`: | ||
| * - Bun can break CJS/UMD interop if a file is routed through plugin `onLoad` | ||
| * (real repro: `jsonc-parser` resolving to `lib/umd/main.js`; | ||
| * https://github.com/oven-sh/bun/issues/19279, | ||
| * https://github.com/oven-sh/bun/issues/21369), so arbitrary `node_modules` | ||
| * JS cannot be blanket-rewritten. | ||
| * - runtime `onResolve` is sync-only, so package/type/source discovery here is | ||
| * synchronous and cached. | ||
| * - a matched `onLoad` cannot safely fall through, so loaders must be narrow. | ||
| * - Bun may canonicalize paths before `onLoad`, so loaders are registered for | ||
| * both the resolved path spelling and its realpath, then canonical-checked. | ||
| * - Bun may native-load `node_modules` ESM without firing `onResolve` for | ||
| * nested package imports, so `node_modules` ESM is recursively prescanned and | ||
| * only files that actually need runtime rewriting get exact-path loaders. | ||
| * | ||
| * Behavior: | ||
| * - non-`node_modules` source files get a dedicated rewrite loader immediately. | ||
| * - `node_modules` files are rewritten only if they are ESM (`.mjs`, `.mts`, | ||
| * `.ts`, `.tsx`, `.jsx`, or `.js` under `package.json#type="module"`) and | ||
| * directly or transitively need runtime-module rewriting; unrelated CJS stays | ||
| * untouched. | ||
| * - optional bare-specifier rewriting is preserved for sibling files in | ||
| * packages already marked for runtime rewriting. | ||
| * | ||
| * Notes: | ||
| * - import scanning is regex-based, not a full parser. | ||
| * - CJS helper libraries that themselves import runtime modules are still not | ||
| * supported. | ||
| * - `package.json#type` caching is per plugin setup, not module-global, so a | ||
| * later plugin instance in the same process can observe filesystem changes. | ||
| */ | ||
| import { existsSync, readFileSync, realpathSync } from "node:fs"; | ||
| import { basename, dirname, isAbsolute, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import * as coreRuntime from "./index.js"; | ||
| const CORE_RUNTIME_SPECIFIER = "@opentui/core"; | ||
| const CORE_TESTING_RUNTIME_SPECIFIER = "@opentui/core/testing"; | ||
| const RUNTIME_MODULE_PREFIX = "opentui:runtime-module:"; | ||
| const MAX_RUNTIME_RESOLVE_PARENTS = 64; | ||
| const DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS = { | ||
| nodeModulesRuntimeSpecifiers: true, | ||
| nodeModulesBareSpecifiers: false, | ||
| }; | ||
| //# debugId=54AC4E2ADFC3366A64756E2164756E21 | ||
| //# sourceMappingURL=runtime-plugin.js.map | ||
| const DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS = [CORE_RUNTIME_SPECIFIER, CORE_TESTING_RUNTIME_SPECIFIER]; | ||
| const DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET = new Set(DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS); | ||
| export const isCoreRuntimeModuleSpecifier = (specifier) => { | ||
| return DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET.has(specifier); | ||
| }; | ||
| const loadCoreTestingRuntimeModule = async () => { | ||
| return (await import("./testing.js")); | ||
| }; | ||
| const escapeRegExp = (value) => { | ||
| return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| }; | ||
| const exactSpecifierFilter = (specifier) => { | ||
| return new RegExp(`^${escapeRegExp(specifier)}$`); | ||
| }; | ||
| const exactPathFilter = (paths) => { | ||
| const candidates = [...new Set(paths.map(sourcePath))]; | ||
| return new RegExp(`^(?:${candidates.map(escapeRegExp).join("|")})(?:[?#].*)?$`); | ||
| }; | ||
| export const runtimeModuleIdForSpecifier = (specifier) => { | ||
| return `${RUNTIME_MODULE_PREFIX}${encodeURIComponent(specifier)}`; | ||
| }; | ||
| const resolveRuntimeModuleExports = async (moduleEntry) => { | ||
| if (typeof moduleEntry === "function") { | ||
| return await moduleEntry(); | ||
| } | ||
| return moduleEntry; | ||
| }; | ||
| const sourcePath = (path) => { | ||
| const searchIndex = path.indexOf("?"); | ||
| const hashIndex = path.indexOf("#"); | ||
| const end = [searchIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0]; | ||
| return end === undefined ? path : path.slice(0, end); | ||
| }; | ||
| const normalizedSourcePathByPath = new Map(); | ||
| const normalizeSourcePath = (path) => { | ||
| const cleanPath = sourcePath(path); | ||
| const cachedPath = normalizedSourcePathByPath.get(cleanPath); | ||
| if (cachedPath !== undefined) { | ||
| return cachedPath; | ||
| } | ||
| let normalizedPath = cleanPath; | ||
| try { | ||
| normalizedPath = realpathSync(cleanPath); | ||
| } | ||
| catch { | ||
| normalizedPath = cleanPath; | ||
| } | ||
| normalizedSourcePathByPath.set(cleanPath, normalizedPath); | ||
| return normalizedPath; | ||
| }; | ||
| const isNodeModulesPath = (path) => { | ||
| return /(?:^|[/\\])node_modules(?:[/\\])/.test(path); | ||
| }; | ||
| const packageTypeForPath = (path, packageTypeByPackageJsonPath) => { | ||
| let currentDir = dirname(path); | ||
| while (true) { | ||
| const packageJsonPath = join(currentDir, "package.json"); | ||
| if (existsSync(packageJsonPath)) { | ||
| const cachedPackageType = packageTypeByPackageJsonPath.get(packageJsonPath); | ||
| if (cachedPackageType) { | ||
| return cachedPackageType; | ||
| } | ||
| let packageType = "commonjs"; | ||
| try { | ||
| const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); | ||
| if (packageJson.type === "module") { | ||
| packageType = "module"; | ||
| } | ||
| } | ||
| catch { | ||
| packageType = "commonjs"; | ||
| } | ||
| packageTypeByPackageJsonPath.set(packageJsonPath, packageType); | ||
| return packageType; | ||
| } | ||
| const parentDir = dirname(currentDir); | ||
| if (parentDir === currentDir) { | ||
| return "commonjs"; | ||
| } | ||
| currentDir = parentDir; | ||
| } | ||
| }; | ||
| const isNodeModulesEsmPath = (path, packageTypeByPackageJsonPath) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| if (!isNodeModulesPath(normalizedPath)) { | ||
| return false; | ||
| } | ||
| if (normalizedPath.endsWith(".mjs") || | ||
| normalizedPath.endsWith(".mts") || | ||
| normalizedPath.endsWith(".ts") || | ||
| normalizedPath.endsWith(".tsx") || | ||
| normalizedPath.endsWith(".jsx")) { | ||
| return true; | ||
| } | ||
| if (normalizedPath.endsWith(".cjs") || normalizedPath.endsWith(".cts") || !normalizedPath.endsWith(".js")) { | ||
| return false; | ||
| } | ||
| return packageTypeForPath(normalizedPath, packageTypeByPackageJsonPath) === "module"; | ||
| }; | ||
| const nodeModulesPackageRootForPath = (path) => { | ||
| let currentDir = dirname(path); | ||
| while (true) { | ||
| const parentDir = dirname(currentDir); | ||
| if (parentDir === currentDir) { | ||
| return null; | ||
| } | ||
| if (basename(parentDir) === "node_modules") { | ||
| return currentDir; | ||
| } | ||
| if (basename(dirname(parentDir)) === "node_modules" && basename(parentDir).startsWith("@")) { | ||
| return currentDir; | ||
| } | ||
| currentDir = parentDir; | ||
| } | ||
| }; | ||
| const resolveRuntimePluginRewriteOptions = (options) => { | ||
| return { | ||
| nodeModulesRuntimeSpecifiers: options?.nodeModulesRuntimeSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesRuntimeSpecifiers, | ||
| nodeModulesBareSpecifiers: options?.nodeModulesBareSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesBareSpecifiers, | ||
| }; | ||
| }; | ||
| const runtimeLoaderForPath = (path) => { | ||
| const cleanPath = sourcePath(path); | ||
| if (cleanPath.endsWith(".tsx")) { | ||
| return "tsx"; | ||
| } | ||
| if (cleanPath.endsWith(".jsx")) { | ||
| return "jsx"; | ||
| } | ||
| if (cleanPath.endsWith(".ts") || cleanPath.endsWith(".mts") || cleanPath.endsWith(".cts")) { | ||
| return "ts"; | ||
| } | ||
| if (cleanPath.endsWith(".js") || cleanPath.endsWith(".mjs") || cleanPath.endsWith(".cjs")) { | ||
| return "js"; | ||
| } | ||
| return null; | ||
| }; | ||
| const resolveImportSpecifierPatterns = [ | ||
| /(from\s+["'])([^"']+)(["'])/g, | ||
| /(import\s+["'])([^"']+)(["'])/g, | ||
| /(import\s*\(\s*["'])([^"']+)(["']\s*\))/g, | ||
| /(require\s*\(\s*["'])([^"']+)(["']\s*\))/g, | ||
| ]; | ||
| const isBareSpecifier = (specifier) => { | ||
| if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("\\")) { | ||
| return false; | ||
| } | ||
| if (specifier.startsWith("node:") || | ||
| specifier.startsWith("bun:") || | ||
| specifier.startsWith("http:") || | ||
| specifier.startsWith("https:") || | ||
| specifier.startsWith("file:") || | ||
| specifier.startsWith("data:")) { | ||
| return false; | ||
| } | ||
| if (specifier.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| const registerResolveParent = (resolveParentsByRecency, resolveParent) => { | ||
| const existingIndex = resolveParentsByRecency.indexOf(resolveParent); | ||
| if (existingIndex >= 0) { | ||
| resolveParentsByRecency.splice(existingIndex, 1); | ||
| } | ||
| resolveParentsByRecency.push(resolveParent); | ||
| if (resolveParentsByRecency.length > MAX_RUNTIME_RESOLVE_PARENTS) { | ||
| resolveParentsByRecency.shift(); | ||
| } | ||
| }; | ||
| const rewriteImportSpecifiers = (code, resolveReplacement) => { | ||
| let transformedCode = code; | ||
| for (const pattern of resolveImportSpecifierPatterns) { | ||
| transformedCode = transformedCode.replace(pattern, (fullMatch, prefix, specifier, suffix) => { | ||
| const replacement = resolveReplacement(specifier); | ||
| if (!replacement || replacement === specifier) { | ||
| return fullMatch; | ||
| } | ||
| return `${prefix}${replacement}${suffix}`; | ||
| }); | ||
| } | ||
| return transformedCode; | ||
| }; | ||
| const collectImportSpecifiers = (code) => { | ||
| const specifiers = new Set(); | ||
| for (const pattern of resolveImportSpecifierPatterns) { | ||
| code.replace(pattern, (_fullMatch, _prefix, specifier) => { | ||
| specifiers.add(specifier); | ||
| return _fullMatch; | ||
| }); | ||
| } | ||
| return [...specifiers]; | ||
| }; | ||
| const resolveFromParent = (specifier, parent) => { | ||
| try { | ||
| const resolvedSpecifier = import.meta.resolve(specifier, parent); | ||
| if (resolvedSpecifier === specifier || | ||
| resolvedSpecifier.startsWith("node:") || | ||
| resolvedSpecifier.startsWith("bun:")) { | ||
| return null; | ||
| } | ||
| return resolvedSpecifier; | ||
| } | ||
| catch { | ||
| return null; | ||
| } | ||
| }; | ||
| const resolveSourcePathFromSpecifier = (specifier, importer) => { | ||
| if (specifier.startsWith("node:") || | ||
| specifier.startsWith("bun:") || | ||
| specifier.startsWith("http:") || | ||
| specifier.startsWith("https:") || | ||
| specifier.startsWith("data:") || | ||
| specifier.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return null; | ||
| } | ||
| if (specifier.startsWith("file:")) { | ||
| return sourcePath(fileURLToPath(specifier)); | ||
| } | ||
| if (isAbsolute(specifier)) { | ||
| return sourcePath(specifier); | ||
| } | ||
| const resolvedSpecifier = resolveFromParent(specifier, importer); | ||
| if (!resolvedSpecifier) { | ||
| return null; | ||
| } | ||
| if (resolvedSpecifier.startsWith("file:")) { | ||
| return sourcePath(fileURLToPath(resolvedSpecifier)); | ||
| } | ||
| if (isAbsolute(resolvedSpecifier)) { | ||
| return sourcePath(resolvedSpecifier); | ||
| } | ||
| return null; | ||
| }; | ||
| const rewriteImportsFromResolveParents = (code, resolveParentsByRecency) => { | ||
| if (resolveParentsByRecency.length === 0) { | ||
| return code; | ||
| } | ||
| const resolveFromParents = (specifier) => { | ||
| if (!isBareSpecifier(specifier)) { | ||
| return null; | ||
| } | ||
| for (let index = resolveParentsByRecency.length - 1; index >= 0; index -= 1) { | ||
| const resolveParent = resolveParentsByRecency[index]; | ||
| const resolvedSpecifier = resolveFromParent(specifier, resolveParent); | ||
| if (resolvedSpecifier) { | ||
| return resolvedSpecifier; | ||
| } | ||
| } | ||
| return null; | ||
| }; | ||
| return rewriteImportSpecifiers(code, resolveFromParents); | ||
| }; | ||
| const rewriteRuntimeSpecifiers = (code, runtimeModuleIdsBySpecifier) => { | ||
| return rewriteImportSpecifiers(code, (specifier) => { | ||
| const runtimeModuleId = runtimeModuleIdsBySpecifier.get(specifier); | ||
| return runtimeModuleId ?? null; | ||
| }); | ||
| }; | ||
| export function createRuntimePlugin(input = {}) { | ||
| const runtimeModules = new Map(); | ||
| runtimeModules.set(CORE_RUNTIME_SPECIFIER, input.core ?? coreRuntime); | ||
| runtimeModules.set(CORE_TESTING_RUNTIME_SPECIFIER, loadCoreTestingRuntimeModule); | ||
| const rewriteOptions = resolveRuntimePluginRewriteOptions(input.rewrite); | ||
| for (const [specifier, moduleEntry] of Object.entries(input.additional ?? {})) { | ||
| runtimeModules.set(specifier, moduleEntry); | ||
| } | ||
| const runtimeModuleIdsBySpecifier = new Map(); | ||
| for (const specifier of runtimeModules.keys()) { | ||
| runtimeModuleIdsBySpecifier.set(specifier, runtimeModuleIdForSpecifier(specifier)); | ||
| } | ||
| return { | ||
| name: "bun-plugin-opentui-runtime-modules", | ||
| setup: (build) => { | ||
| const resolveParentsByRecency = []; | ||
| const installedRewriteLoaders = new Set(); | ||
| const nodeModulesBareRewritePackageRoots = new Set(); | ||
| const packageTypeByPackageJsonPath = new Map(); | ||
| const sourceAnalysisByPath = new Map(); | ||
| const nodeModulesRuntimeRewritePathsByPath = new Map(); | ||
| const installRewriteLoader = (path) => { | ||
| const resolvedTargetPath = sourcePath(path); | ||
| const canonicalTargetPath = normalizeSourcePath(resolvedTargetPath); | ||
| if (installedRewriteLoaders.has(canonicalTargetPath)) { | ||
| return; | ||
| } | ||
| installedRewriteLoaders.add(canonicalTargetPath); | ||
| // Register both the resolved path spelling and its canonical realpath so Bun | ||
| // can reach the loader even if it reports the same file through a different alias. | ||
| build.onLoad({ filter: exactPathFilter([resolvedTargetPath, canonicalTargetPath]) }, async (args) => { | ||
| const loadedPath = normalizeSourcePath(args.path); | ||
| if (loadedPath !== canonicalTargetPath) { | ||
| return undefined; | ||
| } | ||
| const nodeModulesPath = isNodeModulesPath(loadedPath); | ||
| const shouldRewriteRuntimeSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesRuntimeSpecifiers; | ||
| const shouldRewriteBareSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesBareSpecifiers; | ||
| const loader = runtimeLoaderForPath(args.path); | ||
| if (!loader) { | ||
| throw new Error(`Unable to determine runtime loader for path: ${args.path}`); | ||
| } | ||
| const contents = await Bun.file(loadedPath).text(); | ||
| const runtimeRewrittenContents = shouldRewriteRuntimeSpecifiers | ||
| ? rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier) | ||
| : contents; | ||
| if (runtimeRewrittenContents !== contents && shouldRewriteBareSpecifiers) { | ||
| registerResolveParent(resolveParentsByRecency, loadedPath); | ||
| } | ||
| const transformedContents = shouldRewriteBareSpecifiers | ||
| ? rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency) | ||
| : runtimeRewrittenContents; | ||
| return { | ||
| contents: transformedContents, | ||
| loader, | ||
| }; | ||
| }); | ||
| }; | ||
| const analyzeSourcePath = (path) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| const cachedAnalysis = sourceAnalysisByPath.get(normalizedPath); | ||
| if (cachedAnalysis) { | ||
| return cachedAnalysis; | ||
| } | ||
| let contents; | ||
| try { | ||
| contents = readFileSync(normalizedPath, "utf8"); | ||
| } | ||
| catch (error) { | ||
| if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { | ||
| const analysis = { importSpecifiers: [], needsRuntimeSpecifierRewrite: false }; | ||
| sourceAnalysisByPath.set(normalizedPath, analysis); | ||
| return analysis; | ||
| } | ||
| throw error; | ||
| } | ||
| const importSpecifiers = collectImportSpecifiers(contents); | ||
| const analysis = { | ||
| importSpecifiers, | ||
| needsRuntimeSpecifierRewrite: importSpecifiers.some((specifier) => runtimeModuleIdsBySpecifier.has(specifier)), | ||
| }; | ||
| sourceAnalysisByPath.set(normalizedPath, analysis); | ||
| return analysis; | ||
| }; | ||
| const collectNodeModulesRuntimeRewritePaths = (path, visiting = new Set()) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| if (!isNodeModulesEsmPath(normalizedPath, packageTypeByPackageJsonPath)) { | ||
| return []; | ||
| } | ||
| const cachedPaths = nodeModulesRuntimeRewritePathsByPath.get(normalizedPath); | ||
| if (cachedPaths) { | ||
| return cachedPaths; | ||
| } | ||
| if (visiting.has(normalizedPath)) { | ||
| return []; | ||
| } | ||
| visiting.add(normalizedPath); | ||
| const rewritePaths = new Set(); | ||
| const analysis = analyzeSourcePath(normalizedPath); | ||
| if (analysis.needsRuntimeSpecifierRewrite) { | ||
| rewritePaths.add(normalizedPath); | ||
| } | ||
| for (const specifier of analysis.importSpecifiers) { | ||
| const resolvedPath = resolveSourcePathFromSpecifier(specifier, normalizedPath); | ||
| if (!resolvedPath || !isNodeModulesEsmPath(resolvedPath, packageTypeByPackageJsonPath)) { | ||
| continue; | ||
| } | ||
| for (const nestedPath of collectNodeModulesRuntimeRewritePaths(resolvedPath, visiting)) { | ||
| rewritePaths.add(nestedPath); | ||
| } | ||
| } | ||
| visiting.delete(normalizedPath); | ||
| const resolvedRewritePaths = [...rewritePaths]; | ||
| nodeModulesRuntimeRewritePathsByPath.set(normalizedPath, resolvedRewritePaths); | ||
| return resolvedRewritePaths; | ||
| }; | ||
| for (const [specifier, moduleEntry] of runtimeModules.entries()) { | ||
| const moduleId = runtimeModuleIdsBySpecifier.get(specifier); | ||
| if (!moduleId) { | ||
| continue; | ||
| } | ||
| build.module(moduleId, async () => ({ | ||
| exports: await resolveRuntimeModuleExports(moduleEntry), | ||
| loader: "object", | ||
| })); | ||
| build.onResolve({ filter: exactSpecifierFilter(specifier) }, () => ({ path: moduleId })); | ||
| } | ||
| build.onResolve({ filter: /.*/ }, (args) => { | ||
| if (runtimeModuleIdsBySpecifier.has(args.path) || args.path.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return undefined; | ||
| } | ||
| const path = resolveSourcePathFromSpecifier(args.path, args.importer); | ||
| if (!path || !runtimeLoaderForPath(path)) { | ||
| return undefined; | ||
| } | ||
| const nodeModulesPath = isNodeModulesPath(path); | ||
| if (!nodeModulesPath) { | ||
| installRewriteLoader(path); | ||
| return undefined; | ||
| } | ||
| if (!rewriteOptions.nodeModulesRuntimeSpecifiers && !rewriteOptions.nodeModulesBareSpecifiers) { | ||
| return undefined; | ||
| } | ||
| for (const rewritePath of collectNodeModulesRuntimeRewritePaths(path)) { | ||
| installRewriteLoader(rewritePath); | ||
| } | ||
| const packageRoot = nodeModulesPackageRootForPath(path); | ||
| if (rewriteOptions.nodeModulesBareSpecifiers && | ||
| packageRoot && | ||
| nodeModulesBareRewritePackageRoots.has(packageRoot)) { | ||
| installRewriteLoader(path); | ||
| return undefined; | ||
| } | ||
| if (!rewriteOptions.nodeModulesRuntimeSpecifiers || !analyzeSourcePath(path).needsRuntimeSpecifierRewrite) { | ||
| return undefined; | ||
| } | ||
| if (rewriteOptions.nodeModulesBareSpecifiers && packageRoot) { | ||
| nodeModulesBareRewritePackageRoots.add(packageRoot); | ||
| } | ||
| installRewriteLoader(path); | ||
| return undefined; | ||
| }); | ||
| }, | ||
| }; | ||
| } | ||
| //# sourceMappingURL=runtime-plugin.js.map |
@@ -1,9 +0,1 @@ | ||
| { | ||
| "version": 3, | ||
| "sources": [], | ||
| "sourcesContent": [ | ||
| ], | ||
| "mappings": "", | ||
| "debugId": "54AC4E2ADFC3366A64756E2164756E21", | ||
| "names": [] | ||
| } | ||
| {"version":3,"file":"runtime-plugin.js","sourceRoot":"","sources":["runtime-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EA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
| SystemClock, | ||
| TreeSitterClient | ||
| } from "./index-54s7pk0d.js"; | ||
| } from "./index-59t85rvq.js"; | ||
| // src/testing/mock-keys.ts | ||
| import { Buffer as Buffer2 } from "buffer"; | ||
| import { Buffer as Buffer2 } from "node:buffer"; | ||
| function pasteBytes(text) { | ||
@@ -231,3 +231,3 @@ return Uint8Array.from(Buffer2.from(text)); | ||
| _: "\x1F", | ||
| "?": "\x7F", | ||
| "?": "", | ||
| "/": "\x1F", | ||
@@ -725,6 +725,12 @@ "-": "\x1F", | ||
| _autoResolveTimeout; | ||
| _clock; | ||
| constructor(options) { | ||
| super({ dataPath: "/tmp/mock" }); | ||
| super({ dataPath: "/tmp/mock" }, { autoStartWorker: false }); | ||
| this._autoResolveTimeout = options?.autoResolveTimeout; | ||
| this._clock = options?.clock ?? new SystemClock; | ||
| } | ||
| async destroy() { | ||
| this.resolveAllHighlightOnce(); | ||
| await super.destroy(); | ||
| } | ||
| async highlightOnce(content, filetype) { | ||
@@ -734,3 +740,3 @@ const { promise, resolve } = Promise.withResolvers(); | ||
| if (this._autoResolveTimeout !== undefined) { | ||
| timeout = setTimeout(() => { | ||
| timeout = this._clock.setTimeout(() => { | ||
| const index = this._highlightPromises.findIndex((p) => p.promise === promise); | ||
@@ -753,3 +759,3 @@ if (index !== -1) { | ||
| if (item.timeout) { | ||
| clearTimeout(item.timeout); | ||
| this._clock.clearTimeout(item.timeout); | ||
| } | ||
@@ -763,3 +769,3 @@ item.resolve(this._mockResult); | ||
| if (timeout) { | ||
| clearTimeout(timeout); | ||
| this._clock.clearTimeout(timeout); | ||
| } | ||
@@ -999,3 +1005,3 @@ resolve(this._mockResult); | ||
| //# debugId=0BAC903EE185632E64756E2164756E21 | ||
| //# debugId=710D918A343D2BFC64756E2164756E21 | ||
| //# sourceMappingURL=testing.js.map |
| import { TreeSitterClient } from "../lib/tree-sitter/index.js"; | ||
| import { type Clock } from "../lib/clock.js"; | ||
| import type { SimpleHighlight } from "../lib/tree-sitter/types.js"; | ||
@@ -7,5 +8,8 @@ export declare class MockTreeSitterClient extends TreeSitterClient { | ||
| private _autoResolveTimeout?; | ||
| private readonly _clock; | ||
| constructor(options?: { | ||
| autoResolveTimeout?: number; | ||
| clock?: Clock; | ||
| }); | ||
| destroy(): Promise<void>; | ||
| highlightOnce(content: string, filetype: string): Promise<{ | ||
@@ -12,0 +16,0 @@ highlights?: SimpleHighlight[]; |
+1
-1
@@ -372,3 +372,3 @@ import { type Pointer } from "./platform/ffi.js"; | ||
| textBufferClearAllHighlights: (buffer: TextBufferHandle) => void; | ||
| textBufferSetSyntaxStyle: (buffer: TextBufferHandle, style: SyntaxStyleHandle | null) => void; | ||
| textBufferSetSyntaxStyle: (buffer: TextBufferHandle, style: SyntaxStyleHandle | null) => boolean; | ||
| textBufferGetLineHighlights: (buffer: TextBufferHandle, lineIdx: number) => Array<Highlight>; | ||
@@ -375,0 +375,0 @@ textBufferGetHighlightCount: (buffer: TextBufferHandle) => number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| // @bun | ||
| import { | ||
| createRuntimePlugin | ||
| } from "./index-r49y8kdq.js"; | ||
| // src/runtime-plugin-support-configure.ts | ||
| var {plugin: registerBunPlugin } = globalThis.Bun; | ||
| var runtimePluginSupportInstalledKey = "__opentuiCoreRuntimePluginSupportInstalled__"; | ||
| function normalizeRewriteKey(rewrite) { | ||
| return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`; | ||
| } | ||
| function assertCompatibleInstall(install, options) { | ||
| for (const specifier of Object.keys(options.additional ?? {})) { | ||
| if (!install.additionalSpecifiers.has(specifier)) { | ||
| throw new Error(`OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`); | ||
| } | ||
| } | ||
| if (options.core && options.core !== install.core) { | ||
| throw new Error("OpenTUI Core runtime plugin support is already installed with a different core runtime module."); | ||
| } | ||
| if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) { | ||
| throw new Error("OpenTUI Core runtime plugin support is already installed with different rewrite options."); | ||
| } | ||
| } | ||
| function ensureRuntimePluginSupport(options = {}) { | ||
| const state = globalThis; | ||
| const install = state[runtimePluginSupportInstalledKey]; | ||
| if (install) { | ||
| assertCompatibleInstall(install, options); | ||
| return false; | ||
| } | ||
| registerBunPlugin(createRuntimePlugin(options)); | ||
| state[runtimePluginSupportInstalledKey] = { | ||
| additionalSpecifiers: new Set(Object.keys(options.additional ?? {})), | ||
| core: options.core, | ||
| rewriteKey: normalizeRewriteKey(options.rewrite) | ||
| }; | ||
| return true; | ||
| } | ||
| export { ensureRuntimePluginSupport }; | ||
| //# debugId=09C0597CB92E654F64756E2164756E21 | ||
| //# sourceMappingURL=index-8t841rbx.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/runtime-plugin-support-configure.ts"], | ||
| "sourcesContent": [ | ||
| "import { plugin as registerBunPlugin } from \"bun\"\nimport { createRuntimePlugin, type CreateRuntimePluginOptions, type RuntimeModuleEntry } from \"./runtime-plugin.js\"\n\nconst runtimePluginSupportInstalledKey = \"__opentuiCoreRuntimePluginSupportInstalled__\"\n\ninterface RuntimePluginSupportInstall {\n additionalSpecifiers: ReadonlySet<string>\n core?: RuntimeModuleEntry\n rewriteKey: string\n}\n\ntype RuntimePluginSupportState = typeof globalThis & {\n [runtimePluginSupportInstalledKey]?: RuntimePluginSupportInstall\n}\n\nfunction normalizeRewriteKey(rewrite: CreateRuntimePluginOptions[\"rewrite\"] | undefined): string {\n return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`\n}\n\nfunction assertCompatibleInstall(install: RuntimePluginSupportInstall, options: CreateRuntimePluginOptions): void {\n for (const specifier of Object.keys(options.additional ?? {})) {\n if (!install.additionalSpecifiers.has(specifier)) {\n throw new Error(\n `OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`,\n )\n }\n }\n\n if (options.core && options.core !== install.core) {\n throw new Error(\"OpenTUI Core runtime plugin support is already installed with a different core runtime module.\")\n }\n\n if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) {\n throw new Error(\"OpenTUI Core runtime plugin support is already installed with different rewrite options.\")\n }\n}\n\nexport function ensureRuntimePluginSupport(options: CreateRuntimePluginOptions = {}): boolean {\n const state = globalThis as RuntimePluginSupportState\n const install = state[runtimePluginSupportInstalledKey]\n\n if (install) {\n assertCompatibleInstall(install, options)\n return false\n }\n\n registerBunPlugin(createRuntimePlugin(options))\n\n state[runtimePluginSupportInstalledKey] = {\n additionalSpecifiers: new Set(Object.keys(options.additional ?? {})),\n core: options.core,\n rewriteKey: normalizeRewriteKey(options.rewrite),\n }\n return true\n}\n\nexport { createRuntimePlugin, runtimeModuleIdForSpecifier } from \"./runtime-plugin.js\"\nexport type {\n CreateRuntimePluginOptions,\n RuntimeModuleEntry,\n RuntimeModuleExports,\n RuntimeModuleLoader,\n} from \"./runtime-plugin.js\"\n" | ||
| ], | ||
| "mappings": ";;;;;;AAAA;AAGA,IAAM,mCAAmC;AAYzC,SAAS,mBAAmB,CAAC,SAAoE;AAAA,EAC/F,OAAO,GAAG,SAAS,gCAAgC,QAAQ,SAAS,6BAA6B;AAAA;AAGnG,SAAS,uBAAuB,CAAC,SAAsC,SAA2C;AAAA,EAChH,WAAW,aAAa,OAAO,KAAK,QAAQ,cAAc,CAAC,CAAC,GAAG;AAAA,IAC7D,IAAI,CAAC,QAAQ,qBAAqB,IAAI,SAAS,GAAG;AAAA,MAChD,MAAM,IAAI,MACR,oEAAoE,uKACtE;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ,MAAM;AAAA,IACjD,MAAM,IAAI,MAAM,gGAAgG;AAAA,EAClH;AAAA,EAEA,IAAI,QAAQ,WAAW,oBAAoB,QAAQ,OAAO,MAAM,QAAQ,YAAY;AAAA,IAClF,MAAM,IAAI,MAAM,0FAA0F;AAAA,EAC5G;AAAA;AAGK,SAAS,0BAA0B,CAAC,UAAsC,CAAC,GAAY;AAAA,EAC5F,MAAM,QAAQ;AAAA,EACd,MAAM,UAAU,MAAM;AAAA,EAEtB,IAAI,SAAS;AAAA,IACX,wBAAwB,SAAS,OAAO;AAAA,IACxC,OAAO;AAAA,EACT;AAAA,EAEA,kBAAkB,oBAAoB,OAAO,CAAC;AAAA,EAE9C,MAAM,oCAAoC;AAAA,IACxC,sBAAsB,IAAI,IAAI,OAAO,KAAK,QAAQ,cAAc,CAAC,CAAC,CAAC;AAAA,IACnE,MAAM,QAAQ;AAAA,IACd,YAAY,oBAAoB,QAAQ,OAAO;AAAA,EACjD;AAAA,EACA,OAAO;AAAA;", | ||
| "debugId": "09C0597CB92E654F64756E2164756E21", | ||
| "names": [] | ||
| } |
| // @bun | ||
| import { | ||
| exports_src | ||
| } from "./index-0nvgrgam.js"; | ||
| import { | ||
| __require | ||
| } from "./index-54s7pk0d.js"; | ||
| // src/runtime-plugin.ts | ||
| import { existsSync, readFileSync, realpathSync } from "fs"; | ||
| import { basename, dirname, isAbsolute, join } from "path"; | ||
| import { fileURLToPath } from "url"; | ||
| var CORE_RUNTIME_SPECIFIER = "@opentui/core"; | ||
| var CORE_TESTING_RUNTIME_SPECIFIER = "@opentui/core/testing"; | ||
| var RUNTIME_MODULE_PREFIX = "opentui:runtime-module:"; | ||
| var MAX_RUNTIME_RESOLVE_PARENTS = 64; | ||
| var DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS = { | ||
| nodeModulesRuntimeSpecifiers: true, | ||
| nodeModulesBareSpecifiers: false | ||
| }; | ||
| var DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS = [CORE_RUNTIME_SPECIFIER, CORE_TESTING_RUNTIME_SPECIFIER]; | ||
| var DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET = new Set(DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS); | ||
| var isCoreRuntimeModuleSpecifier = (specifier) => { | ||
| return DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET.has(specifier); | ||
| }; | ||
| var loadCoreTestingRuntimeModule = async () => { | ||
| return await import("./testing.js"); | ||
| }; | ||
| var escapeRegExp = (value) => { | ||
| return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
| }; | ||
| var exactSpecifierFilter = (specifier) => { | ||
| return new RegExp(`^${escapeRegExp(specifier)}$`); | ||
| }; | ||
| var exactPathFilter = (paths) => { | ||
| const candidates = [...new Set(paths.map(sourcePath))]; | ||
| return new RegExp(`^(?:${candidates.map(escapeRegExp).join("|")})(?:[?#].*)?$`); | ||
| }; | ||
| var runtimeModuleIdForSpecifier = (specifier) => { | ||
| return `${RUNTIME_MODULE_PREFIX}${encodeURIComponent(specifier)}`; | ||
| }; | ||
| var resolveRuntimeModuleExports = async (moduleEntry) => { | ||
| if (typeof moduleEntry === "function") { | ||
| return await moduleEntry(); | ||
| } | ||
| return moduleEntry; | ||
| }; | ||
| var sourcePath = (path) => { | ||
| const searchIndex = path.indexOf("?"); | ||
| const hashIndex = path.indexOf("#"); | ||
| const end = [searchIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0]; | ||
| return end === undefined ? path : path.slice(0, end); | ||
| }; | ||
| var normalizedSourcePathByPath = new Map; | ||
| var normalizeSourcePath = (path) => { | ||
| const cleanPath = sourcePath(path); | ||
| const cachedPath = normalizedSourcePathByPath.get(cleanPath); | ||
| if (cachedPath !== undefined) { | ||
| return cachedPath; | ||
| } | ||
| let normalizedPath = cleanPath; | ||
| try { | ||
| normalizedPath = realpathSync(cleanPath); | ||
| } catch { | ||
| normalizedPath = cleanPath; | ||
| } | ||
| normalizedSourcePathByPath.set(cleanPath, normalizedPath); | ||
| return normalizedPath; | ||
| }; | ||
| var isNodeModulesPath = (path) => { | ||
| return /(?:^|[/\\])node_modules(?:[/\\])/.test(path); | ||
| }; | ||
| var packageTypeForPath = (path, packageTypeByPackageJsonPath) => { | ||
| let currentDir = dirname(path); | ||
| while (true) { | ||
| const packageJsonPath = join(currentDir, "package.json"); | ||
| if (existsSync(packageJsonPath)) { | ||
| const cachedPackageType = packageTypeByPackageJsonPath.get(packageJsonPath); | ||
| if (cachedPackageType) { | ||
| return cachedPackageType; | ||
| } | ||
| let packageType = "commonjs"; | ||
| try { | ||
| const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); | ||
| if (packageJson.type === "module") { | ||
| packageType = "module"; | ||
| } | ||
| } catch { | ||
| packageType = "commonjs"; | ||
| } | ||
| packageTypeByPackageJsonPath.set(packageJsonPath, packageType); | ||
| return packageType; | ||
| } | ||
| const parentDir = dirname(currentDir); | ||
| if (parentDir === currentDir) { | ||
| return "commonjs"; | ||
| } | ||
| currentDir = parentDir; | ||
| } | ||
| }; | ||
| var isNodeModulesEsmPath = (path, packageTypeByPackageJsonPath) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| if (!isNodeModulesPath(normalizedPath)) { | ||
| return false; | ||
| } | ||
| if (normalizedPath.endsWith(".mjs") || normalizedPath.endsWith(".mts") || normalizedPath.endsWith(".ts") || normalizedPath.endsWith(".tsx") || normalizedPath.endsWith(".jsx")) { | ||
| return true; | ||
| } | ||
| if (normalizedPath.endsWith(".cjs") || normalizedPath.endsWith(".cts") || !normalizedPath.endsWith(".js")) { | ||
| return false; | ||
| } | ||
| return packageTypeForPath(normalizedPath, packageTypeByPackageJsonPath) === "module"; | ||
| }; | ||
| var nodeModulesPackageRootForPath = (path) => { | ||
| let currentDir = dirname(path); | ||
| while (true) { | ||
| const parentDir = dirname(currentDir); | ||
| if (parentDir === currentDir) { | ||
| return null; | ||
| } | ||
| if (basename(parentDir) === "node_modules") { | ||
| return currentDir; | ||
| } | ||
| if (basename(dirname(parentDir)) === "node_modules" && basename(parentDir).startsWith("@")) { | ||
| return currentDir; | ||
| } | ||
| currentDir = parentDir; | ||
| } | ||
| }; | ||
| var resolveRuntimePluginRewriteOptions = (options) => { | ||
| return { | ||
| nodeModulesRuntimeSpecifiers: options?.nodeModulesRuntimeSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesRuntimeSpecifiers, | ||
| nodeModulesBareSpecifiers: options?.nodeModulesBareSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesBareSpecifiers | ||
| }; | ||
| }; | ||
| var runtimeLoaderForPath = (path) => { | ||
| const cleanPath = sourcePath(path); | ||
| if (cleanPath.endsWith(".tsx")) { | ||
| return "tsx"; | ||
| } | ||
| if (cleanPath.endsWith(".jsx")) { | ||
| return "jsx"; | ||
| } | ||
| if (cleanPath.endsWith(".ts") || cleanPath.endsWith(".mts") || cleanPath.endsWith(".cts")) { | ||
| return "ts"; | ||
| } | ||
| if (cleanPath.endsWith(".js") || cleanPath.endsWith(".mjs") || cleanPath.endsWith(".cjs")) { | ||
| return "js"; | ||
| } | ||
| return null; | ||
| }; | ||
| var resolveImportSpecifierPatterns = [ | ||
| /(from\s+["'])([^"']+)(["'])/g, | ||
| /(import\s+["'])([^"']+)(["'])/g, | ||
| /(import\s*\(\s*["'])([^"']+)(["']\s*\))/g, | ||
| /(require\s*\(\s*["'])([^"']+)(["']\s*\))/g | ||
| ]; | ||
| var isBareSpecifier = (specifier) => { | ||
| if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("\\")) { | ||
| return false; | ||
| } | ||
| if (specifier.startsWith("node:") || specifier.startsWith("bun:") || specifier.startsWith("http:") || specifier.startsWith("https:") || specifier.startsWith("file:") || specifier.startsWith("data:")) { | ||
| return false; | ||
| } | ||
| if (specifier.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| }; | ||
| var registerResolveParent = (resolveParentsByRecency, resolveParent) => { | ||
| const existingIndex = resolveParentsByRecency.indexOf(resolveParent); | ||
| if (existingIndex >= 0) { | ||
| resolveParentsByRecency.splice(existingIndex, 1); | ||
| } | ||
| resolveParentsByRecency.push(resolveParent); | ||
| if (resolveParentsByRecency.length > MAX_RUNTIME_RESOLVE_PARENTS) { | ||
| resolveParentsByRecency.shift(); | ||
| } | ||
| }; | ||
| var rewriteImportSpecifiers = (code, resolveReplacement) => { | ||
| let transformedCode = code; | ||
| for (const pattern of resolveImportSpecifierPatterns) { | ||
| transformedCode = transformedCode.replace(pattern, (fullMatch, prefix, specifier, suffix) => { | ||
| const replacement = resolveReplacement(specifier); | ||
| if (!replacement || replacement === specifier) { | ||
| return fullMatch; | ||
| } | ||
| return `${prefix}${replacement}${suffix}`; | ||
| }); | ||
| } | ||
| return transformedCode; | ||
| }; | ||
| var collectImportSpecifiers = (code) => { | ||
| const specifiers = new Set; | ||
| for (const pattern of resolveImportSpecifierPatterns) { | ||
| code.replace(pattern, (_fullMatch, _prefix, specifier) => { | ||
| specifiers.add(specifier); | ||
| return _fullMatch; | ||
| }); | ||
| } | ||
| return [...specifiers]; | ||
| }; | ||
| var resolveFromParent = (specifier, parent) => { | ||
| try { | ||
| const resolvedSpecifier = import.meta.resolve(specifier, parent); | ||
| if (resolvedSpecifier === specifier || resolvedSpecifier.startsWith("node:") || resolvedSpecifier.startsWith("bun:")) { | ||
| return null; | ||
| } | ||
| return resolvedSpecifier; | ||
| } catch { | ||
| return null; | ||
| } | ||
| }; | ||
| var resolveSourcePathFromSpecifier = (specifier, importer) => { | ||
| if (specifier.startsWith("node:") || specifier.startsWith("bun:") || specifier.startsWith("http:") || specifier.startsWith("https:") || specifier.startsWith("data:") || specifier.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return null; | ||
| } | ||
| if (specifier.startsWith("file:")) { | ||
| return sourcePath(fileURLToPath(specifier)); | ||
| } | ||
| if (isAbsolute(specifier)) { | ||
| return sourcePath(specifier); | ||
| } | ||
| const resolvedSpecifier = resolveFromParent(specifier, importer); | ||
| if (!resolvedSpecifier) { | ||
| return null; | ||
| } | ||
| if (resolvedSpecifier.startsWith("file:")) { | ||
| return sourcePath(fileURLToPath(resolvedSpecifier)); | ||
| } | ||
| if (isAbsolute(resolvedSpecifier)) { | ||
| return sourcePath(resolvedSpecifier); | ||
| } | ||
| return null; | ||
| }; | ||
| var rewriteImportsFromResolveParents = (code, resolveParentsByRecency) => { | ||
| if (resolveParentsByRecency.length === 0) { | ||
| return code; | ||
| } | ||
| const resolveFromParents = (specifier) => { | ||
| if (!isBareSpecifier(specifier)) { | ||
| return null; | ||
| } | ||
| for (let index = resolveParentsByRecency.length - 1;index >= 0; index -= 1) { | ||
| const resolveParent = resolveParentsByRecency[index]; | ||
| const resolvedSpecifier = resolveFromParent(specifier, resolveParent); | ||
| if (resolvedSpecifier) { | ||
| return resolvedSpecifier; | ||
| } | ||
| } | ||
| return null; | ||
| }; | ||
| return rewriteImportSpecifiers(code, resolveFromParents); | ||
| }; | ||
| var rewriteRuntimeSpecifiers = (code, runtimeModuleIdsBySpecifier) => { | ||
| return rewriteImportSpecifiers(code, (specifier) => { | ||
| const runtimeModuleId = runtimeModuleIdsBySpecifier.get(specifier); | ||
| return runtimeModuleId ?? null; | ||
| }); | ||
| }; | ||
| function createRuntimePlugin(input = {}) { | ||
| const runtimeModules = new Map; | ||
| runtimeModules.set(CORE_RUNTIME_SPECIFIER, input.core ?? exports_src); | ||
| runtimeModules.set(CORE_TESTING_RUNTIME_SPECIFIER, loadCoreTestingRuntimeModule); | ||
| const rewriteOptions = resolveRuntimePluginRewriteOptions(input.rewrite); | ||
| for (const [specifier, moduleEntry] of Object.entries(input.additional ?? {})) { | ||
| runtimeModules.set(specifier, moduleEntry); | ||
| } | ||
| const runtimeModuleIdsBySpecifier = new Map; | ||
| for (const specifier of runtimeModules.keys()) { | ||
| runtimeModuleIdsBySpecifier.set(specifier, runtimeModuleIdForSpecifier(specifier)); | ||
| } | ||
| return { | ||
| name: "bun-plugin-opentui-runtime-modules", | ||
| setup: (build) => { | ||
| const resolveParentsByRecency = []; | ||
| const installedRewriteLoaders = new Set; | ||
| const nodeModulesBareRewritePackageRoots = new Set; | ||
| const packageTypeByPackageJsonPath = new Map; | ||
| const sourceAnalysisByPath = new Map; | ||
| const nodeModulesRuntimeRewritePathsByPath = new Map; | ||
| const installRewriteLoader = (path) => { | ||
| const resolvedTargetPath = sourcePath(path); | ||
| const canonicalTargetPath = normalizeSourcePath(resolvedTargetPath); | ||
| if (installedRewriteLoaders.has(canonicalTargetPath)) { | ||
| return; | ||
| } | ||
| installedRewriteLoaders.add(canonicalTargetPath); | ||
| build.onLoad({ filter: exactPathFilter([resolvedTargetPath, canonicalTargetPath]) }, async (args) => { | ||
| const loadedPath = normalizeSourcePath(args.path); | ||
| if (loadedPath !== canonicalTargetPath) { | ||
| return; | ||
| } | ||
| const nodeModulesPath = isNodeModulesPath(loadedPath); | ||
| const shouldRewriteRuntimeSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesRuntimeSpecifiers; | ||
| const shouldRewriteBareSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesBareSpecifiers; | ||
| const loader = runtimeLoaderForPath(args.path); | ||
| if (!loader) { | ||
| throw new Error(`Unable to determine runtime loader for path: ${args.path}`); | ||
| } | ||
| const contents = await Bun.file(loadedPath).text(); | ||
| const runtimeRewrittenContents = shouldRewriteRuntimeSpecifiers ? rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier) : contents; | ||
| if (runtimeRewrittenContents !== contents && shouldRewriteBareSpecifiers) { | ||
| registerResolveParent(resolveParentsByRecency, loadedPath); | ||
| } | ||
| const transformedContents = shouldRewriteBareSpecifiers ? rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency) : runtimeRewrittenContents; | ||
| return { | ||
| contents: transformedContents, | ||
| loader | ||
| }; | ||
| }); | ||
| }; | ||
| const analyzeSourcePath = (path) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| const cachedAnalysis = sourceAnalysisByPath.get(normalizedPath); | ||
| if (cachedAnalysis) { | ||
| return cachedAnalysis; | ||
| } | ||
| let contents; | ||
| try { | ||
| contents = readFileSync(normalizedPath, "utf8"); | ||
| } catch (error) { | ||
| if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { | ||
| const analysis2 = { importSpecifiers: [], needsRuntimeSpecifierRewrite: false }; | ||
| sourceAnalysisByPath.set(normalizedPath, analysis2); | ||
| return analysis2; | ||
| } | ||
| throw error; | ||
| } | ||
| const importSpecifiers = collectImportSpecifiers(contents); | ||
| const analysis = { | ||
| importSpecifiers, | ||
| needsRuntimeSpecifierRewrite: importSpecifiers.some((specifier) => runtimeModuleIdsBySpecifier.has(specifier)) | ||
| }; | ||
| sourceAnalysisByPath.set(normalizedPath, analysis); | ||
| return analysis; | ||
| }; | ||
| const collectNodeModulesRuntimeRewritePaths = (path, visiting = new Set) => { | ||
| const normalizedPath = normalizeSourcePath(path); | ||
| if (!isNodeModulesEsmPath(normalizedPath, packageTypeByPackageJsonPath)) { | ||
| return []; | ||
| } | ||
| const cachedPaths = nodeModulesRuntimeRewritePathsByPath.get(normalizedPath); | ||
| if (cachedPaths) { | ||
| return cachedPaths; | ||
| } | ||
| if (visiting.has(normalizedPath)) { | ||
| return []; | ||
| } | ||
| visiting.add(normalizedPath); | ||
| const rewritePaths = new Set; | ||
| const analysis = analyzeSourcePath(normalizedPath); | ||
| if (analysis.needsRuntimeSpecifierRewrite) { | ||
| rewritePaths.add(normalizedPath); | ||
| } | ||
| for (const specifier of analysis.importSpecifiers) { | ||
| const resolvedPath = resolveSourcePathFromSpecifier(specifier, normalizedPath); | ||
| if (!resolvedPath || !isNodeModulesEsmPath(resolvedPath, packageTypeByPackageJsonPath)) { | ||
| continue; | ||
| } | ||
| for (const nestedPath of collectNodeModulesRuntimeRewritePaths(resolvedPath, visiting)) { | ||
| rewritePaths.add(nestedPath); | ||
| } | ||
| } | ||
| visiting.delete(normalizedPath); | ||
| const resolvedRewritePaths = [...rewritePaths]; | ||
| nodeModulesRuntimeRewritePathsByPath.set(normalizedPath, resolvedRewritePaths); | ||
| return resolvedRewritePaths; | ||
| }; | ||
| for (const [specifier, moduleEntry] of runtimeModules.entries()) { | ||
| const moduleId = runtimeModuleIdsBySpecifier.get(specifier); | ||
| if (!moduleId) { | ||
| continue; | ||
| } | ||
| build.module(moduleId, async () => ({ | ||
| exports: await resolveRuntimeModuleExports(moduleEntry), | ||
| loader: "object" | ||
| })); | ||
| build.onResolve({ filter: exactSpecifierFilter(specifier) }, () => ({ path: moduleId })); | ||
| } | ||
| build.onResolve({ filter: /.*/ }, (args) => { | ||
| if (runtimeModuleIdsBySpecifier.has(args.path) || args.path.startsWith(RUNTIME_MODULE_PREFIX)) { | ||
| return; | ||
| } | ||
| const path = resolveSourcePathFromSpecifier(args.path, args.importer); | ||
| if (!path || !runtimeLoaderForPath(path)) { | ||
| return; | ||
| } | ||
| const nodeModulesPath = isNodeModulesPath(path); | ||
| if (!nodeModulesPath) { | ||
| installRewriteLoader(path); | ||
| return; | ||
| } | ||
| if (!rewriteOptions.nodeModulesRuntimeSpecifiers && !rewriteOptions.nodeModulesBareSpecifiers) { | ||
| return; | ||
| } | ||
| for (const rewritePath of collectNodeModulesRuntimeRewritePaths(path)) { | ||
| installRewriteLoader(rewritePath); | ||
| } | ||
| const packageRoot = nodeModulesPackageRootForPath(path); | ||
| if (rewriteOptions.nodeModulesBareSpecifiers && packageRoot && nodeModulesBareRewritePackageRoots.has(packageRoot)) { | ||
| installRewriteLoader(path); | ||
| return; | ||
| } | ||
| if (!rewriteOptions.nodeModulesRuntimeSpecifiers || !analyzeSourcePath(path).needsRuntimeSpecifierRewrite) { | ||
| return; | ||
| } | ||
| if (rewriteOptions.nodeModulesBareSpecifiers && packageRoot) { | ||
| nodeModulesBareRewritePackageRoots.add(packageRoot); | ||
| } | ||
| installRewriteLoader(path); | ||
| return; | ||
| }); | ||
| } | ||
| }; | ||
| } | ||
| export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin }; | ||
| //# debugId=4F4ECA92927B118964756E2164756E21 | ||
| //# sourceMappingURL=index-r49y8kdq.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../src/runtime-plugin.ts"], | ||
| "sourcesContent": [ | ||
| "/*\n * Exposes runtime-only modules (for example `@opentui/core`, `@opentui/solid`,\n * `solid-js`) to externally loaded plugins by rewriting matching imports to\n * virtual `opentui:runtime-module:*` ids.\n *\n * Why this is exact-path + prescan instead of one broad `onLoad`:\n * - Bun can break CJS/UMD interop if a file is routed through plugin `onLoad`\n * (real repro: `jsonc-parser` resolving to `lib/umd/main.js`;\n * https://github.com/oven-sh/bun/issues/19279,\n * https://github.com/oven-sh/bun/issues/21369), so arbitrary `node_modules`\n * JS cannot be blanket-rewritten.\n * - runtime `onResolve` is sync-only, so package/type/source discovery here is\n * synchronous and cached.\n * - a matched `onLoad` cannot safely fall through, so loaders must be narrow.\n * - Bun may canonicalize paths before `onLoad`, so loaders are registered for\n * both the resolved path spelling and its realpath, then canonical-checked.\n * - Bun may native-load `node_modules` ESM without firing `onResolve` for\n * nested package imports, so `node_modules` ESM is recursively prescanned and\n * only files that actually need runtime rewriting get exact-path loaders.\n *\n * Behavior:\n * - non-`node_modules` source files get a dedicated rewrite loader immediately.\n * - `node_modules` files are rewritten only if they are ESM (`.mjs`, `.mts`,\n * `.ts`, `.tsx`, `.jsx`, or `.js` under `package.json#type=\"module\"`) and\n * directly or transitively need runtime-module rewriting; unrelated CJS stays\n * untouched.\n * - optional bare-specifier rewriting is preserved for sibling files in\n * packages already marked for runtime rewriting.\n *\n * Notes:\n * - import scanning is regex-based, not a full parser.\n * - CJS helper libraries that themselves import runtime modules are still not\n * supported.\n * - `package.json#type` caching is per plugin setup, not module-global, so a\n * later plugin instance in the same process can observe filesystem changes.\n */\nimport { existsSync, readFileSync, realpathSync } from \"node:fs\"\nimport { basename, dirname, isAbsolute, join } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\nimport { type BunPlugin } from \"bun\"\nimport * as coreRuntime from \"./index.js\"\n\nexport type RuntimeModuleExports = Record<string, unknown>\nexport type RuntimeModuleLoader = () => RuntimeModuleExports | Promise<RuntimeModuleExports>\nexport type RuntimeModuleEntry = RuntimeModuleExports | RuntimeModuleLoader\n\ninterface SourceAnalysis {\n importSpecifiers: string[]\n needsRuntimeSpecifierRewrite: boolean\n}\n\nexport interface RuntimePluginRewriteOptions {\n nodeModulesRuntimeSpecifiers?: boolean\n nodeModulesBareSpecifiers?: boolean\n}\n\nexport interface CreateRuntimePluginOptions {\n core?: RuntimeModuleEntry\n additional?: Record<string, RuntimeModuleEntry>\n rewrite?: RuntimePluginRewriteOptions\n}\n\nconst CORE_RUNTIME_SPECIFIER = \"@opentui/core\"\nconst CORE_TESTING_RUNTIME_SPECIFIER = \"@opentui/core/testing\"\nconst RUNTIME_MODULE_PREFIX = \"opentui:runtime-module:\"\nconst MAX_RUNTIME_RESOLVE_PARENTS = 64\nconst DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS: Required<RuntimePluginRewriteOptions> = {\n nodeModulesRuntimeSpecifiers: true,\n nodeModulesBareSpecifiers: false,\n}\n\nconst DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS = [CORE_RUNTIME_SPECIFIER, CORE_TESTING_RUNTIME_SPECIFIER] as const\n\nconst DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET = new Set<string>(DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS)\n\nexport const isCoreRuntimeModuleSpecifier = (specifier: string): boolean => {\n return DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET.has(specifier)\n}\n\nconst loadCoreTestingRuntimeModule = async (): Promise<RuntimeModuleExports> => {\n return (await import(\"./testing.js\")) as RuntimeModuleExports\n}\n\nconst escapeRegExp = (value: string): string => {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\nconst exactSpecifierFilter = (specifier: string): RegExp => {\n return new RegExp(`^${escapeRegExp(specifier)}$`)\n}\n\nconst exactPathFilter = (paths: string[]): RegExp => {\n const candidates = [...new Set(paths.map(sourcePath))]\n return new RegExp(`^(?:${candidates.map(escapeRegExp).join(\"|\")})(?:[?#].*)?$`)\n}\n\nexport const runtimeModuleIdForSpecifier = (specifier: string): string => {\n return `${RUNTIME_MODULE_PREFIX}${encodeURIComponent(specifier)}`\n}\n\nconst resolveRuntimeModuleExports = async (moduleEntry: RuntimeModuleEntry): Promise<RuntimeModuleExports> => {\n if (typeof moduleEntry === \"function\") {\n return await moduleEntry()\n }\n\n return moduleEntry\n}\n\nconst sourcePath = (path: string): string => {\n const searchIndex = path.indexOf(\"?\")\n const hashIndex = path.indexOf(\"#\")\n const end = [searchIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0]\n return end === undefined ? path : path.slice(0, end)\n}\n\nconst normalizedSourcePathByPath = new Map<string, string>()\n\nconst normalizeSourcePath = (path: string): string => {\n const cleanPath = sourcePath(path)\n const cachedPath = normalizedSourcePathByPath.get(cleanPath)\n if (cachedPath !== undefined) {\n return cachedPath\n }\n\n let normalizedPath = cleanPath\n\n try {\n normalizedPath = realpathSync(cleanPath)\n } catch {\n normalizedPath = cleanPath\n }\n\n normalizedSourcePathByPath.set(cleanPath, normalizedPath)\n return normalizedPath\n}\n\nconst isNodeModulesPath = (path: string): boolean => {\n return /(?:^|[/\\\\])node_modules(?:[/\\\\])/.test(path)\n}\n\nconst packageTypeForPath = (\n path: string,\n packageTypeByPackageJsonPath: Map<string, \"module\" | \"commonjs\">,\n): \"module\" | \"commonjs\" => {\n let currentDir = dirname(path)\n\n while (true) {\n const packageJsonPath = join(currentDir, \"package.json\")\n if (existsSync(packageJsonPath)) {\n const cachedPackageType = packageTypeByPackageJsonPath.get(packageJsonPath)\n if (cachedPackageType) {\n return cachedPackageType\n }\n\n let packageType: \"module\" | \"commonjs\" = \"commonjs\"\n\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { type?: string }\n if (packageJson.type === \"module\") {\n packageType = \"module\"\n }\n } catch {\n packageType = \"commonjs\"\n }\n\n packageTypeByPackageJsonPath.set(packageJsonPath, packageType)\n return packageType\n }\n\n const parentDir = dirname(currentDir)\n if (parentDir === currentDir) {\n return \"commonjs\"\n }\n\n currentDir = parentDir\n }\n}\n\nconst isNodeModulesEsmPath = (\n path: string,\n packageTypeByPackageJsonPath: Map<string, \"module\" | \"commonjs\">,\n): boolean => {\n const normalizedPath = normalizeSourcePath(path)\n\n if (!isNodeModulesPath(normalizedPath)) {\n return false\n }\n\n if (\n normalizedPath.endsWith(\".mjs\") ||\n normalizedPath.endsWith(\".mts\") ||\n normalizedPath.endsWith(\".ts\") ||\n normalizedPath.endsWith(\".tsx\") ||\n normalizedPath.endsWith(\".jsx\")\n ) {\n return true\n }\n\n if (normalizedPath.endsWith(\".cjs\") || normalizedPath.endsWith(\".cts\") || !normalizedPath.endsWith(\".js\")) {\n return false\n }\n\n return packageTypeForPath(normalizedPath, packageTypeByPackageJsonPath) === \"module\"\n}\n\nconst nodeModulesPackageRootForPath = (path: string): string | null => {\n let currentDir = dirname(path)\n\n while (true) {\n const parentDir = dirname(currentDir)\n if (parentDir === currentDir) {\n return null\n }\n\n if (basename(parentDir) === \"node_modules\") {\n return currentDir\n }\n\n if (basename(dirname(parentDir)) === \"node_modules\" && basename(parentDir).startsWith(\"@\")) {\n return currentDir\n }\n\n currentDir = parentDir\n }\n}\n\nconst resolveRuntimePluginRewriteOptions = (\n options: RuntimePluginRewriteOptions | undefined,\n): Required<RuntimePluginRewriteOptions> => {\n return {\n nodeModulesRuntimeSpecifiers:\n options?.nodeModulesRuntimeSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesRuntimeSpecifiers,\n nodeModulesBareSpecifiers:\n options?.nodeModulesBareSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesBareSpecifiers,\n }\n}\n\nconst runtimeLoaderForPath = (path: string): \"js\" | \"ts\" | \"jsx\" | \"tsx\" | null => {\n const cleanPath = sourcePath(path)\n\n if (cleanPath.endsWith(\".tsx\")) {\n return \"tsx\"\n }\n\n if (cleanPath.endsWith(\".jsx\")) {\n return \"jsx\"\n }\n\n if (cleanPath.endsWith(\".ts\") || cleanPath.endsWith(\".mts\") || cleanPath.endsWith(\".cts\")) {\n return \"ts\"\n }\n\n if (cleanPath.endsWith(\".js\") || cleanPath.endsWith(\".mjs\") || cleanPath.endsWith(\".cjs\")) {\n return \"js\"\n }\n\n return null\n}\n\nconst resolveImportSpecifierPatterns = [\n /(from\\s+[\"'])([^\"']+)([\"'])/g,\n /(import\\s+[\"'])([^\"']+)([\"'])/g,\n /(import\\s*\\(\\s*[\"'])([^\"']+)([\"']\\s*\\))/g,\n /(require\\s*\\(\\s*[\"'])([^\"']+)([\"']\\s*\\))/g,\n] as const\n\nconst isBareSpecifier = (specifier: string): boolean => {\n if (specifier.startsWith(\".\") || specifier.startsWith(\"/\") || specifier.startsWith(\"\\\\\")) {\n return false\n }\n\n if (\n specifier.startsWith(\"node:\") ||\n specifier.startsWith(\"bun:\") ||\n specifier.startsWith(\"http:\") ||\n specifier.startsWith(\"https:\") ||\n specifier.startsWith(\"file:\") ||\n specifier.startsWith(\"data:\")\n ) {\n return false\n }\n\n if (specifier.startsWith(RUNTIME_MODULE_PREFIX)) {\n return false\n }\n\n return true\n}\n\nconst registerResolveParent = (resolveParentsByRecency: string[], resolveParent: string): void => {\n const existingIndex = resolveParentsByRecency.indexOf(resolveParent)\n if (existingIndex >= 0) {\n resolveParentsByRecency.splice(existingIndex, 1)\n }\n\n resolveParentsByRecency.push(resolveParent)\n\n if (resolveParentsByRecency.length > MAX_RUNTIME_RESOLVE_PARENTS) {\n resolveParentsByRecency.shift()\n }\n}\n\nconst rewriteImportSpecifiers = (code: string, resolveReplacement: (specifier: string) => string | null): string => {\n let transformedCode = code\n\n for (const pattern of resolveImportSpecifierPatterns) {\n transformedCode = transformedCode.replace(pattern, (fullMatch, prefix, specifier, suffix) => {\n const replacement = resolveReplacement(specifier)\n if (!replacement || replacement === specifier) {\n return fullMatch\n }\n\n return `${prefix}${replacement}${suffix}`\n })\n }\n\n return transformedCode\n}\n\nconst collectImportSpecifiers = (code: string): string[] => {\n const specifiers = new Set<string>()\n\n for (const pattern of resolveImportSpecifierPatterns) {\n code.replace(pattern, (_fullMatch, _prefix, specifier) => {\n specifiers.add(specifier)\n return _fullMatch\n })\n }\n\n return [...specifiers]\n}\n\nconst resolveFromParent = (specifier: string, parent: string): string | null => {\n try {\n const resolvedSpecifier = import.meta.resolve(specifier, parent)\n if (\n resolvedSpecifier === specifier ||\n resolvedSpecifier.startsWith(\"node:\") ||\n resolvedSpecifier.startsWith(\"bun:\")\n ) {\n return null\n }\n\n return resolvedSpecifier\n } catch {\n return null\n }\n}\n\nconst resolveSourcePathFromSpecifier = (specifier: string, importer: string): string | null => {\n if (\n specifier.startsWith(\"node:\") ||\n specifier.startsWith(\"bun:\") ||\n specifier.startsWith(\"http:\") ||\n specifier.startsWith(\"https:\") ||\n specifier.startsWith(\"data:\") ||\n specifier.startsWith(RUNTIME_MODULE_PREFIX)\n ) {\n return null\n }\n\n if (specifier.startsWith(\"file:\")) {\n return sourcePath(fileURLToPath(specifier))\n }\n\n if (isAbsolute(specifier)) {\n return sourcePath(specifier)\n }\n\n const resolvedSpecifier = resolveFromParent(specifier, importer)\n if (!resolvedSpecifier) {\n return null\n }\n\n if (resolvedSpecifier.startsWith(\"file:\")) {\n return sourcePath(fileURLToPath(resolvedSpecifier))\n }\n\n if (isAbsolute(resolvedSpecifier)) {\n return sourcePath(resolvedSpecifier)\n }\n\n return null\n}\n\nconst rewriteImportsFromResolveParents = (code: string, resolveParentsByRecency: string[]): string => {\n if (resolveParentsByRecency.length === 0) {\n return code\n }\n\n const resolveFromParents = (specifier: string): string | null => {\n if (!isBareSpecifier(specifier)) {\n return null\n }\n\n for (let index = resolveParentsByRecency.length - 1; index >= 0; index -= 1) {\n const resolveParent = resolveParentsByRecency[index]\n const resolvedSpecifier = resolveFromParent(specifier, resolveParent)\n if (resolvedSpecifier) {\n return resolvedSpecifier\n }\n }\n\n return null\n }\n\n return rewriteImportSpecifiers(code, resolveFromParents)\n}\n\nconst rewriteRuntimeSpecifiers = (code: string, runtimeModuleIdsBySpecifier: Map<string, string>): string => {\n return rewriteImportSpecifiers(code, (specifier) => {\n const runtimeModuleId = runtimeModuleIdsBySpecifier.get(specifier)\n return runtimeModuleId ?? null\n })\n}\n\nexport function createRuntimePlugin(input: CreateRuntimePluginOptions = {}): BunPlugin {\n const runtimeModules = new Map<string, RuntimeModuleEntry>()\n runtimeModules.set(CORE_RUNTIME_SPECIFIER, input.core ?? (coreRuntime as RuntimeModuleExports))\n runtimeModules.set(CORE_TESTING_RUNTIME_SPECIFIER, loadCoreTestingRuntimeModule)\n const rewriteOptions = resolveRuntimePluginRewriteOptions(input.rewrite)\n\n for (const [specifier, moduleEntry] of Object.entries(input.additional ?? {})) {\n runtimeModules.set(specifier, moduleEntry)\n }\n\n const runtimeModuleIdsBySpecifier = new Map<string, string>()\n for (const specifier of runtimeModules.keys()) {\n runtimeModuleIdsBySpecifier.set(specifier, runtimeModuleIdForSpecifier(specifier))\n }\n\n return {\n name: \"bun-plugin-opentui-runtime-modules\",\n setup: (build) => {\n const resolveParentsByRecency: string[] = []\n const installedRewriteLoaders = new Set<string>()\n const nodeModulesBareRewritePackageRoots = new Set<string>()\n const packageTypeByPackageJsonPath = new Map<string, \"module\" | \"commonjs\">()\n const sourceAnalysisByPath = new Map<string, SourceAnalysis>()\n const nodeModulesRuntimeRewritePathsByPath = new Map<string, string[]>()\n\n const installRewriteLoader = (path: string): void => {\n const resolvedTargetPath = sourcePath(path)\n const canonicalTargetPath = normalizeSourcePath(resolvedTargetPath)\n\n if (installedRewriteLoaders.has(canonicalTargetPath)) {\n return\n }\n\n installedRewriteLoaders.add(canonicalTargetPath)\n\n // Register both the resolved path spelling and its canonical realpath so Bun\n // can reach the loader even if it reports the same file through a different alias.\n build.onLoad({ filter: exactPathFilter([resolvedTargetPath, canonicalTargetPath]) }, async (args) => {\n const loadedPath = normalizeSourcePath(args.path)\n if (loadedPath !== canonicalTargetPath) {\n return undefined\n }\n\n const nodeModulesPath = isNodeModulesPath(loadedPath)\n const shouldRewriteRuntimeSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesRuntimeSpecifiers\n const shouldRewriteBareSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesBareSpecifiers\n const loader = runtimeLoaderForPath(args.path)\n\n if (!loader) {\n throw new Error(`Unable to determine runtime loader for path: ${args.path}`)\n }\n\n const contents = await Bun.file(loadedPath).text()\n const runtimeRewrittenContents = shouldRewriteRuntimeSpecifiers\n ? rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier)\n : contents\n\n if (runtimeRewrittenContents !== contents && shouldRewriteBareSpecifiers) {\n registerResolveParent(resolveParentsByRecency, loadedPath)\n }\n\n const transformedContents = shouldRewriteBareSpecifiers\n ? rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency)\n : runtimeRewrittenContents\n\n return {\n contents: transformedContents,\n loader,\n }\n })\n }\n\n const analyzeSourcePath = (path: string): SourceAnalysis => {\n const normalizedPath = normalizeSourcePath(path)\n const cachedAnalysis = sourceAnalysisByPath.get(normalizedPath)\n if (cachedAnalysis) {\n return cachedAnalysis\n }\n\n let contents: string\n try {\n contents = readFileSync(normalizedPath, \"utf8\")\n } catch (error) {\n if (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") {\n const analysis = { importSpecifiers: [], needsRuntimeSpecifierRewrite: false }\n sourceAnalysisByPath.set(normalizedPath, analysis)\n return analysis\n }\n throw error\n }\n\n const importSpecifiers = collectImportSpecifiers(contents)\n const analysis = {\n importSpecifiers,\n needsRuntimeSpecifierRewrite: importSpecifiers.some((specifier) =>\n runtimeModuleIdsBySpecifier.has(specifier),\n ),\n }\n\n sourceAnalysisByPath.set(normalizedPath, analysis)\n return analysis\n }\n\n const collectNodeModulesRuntimeRewritePaths = (path: string, visiting = new Set<string>()): string[] => {\n const normalizedPath = normalizeSourcePath(path)\n\n if (!isNodeModulesEsmPath(normalizedPath, packageTypeByPackageJsonPath)) {\n return []\n }\n\n const cachedPaths = nodeModulesRuntimeRewritePathsByPath.get(normalizedPath)\n if (cachedPaths) {\n return cachedPaths\n }\n\n if (visiting.has(normalizedPath)) {\n return []\n }\n\n visiting.add(normalizedPath)\n\n const rewritePaths = new Set<string>()\n const analysis = analyzeSourcePath(normalizedPath)\n\n if (analysis.needsRuntimeSpecifierRewrite) {\n rewritePaths.add(normalizedPath)\n }\n\n for (const specifier of analysis.importSpecifiers) {\n const resolvedPath = resolveSourcePathFromSpecifier(specifier, normalizedPath)\n if (!resolvedPath || !isNodeModulesEsmPath(resolvedPath, packageTypeByPackageJsonPath)) {\n continue\n }\n\n for (const nestedPath of collectNodeModulesRuntimeRewritePaths(resolvedPath, visiting)) {\n rewritePaths.add(nestedPath)\n }\n }\n\n visiting.delete(normalizedPath)\n\n const resolvedRewritePaths = [...rewritePaths]\n nodeModulesRuntimeRewritePathsByPath.set(normalizedPath, resolvedRewritePaths)\n return resolvedRewritePaths\n }\n\n for (const [specifier, moduleEntry] of runtimeModules.entries()) {\n const moduleId = runtimeModuleIdsBySpecifier.get(specifier)\n\n if (!moduleId) {\n continue\n }\n\n build.module(moduleId, async () => ({\n exports: await resolveRuntimeModuleExports(moduleEntry),\n loader: \"object\",\n }))\n\n build.onResolve({ filter: exactSpecifierFilter(specifier) }, () => ({ path: moduleId }))\n }\n\n build.onResolve({ filter: /.*/ }, (args) => {\n if (runtimeModuleIdsBySpecifier.has(args.path) || args.path.startsWith(RUNTIME_MODULE_PREFIX)) {\n return undefined\n }\n\n const path = resolveSourcePathFromSpecifier(args.path, args.importer)\n if (!path || !runtimeLoaderForPath(path)) {\n return undefined\n }\n\n const nodeModulesPath = isNodeModulesPath(path)\n\n if (!nodeModulesPath) {\n installRewriteLoader(path)\n return undefined\n }\n\n if (!rewriteOptions.nodeModulesRuntimeSpecifiers && !rewriteOptions.nodeModulesBareSpecifiers) {\n return undefined\n }\n\n for (const rewritePath of collectNodeModulesRuntimeRewritePaths(path)) {\n installRewriteLoader(rewritePath)\n }\n\n const packageRoot = nodeModulesPackageRootForPath(path)\n if (\n rewriteOptions.nodeModulesBareSpecifiers &&\n packageRoot &&\n nodeModulesBareRewritePackageRoots.has(packageRoot)\n ) {\n installRewriteLoader(path)\n return undefined\n }\n\n if (!rewriteOptions.nodeModulesRuntimeSpecifiers || !analyzeSourcePath(path).needsRuntimeSpecifierRewrite) {\n return undefined\n }\n\n if (rewriteOptions.nodeModulesBareSpecifiers && packageRoot) {\n nodeModulesBareRewritePackageRoots.add(packageRoot)\n }\n\n installRewriteLoader(path)\n return undefined\n })\n },\n }\n}\n" | ||
| ], | ||
| "mappings": ";;;;;;;;;AAoCA;AACA;AACA;AAwBA,IAAM,yBAAyB;AAC/B,IAAM,iCAAiC;AACvC,IAAM,wBAAwB;AAC9B,IAAM,8BAA8B;AACpC,IAAM,yCAAgF;AAAA,EACpF,8BAA8B;AAAA,EAC9B,2BAA2B;AAC7B;AAEA,IAAM,yCAAyC,CAAC,wBAAwB,8BAA8B;AAEtG,IAAM,4CAA4C,IAAI,IAAY,sCAAsC;AAEjG,IAAM,+BAA+B,CAAC,cAA+B;AAAA,EAC1E,OAAO,0CAA0C,IAAI,SAAS;AAAA;AAGhE,IAAM,+BAA+B,YAA2C;AAAA,EAC9E,OAAQ,MAAa;AAAA;AAGvB,IAAM,eAAe,CAAC,UAA0B;AAAA,EAC9C,OAAO,MAAM,QAAQ,uBAAuB,MAAM;AAAA;AAGpD,IAAM,uBAAuB,CAAC,cAA8B;AAAA,EAC1D,OAAO,IAAI,OAAO,IAAI,aAAa,SAAS,IAAI;AAAA;AAGlD,IA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,UACrE,qBAAqB,WAAW;AAAA,QAClC;AAAA,QAEA,MAAM,cAAc,8BAA8B,IAAI;AAAA,QACtD,IACE,eAAe,6BACf,eACA,mCAAmC,IAAI,WAAW,GAClD;AAAA,UACA,qBAAqB,IAAI;AAAA,UACzB;AAAA,QACF;AAAA,QAEA,IAAI,CAAC,eAAe,gCAAgC,CAAC,kBAAkB,IAAI,EAAE,8BAA8B;AAAA,UACzG;AAAA,QACF;AAAA,QAEA,IAAI,eAAe,6BAA6B,aAAa;AAAA,UAC3D,mCAAmC,IAAI,WAAW;AAAA,QACpD;AAAA,QAEA,qBAAqB,IAAI;AAAA,QACzB;AAAA,OACD;AAAA;AAAA,EAEL;AAAA;", | ||
| "debugId": "4F4ECA92927B118964756E2164756E21", | ||
| "names": [] | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
7944463
0.48%0
-100%49257
1.57%16
-27.27%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated