nx 23.3.1 → 23.3.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/bin/run-executor.js +5 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/tasks-runner/batch/run-batch.js +3 -13
- package/dist/src/utils/output.d.ts +5 -0
- package/dist/src/utils/output.js +11 -4
- package/package.json +11 -11
package/dist/bin/run-executor.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const fs_1 = require("fs");
|
|
4
4
|
const run_1 = require("../src/command-line/run/run");
|
|
5
|
+
const output_1 = require("../src/utils/output");
|
|
5
6
|
if (process.env.NX_TERMINAL_OUTPUT_PATH) {
|
|
6
7
|
setUpOutputWatching(process.env.NX_TERMINAL_CAPTURE_STDERR === 'true', process.env.NX_STREAM_OUTPUT === 'true');
|
|
7
8
|
}
|
|
@@ -57,10 +58,14 @@ function setUpOutputWatching(captureStderr, streamOutput) {
|
|
|
57
58
|
process.on('message', async (message) => {
|
|
58
59
|
try {
|
|
59
60
|
const statusCode = await (0, run_1.run)(process.cwd(), process.env.NX_WORKSPACE_ROOT, message.targetDescription, message.overrides, message.isVerbose, message.taskGraph);
|
|
61
|
+
// `process.exit` does not wait for pipe writes, so a task that ends with
|
|
62
|
+
// a large write would otherwise lose the end of its output.
|
|
63
|
+
await output_1.output.drain();
|
|
60
64
|
process.exit(statusCode);
|
|
61
65
|
}
|
|
62
66
|
catch (e) {
|
|
63
67
|
console.error(e);
|
|
68
|
+
await output_1.output.drain();
|
|
64
69
|
process.exit(1);
|
|
65
70
|
}
|
|
66
71
|
});
|
|
Binary file
|
|
Binary file
|
|
@@ -6,6 +6,7 @@ const params_1 = require("../../utils/params");
|
|
|
6
6
|
const project_graph_1 = require("../../project-graph/project-graph");
|
|
7
7
|
const configuration_1 = require("../../config/configuration");
|
|
8
8
|
const async_iterator_1 = require("../../utils/async-iterator");
|
|
9
|
+
const output_1 = require("../../utils/output");
|
|
9
10
|
const executor_utils_1 = require("../../command-line/run/executor-utils");
|
|
10
11
|
// Batch workers are inside an Nx run just like task workers (see
|
|
11
12
|
// bin/run-executor.ts) — mark it so nested tooling can detect Nx.
|
|
@@ -64,26 +65,15 @@ async function runTasks(executorName, projectGraph, batchTaskGraph, fullTaskGrap
|
|
|
64
65
|
console.error(isVerbose ? e : e.message);
|
|
65
66
|
// `process.exit` does not wait for pipe writes, so the reason this worker
|
|
66
67
|
// died could otherwise be the one line that never arrives.
|
|
67
|
-
await
|
|
68
|
+
await output_1.output.drain();
|
|
68
69
|
process.exit(1);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Waits until everything written to stdout and stderr so far has reached the
|
|
73
|
-
* pipe. Writes to a pipe are asynchronous, and the parent learns the batch is
|
|
74
|
-
* over through a separate IPC channel - so without this it can be told the batch
|
|
75
|
-
* finished, or see the process exit, while the end of its output is still in
|
|
76
|
-
* memory here. That tail is where a tool reports what went wrong.
|
|
77
|
-
*/
|
|
78
|
-
function flushStdio() {
|
|
79
|
-
const flush = (stream) => new Promise((resolve) => stream.write('', () => resolve()));
|
|
80
|
-
return Promise.all([flush(process.stdout), flush(process.stderr)]).then(() => undefined);
|
|
81
|
-
}
|
|
82
72
|
process.on('message', async (message) => {
|
|
83
73
|
switch (message.type) {
|
|
84
74
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
|
85
75
|
const results = await runTasks(message.executorName, message.projectGraph, message.batchTaskGraph, message.fullTaskGraph);
|
|
86
|
-
await
|
|
76
|
+
await output_1.output.drain();
|
|
87
77
|
process.send({
|
|
88
78
|
type: batch_messages_1.BatchMessageType.CompleteBatchExecution,
|
|
89
79
|
results,
|
|
@@ -245,6 +245,11 @@ declare class CLIOutput {
|
|
|
245
245
|
log({ title, bodyLines, color }: CLIWarnMessageConfig & {
|
|
246
246
|
color?: string;
|
|
247
247
|
}): void;
|
|
248
|
+
/**
|
|
249
|
+
* Waits until everything written to stdout and stderr so far has reached the
|
|
250
|
+
* pipe. Writes to a pipe are asynchronous and `process.exit` does not wait
|
|
251
|
+
* for them.
|
|
252
|
+
*/
|
|
248
253
|
drain(): Promise<void>;
|
|
249
254
|
}
|
|
250
255
|
export declare const output: CLIOutput;
|
package/dist/src/utils/output.js
CHANGED
|
@@ -557,15 +557,22 @@ class CLIOutput {
|
|
|
557
557
|
this.writeOptionalOutputBody(bodyLines);
|
|
558
558
|
this.addNewline();
|
|
559
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Waits until everything written to stdout and stderr so far has reached the
|
|
562
|
+
* pipe. Writes to a pipe are asynchronous and `process.exit` does not wait
|
|
563
|
+
* for them.
|
|
564
|
+
*/
|
|
560
565
|
drain() {
|
|
561
|
-
|
|
562
|
-
if (
|
|
563
|
-
|
|
566
|
+
const flush = (stream) => new Promise((resolve) => {
|
|
567
|
+
if (stream.writableLength === 0) {
|
|
568
|
+
resolve();
|
|
564
569
|
}
|
|
565
570
|
else {
|
|
566
|
-
|
|
571
|
+
// The callback runs once every write queued before it is flushed.
|
|
572
|
+
stream.write('', () => resolve());
|
|
567
573
|
}
|
|
568
574
|
});
|
|
575
|
+
return Promise.all([flush(process.stdout), flush(process.stderr)]).then(() => undefined);
|
|
569
576
|
}
|
|
570
577
|
}
|
|
571
578
|
exports.output = new CLIOutput();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
@@ -159,16 +159,16 @@
|
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
"optionalDependencies": {
|
|
162
|
-
"@nx/nx-darwin-arm64": "23.3.
|
|
163
|
-
"@nx/nx-darwin-x64": "23.3.
|
|
164
|
-
"@nx/nx-freebsd-x64": "23.3.
|
|
165
|
-
"@nx/nx-linux-arm-gnueabihf": "23.3.
|
|
166
|
-
"@nx/nx-linux-arm64-gnu": "23.3.
|
|
167
|
-
"@nx/nx-linux-arm64-musl": "23.3.
|
|
168
|
-
"@nx/nx-linux-x64-gnu": "23.3.
|
|
169
|
-
"@nx/nx-linux-x64-musl": "23.3.
|
|
170
|
-
"@nx/nx-win32-arm64-msvc": "23.3.
|
|
171
|
-
"@nx/nx-win32-x64-msvc": "23.3.
|
|
162
|
+
"@nx/nx-darwin-arm64": "23.3.2",
|
|
163
|
+
"@nx/nx-darwin-x64": "23.3.2",
|
|
164
|
+
"@nx/nx-freebsd-x64": "23.3.2",
|
|
165
|
+
"@nx/nx-linux-arm-gnueabihf": "23.3.2",
|
|
166
|
+
"@nx/nx-linux-arm64-gnu": "23.3.2",
|
|
167
|
+
"@nx/nx-linux-arm64-musl": "23.3.2",
|
|
168
|
+
"@nx/nx-linux-x64-gnu": "23.3.2",
|
|
169
|
+
"@nx/nx-linux-x64-musl": "23.3.2",
|
|
170
|
+
"@nx/nx-win32-arm64-msvc": "23.3.2",
|
|
171
|
+
"@nx/nx-win32-x64-msvc": "23.3.2"
|
|
172
172
|
},
|
|
173
173
|
"nx-migrations": {
|
|
174
174
|
"migrations": "./migrations.json",
|