nx 23.3.1 → 23.3.3
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/adapter/ngcli-adapter.js +1 -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/project-graph/affected/npm-packages.js +50 -2
- 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
|
});
|
|
@@ -939,7 +939,7 @@ function saveProjectsConfigurationsInWrappedSchematic(host, content) {
|
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, projects) {
|
|
942
|
-
const { WorkspaceNodeModulesArchitectHost: AngularWorkspaceNodeModulesArchitectHost, } = await (0, handle_import_1.handleImport)('@angular-devkit/architect/node
|
|
942
|
+
const { WorkspaceNodeModulesArchitectHost: AngularWorkspaceNodeModulesArchitectHost, } = await (0, handle_import_1.handleImport)('@angular-devkit/architect/node');
|
|
943
943
|
class WrappedWorkspaceNodeModulesArchitectHost extends AngularWorkspaceNodeModulesArchitectHost {
|
|
944
944
|
constructor(workspace, root, projects) {
|
|
945
945
|
super(workspace, root);
|
|
Binary file
|
|
Binary file
|
|
@@ -25,18 +25,62 @@ function packageJsonDependencyChanges(touchedFiles, nxJson, projectGraph) {
|
|
|
25
25
|
projects: touched.filter((name) => name in projectGraph.nodes),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
const PNPM_WORKSPACE_FILES = ['pnpm-workspace.yaml', 'pnpm-workspace.yml'];
|
|
28
29
|
/**
|
|
29
30
|
* External nodes and workspace projects the root package.json change names,
|
|
30
31
|
* or null when it cannot be pinned to them: a removed dependency, a global
|
|
31
32
|
* package, or an override selector matching nothing in the graph.
|
|
33
|
+
*
|
|
34
|
+
* Also reads `overrides` from `pnpm-workspace.yaml` (pnpm 10+): the field
|
|
35
|
+
* moves there when the root `package.json` has no `pnpm` block, and pnpm 12
|
|
36
|
+
* no longer reads `package.json#pnpm` at all. Yaml override diffs are rewritten
|
|
37
|
+
* to the `pnpm.overrides.*` path and matched by the existing pnpm selector
|
|
38
|
+
* logic. Catalog and other workspace settings are left alone.
|
|
32
39
|
*/
|
|
33
40
|
function touchedNpmPackages(touchedFiles, nxJson, projectGraph) {
|
|
34
41
|
const packageJsonChange = touchedFiles.find((f) => f.file === 'package.json');
|
|
35
|
-
|
|
42
|
+
const workspaceYamlChange = touchedFiles.find((f) => PNPM_WORKSPACE_FILES.includes(f.file));
|
|
43
|
+
if (!packageJsonChange && !workspaceYamlChange)
|
|
36
44
|
return [];
|
|
37
45
|
const globalPackages = new Set(getGlobalPackages(nxJson.plugins));
|
|
38
46
|
let touched = [];
|
|
39
|
-
const changes = packageJsonChange
|
|
47
|
+
const changes = packageJsonChange
|
|
48
|
+
? [...packageJsonChange.getChanges()]
|
|
49
|
+
: [];
|
|
50
|
+
if (workspaceYamlChange) {
|
|
51
|
+
for (const c of workspaceYamlChange.getChanges()) {
|
|
52
|
+
// Unparseable yaml - be conservative and fall back to all projects.
|
|
53
|
+
if (!(0, json_diff_1.isJsonChange)(c))
|
|
54
|
+
return null;
|
|
55
|
+
// Catalog, patchedDependencies, settings, etc. do not change which
|
|
56
|
+
// packages the lockfile resolves to.
|
|
57
|
+
if (c.path[0] !== 'overrides')
|
|
58
|
+
continue;
|
|
59
|
+
// Replacing the whole `overrides` map with something non-mappy
|
|
60
|
+
// (null, scalar, array) is a shape we don't understand - fall back.
|
|
61
|
+
if (c.path.length === 1) {
|
|
62
|
+
if (!isObjectOrUndefined(c.value.lhs))
|
|
63
|
+
return null;
|
|
64
|
+
if (!isObjectOrUndefined(c.value.rhs))
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// pnpm's workspace overrides take string selectors as keys and
|
|
69
|
+
// string versions as leaves; a non-string leaf is a shape we
|
|
70
|
+
// don't model.
|
|
71
|
+
if (c.value.lhs !== undefined && typeof c.value.lhs !== 'string') {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
if (c.value.rhs !== undefined && typeof c.value.rhs !== 'string') {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
changes.push({
|
|
79
|
+
...c,
|
|
80
|
+
path: ['pnpm', 'overrides', ...c.path.slice(1)],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
40
84
|
const npmPackages = Object.values(projectGraph.externalNodes);
|
|
41
85
|
let packagesByName;
|
|
42
86
|
const missingTouchedNpmPackages = [];
|
|
@@ -143,3 +187,7 @@ function getGlobalPackages(plugins) {
|
|
|
143
187
|
.map((p) => (0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(typeof p === 'string' ? p : p.plugin))
|
|
144
188
|
.concat('nx');
|
|
145
189
|
}
|
|
190
|
+
function isObjectOrUndefined(value) {
|
|
191
|
+
return (value === undefined ||
|
|
192
|
+
(value !== null && typeof value === 'object' && !Array.isArray(value)));
|
|
193
|
+
}
|
|
@@ -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.3",
|
|
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.3",
|
|
163
|
+
"@nx/nx-darwin-x64": "23.3.3",
|
|
164
|
+
"@nx/nx-freebsd-x64": "23.3.3",
|
|
165
|
+
"@nx/nx-linux-arm-gnueabihf": "23.3.3",
|
|
166
|
+
"@nx/nx-linux-arm64-gnu": "23.3.3",
|
|
167
|
+
"@nx/nx-linux-arm64-musl": "23.3.3",
|
|
168
|
+
"@nx/nx-linux-x64-gnu": "23.3.3",
|
|
169
|
+
"@nx/nx-linux-x64-musl": "23.3.3",
|
|
170
|
+
"@nx/nx-win32-arm64-msvc": "23.3.3",
|
|
171
|
+
"@nx/nx-win32-x64-msvc": "23.3.3"
|
|
172
172
|
},
|
|
173
173
|
"nx-migrations": {
|
|
174
174
|
"migrations": "./migrations.json",
|