nx 18.2.0-canary.20240321-2a4c57d → 18.2.0-canary.20240323-54d4780

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 (35) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +12 -12
  3. package/schemas/nx-schema.json +32 -6
  4. package/src/command-line/add/add.js +1 -1
  5. package/src/command-line/affected/command-object.js +49 -22
  6. package/src/command-line/generate/generate.js +3 -3
  7. package/src/command-line/init/init-v2.js +16 -11
  8. package/src/command-line/run/command-object.js +9 -2
  9. package/src/command-line/run/run-one.js +1 -1
  10. package/src/command-line/run-many/command-object.js +4 -1
  11. package/src/command-line/show/command-object.d.ts +2 -0
  12. package/src/command-line/show/command-object.js +19 -2
  13. package/src/config/nx-json.d.ts +2 -0
  14. package/src/daemon/client/client.js +19 -7
  15. package/src/daemon/daemon-project-graph-error.d.ts +8 -0
  16. package/src/daemon/daemon-project-graph-error.js +13 -0
  17. package/src/daemon/server/handle-hash-tasks.js +11 -1
  18. package/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -0
  19. package/src/daemon/server/project-graph-incremental-recomputation.js +55 -6
  20. package/src/daemon/server/shutdown-utils.js +1 -3
  21. package/src/daemon/socket-utils.js +7 -1
  22. package/src/project-graph/build-project-graph.d.ts +18 -1
  23. package/src/project-graph/build-project-graph.js +71 -24
  24. package/src/project-graph/project-graph.d.ts +23 -2
  25. package/src/project-graph/project-graph.js +117 -14
  26. package/src/project-graph/utils/project-configuration-utils.d.ts +27 -4
  27. package/src/project-graph/utils/project-configuration-utils.js +106 -43
  28. package/src/project-graph/utils/retrieve-workspace-files.d.ts +4 -12
  29. package/src/project-graph/utils/retrieve-workspace-files.js +3 -16
  30. package/src/tasks-runner/cache.js +6 -3
  31. package/src/utils/nx-plugin.d.ts +2 -0
  32. package/src/utils/nx-plugin.js +18 -2
  33. package/src/utils/output.d.ts +1 -1
  34. package/src/utils/params.d.ts +2 -2
  35. package/src/utils/params.js +14 -0
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.readProjectConfigurationsFromRootMap = exports.buildProjectsConfigurationsFromProjectPathsAndPlugins = exports.mergeProjectConfigurationIntoRootMap = void 0;
3
+ exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.MergeNodesError = exports.CreateNodesError = exports.ProjectConfigurationsError = exports.readProjectConfigurationsFromRootMap = exports.createProjectConfigurations = exports.mergeProjectConfigurationIntoRootMap = void 0;
4
4
  const logger_1 = require("../../utils/logger");
5
5
  const fileutils_1 = require("../../utils/fileutils");
6
6
  const workspace_root_1 = require("../../utils/workspace-root");
7
7
  const target_defaults_plugin_1 = require("../../plugins/target-defaults/target-defaults-plugin");
8
8
  const minimatch_1 = require("minimatch");
9
9
  const path_1 = require("path");
10
+ const perf_hooks_1 = require("perf_hooks");
10
11
  function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
11
12
  // This function is used when reading project configuration
12
13
  // in generators, where we don't want to do this.
@@ -208,25 +209,44 @@ exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRoot
208
209
  /**
209
210
  * Transforms a list of project paths into a map of project configurations.
210
211
  *
212
+ * @param root The workspace root
211
213
  * @param nxJson The NxJson configuration
212
214
  * @param workspaceFiles A list of non-ignored workspace files
213
215
  * @param plugins The plugins that should be used to infer project configuration
214
- * @param root The workspace root
215
216
  */
