nx 21.0.0-canary.20250426-da4f55b → 21.0.0-canary.20250429-cf4a1f3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "21.0.0-canary.20250426-da4f55b",
3
+ "version": "21.0.0-canary.20250429-cf4a1f3",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -83,16 +83,16 @@
83
83
  }
84
84
  },
85
85
  "optionalDependencies": {
86
- "@nx/nx-darwin-arm64": "21.0.0-canary.20250426-da4f55b",
87
- "@nx/nx-darwin-x64": "21.0.0-canary.20250426-da4f55b",
88
- "@nx/nx-freebsd-x64": "21.0.0-canary.20250426-da4f55b",
89
- "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250426-da4f55b",
90
- "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250426-da4f55b",
91
- "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250426-da4f55b",
92
- "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250426-da4f55b",
93
- "@nx/nx-linux-x64-musl": "21.0.0-canary.20250426-da4f55b",
94
- "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250426-da4f55b",
95
- "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250426-da4f55b"
86
+ "@nx/nx-darwin-arm64": "21.0.0-canary.20250429-cf4a1f3",
87
+ "@nx/nx-darwin-x64": "21.0.0-canary.20250429-cf4a1f3",
88
+ "@nx/nx-freebsd-x64": "21.0.0-canary.20250429-cf4a1f3",
89
+ "@nx/nx-linux-arm-gnueabihf": "21.0.0-canary.20250429-cf4a1f3",
90
+ "@nx/nx-linux-arm64-gnu": "21.0.0-canary.20250429-cf4a1f3",
91
+ "@nx/nx-linux-arm64-musl": "21.0.0-canary.20250429-cf4a1f3",
92
+ "@nx/nx-linux-x64-gnu": "21.0.0-canary.20250429-cf4a1f3",
93
+ "@nx/nx-linux-x64-musl": "21.0.0-canary.20250429-cf4a1f3",
94
+ "@nx/nx-win32-arm64-msvc": "21.0.0-canary.20250429-cf4a1f3",
95
+ "@nx/nx-win32-x64-msvc": "21.0.0-canary.20250429-cf4a1f3"
96
96
  },
97
97
  "nx-migrations": {
98
98
  "migrations": "./migrations.json",
@@ -18,6 +18,17 @@ exports.NxAngularJsonPlugin = {
18
18
  projects: readAngularJson(ctx.workspaceRoot),
19
19
  }),
20
20
  ],
21
+ createNodesV2: [
22
+ 'angular.json',
23
+ (f, _, ctx) => [
24
+ [
25
+ 'angular.json',
26
+ {
27
+ projects: readAngularJson(ctx.workspaceRoot),
28
+ },
29
+ ],
30
+ ],
31
+ ],
21
32
  };
22
33
  exports.default = exports.NxAngularJsonPlugin;
23
34
  function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
Binary file
@@ -1,4 +1,5 @@
1
- import { CreateDependencies, CreateNodes } from '../../project-graph/plugins';
1
+ import { CreateDependencies, CreateNodes, CreateNodesV2 } from '../../project-graph/plugins';
2
2
  export declare const name = "nx/js/dependencies-and-lockfile";
3
+ export declare const createNodesV2: CreateNodesV2;
3
4
  export declare const createNodes: CreateNodes;
4
5
  export declare const createDependencies: CreateDependencies;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDependencies = exports.createNodes = exports.name = void 0;
3
+ exports.createDependencies = exports.createNodes = exports.createNodesV2 = exports.name = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
6
  const perf_hooks_1 = require("perf_hooks");
7
7
  const cache_directory_1 = require("../../utils/cache-directory");
8
8
  const globs_1 = require("../../utils/globs");
9
+ const plugins_1 = require("../../project-graph/plugins");
9
10
  const lock_file_1 = require("./lock-file/lock-file");
10
11
  const build_dependencies_1 = require("./project-graph/build-dependencies/build-dependencies");
11
12
  const config_1 = require("./utils/config");
@@ -16,6 +17,12 @@ const versions_1 = require("../../utils/versions");
16
17
  const child_process_1 = require("child_process");
