@elench/testkit 0.1.113 → 0.1.115
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/lib/cli/assistant/app.mjs +4 -2
- package/lib/cli/assistant/session.mjs +5 -1
- package/lib/cli/assistant/state.mjs +1 -2
- package/lib/cli/components/blocks/run-tree.mjs +7 -2
- package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
- package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
- package/lib/playwright/index.d.ts +1 -0
- package/lib/playwright/index.mjs +1 -0
- package/lib/runner/default-runtime-runner.mjs +5 -28
- package/lib/runner/lifecycle.mjs +2 -51
- package/lib/runner/managed-processes.mjs +2 -1
- package/lib/runner/playwright-config.mjs +13 -1
- package/lib/runner/playwright-runner.mjs +85 -15
- package/lib/runner/processes.mjs +59 -3
- package/lib/runner/subprocess.mjs +155 -0
- package/lib/shared/file-timeout.mjs +1 -1
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.mjs +1 -0
- package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
- package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
- package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
- package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
- package/node_modules/@elench/next-analysis/package.json +1 -1
- package/node_modules/@elench/testkit-bridge/package.json +2 -2
- package/node_modules/@elench/testkit-protocol/package.json +1 -1
- package/node_modules/@elench/ts-analysis/package.json +1 -1
- package/node_modules/cli-boxes/index.d.ts +95 -90
- package/node_modules/cli-boxes/index.js +5 -2
- package/node_modules/cli-boxes/package.json +6 -13
- package/node_modules/cli-boxes/readme.md +15 -3
- package/node_modules/cli-truncate/index.d.ts +1 -1
- package/node_modules/cli-truncate/package.json +4 -4
- package/node_modules/cli-truncate/readme.md +1 -0
- package/node_modules/ink/build/apply-styles.js +175 -0
- package/node_modules/ink/build/build-layout.js +77 -0
- package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
- package/node_modules/ink/build/components/App.d.ts +1 -4
- package/node_modules/ink/build/components/App.js +22 -142
- package/node_modules/ink/build/components/App.js.map +1 -1
- package/node_modules/ink/build/components/AppContext.d.ts +3 -23
- package/node_modules/ink/build/components/AppContext.js +4 -7
- package/node_modules/ink/build/components/AppContext.js.map +1 -1
- package/node_modules/ink/build/components/Box.d.ts +3 -16
- package/node_modules/ink/build/components/Color.js +62 -0
- package/node_modules/ink/build/components/Cursor.d.ts +83 -0
- package/node_modules/ink/build/components/Cursor.js +53 -0
- package/node_modules/ink/build/components/Cursor.js.map +1 -0
- package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
- package/node_modules/ink/build/components/ErrorOverview.js +6 -6
- package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
- package/node_modules/ink/build/components/Static.js.map +1 -1
- package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
- package/node_modules/ink/build/components/StdinContext.js +0 -1
- package/node_modules/ink/build/components/StdinContext.js.map +1 -1
- package/node_modules/ink/build/components/Text.d.ts +1 -1
- package/node_modules/ink/build/components/Text.js +1 -1
- package/node_modules/ink/build/components/Text.js.map +1 -1
- package/node_modules/ink/build/components/Transform.d.ts +1 -1
- package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
- package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
- package/node_modules/ink/build/devtools.js +6 -31
- package/node_modules/ink/build/devtools.js.map +1 -1
- package/node_modules/ink/build/dom.d.ts +1 -5
- package/node_modules/ink/build/dom.js +1 -20
- package/node_modules/ink/build/dom.js.map +1 -1
- package/node_modules/ink/build/experimental/apply-style.js +140 -0
- package/node_modules/ink/build/experimental/dom.js +123 -0
- package/node_modules/ink/build/experimental/output.js +91 -0
- package/node_modules/ink/build/experimental/reconciler.js +141 -0
- package/node_modules/ink/build/experimental/renderer.js +81 -0
- package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-app.js +1 -1
- package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-cursor.js +1 -1
- package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
- package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
- package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
- package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-focus.js +4 -5
- package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
- package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-input.js +80 -82
- package/node_modules/ink/build/hooks/use-input.js.map +1 -1
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
- package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stderr.js +1 -1
- package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
- package/node_modules/ink/build/hooks/use-stdin.js +1 -2
- package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
- package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
- package/node_modules/ink/build/hooks/use-stdout.js +1 -1
- package/node_modules/ink/build/hooks/useInput.js +38 -0
- package/node_modules/ink/build/index.d.ts +1 -8
- package/node_modules/ink/build/index.js +0 -4
- package/node_modules/ink/build/index.js.map +1 -1
- package/node_modules/ink/build/ink.d.ts +3 -48
- package/node_modules/ink/build/ink.js +155 -325
- package/node_modules/ink/build/ink.js.map +1 -1
- package/node_modules/ink/build/input-parser.d.ts +1 -4
- package/node_modules/ink/build/input-parser.js +30 -70
- package/node_modules/ink/build/input-parser.js.map +1 -1
- package/node_modules/ink/build/instance.js +205 -0
- package/node_modules/ink/build/layout.d.ts +7 -0
- package/node_modules/ink/build/layout.js +33 -0
- package/node_modules/ink/build/layout.js.map +1 -0
- package/node_modules/ink/build/log-update.d.ts +0 -1
- package/node_modules/ink/build/log-update.js +1 -13
- package/node_modules/ink/build/log-update.js.map +1 -1
- package/node_modules/ink/build/measure-element.d.ts +0 -4
- package/node_modules/ink/build/measure-element.js +0 -4
- package/node_modules/ink/build/measure-element.js.map +1 -1
- package/node_modules/ink/build/options.d.ts +52 -0
- package/node_modules/ink/build/options.js +2 -0
- package/node_modules/ink/build/options.js.map +1 -0
- package/node_modules/ink/build/output.js +0 -25
- package/node_modules/ink/build/output.js.map +1 -1
- package/node_modules/ink/build/parse-keypress.d.ts +3 -1
- package/node_modules/ink/build/parse-keypress.js +17 -19
- package/node_modules/ink/build/parse-keypress.js.map +1 -1
- package/node_modules/ink/build/reconciler.js +27 -46
- package/node_modules/ink/build/reconciler.js.map +1 -1
- package/node_modules/ink/build/render-border.js +18 -29
- package/node_modules/ink/build/render-border.js.map +1 -1
- package/node_modules/ink/build/render-to-string.js +1 -2
- package/node_modules/ink/build/render-to-string.js.map +1 -1
- package/node_modules/ink/build/render.d.ts +2 -57
- package/node_modules/ink/build/render.js +11 -18
- package/node_modules/ink/build/render.js.map +1 -1
- package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
- package/node_modules/ink/build/screen-reader-update.js +38 -0
- package/node_modules/ink/build/screen-reader-update.js.map +1 -0
- package/node_modules/ink/build/styles.d.ts +16 -78
- package/node_modules/ink/build/styles.js +31 -102
- package/node_modules/ink/build/styles.js.map +1 -1
- package/node_modules/ink/build/utils.d.ts +2 -9
- package/node_modules/ink/build/utils.js +3 -18
- package/node_modules/ink/build/utils.js.map +1 -1
- package/node_modules/ink/build/wrap-text.js +0 -7
- package/node_modules/ink/build/wrap-text.js.map +1 -1
- package/node_modules/ink/build/write-synchronized.d.ts +1 -1
- package/node_modules/ink/build/write-synchronized.js +2 -4
- package/node_modules/ink/build/write-synchronized.js.map +1 -1
- package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
- package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
- package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
- package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
- package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
- package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
- package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
- package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
- package/node_modules/ink/package.json +98 -34
- package/node_modules/ink/readme.md +48 -554
- package/node_modules/slice-ansi/index.d.ts +1 -1
- package/node_modules/slice-ansi/index.js +89 -146
- package/node_modules/slice-ansi/package.json +5 -5
- package/node_modules/slice-ansi/readme.md +0 -1
- package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
- package/package.json +11 -10
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
- package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
- package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
- package/node_modules/ink/build/components/AnimationContext.js +0 -13
- package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
- package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
- package/node_modules/ink/build/hooks/use-animation.js +0 -87
- package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
- package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
- package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
- package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
- package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
- package/node_modules/ink/build/hooks/use-paste.js +0 -62
- package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
- package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
- package/node_modules/ink/build/hooks/use-window-size.js +0 -22
- package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
- package/node_modules/wrap-ansi/index.js +0 -468
- /package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/license +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
import { killProcessTree, sleep } from "./processes.mjs";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_TERMINATION_GRACE_MS = 5_000;
|
|
5
|
+
|
|
6
|
+
export function startManagedSubprocess(command, args = [], options = {}) {
|
|
7
|
+
const detached = options.detached ?? process.platform !== "win32";
|
|
8
|
+
return execa(command, args, {
|
|
9
|
+
...options,
|
|
10
|
+
detached,
|
|
11
|
+
reject: false,
|
|
12
|
+
forceKillAfterDelay: options.forceKillAfterDelay ?? DEFAULT_TERMINATION_GRACE_MS,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function settleManagedSubprocess(
|
|
17
|
+
subprocess,
|
|
18
|
+
{
|
|
19
|
+
timeoutMs,
|
|
20
|
+
gracefulSignal = "SIGTERM",
|
|
21
|
+
forceSignal = "SIGKILL",
|
|
22
|
+
terminationGraceMs = DEFAULT_TERMINATION_GRACE_MS,
|
|
23
|
+
} = {}
|
|
24
|
+
) {
|
|
25
|
+
const normalizedTimeoutMs = normalizePositiveInteger(timeoutMs, "timeoutMs");
|
|
26
|
+
const normalizedGraceMs = normalizePositiveInteger(terminationGraceMs, "terminationGraceMs");
|
|
27
|
+
const startedAt = Date.now();
|
|
28
|
+
let timeoutHandle = null;
|
|
29
|
+
let timeoutStarted = false;
|
|
30
|
+
let terminationPromise = null;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const completed = await Promise.race([
|
|
34
|
+
subprocess.then(
|
|
35
|
+
async (result) => {
|
|
36
|
+
if (!timeoutStarted) return { result, timedOut: false, termination: null };
|
|
37
|
+
const termination = terminationPromise ? await terminationPromise : null;
|
|
38
|
+
return { result, timedOut: true, termination };
|
|
39
|
+
},
|
|
40
|
+
async (error) => {
|
|
41
|
+
const result = normalizeSubprocessError(error);
|
|
42
|
+
if (!timeoutStarted) return { result, timedOut: false, termination: null };
|
|
43
|
+
const termination = terminationPromise ? await terminationPromise : null;
|
|
44
|
+
return { result, timedOut: true, termination };
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
new Promise((resolve) => {
|
|
48
|
+
timeoutHandle = setTimeout(async () => {
|
|
49
|
+
timeoutStarted = true;
|
|
50
|
+
terminationPromise = terminateSubprocess(subprocess, {
|
|
51
|
+
gracefulSignal,
|
|
52
|
+
forceSignal,
|
|
53
|
+
terminationGraceMs: normalizedGraceMs,
|
|
54
|
+
});
|
|
55
|
+
const termination = await terminationPromise;
|
|
56
|
+
resolve({
|
|
57
|
+
result: termination.result,
|
|
58
|
+
timedOut: true,
|
|
59
|
+
termination,
|
|
60
|
+
});
|
|
61
|
+
}, normalizedTimeoutMs);
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
...completed,
|
|
67
|
+
durationMs: Date.now() - startedAt,
|
|
68
|
+
};
|
|
69
|
+
} finally {
|
|
70
|
+
if (timeoutHandle) clearTimeout(timeoutHandle);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function terminateSubprocess(
|
|
75
|
+
subprocess,
|
|
76
|
+
{
|
|
77
|
+
gracefulSignal = "SIGTERM",
|
|
78
|
+
forceSignal = "SIGKILL",
|
|
79
|
+
terminationGraceMs = DEFAULT_TERMINATION_GRACE_MS,
|
|
80
|
+
} = {}
|
|
81
|
+
) {
|
|
82
|
+
const normalizedGraceMs = normalizePositiveInteger(terminationGraceMs, "terminationGraceMs");
|
|
83
|
+
const gracefulAt = Date.now();
|
|
84
|
+
killProcessTree(subprocess?.pid, gracefulSignal);
|
|
85
|
+
|
|
86
|
+
const gracefulResult = await waitForSubprocess(subprocess, normalizedGraceMs);
|
|
87
|
+
if (gracefulResult.settled) {
|
|
88
|
+
return {
|
|
89
|
+
gracefulSignal,
|
|
90
|
+
forceSignal: null,
|
|
91
|
+
forced: false,
|
|
92
|
+
durationMs: Date.now() - gracefulAt,
|
|
93
|
+
result: gracefulResult.result,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
killProcessTree(subprocess?.pid, forceSignal);
|
|
98
|
+
const forcedResult = await waitForSubprocess(subprocess, normalizedGraceMs);
|
|
99
|
+
return {
|
|
100
|
+
gracefulSignal,
|
|
101
|
+
forceSignal,
|
|
102
|
+
forced: true,
|
|
103
|
+
durationMs: Date.now() - gracefulAt,
|
|
104
|
+
result: forcedResult.settled
|
|
105
|
+
? forcedResult.result
|
|
106
|
+
: syntheticKilledResult(subprocess, forceSignal),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function waitForSubprocess(subprocess, timeoutMs) {
|
|
111
|
+
if (!subprocess) {
|
|
112
|
+
return { settled: true, result: syntheticKilledResult(null, "SIGKILL") };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const result = await Promise.race([
|
|
116
|
+
subprocess.then(
|
|
117
|
+
(value) => ({ settled: true, result: value }),
|
|
118
|
+
(error) => ({ settled: true, result: normalizeSubprocessError(error) })
|
|
119
|
+
),
|
|
120
|
+
sleep(timeoutMs).then(() => ({ settled: false, result: null })),
|
|
121
|
+
]);
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function syntheticKilledResult(subprocess, signal) {
|
|
126
|
+
return {
|
|
127
|
+
command: subprocess?.command || null,
|
|
128
|
+
escapedCommand: subprocess?.escapedCommand || null,
|
|
129
|
+
exitCode: null,
|
|
130
|
+
signal,
|
|
131
|
+
stdout: "",
|
|
132
|
+
stderr: "",
|
|
133
|
+
timedOut: true,
|
|
134
|
+
failed: true,
|
|
135
|
+
killed: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function normalizeSubprocessError(error) {
|
|
140
|
+
return {
|
|
141
|
+
...error,
|
|
142
|
+
exitCode: error?.exitCode ?? null,
|
|
143
|
+
signal: error?.signal ?? null,
|
|
144
|
+
stdout: error?.stdout || "",
|
|
145
|
+
stderr: error?.stderr || error?.message || "",
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function normalizePositiveInteger(value, label) {
|
|
150
|
+
const normalized = Number(value);
|
|
151
|
+
if (!Number.isInteger(normalized) || normalized <= 0) {
|
|
152
|
+
throw new Error(`${label} must be a positive integer.`);
|
|
153
|
+
}
|
|
154
|
+
return normalized;
|
|
155
|
+
}
|
|
@@ -79,7 +79,7 @@ export function formatFileTimeoutBudgetError(fileTimeoutSeconds) {
|
|
|
79
79
|
fileTimeoutSeconds,
|
|
80
80
|
"fileTimeoutSeconds"
|
|
81
81
|
);
|
|
82
|
-
return `
|
|
82
|
+
return `Test file exceeded the ${normalizedFileTimeoutSeconds}s wall-clock timeout`;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function parsePositiveInteger(value, label) {
|
package/lib/ui/index.d.ts
CHANGED
package/lib/ui/index.mjs
CHANGED
|
@@ -231,11 +231,6 @@ This automatically figures out the least amount of escape codes necessary to ach
|
|
|
231
231
|
Placeholder for next release:
|
|
232
232
|
### __WORK IN PROGRESS__
|
|
233
233
|
-->
|
|
234
|
-
### 0.3.0 (2026-02-20)
|
|
235
|
-
|
|
236
|
-
- Fix: preserve non-hyperlink OSC sequences when tokenizing (#54)
|
|
237
|
-
- Fix: support ST-terminated OSC hyperlinks (#53)
|
|
238
|
-
|
|
239
234
|
### 0.2.5 (2026-02-11)
|
|
240
235
|
|
|
241
236
|
- Fix: preserve grapheme clusters when tokenizing (#51)
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { AnsiCode } from "./tokenize.js";
|
|
2
|
+
export declare const ESCAPES: Set<number>;
|
|
3
|
+
export declare const CSI: number;
|
|
4
|
+
export declare const OSC: number;
|
|
2
5
|
export declare const endCodesSet: Set<string>;
|
|
6
|
+
export declare const linkCodePrefix = "\u001B]8;";
|
|
7
|
+
export declare const linkCodePrefixCharCodes: number[];
|
|
8
|
+
export declare const linkCodeSuffix = "\u0007";
|
|
9
|
+
export declare const linkCodeSuffixCharCode: number;
|
|
10
|
+
export declare const linkEndCode: string;
|
|
3
11
|
export declare function getLinkStartCode(url: string, params?: Record<string, string>): string;
|
|
4
12
|
export declare function getEndCode(code: string): string;
|
|
5
13
|
export declare function ansiCodesToString(codes: AnsiCode[]): string;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import ansiStyles from "ansi-styles";
|
|
2
|
-
|
|
2
|
+
export const ESCAPES = new Set([27, 155]); // \x1b and \x9b
|
|
3
|
+
export const CSI = "[".codePointAt(0);
|
|
4
|
+
export const OSC = "]".codePointAt(0);
|
|
3
5
|
export const endCodesSet = new Set();
|
|
4
6
|
const endCodesMap = new Map();
|
|
5
7
|
for (const [start, end] of ansiStyles.codes) {
|
|
6
8
|
endCodesSet.add(ansiStyles.color.ansi(end));
|
|
7
9
|
endCodesMap.set(ansiStyles.color.ansi(start), ansiStyles.color.ansi(end));
|
|
8
10
|
}
|
|
11
|
+
export const linkCodePrefix = "\x1B]8;"; // OSC 8 link prefix (params and URL follow)
|
|
12
|
+
export const linkCodePrefixCharCodes = linkCodePrefix.split("").map((char) => char.charCodeAt(0));
|
|
13
|
+
export const linkCodeSuffix = "\x07";
|
|
14
|
+
export const linkCodeSuffixCharCode = linkCodeSuffix.charCodeAt(0);
|
|
15
|
+
export const linkEndCode = `\x1B]8;;${linkCodeSuffix}`;
|
|
9
16
|
export function getLinkStartCode(url, params) {
|
|
10
17
|
const paramsStr = params
|
|
11
18
|
? Object.entries(params)
|
|
@@ -21,13 +28,8 @@ export function getEndCode(code) {
|
|
|
21
28
|
return endCodesMap.get(code);
|
|
22
29
|
// We have a few special cases to handle here:
|
|
23
30
|
// Links:
|
|
24
|
-
if (code.startsWith(linkCodePrefix))
|
|
25
|
-
|
|
26
|
-
return linkEndCodeST;
|
|
27
|
-
if (code.endsWith("\x9C"))
|
|
28
|
-
return linkEndCodeC1ST;
|
|
29
|
-
return linkEndCode; // BEL (\x07)
|
|
30
|
-
}
|
|
31
|
+
if (code.startsWith(linkCodePrefix))
|
|
32
|
+
return linkEndCode;
|
|
31
33
|
code = code.slice(2);
|
|
32
34
|
// 8-bit/24-bit colors:
|
|
33
35
|
if (code.startsWith("38")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansiCodes.js","sourceRoot":"","sources":["../src/ansiCodes.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ansiCodes.js","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I,CAAC;KAC7B;AACF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IAClD,+CAA+C;IAC/C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,eAAe,CAAC,IAAc;IAC7C,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;AAChF,CAAC"}
|
|
@@ -3,14 +3,10 @@ export interface AnsiCode {
|
|
|
3
3
|
code: string;
|
|
4
4
|
endCode: string;
|
|
5
5
|
}
|
|
6
|
-
export interface ControlCode {
|
|
7
|
-
type: "control";
|
|
8
|
-
code: string;
|
|
9
|
-
}
|
|
10
6
|
export interface Char {
|
|
11
7
|
type: "char";
|
|
12
8
|
value: string;
|
|
13
9
|
fullWidth: boolean;
|
|
14
10
|
}
|
|
15
|
-
export type Token = AnsiCode |
|
|
11
|
+
export type Token = AnsiCode | Char;
|
|
16
12
|
export declare function tokenize(str: string, endChar?: number): Token[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import isFullwidthCodePoint from "is-fullwidth-code-point";
|
|
2
|
-
import { getEndCode } from "./ansiCodes.js";
|
|
3
|
-
import { CC_0, CC_9, CC_BEL, CC_BACKSLASH, CC_C1_ST, CC_ESC, CC_M, CC_CSI, CC_OSC, CC_SEMI, ESCAPES, linkCodePrefix, linkCodePrefixCharCodes, } from "./consts.js";
|
|
2
|
+
import { CSI, ESCAPES, getEndCode, linkCodePrefix, linkCodePrefixCharCodes, OSC, } from "./ansiCodes.js";
|
|
4
3
|
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
5
4
|
function isFullwidthGrapheme(grapheme, baseCodePoint) {
|
|
6
5
|
if (isFullwidthCodePoint(baseCodePoint))
|
|
@@ -26,38 +25,15 @@ function parseLinkCode(string, offset) {
|
|
|
26
25
|
if (paramsEndIndex === -1)
|
|
27
26
|
return undefined;
|
|
28
27
|
// This is a link code (with or without the URL part). Find the end of it.
|
|
29
|
-
const endIndex =
|
|
30
|
-
if (endIndex === -1)
|
|
31
|
-
return undefined;
|
|
32
|
-
return string.slice(0, endIndex + 1);
|
|
33
|
-
}
|
|
34
|
-
// HOT PATH: Generic fallback for non-link OSC sequences (window title, notifications, etc.)
|
|
35
|
-
function parseOSCSequence(string, offset) {
|
|
36
|
-
string = string.slice(offset);
|
|
37
|
-
// Find the OSC terminator (starting after "ESC ]")
|
|
38
|
-
const endIndex = findOSCTerminatorIndex(string, 2);
|
|
28
|
+
const endIndex = string.indexOf("\x07", paramsEndIndex + 1);
|
|
39
29
|
if (endIndex === -1)
|
|
40
30
|
return undefined;
|
|
41
31
|
return string.slice(0, endIndex + 1);
|
|
42
32
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
function findOSCTerminatorIndex(string, startIndex) {
|
|
49
|
-
for (let i = startIndex; i < string.length; i++) {
|
|
50
|
-
const ch = string.charCodeAt(i);
|
|
51
|
-
if (ch === CC_BEL)
|
|
52
|
-
return i;
|
|
53
|
-
if (ch === CC_C1_ST)
|
|
54
|
-
return i;
|
|
55
|
-
if (ch === CC_ESC && i + 1 < string.length && string.charCodeAt(i + 1) === CC_BACKSLASH) {
|
|
56
|
-
return i + 1;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return -1;
|
|
60
|
-
}
|
|
33
|
+
const CC_0 = "0".charCodeAt(0);
|
|
34
|
+
const CC_9 = "9".charCodeAt(0);
|
|
35
|
+
const CC_SEMI = ";".charCodeAt(0);
|
|
36
|
+
const CC_M = "m".charCodeAt(0);
|
|
61
37
|
/**
|
|
62
38
|
* Scans through the given string and finds the index of the last character of an SGR sequence
|
|
63
39
|
* like `\x1B[38;2;123;123;123m`. This assumes that the string has been checked to start with `\x1B[`.
|
|
@@ -135,30 +111,18 @@ export function tokenize(str, endChar = Number.POSITIVE_INFINITY) {
|
|
|
135
111
|
let code;
|
|
136
112
|
// Peek the next code point to determine the type of ANSI sequence
|
|
137
113
|
const nextCodePoint = str.codePointAt(index + 1);
|
|
138
|
-
if (nextCodePoint ===
|
|
139
|
-
// ] = operating system commands
|
|
114
|
+
if (nextCodePoint === OSC) {
|
|
115
|
+
// ] = operating system commands, like links
|
|
140
116
|
code = parseLinkCode(str, index);
|
|
141
117
|
if (code) {
|
|
142
|
-
// OSC 8 hyperlinks are paired codes with an endCode
|
|
143
118
|
ret.push({
|
|
144
119
|
type: "ansi",
|
|
145
120
|
code: code,
|
|
146
121
|
endCode: getEndCode(code),
|
|
147
122
|
});
|
|
148
123
|
}
|
|
149
|
-
else {
|
|
150
|
-
// Other OSC sequences (window title, etc.) are self-contained
|
|
151
|
-
// control codes with no endCode.
|
|
152
|
-
code = parseOSCSequence(str, index);
|
|
153
|
-
if (code) {
|
|
154
|
-
ret.push({
|
|
155
|
-
type: "control",
|
|
156
|
-
code: code,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
124
|
}
|
|
161
|
-
else if (nextCodePoint ===
|
|
125
|
+
else if (nextCodePoint === CSI) {
|
|
162
126
|
// [ = control sequence introducer, like SGR sequences [...m
|
|
163
127
|
code = parseSGRSequence(str, index);
|
|
164
128
|
if (code) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenize.js","sourceRoot":"","sources":["../src/tokenize.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"tokenize.js","sourceRoot":"","sources":["../src/tokenize.ts"],"names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ACnC,GAAG,CAAC,IAAI,CAAC;4BACR,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,cAAc;4BACpB,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC;yBACnC,CAAC,CAAC;qBACH;iBACD;aACD;YAED,IAAI,IAAI,EAAE;gBACT,YAAY,GAAG,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;gBACnC,SAAS;aACT;SACD;QAED,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE1D,GAAG,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,SAAS;SACT,CAAC,CAAC;QAEH,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7B,IAAI,OAAO,IAAI,OAAO,EAAE;YACvB,MAAM;SACN;KACD;IAED,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elench/testkit-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.115",
|
|
4
4
|
"description": "Browser bridge helpers for testkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@elench/testkit-protocol": "0.1.
|
|
25
|
+
"@elench/testkit-protocol": "0.1.115"
|
|
26
26
|
},
|
|
27
27
|
"private": false
|
|
28
28
|
}
|
|
@@ -1,108 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
Style of the box border.
|
|
3
|
-
*/
|
|
4
|
-
export type BoxStyle = {
|
|
5
|
-
readonly topLeft: string;
|
|
6
|
-
readonly top: string;
|
|
7
|
-
readonly topRight: string;
|
|
8
|
-
readonly right: string;
|
|
9
|
-
readonly bottomRight: string;
|
|
10
|
-
readonly bottom: string;
|
|
11
|
-
readonly bottomLeft: string;
|
|
12
|
-
readonly left: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
All box styles.
|
|
17
|
-
*/
|
|
18
|
-
export type Boxes = {
|
|
1
|
+
declare namespace cliBoxes {
|
|
19
2
|
/**
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
┌────┐
|
|
23
|
-
│ │
|
|
24
|
-
└────┘
|
|
25
|
-
```
|
|
3
|
+
Style of the box border.
|
|
26
4
|
*/
|
|
27
|
-
|
|
5
|
+
interface BoxStyle {
|
|
6
|
+
readonly topLeft: string;
|
|
7
|
+
readonly top: string;
|
|
8
|
+
readonly topRight: string;
|
|
9
|
+
readonly right: string;
|
|
10
|
+
readonly bottomRight: string;
|
|
11
|
+
readonly bottom: string;
|
|
12
|
+
readonly bottomLeft: string;
|
|
13
|
+
readonly left: string;
|
|
14
|
+
}
|
|
28
15
|
|
|
29
16
|
/**
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
╔════╗
|
|
33
|
-
║ ║
|
|
34
|
-
╚════╝
|
|
35
|
-
```
|
|
17
|
+
All box styles.
|
|
36
18
|
*/
|
|
37
|
-
|
|
19
|
+
interface Boxes {
|
|
20
|
+
/**
|
|
21
|
+
@example
|
|
22
|
+
```
|
|
23
|
+
┌────┐
|
|
24
|
+
│ │
|
|
25
|
+
└────┘
|
|
26
|
+
```
|
|
27
|
+
*/
|
|
28
|
+
readonly single: BoxStyle;
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
/**
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
╔════╗
|
|
34
|
+
║ ║
|
|
35
|
+
╚════╝
|
|
36
|
+
```
|
|
37
|
+
*/
|
|
38
|
+
readonly double: BoxStyle;
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
/**
|
|
41
|
+
@example
|
|
42
|
+
```
|
|
43
|
+
╭────╮
|
|
44
|
+
│ │
|
|
45
|
+
╰────╯
|
|
46
|
+
```
|
|
47
|
+
*/
|
|
48
|
+
readonly round: BoxStyle;
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
/**
|
|
51
|
+
@example
|
|
52
|
+
```
|
|
53
|
+
┏━━━━┓
|
|
54
|
+
┃ ┃
|
|
55
|
+
┗━━━━┛
|
|
56
|
+
```
|
|
57
|
+
*/
|
|
58
|
+
readonly bold: BoxStyle;
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
/**
|
|
61
|
+
@example
|
|
62
|
+
```
|
|
63
|
+
╓────╖
|
|
64
|
+
║ ║
|
|
65
|
+
╙────╜
|
|
66
|
+
```
|
|
67
|
+
*/
|
|
68
|
+
readonly singleDouble: BoxStyle;
|
|
78
69
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
/**
|
|
71
|
+
@example
|
|
72
|
+
```
|
|
73
|
+
╒════╕
|
|
74
|
+
│ │
|
|
75
|
+
╘════╛
|
|
76
|
+
```
|
|
77
|
+
*/
|
|
78
|
+
readonly doubleSingle: BoxStyle;
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
80
|
+
/**
|
|
81
|
+
@example
|
|
82
|
+
```
|
|
83
|
+
+----+
|
|
84
|
+
| |
|
|
85
|
+
+----+
|
|
86
|
+
```
|
|
87
|
+
*/
|
|
88
|
+
readonly classic: BoxStyle;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
@example
|
|
92
|
+
```
|
|
93
|
+
↘↓↓↓↓↙
|
|
94
|
+
→ ←
|
|
95
|
+
↗↑↑↑↑↖
|
|
96
|
+
```
|
|
97
|
+
*/
|
|
98
|
+
readonly arrow: BoxStyle;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
99
101
|
|
|
100
102
|
/**
|
|
101
103
|
Boxes for use in the terminal.
|
|
102
104
|
|
|
103
105
|
@example
|
|
104
106
|
```
|
|
105
|
-
import cliBoxes
|
|
107
|
+
import cliBoxes = require('cli-boxes');
|
|
106
108
|
|
|
107
109
|
console.log(cliBoxes.single);
|
|
108
110
|
// {
|
|
@@ -117,6 +119,9 @@ console.log(cliBoxes.single);
|
|
|
117
119
|
// }
|
|
118
120
|
```
|
|
119
121
|
*/
|
|
120
|
-
declare const cliBoxes: Boxes
|
|
122
|
+
declare const cliBoxes: cliBoxes.Boxes & {
|
|
123
|
+
// TODO: Remove this for the next major release
|
|
124
|
+
default: typeof cliBoxes;
|
|
125
|
+
};
|
|
121
126
|
|
|
122
|
-
export
|
|
127
|
+
export = cliBoxes;
|