nx 19.0.0-beta.1 → 19.0.0-beta.11

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 (99) hide show
  1. package/.eslintrc.json +1 -1
  2. package/migrations.json +2 -25
  3. package/package.json +12 -12
  4. package/src/command-line/add/add.js +17 -16
  5. package/src/command-line/affected/affected.js +1 -1
  6. package/src/command-line/graph/graph.d.ts +11 -1
  7. package/src/command-line/graph/graph.js +97 -13
  8. package/src/command-line/init/implementation/react/index.js +1 -1
  9. package/src/command-line/release/changelog.js +1 -1
  10. package/src/command-line/release/command-object.js +2 -2
  11. package/src/command-line/release/publish.js +1 -1
  12. package/src/command-line/report/report.js +1 -1
  13. package/src/command-line/run/run-one.js +1 -1
  14. package/src/command-line/run-many/run-many.js +1 -1
  15. package/src/command-line/yargs-utils/shared-options.js +1 -1
  16. package/src/config/nx-json.d.ts +2 -2
  17. package/src/config/to-project-name.d.ts +5 -0
  18. package/src/config/to-project-name.js +13 -0
  19. package/src/core/graph/index.html +1 -2
  20. package/src/core/graph/main.js +1 -1
  21. package/src/core/graph/runtime.js +1 -1
  22. package/src/core/graph/styles.css +2 -2
  23. package/src/core/graph/styles.js +1 -1
  24. package/src/daemon/client/client.d.ts +2 -2
  25. package/src/daemon/client/client.js +21 -6
  26. package/src/daemon/server/project-graph-incremental-recomputation.js +8 -8
  27. package/src/daemon/server/shutdown-utils.js +7 -2
  28. package/src/daemon/tmp-dir.js +2 -2
  29. package/src/devkit-exports.d.ts +1 -5
  30. package/src/devkit-exports.js +1 -7
  31. package/src/devkit-internals.d.ts +2 -0
  32. package/src/devkit-internals.js +5 -1
  33. package/src/executors/run-commands/run-commands.impl.d.ts +2 -0
  34. package/src/executors/run-commands/run-commands.impl.js +69 -23
  35. package/src/executors/run-commands/schema.json +19 -2
  36. package/src/executors/utils/convert-nx-executor.js +2 -1
  37. package/src/generators/testing-utils/create-tree-with-empty-workspace.js +7 -0
  38. package/src/generators/utils/project-configuration.js +3 -8
  39. package/src/hasher/task-hasher.d.ts +4 -4
  40. package/src/native/index.d.ts +1 -1
  41. package/src/plugins/js/lock-file/pnpm-parser.js +109 -67
  42. package/src/plugins/package-json-workspaces/create-nodes.d.ts +1 -0
  43. package/src/plugins/package-json-workspaces/create-nodes.js +25 -20
  44. package/src/plugins/project-json/build-nodes/project-json.js +2 -2
  45. package/src/project-graph/affected/locators/workspace-projects.js +3 -1
  46. package/src/project-graph/build-project-graph.d.ts +8 -18
  47. package/src/project-graph/build-project-graph.js +86 -57
  48. package/src/project-graph/error-types.d.ts +49 -7
  49. package/src/project-graph/error-types.js +121 -9
  50. package/src/project-graph/file-utils.d.ts +2 -3
  51. package/src/project-graph/file-utils.js +5 -9
  52. package/src/project-graph/plugins/internal-api.d.ts +3 -2
  53. package/src/project-graph/plugins/internal-api.js +3 -0
  54. package/src/project-graph/plugins/isolation/messaging.d.ts +26 -3
  55. package/src/project-graph/plugins/isolation/plugin-pool.js +23 -1
  56. package/src/project-graph/plugins/isolation/plugin-worker.js +21 -0
  57. package/src/project-graph/plugins/loader.js +14 -6
  58. package/src/project-graph/plugins/public-api.d.ts +11 -1
  59. package/src/project-graph/plugins/utils.d.ts +2 -2
  60. package/src/project-graph/plugins/utils.js +19 -24
  61. package/src/project-graph/project-graph.d.ts +3 -0
  62. package/src/project-graph/project-graph.js +8 -7
  63. package/src/project-graph/utils/find-project-for-path.js +2 -3
  64. package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
  65. package/src/project-graph/utils/normalize-project-nodes.js +8 -14
  66. package/src/project-graph/utils/project-configuration-utils.d.ts +24 -6
  67. package/src/project-graph/utils/project-configuration-utils.js +125 -41
  68. package/src/tasks-runner/create-task-graph.js +0 -1
  69. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -1
  70. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +4 -0
  71. package/src/tasks-runner/pseudo-terminal.d.ts +2 -1
  72. package/src/tasks-runner/pseudo-terminal.js +8 -2
  73. package/src/tasks-runner/run-command.js +4 -4
  74. package/src/tasks-runner/utils.js +17 -0
  75. package/src/utils/assert-workspace-validity.js +2 -1
  76. package/src/utils/command-line-utils.d.ts +1 -1
  77. package/src/utils/nx-plugin.deprecated.d.ts +1 -1
  78. package/src/utils/nx-plugin.deprecated.js +1 -1
  79. package/src/utils/params.js +4 -0
  80. package/src/utils/perf-logging.js +3 -1
  81. package/src/command-line/repair.d.ts +0 -4
  82. package/src/command-line/repair.js +0 -7
  83. package/src/command-line/run-many.d.ts +0 -4
  84. package/src/command-line/run-many.js +0 -7
  85. package/src/command-line/run-one.d.ts +0 -4
  86. package/src/command-line/run-one.js +0 -7
  87. package/src/command-line/run.d.ts +0 -4
  88. package/src/command-line/run.js +0 -7
  89. package/src/command-line/watch.d.ts +0 -4
  90. package/src/command-line/watch.js +0 -7
  91. package/src/config/workspaces.d.ts +0 -18
  92. package/src/config/workspaces.js +0 -35
  93. package/src/core/graph/3rdpartylicenses.txt +0 -785
  94. package/src/migrations/update-15-1-0/set-project-names.d.ts +0 -2
  95. package/src/migrations/update-15-1-0/set-project-names.js +0 -34
  96. package/src/migrations/update-15-8-2/update-nxw.d.ts +0 -2
  97. package/src/migrations/update-15-8-2/update-nxw.js +0 -7
  98. package/src/utils/typescript.d.ts +0 -1
  99. package/src/utils/typescript.js +0 -5
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.readProjectConfigurationsFromRootMap = exports.createProjectConfigurations = exports.mergeProjectConfigurationIntoRootMap = void 0;
3
+ exports.normalizeTarget = exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.validateProject = exports.readProjectConfigurationsFromRootMap = exports.createProjectConfigurations = exports.mergeMetadata = 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");
@@ -12,17 +12,17 @@ const error_types_1 = require("../error-types");
12
12
  function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