216
- function buildProjectsConfigurationsFromProjectPathsAndPlugins(nxJson, workspaceFiles, // making this parameter allows devkit to pick up newly created projects
217
- plugins, root = workspace_root_1.workspaceRoot) {
217
+ function createProjectConfigurations(root = workspace_root_1.workspaceRoot, nxJson, workspaceFiles, // making this parameter allows devkit to pick up newly created projects
218
+ plugins) {
219
+ perf_hooks_1.performance.mark('build-project-configs:start');
218
220
  const results = [];
221
+ const errors = [];
219
222
  // We iterate over plugins first - this ensures that plugins specified first take precedence.
220
- for (const { plugin, options } of plugins) {
223
+ for (const { plugin, options, include, exclude } of plugins) {
221
224
  const [pattern, createNodes] = plugin.createNodes ?? [];
222
225
  const pluginResults = [];
223
- performance.mark(`${plugin.name}:createNodes - start`);
226
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes - start`);
224
227
  if (!pattern) {
225
228
  continue;
226
229
  }
227
- const matchingConfigFiles = workspaceFiles.filter(minimatch_1.minimatch.filter(pattern, { dot: true }));
230
+ const matchingConfigFiles = [];
231
+ for (const file of workspaceFiles) {
232
+ if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
233
+ if (include) {
234
+ const included = include.some((includedPattern) => (0, minimatch_1.minimatch)(file, includedPattern, { dot: true }));
235
+ if (!included) {
236
+ continue;
237
+ }
238
+ }
239
+ if (exclude) {
240
+ const excluded = include.some((excludedPattern) => (0, minimatch_1.minimatch)(file, excludedPattern, { dot: true }));
241
+ if (excluded) {
242
+ continue;
243
+ }
244
+ }
245
+ matchingConfigFiles.push(file);
246
+ }
247
+ }
228
248
  for (const file of matchingConfigFiles) {
229
- performance.mark(`${plugin.name}:createNodes:${file} - start`);
249
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - start`);
230
250
  try {
231
251
  let r = createNodes(file, options, {
232
252
  nxJsonConfiguration: nxJson,
@@ -235,19 +255,26 @@ plugins, root = workspace_root_1.workspaceRoot) {
235
255
  });
236
256
  if (r instanceof Promise) {
237
257
  pluginResults.push(r
238
- .catch((e) => {
239
- performance.mark(`${plugin.name}:createNodes:${file} - end`);
240
- throw new CreateNodesError(`Unable to create nodes for ${file} using plugin ${plugin.name}.`, e);
258
+ .catch((error) => {
259
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - end`);
260
+ errors.push(new CreateNodesError({
261
+ file,
262
+ pluginName: plugin.name,
263
+ error,
264
+ }));
265
+ return {
266
+ projects: {},
267
+ };
241
268
  })
242
269
  .then((r) => {
243
- performance.mark(`${plugin.name}:createNodes:${file} - end`);
244
- performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
270
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - end`);
271
+ perf_hooks_1.performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
245
272
  return { ...r, file, pluginName: plugin.name };
246
273
  }));
247
274
  }
248
275
  else {
249
- performance.mark(`${plugin.name}:createNodes:${file} - end`);
250
- performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
276
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes:${file} - end`);
277
+ perf_hooks_1.performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
251
278
  pluginResults.push({
252
279
  ...r,
253
280
  file,
@@ -255,19 +282,22 @@ plugins, root = workspace_root_1.workspaceRoot) {
255
282
  });
256
283
  }
257
284
  }
258
- catch (e) {
259
- throw new CreateNodesError(`Unable to create nodes for ${file} using plugin ${plugin.name}.`, e);
285
+ catch (error) {
286
+ errors.push(new CreateNodesError({
287
+ file,
288
+ pluginName: plugin.name,
289
+ error,
290
+ }));
260
291
  }
261
292
  }
262
- // If there are no promises (counter undefined) or all promises have resolved (counter === 0)
263
293
  results.push(Promise.all(pluginResults).then((results) => {
264
- performance.mark(`${plugin.name}:createNodes - end`);
265
- performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
294
+ perf_hooks_1.performance.mark(`${plugin.name}:createNodes - end`);
295
+ perf_hooks_1.performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
266
296
  return results;
267
297
  }));
268
298
  }
269
299
  return Promise.all(results).then((results) => {
270
- performance.mark('createNodes:merge - start');
300
+ perf_hooks_1.performance.mark('createNodes:merge - start');
271
301
  const projectRootMap = new Map();
272
302
  const externalNodes = {};
273
303
  const configurationSourceMaps = {};
@@ -285,25 +315,41 @@ plugins, root = workspace_root_1.workspaceRoot) {
285
315
  try {
286
316
  mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInfo);
287
317
  }
288
- catch (e) {
289
- throw new CreateNodesError(`Unable to merge project information for "${project.root}" from ${result.file} using plugin ${result.pluginName}.`, e);
318
+ catch (error) {
319
+ errors.push(new MergeNodesError({
320
+ file,
321
+ pluginName,
322
+ error,
323
+ }));
290
324
  }
291
325
  }
292
326
  Object.assign(externalNodes, pluginExternalNodes);
293
327
  }
294
328
  const projects = readProjectConfigurationsFromRootMap(projectRootMap);
295
329
  const rootMap = createRootMap(projectRootMap);
296
- performance.mark('createNodes:merge - end');
297
- performance.measure('createNodes:merge', 'createNodes:merge - start', 'createNodes:merge - end');
298
- return {
299
- projects,
300
- externalNodes,
301
- rootMap,
302
- sourceMaps: configurationSourceMaps,
303
- };
330
+ perf_hooks_1.performance.mark('createNodes:merge - end');
331
+ perf_hooks_1.performance.measure('createNodes:merge', 'createNodes:merge - start', 'createNodes:merge - end');
332
+ perf_hooks_1.performance.mark('build-project-configs:end');
333
+ perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
334
+ if (errors.length === 0) {
335
+ return {
336
+ projects,
337
+ externalNodes,
338
+ projectRootMap: rootMap,
339
+ sourceMaps: configurationSourceMaps,
340
+ };
341
+ }
342
+ else {
343
+ throw new ProjectConfigurationsError(errors, {
344
+ projects,
345
+ externalNodes,
346
+ projectRootMap: rootMap,
347
+ sourceMaps: configurationSourceMaps,
348
+ });
349
+ }
304
350
  });
305
351
  }
306
- exports.buildProjectsConfigurationsFromProjectPathsAndPlugins = buildProjectsConfigurationsFromProjectPathsAndPlugins;
352
+ exports.createProjectConfigurations = createProjectConfigurations;
307
353
  function readProjectConfigurationsFromRootMap(projectRootMap) {
308
354
  const projects = {};
309
355
  // If there are projects that have the same name, that is an error.
@@ -346,20 +392,37 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
346
392
  return projects;
347
393
  }
348
394
  exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
395
+ class ProjectConfigurationsError extends Error {
396
+ constructor(errors, partialProjectConfigurationsResult) {
397
+ super('Failed to create project configurations');
398
+ this.errors = errors;
399
+ this.partialProjectConfigurationsResult = partialProjectConfigurationsResult;
400
+ this.name = this.constructor.name;
401
+ }
402
+ }
403
+ exports.ProjectConfigurationsError = ProjectConfigurationsError;
349
404
  class CreateNodesError extends Error {
350
- constructor(msg, cause) {
351
- const message = `${msg} ${!cause
352
- ? ''
353
- : cause instanceof Error
354
- ? `\n\n\t Inner Error: ${cause.stack}`
355
- : cause}`;
356
- // These errors are thrown during a JS callback which is invoked via rust.
357
- // The errors messaging gets lost in the rust -> js -> rust transition, but
358
- // logging the error here will ensure that it is visible in the console.
359
- console.error(message);
360
- super(message, { cause });
405
+ constructor({ file, pluginName, error, }) {
406
+ const msg = `The "${pluginName}" plugin threw an error while creating nodes from ${file}:`;
407
+ super(msg, { cause: error });
408
+ this.name = this.constructor.name;
409
+ this.file = file;
410
+ this.pluginName = pluginName;
411
+ this.stack = `${this.message}\n ${error.stack.split('\n').join('\n ')}`;
412
+ }
413
+ }
414
+ exports.CreateNodesError = CreateNodesError;
415
+ class MergeNodesError extends Error {
416
+ constructor({ file, pluginName, error, }) {
417
+ const msg = `The nodes created from ${file} by the "${pluginName}" could not be merged into the project graph:`;
418
+ super(msg, { cause: error });
419
+ this.name = this.constructor.name;
420
+ this.file = file;
421
+ this.pluginName = pluginName;
422
+ this.stack = `${this.message}\n ${error.stack.split('\n').join('\n ')}`;
361
423
  }
362
424
  }
425
+ exports.MergeNodesError = MergeNodesError;
363
426
  /**
364
427
  * Merges two targets.
365
428
  *
@@ -1,7 +1,6 @@
1
1
  import { ProjectConfiguration } from '../../config/workspace-json-project-json';
2
2
  import { NxJsonConfiguration } from '../../config/nx-json';
3
- import { ProjectGraphExternalNode } from '../../config/project-graph';
4
- import { ConfigurationSourceMaps } from './project-configuration-utils';
3
+ import { ConfigurationResult } from './project-configuration-utils';
5
4
  import { LoadedNxPlugin } from '../../utils/nx-plugin';
6
5
  /**
7
6
  * Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
@@ -10,7 +9,7 @@ import { LoadedNxPlugin } from '../../utils/nx-plugin';
10
9
  * @param nxJson
11
10
  */
12
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
13
- allWorkspaceFiles: import("../../config/project-graph").FileData[];
12
+ allWorkspaceFiles: import("../file-utils").FileData[];
14
13
  fileMap: {
15
14
  projectFileMap: ProjectFiles;
16
15
  nonProjectFiles: import("../../native").FileData[];
@@ -23,15 +22,8 @@ export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRoo
23
22
  * @param workspaceRoot
24
23
  * @param nxJson
25
24
  */
26
- export declare function retrieveProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<RetrievedGraphNodes>;
27
- export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<RetrievedGraphNodes>;
28
- export type RetrievedGraphNodes = {
29
- externalNodes: Record<string, ProjectGraphExternalNode>;
30
- projects: Record<string, ProjectConfiguration>;
31
- sourceMaps: ConfigurationSourceMaps;
32
- projectRootMap: Record<string, string>;
33
- };
25
+ export declare function retrieveProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
26
+ export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
34
27
  export declare function retrieveProjectConfigurationPaths(root: string, plugins: LoadedNxPlugin[]): string[];
35
28
  export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
36
- export declare function createProjectConfigurations(workspaceRoot: string, nxJson: NxJsonConfiguration, configFiles: string[], plugins: LoadedNxPlugin[]): Promise<RetrievedGraphNodes>;
37
29
  export declare function configurationGlobs(plugins: LoadedNxPlugin[]): string[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configurationGlobs = exports.createProjectConfigurations = exports.retrieveProjectConfigurationsWithoutPluginInference = exports.retrieveProjectConfigurationPaths = exports.retrieveProjectConfigurationsWithAngularProjects = exports.retrieveProjectConfigurations = exports.retrieveWorkspaceFiles = void 0;
3
+ exports.configurationGlobs = exports.retrieveProjectConfigurationsWithoutPluginInference = exports.retrieveProjectConfigurationPaths = exports.retrieveProjectConfigurationsWithAngularProjects = exports.retrieveProjectConfigurations = exports.retrieveWorkspaceFiles = void 0;
4
4
  const perf_hooks_1 = require("perf_hooks");
5
5
  const installation_directory_1 = require("../../utils/installation-directory");
6
6
  const angular_json_1 = require("../../adapter/angular-json");
@@ -58,7 +58,7 @@ exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfig
58
58
  function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins) {
59
59
  const globPatterns = configurationGlobs(plugins);
60
60
  const workspaceFiles = (0, workspace_context_1.globWithWorkspaceContext)(workspaceRoot, globPatterns);
61
- return createProjectConfigurations(workspaceRoot, nxJson, workspaceFiles, plugins);
61
+ return (0, project_configuration_utils_1.createProjectConfigurations)(workspaceRoot, nxJson, workspaceFiles, plugins);
62
62
  }
63
63
  function retrieveProjectConfigurationPaths(root, plugins) {
64
64
  const projectGlobPatterns = configurationGlobs(plugins);
@@ -76,7 +76,7 @@ async function retrieveProjectConfigurationsWithoutPluginInference(root) {
76
76
  return projectsWithoutPluginCache.get(cacheKey);
77
77
  }
78
78
  const projectFiles = (0, workspace_context_1.globWithWorkspaceContext)(root, projectGlobPatterns) ?? [];
79
- const { projects } = await createProjectConfigurations(root, nxJson, projectFiles, [
79
+ const { projects } = await (0, project_configuration_utils_1.createProjectConfigurations)(root, nxJson, projectFiles, [
80
80
  { plugin: (0, package_json_workspaces_1.getNxPackageJsonWorkspacesPlugin)(root) },
81
81
  { plugin: project_json_1.ProjectJsonProjectsPlugin },
82
82
  ]);
@@ -84,19 +84,6 @@ async function retrieveProjectConfigurationsWithoutPluginInference(root) {
84
84
  return projects;
85
85
  }
86
86
  exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
87
- async function createProjectConfigurations(workspaceRoot, nxJson, configFiles, plugins) {
88
- perf_hooks_1.performance.mark('build-project-configs:start');
89
- const { projects, externalNodes, rootMap, sourceMaps } = await (0, project_configuration_utils_1.buildProjectsConfigurationsFromProjectPathsAndPlugins)(nxJson, configFiles, plugins, workspaceRoot);
90
- perf_hooks_1.performance.mark('build-project-configs:end');
91
- perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
92
- return {
93
- projects,
94
- externalNodes,
95
- projectRootMap: rootMap,
96
- sourceMaps,
97
- };
98
- }
99
- exports.createProjectConfigurations = createProjectConfigurations;
100
87
  function configurationGlobs(plugins) {
101
88
  const globPatterns = [];
102
89
  for (const { plugin } of plugins) {
@@ -215,18 +215,21 @@ class Cache {
215
215
  }
216
216
  tryAndRetry(fn) {
217
217
  let attempts = 0;
218
- const baseTimeout = 100;
218
+ const baseTimeout = 5;
219
+ // Generate a random number between 2 and 4 to raise to the power of attempts
220
+ const baseExponent = Math.random() * 2 + 2;
219
221
  const _try = async () => {
220
222
  try {
221
223
  attempts++;
222
224
  return await fn();
223
225
  }
224
226
  catch (e) {
225
- if (attempts === 10) {
227
+ // Max time is 5 * 4^3 = 20480ms
228
+ if (attempts === 6) {
226
229
  // After enough attempts, throw the error
227
230
  throw e;
228
231
  }
229
- await new Promise((res) => setTimeout(res, baseTimeout * attempts));
232
+ await new Promise((res) => setTimeout(res, baseExponent ** attempts));
230
233
  return await _try();
231
234
  }
232
235
  };
@@ -91,6 +91,8 @@ export type NxPlugin = NxPluginV1 | NxPluginV2;
91
91
  export type LoadedNxPlugin = {
92
92
  plugin: NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
93
93
  options?: unknown;
94
+ include?: string[];
95
+ exclude?: string[];
94
96
  };
95
97
  export declare const nxPluginCache: Map<string, LoadedNxPlugin['plugin']>;
96
98
  export declare function getPluginPathAndName(moduleName: string, paths: string[], projects: Record<string, ProjectConfiguration>, root: string): {
@@ -71,8 +71,19 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
71
71
  ? pluginConfiguration
72
72
  : { plugin: pluginConfiguration, options: undefined };
73
73
  let pluginModule = exports.nxPluginCache.get(moduleName);
74
+ const include = typeof pluginConfiguration === 'object'
75
+ ? pluginConfiguration.include
76
+ : undefined;
77
+ const exclude = typeof pluginConfiguration === 'object'
78
+ ? pluginConfiguration.exclude
79
+ : undefined;
74
80
  if (pluginModule) {
75
- return { plugin: pluginModule, options };
81
+ return {
82
+ plugin: pluginModule,
83
+ options,
84
+ include,
85
+ exclude,
86
+ };
76
87
  }
77
88
  performance.mark(`Load Nx Plugin: ${moduleName} - start`);
78
89
  let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projects, root);
@@ -81,7 +92,12 @@ async function loadNxPluginAsync(pluginConfiguration, paths, projects, root) {
81
92
  exports.nxPluginCache.set(moduleName, plugin);
82
93
  performance.mark(`Load Nx Plugin: ${moduleName} - end`);
83
94
  performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
84
- return { plugin, options };
95
+ return {
96
+ plugin,
97
+ options,
98
+ include,
99
+ exclude,
100
+ };
85
101
  }
86
102
  exports.loadNxPluginAsync = loadNxPluginAsync;
87
103
  async function loadNxPlugins(plugins, paths = (0, installation_directory_1.getNxRequirePaths)(), root = workspace_root_1.workspaceRoot, projects) {
@@ -1,5 +1,5 @@
1
1
  import * as chalk from 'chalk';
2
- import { TaskStatus } from '../tasks-runner/tasks-runner';
2
+ import type { TaskStatus } from '../tasks-runner/tasks-runner';
3
3
  export interface CLIErrorMessageConfig {
4
4
  title: string;
5
5
  bodyLines?: string[];
@@ -1,5 +1,5 @@
1
- import { NxJsonConfiguration } from '../config/nx-json';
2
- import { TargetConfiguration, ProjectsConfigurations } from '../config/workspace-json-project-json';
1
+ import type { NxJsonConfiguration } from '../config/nx-json';
2
+ import type { TargetConfiguration, ProjectsConfigurations } from '../config/workspace-json-project-json';
3
3
  type PropertyDescription = {
4
4
  type?: string | string[];
5
5
  required?: string[];
@@ -13,6 +13,20 @@ async function handleErrors(isVerbose, fn) {
13
13
  if (err.constructor.name === 'UnsuccessfulWorkflowExecution') {
14
14
  logger_1.logger.error('The generator workflow failed. See above.');
15
15
  }
16
+ else if (err.name === 'ProjectGraphError') {
17
+ const projectGraphError = err;
18
+ let title = projectGraphError.message;
19
+ if (isVerbose) {
20
+ title += ' See errors below.';
21
+ }
22
+ const bodyLines = isVerbose
23
+ ? [projectGraphError.stack]
24
+ : ['Pass --verbose to see the stacktraces.'];
25
+ output_1.output.error({
26
+ title,
27
+ bodyLines: bodyLines,
28
+ });
29
+ }
16
30
  else {
17
31
  const lines = (err.message ? err.message : err.toString()).split('\n');
18
32
  const bodyLines = lines.slice(1);