@packtory/cli 0.0.102 → 0.0.104
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/command-line-interface/config-loader.js +2 -33
- package/command-line-interface/config-loader.js.map +1 -1
- package/command-line-interface/one-time-password-prompt.js +0 -31
- package/command-line-interface/one-time-password-prompt.js.map +1 -1
- package/command-line-interface/preview-io/preview-io-shared.js +2 -31
- package/command-line-interface/preview-io/preview-io-shared.js.map +1 -1
- package/command-line-interface/preview-io/preview-io.js +4 -15
- package/command-line-interface/preview-io/preview-io.js.map +1 -1
- package/command-line-interface/preview-io/preview-spawn.js +1 -26
- package/command-line-interface/preview-io/preview-spawn.js.map +1 -1
- package/command-line-interface/runner/changelog-destinations.js +5 -220
- package/command-line-interface/runner/changelog-destinations.js.map +1 -1
- package/command-line-interface/runner/changelog-handler.js +5 -79
- package/command-line-interface/runner/changelog-handler.js.map +1 -1
- package/command-line-interface/runner/changelog-pr-log-config.js +1 -147
- package/command-line-interface/runner/changelog-pr-log-config.js.map +1 -1
- package/command-line-interface/runner/command-parsing.js +0 -10
- package/command-line-interface/runner/command-parsing.js.map +1 -1
- package/command-line-interface/runner/config-inspect-handler.js +4 -79
- package/command-line-interface/runner/config-inspect-handler.js.map +1 -1
- package/command-line-interface/runner/failure-printing.js +5 -75
- package/command-line-interface/runner/failure-printing.js.map +1 -1
- package/command-line-interface/runner/github-api-request.js +0 -100
- package/command-line-interface/runner/github-api-request.js.map +1 -1
- package/command-line-interface/runner/github-release-client.js +2 -102
- package/command-line-interface/runner/github-release-client.js.map +1 -1
- package/command-line-interface/runner/github-release-notes.js +1 -74
- package/command-line-interface/runner/github-release-notes.js.map +1 -1
- package/command-line-interface/runner/github-repository.js +1 -14
- package/command-line-interface/runner/github-repository.js.map +1 -1
- package/command-line-interface/runner/pack-handler.js +4 -201
- package/command-line-interface/runner/pack-handler.js.map +1 -1
- package/command-line-interface/runner/package-dependencies-handler.js +3 -53
- package/command-line-interface/runner/package-dependencies-handler.js.map +1 -1
- package/command-line-interface/runner/package-tree-handler.js +3 -66
- package/command-line-interface/runner/package-tree-handler.js.map +1 -1
- package/command-line-interface/runner/preview-handler.js +4 -50
- package/command-line-interface/runner/preview-handler.js.map +1 -1
- package/command-line-interface/runner/progress-wiring.js +0 -32
- package/command-line-interface/runner/progress-wiring.js.map +1 -1
- package/command-line-interface/runner/publish-handler.js +2 -45
- package/command-line-interface/runner/publish-handler.js.map +1 -1
- package/command-line-interface/runner/release-diff-handler.js +3 -33
- package/command-line-interface/runner/release-diff-handler.js.map +1 -1
- package/command-line-interface/runner/release-handler.js +5 -246
- package/command-line-interface/runner/release-handler.js.map +1 -1
- package/command-line-interface/runner/release-output-files.js +2 -24
- package/command-line-interface/runner/release-output-files.js.map +1 -1
- package/command-line-interface/runner/release-plan-result-printing.js +2 -25
- package/command-line-interface/runner/release-plan-result-printing.js.map +1 -1
- package/command-line-interface/runner/release-pr-branch-commit.js +2 -108
- package/command-line-interface/runner/release-pr-branch-commit.js.map +1 -1
- package/command-line-interface/runner/release-pr-github-client.js +8 -289
- package/command-line-interface/runner/release-pr-github-client.js.map +1 -1
- package/command-line-interface/runner/release-pr-workflow-run-cancellation.js +3 -66
- package/command-line-interface/runner/release-pr-workflow-run-cancellation.js.map +1 -1
- package/command-line-interface/runner/release-pr-workflow-runs.js +1 -52
- package/command-line-interface/runner/release-pr-workflow-runs.js.map +1 -1
- package/command-line-interface/runner/release-preparation.js +4 -91
- package/command-line-interface/runner/release-preparation.js.map +1 -1
- package/command-line-interface/runner/release-publish-authorization.js +1 -66
- package/command-line-interface/runner/release-publish-authorization.js.map +1 -1
- package/command-line-interface/runner/release-pull-request-ci.js +0 -297
- package/command-line-interface/runner/release-pull-request-ci.js.map +1 -1
- package/command-line-interface/runner/release-pull-request-config.d.ts +0 -38
- package/command-line-interface/runner/release-pull-request-config.d.ts.map +1 -1
- package/command-line-interface/runner/release-pull-request-config.js +5 -51
- package/command-line-interface/runner/release-pull-request-config.js.map +1 -1
- package/command-line-interface/runner/release-pull-request-handler.js +9 -320
- package/command-line-interface/runner/release-pull-request-handler.js.map +1 -1
- package/command-line-interface/runner/release-pull-request-policy.js +0 -46
- package/command-line-interface/runner/release-pull-request-policy.js.map +1 -1
- package/command-line-interface/runner/release-pull-request-settings.js +2 -18
- package/command-line-interface/runner/release-pull-request-settings.js.map +1 -1
- package/command-line-interface/runner/report-persistence.js +2 -25
- package/command-line-interface/runner/report-persistence.js.map +1 -1
- package/command-line-interface/runner/runner-symbols.js +1 -10
- package/command-line-interface/runner/runner-symbols.js.map +1 -1
- package/command-line-interface/runner/runner.js +14 -385
- package/command-line-interface/runner/runner.js.map +1 -1
- package/command-line-interface/runner/terminal-error-chain.js +0 -101
- package/command-line-interface/runner/terminal-error-chain.js.map +1 -1
- package/command-line-interface/spinner/line-spinner-renderer.js +2 -49
- package/command-line-interface/spinner/line-spinner-renderer.js.map +1 -1
- package/command-line-interface/spinner/spinner-boot.js +1 -9
- package/command-line-interface/spinner/spinner-boot.js.map +1 -1
- package/command-line-interface/spinner/spinner-glyphs.js +1 -30
- package/command-line-interface/spinner/spinner-glyphs.js.map +1 -1
- package/command-line-interface/spinner/spinner-render-sequence.js +2 -30
- package/command-line-interface/spinner/spinner-render-sequence.js.map +1 -1
- package/command-line-interface/spinner/spinner-runtime.js +1 -30
- package/command-line-interface/spinner/spinner-runtime.js.map +1 -1
- package/command-line-interface/spinner/spinner-shared-state.js +0 -271
- package/command-line-interface/spinner/spinner-shared-state.js.map +1 -1
- package/command-line-interface/spinner/spinner-snapshots.js +1 -11
- package/command-line-interface/spinner/spinner-snapshots.js.map +1 -1
- package/command-line-interface/spinner/spinner-worker-backend.js +0 -42
- package/command-line-interface/spinner/spinner-worker-backend.js.map +1 -1
- package/command-line-interface/spinner/spinner-worker-loop.js +3 -39
- package/command-line-interface/spinner/spinner-worker-loop.js.map +1 -1
- package/command-line-interface/spinner/terminal-spinner-renderer.js +0 -54
- package/command-line-interface/spinner/terminal-spinner-renderer.js.map +1 -1
- package/common/path-tree.js +2 -100
- package/common/path-tree.js.map +1 -1
- package/package.json +3 -3
- package/packages/command-line-interface/pull-request-label-versioning.js +3 -80
- package/packages/command-line-interface/pull-request-label-versioning.js.map +1 -1
- package/packages/command-line-interface/spinner-boot.entry-point.js +3 -40
- package/packages/command-line-interface/spinner-boot.entry-point.js.map +1 -1
- package/packtory/changelog-source-file-history.js +2 -108
- package/packtory/changelog-source-file-history.js.map +1 -1
- package/packtory/packtory-changelog.js +5 -294
- package/packtory/packtory-changelog.js.map +1 -1
- package/report/html-renderer/artifact-tree-renderer.js +4 -28
- package/report/html-renderer/artifact-tree-renderer.js.map +1 -1
- package/report/html-renderer/diagnostics-renderer.js +2 -38
- package/report/html-renderer/diagnostics-renderer.js.map +1 -1
- package/report/html-renderer/diff-renderer.js +1 -28
- package/report/html-renderer/diff-renderer.js.map +1 -1
- package/report/html-renderer/eliminated-files-renderer.js +2 -15
- package/report/html-renderer/eliminated-files-renderer.js.map +1 -1
- package/report/html-renderer/html-escaping.js +0 -8
- package/report/html-renderer/html-escaping.js.map +1 -1
- package/report/html-renderer/html-primitives.js +1 -23
- package/report/html-renderer/html-primitives.js.map +1 -1
- package/report/html-renderer/html-renderer.js +4 -60
- package/report/html-renderer/html-renderer.js.map +1 -1
- package/report/html-renderer/html-styles.js +0 -176
- package/report/html-renderer/html-styles.js.map +1 -1
- package/report/html-renderer/package-renderer.js +6 -31
- package/report/html-renderer/package-renderer.js.map +1 -1
- package/report/preview/artifact-diff-builder.js +2 -19
- package/report/preview/artifact-diff-builder.js.map +1 -1
- package/report/preview/artifact-tree-builder.js +1 -19
- package/report/preview/artifact-tree-builder.js.map +1 -1
- package/report/preview/bundle-artifact-index.js +1 -15
- package/report/preview/bundle-artifact-index.js.map +1 -1
- package/report/preview/preview-document-state.js +0 -16
- package/report/preview/preview-document-state.js.map +1 -1
- package/report/preview/preview-document.js +6 -84
- package/report/preview/preview-document.js.map +1 -1
- package/report/preview/preview-result-inspectors.js +2 -33
- package/report/preview/preview-result-inspectors.js.map +1 -1
- package/report/preview/preview-summary.js +0 -25
- package/report/preview/preview-summary.js.map +1 -1
- package/report/release-diff/release-diff-document.js +2 -25
- package/report/release-diff/release-diff-document.js.map +1 -1
- package/report/release-diff/release-diff-summary.js +1 -39
- package/report/release-diff/release-diff-summary.js.map +1 -1
- package/report/terminal-renderer/terminal-artifact-renderer.js +2 -30
- package/report/terminal-renderer/terminal-artifact-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-package-dependencies-renderer.js +1 -77
- package/report/terminal-renderer/terminal-package-dependencies-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-package-renderer.js +2 -74
- package/report/terminal-renderer/terminal-package-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-package-tree-renderer.js +3 -16
- package/report/terminal-renderer/terminal-package-tree-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-preview-renderer-shared.js +3 -61
- package/report/terminal-renderer/terminal-preview-renderer-shared.js.map +1 -1
- package/report/terminal-renderer/terminal-preview-renderer.js +2 -54
- package/report/terminal-renderer/terminal-preview-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-release-diff-package-renderer.js +4 -145
- package/report/terminal-renderer/terminal-release-diff-package-renderer.js.map +1 -1
- package/report/terminal-renderer/terminal-release-diff-renderer.js +2 -48
- package/report/terminal-renderer/terminal-release-diff-renderer.js.map +1 -1
- package/sbom.cdx.json +15 -15
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function buildRedrawSequence(state, columns, expectedLineCount) {
|
|
4
|
-
let output = '';
|
|
5
|
-
if (state.renderedLineCount > 0) {
|
|
6
|
-
output += cursorUp(state.renderedLineCount);
|
|
7
|
-
}
|
|
8
|
-
const visibleSnapshots = state.snapshots.slice(0, expectedLineCount);
|
|
9
|
-
for (const snapshot of visibleSnapshots) {
|
|
10
|
-
const line = formatLine(snapshot, state.frameIndex, columns);
|
|
11
|
-
output += `${clearEntireLine + cursorToColumnZero + line}\n`;
|
|
12
|
-
}
|
|
13
|
-
return output;
|
|
14
|
-
}
|
|
15
|
-
export function buildRenderTickOutput(accessors, state) {
|
|
16
|
-
const targetMutation = accessors.getLatestMutation();
|
|
17
|
-
const snapshots = readAllSnapshots(accessors);
|
|
18
|
-
const highestActive = findHighestActiveSlotIndex(snapshots);
|
|
19
|
-
const shouldSkipWrite = highestActive < 0 && state.renderedLineCount === 0;
|
|
20
|
-
if (shouldSkipWrite) {
|
|
21
|
-
return { expectedLineCount: 0, snapshots, sequence: undefined, targetMutation };
|
|
22
|
-
}
|
|
23
|
-
const expectedLineCount = Math.max(state.renderedLineCount, highestActive + 1);
|
|
24
|
-
return {
|
|
25
|
-
expectedLineCount,
|
|
26
|
-
snapshots,
|
|
27
|
-
sequence: buildRedrawSequence({ ...state, snapshots }, accessors.getColumns(), expectedLineCount),
|
|
28
|
-
targetMutation
|
|
29
|
-
};
|
|
30
|
-
}
|
|
1
|
+
import "./spinner-glyphs.js";
|
|
2
|
+
import "./spinner-snapshots.js";
|
|
31
3
|
//# sourceMappingURL=spinner-render-sequence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-render-sequence.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-render-sequence.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"spinner-render-sequence.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-render-sequence.ts"],"names":[],"mappings":"AAAA,OAA0E,qBAAqB,CAAC;AAChG,OAAgF,wBAAwB,CAAC"}
|
|
@@ -1,31 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
const defaultSlotCount = 64;
|
|
3
|
-
const defaultIntervalMs = 80;
|
|
4
|
-
function resolveOptions(options) {
|
|
5
|
-
return {
|
|
6
|
-
slotCount: options.slotCount ?? defaultSlotCount,
|
|
7
|
-
intervalMs: options.intervalMs ?? defaultIntervalMs,
|
|
8
|
-
stdoutFileDescriptor: options.stdoutFileDescriptor,
|
|
9
|
-
stdoutColumns: options.stdoutColumns,
|
|
10
|
-
spawnWorker: options.spawnWorker
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function setupSharedBuffer(resolved) {
|
|
14
|
-
const layout = createSpinnerSharedLayout(resolved.slotCount);
|
|
15
|
-
const buffer = new SharedArrayBuffer(layout.bufferByteLength);
|
|
16
|
-
const accessors = createSpinnerSharedAccessors(buffer, layout);
|
|
17
|
-
accessors.setIntervalMs(resolved.intervalMs);
|
|
18
|
-
accessors.setColumns(resolved.stdoutColumns);
|
|
19
|
-
return accessors;
|
|
20
|
-
}
|
|
21
|
-
export function createSpinnerRuntime(options) {
|
|
22
|
-
const resolved = resolveOptions(options);
|
|
23
|
-
const accessors = setupSharedBuffer(resolved);
|
|
24
|
-
resolved.spawnWorker({
|
|
25
|
-
buffer: accessors.buffer,
|
|
26
|
-
slotCount: accessors.layout.slotCount,
|
|
27
|
-
stdoutFileDescriptor: resolved.stdoutFileDescriptor
|
|
28
|
-
});
|
|
29
|
-
return { accessors, slotCount: resolved.slotCount };
|
|
30
|
-
}
|
|
1
|
+
import "./spinner-shared-state.js";
|
|
31
2
|
//# sourceMappingURL=spinner-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-runtime.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-runtime.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"spinner-runtime.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-runtime.ts"],"names":[],"mappings":"AAAA,OAIO,2BAA2B,CAAC"}
|
|
@@ -1,272 +1 @@
|
|
|
1
|
-
const headerByteLength = 24;
|
|
2
|
-
const slotByteLength = 384;
|
|
3
|
-
const labelByteLength = 64;
|
|
4
|
-
const messageByteLength = 256;
|
|
5
|
-
const slotStateOffset = 4;
|
|
6
|
-
const slotLabelLengthOffset = 8;
|
|
7
|
-
const slotMessageLengthOffset = 10;
|
|
8
|
-
const slotLabelOffset = 16;
|
|
9
|
-
const slotMessageOffset = slotLabelOffset + labelByteLength;
|
|
10
|
-
const headerControlIndex = 0;
|
|
11
|
-
const headerColumnsIndex = 1;
|
|
12
|
-
const headerIntervalIndex = 2;
|
|
13
|
-
const headerMutationIndex = 3;
|
|
14
|
-
const headerRenderedMutationIndex = 4;
|
|
15
|
-
const slotGenerationIndex = 0;
|
|
16
|
-
const controlShutdownValue = 1;
|
|
17
|
-
const controlIdleValue = 0;
|
|
18
|
-
const maximumReadSlotAttempts = 1024;
|
|
19
|
-
const maximumRenderedMutationWaitAttempts = 256;
|
|
20
|
-
const slotStateEmpty = 0;
|
|
21
|
-
const slotStateRunning = 1;
|
|
22
|
-
const slotStateSucceeded = 2;
|
|
23
|
-
const slotStateFailed = 3;
|
|
24
|
-
const slotStateCanceled = 4;
|
|
25
|
-
const textEncoder = new TextEncoder();
|
|
26
|
-
const textDecoder = new TextDecoder();
|
|
27
|
-
const stateToByteMap = {
|
|
28
|
-
empty: slotStateEmpty,
|
|
29
|
-
running: slotStateRunning,
|
|
30
|
-
succeeded: slotStateSucceeded,
|
|
31
|
-
failed: slotStateFailed,
|
|
32
|
-
canceled: slotStateCanceled
|
|
33
|
-
};
|
|
34
|
-
const byteToStateMap = {
|
|
35
|
-
[slotStateEmpty]: 'empty',
|
|
36
|
-
[slotStateRunning]: 'running',
|
|
37
|
-
[slotStateSucceeded]: 'succeeded',
|
|
38
|
-
[slotStateFailed]: 'failed',
|
|
39
|
-
[slotStateCanceled]: 'canceled'
|
|
40
|
-
};
|
|
41
|
-
export function createSpinnerSharedLayout(slotCount) {
|
|
42
|
-
return {
|
|
43
|
-
bufferByteLength: headerByteLength + slotCount * slotByteLength,
|
|
44
|
-
slotCount,
|
|
45
|
-
slotByteLength,
|
|
46
|
-
headerByteLength
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function stateToByte(state) {
|
|
50
|
-
return stateToByteMap[state];
|
|
51
|
-
}
|
|
52
|
-
function byteToState(byte) {
|
|
53
|
-
const state = byteToStateMap[byte];
|
|
54
|
-
if (state === undefined) {
|
|
55
|
-
throw new Error(`Unknown spinner slot state byte ${byte}`);
|
|
56
|
-
}
|
|
57
|
-
return state;
|
|
58
|
-
}
|
|
59
|
-
const labelSlice = {
|
|
60
|
-
contentOffset: slotLabelOffset,
|
|
61
|
-
contentCapacity: labelByteLength,
|
|
62
|
-
lengthOffset: slotLabelLengthOffset
|
|
63
|
-
};
|
|
64
|
-
const messageSlice = {
|
|
65
|
-
contentOffset: slotMessageOffset,
|
|
66
|
-
contentCapacity: messageByteLength,
|
|
67
|
-
lengthOffset: slotMessageLengthOffset
|
|
68
|
-
};
|
|
69
|
-
function isPendingRenderedMutationWaitIteration(iteration) {
|
|
70
|
-
return Object.hasOwn(iteration, 'nextCurrent');
|
|
71
|
-
}
|
|
72
|
-
function renderedMutationWaitIterationResult(iteration) {
|
|
73
|
-
return Object.hasOwn(iteration, 'result') && Reflect.get(iteration, 'result') === true;
|
|
74
|
-
}
|
|
75
|
-
function getRenderedMutationWaitAttemptBudget(timeoutMs) {
|
|
76
|
-
return Math.min(maximumRenderedMutationWaitAttempts, Math.max(Math.ceil(timeoutMs), 1));
|
|
77
|
-
}
|
|
78
|
-
function waitForRenderedMutationStep(input) {
|
|
79
|
-
const waitStatus = input.atomics.wait(input.headerInt32, headerRenderedMutationIndex, input.expectedMutation, input.timeoutMs);
|
|
80
|
-
const current = input.atomics.load(input.headerInt32, headerRenderedMutationIndex);
|
|
81
|
-
return {
|
|
82
|
-
current,
|
|
83
|
-
remainingMs: input.deadline - input.now(),
|
|
84
|
-
timedOutWithoutProgress: waitStatus === 'timed-out' && current === input.expectedMutation
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function getRenderedMutationWaitResult(current, remainingMs, mutation) {
|
|
88
|
-
if (current >= mutation) {
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
if (remainingMs <= 0) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
function getRenderedMutationWaitStepResult(current, remainingMs, step, mutation) {
|
|
97
|
-
const waitResult = getRenderedMutationWaitResult(step.current, step.remainingMs, mutation);
|
|
98
|
-
if (waitResult !== undefined) {
|
|
99
|
-
return waitResult;
|
|
100
|
-
}
|
|
101
|
-
if (step.timedOutWithoutProgress) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
if (step.current === current && step.remainingMs > remainingMs) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
function initialRenderedMutationWaitState(input, deadline) {
|
|
110
|
-
return Float64Array.of(input.atomics.load(input.headerInt32, headerRenderedMutationIndex), deadline - input.now());
|
|
111
|
-
}
|
|
112
|
-
function advanceRenderedMutationWait(input) {
|
|
113
|
-
const currentResult = getRenderedMutationWaitResult(input.current, input.remainingMs, input.mutation);
|
|
114
|
-
if (currentResult !== undefined) {
|
|
115
|
-
return { result: currentResult };
|
|
116
|
-
}
|
|
117
|
-
const step = waitForRenderedMutationStep({
|
|
118
|
-
atomics: input.atomics,
|
|
119
|
-
headerInt32: input.headerInt32,
|
|
120
|
-
now: input.now,
|
|
121
|
-
deadline: input.deadline,
|
|
122
|
-
expectedMutation: input.current,
|
|
123
|
-
timeoutMs: Math.min(input.remainingMs, input.timeoutMs)
|
|
124
|
-
});
|
|
125
|
-
const stepResult = getRenderedMutationWaitStepResult(input.current, input.remainingMs, step, input.mutation);
|
|
126
|
-
if (stepResult !== undefined) {
|
|
127
|
-
return { result: stepResult };
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
nextCurrent: input.atomics.load(input.headerInt32, headerRenderedMutationIndex),
|
|
131
|
-
nextRemainingMs: step.remainingMs
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function waitForRenderedMutationWithinBudget(input) {
|
|
135
|
-
const deadline = input.now() + input.timeoutMs;
|
|
136
|
-
const maximumAttempts = getRenderedMutationWaitAttemptBudget(input.timeoutMs);
|
|
137
|
-
const budget = Array.from({ length: maximumAttempts }).reduce(function (currentBudget) {
|
|
138
|
-
if (currentBudget.type !== 'pending') {
|
|
139
|
-
return currentBudget;
|
|
140
|
-
}
|
|
141
|
-
const iteration = advanceRenderedMutationWait({
|
|
142
|
-
atomics: input.atomics,
|
|
143
|
-
headerInt32: input.headerInt32,
|
|
144
|
-
now: input.now,
|
|
145
|
-
deadline,
|
|
146
|
-
mutation: input.mutation,
|
|
147
|
-
current: Number(currentBudget.state[0]),
|
|
148
|
-
remainingMs: Number(currentBudget.state[1]),
|
|
149
|
-
timeoutMs: input.timeoutMs
|
|
150
|
-
});
|
|
151
|
-
if (!isPendingRenderedMutationWaitIteration(iteration)) {
|
|
152
|
-
return { type: 'finished', result: renderedMutationWaitIterationResult(iteration) };
|
|
153
|
-
}
|
|
154
|
-
return { type: 'pending', state: Float64Array.of(iteration.nextCurrent, iteration.nextRemainingMs) };
|
|
155
|
-
}, { type: 'pending', state: initialRenderedMutationWaitState(input, deadline) });
|
|
156
|
-
if (budget.type === 'finished') {
|
|
157
|
-
return budget.result;
|
|
158
|
-
}
|
|
159
|
-
return getRenderedMutationWaitResult(Number(budget.state[0]), Number(budget.state[1]), input.mutation) ?? false;
|
|
160
|
-
}
|
|
161
|
-
function writeStringIntoSlot(views, slotIndex, slice, value) {
|
|
162
|
-
const target = views
|
|
163
|
-
.slotBytes(slotIndex)
|
|
164
|
-
.subarray(slice.contentOffset, slice.contentOffset + slice.contentCapacity);
|
|
165
|
-
target.fill(0);
|
|
166
|
-
const { written } = textEncoder.encodeInto(value, target);
|
|
167
|
-
views.slotData(slotIndex).setUint16(slice.lengthOffset, written, true);
|
|
168
|
-
}
|
|
169
|
-
function readStringFromSlot(views, slotIndex, slice) {
|
|
170
|
-
const length = views.slotData(slotIndex).getUint16(slice.lengthOffset, true);
|
|
171
|
-
return textDecoder.decode(views.slotBytes(slotIndex).subarray(slice.contentOffset, slice.contentOffset + length));
|
|
172
|
-
}
|
|
173
|
-
export function createSpinnerSharedAccessors(buffer, layout, dependencies = {}) {
|
|
174
|
-
const atomics = dependencies.atomics ?? Atomics;
|
|
175
|
-
const now = dependencies.now ?? Date.now;
|
|
176
|
-
const headerInt32 = new Int32Array(buffer);
|
|
177
|
-
const headerUint32 = new Uint32Array(buffer);
|
|
178
|
-
const slotOffset = function (slotIndex) {
|
|
179
|
-
return layout.headerByteLength + slotIndex * layout.slotByteLength;
|
|
180
|
-
};
|
|
181
|
-
const views = {
|
|
182
|
-
headerInt32,
|
|
183
|
-
headerUint32,
|
|
184
|
-
slotInt32(slotIndex) {
|
|
185
|
-
return new Int32Array(buffer, slotOffset(slotIndex), 1);
|
|
186
|
-
},
|
|
187
|
-
slotBytes(slotIndex) {
|
|
188
|
-
return new Uint8Array(buffer, slotOffset(slotIndex), layout.slotByteLength);
|
|
189
|
-
},
|
|
190
|
-
slotData(slotIndex) {
|
|
191
|
-
return new DataView(buffer, slotOffset(slotIndex), layout.slotByteLength);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
function readSlotSnapshot(slotIndex) {
|
|
195
|
-
return {
|
|
196
|
-
state: byteToState(views.slotData(slotIndex).getUint8(slotStateOffset)),
|
|
197
|
-
label: readStringFromSlot(views, slotIndex, labelSlice),
|
|
198
|
-
message: readStringFromSlot(views, slotIndex, messageSlice)
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function readStableSlotAfterGeneration(slotIndex, generationBefore) {
|
|
202
|
-
const read = Array.from({ length: maximumReadSlotAttempts }).reduce(function (currentRead) {
|
|
203
|
-
if (currentRead.type !== 'pending') {
|
|
204
|
-
return currentRead;
|
|
205
|
-
}
|
|
206
|
-
const slot = readSlotSnapshot(slotIndex);
|
|
207
|
-
const nextGeneration = atomics.load(views.slotInt32(slotIndex), slotGenerationIndex);
|
|
208
|
-
if (nextGeneration === currentRead.generation) {
|
|
209
|
-
return { type: 'finished', slot };
|
|
210
|
-
}
|
|
211
|
-
return { type: 'pending', generation: nextGeneration };
|
|
212
|
-
}, { type: 'pending', generation: generationBefore });
|
|
213
|
-
if (read.type === 'finished') {
|
|
214
|
-
return read.slot;
|
|
215
|
-
}
|
|
216
|
-
throw new Error(`Failed to read a stable spinner slot snapshot after ${maximumReadSlotAttempts} attempts`);
|
|
217
|
-
}
|
|
218
|
-
function readStableSlot(slotIndex) {
|
|
219
|
-
return readStableSlotAfterGeneration(slotIndex, atomics.load(views.slotInt32(slotIndex), slotGenerationIndex));
|
|
220
|
-
}
|
|
221
|
-
return {
|
|
222
|
-
layout,
|
|
223
|
-
buffer,
|
|
224
|
-
setColumns(columns) {
|
|
225
|
-
atomics.store(views.headerUint32, headerColumnsIndex, columns);
|
|
226
|
-
},
|
|
227
|
-
getColumns() {
|
|
228
|
-
return atomics.load(views.headerUint32, headerColumnsIndex);
|
|
229
|
-
},
|
|
230
|
-
setIntervalMs(intervalMs) {
|
|
231
|
-
atomics.store(views.headerUint32, headerIntervalIndex, intervalMs);
|
|
232
|
-
},
|
|
233
|
-
getIntervalMs() {
|
|
234
|
-
return atomics.load(views.headerUint32, headerIntervalIndex);
|
|
235
|
-
},
|
|
236
|
-
markMutation() {
|
|
237
|
-
return atomics.add(views.headerInt32, headerMutationIndex, 1) + 1;
|
|
238
|
-
},
|
|
239
|
-
getLatestMutation() {
|
|
240
|
-
return atomics.load(views.headerInt32, headerMutationIndex);
|
|
241
|
-
},
|
|
242
|
-
acknowledgeRender(mutation) {
|
|
243
|
-
atomics.store(views.headerInt32, headerRenderedMutationIndex, mutation);
|
|
244
|
-
atomics.notify(views.headerInt32, headerRenderedMutationIndex);
|
|
245
|
-
},
|
|
246
|
-
waitForRenderedMutation(mutation, timeoutMs) {
|
|
247
|
-
return waitForRenderedMutationWithinBudget({
|
|
248
|
-
atomics,
|
|
249
|
-
headerInt32: views.headerInt32,
|
|
250
|
-
mutation,
|
|
251
|
-
now,
|
|
252
|
-
timeoutMs
|
|
253
|
-
});
|
|
254
|
-
},
|
|
255
|
-
requestShutdown() {
|
|
256
|
-
atomics.store(views.headerInt32, headerControlIndex, controlShutdownValue);
|
|
257
|
-
},
|
|
258
|
-
isShutdownRequested() {
|
|
259
|
-
return atomics.load(views.headerInt32, headerControlIndex) !== controlIdleValue;
|
|
260
|
-
},
|
|
261
|
-
bumpSlotGeneration(slotIndex) {
|
|
262
|
-
atomics.add(views.slotInt32(slotIndex), slotGenerationIndex, 1);
|
|
263
|
-
},
|
|
264
|
-
writeSlot(slotIndex, state, label, message) {
|
|
265
|
-
views.slotData(slotIndex).setUint8(slotStateOffset, stateToByte(state));
|
|
266
|
-
writeStringIntoSlot(views, slotIndex, labelSlice, label);
|
|
267
|
-
writeStringIntoSlot(views, slotIndex, messageSlice, message);
|
|
268
|
-
},
|
|
269
|
-
readSlot: readStableSlot
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
1
|
//# sourceMappingURL=spinner-shared-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-shared-state.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-shared-state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spinner-shared-state.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-shared-state.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export function readAllSnapshots(accessors) {
|
|
3
|
-
return times(accessors.layout.slotCount, function (slotIndex) {
|
|
4
|
-
return accessors.readSlot(slotIndex);
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
export function findHighestActiveSlotIndex(snapshots) {
|
|
8
|
-
return snapshots.findLastIndex(function (snapshot) {
|
|
9
|
-
return snapshot.state !== 'empty';
|
|
10
|
-
});
|
|
11
|
-
}
|
|
1
|
+
import 'remeda';
|
|
12
2
|
//# sourceMappingURL=spinner-snapshots.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-snapshots.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-snapshots.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"spinner-snapshots.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-snapshots.ts"],"names":[],"mappings":"AAAA,OAAsB,QAAQ,CAAC"}
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
const shutdownFlushIntervals = 4;
|
|
2
|
-
const minimumShutdownFlushTimeoutMs = 100;
|
|
3
|
-
function writeSlot(accessors, update) {
|
|
4
|
-
accessors.writeSlot(update.slotIndex, update.state, update.label, update.message);
|
|
5
|
-
accessors.bumpSlotGeneration(update.slotIndex);
|
|
6
|
-
accessors.markMutation();
|
|
7
|
-
}
|
|
8
|
-
export function createWorkerSpinnerBackend(dependencies) {
|
|
9
|
-
const { runtime } = dependencies;
|
|
10
|
-
const shutdownFlushTimeoutMs = Math.max(runtime.accessors.getIntervalMs() * shutdownFlushIntervals, minimumShutdownFlushTimeoutMs);
|
|
11
|
-
let shutdownSignaled = false;
|
|
12
|
-
function ensureSlotIndexFits(slotIndex) {
|
|
13
|
-
if (slotIndex >= runtime.slotCount) {
|
|
14
|
-
throw new RangeError(`Spinner slot index ${slotIndex} exceeds backend capacity ${runtime.slotCount}; increase slotCount`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
add(slotIndex, label, message) {
|
|
19
|
-
ensureSlotIndexFits(slotIndex);
|
|
20
|
-
writeSlot(runtime.accessors, { slotIndex, state: 'running', label, message });
|
|
21
|
-
},
|
|
22
|
-
update(slotIndex, label, message) {
|
|
23
|
-
ensureSlotIndexFits(slotIndex);
|
|
24
|
-
writeSlot(runtime.accessors, { slotIndex, state: 'running', label, message });
|
|
25
|
-
},
|
|
26
|
-
finish(slotIndex, status, label, message) {
|
|
27
|
-
ensureSlotIndexFits(slotIndex);
|
|
28
|
-
writeSlot(runtime.accessors, { slotIndex, state: status, label, message });
|
|
29
|
-
},
|
|
30
|
-
shutdown() {
|
|
31
|
-
if (shutdownSignaled) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
shutdownSignaled = true;
|
|
35
|
-
runtime.accessors.requestShutdown();
|
|
36
|
-
const shutdownMutation = runtime.accessors.markMutation();
|
|
37
|
-
if (runtime.accessors.getIntervalMs() > 0) {
|
|
38
|
-
runtime.accessors.waitForRenderedMutation(shutdownMutation, shutdownFlushTimeoutMs);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
1
|
//# sourceMappingURL=spinner-worker-backend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-worker-backend.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-worker-backend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spinner-worker-backend.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-worker-backend.ts"],"names":[],"mappings":""}
|
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
export function startSpinnerWorker(input, dependencies) {
|
|
5
|
-
const layout = createSpinnerSharedLayout(input.slotCount);
|
|
6
|
-
const accessors = createSpinnerSharedAccessors(input.buffer, layout);
|
|
7
|
-
let state = {
|
|
8
|
-
snapshots: readAllSnapshots(accessors),
|
|
9
|
-
renderedLineCount: 0,
|
|
10
|
-
frameIndex: 0
|
|
11
|
-
};
|
|
12
|
-
function renderTick() {
|
|
13
|
-
const output = buildRenderTickOutput(accessors, state);
|
|
14
|
-
if (output.sequence !== undefined) {
|
|
15
|
-
dependencies.write(input.stdoutFileDescriptor, output.sequence);
|
|
16
|
-
state = {
|
|
17
|
-
snapshots: output.snapshots,
|
|
18
|
-
renderedLineCount: output.expectedLineCount,
|
|
19
|
-
frameIndex: state.frameIndex + 1
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
accessors.acknowledgeRender(output.targetMutation);
|
|
23
|
-
}
|
|
24
|
-
const intervalMs = accessors.getIntervalMs();
|
|
25
|
-
const ticker = dependencies.setInterval(function () {
|
|
26
|
-
renderTick();
|
|
27
|
-
if (accessors.isShutdownRequested()) {
|
|
28
|
-
renderTick();
|
|
29
|
-
dependencies.clearInterval(ticker);
|
|
30
|
-
}
|
|
31
|
-
}, intervalMs);
|
|
32
|
-
}
|
|
33
|
-
export function isSpinnerWorkerInput(value) {
|
|
34
|
-
return (typeof value === 'object' &&
|
|
35
|
-
value !== null &&
|
|
36
|
-
Reflect.get(value, 'buffer') instanceof SharedArrayBuffer &&
|
|
37
|
-
typeof Reflect.get(value, 'slotCount') === 'number' &&
|
|
38
|
-
typeof Reflect.get(value, 'stdoutFileDescriptor') === 'number');
|
|
39
|
-
}
|
|
1
|
+
import "./spinner-render-sequence.js";
|
|
2
|
+
import "./spinner-shared-state.js";
|
|
3
|
+
import "./spinner-snapshots.js";
|
|
40
4
|
//# sourceMappingURL=spinner-worker-loop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner-worker-loop.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-worker-loop.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"spinner-worker-loop.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/spinner-worker-loop.ts"],"names":[],"mappings":"AAAA,OAAwD,8BAA8B,CAAC;AACvF,OAAwE,2BAA2B,CAAC;AACpG,OAAiC,wBAAwB,CAAC"}
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
export const spinnerResultStatus = {
|
|
2
|
-
failure: 'failure',
|
|
3
|
-
success: 'success'
|
|
4
|
-
};
|
|
5
|
-
const cancelMessage = 'Canceled …';
|
|
6
|
-
export function createTerminalSpinnerRenderer(dependencies) {
|
|
7
|
-
const { backend } = dependencies;
|
|
8
|
-
const spinners = new Map();
|
|
9
|
-
const usedSlots = new Set();
|
|
10
|
-
function nextFreeSlotIndex() {
|
|
11
|
-
return usedSlots.size;
|
|
12
|
-
}
|
|
13
|
-
function getSpinnerById(id) {
|
|
14
|
-
const spinner = spinners.get(id);
|
|
15
|
-
if (spinner === undefined) {
|
|
16
|
-
throw new Error(`Spinner with id ${id} does not exist`);
|
|
17
|
-
}
|
|
18
|
-
return spinner;
|
|
19
|
-
}
|
|
20
|
-
function ensureIdDoesNotExist(id) {
|
|
21
|
-
if (spinners.has(id)) {
|
|
22
|
-
throw new Error(`Spinner with id ${id} already exists`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
add(id, label, message) {
|
|
27
|
-
ensureIdDoesNotExist(id);
|
|
28
|
-
const slotIndex = nextFreeSlotIndex();
|
|
29
|
-
usedSlots.add(slotIndex);
|
|
30
|
-
spinners.set(id, { slotIndex, label, message, status: 'running' });
|
|
31
|
-
backend.add(slotIndex, label, message);
|
|
32
|
-
},
|
|
33
|
-
updateMessage(id, message) {
|
|
34
|
-
const spinner = getSpinnerById(id);
|
|
35
|
-
spinners.set(id, { ...spinner, message });
|
|
36
|
-
backend.update(spinner.slotIndex, spinner.label, message);
|
|
37
|
-
},
|
|
38
|
-
stop(id, status, message) {
|
|
39
|
-
const spinner = getSpinnerById(id);
|
|
40
|
-
spinners.set(id, { ...spinner, message, status });
|
|
41
|
-
const finalState = status === spinnerResultStatus.success ? 'succeeded' : 'failed';
|
|
42
|
-
backend.finish(spinner.slotIndex, finalState, spinner.label, message);
|
|
43
|
-
},
|
|
44
|
-
stopAll() {
|
|
45
|
-
for (const spinner of spinners.values()) {
|
|
46
|
-
if (spinner.status === 'running') {
|
|
47
|
-
backend.finish(spinner.slotIndex, 'canceled', spinner.label, cancelMessage);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
spinners.clear();
|
|
51
|
-
backend.shutdown();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
1
|
//# sourceMappingURL=terminal-spinner-renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-spinner-renderer.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/terminal-spinner-renderer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"terminal-spinner-renderer.js","sourceRoot":"","sources":["../../../../../source/command-line-interface/spinner/terminal-spinner-renderer.ts"],"names":[],"mappings":""}
|