nx 18.3.2 → 18.3.4

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 (42) hide show
  1. package/migrations.json +2 -1
  2. package/package.json +12 -12
  3. package/src/command-line/graph/command-object.js +1 -1
  4. package/src/command-line/show/command-object.js +1 -5
  5. package/src/command-line/yargs-utils/shared-options.d.ts +3 -0
  6. package/src/command-line/yargs-utils/shared-options.js +15 -6
  7. package/src/core/graph/main.js +1 -1
  8. package/src/daemon/server/project-graph-incremental-recomputation.js +6 -6
  9. package/src/daemon/server/server.js +1 -4
  10. package/src/daemon/socket-utils.js +2 -14
  11. package/src/devkit-internals.d.ts +1 -0
  12. package/src/devkit-internals.js +3 -1
  13. package/src/executors/run-commands/run-commands.impl.d.ts +1 -0
  14. package/src/executors/run-commands/run-commands.impl.js +64 -12
  15. package/src/executors/run-commands/schema.json +5 -0
  16. package/src/executors/utils/convert-nx-executor.js +2 -1
  17. package/src/generators/utils/project-configuration.js +2 -2
  18. package/src/project-graph/build-project-graph.d.ts +1 -1
  19. package/src/project-graph/build-project-graph.js +7 -8
  20. package/src/project-graph/error-types.d.ts +5 -1
  21. package/src/project-graph/error-types.js +11 -1
  22. package/src/project-graph/file-utils.js +1 -1
  23. package/src/project-graph/plugins/isolation/messaging.d.ts +9 -6
  24. package/src/project-graph/plugins/isolation/messaging.js +27 -10
  25. package/src/project-graph/plugins/isolation/plugin-pool.js +11 -14
  26. package/src/project-graph/plugins/isolation/plugin-worker.js +21 -5
  27. package/src/project-graph/plugins/loader.js +35 -23
  28. package/src/project-graph/plugins/public-api.d.ts +1 -1
  29. package/src/project-graph/plugins/utils.d.ts +2 -2
  30. package/src/project-graph/plugins/utils.js +15 -16
  31. package/src/project-graph/utils/find-project-for-path.js +2 -3
  32. package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
  33. package/src/project-graph/utils/normalize-project-nodes.js +8 -8
  34. package/src/project-graph/utils/project-configuration-utils.d.ts +18 -3
  35. package/src/project-graph/utils/project-configuration-utils.js +22 -14
  36. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
  37. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +4 -0
  38. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +4 -0
  39. package/src/tasks-runner/pseudo-terminal.js +6 -0
  40. package/src/utils/perf-logging.js +3 -1
  41. package/src/utils/serializable-error.d.ts +4 -0
  42. package/src/utils/serializable-error.js +28 -0
@@ -14,10 +14,11 @@ const find_project_for_path_1 = require("../utils/find-project-for-path");
14
14
  const path_1 = require("../../utils/path");
15
15
  const logger_1 = require("../../utils/logger");
16
16
  const node_path_1 = require("node:path");
17
- const path = require("node:path/posix");
18
17
  const retrieve_workspace_files_1 = require("../utils/retrieve-workspace-files");
19
18
  const utils_1 = require("./utils");
20
19
  const internal_api_1 = require("./internal-api");
