nx 20.0.0-canary.20241002-1d10a19 → 20.0.0-canary.20241005-75c1da3
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/.eslintrc.json +12 -2
- package/bin/init-local.js +0 -39
- package/bin/nx.js +3 -13
- package/migrations.json +5 -37
- package/package.json +11 -11
- package/release/changelog-renderer/index.d.ts +60 -38
- package/release/changelog-renderer/index.js +260 -236
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -1
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/affected/affected.js +0 -2
- package/src/command-line/nx-commands.js +31 -10
- package/src/command-line/release/changelog.d.ts +2 -2
- package/src/command-line/release/changelog.js +28 -29
- package/src/command-line/release/index.d.ts +5 -2
- package/src/command-line/release/publish.d.ts +6 -1
- package/src/command-line/release/publish.js +31 -25
- package/src/command-line/release/utils/git.js +2 -2
- package/src/command-line/release/utils/print-changes.js +6 -4
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
- package/src/command-line/release/version.d.ts +3 -3
- package/src/command-line/run/run-one.js +0 -2
- package/src/command-line/run/run.js +0 -1
- package/src/command-line/run-many/run-many.js +1 -4
- package/src/command-line/yargs-utils/shared-options.js +2 -2
- package/src/config/misc-interfaces.d.ts +3 -15
- package/src/config/nx-json.d.ts +4 -3
- package/src/config/project-graph.d.ts +0 -2
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.js +1 -3
- package/src/devkit-exports.d.ts +3 -4
- package/src/devkit-exports.js +3 -6
- package/src/executors/utils/convert-nx-executor.js +0 -1
- package/src/generators/utils/nx-json.d.ts +1 -1
- package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/onboarding.js +2 -2
- package/src/nx-cloud/utilities/url-shorten.js +5 -5
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
- package/src/project-graph/build-project-graph.js +3 -41
- package/src/project-graph/error-types.d.ts +4 -10
- package/src/project-graph/error-types.js +1 -12
- package/src/project-graph/file-utils.d.ts +2 -2
- package/src/project-graph/file-utils.js +3 -3
- package/src/project-graph/nx-deps-cache.d.ts +0 -1
- package/src/project-graph/nx-deps-cache.js +0 -1
- package/src/project-graph/plugins/internal-api.d.ts +2 -5
- package/src/project-graph/plugins/internal-api.js +0 -1
- package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
- package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
- package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
- package/src/project-graph/plugins/loader.js +2 -3
- package/src/project-graph/plugins/public-api.d.ts +6 -7
- package/src/project-graph/plugins/utils.d.ts +1 -7
- package/src/project-graph/plugins/utils.js +0 -37
- package/src/project-graph/utils/project-configuration-utils.js +1 -1
- package/src/tasks-runner/batch/run-batch.js +0 -1
- package/src/tasks-runner/cache.d.ts +2 -1
- package/src/tasks-runner/cache.js +11 -6
- package/src/tasks-runner/create-task-graph.d.ts +2 -0
- package/src/tasks-runner/create-task-graph.js +39 -5
- package/src/tasks-runner/init-tasks-runner.js +0 -2
- package/src/tasks-runner/run-command.js +15 -2
- package/src/tasks-runner/task-orchestrator.js +1 -1
- package/src/utils/command-line-utils.d.ts +3 -0
- package/src/utils/command-line-utils.js +24 -33
- package/src/utils/git-utils.js +2 -2
- package/src/utils/plugins/plugin-capabilities.js +2 -3
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
- package/src/utils/app-root.d.ts +0 -8
- package/src/utils/app-root.js +0 -12
- package/src/utils/nx-plugin.deprecated.d.ts +0 -31
- package/src/utils/nx-plugin.deprecated.js +0 -20
- package/src/utils/workspace-configuration-check.d.ts +0 -1
- package/src/utils/workspace-configuration-check.js +0 -36
@@ -57,9 +57,7 @@ class DaemonClient {
|
|
57
57
|
}
|
58
58
|
enabled() {
|
59
59
|
if (this._enabled === undefined) {
|
60
|
-
|
61
|
-
const useDaemonProcessOption = this.nxJson?.useDaemonProcess ??
|
62
|
-
this.nxJson?.tasksRunnerOptions?.['default']?.options?.useDaemonProcess;
|
60
|
+
const useDaemonProcessOption = this.nxJson?.useDaemonProcess;
|
63
61
|
const env = process.env.NX_DAEMON;
|
64
62
|
// env takes precedence
|
65
63
|
// option=true,env=false => no daemon
|
package/src/devkit-exports.d.ts
CHANGED
@@ -18,7 +18,6 @@ export { workspaceLayout } from './config/configuration';
|
|
18
18
|
export type { NxPlugin, NxPluginV2, CreateNodes, CreateNodesFunction, CreateNodesResult, CreateNodesContext, CreateNodesContextV2, CreateNodesFunctionV2, CreateNodesResultV2, CreateNodesV2, CreateDependencies, CreateDependenciesContext, CreateMetadata, CreateMetadataContext, ProjectsMetadata, } from './project-graph/plugins';
|
19
19
|
export { AggregateCreateNodesError } from './project-graph/error-types';
|
20
20
|
export { createNodesFromFiles } from './project-graph/plugins';
|
21
|
-
export type { NxPluginV1, ProjectTargetConfigurator, } from './utils/nx-plugin.deprecated';
|
22
21
|
/**
|
23
22
|
* @category Workspace
|
24
23
|
*/
|
@@ -66,7 +65,7 @@ export { readNxJson, updateNxJson, } from './generators/utils/project-configurat
|
|
66
65
|
/**
|
67
66
|
* @category Project Graph
|
68
67
|
*/
|
69
|
-
export type { ProjectFileMap, FileMap, FileData, ProjectGraph, ProjectGraphDependency,
|
68
|
+
export type { ProjectFileMap, FileMap, FileData, ProjectGraph, ProjectGraphDependency, ProjectGraphProjectNode, ProjectGraphExternalNode, } from './config/project-graph';
|
70
69
|
export type { GraphJson } from './command-line/graph/graph';
|
71
70
|
/**
|
72
71
|
* @category Project Graph
|
@@ -75,7 +74,7 @@ export { DependencyType } from './config/project-graph';
|
|
75
74
|
/**
|
76
75
|
* @category Project Graph
|
77
76
|
*/
|
78
|
-
export {
|
77
|
+
export { RawProjectGraphDependency, DynamicDependency, ImplicitDependency, StaticDependency, validateDependency, } from './project-graph/project-graph-builder';
|
79
78
|
/**
|
80
79
|
* @category Generators
|
81
80
|
*/
|
@@ -103,7 +102,7 @@ export { joinPathFragments, normalizePath } from './utils/path';
|
|
103
102
|
/**
|
104
103
|
* @category Utils
|
105
104
|
*/
|
106
|
-
export { workspaceRoot
|
105
|
+
export { workspaceRoot } from './utils/workspace-root';
|
107
106
|
/**
|
108
107
|
* @category Utils
|
109
108
|
*/
|
package/src/devkit-exports.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
* Try hard to not add to this API to reduce the surface area we need to maintain.
|
5
5
|
*/
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
-
exports.isDaemonEnabled = exports.createProjectFileMapUsingProjectGraph = exports.cacheDir = exports.hashArray = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readProjectsConfigurationFromProjectGraph = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.
|
7
|
+
exports.isDaemonEnabled = exports.createProjectFileMapUsingProjectGraph = exports.cacheDir = exports.hashArray = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readProjectsConfigurationFromProjectGraph = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.workspaceRoot = exports.normalizePath = exports.joinPathFragments = exports.stripIndents = exports.writeJsonFile = exports.readJsonFile = exports.stripJsonComments = exports.serializeJson = exports.parseJson = exports.updateJson = exports.writeJson = exports.readJson = exports.validateDependency = exports.DependencyType = exports.updateNxJson = exports.readNxJson = exports.globAsync = exports.glob = exports.getProjects = exports.updateProjectConfiguration = exports.removeProjectConfiguration = exports.readProjectConfiguration = exports.addProjectConfiguration = exports.runExecutor = exports.isWorkspacesEnabled = exports.getPackageManagerVersion = exports.detectPackageManager = exports.getPackageManagerCommand = exports.output = exports.logger = exports.createNodesFromFiles = exports.AggregateCreateNodesError = exports.workspaceLayout = void 0;
|
8
8
|
var configuration_1 = require("./config/configuration");
|
9
9
|
Object.defineProperty(exports, "workspaceLayout", { enumerable: true, get: function () { return configuration_1.workspaceLayout; } });
|
10
10
|
var error_types_1 = require("./project-graph/error-types");
|
@@ -64,7 +64,6 @@ Object.defineProperty(exports, "DependencyType", { enumerable: true, get: functi
|
|
64
64
|
* @category Project Graph
|
65
65
|
*/
|
66
66
|
var project_graph_builder_1 = require("./project-graph/project-graph-builder");
|
67
|
-
Object.defineProperty(exports, "ProjectGraphBuilder", { enumerable: true, get: function () { return project_graph_builder_1.ProjectGraphBuilder; } });
|
68
67
|
Object.defineProperty(exports, "validateDependency", { enumerable: true, get: function () { return project_graph_builder_1.validateDependency; } });
|
69
68
|
/**
|
70
69
|
* @category Generators
|
@@ -97,13 +96,11 @@ Object.defineProperty(exports, "stripIndents", { enumerable: true, get: function
|
|
97
96
|
var path_1 = require("./utils/path");
|
98
97
|
Object.defineProperty(exports, "joinPathFragments", { enumerable: true, get: function () { return path_1.joinPathFragments; } });
|
99
98
|
Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return path_1.normalizePath; } });
|
100
|
-
// TODO(v16): Change this to export from './utils/workspace-root'
|
101
99
|
/**
|
102
100
|
* @category Utils
|
103
101
|
*/
|
104
|
-
var
|
105
|
-
Object.defineProperty(exports, "workspaceRoot", { enumerable: true, get: function () { return
|
106
|
-
Object.defineProperty(exports, "appRootPath", { enumerable: true, get: function () { return app_root_1.appRootPath; } });
|
102
|
+
var workspace_root_1 = require("./utils/workspace-root");
|
103
|
+
Object.defineProperty(exports, "workspaceRoot", { enumerable: true, get: function () { return workspace_root_1.workspaceRoot; } });
|
107
104
|
/**
|
108
105
|
* @category Utils
|
109
106
|
*/
|
@@ -29,7 +29,6 @@ function convertNxExecutor(executor) {
|
|
29
29
|
targetName: builderContext.target.target,
|
30
30
|
target: builderContext.target.target,
|
31
31
|
configurationName: builderContext.target.configuration,
|
32
|
-
workspace: { ...nxJsonConfiguration, ...projectsConfigurations },
|
33
32
|
projectsConfigurations,
|
34
33
|
nxJsonConfiguration,
|
35
34
|
cwd: process.cwd(),
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { NxJsonConfiguration } from '../../config/nx-json';
|
2
2
|
import type { Tree } from '../tree';
|
3
3
|
/**
|
4
|
-
* @deprecated You must pass a {@link Tree}
|
4
|
+
* @deprecated You must pass a {@link Tree}. This will be removed in Nx 21.
|
5
5
|
*/
|
6
6
|
export declare function readNxJson(): NxJsonConfiguration | null;
|
7
7
|
export declare function readNxJson(tree: Tree): NxJsonConfiguration | null;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = update;
|
4
|
+
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
5
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
6
|
+
async function update(tree) {
|
7
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
8
|
+
if (nxJson?.tasksRunnerOptions?.['default']?.options?.useDaemonProcess !==
|
9
|
+
undefined) {
|
10
|
+
nxJson.useDaemonProcess =
|
11
|
+
nxJson.tasksRunnerOptions['default'].options.useDaemonProcess;
|
12
|
+
delete nxJson.tasksRunnerOptions['default'].options.useDaemonProcess;
|
13
|
+
if (Object.keys(nxJson.tasksRunnerOptions['default'].options).length === 0) {
|
14
|
+
delete nxJson.tasksRunnerOptions['default'].options;
|
15
|
+
}
|
16
|
+
if (Object.keys(nxJson.tasksRunnerOptions['default']).length === 0) {
|
17
|
+
delete nxJson.tasksRunnerOptions['default'];
|
18
|
+
}
|
19
|
+
if (Object.keys(nxJson.tasksRunnerOptions).length === 0) {
|
20
|
+
delete nxJson.tasksRunnerOptions;
|
21
|
+
}
|
22
|
+
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
23
|
+
}
|
24
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
25
|
+
}
|
Binary file
|
@@ -42,6 +42,18 @@ function getNxInitDate() {
|
|
42
42
|
return null;
|
43
43
|
}
|
44
44
|
}
|
45
|
+
async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
|
46
|
+
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
47
|
+
const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
|
48
|
+
workspaceName,
|
49
|
+
installationSource,
|
50
|
+
nxInitDate,
|
51
|
+
});
|
52
|
+
if (response.data.message) {
|
53
|
+
throw new Error(response.data.message);
|
54
|
+
}
|
55
|
+
return response.data;
|
56
|
+
}
|
45
57
|
async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {
|
46
58
|
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
|
47
59
|
const response = await require('axios').post(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
|
@@ -69,6 +81,19 @@ async function printSuccessMessage(token, installationSource, usesGithub) {
|
|
69
81
|
});
|
70
82
|
return connectCloudUrl;
|
71
83
|
}
|
84
|
+
function addNxCloudAccessTokenToNxJson(tree, token, directory = '') {
|
85
|
+
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
|
86
|
+
if (tree.exists(nxJsonPath)) {
|
87
|
+
(0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
|
88
|
+
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
|
89
|
+
if (overrideUrl) {
|
90
|
+
nxJson.nxCloudUrl = overrideUrl;
|
91
|
+
}
|
92
|
+
nxJson.nxCloudAccessToken = token;
|
93
|
+
return nxJson;
|
94
|
+
});
|
95
|
+
}
|
96
|
+
}
|
72
97
|
function addNxCloudIdToNxJson(tree, nxCloudId, directory = '') {
|
73
98
|
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
|
74
99
|
if (tree.exists(nxJsonPath)) {
|
@@ -89,6 +114,7 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
|
|
89
114
|
return null;
|
90
115
|
}
|
91
116
|
const isGitHubDetected = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
|
117
|
+
let responseFromCreateNxCloudWorkspaceV1;
|
92
118
|
let responseFromCreateNxCloudWorkspaceV2;
|
93
119
|
/**
|
94
120
|
* Do not create an Nx Cloud token if the user is using GitHub and
|
@@ -98,12 +124,34 @@ async function connectToNxCloud(tree, schema, nxJson = (0, nx_json_1.readNxJson)
|
|
98
124
|
isGitHubDetected &&
|
99
125
|
schema.installationSource === 'nx-connect')
|
100
126
|
return null;
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
127
|
+
try {
|
128
|
+
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
|
129
|
+
}
|
130
|
+
catch (e) {
|
131
|
+
if (e.response?.status === 404) {
|
132
|
+
responseFromCreateNxCloudWorkspaceV1 = await createNxCloudWorkspaceV1(getRootPackageName(tree), schema.installationSource, getNxInitDate());
|
133
|
+
}
|
134
|
+
else {
|
135
|
+
throw e;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
if (responseFromCreateNxCloudWorkspaceV2) {
|
139
|
+
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
|
140
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
141
|
+
silent: schema.hideFormatLogs,
|
142
|
+
});
|
143
|
+
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
|
144
|
+
}
|
145
|
+
else if (responseFromCreateNxCloudWorkspaceV1) {
|
146
|
+
addNxCloudAccessTokenToNxJson(tree, responseFromCreateNxCloudWorkspaceV1?.token, schema.directory);
|
147
|
+
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
|
148
|
+
silent: schema.hideFormatLogs,
|
149
|
+
});
|
150
|
+
return responseFromCreateNxCloudWorkspaceV1.token;
|
151
|
+
}
|
152
|
+
else {
|
153
|
+
throw new Error('Could not create an Nx Cloud Workspace. Please try again.');
|
154
|
+
}
|
107
155
|
}
|
108
156
|
async function connectToNxCloudGenerator(tree, options) {
|
109
157
|
await connectToNxCloud(tree, options);
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApiAxiosInstance = createApiAxiosInstance;
|
4
4
|
const path_1 = require("path");
|
5
5
|
const environment_1 = require("./environment");
|
6
|
-
const axios = require('axios');
|
7
6
|
function createApiAxiosInstance(options) {
|
8
7
|
let axiosConfigBuilder = (axiosConfig) => axiosConfig;
|
9
8
|
const baseUrl = process.env.NX_CLOUD_API || options.url || 'https://cloud.nx.app';
|
@@ -17,7 +16,7 @@ function createApiAxiosInstance(options) {
|
|
17
16
|
const { nxCloudProxyConfig } = require((0, path_1.join)(process.cwd(), options.customProxyConfigPath));
|
18
17
|
axiosConfigBuilder = nxCloudProxyConfig ?? axiosConfigBuilder;
|
19
18
|
}
|
20
|
-
return axios.create(axiosConfigBuilder({
|
19
|
+
return require('axios').create(axiosConfigBuilder({
|
21
20
|
baseURL: baseUrl,
|
22
21
|
timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
|
23
22
|
headers: { authorization: accessToken },
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNxCloudOnboardingURLForWelcomeApp = createNxCloudOnboardingURLForWelcomeApp;
|
4
4
|
exports.getNxCloudAppOnBoardingUrl = getNxCloudAppOnBoardingUrl;
|
5
5
|
exports.readNxCloudToken = readNxCloudToken;
|
6
|
-
const devkit_exports_1 = require("../../devkit-exports");
|
7
6
|
const is_workspace_claimed_1 = require("./is-workspace-claimed");
|
8
7
|
const url_shorten_1 = require("./url-shorten");
|
9
8
|
const run_command_1 = require("../../tasks-runner/run-command");
|
9
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
10
10
|
async function createNxCloudOnboardingURLForWelcomeApp(tree, token) {
|
11
11
|
token = token || readNxCloudToken(tree);
|
12
12
|
if (!token) {
|
@@ -22,7 +22,7 @@ async function getNxCloudAppOnBoardingUrl(token) {
|
|
22
22
|
return onboardingUrl;
|
23
23
|
}
|
24
24
|
function readNxCloudToken(tree) {
|
25
|
-
const nxJson = (0,
|
25
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
26
26
|
const { accessToken, nxCloudId } = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
27
27
|
return accessToken || nxCloudId;
|
28
28
|
}
|
@@ -7,7 +7,7 @@ exports.getNxCloudVersion = getNxCloudVersion;
|
|
7
7
|
exports.removeVersionModifier = removeVersionModifier;
|
8
8
|
exports.versionIsValid = versionIsValid;
|
9
9
|
exports.compareCleanCloudVersions = compareCleanCloudVersions;
|
10
|
-
const
|
10
|
+
const logger_1 = require("../../utils/logger");
|
11
11
|
const git_utils_1 = require("../../utils/git-utils");
|
12
12
|
const get_cloud_options_1 = require("./get-cloud-options");
|
13
13
|
/**
|
@@ -27,7 +27,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
catch (e) {
|
30
|
-
|
30
|
+
logger_1.logger.verbose(`Failed to get Nx Cloud version.
|
31
31
|
${e}`);
|
32
32
|
return apiUrl;
|
33
33
|
}
|
@@ -46,7 +46,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
|
|
46
46
|
return `${apiUrl}/connect/${response.data}`;
|
47
47
|
}
|
48
48
|
catch (e) {
|
49
|
-
|
49
|
+
logger_1.logger.verbose(`Failed to shorten Nx Cloud URL.
|
50
50
|
${e}`);
|
51
51
|
return getURLifShortenFailed(usesGithub, githubSlug === 'github' ? null : githubSlug, apiUrl, source, accessToken);
|
52
52
|
}
|
@@ -96,7 +96,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
|
|
96
96
|
}
|
97
97
|
catch (e) {
|
98
98
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
99
|
-
|
99
|
+
logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
|
100
100
|
${e}`);
|
101
101
|
}
|
102
102
|
return false;
|
@@ -116,7 +116,7 @@ async function getNxCloudVersion(apiUrl) {
|
|
116
116
|
return version;
|
117
117
|
}
|
118
118
|
catch (e) {
|
119
|
-
|
119
|
+
logger_1.logger.verbose(`Failed to get version of Nx Cloud.
|
120
120
|
${e}`);
|
121
121
|
return null;
|
122
122
|
}
|
@@ -15,20 +15,10 @@ const get_package_name_from_import_path_1 = require("../../../../utils/get-packa
|
|
15
15
|
* Use a shared cache to avoid repeated npm package resolution work within the TargetProjectLocator.
|
16
16
|
*/
|
17
17
|
const defaultNpmResolutionCache = new Map();
|
18
|
-
const
|
19
|
-
...node_module_1.builtinModules,
|
20
|
-
...node_module_1.builtinModules.map((x) => `node:${x}`),
|
21
|
-
// These are missing in the builtinModules list
|
22
|
-
// See: https://github.com/nodejs/node/issues/42785
|
23
|
-
// TODO(v20): We should be safe to use `isBuiltin` function instead of keep the set here (https://nodejs.org/api/module.html#moduleisbuiltinmodulename)
|
24
|
-
'test',
|
25
|
-
'node:test',
|
26
|
-
'node:sea',
|
27
|
-
'node:sqlite',
|
28
|
-
]);
|
18
|
+
const experimentalNodeModules = new Set(['node:sqlite']);
|
29
19
|
function isBuiltinModuleImport(importExpr) {
|
30
20
|
const packageName = (0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(importExpr);
|
31
|
-
return
|
21
|
+
return (0, node_module_1.isBuiltin)(packageName) || experimentalNodeModules.has(packageName);
|
32
22
|
}
|
33
23
|
class TargetProjectLocator {
|
34
24
|
constructor(nodes, externalNodes = {}, npmResolutionCache = defaultNpmResolutionCache) {
|
@@ -10,13 +10,11 @@ const assert_workspace_validity_1 = require("../utils/assert-workspace-validity"
|
|
10
10
|
const nx_deps_cache_1 = require("./nx-deps-cache");
|
11
11
|
const implicit_project_dependencies_1 = require("./utils/implicit-project-dependencies");
|
12
12
|
const normalize_project_nodes_1 = require("./utils/normalize-project-nodes");
|
13
|
-
const utils_1 = require("./plugins/utils");
|
14
13
|
const typescript_1 = require("../plugins/js/utils/typescript");
|
15
14
|
const fileutils_1 = require("../utils/fileutils");
|
16
15
|
const project_graph_builder_1 = require("./project-graph-builder");
|
17
16
|
const configuration_1 = require("../config/configuration");
|
18
17
|
const fs_1 = require("fs");
|
19
|
-
const output_1 = require("../utils/output");
|
20
18
|
const error_types_1 = require("./error-types");
|
21
19
|
const project_configuration_utils_1 = require("./utils/project-configuration-utils");
|
22
20
|
let storedFileMap = null;
|
@@ -182,44 +180,8 @@ function createContext(projects, nxJson, externalNodes, fileMap, filesToProcess)
|
|
182
180
|
async function updateProjectGraphWithPlugins(context, initProjectGraph, plugins, sourceMap) {
|
183
181
|
let graph = initProjectGraph;
|
184
182
|
const errors = [];
|
185
|
-
for (const plugin of plugins) {
|
186
|
-
try {
|
187
|
-
if ((0, utils_1.isNxPluginV1)(plugin) &&
|
188
|
-
plugin.processProjectGraph &&
|
189
|
-
!plugin.createDependencies) {
|
190
|
-
output_1.output.warn({
|
191
|
-
title: `${plugin.name} is a v1 plugin.`,
|
192
|
-
bodyLines: [
|
193
|
-
'Nx has recently released a v2 model for project graph plugins. The `processProjectGraph` method is deprecated. Plugins should use some combination of `createNodes` and `createDependencies` instead.',
|
194
|
-
],
|
195
|
-
});
|
196
|
-
perf_hooks_1.performance.mark(`${plugin.name}:processProjectGraph - start`);
|
197
|
-
graph = await plugin.processProjectGraph(graph, {
|
198
|
-
...context,
|
199
|
-
projectsConfigurations: {
|
200
|
-
projects: context.projects,
|
201
|
-
version: 2,
|
202
|
-
},
|
203
|
-
fileMap: context.fileMap.projectFileMap,
|
204
|
-
filesToProcess: context.filesToProcess.projectFileMap,
|
205
|
-
workspace: {
|
206
|
-
version: 2,
|
207
|
-
projects: context.projects,
|
208
|
-
...context.nxJsonConfiguration,
|
209
|
-
},
|
210
|
-
});
|
211
|
-
perf_hooks_1.performance.mark(`${plugin.name}:processProjectGraph - end`);
|
212
|
-
perf_hooks_1.performance.measure(`${plugin.name}:processProjectGraph`, `${plugin.name}:processProjectGraph - start`, `${plugin.name}:processProjectGraph - end`);
|
213
|
-
}
|
214
|
-
}
|
215
|
-
catch (e) {
|
216
|
-
errors.push(new error_types_1.ProcessProjectGraphError(plugin.name, {
|
217
|
-
cause: e,
|
218
|
-
}));
|
219
|
-
}
|
220
|
-
}
|
221
183
|
const builder = new project_graph_builder_1.ProjectGraphBuilder(graph, context.fileMap.projectFileMap, context.fileMap.nonProjectFiles);
|
222
|
-
const createDependencyPlugins = plugins.filter((plugin) =>
|
184
|
+
const createDependencyPlugins = plugins.filter((plugin) => plugin.createDependencies);
|
223
185
|
await Promise.all(createDependencyPlugins.map(async (plugin) => {
|
224
186
|
perf_hooks_1.performance.mark(`${plugin.name}:createDependencies - start`);
|
225
187
|
try {
|
@@ -264,10 +226,10 @@ async function applyProjectMetadata(graph, plugins, context, sourceMap) {
|
|
264
226
|
const results = [];
|
265
227
|
const errors = [];
|
266
228
|
const promises = plugins.map(async (plugin) => {
|
267
|
-
if (
|
229
|
+
if (plugin.createMetadata) {
|
268
230
|
perf_hooks_1.performance.mark(`${plugin.name}:createMetadata - start`);
|
269
231
|
try {
|
270
|
-
const metadata = await plugin.createMetadata(graph,
|
232
|
+
const metadata = await plugin.createMetadata(graph, context);
|
271
233
|
results.push({ metadata, pluginName: plugin.name });
|
272
234
|
}
|
273
235
|
catch (e) {
|
@@ -4,7 +4,7 @@ import { ProjectGraph } from '../config/project-graph';
|
|
4
4
|
import { CreateNodesFunctionV2 } from './plugins';
|
5
5
|
export declare class ProjectGraphError extends Error {
|
6
6
|
#private;
|
7
|
-
constructor(errors: Array<AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | ProcessDependenciesError |
|
7
|
+
constructor(errors: Array<AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | ProcessDependenciesError | CreateMetadataError | WorkspaceValidityError>, partialProjectGraph: ProjectGraph, partialSourceMaps: ConfigurationSourceMaps);
|
8
8
|
/**
|
9
9
|
* The daemon cannot throw errors which contain methods as they are not serializable.
|
10
10
|
*
|
@@ -18,7 +18,7 @@ export declare class ProjectGraphError extends Error {
|
|
18
18
|
*/
|
19
19
|
getPartialProjectGraph(): ProjectGraph;
|
20
20
|
getPartialSourcemaps(): ConfigurationSourceMaps;
|
21
|
-
getErrors(): (AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | CreateMetadataError | ProcessDependenciesError |
|
21
|
+
getErrors(): (AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | CreateMetadataError | ProcessDependenciesError | WorkspaceValidityError)[];
|
22
22
|
}
|
23
23
|
export declare class MultipleProjectsWithSameNameError extends Error {
|
24
24
|
conflicts: Map<string, string[]>;
|
@@ -108,16 +108,10 @@ export declare class WorkspaceValidityError extends Error {
|
|
108
108
|
constructor(message: string);
|
109
109
|
}
|
110
110
|
export declare function isWorkspaceValidityError(e: unknown): e is WorkspaceValidityError;
|
111
|
-
export declare class ProcessProjectGraphError extends Error {
|
112
|
-
readonly pluginName: string;
|
113
|
-
constructor(pluginName: string, { cause }: {
|
114
|
-
cause: any;
|
115
|
-
});
|
116
|
-
}
|
117
111
|
export declare class AggregateProjectGraphError extends Error {
|
118
|
-
readonly errors: Array<CreateMetadataError | ProcessDependenciesError |
|
112
|
+
readonly errors: Array<CreateMetadataError | ProcessDependenciesError | WorkspaceValidityError>;
|
119
113
|
readonly partialProjectGraph: ProjectGraph;
|
120
|
-
constructor(errors: Array<CreateMetadataError | ProcessDependenciesError |
|
114
|
+
constructor(errors: Array<CreateMetadataError | ProcessDependenciesError | WorkspaceValidityError>, partialProjectGraph: ProjectGraph);
|
121
115
|
}
|
122
116
|
export declare function isAggregateProjectGraphError(e: unknown): e is AggregateProjectGraphError;
|
123
117
|
export declare function isCreateMetadataError(e: unknown): e is CreateMetadataError;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
var _ProjectGraphError_errors, _ProjectGraphError_partialProjectGraph, _ProjectGraphError_partialSourceMaps;
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.LoadPluginError = exports.DaemonProjectGraphError = exports.AggregateProjectGraphError = exports.
|
4
|
+
exports.LoadPluginError = exports.DaemonProjectGraphError = exports.AggregateProjectGraphError = exports.WorkspaceValidityError = exports.ProcessDependenciesError = exports.CreateMetadataError = exports.MergeNodesError = exports.AggregateCreateNodesError = exports.ProjectConfigurationsError = exports.ProjectWithNoNameError = exports.ProjectsWithNoNameError = exports.ProjectWithExistingNameError = exports.MultipleProjectsWithSameNameError = exports.ProjectGraphError = void 0;
|
5
5
|
exports.isProjectWithExistingNameError = isProjectWithExistingNameError;
|
6
6
|
exports.isMultipleProjectsWithSameNameError = isMultipleProjectsWithSameNameError;
|
7
7
|
exports.isProjectsWithNoNameError = isProjectsWithNoNameError;
|
@@ -227,17 +227,6 @@ function isWorkspaceValidityError(e) {
|
|
227
227
|
'name' in e &&
|
228
228
|
e?.name === WorkspaceValidityError.name));
|
229
229
|
}
|
230
|
-
class ProcessProjectGraphError extends Error {
|
231
|
-
constructor(pluginName, { cause }) {
|
232
|
-
super(`The "${pluginName}" plugin threw an error while processing the project graph:`, {
|
233
|
-
cause,
|
234
|
-
});
|
235
|
-
this.pluginName = pluginName;
|
236
|
-
this.name = this.constructor.name;
|
237
|
-
this.stack = `${this.message}\n${indentString(cause, 2)}`;
|
238
|
-
}
|
239
|
-
}
|
240
|
-
exports.ProcessProjectGraphError = ProcessProjectGraphError;
|
241
230
|
class AggregateProjectGraphError extends Error {
|
242
231
|
constructor(errors, partialProjectGraph) {
|
243
232
|
super('Failed to create project graph. See above for errors');
|
@@ -18,8 +18,8 @@ export declare function isDeletedFileChange(change: Change): change is DeletedFi
|
|
18
18
|
export declare function calculateFileChanges(files: string[], allWorkspaceFiles: FileData[], nxArgs?: NxArgs, readFileAtRevision?: (f: string, r: void | string) => string, ignore?: ReturnType<typeof ignore>): FileChange[];
|
19
19
|
export declare const TEN_MEGABYTES: number;
|
20
20
|
/**
|
21
|
-
* TODO(
|
22
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
21
|
+
* TODO(v21): Remove this function
|
22
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
23
23
|
*/
|
24
24
|
export declare function readWorkspaceConfig(opts: {
|
25
25
|
format: 'angularCli' | 'nx';
|
@@ -101,8 +101,8 @@ function defaultReadFileAtRevision(file, revision) {
|
|
101
101
|
}
|
102
102
|
}
|
103
103
|
/**
|
104
|
-
* TODO(
|
105
|
-
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in
|
104
|
+
* TODO(v21): Remove this function
|
105
|
+
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead. This will be removed in v21.
|
106
106
|
*/
|
107
107
|
function readWorkspaceConfig(opts) {
|
108
108
|
let configuration = null;
|
@@ -140,7 +140,7 @@ function readPackageJson() {
|
|
140
140
|
}
|
141
141
|
}
|
142
142
|
/**
|
143
|
-
* TODO(
|
143
|
+
* TODO(v21): Remove this function.
|
144
144
|
*/
|
145
145
|
function getProjectsSync(root, nxJson) {
|
146
146
|
/**
|
@@ -4,7 +4,6 @@ import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
|
4
4
|
export interface FileMapCache {
|
5
5
|
version: string;
|
6
6
|
nxVersion: string;
|
7
|
-
deps: Record<string, string>;
|
8
7
|
pathMappings: Record<string, any>;
|
9
8
|
nxJsonPlugins: PluginData[];
|
10
9
|
pluginsConfig?: any;
|
@@ -77,7 +77,6 @@ function createProjectFileMapCache(nxJson, packageJsonDeps, fileMap, tsConfig) {
|
|
77
77
|
const newValue = {
|
78
78
|
version: '6.0',
|
79
79
|
nxVersion: versions_1.nxVersion,
|
80
|
-
deps: packageJsonDeps, // TODO(v19): We can remove this in favor of nxVersion
|
81
80
|
// compilerOptions may not exist, especially for package-based repos
|
82
81
|
pathMappings: tsConfig?.compilerOptions?.paths || {},
|
83
82
|
nxJsonPlugins,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { PluginConfiguration } from '../../config/nx-json';
|
2
|
-
import { NxPluginV1 } from '../../utils/nx-plugin.deprecated';
|
3
2
|
import { CreateDependencies, CreateDependenciesContext, CreateMetadata, CreateMetadataContext, CreateNodesContextV2, CreateNodesResult, NxPluginV2 } from './public-api';
|
4
|
-
import { ProjectGraph
|
3
|
+
import { ProjectGraph } from '../../config/project-graph';
|
5
4
|
export declare class LoadedNxPlugin {
|
6
5
|
readonly name: string;
|
7
6
|
readonly createNodes?: [
|
@@ -10,17 +9,15 @@ export declare class LoadedNxPlugin {
|
|
10
9
|
];
|
11
10
|
readonly createDependencies?: (context: CreateDependenciesContext) => ReturnType<CreateDependencies>;
|
12
11
|
readonly createMetadata?: (graph: ProjectGraph, context: CreateMetadataContext) => ReturnType<CreateMetadata>;
|
13
|
-
readonly processProjectGraph?: ProjectGraphProcessor;
|
14
12
|
readonly options?: unknown;
|
15
13
|
readonly include?: string[];
|
16
14
|
readonly exclude?: string[];
|
17
|
-
constructor(plugin:
|
15
|
+
constructor(plugin: NxPluginV2, pluginDefinition: PluginConfiguration);
|
18
16
|
}
|
19
17
|
export type CreateNodesResultWithContext = CreateNodesResult & {
|
20
18
|
file: string;
|
21
19
|
pluginName: string;
|
22
20
|
};
|
23
|
-
export type NormalizedPlugin = NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
|
24
21
|
export declare const nxPluginCache: Map<unknown, [
|
25
22
|
Promise<LoadedNxPlugin>,
|
26
23
|
() => void
|
@@ -62,7 +62,6 @@ class LoadedNxPlugin {
|
|
62
62
|
if (plugin.createMetadata) {
|
63
63
|
this.createMetadata = (graph, context) => plugin.createMetadata(graph, this.options, context);
|
64
64
|
}
|
65
|
-
this.processProjectGraph = plugin.processProjectGraph;
|
66
65
|
}
|
67
66
|
}
|
68
67
|
exports.LoadedNxPlugin = LoadedNxPlugin;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ProjectGraph
|
1
|
+
import { ProjectGraph } from '../../../config/project-graph';
|
2
2
|
import { PluginConfiguration } from '../../../config/nx-json';
|
3
3
|
import { CreateDependenciesContext, CreateMetadataContext, CreateNodesContextV2 } from '../public-api';
|
4
4
|
import { LoadedNxPlugin } from '../internal-api';
|
@@ -86,32 +86,12 @@ export interface PluginCreateMetadataResult {
|
|
86
86
|
tx: string;
|
87
87
|
};
|
88
88
|
}
|
89
|
-
export interface PluginWorkerProcessProjectGraphMessage {
|
90
|
-
type: 'processProjectGraph';
|
91
|
-
payload: {
|
92
|
-
graph: ProjectGraph;
|
93
|
-
ctx: ProjectGraphProcessorContext;
|
94
|
-
tx: string;
|
95
|
-
};
|
96
|
-
}
|
97
|
-
export interface PluginWorkerProcessProjectGraphResult {
|
98
|
-
type: 'processProjectGraphResult';
|
99
|
-
payload: {
|
100
|
-
graph: ProjectGraph;
|
101
|
-
success: true;
|
102
|
-
tx: string;
|
103
|
-
} | {
|
104
|
-
success: false;
|
105
|
-
error: Error;
|
106
|
-
tx: string;
|
107
|
-
};
|
108
|
-
}
|
109
89
|
export interface PluginWorkerShutdownMessage {
|
110
90
|
type: 'shutdown';
|
111
91
|
payload: {};
|
112
92
|
}
|
113
|
-
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerShutdownMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage |
|
114
|
-
export type PluginWorkerResult = PluginWorkerLoadResult | PluginWorkerCreateNodesResult | PluginCreateDependenciesResult |
|
93
|
+
export type PluginWorkerMessage = PluginWorkerLoadMessage | PluginWorkerShutdownMessage | PluginWorkerCreateNodesMessage | PluginCreateDependenciesMessage | PluginCreateMetadataMessage;
|
94
|
+
export type PluginWorkerResult = PluginWorkerLoadResult | PluginWorkerCreateNodesResult | PluginCreateDependenciesResult | PluginCreateMetadataResult;
|
115
95
|
export declare function isPluginWorkerMessage(message: Serializable): message is PluginWorkerMessage;
|
116
96
|
export declare function isPluginWorkerResult(message: Serializable): message is PluginWorkerResult;
|
117
97
|
type MaybePromise<T> = T | Promise<T>;
|
@@ -115,20 +115,6 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
115
115
|
});
|
116
116
|
}
|
117
117
|
: undefined,
|
118
|
-
processProjectGraph: result.hasProcessProjectGraph
|
119
|
-
? (graph, ctx) => {
|
120
|
-
const tx = pluginName + worker.pid + ':processProjectGraph:' + txId++;
|
121
|
-
return registerPendingPromise(tx, pending, () => {
|
122
|
-
(0, messaging_1.sendMessageOverSocket)(socket, {
|
123
|
-
type: 'processProjectGraph',
|
124
|
-
payload: { graph, ctx, tx },
|
125
|
-
});
|
126
|
-
}, {
|
127
|
-
operation: 'processProjectGraph',
|
128
|
-
plugin: pluginName,
|
129
|
-
});
|
130
|
-
}
|
131
|
-
: undefined,
|
132
118
|
createMetadata: result.hasCreateMetadata
|
133
119
|
? (graph, ctx) => {
|
134
120
|
const tx = pluginName + worker.pid + ':createMetadata:' + txId++;
|
@@ -167,15 +153,6 @@ function createWorkerHandler(worker, pending, onload, onloadError, socket) {
|
|
167
153
|
rejector(result.error);
|
168
154
|
}
|
169
155
|
},
|
170
|
-
processProjectGraphResult: ({ tx, ...result }) => {
|
171
|
-
const { resolver, rejector } = pending.get(tx);
|
172
|
-
if (result.success) {
|
173
|
-
resolver(result.graph);
|
174
|
-
}
|
175
|
-
else if (result.success === false) {
|
176
|
-
rejector(result.error);
|
177
|
-
}
|
178
|
-
},
|
179
156
|
createMetadataResult: ({ tx, ...result }) => {
|
180
157
|
const { resolver, rejector } = pending.get(tx);
|
181
158
|
if (result.success) {
|