17
18
  exports.name = 'nx/js/dependencies-and-lockfile';
18
19
  let parsedLockFile = {};
20
+ exports.createNodesV2 = [
21
+ (0, globs_1.combineGlobPatterns)(lock_file_1.LOCKFILES),
22
+ (files, _, context) => {
23
+ return (0, plugins_1.createNodesFromFiles)(exports.createNodes[1], files, _, context);
24
+ },
25
+ ];
19
26
  exports.createNodes = [
20
27
  // Look for all lockfiles
21
28
  (0, globs_1.combineGlobPatterns)(lock_file_1.LOCKFILES),
@@ -2,18 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHoistedPackageVersion = getHoistedPackageVersion;
4
4
  exports.normalizePackageJson = normalizePackageJson;
5
- const fs_1 = require("fs");
6
5
  const workspace_root_1 = require("../../../../utils/workspace-root");
6
+ const fileutils_1 = require("../../../../utils/fileutils");
7
7
  /**
8
8
  * Get version of hoisted package if available
9
9
  */
10
10
  function getHoistedPackageVersion(packageName) {
11
11
  const fullPath = `${workspace_root_1.workspaceRoot}/node_modules/${packageName}/package.json`;
12
- if ((0, fs_1.existsSync)(fullPath)) {
13
- const content = (0, fs_1.readFileSync)(fullPath, 'utf-8');
14
- return JSON.parse(content)?.version;
12
+ try {
13
+ return (0, fileutils_1.readJsonFile)(fullPath)?.version;
14
+ }
15
+ catch (e) {
16
+ return;
15
17
  }
16
- return;
17
18
  }
18
19
  /**
19
20
  * Strip off non-pruning related fields from package.json
@@ -9,7 +9,7 @@ exports.usesLeadingDash = usesLeadingDash;
9
9
  exports.loadPnpmHoistedDepsDefinition = loadPnpmHoistedDepsDefinition;
10
10
  exports.parseAndNormalizePnpmLockfile = parseAndNormalizePnpmLockfile;
11
11
  exports.stringifyToPnpmYaml = stringifyToPnpmYaml;
12
- const fs_1 = require("fs");
12
+ const node_fs_1 = require("node:fs");
13
13
  const semver_1 = require("semver");
14
14
  const workspace_root_1 = require("../../../../utils/workspace-root");
15
15
  const file_hasher_1 = require("../../../../hasher/file-hasher");
@@ -31,8 +31,8 @@ function usesLeadingDash(data) {
31
31
  }
32
32
  function loadPnpmHoistedDepsDefinition() {
33
33
  const fullPath = `${workspace_root_1.workspaceRoot}/node_modules/.modules.yaml`;
34
- if ((0, fs_1.existsSync)(fullPath)) {
35
- const content = (0, fs_1.readFileSync)(fullPath, 'utf-8');
34
+ if ((0, node_fs_1.existsSync)(fullPath)) {
35
+ const content = (0, node_fs_1.readFileSync)(fullPath, 'utf-8');
36
36
  const { load } = require('@zkochan/js-yaml');
37
37
  return load(content)?.hoistedDependencies ?? {};
38
38
  }
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoadedNxPlugin = void 0;
4
4
  const error_types_1 = require("../error-types");
5
- const utils_1 = require("./utils");
6
5
  const enabled_1 = require("./isolation/enabled");
7
6
  const client_1 = require("../../daemon/client/client");
8
7
  class LoadedNxPlugin {
@@ -14,10 +13,7 @@ class LoadedNxPlugin {
14
13
  this.exclude = pluginDefinition.exclude;
15
14
  }
16
15
  if (plugin.createNodes && !plugin.createNodesV2) {
17
- this.createNodes = [
18
- plugin.createNodes[0],
19
- (configFiles, context) => (0, utils_1.createNodesFromFiles)(plugin.createNodes[1], configFiles, this.options, context).then((results) => results.map((r) => [this.name, r[0], r[1]])),
20
- ];
16
+ throw new Error(`Plugin ${plugin.name} only provides \`createNodes\` which was removed in Nx 21, it should provide a \`createNodesV2\` implementation.`);
21
17
  }
22
18
  if (plugin.createNodesV2) {
23
19
  this.createNodes = [
@@ -194,6 +194,13 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
194
194
  }
195
195
  return {
196
196
  lifeCycle: new life_cycle_1.CompositeLifeCycle(lifeCycles),
197
+ restoreTerminal: () => {
198
+ process.stdout.write = originalStdoutWrite;
199
+ process.stderr.write = originalStderrWrite;
200
+ console.log = originalConsoleLog;
201
+ console.error = originalConsoleError;
202
+ restoreTerminal();
203
+ },
197
204
  printSummary,
198
205
  renderIsDone,
199
206
  };
@@ -289,24 +296,32 @@ async function runCommandForTasks(projectsToRun, currentProjectGraph, { nxJson }
289
296
  const tasks = Object.values(taskGraph.tasks);
290
297
  const initiatingTasks = tasks.filter((t) => projectNameSet.has(t.target.project) &&
291
298
  nxArgs.targets.includes(t.target.target));
292
- const { lifeCycle, renderIsDone, printSummary } = await getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides);
293
- const taskResults = await invokeTasksRunner({
294
- tasks,
295
- projectGraph,
296
- taskGraph,
297
- lifeCycle,
298
- nxJson,
299
- nxArgs,
300
- loadDotEnvFiles: extraOptions.loadDotEnvFiles,
301
- initiatingProject,
302
- initiatingTasks,
303
- });
304
- await renderIsDone;
305
- if (printSummary) {
306
- printSummary();
299
+ const { lifeCycle, renderIsDone, printSummary, restoreTerminal } = await getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, projectNames, tasks, taskGraph, nxArgs, nxJson, overrides);
300
+ try {
301
+ const taskResults = await invokeTasksRunner({
302
+ tasks,
303
+ projectGraph,
304
+ taskGraph,
305
+ lifeCycle,
306
+ nxJson,
307
+ nxArgs,
308
+ loadDotEnvFiles: extraOptions.loadDotEnvFiles,
309
+ initiatingProject,
310
+ initiatingTasks,
311
+ });
312
+ await renderIsDone;
313
+ if (printSummary) {
314
+ printSummary();
315
+ }
316
+ await (0, nx_key_1.printNxKey)();
317
+ return taskResults;
318
+ }
319
+ catch (e) {
320
+ if (restoreTerminal) {
321
+ restoreTerminal();
322
+ }
323
+ throw e;
307
324
  }
308
- await (0, nx_key_1.printNxKey)();
309
- return taskResults;
310
325
  }
311
326
  async function ensureWorkspaceIsInSyncAndGetGraphs(projectGraph, nxJson, projectNames, nxArgs, overrides, extraTargetDependencies, extraOptions) {
312
327
  let taskGraph = createTaskGraphAndRunValidations(projectGraph, extraTargetDependencies ?? {}, projectNames, nxArgs, overrides, extraOptions);
@@ -421,6 +421,9 @@ class TaskOrchestrator {
421
421
  const runningTask = new shared_running_task_1.SharedRunningTask(this.runningTasksService, task.id);
422
422
  this.runningContinuousTasks.set(task.id, runningTask);
423
423
  runningTask.onExit(() => {
424
+ if (this.tuiEnabled) {
425
+ this.options.lifeCycle.setTaskStatus(task.id, 9 /* NativeTaskStatus.Stopped */);
426
+ }
424
427
  this.runningContinuousTasks.delete(task.id);
425
428
  });
426
429
  // task is already running by another process, we schedule the next tasks
@@ -457,6 +460,9 @@ class TaskOrchestrator {
457
460
  this.runningTasksService.addRunningTask(task.id);
458
461
  this.runningContinuousTasks.set(task.id, childProcess);
459
462
  childProcess.onExit(() => {
463
+ if (this.tuiEnabled) {
464
+ this.options.lifeCycle.setTaskStatus(task.id, 9 /* NativeTaskStatus.Stopped */);
465
+ }
460
466
  this.runningTasksService.removeRunningTask(task.id);
461
467
  this.runningContinuousTasks.delete(task.id);
462
468
  });