nx 23.2.0-beta.4 → 23.2.0-beta.5

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 (81) hide show
  1. package/dist/bin/nx.js +1 -0
  2. package/dist/src/command-line/affected/affected.js +1 -0
  3. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
  4. package/dist/src/command-line/init/init-v2.js +2 -2
  5. package/dist/src/command-line/migrate/agentic/definitions.js +2 -2
  6. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +15 -19
  7. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +19 -31
  8. package/dist/src/command-line/migrate/agentic/handoff.d.ts +4 -6
  9. package/dist/src/command-line/migrate/agentic/handoff.js +9 -8
  10. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
  11. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
  12. package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
  13. package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
  14. package/dist/src/command-line/migrate/agentic/select.js +10 -2
  15. package/dist/src/command-line/migrate/agentic/types.d.ts +17 -3
  16. package/dist/src/command-line/migrate/agentic/types.js +26 -0
  17. package/dist/src/command-line/migrate/command-object.d.ts +3 -0
  18. package/dist/src/command-line/migrate/command-object.js +6 -1
  19. package/dist/src/command-line/migrate/execute-migration.d.ts +14 -9
  20. package/dist/src/command-line/migrate/execute-migration.js +82 -18
  21. package/dist/src/command-line/migrate/migrate-analytics.d.ts +7 -0
  22. package/dist/src/command-line/migrate/migrate-analytics.js +14 -0
  23. package/dist/src/command-line/migrate/migrate-commits.d.ts +32 -8
  24. package/dist/src/command-line/migrate/migrate-commits.js +77 -9
  25. package/dist/src/command-line/migrate/migrate-config.d.ts +11 -12
  26. package/dist/src/command-line/migrate/migrate-config.js +14 -14
  27. package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
  28. package/dist/src/command-line/migrate/migrate-output.js +52 -8
  29. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  30. package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
  31. package/dist/src/command-line/migrate/migrate.d.ts +17 -68
  32. package/dist/src/command-line/migrate/migrate.js +385 -220
  33. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  34. package/dist/src/command-line/migrate/run/index.d.ts +2 -0
  35. package/dist/src/command-line/migrate/run/index.js +5 -0
  36. package/dist/src/command-line/migrate/run/util.d.ts +1 -0
  37. package/dist/src/command-line/migrate/run/util.js +16 -0
  38. package/dist/src/command-line/migrate/run/worker.d.ts +15 -0
  39. package/dist/src/command-line/migrate/run/worker.js +419 -0
  40. package/dist/src/command-line/migrate/run-migration-process.js +6 -5
  41. package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
  42. package/dist/src/command-line/migrate/sort-migrations.js +32 -0
  43. package/dist/src/command-line/migrate/version-skew-guard.d.ts +59 -0
  44. package/dist/src/command-line/migrate/version-skew-guard.js +156 -0
  45. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
  46. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
  47. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
  48. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
  49. package/dist/src/command-line/nx-commands.js +26 -24
  50. package/dist/src/command-line/release/changelog.js +5 -0
  51. package/dist/src/command-line/release/utils/git.js +1 -1
  52. package/dist/src/command-line/release/utils/release-graph.d.ts +1 -0
  53. package/dist/src/command-line/release/utils/release-graph.js +15 -3
  54. package/dist/src/command-line/release/version/version-actions.d.ts +8 -0
  55. package/dist/src/command-line/release/version/version-actions.js +8 -0
  56. package/dist/src/command-line/release/version.js +9 -5
  57. package/dist/src/config/misc-interfaces.d.ts +19 -7
  58. package/dist/src/core/graph/main.js +1 -1
  59. package/dist/src/daemon/server/latest-nx.js +5 -2
  60. package/dist/src/devkit-internals.d.ts +91 -2
  61. package/dist/src/devkit-internals.js +181 -3
  62. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +5 -0
  63. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +9 -2
  64. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  65. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  66. package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
  67. package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
  68. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
  69. package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
  70. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +14 -8
  71. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -0
  72. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
  73. package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
  74. package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
  75. package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
  76. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
  77. package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
  78. package/dist/src/tasks-runner/run-command.js +4 -0
  79. package/dist/src/utils/assert-workspace-validity.js +7 -2
  80. package/dist/src/utils/child-process.js +2 -0
  81. package/package.json +12 -12
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MEANINGFUL_OVERHEAD = exports.MIN_RECOMMENDATION_RUN_DURATION = void 0;
4
+ exports.prefetchRemoteCacheOnboardingUrl = prefetchRemoteCacheOnboardingUrl;
4
5
  exports.recommendationToPayloadString = recommendationToPayloadString;
