vouchington-tooling 0.63.0 → 0.64.0
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/README.md +88 -0
- package/dist/cli/commands/cloc.d.mts +7 -0
- package/dist/cli/commands/cloc.mjs +47 -0
- package/dist/cli/commands/storybook-browser-runner.d.mts +7 -0
- package/dist/cli/commands/storybook-browser-runner.mjs +29 -0
- package/dist/cli/index.mjs +4 -0
- package/dist/cli/parse-forwarded-commands.d.mts +6 -0
- package/dist/cli/parse-forwarded-commands.mjs +4 -0
- package/dist/cli/parse.d.mts +6 -0
- package/dist/cli/usage-text.d.mts +1 -1
- package/dist/cli/usage-text.mjs +18 -0
- package/dist/cloc/child-process.d.mts +3 -0
- package/dist/cloc/child-process.mjs +14 -0
- package/dist/cloc/classify.d.mts +8 -0
- package/dist/cloc/classify.mjs +20 -0
- package/dist/cloc/config-load.d.mts +7 -0
- package/dist/cloc/config-load.mjs +26 -0
- package/dist/cloc/config.d.mts +55 -0
- package/dist/cloc/config.mjs +109 -0
- package/dist/cloc/count.d.mts +9 -0
- package/dist/cloc/count.mjs +33 -0
- package/dist/cloc/index.d.mts +12 -0
- package/dist/cloc/index.mjs +7 -0
- package/dist/cloc/layout.test-helpers.d.mts +8 -0
- package/dist/cloc/layout.test-helpers.mjs +42 -0
- package/dist/cloc/paths.d.mts +7 -0
- package/dist/cloc/paths.mjs +29 -0
- package/dist/cloc/patterns.d.mts +10 -0
- package/dist/cloc/patterns.mjs +25 -0
- package/dist/cloc/rows.d.mts +13 -0
- package/dist/cloc/rows.mjs +42 -0
- package/dist/cloc/scc.d.mts +10 -0
- package/dist/cloc/scc.mjs +55 -0
- package/dist/cloc/tracked.d.mts +4 -0
- package/dist/cloc/tracked.mjs +40 -0
- package/dist/storybook-browser-runner/args.d.mts +8 -0
- package/dist/storybook-browser-runner/args.mjs +52 -0
- package/dist/storybook-browser-runner/attempt-result.d.mts +41 -0
- package/dist/storybook-browser-runner/attempt-result.mjs +108 -0
- package/dist/storybook-browser-runner/bootstrap-telemetry.d.mts +35 -0
- package/dist/storybook-browser-runner/bootstrap-telemetry.mjs +138 -0
- package/dist/storybook-browser-runner/cache-plan.d.mts +22 -0
- package/dist/storybook-browser-runner/cache-plan.mjs +53 -0
- package/dist/storybook-browser-runner/diagnostics.d.mts +8 -0
- package/dist/storybook-browser-runner/diagnostics.mjs +29 -0
- package/dist/storybook-browser-runner/env.d.mts +2 -0
- package/dist/storybook-browser-runner/env.mjs +59 -0
- package/dist/storybook-browser-runner/fixtures.test-helpers.d.mts +49 -0
- package/dist/storybook-browser-runner/fixtures.test-helpers.mjs +95 -0
- package/dist/storybook-browser-runner/index.d.mts +15 -0
- package/dist/storybook-browser-runner/index.mjs +70 -0
- package/dist/storybook-browser-runner/observer-state.d.mts +22 -0
- package/dist/storybook-browser-runner/observer-state.mjs +21 -0
- package/dist/storybook-browser-runner/options.d.mts +18 -0
- package/dist/storybook-browser-runner/options.mjs +49 -0
- package/dist/storybook-browser-runner/output-observer.d.mts +37 -0
- package/dist/storybook-browser-runner/output-observer.mjs +130 -0
- package/dist/storybook-browser-runner/output-patterns.d.mts +14 -0
- package/dist/storybook-browser-runner/output-patterns.mjs +26 -0
- package/dist/storybook-browser-runner/quiet-output.d.mts +16 -0
- package/dist/storybook-browser-runner/quiet-output.mjs +79 -0
- package/dist/storybook-browser-runner/run-attempt.d.mts +14 -0
- package/dist/storybook-browser-runner/run-attempt.mjs +111 -0
- package/dist/storybook-browser-runner/runtime-metadata.d.mts +12 -0
- package/dist/storybook-browser-runner/runtime-metadata.mjs +50 -0
- package/dist/storybook-browser-runner/session-deps.d.mts +11 -0
- package/dist/storybook-browser-runner/session-deps.mjs +70 -0
- package/dist/storybook-browser-runner/types.d.mts +49 -0
- package/dist/storybook-browser-runner/types.mjs +1 -0
- package/dist/storybook-browser-runner/vite-detectors.d.mts +6 -0
- package/dist/storybook-browser-runner/vite-detectors.mjs +20 -0
- package/dist/storybook-browser-runner/watchdog.d.mts +23 -0
- package/dist/storybook-browser-runner/watchdog.mjs +55 -0
- package/package.json +11 -1
- package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BrowserSessionWatchdog } from '../browser-session-runner/index.mts';
|
|
2
|
+
import type { OutputObserver } from './output-observer.mts';
|
|
3
|
+
import type { StorybookBrowserRunnerDeps } from './types.mts';
|
|
4
|
+
/** What the watchdog decided, read by the attempt result once the session ends. */
|
|
5
|
+
export type WatchdogOutcome = {
|
|
6
|
+
hung: boolean;
|
|
7
|
+
resultFileDetectedAt: number | null;
|
|
8
|
+
semanticStall: boolean;
|
|
9
|
+
stalled: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type StorybookWatchdogOptions = {
|
|
12
|
+
completionFile: string | undefined;
|
|
13
|
+
deps: Pick<StorybookBrowserRunnerDeps, 'clearInterval' | 'cwd' | 'existsSync' | 'now' | 'setInterval' | 'stderr'>;
|
|
14
|
+
hangMs: number;
|
|
15
|
+
observer: OutputObserver;
|
|
16
|
+
outcome: WatchdogOutcome;
|
|
17
|
+
stallMs: number;
|
|
18
|
+
};
|
|
19
|
+
/** Terminates the attempt on an optimizer stall, a mid-suite stall, or a tester-connection hang. */
|
|
20
|
+
export declare function createStorybookWatchdog(options: StorybookWatchdogOptions): BrowserSessionWatchdog;
|
|
21
|
+
/** Records when the completion file first appears; also sampled once more as an attempt ends. */
|
|
22
|
+
export declare function sampleCompletionFile(options: Pick<StorybookWatchdogOptions, 'completionFile' | 'deps' | 'outcome'>): void;
|
|
23
|
+
export declare function isSpawnedProcessGroupId(processGroupId: number | undefined): processGroupId is number;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
const MAX_WATCHDOG_INTERVAL_MS = 5000;
|
|
3
|
+
/** Terminates the attempt on an optimizer stall, a mid-suite stall, or a tester-connection hang. */
|
|
4
|
+
export function createStorybookWatchdog(options) {
|
|
5
|
+
const { deps, hangMs, observer, outcome, stallMs } = options;
|
|
6
|
+
return (controller) => {
|
|
7
|
+
// The first decision is final: later ticks during the termination grace must not repeat it.
|
|
8
|
+
let decided = false;
|
|
9
|
+
const check = () => {
|
|
10
|
+
const now = deps.now();
|
|
11
|
+
sampleCompletionFile(options);
|
|
12
|
+
if (decided)
|
|
13
|
+
return;
|
|
14
|
+
const seen = observer.snapshot();
|
|
15
|
+
if (!seen.semanticProgressSeen &&
|
|
16
|
+
seen.optimizerLastProgressAt != null &&
|
|
17
|
+
now - seen.optimizerLastProgressAt >= stallMs) {
|
|
18
|
+
outcome.stalled = true;
|
|
19
|
+
deps.stderr.write(`[storybook-browser] Vite optimizer made no startup progress for ${stallMs}ms; terminating attempt\n`);
|
|
20
|
+
decided = true;
|
|
21
|
+
controller.terminate();
|
|
22
|
+
}
|
|
23
|
+
else if (seen.semanticProgressSeen && now - seen.lastSemanticProgressAt >= hangMs) {
|
|
24
|
+
outcome.semanticStall = true;
|
|
25
|
+
deps.stderr.write(`[storybook-browser] no semantic test progress for ${hangMs}ms; terminating terminal mid-suite stall\n`);
|
|
26
|
+
decided = true;
|
|
27
|
+
controller.terminate();
|
|
28
|
+
}
|
|
29
|
+
else if (seen.anyOutputSeen &&
|
|
30
|
+
!seen.semanticProgressSeen &&
|
|
31
|
+
now - seen.lastHangProgressAt >= hangMs) {
|
|
32
|
+
outcome.hung = true;
|
|
33
|
+
deps.stderr.write(`[storybook-browser] no test output for ${hangMs}ms after Vite startup — suspected Vitest/Chromium tester-connection hang; last output:\n${seen.outputBuffer}\n`);
|
|
34
|
+
decided = true;
|
|
35
|
+
controller.terminate();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const interval = deps.setInterval(check, Math.min(MAX_WATCHDOG_INTERVAL_MS, stallMs, hangMs));
|
|
39
|
+
return () => deps.clearInterval(interval);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Records when the completion file first appears; also sampled once more as an attempt ends. */
|
|
43
|
+
export function sampleCompletionFile(options) {
|
|
44
|
+
const { completionFile, deps, outcome } = options;
|
|
45
|
+
if (!completionFile || outcome.resultFileDetectedAt != null)
|
|
46
|
+
return;
|
|
47
|
+
if (deps.existsSync(resolve(deps.cwd, completionFile)))
|
|
48
|
+
outcome.resultFileDetectedAt = deps.now();
|
|
49
|
+
}
|
|
50
|
+
export function isSpawnedProcessGroupId(processGroupId) {
|
|
51
|
+
return (processGroupId != null &&
|
|
52
|
+
Number.isSafeInteger(processGroupId) &&
|
|
53
|
+
processGroupId > 1 &&
|
|
54
|
+
processGroupId <= 2_147_483_647);
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vouchington-tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "Vouchington CLI and extractable tooling libraries.",
|
|
5
5
|
"homepage": "https://github.com/vouchington/vouchington-tooling/tree/main/packages/vouchington-tooling#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -321,6 +321,16 @@
|
|
|
321
321
|
"import": "./dist/dead-code/index.mjs",
|
|
322
322
|
"default": "./dist/dead-code/index.mjs"
|
|
323
323
|
},
|
|
324
|
+
"./cloc": {
|
|
325
|
+
"types": "./dist/cloc/index.d.mts",
|
|
326
|
+
"import": "./dist/cloc/index.mjs",
|
|
327
|
+
"default": "./dist/cloc/index.mjs"
|
|
328
|
+
},
|
|
329
|
+
"./storybook-browser-runner": {
|
|
330
|
+
"types": "./dist/storybook-browser-runner/index.d.mts",
|
|
331
|
+
"import": "./dist/storybook-browser-runner/index.mjs",
|
|
332
|
+
"default": "./dist/storybook-browser-runner/index.mjs"
|
|
333
|
+
},
|
|
324
334
|
"./sandbox-command-audit": {
|
|
325
335
|
"types": "./dist/sandbox-command-audit/index.d.mts",
|
|
326
336
|
"import": "./dist/sandbox-command-audit/index.mjs",
|
|
Binary file
|