nx 23.3.0-beta.7 → 23.3.0-beta.8

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 (115) hide show
  1. package/README.md +1 -1
  2. package/dist/nx-cloud-internals.d.ts +1 -1
  3. package/dist/nx-cloud-internals.js +4 -4
  4. package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +6 -2
  5. package/dist/src/command-line/migrate/agentic/master/run-master-session.js +88 -14
  6. package/dist/src/command-line/migrate/command-object.d.ts +1 -0
  7. package/dist/src/command-line/migrate/command-object.js +6 -1
  8. package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
  9. package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
  10. package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
  11. package/dist/src/command-line/migrate/migrate-config.js +19 -11
  12. package/dist/src/command-line/migrate/migrate.d.ts +2 -0
  13. package/dist/src/command-line/migrate/migrate.js +152 -45
  14. package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
  15. package/dist/src/command-line/migrate/run/broker.d.ts +14 -2
  16. package/dist/src/command-line/migrate/run/broker.js +95 -34
  17. package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
  18. package/dist/src/command-line/migrate/run/existing-run-report.js +225 -0
  19. package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
  20. package/dist/src/command-line/migrate/run/give-up.js +148 -0
  21. package/dist/src/command-line/migrate/run/index.d.ts +6 -4
  22. package/dist/src/command-line/migrate/run/index.js +15 -2
  23. package/dist/src/command-line/migrate/run/issues.d.ts +14 -0
  24. package/dist/src/command-line/migrate/run/issues.js +59 -0
  25. package/dist/src/command-line/migrate/run/orchestrator.d.ts +40 -1
  26. package/dist/src/command-line/migrate/run/orchestrator.js +509 -160
  27. package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
  28. package/dist/src/command-line/migrate/run/run-id.js +0 -30
  29. package/dist/src/command-line/migrate/run/run-state.d.ts +11 -9
  30. package/dist/src/command-line/migrate/run/run-state.js +25 -12
  31. package/dist/src/command-line/migrate/run/runbook.js +9 -4
  32. package/dist/src/command-line/migrate/run/state-lock.d.ts +31 -0
  33. package/dist/src/command-line/migrate/run/state-lock.js +126 -0
  34. package/dist/src/command-line/migrate/run/state-machine.d.ts +15 -0
  35. package/dist/src/command-line/migrate/run/state-machine.js +137 -10
  36. package/dist/src/command-line/migrate/run/util.d.ts +1 -0
  37. package/dist/src/command-line/migrate/run/util.js +21 -0
  38. package/dist/src/command-line/migrate/run/worker.js +3 -0
  39. package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
  40. package/dist/src/command-line/migrate/step-actions.js +7 -1
  41. package/dist/src/command-line/migrate/text.d.ts +6 -0
  42. package/dist/src/command-line/migrate/text.js +25 -0
  43. package/dist/src/command-line/release/utils/release-graph.js +1 -1
  44. package/dist/src/command-line/release/utils/remote-release-clients/github.js +2 -5
  45. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +2 -2
  46. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +4 -5
  47. package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
  48. package/dist/src/command-line/reset/reset.js +3 -0
  49. package/dist/src/config/task-graph.d.ts +1 -1
  50. package/dist/src/config/workspace-json-project-json.d.ts +4 -4
  51. package/dist/src/daemon/client/client.d.ts +3 -3
  52. package/dist/src/daemon/client/client.js +4 -4
  53. package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
  54. package/dist/src/daemon/server/handle-hash-tasks.d.ts +2 -2
  55. package/dist/src/daemon/server/handle-hash-tasks.js +3 -3
  56. package/dist/src/daemon/server/handle-select-affected-tasks.js +4 -2
  57. package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
  58. package/dist/src/daemon/server/{io-snapshots-state.js → ultracache-configuration-state.js} +5 -4
  59. package/dist/src/hasher/create-task-hasher.d.ts +3 -3
  60. package/dist/src/hasher/create-task-hasher.js +6 -6
  61. package/dist/src/hasher/hash-task.d.ts +2 -2
  62. package/dist/src/hasher/hash-task.js +5 -5
  63. package/dist/src/hasher/native-task-hasher-impl.d.ts +7 -7
  64. package/dist/src/hasher/native-task-hasher-impl.js +19 -19
  65. package/dist/src/hasher/task-hasher.d.ts +14 -14
  66. package/dist/src/hasher/task-hasher.js +13 -13
  67. package/dist/src/native/index.d.ts +95 -102
  68. package/dist/src/native/native-bindings.js +4 -5
  69. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  70. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  71. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
  72. package/dist/src/nx-cloud/update-manager.d.ts +3 -3
  73. package/dist/src/nx-cloud/update-manager.js +19 -13
  74. package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
  75. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
  76. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
  77. package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
  78. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
  79. package/dist/src/project-graph/affected/affected-tasks.d.ts +11 -10
  80. package/dist/src/project-graph/affected/affected-tasks.js +16 -20
  81. package/dist/src/tasks-runner/init-tasks-runner.d.ts +5 -5
  82. package/dist/src/tasks-runner/init-tasks-runner.js +8 -15
  83. package/dist/src/tasks-runner/run-command.d.ts +7 -7
  84. package/dist/src/tasks-runner/run-command.js +18 -23
  85. package/dist/src/ultracache/config.d.ts +21 -0
  86. package/dist/src/ultracache/config.js +29 -0
  87. package/dist/src/ultracache/fetch.d.ts +21 -0
  88. package/dist/src/{io-snapshots → ultracache}/fetch.js +9 -9
  89. package/dist/src/ultracache/overrides.d.ts +17 -0
  90. package/dist/src/{io-snapshots → ultracache}/overrides.js +14 -13
  91. package/dist/src/ultracache/report.d.ts +13 -0
  92. package/dist/src/{io-snapshots → ultracache}/report.js +15 -21
  93. package/dist/src/ultracache/store.d.ts +40 -0
  94. package/dist/src/{io-snapshots → ultracache}/store.js +45 -45
  95. package/dist/src/utils/ab-testing.js +11 -12
  96. package/dist/src/utils/db-connection.d.ts +1 -0
  97. package/dist/src/utils/db-connection.js +1 -0
  98. package/dist/src/utils/git-utils.d.ts +7 -0
  99. package/dist/src/utils/git-utils.js +21 -9
  100. package/dist/src/utils/http-client.d.ts +27 -0
  101. package/dist/src/utils/http-client.js +193 -0
  102. package/package.json +12 -38
  103. package/dist/src/daemon/message-types/io-snapshot-version.d.ts +0 -5
  104. package/dist/src/daemon/server/io-snapshots-state.d.ts +0 -7
  105. package/dist/src/io-snapshots/config.d.ts +0 -23
  106. package/dist/src/io-snapshots/config.js +0 -32
  107. package/dist/src/io-snapshots/fetch.d.ts +0 -21
  108. package/dist/src/io-snapshots/outputs.d.ts +0 -12
  109. package/dist/src/io-snapshots/outputs.js +0 -33
  110. package/dist/src/io-snapshots/overrides.d.ts +0 -17
  111. package/dist/src/io-snapshots/report.d.ts +0 -13
  112. package/dist/src/io-snapshots/store.d.ts +0 -37
  113. package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
  114. package/dist/src/nx-cloud/utilities/axios.js +0 -17
  115. /package/dist/src/daemon/message-types/{io-snapshot-version.js → ultracache-configuration-version.js} +0 -0
