nx 22.7.0 → 23.0.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.
Files changed (33) hide show
  1. package/dist/src/config/workspace-json-project-json.d.ts +10 -0
  2. package/dist/src/daemon/server/handle-hash-tasks.js +1 -1
  3. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -4
  4. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +11 -20
  5. package/dist/src/executors/utils/convert-nx-executor.js +2 -2
  6. package/dist/src/hasher/create-task-hasher.js +1 -1
  7. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  8. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  9. package/dist/src/project-graph/build-project-graph.d.ts +2 -4
  10. package/dist/src/project-graph/build-project-graph.js +2 -7
  11. package/dist/src/project-graph/file-map-utils.d.ts +2 -4
  12. package/dist/src/project-graph/file-map-utils.js +0 -3
  13. package/dist/src/project-graph/plugins/get-plugins.d.ts +15 -0
  14. package/dist/src/project-graph/plugins/get-plugins.js +21 -3
  15. package/dist/src/project-graph/project-graph.js +7 -6
  16. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +40 -64
  17. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +182 -411
  18. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +10 -4
  19. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +22 -8
  20. package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +4 -61
  21. package/dist/src/project-graph/utils/project-configuration/source-maps.js +14 -59
  22. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +16 -0
  23. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +117 -0
  24. package/dist/src/project-graph/utils/project-configuration/target-merging.d.ts +1 -4
  25. package/dist/src/project-graph/utils/project-configuration/target-merging.js +261 -136
  26. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +0 -7
  27. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +23 -0
  28. package/dist/src/project-graph/utils/project-configuration/utils.js +164 -0
  29. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +33 -9
  30. package/dist/src/project-graph/utils/project-configuration-utils.js +153 -65
  31. package/dist/src/project-graph/utils/retrieve-workspace-files.d.ts +6 -3
  32. package/dist/src/project-graph/utils/retrieve-workspace-files.js +32 -13
  33. package/package.json +11 -11
@@ -4,8 +4,9 @@ import { ProjectConfiguration } from '../../config/workspace-json-project-json';
4
4
  import { AggregateCreateNodesError, MergeNodesError, MultipleProjectsWithSameNameError, ProjectsWithNoNameError, WorkspaceValidityError } from '../error-types';