20
+ const error_types_1 = require("../error-types");
21
+ const path = require("node:path/posix");
21
22
  function readPluginPackageJson(pluginName, projects, paths = (0, installation_directory_1.getNxRequirePaths)()) {
22
23
  try {
23
24
  const result = (0, package_json_1.readModulePackageJsonWithoutFallbacks)(pluginName, paths);
@@ -31,6 +32,9 @@ function readPluginPackageJson(pluginName, projects, paths = (0, installation_di
31
32
  const localPluginPath = resolveLocalNxPlugin(pluginName, projects);
32
33
  if (localPluginPath) {
33
34
  const localPluginPackageJson = path.join(localPluginPath.path, 'package.json');
35
+ if (!exports.unregisterPluginTSTranspiler) {
36
+ registerPluginTSTranspiler();
37
+ }
34
38
  return {
35
39
  path: localPluginPackageJson,
36
40
  json: (0, fileutils_1.readJsonFile)(localPluginPackageJson),
@@ -76,22 +80,27 @@ function registerPluginTSTranspiler() {
76
80
  }
77
81
  exports.registerPluginTSTranspiler = registerPluginTSTranspiler;
78
82
  function lookupLocalPlugin(importPath, projects, root = workspace_root_1.workspaceRoot) {
79
- const plugin = findNxProjectForImportPath(importPath, projects, root);
80
- if (!plugin) {
83
+ const projectConfig = findNxProjectForImportPath(importPath, projects, root);
84
+ if (!projectConfig) {
81
85
  return null;
82
86
  }
83
- const projectConfig = projects[plugin];
84
87
  return { path: path.join(root, projectConfig.root), projectConfig };
85
88
  }
86
89
  function findNxProjectForImportPath(importPath, projects, root = workspace_root_1.workspaceRoot) {
87
90
  const tsConfigPaths = readTsConfigPaths(root);
88
91
  const possiblePaths = tsConfigPaths[importPath]?.map((p) => (0, path_1.normalizePath)(path.relative(root, path.join(root, p))));
89
92
  if (possiblePaths?.length) {
90
- const projectRootMappings = (0, find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations)(projects);
93
+ const projectRootMappings = new Map();
94
+ const projectNameMap = new Map();
95
+ for (const projectRoot in projects) {
96
+ const project = projects[projectRoot];
97
+ projectRootMappings.set(project.root, project.name);
98
+ projectNameMap.set(project.name, project);
99
+ }
91
100
  for (const tsConfigPath of possiblePaths) {
92
101
  const nxProject = (0, find_project_for_path_1.findProjectForPath)(tsConfigPath, projectRootMappings);
93
102
  if (nxProject) {
94
- return nxProject;
103
+ return projectNameMap.get(nxProject);
95
104
  }
96
105
  }
97
106
  logger_1.logger.verbose('Unable to find local plugin', possiblePaths, projectRootMappings);
@@ -174,26 +183,29 @@ function loadNxPlugin(plugin, root) {
174
183
  }
175
184
  exports.loadNxPlugin = loadNxPlugin;
176
185
  async function loadNxPluginAsync(pluginConfiguration, paths, root) {
177
- try {
178
- require.resolve(typeof pluginConfiguration === 'string'
179
- ? pluginConfiguration
180
- : pluginConfiguration.plugin);
181
- }
182
- catch {
183
- // If a plugin cannot be resolved, we will need projects to resolve it
184
- projectsWithoutInference ??=
185
- await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
186
- }
187
186
  const moduleName = typeof pluginConfiguration === 'string'
188
187
  ? pluginConfiguration
189
188
  : pluginConfiguration.plugin;
190
- performance.mark(`Load Nx Plugin: ${moduleName} - start`);
191
- let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projectsWithoutInference, root);
192
- const plugin = (0, utils_1.normalizeNxPlugin)(await importPluginModule(pluginPath));
193
- plugin.name ??= name;
194
- performance.mark(`Load Nx Plugin: ${moduleName} - end`);
195
- performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
196
- return new internal_api_1.LoadedNxPlugin(plugin, pluginConfiguration);
189
+ try {
190
+ try {
191
+ require.resolve(moduleName);
192
+ }
193
+ catch {
194
+ // If a plugin cannot be resolved, we will need projects to resolve it
195
+ projectsWithoutInference ??=
196
+ await (0, retrieve_workspace_files_1.retrieveProjectConfigurationsWithoutPluginInference)(root);
197
+ }
198
+ performance.mark(`Load Nx Plugin: ${moduleName} - start`);
199
+ let { pluginPath, name } = await getPluginPathAndName(moduleName, paths, projectsWithoutInference, root);
200
+ const plugin = (0, utils_1.normalizeNxPlugin)(await importPluginModule(pluginPath));
201
+ plugin.name ??= name;
202
+ performance.mark(`Load Nx Plugin: ${moduleName} - end`);
203
+ performance.measure(`Load Nx Plugin: ${moduleName}`, `Load Nx Plugin: ${moduleName} - start`, `Load Nx Plugin: ${moduleName} - end`);
204
+ return new internal_api_1.LoadedNxPlugin(plugin, pluginConfiguration);
205
+ }
206
+ catch (e) {
207
+ throw new error_types_1.LoadPluginError(moduleName, e);
208
+ }
197
209
  }
198
210
  exports.loadNxPluginAsync = loadNxPluginAsync;
199
211
  async function importPluginModule(pluginPath) {
@@ -12,7 +12,7 @@ export interface CreateNodesContext {
12
12
  /**
13
13
  * The subset of configuration files which match the createNodes pattern
14
14
  */
15
- readonly configFiles: string[];
15
+ readonly configFiles: readonly string[];
16
16
  }
17
17
  /**
18
18
  * A function which parses a configuration file into a set of nodes.
@@ -1,7 +1,7 @@
1
1
  import type { NxPluginV1 } from '../../utils/nx-plugin.deprecated';
2
2
  import type { CreateNodesResultWithContext, LoadedNxPlugin, NormalizedPlugin } from './internal-api';
3
- import type { CreateNodesContext, NxPlugin, NxPluginV2 } from './public-api';
3
+ import { type CreateNodesContext, type NxPlugin, type NxPluginV2 } from './public-api';
4
4
  export declare function isNxPluginV2(plugin: NxPlugin): plugin is NxPluginV2;
5
5
  export declare function isNxPluginV1(plugin: NxPlugin | LoadedNxPlugin): plugin is NxPluginV1;
6
6
  export declare function normalizeNxPlugin(plugin: NxPlugin): NormalizedPlugin;
7
- export declare function runCreateNodesInParallel(configFiles: string[], plugin: NormalizedPlugin, options: unknown, context: CreateNodesContext): Promise<CreateNodesResultWithContext[]>;
7
+ export declare function runCreateNodesInParallel(configFiles: readonly string[], plugin: NormalizedPlugin, options: unknown, context: CreateNodesContext): Promise<CreateNodesResultWithContext[]>;
@@ -43,30 +43,29 @@ async function runCreateNodesInParallel(configFiles, plugin, options, context) {
43
43
  performance.mark(`${plugin.name}:createNodes - start`);
44
44
  const errors = [];
45
45
  const results = [];
46
- const promises = configFiles.map((file) => {
46
+ const promises = configFiles.map(async (file) => {
47
47
  performance.mark(`${plugin.name}:createNodes:${file} - start`);
48
- // Result is either static or a promise, using Promise.resolve lets us
49
- // handle both cases with same logic
50
- const value = Promise.resolve(plugin.createNodes[1](file, options, context));
51
- return value
52
- .catch((e) => {
53
- performance.mark(`${plugin.name}:createNodes:${file} - end`);
48
+ try {
49
+ const value = await plugin.createNodes[1](file, options, context);
50
+ if (value) {
51
+ results.push({
52
+ ...value,
53
+ file,
54
+ pluginName: plugin.name,
55
+ });
56
+ }
57
+ }
58
+ catch (e) {
54
59
  errors.push(new error_types_1.CreateNodesError({
55
60
  error: e,
56
61
  pluginName: plugin.name,
57
62
  file,
58
63
  }));
59
- return null;
60
- })
61
- .then((r) => {
64
+ }
65
+ finally {
62
66
  performance.mark(`${plugin.name}:createNodes:${file} - end`);
63
67
  performance.measure(`${plugin.name}:createNodes:${file}`, `${plugin.name}:createNodes:${file} - start`, `${plugin.name}:createNodes:${file} - end`);
64
- // Existing behavior is to ignore null results of
65
- // createNodes function.
66
- if (r) {
67
- results.push({ ...r, file, pluginName: plugin.name });
68
- }
69
- });
68
+ }
70
69
  });
71
70
  await Promise.all(promises).then(() => {
72
71
  performance.mark(`${plugin.name}:createNodes - end`);
@@ -9,9 +9,8 @@ const path_2 = require("../../utils/path");
9
9
  */
10
10
  function createProjectRootMappingsFromProjectConfigurations(projects) {
11
11
  const projectRootMappings = new Map();
12
- for (const projectName of Object.keys(projects)) {
13
- const root = projects[projectName].root;
14
- projectRootMappings.set(normalizeProjectRoot(root), projectName);
12
+ for (const { name, root } of Object.values(projects)) {
13
+ projectRootMappings.set(normalizeProjectRoot(root), name);
15
14
  }
16
15
  return projectRootMappings;
17
16
  }
@@ -2,7 +2,7 @@ import { ProjectGraphProjectNode } from '../../config/project-graph';
2
2
  import { ProjectGraphBuilder } from '../project-graph-builder';
3
3
  import { ProjectConfiguration, TargetConfiguration } from '../../config/workspace-json-project-json';
4
4
  import { CreateDependenciesContext } from '../plugins';
5
- export declare function normalizeProjectNodes(ctx: CreateDependenciesContext, builder: ProjectGraphBuilder): Promise<void>;
5
+ export declare function normalizeProjectNodes({ projects }: CreateDependenciesContext, builder: ProjectGraphBuilder): Promise<void>;
6
6
  /**
7
7
  * Apply target defaults and normalization
8
8
  */
@@ -3,15 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeImplicitDependencies = exports.normalizeProjectTargets = exports.normalizeProjectNodes = void 0;
4
4
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
5
5
  const project_configuration_utils_1 = require("../utils/project-configuration-utils");
6
- async function normalizeProjectNodes(ctx, builder) {
7
- const toAdd = [];
6
+ async function normalizeProjectNodes({ projects }, builder) {
8
7
  // Sorting projects by name to make sure that the order of projects in the graph is deterministic.
9
8
  // This is important to ensure that expanded properties referencing projects (e.g. implicit dependencies)
10
9
  // are also deterministic, and thus don't cause the calculated project configuration hash to shift.
11
- const projects = Object.keys(ctx.projects).sort();
10
+ const sortedProjectNames = Object.keys(projects).sort();
12
11
  // Used for expanding implicit dependencies (e.g. `@proj/*` or `tag:foo`)
13
- const partialProjectGraphNodes = projects.reduce((graph, project) => {
14
- const projectConfiguration = ctx.projects[project];
12
+ const partialProjectGraphNodes = sortedProjectNames.reduce((graph, project) => {
13
+ const projectConfiguration = projects[project];
15
14
  graph[project] = {
16
15
  name: project,
17
16
  type: projectConfiguration.projectType === 'library' ? 'lib' : 'app', // missing fallback to `e2e`
@@ -21,8 +20,9 @@ async function normalizeProjectNodes(ctx, builder) {
21
20
  };
22
21
  return graph;
23
22
  }, {});
24
- for (const key of projects) {
25
- const p = ctx.projects[key];
23
+ const toAdd = [];
24
+ for (const key of sortedProjectNames) {
25
+ const p = projects[key];
26
26
  p.implicitDependencies = normalizeImplicitDependencies(key, p.implicitDependencies, partialProjectGraphNodes);
27
27
  p.targets = normalizeProjectTargets(p, key);
28
28
  // TODO: remove in v16
@@ -31,7 +31,7 @@ async function normalizeProjectNodes(ctx, builder) {
31
31
  ? 'e2e'
32
32
  : 'app'
33
33
  : 'lib';
34
- const tags = ctx.projects?.[key]?.tags || [];
34
+ const tags = p.tags || [];
35
35
  toAdd.push({
36
36
  name: key,
37
37
  type: projectType,
@@ -5,16 +5,31 @@ import { ONLY_MODIFIES_EXISTING_TARGET } from '../../plugins/target-defaults/sym
5
5
  import { LoadedNxPlugin } from '../plugins/internal-api';
6
6
  export type SourceInformation = [file: string, plugin: string];
7
7
  export type ConfigurationSourceMaps = Record<string, Record<string, SourceInformation>>;
8
- export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Map<string, ProjectConfiguration>, project: ProjectConfiguration & {
8
+ export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Record<string, ProjectConfiguration>, project: ProjectConfiguration & {
9
9
  targets?: Record<string, TargetConfiguration & {
10
10
  [ONLY_MODIFIES_EXISTING_TARGET]?: boolean;
11
11
  }>;
12
12
  }, configurationSourceMaps?: ConfigurationSourceMaps, sourceInformation?: SourceInformation, skipCommandNormalization?: boolean): void;
13
13
  export type ConfigurationResult = {
14
- projects: Record<string, ProjectConfiguration>;
14
+ /**
15
+ * A map of project configurations, keyed by project root.
16
+ */
17
+ projects: {
18
+ [projectRoot: string]: ProjectConfiguration;
19
+ };
20
+ /**
21
+ * Node Name -> Node info
22
+ */
15
23
  externalNodes: Record<string, ProjectGraphExternalNode>;
24
+ /**
25
+ * Project Root -> Project Name
26
+ */
16
27
  projectRootMap: Record<string, string>;
17
28
  sourceMaps: ConfigurationSourceMaps;
29
+ /**
30
+ * The list of files that were used to create project configurations
31
+ */
32
+ matchingProjectFiles: string[];
18
33
  };
19
34
  /**
20
35
  * Transforms a list of project paths into a map of project configurations.
@@ -26,7 +41,7 @@ export type ConfigurationResult = {
26
41
  */
27
42
  export declare function createProjectConfigurations(root: string, nxJson: NxJsonConfiguration, projectFiles: string[], // making this parameter allows devkit to pick up newly created projects
28
43
  plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
29
- export declare function readProjectConfigurationsFromRootMap(projectRootMap: Map<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
44
+ export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
30
45
  /**
31
46
  * Merges two targets.
32
47
  *
@@ -17,12 +17,12 @@ skipCommandNormalization) {
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
  }
@@ -138,7 +138,8 @@ skipCommandNormalization) {
138
138
  updatedProjectConfiguration.targets[targetName] = mergedTarget;
139
139
  }
140
140
  }
141
- projectRootMap.set(updatedProjectConfiguration.root, updatedProjectConfiguration);
141
+ projectRootMap[updatedProjectConfiguration.root] =
142
+ updatedProjectConfiguration;
142
143
  }
143
144
  exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
144
145
  function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata, matchingMetadata) {
@@ -264,7 +265,7 @@ plugins) {
264
265
  }
265
266
  return Promise.all(results).then((results) => {
266
267
  perf_hooks_1.performance.mark('createNodes:merge - start');
267
- const projectRootMap = new Map();
268
+ const projectRootMap = {};
268
269
  const externalNodes = {};
269
270
  const configurationSourceMaps = {};
270
271
  for (const result of results.flat()) {
@@ -291,14 +292,17 @@ plugins) {
291
292
  }
292
293
  Object.assign(externalNodes, pluginExternalNodes);
293
294
  }
294
- let projects;
295
295
  try {
296
- projects = readProjectConfigurationsFromRootMap(projectRootMap);
296
+ // We still call this just to assert that the root map
297
+ // only contains valid project names. This is a safety check.
298
+ //
299
+ // The signature itself can't be changed as we need it to return
300
+ // project configurations for use in devkit.
301
+ readProjectConfigurationsFromRootMap(projectRootMap);
297
302
  }
298
303
  catch (e) {
299
304
  if ((0, error_types_1.isProjectsWithNoNameError)(e) ||
300
305
  (0, error_types_1.isProjectsWithConflictingNamesError)(e)) {
301
- projects = e.projects;
302
306
  errors.push(e);
303
307
  }
304
308
  else {
@@ -312,18 +316,20 @@ plugins) {
312
316
  perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
313
317
  if (errors.length === 0) {
314
318
  return {
315
- projects,
319
+ projects: projectRootMap,
316
320
  externalNodes,
317
321
  projectRootMap: rootMap,
318
322
  sourceMaps: configurationSourceMaps,
323
+ matchingProjectFiles: projectFiles,
319
324
  };
320
325
  }
321
326
  else {
322
327
  throw new error_types_1.ProjectConfigurationsError(errors, {
323
- projects,
328
+ projects: projectRootMap,
324
329
  externalNodes,
325
330
  projectRootMap: rootMap,
326
331
  sourceMaps: configurationSourceMaps,
332
+ matchingProjectFiles: projectFiles,
327
333
  });
328
334
  }
329
335
  });
@@ -336,7 +342,8 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
336
342
  // to provide better error messaging.
337
343
  const conflicts = new Map();
338
344
  const projectRootsWithNoName = [];
339
- for (const [root, configuration] of projectRootMap.entries()) {
345
+ for (const root in projectRootMap) {
346
+ const configuration = projectRootMap[root];
340
347
  // We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
341
348
  // Strip it before returning configuration for usage.
342
349
  if (configuration['// targets'])
@@ -388,7 +395,7 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
388
395
  const { configurations: defaultConfigurations, options: defaultOptions, ...baseTargetProperties } = baseTarget ?? {};
389
396
  // Target is "compatible", e.g. executor is defined only once or is the same
390
397
  // in both places. This means that it is likely safe to merge
391
- const isCompatible = isCompatibleTarget(baseTargetProperties, target);
398
+ const isCompatible = isCompatibleTarget(baseTarget ?? {}, target);
392
399
  // If the targets are not compatible, we would normally overwrite the old target
393
400
  // with the new one. However, we have a special case for targets that have the
394
401
  // ONLY_MODIFIES_EXISTING_TARGET symbol set. This prevents the merged target
@@ -544,7 +551,8 @@ function readTargetDefaultsForTarget(targetName, targetDefaults, executor) {
544
551
  exports.readTargetDefaultsForTarget = readTargetDefaultsForTarget;
545
552
  function createRootMap(projectRootMap) {
546
553
  const map = {};
547
- for (const [projectRoot, { name: projectName }] of projectRootMap) {
554
+ for (const projectRoot in projectRootMap) {
555
+ const projectName = projectRootMap[projectRoot].name;
548
556
  map[projectRoot] = projectName;
549
557
  }
550
558
  return map;
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
9
9
  * @param nxJson
10
10
  */
11
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("../file-utils").FileData[];
12
+ allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("../../native").FileData[];
15
+ nonProjectFiles: import("nx/src/native").FileData[];
16
16
  };
17
- rustReferences: import("../../native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
@@ -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();
@@ -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();
@@ -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) {
@@ -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);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This function transforms an error into an object which can be properly serialized and deserialized to be sent between processes.
3
+ */
4
+ export declare function createSerializableError<T extends Error>(error: T): T;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSerializableError = void 0;
4
+ /**
5
+ * This function transforms an error into an object which can be properly serialized and deserialized to be sent between processes.
6
+ */
7
+ function createSerializableError(error) {
8
+ const res = {};
9
+ Object.getOwnPropertyNames(error).forEach((k) => {
10
+ let value = error[k];
11
+ // If an error has an error as a property such as cause, it will be transformed into a serializable error
12
+ if (typeof value === 'object' && value instanceof Error) {
13
+ value = createSerializableError(value);
14
+ }
15
+ // If an error has an array of errors as a property, they will be transformed into serializable errors
16
+ if (Array.isArray(value)) {
17
+ value = value.map((v) => {
18
+ if (typeof v === 'object' && v instanceof Error) {
19
+ return createSerializableError(v);
20
+ }
21
+ return v;
22
+ });
23
+ }
24
+ res[k] = value;
25
+ });
26
+ return res;
27
+ }
28
+ exports.createSerializableError = createSerializableError;