13
13
  // This function is used when reading project configuration
14
14
  // in generators, where we don't want to do this.
15
- skipCommandNormalization) {
15
+ skipTargetNormalization) {
16
16
  if (configurationSourceMaps && !configurationSourceMaps[project.root]) {
17
17
  configurationSourceMaps[project.root] = {};
18
18
  }
19
19
  const sourceMap = configurationSourceMaps?.[project.root];
20
- let matchingProject = projectRootMap.get(project.root);
20
+ let matchingProject = projectRootMap[project.root];
21
21
  if (!matchingProject) {
22
- projectRootMap.set(project.root, {
22
+ projectRootMap[project.root] = {
23
23
  root: project.root,
24
- });
25
- matchingProject = projectRootMap.get(project.root);
24
+ };
25
+ matchingProject = projectRootMap[project.root];
26
26
  if (sourceMap) {
27
27
  sourceMap[`root`] = sourceInformation;
28
28
  }
@@ -129,16 +129,18 @@ skipCommandNormalization) {
129
129
  !matchingProject.targets?.[targetName]) {
130
130
  continue;
131
131
  }
132
- const mergedTarget = mergeTargetConfigurations(skipCommandNormalization
132
+ const normalizedTarget = skipTargetNormalization
133
133
  ? target
134
- : resolveCommandSyntacticSugar(target, project.root), matchingProject.targets?.[targetName], sourceMap, sourceInformation, `targets.${targetName}`);
134
+ : resolveCommandSyntacticSugar(target, project.root);
135
+ const mergedTarget = mergeTargetConfigurations(normalizedTarget, matchingProject.targets?.[targetName], sourceMap, sourceInformation, `targets.${targetName}`);
135
136
  // We don't want the symbol to live on past the merge process
136
137
  if (mergedTarget?.[symbols_1.ONLY_MODIFIES_EXISTING_TARGET])
137
138
  delete mergedTarget?.[symbols_1.ONLY_MODIFIES_EXISTING_TARGET];
138
139
  updatedProjectConfiguration.targets[targetName] = mergedTarget;
139
140
  }
