nx 23.3.0 → 24.0.0-beta.1
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 +3 -6
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +1 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
- package/dist/src/command-line/graph/graph.js +3 -5
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/init-v2.js +0 -2
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +76 -15
- package/dist/src/command-line/migrate/execute-migration.d.ts +2 -2
- package/dist/src/command-line/migrate/execute-migration.js +18 -10
- package/dist/src/command-line/migrate/migrate-commits.d.ts +4 -1
- package/dist/src/command-line/migrate/migrate-commits.js +10 -3
- package/dist/src/command-line/migrate/migrate.js +43 -6
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +5 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +68 -20
- package/dist/src/command-line/migrate/run/index.d.ts +4 -3
- package/dist/src/command-line/migrate/run/index.js +8 -1
- package/dist/src/command-line/migrate/run/orchestrator.js +72 -13
- package/dist/src/command-line/migrate/run/runbook.js +19 -0
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +3 -0
- package/dist/src/command-line/migrate/run/util.js +7 -1
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/show/show-target/info.js +1 -1
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +12 -0
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +65 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +9 -0
- package/dist/src/daemon/client/client.js +89 -37
- package/dist/src/daemon/server/shutdown-utils.js +0 -3
- package/dist/src/daemon/socket-utils.d.ts +9 -4
- package/dist/src/daemon/socket-utils.js +12 -49
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +1 -0
- package/dist/src/hasher/check-task-files.js +4 -4
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +145 -0
- package/dist/src/native/index.d.ts +180 -12
- package/dist/src/native/native-bindings.js +8 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -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/nx-cloud/update-manager.d.ts +7 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/project-graph/affected/affected-tasks.js +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +47 -26
- package/dist/src/tasks-runner/init-tasks-runner.js +13 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/readiness/probes.d.ts +9 -0
- package/dist/src/tasks-runner/readiness/probes.js +62 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +38 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +190 -0
- package/dist/src/tasks-runner/run-command.js +5 -4
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +26 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +37 -8
- package/dist/src/tasks-runner/task-orchestrator.js +460 -76
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +64 -6
- package/dist/src/tasks-runner/utils.d.ts +20 -5
- package/dist/src/tasks-runner/utils.js +70 -35
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/child-process.js +1 -0
- package/dist/src/utils/git-utils.d.ts +6 -1
- package/dist/src/utils/git-utils.js +26 -5
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +1 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/migrations.json +7 -0
- package/package.json +11 -20
- package/readme-template.md +3 -3
- package/schemas/nx-schema.json +70 -0
- package/schemas/project-schema.json +67 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -8,6 +8,9 @@ exports.assertTaskGraphDoesNotContainInvalidTargets = assertTaskGraphDoesNotCont
|
|
|
8
8
|
exports.getLeafTasks = getLeafTasks;
|
|
9
9
|
exports.walkTaskGraph = walkTaskGraph;
|
|
10
10
|
const output_1 = require("../utils/output");
|
|
11
|
+
function edgeId(edge) {
|
|
12
|
+
return typeof edge === 'string' ? edge : edge.id;
|
|
13
|
+
}
|
|
11
14
|
function _findCycle(graph, id, visited, path) {
|
|
12
15
|
if (visited[id])
|
|
13
16
|
return null;
|
|
@@ -15,7 +18,7 @@ function _findCycle(graph, id, visited, path) {
|
|
|
15
18
|
for (const d of [
|
|
16
19
|
...graph.dependencies[id],
|
|
17
20
|
...(graph.continuousDependencies?.[id] ?? []),
|
|
18
|
-
]) {
|
|
21
|
+
].map(edgeId)) {
|
|
19
22
|
if (path.includes(d))
|
|
20
23
|
return [...path, d];
|
|
21
24
|
const cycle = _findCycle(graph, d, visited, [...path, d]);
|
|
@@ -64,13 +67,13 @@ function _makeAcyclic(graph, id, visited, path) {
|
|
|
64
67
|
visited[id] = true;
|
|
65
68
|
const deps = graph.dependencies[id];
|
|
66
69
|
const continuousDeps = graph.continuousDependencies?.[id] ?? [];
|
|
67
|
-
for (const d of [...deps, ...continuousDeps]) {
|
|
70
|
+
for (const d of [...deps, ...continuousDeps].map(edgeId)) {
|
|
68
71
|
if (path.includes(d)) {
|
|
69
|
-
const depsIdx = deps.
|
|
72
|
+
const depsIdx = deps.findIndex((edge) => edgeId(edge) === d);
|
|
70
73
|
if (depsIdx >= 0) {
|
|
71
74
|
deps.splice(depsIdx, 1);
|
|
72
75
|
}
|
|
73
|
-
const continuousIdx = continuousDeps.
|
|
76
|
+
const continuousIdx = continuousDeps.findIndex((edge) => edgeId(edge) === d);
|
|
74
77
|
if (continuousIdx >= 0) {
|
|
75
78
|
continuousDeps.splice(continuousIdx, 1);
|
|
76
79
|
}
|
|
@@ -131,7 +134,7 @@ function assertTaskGraphDoesNotContainInvalidTargets(taskGraph) {
|
|
|
131
134
|
taskGraph.continuousDependencies[task.id].length > 0) {
|
|
132
135
|
nonParallelTasksThatDependOnContinuousTasks.push(task);
|
|
133
136
|
}
|
|
134
|
-
for (const dependency of taskGraph.continuousDependencies[task.id]) {
|
|
137
|
+
for (const { id: dependency } of taskGraph.continuousDependencies[task.id]) {
|
|
135
138
|
if (taskGraph.tasks[dependency].parallelism === false) {
|
|
136
139
|
nonParallelContinuousTasksThatAreDependedOn.push(taskGraph.tasks[dependency]);
|
|
137
140
|
}
|
|
@@ -148,7 +151,9 @@ class NonParallelTaskDependsOnContinuousTasksError extends Error {
|
|
|
148
151
|
constructor(invalidTasks, taskGraph) {
|
|
149
152
|
let message = 'The following tasks do not support parallelism but depend on continuous tasks:';
|
|
150
153
|
for (const task of invalidTasks) {
|
|
151
|
-
message += `\n - ${task.id} -> ${taskGraph.continuousDependencies[task.id]
|
|
154
|
+
message += `\n - ${task.id} -> ${taskGraph.continuousDependencies[task.id]
|
|
155
|
+
.map((edge) => edge.id)
|
|
156
|
+
.join(', ')}`;
|
|
152
157
|
}
|
|
153
158
|
super(message);
|
|
154
159
|
this.invalidTasks = invalidTasks;
|
|
@@ -159,7 +164,7 @@ class DependingOnNonParallelContinuousTaskError extends Error {
|
|
|
159
164
|
constructor(invalidTasks, taskGraph) {
|
|
160
165
|
let message = 'The following continuous tasks do not support parallelism but are depended on:';
|
|
161
166
|
for (const task of invalidTasks) {
|
|
162
|
-
const dependents = Object.keys(taskGraph.continuousDependencies).filter((parentTaskId) => taskGraph.continuousDependencies[parentTaskId].
|
|
167
|
+
const dependents = Object.keys(taskGraph.continuousDependencies).filter((parentTaskId) => taskGraph.continuousDependencies[parentTaskId].some((edge) => edge.id === task.id));
|
|
163
168
|
message += `\n - ${task.id} <- ${dependents.join(', ')}`;
|
|
164
169
|
}
|
|
165
170
|
message +=
|
|
@@ -185,13 +190,13 @@ function reverseTaskGraph(taskGraph) {
|
|
|
185
190
|
dependencies: Object.fromEntries(Object.entries(taskGraph.tasks).map(([taskId]) => [taskId, []])),
|
|
186
191
|
};
|
|
187
192
|
for (const [taskId, dependencies] of Object.entries(taskGraph.dependencies)) {
|
|
188
|
-
for (const dependency of dependencies) {
|
|
189
|
-
reversed.dependencies[dependency].push(taskId);
|
|
193
|
+
for (const { id: dependency } of dependencies) {
|
|
194
|
+
reversed.dependencies[dependency].push({ id: taskId });
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
for (const [taskId, dependencies] of Object.entries(taskGraph.continuousDependencies)) {
|
|
193
|
-
for (const dependency of dependencies) {
|
|
194
|
-
reversed.dependencies[dependency].push(taskId);
|
|
198
|
+
for (const { id: dependency } of dependencies) {
|
|
199
|
+
reversed.dependencies[dependency].push({ id: taskId });
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
return reversed;
|
|
@@ -213,7 +218,7 @@ async function walkTaskGraph(taskGraph, walkFn) {
|
|
|
213
218
|
await walkFn(currentRoots);
|
|
214
219
|
const nextRoots = [];
|
|
215
220
|
for (const id of currentRoots) {
|
|
216
|
-
for (const depId of reversed.dependencies[id] ?? []) {
|
|
221
|
+
for (const { id: depId } of reversed.dependencies[id] ?? []) {
|
|
217
222
|
inDegree[depId]--;
|
|
218
223
|
if (inDegree[depId] === 0) {
|
|
219
224
|
nextRoots.push(depId);
|
|
@@ -7,6 +7,7 @@ import { TaskHasher } from '../hasher/task-hasher';
|
|
|
7
7
|
import { NxArgs } from '../utils/command-line-utils';
|
|
8
8
|
import { DefaultTasksRunnerOptions } from './default-tasks-runner';
|
|
9
9
|
import { TaskResult } from './life-cycle';
|
|
10
|
+
import { NoopChildProcess } from './running-tasks/noop-child-process';
|
|
10
11
|
import { RunningTask } from './running-tasks/running-task';
|
|
11
12
|
import { SharedRunningTask } from './running-tasks/shared-running-task';
|
|
12
13
|
import { TaskStatus } from './tasks-runner';
|
|
@@ -62,6 +63,11 @@ export declare class TaskOrchestrator {
|
|
|
62
63
|
private runningDiscreteTasks;
|
|
63
64
|
private discreteTaskExitHandled;
|
|
64
65
|
private continuousTaskExitHandled;
|
|
66
|
+
private readiness;
|
|
67
|
+
private readinessFailures;
|
|
68
|
+
private readinessFailureReasons;
|
|
69
|
+
private readinessSettled;
|
|
70
|
+
private waitingLogged;
|
|
65
71
|
private cleanupPromise;
|
|
66
72
|
private signalHandlers;
|
|
67
73
|
private tasksWithPersistedOutput;
|
|
@@ -91,15 +97,23 @@ export declare class TaskOrchestrator {
|
|
|
91
97
|
*/
|
|
92
98
|
private executeCoordinatorLoop;
|
|
93
99
|
private executeContinuousTaskLoop;
|
|
100
|
+
private hasUnresolvedCacheableTask;
|
|
101
|
+
private scheduleAfterReadiness;
|
|
94
102
|
private processTask;
|
|
95
103
|
processAllScheduledTasks(): void;
|
|
96
104
|
/**
|
|
97
|
-
* Registers a task invocation and checks for loops across nested Nx
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
105
|
+
* Registers a task invocation and checks for loops across nested Nx
|
|
106
|
+
* processes. registerTask() returns the invocation chain only when an
|
|
107
|
+
* *ancestor* Nx process is already running this task — a genuine loop.
|
|
108
|
+
* Sibling processes running the same task are legitimate and register
|
|
109
|
+
* without complaint.
|
|
110
|
+
*
|
|
111
|
+
* The overrides hash rides along with the task id so the tracker can tell an
|
|
112
|
+
* ancestor re-invoking a task with different arguments from one repeating
|
|
113
|
+
* the same invocation.
|
|
101
114
|
*/
|
|
102
115
|
private detectTaskInvocationLoop;
|
|
116
|
+
private releaseTaskInvocation;
|
|
103
117
|
private applyCachedResults;
|
|
104
118
|
/**
|
|
105
119
|
* Batch cache lookup + filter to successful entries. Handles both
|
|
@@ -244,14 +258,28 @@ export declare class TaskOrchestrator {
|
|
|
244
258
|
*/
|
|
245
259
|
private handleDiscreteWorkerFailure;
|
|
246
260
|
/**
|
|
247
|
-
* Spawn and wait on a task's child process
|
|
248
|
-
* lookup. Callers must have already confirmed the task
|
|
249
|
-
* (or disabled caching entirely).
|
|
261
|
+
* Spawn and wait on a task's child process once its ready dependencies are
|
|
262
|
+
* ready, with no cache lookup. Callers must have already confirmed the task
|
|
263
|
+
* is a cache miss (or disabled caching entirely).
|
|
250
264
|
*/
|
|
251
265
|
runTaskDirectly(doNotSkipCache: boolean, task: Task, groupId: number): Promise<TaskResult>;
|
|
252
266
|
private runTask;
|
|
253
267
|
private runTaskInForkedProcess;
|
|
254
|
-
startContinuousTask(task: Task, groupId: number): Promise<RunningTask | SharedRunningTask>;
|
|
268
|
+
startContinuousTask(task: Task, groupId: number): Promise<NoopChildProcess | RunningTask | SharedRunningTask>;
|
|
269
|
+
private getReadyWhen;
|
|
270
|
+
private waitForReadyDependencies;
|
|
271
|
+
private onReadinessHold;
|
|
272
|
+
private pollReadinessRow;
|
|
273
|
+
private startReadinessProbe;
|
|
274
|
+
private failReadiness;
|
|
275
|
+
private hasReadyWaiter;
|
|
276
|
+
private skipWaiter;
|
|
277
|
+
private recordReadiness;
|
|
278
|
+
private readinessOf;
|
|
279
|
+
private armReadiness;
|
|
280
|
+
private abortReadiness;
|
|
281
|
+
private abortAllReadiness;
|
|
282
|
+
private failTaskBeforeStart;
|
|
255
283
|
private preRunSteps;
|
|
256
284
|
private postRunSteps;
|
|
257
285
|
/**
|
|
@@ -297,6 +325,7 @@ export declare class TaskOrchestrator {
|
|
|
297
325
|
*/
|
|
298
326
|
private recordContinuousTerminalOutput;
|
|
299
327
|
private scheduleNextTasksAndReleaseThreads;
|
|
328
|
+
private releaseThreads;
|
|
300
329
|
private complete;
|
|
301
330
|
/**
|
|
302
331
|
* Unified task completion handler for a set of tasks.
|