@@ -584,8 +584,6 @@ module.exports.HashPlanner = nativeBinding.HashPlanner
584
584
  module.exports.HttpRemoteCache = nativeBinding.HttpRemoteCache
585
585
  module.exports.IgnoredIndexReader = nativeBinding.IgnoredIndexReader
586
586
  module.exports.ImportResult = nativeBinding.ImportResult
587
- module.exports.IoSnapshots = nativeBinding.IoSnapshots
588
- module.exports.IoSnapshotStore = nativeBinding.IoSnapshotStore
589
587
  module.exports.NxCache = nativeBinding.NxCache
590
588
  module.exports.NxConsolePreferences = nativeBinding.NxConsolePreferences
591
589
  module.exports.NxPluginCapabilities = nativeBinding.NxPluginCapabilities
@@ -596,6 +594,8 @@ module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
596
594
  module.exports.TaskDetails = nativeBinding.TaskDetails
597
595
  module.exports.TaskHasher = nativeBinding.TaskHasher
598
596
  module.exports.TaskInvocationTracker = nativeBinding.TaskInvocationTracker
597
+ module.exports.UltracacheConfigurations = nativeBinding.UltracacheConfigurations
598
+ module.exports.UltracacheConfigurationStore = nativeBinding.UltracacheConfigurationStore
599
599
  module.exports.WorkspaceContext = nativeBinding.WorkspaceContext
600
600
  module.exports.affectedTasks = nativeBinding.affectedTasks
601
601
  module.exports.BatchStatus = nativeBinding.BatchStatus
@@ -618,11 +618,10 @@ module.exports.getDefaultMaxCacheSize = nativeBinding.getDefaultMaxCacheSize
618
618
  module.exports.getEventDimensions = nativeBinding.getEventDimensions
619
619
  module.exports.getFilesForOutputsBatch = nativeBinding.getFilesForOutputsBatch
620
620
  module.exports.getHardcodedIgnorePatterns = nativeBinding.getHardcodedIgnorePatterns
621
- module.exports.getIoSnapshotDeferredTaskIds = nativeBinding.getIoSnapshotDeferredTaskIds
622
- module.exports.getIoSnapshotReport = nativeBinding.getIoSnapshotReport
623
621
  module.exports.getMainWorktreeRoot = nativeBinding.getMainWorktreeRoot
624
- module.exports.getObservedIoSnapshotOutputs = nativeBinding.getObservedIoSnapshotOutputs
625
622
  module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
623
+ module.exports.getUltracacheDeferredTaskIds = nativeBinding.getUltracacheDeferredTaskIds
624
+ module.exports.getUltracacheReport = nativeBinding.getUltracacheReport
626
625
  module.exports.GroupType = nativeBinding.GroupType
627
626
  module.exports.hashArray = nativeBinding.hashArray
628
627
  module.exports.hashFile = nativeBinding.hashFile
Binary file
@@ -11,6 +11,7 @@ const url_shorten_1 = require("../../utilities/url-shorten");
11
11
  const get_cloud_options_1 = require("../../utilities/get-cloud-options");
12
12
  const path_1 = require("path");
13
13
  const git_utils_1 = require("../../../utils/git-utils");
