@opentui/core 0.2.10 → 0.2.11
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/{index-gpwc47jm.js → index-16cethat.js} +3 -3
- package/{index-8bzyejht.js → index-akz3tpeb.js} +2 -2
- package/{index-691sybgy.js → index-hpxarv5s.js} +3 -5
- package/{index-691sybgy.js.map → index-hpxarv5s.js.map} +2 -2
- package/{index-t4yn324k.js → index-ysvpktsp.js} +41 -355
- package/{index-t4yn324k.js.map → index-ysvpktsp.js.map} +5 -7
- package/index.js +3 -5
- package/index.js.map +1 -1
- package/lib/tree-sitter/assets/update.d.ts +1 -0
- package/lib/tree-sitter/index.d.ts +0 -2
- package/lib/tree-sitter/update-assets.d.ts +3 -0
- package/lib/tree-sitter/update-assets.js +377 -0
- package/lib/tree-sitter/update-assets.js.map +12 -0
- package/package.json +12 -7
- package/runtime-plugin-support-configure.js +4 -4
- package/runtime-plugin-support.js +4 -4
- package/runtime-plugin.js +3 -3
- package/testing.js +1 -1
- /package/{index-gpwc47jm.js.map → index-16cethat.js.map} +0 -0
- /package/{index-8bzyejht.js.map → index-akz3tpeb.js.map} +0 -0
|
@@ -5703,7 +5703,7 @@ function parseKittyKeyboard(sequence) {
|
|
|
5703
5703
|
} else {
|
|
5704
5704
|
if (codepoint > 0 && codepoint <= 1114111) {
|
|
5705
5705
|
const char = String.fromCodePoint(codepoint);
|
|
5706
|
-
key.name = char;
|
|
5706
|
+
key.name = char === " " ? "space" : char;
|
|
5707
5707
|
if (baseCodepoint) {
|
|
5708
5708
|
key.baseCode = baseCodepoint;
|
|
5709
5709
|
}
|
|
@@ -5752,7 +5752,9 @@ function parseKittyKeyboard(sequence) {
|
|
|
5752
5752
|
if (text === "") {
|
|
5753
5753
|
const isPrintable = key.name.length > 0 && !kittyKeyMap[codepoint];
|
|
5754
5754
|
if (isPrintable) {
|
|
5755
|
-
if (
|
|
5755
|
+
if (codepoint === 32) {
|
|
5756
|
+
text = " ";
|
|
5757
|
+
} else if (key.shift && shiftedCodepoint) {
|
|
5756
5758
|
text = String.fromCodePoint(shiftedCodepoint);
|
|
5757
5759
|
} else if (key.shift && key.name.length === 1) {
|
|
5758
5760
|
text = key.name.toLocaleUpperCase();
|
|
@@ -5761,9 +5763,6 @@ function parseKittyKeyboard(sequence) {
|
|
|
5761
5763
|
}
|
|
5762
5764
|
}
|
|
5763
5765
|
}
|
|
5764
|
-
if (key.name === " " && key.shift && !key.ctrl && !key.meta) {
|
|
5765
|
-
text = " ";
|
|
5766
|
-
}
|
|
5767
5766
|
if (text) {
|
|
5768
5767
|
if (codepoint === 0) {
|
|
5769
5768
|
key.name = text;
|
|
@@ -9711,319 +9710,6 @@ function infoStringToFiletype(infoString) {
|
|
|
9711
9710
|
return basenameToFiletype.get(normalizedToken) ?? pathToFiletype(normalizedToken) ?? extToFiletype(normalizedToken) ?? normalizedToken;
|
|
9712
9711
|
}
|
|
9713
9712
|
|
|
9714
|
-
// src/lib/tree-sitter/assets/update.ts
|
|
9715
|
-
import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
9716
|
-
import * as path4 from "path";
|
|
9717
|
-
|
|
9718
|
-
// src/lib/tree-sitter/download-utils.ts
|
|
9719
|
-
import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "fs/promises";
|
|
9720
|
-
import * as path3 from "path";
|
|
9721
|
-
|
|
9722
|
-
class DownloadUtils {
|
|
9723
|
-
static hashUrl(url) {
|
|
9724
|
-
let hash = 0;
|
|
9725
|
-
for (let i = 0;i < url.length; i++) {
|
|
9726
|
-
const char = url.charCodeAt(i);
|
|
9727
|
-
hash = (hash << 5) - hash + char;
|
|
9728
|
-
hash = hash & hash;
|
|
9729
|
-
}
|
|
9730
|
-
return Math.abs(hash).toString(16);
|
|
9731
|
-
}
|
|
9732
|
-
static async downloadOrLoad(source, cacheDir, cacheSubdir, fileExtension, useHashForCache = true, filetype) {
|
|
9733
|
-
const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
|
|
9734
|
-
if (isUrl2) {
|
|
9735
|
-
let cacheFileName;
|
|
9736
|
-
if (useHashForCache) {
|
|
9737
|
-
const hash = this.hashUrl(source);
|
|
9738
|
-
cacheFileName = filetype ? `${filetype}-${hash}${fileExtension}` : `${hash}${fileExtension}`;
|
|
9739
|
-
} else {
|
|
9740
|
-
cacheFileName = path3.basename(source);
|
|
9741
|
-
}
|
|
9742
|
-
const cacheFile = path3.join(cacheDir, cacheSubdir, cacheFileName);
|
|
9743
|
-
await mkdir2(path3.dirname(cacheFile), { recursive: true });
|
|
9744
|
-
try {
|
|
9745
|
-
const cachedContent = await readFile(cacheFile);
|
|
9746
|
-
if (cachedContent.byteLength > 0) {
|
|
9747
|
-
console.log(`Loaded from cache: ${cacheFile} (${source})`);
|
|
9748
|
-
return { content: cachedContent, filePath: cacheFile };
|
|
9749
|
-
}
|
|
9750
|
-
} catch (error) {}
|
|
9751
|
-
try {
|
|
9752
|
-
console.log(`Downloading from URL: ${source}`);
|
|
9753
|
-
const response = await fetch(source);
|
|
9754
|
-
if (!response.ok) {
|
|
9755
|
-
return { error: `Failed to fetch from ${source}: ${response.statusText}` };
|
|
9756
|
-
}
|
|
9757
|
-
const content = Buffer.from(await response.arrayBuffer());
|
|
9758
|
-
try {
|
|
9759
|
-
await writeFile2(cacheFile, Buffer.from(content));
|
|
9760
|
-
console.log(`Cached: ${source}`);
|
|
9761
|
-
} catch (cacheError) {
|
|
9762
|
-
console.warn(`Failed to cache: ${cacheError}`);
|
|
9763
|
-
}
|
|
9764
|
-
return { content, filePath: cacheFile };
|
|
9765
|
-
} catch (error) {
|
|
9766
|
-
return { error: `Error downloading from ${source}: ${error}` };
|
|
9767
|
-
}
|
|
9768
|
-
} else {
|
|
9769
|
-
try {
|
|
9770
|
-
console.log(`Loading from local path: ${source}`);
|
|
9771
|
-
const content = await readFile(source);
|
|
9772
|
-
return { content, filePath: source };
|
|
9773
|
-
} catch (error) {
|
|
9774
|
-
return { error: `Error loading from local path ${source}: ${error}` };
|
|
9775
|
-
}
|
|
9776
|
-
}
|
|
9777
|
-
}
|
|
9778
|
-
static async downloadToPath(source, targetPath) {
|
|
9779
|
-
const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
|
|
9780
|
-
await mkdir2(path3.dirname(targetPath), { recursive: true });
|
|
9781
|
-
if (isUrl2) {
|
|
9782
|
-
try {
|
|
9783
|
-
console.log(`Downloading from URL: ${source}`);
|
|
9784
|
-
const response = await fetch(source);
|
|
9785
|
-
if (!response.ok) {
|
|
9786
|
-
return { error: `Failed to fetch from ${source}: ${response.statusText}` };
|
|
9787
|
-
}
|
|
9788
|
-
const content = Buffer.from(await response.arrayBuffer());
|
|
9789
|
-
await writeFile2(targetPath, Buffer.from(content));
|
|
9790
|
-
console.log(`Downloaded: ${source} -> ${targetPath}`);
|
|
9791
|
-
return { content, filePath: targetPath };
|
|
9792
|
-
} catch (error) {
|
|
9793
|
-
return { error: `Error downloading from ${source}: ${error}` };
|
|
9794
|
-
}
|
|
9795
|
-
} else {
|
|
9796
|
-
try {
|
|
9797
|
-
console.log(`Copying from local path: ${source}`);
|
|
9798
|
-
const content = await readFile(source);
|
|
9799
|
-
await writeFile2(targetPath, Buffer.from(content));
|
|
9800
|
-
return { content, filePath: targetPath };
|
|
9801
|
-
} catch (error) {
|
|
9802
|
-
return { error: `Error copying from local path ${source}: ${error}` };
|
|
9803
|
-
}
|
|
9804
|
-
}
|
|
9805
|
-
}
|
|
9806
|
-
static async fetchHighlightQueries(sources, cacheDir, filetype) {
|
|
9807
|
-
const queryPromises = sources.map((source) => this.fetchHighlightQuery(source, cacheDir, filetype));
|
|
9808
|
-
const queryResults = await Promise.all(queryPromises);
|
|
9809
|
-
const validQueries = queryResults.filter((query) => query.trim().length > 0);
|
|
9810
|
-
return validQueries.join(`
|
|
9811
|
-
`);
|
|
9812
|
-
}
|
|
9813
|
-
static async fetchHighlightQuery(source, cacheDir, filetype) {
|
|
9814
|
-
const result = await this.downloadOrLoad(source, cacheDir, "queries", ".scm", true, filetype);
|
|
9815
|
-
if (result.error) {
|
|
9816
|
-
console.error(`Error fetching highlight query from ${source}:`, result.error);
|
|
9817
|
-
return "";
|
|
9818
|
-
}
|
|
9819
|
-
if (result.content) {
|
|
9820
|
-
return new TextDecoder().decode(result.content);
|
|
9821
|
-
}
|
|
9822
|
-
return "";
|
|
9823
|
-
}
|
|
9824
|
-
}
|
|
9825
|
-
|
|
9826
|
-
// src/lib/tree-sitter/assets/update.ts
|
|
9827
|
-
import { readdir } from "fs/promises";
|
|
9828
|
-
var __dirname = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets";
|
|
9829
|
-
function getDefaultOptions() {
|
|
9830
|
-
return {
|
|
9831
|
-
configPath: path4.resolve(__dirname, "../parsers-config"),
|
|
9832
|
-
assetsDir: path4.resolve(__dirname),
|
|
9833
|
-
outputPath: path4.resolve(__dirname, "../default-parsers.ts")
|
|
9834
|
-
};
|
|
9835
|
-
}
|
|
9836
|
-
async function loadConfig(configPath) {
|
|
9837
|
-
let ext = path4.extname(configPath);
|
|
9838
|
-
let resolvedConfigPath = configPath;
|
|
9839
|
-
if (ext === "") {
|
|
9840
|
-
const files = await readdir(path4.dirname(configPath));
|
|
9841
|
-
const file = files.find((file2) => file2.startsWith(path4.basename(configPath)) && (file2.endsWith(".json") || file2.endsWith(".ts") || file2.endsWith(".js")));
|
|
9842
|
-
if (!file) {
|
|
9843
|
-
throw new Error(`No config file found for ${configPath}`);
|
|
9844
|
-
}
|
|
9845
|
-
resolvedConfigPath = path4.join(path4.dirname(configPath), file);
|
|
9846
|
-
ext = path4.extname(resolvedConfigPath);
|
|
9847
|
-
}
|
|
9848
|
-
if (ext === ".json") {
|
|
9849
|
-
const configContent = await readFile2(resolvedConfigPath, "utf-8");
|
|
9850
|
-
return JSON.parse(configContent);
|
|
9851
|
-
} else if (ext === ".ts" || ext === ".js") {
|
|
9852
|
-
const { default: configContent } = await import(resolvedConfigPath);
|
|
9853
|
-
return configContent;
|
|
9854
|
-
}
|
|
9855
|
-
throw new Error(`Unsupported config file extension: ${ext}`);
|
|
9856
|
-
}
|
|
9857
|
-
async function downloadLanguage(filetype, languageUrl, assetsDir, outputPath) {
|
|
9858
|
-
const languageDir = path4.join(assetsDir, filetype);
|
|
9859
|
-
const languageFilename = path4.basename(languageUrl);
|
|
9860
|
-
const languagePath = path4.join(languageDir, languageFilename);
|
|
9861
|
-
const result = await DownloadUtils.downloadToPath(languageUrl, languagePath);
|
|
9862
|
-
if (result.error) {
|
|
9863
|
-
throw new Error(`Failed to download language for ${filetype}: ${result.error}`);
|
|
9864
|
-
}
|
|
9865
|
-
return "./" + path4.relative(path4.dirname(outputPath), languagePath);
|
|
9866
|
-
}
|
|
9867
|
-
async function downloadAndCombineQueries(filetype, queryUrls, assetsDir, outputPath, queryType, configPath) {
|
|
9868
|
-
const queriesDir = path4.join(assetsDir, filetype);
|
|
9869
|
-
const queryPath = path4.join(queriesDir, `${queryType}.scm`);
|
|
9870
|
-
const queryContents = [];
|
|
9871
|
-
for (let i = 0;i < queryUrls.length; i++) {
|
|
9872
|
-
const queryUrl = queryUrls[i];
|
|
9873
|
-
if (queryUrl.startsWith("./")) {
|
|
9874
|
-
console.log(` Using local query ${i + 1}/${queryUrls.length}: ${queryUrl}`);
|
|
9875
|
-
try {
|
|
9876
|
-
const localPath = path4.resolve(path4.dirname(configPath), queryUrl);
|
|
9877
|
-
const content = await readFile2(localPath, "utf-8");
|
|
9878
|
-
if (content.trim()) {
|
|
9879
|
-
queryContents.push(content);
|
|
9880
|
-
console.log(` \u2713 Loaded ${content.split(`
|
|
9881
|
-
`).length} lines from local file`);
|
|
9882
|
-
}
|
|
9883
|
-
} catch (error) {
|
|
9884
|
-
console.warn(`Failed to read local query from ${queryUrl}: ${error}`);
|
|
9885
|
-
continue;
|
|
9886
|
-
}
|
|
9887
|
-
} else {
|
|
9888
|
-
console.log(` Downloading query ${i + 1}/${queryUrls.length}: ${queryUrl}`);
|
|
9889
|
-
try {
|
|
9890
|
-
const response = await fetch(queryUrl);
|
|
9891
|
-
if (!response.ok) {
|
|
9892
|
-
console.warn(`Failed to download query from ${queryUrl}: ${response.statusText}`);
|
|
9893
|
-
continue;
|
|
9894
|
-
}
|
|
9895
|
-
const content = await response.text();
|
|
9896
|
-
if (content.trim()) {
|
|
9897
|
-
queryContents.push(`; Query from: ${queryUrl}
|
|
9898
|
-
${content}`);
|
|
9899
|
-
console.log(` \u2713 Downloaded ${content.split(`
|
|
9900
|
-
`).length} lines`);
|
|
9901
|
-
}
|
|
9902
|
-
} catch (error) {
|
|
9903
|
-
console.warn(`Failed to download query from ${queryUrl}: ${error}`);
|
|
9904
|
-
continue;
|
|
9905
|
-
}
|
|
9906
|
-
}
|
|
9907
|
-
}
|
|
9908
|
-
const combinedContent = queryContents.join(`
|
|
9909
|
-
|
|
9910
|
-
`);
|
|
9911
|
-
await writeFile3(queryPath, combinedContent, "utf-8");
|
|
9912
|
-
console.log(` Combined ${queryContents.length} queries into ${queryPath}`);
|
|
9913
|
-
return "./" + path4.relative(path4.dirname(outputPath), queryPath);
|
|
9914
|
-
}
|
|
9915
|
-
async function generateDefaultParsersFile(parsers, outputPath) {
|
|
9916
|
-
const assetPaths = parsers.map((parser) => {
|
|
9917
|
-
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
|
|
9918
|
-
const lines = [
|
|
9919
|
-
`const ${safeFiletype}_highlights = await resolveBundledFilePath(`,
|
|
9920
|
-
` () => import("${parser.highlightsPath}" as string, { with: { type: "file" } }),`,
|
|
9921
|
-
` "${parser.highlightsPath}",`,
|
|
9922
|
-
` import.meta.url,`,
|
|
9923
|
-
`)`,
|
|
9924
|
-
`const ${safeFiletype}_language = await resolveBundledFilePath(`,
|
|
9925
|
-
` () => import("${parser.languagePath}" as string, { with: { type: "file" } }),`,
|
|
9926
|
-
` "${parser.languagePath}",`,
|
|
9927
|
-
` import.meta.url,`,
|
|
9928
|
-
`)`
|
|
9929
|
-
];
|
|
9930
|
-
if (parser.injectionsPath) {
|
|
9931
|
-
lines.push(`const ${safeFiletype}_injections = await resolveBundledFilePath(`, ` () => import("${parser.injectionsPath}" as string, { with: { type: "file" } }),`, ` "${parser.injectionsPath}",`, ` import.meta.url,`, `)`);
|
|
9932
|
-
}
|
|
9933
|
-
return lines.join(`
|
|
9934
|
-
`);
|
|
9935
|
-
}).join(`
|
|
9936
|
-
`);
|
|
9937
|
-
const parserDefinitions = parsers.map((parser) => {
|
|
9938
|
-
const safeFiletype = parser.filetype.replace(/[^a-zA-Z0-9]/g, "_");
|
|
9939
|
-
const queriesLines = [` highlights: [${safeFiletype}_highlights],`];
|
|
9940
|
-
if (parser.injectionsPath) {
|
|
9941
|
-
queriesLines.push(` injections: [${safeFiletype}_injections],`);
|
|
9942
|
-
}
|
|
9943
|
-
const injectionMappingLine = parser.injectionMapping ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},` : "";
|
|
9944
|
-
const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : "";
|
|
9945
|
-
return ` {
|
|
9946
|
-
filetype: "${parser.filetype}",
|
|
9947
|
-
${aliasesLine ? aliasesLine + `
|
|
9948
|
-
` : ""} queries: {
|
|
9949
|
-
${queriesLines.join(`
|
|
9950
|
-
`)}
|
|
9951
|
-
},
|
|
9952
|
-
wasm: ${safeFiletype}_language,${injectionMappingLine ? `
|
|
9953
|
-
` + injectionMappingLine : ""}
|
|
9954
|
-
}`;
|
|
9955
|
-
}).join(`,
|
|
9956
|
-
`);
|
|
9957
|
-
const fileContent = `// This file is generated by assets/update.ts - DO NOT EDIT MANUALLY
|
|
9958
|
-
// Run 'bun assets/update.ts' to regenerate this file
|
|
9959
|
-
// Last generated: ${new Date().toISOString()}
|
|
9960
|
-
|
|
9961
|
-
import type { FiletypeParserOptions } from "./types.js"
|
|
9962
|
-
import { resolveBundledFilePath } from "../../platform/runtime.js"
|
|
9963
|
-
|
|
9964
|
-
// Cached parsers to avoid re-resolving paths on every call
|
|
9965
|
-
let _cachedParsers: Promise<FiletypeParserOptions[]> | undefined
|
|
9966
|
-
|
|
9967
|
-
export function getParsers(): Promise<FiletypeParserOptions[]> {
|
|
9968
|
-
if (!_cachedParsers) {
|
|
9969
|
-
_cachedParsers = loadParsers()
|
|
9970
|
-
}
|
|
9971
|
-
return _cachedParsers
|
|
9972
|
-
}
|
|
9973
|
-
|
|
9974
|
-
async function loadParsers(): Promise<FiletypeParserOptions[]> {
|
|
9975
|
-
${assetPaths}
|
|
9976
|
-
|
|
9977
|
-
return [
|
|
9978
|
-
${parserDefinitions},
|
|
9979
|
-
]
|
|
9980
|
-
}
|
|
9981
|
-
`;
|
|
9982
|
-
await mkdir3(path4.dirname(outputPath), { recursive: true });
|
|
9983
|
-
await writeFile3(outputPath, fileContent, "utf-8");
|
|
9984
|
-
console.log(`Generated ${path4.basename(outputPath)} with ${parsers.length} parsers`);
|
|
9985
|
-
}
|
|
9986
|
-
async function main(options) {
|
|
9987
|
-
const opts = { ...getDefaultOptions(), ...options };
|
|
9988
|
-
try {
|
|
9989
|
-
console.log("Loading parsers configuration...");
|
|
9990
|
-
console.log(` Config: ${opts.configPath}`);
|
|
9991
|
-
console.log(` Assets Dir: ${opts.assetsDir}`);
|
|
9992
|
-
console.log(` Output: ${opts.outputPath}`);
|
|
9993
|
-
const config = await loadConfig(opts.configPath);
|
|
9994
|
-
console.log(`Found ${config.parsers.length} parsers to process`);
|
|
9995
|
-
const generatedParsers = [];
|
|
9996
|
-
for (const parser of config.parsers) {
|
|
9997
|
-
console.log(`Processing ${parser.filetype}...`);
|
|
9998
|
-
console.log(` Downloading language...`);
|
|
9999
|
-
const languagePath = await downloadLanguage(parser.filetype, parser.wasm, opts.assetsDir, opts.outputPath);
|
|
10000
|
-
console.log(` Downloading ${parser.queries.highlights.length} highlight queries...`);
|
|
10001
|
-
const highlightsPath = await downloadAndCombineQueries(parser.filetype, parser.queries.highlights, opts.assetsDir, opts.outputPath, "highlights", opts.configPath);
|
|
10002
|
-
let injectionsPath;
|
|
10003
|
-
if (parser.queries.injections && parser.queries.injections.length > 0) {
|
|
10004
|
-
console.log(` Downloading ${parser.queries.injections.length} injection queries...`);
|
|
10005
|
-
injectionsPath = await downloadAndCombineQueries(parser.filetype, parser.queries.injections, opts.assetsDir, opts.outputPath, "injections", opts.configPath);
|
|
10006
|
-
}
|
|
10007
|
-
generatedParsers.push({
|
|
10008
|
-
filetype: parser.filetype,
|
|
10009
|
-
aliases: parser.aliases,
|
|
10010
|
-
languagePath,
|
|
10011
|
-
highlightsPath,
|
|
10012
|
-
injectionsPath,
|
|
10013
|
-
injectionMapping: parser.injectionMapping
|
|
10014
|
-
});
|
|
10015
|
-
console.log(` \u2713 Completed ${parser.filetype}`);
|
|
10016
|
-
}
|
|
10017
|
-
console.log("Generating output file...");
|
|
10018
|
-
await generateDefaultParsersFile(generatedParsers, opts.outputPath);
|
|
10019
|
-
console.log("\u2705 Update completed successfully!");
|
|
10020
|
-
} catch (error) {
|
|
10021
|
-
console.error("\u274C Update failed:", error);
|
|
10022
|
-
process.exit(1);
|
|
10023
|
-
}
|
|
10024
|
-
}
|
|
10025
|
-
if (false) {}
|
|
10026
|
-
|
|
10027
9713
|
// src/lib/tree-sitter/index.ts
|
|
10028
9714
|
function getTreeSitterClient() {
|
|
10029
9715
|
const dataPathsManager = getDataPaths();
|
|
@@ -10867,7 +10553,7 @@ class TerminalPalette {
|
|
|
10867
10553
|
const out = this.stdout;
|
|
10868
10554
|
if (!out.isTTY || !this.stdin.isTTY)
|
|
10869
10555
|
return false;
|
|
10870
|
-
return new Promise((
|
|
10556
|
+
return new Promise((resolve3) => {
|
|
10871
10557
|
const session = this.createQuerySession();
|
|
10872
10558
|
let buffer = "";
|
|
10873
10559
|
let settled = false;
|
|
@@ -10876,7 +10562,7 @@ class TerminalPalette {
|
|
|
10876
10562
|
return;
|
|
10877
10563
|
settled = true;
|
|
10878
10564
|
session.cleanup();
|
|
10879
|
-
|
|
10565
|
+
resolve3(supported);
|
|
10880
10566
|
};
|
|
10881
10567
|
const onData = (chunk) => {
|
|
10882
10568
|
buffer += chunk.toString();
|
|
@@ -10899,7 +10585,7 @@ class TerminalPalette {
|
|
|
10899
10585
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10900
10586
|
return results;
|
|
10901
10587
|
}
|
|
10902
|
-
return new Promise((
|
|
10588
|
+
return new Promise((resolve3) => {
|
|
10903
10589
|
const session = this.createQuerySession();
|
|
10904
10590
|
let buffer = "";
|
|
10905
10591
|
let idleTimer = null;
|
|
@@ -10909,7 +10595,7 @@ class TerminalPalette {
|
|
|
10909
10595
|
return;
|
|
10910
10596
|
settled = true;
|
|
10911
10597
|
session.cleanup();
|
|
10912
|
-
|
|
10598
|
+
resolve3(results);
|
|
10913
10599
|
};
|
|
10914
10600
|
const onData = (chunk) => {
|
|
10915
10601
|
buffer += chunk.toString();
|
|
@@ -10952,7 +10638,7 @@ class TerminalPalette {
|
|
|
10952
10638
|
if (!out.isTTY || !this.stdin.isTTY) {
|
|
10953
10639
|
return results;
|
|
10954
10640
|
}
|
|
10955
|
-
return new Promise((
|
|
10641
|
+
return new Promise((resolve3) => {
|
|
10956
10642
|
const session = this.createQuerySession();
|
|
10957
10643
|
let buffer = "";
|
|
10958
10644
|
let idleTimer = null;
|
|
@@ -10962,7 +10648,7 @@ class TerminalPalette {
|
|
|
10962
10648
|
return;
|
|
10963
10649
|
settled = true;
|
|
10964
10650
|
session.cleanup();
|
|
10965
|
-
|
|
10651
|
+
resolve3(results);
|
|
10966
10652
|
};
|
|
10967
10653
|
const onData = (chunk) => {
|
|
10968
10654
|
buffer += chunk.toString();
|
|
@@ -11267,11 +10953,11 @@ function toBunPointer(pointer) {
|
|
|
11267
10953
|
}
|
|
11268
10954
|
function createBunBackend(bun2) {
|
|
11269
10955
|
return {
|
|
11270
|
-
dlopen(
|
|
11271
|
-
if (
|
|
10956
|
+
dlopen(path3, symbols) {
|
|
10957
|
+
if (path3 === null) {
|
|
11272
10958
|
throw new Error(BUN_DLOPEN_NULL);
|
|
11273
10959
|
}
|
|
11274
|
-
const library = bun2.dlopen(
|
|
10960
|
+
const library = bun2.dlopen(path3, normalizeBunDefinitions(symbols));
|
|
11275
10961
|
const callbacks = new Set;
|
|
11276
10962
|
let closed = false;
|
|
11277
10963
|
return {
|
|
@@ -11307,8 +10993,8 @@ function createBunBackend(bun2) {
|
|
|
11307
10993
|
}
|
|
11308
10994
|
function createNodeBackend(nodeFfi) {
|
|
11309
10995
|
return {
|
|
11310
|
-
dlopen(
|
|
11311
|
-
const { lib, functions } = nodeFfi.dlopen(toNodeLibraryPath(
|
|
10996
|
+
dlopen(path3, symbols) {
|
|
10997
|
+
const { lib, functions } = nodeFfi.dlopen(toNodeLibraryPath(path3), normalizeNodeDefinitions(symbols));
|
|
11312
10998
|
const callbacks = new Set;
|
|
11313
10999
|
let closed = false;
|
|
11314
11000
|
let libraryClosed = false;
|
|
@@ -11367,8 +11053,8 @@ function createNodeBackend(nodeFfi) {
|
|
|
11367
11053
|
}
|
|
11368
11054
|
};
|
|
11369
11055
|
}
|
|
11370
|
-
function toNodeLibraryPath(
|
|
11371
|
-
return
|
|
11056
|
+
function toNodeLibraryPath(path3) {
|
|
11057
|
+
return path3 instanceof URL ? fileURLToPath2(path3) : path3;
|
|
11372
11058
|
}
|
|
11373
11059
|
function normalizeNodeDefinitions(definitions) {
|
|
11374
11060
|
return Object.fromEntries(Object.entries(definitions).map(([name, definition]) => [name, normalizeNodeDefinition(definition)]));
|
|
@@ -14586,8 +14272,8 @@ class FFIRenderLib {
|
|
|
14586
14272
|
textBufferAppendFromMemId(buffer, memId) {
|
|
14587
14273
|
this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
|
|
14588
14274
|
}
|
|
14589
|
-
textBufferLoadFile(buffer,
|
|
14590
|
-
const pathBytes = this.encoder.encode(
|
|
14275
|
+
textBufferLoadFile(buffer, path3) {
|
|
14276
|
+
const pathBytes = this.encoder.encode(path3);
|
|
14591
14277
|
return this.opentui.symbols.textBufferLoadFile(buffer, pathBytes, pathBytes.length);
|
|
14592
14278
|
}
|
|
14593
14279
|
textBufferSetStyledText(buffer, chunks) {
|
|
@@ -15574,11 +15260,11 @@ class TextBuffer {
|
|
|
15574
15260
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
15575
15261
|
this._lineInfo = undefined;
|
|
15576
15262
|
}
|
|
15577
|
-
loadFile(
|
|
15263
|
+
loadFile(path3) {
|
|
15578
15264
|
this.guard();
|
|
15579
|
-
const success = this.lib.textBufferLoadFile(this.bufferPtr,
|
|
15265
|
+
const success = this.lib.textBufferLoadFile(this.bufferPtr, path3);
|
|
15580
15266
|
if (!success) {
|
|
15581
|
-
throw new Error(`Failed to load file: ${
|
|
15267
|
+
throw new Error(`Failed to load file: ${path3}`);
|
|
15582
15268
|
}
|
|
15583
15269
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
15584
15270
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
@@ -19364,7 +19050,7 @@ class TextRenderable extends TextBufferRenderable {
|
|
|
19364
19050
|
import { EventEmitter as EventEmitter8 } from "events";
|
|
19365
19051
|
import { Console } from "console";
|
|
19366
19052
|
import fs from "fs";
|
|
19367
|
-
import
|
|
19053
|
+
import path3 from "path";
|
|
19368
19054
|
import util2 from "util";
|
|
19369
19055
|
|
|
19370
19056
|
// src/lib/output.capture.ts
|
|
@@ -20478,7 +20164,7 @@ class TerminalConsole extends EventEmitter8 {
|
|
|
20478
20164
|
try {
|
|
20479
20165
|
const timestamp = Date.now();
|
|
20480
20166
|
const filename = `_console_${timestamp}.log`;
|
|
20481
|
-
const filepath =
|
|
20167
|
+
const filepath = path3.join(process.cwd(), filename);
|
|
20482
20168
|
const allLogEntries = [...this._allLogEntries, ...terminalConsoleCache.cachedLogs];
|
|
20483
20169
|
const logLines = [];
|
|
20484
20170
|
for (const [date, level, args, callerInfo] of allLogEntries) {
|
|
@@ -21648,16 +21334,16 @@ class RendererThemeMode {
|
|
|
21648
21334
|
if (this._themeMode !== null || isDestroyed || timeoutMs === 0) {
|
|
21649
21335
|
return Promise.resolve(this._themeMode);
|
|
21650
21336
|
}
|
|
21651
|
-
return new Promise((
|
|
21337
|
+
return new Promise((resolve3) => {
|
|
21652
21338
|
const waiter = {
|
|
21653
|
-
resolve:
|
|
21339
|
+
resolve: resolve3,
|
|
21654
21340
|
timeoutHandle: null
|
|
21655
21341
|
};
|
|
21656
21342
|
if (timeoutMs > 0) {
|
|
21657
21343
|
waiter.timeoutHandle = this.clock.setTimeout(() => {
|
|
21658
21344
|
this.waiters.delete(waiter);
|
|
21659
21345
|
waiter.timeoutHandle = null;
|
|
21660
|
-
|
|
21346
|
+
resolve3(this._themeMode);
|
|
21661
21347
|
}, timeoutMs);
|
|
21662
21348
|
}
|
|
21663
21349
|
this.waiters.add(waiter);
|
|
@@ -22039,7 +21725,7 @@ var rendererTracker = singleton("RendererTracker", () => {
|
|
|
22039
21725
|
});
|
|
22040
21726
|
async function createCliRenderer(config = {}) {
|
|
22041
21727
|
if (process.argv.includes("--delay-start")) {
|
|
22042
|
-
await new Promise((
|
|
21728
|
+
await new Promise((resolve3) => setTimeout(resolve3, 5000));
|
|
22043
21729
|
}
|
|
22044
21730
|
const stdin = config.stdin || process.stdin;
|
|
22045
21731
|
const stdout = config.stdout || process.stdout;
|
|
@@ -22601,8 +22287,8 @@ Captured external output:
|
|
|
22601
22287
|
if (!this.isIdleNow())
|
|
22602
22288
|
return;
|
|
22603
22289
|
const resolvers = this.idleResolvers.splice(0);
|
|
22604
|
-
for (const
|
|
22605
|
-
|
|
22290
|
+
for (const resolve3 of resolvers) {
|
|
22291
|
+
resolve3();
|
|
22606
22292
|
}
|
|
22607
22293
|
}
|
|
22608
22294
|
idle() {
|
|
@@ -22610,8 +22296,8 @@ Captured external output:
|
|
|
22610
22296
|
return Promise.resolve();
|
|
22611
22297
|
if (this.isIdleNow())
|
|
22612
22298
|
return Promise.resolve();
|
|
22613
|
-
return new Promise((
|
|
22614
|
-
this.idleResolvers.push(
|
|
22299
|
+
return new Promise((resolve3) => {
|
|
22300
|
+
this.idleResolvers.push(resolve3);
|
|
22615
22301
|
});
|
|
22616
22302
|
}
|
|
22617
22303
|
get resolution() {
|
|
@@ -22901,7 +22587,7 @@ Captured external output:
|
|
|
22901
22587
|
return pending;
|
|
22902
22588
|
};
|
|
22903
22589
|
const waitForPendingHighlights = async (pending, timeoutMs) => {
|
|
22904
|
-
await new Promise((
|
|
22590
|
+
await new Promise((resolve3, reject) => {
|
|
22905
22591
|
let settled = false;
|
|
22906
22592
|
const timeoutHandle = renderer.clock.setTimeout(() => {
|
|
22907
22593
|
if (settled) {
|
|
@@ -22916,7 +22602,7 @@ Captured external output:
|
|
|
22916
22602
|
}
|
|
22917
22603
|
settled = true;
|
|
22918
22604
|
renderer.clock.clearTimeout(timeoutHandle);
|
|
22919
|
-
|
|
22605
|
+
resolve3();
|
|
22920
22606
|
}, (error) => {
|
|
22921
22607
|
if (settled) {
|
|
22922
22608
|
return;
|
|
@@ -24800,16 +24486,16 @@ Captured external output:
|
|
|
24800
24486
|
return;
|
|
24801
24487
|
const resolvers = [...this.xtVersionWaiters];
|
|
24802
24488
|
this.xtVersionWaiters.clear();
|
|
24803
|
-
for (const
|
|
24804
|
-
|
|
24489
|
+
for (const resolve3 of resolvers) {
|
|
24490
|
+
resolve3();
|
|
24805
24491
|
}
|
|
24806
24492
|
}
|
|
24807
24493
|
waitForXtVersion() {
|
|
24808
24494
|
if (this.capabilityTimeoutId === null || this._capabilities?.terminal?.from_xtversion) {
|
|
24809
24495
|
return Promise.resolve();
|
|
24810
24496
|
}
|
|
24811
|
-
return new Promise((
|
|
24812
|
-
this.xtVersionWaiters.add(
|
|
24497
|
+
return new Promise((resolve3) => {
|
|
24498
|
+
this.xtVersionWaiters.add(resolve3);
|
|
24813
24499
|
});
|
|
24814
24500
|
}
|
|
24815
24501
|
shouldSyncNativePaletteState() {
|
|
@@ -24895,7 +24581,7 @@ Captured external output:
|
|
|
24895
24581
|
}
|
|
24896
24582
|
}
|
|
24897
24583
|
|
|
24898
|
-
export { __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, 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, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, stringWidth2 as stringWidth, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype,
|
|
24584
|
+
export { __export, __require, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, normalizeIndexedColorIndex, ansi256IndexToRgb, RGBA, normalizeColorValue, hexToRgb, rgbToHex, hsvToRgb, parseColor, 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, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, stringWidth2 as stringWidth, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, normalizeTerminalPalette, buildTerminalPaletteSignature, decodePasteBytes, stripAnsiSequences, detectLinks, toArrayBuffer, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, TextBufferView, EditBuffer, EditorView, convertThemeToStyles, SyntaxStyle, ANSI, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, calculateRenderGeometry, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
24899
24585
|
|
|
24900
|
-
//# debugId=
|
|
24901
|
-
//# sourceMappingURL=index-
|
|
24586
|
+
//# debugId=8F137D6551AE123964756E2164756E21
|
|
24587
|
+
//# sourceMappingURL=index-ysvpktsp.js.map
|