nx 23.3.0-beta.0 → 23.3.0-beta.2
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/dist/src/command-line/format/format.js +2 -18
- package/dist/src/command-line/graph/graph.js +42 -3
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
- package/dist/src/command-line/init/implementation/angular/index.js +0 -3
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
- package/dist/src/command-line/init/implementation/format.js +2 -3
- package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
- package/dist/src/command-line/init/implementation/utils.js +0 -8
- package/dist/src/command-line/init/init-v2.js +0 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +75 -19
- package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
- package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +27 -17
- package/dist/src/command-line/migrate/agentic/handoff.js +107 -24
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +21 -0
- package/dist/src/command-line/migrate/agentic/instruction-files.js +36 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +16 -0
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +70 -0
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
- package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
- package/dist/src/command-line/migrate/agentic/runner.d.ts +17 -8
- package/dist/src/command-line/migrate/agentic/runner.js +110 -55
- package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
- package/dist/src/command-line/migrate/agentic/types.js +10 -7
- package/dist/src/command-line/migrate/migrate-commits.d.ts +1 -0
- package/dist/src/command-line/migrate/migrate-commits.js +9 -0
- package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
- package/dist/src/command-line/migrate/migrate-output.js +3 -7
- package/dist/src/command-line/migrate/migrate.js +21 -8
- package/dist/src/command-line/migrate/run/agent-output.d.ts +10 -0
- package/dist/src/command-line/migrate/run/agent-output.js +16 -2
- package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
- package/dist/src/command-line/migrate/run/agent-work-payload.js +142 -0
- package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
- package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
- package/dist/src/command-line/migrate/run/index.d.ts +1 -1
- package/dist/src/command-line/migrate/run/issues.d.ts +106 -0
- package/dist/src/command-line/migrate/run/issues.js +980 -0
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +1 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +662 -105
- package/dist/src/command-line/migrate/run/run-state.d.ts +43 -8
- package/dist/src/command-line/migrate/run/run-state.js +184 -20
- package/dist/src/command-line/migrate/run/runbook.d.ts +17 -0
- package/dist/src/command-line/migrate/run/runbook.js +97 -0
- package/dist/src/command-line/migrate/run/state-lock.d.ts +2 -2
- package/dist/src/command-line/migrate/run/state-lock.js +2 -2
- package/dist/src/command-line/migrate/run/state-machine.d.ts +5 -1
- package/dist/src/command-line/migrate/run/state-machine.js +27 -1
- package/dist/src/command-line/migrate/run/worker.js +206 -56
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
- package/dist/src/command-line/release/publish.js +11 -4
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +3 -3
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +2 -0
- package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +35 -0
- package/dist/src/command-line/report/report.d.ts +2 -0
- package/dist/src/command-line/report/report.js +28 -1
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
- package/dist/src/command-line/yargs-utils/shared-options.js +22 -4
- package/dist/src/config/workspace-json-project-json.d.ts +2 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +6 -2
- package/dist/src/daemon/client/client.js +27 -11
- package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
- package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
- package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
- package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +8 -2
- package/dist/src/daemon/server/handle-hash-tasks.js +16 -3
- package/dist/src/daemon/server/handle-outputs-changes.d.ts +2 -2
- package/dist/src/daemon/server/handle-outputs-changes.js +21 -6
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
- package/dist/src/daemon/server/outputs-tracking.d.ts +6 -0
- package/dist/src/daemon/server/outputs-tracking.js +18 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +100 -70
- package/dist/src/daemon/server/restart-checks.d.ts +22 -0
- package/dist/src/daemon/server/restart-checks.js +77 -0
- package/dist/src/daemon/server/server.js +33 -18
- package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
- package/dist/src/daemon/server/shutdown-utils.js +3 -26
- package/dist/src/hasher/hash-task.js +20 -16
- package/dist/src/hasher/native-task-hasher-impl.d.ts +8 -0
- package/dist/src/hasher/native-task-hasher-impl.js +46 -3
- package/dist/src/hasher/task-hasher.d.ts +9 -0
- package/dist/src/hasher/task-hasher.js +14 -0
- package/dist/src/native/index.d.ts +222 -21
- package/dist/src/native/index.js +3 -3
- package/dist/src/native/native-bindings.js +4 -1
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
- package/dist/src/plugins/js/utils/register.js +2 -1
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +19 -26
- package/dist/src/project-graph/error-types.d.ts +5 -0
- package/dist/src/project-graph/error-types.js +44 -5
- package/dist/src/project-graph/file-utils.d.ts +2 -0
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
- package/dist/src/project-graph/nx-deps-cache.js +4 -4
- package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
- package/dist/src/project-graph/plugins/get-plugins.js +60 -82
- package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
- package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
- package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/index.js +3 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
- package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
- package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
- package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
- package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
- package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
- package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
- package/dist/src/project-graph/project-graph.js +43 -42
- package/dist/src/tasks-runner/batch/run-batch.js +15 -0
- package/dist/src/tasks-runner/cache.d.ts +35 -0
- package/dist/src/tasks-runner/cache.js +40 -0
- package/dist/src/tasks-runner/create-task-graph.js +1 -0
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
- package/dist/src/tasks-runner/forked-process-task-runner.js +8 -7
- package/dist/src/tasks-runner/init-tasks-runner.js +5 -1
- package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
- package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
- package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
- package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
- package/dist/src/tasks-runner/prune-task-graph.js +45 -0
- package/dist/src/tasks-runner/run-command.js +14 -3
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
- package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
- package/dist/src/tasks-runner/task-orchestrator.d.ts +64 -2
- package/dist/src/tasks-runner/task-orchestrator.js +232 -46
- package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
- package/dist/src/tasks-runner/terminal-output-path.js +18 -0
- package/dist/src/tasks-runner/utils.js +5 -2
- package/dist/src/utils/ab-testing.d.ts +4 -1
- package/dist/src/utils/ab-testing.js +11 -7
- package/dist/src/utils/chunkify.d.ts +1 -7
- package/dist/src/utils/chunkify.js +2 -8
- package/dist/src/utils/command-line-utils.d.ts +19 -0
- package/dist/src/utils/command-line-utils.js +10 -3
- package/dist/src/utils/formatters/index.d.ts +6 -0
- package/dist/src/utils/formatters/index.js +5 -0
- package/dist/src/utils/formatters/prettier.d.ts +0 -8
- package/dist/src/utils/formatters/prettier.js +4 -26
- package/dist/src/utils/handle-errors.js +5 -43
- package/dist/src/utils/installed-nx-version.js +2 -48
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/output.d.ts +22 -3
- package/dist/src/utils/output.js +28 -5
- package/dist/src/utils/package-json.d.ts +25 -0
- package/dist/src/utils/package-json.js +41 -6
- package/dist/src/utils/package-manager.d.ts +6 -0
- package/dist/src/utils/package-manager.js +10 -0
- package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
- package/dist/src/utils/provenance.js +20 -4
- package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
- package/dist/src/utils/workspace-context.d.ts +47 -3
- package/dist/src/utils/workspace-context.js +162 -10
- package/package.json +12 -13
- package/schemas/nx-schema.json +4 -0
- package/schemas/project-schema.json +4 -0
- package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
- package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
- package/dist/src/daemon/server/watcher.d.ts +0 -18
- package/dist/src/daemon/server/watcher.js +0 -126
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SummaryTerminalOutputLifeCycle = void 0;
|
|
4
|
+
const output_1 = require("../../utils/output");
|
|
5
|
+
const terminal_output_path_1 = require("../terminal-output-path");
|
|
6
|
+
/**
|
|
7
|
+
* Prints a run as a handful of lines rather than a transcript: counts, then one
|
|
8
|
+
* line per failure naming the file that holds its output. Task output stops
|
|
9
|
+
* being a stream to read and becomes an artifact to address, so the size of this
|
|
10
|
+
* renderer's output depends on how many tasks failed, never on how loud they
|
|
11
|
+
* were.
|
|
12
|
+
*
|
|
13
|
+
* Selected by `--output-style=summary`, and by default when Nx is driven by an
|
|
14
|
+
* AI agent, which otherwise reads thousands of lines of passing output to find
|
|
15
|
+
* the one failure.
|
|
16
|
+
*/
|
|
17
|
+
class SummaryTerminalOutputLifeCycle {
|
|
18
|
+
constructor(tasks) {
|
|
19
|
+
this.tasks = tasks;
|
|
20
|
+
this.failed = [];
|
|
21
|
+
this.stopped = [];
|
|
22
|
+
this.completed = new Set();
|
|
23
|
+
this.succeeded = 0;
|
|
24
|
+
this.cached = 0;
|
|
25
|
+
this.batchLogs = new Map();
|
|
26
|
+
}
|
|
27
|
+
setCloudLink(label, url) {
|
|
28
|
+
this.cloudLink = { label, url };
|
|
29
|
+
}
|
|
30
|
+
batchOutputAvailable(batchId, path) {
|
|
31
|
+
this.batchLogs.set(batchId, path);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Nothing is printed as tasks complete. A summary that interleaved with
|
|
35
|
+
* progress would be a transcript again.
|
|
36
|
+
*/
|
|
37
|
+
printTaskTerminalOutput() { }
|
|
38
|
+
endTasks(taskResults) {
|
|
39
|
+
for (const { task, status, terminalOutput } of taskResults) {
|
|
40
|
+
this.completed.add(task.id);
|
|
41
|
+
switch (status) {
|
|
42
|
+
case 'failure':
|
|
43
|
+
// Whether a log file exists is decided here, not at render time.
|
|
44
|
+
// `persistTerminalOutputs` skips only an undefined `terminalOutput`,
|
|
45
|
+
// so an empty one still writes a 0-byte file - truthiness, not
|
|
46
|
+
// definedness, is what says a reader will find something there.
|
|
47
|
+
this.failed.push({
|
|
48
|
+
task,
|
|
49
|
+
hasOutput: !!terminalOutput,
|
|
50
|
+
});
|
|
51
|
+
break;
|
|
52
|
+
case 'stopped':
|
|
53
|
+
// Every task of a stopped batch carries `''`: the worker's partial
|
|
54
|
+
// log is announced as the batch's own artifact now, not folded into
|
|
55
|
+
// any task. So these address a file only when something else wrote
|
|
56
|
+
// one, and the batch log is addressed once below.
|
|
57
|
+
this.stopped.push({
|
|
58
|
+
task,
|
|
59
|
+
hasOutput: !!terminalOutput,
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
case 'local-cache':
|
|
63
|
+
case 'local-cache-kept-existing':
|
|
64
|
+
case 'remote-cache':
|
|
65
|
+
this.cached++;
|
|
66
|
+
this.succeeded++;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
this.succeeded++;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
endCommand() {
|
|
74
|
+
const skipped = this.tasks.filter((t) => !this.completed.has(t.id)).length;
|
|
75
|
+
const bodyLines = [];
|
|
76
|
+
for (const { task, hasOutput } of this.failed) {
|
|
77
|
+
bodyLines.push('', ...this.failureBlock(task, hasOutput));
|
|
78
|
+
}
|
|
79
|
+
if (this.stopped.length > 0) {
|
|
80
|
+
bodyLines.push('', output_1.output.dim('Stopped before finishing:'), ...this.stopped.flatMap(({ task, hasOutput }) => {
|
|
81
|
+
const line = `${output_1.output.dim('-')} ${task.id}`;
|
|
82
|
+
return task.hash && hasOutput
|
|
83
|
+
? [
|
|
84
|
+
line,
|
|
85
|
+
output_1.output.dim(` full log: ${(0, terminal_output_path_1.terminalOutputPathForHash)(task.hash)}`),
|
|
86
|
+
]
|
|
87
|
+
: [line];
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
if (this.batchLogs.size > 0) {
|
|
91
|
+
// One line per worker, not per task: a batch's log explains the whole
|
|
92
|
+
// batch, and no task's own output file contains it.
|
|
93
|
+
bodyLines.push('', output_1.output.dim('Batch worker logs:'));
|
|
94
|
+
for (const [batchId, path] of this.batchLogs) {
|
|
95
|
+
bodyLines.push(`${output_1.output.dim('-')} ${output_1.output.dim(`${batchId}: ${path}`)}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (this.cloudLink) {
|
|
99
|
+
bodyLines.push('', `${this.cloudLink.label} ${this.cloudLink.url}`);
|
|
100
|
+
}
|
|
101
|
+
bodyLines.push('', output_1.output.dim('Re-run with --output-style=static to inline logs.'));
|
|
102
|
+
const title = this.countsLine(skipped);
|
|
103
|
+
if (this.failed.length > 0 || this.stopped.length > 0) {
|
|
104
|
+
output_1.output.error({ title, bodyLines });
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
output_1.output.success({ title, bodyLines });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
countsLine(skipped) {
|
|
111
|
+
const parts = [`${this.succeeded} succeeded`];
|
|
112
|
+
if (this.cached > 0) {
|
|
113
|
+
parts.push(`${this.cached} cached`);
|
|
114
|
+
}
|
|
115
|
+
if (this.failed.length > 0) {
|
|
116
|
+
parts.push(`${this.failed.length} failed`);
|
|
117
|
+
}
|
|
118
|
+
if (this.stopped.length > 0) {
|
|
119
|
+
parts.push(`${this.stopped.length} stopped`);
|
|
120
|
+
}
|
|
121
|
+
if (skipped > 0) {
|
|
122
|
+
parts.push(`${skipped} skipped`);
|
|
123
|
+
}
|
|
124
|
+
return `${this.tasks.length} ${this.tasks.length === 1 ? 'task' : 'tasks'}: ${parts.join(', ')}`;
|
|
125
|
+
}
|
|
126
|
+
failureBlock(task, hasOutput) {
|
|
127
|
+
// No exit code: `completeTasks` rebuilds `TaskResult.code` from the status,
|
|
128
|
+
// so every failure arrives as 1 and a task killed with 137 or a missing
|
|
129
|
+
// binary's 127 would all render `(exit 1)`. Printing a number that is
|
|
130
|
+
// always 1 to a reader whose job is to machine-read this line is worse than
|
|
131
|
+
// printing none. formatCommand is what every other renderer uses, so a task
|
|
132
|
+
// reads the same here as it does under --output-style=static.
|
|
133
|
+
const lines = [
|
|
134
|
+
`${output_1.output.colors.red('✖')} ${output_1.output.formatCommand(task.id)}`,
|
|
135
|
+
];
|
|
136
|
+
// The log is addressed, not reproduced. `hash` is optional on the type but
|
|
137
|
+
// always set by the time a task has run — processTask hashes before it
|
|
138
|
+
// schedules — so that half only guards against printing a bogus path.
|
|
139
|
+
// `hasOutput` is the load-bearing half: no output, no file, no address.
|
|
140
|
+
if (task.hash && hasOutput) {
|
|
141
|
+
lines.push(output_1.output.dim(` full log: ${(0, terminal_output_path_1.terminalOutputPathForHash)(task.hash)}`));
|
|
142
|
+
}
|
|
143
|
+
return lines;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.SummaryTerminalOutputLifeCycle = SummaryTerminalOutputLifeCycle;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TaskGraph } from '../config/task-graph';
|
|
2
|
+
/**
|
|
3
|
+
* Everything written onto a task as a run progresses: hashes and hash
|
|
4
|
+
* details by the hasher, timings by the orchestrator, terminal output by the
|
|
5
|
+
* Nx Cloud life cycle. Nothing that receives a task graph over a socket or
|
|
6
|
+
* a fork needs any of it. The daemon recomputes hashes, and a worker learns
|
|
7
|
+
* its own from `NX_TASK_HASH`; hash details are read only by Nx Cloud on the
|
|
8
|
+
* runner side.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TASK_RESULT_FIELDS: readonly ['hash', 'hashDetails', 'startTime', 'endTime', 'terminalOutput'];
|
|
11
|
+
/**
|
|
12
|
+
* A copy of the graph with `TASK_RESULT_FIELDS` removed from every task, made
|
|
13
|
+
* once per graph object. Structure and the remaining fields are fixed once a
|
|
14
|
+
* graph is built and only result fields change during a run, so the copy
|
|
15
|
+
* never goes stale, and the source graph is untouched.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pruneTaskGraph(taskGraph: TaskGraph): TaskGraph;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TASK_RESULT_FIELDS = void 0;
|
|
4
|
+
exports.pruneTaskGraph = pruneTaskGraph;
|
|
5
|
+
/**
|
|
6
|
+
* Everything written onto a task as a run progresses: hashes and hash
|
|
7
|
+
* details by the hasher, timings by the orchestrator, terminal output by the
|
|
8
|
+
* Nx Cloud life cycle. Nothing that receives a task graph over a socket or
|
|
9
|
+
* a fork needs any of it. The daemon recomputes hashes, and a worker learns
|
|
10
|
+
* its own from `NX_TASK_HASH`; hash details are read only by Nx Cloud on the
|
|
11
|
+
* runner side.
|
|
12
|
+
*/
|
|
13
|
+
exports.TASK_RESULT_FIELDS = [
|
|
14
|
+
'hash',
|
|
15
|
+
'hashDetails',
|
|
16
|
+
'startTime',
|
|
17
|
+
'endTime',
|
|
18
|
+
'terminalOutput',
|
|
19
|
+
];
|
|
20
|
+
const prunedGraphs = new WeakMap();
|
|
21
|
+
/**
|
|
22
|
+
* A copy of the graph with `TASK_RESULT_FIELDS` removed from every task, made
|
|
23
|
+
* once per graph object. Structure and the remaining fields are fixed once a
|
|
24
|
+
* graph is built and only result fields change during a run, so the copy
|
|
25
|
+
* never goes stale, and the source graph is untouched.
|
|
26
|
+
*/
|
|
27
|
+
function pruneTaskGraph(taskGraph) {
|
|
28
|
+
let pruned = prunedGraphs.get(taskGraph);
|
|
29
|
+
if (pruned)
|
|
30
|
+
return pruned;
|
|
31
|
+
const tasks = {};
|
|
32
|
+
for (const id in taskGraph.tasks) {
|
|
33
|
+
const task = taskGraph.tasks[id];
|
|
34
|
+
const copy = {};
|
|
35
|
+
for (const key in task) {
|
|
36
|
+
if (!exports.TASK_RESULT_FIELDS.includes(key)) {
|
|
37
|
+
copy[key] = task[key];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
tasks[id] = copy;
|
|
41
|
+
}
|
|
42
|
+
pruned = { ...taskGraph, tasks };
|
|
43
|
+
prunedGraphs.set(taskGraph, pruned);
|
|
44
|
+
return pruned;
|
|
45
|
+
}
|
|
@@ -35,6 +35,7 @@ const dynamic_run_many_terminal_output_life_cycle_1 = require("./life-cycles/dyn
|
|
|
35
35
|
const dynamic_run_one_terminal_output_life_cycle_1 = require("./life-cycles/dynamic-run-one-terminal-output-life-cycle");
|
|
36
36
|
const static_run_many_terminal_output_life_cycle_1 = require("./life-cycles/static-run-many-terminal-output-life-cycle");
|
|
37
37
|
const static_run_one_terminal_output_life_cycle_1 = require("./life-cycles/static-run-one-terminal-output-life-cycle");
|
|
38
|
+
const summary_terminal_output_life_cycle_1 = require("./life-cycles/summary-terminal-output-life-cycle");
|
|
38
39
|
const store_run_information_life_cycle_1 = require("./life-cycles/store-run-information-life-cycle");
|
|
39
40
|
const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
|
|
40
41
|
const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
|
|
@@ -265,8 +266,14 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
|
265
266
|
renderIsDone,
|
|
266
267
|
};
|
|
267
268
|
}
|
|
269
|
+
if (nxArgs.resolvedOutputStyle === 'summary') {
|
|
270
|
+
return {
|
|
271
|
+
lifeCycle: new summary_terminal_output_life_cycle_1.SummaryTerminalOutputLifeCycle(tasks),
|
|
272
|
+
renderIsDone: Promise.resolve(),
|
|
273
|
+
};
|
|
274
|
+
}
|
|
268
275
|
const { runnerOptions } = getRunner(nxArgs, nxJson);
|
|
269
|
-
const useDynamicOutput = shouldUseDynamicLifeCycle(tasks, runnerOptions, nxArgs.
|
|
276
|
+
const useDynamicOutput = shouldUseDynamicLifeCycle(tasks, runnerOptions, nxArgs.specifiedOutputStyle);
|
|
270
277
|
if (isRunOne) {
|
|
271
278
|
if (useDynamicOutput) {
|
|
272
279
|
return await (0, dynamic_run_one_terminal_output_life_cycle_1.createRunOneDynamicOutputRenderer)({
|
|
@@ -641,12 +648,12 @@ function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
|
|
|
641
648
|
// grouping applies, let it win over the implicit request; an output style the
|
|
642
649
|
// user asked for explicitly still wins over grouping.
|
|
643
650
|
const batchMode = process.env.NX_BATCH_MODE === 'true' || nxArgs.batch;
|
|
644
|
-
if (nxArgs.
|
|
651
|
+
if (nxArgs.specifiedOutputStyle == 'stream' ||
|
|
645
652
|
(batchMode && !(0, output_1.isLogGroupingEnabled)())) {
|
|
646
653
|
process.env.NX_STREAM_OUTPUT = 'true';
|
|
647
654
|
process.env.NX_PREFIX_OUTPUT = 'true';
|
|
648
655
|
}
|
|
649
|
-
if (nxArgs.
|
|
656
|
+
if (nxArgs.specifiedOutputStyle == 'stream-without-prefixes') {
|
|
650
657
|
process.env.NX_STREAM_OUTPUT = 'true';
|
|
651
658
|
process.env.NX_PREFIX_OUTPUT = 'false';
|
|
652
659
|
}
|
|
@@ -733,6 +740,9 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
|
733
740
|
// per-task-env shape and normalizes internally.
|
|
734
741
|
return hasher.hashTasks(tasks, taskGraph_, envOrPerTaskEnvs);
|
|
735
742
|
},
|
|
743
|
+
hashTasksUpfront(tasks, taskGraph_, perTaskEnvs) {
|
|
744
|
+
return hasher.hashTasksUpfront(tasks, taskGraph_, perTaskEnvs);
|
|
745
|
+
},
|
|
736
746
|
},
|
|
737
747
|
daemon: client_1.daemonClient,
|
|
738
748
|
});
|
|
@@ -789,6 +799,7 @@ function shouldUseDynamicLifeCycle(tasks, options, outputStyle) {
|
|
|
789
799
|
if ((0, is_ci_1.isCI)())
|
|
790
800
|
return false;
|
|
791
801
|
if ((0, output_1.isStaticOutputStyle)(outputStyle) ||
|
|
802
|
+
outputStyle === 'summary' ||
|
|
792
803
|
outputStyle === 'stream' ||
|
|
793
804
|
outputStyle === 'stream-without-prefixes')
|
|
794
805
|
return false;
|
|
@@ -4,6 +4,20 @@ import { BatchResults } from '../batch/batch-messages';
|
|
|
4
4
|
export declare class BatchProcess {
|
|
5
5
|
private childProcess;
|
|
6
6
|
private executorName;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the active output style puts task bytes on the terminal at all.
|
|
9
|
+
* `summary` does not, and its life cycle cannot enforce that here: this
|
|
10
|
+
* class writes to `output` directly from a stream handler, so without being
|
|
11
|
+
* told it would print a whole batch into a run that asked for log paths.
|
|
12
|
+
*
|
|
13
|
+
* False makes this capture rather than print. Suppressing the write alone
|
|
14
|
+
* would drop the bytes entirely off GitHub Actions, where nothing else
|
|
15
|
+
* captures them - and the worker's own crash output is exactly what no task
|
|
16
|
+
* ever claims, so it would exist nowhere.
|
|
17
|
+
*/
|
|
18
|
+
private readonly printsOutput;
|
|
19
|
+
/** Labels the capture file so it is identifiable in `batchOutputs/`. */
|
|
20
|
+
private readonly batchId;
|
|
7
21
|
private exitCallbacks;
|
|
8
22
|
private batchResultsCallbacks;
|
|
9
23
|
private taskResultsCallbacks;
|
|
@@ -24,49 +38,109 @@ export declare class BatchProcess {
|
|
|
24
38
|
* length of a JS string.
|
|
25
39
|
*/
|
|
26
40
|
private capturedOutputPath;
|
|
27
|
-
private
|
|
41
|
+
private capturedOutputStream;
|
|
42
|
+
/** Sources paused for backpressure, awaiting a 'drain' that may never come. */
|
|
43
|
+
private readonly pausedSources;
|
|
28
44
|
/**
|
|
29
45
|
* Set once the capture is released. A chunk can still arrive after that —
|
|
30
|
-
* stdout delivers past the exit event — and
|
|
31
|
-
*
|
|
46
|
+
* stdout delivers past the exit event — and writing then would reach a file
|
|
47
|
+
* the renderer has already read.
|
|
32
48
|
*/
|
|
33
49
|
private capturedOutputDiscarded;
|
|
34
50
|
/**
|
|
35
|
-
* Set when
|
|
36
|
-
*
|
|
37
|
-
*
|
|
51
|
+
* Set when the capture file could not be written. Whatever reached it is kept
|
|
52
|
+
* and still rendered: that is the head of the batch's log, where a compiler's
|
|
53
|
+
* first non-cascading errors are. Everything after it goes to the terminal -
|
|
54
|
+
* see `capture`.
|
|
38
55
|
*/
|
|
39
56
|
private capturedOutputFailed;
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
/** Set once the failure has been reported, so it is said once per batch. */
|
|
58
|
+
private capturedOutputWarned;
|
|
59
|
+
/** Set before `end()`: a write after it would destroy the unflushed tail. */
|
|
60
|
+
private capturedOutputClosing;
|
|
61
|
+
private static captureSeq;
|
|
62
|
+
/** Turns `flushCapturedOutput` waits for a resumed source to empty. */
|
|
63
|
+
private static readonly MAX_DRAIN_TURNS;
|
|
64
|
+
/**
|
|
65
|
+
* Makes the capture file unique across every batch in the process, which
|
|
66
|
+
* `batchId` alone does not: `TasksSchedule.batchCounters` is per instance, so
|
|
67
|
+
* a second orchestrator in the same process - `runDiscreteTasks` and
|
|
68
|
+
* `runContinuousTasks`, not the CLI - re-mints `<executor> 1`, and the pid
|
|
69
|
+
* cannot separate them.
|
|
70
|
+
*/
|
|
71
|
+
private readonly captureSeq;
|
|
72
|
+
/**
|
|
73
|
+
* Separates this capture from one minted by a DIFFERENT process, which
|
|
74
|
+
* `captureSeq` cannot: it is a per-process static that restarts at 1. These
|
|
75
|
+
* files now outlive their batch and `cacheDir` can be shared across checkouts
|
|
76
|
+
* of a repo, so without this a recycled pid truncates a log an earlier run's
|
|
77
|
+
* summary is still pointing at.
|
|
78
|
+
*/
|
|
79
|
+
private readonly captureNonce;
|
|
80
|
+
constructor(childProcess: ChildProcess, executorName: string,
|
|
81
|
+
/**
|
|
82
|
+
* Whether the active output style puts task bytes on the terminal at all.
|
|
83
|
+
* `summary` does not, and its life cycle cannot enforce that here: this
|
|
84
|
+
* class writes to `output` directly from a stream handler, so without being
|
|
85
|
+
* told it would print a whole batch into a run that asked for log paths.
|
|
86
|
+
*
|
|
87
|
+
* False makes this capture rather than print. Suppressing the write alone
|
|
88
|
+
* would drop the bytes entirely off GitHub Actions, where nothing else
|
|
89
|
+
* captures them - and the worker's own crash output is exactly what no task
|
|
90
|
+
* ever claims, so it would exist nowhere.
|
|
91
|
+
*/
|
|
92
|
+
printsOutput?: boolean,
|
|
93
|
+
/** Labels the capture file so it is identifiable in `batchOutputs/`. */
|
|
94
|
+
batchId?: string);
|
|
42
95
|
onExit(cb: (code: number) => void): void;
|
|
43
96
|
onBatchResults(cb: (results: BatchResults) => void): void;
|
|
44
97
|
onTaskResults(cb: (task: string, result: TaskResult) => void): void;
|
|
45
98
|
onOutput(cb: (output: string) => void): void;
|
|
46
99
|
private capture;
|
|
100
|
+
/**
|
|
101
|
+
* Puts bytes the capture could not take back on the terminal, on the stream
|
|
102
|
+
* they arrived on.
|
|
103
|
+
*/
|
|
104
|
+
private forwardUncaptured;
|
|
105
|
+
/**
|
|
106
|
+
* Names the failure once. A stream reports it asynchronously, so the chunk
|
|
107
|
+
* that tripped it may or may not have reached disk - unlike a `writeSync`,
|
|
108
|
+
* there is no byte count to tell. Every chunk after it is forwarded.
|
|
109
|
+
*/
|
|
110
|
+
private warnCaptureFailed;
|
|
111
|
+
/**
|
|
112
|
+
* Lets the worker write again after the capture has stopped.
|
|
113
|
+
*
|
|
114
|
+
* Without this a failed capture wedges the whole run: the source stays
|
|
115
|
+
* paused, so the worker blocks once its stdout pipe fills, never sends its
|
|
116
|
+
* results, and `getResults` waits on a batch that can no longer finish.
|
|
117
|
+
*/
|
|
118
|
+
private resumeCapturedSources;
|
|
119
|
+
private openCapturedOutput;
|
|
120
|
+
/**
|
|
121
|
+
* Flushes and closes the capture so the file is complete before a caller
|
|
122
|
+
* reads it.
|
|
123
|
+
*/
|
|
124
|
+
flushCapturedOutput(): Promise<void>;
|
|
47
125
|
/**
|
|
48
126
|
* Path to the file holding everything held back from the live stream under
|
|
49
127
|
* log grouping, or undefined if nothing was captured. Used to render the whole
|
|
50
128
|
* batch as one fold, so output no task claimed is not lost.
|
|
51
129
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* same file instead of minting a second numbered one that nothing cleans up.
|
|
56
|
-
* The caller reads the file once, synchronously, while rendering the fold, so
|
|
57
|
-
* anything arriving after that read is not shown; writes are unbuffered, so
|
|
58
|
-
* the read always sees a complete prefix of what has arrived by then.
|
|
130
|
+
* Not valid to read before `flushCapturedOutput`; that flush ends the stream,
|
|
131
|
+
* so a chunk arriving afterwards - a worker's stdout can deliver past the
|
|
132
|
+
* exit event `getResults()` settles on - is dropped rather than appended.
|
|
59
133
|
*/
|
|
60
134
|
getCapturedOutputPath(): string | undefined;
|
|
61
135
|
/** Releases the capture file. Safe to call more than once. */
|
|
62
136
|
discardCapturedOutput(): void;
|
|
63
137
|
/**
|
|
64
|
-
*
|
|
65
|
-
* read. Tolerates a partially-initialized capture, since it also
|
|
66
|
-
* opening or writing the file is what failed.
|
|
138
|
+
* Destroys the stream and unlinks the file, leaving no path behind for a
|
|
139
|
+
* caller to read. Tolerates a partially-initialized capture, since it also
|
|
140
|
+
* runs when opening or writing the file is what failed.
|
|
67
141
|
*/
|
|
68
142
|
private releaseCapturedOutput;
|
|
69
|
-
/**
|
|
143
|
+
/** Destroys the stream, dropping anything still buffered. The file stays. */
|
|
70
144
|
private closeCapturedOutput;
|
|
71
145
|
getResults(): Promise<BatchResults>;
|
|
72
146
|
send(message: Serializable): void;
|