nx 19.5.6 → 19.5.8
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 +12 -12
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/connect/connect-to-nx-cloud.js +5 -2
- package/src/config/nx-json.d.ts +4 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +4 -2
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +21 -14
- package/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -1
- package/src/nx-cloud/utilities/get-cloud-options.js +3 -2
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +7 -2
- package/src/plugins/package-json/create-nodes.js +9 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +32 -10
- package/src/tasks-runner/cache.js +1 -1
- package/src/tasks-runner/create-task-graph.d.ts +2 -0
- package/src/tasks-runner/create-task-graph.js +35 -1
- package/src/tasks-runner/utils.js +14 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "19.5.
|
3
|
+
"version": "19.5.8",
|
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": {
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"yargs-parser": "21.1.1",
|
72
72
|
"node-machine-id": "1.1.12",
|
73
73
|
"ora": "5.3.0",
|
74
|
-
"@nrwl/tao": "19.5.
|
74
|
+
"@nrwl/tao": "19.5.8"
|
75
75
|
},
|
76
76
|
"peerDependencies": {
|
77
77
|
"@swc-node/register": "^1.8.0",
|
@@ -86,16 +86,16 @@
|
|
86
86
|
}
|
87
87
|
},
|
88
88
|
"optionalDependencies": {
|
89
|
-
"@nx/nx-darwin-x64": "19.5.
|
90
|
-
"@nx/nx-darwin-arm64": "19.5.
|
91
|
-
"@nx/nx-linux-x64-gnu": "19.5.
|
92
|
-
"@nx/nx-linux-x64-musl": "19.5.
|
93
|
-
"@nx/nx-win32-x64-msvc": "19.5.
|
94
|
-
"@nx/nx-linux-arm64-gnu": "19.5.
|
95
|
-
"@nx/nx-linux-arm64-musl": "19.5.
|
96
|
-
"@nx/nx-linux-arm-gnueabihf": "19.5.
|
97
|
-
"@nx/nx-win32-arm64-msvc": "19.5.
|
98
|
-
"@nx/nx-freebsd-x64": "19.5.
|
89
|
+
"@nx/nx-darwin-x64": "19.5.8",
|
90
|
+
"@nx/nx-darwin-arm64": "19.5.8",
|
91
|
+
"@nx/nx-linux-x64-gnu": "19.5.8",
|
92
|
+
"@nx/nx-linux-x64-musl": "19.5.8",
|
93
|
+
"@nx/nx-win32-x64-msvc": "19.5.8",
|
94
|
+
"@nx/nx-linux-arm64-gnu": "19.5.8",
|
95
|
+
"@nx/nx-linux-arm64-musl": "19.5.8",
|
96
|
+
"@nx/nx-linux-arm-gnueabihf": "19.5.8",
|
97
|
+
"@nx/nx-win32-arm64-msvc": "19.5.8",
|
98
|
+
"@nx/nx-freebsd-x64": "19.5.8"
|
99
99
|
},
|
100
100
|
"nx-migrations": {
|
101
101
|
"migrations": "./migrations.json",
|
package/src/adapter/compat.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
|
2
|
-
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins"];
|
2
|
+
export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud"];
|
package/src/adapter/compat.js
CHANGED
@@ -55,12 +55,15 @@ async function connectWorkspaceToCloud(options, directory = workspace_root_1.wor
|
|
55
55
|
}
|
56
56
|
async function connectToNxCloudCommand(command) {
|
57
57
|
const nxJson = (0, configuration_1.readNxJson)();
|
58
|
+
const installationSource = process.env.NX_CONSOLE
|
59
|
+
? 'nx-console'
|
60
|
+
: 'nx-connect';
|
58
61
|
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
59
62
|
const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
|
60
63
|
if (!token) {
|
61
64
|
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
|
62
65
|
}
|
63
|
-
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(
|
66
|
+
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token);
|
64
67
|
output_1.output.log({
|
65
68
|
title: '✔ This workspace already has Nx Cloud set up',
|
66
69
|
bodyLines: [
|
@@ -73,7 +76,7 @@ async function connectToNxCloudCommand(command) {
|
|
73
76
|
return false;
|
74
77
|
}
|
75
78
|
const token = await connectWorkspaceToCloud({
|
76
|
-
installationSource: command ??
|
79
|
+
installationSource: command ?? installationSource,
|
77
80
|
});
|
78
81
|
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token);
|
79
82
|
try {
|
package/src/config/nx-json.d.ts
CHANGED
@@ -404,6 +404,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
404
404
|
* Set this to false to disable adding inference plugins when generating new projects
|
405
405
|
*/
|
406
406
|
useInferencePlugins?: boolean;
|
407
|
+
/**
|
408
|
+
* Set this to false to disable connection to Nx Cloud
|
409
|
+
*/
|
410
|
+
neverConnectToCloud?: boolean;
|
407
411
|
}
|
408
412
|
export type PluginConfiguration = string | ExpandedPluginConfiguration;
|
409
413
|
export type ExpandedPluginConfiguration<T = unknown> = {
|
Binary file
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Tree } from '../../../generators/tree';
|
2
|
+
import { NxJsonConfiguration } from '../../../config/nx-json';
|
2
3
|
export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>;
|
3
4
|
export interface ConnectToNxCloudOptions {
|
4
5
|
analytics?: boolean;
|
@@ -7,5 +8,6 @@ export interface ConnectToNxCloudOptions {
|
|
7
8
|
github?: boolean;
|
8
9
|
directory?: string;
|
9
10
|
}
|
10
|
-
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>;
|
11
|
-
|
11
|
+
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions, nxJson?: NxJsonConfiguration<string[] | "*">): Promise<string>;
|
12
|
+
declare function connectToNxCloudGenerator(tree: Tree, options: ConnectToNxCloudOptions): Promise<void>;
|
13
|
+
export default connectToNxCloudGenerator;
|
@@ -9,6 +9,7 @@ const nx_json_1 = require("../../../generators/utils/nx-json");
|
|
9
9
|
const format_changed_files_with_prettier_if_available_1 = require("../../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
10
10
|
const url_shorten_1 = require("../../utilities/url-shorten");
|
11
11
|
const get_cloud_options_1 = require("../../utilities/get-cloud-options");
|
12
|
+
const path_1 = require("path");
|
12
13
|
function printCloudConnectionDisabledMessage() {
|
13
14
|
output_1.output.error({
|
14
15
|
title: `Connections to Nx Cloud are disabled for this workspace`,
|
@@ -68,20 +69,21 @@ async function printSuccessMessage(token, installationSource, usesGithub) {
|
|
68
69
|
});
|
69
70
|
return connectCloudUrl;
|
70
71
|
}
|
71
|
-
function addNxCloudOptionsToNxJson(tree,
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
function addNxCloudOptionsToNxJson(tree, token, directory = '') {
|
73
|
+
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
|
74
|
+
if (tree.exists(nxJsonPath)) {
|
75
|
+
(0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
|
76
|
+
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
|
77
|
+
if (overrideUrl) {
|
78
|
+
nxJson.nxCloudUrl = overrideUrl;
|
79
|
+
}
|
80
|
+
nxJson.nxCloudAccessToken = token;
|
81
|
+
return nxJson;
|
82
|
+
});
|
79
83
|
}
|
80
|
-
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
81
84
|
}
|
82
|
-
async function connectToNxCloud(tree, schema) {
|
85
|
+
async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)(tree)) {
|
83
86
|
schema.installationSource ??= 'user';
|
84
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
85
87
|
if (nxJson?.neverConnectToCloud) {
|
86
88
|
printCloudConnectionDisabledMessage();
|
87
89
|
return null;
|
@@ -91,9 +93,11 @@ async function connectToNxCloud(tree, schema) {
|
|
91
93
|
let responseFromCreateNxCloudWorkspace;
|
92
94
|
// do NOT create Nx Cloud token (createNxCloudWorkspace)
|
93
95
|
// if user is using github and is running nx-connect
|
94
|
-
if (!(usesGithub &&
|
96
|
+
if (!(usesGithub &&
|
97
|
+
(schema.installationSource === 'nx-connect' ||
|
98
|
+
schema.installationSource === 'nx-console'))) {
|
95
99
|
responseFromCreateNxCloudWorkspace = await createNxCloudWorkspace(getRootPackageName(tree), schema.installationSource, getNxInitDate());
|
96
|
-
addNxCloudOptionsToNxJson(tree,
|
100
|
+
addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspace?.token, schema.directory);
|
97
101
|
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
98
102
|
silent: schema.hideFormatLogs,
|
99
103
|
});
|
@@ -101,4 +105,7 @@ async function connectToNxCloud(tree, schema) {
|
|
101
105
|
}
|
102
106
|
}
|
103
107
|
}
|
104
|
-
|
108
|
+
async function connectToNxCloudGenerator(tree, options) {
|
109
|
+
await connectToNxCloud(tree, options);
|
110
|
+
}
|
111
|
+
exports.default = connectToNxCloudGenerator;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { CloudTaskRunnerOptions } from '../nx-cloud-tasks-runner-shell';
|
2
|
-
export declare function getCloudOptions(): CloudTaskRunnerOptions;
|
2
|
+
export declare function getCloudOptions(directory?: string): CloudTaskRunnerOptions;
|
3
3
|
export declare function getCloudUrl(): string;
|
4
4
|
export declare function removeTrailingSlash(apiUrl: string): string;
|
@@ -5,8 +5,9 @@ exports.getCloudUrl = getCloudUrl;
|
|
5
5
|
exports.removeTrailingSlash = removeTrailingSlash;
|
6
6
|
const nx_json_1 = require("../../config/nx-json");
|
7
7
|
const run_command_1 = require("../../tasks-runner/run-command");
|
8
|
-
|
9
|
-
|
8
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
9
|
+
function getCloudOptions(directory = workspace_root_1.workspaceRoot) {
|
10
|
+
const nxJson = (0, nx_json_1.readNxJson)(directory);
|
10
11
|
// TODO: The default is not always cloud? But it's not handled at the moment
|
11
12
|
return (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
12
13
|
}
|
@@ -141,9 +141,14 @@ class TargetProjectLocator {
|
|
141
141
|
}
|
142
142
|
const version = (0, semver_1.clean)(externalPackageJson.version);
|
143
143
|
const npmProjectKey = `npm:${externalPackageJson.name}@${version}`;
|
144
|
-
|
144
|
+
let matchingExternalNode = this.npmProjects[npmProjectKey];
|
145
145
|
if (!matchingExternalNode) {
|
146
|
-
|
146
|
+
// check if it's a package alias, where the resolved package key is used as the version
|
147
|
+
const aliasNpmProjectKey = `npm:${packageName}@${npmProjectKey}`;
|
148
|
+
matchingExternalNode = this.npmProjects[aliasNpmProjectKey];
|
149
|
+
if (!matchingExternalNode) {
|
150
|
+
return null;
|
151
|
+
}
|
147
152
|
}
|
148
153
|
this.npmResolutionCache.set(npmImportForProject, matchingExternalNode.name);
|
149
154
|
return matchingExternalNode.name;
|
@@ -90,7 +90,15 @@ function buildProjectConfigurationFromPackageJson(packageJson, workspaceRoot, pa
|
|
90
90
|
const siblingProjectJson = tryReadJson((0, node_path_1.join)(workspaceRoot, projectRoot, 'project.json'));
|
91
91
|
if (siblingProjectJson) {
|
92
92
|
for (const target of Object.keys(siblingProjectJson?.targets ?? {})) {
|
93
|
-
|
93
|
+
const { executor, command, options } = siblingProjectJson.targets[target];
|
94
|
+
if (
|
95
|
+
// will use run-commands, different target
|
96
|
+
command ||
|
97
|
+
// Either uses a different executor or runs a different script
|
98
|
+
(executor &&
|
99
|
+
(executor !== 'nx:run-script' || options?.script !== target))) {
|
100
|
+
delete packageJson.scripts?.[target];
|
101
|
+
}
|
94
102
|
}
|
95
103
|
}
|
96
104
|
if (!packageJson.name && projectRoot === '.') {
|
@@ -13,7 +13,11 @@ const exit_codes_1 = require("../../../utils/exit-codes");
|
|
13
13
|
const messaging_1 = require("./messaging");
|
14
14
|
const cleanupFunctions = new Set();
|
15
15
|
const pluginNames = new Map();
|
16
|
-
const
|
16
|
+
const PLUGIN_TIMEOUT_HINT_TEXT = 'As a last resort, you can set NX_PLUGIN_NO_TIMEOUTS=true to bypass this timeout.';
|
17
|
+
const MINUTES = 10;
|
18
|
+
const MAX_MESSAGE_WAIT = process.env.NX_PLUGIN_NO_TIMEOUTS === 'true'
|
19
|
+
? undefined
|
20
|
+
: 1000 * 60 * MINUTES; // 10 minutes
|
17
21
|
const nxPluginWorkerCache = (global['nxPluginWorkerCache'] ??= new Map());
|
18
22
|
async function loadRemoteNxPlugin(plugin, root) {
|
19
23
|
const cacheKey = JSON.stringify({ plugin, root });
|
@@ -36,11 +40,14 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
36
40
|
payload: { plugin, root },
|
37
41
|
});
|
38
42
|
// logger.verbose(`[plugin-worker] started worker: ${worker.pid}`);
|
39
|
-
const loadTimeout =
|
40
|
-
|
41
|
-
|
43
|
+
const loadTimeout = MAX_MESSAGE_WAIT
|
44
|
+
? setTimeout(() => {
|
45
|
+
rej(new Error(`Loading "${plugin}" timed out after ${MINUTES} minutes. ${PLUGIN_TIMEOUT_HINT_TEXT}`));
|
46
|
+
}, MAX_MESSAGE_WAIT)
|
47
|
+
: undefined;
|
42
48
|
socket.on('data', (0, consume_messages_from_socket_1.consumeMessagesFromSocket)(createWorkerHandler(worker, pendingPromises, (val) => {
|
43
|
-
|
49
|
+
if (loadTimeout)
|
50
|
+
clearTimeout(loadTimeout);
|
44
51
|
res(val);
|
45
52
|
}, rej, socket)));
|
46
53
|
worker.on('exit', exitHandler);
|
@@ -90,6 +97,9 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
90
97
|
type: 'createNodes',
|
91
98
|
payload: { configFiles, context: ctx, tx },
|
92
99
|
});
|
100
|
+
}, {
|
101
|
+
plugin: pluginName,
|
102
|
+
operation: 'createNodes',
|
93
103
|
});
|
94
104
|
},
|
95
105
|
]
|
@@ -102,6 +112,9 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
102
112
|
type: 'createDependencies',
|
103
113
|
payload: { context: ctx, tx },
|
104
114
|
});
|
115
|
+
}, {
|
116
|
+
plugin: pluginName,
|
117
|
+
operation: 'createDependencies',
|
105
118
|
});
|
106
119
|
}
|
107
120
|
: undefined,
|
@@ -113,6 +126,9 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
113
126
|
type: 'processProjectGraph',
|
114
127
|
payload: { graph, ctx, tx },
|
115
128
|
});
|
129
|
+
}, {
|
130
|
+
operation: 'processProjectGraph',
|
131
|
+
plugin: pluginName,
|
116
132
|
});
|
117
133
|
}
|
118
134
|
: undefined,
|
@@ -124,6 +140,9 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
124
140
|
type: 'createMetadata',
|
125
141
|
payload: { graph, context: ctx, tx },
|
126
142
|
});
|
143
|
+
}, {
|
144
|
+
plugin: pluginName,
|
145
|
+
operation: 'createMetadata',
|
127
146
|
});
|
128
147
|
}
|
129
148
|
: undefined,
|
@@ -192,18 +211,21 @@ process.on('SIGINT', () => {
|
|
192
211
|
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
193
212
|
});
|
194
213
|
process.on('SIGTERM', exitHandler);
|
195
|
-
function registerPendingPromise(tx, pending, callback) {
|
214
|
+
function registerPendingPromise(tx, pending, callback, context) {
|
196
215
|
let resolver, rejector, timeout;
|
197
216
|
const promise = new Promise((res, rej) => {
|
198
217
|
rejector = rej;
|
199
218
|
resolver = res;
|
200
|
-
timeout =
|
201
|
-
|
202
|
-
|
219
|
+
timeout = MAX_MESSAGE_WAIT
|
220
|
+
? setTimeout(() => {
|
221
|
+
rej(new Error(`${context.plugin} timed out after ${MINUTES} minutes during ${context.operation}. ${PLUGIN_TIMEOUT_HINT_TEXT}`));
|
222
|
+
}, MAX_MESSAGE_WAIT)
|
223
|
+
: undefined;
|
203
224
|
callback();
|
204
225
|
}).finally(() => {
|
205
226
|
pending.delete(tx);
|
206
|
-
|
227
|
+
if (timeout)
|
228
|
+
clearTimeout(timeout);
|
207
229
|
});
|
208
230
|
pending.set(tx, {
|
209
231
|
promise,
|
@@ -25,7 +25,7 @@ class Cache {
|
|
25
25
|
if (shouldSpawnProcess) {
|
26
26
|
const scriptPath = require.resolve('./remove-old-cache-records.js');
|
27
27
|
try {
|
28
|
-
const p = (0, child_process_1.spawn)('node', [scriptPath,
|
28
|
+
const p = (0, child_process_1.spawn)('node', [scriptPath, `${this.cachePath}`], {
|
29
29
|
stdio: 'ignore',
|
30
30
|
detached: true,
|
31
31
|
shell: false,
|
@@ -18,9 +18,11 @@ export declare class ProcessTasks {
|
|
18
18
|
private processTasksForMultipleProjects;
|
19
19
|
private processTasksForSingleProject;
|
20
20
|
private processTasksForDependencies;
|
21
|
+
private createDummyTask;
|
21
22
|
createTask(id: string, project: ProjectGraphProjectNode, target: string, resolvedConfiguration: string | undefined, overrides: Object): Task;
|
22
23
|
resolveConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string | undefined): string;
|
23
24
|
getId(project: string, target: string, configuration: string | undefined): string;
|
25
|
+
private filterDummyTasks;
|
24
26
|
}
|
25
27
|
export declare function createTaskGraph(projectGraph: ProjectGraph, extraTargetDependencies: TargetDependencies, projectNames: string[], targets: string[], configuration: string | undefined, overrides: Object, excludeTaskDependencies?: boolean): TaskGraph;
|
26
28
|
export declare function mapTargetDefaultsToDependencies(defaults: TargetDefaults | undefined): TargetDependencies;
|
@@ -6,6 +6,7 @@ exports.mapTargetDefaultsToDependencies = mapTargetDefaultsToDependencies;
|
|
6
6
|
const utils_1 = require("./utils");
|
7
7
|
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
8
8
|
const output_1 = require("../utils/output");
|
9
|
+
const DUMMY_TASK_TARGET = '__nx_dummy_task__';
|
9
10
|
class ProcessTasks {
|
10
11
|
constructor(extraTargetDependencies, projectGraph) {
|
11
12
|
this.extraTargetDependencies = extraTargetDependencies;
|
@@ -52,6 +53,7 @@ class ProcessTasks {
|
|
52
53
|
this.dependencies[d] = this.dependencies[d].filter((dd) => !!initialTasks[dd]);
|
53
54
|
}
|
54
55
|
}
|
56
|
+
this.filterDummyTasks();
|
55
57
|
for (const projectName of Object.keys(this.dependencies)) {
|
56
58
|
if (this.dependencies[projectName].length > 1) {
|
57
59
|
this.dependencies[projectName] = [
|
@@ -113,6 +115,9 @@ class ProcessTasks {
|
|
113
115
|
}
|
114
116
|
}
|
115
117
|
processTasksForDependencies(projectUsedToDeriveDependencies, dependencyConfig, configuration, task, taskOverrides, overrides) {
|
118
|
+
if (!this.projectGraph.dependencies.hasOwnProperty(projectUsedToDeriveDependencies)) {
|
119
|
+
return;
|
120
|
+
}
|
116
121
|
for (const dep of this.projectGraph.dependencies[projectUsedToDeriveDependencies]) {
|
117
122
|
const depProject = this.projectGraph.nodes[dep.target];
|
118
123
|
// this is to handle external dependencies
|
@@ -132,10 +137,20 @@ class ProcessTasks {
|
|
132
137
|
}
|
133
138
|
}
|
134
139
|
else {
|
135
|
-
this.
|
140
|
+
const dummyId = this.getId(depProject.name, DUMMY_TASK_TARGET, undefined);
|
141
|
+
this.dependencies[task.id].push(dummyId);
|
142
|
+
this.dependencies[dummyId] = [];
|
143
|
+
const noopTask = this.createDummyTask(dummyId, task);
|
144
|
+
this.processTask(noopTask, depProject.name, configuration, overrides);
|
136
145
|
}
|
137
146
|
}
|
138
147
|
}
|
148
|
+
createDummyTask(id, task) {
|
149
|
+
return {
|
150
|
+
...task,
|
151
|
+
id,
|
152
|
+
};
|
153
|
+
}
|
139
154
|
createTask(id, project, target, resolvedConfiguration, overrides) {
|
140
155
|
if (!project.data.targets[target]) {
|
141
156
|
throw new Error(`Cannot find configuration for task ${project.name}:${target}`);
|
@@ -173,6 +188,25 @@ class ProcessTasks {
|
|
173
188
|
}
|
174
189
|
return id;
|
175
190
|
}
|
191
|
+
filterDummyTasks() {
|
192
|
+
for (const [key, deps] of Object.entries(this.dependencies)) {
|
193
|
+
const normalizedDeps = [];
|
194
|
+
for (const dep of deps) {
|
195
|
+
if (dep.endsWith(DUMMY_TASK_TARGET)) {
|
196
|
+
normalizedDeps.push(...this.dependencies[dep].filter((d) => !d.endsWith(DUMMY_TASK_TARGET)));
|
197
|
+
}
|
198
|
+
else {
|
199
|
+
normalizedDeps.push(dep);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
this.dependencies[key] = normalizedDeps;
|
203
|
+
}
|
204
|
+
for (const key of Object.keys(this.dependencies)) {
|
205
|
+
if (key.endsWith(DUMMY_TASK_TARGET)) {
|
206
|
+
delete this.dependencies[key];
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
176
210
|
}
|
177
211
|
exports.ProcessTasks = ProcessTasks;
|
178
212
|
function createTaskGraph(projectGraph, extraTargetDependencies, projectNames, targets, configuration, overrides, excludeTaskDependencies = false) {
|
@@ -77,27 +77,31 @@ function expandDependencyConfigSyntaxSugar(dependencyConfigString, graph) {
|
|
77
77
|
}
|
78
78
|
// Weakmap let's the cache get cleared by garbage collector if allTargetNames is no longer used
|
79
79
|
const patternResultCache = new WeakMap();
|
80
|
-
function
|
81
|
-
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) {
|
82
|
-
return [dependencyConfig];
|
83
|
-
}
|
80
|
+
function findMatchingTargets(pattern, allTargetNames) {
|
84
81
|
let cache = patternResultCache.get(allTargetNames);
|
85
82
|
if (!cache) {
|
86
83
|
cache = new Map();
|
87
84
|
patternResultCache.set(allTargetNames, cache);
|
88
85
|
}
|
89
|
-
const cachedResult = cache.get(
|
86
|
+
const cachedResult = cache.get(pattern);
|
90
87
|
if (cachedResult) {
|
91
88
|
return cachedResult;
|
92
89
|
}
|
93
|
-
const matcher = minimatch_1.minimatch.filter(
|
90
|
+
const matcher = minimatch_1.minimatch.filter(pattern);
|
94
91
|
const matchingTargets = allTargetNames.filter((t) => matcher(t));
|
95
|
-
|
96
|
-
|
92
|
+
cache.set(pattern, matchingTargets);
|
93
|
+
return matchingTargets;
|
94
|
+
}
|
95
|
+
function expandWildcardTargetConfiguration(dependencyConfig, allTargetNames) {
|
96
|
+
if (!(0, globs_1.isGlobPattern)(dependencyConfig.target)) {
|
97
|
+
return [dependencyConfig];
|
98
|
+
}
|
99
|
+
const matchingTargets = findMatchingTargets(dependencyConfig.target, allTargetNames);
|
100
|
+
return matchingTargets.map((t) => ({
|
97
101
|
target: t,
|
102
|
+
projects: dependencyConfig.projects,
|
103
|
+
dependencies: dependencyConfig.dependencies,
|
98
104
|
}));
|
99
|
-
cache.set(dependencyConfig.target, result);
|
100
|
-
return result;
|
101
105
|
}
|
102
106
|
function readProjectAndTargetFromTargetString(targetString, projects) {
|
103
107
|
// Support for both `project:target` and `target:with:colons` syntax
|