nx 23.2.0-beta.0 → 23.2.0-beta.2

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 (59) hide show
  1. package/dist/bin/nx.js +1 -1
  2. package/dist/src/analytics/analytics.d.ts +6 -0
  3. package/dist/src/analytics/analytics.js +7 -1
  4. package/dist/src/analytics/index.d.ts +1 -1
  5. package/dist/src/analytics/index.js +2 -1
  6. package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
  7. package/dist/src/command-line/init/ai-agent-prompts.js +7 -6
  8. package/dist/src/command-line/init/command-object.js +10 -2
  9. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
  10. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +3 -0
  11. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +4 -1
  12. package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
  13. package/dist/src/command-line/migrate/execute-migration.js +389 -0
  14. package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
  15. package/dist/src/command-line/migrate/migrate.d.ts +1 -45
  16. package/dist/src/command-line/migrate/migrate.js +17 -375
  17. package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
  18. package/dist/src/command-line/release/utils/release-graph.d.ts +2 -2
  19. package/dist/src/command-line/release/utils/shared.d.ts +2 -2
  20. package/dist/src/command-line/show/show-target/inputs.js +50 -153
  21. package/dist/src/command-line/show/show-target/outputs.js +48 -173
  22. package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
  23. package/dist/src/command-line/show/show-target/utils.js +83 -3
  24. package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  25. package/dist/src/commands-runner/create-command-graph.js +5 -0
  26. package/dist/src/config/nx-json.d.ts +1 -1
  27. package/dist/src/core/graph/main.js +1 -1
  28. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  29. package/dist/src/daemon/server/server.js +7 -4
  30. package/dist/src/devkit-internals.d.ts +1 -0
  31. package/dist/src/devkit-internals.js +5 -2
  32. package/dist/src/generators/utils/nx-json.js +13 -3
  33. package/dist/src/hasher/check-task-files.d.ts +86 -0
  34. package/dist/src/hasher/check-task-files.js +378 -0
  35. package/dist/src/native/index.d.ts +25 -2
  36. package/dist/src/native/native-bindings.js +2 -0
  37. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  38. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  39. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -0
  40. package/dist/src/project-graph/build-project-graph.js +7 -1
  41. package/dist/src/project-graph/file-utils.js +6 -1
  42. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
  43. package/dist/src/project-graph/project-graph.js +3 -0
  44. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  45. package/dist/src/tasks-runner/life-cycle.js +2 -2
  46. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +9 -4
  47. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
  48. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +16 -8
  49. package/dist/src/tasks-runner/life-cycles/performance-report.js +55 -27
  50. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  51. package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
  52. package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -1
  53. package/dist/src/tasks-runner/task-orchestrator.js +23 -6
  54. package/dist/src/utils/acknowledge-build-scripts.js +7 -5
  55. package/dist/src/utils/command-line-utils.js +30 -20
  56. package/dist/src/utils/git-revision.d.ts +12 -0
  57. package/dist/src/utils/git-revision.js +25 -0
  58. package/dist/src/utils/package-manager.js +6 -2
  59. package/package.json +11 -11
@@ -19,6 +19,7 @@ exports.stopMigration = stopMigration;
19
19
  const child_process_1 = require("child_process");
20
20
  const fs_1 = require("fs");
21
21
  const path_1 = require("path");
22
+ const git_revision_1 = require("../../utils/git-revision");
22
23
  const migrate_1 = require("./migrate");
23
24
  Object.defineProperty(exports, "isHybridMigration", { enumerable: true, get: function () { return migrate_1.isHybridMigration; } });
24
25
  Object.defineProperty(exports, "isPromptOnlyMigration", { enumerable: true, get: function () { return migrate_1.isPromptOnlyMigration; } });
@@ -51,6 +52,9 @@ function finishMigrationProcess(workspacePath, squashCommits, commitMessage) {
51
52
  const migrationsJsonPath = (0, path_1.join)(workspacePath, 'migrations.json');
52
53
  const parsedMigrationsJson = JSON.parse((0, fs_1.readFileSync)(migrationsJsonPath, 'utf-8'));
53
54
  const initialGitRef = parsedMigrationsJson['nx-console'].initialGitRef;
55
+ if (squashCommits && initialGitRef) {
56
+ (0, git_revision_1.assertValidGitSha)(initialGitRef.ref);
57
+ }
54
58
  if ((0, fs_1.existsSync)(migrationsJsonPath)) {
55
59
  (0, fs_1.rmSync)(migrationsJsonPath);
56
60
  }
@@ -59,24 +63,24 @@ function finishMigrationProcess(workspacePath, squashCommits, commitMessage) {
59
63
  encoding: 'utf-8',
60
64
  windowsHide: true,
61
65
  });
