nx 18.1.0-canary.20240228-4d13753 → 18.1.0-canary.20240301-d705372
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/migrations.json +1 -1
- package/package.json +12 -12
- package/schemas/nx-schema.json +4 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -0
- package/src/command-line/add/add.js +2 -1
- package/src/command-line/init/command-object.js +3 -1
- package/src/command-line/init/init-v2.js +1 -0
- package/src/command-line/release/utils/git.js +15 -1
- package/src/config/nx-json.d.ts +4 -0
- package/src/daemon/server/project-graph-incremental-recomputation.js +4 -1
- package/src/generators/utils/project-configuration.js +15 -1
- package/src/migrations/update-15-1-0/set-project-names.js +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +4 -24
- package/src/plugins/js/utils/register.js +1 -0
- package/src/project-graph/build-project-graph.js +0 -3
- package/src/project-graph/plugins/internal-api.d.ts +1 -1
- package/src/project-graph/plugins/internal-api.js +4 -4
- package/src/project-graph/plugins/plugin-pool.js +26 -24
- package/src/project-graph/project-graph.js +2 -0
- package/src/project-graph/utils/project-configuration-utils.js +4 -2
- package/src/project-graph/utils/retrieve-workspace-files.js +6 -1
package/migrations.json
CHANGED
@@ -86,7 +86,7 @@
|
|
86
86
|
"18.0.0-disable-adding-plugins-for-existing-workspaces": {
|
87
87
|
"cli": "nx",
|
88
88
|
"version": "18.0.0-beta.2",
|
89
|
-
"description": "Updates .
|
89
|
+
"description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
|
90
90
|
"implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
|
91
91
|
"x-repair-skip": true
|
92
92
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "18.1.0-canary.
|
3
|
+
"version": "18.1.0-canary.20240301-d705372",
|
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": {
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"yargs-parser": "21.1.1",
|
67
67
|
"node-machine-id": "1.1.12",
|
68
68
|
"ora": "5.3.0",
|
69
|
-
"@nrwl/tao": "18.1.0-canary.
|
69
|
+
"@nrwl/tao": "18.1.0-canary.20240301-d705372"
|
70
70
|
},
|
71
71
|
"peerDependencies": {
|
72
72
|
"@swc-node/register": "^1.8.0",
|
@@ -81,16 +81,16 @@
|
|
81
81
|
}
|
82
82
|
},
|
83
83
|
"optionalDependencies": {
|
84
|
-
"@nx/nx-darwin-x64": "18.1.0-canary.
|
85
|
-
"@nx/nx-darwin-arm64": "18.1.0-canary.
|
86
|
-
"@nx/nx-linux-x64-gnu": "18.1.0-canary.
|
87
|
-
"@nx/nx-linux-x64-musl": "18.1.0-canary.
|
88
|
-
"@nx/nx-win32-x64-msvc": "18.1.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "18.1.0-canary.
|
91
|
-
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.
|
92
|
-
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.
|
93
|
-
"@nx/nx-freebsd-x64": "18.1.0-canary.
|
84
|
+
"@nx/nx-darwin-x64": "18.1.0-canary.20240301-d705372",
|
85
|
+
"@nx/nx-darwin-arm64": "18.1.0-canary.20240301-d705372",
|
86
|
+
"@nx/nx-linux-x64-gnu": "18.1.0-canary.20240301-d705372",
|
87
|
+
"@nx/nx-linux-x64-musl": "18.1.0-canary.20240301-d705372",
|
88
|
+
"@nx/nx-win32-x64-msvc": "18.1.0-canary.20240301-d705372",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "18.1.0-canary.20240301-d705372",
|
90
|
+
"@nx/nx-linux-arm64-musl": "18.1.0-canary.20240301-d705372",
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "18.1.0-canary.20240301-d705372",
|
92
|
+
"@nx/nx-win32-arm64-msvc": "18.1.0-canary.20240301-d705372",
|
93
|
+
"@nx/nx-freebsd-x64": "18.1.0-canary.20240301-d705372"
|
94
94
|
},
|
95
95
|
"nx-migrations": {
|
96
96
|
"migrations": "./migrations.json",
|
package/schemas/nx-schema.json
CHANGED
@@ -101,6 +101,10 @@
|
|
101
101
|
"type": "boolean",
|
102
102
|
"description": "Specifies whether the daemon should be used for the default tasks runner."
|
103
103
|
},
|
104
|
+
"useInferencePlugins": {
|
105
|
+
"type": "boolean",
|
106
|
+
"description": "Specifies whether to add inference plugins when generating new projects."
|
107
|
+
},
|
104
108
|
"release": {
|
105
109
|
"type": "object",
|
106
110
|
"description": "Configuration for the nx release commands.",
|
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"];
|
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"];
|
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"];
|
package/src/adapter/compat.js
CHANGED
@@ -97,7 +97,8 @@ async function initializePlugin(pkgName, options) {
|
|
97
97
|
}
|
98
98
|
else {
|
99
99
|
updatePackageScripts =
|
100
|
-
|
100
|
+
(0, nx_json_1.readNxJson)().useInferencePlugins !== false &&
|
101
|
+
process.env.NX_ADD_PLUGINS !== 'false' &&
|
101
102
|
coreNxPlugins.includes(pkgName);
|
102
103
|
}
|
103
104
|
await (0, child_process_2.runNxAsync)(`g ${pkgName}:${initGenerator} --keepExistingVersions${updatePackageScripts ? ' --updatePackageScripts' : ''}`, {
|
@@ -2,7 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.yargsInitCommand = void 0;
|
4
4
|
const shared_options_1 = require("../yargs-utils/shared-options");
|
5
|
-
const
|
5
|
+
const nx_json_1 = require("../../config/nx-json");
|
6
|
+
const useV2 = process.env['NX_ADD_PLUGINS'] !== 'false' &&
|
7
|
+
(0, nx_json_1.readNxJson)().useInferencePlugins !== false;
|
6
8
|
exports.yargsInitCommand = {
|
7
9
|
command: 'init',
|
8
10
|
describe: 'Adds Nx to any type of workspace. It installs nx, creates an nx.json configuration file and optionally sets up remote caching. For more info, check https://nx.dev/recipes/adopting-nx.',
|
@@ -14,11 +14,25 @@ function escapeRegExp(string) {
|
|
14
14
|
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;
|
15
15
|
async function getLatestGitTagForPattern(releaseTagPattern, additionalInterpolationData = {}) {
|
16
16
|
try {
|
17
|
-
|
17
|
+
let tags;
|
18
|
+
tags = await (0, exec_command_1.execCommand)('git', [
|
19
|
+
'tag',
|
20
|
+
'--sort',
|
21
|
+
'-v:refname',
|
22
|
+
'--merged',
|
23
|
+
]).then((r) => r
|
18
24
|
.trim()
|
19
25
|
.split('\n')
|
20
26
|
.map((t) => t.trim())
|
21
27
|
.filter(Boolean));
|
28
|
+
if (!tags.length) {
|
29
|
+
// try again, but include all tags on the repo instead of just --merged ones
|
30
|
+
tags = await (0, exec_command_1.execCommand)('git', ['tag', '--sort', '-v:refname']).then((r) => r
|
31
|
+
.trim()
|
32
|
+
.split('\n')
|
33
|
+
.map((t) => t.trim())
|
34
|
+
.filter(Boolean));
|
35
|
+
}
|
22
36
|
if (!tags.length) {
|
23
37
|
return null;
|
24
38
|
}
|
package/src/config/nx-json.d.ts
CHANGED
@@ -358,6 +358,10 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
|
|
358
358
|
* Set this to false to disable the daemon.
|
359
359
|
*/
|
360
360
|
useDaemonProcess?: boolean;
|
361
|
+
/**
|
362
|
+
* Set this to false to disable adding inference plugins when generating new projects
|
363
|
+
*/
|
364
|
+
useInferencePlugins?: boolean;
|
361
365
|
}
|
362
366
|
export type PluginConfiguration = string | {
|
363
367
|
plugin: string;
|
@@ -137,9 +137,12 @@ async function processFilesAndCreateAndSerializeProjectGraph() {
|
|
137
137
|
logger_1.serverLogger.requestLog([...updatedFiles.values()]);
|
138
138
|
logger_1.serverLogger.requestLog([...deletedFiles]);
|
139
139
|
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
140
|
+
global.NX_GRAPH_CREATION = true;
|
140
141
|
const graphNodes = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(workspace_root_1.workspaceRoot, nxJson);
|
141
142
|
await processCollectedUpdatedAndDeletedFiles(graphNodes, updatedFileHashes, deletedFiles);
|
142
|
-
|
143
|
+
const g = createAndSerializeProjectGraph(graphNodes);
|
144
|
+
delete global.NX_GRAPH_CREATION;
|
145
|
+
return g;
|
143
146
|
}
|
144
147
|
catch (err) {
|
145
148
|
return Promise.resolve({
|
@@ -35,6 +35,7 @@ function addProjectConfiguration(tree, projectName, projectConfiguration, standa
|
|
35
35
|
throw new Error(`Cannot create a new project ${projectName} at ${projectConfiguration.root}. A project already exists in this directory.`);
|
36
36
|
}
|
37
37
|
delete projectConfiguration.$schema;
|
38
|
+
handleEmptyTargets(projectName, projectConfiguration);
|
38
39
|
(0, json_1.writeJson)(tree, projectConfigFile, {
|
39
40
|
name: projectName,
|
40
41
|
$schema: getRelativeProjectJsonSchemaPath(tree, projectConfiguration),
|
@@ -55,6 +56,7 @@ function updateProjectConfiguration(tree, projectName, projectConfiguration) {
|
|
55
56
|
if (!tree.exists(projectConfigFile)) {
|
56
57
|
throw new Error(`Cannot update Project ${projectName} at ${projectConfiguration.root}. It either doesn't exist yet, or may not use project.json for configuration. Use \`addProjectConfiguration()\` instead if you want to create a new project.`);
|
57
58
|
}
|
59
|
+
handleEmptyTargets(projectName, projectConfiguration);
|
58
60
|
(0, json_1.writeJson)(tree, projectConfigFile, {
|
59
61
|
name: projectConfiguration.name ?? projectName,
|
60
62
|
$schema: getRelativeProjectJsonSchemaPath(tree, projectConfiguration),
|
@@ -131,7 +133,7 @@ function readAndCombineAllProjectConfigurations(tree) {
|
|
131
133
|
const patterns = [
|
132
134
|
'**/project.json',
|
133
135
|
'project.json',
|
134
|
-
...(0, package_json_workspaces_1.getGlobPatternsFromPackageManagerWorkspaces)(tree.root, (p) => (0, json_1.readJson)(tree, p)),
|
136
|
+
...(0, package_json_workspaces_1.getGlobPatternsFromPackageManagerWorkspaces)(tree.root, (p) => (0, json_1.readJson)(tree, p, { expectComments: true })),
|
135
137
|
];
|
136
138
|
const projectGlobPatterns = (0, retrieve_workspace_files_1.configurationGlobs)([
|
137
139
|
project_json_1.ProjectJsonProjectsPlugin,
|
@@ -237,3 +239,15 @@ function toNewFormat(w) {
|
|
237
239
|
}
|
238
240
|
return w;
|
239
241
|
}
|
242
|
+
function handleEmptyTargets(projectName, projectConfiguration) {
|
243
|
+
if (projectConfiguration.targets &&
|
244
|
+
!Object.keys(projectConfiguration.targets).length) {
|
245
|
+
// Re-order `targets` to appear after the `// target` comment.
|
246
|
+
delete projectConfiguration.targets;
|
247
|
+
projectConfiguration['// targets'] = `to see all targets run: nx show project ${projectName} --web`;
|
248
|
+
projectConfiguration.targets = {};
|
249
|
+
}
|
250
|
+
else {
|
251
|
+
delete projectConfiguration['// targets'];
|
252
|
+
}
|
253
|
+
}
|
@@ -6,9 +6,11 @@ const json_1 = require("../../generators/utils/json");
|
|
6
6
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
7
|
const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-workspace-files");
|
8
8
|
const internal_api_1 = require("../../project-graph/plugins/internal-api");
|
9
|
+
const plugin_pool_1 = require("../../project-graph/plugins/plugin-pool");
|
9
10
|
async function default_1(tree) {
|
10
11
|
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
11
12
|
const projectFiles = await (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, await (0, internal_api_1.loadNxPlugins)(nxJson?.plugins));
|
13
|
+
await (0, plugin_pool_1.shutdownPluginWorkers)();
|
12
14
|
const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));
|
13
15
|
for (let f of projectJsons) {
|
14
16
|
const projectJson = (0, json_1.readJson)(tree, f);
|
@@ -1,29 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const
|
4
|
-
const ignore_1 = require("ignore");
|
3
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
5
4
|
function migrate(tree) {
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
if (ig.ignores('.env')) {
|
10
|
-
logger_1.logger.warn('NX The NX_ADD_PLUGINS=false environment variable was added to your .env file for backwards compatibility. However, your .env is ignored by git. Other contributors should add this key to their .env file or ensure that the environment variable is set to false when generating code with Nx.');
|
11
|
-
}
|
12
|
-
}
|
13
|
-
catch { }
|
14
|
-
if (!tree.exists('.env')) {
|
15
|
-
tree.write('.env', '');
|
16
|
-
}
|
17
|
-
const dotenv = tree.read('.env', 'utf-8');
|
18
|
-
const newDotenvContents = [
|
19
|
-
'# Nx 18 enables using plugins to infer targets by default',
|
20
|
-
'# This is disabled for existing workspaces to maintain compatibility',
|
21
|
-
'# For more info, see: https://nx.dev/concepts/inferred-tasks',
|
22
|
-
'NX_ADD_PLUGINS=false',
|
23
|
-
];
|
24
|
-
if (dotenv.length) {
|
25
|
-
newDotenvContents.unshift(dotenv, '');
|
26
|
-
}
|
27
|
-
tree.write('.env', newDotenvContents.join('\n'));
|
5
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
6
|
+
nxJson.useInferencePlugins = false;
|
7
|
+
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
28
8
|
}
|
29
9
|
exports.default = migrate;
|
@@ -67,6 +67,7 @@ function getTranspiler(compilerOptions) {
|
|
67
67
|
}
|
68
68
|
compilerOptions.lib = ['es2021'];
|
69
69
|
compilerOptions.module = ts.ModuleKind.CommonJS;
|
70
|
+
compilerOptions.moduleResolution = ts.ModuleResolutionKind.Node10;
|
70
71
|
compilerOptions.target = ts.ScriptTarget.ES2021;
|
71
72
|
compilerOptions.inlineSourceMap = true;
|
72
73
|
compilerOptions.skipLibCheck = true;
|
@@ -187,8 +187,6 @@ async function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
187
187
|
const createDependencyPlugins = plugins.filter((plugin) => (0, utils_1.isNxPluginV2)(plugin) && plugin.createDependencies);
|
188
188
|
await Promise.all(createDependencyPlugins.map(async (plugin) => {
|
189
189
|
perf_hooks_1.performance.mark(`${plugin.name}:createDependencies - start`);
|
190
|
-
// Set this globally to allow plugins to know if they are being called from the project graph creation
|
191
|
-
global.NX_GRAPH_CREATION = true;
|
192
190
|
try {
|
193
191
|
// TODO: we shouldn't have to pass null here
|
194
192
|
const dependencies = await plugin.createDependencies(null, {
|
@@ -206,7 +204,6 @@ async function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
206
204
|
}
|
207
205
|
throw new Error(message);
|
208
206
|
}
|
209
|
-
delete global.NX_GRAPH_CREATION;
|
210
207
|
perf_hooks_1.performance.mark(`${plugin.name}:createDependencies - end`);
|
211
208
|
perf_hooks_1.performance.measure(`${plugin.name}:createDependencies`, `${plugin.name}:createDependencies - start`, `${plugin.name}:createDependencies - end`);
|
212
209
|
}));
|
@@ -12,7 +12,7 @@ export type RemotePlugin = Omit<NormalizedPlugin, 'createNodes'> & {
|
|
12
12
|
fn: (matchedFiles: string[], context: CreateNodesContext) => Promise<CreateNodesResultWithContext[]>
|
13
13
|
];
|
14
14
|
};
|
15
|
-
export declare const nxPluginCache: Map<unknown, RemotePlugin
|
15
|
+
export declare const nxPluginCache: Map<unknown, Promise<RemotePlugin>>;
|
16
16
|
export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string): Promise<RemotePlugin[]>;
|
17
17
|
export declare function loadNxPlugin(plugin: PluginConfiguration, root?: string): Promise<RemotePlugin>;
|
18
18
|
export declare function getDefaultPlugins(root: string): Promise<string[]>;
|
@@ -27,11 +27,11 @@ exports.loadNxPlugins = loadNxPlugins;
|
|
27
27
|
async function loadNxPlugin(plugin, root = workspace_root_1.workspaceRoot) {
|
28
28
|
const cacheKey = JSON.stringify(plugin);
|
29
29
|
if (exports.nxPluginCache.has(cacheKey)) {
|
30
|
-
return exports.nxPluginCache.get(cacheKey);
|
30
|
+
return await exports.nxPluginCache.get(cacheKey);
|
31
31
|
}
|
32
|
-
const
|
33
|
-
exports.nxPluginCache.set(cacheKey,
|
34
|
-
return
|
32
|
+
const loadingPlugin = (0, plugin_pool_1.loadRemoteNxPlugin)(plugin, root);
|
33
|
+
exports.nxPluginCache.set(cacheKey, loadingPlugin);
|
34
|
+
return await loadingPlugin;
|
35
35
|
}
|
36
36
|
exports.loadNxPlugin = loadNxPlugin;
|
37
37
|
async function getDefaultPlugins(root) {
|
@@ -94,53 +94,35 @@ function createWorkerHandler(worker, onload, onloadError) {
|
|
94
94
|
? [
|
95
95
|
createNodesPattern,
|
96
96
|
(configFiles, ctx) => {
|
97
|
-
|
98
|
-
|
97
|
+
const tx = pluginName + ':createNodes:' + performance.now();
|
98
|
+
return registerPendingPromise(tx, pending, () => {
|
99
99
|
worker.send((0, messaging_1.createMessage)({
|
100
100
|
type: 'createNodes',
|
101
101
|
payload: { configFiles, context: ctx, tx },
|
102
102
|
}));
|
103
|
-
pending.add(tx);
|
104
|
-
promiseBank.set(tx, {
|
105
|
-
promise: this,
|
106
|
-
resolver: res,
|
107
|
-
rejecter: rej,
|
108
|
-
});
|
109
103
|
});
|
110
104
|
},
|
111
105
|
]
|
112
106
|
: undefined,
|
113
107
|
createDependencies: result.hasCreateDependencies
|
114
108
|
? (opts, ctx) => {
|
115
|
-
|
116
|
-
|
109
|
+
const tx = pluginName + ':createDependencies:' + performance.now();
|
110
|
+
return registerPendingPromise(tx, pending, () => {
|
117
111
|
worker.send((0, messaging_1.createMessage)({
|
118
112
|
type: 'createDependencies',
|
119
113
|
payload: { context: ctx, tx },
|
120
114
|
}));
|
121
|
-
pending.add(tx);
|
122
|
-
promiseBank.set(tx, {
|
123
|
-
promise: this,
|
124
|
-
resolver: res,
|
125
|
-
rejecter: rej,
|
126
|
-
});
|
127
115
|
});
|
128
116
|
}
|
129
117
|
: undefined,
|
130
118
|
processProjectGraph: result.hasProcessProjectGraph
|
131
119
|
? (graph, ctx) => {
|
132
|
-
|
133
|
-
|
120
|
+
const tx = pluginName + ':processProjectGraph:' + performance.now();
|
121
|
+
return registerPendingPromise(tx, pending, () => {
|
134
122
|
worker.send((0, messaging_1.createMessage)({
|
135
123
|
type: 'processProjectGraph',
|
136
124
|
payload: { graph, ctx, tx },
|
137
125
|
}));
|
138
|
-
pending.add(tx);
|
139
|
-
promiseBank.set(tx, {
|
140
|
-
promise: this,
|
141
|
-
resolver: res,
|
142
|
-
rejecter: rej,
|
143
|
-
});
|
144
126
|
});
|
145
127
|
}
|
146
128
|
: undefined,
|
@@ -212,3 +194,23 @@ function getPendingPromises(pool, pidMap) {
|
|
212
194
|
}
|
213
195
|
return pendingTxs;
|
214
196
|
}
|
197
|
+
function registerPendingPromise(tx, pending, callback) {
|
198
|
+
let resolver, rejecter;
|
199
|
+
const promise = new Promise((res, rej) => {
|
200
|
+
resolver = res;
|
201
|
+
rejecter = rej;
|
202
|
+
callback();
|
203
|
+
}).then((val) => {
|
204
|
+
// Remove the promise from the pending set
|
205
|
+
pending.delete(tx);
|
206
|
+
// Return the original value
|
207
|
+
return val;
|
208
|
+
});
|
209
|
+
pending.add(tx);
|
210
|
+
promiseBank.set(tx, {
|
211
|
+
promise,
|
212
|
+
resolver,
|
213
|
+
rejecter,
|
214
|
+
});
|
215
|
+
return promise;
|
216
|
+
}
|
@@ -65,6 +65,7 @@ function readProjectsConfigurationFromProjectGraph(projectGraph) {
|
|
65
65
|
}
|
66
66
|
exports.readProjectsConfigurationFromProjectGraph = readProjectsConfigurationFromProjectGraph;
|
67
67
|
async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
68
|
+
global.NX_GRAPH_CREATION = true;
|
68
69
|
const nxJson = (0, nx_json_1.readNxJson)();
|
69
70
|
perf_hooks_1.performance.mark('retrieve-project-configurations:start');
|
70
71
|
const { projects, externalNodes, sourceMaps, projectRootMap } = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(workspace_root_1.workspaceRoot, nxJson);
|
@@ -76,6 +77,7 @@ async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
|
76
77
|
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:start');
|
77
78
|
const projectGraph = (await (0, build_project_graph_1.buildProjectGraphUsingProjectFileMap)(projects, externalNodes, fileMap, allWorkspaceFiles, rustReferences, cacheEnabled ? (0, nx_deps_cache_1.readFileMapCache)() : null, cacheEnabled)).projectGraph;
|
78
79
|
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:end');
|
80
|
+
delete global.NX_GRAPH_CREATION;
|
79
81
|
return { projectGraph, sourceMaps };
|
80
82
|
}
|
81
83
|
exports.buildProjectGraphAndSourceMapsWithoutDaemon = buildProjectGraphAndSourceMapsWithoutDaemon;
|
@@ -141,8 +141,6 @@ plugins, root = workspace_root_1.workspaceRoot) {
|
|
141
141
|
}
|
142
142
|
const matchedFiles = [];
|
143
143
|
performance.mark(`${plugin.name}:createNodes - start`);
|
144
|
-
// Set this globally to allow plugins to know if they are being called from the project graph creation
|
145
|
-
global.NX_GRAPH_CREATION = true;
|
146
144
|
for (const file of projectFiles) {
|
147
145
|
if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
|
148
146
|
matchedFiles.push(file);
|
@@ -197,6 +195,10 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
197
195
|
// to provide better error messaging.
|
198
196
|
const errors = new Map();
|
199
197
|
for (const [root, configuration] of projectRootMap.entries()) {
|
198
|
+
// We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
|
199
|
+
// Strip it before returning configuration for usage.
|
200
|
+
if (configuration['// targets'])
|
201
|
+
delete configuration['// targets'];
|
200
202
|
if (!configuration.name) {
|
201
203
|
try {
|
202
204
|
const { name } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
@@ -9,6 +9,7 @@ const internal_api_1 = require("../plugins/internal-api");
|
|
9
9
|
const workspace_context_1 = require("../../utils/workspace-context");
|
10
10
|
const build_all_workspace_files_1 = require("./build-all-workspace-files");
|
11
11
|
const path_1 = require("path");
|
12
|
+
const plugin_pool_1 = require("../plugins/plugin-pool");
|
12
13
|
/**
|
13
14
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
14
15
|
* @throws
|
@@ -41,7 +42,11 @@ exports.retrieveWorkspaceFiles = retrieveWorkspaceFiles;
|
|
41
42
|
*/
|
42
43
|
async function retrieveProjectConfigurations(workspaceRoot, nxJson) {
|
43
44
|
const plugins = await (0, internal_api_1.loadNxPlugins)(nxJson?.plugins ?? [], workspaceRoot);
|
44
|
-
|
45
|
+
const projects = await _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins);
|
46
|
+
if (!global.NX_GRAPH_CREATION) {
|
47
|
+
await (0, plugin_pool_1.shutdownPluginWorkers)();
|
48
|
+
}
|
49
|
+
return projects;
|
45
50
|
}
|
46
51
|
exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
47
52
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|