nx 20.4.0-canary.20250117-cba25da → 20.4.0-canary.20250118-ee135b2

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
@@ -57,6 +57,7 @@ export declare function isProjectConfigurationsError(e: unknown): e is ProjectCo
57
57
  export declare class AggregateCreateNodesError extends Error {
58
58
  readonly errors: Array<[file: string | null, error: Error]>;
59
59
  readonly partialResults: Awaited<ReturnType<CreateNodesFunctionV2>>;
60
+ pluginIndex: number | undefined;
60
61
  /**
61
62
  * Throwing this error from a `createNodesV2` function will allow Nx to continue processing and recieve partial results from your plugin.
62
63
  * @example
@@ -88,10 +89,12 @@ export declare function formatAggregateCreateNodesError(error: AggregateCreateNo
88
89
  export declare class MergeNodesError extends Error {
89
90
  file: string;
90
91
  pluginName: string;
91
- constructor({ file, pluginName, error, }: {
92
+ pluginIndex: number;
93
+ constructor({ file, pluginName, error, pluginIndex, }: {
92
94
  file: string;
93
95
  pluginName: string;
94
96
  error: Error;
97
+ pluginIndex?: number;
95
98
  });
96
99
  }
97
100
  export declare class CreateMetadataError extends Error {
@@ -232,12 +232,15 @@ function formatAggregateCreateNodesError(error, pluginName) {
232
232
  error.message = errorBodyLines.join('\n');
233
233
  }
234
234
  class MergeNodesError extends Error {
235
- constructor({ file, pluginName, error, }) {
236
- const msg = `The nodes created from ${file} by the "${pluginName}" could not be merged into the project graph:`;
235
+ constructor({ file, pluginName, error, pluginIndex, }) {
236
+ const msg = `The nodes created from ${file} by the "${pluginName}" ${pluginIndex === undefined
237
+ ? ''
238
+ : `at index ${pluginIndex} in nx.json#plugins `}could not be merged into the project graph.`;
237
239
  super(msg, { cause: error });
238
240
  this.name = this.constructor.name;
239
241
  this.file = file;
240
242
  this.pluginName = pluginName;
243
+ this.pluginIndex = pluginIndex;
241
244
  this.stack = `${this.message}\n${indentString(formatErrorStackAndCause(error), 2)}`;
242
245
  }
243
246
  }
@@ -248,7 +248,7 @@ plugins) {
248
248
  const results = [];
249
249
  const errors = [];
250
250
  // We iterate over plugins first - this ensures that plugins specified first take precedence.
251
- for (const { createNodes: createNodesTuple, include, exclude, name: pluginName, } of plugins) {
251
+ for (const [index, { createNodes: createNodesTuple, include, exclude, name: pluginName },] of plugins.entries()) {
252
252
  const [pattern, createNodes] = createNodesTuple ?? [];
253
253
  if (!pattern) {
254
254
  continue;
@@ -266,10 +266,11 @@ plugins) {
266
266
  : // This represents a single plugin erroring out with a hard error.
267
267
  new error_types_1.AggregateCreateNodesError([[null, e]], []);
268
268
  (0, error_types_1.formatAggregateCreateNodesError)(error, pluginName);
269
+ error.pluginIndex = index;
269
270
  // This represents a single plugin erroring out with a hard error.
270
271
  errors.push(error);
271
272
  // The plugin didn't return partial results, so we return an empty array.
272
- return error.partialResults.map((r) => [pluginName, r[0], r[1]]);
273
+ return error.partialResults.map((r) => [pluginName, r[0], r[1], index]);
273
274
  })
274
275
  .finally(() => {
275
276
  inProgressPlugins.delete(pluginName);
@@ -308,7 +309,7 @@ function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
308
309
  const externalNodes = {};
309
310
  const configurationSourceMaps = {};
310
311
  for (const result of results.flat()) {
311
- const [pluginName, file, nodes] = result;
312
+ const [pluginName, file, nodes, index] = result;
312
313
  const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;
313
314
  const sourceInfo = [file, pluginName];
314
315
  for (const node in projectNodes) {
@@ -328,6 +329,7 @@ function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
328
329
  file,
329
330
  pluginName,
330
331
  error,
332
+ pluginIndex: index,
331
333
  }));
332
334
  }
333
335
  }