@opentui/core 0.0.0-20251001-886e38c1 → 0.0.0-20251001-d57654da
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3d.js +1 -1
- package/{index-r19wz8xa.js → index-zgy8chsr.js} +56 -35
- package/{index-r19wz8xa.js.map → index-zgy8chsr.js.map} +5 -6
- package/index.js +1 -1
- package/lib/tree-sitter/client.d.ts +4 -0
- package/lib/tree-sitter/parser.worker.d.ts +1 -2
- package/package.json +11 -16
- package/parser.worker.js +30 -2
- package/parser.worker.js.map +3 -3
- package/testing.js +1 -1
- package/lib/tree-sitter/parser.worker.path.d.ts +0 -2
- package/parser.worker.d.ts +0 -2
- package/parser.worker.path.d.ts +0 -2
- package/parser.worker.path.js +0 -10
- package/parser.worker.path.js.map +0 -10
- /package/{highlights-ghv9g403.scm → assets/javascript/highlights.scm} +0 -0
- /package/{tree-sitter-javascript-nd0q4pe9.wasm → assets/javascript/tree-sitter-javascript.wasm} +0 -0
- /package/{highlights-eq9cgrbb.scm → assets/typescript/highlights.scm} +0 -0
- /package/{tree-sitter-typescript-zxjzwt75.wasm → assets/typescript/tree-sitter-typescript.wasm} +0 -0
package/3d.js
CHANGED
|
@@ -5285,20 +5285,10 @@ class ProcessQueue {
|
|
|
5285
5285
|
// src/lib/tree-sitter/default-parsers.ts
|
|
5286
5286
|
import { resolve, dirname } from "path";
|
|
5287
5287
|
import { fileURLToPath } from "url";
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
// src/lib/tree-sitter/assets/javascript/tree-sitter-javascript.wasm
|
|
5293
|
-
var tree_sitter_javascript_default = "./tree-sitter-javascript-nd0q4pe9.wasm";
|
|
5294
|
-
|
|
5295
|
-
// src/lib/tree-sitter/assets/typescript/highlights.scm
|
|
5296
|
-
var highlights_default2 = "./highlights-eq9cgrbb.scm";
|
|
5297
|
-
|
|
5298
|
-
// src/lib/tree-sitter/assets/typescript/tree-sitter-typescript.wasm
|
|
5299
|
-
var tree_sitter_typescript_default = "./tree-sitter-typescript-zxjzwt75.wasm";
|
|
5300
|
-
|
|
5301
|
-
// src/lib/tree-sitter/default-parsers.ts
|
|
5288
|
+
import javascript_highlights from "./assets/javascript/highlights.scm" with { type: "file" };
|
|
5289
|
+
import javascript_language from "./assets/javascript/tree-sitter-javascript.wasm" with { type: "file" };
|
|
5290
|
+
import typescript_highlights from "./assets/typescript/highlights.scm" with { type: "file" };
|
|
5291
|
+
import typescript_language from "./assets/typescript/tree-sitter-typescript.wasm" with { type: "file" };
|
|
5302
5292
|
var _cachedParsers;
|
|
5303
5293
|
function getParsers() {
|
|
5304
5294
|
if (!_cachedParsers) {
|
|
@@ -5306,28 +5296,32 @@ function getParsers() {
|
|
|
5306
5296
|
{
|
|
5307
5297
|
filetype: "javascript",
|
|
5308
5298
|
queries: {
|
|
5309
|
-
highlights: [resolve(dirname(fileURLToPath(import.meta.url)),
|
|
5299
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), javascript_highlights)]
|
|
5310
5300
|
},
|
|
5311
|
-
wasm: resolve(dirname(fileURLToPath(import.meta.url)),
|
|
5301
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), javascript_language)
|
|
5312
5302
|
},
|
|
5313
5303
|
{
|
|
5314
5304
|
filetype: "typescript",
|
|
5315
5305
|
queries: {
|
|
5316
|
-
highlights: [resolve(dirname(fileURLToPath(import.meta.url)),
|
|
5306
|
+
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), typescript_highlights)]
|
|
5317
5307
|
},
|
|
5318
|
-
wasm: resolve(dirname(fileURLToPath(import.meta.url)),
|
|
5308
|
+
wasm: resolve(dirname(fileURLToPath(import.meta.url)), typescript_language)
|
|
5319
5309
|
}
|
|
5320
5310
|
];
|
|
5321
5311
|
}
|
|
5322
5312
|
return _cachedParsers;
|
|
5323
5313
|
}
|
|
5324
5314
|
|
|
5325
|
-
// src/lib/tree-sitter/parser.worker.path.ts
|
|
5326
|
-
var workerPath = new URL("./parser.worker.js", import.meta.url).href;
|
|
5327
|
-
var parser_worker_path_default = workerPath;
|
|
5328
|
-
|
|
5329
5315
|
// src/lib/tree-sitter/client.ts
|
|
5330
5316
|
import { resolve as resolve2, isAbsolute } from "path";
|
|
5317
|
+
import { existsSync } from "fs";
|
|
5318
|
+
import { parse } from "path";
|
|
5319
|
+
registerEnvVar({
|
|
5320
|
+
name: "OTUI_TREE_SITTER_WORKER_PATH",
|
|
5321
|
+
description: "Path to the TreeSitter worker",
|
|
5322
|
+
type: "string",
|
|
5323
|
+
default: ""
|
|
5324
|
+
});
|
|
5331
5325
|
var DEFAULT_PARSERS = getParsers();
|
|
5332
5326
|
function addDefaultParsers(parsers) {
|
|
5333
5327
|
for (const parser of parsers) {
|
|
@@ -5339,6 +5333,7 @@ function addDefaultParsers(parsers) {
|
|
|
5339
5333
|
}
|
|
5340
5334
|
}
|
|
5341
5335
|
}
|
|
5336
|
+
var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
5342
5337
|
|
|
5343
5338
|
class TreeSitterClient extends EventEmitter2 {
|
|
5344
5339
|
initialized = false;
|
|
@@ -5371,8 +5366,20 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
5371
5366
|
if (this.worker) {
|
|
5372
5367
|
return;
|
|
5373
5368
|
}
|
|
5374
|
-
|
|
5375
|
-
|
|
5369
|
+
let worker_path;
|
|
5370
|
+
if (env.OTUI_TREE_SITTER_WORKER_PATH) {
|
|
5371
|
+
worker_path = env.OTUI_TREE_SITTER_WORKER_PATH;
|
|
5372
|
+
} else if (typeof OTUI_TREE_SITTER_WORKER_PATH !== "undefined") {
|
|
5373
|
+
worker_path = OTUI_TREE_SITTER_WORKER_PATH;
|
|
5374
|
+
} else if (this.options.workerPath) {
|
|
5375
|
+
worker_path = this.options.workerPath;
|
|
5376
|
+
} else {
|
|
5377
|
+
worker_path = new URL("./parser.worker.js", import.meta.url).href;
|
|
5378
|
+
if (!existsSync(resolve2(import.meta.dirname, "parser.worker.js"))) {
|
|
5379
|
+
worker_path = new URL("./parser.worker.ts", import.meta.url).href;
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
this.worker = new Worker(worker_path);
|
|
5376
5383
|
this.worker.onmessage = this.handleWorkerMessage.bind(this);
|
|
5377
5384
|
this.worker.onerror = (error) => {
|
|
5378
5385
|
console.error("TreeSitter worker error:", error.message);
|
|
@@ -5426,13 +5433,24 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
5426
5433
|
this.addFiletypeParser(parser);
|
|
5427
5434
|
}
|
|
5428
5435
|
}
|
|
5436
|
+
resolvePath(path) {
|
|
5437
|
+
if (isUrl(path)) {
|
|
5438
|
+
return path;
|
|
5439
|
+
}
|
|
5440
|
+
if (/\$bunfs/.test(path)) {
|
|
5441
|
+
return "/$bunfs/root/" + parse(path).base;
|
|
5442
|
+
}
|
|
5443
|
+
if (!isAbsolute(path)) {
|
|
5444
|
+
return resolve2(path);
|
|
5445
|
+
}
|
|
5446
|
+
return path;
|
|
5447
|
+
}
|
|
5429
5448
|
addFiletypeParser(filetypeParser) {
|
|
5430
|
-
const isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
5431
5449
|
const resolvedParser = {
|
|
5432
5450
|
...filetypeParser,
|
|
5433
|
-
wasm:
|
|
5451
|
+
wasm: this.resolvePath(filetypeParser.wasm),
|
|
5434
5452
|
queries: {
|
|
5435
|
-
highlights: filetypeParser.queries.highlights.map((path) =>
|
|
5453
|
+
highlights: filetypeParser.queries.highlights.map((path) => this.resolvePath(path))
|
|
5436
5454
|
}
|
|
5437
5455
|
};
|
|
5438
5456
|
this.worker?.postMessage({ type: "ADD_FILETYPE_PARSER", filetypeParser: resolvedParser });
|
|
@@ -5934,8 +5952,8 @@ class DownloadUtils {
|
|
|
5934
5952
|
return Math.abs(hash).toString(16);
|
|
5935
5953
|
}
|
|
5936
5954
|
static async downloadOrLoad(source, cacheDir, cacheSubdir, fileExtension, useHashForCache = true, filetype) {
|
|
5937
|
-
const
|
|
5938
|
-
if (
|
|
5955
|
+
const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
|
|
5956
|
+
if (isUrl2) {
|
|
5939
5957
|
let cacheFileName;
|
|
5940
5958
|
if (useHashForCache) {
|
|
5941
5959
|
const hash = this.hashUrl(source);
|
|
@@ -5980,9 +5998,9 @@ class DownloadUtils {
|
|
|
5980
5998
|
}
|
|
5981
5999
|
}
|
|
5982
6000
|
static async downloadToPath(source, targetPath) {
|
|
5983
|
-
const
|
|
6001
|
+
const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
|
|
5984
6002
|
await mkdir(path2.dirname(targetPath), { recursive: true });
|
|
5985
|
-
if (
|
|
6003
|
+
if (isUrl2) {
|
|
5986
6004
|
try {
|
|
5987
6005
|
console.log(`Downloading from URL: ${source}`);
|
|
5988
6006
|
const response = await fetch(source);
|
|
@@ -6175,7 +6193,7 @@ function getTreeSitterClient() {
|
|
|
6175
6193
|
}
|
|
6176
6194
|
// src/zig.ts
|
|
6177
6195
|
import { dlopen, toArrayBuffer as toArrayBuffer2, JSCallback, ptr } from "bun:ffi";
|
|
6178
|
-
import { existsSync } from "fs";
|
|
6196
|
+
import { existsSync as existsSync2 } from "fs";
|
|
6179
6197
|
|
|
6180
6198
|
// src/buffer.ts
|
|
6181
6199
|
import { toArrayBuffer } from "bun:ffi";
|
|
@@ -6376,7 +6394,10 @@ class OptimizedBuffer {
|
|
|
6376
6394
|
// src/zig.ts
|
|
6377
6395
|
var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
|
|
6378
6396
|
var targetLibPath = module.default;
|
|
6379
|
-
if (
|
|
6397
|
+
if (/\$bunfs/.test(targetLibPath)) {
|
|
6398
|
+
targetLibPath = targetLibPath.replace("../", "");
|
|
6399
|
+
}
|
|
6400
|
+
if (!existsSync2(targetLibPath)) {
|
|
6380
6401
|
throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
|
|
6381
6402
|
}
|
|
6382
6403
|
registerEnvVar({
|
|
@@ -10812,5 +10833,5 @@ Captured output:
|
|
|
10812
10833
|
|
|
10813
10834
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, exports_src, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, ANSI, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, DebugOverlayCorner, createTextAttributes, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, t, convertThemeToStyles, SyntaxStyle, hastToStyledText, parseAlign, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, TextBuffer, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, CliRenderer };
|
|
10814
10835
|
|
|
10815
|
-
//# debugId=
|
|
10816
|
-
//# sourceMappingURL=index-
|
|
10836
|
+
//# debugId=6251804965AF12D064756E2164756E21
|
|
10837
|
+
//# sourceMappingURL=index-zgy8chsr.js.map
|