14
+ const http_client_1 = require("../../../utils/http-client");
14
15
  function printCloudConnectionDisabledMessage() {
15
16
  output_1.output.error({
16
17
  title: `Connections to Nx Cloud are disabled for this workspace`,
@@ -46,10 +47,13 @@ function getNxInitDate() {
46
47
  }
47
48
  async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
48
49
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
49
- const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
50
- workspaceName,
51
- installationSource,
52
- nxInitDate,
50
+ const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
51
+ method: 'POST',
52
+ data: {
53
+ workspaceName,
54
+ installationSource,
55
+ nxInitDate,
56
+ },
53
57
  });
54
58
  if (response.data.message) {
55
59
  throw new Error(response.data.message);
@@ -58,10 +62,13 @@ async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxIni
58
62
  }
59
63
  async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {
60
64
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
61
- const response = await require('axios').post(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
62
- workspaceName,
63
- installationSource,
64
- nxInitDate,
65
+ const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/v2/create-org-and-workspace`, {
66
+ method: 'POST',
67
+ data: {
68
+ workspaceName,
69
+ installationSource,
70
+ nxInitDate,
71
+ },
65
72
  });
66
73
  if (response.data.message) {
67
74
  throw new Error(response.data.message);
@@ -1,5 +1,5 @@
1
1
  import type { CloudTaskRunnerOptions } from './nx-cloud-tasks-runner-shell';
2
- import type { ReadIoSnapshotsOptions, ReadIoSnapshotsResult } from '../io-snapshots/fetch';
2
+ import type { ReadUltracacheConfigurationsOptions, ReadUltracacheConfigurationsResult } from '../ultracache/fetch';
3
3
  import { TasksRunner } from '../tasks-runner/tasks-runner';
4
4
  import { RemoteCacheV2 } from '../tasks-runner/default-tasks-runner';
5
5
  export declare class NxCloudEnterpriseOutdatedError extends Error {
@@ -13,8 +13,8 @@ export interface NxCloudClient {
13
13
  commands: Record<string, () => Promise<void>>;
14
14
  nxCloudTasksRunner: TasksRunner<CloudTaskRunnerOptions>;
15
15
  getRemoteCache: () => RemoteCacheV2;
16
- /** Clients that expose I/O snapshots; see `fetchIoSnapshots`. */
17
- readIoSnapshots?: (options: ReadIoSnapshotsOptions) => Promise<ReadIoSnapshotsResult | null>;
16
+ /** Clients that expose Ultracache configurations; see `fetchUltracacheConfigurations`. */
17
+ readUltracacheConfigurations?: (options: ReadUltracacheConfigurationsOptions) => Promise<ReadUltracacheConfigurationsResult | null>;
18
18
  }
19
19
  export declare function verifyOrUpdateNxCloudClient(options?: {
20
20
  url?: string;
@@ -6,9 +6,11 @@ exports.getBundleInstallDefaultLocation = getBundleInstallDefaultLocation;
6
6
  const tslib_1 = require("tslib");
7
7
  const fs_1 = require("fs");
8
8
  const zlib_1 = require("zlib");
9
+ const stream_1 = require("stream");
9
10
  const path_1 = require("path");
10
11
  const os_1 = require("os");
11
- const axios_1 = require("./utilities/axios");
12
+ const nx_cloud_http_client_1 = require("./utilities/nx-cloud-http-client");
13
+ const http_client_1 = require("../utils/http-client");
12
14
  const debug_logger_1 = require("./debug-logger");
13
15
  const tar = tslib_1.__importStar(require("tar-stream"));
14
16
  const cache_directory_1 = require("../utils/cache-directory");
@@ -32,14 +34,14 @@ async function verifyOrUpdateNxCloudClient(options) {
32
34
  const currentBundle = getLatestInstalledRunnerBundle();
33
35
  const apiUrl = process.env.NX_CLOUD_API || options?.url || 'https://cloud.nx.app';
34
36
  if (shouldVerifyInstalledRunnerBundle(currentBundle)) {
35
- const axios = (0, axios_1.createApiAxiosInstance)(options);
37
+ const httpClient = (0, nx_cloud_http_client_1.createApiHttpClient)(options);
36
38
  let verifyBundleResponse;
37
39
  try {
38
- verifyBundleResponse = await verifyCurrentBundle(axios, currentBundle);
40
+ verifyBundleResponse = await verifyCurrentBundle(httpClient, currentBundle);
39
41
  }
40
42
  catch (e) {
41
43
  // Enterprise image compatibility, to be removed
42
- if (e.message === 'Request failed with status code 404' && apiUrl) {
44
+ if (e instanceof http_client_1.HttpError && e.status === 404 && apiUrl) {
43
45
  throw new NxCloudEnterpriseOutdatedError(apiUrl);
44
46
  }
45
47
  (0, debug_logger_1.debugLog)('Could not verify bundle. Resetting validation timer and using previously installed or default runner. Error: ', e);
@@ -72,7 +74,7 @@ async function verifyOrUpdateNxCloudClient(options) {
72
74
  if (version === 'NX_ENTERPRISE_OUTDATED_IMAGE') {
73
75
  throw new NxCloudEnterpriseOutdatedError(apiUrl);
74
76
  }
75
- const fullPath = await downloadAndExtractClientBundle(axios, runnerBundleInstallDirectory, version, url);
77
+ const fullPath = await downloadAndExtractClientBundle(httpClient, runnerBundleInstallDirectory, version, url);
76
78
  (0, debug_logger_1.debugLog)('Done: ', fullPath);
77
79
  const nxCloudClient = require(fullPath);
78
80
  if (nxCloudClient.commands === undefined) {
@@ -157,8 +159,8 @@ function shouldVerifyInstalledRunnerBundle(currentBundle) {
157
159
  }
158
160
  return true;
159
161
  }
160
- async function verifyCurrentBundle(axios, currentBundle) {
161
- return axios.get('/nx-cloud/client/verify', {
162
+ async function verifyCurrentBundle(httpClient, currentBundle) {
163
+ return httpClient.get('/nx-cloud/client/verify', {
162
164
  params: currentBundle
163
165
  ? {
164
166
  version: currentBundle.version,
@@ -209,10 +211,10 @@ function hashDirectory(dir) {
209
211
  const combinedHashes = hashes.sort().join('');
210
212
  return (0, crypto_1.createHash)('sha256').update(combinedHashes).digest('hex');
211
213
  }
212
- async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirectory, version, url) {
214
+ async function downloadAndExtractClientBundle(httpClient, runnerBundleInstallDirectory, version, url) {
213
215
  let resp;
214
216
  try {
215
- resp = await axios.get(url, {
217
+ resp = await httpClient.get(url, {
216
218
  responseType: 'stream',
217
219
  });
218
220
  }
@@ -238,6 +240,8 @@ async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirector
238
240
  else if (headers.type === 'file') {
239
241
  const outputFilePath = (0, path_1.join)(bundleExtractLocation, headers.name);
240
242
  const writeStream = (0, fs_1.createWriteStream)(outputFilePath);
243
+ // Surface disk errors through the pipeline instead of crashing
244
+ writeStream.on('error', (e) => extract.destroy(e));
241
245
  stream.pipe(writeStream);
242
246
  // Continue the tar stream after the write stream closes
243
247
  writeStream.on('close', () => {
@@ -246,15 +250,17 @@ async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirector
246
250
  stream.resume();
247
251
  }
248
252
  });
249
- extract.on('error', (e) => {
250
- rej(e);
251
- });
252
253
  extract.on('finish', function () {
253
254
  removeOldClientBundles(version);
254
255
  writeBundleVerificationLock();
255
256
  res(bundleExtractLocation);
256
257
  });
257
- resp.data.pipe((0, zlib_1.createGunzip)()).pipe(extract);
258
+ // pipeline propagates download/gunzip errors that .pipe() would leave
259
+ // uncaught
260
+ (0, stream_1.pipeline)(resp.data, (0, zlib_1.createGunzip)(), extract, (e) => {
261
+ if (e)
262
+ rej(e);
263
+ });
258
264
  });
259
265
  }
260
266
  function removeOldClientBundles(currentInstallVersion) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isWorkspaceClaimed = isWorkspaceClaimed;
4
4
  const get_cloud_options_1 = require("./get-cloud-options");
5
+ const http_client_1 = require("../../utils/http-client");
5
6
  async function isWorkspaceClaimed(accessToken) {
6
7
  if (!accessToken)
7
8
  return false;
@@ -10,7 +11,7 @@ async function isWorkspaceClaimed(accessToken) {
10
11
  const requestData = (0, get_cloud_options_1.isNxCloudId)(accessToken)
11
12
  ? { nxCloudId: accessToken }
12
13
  : { nxCloudAccessToken: accessToken };
13
- const response = await require('axios').post(`${apiUrl}/nx-cloud/is-workspace-claimed`, requestData);
14
+ const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/is-workspace-claimed`, { method: 'POST', data: requestData });
14
15
  if (response.data.message) {
15
16
  return false;
16
17
  }
@@ -0,0 +1,5 @@
1
+ import { type HttpClient } from '../../utils/http-client';
2
+ export declare function createApiHttpClient(options?: {
3
+ url?: string;
4
+ customProxyConfigPath?: string;
5
+ }): HttpClient;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createApiHttpClient = createApiHttpClient;
4
+ const http_client_1 = require("../../utils/http-client");
5
+ const environment_1 = require("./environment");
6
+ function createApiHttpClient(options) {
7
+ if (options?.customProxyConfigPath) {
8
+ const { logger } = require('../../utils/logger');
9
+ // The client bundle still reads this file for its own requests
10
+ logger.warn('customProxyConfigPath is not used for downloading the Nx Cloud client. Set HTTP_PROXY/HTTPS_PROXY/NO_PROXY (and NODE_EXTRA_CA_CERTS for custom certificates) instead.');
11
+ }
12
+ return (0, http_client_1.createHttpClient)({
13
+ baseURL: process.env.NX_CLOUD_API || options?.url || 'https://cloud.nx.app',
14
+ timeout: environment_1.NX_CLOUD_NO_TIMEOUTS ? environment_1.UNLIMITED_TIMEOUT : 10000,
15
+ });
16
+ }
@@ -5,10 +5,11 @@ exports.getURLifShortenFailed = getURLifShortenFailed;
5
5
  const logger_1 = require("../../utils/logger");
6
6
  const get_cloud_options_1 = require("./get-cloud-options");
7
7
  const git_utils_1 = require("../../utils/git-utils");
8
+ const http_client_1 = require("../../utils/http-client");
8
9
  async function createNxCloudOnboardingURL(onboardingSource, accessToken, meta, forceManual = false, forceGithub = false, directory,
9
10
  // Aborting tears down the in-flight request; without it a caller that stops
10
11
  // waiting (see prefetchRemoteCacheOnboardingUrl) leaves the socket holding
11
- // the event loop open, since axios has no default timeout.
12
+ // the event loop open, since these requests have no timeout.
12
13
  signal) {
13
14
  const remoteInfo = (0, git_utils_1.getVcsRemoteInfo)(directory);
14
15
  const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
@@ -26,14 +27,18 @@ signal) {
26
27
  }
27
28
  const source = getSource(onboardingSource);
28
29
  try {
29
- const response = await require('axios').post(`${apiUrl}/nx-cloud/onboarding`, {
30
- type: usesGithub ? 'GITHUB' : 'MANUAL',
31
- source,
32
- accessToken: usesGithub ? null : accessToken,
33
- selectedRepositoryName: remoteInfo?.slug ?? null,
34
- repositoryDomain: remoteInfo?.domain ?? null,
35
- meta,
36
- }, { signal });
30
+ const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/onboarding`, {
31
+ method: 'POST',
32
+ data: {
33
+ type: usesGithub ? 'GITHUB' : 'MANUAL',
34
+ source,
35
+ accessToken: usesGithub ? null : accessToken,
36
+ selectedRepositoryName: remoteInfo?.slug ?? null,
37
+ repositoryDomain: remoteInfo?.domain ?? null,
38
+ meta,
39
+ },
40
+ signal,
41
+ });
37
42
  if (!response?.data || response.data.message) {
38
43
  throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
39
44
  }
@@ -69,7 +74,9 @@ function getURLifShortenFailed(usesGithub, githubSlug, apiUrl, source, accessTok
69
74
  }
70
75
  async function getInstallationSupportsGitHub(apiUrl, signal) {
71
76
  try {
72
- const response = await require('axios').get(`${apiUrl}/nx-cloud/system/features`, { signal });
77
+ const response = await (0, http_client_1.httpRequest)(`${apiUrl}/nx-cloud/system/features`, {
78
+ signal,
79
+ });
73
80
  if (!response?.data || response.data.message) {
74
81
  throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL');
75
82
  }
@@ -416,17 +416,16 @@ class TargetProjectLocator {
416
416
  const packageJsonPath = (0, resolve_relative_to_dir_1.resolveRelativeToDir)((0, node_path_1.join)(packageName, 'package.json'), relativeToDir);
417
417
  if (packageJsonPath) {
418
418
  if (this.packageJsonResolutionCache.has(packageJsonPath)) {
419
- return this.packageJsonResolutionCache.get(packageJsonPath);
419
+ const cached = this.packageJsonResolutionCache.get(packageJsonPath);
420
+ if (cached) {
421
+ return cached;
422
+ }
420
423
  }
421
424
  const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
422
425
  if (parsedPackageJson.name && parsedPackageJson.version) {
423
426
  this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
424
427
  return parsedPackageJson;
425
428
  }
426
- else {
427
- this.packageJsonResolutionCache.set(packageJsonPath, null);
428
- return null;
429
- }
430
429
  }
431
430
  try {
432
431
  // Resolve the main entry point of the package
@@ -435,22 +434,27 @@ class TargetProjectLocator {
435
434
  while (dir !== (0, node_path_1.dirname)(dir)) {
436
435
  const packageJsonPath = (0, node_path_1.join)(dir, 'package.json');
437
436
  if (this.packageJsonResolutionCache.has(packageJsonPath)) {
438
- return this.packageJsonResolutionCache.get(packageJsonPath);
439
- }
440
- try {
441
- const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
442
- // Ensure the package.json contains the "name" and "version" fields
443
- if (parsedPackageJson.name && parsedPackageJson.version) {
444
- this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
445
- return parsedPackageJson;
437
+ const cached = this.packageJsonResolutionCache.get(packageJsonPath);
438
+ if (cached) {
439
+ return cached;
446
440
  }
447
- else {
441
+ // Cached incomplete manifests are traversal points, not terminal misses.
442
+ }
443
+ else {
444
+ try {
445
+ const parsedPackageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
446
+ // Ensure the package.json contains the "name" and "version" fields
447
+ if (parsedPackageJson.name && parsedPackageJson.version) {
448
+ this.packageJsonResolutionCache.set(packageJsonPath, parsedPackageJson);
449
+ return parsedPackageJson;
450
+ }
451
+ // A module-format stub without name/version: remember it and keep
452
+ // traversing towards the real manifest.
448
453
  this.packageJsonResolutionCache.set(packageJsonPath, null);
449
- return null;
450
454
  }
451
- }
452
- catch {
453
- // Package.json is invalid, keep traversing
455
+ catch {
456
+ // Package.json is invalid, keep traversing
457
+ }
454
458
  }
455
459
  dir = (0, node_path_1.dirname)(dir);
456
460
  }
@@ -1,9 +1,9 @@
1
1
  import { NxJsonConfiguration, TargetDependencies } from '../../config/nx-json';
2
2
  import { ProjectGraph } from '../../config/project-graph';
3
3
  import { TaskGraph } from '../../config/task-graph';
4
- import { type IoSnapshots } from '../../native';
5
- import { type IoSnapshotOutcome } from '../../io-snapshots/store';
6
- import type { IoSnapshotVersion } from '../../daemon/message-types/io-snapshot-version';
4
+ import { type UltracacheConfigurations } from '../../native';
5
+ import { type UltracacheConfigurationOutcome } from '../../ultracache/store';
6
+ import type { UltracacheConfigurationVersion } from '../../daemon/message-types/ultracache-configuration-version';
7
7
  import { FileChange } from '../file-utils';
8
8
  import type { NxArgs } from '../../utils/command-line-utils';
9
9
  import { TaskPlanningContext } from '../../hasher/task-planning-context';
@@ -42,8 +42,8 @@ export interface ComputeAffectedTasksOptions {
42
42
  /** `--exclude` project patterns. Their tasks leave the selection but still carry a change and run as dependencies. */
43
43
  exclude?: string[];
44
44
  packageJson?: any;
45
- /** This command's I/O snapshot set. Selection plans with it, as the run hashes with it. */
46
- ioSnapshotOutcome?: IoSnapshotOutcome | null;
45
+ /** This command's Ultracache configurations. Selection plans with them, as the run hashes with them. */
46
+ ultracacheConfigurationOutcome?: UltracacheConfigurationOutcome | null;
47
47
  selectivelyHashTsConfig?: boolean;
48
48
  }
49
49
  export type FileChangeArgs = Pick<NxArgs, 'base' | 'head' | 'files'>;
@@ -61,7 +61,7 @@ export interface AffectedTasksRequest {
61
61
  extraTargetDependencies: TargetDependencies;
62
62
  excludeTaskDependencies: boolean;
63
63
  exclude: string[];
64
- ioSnapshots?: IoSnapshotVersion;
64
+ ultracacheConfigurationsVersion?: UltracacheConfigurationVersion;
65
65
  /** The runner's `selectivelyHashTsConfig`, which decides what the tsconfig hash reads. */
66
66
  selectivelyHashTsConfig?: boolean;
67
67
  }
@@ -76,13 +76,14 @@ export interface AffectedTasksRequest {
76
76
  export declare function computeAffectedTasks(opts: ComputeAffectedTasksOptions): Promise<AffectedTasksResult>;
77
77
  /**
78
78
  * Plans the targets' full task graph and matches the changed paths against
79
- * every plan. No project-level prefilter: under an I/O snapshot a task can read
80
- * files no affected project owns. Shared by the client and the daemon.
79
+ * every plan. No project-level prefilter: under Ultracache configurations a
80
+ * task can read files no affected project owns. Shared by the client and the
81
+ * daemon.
81
82
  */
82
- export declare function selectAffectedTasks(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, planningContext: TaskPlanningContext, request: AffectedTasksRequest, { touchedFiles, packageJson, ioSnapshots, }?: {
83
+ export declare function selectAffectedTasks(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, planningContext: TaskPlanningContext, request: AffectedTasksRequest, { touchedFiles, packageJson, ultracacheConfigurations, }?: {
83
84
  touchedFiles?: FileChange[];
84
85
  packageJson?: any;
85
- ioSnapshots?: IoSnapshots;
86
+ ultracacheConfigurations?: UltracacheConfigurations;
86
87
  }): Promise<{
87
88
  affectedTaskIds: Set<string>;
88
89
  taskGraph: TaskGraph;
@@ -4,9 +4,8 @@ exports.selectsAffectedTasks = selectsAffectedTasks;
4
4
  exports.computeAffectedTasks = computeAffectedTasks;
5
5
  exports.selectAffectedTasks = selectAffectedTasks;
6
6
  const native_1 = require("../../native");
7
- const outputs_1 = require("../../io-snapshots/outputs");
8
- const overrides_1 = require("../../io-snapshots/overrides");
9
- const store_1 = require("../../io-snapshots/store");
7
+ const overrides_1 = require("../../ultracache/overrides");
8
+ const store_1 = require("../../ultracache/store");
10
9
  const create_task_graph_1 = require("../../tasks-runner/create-task-graph");
11
10
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
12
11
  const utils_1 = require("../../tasks-runner/utils");
@@ -53,11 +52,11 @@ async function computeAffectedTasks(opts) {
53
52
  exclude: opts.exclude ?? [],
54
53
  selectivelyHashTsConfig: opts.selectivelyHashTsConfig,
55
54
  };
56
- const ioSnapshots = (0, store_1.snapshotsOf)(opts.ioSnapshotOutcome ?? null);
57
- if (ioSnapshots) {
58
- request.ioSnapshots = {
59
- commit: ioSnapshots.commit,
60
- fetchedAt: ioSnapshots.resolution.fetchedAt,
55
+ const ultracacheConfigurations = (0, store_1.configurationsOf)(opts.ultracacheConfigurationOutcome ?? null);
56
+ if (ultracacheConfigurations) {
57
+ request.ultracacheConfigurationsVersion = {
58
+ commit: ultracacheConfigurations.commit,
59
+ fetchedAt: ultracacheConfigurations.resolution.fetchedAt,
61
60
  };
62
61
  }
63
62
  if (!(0, is_on_daemon_1.isOnDaemon)() && client_1.daemonClient.enabled()) {
@@ -68,7 +67,7 @@ async function computeAffectedTasks(opts) {
68
67
  affectedTaskIds: new Set(selection.affectedTaskIds),
69
68
  taskSelection: {
70
69
  ...selection.taskSelection,
71
- ioSnapshotOutcome: opts.ioSnapshotOutcome,
70
+ ultracacheConfigurationOutcome: opts.ultracacheConfigurationOutcome,
72
71
  },
73
72
  };
74
73
  }
@@ -86,7 +85,7 @@ async function computeAffectedTasks(opts) {
86
85
  const selection = await selectAffectedTasks(projectGraph, opts.nxJson, planningContext, request, {
87
86
  touchedFiles: opts.touchedFiles,
88
87
  packageJson: opts.packageJson,
89
- ioSnapshots,
88
+ ultracacheConfigurations,
90
89
  });
91
90
  return {
92
91
  projectGraph,
@@ -96,16 +95,17 @@ async function computeAffectedTasks(opts) {
96
95
  ...selection.taskSelection,
97
96
  // The planner remembers what selection planned, so the run's hashing reuses it.
98
97
  planningContext,
99
- ioSnapshotOutcome: opts.ioSnapshotOutcome,
98
+ ultracacheConfigurationOutcome: opts.ultracacheConfigurationOutcome,
100
99
  },
101
100
  };
102
101
  }
103
102
  /**
104
103
  * Plans the targets' full task graph and matches the changed paths against
105
- * every plan. No project-level prefilter: under an I/O snapshot a task can read
106
- * files no affected project owns. Shared by the client and the daemon.
104
+ * every plan. No project-level prefilter: under Ultracache configurations a
105
+ * task can read files no affected project owns. Shared by the client and the
106
+ * daemon.
107
107
  */
108
- async function selectAffectedTasks(projectGraph, nxJson, planningContext, request, { touchedFiles = (0, file_utils_1.calculateFileChanges)(request.changedFiles, request.fileChangeArgs), packageJson, ioSnapshots, } = {}) {
108
+ async function selectAffectedTasks(projectGraph, nxJson, planningContext, request, { touchedFiles = (0, file_utils_1.calculateFileChanges)(request.changedFiles, request.fileChangeArgs), packageJson, ultracacheConfigurations, } = {}) {
109
109
  const { targets } = request;
110
110
  // Only projects that have one of the targets: with a single target,
111
111
  // createTaskGraph tries to create a task for projects that lack it and
@@ -128,12 +128,8 @@ async function selectAffectedTasks(projectGraph, nxJson, planningContext, reques
128
128
  // Dependencies carry a change even when they won't run; `keep` drops them.
129
129
  false);
130
130
  const taskIds = Object.keys(taskGraph.tasks);
131
- // As the run hashes: observed outputs carry output reads, observed inputs match changes.
132
- if (ioSnapshots) {
133
- (0, outputs_1.applyIoSnapshotOutputs)(projectGraph, taskGraph, ioSnapshots);
134
- }
135
- const plans = ioSnapshots
136
- ? planningContext.planner.getPlansReference(taskIds, taskGraph, ioSnapshots, (0, overrides_1.ioSnapshotEligibilityOptions)(projectGraph, taskGraph))
131
+ const plans = ultracacheConfigurations
132
+ ? planningContext.planner.getPlansReference(taskIds, taskGraph, ultracacheConfigurations, (0, overrides_1.ultracacheEligibilityOptions)(projectGraph, taskGraph))
137
133
  : planningContext.planner.getPlansReference(taskIds, taskGraph);
138
134
  const dependencies = dependencyChanges(projectGraph, touchedFiles, nxJson, packageJson);
139
135
  const namedProjects = new Set(dependencies.projects);
@@ -1,12 +1,12 @@
1
1
  import type { NxJsonConfiguration } from '../config/nx-json';
2
2
  import { Task, TaskGraph } from '../config/task-graph';
3
3
  import { LifeCycle, TaskResult } from './life-cycle';
4
- import type { IoSnapshots } from '../native';
4
+ import type { UltracacheConfigurations } from '../native';
5
5
  import type { ProjectGraph } from '../config/project-graph';
6
6
  import { RunningTask } from './running-tasks/running-task';
7
7
  export declare function runDiscreteTasks(tasks: Task[], projectGraph: ProjectGraph, fullTaskGraph: TaskGraph, nxJson: NxJsonConfiguration, lifeCycle: LifeCycle,
8
- /** The set to hash from, e.g. from `importIoSnapshots`; omitted hashes natively. */
9
- ioSnapshots?: IoSnapshots): Promise<Array<Promise<TaskResult[]>>>;
8
+ /** The set to hash from, e.g. from `importUltracacheConfigurations`; omitted hashes natively. */
9
+ ultracacheConfigurations?: UltracacheConfigurations): Promise<Array<Promise<TaskResult[]>>>;
10
10
  export declare function runContinuousTasks(tasks: Task[], projectGraph: ProjectGraph, fullTaskGraph: TaskGraph, nxJson: NxJsonConfiguration, lifeCycle: LifeCycle,
11
- /** The set to hash from, e.g. from `importIoSnapshots`; omitted hashes natively. */
12
- ioSnapshots?: IoSnapshots): Promise<Record<string, Promise<RunningTask>>>;
11
+ /** The set to hash from, e.g. from `importUltracacheConfigurations`; omitted hashes natively. */
12
+ ultracacheConfigurations?: UltracacheConfigurations): Promise<Record<string, Promise<RunningTask>>>;
@@ -8,11 +8,10 @@ const dotenv_1 = require("../utils/dotenv");
8
8
  const life_cycle_1 = require("./life-cycle");
9
9
  const task_orchestrator_1 = require("./task-orchestrator");
10
10
  const create_task_hasher_1 = require("../hasher/create-task-hasher");
11
- const outputs_1 = require("../io-snapshots/outputs");
12
11
  const client_1 = require("../daemon/client/client");
13
12
  const shared_running_task_1 = require("./running-tasks/shared-running-task");
14
13
  const task_results_life_cycle_1 = require("./life-cycles/task-results-life-cycle");
15
- async function createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ioSnapshots) {
14
+ async function createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ultracacheConfigurations) {
16
15
  (0, dotenv_1.loadRootEnvFiles)();
17
16
  const invokeRunnerTerminalLifecycle = new invoke_runner_terminal_output_life_cycle_1.InvokeRunnerTerminalOutputLifeCycle(tasks);
18
17
  const taskResultsLifecycle = new task_results_life_cycle_1.TaskResultsLifeCycle();
@@ -37,13 +36,7 @@ async function createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, li
37
36
  return acc;
38
37
  }, {}),
39
38
  };
40
- // As in run-command, unhashed tasks hash from the caller's set. Applying is
41
- // idempotent, so both graphs may share the same Task objects.
42
- if (ioSnapshots) {
43
- (0, outputs_1.applyIoSnapshotOutputs)(projectGraph, fullTaskGraph, ioSnapshots);
44
- (0, outputs_1.applyIoSnapshotOutputs)(projectGraph, taskGraph, ioSnapshots);
45
- }
46
- const hasher = (0, create_task_hasher_1.createTaskHasher)(projectGraph, nxJson, options, ioSnapshots);
39
+ const hasher = (0, create_task_hasher_1.createTaskHasher)(projectGraph, nxJson, options, ultracacheConfigurations);
47
40
  const nxArgs = {
48
41
  ...options,
49
42
  parallel: tasks.length,
@@ -65,9 +58,9 @@ function logDisposeFailure(e) {
65
58
  console.error('Failed to dispose the task orchestrator:', e);
66
59
  }
67
60
  async function runDiscreteTasks(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle,
68
- /** The set to hash from, e.g. from `importIoSnapshots`; omitted hashes natively. */
69
- ioSnapshots) {
70
- const orchestrator = await createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ioSnapshots);
61
+ /** The set to hash from, e.g. from `importUltracacheConfigurations`; omitted hashes natively. */
62
+ ultracacheConfigurations) {
63
+ const orchestrator = await createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ultracacheConfigurations);
71
64
  let groupId = 0;
72
65
  let nextBatch = orchestrator.nextBatch();
73
66
  const batchResults = [];
@@ -106,9 +99,9 @@ ioSnapshots) {
106
99
  return results;
107
100
  }
108
101
  async function runContinuousTasks(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle,
109
- /** The set to hash from, e.g. from `importIoSnapshots`; omitted hashes natively. */
110
- ioSnapshots) {
111
- const orchestrator = await createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ioSnapshots);
102
+ /** The set to hash from, e.g. from `importUltracacheConfigurations`; omitted hashes natively. */
103
+ ultracacheConfigurations) {
104
+ const orchestrator = await createOrchestrator(tasks, projectGraph, fullTaskGraph, nxJson, lifeCycle, ultracacheConfigurations);
112
105
  const runningTasks = tasks.reduce((current, task, index) => {
113
106
  current[task.id] = orchestrator.startContinuousTask(task, index);
114
107
  return current;
@@ -3,7 +3,7 @@ import { ProjectGraph } from '../config/project-graph';
3
3
  import { Task, TaskGraph } from '../config/task-graph';
4
4
  import { TargetDependencyConfig } from '../config/workspace-json-project-json';
5
5
  import { NxArgs } from '../utils/command-line-utils';
6
- import { type IoSnapshotOutcome } from '../io-snapshots/store';
6
+ import { type UltracacheConfigurationOutcome } from '../ultracache/store';
7
7
  import type { TaskPlanningContext } from '../hasher/task-planning-context';
8
8
  /** What a command runs. */
9
9
  export interface TaskSelection {
@@ -20,8 +20,8 @@ export interface TaskSelection {
20
20
  taskIds?: string[];
21
21
  /** The planner selection used. It remembers those plans, so hashing the run reuses them. */
22
22
  planningContext?: TaskPlanningContext;
23
- /** The I/O snapshot set selection planned with; the run hashes with the same one. */
24
- ioSnapshotOutcome?: IoSnapshotOutcome | null;
23
+ /** The Ultracache configurations selection planned with; the run hashes with the same ones. */
24
+ ultracacheConfigurationOutcome?: UltracacheConfigurationOutcome | null;
25
25
  }
26
26
  import { LifeCycle, TaskResult, TaskResults } from './life-cycle';
27
27
  import { TasksRunner } from './tasks-runner';
@@ -46,7 +46,7 @@ export declare function runTasksForCommand(taskSelection: TaskSelection, current
46
46
  completed: boolean;
47
47
  }>;
48
48
  export declare function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean): void;
49
- export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, planningContext, ioSnapshotOutcome: loadedIoSnapshotOutcome, }: {
49
+ export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nxJson, nxArgs, loadDotEnvFiles, initiatingProject, initiatingTasks, planningContext, ultracacheConfigurationOutcome: loadedUltracacheConfigurationOutcome, }: {
50
50
  tasks: Task[];
51
51
  projectGraph: ProjectGraph;
52
52
  taskGraph: TaskGraph;
@@ -58,17 +58,17 @@ export declare function invokeTasksRunner({ tasks, projectGraph, taskGraph, life
58
58
  initiatingTasks: Task[];
59
59
  planningContext?: TaskPlanningContext;
60
60
  /** Already loaded for this command; `undefined` loads it here. */
61
- ioSnapshotOutcome?: IoSnapshotOutcome | null;
61
+ ultracacheConfigurationOutcome?: UltracacheConfigurationOutcome | null;
62
62
  }): Promise<{
63
63
  [id: string]: TaskResult;
64
64
  }>;
65
65
  export declare function constructLifeCycles(lifeCycle: LifeCycle, taskGraph: TaskGraph, nxJson?: NxJsonConfiguration, skipNxCache?: boolean): LifeCycle[];
66
66
  /**
67
67
  * What affected task selection reads from the runner options, so it plans as
68
- * the run hashes. The snapshot set is loaded once, for selection and the run.
68
+ * the run hashes. The Ultracache configurations are loaded once, for selection and the run.
69
69
  */
70
70
  export declare function runnerInputsForSelection(nxArgs: NxArgs, nxJson: NxJsonConfiguration): Promise<{
71
- ioSnapshotOutcome: IoSnapshotOutcome | null;
71
+ ultracacheConfigurationOutcome: UltracacheConfigurationOutcome | null;
72
72
  selectivelyHashTsConfig: boolean;
73
73
  }>;
74
74
  export declare function getRunner(nxArgs: NxArgs, nxJson: NxJsonConfiguration): {