140
141
  }
141
- projectRootMap.set(updatedProjectConfiguration.root, updatedProjectConfiguration);
142
+ projectRootMap[updatedProjectConfiguration.root] =
143
+ updatedProjectConfiguration;
142
144
  }
143
145
  exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
144
146
  function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata, matchingMetadata) {
@@ -210,6 +212,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
210
212
  }
211
213
  return result;
212
214
  }
215
+ exports.mergeMetadata = mergeMetadata;
213
216
  /**
214
217
  * Transforms a list of project paths into a map of project configurations.
215
218
  *
@@ -264,7 +267,7 @@ plugins) {
264
267
  }
265
268
  return Promise.all(results).then((results) => {
266
269
  perf_hooks_1.performance.mark('createNodes:merge - start');
267
- const projectRootMap = new Map();
270
+ const projectRootMap = {};
268
271
  const externalNodes = {};
269
272
  const configurationSourceMaps = {};
270
273
  for (const result of results.flat()) {
@@ -291,14 +294,12 @@ plugins) {
291
294
  }
292
295
  Object.assign(externalNodes, pluginExternalNodes);
293
296
  }
294
- let projects;
295
297
  try {
296
- projects = readProjectConfigurationsFromRootMap(projectRootMap);
298
+ validateAndNormalizeProjectRootMap(projectRootMap);
297
299
  }
298
300
  catch (e) {
299
301
  if ((0, error_types_1.isProjectsWithNoNameError)(e) ||
300
- (0, error_types_1.isProjectsWithConflictingNamesError)(e)) {
301
- projects = e.projects;
302
+ (0, error_types_1.isMultipleProjectsWithSameNameError)(e)) {
302
303
  errors.push(e);
303
304
  }
304
305
  else {
@@ -312,18 +313,20 @@ plugins) {
312
313
  perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
313
314
  if (errors.length === 0) {
314
315
  return {
315
- projects,
316
+ projects: projectRootMap,
316
317
  externalNodes,
317
318
  projectRootMap: rootMap,
318
319
  sourceMaps: configurationSourceMaps,
320
+ matchingProjectFiles: projectFiles,
319
321
  };
320
322
  }
321
323
  else {
322
324
  throw new error_types_1.ProjectConfigurationsError(errors, {
323
- projects,
325
+ projects: projectRootMap,
324
326
  externalNodes,
325
327
  projectRootMap: rootMap,
326
328
  sourceMaps: configurationSourceMaps,
329
+ matchingProjectFiles: projectFiles,
327
330
  });
328
331
  }
329
332
  });
@@ -336,34 +339,34 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
336
339
  // to provide better error messaging.
337
340
  const conflicts = new Map();
338
341
  const projectRootsWithNoName = [];
339
- for (const [root, configuration] of projectRootMap.entries()) {
342
+ for (const root in projectRootMap) {
343
+ const project = projectRootMap[root];
340
344
  // We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
341
345
  // Strip it before returning configuration for usage.
342
- if (configuration['// targets'])
343
- delete configuration['// targets'];
344
- if (!configuration.name) {
345
- try {
346
- const { name } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
347
- configuration.name = name;
346
+ if (project['// targets'])
347
+ delete project['// targets'];
348
+ try {
349
+ validateProject(project, projects);
350
+ projects[project.name] = project;
351
+ }
352
+ catch (e) {
353
+ if ((0, error_types_1.isProjectWithNoNameError)(e)) {
354
+ projectRootsWithNoName.push(e.projectRoot);
348
355
  }
349
- catch {
350
- projectRootsWithNoName.push(root);
356
+ else if ((0, error_types_1.isProjectWithExistingNameError)(e)) {
357
+ const rootErrors = conflicts.get(e.projectName) ?? [
358
+ projects[e.projectName].root,
359
+ ];
360
+ rootErrors.push(e.projectRoot);
361
+ conflicts.set(e.projectName, rootErrors);
362
+ }
363
+ else {
364
+ throw e;
351
365
  }
352
- }
353
- if (configuration.name in projects) {
354
- let rootErrors = conflicts.get(configuration.name) ?? [
355
- projects[configuration.name].root,
356
- ];
357
- rootErrors.push(root);
358
- conflicts.set(configuration.name, rootErrors);
359
- projects[configuration.name] = configuration;
360
- }
361
- else {
362
- projects[configuration.name] = configuration;
363
366
  }
364
367
  }
365
368
  if (conflicts.size > 0) {
366
- throw new error_types_1.ProjectsWithConflictingNamesError(conflicts, projects);
369
+ throw new error_types_1.MultipleProjectsWithSameNameError(conflicts, projects);
367
370
  }
368
371
  if (projectRootsWithNoName.length > 0) {
369
372
  throw new error_types_1.ProjectsWithNoNameError(projectRootsWithNoName, projects);
@@ -371,6 +374,76 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
371
374
  return projects;
372
375
  }
373
376
  exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
377
+ function validateAndNormalizeProjectRootMap(projectRootMap) {
378
+ // Name -> Project, used to validate that all projects have unique names
379
+ const projects = {};
380
+ // If there are projects that have the same name, that is an error.
381
+ // This object tracks name -> (all roots of projects with that name)
382
+ // to provide better error messaging.
383
+ const conflicts = new Map();
384
+ const projectRootsWithNoName = [];
385
+ for (const root in projectRootMap) {
386
+ const project = projectRootMap[root];
387
+ // We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
388
+ // Strip it before returning configuration for usage.
389
+ if (project['// targets'])
390
+ delete project['// targets'];
391
+ try {
392
+ validateProject(project, projects);
393
+ projects[project.name] = project;
394
+ }
395
+ catch (e) {
396
+ if ((0, error_types_1.isProjectWithNoNameError)(e)) {
397
+ projectRootsWithNoName.push(e.projectRoot);
398
+ }
399
+ else if ((0, error_types_1.isProjectWithExistingNameError)(e)) {
400
+ const rootErrors = conflicts.get(e.projectName) ?? [
401
+ projects[e.projectName].root,
402
+ ];
403
+ rootErrors.push(e.projectRoot);
404
+ conflicts.set(e.projectName, rootErrors);
405
+ }
406
+ else {
407
+ throw e;
408
+ }
409
+ }
410
+ for (const targetName in project.targets) {
411
+ project.targets[targetName] = normalizeTarget(project.targets[targetName], project);
412
+ if (!project.targets[targetName].executor &&
413
+ !project.targets[targetName].command) {
414
+ delete project.targets[targetName];
415
+ }
416
+ }
417
+ }
418
+ if (conflicts.size > 0) {
419
+ throw new error_types_1.MultipleProjectsWithSameNameError(conflicts, projects);
420
+ }
421
+ if (projectRootsWithNoName.length > 0) {
422
+ throw new error_types_1.ProjectsWithNoNameError(projectRootsWithNoName, projects);
423
+ }
424
+ return projectRootMap;
425
+ }
426
+ function validateProject(project,
427
+ // name -> project
428
+ knownProjects) {
429
+ if (!project.name) {
430
+ try {
431
+ const { name } = (0, fileutils_1.readJsonFile)((0, path_1.join)(project.root, 'package.json'));
432
+ if (!name) {
433
+ throw new Error(`Project at ${project.root} has no name provided.`);
434
+ }
435
+ project.name = name;
436
+ }
437
+ catch {
438
+ throw new error_types_1.ProjectWithNoNameError(project.root);
439
+ }
440
+ }
441
+ else if (knownProjects[project.name] &&
442
+ knownProjects[project.name].root !== project.root) {
443
+ throw new error_types_1.ProjectWithExistingNameError(project.name, project.root);
444
+ }
445
+ }
446
+ exports.validateProject = validateProject;
374
447
  /**
375
448
  * Merges two targets.
376
449
  *
@@ -388,7 +461,7 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
388
461
  const { configurations: defaultConfigurations, options: defaultOptions, ...baseTargetProperties } = baseTarget ?? {};
389
462
  // Target is "compatible", e.g. executor is defined only once or is the same
390
463
  // in both places. This means that it is likely safe to merge
391
- const isCompatible = isCompatibleTarget(baseTargetProperties, target);
464
+ const isCompatible = isCompatibleTarget(baseTarget ?? {}, target);
392
465
  // If the targets are not compatible, we would normally overwrite the old target
393
466
  // with the new one. However, we have a special case for targets that have the
394
467
  // ONLY_MODIFIES_EXISTING_TARGET symbol set. This prevents the merged target
@@ -451,8 +524,8 @@ function isCompatibleTarget(a, b) {
451
524
  return false;
452
525
  const isRunCommands = a.executor === 'nx:run-commands';
453
526
  if (isRunCommands) {
454
- const aCommand = a.options?.command ?? a.options?.commands.join(' && ');
455
- const bCommand = b.options?.command ?? b.options?.commands.join(' && ');
527
+ const aCommand = a.options?.command ?? a.options?.commands?.join(' && ');
528
+ const bCommand = b.options?.command ?? b.options?.commands?.join(' && ');
456
529
  const oneHasNoCommand = !aCommand || !bCommand;
457
530
  const hasSameCommand = aCommand === bCommand;
458
531
  return oneHasNoCommand || hasSameCommand;
@@ -544,7 +617,8 @@ function readTargetDefaultsForTarget(targetName, targetDefaults, executor) {
544
617
  exports.readTargetDefaultsForTarget = readTargetDefaultsForTarget;
545
618
  function createRootMap(projectRootMap) {
546
619
  const map = {};
547
- for (const [projectRoot, { name: projectName }] of projectRootMap) {
620
+ for (const projectRoot in projectRootMap) {
621
+ const projectName = projectRootMap[projectRoot].name;
548
622
  map[projectRoot] = projectName;
549
623
  }
550
624
  return map;
@@ -568,3 +642,13 @@ function resolveCommandSyntacticSugar(target, key) {
568
642
  };
569
643
  }
570
644
  }
645
+ function normalizeTarget(target, project) {
646
+ target = resolveCommandSyntacticSugar(target, project.root);
647
+ target.options = resolveNxTokensInOptions(target.options, project, `${project.root}:${target}`);
648
+ target.configurations ??= {};
649
+ for (const configuration in target.configurations) {
650
+ target.configurations[configuration] = resolveNxTokensInOptions(target.configurations[configuration], project, `${project.root}:${target}:${configuration}`);
651
+ }
652
+ return target;
653
+ }
654
+ exports.normalizeTarget = normalizeTarget;
@@ -170,7 +170,6 @@ class ProcessTasks {
170
170
  projectRoot: project.data.root,
171
171
  overrides: interpolatedOverrides,
172
172
  outputs: (0, utils_1.getOutputs)(this.projectGraph.nodes, qualifiedTarget, interpolatedOverrides),
173
- // TODO(v19): Remove cast here after typing is moved back onto TargetConfiguration
174
173
  cache: project.data.targets[target].cache,
175
174
  };
176
175
  }
@@ -24,6 +24,10 @@ const EXTENDED_LEFT_PAD = ` `;
24
24
  */