5
6
  exports.buildRecommendations = buildRecommendations;
6
7
  exports.formatReport = formatReport;
@@ -8,14 +9,72 @@ exports.formatReportMarkdown = formatReportMarkdown;
8
9
  exports.buildExitSummaryPayload = buildExitSummaryPayload;
9
10
  const native_1 = require("../../native");
10
11
  const terminal_link_1 = require("../../utils/terminal-link");
12
+ const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
13
+ const url_shorten_1 = require("../../nx-cloud/utilities/url-shorten");
14
+ const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
15
+ const git_utils_1 = require("../../utils/git-utils");
16
+ const logger_1 = require("../../utils/logger");
11
17
  const NX_AGENTS_URL = 'https://nx.dev/ci/features/distribute-task-execution';
12
- const NX_REMOTE_CACHE_URL = 'https://nx.dev/ci/features/remote-cache';
18
+ // Fallback for the remote-cache CTA when the short onboarding URL can't be
19
+ // fetched: the generic Cloud get-started page (still drives to onboarding).
20
+ const NX_CLOUD_GET_STARTED_URL = 'https://cloud.nx.app/get-started';
13
21
  const NX_PERFORMANCE_URL = 'https://nx.dev/docs/concepts/ci-concepts/parallelization-distribution';
14
22
  /** utm tag attributing report clicks back to it; the content names the CTA clicked. */
15
23
  const utm = (content) => `?utm_source=nx-cli&utm_medium=cli&utm_campaign=performance-report&utm_content=${content}`;
16
24
  const NX_PERFORMANCE_LINK = `${NX_PERFORMANCE_URL}${utm('parallelization')}`;
17
25
  const NX_AGENTS_LINK = `${NX_AGENTS_URL}${utm('nx-agents')}`;