5
5
  import type { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
6
6
  import { CreateNodesResult } from '../plugins/public-api';
7
- import type { ConfigurationSourceMaps, SourceInformation } from './project-configuration/source-maps';
8
- export { mergeTargetConfigurations, readTargetDefaultsForTarget, } from './project-configuration/target-merging';
7
+ import type { ConfigurationSourceMaps } from './project-configuration/source-maps';
8
+ export { mergeTargetConfigurations } from './project-configuration/target-merging';
9
+ export { readTargetDefaultsForTarget } from './project-configuration/target-defaults';
9
10
  export type ConfigurationResult = {
10
11
  /**
11
12
  * A map of project configurations, keyed by project root.
@@ -30,22 +31,45 @@ export type ConfigurationResult = {
30
31
  /**
31
32
  * Transforms a list of project paths into a map of project configurations.
32
33
  *
34
+ * Plugins are run in parallel, then results are merged in a single ordered pass:
35
+ * specified plugins → synthetic target defaults → default plugins
36
+ *
37
+ * This ordering ensures '...' spread tokens in default plugin configs
38
+ * (project.json, package.json) expand against accumulated values from
39
+ * specified plugins and target defaults.
40
+ *
33
41
  * @param root The workspace root
34
42
  * @param nxJson The NxJson configuration
35
- * @param workspaceFiles A list of non-ignored workspace files
36
- * @param plugins The plugins that should be used to infer project configuration
43
+ * @param projectFiles Plugin config files, separated by plugin set
44
+ * @param plugins The plugins separated into specified and default sets
37
45
  */
38
- export declare function createProjectConfigurationsWithPlugins(root: string, nxJson: NxJsonConfiguration, projectFiles: string[][], // making this parameter allows devkit to pick up newly created projects
39
- plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
40
- export declare function mergeCreateNodesResults(results: (readonly [
46
+ export declare function createProjectConfigurationsWithPlugins(root: string, nxJson: NxJsonConfiguration, projectFiles: {
47
+ specifiedPluginFiles: string[][];
48
+ defaultPluginFiles: string[][];
49
+ }, plugins: {
50
+ specifiedPlugins: LoadedNxPlugin[];
51
+ defaultPlugins: LoadedNxPlugin[];
52
+ }): Promise<ConfigurationResult>;
53
+ export type CreateNodesResultEntry = readonly [
41
54
  plugin: string,
42
55
  file: string,
43
56
  result: CreateNodesResult,
44
57
  pluginIndex?: number
45
- ])[][], nxJsonConfiguration: NxJsonConfiguration, workspaceRoot: string, errors: (AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | WorkspaceValidityError)[]): {
58
+ ];
59
+ export type MergeError = AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | WorkspaceValidityError;
60
+ /**
61
+ * Merges create nodes results into a single rootMap.
62
+ *
63
+ * Default plugin results are merged twice: first into an intermediate
64
+ * rootMap with unresolved spread sentinels preserved, so target
65
+ * defaults selection sees the real merged shape of defaults; then
66
+ * applied as a single layer onto the main rootMap where the preserved
67
+ * spreads resolve against the specified + target-defaults base.
68
+ */
69
+ export declare function mergeCreateNodesResults(specifiedResults: CreateNodesResultEntry[][], defaultResults: CreateNodesResultEntry[][], nxJsonConfiguration: NxJsonConfiguration, workspaceRoot: string, errors: MergeError[]): {
46
70
  projectRootMap: Record<string, ProjectConfiguration>;
47
71
  externalNodes: Record<string, ProjectGraphExternalNode>;
48
72
  rootMap: Record<string, string>;
49
- configurationSourceMaps: Record<string, Record<string, SourceInformation>>;
73
+ configurationSourceMaps: ConfigurationSourceMaps;
50
74
  };
51
75
  export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
@@ -13,35 +13,53 @@ const delayed_spinner_1 = require("../../utils/delayed-spinner");
13
13
  const plugin_progress_text_1 = require("../../utils/plugin-progress-text");
14
14
  const progress_topics_1 = require("../../utils/progress-topics");
15
15
  const error_types_1 = require("../error-types");
16
+ const target_defaults_1 = require("./project-configuration/target-defaults");
16
17
  var target_merging_1 = require("./project-configuration/target-merging");
17
18
  Object.defineProperty(exports, "mergeTargetConfigurations", { enumerable: true, get: function () { return target_merging_1.mergeTargetConfigurations; } });
18
- Object.defineProperty(exports, "readTargetDefaultsForTarget", { enumerable: true, get: function () { return target_merging_1.readTargetDefaultsForTarget; } });
19
+ var target_defaults_2 = require("./project-configuration/target-defaults");
20
+ Object.defineProperty(exports, "readTargetDefaultsForTarget", { enumerable: true, get: function () { return target_defaults_2.readTargetDefaultsForTarget; } });
19
21
  /**
20
22
  * Transforms a list of project paths into a map of project configurations.
21
23
  *
24
+ * Plugins are run in parallel, then results are merged in a single ordered pass:
25
+ * specified plugins → synthetic target defaults → default plugins
26
+ *
27
+ * This ordering ensures '...' spread tokens in default plugin configs
28
+ * (project.json, package.json) expand against accumulated values from
29
+ * specified plugins and target defaults.
30
+ *
22
31
  * @param root The workspace root
23
32
  * @param nxJson The NxJson configuration
24
- * @param workspaceFiles A list of non-ignored workspace files
25
- * @param plugins The plugins that should be used to infer project configuration
33
+ * @param projectFiles Plugin config files, separated by plugin set
34
+ * @param plugins The plugins separated into specified and default sets
26
35
  */
27
- async function createProjectConfigurationsWithPlugins(root = workspace_root_1.workspaceRoot, nxJson, projectFiles, // making this parameter allows devkit to pick up newly created projects
28
- plugins) {
36
+ async function createProjectConfigurationsWithPlugins(root = workspace_root_1.workspaceRoot, nxJson, projectFiles, plugins) {
29
37
  perf_hooks_1.performance.mark('build-project-configs:start');
30
38
  let spinner;
31
39
  const inProgressPlugins = new Set();
32
40
  const getSpinnerText = () => spinner
33
41
  ? (0, plugin_progress_text_1.formatPluginProgressText)('Creating project graph nodes', inProgressPlugins)
34
42
  : '';
35
- const createNodesPlugins = plugins.filter((plugin) => plugin.createNodes?.[0]);
43
+ const specifiedCreateNodesPlugins = plugins.specifiedPlugins.filter((plugin) => plugin.createNodes?.[0]);
44
+ const defaultCreateNodesPlugins = plugins.defaultPlugins.filter((plugin) => plugin.createNodes?.[0]);
45
+ const allCreateNodesPlugins = [
46
+ ...specifiedCreateNodesPlugins,
47
+ ...defaultCreateNodesPlugins,
48
+ ];
49
+ const allProjectFiles = [
50
+ ...projectFiles.specifiedPluginFiles,
51
+ ...projectFiles.defaultPluginFiles,
52
+ ];
53
+ const specifiedCount = specifiedCreateNodesPlugins.length;
36
54
  spinner = new delayed_spinner_1.DelayedSpinner(getSpinnerText(), {
37
55
  progressTopic: progress_topics_1.ProgressTopics.GraphConstruction,
38
56
  });
39
57
  const results = [];
40
58
  const errors = [];
41
59
  // We iterate over plugins first - this ensures that plugins specified first take precedence.
42
- for (const [index, { index: pluginIndex, createNodes: createNodesTuple, include, exclude, name: pluginName, },] of createNodesPlugins.entries()) {
60
+ for (const [index, { index: pluginIndex, createNodes: createNodesTuple, include, exclude, name: pluginName, },] of allCreateNodesPlugins.entries()) {
43
61
  const [pattern, createNodes] = createNodesTuple;
44
- const matchingConfigFiles = findMatchingConfigFiles(projectFiles[index], pattern, include, exclude);
62
+ const matchingConfigFiles = findMatchingConfigFiles(allProjectFiles[index], pattern, include, exclude);
45
63
  inProgressPlugins.add(pluginName);
46
64
  let r = createNodes(matchingConfigFiles, {
47
65
  nxJsonConfiguration: nxJson,
@@ -70,16 +88,23 @@ plugins) {
70
88
  }
71
89
  return Promise.all(results).then((results) => {
72
90
  spinner?.cleanup();
73
- const { projectRootMap, externalNodes, rootMap, configurationSourceMaps } = mergeCreateNodesResults(results, nxJson, root, errors);
91
+ // Split results into specified and default plugin sets
92
+ const specifiedResults = results.slice(0, specifiedCount);
93
+ const defaultResults = results.slice(specifiedCount);
94
+ const { projectRootMap, externalNodes, rootMap, configurationSourceMaps } = mergeCreateNodesResults(specifiedResults, defaultResults, nxJson, root, errors);
74
95
  perf_hooks_1.performance.mark('build-project-configs:end');
75
96
  perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
97
+ const allProjectFilesFlat = [
98
+ ...projectFiles.specifiedPluginFiles.flat(),
99
+ ...projectFiles.defaultPluginFiles.flat(),
100
+ ];
76
101
  if (errors.length === 0) {
77
102
  return {
78
103
  projects: projectRootMap,
79
104
  externalNodes,
80
105
  projectRootMap: rootMap,
81
106
  sourceMaps: configurationSourceMaps,
82
- matchingProjectFiles: projectFiles.flat(),
107
+ matchingProjectFiles: allProjectFilesFlat,
83
108
  };
84
109
  }
85
110
  else {
@@ -88,70 +113,133 @@ plugins) {
88
113
  externalNodes,
89
114
  projectRootMap: rootMap,
90
115
  sourceMaps: configurationSourceMaps,
91
- matchingProjectFiles: projectFiles.flat(),
116
+ matchingProjectFiles: allProjectFilesFlat,
92
117
  });
93
118
  }
94
119
  });
95
120
  }
96
- function mergeCreateNodesResults(results, nxJsonConfiguration, workspaceRoot, errors) {
121
+ /**
122
+ * Runs a single plugin batch through two passes:
123
+ *
124
+ * 1. Every project node in every plugin result is handed to `mergeFn`,
125
+ * which decides where it lands (the manager's rootMap, an
126
+ * intermediate rootMap, etc.). Any failure is collected into
127
+ * `errors`; processing keeps going. External nodes are accumulated
128
+ * onto the shared `externalNodes` record.
129
+ * 2. After every project in the batch has been merged, name-reference
130
+ * sentinels for the batch are registered against `nameRefRootMap` —
131
+ * the rootMap the batch was merged into — so sentinels point at the
132
+ * target objects that actually received the merges.
133
+ *
134
+ * The two passes can't be collapsed: a sentinel registered too early
135
+ * would point at the pre-merge object, and a later project in the same
136
+ * batch may still rename a project the sentinel refers to. Splitting
137
+ * the registration into a second pass also lets forward references
138
+ * inside the same batch resolve eagerly.
139
+ */
140
+ function mergeCreateNodesResultsFromSinglePlugin(pluginResults, mergeFn, nodesManager, nameRefRootMap, externalNodes, errors) {
141
+ for (const result of pluginResults) {
142
+ const [pluginName, file, nodes, pluginIndex] = result;
143
+ const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;
144
+ const sourceInfo = [file, pluginName];
145
+ for (const root in projectNodes) {
146
+ if (!projectNodes[root])
147
+ continue;
148
+ const project = { root, ...projectNodes[root] };
149
+ try {
150
+ mergeFn(project, sourceInfo);
151
+ }
152
+ catch (error) {
153
+ errors.push(new error_types_1.MergeNodesError({ file, pluginName, error, pluginIndex }));
154
+ }
155
+ }
156
+ Object.assign(externalNodes, pluginExternalNodes);
157
+ }
158
+ for (const result of pluginResults) {
159
+ const [pluginName, file, nodes, pluginIndex] = result;
160
+ const { projects: projectNodes } = nodes;
161
+ try {
162
+ nodesManager.registerNameRefs(projectNodes, nameRefRootMap);
163
+ }
164
+ catch (error) {
165
+ errors.push(new error_types_1.MergeNodesError({ file, pluginName, error, pluginIndex }));
166
+ }
167
+ }
168
+ }
169
+ /**
170
+ * Merges create nodes results into a single rootMap.
171
+ *
172
+ * Default plugin results are merged twice: first into an intermediate
173
+ * rootMap with unresolved spread sentinels preserved, so target
174
+ * defaults selection sees the real merged shape of defaults; then
175
+ * applied as a single layer onto the main rootMap where the preserved
176
+ * spreads resolve against the specified + target-defaults base.
177
+ */
178
+ function mergeCreateNodesResults(specifiedResults, defaultResults, nxJsonConfiguration, workspaceRoot, errors) {
97
179
  perf_hooks_1.performance.mark('createNodes:merge - start');
98
180
  const nodesManager = new project_nodes_manager_1.ProjectNodesManager();
99
181
  const externalNodes = {};
100
182
  const configurationSourceMaps = {};
101
- // Process each plugin's results in two phases:
102
- // Phase 1: Merge all projects from this plugin into rootMap/nameMap
103
- // Phase 2: Register substitutors for this plugin's results
104
- //
105
- // Per-plugin batching ensures that:
106
- // - All same-plugin projects are in the nameMap before substitutor
107
- // registration (fixes cross-file references like kafka-stream)
108
- // - Later-plugin renames haven't occurred yet, so dependsOn strings
109
- // that reference old names can still be resolved via the nameMap
110
- for (const pluginResults of results) {
111
- // Phase 1: Merge all projects from this plugin batch
112
- for (const result of pluginResults) {
113
- const [pluginName, file, nodes, pluginIndex] = result;
114
- const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;
115
- const sourceInfo = [file, pluginName];
116
- for (const root in projectNodes) {
117
- // Handles `{projects: {'libs/foo': undefined}}`.
118
- if (!projectNodes[root]) {
119
- continue;
120
- }
121
- const project = {
122
- root: root,
123
- ...projectNodes[root],
124
- };
125
- try {
126
- nodesManager.mergeProjectNode(project, configurationSourceMaps, sourceInfo);
127
- }
128
- catch (error) {
129
- errors.push(new error_types_1.MergeNodesError({
130
- file,
131
- pluginName,
132
- error,
133
- pluginIndex,
134
- }));
135
- }
136
- }
137
- Object.assign(externalNodes, pluginExternalNodes);
183
+ const intermediateDefaultRootMap = {};
184
+ // Kept separate so the intermediate merge doesn't clobber
185
+ // specified/TD attribution on fields the defaults don't touch.
186
+ const defaultConfigurationSourceMaps = {};
187
+ const mergeToManager = (project, sourceInfo) => nodesManager.mergeProjectNode(project, configurationSourceMaps, sourceInfo);
188
+ const mergeToIntermediate = (project, sourceInfo) => {
189
+ (0, project_nodes_manager_1.mergeProjectConfigurationIntoRootMap)(intermediateDefaultRootMap, project, defaultConfigurationSourceMaps, sourceInfo, false, true);
190
+ };
191
+ for (const pluginResults of specifiedResults) {
192
+ mergeCreateNodesResultsFromSinglePlugin(pluginResults, mergeToManager, nodesManager, nodesManager.getRootMap(), externalNodes, errors);
193
+ }
194
+ for (const pluginResults of defaultResults) {
195
+ mergeCreateNodesResultsFromSinglePlugin(pluginResults, mergeToIntermediate, nodesManager, intermediateDefaultRootMap, externalNodes, errors);
196
+ }
197
+ const targetDefaultsResults = (0, target_defaults_1.createTargetDefaultsResults)(nodesManager.getRootMap(), intermediateDefaultRootMap, nxJsonConfiguration);
198
+ if (targetDefaultsResults.length > 0) {
199
+ mergeCreateNodesResultsFromSinglePlugin(targetDefaultsResults, mergeToManager, nodesManager, nodesManager.getRootMap(), externalNodes, errors);
200
+ }
201
+ // Apply the intermediate default rootMap as a single layer. Preserved
202
+ // spread sentinels resolve here against the real specified + TD base.
203
+ // Source maps are intentionally not written — TD attribution for
204
+ // fields that yield to the base (e.g. keys before `...`) stays intact.
205
+ for (const root in intermediateDefaultRootMap) {
206
+ const project = intermediateDefaultRootMap[root];
207
+ try {
208
+ nodesManager.mergeProjectNode(project, undefined, undefined);
138
209
  }
139
- // Phase 2: Register substitutors for this plugin batch. The nameMap
140
- // now contains all projects from this plugin (and all prior plugins)
141
- // so splitTargetFromConfigurations can resolve colon-delimited strings.
142
- for (const result of pluginResults) {
143
- const [pluginName, file, nodes, pluginIndex] = result;
144
- const { projects: projectNodes } = nodes;
145
- try {
146
- nodesManager.registerSubstitutors(projectNodes);
147
- }
148
- catch (error) {
149
- errors.push(new error_types_1.MergeNodesError({
150
- file,
151
- pluginName,
152
- error,
153
- pluginIndex,
154
- }));
210
+ catch (error) {
211
+ errors.push(new error_types_1.MergeNodesError({
212
+ file: 'nx.json',
213
+ pluginName: 'nx/default-plugins',
214
+ error,
215
+ pluginIndex: undefined,
216
+ }));
217
+ }
218
+ }
219
+ // The intermediate apply may have rebuilt dependsOn / inputs arrays
220
+ // via spread merges, leaving sentinels inserted against the
221
+ // intermediate rootMap pointing at now-orphaned arrays. Re-walking
222
+ // the final merged targets rebinds each encountered sentinel's
223
+ // `parent` to the current array (see
224
+ // ProjectNameInNodePropsManager#processInputs / processDependsOn).
225
+ nodesManager.registerNameRefs(intermediateDefaultRootMap);
226
+ // Overlay default-plugin attribution onto the main source maps using
227
+ // "only fill missing" semantics. Any key already present in
228
+ // configurationSourceMaps was written by a specified plugin or by
229
+ // target defaults, and that attribution is strictly more correct:
230
+ // - For fields the default plugin never shadowed, the existing entry
231
+ // already matches what the default plugin would overlay.
232
+ // - For fields where a default plugin placed `...` after other keys,
233
+ // those keys yielded to the base during the single-layer apply
234
+ // above. The stale default-plugin entry in
235
+ // `defaultConfigurationSourceMaps` must NOT clobber the base
236
+ // attribution that the specified plugin / TD already recorded.
237
+ for (const root in defaultConfigurationSourceMaps) {
238
+ const existing = (configurationSourceMaps[root] ??= {});
239
+ const incoming = defaultConfigurationSourceMaps[root];
240
+ for (const key in incoming) {
241
+ if (existing[key] === undefined) {
242
+ existing[key] = incoming[key];
155
243
  }
156
244
  }
157
245
  }
@@ -2,14 +2,14 @@ import { ProjectConfiguration } from '../../config/workspace-json-project-json';
2
2
  import { NxJsonConfiguration } from '../../config/nx-json';
3
3
  import { ConfigurationResult } from './project-configuration-utils';
4
4
  import type { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
5
+ import { SeparatedPlugins } from '../plugins/get-plugins';
5
6
  /**
6
- * Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
7
+ * Walks the workspace directory to create the `projectFileMap` and `ProjectConfigurations`
7
8
  * @throws
8
9
  * @param workspaceRoot
9
10
  * @param nxJson
10
11
  */
11
12
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("../file-utils").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: Record<string, import("../../native").FileData[]>;
15
15
  nonProjectFiles: import("../../native").FileData[];
@@ -18,8 +18,11 @@ export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRoo
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
21
+ *
22
+ * Accepts separated plugin sets so that target defaults can be applied
23
+ * between specified and default plugin processing phases.
21
24
  */
22
- export declare function retrieveProjectConfigurations(plugins: LoadedNxPlugin[], workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
25
+ export declare function retrieveProjectConfigurations(separatedPlugins: SeparatedPlugins, workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
23
26
  export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
24
27
  export declare function retrieveProjectConfigurationPaths(root: string, plugins: Array<LoadedNxPlugin>): Promise<string[]>;
25
28
  export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
@@ -11,11 +11,10 @@ const angular_json_1 = require("../../adapter/angular-json");
11
11
  const nx_json_1 = require("../../config/nx-json");
12
12
  const project_configuration_utils_1 = require("./project-configuration-utils");
13
13
  const workspace_context_1 = require("../../utils/workspace-context");
14
- const build_all_workspace_files_1 = require("./build-all-workspace-files");
15
14
  const path_1 = require("path");
16
15
  const get_plugins_1 = require("../plugins/get-plugins");
17
16
  /**
18
- * Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
17
+ * Walks the workspace directory to create the `projectFileMap` and `ProjectConfigurations`
19
18
  * @throws
20
19
  * @param workspaceRoot
21
20
  * @param nxJson
@@ -29,7 +28,6 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
29
28
  perf_hooks_1.performance.mark('get-workspace-files:end');
30
29
  perf_hooks_1.performance.measure('get-workspace-files', 'get-workspace-files:start', 'get-workspace-files:end');
31
30
  return {
32
- allWorkspaceFiles: (0, build_all_workspace_files_1.buildAllWorkspaceFiles)(projectFileMap, globalFiles),
33
31
  fileMap: {
34
32
  projectFileMap,
35
33
  nonProjectFiles: globalFiles,
@@ -39,12 +37,26 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
39
37
  }
40
38
  /**
41
39
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
40
+ *
41
+ * Accepts separated plugin sets so that target defaults can be applied
42
+ * between specified and default plugin processing phases.
42
43
  */
43
- async function retrieveProjectConfigurations(plugins, workspaceRoot, nxJson) {
44
- const pluginsWithCreateNodes = plugins.filter((p) => !!p.createNodes);
45
- const globPatterns = getGlobPatternsOfPlugins(pluginsWithCreateNodes);
46
- const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, globPatterns);
47
- return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, pluginConfigFiles, pluginsWithCreateNodes);
44
+ async function retrieveProjectConfigurations(separatedPlugins, workspaceRoot, nxJson) {
45
+ const specifiedWithCreateNodes = separatedPlugins.specifiedPlugins.filter((p) => !!p.createNodes);
46
+ const defaultWithCreateNodes = separatedPlugins.defaultPlugins.filter((p) => !!p.createNodes);
47
+ const specifiedGlobPatterns = getGlobPatternsOfPlugins(specifiedWithCreateNodes);
48
+ const defaultGlobPatterns = getGlobPatternsOfPlugins(defaultWithCreateNodes);
49
+ const [specifiedPluginFiles, defaultPluginFiles] = await Promise.all([
50
+ (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, specifiedGlobPatterns),
51
+ (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, defaultGlobPatterns),
52
+ ]);
53
+ return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, {
54
+ specifiedPluginFiles: specifiedPluginFiles ?? [],
55
+ defaultPluginFiles: defaultPluginFiles ?? [],
56
+ }, {
57
+ specifiedPlugins: specifiedWithCreateNodes,
58
+ defaultPlugins: defaultWithCreateNodes,
59
+ });
48
60
  }
49
61
  async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
50
62
  const pluginsToLoad = nxJson?.plugins ?? [];
@@ -53,8 +65,8 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
53
65
  (typeof p === 'object' && p.plugin === angular_json_1.NX_ANGULAR_JSON_PLUGIN_NAME))) {
54
66
  pluginsToLoad.push((0, path_1.join)(__dirname, '../../adapter/angular-json'));
55
67
  }
56
- const plugins = await (0, get_plugins_1.getPlugins)(workspaceRoot);
57
- const res = await retrieveProjectConfigurations(plugins, workspaceRoot, nxJson);
68
+ const separatedPlugins = await (0, get_plugins_1.getPluginsSeparated)(workspaceRoot);
69
+ const res = await retrieveProjectConfigurations(separatedPlugins, workspaceRoot, nxJson);
58
70
  return res;
59
71
  }
60
72
  async function retrieveProjectConfigurationPaths(root, plugins) {
@@ -66,14 +78,21 @@ const projectsWithoutPluginCache = new Map();
66
78
  // TODO: This function is called way too often, it should be optimized without this cache
67
79
  async function retrieveProjectConfigurationsWithoutPluginInference(root) {
68
80
  const nxJson = (0, nx_json_1.readNxJson)(root);
69
- const plugins = await (0, get_plugins_1.getOnlyDefaultPlugins)(); // only load default plugins
70
- const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
81
+ const defaultPlugins = await (0, get_plugins_1.getOnlyDefaultPlugins)(); // only load default plugins
82
+ const pluginsWithCreateNodes = defaultPlugins.filter((p) => !!p.createNodes);
83
+ const projectGlobPatterns = getGlobPatternsOfPlugins(pluginsWithCreateNodes);
71
84
  const cacheKey = root + ',' + projectGlobPatterns.join(',');
72
85
  if (projectsWithoutPluginCache.has(cacheKey)) {
73
86
  return projectsWithoutPluginCache.get(cacheKey);
74
87
  }
75
88
  const projectFiles = (await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns)) ?? [];
76
- const { projects } = await (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(root, nxJson, projectFiles, plugins);
89
+ const { projects } = await (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(root, nxJson, {
90
+ specifiedPluginFiles: [],
91
+ defaultPluginFiles: projectFiles,
92
+ }, {
93
+ specifiedPlugins: [],
94
+ defaultPlugins: pluginsWithCreateNodes,
95
+ });
77
96
  projectsWithoutPluginCache.set(cacheKey, projects);
78
97
  return projects;
79
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "22.7.0",
3
+ "version": "23.0.0-beta.0",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
@@ -171,16 +171,16 @@
171
171
  }
172
172
  },
173
173
  "optionalDependencies": {
174
- "@nx/nx-darwin-arm64": "22.7.0",
175
- "@nx/nx-darwin-x64": "22.7.0",
176
- "@nx/nx-freebsd-x64": "22.7.0",
177
- "@nx/nx-linux-arm-gnueabihf": "22.7.0",
178
- "@nx/nx-linux-arm64-gnu": "22.7.0",
179
- "@nx/nx-linux-arm64-musl": "22.7.0",
180
- "@nx/nx-linux-x64-gnu": "22.7.0",
181
- "@nx/nx-linux-x64-musl": "22.7.0",
182
- "@nx/nx-win32-arm64-msvc": "22.7.0",
183
- "@nx/nx-win32-x64-msvc": "22.7.0"
174
+ "@nx/nx-darwin-arm64": "23.0.0-beta.0",
175
+ "@nx/nx-darwin-x64": "23.0.0-beta.0",
176
+ "@nx/nx-freebsd-x64": "23.0.0-beta.0",
177
+ "@nx/nx-linux-arm-gnueabihf": "23.0.0-beta.0",
178
+ "@nx/nx-linux-arm64-gnu": "23.0.0-beta.0",
179
+ "@nx/nx-linux-arm64-musl": "23.0.0-beta.0",
180
+ "@nx/nx-linux-x64-gnu": "23.0.0-beta.0",
181
+ "@nx/nx-linux-x64-musl": "23.0.0-beta.0",
182
+ "@nx/nx-win32-arm64-msvc": "23.0.0-beta.0",
183
+ "@nx/nx-win32-x64-msvc": "23.0.0-beta.0"
184
184
  },
185
185
  "nx-migrations": {
186
186
  "migrations": "./migrations.json",