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,37 @@
|
|
|
1
|
+
import type { StorybookBrowserBootstrapTelemetry } from './bootstrap-telemetry.mts';
|
|
2
|
+
import type { StorybookBrowserDiagnostics } from './diagnostics.mts';
|
|
3
|
+
import { type ProjectOutputPatterns } from './output-patterns.mts';
|
|
4
|
+
import { type OutputObserverSnapshot } from './observer-state.mts';
|
|
5
|
+
import type { StorybookQuietOutput } from './quiet-output.mts';
|
|
6
|
+
type Source = 'stderr' | 'stdout';
|
|
7
|
+
type Sink = Pick<NodeJS.WriteStream, 'write'>;
|
|
8
|
+
export type OutputObserverOptions = {
|
|
9
|
+
diagnostics: StorybookBrowserDiagnostics;
|
|
10
|
+
now: () => number;
|
|
11
|
+
patterns: ProjectOutputPatterns;
|
|
12
|
+
progressPrefix: string;
|
|
13
|
+
quietOutput: StorybookQuietOutput;
|
|
14
|
+
startedAt: number;
|
|
15
|
+
stderr: Sink;
|
|
16
|
+
stdout: Sink;
|
|
17
|
+
telemetry: StorybookBrowserBootstrapTelemetry;
|
|
18
|
+
};
|
|
19
|
+
/** Reads child output and latches the startup, progress and failure markers the policy needs. */
|
|
20
|
+
export declare class OutputObserver {
|
|
21
|
+
private readonly newOptimizeDeps;
|
|
22
|
+
private readonly options;
|
|
23
|
+
private lastSemanticSequence;
|
|
24
|
+
private readonly decoders;
|
|
25
|
+
private state;
|
|
26
|
+
constructor(options: OutputObserverOptions);
|
|
27
|
+
snapshot(): OutputObserverSnapshot;
|
|
28
|
+
observe(source: Source, chunk: string | Buffer): void;
|
|
29
|
+
/** Emits any unterminated lines the telemetry still holds, stdout before stderr. */
|
|
30
|
+
flush(): void;
|
|
31
|
+
private emit;
|
|
32
|
+
private observeStartup;
|
|
33
|
+
private observeProgress;
|
|
34
|
+
private recordSemanticProgress;
|
|
35
|
+
private observeFailures;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { latestStorybookProgressSequence } from "../vitest-diagnostics/index.mjs";
|
|
2
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
3
|
+
import { hasAddonVitestSetupFile, optimizerProgressPattern, viteServerFetchFailurePattern, viteServerScriptNetworkChangePattern, vitestRunnerMissingMarker, } from "./output-patterns.mjs";
|
|
4
|
+
import { initialObserverState, } from "./observer-state.mjs";
|
|
5
|
+
import { hasStorybookBrowserViteDependencyReady, hasStorybookBrowserViteReady, hasStorybookViteNewDependenciesFound, hasStorybookViteOptimizerReload, parseStorybookViteNewDependencies, stripAnsi, } from "./vite-detectors.mjs";
|
|
6
|
+
const BUFFER_CHARS = 1000;
|
|
7
|
+
// One less than the longest optimizer progress marker, so the overlap cannot hold a whole marker.
|
|
8
|
+
const OPTIMIZER_MARKER_OVERLAP = 32;
|
|
9
|
+
// A progress marker line is at most 512 bytes, so this tail covers one split across chunks.
|
|
10
|
+
const PROGRESS_MARKER_OVERLAP = 600;
|
|
11
|
+
/** Reads child output and latches the startup, progress and failure markers the policy needs. */
|
|
12
|
+
export class OutputObserver {
|
|
13
|
+
newOptimizeDeps = new Set();
|
|
14
|
+
options;
|
|
15
|
+
lastSemanticSequence = 0;
|
|
16
|
+
decoders = {
|
|
17
|
+
stderr: new StringDecoder('utf8'),
|
|
18
|
+
stdout: new StringDecoder('utf8'),
|
|
19
|
+
};
|
|
20
|
+
state;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.state = initialObserverState(options.startedAt);
|
|
24
|
+
}
|
|
25
|
+
snapshot() {
|
|
26
|
+
return { ...this.state, newOptimizeDeps: [...this.newOptimizeDeps] };
|
|
27
|
+
}
|
|
28
|
+
observe(source, chunk) {
|
|
29
|
+
const { now: clock, startedAt, telemetry } = this.options;
|
|
30
|
+
const now = clock();
|
|
31
|
+
// Decode per stream so a multibyte character split across chunks survives.
|
|
32
|
+
const text = this.decoders[source].write(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);
|
|
33
|
+
const observed = telemetry.consume(source, text, now - startedAt);
|
|
34
|
+
if (observed.output)
|
|
35
|
+
this.emit(source, observed.output);
|
|
36
|
+
const { patterns } = this.options;
|
|
37
|
+
const state = this.state;
|
|
38
|
+
// The marker can be split across chunks, so it is also matched against the previous tail.
|
|
39
|
+
const joined = state.outputBuffer.slice(-OPTIMIZER_MARKER_OVERLAP) + text;
|
|
40
|
+
// Progress markers are read from the whole chunk, not the truncated rolling buffer.
|
|
41
|
+
const progressText = stripAnsi(state.outputBuffer.slice(-PROGRESS_MARKER_OVERLAP) + text);
|
|
42
|
+
state.outputBuffer = (state.outputBuffer + text).slice(-BUFFER_CHARS);
|
|
43
|
+
const plainBuffer = stripAnsi(state.outputBuffer);
|
|
44
|
+
state.anyOutputSeen = true;
|
|
45
|
+
state.lastOutputAt = now;
|
|
46
|
+
const storybookOutput = plainBuffer.includes(patterns.projectMarker);
|
|
47
|
+
if (observed.hasNonDiagnosticOutput || state.storybookBrowserOutputSeen) {
|
|
48
|
+
state.lastHangProgressAt = now;
|
|
49
|
+
}
|
|
50
|
+
if (optimizerProgressPattern.test(joined))
|
|
51
|
+
state.optimizerLastProgressAt = now;
|
|
52
|
+
if (hasStorybookBrowserViteDependencyReady(plainBuffer) || storybookOutput) {
|
|
53
|
+
state.optimizerLastProgressAt = null;
|
|
54
|
+
}
|
|
55
|
+
this.observeStartup(now, hasStorybookBrowserViteReady(plainBuffer) || storybookOutput);
|
|
56
|
+
this.observeProgress(now, plainBuffer, progressText, storybookOutput);
|
|
57
|
+
this.observeFailures(stripAnsi(text), plainBuffer);
|
|
58
|
+
}
|
|
59
|
+
/** Emits any unterminated lines the telemetry still holds, stdout before stderr. */
|
|
60
|
+
flush() {
|
|
61
|
+
for (const source of ['stdout', 'stderr']) {
|
|
62
|
+
const rest = this.decoders[source].end();
|
|
63
|
+
if (rest)
|
|
64
|
+
this.options.telemetry.consume(source, rest, this.options.now() - this.options.startedAt);
|
|
65
|
+
const observed = this.options.telemetry.flush(source, this.options.now() - this.options.startedAt);
|
|
66
|
+
if (observed.output)
|
|
67
|
+
this.emit(source, observed.output);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
emit(source, output) {
|
|
71
|
+
this.options.diagnostics.recordOutput(output);
|
|
72
|
+
const visible = this.options.quietOutput.split(output, source);
|
|
73
|
+
if (visible)
|
|
74
|
+
(source === 'stdout' ? this.options.stdout : this.options.stderr).write(visible);
|
|
75
|
+
}
|
|
76
|
+
observeStartup(now, startupNowComplete) {
|
|
77
|
+
if (this.state.startupComplete || !startupNowComplete)
|
|
78
|
+
return;
|
|
79
|
+
this.state.startupComplete = true;
|
|
80
|
+
this.state.optimizerReadyAt ??= now;
|
|
81
|
+
this.state.lastHangProgressAt = now;
|
|
82
|
+
}
|
|
83
|
+
observeProgress(now, plainBuffer, progressText, storybookOutput) {
|
|
84
|
+
const { patterns, progressPrefix } = this.options;
|
|
85
|
+
const state = this.state;
|
|
86
|
+
const sequence = latestStorybookProgressSequence(progressText, progressPrefix);
|
|
87
|
+
if (sequence != null && sequence > this.lastSemanticSequence) {
|
|
88
|
+
this.lastSemanticSequence = sequence;
|
|
89
|
+
this.recordSemanticProgress(now);
|
|
90
|
+
}
|
|
91
|
+
if (storybookOutput && !state.storybookBrowserOutputSeen) {
|
|
92
|
+
state.storybookBrowserOutputSeen = true;
|
|
93
|
+
this.recordSemanticProgress(now);
|
|
94
|
+
}
|
|
95
|
+
if (state.startupComplete &&
|
|
96
|
+
!state.storybookBrowserOutputSeen &&
|
|
97
|
+
patterns.connectionTimeout.test(plainBuffer)) {
|
|
98
|
+
state.browserSessionConnectionTimedOut = true;
|
|
99
|
+
}
|
|
100
|
+
if (patterns.testOutput.test(plainBuffer))
|
|
101
|
+
state.firstTestOutputAt ??= now;
|
|
102
|
+
}
|
|
103
|
+
recordSemanticProgress(now) {
|
|
104
|
+
const state = this.state;
|
|
105
|
+
state.semanticProgressSeen = true;
|
|
106
|
+
state.lastSemanticProgressAt = now;
|
|
107
|
+
state.firstTestOutputAt ??= now;
|
|
108
|
+
this.options.telemetry.recordSemanticProgress(now - this.options.startedAt);
|
|
109
|
+
}
|
|
110
|
+
observeFailures(plainText, plainBuffer) {
|
|
111
|
+
const state = this.state;
|
|
112
|
+
if (viteServerFetchFailurePattern.test(plainBuffer) ||
|
|
113
|
+
(!state.semanticProgressSeen && viteServerScriptNetworkChangePattern.test(plainBuffer))) {
|
|
114
|
+
state.retryableViteFailure = true;
|
|
115
|
+
}
|
|
116
|
+
const either = (check) => check(plainText) || check(plainBuffer);
|
|
117
|
+
if (either(hasStorybookViteNewDependenciesFound))
|
|
118
|
+
state.sawNewOptimizeDeps = true;
|
|
119
|
+
if (either(hasStorybookViteOptimizerReload))
|
|
120
|
+
state.sawOptimizerReload = true;
|
|
121
|
+
for (const name of parseStorybookViteNewDependencies(plainText))
|
|
122
|
+
this.newOptimizeDeps.add(name);
|
|
123
|
+
if (!state.sawAddonVitestSetupFile && hasAddonVitestSetupFile(plainText, plainBuffer)) {
|
|
124
|
+
state.sawAddonVitestSetupFile = true;
|
|
125
|
+
}
|
|
126
|
+
if (!state.sawRunnerMissingMessage && either((t) => t.includes(vitestRunnerMissingMarker))) {
|
|
127
|
+
state.sawRunnerMissingMessage = true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const optimizerProgressPattern: RegExp;
|
|
2
|
+
export declare const viteServerFetchFailurePattern: RegExp;
|
|
3
|
+
export declare const viteServerScriptNetworkChangePattern: RegExp;
|
|
4
|
+
export declare const vitestRunnerMissingMarker = "Vitest failed to find the runner";
|
|
5
|
+
export type ProjectOutputPatterns = {
|
|
6
|
+
/** Matches the browser-session connection timeout message for the project. */
|
|
7
|
+
connectionTimeout: RegExp;
|
|
8
|
+
/** Marker that prefixes every test line of the browser project. */
|
|
9
|
+
projectMarker: string;
|
|
10
|
+
/** Matches the browser project's output or the Vitest summary. */
|
|
11
|
+
testOutput: RegExp;
|
|
12
|
+
};
|
|
13
|
+
export declare function createProjectOutputPatterns(projectName: string): ProjectOutputPatterns;
|
|
14
|
+
export declare function hasAddonVitestSetupFile(plainText: string, plainOutputBuffer: string): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const optimizerProgressPattern = /\[optimizer\] (?:scanning|bundling) dependencies/;
|
|
2
|
+
export const viteServerFetchFailurePattern = /Failed to fetch dynamically imported module: http:\/\/localhost:\d+\//;
|
|
3
|
+
export const viteServerScriptNetworkChangePattern = /\[PW Error\] script request failed for http:\/\/localhost:\d+\/\S+ url: net::ERR_NETWORK_CHANGED/;
|
|
4
|
+
// Runner-missing detection latches two independent markers (see hasAddonVitestSetupFile and
|
|
5
|
+
// vitestRunnerMissingMarker). They are matched separately, never as one regex spanning both,
|
|
6
|
+
// because the full "Failed to import test file ... Vitest failed to find the runner" error block
|
|
7
|
+
// is larger than the rolling output window, so the two ends cannot co-occur in one snapshot.
|
|
8
|
+
const addonVitestSetupFilePathMarker = '/@storybook/addon-vitest/';
|
|
9
|
+
const addonVitestSetupFileNameMarker = '/vitest-plugin/setup-file.js';
|
|
10
|
+
export const vitestRunnerMissingMarker = 'Vitest failed to find the runner';
|
|
11
|
+
export function createProjectOutputPatterns(projectName) {
|
|
12
|
+
const name = projectName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
13
|
+
return {
|
|
14
|
+
connectionTimeout: new RegExp(`Failed to connect to the browser session "[^"]+" \\[${name} \\(chromium\\)\\] within the timeout\\.`),
|
|
15
|
+
projectMarker: `|${projectName}`,
|
|
16
|
+
testOutput: new RegExp(`\\|${name}|\\n\\s*(?:[✓✗✘] )?Test Files\\s+`),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// The add-on setup-file path (the package segment and the file segment) is checked against the
|
|
20
|
+
// current chunk and the sliding buffer, so it latches whether the block arrives as one oversized
|
|
21
|
+
// write or is split across chunks. The two segments always co-locate on one path line.
|
|
22
|
+
export function hasAddonVitestSetupFile(plainText, plainOutputBuffer) {
|
|
23
|
+
const hasBoth = (haystack) => haystack.includes(addonVitestSetupFilePathMarker) &&
|
|
24
|
+
haystack.includes(addonVitestSetupFileNameMarker);
|
|
25
|
+
return hasBoth(plainText) || hasBoth(plainOutputBuffer);
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const MAX_QUIET_TAIL_BYTES: number;
|
|
2
|
+
export type QuietOutputSource = 'stderr' | 'stdout';
|
|
3
|
+
export declare class StorybookQuietOutput {
|
|
4
|
+
private chunks;
|
|
5
|
+
private bytes;
|
|
6
|
+
private readonly progressPrefix;
|
|
7
|
+
private readonly inViteDepsBlock;
|
|
8
|
+
constructor(progressPrefix: string);
|
|
9
|
+
/** Returns the lines that belong in the job log and retains the quiet ones. */
|
|
10
|
+
split(output: string, source?: QuietOutputSource): string;
|
|
11
|
+
private isQuiet;
|
|
12
|
+
/** Returns the retained quiet output once, or an empty string when there is none. */
|
|
13
|
+
drain(): string;
|
|
14
|
+
private retain;
|
|
15
|
+
}
|
|
16
|
+
export declare function quietOutputHeader(bytes: number): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { hasStorybookBrowserViteDependencyReady, hasStorybookViteNewDependenciesFound, hasStorybookViteOptimizerReload, stripAnsi, } from "./vite-detectors.mjs";
|
|
2
|
+
// Quiet lines are machine-consumed watchdog evidence. They stay out of the job log on success
|
|
3
|
+
// and are replayed from this bounded tail when an attempt fails.
|
|
4
|
+
export const MAX_QUIET_TAIL_BYTES = 128 * 1024;
|
|
5
|
+
const viteDepsDebugPattern = /\bvite:deps\b/;
|
|
6
|
+
const indentedContinuationPattern = /^ {2,}\S/;
|
|
7
|
+
function isOptimizerLifecycleLine(plain) {
|
|
8
|
+
// Keep the optimizer lifecycle lines that classify retry and optimizeDeps guidance visible.
|
|
9
|
+
return (hasStorybookBrowserViteDependencyReady(plain) ||
|
|
10
|
+
hasStorybookViteNewDependenciesFound(plain) ||
|
|
11
|
+
hasStorybookViteOptimizerReload(plain));
|
|
12
|
+
}
|
|
13
|
+
export class StorybookQuietOutput {
|
|
14
|
+
chunks = [];
|
|
15
|
+
bytes = 0;
|
|
16
|
+
progressPrefix;
|
|
17
|
+
// A vite:deps message lists its dependency paths on indented lines that carry no namespace.
|
|
18
|
+
// The block is tracked per stream so interleaved output cannot extend it.
|
|
19
|
+
inViteDepsBlock = {
|
|
20
|
+
stderr: false,
|
|
21
|
+
stdout: false,
|
|
22
|
+
};
|
|
23
|
+
constructor(progressPrefix) {
|
|
24
|
+
this.progressPrefix = progressPrefix;
|
|
25
|
+
}
|
|
26
|
+
/** Returns the lines that belong in the job log and retains the quiet ones. */
|
|
27
|
+
split(output, source = 'stdout') {
|
|
28
|
+
let visible = '';
|
|
29
|
+
for (const line of output.split(/(?<=\r?\n|\r(?!\n))/)) {
|
|
30
|
+
if (this.isQuiet(line, source))
|
|
31
|
+
this.retain(line);
|
|
32
|
+
else
|
|
33
|
+
visible += line;
|
|
34
|
+
}
|
|
35
|
+
return visible;
|
|
36
|
+
}
|
|
37
|
+
isQuiet(line, source) {
|
|
38
|
+
const plain = stripAnsi(line);
|
|
39
|
+
const inBlock = this.inViteDepsBlock[source];
|
|
40
|
+
this.inViteDepsBlock[source] = false;
|
|
41
|
+
if (plain.includes(this.progressPrefix))
|
|
42
|
+
return true;
|
|
43
|
+
if (isOptimizerLifecycleLine(plain))
|
|
44
|
+
return false;
|
|
45
|
+
if (viteDepsDebugPattern.test(plain)) {
|
|
46
|
+
this.inViteDepsBlock[source] = true;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
this.inViteDepsBlock[source] = inBlock && indentedContinuationPattern.test(plain);
|
|
50
|
+
return this.inViteDepsBlock[source];
|
|
51
|
+
}
|
|
52
|
+
/** Returns the retained quiet output once, or an empty string when there is none. */
|
|
53
|
+
drain() {
|
|
54
|
+
const text = Buffer.concat(this.chunks).toString('utf8');
|
|
55
|
+
this.chunks = [];
|
|
56
|
+
this.bytes = 0;
|
|
57
|
+
return text;
|
|
58
|
+
}
|
|
59
|
+
retain(line) {
|
|
60
|
+
const encoded = Buffer.from(line);
|
|
61
|
+
const chunk = encoded.byteLength > MAX_QUIET_TAIL_BYTES
|
|
62
|
+
? encoded.subarray(encoded.byteLength - MAX_QUIET_TAIL_BYTES)
|
|
63
|
+
: encoded;
|
|
64
|
+
this.chunks.push(chunk);
|
|
65
|
+
this.bytes += chunk.byteLength;
|
|
66
|
+
while (this.bytes > MAX_QUIET_TAIL_BYTES) {
|
|
67
|
+
const oldest = this.chunks[0];
|
|
68
|
+
const excess = this.bytes - MAX_QUIET_TAIL_BYTES;
|
|
69
|
+
if (excess >= oldest.byteLength)
|
|
70
|
+
this.chunks.shift();
|
|
71
|
+
else
|
|
72
|
+
this.chunks[0] = oldest.subarray(excess);
|
|
73
|
+
this.bytes -= Math.min(excess, oldest.byteLength);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function quietOutputHeader(bytes) {
|
|
78
|
+
return `[storybook-browser] attempt did not succeed; replaying suppressed progress markers and vite:deps debug output (last ${bytes} bytes):\n`;
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AttemptResult } from './attempt-result.mts';
|
|
2
|
+
import type { StorybookBrowserDiagnostics } from './diagnostics.mts';
|
|
3
|
+
import { type StorybookBrowserRunnerOptions } from './options.mts';
|
|
4
|
+
import type { ResolvedStorybookBrowserProject, StorybookBrowserRunnerDeps } from './types.mts';
|
|
5
|
+
export type RunAttemptInput = {
|
|
6
|
+
deps: StorybookBrowserRunnerDeps;
|
|
7
|
+
diagnostics: StorybookBrowserDiagnostics;
|
|
8
|
+
env: NodeJS.ProcessEnv;
|
|
9
|
+
options: StorybookBrowserRunnerOptions;
|
|
10
|
+
project: ResolvedStorybookBrowserProject;
|
|
11
|
+
sessionDeadlineAt: number;
|
|
12
|
+
};
|
|
13
|
+
/** Runs the test command once under `runBrowserSession` and classifies how it ended. */
|
|
14
|
+
export declare function runUpstreamAttempt(input: RunAttemptInput): Promise<AttemptResult>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { runBrowserSession } from "../browser-session-runner/index.mjs";
|
|
2
|
+
import { expiredAttempt, buildAttemptResult, failedSpawnAttempt, } from "./attempt-result.mjs";
|
|
3
|
+
import { StorybookBrowserBootstrapTelemetry } from "./bootstrap-telemetry.mjs";
|
|
4
|
+
import { commandArgs } from "./options.mjs";
|
|
5
|
+
import { OutputObserver } from "./output-observer.mjs";
|
|
6
|
+
import { createProjectOutputPatterns } from "./output-patterns.mjs";
|
|
7
|
+
import { quietOutputHeader, StorybookQuietOutput } from "./quiet-output.mjs";
|
|
8
|
+
import { DISABLED_STALL_TIMER_MS, createBrowserSessionDeps } from "./session-deps.mjs";
|
|
9
|
+
import { createStorybookWatchdog, isSpawnedProcessGroupId, sampleCompletionFile, } from "./watchdog.mjs";
|
|
10
|
+
/** Runs the test command once under `runBrowserSession` and classifies how it ended. */
|
|
11
|
+
export async function runUpstreamAttempt(input) {
|
|
12
|
+
const { deps, diagnostics, env, options, project, sessionDeadlineAt } = input;
|
|
13
|
+
const startedAt = deps.now();
|
|
14
|
+
const telemetry = new StorybookBrowserBootstrapTelemetry();
|
|
15
|
+
const quietOutput = new StorybookQuietOutput(project.progressPrefix);
|
|
16
|
+
const observer = new OutputObserver({
|
|
17
|
+
diagnostics,
|
|
18
|
+
now: deps.now,
|
|
19
|
+
patterns: createProjectOutputPatterns(project.projectName),
|
|
20
|
+
progressPrefix: project.progressPrefix,
|
|
21
|
+
quietOutput,
|
|
22
|
+
startedAt,
|
|
23
|
+
stderr: deps.stderr,
|
|
24
|
+
stdout: deps.stdout,
|
|
25
|
+
telemetry,
|
|
26
|
+
});
|
|
27
|
+
const outcome = {
|
|
28
|
+
hung: false,
|
|
29
|
+
resultFileDetectedAt: null,
|
|
30
|
+
semanticStall: false,
|
|
31
|
+
stalled: false,
|
|
32
|
+
};
|
|
33
|
+
let spawnFailed = false;
|
|
34
|
+
let completed;
|
|
35
|
+
const replayQuietOutput = () => {
|
|
36
|
+
const quiet = quietOutput.drain();
|
|
37
|
+
if (!quiet)
|
|
38
|
+
return;
|
|
39
|
+
deps.stderr.write(quietOutputHeader(Buffer.byteLength(quiet)));
|
|
40
|
+
deps.stdout.write(quiet);
|
|
41
|
+
};
|
|
42
|
+
// browser-session-runner needs an integer delay; a monotonic clock yields fractions.
|
|
43
|
+
const remainingMs = Math.max(1, Math.ceil(sessionDeadlineAt - options.terminationGraceMs - deps.now()));
|
|
44
|
+
try {
|
|
45
|
+
await runBrowserSession({
|
|
46
|
+
attempts: 1,
|
|
47
|
+
classifyExit: () => (completed?.retryable ? 'retry' : 'return'),
|
|
48
|
+
deadlineMs: remainingMs,
|
|
49
|
+
graceMs: options.terminationGraceMs,
|
|
50
|
+
onAttemptComplete: (session) => {
|
|
51
|
+
observer.flush();
|
|
52
|
+
sampleCompletionFile({ completionFile: project.completionFile, deps, outcome });
|
|
53
|
+
const cleanExit = session.reason === 'exit' && session.exit.code === 0 && !session.exit.signal;
|
|
54
|
+
if (!cleanExit || spawnFailed)
|
|
55
|
+
replayQuietOutput();
|
|
56
|
+
completed = buildAttemptResult(session, {
|
|
57
|
+
bootstrap: telemetry.snapshot(),
|
|
58
|
+
finishedAt: deps.now(),
|
|
59
|
+
observed: observer.snapshot(),
|
|
60
|
+
outcome,
|
|
61
|
+
spawnFailed,
|
|
62
|
+
startedAt,
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
onLine: () => undefined,
|
|
66
|
+
onOutput: ({ chunk, source }) => observer.observe(source, chunk),
|
|
67
|
+
processGroupDrainMs: options.terminationGraceMs,
|
|
68
|
+
semanticStallMs: DISABLED_STALL_TIMER_MS,
|
|
69
|
+
start: () => {
|
|
70
|
+
const started = spawnTestCommand(project, env, deps, () => {
|
|
71
|
+
spawnFailed = true;
|
|
72
|
+
});
|
|
73
|
+
return started;
|
|
74
|
+
},
|
|
75
|
+
startupStallMs: DISABLED_STALL_TIMER_MS,
|
|
76
|
+
watchdog: createStorybookWatchdog({
|
|
77
|
+
completionFile: project.completionFile,
|
|
78
|
+
deps,
|
|
79
|
+
hangMs: options.hangMs,
|
|
80
|
+
observer,
|
|
81
|
+
outcome,
|
|
82
|
+
stallMs: options.stallMs,
|
|
83
|
+
}),
|
|
84
|
+
}, createBrowserSessionDeps(deps));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (!spawnFailed)
|
|
88
|
+
throw error;
|
|
89
|
+
completed = failedSpawnAttempt(telemetry.snapshot(), startedAt, observer.snapshot().lastOutputAt, deps.now());
|
|
90
|
+
}
|
|
91
|
+
return completed ?? expiredAttempt(telemetry.snapshot(), startedAt, deps.now());
|
|
92
|
+
}
|
|
93
|
+
function spawnTestCommand(project, env, deps, onSpawnFailure) {
|
|
94
|
+
const child = deps.spawn(project.command, commandArgs(project, env), {
|
|
95
|
+
cwd: deps.cwd,
|
|
96
|
+
detached: true,
|
|
97
|
+
env,
|
|
98
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
+
});
|
|
100
|
+
child.on('error', (error) => {
|
|
101
|
+
onSpawnFailure();
|
|
102
|
+
deps.stderr.write(`[storybook-browser] failed to start browser test command: ${error.message}\n`);
|
|
103
|
+
});
|
|
104
|
+
const processGroupId = child.pid;
|
|
105
|
+
if (!isSpawnedProcessGroupId(processGroupId)) {
|
|
106
|
+
onSpawnFailure();
|
|
107
|
+
deps.stderr.write('[storybook-browser] failed to start browser test command: spawned browser test command without a process ID\n');
|
|
108
|
+
throw new Error('spawned browser test command without a process ID');
|
|
109
|
+
}
|
|
110
|
+
return Object.assign(child, { processGroupId });
|
|
111
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StorybookBrowserRuntimeMetadata {
|
|
2
|
+
architecture: string;
|
|
3
|
+
chromium: string;
|
|
4
|
+
node: string;
|
|
5
|
+
platform: NodeJS.Platform;
|
|
6
|
+
playwright: string;
|
|
7
|
+
storybookAddonVitest: string;
|
|
8
|
+
vitest: string;
|
|
9
|
+
vitestBrowserPlaywright: string;
|
|
10
|
+
}
|
|
11
|
+
/** Versions as the consumer resolves them: packages are looked up from `cwd`, not from this package. */
|
|
12
|
+
export declare function storybookBrowserRuntimeMetadata(cwd: string): StorybookBrowserRuntimeMetadata;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
/** Versions as the consumer resolves them: packages are looked up from `cwd`, not from this package. */
|
|
5
|
+
export function storybookBrowserRuntimeMetadata(cwd) {
|
|
6
|
+
const resolveFrom = createRequire(resolve(cwd, 'package.json')).resolve;
|
|
7
|
+
return {
|
|
8
|
+
architecture: process.arch,
|
|
9
|
+
chromium: chromiumVersion(resolveFrom),
|
|
10
|
+
node: process.version,
|
|
11
|
+
platform: process.platform,
|
|
12
|
+
playwright: packageVersion(resolveFrom, 'playwright'),
|
|
13
|
+
storybookAddonVitest: packageVersion(resolveFrom, '@storybook/addon-vitest'),
|
|
14
|
+
vitest: packageVersion(resolveFrom, 'vitest'),
|
|
15
|
+
vitestBrowserPlaywright: packageVersion(resolveFrom, '@vitest/browser-playwright'),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function packageVersion(resolveFrom, packageName) {
|
|
19
|
+
try {
|
|
20
|
+
let directory = dirname(resolveFrom(packageName));
|
|
21
|
+
while (true) {
|
|
22
|
+
const manifestPath = resolve(directory, 'package.json');
|
|
23
|
+
if (existsSync(manifestPath)) {
|
|
24
|
+
const manifest = readJson(manifestPath);
|
|
25
|
+
if (manifest.name === packageName && manifest.version)
|
|
26
|
+
return manifest.version;
|
|
27
|
+
}
|
|
28
|
+
const parent = dirname(directory);
|
|
29
|
+
if (parent === directory)
|
|
30
|
+
return 'unknown';
|
|
31
|
+
directory = parent;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return 'unknown';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function chromiumVersion(resolveFrom) {
|
|
39
|
+
try {
|
|
40
|
+
const manifest = readJson(resolve(dirname(resolveFrom('playwright-core')), 'browsers.json'));
|
|
41
|
+
const chromium = manifest.browsers?.find((browser) => browser.name === 'chromium');
|
|
42
|
+
return chromium?.browserVersion ?? chromium?.revision ?? 'unknown';
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return 'unknown';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function readJson(path) {
|
|
49
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type BrowserSessionDeps } from '../browser-session-runner/index.mts';
|
|
2
|
+
import type { StorybookBrowserRunnerDeps } from './types.mts';
|
|
3
|
+
/** browser-session-runner uses this delay for its disabled startup and semantic stall timers. */
|
|
4
|
+
export declare const DISABLED_STALL_TIMER_MS = 2147483647;
|
|
5
|
+
export declare const defaultRunnerDeps: () => StorybookBrowserRunnerDeps;
|
|
6
|
+
/**
|
|
7
|
+
* Adapts the injected runner deps to `browser-session-runner`. Its disabled startup and semantic
|
|
8
|
+
* stall sentinels are the only callers that pass the maximum 32-bit delay, and those timers must
|
|
9
|
+
* not hold the process open, so they use unref'd native timers.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createBrowserSessionDeps(deps: StorybookBrowserRunnerDeps): BrowserSessionDeps;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { isProcessGroupAlive, waitForProcessGroupExit, } from "../browser-session-runner/index.mjs";
|
|
4
|
+
/** browser-session-runner uses this delay for its disabled startup and semantic stall timers. */
|
|
5
|
+
export const DISABLED_STALL_TIMER_MS = 2_147_483_647;
|
|
6
|
+
export const defaultRunnerDeps = () => ({
|
|
7
|
+
clearInterval,
|
|
8
|
+
clearTimeout,
|
|
9
|
+
cpSync,
|
|
10
|
+
cwd: process.cwd(),
|
|
11
|
+
existsSync,
|
|
12
|
+
isProcessGroupAlive,
|
|
13
|
+
killProcessGroup: (pid, signal) => {
|
|
14
|
+
try {
|
|
15
|
+
process.kill(-pid, signal);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error.code !== 'ESRCH')
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
mkdirSync,
|
|
23
|
+
now: () => performance.now(),
|
|
24
|
+
offParentSignal: (signal, listener) => process.off(signal, listener),
|
|
25
|
+
onParentSignal: (signal, listener) => process.on(signal, listener),
|
|
26
|
+
rmSync,
|
|
27
|
+
setInterval,
|
|
28
|
+
setTimeout,
|
|
29
|
+
spawn,
|
|
30
|
+
stderr: process.stderr,
|
|
31
|
+
stdout: process.stdout,
|
|
32
|
+
waitForProcessGroupExit,
|
|
33
|
+
writeFileSync,
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Adapts the injected runner deps to `browser-session-runner`. Its disabled startup and semantic
|
|
37
|
+
* stall sentinels are the only callers that pass the maximum 32-bit delay, and those timers must
|
|
38
|
+
* not hold the process open, so they use unref'd native timers.
|
|
39
|
+
*/
|
|
40
|
+
export function createBrowserSessionDeps(deps) {
|
|
41
|
+
const sentinelTimers = new Set();
|
|
42
|
+
return {
|
|
43
|
+
clearInterval: deps.clearInterval,
|
|
44
|
+
clearTimeout: (handle) => {
|
|
45
|
+
if (sentinelTimers.delete(handle)) {
|
|
46
|
+
clearTimeout(handle);
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
deps.clearTimeout(handle);
|
|
50
|
+
},
|
|
51
|
+
isProcessGroupAlive: deps.isProcessGroupAlive,
|
|
52
|
+
killProcessGroup: deps.killProcessGroup,
|
|
53
|
+
now: deps.now,
|
|
54
|
+
offParentSignal: deps.offParentSignal,
|
|
55
|
+
onParentSignal: deps.onParentSignal,
|
|
56
|
+
setInterval: deps.setInterval,
|
|
57
|
+
setTimeout: (callback, ms) => {
|
|
58
|
+
if (ms !== DISABLED_STALL_TIMER_MS)
|
|
59
|
+
return deps.setTimeout(callback, ms);
|
|
60
|
+
const timeout = setTimeout(() => {
|
|
61
|
+
sentinelTimers.delete(timeout);
|
|
62
|
+
callback();
|
|
63
|
+
}, ms);
|
|
64
|
+
timeout.unref?.();
|
|
65
|
+
sentinelTimers.add(timeout);
|
|
66
|
+
return timeout;
|
|
67
|
+
},
|
|
68
|
+
waitForProcessGroupExit: deps.waitForProcessGroupExit,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { spawn as defaultSpawn } from 'node:child_process';
|
|
2
|
+
import type { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import type { BrowserSessionDeps, isProcessGroupAlive, waitForProcessGroupExit } from '../browser-session-runner/index.mts';
|
|
4
|
+
/** Repository-specific values the runner takes as parameters. */
|
|
5
|
+
export type StorybookBrowserProject = {
|
|
6
|
+
/** Base argv after `command`. Defaults to `exec vitest run --project <projectName>`. */
|
|
7
|
+
args?: readonly string[];
|
|
8
|
+
/** Appended to the argv unless `<envPrefix>_COVERAGE` is `0`. Defaults to `--coverage`. */
|
|
9
|
+
coverageArgs?: readonly string[];
|
|
10
|
+
/** Command to spawn. Defaults to `pnpm`. */
|
|
11
|
+
command?: string;
|
|
12
|
+
/** Result file, relative to the working directory, whose appearance marks completion. */
|
|
13
|
+
completionFile?: string;
|
|
14
|
+
/** Prefix of the tunable env var names. Defaults to `STORYBOOK_BROWSER`. */
|
|
15
|
+
envPrefix?: string;
|
|
16
|
+
/** Config path named in the guidance printed when Vite discovers new optimizeDeps. */
|
|
17
|
+
optimizeDepsConfigPath?: string;
|
|
18
|
+
/** Progress marker prefix emitted by the Storybook progress reporter. */
|
|
19
|
+
progressPrefix?: string;
|
|
20
|
+
/** Vitest project name, also the browser-project output marker. */
|
|
21
|
+
projectName: string;
|
|
22
|
+
/** Files, relative to the working directory, removed before each attempt. */
|
|
23
|
+
resultFiles?: readonly string[];
|
|
24
|
+
};
|
|
25
|
+
export type ResolvedStorybookBrowserProject = Required<Omit<StorybookBrowserProject, 'completionFile' | 'optimizeDepsConfigPath'>> & {
|
|
26
|
+
completionFile: string | undefined;
|
|
27
|
+
optimizeDepsGuidance: string;
|
|
28
|
+
};
|
|
29
|
+
export type StorybookBrowserRunnerDeps = {
|
|
30
|
+
clearInterval: typeof clearInterval;
|
|
31
|
+
clearTimeout: typeof clearTimeout;
|
|
32
|
+
cpSync: typeof cpSync;
|
|
33
|
+
cwd: string;
|
|
34
|
+
existsSync: typeof existsSync;
|
|
35
|
+
isProcessGroupAlive: typeof isProcessGroupAlive;
|
|
36
|
+
killProcessGroup: (pid: number, signal: NodeJS.Signals) => void;
|
|
37
|
+
mkdirSync: typeof mkdirSync;
|
|
38
|
+
now: () => number;
|
|
39
|
+
offParentSignal: BrowserSessionDeps['offParentSignal'];
|
|
40
|
+
onParentSignal: BrowserSessionDeps['onParentSignal'];
|
|
41
|
+
rmSync: typeof rmSync;
|
|
42
|
+
setInterval: typeof setInterval;
|
|
43
|
+
setTimeout: typeof setTimeout;
|
|
44
|
+
spawn: typeof defaultSpawn;
|
|
45
|
+
stderr: Pick<NodeJS.WriteStream, 'write'>;
|
|
46
|
+
stdout: Pick<NodeJS.WriteStream, 'write'>;
|
|
47
|
+
waitForProcessGroupExit: typeof waitForProcessGroupExit;
|
|
48
|
+
writeFileSync: typeof writeFileSync;
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const stripAnsi: (log: string) => string;
|
|
2
|
+
export declare const hasStorybookBrowserViteDependencyReady: (plainLog: string) => boolean;
|
|
3
|
+
export declare const hasStorybookBrowserViteReady: (plainLog: string) => boolean;
|
|
4
|
+
export declare const hasStorybookViteNewDependenciesFound: (plainLog: string) => boolean;
|
|
5
|
+
export declare const hasStorybookViteOptimizerReload: (plainLog: string) => boolean;
|
|
6
|
+
export declare const parseStorybookViteNewDependencies: (plainLog: string) => string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const ansiEscapePattern = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, 'g');
|
|
2
|
+
const NEW_DEPENDENCIES_MARKER = 'new dependencies found:';
|
|
3
|
+
const OPTIMIZER_RELOAD_MARKER = 'optimized dependencies changed. reloading';
|
|
4
|
+
export const stripAnsi = (log) => log.replace(ansiEscapePattern, '');
|
|
5
|
+
export const hasStorybookBrowserViteDependencyReady = (plainLog) => plainLog.includes('dependencies optimized') || /\bhash is consistent\b/i.test(plainLog);
|
|
6
|
+
export const hasStorybookBrowserViteReady = (plainLog) => hasStorybookBrowserViteDependencyReady(plainLog) ||
|
|
7
|
+
/VITE v\d+\.\d+\.\d+\s*ready in \d+\s*ms/.test(plainLog);
|
|
8
|
+
export const hasStorybookViteNewDependenciesFound = (plainLog) => plainLog.includes(NEW_DEPENDENCIES_MARKER);
|
|
9
|
+
export const hasStorybookViteOptimizerReload = (plainLog) => plainLog.includes(OPTIMIZER_RELOAD_MARKER);
|
|
10
|
+
export const parseStorybookViteNewDependencies = (plainLog) => {
|
|
11
|
+
const names = new Set();
|
|
12
|
+
for (const match of plainLog.matchAll(/new dependencies found:\s*([^\n]+)/g)) {
|
|
13
|
+
for (const name of (match[1] ?? '').split(',')) {
|
|
14
|
+
const trimmed = name.trim();
|
|
15
|
+
if (trimmed)
|
|
16
|
+
names.add(trimmed);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return [...names];
|
|
20
|
+
};
|