nx 23.1.0-rc.1 → 23.1.0-rc.2

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.
Binary file
@@ -16,7 +16,10 @@ Object.defineProperty(exports, "validateProject", { enumerable: true, get: funct
16
16
  function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
17
17
  // This function is used when reading project configuration
18
18
  // in generators, where we don't want to do this.
19
- skipTargetNormalization, deferSpreadsWithoutBase) {
19
+ skipTargetNormalization,
20
+ // Preserve `'...'` spreads that have no base value (default) so a later
21
+ // merge layer can resolve them; pass `false` only for a final merge.
22
+ deferSpreadsWithoutBase = true) {
20
23
  project.root = project.root === '' ? '.' : project.root;
21
24
  if (configurationSourceMaps && !configurationSourceMaps[project.root]) {
22
25
  configurationSourceMaps[project.root] = {};
@@ -234,7 +237,9 @@ class ProjectNodesManager {
234
237
  */
235
238
  mergeProjectNode(project, configurationSourceMaps, sourceInformation) {
236
239
  const previousName = this.rootMap[project.root]?.name;
237
- mergeProjectConfigurationIntoRootMap(this.rootMap, project, configurationSourceMaps, sourceInformation);
240
+ // This is a final apply — dangling `'...'` spreads must resolve (expand
241
+ // against the empty base) so they never leak into the project graph.
242
+ mergeProjectConfigurationIntoRootMap(this.rootMap, project, configurationSourceMaps, sourceInformation, undefined, false);
238
243
  const merged = this.rootMap[project.root];
239
244
  const currentName = merged?.name;
240
245
  if (currentName) {
@@ -311,9 +311,9 @@ function mergeMatchingEntries(entries, ctx) {
311
311
  if (!entryFilterMatches(entry.filter, ctx))
312
312
  continue;
313
313
  const config = stripFilter(entry);
314
- // A lone matching entry is returned without merging so deferred `'...'`
315
- // spread tokens survive for the downstream merge; only a second match
316
- // triggers a merge, later entry winning.
314
+ // Later matches merge on top, earlier entry as base. Unresolvable `'...'`
315
+ // spreads are deferred by default so they survive for the downstream
316
+ // merge against the plugin-provided target.
317
317
  acc = acc === null ? config : (0, target_merging_1.mergeTargetConfigurations)(config, acc);
318
318
  }
319
319
  return acc;
@@ -14,6 +14,10 @@ export declare function mergeMetadata<T = ProjectMetadata | TargetMetadata>(sour
14
14
  * @param projectConfigSourceMap The source map to be filled with metadata about where each property came from
15
15
  * @param sourceInformation The metadata about where the new target was defined
16
16
  * @param targetIdentifier The identifier for the target to merge, used for source map
17
+ * @param deferSpreadsWithoutBase Whether a `'...'` spread with no base value is preserved
18
+ * for a later merge layer to resolve (default), or expanded against the empty base and
19
+ * dropped. Pass `false` only for a final merge whose result is consumed directly rather
20
+ * than merged onto a lower-priority base.
17
21
  * @returns A merged target configuration
18
22
  */
19
23
  export declare function mergeTargetConfigurations(target: TargetConfiguration, baseTarget?: TargetConfiguration, projectConfigSourceMap?: Record<string, SourceInformation>, sourceInformation?: SourceInformation, targetIdentifier?: string, deferSpreadsWithoutBase?: boolean): TargetConfiguration;
@@ -250,9 +250,13 @@ function mergeConfigurations(newConfigurations, baseConfigurations, projectConfi
250
250
  * @param projectConfigSourceMap The source map to be filled with metadata about where each property came from
251
251
  * @param sourceInformation The metadata about where the new target was defined
252
252
  * @param targetIdentifier The identifier for the target to merge, used for source map
253
+ * @param deferSpreadsWithoutBase Whether a `'...'` spread with no base value is preserved
254
+ * for a later merge layer to resolve (default), or expanded against the empty base and
255
+ * dropped. Pass `false` only for a final merge whose result is consumed directly rather
256
+ * than merged onto a lower-priority base.
253
257
  * @returns A merged target configuration
254
258
  */
255
- function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase) {
259
+ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, sourceInformation, targetIdentifier, deferSpreadsWithoutBase = true) {
256
260
  const { configurations: defaultConfigurations, options: defaultOptions, ...baseTargetProperties } = baseTarget ?? {};
257
261
  // Target is "compatible", e.g. executor is defined only once or is the same
258
262
  // in both places. This means that it is likely safe to merge
@@ -195,7 +195,7 @@ function mergeCreateNodesResults(specifiedResults, defaultResults, nxJsonConfigu
195
195
  const defaultConfigurationSourceMaps = {};
196
196
  const mergeToManager = (project, sourceInfo) => nodesManager.mergeProjectNode(project, configurationSourceMaps, sourceInfo);
197
197
  const mergeToIntermediate = (project, sourceInfo) => {
198
- (0, project_nodes_manager_1.mergeProjectConfigurationIntoRootMap)(intermediateDefaultRootMap, project, defaultConfigurationSourceMaps, sourceInfo, false, true);
198
+ (0, project_nodes_manager_1.mergeProjectConfigurationIntoRootMap)(intermediateDefaultRootMap, project, defaultConfigurationSourceMaps, sourceInfo);
199
199
  };
200
200
  for (const pluginResults of specifiedResults) {
201
201
  mergeCreateNodesResultsFromSinglePlugin(pluginResults, mergeToManager, nodesManager, nodesManager.getRootMap(), externalNodes, errors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "23.1.0-rc.1",
3
+ "version": "23.1.0-rc.2",
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.",
@@ -176,16 +176,16 @@
176
176
  }
177
177
  },
178
178
  "optionalDependencies": {
179
- "@nx/nx-darwin-arm64": "23.1.0-rc.1",
180
- "@nx/nx-darwin-x64": "23.1.0-rc.1",
181
- "@nx/nx-freebsd-x64": "23.1.0-rc.1",
182
- "@nx/nx-linux-arm-gnueabihf": "23.1.0-rc.1",
183
- "@nx/nx-linux-arm64-gnu": "23.1.0-rc.1",
184
- "@nx/nx-linux-arm64-musl": "23.1.0-rc.1",
185
- "@nx/nx-linux-x64-gnu": "23.1.0-rc.1",
186
- "@nx/nx-linux-x64-musl": "23.1.0-rc.1",
187
- "@nx/nx-win32-arm64-msvc": "23.1.0-rc.1",
188
- "@nx/nx-win32-x64-msvc": "23.1.0-rc.1"
179
+ "@nx/nx-darwin-arm64": "23.1.0-rc.2",
180
+ "@nx/nx-darwin-x64": "23.1.0-rc.2",
181
+ "@nx/nx-freebsd-x64": "23.1.0-rc.2",
182
+ "@nx/nx-linux-arm-gnueabihf": "23.1.0-rc.2",
183
+ "@nx/nx-linux-arm64-gnu": "23.1.0-rc.2",
184
+ "@nx/nx-linux-arm64-musl": "23.1.0-rc.2",
185
+ "@nx/nx-linux-x64-gnu": "23.1.0-rc.2",
186
+ "@nx/nx-linux-x64-musl": "23.1.0-rc.2",
187
+ "@nx/nx-win32-arm64-msvc": "23.1.0-rc.2",
188
+ "@nx/nx-win32-x64-msvc": "23.1.0-rc.2"
189
189
  },
190
190
  "nx-migrations": {
191
191
  "migrations": "./migrations.json",