nx 24.0.0-beta.0 → 24.0.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/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/command-line/graph/graph.js +2 -1
- 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/handoff-gitignore.d.ts +19 -23
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +16 -19
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +25 -13
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +82 -22
- package/dist/src/command-line/migrate/agentic/select.js +3 -3
- package/dist/src/command-line/migrate/agentic/types.js +1 -3
- package/dist/src/command-line/migrate/command-object.js +5 -9
- 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-analytics.d.ts +6 -0
- package/dist/src/command-line/migrate/migrate-analytics.js +12 -0
- 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-config.d.ts +6 -6
- package/dist/src/command-line/migrate/migrate-config.js +12 -6
- package/dist/src/command-line/migrate/migrate.d.ts +3 -30
- package/dist/src/command-line/migrate/migrate.js +206 -237
- 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/existing-run-report.d.ts +1 -1
- package/dist/src/command-line/migrate/run/existing-run-report.js +7 -5
- package/dist/src/command-line/migrate/run/index.d.ts +6 -5
- package/dist/src/command-line/migrate/run/index.js +12 -1
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +21 -0
- package/dist/src/command-line/migrate/run/orchestrator.js +149 -32
- package/dist/src/command-line/migrate/run/run-state.d.ts +13 -0
- package/dist/src/command-line/migrate/run/run-state.js +21 -0
- 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/migrate/sort-migrations.d.ts +1 -7
- package/dist/src/command-line/migrate/sort-migrations.js +1 -12
- package/dist/src/command-line/show/show-target/info.js +1 -1
- package/dist/src/config/nx-json.d.ts +13 -4
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +72 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/hasher/check-task-files.js +4 -4
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/hasher/task-hasher.d.ts +2 -0
- package/dist/src/hasher/task-hasher.js +4 -1
- package/dist/src/native/index.d.ts +92 -14
- package/dist/src/native/native-bindings.js +3 -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/project-graph/utils/project-configuration/target-normalization.js +6 -1
- package/dist/src/project-graph/utils/retrieve-workspace-files.js +27 -6
- package/dist/src/tasks-runner/create-task-graph.d.ts +7 -16
- package/dist/src/tasks-runner/create-task-graph.js +43 -57
- package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
- 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 +7 -6
- package/dist/src/tasks-runner/running-tasks/batch-process.js +6 -0
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- 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 -10
- package/dist/src/tasks-runner/task-orchestrator.js +459 -79
- package/dist/src/tasks-runner/tasks-runner.d.ts +1 -1
- 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.js +6 -22
- 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/plugins/core-plugins.js +4 -0
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/package.json +12 -11
- package/schemas/nx-schema.json +93 -4
- package/schemas/project-schema.json +84 -2
|
@@ -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';
|
|
@@ -27,7 +28,7 @@ export declare class TaskOrchestrator {
|
|
|
27
28
|
private readonly resolvedOutputStyle;
|
|
28
29
|
private readonly fullTaskGraph;
|
|
29
30
|
/** Tasks the up-front pass left to hash once the tasks they read from have run. */
|
|
30
|
-
private readonly
|
|
31
|
+
private readonly hashingDeferredTaskIds?;
|
|
31
32
|
private taskDetails;
|
|
32
33
|
private cache;
|
|
33
34
|
private readonly tuiEnabled;
|
|
@@ -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;
|
|
@@ -73,7 +79,7 @@ export declare class TaskOrchestrator {
|
|
|
73
79
|
/** What this run renders with, after defaults. */
|
|
74
80
|
resolvedOutputStyle: OutputStyle, fullTaskGraph?: TaskGraph,
|
|
75
81
|
/** Tasks the up-front pass left to hash once the tasks they read from have run. */
|
|
76
|
-
|
|
82
|
+
hashingDeferredTaskIds?: ReadonlySet<string>);
|
|
77
83
|
init(): Promise<void>;
|
|
78
84
|
run(): Promise<{
|
|
79
85
|
[k: string]: TaskStatus;
|
|
@@ -91,6 +97,8 @@ 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
|
/**
|
|
@@ -138,14 +146,18 @@ export declare class TaskOrchestrator {
|
|
|
138
146
|
/**
|
|
139
147
|
* Hash all batch tasks and resolve cache hits topologically.
|
|
140
148
|
*
|
|
141
|
-
* Walks the task graph level by level.
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
149
|
+
* Walks the task graph level by level. A deferred task (its hash reads
|
|
150
|
+
* another task's outputs) behind an upstream batch task that still has to
|
|
151
|
+
* run is never looked up yet:
|
|
152
|
+
* - behind a non-cacheable task only, it is held back for a later wave,
|
|
153
|
+
* where it hashes after that task ran;
|
|
154
|
+
* - behind a cache miss, it runs in this wave and re-hashes after execution.
|
|
155
|
+
* Every task run in this wave gets a hash first, for Cloud's startTasks.
|
|
145
156
|
*/
|
|
146
157
|
private applyBatchCachedResults;
|
|
147
158
|
private hashBatchTasks;
|
|
148
159
|
applyFromCacheOrRunBatch(doNotSkipCache: boolean, batch: Batch, groupId: number): Promise<TaskResult[]>;
|
|
160
|
+
private runBatchWave;
|
|
149
161
|
private runBatch;
|
|
150
162
|
/**
|
|
151
163
|
* Tells the life cycle where the batch worker's own log is, when something
|
|
@@ -250,14 +262,28 @@ export declare class TaskOrchestrator {
|
|
|
250
262
|
*/
|
|
251
263
|
private handleDiscreteWorkerFailure;
|
|
252
264
|
/**
|
|
253
|
-
* Spawn and wait on a task's child process
|
|
254
|
-
* lookup. Callers must have already confirmed the task
|
|
255
|
-
* (or disabled caching entirely).
|
|
265
|
+
* Spawn and wait on a task's child process once its ready dependencies are
|
|
266
|
+
* ready, with no cache lookup. Callers must have already confirmed the task
|
|
267
|
+
* is a cache miss (or disabled caching entirely).
|
|
256
268
|
*/
|
|
257
269
|
runTaskDirectly(doNotSkipCache: boolean, task: Task, groupId: number): Promise<TaskResult>;
|
|
258
270
|
private runTask;
|
|
259
271
|
private runTaskInForkedProcess;
|
|
260
|
-
startContinuousTask(task: Task, groupId: number): Promise<RunningTask | SharedRunningTask>;
|
|
272
|
+
startContinuousTask(task: Task, groupId: number): Promise<NoopChildProcess | RunningTask | SharedRunningTask>;
|
|
273
|
+
private getReadyWhen;
|
|
274
|
+
private waitForReadyDependencies;
|
|
275
|
+
private onReadinessHold;
|
|
276
|
+
private pollReadinessRow;
|
|
277
|
+
private startReadinessProbe;
|
|
278
|
+
private failReadiness;
|
|
279
|
+
private hasReadyWaiter;
|
|
280
|
+
private skipWaiter;
|
|
281
|
+
private recordReadiness;
|
|
282
|
+
private readinessOf;
|
|
283
|
+
private armReadiness;
|
|
284
|
+
private abortReadiness;
|
|
285
|
+
private abortAllReadiness;
|
|
286
|
+
private failTaskBeforeStart;
|
|
261
287
|
private preRunSteps;
|
|
262
288
|
private postRunSteps;
|
|
263
289
|
/**
|
|
@@ -303,6 +329,7 @@ export declare class TaskOrchestrator {
|
|
|
303
329
|
*/
|
|
304
330
|
private recordContinuousTerminalOutput;
|
|
305
331
|
private scheduleNextTasksAndReleaseThreads;
|
|
332
|
+
private releaseThreads;
|
|
306
333
|
private complete;
|
|
307
334
|
/**
|
|
308
335
|
* Unified task completion handler for a set of tasks.
|