62
- (0, child_process_1.execSync)(`git commit -m "${commitMessage}" --no-verify`, {
63
- cwd: workspacePath,
64
- encoding: 'utf-8',
65
- windowsHide: true,
66
- });
66
+ commit(workspacePath, commitMessage);
67
67
  if (squashCommits && initialGitRef) {
68
- (0, child_process_1.execSync)(`git reset --soft ${initialGitRef.ref}`, {
69
- cwd: workspacePath,
70
- encoding: 'utf-8',
71
- windowsHide: true,
72
- });
73
- (0, child_process_1.execSync)(`git commit -m "${commitMessage}" --no-verify`, {
68
+ (0, child_process_1.execFileSync)('git', ['reset', '--soft', initialGitRef.ref], {
74
69
  cwd: workspacePath,
75
70
  encoding: 'utf-8',
76
71
  windowsHide: true,
77
72
  });
73
+ commit(workspacePath, commitMessage);
78
74
  }
79
75
  }
76
+ function commit(workspacePath, commitMessage) {
77
+ (0, child_process_1.execSync)('git commit --no-verify -F -', {
78
+ cwd: workspacePath,
79
+ encoding: 'utf-8',
80
+ windowsHide: true,
81
+ input: commitMessage,
82
+ });
83
+ }
80
84
  async function runSingleMigration(workspacePath, migration, configuration) {
81
85
  try {
82
86
  // Set current migration tracking
@@ -342,7 +346,8 @@ function undoMigration(workspacePath, id) {
342
346
  // `existing.ref` is the unmodified HEAD at run time, so `ref^` would
343
347
  // reset past unrelated history. Only flip the metadata to skipped.
344
348
  if (existing.changedFiles.length > 0) {
345
- (0, child_process_1.execSync)(`git reset --hard ${existing.ref}^`, {
349
+ (0, git_revision_1.assertValidGitSha)(existing.ref);
350
+ (0, child_process_1.execFileSync)('git', ['reset', '--hard', `${existing.ref}^`], {
346
351
  cwd: workspacePath,
347
352
  encoding: 'utf-8',
348
353
  windowsHide: true,
@@ -1,6 +1,5 @@
1
1
  import { MigrationsJson, PackageJsonUpdateForPackage as PackageUpdate } from '../../config/misc-interfaces';
2
2
  import { NxJsonConfiguration } from '../../config/nx-json';
3
- import { FileChange } from '../../generators/tree';
4
3
  import { ArrayPackageGroup, PackageJson } from '../../utils/package-json';
5
4
  import { PackageManagerCommands } from '../../utils/package-manager';
6
5
  import { type MigrateFetchStats, type MigrateMultiMajorChoice } from './migrate-analytics';
@@ -10,6 +9,7 @@ import type { ResolvedAgentic } from './agentic/types';
10
9
  import { isHybridMigration, isPromptOnlyMigration } from './migration-shape';
11
10
  import { filterDowngradedUpdates } from './update-filters';
12
11
  import { normalizeVersion } from './version-utils';
12
+ export * from './execute-migration';
13
13
  export { normalizeVersion };
14
14
  export interface ResolvedMigrationConfiguration extends MigrationsJson {
15
15
  packageGroup?: ArrayPackageGroup;
@@ -174,14 +174,6 @@ export declare function createFetcher(pmc: PackageManagerCommands): ((pkg: strin
174
174
  };
175
175
  export { filterDowngradedUpdates };
176
176
  export declare function generateMigrationsJsonAndUpdatePackageJson(root: string, opts: GenerateMigrations, fetch?: MigratorOptions['fetch']): Promise<void>;
177
- /**
178
- * Detects npm peer-dependency resolution failures. Keyed on the `ERESOLVE`
179
- * error code, which npm consistently emits for this class of failure across
180
- * v7+ (`npm ERR! code ERESOLVE` / `npm error code ERESOLVE`). Falls back to a
181
- * small set of stable phrases in case the code line is missing from the
182
- * captured output.
183
- */
184
- export declare function isNpmPeerDepsError(stderr: string): boolean;
185
177
  type ExecutableMigration = {
186
178
  package: string;
187
179
  name: string;
@@ -253,46 +245,10 @@ export declare function executeMigrations(root: string, migrations: ExecutableMi
253
245
  committedShasCount: number;
254
246
  retainedAtSuccess: string[];
255
247
  }>;
256
- export declare class ChangedDepInstaller {
257
- private readonly root;
258
- private readonly shouldSkipInstall;
259
- private initialDeps;
260
- private _skippedInstall;
261
- constructor(root: string, shouldSkipInstall?: boolean);
262
- get skippedInstall(): boolean;
263
- installDepsIfChanged(): Promise<void>;
264
- }
265
- export declare function runNxOrAngularMigration(root: string, migration: {
266
- package: string;
267
- name: string;
268
- description?: string;
269
- version: string;
270
- }, isVerbose: boolean, captureGeneratorOutput?: boolean, resolvedCollection?: {
271
- collection: MigrationsJson;
272
- collectionPath: string;
273
- }): Promise<{
274
- changes: FileChange[];
275
- nextSteps: string[];
276
- agentContext: string[];
277
- logs: string;
278
- madeChanges: boolean;
279
- }>;
280
- export declare function parseMigrationReturn(value: unknown): {
281
- nextSteps: string[];
282
- agentContext: string[];
283
- };
284
248
  export declare function migrate(root: string, args: {
285
249
  [k: string]: any;
286
250
  }, rawArgs: string[]): Promise<number>;
287
251
  export declare function runMigration(): Promise<number>;
288
- export declare function readMigrationCollection(packageName: string, root: string): {
289
- collection: MigrationsJson;
290
- collectionPath: string;
291
- };
292
- export declare function getImplementationPath(collection: MigrationsJson, collectionPath: string, name: string, migrationVersion?: string): {
293
- path: string;
294
- fnSymbol: string;
295
- };
296
252
  /**
297
253
  * Resolves a migration's collection once and derives everything the run loop
298
254
  * needs from that single read: the implementation context (`collection` +