nx 22.7.0-beta.12 → 22.7.0-beta.13
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/schemas/nx-schema.json +25 -0
- package/dist/schemas/project-schema.json +25 -0
- package/dist/src/adapter/ngcli-adapter.js +11 -12
- package/dist/src/command-line/daemon/daemon.js +8 -4
- package/dist/src/command-line/graph/graph.js +8 -1
- package/dist/src/command-line/show/show-target/utils.js +4 -3
- package/dist/src/command-line/yargs-utils/shared-options.js +5 -1
- package/dist/src/config/nx-json.d.ts +3 -1
- package/dist/src/config/workspace-json-project-json.d.ts +2 -1
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +10 -3
- package/dist/src/daemon/client/client.js +21 -31
- package/dist/src/daemon/client/daemon-environment.d.ts +4 -0
- package/dist/src/daemon/client/daemon-environment.js +119 -0
- package/dist/src/daemon/client/daemon-socket-messenger.d.ts +2 -5
- package/dist/src/daemon/client/daemon-socket-messenger.js +1 -1
- package/dist/src/daemon/message-types/daemon-message.d.ts +6 -0
- package/dist/src/daemon/message-types/daemon-message.js +6 -0
- package/dist/src/daemon/server/handle-hash-tasks.d.ts +1 -1
- package/dist/src/daemon/server/handle-hash-tasks.js +1 -1
- package/dist/src/daemon/server/handle-outputs-tracking.d.ts +4 -4
- package/dist/src/daemon/server/handle-outputs-tracking.js +11 -11
- package/dist/src/daemon/server/outputs-tracking.d.ts +18 -3
- package/dist/src/daemon/server/outputs-tracking.js +49 -22
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +2 -1
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +20 -4
- package/dist/src/daemon/server/server.js +71 -40
- package/dist/src/executors/run-commands/running-tasks.js +2 -3
- package/dist/src/executors/run-script/run-script.impl.js +16 -8
- package/dist/src/hasher/hash-task.d.ts +9 -1
- package/dist/src/hasher/hash-task.js +41 -14
- package/dist/src/hasher/native-task-hasher-impl.d.ts +1 -1
- package/dist/src/hasher/native-task-hasher-impl.js +4 -6
- package/dist/src/hasher/task-hasher.d.ts +20 -9
- package/dist/src/hasher/task-hasher.js +34 -6
- package/dist/src/native/index.d.ts +34 -7
- package/dist/src/native/native-bindings.js +1 -1
- package/dist/src/native/nx.wasi-browser.js +0 -1
- package/dist/src/native/nx.wasi.cjs +0 -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/utils/register.js +83 -4
- package/dist/src/project-graph/error-types.js +31 -11
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +9 -0
- package/dist/src/project-graph/plugins/isolation/message-types.d.ts +1 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +9 -0
- package/dist/src/project-graph/plugins/isolation/messaging.js +2 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +36 -68
- package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +6 -0
- package/dist/src/tasks-runner/cache.d.ts +6 -0
- package/dist/src/tasks-runner/cache.js +58 -0
- package/dist/src/tasks-runner/init-tasks-runner.js +13 -7
- package/dist/src/tasks-runner/run-command.js +13 -5
- package/dist/src/tasks-runner/task-env.js +17 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +79 -7
- package/dist/src/tasks-runner/task-orchestrator.js +327 -120
- package/dist/src/tasks-runner/tasks-schedule.d.ts +5 -2
- package/dist/src/tasks-runner/tasks-schedule.js +31 -17
- package/dist/src/tasks-runner/utils.d.ts +3 -3
- package/dist/src/tasks-runner/utils.js +5 -6
- package/package.json +12 -12
- package/dist/src/daemon/client/exec-is-server-available.d.ts +0 -1
- package/dist/src/daemon/client/exec-is-server-available.js +0 -11
- package/dist/src/daemon/client/generate-help-output.d.ts +0 -1
- package/dist/src/daemon/client/generate-help-output.js +0 -26
|
@@ -6,8 +6,9 @@ const project_graph_utils_1 = require("../utils/project-graph-utils");
|
|
|
6
6
|
const operators_1 = require("../project-graph/operators");
|
|
7
7
|
const task_history_1 = require("../utils/task-history");
|
|
8
8
|
class TasksSchedule {
|
|
9
|
-
constructor(projectGraph, taskGraph, options) {
|
|
9
|
+
constructor(projectGraph, projects, taskGraph, options) {
|
|
10
10
|
this.projectGraph = projectGraph;
|
|
11
|
+
this.projects = projects;
|
|
11
12
|
this.taskGraph = taskGraph;
|
|
12
13
|
this.options = options;
|
|
13
14
|
this.notScheduledTaskGraph = this.taskGraph;
|
|
@@ -50,6 +51,7 @@ class TasksSchedule {
|
|
|
50
51
|
delete this.reverseTaskDeps[taskId];
|
|
51
52
|
}
|
|
52
53
|
const removedSet = new Set(taskIds);
|
|
54
|
+
this.scheduledTasks = this.scheduledTasks.filter((id) => !removedSet.has(id));
|
|
53
55
|
for (const [key, deps] of Object.entries(this.reverseTaskDeps)) {
|
|
54
56
|
this.reverseTaskDeps[key] = deps.filter((d) => !removedSet.has(d));
|
|
55
57
|
}
|
|
@@ -96,18 +98,30 @@ class TasksSchedule {
|
|
|
96
98
|
if (this.options.batch !== false && process.env.NX_BATCH_MODE !== 'false') {
|
|
97
99
|
await this.scheduleBatches();
|
|
98
100
|
}
|
|
101
|
+
const toSchedule = [];
|
|
99
102
|
for (let root of this.notScheduledTaskGraph.roots) {
|
|
100
103
|
if (this.canBeScheduled(root)) {
|
|
101
|
-
|
|
104
|
+
toSchedule.push(root);
|
|
105
|
+
// Mark as running so canBeScheduled gates on parallelism for
|
|
106
|
+
// subsequent roots in this same scheduling pass.
|
|
107
|
+
this.runningTasks.add(root);
|
|
102
108
|
}
|
|
103
109
|
}
|
|
110
|
+
if (toSchedule.length > 0) {
|
|
111
|
+
this.scheduleTaskBatch(toSchedule);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
scheduleTaskBatch(taskIds) {
|
|
115
|
+
this.notScheduledTaskGraph = (0, utils_1.removeTasksFromTaskGraph)(this.notScheduledTaskGraph, taskIds);
|
|
116
|
+
for (const taskId of taskIds) {
|
|
117
|
+
this.scheduledTasks.push(taskId);
|
|
118
|
+
this.runningTasks.add(taskId);
|
|
119
|
+
}
|
|
120
|
+
this.sortScheduledTasks();
|
|
104
121
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.scheduledTasks
|
|
108
|
-
.concat(taskId)
|
|
109
|
-
// NOTE: sort task by most dependent on first
|
|
110
|
-
.sort((taskId1, taskId2) => {
|
|
122
|
+
sortScheduledTasks() {
|
|
123
|
+
// NOTE: sort task by most dependent on first
|
|
124
|
+
this.scheduledTasks.sort((taskId1, taskId2) => {
|
|
111
125
|
// First compare the length of task dependencies.
|
|
112
126
|
const taskDifference = this.reverseTaskDeps[taskId2].length -
|
|
113
127
|
this.reverseTaskDeps[taskId1].length;
|
|
@@ -125,18 +139,18 @@ class TasksSchedule {
|
|
|
125
139
|
return dependenciesDiff;
|
|
126
140
|
}
|
|
127
141
|
const task1Timing = this.estimatedTaskTimings[taskId1];
|
|
128
|
-
if (!task1Timing) {
|
|
129
|
-
// if no timing or 0, put task1 at beginning
|
|
130
|
-
return -1;
|
|
131
|
-
}
|
|
132
142
|
const task2Timing = this.estimatedTaskTimings[taskId2];
|
|
133
|
-
|
|
134
|
-
|
|
143
|
+
// Tasks with no historical timing run first (unknown duration = assume long)
|
|
144
|
+
const has1 = task1Timing != null && task1Timing !== 0;
|
|
145
|
+
const has2 = task2Timing != null && task2Timing !== 0;
|
|
146
|
+
if (!has1 && !has2)
|
|
147
|
+
return 0;
|
|
148
|
+
if (!has1)
|
|
149
|
+
return -1;
|
|
150
|
+
if (!has2)
|
|
135
151
|
return 1;
|
|
136
|
-
}
|
|
137
152
|
return task2Timing - task1Timing;
|
|
138
153
|
});
|
|
139
|
-
this.runningTasks.add(taskId);
|
|
140
154
|
}
|
|
141
155
|
async scheduleBatches() {
|
|
142
156
|
const batchMap = {};
|
|
@@ -168,7 +182,7 @@ class TasksSchedule {
|
|
|
168
182
|
if (!this.canBatchTaskBeScheduled(task, batches[rootExecutorName])) {
|
|
169
183
|
return;
|
|
170
184
|
}
|
|
171
|
-
const { batchImplementationFactory, preferBatch } = (0, utils_1.getExecutorForTask)(task, this.
|
|
185
|
+
const { batchImplementationFactory, preferBatch } = (0, utils_1.getExecutorForTask)(task, this.projects);
|
|
172
186
|
const executorName = (0, utils_1.getExecutorNameForTask)(task, this.projectGraph);
|
|
173
187
|
if (rootExecutorName !== executorName) {
|
|
174
188
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
|
2
2
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
|
3
3
|
import { Task, TaskGraph } from '../config/task-graph';
|
|
4
|
-
import { TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
4
|
+
import { ProjectConfiguration, TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
5
5
|
export type NormalizedTargetDependencyConfig = TargetDependencyConfig & {
|
|
6
6
|
projects: string[];
|
|
7
7
|
};
|
|
@@ -31,11 +31,11 @@ export declare function getOutputsForTargetAndConfiguration(target: Task['target
|
|
|
31
31
|
export declare function interpolate(template: string, data: any): string;
|
|
32
32
|
export declare function getTargetConfigurationForTask(task: Task, projectGraph: ProjectGraph): TargetConfiguration | undefined;
|
|
33
33
|
export declare function getExecutorNameForTask(task: Task, projectGraph: ProjectGraph): string;
|
|
34
|
-
export declare function getExecutorForTask(task: Task,
|
|
34
|
+
export declare function getExecutorForTask(task: Task, projects: Record<string, ProjectConfiguration>): ExecutorConfig & {
|
|
35
35
|
isNgCompat: boolean;
|
|
36
36
|
isNxExecutor: boolean;
|
|
37
37
|
};
|
|
38
|
-
export declare function getCustomHasher(task: Task,
|
|
38
|
+
export declare function getCustomHasher(task: Task, projects: Record<string, ProjectConfiguration>): CustomHasher | null;
|
|
39
39
|
export declare function removeTasksFromTaskGraph(graph: TaskGraph, ids: string[]): TaskGraph;
|
|
40
40
|
export declare function calculateReverseDeps(taskGraph: TaskGraph): Record<string, string[]>;
|
|
41
41
|
export declare function getCliPath(): string;
|
|
@@ -30,7 +30,6 @@ const node_path_1 = require("node:path");
|
|
|
30
30
|
const posix_1 = require("node:path/posix");
|
|
31
31
|
const executor_utils_1 = require("../command-line/run/executor-utils");
|
|
32
32
|
const native_1 = require("../native");
|
|
33
|
-
const project_graph_1 = require("../project-graph/project-graph");
|
|
34
33
|
const fileutils_1 = require("../utils/fileutils");
|
|
35
34
|
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
|
36
35
|
const globs_1 = require("../utils/globs");
|
|
@@ -292,13 +291,13 @@ function getTargetConfigurationForTask(task, projectGraph) {
|
|
|
292
291
|
function getExecutorNameForTask(task, projectGraph) {
|
|
293
292
|
return getTargetConfigurationForTask(task, projectGraph)?.executor;
|
|
294
293
|
}
|
|
295
|
-
function getExecutorForTask(task,
|
|
296
|
-
const executor =
|
|
294
|
+
function getExecutorForTask(task, projects) {
|
|
295
|
+
const executor = projects[task.target.project]?.targets?.[task.target.target]?.executor;
|
|
297
296
|
const [nodeModule, executorName] = (0, executor_utils_1.parseExecutor)(executor);
|
|
298
|
-
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot,
|
|
297
|
+
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, projects);
|
|
299
298
|
}
|
|
300
|
-
function getCustomHasher(task,
|
|
301
|
-
const factory = getExecutorForTask(task,
|
|
299
|
+
function getCustomHasher(task, projects) {
|
|
300
|
+
const factory = getExecutorForTask(task, projects).hasherFactory;
|
|
302
301
|
return factory ? factory() : null;
|
|
303
302
|
}
|
|
304
303
|
function removeTasksFromTaskGraph(graph, ids) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.13",
|
|
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.",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"define-lazy-prop": "2.0.0",
|
|
80
80
|
"delayed-stream": "1.0.0",
|
|
81
81
|
"dotenv": "16.4.7",
|
|
82
|
-
"dotenv-expand": "
|
|
82
|
+
"dotenv-expand": "12.0.3",
|
|
83
83
|
"dunder-proto": "1.0.1",
|
|
84
84
|
"ejs": "5.0.1",
|
|
85
85
|
"emoji-regex": "8.0.0",
|
|
@@ -171,16 +171,16 @@
|
|
|
171
171
|
}
|
|
172
172
|
},
|
|
173
173
|
"optionalDependencies": {
|
|
174
|
-
"@nx/nx-darwin-arm64": "22.7.0-beta.
|
|
175
|
-
"@nx/nx-darwin-x64": "22.7.0-beta.
|
|
176
|
-
"@nx/nx-freebsd-x64": "22.7.0-beta.
|
|
177
|
-
"@nx/nx-linux-arm-gnueabihf": "22.7.0-beta.
|
|
178
|
-
"@nx/nx-linux-arm64-gnu": "22.7.0-beta.
|
|
179
|
-
"@nx/nx-linux-arm64-musl": "22.7.0-beta.
|
|
180
|
-
"@nx/nx-linux-x64-gnu": "22.7.0-beta.
|
|
181
|
-
"@nx/nx-linux-x64-musl": "22.7.0-beta.
|
|
182
|
-
"@nx/nx-win32-arm64-msvc": "22.7.0-beta.
|
|
183
|
-
"@nx/nx-win32-x64-msvc": "22.7.0-beta.
|
|
174
|
+
"@nx/nx-darwin-arm64": "22.7.0-beta.13",
|
|
175
|
+
"@nx/nx-darwin-x64": "22.7.0-beta.13",
|
|
176
|
+
"@nx/nx-freebsd-x64": "22.7.0-beta.13",
|
|
177
|
+
"@nx/nx-linux-arm-gnueabihf": "22.7.0-beta.13",
|
|
178
|
+
"@nx/nx-linux-arm64-gnu": "22.7.0-beta.13",
|
|
179
|
+
"@nx/nx-linux-arm64-musl": "22.7.0-beta.13",
|
|
180
|
+
"@nx/nx-linux-x64-gnu": "22.7.0-beta.13",
|
|
181
|
+
"@nx/nx-linux-x64-musl": "22.7.0-beta.13",
|
|
182
|
+
"@nx/nx-win32-arm64-msvc": "22.7.0-beta.13",
|
|
183
|
+
"@nx/nx-win32-x64-msvc": "22.7.0-beta.13"
|
|
184
184
|
},
|
|
185
185
|
"nx-migrations": {
|
|
186
186
|
"migrations": "./migrations.json",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateDaemonHelpOutput(): string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateDaemonHelpOutput = generateDaemonHelpOutput;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const cache_1 = require("../cache");
|
|
6
|
-
const tmp_dir_1 = require("../tmp-dir");
|
|
7
|
-
function generateDaemonHelpOutput() {
|
|
8
|
-
/**
|
|
9
|
-
* A workaround for cases such as yargs output where we need to synchronously
|
|
10
|
-
* get the value of this async operation.
|
|
11
|
-
*/
|
|
12
|
-
const res = (0, child_process_1.spawnSync)(process.execPath, ['./exec-is-server-available.js'], {
|
|
13
|
-
cwd: __dirname,
|
|
14
|
-
windowsHide: true,
|
|
15
|
-
});
|
|
16
|
-
const isServerAvailable = res?.stdout?.toString().trim().indexOf('true') > -1;
|
|
17
|
-
if (!isServerAvailable) {
|
|
18
|
-
return 'Nx Daemon is not running.';
|
|
19
|
-
}
|
|
20
|
-
const pid = (0, cache_1.getDaemonProcessIdSync)();
|
|
21
|
-
return `Nx Daemon is currently running:
|
|
22
|
-
- Logs: ${tmp_dir_1.DAEMON_OUTPUT_LOG_FILE}${pid
|
|
23
|
-
? `
|
|
24
|
-
- Process ID: ${pid}`
|
|
25
|
-
: ''}`;
|
|
26
|
-
}
|