@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.
Files changed (196) hide show
  1. package/lib/cli/assistant/app.mjs +4 -2
  2. package/lib/cli/assistant/session.mjs +5 -1
  3. package/lib/cli/assistant/state.mjs +1 -2
  4. package/lib/cli/components/blocks/run-tree.mjs +7 -2
  5. package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
  6. package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
  7. package/lib/playwright/index.d.ts +1 -0
  8. package/lib/playwright/index.mjs +1 -0
  9. package/lib/runner/default-runtime-runner.mjs +5 -28
  10. package/lib/runner/lifecycle.mjs +2 -51
  11. package/lib/runner/managed-processes.mjs +2 -1
  12. package/lib/runner/playwright-config.mjs +13 -1
  13. package/lib/runner/playwright-runner.mjs +85 -15
  14. package/lib/runner/processes.mjs +59 -3
  15. package/lib/runner/subprocess.mjs +155 -0
  16. package/lib/shared/file-timeout.mjs +1 -1
  17. package/lib/ui/index.d.ts +2 -0
  18. package/lib/ui/index.mjs +1 -0
  19. package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
  20. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
  21. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
  22. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
  23. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
  24. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
  25. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
  26. package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
  27. package/node_modules/@elench/next-analysis/package.json +1 -1
  28. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  29. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  30. package/node_modules/@elench/ts-analysis/package.json +1 -1
  31. package/node_modules/cli-boxes/index.d.ts +95 -90
  32. package/node_modules/cli-boxes/index.js +5 -2
  33. package/node_modules/cli-boxes/package.json +6 -13
  34. package/node_modules/cli-boxes/readme.md +15 -3
  35. package/node_modules/cli-truncate/index.d.ts +1 -1
  36. package/node_modules/cli-truncate/package.json +4 -4
  37. package/node_modules/cli-truncate/readme.md +1 -0
  38. package/node_modules/ink/build/apply-styles.js +175 -0
  39. package/node_modules/ink/build/build-layout.js +77 -0
  40. package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
  41. package/node_modules/ink/build/components/App.d.ts +1 -4
  42. package/node_modules/ink/build/components/App.js +22 -142
  43. package/node_modules/ink/build/components/App.js.map +1 -1
  44. package/node_modules/ink/build/components/AppContext.d.ts +3 -23
  45. package/node_modules/ink/build/components/AppContext.js +4 -7
  46. package/node_modules/ink/build/components/AppContext.js.map +1 -1
  47. package/node_modules/ink/build/components/Box.d.ts +3 -16
  48. package/node_modules/ink/build/components/Color.js +62 -0
  49. package/node_modules/ink/build/components/Cursor.d.ts +83 -0
  50. package/node_modules/ink/build/components/Cursor.js +53 -0
  51. package/node_modules/ink/build/components/Cursor.js.map +1 -0
  52. package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
  53. package/node_modules/ink/build/components/ErrorOverview.js +6 -6
  54. package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
  55. package/node_modules/ink/build/components/Static.js.map +1 -1
  56. package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
  57. package/node_modules/ink/build/components/StdinContext.js +0 -1
  58. package/node_modules/ink/build/components/StdinContext.js.map +1 -1
  59. package/node_modules/ink/build/components/Text.d.ts +1 -1
  60. package/node_modules/ink/build/components/Text.js +1 -1
  61. package/node_modules/ink/build/components/Text.js.map +1 -1
  62. package/node_modules/ink/build/components/Transform.d.ts +1 -1
  63. package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
  64. package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
  65. package/node_modules/ink/build/devtools.js +6 -31
  66. package/node_modules/ink/build/devtools.js.map +1 -1
  67. package/node_modules/ink/build/dom.d.ts +1 -5
  68. package/node_modules/ink/build/dom.js +1 -20
  69. package/node_modules/ink/build/dom.js.map +1 -1
  70. package/node_modules/ink/build/experimental/apply-style.js +140 -0
  71. package/node_modules/ink/build/experimental/dom.js +123 -0
  72. package/node_modules/ink/build/experimental/output.js +91 -0
  73. package/node_modules/ink/build/experimental/reconciler.js +141 -0
  74. package/node_modules/ink/build/experimental/renderer.js +81 -0
  75. package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
  76. package/node_modules/ink/build/hooks/use-app.js +1 -1
  77. package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
  78. package/node_modules/ink/build/hooks/use-cursor.js +1 -1
  79. package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
  80. package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
  81. package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
  82. package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
  83. package/node_modules/ink/build/hooks/use-focus.js +4 -5
  84. package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
  85. package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
  86. package/node_modules/ink/build/hooks/use-input.js +80 -82
  87. package/node_modules/ink/build/hooks/use-input.js.map +1 -1
  88. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
  89. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
  90. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
  91. package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
  92. package/node_modules/ink/build/hooks/use-stderr.js +1 -1
  93. package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
  94. package/node_modules/ink/build/hooks/use-stdin.js +1 -2
  95. package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
  96. package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
  97. package/node_modules/ink/build/hooks/use-stdout.js +1 -1
  98. package/node_modules/ink/build/hooks/useInput.js +38 -0
  99. package/node_modules/ink/build/index.d.ts +1 -8
  100. package/node_modules/ink/build/index.js +0 -4
  101. package/node_modules/ink/build/index.js.map +1 -1
  102. package/node_modules/ink/build/ink.d.ts +3 -48
  103. package/node_modules/ink/build/ink.js +155 -325
  104. package/node_modules/ink/build/ink.js.map +1 -1
  105. package/node_modules/ink/build/input-parser.d.ts +1 -4
  106. package/node_modules/ink/build/input-parser.js +30 -70
  107. package/node_modules/ink/build/input-parser.js.map +1 -1
  108. package/node_modules/ink/build/instance.js +205 -0
  109. package/node_modules/ink/build/layout.d.ts +7 -0
  110. package/node_modules/ink/build/layout.js +33 -0
  111. package/node_modules/ink/build/layout.js.map +1 -0
  112. package/node_modules/ink/build/log-update.d.ts +0 -1
  113. package/node_modules/ink/build/log-update.js +1 -13
  114. package/node_modules/ink/build/log-update.js.map +1 -1
  115. package/node_modules/ink/build/measure-element.d.ts +0 -4
  116. package/node_modules/ink/build/measure-element.js +0 -4
  117. package/node_modules/ink/build/measure-element.js.map +1 -1
  118. package/node_modules/ink/build/options.d.ts +52 -0
  119. package/node_modules/ink/build/options.js +2 -0
  120. package/node_modules/ink/build/options.js.map +1 -0
  121. package/node_modules/ink/build/output.js +0 -25
  122. package/node_modules/ink/build/output.js.map +1 -1
  123. package/node_modules/ink/build/parse-keypress.d.ts +3 -1
  124. package/node_modules/ink/build/parse-keypress.js +17 -19
  125. package/node_modules/ink/build/parse-keypress.js.map +1 -1
  126. package/node_modules/ink/build/reconciler.js +27 -46
  127. package/node_modules/ink/build/reconciler.js.map +1 -1
  128. package/node_modules/ink/build/render-border.js +18 -29
  129. package/node_modules/ink/build/render-border.js.map +1 -1
  130. package/node_modules/ink/build/render-to-string.js +1 -2
  131. package/node_modules/ink/build/render-to-string.js.map +1 -1
  132. package/node_modules/ink/build/render.d.ts +2 -57
  133. package/node_modules/ink/build/render.js +11 -18
  134. package/node_modules/ink/build/render.js.map +1 -1
  135. package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
  136. package/node_modules/ink/build/screen-reader-update.js +38 -0
  137. package/node_modules/ink/build/screen-reader-update.js.map +1 -0
  138. package/node_modules/ink/build/styles.d.ts +16 -78
  139. package/node_modules/ink/build/styles.js +31 -102
  140. package/node_modules/ink/build/styles.js.map +1 -1
  141. package/node_modules/ink/build/utils.d.ts +2 -9
  142. package/node_modules/ink/build/utils.js +3 -18
  143. package/node_modules/ink/build/utils.js.map +1 -1
  144. package/node_modules/ink/build/wrap-text.js +0 -7
  145. package/node_modules/ink/build/wrap-text.js.map +1 -1
  146. package/node_modules/ink/build/write-synchronized.d.ts +1 -1
  147. package/node_modules/ink/build/write-synchronized.js +2 -4
  148. package/node_modules/ink/build/write-synchronized.js.map +1 -1
  149. package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  150. package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
  151. package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
  152. package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
  153. package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
  154. package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
  155. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
  156. package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
  157. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
  158. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
  159. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
  160. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
  161. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
  162. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
  163. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
  164. package/node_modules/ink/package.json +98 -34
  165. package/node_modules/ink/readme.md +48 -554
  166. package/node_modules/slice-ansi/index.d.ts +1 -1
  167. package/node_modules/slice-ansi/index.js +89 -146
  168. package/node_modules/slice-ansi/package.json +5 -5
  169. package/node_modules/slice-ansi/readme.md +0 -1
  170. package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
  171. package/package.json +11 -10
  172. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
  173. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
  174. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
  175. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
  176. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
  177. package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
  178. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
  179. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
  180. package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
  181. package/node_modules/ink/build/components/AnimationContext.js +0 -13
  182. package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
  183. package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
  184. package/node_modules/ink/build/hooks/use-animation.js +0 -87
  185. package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
  186. package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
  187. package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
  188. package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
  189. package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
  190. package/node_modules/ink/build/hooks/use-paste.js +0 -62
  191. package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
  192. package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
  193. package/node_modules/ink/build/hooks/use-window-size.js +0 -22
  194. package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
  195. package/node_modules/wrap-ansi/index.js +0 -468
  196. /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 `Default runtime exceeded the ${normalizedFileTimeoutSeconds}s test file timeout`;
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
@@ -1 +1,3 @@
1
1
  export * from "@playwright/test";