25
25
  async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, overrides, }) {
26
26
  cliCursor.hide();
27
+ // Show the cursor again after the process exits
28
+ process.on('exit', () => {
29
+ cliCursor.show();
30
+ });
27
31
  let resolveRenderIsDonePromise;
28
32
  const renderIsDone = new Promise((resolve) => (resolveRenderIsDonePromise = resolve)).then(() => {
29
33
  clearRenderInterval();
@@ -261,7 +265,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
261
265
  '',
262
266
  `${failedTasksForPrinting
263
267
  .map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
264
- .join('\n ')}`,
268
+ .join('\n')}`,
265
269
  ];
266
270
  if (failedTasks.size > numFailedToPrint) {
267
271
  failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
@@ -24,6 +24,10 @@ const EXTENDED_LEFT_PAD = ` `;
24
24
  */
25
25
  async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, args, overrides, }) {
26
26
  cliCursor.hide();
27
+ // Show the cursor again after the process exits
28
+ process.on('exit', () => {
29
+ cliCursor.show();
30
+ });
27
31
  let resolveRenderIsDonePromise;
28
32
  const renderIsDone = new Promise((resolve) => (resolveRenderIsDonePromise = resolve)).then(() => {
29
33
  clearRenderInterval();
@@ -11,10 +11,11 @@ export declare class PseudoTerminal {
11
11
  static isSupported(): boolean;
12
12
  constructor(rustPseudoTerminal: RustPseudoTerminal);
13
13
  init(): Promise<void>;
14
- runCommand(command: string, { cwd, jsEnv, quiet, }?: {
14
+ runCommand(command: string, { cwd, jsEnv, quiet, tty, }?: {
15
15
  cwd?: string;
16
16
  jsEnv?: Record<string, string>;
17
17
  quiet?: boolean;
18
+ tty?: boolean;
18
19
  }): PseudoTtyProcess;
19
20
  fork(id: string, script: string, { cwd, jsEnv, quiet, }: {
20
21
  cwd?: string;
@@ -32,8 +32,8 @@ class PseudoTerminal {
32
32
  await this.pseudoIPC.init();
33
33
  this.initialized = true;
34
34
  }
35
- runCommand(command, { cwd, jsEnv, quiet, } = {}) {
36
- return new PseudoTtyProcess(this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, quiet));
35
+ runCommand(command, { cwd, jsEnv, quiet, tty, } = {}) {
36
+ return new PseudoTtyProcess(this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, quiet, tty));
37
37
  }
38
38
  async fork(id, script, { cwd, jsEnv, quiet, }) {
39
39
  if (!this.initialized) {
@@ -142,6 +142,12 @@ function supportedPtyPlatform() {
142
142
  if (process.platform !== 'win32') {
143
143
  return true;
144
144
  }
145
+ // TODO: Re-enable Windows support when it's stable
146
+ // Currently, there's an issue with control chars.
147
+ // See: https://github.com/nrwl/nx/issues/22358
148
+ if (process.env.NX_WINDOWS_PTY_SUPPORT !== 'true') {
149
+ return false;
150
+ }
145
151
  let windowsVersion = os.release().split('.');
146
152
  let windowsBuild = windowsVersion[2];
147
153
  if (!windowsBuild) {
@@ -140,7 +140,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
140
140
  title: `TaskGraph is now required as an argument to hashTask`,
141
141
  bodyLines: [
142
142
  `The TaskGraph object can be retrieved from the context`,
143
- 'This will result in an error in Nx 19',
143
+ 'This will result in an error in Nx 20',
144
144
  ],
145
145
  });
146
146
  taskGraph_ = taskGraph;
@@ -150,7 +150,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
150
150
  title: `The environment variables are now required as an argument to hashTask`,
151
151
  bodyLines: [
152
152
  `Please pass the environment variables used when running the task`,
153
- 'This will result in an error in Nx 19',
153
+ 'This will result in an error in Nx 20',
154
154
  ],
155
155
  });
156
156
  env = process.env;
@@ -163,7 +163,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
163
163
  title: `TaskGraph is now required as an argument to hashTasks`,
164
164
  bodyLines: [
165
165
  `The TaskGraph object can be retrieved from the context`,
166
- 'This will result in an error in Nx 19',
166
+ 'This will result in an error in Nx 20',
167
167
  ],
168
168
  });
169
169
  taskGraph_ = taskGraph;
@@ -173,7 +173,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
173
173
  title: `The environment variables are now required as an argument to hashTasks`,
174
174
  bodyLines: [
175
175
  `Please pass the environment variables used when running the tasks`,
176
- 'This will result in an error in Nx 19',
176
+ 'This will result in an error in Nx 20',
177
177
  ],
178
178
  });
179
179
  env = process.env;
@@ -78,7 +78,24 @@ class InvalidOutputsError extends Error {
78
78
  return `The following outputs are invalid:${invalidOutputsList}\nPlease run "nx repair" to repair your configuration`;
79
79
  }
80
80
  }
81
+ function assertOutputsAreValidType(outputs) {
82
+ if (!Array.isArray(outputs)) {
83
+ throw new Error("The 'outputs' field must be an array");
84
+ }
85
+ const typesArray = [];
86
+ let hasInvalidType = false;
87
+ for (const output of outputs) {
88
+ if (typeof output !== 'string') {
89
+ hasInvalidType = true;
90
+ }
91
+ typesArray.push(typeof output);
92
+ }
93
+ if (hasInvalidType) {
94
+ throw new Error(`The 'outputs' field must contain only strings, but received types: [${typesArray.join(', ')}]`);
95
+ }
96
+ }
81
97
  function validateOutputs(outputs) {
98
+ assertOutputsAreValidType(outputs);
82
99
  const invalidOutputs = new Set();
83
100
  for (const output of outputs) {
84
101
  if (!/^!?{[\s\S]+}/.test(output)) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertWorkspaceValidity = void 0;
4
4
  const find_matching_projects_1 = require("./find-matching-projects");
5
5
  const output_1 = require("./output");
6
+ const devkit_internals_1 = require("../devkit-internals");
6
7
  function assertWorkspaceValidity(projects, nxJson) {
7
8
  const projectNames = Object.keys(projects);
8
9
  const projectGraphNodes = projectNames.reduce((graph, project) => {
@@ -67,7 +68,7 @@ function assertWorkspaceValidity(projects, nxJson) {
67
68
  })
68
69
  .join('\n\n');
69
70
  }
70
- throw new Error(`Configuration Error\n${message}`);
71
+ throw new devkit_internals_1.WorkspaceValidityError(message);
71
72
  }
72
73
  exports.assertWorkspaceValidity = assertWorkspaceValidity;
73
74
  function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDeps, projectConfigurations, projects) {
@@ -30,7 +30,7 @@ export interface NxArgs {
30
30
  type?: string;
31
31
  batch?: boolean;
32
32
  }
33
- export declare function createOverrides(__overrides_unparsed__?: string[]): any;
33
+ export declare function createOverrides(__overrides_unparsed__?: string[]): Record<string, any>;
34
34
  export declare function splitArgsIntoNxArgsAndOverrides(args: {
35
35
  [k: string]: any;
36
36
  }, mode: 'run-one' | 'run-many' | 'affected' | 'print-affected', options: {
@@ -26,6 +26,6 @@ export type NxPluginV1 = {
26
26
  projectFilePatterns?: string[];
27
27
  };
28
28
  /**
29
- * @todo(@agentender) v19: Remove this fn when we remove readWorkspaceConfig
29
+ * @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
30
30
  */
31
31
  export declare function getDefaultPluginsSync(root: string): NxPluginV2[];
@@ -6,7 +6,7 @@ const project_json_1 = require("../plugins/project-json/build-nodes/project-json
6
6
  const target_defaults_plugin_1 = require("../plugins/target-defaults/target-defaults-plugin");
7
7
  const PackageJsonWorkspacesPlugin = require("../plugins/package-json-workspaces");
8
8
  /**
9
- * @todo(@agentender) v19: Remove this fn when we remove readWorkspaceConfig
9
+ * @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
10
10
  */
11
11
  function getDefaultPluginsSync(root) {
12
12
  const plugins = [
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPromptsForSchema = exports.convertSmartDefaultsIntoNamedParams = exports.warnDeprecations = exports.combineOptionsForGenerator = exports.combineOptionsForExecutor = exports.applyVerbosity = exports.setDefaults = exports.validateObject = exports.validateOptsAgainstSchema = exports.SchemaError = exports.convertAliases = exports.coerceTypesInOptions = exports.convertToCamelCase = exports.handleErrors = void 0;
4
4
  const logger_1 = require("./logger");
5
5
  const output_1 = require("./output");
6
+ const client_1 = require("../daemon/client/client");
6
7
  const LIST_CHOICE_DISPLAY_LIMIT = 10;
7
8
  async function handleErrors(isVerbose, fn) {
8
9
  try {
@@ -41,6 +42,9 @@ async function handleErrors(isVerbose, fn) {
41
42
  logger_1.logger.info(err.stack);
42
43
  }
43
44
  }
45
+ if (client_1.daemonClient.enabled()) {
46
+ client_1.daemonClient.reset();
47
+ }
44
48
  return 1;
45
49
  }
46
50
  }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const perf_hooks_1 = require("perf_hooks");
4
- if (process.env.NX_PERF_LOGGING === 'true') {
4
+ let initialized = false;
5
+ if (process.env.NX_PERF_LOGGING === 'true' && !initialized) {
6
+ initialized = true;
5
7
  const obs = new perf_hooks_1.PerformanceObserver((list) => {
6
8
  for (const entry of list.getEntries()) {
7
9
  console.log(`Time for '${entry.name}'`, entry.duration);
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
3
- */
4
- export * from './repair/repair';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
6
- */
7
- tslib_1.__exportStar(require("./repair/repair"), exports);
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
3
- */
4
- export * from './run-many/run-many';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
6
- */
7
- tslib_1.__exportStar(require("./run-many/run-many"), exports);
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
3
- */
4
- export * from './run/run-one';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
6
- */
7
- tslib_1.__exportStar(require("./run/run-one"), exports);
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
3
- */
4
- export * from './run/run';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
6
- */
7
- tslib_1.__exportStar(require("./run/run"), exports);
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
3
- */
4
- export * from './watch/watch';
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /**
5
- * @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
6
- */
7
- tslib_1.__exportStar(require("./watch/watch"), exports);
@@ -1,18 +0,0 @@
1
- import type { NxJsonConfiguration } from './nx-json';
2
- import { ProjectsConfigurations } from './workspace-json-project-json';
3
- /**
4
- * @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
5
- */
6
- export declare class Workspaces {
7
- private root;
8
- constructor(root: string);
9
- /**
10
- * @deprecated Use {@link readProjectsConfigurationFromProjectGraph} instead.
11
- */
12
- readWorkspaceConfiguration(): ProjectsConfigurations & NxJsonConfiguration;
13
- }
14
- /**
15
- * Pulled from toFileName in names from @nx/devkit.
16
- * Todo: Should refactor, not duplicate.
17
- */
18
- export declare function toProjectName(fileName: string): string;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toProjectName = exports.Workspaces = void 0;
4
- const path_1 = require("path");
5
- const project_graph_1 = require("../project-graph/project-graph");
6
- const nx_json_1 = require("./nx-json");
7
- // TODO(v19): remove this class
8
- /**
9
- * @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
10
- */
11
- class Workspaces {
12
- constructor(root) {
13
- this.root = root;
14
- }
15
- /**
16
- * @deprecated Use {@link readProjectsConfigurationFromProjectGraph} instead.
17
- */
18
- readWorkspaceConfiguration() {
19
- const nxJson = (0, nx_json_1.readNxJson)(this.root);
20
- return {
21
- ...(0, project_graph_1.readProjectsConfigurationFromProjectGraph)((0, project_graph_1.readCachedProjectGraph)()),
22
- ...nxJson,
23
- };
24
- }
25
- }
26
- exports.Workspaces = Workspaces;
27
- /**
28
- * Pulled from toFileName in names from @nx/devkit.
29
- * Todo: Should refactor, not duplicate.
30
- */
31
- function toProjectName(fileName) {
32
- const parts = (0, path_1.dirname)(fileName).split(/[\/\\]/g);
33
- return parts[parts.length - 1].toLowerCase();
34
- }
35
- exports.toProjectName = toProjectName;