nx 16.6.0 → 16.7.0-beta.0
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/package.json +13 -13
- package/src/command-line/affected/print-affected.js +2 -2
- package/src/command-line/show/command-object.js +2 -2
- package/src/daemon/server/handle-hash-tasks.js +2 -4
- package/src/hasher/hash-task.js +2 -2
- package/src/hasher/task-hasher.d.ts +16 -8
- package/src/hasher/task-hasher.js +30 -31
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +6 -5
- package/src/tasks-runner/run-command.js +28 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.7.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://nx.dev",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@nrwl/tao": "16.
|
|
35
|
+
"@nrwl/tao": "16.7.0-beta.0",
|
|
36
36
|
"@parcel/watcher": "2.0.4",
|
|
37
37
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
38
38
|
"@yarnpkg/parsers": "3.0.0-rc.46",
|
|
@@ -81,16 +81,16 @@
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
|
84
|
-
"@nx/nx-darwin-arm64": "16.
|
|
85
|
-
"@nx/nx-darwin-x64": "16.
|
|
86
|
-
"@nx/nx-freebsd-x64": "16.
|
|
87
|
-
"@nx/nx-linux-arm-gnueabihf": "16.
|
|
88
|
-
"@nx/nx-linux-arm64-gnu": "16.
|
|
89
|
-
"@nx/nx-linux-arm64-musl": "16.
|
|
90
|
-
"@nx/nx-linux-x64-gnu": "16.
|
|
91
|
-
"@nx/nx-linux-x64-musl": "16.
|
|
92
|
-
"@nx/nx-win32-arm64-msvc": "16.
|
|
93
|
-
"@nx/nx-win32-x64-msvc": "16.
|
|
84
|
+
"@nx/nx-darwin-arm64": "16.7.0-beta.0",
|
|
85
|
+
"@nx/nx-darwin-x64": "16.7.0-beta.0",
|
|
86
|
+
"@nx/nx-freebsd-x64": "16.7.0-beta.0",
|
|
87
|
+
"@nx/nx-linux-arm-gnueabihf": "16.7.0-beta.0",
|
|
88
|
+
"@nx/nx-linux-arm64-gnu": "16.7.0-beta.0",
|
|
89
|
+
"@nx/nx-linux-arm64-musl": "16.7.0-beta.0",
|
|
90
|
+
"@nx/nx-linux-x64-gnu": "16.7.0-beta.0",
|
|
91
|
+
"@nx/nx-linux-x64-musl": "16.7.0-beta.0",
|
|
92
|
+
"@nx/nx-win32-arm64-msvc": "16.7.0-beta.0",
|
|
93
|
+
"@nx/nx-win32-x64-msvc": "16.7.0-beta.0"
|
|
94
94
|
},
|
|
95
95
|
"nx-migrations": {
|
|
96
96
|
"migrations": "./migrations.json",
|
|
@@ -177,5 +177,5 @@
|
|
|
177
177
|
},
|
|
178
178
|
"main": "./bin/nx.js",
|
|
179
179
|
"types": "./bin/nx.d.ts",
|
|
180
|
-
"gitHead": "
|
|
180
|
+
"gitHead": "bda51652665181d38894e7ed910151e60176a9be"
|
|
181
181
|
}
|
|
@@ -39,10 +39,10 @@ function createTasks(affectedProjectsWithTargetAndConfig, projectGraph, nxArgs,
|
|
|
39
39
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
const defaultDependencyConfigs = (0, create_task_graph_1.mapTargetDefaultsToDependencies)(nxJson.targetDefaults);
|
|
41
41
|
const taskGraph = (0, create_task_graph_1.createTaskGraph)(projectGraph, defaultDependencyConfigs, affectedProjectsWithTargetAndConfig.map((p) => p.name), nxArgs.targets, nxArgs.configuration, overrides);
|
|
42
|
-
const hasher = new task_hasher_1.InProcessTaskHasher({}, [], projectGraph,
|
|
42
|
+
const hasher = new task_hasher_1.InProcessTaskHasher({}, [], projectGraph, nxJson, {}, file_hasher_1.fileHasher);
|
|
43
43
|
const execCommand = (0, package_manager_1.getPackageManagerCommand)().exec;
|
|
44
44
|
const tasks = Object.values(taskGraph.tasks);
|
|
45
|
-
yield Promise.all(tasks.map((t) => (0, hash_task_1.hashTask)(hasher, projectGraph,
|
|
45
|
+
yield Promise.all(tasks.map((t) => (0, hash_task_1.hashTask)(hasher, projectGraph, taskGraph, t)));
|
|
46
46
|
return tasks.map((task) => ({
|
|
47
47
|
id: task.id,
|
|
48
48
|
overrides,
|
|
@@ -47,8 +47,8 @@ const showProjectsCommand = {
|
|
|
47
47
|
.implies('files', 'affected')
|
|
48
48
|
.implies('base', 'affected')
|
|
49
49
|
.implies('head', 'affected')
|
|
50
|
-
.example('$0 show projects --
|
|
51
|
-
.example('$0 show projects --
|
|
50
|
+
.example('$0 show projects --projects "apps/*"', 'Show all projects in the apps directory')
|
|
51
|
+
.example('$0 show projects --projects "shared-*"', 'Show all projects that start with "shared-"')
|
|
52
52
|
.example('$0 show projects --affected', 'Show affected projects in the workspace')
|
|
53
53
|
.example('$0 show projects --affected --exclude *-e2e', 'Show affected projects in the workspace, excluding end-to-end projects'),
|
|
54
54
|
handler: (args) => Promise.resolve().then(() => require('./show')).then((m) => m.showProjectsHandler(args)),
|
|
@@ -12,7 +12,6 @@ const set_hash_env_1 = require("../../hasher/set-hash-env");
|
|
|
12
12
|
* TaskHasher has a cache inside, so keeping it around results in faster performance
|
|
13
13
|
*/
|
|
14
14
|
let storedProjectGraph = null;
|
|
15
|
-
let storedTaskGraph = null;
|
|
16
15
|
let storedHasher = null;
|
|
17
16
|
function handleHashTasks(payload) {
|
|
18
17
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -21,10 +20,9 @@ function handleHashTasks(payload) {
|
|
|
21
20
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
22
21
|
if (projectGraph !== storedProjectGraph) {
|
|
23
22
|
storedProjectGraph = projectGraph;
|
|
24
|
-
|
|
25
|
-
storedHasher = new task_hasher_1.InProcessTaskHasher(projectFileMap, allWorkspaceFiles, projectGraph, payload.taskGraph, nxJson, payload.runnerOptions, file_hasher_1.fileHasher);
|
|
23
|
+
storedHasher = new task_hasher_1.InProcessTaskHasher(projectFileMap, allWorkspaceFiles, projectGraph, nxJson, payload.runnerOptions, file_hasher_1.fileHasher);
|
|
26
24
|
}
|
|
27
|
-
const response = JSON.stringify(yield storedHasher.hashTasks(payload.tasks));
|
|
25
|
+
const response = JSON.stringify(yield storedHasher.hashTasks(payload.tasks, payload.taskGraph));
|
|
28
26
|
return {
|
|
29
27
|
response,
|
|
30
28
|
description: 'handleHashTasks',
|
package/src/hasher/hash-task.js
CHANGED
|
@@ -23,7 +23,7 @@ function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGraph, tas
|
|
|
23
23
|
(0, task_hasher_1.getInputs)(task, projectGraph, nxJson).depsOutputs.length > 0);
|
|
24
24
|
})
|
|
25
25
|
.map((t) => t.task);
|
|
26
|
-
const hashes = yield hasher.hashTasks(tasksToHash);
|
|
26
|
+
const hashes = yield hasher.hashTasks(tasksToHash, taskGraph);
|
|
27
27
|
for (let i = 0; i < tasksToHash.length; i++) {
|
|
28
28
|
tasksToHash[i].hash = hashes[i].value;
|
|
29
29
|
tasksToHash[i].hashDetails = hashes[i].details;
|
|
@@ -44,7 +44,7 @@ function hashTask(hasher, projectGraph, taskGraph, task) {
|
|
|
44
44
|
projectsConfigurations,
|
|
45
45
|
nxJsonConfiguration: (0, nx_json_1.readNxJson)(),
|
|
46
46
|
})
|
|
47
|
-
: hasher.hashTask(task));
|
|
47
|
+
: hasher.hashTask(task, taskGraph));
|
|
48
48
|
task.hash = value;
|
|
49
49
|
task.hashDetails = details;
|
|
50
50
|
});
|
|
@@ -46,31 +46,39 @@ export interface Hash {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
export interface TaskHasher {
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use hashTask(task:Task, taskGraph: TaskGraph)
|
|
51
|
+
* @param task
|
|
52
|
+
*/
|
|
49
53
|
hashTask(task: Task): Promise<Hash>;
|
|
54
|
+
hashTask(task: Task, taskGraph: TaskGraph): Promise<Hash>;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated use hashTasks(tasks:Task[], taskGraph: TaskGraph)
|
|
57
|
+
* @param tasks
|
|
58
|
+
*/
|
|
50
59
|
hashTasks(tasks: Task[]): Promise<Hash[]>;
|
|
60
|
+
hashTasks(tasks: Task[], taskGraph: TaskGraph): Promise<Hash[]>;
|
|
51
61
|
}
|
|
52
62
|
export type Hasher = TaskHasher;
|
|
53
63
|
export declare class DaemonBasedTaskHasher implements TaskHasher {
|
|
54
64
|
private readonly daemonClient;
|
|
55
|
-
private readonly taskGraph;
|
|
56
65
|
private readonly runnerOptions;
|
|
57
|
-
constructor(daemonClient: DaemonClient,
|
|
58
|
-
hashTasks(tasks: Task[]): Promise<Hash[]>;
|
|
59
|
-
hashTask(task: Task): Promise<Hash>;
|
|
66
|
+
constructor(daemonClient: DaemonClient, runnerOptions: any);
|
|
67
|
+
hashTasks(tasks: Task[], taskGraph?: TaskGraph): Promise<Hash[]>;
|
|
68
|
+
hashTask(task: Task, taskGraph?: TaskGraph): Promise<Hash>;
|
|
60
69
|
}
|
|
61
70
|
export declare class InProcessTaskHasher implements TaskHasher {
|
|
62
71
|
private readonly projectFileMap;
|
|
63
72
|
private readonly allWorkspaceFiles;
|
|
64
73
|
private readonly projectGraph;
|
|
65
|
-
private readonly taskGraph;
|
|
66
74
|
private readonly nxJson;
|
|
67
75
|
private readonly options;
|
|
68
76
|
private readonly fileHasher;
|
|
69
77
|
static version: string;
|
|
70
78
|
private taskHasher;
|
|
71
|
-
constructor(projectFileMap: ProjectFileMap, allWorkspaceFiles: FileData[], projectGraph: ProjectGraph,
|
|
72
|
-
hashTasks(tasks: Task[]): Promise<Hash[]>;
|
|
73
|
-
hashTask(task: Task): Promise<Hash>;
|
|
79
|
+
constructor(projectFileMap: ProjectFileMap, allWorkspaceFiles: FileData[], projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, options: any, fileHasher: FileHasher);
|
|
80
|
+
hashTasks(tasks: Task[], taskGraph?: TaskGraph): Promise<Hash[]>;
|
|
81
|
+
hashTask(task: Task, taskGraph?: TaskGraph): Promise<Hash>;
|
|
74
82
|
private hashCommand;
|
|
75
83
|
}
|
|
76
84
|
export declare function getNamedInputs(nxJson: NxJsonConfiguration, project: ProjectGraphProjectNode): {
|
|
@@ -15,30 +15,28 @@ const path_1 = require("path");
|
|
|
15
15
|
const path_2 = require("../utils/path");
|
|
16
16
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
|
17
17
|
class DaemonBasedTaskHasher {
|
|
18
|
-
constructor(daemonClient,
|
|
18
|
+
constructor(daemonClient, runnerOptions) {
|
|
19
19
|
this.daemonClient = daemonClient;
|
|
20
|
-
this.taskGraph = taskGraph;
|
|
21
20
|
this.runnerOptions = runnerOptions;
|
|
22
21
|
}
|
|
23
|
-
hashTasks(tasks) {
|
|
22
|
+
hashTasks(tasks, taskGraph) {
|
|
24
23
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return this.daemonClient.hashTasks(this.runnerOptions, tasks,
|
|
24
|
+
return this.daemonClient.hashTasks(this.runnerOptions, tasks, taskGraph);
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
hashTask(task) {
|
|
27
|
+
hashTask(task, taskGraph) {
|
|
29
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
return (yield this.daemonClient.hashTasks(this.runnerOptions, [task],
|
|
29
|
+
return (yield this.daemonClient.hashTasks(this.runnerOptions, [task], taskGraph))[0];
|
|
31
30
|
});
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
exports.DaemonBasedTaskHasher = DaemonBasedTaskHasher;
|
|
35
34
|
class InProcessTaskHasher {
|
|
36
|
-
constructor(projectFileMap, allWorkspaceFiles, projectGraph,
|
|
35
|
+
constructor(projectFileMap, allWorkspaceFiles, projectGraph, nxJson, options, fileHasher) {
|
|
37
36
|
var _a;
|
|
38
37
|
this.projectFileMap = projectFileMap;
|
|
39
38
|
this.allWorkspaceFiles = allWorkspaceFiles;
|
|
40
39
|
this.projectGraph = projectGraph;
|
|
41
|
-
this.taskGraph = taskGraph;
|
|
42
40
|
this.nxJson = nxJson;
|
|
43
41
|
this.options = options;
|
|
44
42
|
this.fileHasher = fileHasher;
|
|
@@ -54,16 +52,18 @@ class InProcessTaskHasher {
|
|
|
54
52
|
'.gitignore',
|
|
55
53
|
'.nxignore',
|
|
56
54
|
].map((d) => ({ fileset: `{workspaceRoot}/${d}` }));
|
|
57
|
-
this.taskHasher = new TaskHasherImpl(nxJson, legacyRuntimeInputs, legacyFilesetInputs, this.projectFileMap, this.allWorkspaceFiles, this.projectGraph, this.
|
|
55
|
+
this.taskHasher = new TaskHasherImpl(nxJson, legacyRuntimeInputs, legacyFilesetInputs, this.projectFileMap, this.allWorkspaceFiles, this.projectGraph, this.fileHasher, { selectivelyHashTsConfig: (_a = this.options.selectivelyHashTsConfig) !== null && _a !== void 0 ? _a : false });
|
|
58
56
|
}
|
|
59
|
-
hashTasks(tasks) {
|
|
57
|
+
hashTasks(tasks, taskGraph) {
|
|
60
58
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return yield Promise.all(tasks.map((t) => this.hashTask(t)));
|
|
59
|
+
return yield Promise.all(tasks.map((t) => this.hashTask(t, taskGraph)));
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
hashTask(task) {
|
|
62
|
+
hashTask(task, taskGraph) {
|
|
65
63
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
const res = yield this.taskHasher.hashTask(task, [
|
|
64
|
+
const res = yield this.taskHasher.hashTask(task, taskGraph, [
|
|
65
|
+
task.target.project,
|
|
66
|
+
]);
|
|
67
67
|
const command = this.hashCommand(task);
|
|
68
68
|
return {
|
|
69
69
|
value: (0, file_hasher_1.hashArray)([res.value, command]),
|
|
@@ -104,14 +104,13 @@ const DEFAULT_INPUTS = [
|
|
|
104
104
|
},
|
|
105
105
|
];
|
|
106
106
|
class TaskHasherImpl {
|
|
107
|
-
constructor(nxJson, legacyRuntimeInputs, legacyFilesetInputs, projectFileMap, allWorkspaceFiles, projectGraph,
|
|
107
|
+
constructor(nxJson, legacyRuntimeInputs, legacyFilesetInputs, projectFileMap, allWorkspaceFiles, projectGraph, fileHasher, options) {
|
|
108
108
|
this.nxJson = nxJson;
|
|
109
109
|
this.legacyRuntimeInputs = legacyRuntimeInputs;
|
|
110
110
|
this.legacyFilesetInputs = legacyFilesetInputs;
|
|
111
111
|
this.projectFileMap = projectFileMap;
|
|
112
112
|
this.allWorkspaceFiles = allWorkspaceFiles;
|
|
113
113
|
this.projectGraph = projectGraph;
|
|
114
|
-
this.taskGraph = taskGraph;
|
|
115
114
|
this.fileHasher = fileHasher;
|
|
116
115
|
this.options = options;
|
|
117
116
|
this.filesetHashes = {};
|
|
@@ -121,11 +120,11 @@ class TaskHasherImpl {
|
|
|
121
120
|
// External Dependencies are all calculated up front in a deterministic order
|
|
122
121
|
this.calculateExternalDependencyHashes();
|
|
123
122
|
}
|
|
124
|
-
hashTask(task, visited) {
|
|
123
|
+
hashTask(task, taskGraph, visited) {
|
|
125
124
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
126
125
|
return Promise.resolve().then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
127
126
|
const { selfInputs, depsInputs, depsOutputs, projectInputs } = getInputs(task, this.projectGraph, this.nxJson);
|
|
128
|
-
const selfAndInputs = yield this.hashSelfAndDepsInputs(task.target.project, task, selfInputs, depsInputs, depsOutputs, projectInputs, visited);
|
|
127
|
+
const selfAndInputs = yield this.hashSelfAndDepsInputs(task.target.project, task, selfInputs, depsInputs, depsOutputs, projectInputs, taskGraph, visited);
|
|
129
128
|
const target = this.hashTarget(task.target.project, task.target.target, selfInputs);
|
|
130
129
|
if (target) {
|
|
131
130
|
return this.combinePartialHashes([selfAndInputs, target]);
|
|
@@ -134,7 +133,7 @@ class TaskHasherImpl {
|
|
|
134
133
|
}));
|
|
135
134
|
});
|
|
136
135
|
}
|
|
137
|
-
hashNamedInputForDependencies(projectName, task, namedInput, visited) {
|
|
136
|
+
hashNamedInputForDependencies(projectName, task, namedInput, taskGraph, visited) {
|
|
138
137
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
139
138
|
const projectNode = this.projectGraph.nodes[projectName];
|
|
140
139
|
const namedInputs = Object.assign(Object.assign({ default: [{ fileset: '{projectRoot}/**/*' }] }, this.nxJson.namedInputs), projectNode.data.namedInputs);
|
|
@@ -142,18 +141,18 @@ class TaskHasherImpl {
|
|
|
142
141
|
const selfInputs = expandedInputs.filter(isSelfInput);
|
|
143
142
|
const depsOutputs = expandedInputs.filter(isDepsOutput);
|
|
144
143
|
const depsInputs = [{ input: namedInput, dependencies: true }]; // true is boolean by default
|
|
145
|
-
return this.hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, [], visited);
|
|
144
|
+
return this.hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, [], taskGraph, visited);
|
|
146
145
|
});
|
|
147
146
|
}
|
|
148
|
-
hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, projectInputs, visited) {
|
|
147
|
+
hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, projectInputs, taskGraph, visited) {
|
|
149
148
|
var _a;
|
|
150
149
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
151
150
|
const projectGraphDeps = (_a = this.projectGraph.dependencies[projectName]) !== null && _a !== void 0 ? _a : [];
|
|
152
151
|
// we don't want random order of dependencies to change the hash
|
|
153
152
|
projectGraphDeps.sort((a, b) => a.target.localeCompare(b.target));
|
|
154
153
|
const self = yield this.hashSingleProjectInputs(projectName, selfInputs);
|
|
155
|
-
const deps = yield this.hashDepsInputs(task, depsInputs, projectGraphDeps, visited);
|
|
156
|
-
const depsOut = yield this.hashDepsOutputs(task, depsOutputs);
|
|
154
|
+
const deps = yield this.hashDepsInputs(task, depsInputs, projectGraphDeps, taskGraph, visited);
|
|
155
|
+
const depsOut = yield this.hashDepsOutputs(task, depsOutputs, taskGraph);
|
|
157
156
|
const projects = yield this.hashProjectInputs(projectInputs);
|
|
158
157
|
return this.combinePartialHashes([
|
|
159
158
|
...self,
|
|
@@ -176,7 +175,7 @@ class TaskHasherImpl {
|
|
|
176
175
|
const value = (0, file_hasher_1.hashArray)(hashValues);
|
|
177
176
|
return { value, details };
|
|
178
177
|
}
|
|
179
|
-
hashDepsInputs(task, inputs, projectGraphDeps, visited) {
|
|
178
|
+
hashDepsInputs(task, inputs, projectGraphDeps, taskGraph, visited) {
|
|
180
179
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
181
180
|
return (yield Promise.all(inputs.map((input) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
182
181
|
return yield Promise.all(projectGraphDeps.map((d) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -186,7 +185,7 @@ class TaskHasherImpl {
|
|
|
186
185
|
else {
|
|
187
186
|
visited.push(d.target);
|
|
188
187
|
if (this.projectGraph.nodes[d.target]) {
|
|
189
|
-
return yield this.hashNamedInputForDependencies(d.target, task, input.input || 'default', visited);
|
|
188
|
+
return yield this.hashNamedInputForDependencies(d.target, task, input.input || 'default', taskGraph, visited);
|
|
190
189
|
}
|
|
191
190
|
else {
|
|
192
191
|
return this.getExternalDependencyHash(d.target);
|
|
@@ -198,27 +197,27 @@ class TaskHasherImpl {
|
|
|
198
197
|
.filter((r) => !!r);
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
|
-
hashDepsOutputs(task, depsOutputs) {
|
|
200
|
+
hashDepsOutputs(task, depsOutputs, taskGraph) {
|
|
202
201
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
203
202
|
if (depsOutputs.length === 0) {
|
|
204
203
|
return [];
|
|
205
204
|
}
|
|
206
205
|
const result = [];
|
|
207
206
|
for (const { dependentTasksOutputFiles, transitive } of depsOutputs) {
|
|
208
|
-
result.push(...(yield this.hashDepOuputs(task, dependentTasksOutputFiles, transitive)));
|
|
207
|
+
result.push(...(yield this.hashDepOuputs(task, dependentTasksOutputFiles, taskGraph, transitive)));
|
|
209
208
|
}
|
|
210
209
|
return result;
|
|
211
210
|
});
|
|
212
211
|
}
|
|
213
|
-
hashDepOuputs(task, dependentTasksOutputFiles, transitive) {
|
|
212
|
+
hashDepOuputs(task, dependentTasksOutputFiles, taskGraph, transitive) {
|
|
214
213
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
215
214
|
// task has no dependencies
|
|
216
|
-
if (!
|
|
215
|
+
if (!taskGraph.dependencies[task.id]) {
|
|
217
216
|
return [];
|
|
218
217
|
}
|
|
219
218
|
const partialHashes = [];
|
|
220
|
-
for (const d of
|
|
221
|
-
const childTask =
|
|
219
|
+
for (const d of taskGraph.dependencies[task.id]) {
|
|
220
|
+
const childTask = taskGraph.tasks[d];
|
|
222
221
|
const outputs = (0, utils_1.getOutputsForTargetAndConfiguration)(childTask, this.projectGraph.nodes[childTask.target.project]);
|
|
223
222
|
const { getFilesForOutputs } = require('../native');
|
|
224
223
|
const outputFiles = getFilesForOutputs(workspace_root_1.workspaceRoot, outputs);
|
|
@@ -235,7 +234,7 @@ class TaskHasherImpl {
|
|
|
235
234
|
details: hashDetails,
|
|
236
235
|
});
|
|
237
236
|
if (transitive) {
|
|
238
|
-
partialHashes.push(...(yield this.hashDepOuputs(childTask, dependentTasksOutputFiles, transitive)));
|
|
237
|
+
partialHashes.push(...(yield this.hashDepOuputs(childTask, dependentTasksOutputFiles, taskGraph, transitive)));
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
return partialHashes;
|
|
@@ -13,8 +13,7 @@ function buildExplicitDependencies(jsPluginConfig, ctx, builder) {
|
|
|
13
13
|
// files we need to process is >= 100 and there are more than 2 CPUs
|
|
14
14
|
// to be able to use at least 2 workers (1 worker per CPU and
|
|
15
15
|
// 1 CPU for the main thread)
|
|
16
|
-
if (
|
|
17
|
-
process.env.NX_NATIVE_TS_DEPS !== 'false') ||
|
|
16
|
+
if (process.env.NX_NATIVE_TS_DEPS !== 'false' ||
|
|
18
17
|
jsPluginConfig.analyzeSourceFiles === false ||
|
|
19
18
|
totalNumOfFilesToProcess < 100 ||
|
|
20
19
|
getNumberOfWorkers() <= 2) {
|
|
@@ -4,10 +4,11 @@ exports.buildExplicitTypeScriptDependencies = void 0;
|
|
|
4
4
|
const typescript_import_locator_1 = require("./typescript-import-locator");
|
|
5
5
|
const target_project_locator_1 = require("./target-project-locator");
|
|
6
6
|
const project_graph_1 = require("../../../../config/project-graph");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const workspace_root_1 = require("../../../../utils/workspace-root");
|
|
7
9
|
function buildExplicitTypeScriptDependencies(graph, filesToProcess) {
|
|
8
10
|
let results;
|
|
9
|
-
if (process.env.NX_NATIVE_TS_DEPS
|
|
10
|
-
process.env.NX_NATIVE_TS_DEPS !== 'false') {
|
|
11
|
+
if (process.env.NX_NATIVE_TS_DEPS !== 'false') {
|
|
11
12
|
results = buildExplicitTypeScriptDependenciesWithSwc(filesToProcess, graph);
|
|
12
13
|
}
|
|
13
14
|
else {
|
|
@@ -66,7 +67,7 @@ function buildExplicitTypeScriptDependenciesWithSwc(projectFileMap, graph) {
|
|
|
66
67
|
(_a = filesToProcess[project]) !== null && _a !== void 0 ? _a : (filesToProcess[project] = []);
|
|
67
68
|
for (const { file } of fileData) {
|
|
68
69
|
if (moduleExtensions.some((ext) => file.endsWith(ext))) {
|
|
69
|
-
filesToProcess[project].push(file);
|
|
70
|
+
filesToProcess[project].push((0, path_1.join)(workspace_root_1.workspaceRoot, file));
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
}
|
|
@@ -74,7 +75,7 @@ function buildExplicitTypeScriptDependenciesWithSwc(projectFileMap, graph) {
|
|
|
74
75
|
const imports = findImports(filesToProcess);
|
|
75
76
|
for (const { sourceProject, file, staticImportExpressions, dynamicImportExpressions, } of imports) {
|
|
76
77
|
for (const importExpr of staticImportExpressions) {
|
|
77
|
-
const dependency = convertImportToDependency(importExpr, file, sourceProject, project_graph_1.DependencyType.static, targetProjectLocator);
|
|
78
|
+
const dependency = convertImportToDependency(importExpr, (0, path_1.relative)(workspace_root_1.workspaceRoot, file), sourceProject, project_graph_1.DependencyType.static, targetProjectLocator);
|
|
78
79
|
// TODO: These edges technically should be allowed but we need to figure out how to separate config files out from root
|
|
79
80
|
if (isRoot(graph, dependency.sourceProjectName) ||
|
|
80
81
|
!isRoot(graph, dependency.targetProjectName)) {
|
|
@@ -82,7 +83,7 @@ function buildExplicitTypeScriptDependenciesWithSwc(projectFileMap, graph) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
for (const importExpr of dynamicImportExpressions) {
|
|
85
|
-
const dependency = convertImportToDependency(importExpr, file, sourceProject, project_graph_1.DependencyType.dynamic, targetProjectLocator);
|
|
86
|
+
const dependency = convertImportToDependency(importExpr, (0, path_1.relative)(workspace_root_1.workspaceRoot, file), sourceProject, project_graph_1.DependencyType.dynamic, targetProjectLocator);
|
|
86
87
|
// TODO: These edges technically should be allowed but we need to figure out how to separate config files out from root
|
|
87
88
|
if (isRoot(graph, dependency.sourceProjectName) ||
|
|
88
89
|
!isRoot(graph, dependency.targetProjectName)) {
|
|
@@ -131,11 +131,11 @@ function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson,
|
|
|
131
131
|
const { tasksRunner, runnerOptions } = getRunner(nxArgs, nxJson);
|
|
132
132
|
let hasher;
|
|
133
133
|
if (client_1.daemonClient.enabled()) {
|
|
134
|
-
hasher = new task_hasher_1.DaemonBasedTaskHasher(client_1.daemonClient,
|
|
134
|
+
hasher = new task_hasher_1.DaemonBasedTaskHasher(client_1.daemonClient, runnerOptions);
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
137
|
const { projectFileMap, allWorkspaceFiles } = (0, build_project_graph_1.getProjectFileMap)();
|
|
138
|
-
hasher = new task_hasher_1.InProcessTaskHasher(projectFileMap, allWorkspaceFiles, projectGraph,
|
|
138
|
+
hasher = new task_hasher_1.InProcessTaskHasher(projectFileMap, allWorkspaceFiles, projectGraph, nxJson, runnerOptions, file_hasher_1.fileHasher);
|
|
139
139
|
}
|
|
140
140
|
// this is used for two reasons: to fetch all remote cache hits AND
|
|
141
141
|
// to submit everything that is known in advance to Nx Cloud to run in
|
|
@@ -150,7 +150,32 @@ function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson,
|
|
|
150
150
|
nxJson,
|
|
151
151
|
nxArgs,
|
|
152
152
|
taskGraph,
|
|
153
|
-
hasher
|
|
153
|
+
hasher: {
|
|
154
|
+
hashTask(task, taskGraph_) {
|
|
155
|
+
if (!taskGraph_) {
|
|
156
|
+
output_1.output.warn({
|
|
157
|
+
title: `TaskGraph is now required as an argument to hashTasks`,
|
|
158
|
+
bodyLines: [
|
|
159
|
+
`The TaskGraph object can be retrieved from the context`,
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
taskGraph_ = taskGraph;
|
|
163
|
+
}
|
|
164
|
+
return hasher.hashTask(task, taskGraph_);
|
|
165
|
+
},
|
|
166
|
+
hashTasks(task, taskGraph_) {
|
|
167
|
+
if (!taskGraph_) {
|
|
168
|
+
output_1.output.warn({
|
|
169
|
+
title: `TaskGraph is now required as an argument to hashTasks`,
|
|
170
|
+
bodyLines: [
|
|
171
|
+
`The TaskGraph object can be retrieved from the context`,
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
taskGraph_ = taskGraph;
|
|
175
|
+
}
|
|
176
|
+
return hasher.hashTasks(task, taskGraph_);
|
|
177
|
+
},
|
|
178
|
+
},
|
|
154
179
|
daemon: client_1.daemonClient,
|
|
155
180
|
});
|
|
156
181
|
let anyFailures;
|