2
+ export { defineConfig } from "../playwright/index";
3
+ export type { PlaywrightConfigOptions } from "../playwright/index";
package/lib/ui/index.mjs CHANGED
@@ -1 +1,2 @@
1
1
  export * from "@playwright/test";
2
+ export { defineConfig } from "../playwright/index.mjs";
@@ -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
- import { linkCodePrefix, linkCodeSuffix, linkEndCode, linkEndCodeC1ST, linkEndCodeST, } from "./consts.js";
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
- if (code.endsWith("\x1B\\"))
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;AAErC,OAAO,EACN,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,aAAa,GACb,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;AAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC9C,KAAK,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,UAAU,CAAC,KAAK,EAAE;IAC5C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAA+B;IAC5E,MAAM,SAAS,GAAG,MAAM;QACvB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;aACrB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;aAC5B,IAAI,CAAC,GAAG,CAAC;QACZ,CAAC,CAAC,EAAE,CAAC;IACN,OAAO,GAAG,cAAc,GA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,CAAC;KAC9B;SAAM,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACjC,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;KAChC;IAED,uDAAuD;IACvD,MAAM,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,IAAI,GAAG,EAAE;QACR,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAClC;SAAM;QACN,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,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 | ControlCode | Char;
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 = findOSCTerminatorIndex(string, paramsEndIndex + 1);
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
- * Finds the index of the last character of the first OSC terminator at or after startIndex.
45
- * Recognizes BEL (\x07), C1 ST (\x9C), and ESC+backslash (\x1B\x5C).
46
- * Returns -1 if no terminator is found.
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 === CC_OSC) {
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 === CC_CSI) {
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,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,cAAc,EACd,uBAAuB,GACvB,MAAM,aAAa,CAAC;AAErB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,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,8CAA8C;oBAC9C,MAAM,KAAK,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;oBAC9C,KAAK,MAAM,cAAc,IAAI,KAAK,EAAE;wBACnC,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": "@alcalzone/ansi-tokenize",
3
- "version": "0.3.0",
3
+ "version": "0.2.5",
4
4
  "description": "Efficiently modify strings containing ANSI escape codes",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "SWC-backed Next.js source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-bridge",
3
- "version": "0.1.113",
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.113"
25
+ "@elench/testkit-protocol": "0.1.115"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "Shared browser protocol for testkit bridge and extension consumers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/ts-analysis",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "TypeScript compiler-backed source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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
- @example
21
- ```
22
- ┌────┐
23
- │ │
24
- └────┘
25
- ```
3
+ Style of the box border.
26
4
  */
27
- readonly single: BoxStyle;
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
- @example
31
- ```
32
- ╔════╗
33
- ║ ║
34
- ╚════╝
35
- ```
17
+ All box styles.
36
18
  */
37
- readonly double: BoxStyle;
19
+ interface Boxes {
20
+ /**
21
+ @example
22
+ ```
23
+ ┌────┐
24
+ │ │
25
+ └────┘
26
+ ```
27
+ */
28
+ readonly single: BoxStyle;
38
29
 
39
- /**
40
- @example
41
- ```
42
- ╭────╮
43
-
44
- ╰────╯
45
- ```
46
- */
47
- readonly round: BoxStyle;
30
+ /**
31
+ @example
32
+ ```
33
+ ╔════╗
34
+
35
+ ╚════╝
36
+ ```
37
+ */
38
+ readonly double: BoxStyle;
48
39
 
49
- /**
50
- @example
51
- ```
52
- ┏━━━━┓
53
-
54
- ┗━━━━┛
55
- ```
56
- */
57
- readonly bold: BoxStyle;
40
+ /**
41
+ @example
42
+ ```
43
+ ╭────╮
44
+
45
+ ╰────╯
46
+ ```
47
+ */
48
+ readonly round: BoxStyle;
58
49
 
59
- /**
60
- @example
61
- ```
62
- ╓────╖
63
-
64
- ╙────╜
65
- ```
66
- */
67
- readonly singleDouble: BoxStyle;
50
+ /**
51
+ @example
52
+ ```
53
+ ┏━━━━┓
54
+
55
+ ┗━━━━┛
56
+ ```
57
+ */
58
+ readonly bold: BoxStyle;
68
59
 
69
- /**
70
- @example
71
- ```
72
- ╒════╕
73
-
74
- ╘════╛
75
- ```
76
- */
77
- readonly doubleSingle: BoxStyle;
60
+ /**
61
+ @example
62
+ ```
63
+ ╓────╖
64
+
65
+ ╙────╜
66
+ ```
67
+ */
68
+ readonly singleDouble: BoxStyle;
78
69
 
79
- /**
80
- @example
81
- ```
82
- +----+
83
- | |
84
- +----+
85
- ```
86
- */
87
- readonly classic: BoxStyle;
70
+ /**
71
+ @example
72
+ ```
73
+ ╒════╕
74
+
75
+ ╘════╛
76
+ ```
77
+ */
78
+ readonly doubleSingle: BoxStyle;
88
79
 
89
- /**
90
- @example
91
- ```
92
- ↘↓↓↓↓↙
93
-
94
- ↗↑↑↑↑↖
95
- ```
96
- */
97
- readonly arrow: BoxStyle;
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 from 'cli-boxes';
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 default cliBoxes;
127
+ export = cliBoxes;
@@ -1,3 +1,6 @@
1
- import cliBoxes from './boxes.json' with {type: 'json'};
1
+ 'use strict';
2
+ const cliBoxes = require('./boxes.json');
2
3
 
3
- export default cliBoxes;
4
+ module.exports = cliBoxes;
5
+ // TODO: Remove this for the next major release
6
+ module.exports.default = cliBoxes;