@opentui/core 0.0.0-20251001-ad2d8bd4 → 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 CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  __export,
6
6
  __require,
7
7
  __toESM
8
- } from "./index-nyqttas2.js";
8
+ } from "./index-zgy8chsr.js";
9
9
 
10
10
  // ../../node_modules/omggif/omggif.js
11
11
  var require_omggif = __commonJS((exports) => {
@@ -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
- // src/lib/tree-sitter/assets/javascript/highlights.scm
5290
- var highlights_default = "./highlights-ghv9g403.scm";
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,16 +5296,16 @@ function getParsers() {
5306
5296
  {
5307
5297
  filetype: "javascript",
5308
5298
  queries: {
5309
- highlights: [resolve(dirname(fileURLToPath(import.meta.url)), highlights_default)]
5299
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), javascript_highlights)]
5310
5300
  },
5311
- wasm: resolve(dirname(fileURLToPath(import.meta.url)), tree_sitter_javascript_default)
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)), highlights_default2)]
5306
+ highlights: [resolve(dirname(fileURLToPath(import.meta.url)), typescript_highlights)]
5317
5307
  },
5318
- wasm: resolve(dirname(fileURLToPath(import.meta.url)), tree_sitter_typescript_default)
5308
+ wasm: resolve(dirname(fileURLToPath(import.meta.url)), typescript_language)
5319
5309
  }
5320
5310
  ];
5321
5311
  }
@@ -5325,6 +5315,13 @@ function getParsers() {
5325
5315
  // src/lib/tree-sitter/client.ts
5326
5316
  import { resolve as resolve2, isAbsolute } from "path";
5327
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
+ });
5328
5325
  var DEFAULT_PARSERS = getParsers();
5329
5326
  function addDefaultParsers(parsers) {
5330
5327
  for (const parser of parsers) {
@@ -5336,6 +5333,7 @@ function addDefaultParsers(parsers) {
5336
5333
  }
5337
5334
  }
5338
5335
  }
5336
+ var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
5339
5337
 
5340
5338
  class TreeSitterClient extends EventEmitter2 {
5341
5339
  initialized = false;
@@ -5369,7 +5367,11 @@ class TreeSitterClient extends EventEmitter2 {
5369
5367
  return;
5370
5368
  }
5371
5369
  let worker_path;
5372
- if (this.options.workerPath) {
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) {
5373
5375
  worker_path = this.options.workerPath;
5374
5376
  } else {
5375
5377
  worker_path = new URL("./parser.worker.js", import.meta.url).href;
@@ -5431,13 +5433,24 @@ class TreeSitterClient extends EventEmitter2 {
5431
5433
  this.addFiletypeParser(parser);
5432
5434
  }
5433
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
+ }
5434
5448
  addFiletypeParser(filetypeParser) {
5435
- const isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
5436
5449
  const resolvedParser = {
5437
5450
  ...filetypeParser,
5438
- wasm: isUrl(filetypeParser.wasm) || isAbsolute(filetypeParser.wasm) ? filetypeParser.wasm : resolve2(filetypeParser.wasm),
5451
+ wasm: this.resolvePath(filetypeParser.wasm),
5439
5452
  queries: {
5440
- highlights: filetypeParser.queries.highlights.map((path) => isUrl(path) || isAbsolute(path) ? path : resolve2(path))
5453
+ highlights: filetypeParser.queries.highlights.map((path) => this.resolvePath(path))
5441
5454
  }
5442
5455
  };
5443
5456
  this.worker?.postMessage({ type: "ADD_FILETYPE_PARSER", filetypeParser: resolvedParser });
@@ -5939,8 +5952,8 @@ class DownloadUtils {
5939
5952
  return Math.abs(hash).toString(16);
5940
5953
  }
5941
5954
  static async downloadOrLoad(source, cacheDir, cacheSubdir, fileExtension, useHashForCache = true, filetype) {
5942
- const isUrl = source.startsWith("http://") || source.startsWith("https://");
5943
- if (isUrl) {
5955
+ const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
5956
+ if (isUrl2) {
5944
5957
  let cacheFileName;
5945
5958
  if (useHashForCache) {
5946
5959
  const hash = this.hashUrl(source);
@@ -5985,9 +5998,9 @@ class DownloadUtils {
5985
5998
  }
5986
5999
  }
5987
6000
  static async downloadToPath(source, targetPath) {
5988
- const isUrl = source.startsWith("http://") || source.startsWith("https://");
6001
+ const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
5989
6002
  await mkdir(path2.dirname(targetPath), { recursive: true });
5990
- if (isUrl) {
6003
+ if (isUrl2) {
5991
6004
  try {
5992
6005
  console.log(`Downloading from URL: ${source}`);
5993
6006
  const response = await fetch(source);
@@ -6033,7 +6046,7 @@ class DownloadUtils {
6033
6046
  }
6034
6047
 
6035
6048
  // src/lib/tree-sitter/assets/update.ts
6036
- var __dirname = "/Users/kmdr/workspace/opentui/packages/core/src/lib/tree-sitter/assets";
6049
+ var __dirname = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets";
6037
6050
  function getDefaultOptions() {
6038
6051
  return {
6039
6052
  configPath: path3.resolve(__dirname, "../parsers-config.json"),
@@ -6381,6 +6394,9 @@ class OptimizedBuffer {
6381
6394
  // src/zig.ts
6382
6395
  var module = await import(`@opentui/core-${process.platform}-${process.arch}/index.ts`);
6383
6396
  var targetLibPath = module.default;
6397
+ if (/\$bunfs/.test(targetLibPath)) {
6398
+ targetLibPath = targetLibPath.replace("../", "");
6399
+ }
6384
6400
  if (!existsSync2(targetLibPath)) {
6385
6401
  throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
6386
6402
  }
@@ -10817,5 +10833,5 @@ Captured output:
10817
10833
 
10818
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 };
10819
10835
 
10820
- //# debugId=FB423E72911C491764756E2164756E21
10821
- //# sourceMappingURL=index-nyqttas2.js.map
10836
+ //# debugId=6251804965AF12D064756E2164756E21
10837
+ //# sourceMappingURL=index-zgy8chsr.js.map