18
- const NX_REMOTE_CACHE_LINK = `${NX_REMOTE_CACHE_URL}${utm('remote-cache')}`;
26
+ const NX_REMOTE_CACHE_LINK = `${NX_CLOUD_GET_STARTED_URL}${utm('remote-cache')}`;
27
+ // Defaults to the get-started link; a disconnected workspace gets a short Nx
28
+ // Cloud onboarding URL instead (see prefetchRemoteCacheOnboardingUrl).
29
+ let remoteCacheLink = NX_REMOTE_CACHE_LINK;
30
+ // Give up on the short URL after this long so a slow/hung Cloud API never
31
+ // lingers past the exit report. Covers two sequential round trips (features
32
+ // GET, onboarding POST); the 30s CTA floor leaves room. Timing out also aborts
33
+ // the request - Promise.race alone would leave the socket holding the event
34
+ // loop open, which strands programmatic callers that never process.exit.
35
+ const ONBOARDING_URL_TIMEOUT = 5000;
36
+ /**
37
+ * Point the remote-cache CTA at a short Nx Cloud onboarding URL for a
38
+ * disconnected GitHub workspace - the VCS flow where Cloud opens the nx.json PR.
39
+ * Non-GitHub remotes keep the get-started link (handles every provider) and skip
40
+ * the network entirely. Runs in CI too - terminal + job summary.
41
+ *
42
+ * Best-effort: the get-started link stays on failure/timeout. Fired at run start;
43
+ * the CTA needs a >30s run (MIN_RECOMMENDATION_RUN_DURATION), so the fetch
44
+ * always resolves first.
45
+ */
46
+ async function prefetchRemoteCacheOnboardingUrl(nxJson) {
47
+ if ((0, nx_cloud_utils_1.isNxCloudDisabled)(nxJson) || (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
48
+ return;
49
+ }
50
+ if ((0, git_utils_1.getVcsRemoteInfo)()?.domain !== 'github.com') {
51
+ return;
52
+ }
53
+ const abortController = new AbortController();
54
+ try {
55
+ const url = await Promise.race([
56
+ (0, url_shorten_1.createNxCloudOnboardingURL)('nx-cli-perf-report', undefined, undefined, false, false, undefined, abortController.signal),
57
+ new Promise((resolve) => {
58
+ // unref so the pending timer never keeps the CLI alive on its own.
59
+ setTimeout(() => {
60
+ abortController.abort();
61
+ resolve(null);
62
+ }, ONBOARDING_URL_TIMEOUT).unref();
63
+ }),
64
+ ]);
65
+ // createNxCloudOnboardingURL never throws - on an unreachable API it returns a
66
+ // paste-a-token URL (accessToken=undefined). Only accept a real short link.
67
+ if (url?.startsWith(`${(0, get_cloud_options_1.getCloudUrl)()}/connect/`)) {
68
+ remoteCacheLink = url;
69
+ }
70
+ else {
71
+ logger_1.logger.verbose(`Keeping the get-started remote-cache link (${url === null ? 'onboarding URL timed out' : `got: ${url}`})`);
72
+ }
73
+ }
74
+ catch (e) {
75
+ logger_1.logger.verbose(`Keeping the get-started remote-cache link: ${e}`);
76
+ }
77
+ }
19
78
  /**
20
79
  * Whole-phrase CTA: the whole sentence is the link. The Rust TUI popup keeps no
21
80
  * copy of this string; it gets the phrase + href from the exit payload's `links`.
@@ -176,7 +235,7 @@ const RECOMMENDATIONS = [
176
235
  c.cacheableCount > 0 &&
177
236
  !c.remoteCacheEnabled &&
178
237
  c.cacheHits / c.cacheableCount <= LOW_CACHE_HIT_RATE,
179
- build: () => [phraseLink(NX_REMOTE_CACHE_CTA, NX_REMOTE_CACHE_LINK), `.`],
238
+ build: () => [phraseLink(NX_REMOTE_CACHE_CTA, remoteCacheLink), `.`],
180
239
  },
181
240
  {
182
241
  // Cache skipped: drop the flag to restore unchanged tasks instantly.
@@ -39,6 +39,7 @@ const store_run_information_life_cycle_1 = require("./life-cycles/store-run-info
39
39
  const task_history_life_cycle_1 = require("./life-cycles/task-history-life-cycle");
40
40
  const task_profiling_life_cycle_1 = require("./life-cycles/task-profiling-life-cycle");
41
41
  const performance_life_cycle_1 = require("./life-cycles/performance-life-cycle");
42
+ const performance_report_1 = require("./life-cycles/performance-report");
42
43
  const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
43
44
  const task_telemetry_life_cycle_1 = require("./life-cycles/task-telemetry-life-cycle");
44
45
  const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle");
@@ -80,6 +81,9 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
80
81
  if (tasks.length === 1 && !is_tui_enabled_1.ORIGINAL_TUI_ENV_VALUE) {
81
82
  process.env.NX_TUI = 'false';
82
83
  }
84
+ // Kick off in the background so the URL is ready by the exit report. A brief
85
+ // sync preamble (git remote + axios load) runs here; the network call does not.
86
+ (0, performance_report_1.prefetchRemoteCacheOnboardingUrl)(nxJson);
83
87
  if ((0, is_tui_enabled_1.isTuiEnabled)()) {
84
88
  const interceptedNxCloudLogs = [];
85
89
  // Resolve where the Nx Cloud client bundle actually loads from so the
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertWorkspaceValidity = assertWorkspaceValidity;
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
+ // Import from the defining module, not the devkit-internals barrel: this file
7
+ // is on the project-graph construction path, and the barrel now eagerly
8
+ // re-exports the project-graph modules, which would create a require cycle back
9
+ // through build-project-graph. (Release modules cross the barrel as erased
10
+ // types only — see the note in packages/devkit/internal.ts.)
11
+ const error_types_1 = require("../project-graph/error-types");
7
12
  function assertWorkspaceValidity(projects, nxJson) {
8
13
  const projectNames = Object.keys(projects);
9
14
  const projectGraphNodes = projectNames.reduce((graph, project) => {
@@ -65,7 +70,7 @@ function assertWorkspaceValidity(projects, nxJson) {
65
70
  })
66
71
  .join('\n\n');
67
72
  }
68
- throw new devkit_internals_1.WorkspaceValidityError(message);
73
+ throw new error_types_1.WorkspaceValidityError(message);
69
74
  }
70
75
  function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDeps, projectConfigurations, projects) {
71
76
  const invalidProjectsOrGlobs = desiredImplicitDeps.filter((implicit) => {
@@ -13,6 +13,8 @@ const exit_codes_1 = require("./exit-codes");
13
13
  function getRunNxBaseCommand(packageManagerCommand, cwd = process.cwd()) {
14
14
  if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'))) {
15
15
  if (!packageManagerCommand) {
16
+ // `readLocalNxVersion` (command-line/migrate/migrate.ts) mirrors this
17
+ // selector to predict which nx the spawn will run; keep the two in sync.
16
18
  const pm = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot);
17
19
  packageManagerCommand = (0, package_manager_1.getPackageManagerCommand)(pm, workspace_root_1.workspaceRoot);
18
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "23.2.0-beta.4",
3
+ "version": "23.2.0-beta.5",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
@@ -65,7 +65,7 @@
65
65
  "balanced-match": "4.0.3",
66
66
  "base64-js": "1.5.1",
67
67
  "bl": "4.1.0",
68
- "brace-expansion": "5.0.8",
68
+ "brace-expansion": "5.0.9",
69
69
  "buffer": "5.7.1",
70
70
  "bundle-name": "4.1.0",
71
71
  "call-bind-apply-helpers": "1.0.2",
@@ -181,16 +181,16 @@
181
181
  }
182
182
  },
183
183
  "optionalDependencies": {
184
- "@nx/nx-darwin-arm64": "23.2.0-beta.4",
185
- "@nx/nx-darwin-x64": "23.2.0-beta.4",
186
- "@nx/nx-freebsd-x64": "23.2.0-beta.4",
187
- "@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.4",
188
- "@nx/nx-linux-arm64-gnu": "23.2.0-beta.4",
189
- "@nx/nx-linux-arm64-musl": "23.2.0-beta.4",
190
- "@nx/nx-linux-x64-gnu": "23.2.0-beta.4",
191
- "@nx/nx-linux-x64-musl": "23.2.0-beta.4",
192
- "@nx/nx-win32-arm64-msvc": "23.2.0-beta.4",
193
- "@nx/nx-win32-x64-msvc": "23.2.0-beta.4"
184
+ "@nx/nx-darwin-arm64": "23.2.0-beta.5",
185
+ "@nx/nx-darwin-x64": "23.2.0-beta.5",
186
+ "@nx/nx-freebsd-x64": "23.2.0-beta.5",
187
+ "@nx/nx-linux-arm-gnueabihf": "23.2.0-beta.5",
188
+ "@nx/nx-linux-arm64-gnu": "23.2.0-beta.5",
189
+ "@nx/nx-linux-arm64-musl": "23.2.0-beta.5",
190
+ "@nx/nx-linux-x64-gnu": "23.2.0-beta.5",
191
+ "@nx/nx-linux-x64-musl": "23.2.0-beta.5",
192
+ "@nx/nx-win32-arm64-msvc": "23.2.0-beta.5",
193
+ "@nx/nx-win32-x64-msvc": "23.2.0-beta.5"
194
194
  },
195
195
  "nx-migrations": {
196
196
  "migrations": "./migrations.json",