@opentui/core 0.4.4 → 0.4.5
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/chunk-bun-t2myhmwd.js +16382 -0
- package/chunk-bun-t2myhmwd.js.map +62 -0
- package/chunk-bun-tkm837n2.js +10047 -0
- package/chunk-bun-tkm837n2.js.map +32 -0
- package/{index-7z5n7k9m.js → chunk-node-51kpf0mz.js} +3 -3
- package/{index-7z5n7k9m.js.map → chunk-node-51kpf0mz.js.map} +1 -1
- package/{index-za1krqsf.js → chunk-node-q0cwyvm9.js} +413 -320
- package/chunk-node-q0cwyvm9.js.map +61 -0
- package/index.bun.js +13086 -0
- package/{index.js.map → index.bun.js.map} +2 -2
- package/index.d.ts +1 -0
- package/{index.js → index.node.js} +6 -4
- package/index.node.js.map +70 -0
- package/lib/tree-sitter/default-parser-assets.bun.d.ts +1 -0
- package/lib/tree-sitter/default-parsers.d.ts +1 -0
- package/lib/tree-sitter/parsers-config.d.ts +2 -2
- package/lib/tree-sitter/types.d.ts +1 -0
- package/lib/tree-sitter/update-assets.js +124 -58
- package/lib/tree-sitter/update-assets.js.map +3 -3
- package/node-asset-target.d.ts +12 -0
- package/node-assets.d.ts +7 -0
- package/node-assets.js +261 -0
- package/node-assets.js.map +16 -0
- package/package.json +23 -13
- package/parser.worker.js +3350 -188
- package/parser.worker.js.map +18 -12
- package/platform/assets.d.ts +5 -0
- package/platform/runtime-assets.bun.d.ts +4 -0
- package/platform/runtime-assets.node.d.ts +4 -0
- package/platform/runtime.d.ts +5 -1
- package/runtime-plugin.js +2 -2
- package/runtime-plugin.js.map +1 -1
- package/testing.bun.js +1005 -0
- package/testing.bun.js.map +18 -0
- package/testing.js +2 -2
- package/yoga.bun.js +194 -0
- package/yoga.bun.js.map +9 -0
- package/yoga.js +1 -1
- package/index-za1krqsf.js.map +0 -58
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -43,7 +42,6 @@ var __export = (target, all) => {
|
|
|
43
42
|
set: __exportSetter.bind(all, name)
|
|
44
43
|
});
|
|
45
44
|
};
|
|
46
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
47
45
|
|
|
48
46
|
// ../../node_modules/.bun/emoji-regex@10.6.0/node_modules/emoji-regex/index.js
|
|
49
47
|
var require_emoji_regex = __commonJS((exports, module) => {
|
|
@@ -151,7 +149,7 @@ __export(exports_yoga, {
|
|
|
151
149
|
});
|
|
152
150
|
|
|
153
151
|
// src/platform/ffi.ts
|
|
154
|
-
import { createRequire
|
|
152
|
+
import { createRequire } from "node:module";
|
|
155
153
|
import { fileURLToPath } from "node:url";
|
|
156
154
|
var FFIType = {
|
|
157
155
|
char: "char",
|
|
@@ -231,7 +229,7 @@ function createUnsupportedBackend(cause) {
|
|
|
231
229
|
};
|
|
232
230
|
}
|
|
233
231
|
var isBun = typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.bun === "string";
|
|
234
|
-
var requireModule =
|
|
232
|
+
var requireModule = createRequire(import.meta.url);
|
|
235
233
|
var backend = loadBackend();
|
|
236
234
|
function loadBackend() {
|
|
237
235
|
if (isBun) {
|
|
@@ -570,8 +568,8 @@ var toArrayBuffer = backend.toArrayBuffer;
|
|
|
570
568
|
// src/platform/runtime.ts
|
|
571
569
|
import { existsSync } from "node:fs";
|
|
572
570
|
import { mkdir, writeFile as writeFileNode } from "node:fs/promises";
|
|
573
|
-
import { dirname, isAbsolute, resolve } from "node:path";
|
|
574
|
-
import { fileURLToPath as
|
|
571
|
+
import { dirname, isAbsolute as isAbsolute2, resolve } from "node:path";
|
|
572
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
575
573
|
|
|
576
574
|
// ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
577
575
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
@@ -665,6 +663,231 @@ function stringWidth(string, options = {}) {
|
|
|
665
663
|
return width;
|
|
666
664
|
}
|
|
667
665
|
|
|
666
|
+
// src/platform/assets.ts
|
|
667
|
+
import { statSync } from "node:fs";
|
|
668
|
+
import { isAbsolute, join } from "node:path";
|
|
669
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
670
|
+
|
|
671
|
+
// src/lib/singleton.ts
|
|
672
|
+
var singletonCacheSymbol = Symbol.for("@opentui/core/singleton");
|
|
673
|
+
function singleton(key, factory) {
|
|
674
|
+
const bag = globalThis[singletonCacheSymbol] ??= {};
|
|
675
|
+
if (!(key in bag)) {
|
|
676
|
+
bag[key] = factory();
|
|
677
|
+
}
|
|
678
|
+
return bag[key];
|
|
679
|
+
}
|
|
680
|
+
function getSingleton(key) {
|
|
681
|
+
const bag = globalThis[singletonCacheSymbol];
|
|
682
|
+
return bag?.[key];
|
|
683
|
+
}
|
|
684
|
+
function destroySingleton(key) {
|
|
685
|
+
const bag = globalThis[singletonCacheSymbol];
|
|
686
|
+
if (bag && key in bag) {
|
|
687
|
+
delete bag[key];
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// src/lib/env.ts
|
|
692
|
+
var envRegistry = singleton("env-registry", () => ({}));
|
|
693
|
+
function registerEnvVar(config) {
|
|
694
|
+
const existing = envRegistry[config.name];
|
|
695
|
+
if (existing) {
|
|
696
|
+
if (existing.description !== config.description || existing.type !== config.type || existing.default !== config.default) {
|
|
697
|
+
throw new Error(`Environment variable "${config.name}" is already registered with different configuration. ` + `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`);
|
|
698
|
+
}
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
envRegistry[config.name] = config;
|
|
702
|
+
}
|
|
703
|
+
function normalizeBoolean(value) {
|
|
704
|
+
const lowerValue = value.toLowerCase();
|
|
705
|
+
return ["true", "1", "on", "yes"].includes(lowerValue);
|
|
706
|
+
}
|
|
707
|
+
function parseEnvValue(config) {
|
|
708
|
+
const envValue = process.env[config.name];
|
|
709
|
+
if (envValue === undefined && config.default !== undefined) {
|
|
710
|
+
return config.default;
|
|
711
|
+
}
|
|
712
|
+
if (envValue === undefined) {
|
|
713
|
+
throw new Error(`Required environment variable ${config.name} is not set. ${config.description}`);
|
|
714
|
+
}
|
|
715
|
+
switch (config.type) {
|
|
716
|
+
case "boolean":
|
|
717
|
+
return typeof envValue === "boolean" ? envValue : normalizeBoolean(envValue);
|
|
718
|
+
case "number":
|
|
719
|
+
const numValue = Number(envValue);
|
|
720
|
+
if (isNaN(numValue)) {
|
|
721
|
+
throw new Error(`Environment variable ${config.name} must be a valid number, got: ${envValue}`);
|
|
722
|
+
}
|
|
723
|
+
return numValue;
|
|
724
|
+
case "string":
|
|
725
|
+
default:
|
|
726
|
+
return envValue;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
class EnvStore {
|
|
731
|
+
parsedValues = new Map;
|
|
732
|
+
get(key) {
|
|
733
|
+
if (this.parsedValues.has(key)) {
|
|
734
|
+
return this.parsedValues.get(key);
|
|
735
|
+
}
|
|
736
|
+
if (!(key in envRegistry)) {
|
|
737
|
+
throw new Error(`Environment variable ${key} is not registered.`);
|
|
738
|
+
}
|
|
739
|
+
try {
|
|
740
|
+
const value = parseEnvValue(envRegistry[key]);
|
|
741
|
+
this.parsedValues.set(key, value);
|
|
742
|
+
return value;
|
|
743
|
+
} catch (error) {
|
|
744
|
+
throw new Error(`Failed to parse env var ${key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
has(key) {
|
|
748
|
+
return key in envRegistry;
|
|
749
|
+
}
|
|
750
|
+
clearCache() {
|
|
751
|
+
this.parsedValues.clear();
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
var envStore = singleton("env-store", () => new EnvStore);
|
|
755
|
+
function clearEnvCache() {
|
|
756
|
+
envStore.clearCache();
|
|
757
|
+
}
|
|
758
|
+
function generateEnvMarkdown() {
|
|
759
|
+
const configs = Object.values(envRegistry);
|
|
760
|
+
if (configs.length === 0) {
|
|
761
|
+
return `# Environment Variables
|
|
762
|
+
|
|
763
|
+
No environment variables registered.
|
|
764
|
+
`;
|
|
765
|
+
}
|
|
766
|
+
let markdown = `# Environment Variables
|
|
767
|
+
|
|
768
|
+
`;
|
|
769
|
+
for (const config of configs) {
|
|
770
|
+
markdown += `## ${config.name}
|
|
771
|
+
|
|
772
|
+
`;
|
|
773
|
+
markdown += `${config.description}
|
|
774
|
+
|
|
775
|
+
`;
|
|
776
|
+
markdown += `**Type:** \`${config.type || "string"}\`
|
|
777
|
+
`;
|
|
778
|
+
if (config.default !== undefined) {
|
|
779
|
+
const defaultValue = typeof config.default === "string" ? `"${config.default}"` : String(config.default);
|
|
780
|
+
markdown += `**Default:** \`${defaultValue}\`
|
|
781
|
+
`;
|
|
782
|
+
} else {
|
|
783
|
+
markdown += `**Default:** *Required*
|
|
784
|
+
`;
|
|
785
|
+
}
|
|
786
|
+
markdown += `
|
|
787
|
+
`;
|
|
788
|
+
}
|
|
789
|
+
return markdown;
|
|
790
|
+
}
|
|
791
|
+
function generateEnvColored() {
|
|
792
|
+
const configs = Object.values(envRegistry);
|
|
793
|
+
if (configs.length === 0) {
|
|
794
|
+
return `\x1B[1;36mEnvironment Variables\x1B[0m
|
|
795
|
+
|
|
796
|
+
No environment variables registered.
|
|
797
|
+
`;
|
|
798
|
+
}
|
|
799
|
+
let output = `\x1B[1;36mEnvironment Variables\x1B[0m
|
|
800
|
+
|
|
801
|
+
`;
|
|
802
|
+
for (const config of configs) {
|
|
803
|
+
output += `\x1B[1;33m${config.name}\x1B[0m
|
|
804
|
+
`;
|
|
805
|
+
output += `${config.description}
|
|
806
|
+
`;
|
|
807
|
+
output += `\x1B[32mType:\x1B[0m \x1B[36m${config.type || "string"}\x1B[0m
|
|
808
|
+
`;
|
|
809
|
+
if (config.default !== undefined) {
|
|
810
|
+
const defaultValue = typeof config.default === "string" ? `"${config.default}"` : String(config.default);
|
|
811
|
+
output += `\x1B[32mDefault:\x1B[0m \x1B[35m${defaultValue}\x1B[0m
|
|
812
|
+
`;
|
|
813
|
+
} else {
|
|
814
|
+
output += `\x1B[32mDefault:\x1B[0m \x1B[31mRequired\x1B[0m
|
|
815
|
+
`;
|
|
816
|
+
}
|
|
817
|
+
output += `
|
|
818
|
+
`;
|
|
819
|
+
}
|
|
820
|
+
return output;
|
|
821
|
+
}
|
|
822
|
+
var env = new Proxy({}, {
|
|
823
|
+
get(target, prop) {
|
|
824
|
+
if (typeof prop !== "string") {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
return envStore.get(prop);
|
|
828
|
+
},
|
|
829
|
+
has(target, prop) {
|
|
830
|
+
return envStore.has(prop);
|
|
831
|
+
},
|
|
832
|
+
ownKeys() {
|
|
833
|
+
return Object.keys(envRegistry);
|
|
834
|
+
},
|
|
835
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
836
|
+
if (envStore.has(prop)) {
|
|
837
|
+
return {
|
|
838
|
+
enumerable: true,
|
|
839
|
+
configurable: true,
|
|
840
|
+
get: () => envStore.get(prop)
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
// src/platform/assets.ts
|
|
848
|
+
registerEnvVar({
|
|
849
|
+
name: "OTUI_ASSET_ROOT",
|
|
850
|
+
description: "Absolute directory containing relocatable OpenTUI runtime assets",
|
|
851
|
+
type: "string",
|
|
852
|
+
default: ""
|
|
853
|
+
});
|
|
854
|
+
function resolveAssetPath(key, fallback) {
|
|
855
|
+
validateAssetKey(key);
|
|
856
|
+
const configuredPath = resolveAssetRootPath(key);
|
|
857
|
+
if (configuredPath !== undefined) {
|
|
858
|
+
return configuredPath;
|
|
859
|
+
}
|
|
860
|
+
if (fallback === undefined) {
|
|
861
|
+
throw new Error(`OpenTUI asset ${JSON.stringify(key)} has no package-relative fallback`);
|
|
862
|
+
}
|
|
863
|
+
const value = typeof fallback === "function" ? fallback() : fallback;
|
|
864
|
+
return value instanceof URL ? fileURLToPath2(value) : value;
|
|
865
|
+
}
|
|
866
|
+
function resolveAssetRootPath(key) {
|
|
867
|
+
validateAssetKey(key);
|
|
868
|
+
const root = process.env.OTUI_ASSET_ROOT;
|
|
869
|
+
if (!root) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
if (!isAbsolute(root)) {
|
|
873
|
+
throw new Error(`OTUI_ASSET_ROOT must be an absolute directory, got ${JSON.stringify(root)}`);
|
|
874
|
+
}
|
|
875
|
+
const assetPath = join(root, key);
|
|
876
|
+
let isFile = false;
|
|
877
|
+
try {
|
|
878
|
+
isFile = statSync(assetPath).isFile();
|
|
879
|
+
} catch {}
|
|
880
|
+
if (!isFile) {
|
|
881
|
+
throw new Error(`Missing OpenTUI asset ${JSON.stringify(key)} at ${JSON.stringify(assetPath)}`);
|
|
882
|
+
}
|
|
883
|
+
return assetPath;
|
|
884
|
+
}
|
|
885
|
+
function validateAssetKey(key) {
|
|
886
|
+
if (key.length === 0 || isAbsolute(key) || key.includes("\\") || key.split("/").includes("..")) {
|
|
887
|
+
throw new Error(`Invalid OpenTUI asset key: ${JSON.stringify(key)}`);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
668
891
|
// src/platform/runtime.ts
|
|
669
892
|
var TEXT_ENCODER = new TextEncoder;
|
|
670
893
|
var bun = globalThis.Bun;
|
|
@@ -672,33 +895,46 @@ var sleep = bun?.sleep ?? standardSleep;
|
|
|
672
895
|
var stringWidth2 = bun?.stringWidth ?? stringWidth;
|
|
673
896
|
var stripANSI = bun?.stripANSI ?? stripAnsi;
|
|
674
897
|
var writeFile = bun?.write ?? writeFilePortable;
|
|
675
|
-
async function resolveBundledFilePath(loadBundledFile, fallbackPath, metaUrl) {
|
|
898
|
+
async function resolveBundledFilePath(key, loadBundledFile, fallbackPath, metaUrl, options = {}) {
|
|
899
|
+
if (options.useAssetRoot ?? true) {
|
|
900
|
+
const configuredPath = resolveAssetRootPath(key);
|
|
901
|
+
if (configuredPath !== undefined) {
|
|
902
|
+
return configuredPath;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
676
905
|
if (!bun) {
|
|
677
906
|
const path = resolveFallbackFilePath(fallbackPath, metaUrl);
|
|
678
907
|
if (existsSync(path)) {
|
|
679
908
|
return path;
|
|
680
909
|
}
|
|
681
|
-
return await loadBundledFilePath(loadBundledFile, metaUrl) ?? path;
|
|
910
|
+
return await loadBundledFilePath(loadBundledFile, metaUrl, options.loadBundledFileFallback ?? false) ?? path;
|
|
682
911
|
}
|
|
683
912
|
return normalizeLoadedFilePath((await loadBundledFile()).default, metaUrl);
|
|
684
913
|
}
|
|
685
914
|
function resolveFallbackFilePath(fallbackPath, metaUrl) {
|
|
686
915
|
const path = typeof fallbackPath === "function" ? fallbackPath() : fallbackPath;
|
|
687
|
-
return
|
|
916
|
+
return fileURLToPath3(path instanceof URL ? path : new URL(path, metaUrl));
|
|
688
917
|
}
|
|
689
918
|
function normalizeLoadedFilePath(loadedPath, baseUrl) {
|
|
690
919
|
if (loadedPath.startsWith("file:")) {
|
|
691
|
-
return
|
|
920
|
+
return fileURLToPath3(loadedPath);
|
|
692
921
|
}
|
|
693
|
-
if (
|
|
922
|
+
if (isAbsolute2(loadedPath)) {
|
|
694
923
|
return loadedPath;
|
|
695
924
|
}
|
|
696
|
-
return resolve(dirname(
|
|
925
|
+
return resolve(dirname(fileURLToPath3(baseUrl)), loadedPath);
|
|
697
926
|
}
|
|
698
|
-
async function loadBundledFilePath(loadBundledFile, metaUrl) {
|
|
927
|
+
async function loadBundledFilePath(loadBundledFile, metaUrl, loadBundledFileFallback) {
|
|
699
928
|
const specifier = extractBundledImportSpecifier(loadBundledFile);
|
|
700
929
|
if (!specifier) {
|
|
701
|
-
|
|
930
|
+
if (!loadBundledFileFallback) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
try {
|
|
934
|
+
return normalizeLoadedFilePath((await loadBundledFile()).default, metaUrl);
|
|
935
|
+
} catch {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
702
938
|
}
|
|
703
939
|
try {
|
|
704
940
|
const moduleUrl = new URL(specifier, metaUrl);
|
|
@@ -717,7 +953,7 @@ function standardSleep(msOrDate) {
|
|
|
717
953
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
718
954
|
}
|
|
719
955
|
async function writeFilePortable(destination, data, options) {
|
|
720
|
-
const destinationPath = destination instanceof URL ?
|
|
956
|
+
const destinationPath = destination instanceof URL ? fileURLToPath3(destination) : destination;
|
|
721
957
|
if (options?.createPath) {
|
|
722
958
|
await mkdir(dirname(destinationPath), { recursive: true });
|
|
723
959
|
}
|
|
@@ -5906,181 +6142,6 @@ class ASCIIFontSelectionHelper {
|
|
|
5906
6142
|
return previousSelection?.start !== this.localSelection?.start || previousSelection?.end !== this.localSelection?.end;
|
|
5907
6143
|
}
|
|
5908
6144
|
}
|
|
5909
|
-
// src/lib/singleton.ts
|
|
5910
|
-
var singletonCacheSymbol = Symbol.for("@opentui/core/singleton");
|
|
5911
|
-
function singleton(key, factory) {
|
|
5912
|
-
const bag = globalThis[singletonCacheSymbol] ??= {};
|
|
5913
|
-
if (!(key in bag)) {
|
|
5914
|
-
bag[key] = factory();
|
|
5915
|
-
}
|
|
5916
|
-
return bag[key];
|
|
5917
|
-
}
|
|
5918
|
-
function getSingleton(key) {
|
|
5919
|
-
const bag = globalThis[singletonCacheSymbol];
|
|
5920
|
-
return bag?.[key];
|
|
5921
|
-
}
|
|
5922
|
-
function destroySingleton(key) {
|
|
5923
|
-
const bag = globalThis[singletonCacheSymbol];
|
|
5924
|
-
if (bag && key in bag) {
|
|
5925
|
-
delete bag[key];
|
|
5926
|
-
}
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
|
-
// src/lib/env.ts
|
|
5930
|
-
var envRegistry = singleton("env-registry", () => ({}));
|
|
5931
|
-
function registerEnvVar(config) {
|
|
5932
|
-
const existing = envRegistry[config.name];
|
|
5933
|
-
if (existing) {
|
|
5934
|
-
if (existing.description !== config.description || existing.type !== config.type || existing.default !== config.default) {
|
|
5935
|
-
throw new Error(`Environment variable "${config.name}" is already registered with different configuration. ` + `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`);
|
|
5936
|
-
}
|
|
5937
|
-
return;
|
|
5938
|
-
}
|
|
5939
|
-
envRegistry[config.name] = config;
|
|
5940
|
-
}
|
|
5941
|
-
function normalizeBoolean(value) {
|
|
5942
|
-
const lowerValue = value.toLowerCase();
|
|
5943
|
-
return ["true", "1", "on", "yes"].includes(lowerValue);
|
|
5944
|
-
}
|
|
5945
|
-
function parseEnvValue(config) {
|
|
5946
|
-
const envValue = process.env[config.name];
|
|
5947
|
-
if (envValue === undefined && config.default !== undefined) {
|
|
5948
|
-
return config.default;
|
|
5949
|
-
}
|
|
5950
|
-
if (envValue === undefined) {
|
|
5951
|
-
throw new Error(`Required environment variable ${config.name} is not set. ${config.description}`);
|
|
5952
|
-
}
|
|
5953
|
-
switch (config.type) {
|
|
5954
|
-
case "boolean":
|
|
5955
|
-
return typeof envValue === "boolean" ? envValue : normalizeBoolean(envValue);
|
|
5956
|
-
case "number":
|
|
5957
|
-
const numValue = Number(envValue);
|
|
5958
|
-
if (isNaN(numValue)) {
|
|
5959
|
-
throw new Error(`Environment variable ${config.name} must be a valid number, got: ${envValue}`);
|
|
5960
|
-
}
|
|
5961
|
-
return numValue;
|
|
5962
|
-
case "string":
|
|
5963
|
-
default:
|
|
5964
|
-
return envValue;
|
|
5965
|
-
}
|
|
5966
|
-
}
|
|
5967
|
-
|
|
5968
|
-
class EnvStore {
|
|
5969
|
-
parsedValues = new Map;
|
|
5970
|
-
get(key) {
|
|
5971
|
-
if (this.parsedValues.has(key)) {
|
|
5972
|
-
return this.parsedValues.get(key);
|
|
5973
|
-
}
|
|
5974
|
-
if (!(key in envRegistry)) {
|
|
5975
|
-
throw new Error(`Environment variable ${key} is not registered.`);
|
|
5976
|
-
}
|
|
5977
|
-
try {
|
|
5978
|
-
const value = parseEnvValue(envRegistry[key]);
|
|
5979
|
-
this.parsedValues.set(key, value);
|
|
5980
|
-
return value;
|
|
5981
|
-
} catch (error) {
|
|
5982
|
-
throw new Error(`Failed to parse env var ${key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
5983
|
-
}
|
|
5984
|
-
}
|
|
5985
|
-
has(key) {
|
|
5986
|
-
return key in envRegistry;
|
|
5987
|
-
}
|
|
5988
|
-
clearCache() {
|
|
5989
|
-
this.parsedValues.clear();
|
|
5990
|
-
}
|
|
5991
|
-
}
|
|
5992
|
-
var envStore = singleton("env-store", () => new EnvStore);
|
|
5993
|
-
function clearEnvCache() {
|
|
5994
|
-
envStore.clearCache();
|
|
5995
|
-
}
|
|
5996
|
-
function generateEnvMarkdown() {
|
|
5997
|
-
const configs = Object.values(envRegistry);
|
|
5998
|
-
if (configs.length === 0) {
|
|
5999
|
-
return `# Environment Variables
|
|
6000
|
-
|
|
6001
|
-
No environment variables registered.
|
|
6002
|
-
`;
|
|
6003
|
-
}
|
|
6004
|
-
let markdown = `# Environment Variables
|
|
6005
|
-
|
|
6006
|
-
`;
|
|
6007
|
-
for (const config of configs) {
|
|
6008
|
-
markdown += `## ${config.name}
|
|
6009
|
-
|
|
6010
|
-
`;
|
|
6011
|
-
markdown += `${config.description}
|
|
6012
|
-
|
|
6013
|
-
`;
|
|
6014
|
-
markdown += `**Type:** \`${config.type || "string"}\`
|
|
6015
|
-
`;
|
|
6016
|
-
if (config.default !== undefined) {
|
|
6017
|
-
const defaultValue = typeof config.default === "string" ? `"${config.default}"` : String(config.default);
|
|
6018
|
-
markdown += `**Default:** \`${defaultValue}\`
|
|
6019
|
-
`;
|
|
6020
|
-
} else {
|
|
6021
|
-
markdown += `**Default:** *Required*
|
|
6022
|
-
`;
|
|
6023
|
-
}
|
|
6024
|
-
markdown += `
|
|
6025
|
-
`;
|
|
6026
|
-
}
|
|
6027
|
-
return markdown;
|
|
6028
|
-
}
|
|
6029
|
-
function generateEnvColored() {
|
|
6030
|
-
const configs = Object.values(envRegistry);
|
|
6031
|
-
if (configs.length === 0) {
|
|
6032
|
-
return `\x1B[1;36mEnvironment Variables\x1B[0m
|
|
6033
|
-
|
|
6034
|
-
No environment variables registered.
|
|
6035
|
-
`;
|
|
6036
|
-
}
|
|
6037
|
-
let output = `\x1B[1;36mEnvironment Variables\x1B[0m
|
|
6038
|
-
|
|
6039
|
-
`;
|
|
6040
|
-
for (const config of configs) {
|
|
6041
|
-
output += `\x1B[1;33m${config.name}\x1B[0m
|
|
6042
|
-
`;
|
|
6043
|
-
output += `${config.description}
|
|
6044
|
-
`;
|
|
6045
|
-
output += `\x1B[32mType:\x1B[0m \x1B[36m${config.type || "string"}\x1B[0m
|
|
6046
|
-
`;
|
|
6047
|
-
if (config.default !== undefined) {
|
|
6048
|
-
const defaultValue = typeof config.default === "string" ? `"${config.default}"` : String(config.default);
|
|
6049
|
-
output += `\x1B[32mDefault:\x1B[0m \x1B[35m${defaultValue}\x1B[0m
|
|
6050
|
-
`;
|
|
6051
|
-
} else {
|
|
6052
|
-
output += `\x1B[32mDefault:\x1B[0m \x1B[31mRequired\x1B[0m
|
|
6053
|
-
`;
|
|
6054
|
-
}
|
|
6055
|
-
output += `
|
|
6056
|
-
`;
|
|
6057
|
-
}
|
|
6058
|
-
return output;
|
|
6059
|
-
}
|
|
6060
|
-
var env = new Proxy({}, {
|
|
6061
|
-
get(target, prop) {
|
|
6062
|
-
if (typeof prop !== "string") {
|
|
6063
|
-
return;
|
|
6064
|
-
}
|
|
6065
|
-
return envStore.get(prop);
|
|
6066
|
-
},
|
|
6067
|
-
has(target, prop) {
|
|
6068
|
-
return envStore.has(prop);
|
|
6069
|
-
},
|
|
6070
|
-
ownKeys() {
|
|
6071
|
-
return Object.keys(envRegistry);
|
|
6072
|
-
},
|
|
6073
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
6074
|
-
if (envStore.has(prop)) {
|
|
6075
|
-
return {
|
|
6076
|
-
enumerable: true,
|
|
6077
|
-
configurable: true,
|
|
6078
|
-
get: () => envStore.get(prop)
|
|
6079
|
-
};
|
|
6080
|
-
}
|
|
6081
|
-
return;
|
|
6082
|
-
}
|
|
6083
|
-
});
|
|
6084
6145
|
// src/lib/stdin-parser.ts
|
|
6085
6146
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
6086
6147
|
var DEFAULT_TIMEOUT_MS = 20;
|
|
@@ -7843,92 +7904,151 @@ class ProcessQueue {
|
|
|
7843
7904
|
}
|
|
7844
7905
|
}
|
|
7845
7906
|
|
|
7907
|
+
// src/node-asset-target.ts
|
|
7908
|
+
var NATIVE_FILE_NAMES = {
|
|
7909
|
+
darwin: "libopentui.dylib",
|
|
7910
|
+
linux: "libopentui.so",
|
|
7911
|
+
win32: "opentui.dll"
|
|
7912
|
+
};
|
|
7913
|
+
function getNativeAssetDescriptor(target) {
|
|
7914
|
+
if (!Object.hasOwn(NATIVE_FILE_NAMES, target.platform) || target.arch !== "arm64" && target.arch !== "x64") {
|
|
7915
|
+
throw new Error(`Unsupported OpenTUI Node asset target: ${String(target.platform)}-${String(target.arch)}`);
|
|
7916
|
+
}
|
|
7917
|
+
if (target.libc !== undefined && target.libc !== "glibc" && target.libc !== "musl") {
|
|
7918
|
+
throw new Error(`Unsupported libc for OpenTUI Node assets: ${String(target.libc)}`);
|
|
7919
|
+
}
|
|
7920
|
+
if (target.platform !== "linux" && target.libc !== undefined) {
|
|
7921
|
+
throw new Error(`OpenTUI Node asset target libc is only supported on Linux, got ${target.platform}`);
|
|
7922
|
+
}
|
|
7923
|
+
const libcSuffix = target.platform === "linux" && target.libc === "musl" ? "-musl" : "";
|
|
7924
|
+
const packageName = `@opentui/core-${target.platform}-${target.arch}${libcSuffix}`;
|
|
7925
|
+
const fileName = NATIVE_FILE_NAMES[target.platform];
|
|
7926
|
+
return {
|
|
7927
|
+
key: `${packageName}/${fileName}`,
|
|
7928
|
+
packageName,
|
|
7929
|
+
fileName
|
|
7930
|
+
};
|
|
7931
|
+
}
|
|
7932
|
+
function getCurrentNodeAssetTarget() {
|
|
7933
|
+
const libc = process.env.OPENTUI_LIBC;
|
|
7934
|
+
if (process.platform === "linux" && libc !== undefined && libc !== "" && libc !== "glibc" && libc !== "musl") {
|
|
7935
|
+
throw new Error(`On Linux, OPENTUI_LIBC must be unset, empty, "glibc", or "musl", got ${JSON.stringify(libc)}`);
|
|
7936
|
+
}
|
|
7937
|
+
return {
|
|
7938
|
+
platform: process.platform,
|
|
7939
|
+
arch: process.arch,
|
|
7940
|
+
...process.platform === "linux" && libc === "musl" ? { libc } : {}
|
|
7941
|
+
};
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
// src/platform/runtime-assets.node.ts
|
|
7945
|
+
var CORE_ASSET_PREFIX = "@opentui/core/";
|
|
7946
|
+
var PARSER_WORKER_ASSET_KEY = `${CORE_ASSET_PREFIX}parser.worker.js`;
|
|
7947
|
+
var TREE_SITTER_WASM_ASSET_KEY = "web-tree-sitter/tree-sitter.wasm";
|
|
7948
|
+
function resolveDefaultParserAsset(relativePath, fallbackPath) {
|
|
7949
|
+
return Promise.resolve(resolveAssetPath(`${CORE_ASSET_PREFIX}${relativePath}`, fallbackPath));
|
|
7950
|
+
}
|
|
7951
|
+
function resolveDefaultTreeSitterWorkerPath(fallbackPath) {
|
|
7952
|
+
return resolveAssetPath(PARSER_WORKER_ASSET_KEY, fallbackPath);
|
|
7953
|
+
}
|
|
7954
|
+
function resolveTreeSitterWasm() {
|
|
7955
|
+
return Promise.resolve(resolveAssetPath(TREE_SITTER_WASM_ASSET_KEY, () => new URL(import.meta.resolve(TREE_SITTER_WASM_ASSET_KEY))));
|
|
7956
|
+
}
|
|
7957
|
+
async function resolveNativeLibraryPath() {
|
|
7958
|
+
const asset = getNativeAssetDescriptor(getCurrentNodeAssetTarget());
|
|
7959
|
+
const configuredPath = resolveAssetRootPath(asset.key);
|
|
7960
|
+
if (configuredPath !== undefined) {
|
|
7961
|
+
return configuredPath;
|
|
7962
|
+
}
|
|
7963
|
+
const specifier = asset.packageName;
|
|
7964
|
+
return (await import(specifier)).default;
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7846
7967
|
// src/lib/tree-sitter/default-parsers.ts
|
|
7847
|
-
var
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
}
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
{
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
},
|
|
7881
|
-
wasm: typescript_language
|
|
7882
|
-
},
|
|
7883
|
-
{
|
|
7884
|
-
filetype: "markdown",
|
|
7885
|
-
queries: {
|
|
7886
|
-
highlights: [markdown_highlights],
|
|
7887
|
-
injections: [markdown_injections]
|
|
7888
|
-
},
|
|
7889
|
-
wasm: markdown_language,
|
|
7890
|
-
injectionMapping: {
|
|
7891
|
-
nodeTypes: {
|
|
7892
|
-
inline: "markdown_inline",
|
|
7893
|
-
pipe_table_cell: "markdown_inline"
|
|
7894
|
-
},
|
|
7895
|
-
infoStringMap: {
|
|
7896
|
-
javascript: "javascript",
|
|
7897
|
-
js: "javascript",
|
|
7898
|
-
jsx: "javascriptreact",
|
|
7899
|
-
javascriptreact: "javascriptreact",
|
|
7900
|
-
typescript: "typescript",
|
|
7901
|
-
ts: "typescript",
|
|
7902
|
-
tsx: "typescriptreact",
|
|
7903
|
-
typescriptreact: "typescriptreact",
|
|
7904
|
-
markdown: "markdown",
|
|
7905
|
-
md: "markdown"
|
|
7906
|
-
}
|
|
7968
|
+
var defaultParserDescriptors = [
|
|
7969
|
+
{
|
|
7970
|
+
filetype: "javascript",
|
|
7971
|
+
aliases: ["javascriptreact"],
|
|
7972
|
+
queries: { highlights: ["assets/javascript/highlights.scm"] },
|
|
7973
|
+
wasm: "assets/javascript/tree-sitter-javascript.wasm"
|
|
7974
|
+
},
|
|
7975
|
+
{
|
|
7976
|
+
filetype: "typescript",
|
|
7977
|
+
aliases: ["typescriptreact"],
|
|
7978
|
+
queries: { highlights: ["assets/typescript/highlights.scm"] },
|
|
7979
|
+
wasm: "assets/typescript/tree-sitter-typescript.wasm"
|
|
7980
|
+
},
|
|
7981
|
+
{
|
|
7982
|
+
filetype: "markdown",
|
|
7983
|
+
queries: {
|
|
7984
|
+
highlights: ["assets/markdown/highlights.scm"],
|
|
7985
|
+
injections: ["assets/markdown/injections.scm"]
|
|
7986
|
+
},
|
|
7987
|
+
wasm: "assets/markdown/tree-sitter-markdown.wasm",
|
|
7988
|
+
injectionMapping: {
|
|
7989
|
+
nodeTypes: { inline: "markdown_inline", pipe_table_cell: "markdown_inline" },
|
|
7990
|
+
infoStringMap: {
|
|
7991
|
+
javascript: "javascript",
|
|
7992
|
+
js: "javascript",
|
|
7993
|
+
jsx: "javascriptreact",
|
|
7994
|
+
javascriptreact: "javascriptreact",
|
|
7995
|
+
typescript: "typescript",
|
|
7996
|
+
ts: "typescript",
|
|
7997
|
+
tsx: "typescriptreact",
|
|
7998
|
+
typescriptreact: "typescriptreact",
|
|
7999
|
+
markdown: "markdown",
|
|
8000
|
+
md: "markdown"
|
|
7907
8001
|
}
|
|
7908
|
-
},
|
|
7909
|
-
{
|
|
7910
|
-
filetype: "markdown_inline",
|
|
7911
|
-
queries: {
|
|
7912
|
-
highlights: [markdown_inline_highlights]
|
|
7913
|
-
},
|
|
7914
|
-
wasm: markdown_inline_language
|
|
7915
|
-
},
|
|
7916
|
-
{
|
|
7917
|
-
filetype: "zig",
|
|
7918
|
-
queries: {
|
|
7919
|
-
highlights: [zig_highlights]
|
|
7920
|
-
},
|
|
7921
|
-
wasm: zig_language
|
|
7922
8002
|
}
|
|
7923
|
-
|
|
8003
|
+
},
|
|
8004
|
+
{
|
|
8005
|
+
filetype: "markdown_inline",
|
|
8006
|
+
queries: { highlights: ["assets/markdown_inline/highlights.scm"] },
|
|
8007
|
+
wasm: "assets/markdown_inline/tree-sitter-markdown_inline.wasm"
|
|
8008
|
+
},
|
|
8009
|
+
{
|
|
8010
|
+
filetype: "zig",
|
|
8011
|
+
queries: { highlights: ["assets/zig/highlights.scm"] },
|
|
8012
|
+
wasm: "assets/zig/tree-sitter-zig.wasm"
|
|
8013
|
+
}
|
|
8014
|
+
];
|
|
8015
|
+
var defaultParserAssetPaths = [
|
|
8016
|
+
...new Set(defaultParserDescriptors.flatMap((parser) => [
|
|
8017
|
+
...parser.queries.highlights,
|
|
8018
|
+
parser.wasm,
|
|
8019
|
+
...parser.queries.injections ?? []
|
|
8020
|
+
]))
|
|
8021
|
+
];
|
|
8022
|
+
var cachedParsers;
|
|
8023
|
+
function getParsers() {
|
|
8024
|
+
cachedParsers ??= Promise.all(defaultParserDescriptors.map(resolveDefaultParser));
|
|
8025
|
+
return cachedParsers;
|
|
8026
|
+
}
|
|
8027
|
+
async function resolveDefaultParser(parser) {
|
|
8028
|
+
const queries = {
|
|
8029
|
+
highlights: await Promise.all(parser.queries.highlights.map(resolveParserAsset))
|
|
8030
|
+
};
|
|
8031
|
+
if (parser.queries.injections) {
|
|
8032
|
+
queries.injections = await Promise.all(parser.queries.injections.map(resolveParserAsset));
|
|
8033
|
+
}
|
|
8034
|
+
return {
|
|
8035
|
+
filetype: parser.filetype,
|
|
8036
|
+
...parser.aliases ? { aliases: [...parser.aliases] } : {},
|
|
8037
|
+
queries,
|
|
8038
|
+
wasm: await resolveParserAsset(parser.wasm),
|
|
8039
|
+
...parser.injectionMapping ? { injectionMapping: parser.injectionMapping } : {}
|
|
8040
|
+
};
|
|
8041
|
+
}
|
|
8042
|
+
function resolveParserAsset(relativePath) {
|
|
8043
|
+
return resolveDefaultParserAsset(relativePath, new URL(`./${relativePath}`, import.meta.url));
|
|
7924
8044
|
}
|
|
7925
8045
|
|
|
7926
8046
|
// src/lib/tree-sitter/client.ts
|
|
7927
|
-
import { resolve as resolve2, isAbsolute as
|
|
8047
|
+
import { resolve as resolve2, isAbsolute as isAbsolute3, parse } from "path";
|
|
7928
8048
|
import { existsSync as existsSync2 } from "fs";
|
|
7929
8049
|
|
|
7930
8050
|
// src/lib/bunfs.ts
|
|
7931
|
-
import { basename, join } from "node:path";
|
|
8051
|
+
import { basename, join as join2 } from "node:path";
|
|
7932
8052
|
function isBunfsPath(path) {
|
|
7933
8053
|
return path.includes("$bunfs") || /^B:[\\/]~BUN/i.test(path);
|
|
7934
8054
|
}
|
|
@@ -7936,7 +8056,7 @@ function getBunfsRootPath() {
|
|
|
7936
8056
|
return process.platform === "win32" ? "B:\\~BUN\\root" : "/$bunfs/root";
|
|
7937
8057
|
}
|
|
7938
8058
|
function normalizeBunfsPath(fileName) {
|
|
7939
|
-
return
|
|
8059
|
+
return join2(getBunfsRootPath(), basename(fileName));
|
|
7940
8060
|
}
|
|
7941
8061
|
|
|
7942
8062
|
// src/platform/worker.ts
|
|
@@ -8323,8 +8443,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8323
8443
|
if (typeof OTUI_TREE_SITTER_WORKER_PATH !== "undefined") {
|
|
8324
8444
|
return OTUI_TREE_SITTER_WORKER_PATH;
|
|
8325
8445
|
}
|
|
8326
|
-
let workerPath = new URL("./parser.worker.js", import.meta.url)
|
|
8327
|
-
if (!
|
|
8446
|
+
let workerPath = resolveDefaultTreeSitterWorkerPath(new URL("./parser.worker.js", import.meta.url));
|
|
8447
|
+
if (!process.env.OTUI_ASSET_ROOT && !existsSync2(workerPath)) {
|
|
8328
8448
|
workerPath = new URL("./parser.worker.ts", import.meta.url).href;
|
|
8329
8449
|
}
|
|
8330
8450
|
return workerPath;
|
|
@@ -8401,6 +8521,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8401
8521
|
}
|
|
8402
8522
|
}
|
|
8403
8523
|
async initializeClient(generation, worker) {
|
|
8524
|
+
const treeSitterWasmPath = await resolveTreeSitterWasm();
|
|
8525
|
+
this.assertCurrentInitialization(generation, worker);
|
|
8404
8526
|
await new Promise((resolve3, reject) => {
|
|
8405
8527
|
const timeoutMs = this.options.initTimeout ?? 1e4;
|
|
8406
8528
|
const timeoutId = setTimeout(() => {
|
|
@@ -8412,7 +8534,8 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8412
8534
|
this.initializeResolvers = { resolve: resolve3, reject, timeoutId };
|
|
8413
8535
|
this.sendWorkerMessage({
|
|
8414
8536
|
type: "INIT",
|
|
8415
|
-
dataPath: this.options.dataPath
|
|
8537
|
+
dataPath: this.options.dataPath,
|
|
8538
|
+
treeSitterWasmPath
|
|
8416
8539
|
});
|
|
8417
8540
|
});
|
|
8418
8541
|
this.assertCurrentInitialization(generation, worker);
|
|
@@ -8438,7 +8561,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8438
8561
|
if (isBunfsPath(path)) {
|
|
8439
8562
|
return normalizeBunfsPath(parse(path).base);
|
|
8440
8563
|
}
|
|
8441
|
-
if (!
|
|
8564
|
+
if (!isAbsolute3(path)) {
|
|
8442
8565
|
return resolve2(path);
|
|
8443
8566
|
}
|
|
8444
8567
|
return path;
|
|
@@ -11868,51 +11991,18 @@ registerEnvVar({
|
|
|
11868
11991
|
type: "string",
|
|
11869
11992
|
default: ""
|
|
11870
11993
|
});
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
async function resolveNativePackage() {
|
|
11878
|
-
if (process.platform === "darwin") {
|
|
11879
|
-
if (process.arch === "x64")
|
|
11880
|
-
return await import("@opentui/core-darwin-x64");
|
|
11881
|
-
if (process.arch === "arm64")
|
|
11882
|
-
return await import("@opentui/core-darwin-arm64");
|
|
11883
|
-
}
|
|
11884
|
-
if (process.platform === "linux") {
|
|
11885
|
-
validateLinuxLibcOverride();
|
|
11886
|
-
if (process.arch === "x64") {
|
|
11887
|
-
if (process.env.OPENTUI_LIBC === "musl") {
|
|
11888
|
-
return await import("@opentui/core-linux-x64-musl");
|
|
11889
|
-
} else {
|
|
11890
|
-
return await import("@opentui/core-linux-x64");
|
|
11891
|
-
}
|
|
11892
|
-
}
|
|
11893
|
-
if (process.arch === "arm64") {
|
|
11894
|
-
if (process.env.OPENTUI_LIBC === "musl") {
|
|
11895
|
-
return await import("@opentui/core-linux-arm64-musl");
|
|
11896
|
-
} else {
|
|
11897
|
-
return await import("@opentui/core-linux-arm64");
|
|
11898
|
-
}
|
|
11899
|
-
}
|
|
11994
|
+
var targetLibPath;
|
|
11995
|
+
var targetLibError;
|
|
11996
|
+
try {
|
|
11997
|
+
targetLibPath = await resolveNativeLibraryPath();
|
|
11998
|
+
if (isBunfsPath(targetLibPath)) {
|
|
11999
|
+
targetLibPath = targetLibPath.replace("../", "");
|
|
11900
12000
|
}
|
|
11901
|
-
if (
|
|
11902
|
-
|
|
11903
|
-
return await import("@opentui/core-win32-x64");
|
|
11904
|
-
if (process.arch === "arm64")
|
|
11905
|
-
return await import("@opentui/core-win32-arm64");
|
|
12001
|
+
if (!existsSync3(targetLibPath)) {
|
|
12002
|
+
throw new Error(`OpenTUI native library does not exist at ${JSON.stringify(targetLibPath)}`);
|
|
11906
12003
|
}
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
var nativePackage = await resolveNativePackage();
|
|
11910
|
-
var targetLibPath = nativePackage.default;
|
|
11911
|
-
if (isBunfsPath(targetLibPath)) {
|
|
11912
|
-
targetLibPath = targetLibPath.replace("../", "");
|
|
11913
|
-
}
|
|
11914
|
-
if (!existsSync3(targetLibPath)) {
|
|
11915
|
-
throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
|
|
12004
|
+
} catch (error) {
|
|
12005
|
+
targetLibError = error instanceof Error ? error : new Error(String(error));
|
|
11916
12006
|
}
|
|
11917
12007
|
registerEnvVar({
|
|
11918
12008
|
name: "OTUI_DEBUG_FFI",
|
|
@@ -11989,6 +12079,9 @@ function optionalRgbaPtr(value) {
|
|
|
11989
12079
|
}
|
|
11990
12080
|
function getOpenTUILib(libPath) {
|
|
11991
12081
|
const resolvedLibPath = libPath || targetLibPath;
|
|
12082
|
+
if (!resolvedLibPath) {
|
|
12083
|
+
throw targetLibError ?? new Error(`OpenTUI is not supported on the current platform: ${process.platform}-${process.arch}`);
|
|
12084
|
+
}
|
|
11992
12085
|
const rawSymbols = dlopen(resolvedLibPath, {
|
|
11993
12086
|
setLogCallback: {
|
|
11994
12087
|
args: ["ptr"],
|
|
@@ -13476,10 +13569,10 @@ function convertToDebugSymbols(symbols) {
|
|
|
13476
13569
|
const medianWidth = Math.max(medHeader.length, ...allStats.map((s) => s.median.toFixed(2).length));
|
|
13477
13570
|
const p90Width = Math.max(p90Header.length, ...allStats.map((s) => s.p90.toFixed(2).length));
|
|
13478
13571
|
const p99Width = Math.max(p99Header.length, ...allStats.map((s) => s.p99.toFixed(2).length));
|
|
13479
|
-
lines.push(`${nameHeader.padEnd(nameWidth)} |
|
|
13572
|
+
lines.push(`${nameHeader.padEnd(nameWidth)} | ` + `${callsHeader.padStart(countWidth)} | ` + `${totalHeader.padStart(totalWidth)} | ` + `${avgHeader.padStart(avgWidth)} | ` + `${minHeader.padStart(statWidthMin)} | ` + `${maxHeader.padStart(statWidthMax)} | ` + `${medHeader.padStart(medianWidth)} | ` + `${p90Header.padStart(p90Width)} | ` + `${p99Header.padStart(p99Width)}`);
|
|
13480
13573
|
lines.push(`${"-".repeat(nameWidth)}-+-${"-".repeat(countWidth)}-+-${"-".repeat(totalWidth)}-+-${"-".repeat(avgWidth)}-+-${"-".repeat(statWidthMin)}-+-${"-".repeat(statWidthMax)}-+-${"-".repeat(medianWidth)}-+-${"-".repeat(p90Width)}-+-${"-".repeat(p99Width)}`);
|
|
13481
13574
|
allStats.forEach((stat) => {
|
|
13482
|
-
lines.push(`${stat.name.padEnd(nameWidth)} |
|
|
13575
|
+
lines.push(`${stat.name.padEnd(nameWidth)} | ` + `${String(stat.count).padStart(countWidth)} | ` + `${stat.total.toFixed(2).padStart(totalWidth)} | ` + `${stat.average.toFixed(2).padStart(avgWidth)} | ` + `${stat.min.toFixed(2).padStart(statWidthMin)} | ` + `${stat.max.toFixed(2).padStart(statWidthMax)} | ` + `${stat.median.toFixed(2).padStart(medianWidth)} | ` + `${stat.p90.toFixed(2).padStart(p90Width)} | ` + `${stat.p99.toFixed(2).padStart(p99Width)}`);
|
|
13483
13576
|
});
|
|
13484
13577
|
}
|
|
13485
13578
|
lines.push("-------------------------------------------------------------------------------------------------------------------------");
|
|
@@ -16262,7 +16355,7 @@ var Yoga = {
|
|
|
16262
16355
|
};
|
|
16263
16356
|
var yoga_default = Yoga;
|
|
16264
16357
|
|
|
16265
|
-
export { toArrayBuffer, sleep, stringWidth2 as stringWidth, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, 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, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper,
|
|
16358
|
+
export { toArrayBuffer, singleton, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, sleep, stringWidth2 as stringWidth, resolveBundledFilePath, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, 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, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, destroyTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, ClipboardTarget, Clipboard, detectLinks, OptimizedBuffer, TextBuffer, SpanInfoStruct, NativeAudioStreamFormat, NativeAudioStreamState, NativeAudioStreamStateNames, NativeAudioStreamCloseReason, NativeAudioStreamState2 as NativeAudioStreamState1, NativeAudioStreamCloseReason2 as NativeAudioStreamCloseReason1, NativeAudioStreamFormat2 as NativeAudioStreamFormat1, LogLevel2 as LogLevel, NativeMeasureTargetKind, setRenderLibPath, resolveRenderLib, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel as LogLevel1, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, ALIGN_AUTO, ALIGN_FLEX_START, ALIGN_CENTER, ALIGN_FLEX_END, ALIGN_STRETCH, ALIGN_BASELINE, ALIGN_SPACE_BETWEEN, ALIGN_SPACE_AROUND, ALIGN_SPACE_EVENLY, BOX_SIZING_BORDER_BOX, BOX_SIZING_CONTENT_BOX, DIMENSION_WIDTH, DIMENSION_HEIGHT, DIRECTION_INHERIT, DIRECTION_LTR, DIRECTION_RTL, DISPLAY_FLEX, DISPLAY_NONE, DISPLAY_CONTENTS, EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM, EDGE_START, EDGE_END, EDGE_HORIZONTAL, EDGE_VERTICAL, EDGE_ALL, ERRATA_NONE, ERRATA_STRETCH_FLEX_BASIS, ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING, ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE, ERRATA_ALL, ERRATA_CLASSIC, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS, FLEX_DIRECTION_COLUMN, FLEX_DIRECTION_COLUMN_REVERSE, FLEX_DIRECTION_ROW, FLEX_DIRECTION_ROW_REVERSE, GUTTER_COLUMN, GUTTER_ROW, GUTTER_ALL, JUSTIFY_FLEX_START, JUSTIFY_CENTER, JUSTIFY_FLEX_END, JUSTIFY_SPACE_BETWEEN, JUSTIFY_SPACE_AROUND, JUSTIFY_SPACE_EVENLY, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_FATAL, MEASURE_MODE_UNDEFINED, MEASURE_MODE_EXACTLY, MEASURE_MODE_AT_MOST, NODE_TYPE_DEFAULT, NODE_TYPE_TEXT, OVERFLOW_VISIBLE, OVERFLOW_HIDDEN, OVERFLOW_SCROLL, POSITION_TYPE_STATIC, POSITION_TYPE_RELATIVE, POSITION_TYPE_ABSOLUTE, UNIT_UNDEFINED, UNIT_POINT, UNIT_PERCENT, UNIT_AUTO, WRAP_NO_WRAP, WRAP_WRAP, WRAP_WRAP_REVERSE, Config, Node, exports_yoga, yoga_default };
|
|
16266
16359
|
|
|
16267
|
-
//# debugId=
|
|
16268
|
-
//# sourceMappingURL=
|
|
16360
|
+
//# debugId=F036A274BA18217764756E2164756E21
|
|
16361
|
+
//# sourceMappingURL=chunk-node-q0cwyvm9.js.map
|