nx 23.3.0-beta.4 → 23.3.0-beta.6

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 (113) hide show
  1. package/dist/nx-cloud-internals.d.ts +1 -0
  2. package/dist/nx-cloud-internals.js +9 -0
  3. package/dist/plugins/package-json.js +1 -1
  4. package/dist/src/command-line/affected/affected.js +51 -9
  5. package/dist/src/command-line/graph/graph.d.ts +31 -0
  6. package/dist/src/command-line/graph/graph.js +71 -17
  7. package/dist/src/command-line/release/publish.js +7 -11
  8. package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
  9. package/dist/src/command-line/run/run-one.js +5 -1
  10. package/dist/src/command-line/run-many/run-many.js +6 -12
  11. package/dist/src/command-line/show/projects.js +30 -1
  12. package/dist/src/config/task-graph.d.ts +1 -1
  13. package/dist/src/config/workspace-json-project-json.d.ts +21 -1
  14. package/dist/src/core/graph/main.js +1 -1
  15. package/dist/src/core/graph/runtime.js +1 -1
  16. package/dist/src/core/graph/styles.js +1 -1
  17. package/dist/src/daemon/client/client.d.ts +7 -2
  18. package/dist/src/daemon/client/client.js +15 -2
  19. package/dist/src/daemon/message-types/io-snapshot-version.d.ts +5 -0
  20. package/dist/src/daemon/message-types/io-snapshot-version.js +2 -0
  21. package/dist/src/daemon/message-types/select-affected-tasks.d.ts +18 -0
  22. package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
  23. package/dist/src/daemon/server/handle-hash-tasks.d.ts +2 -0
  24. package/dist/src/daemon/server/handle-hash-tasks.js +5 -3
  25. package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
  26. package/dist/src/daemon/server/handle-select-affected-tasks.js +23 -0
  27. package/dist/src/daemon/server/io-snapshots-state.d.ts +7 -0
  28. package/dist/src/daemon/server/io-snapshots-state.js +35 -0
  29. package/dist/src/daemon/server/planning-context.d.ts +8 -0
  30. package/dist/src/daemon/server/planning-context.js +18 -0
  31. package/dist/src/daemon/server/server.d.ts +1 -0
  32. package/dist/src/daemon/server/server.js +6 -0
  33. package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
  34. package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
  35. package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
  36. package/dist/src/executors/run-commands/running-tasks.js +13 -13
  37. package/dist/src/hasher/create-task-hasher.d.ts +8 -1
  38. package/dist/src/hasher/create-task-hasher.js +13 -3
  39. package/dist/src/hasher/hash-plan-inspector.js +2 -2
  40. package/dist/src/hasher/hash-task.d.ts +2 -2
  41. package/dist/src/hasher/hash-task.js +7 -1
  42. package/dist/src/hasher/native-task-hasher-impl.d.ts +13 -5
  43. package/dist/src/hasher/native-task-hasher-impl.js +38 -15
  44. package/dist/src/hasher/task-hasher.d.ts +17 -9
  45. package/dist/src/hasher/task-hasher.js +16 -11
  46. package/dist/src/hasher/task-planning-context.d.ts +13 -0
  47. package/dist/src/hasher/task-planning-context.js +12 -0
  48. package/dist/src/io-snapshots/config.d.ts +23 -0
  49. package/dist/src/io-snapshots/config.js +32 -0
  50. package/dist/src/io-snapshots/fetch.d.ts +21 -0
  51. package/dist/src/io-snapshots/fetch.js +43 -0
  52. package/dist/src/io-snapshots/outputs.d.ts +12 -0
  53. package/dist/src/io-snapshots/outputs.js +33 -0
  54. package/dist/src/io-snapshots/overrides.d.ts +12 -0
  55. package/dist/src/io-snapshots/overrides.js +49 -0
  56. package/dist/src/io-snapshots/report.d.ts +13 -0
  57. package/dist/src/io-snapshots/report.js +68 -0
  58. package/dist/src/io-snapshots/store.d.ts +37 -0
  59. package/dist/src/io-snapshots/store.js +162 -0
  60. package/dist/src/native/index.d.ts +264 -2
  61. package/dist/src/native/native-bindings.js +10 -0
  62. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  63. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  64. package/dist/src/native/transform-objects.d.ts +11 -2
  65. package/dist/src/native/transform-objects.js +46 -0
  66. package/dist/src/nx-cloud/update-manager.d.ts +3 -0
  67. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
  68. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
  69. package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
  70. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
  71. package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
  72. package/dist/src/plugins/package-json/create-nodes.js +13 -13
  73. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
  74. package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
  75. package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
  76. package/dist/src/project-graph/affected/affected-projects.js +42 -0
  77. package/dist/src/project-graph/affected/affected-tasks.d.ts +90 -0
  78. package/dist/src/project-graph/affected/affected-tasks.js +214 -0
  79. package/dist/src/project-graph/file-utils.js +6 -2
  80. package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
  81. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
  82. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
  83. package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
  84. package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
  85. package/dist/src/tasks-runner/create-task-graph.js +56 -2
  86. package/dist/src/tasks-runner/forked-process-task-runner.js +3 -3
  87. package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
  88. package/dist/src/tasks-runner/init-tasks-runner.js +17 -6
  89. package/dist/src/tasks-runner/run-command.d.ts +41 -5
  90. package/dist/src/tasks-runner/run-command.js +84 -18
  91. package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
  92. package/dist/src/tasks-runner/task-io-service.js +14 -5
  93. package/dist/src/tasks-runner/task-orchestrator.js +1 -1
  94. package/dist/src/tasks-runner/utils.d.ts +5 -0
  95. package/dist/src/tasks-runner/utils.js +9 -0
  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/json-diff.d.ts +4 -2
  99. package/dist/src/utils/json-diff.js +6 -94
  100. package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
  101. package/dist/src/utils/nx-cloud-utils.js +6 -1
  102. package/dist/src/utils/project-graph-utils.d.ts +2 -0
  103. package/dist/src/utils/project-graph-utils.js +12 -0
  104. package/package.json +22 -13
  105. package/readme-template.md +16 -0
  106. package/schemas/nx-schema.json +34 -0
  107. package/schemas/project-schema.json +31 -0
  108. package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
  109. package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -40
  110. package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
  111. package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
  112. package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
  113. package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
@@ -1 +1 @@
1
- (()=>{"use strict";var e,r={},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return r[e](i,i.exports,n),i.exports}n.m=r,e=[],n.O=(r,t,o,i)=>{if(!t){var a=1/0;for(c=0;c<e.length;c++){for(var[t,o,i]=e[c],l=!0,u=0;u<t.length;u++)(!1&i||a>=i)&&Object.keys(n.O).every(e=>n.O[e](t[u]))?t.splice(u--,1):(l=!1,i<a&&(a=i));if(l){e.splice(c--,1);var f=o();void 0!==f&&(r=f)}}return r}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[t,o,i]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={121:0};n.O.j=r=>0===e[r];var r=(r,t)=>{var o,i,[a,l,u]=t,f=0;if(a.some(r=>0!==e[r])){for(o in l)n.o(l,o)&&(n.m[o]=l[o]);if(u)var c=u(n)}for(r&&r(t);f<a.length;f++)i=a[f],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(c)},t=self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
1
+ (()=>{"use strict";var e={};const r={};function t(n){const o=r[n];if(void 0!==o)return o.exports;const i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}t.m=e,(()=>{const e=[];t.O=(r,n,o,i)=>{if(n){i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];return void(e[l]=[n,o,i])}let a=1/0;for(l=0;l<e.length;l++){let[n,o,i]=e[l],u=!0;for(var c=0;c<n.length;c++)(!1&i||a>=i)&&Object.keys(t.O).every(e=>t.O[e](n[c]))?n.splice(c--,1):(u=!1,i<a&&(a=i));if(u){e.splice(l--,1);const t=o();void 0!==t&&(r=t)}}return r}})(),t.n=e=>{const r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{if(Array.isArray(r))for(var n=0;n<r.length;){var o=r[n++],i=r[n++];t.o(e,o)?0===i&&n++:0===i?Object.defineProperty(e,o,{enumerable:!0,value:r[n++]}):Object.defineProperty(e,o,{enumerable:!0,get:i})}else for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.dn=e=>{var r=Object.getOwnPropertyDescriptor(e,"name");(!r||!r.writable&&r.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={121:0};t.O.j=r=>0===e[r];const r=(r,n)=>{let[o,i,l]=n;var a,c,u=0;if(o.some(r=>0!==e[r])){for(a in i)t.o(i,a)&&(t.m[a]=i[a]);if(l)var f=l(t)}for(r&&r(n);u<o.length;u++)c=o[u],t.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return t.O(f)},n=self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})()})();
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[]).push([[869],{1296(){}},e=>{var n;n=1296,e(e.s=n)}]);
1
+ "use strict";(self.webpackChunk_nx_graph_client=self.webpackChunk_nx_graph_client||[]).push([[869],{4091(){}},e=>{var n;n=4091,e(e.s=n)}]);
@@ -1,6 +1,7 @@
1
1
  import { ChildProcess } from 'child_process';
2
2
  import { FileData, ProjectGraph } from '../../config/project-graph';
3
3
  import { Task, TaskGraph } from '../../config/task-graph';
4
+ import type { IoSnapshotVersion } from '../message-types/io-snapshot-version';
4
5
  import { Hash } from '../../hasher/task-hasher';
5
6
  import { NxWorkspaceFiles, TaskRun, TaskTarget } from '../../native';
6
7
  import { PreTasksExecutionContext } from '../../project-graph/plugins/public-api';
@@ -8,6 +9,8 @@ import type { MaybeStubbedPostTasksExecutionContext } from '../../project-graph/
8
9
  import { ConfigurationSourceMaps } from '../../project-graph/utils/project-configuration/source-maps';
9
10
  import type { FlushSyncGeneratorChangesResult, SyncGeneratorRunResult } from '../../utils/sync-generators';
10
11
  import { type ConfigureAiAgentsStatusResponse } from '../message-types/configure-ai-agents';
12
+ import { type SelectAffectedTasksResponse } from '../message-types/select-affected-tasks';
13
+ import type { AffectedTasksRequest } from '../../project-graph/affected/affected-tasks';
11
14
  import type { NxPluginCapabilities } from '../../project-graph/plugins/nx-plugin-capabilities';
12
15
  import { type NxConsoleStatusResponse, type SetNxConsolePreferenceAndInstallResponse } from '../message-types/nx-console';
13
16
  /** A refused connect: the errno, and the path it was made against. */
@@ -58,8 +61,8 @@ export declare class DaemonClient {
58
61
  sourceMaps: ConfigurationSourceMaps;
59
62
  }>;
60
63
  getAllFileData(): Promise<FileData[]>;
61
- hashTasks(runnerOptions: any, tasks: Task[], taskGraph: TaskGraph, perTaskEnvs: Record<string, NodeJS.ProcessEnv>, cwd: string, collectInputs?: boolean): Promise<Hash[]>;
62
- hashTasksUpfront(runnerOptions: any, tasks: Task[], taskGraph: TaskGraph, perTaskEnvs: Record<string, NodeJS.ProcessEnv>, cwd: string, collectInputs?: boolean): Promise<Record<string, Hash>>;
64
+ hashTasks(runnerOptions: any, tasks: Task[], taskGraph: TaskGraph, perTaskEnvs: Record<string, NodeJS.ProcessEnv>, cwd: string, collectInputs?: boolean, ioSnapshots?: IoSnapshotVersion): Promise<Hash[]>;
65
+ hashTasksUpfront(runnerOptions: any, tasks: Task[], taskGraph: TaskGraph, perTaskEnvs: Record<string, NodeJS.ProcessEnv>, cwd: string, collectInputs?: boolean, ioSnapshots?: IoSnapshotVersion): Promise<Record<string, Hash>>;
63
66
  registerFileWatcher(config: {
64
67
  watchProjects: string[] | 'all';
65
68
  includeGlobalWorkspaceFiles?: boolean;
@@ -102,6 +105,8 @@ export declare class DaemonClient {
102
105
  taskGenerators: string[];
103
106
  }>;
104
107
  getPluginCapabilities(): Promise<NxPluginCapabilities[]>;
108
+ /** Selection runs where hashing does, so the plans it builds are reused. */
109
+ selectAffectedTasks(request: AffectedTasksRequest): Promise<SelectAffectedTasksResponse>;
105
110
  updateWorkspaceContext(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
106
111
  runPreTasksExecution(context: PreTasksExecutionContext): Promise<NodeJS.ProcessEnv[]>;
107
112
  runPostTasksExecution(context: MaybeStubbedPostTasksExecutionContext): Promise<void>;
@@ -36,6 +36,7 @@ const get_files_in_directory_1 = require("../message-types/get-files-in-director
36
36
  const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
37
37
  const get_registered_sync_generators_1 = require("../message-types/get-registered-sync-generators");
38
38
  const get_plugin_capabilities_1 = require("../message-types/get-plugin-capabilities");
39
+ const select_affected_tasks_1 = require("../message-types/select-affected-tasks");
39
40
  const get_sync_generator_changes_1 = require("../message-types/get-sync-generator-changes");
40
41
  const hash_glob_1 = require("../message-types/hash-glob");
41
42
  const nx_console_1 = require("../message-types/nx-console");
@@ -210,7 +211,7 @@ class DaemonClient {
210
211
  async getAllFileData() {
211
212
  return await this.sendToDaemonViaQueue({ type: 'REQUEST_FILE_DATA' });
212
213
  }
213
- hashTasks(runnerOptions, tasks, taskGraph, perTaskEnvs, cwd, collectInputs) {
214
+ hashTasks(runnerOptions, tasks, taskGraph, perTaskEnvs, cwd, collectInputs, ioSnapshots) {
214
215
  return this.sendToDaemonViaQueue({
215
216
  type: 'HASH_TASKS',
216
217
  runnerOptions,
@@ -218,9 +219,12 @@ class DaemonClient {
218
219
  ...withoutTaskResults(tasks, taskGraph),
219
220
  cwd,
220
221
  collectInputs,
222
+ // An External cannot cross the socket: the version names the stored set
223
+ // to hash from. Absent means native hashing.
224
+ ioSnapshots,
221
225
  });
222
226
  }
223
- hashTasksUpfront(runnerOptions, tasks, taskGraph, perTaskEnvs, cwd, collectInputs) {
227
+ hashTasksUpfront(runnerOptions, tasks, taskGraph, perTaskEnvs, cwd, collectInputs, ioSnapshots) {
224
228
  return this.sendToDaemonViaQueue({
225
229
  type: 'HASH_TASKS_UPFRONT',
226
230
  runnerOptions,
@@ -228,6 +232,7 @@ class DaemonClient {
228
232
  ...withoutTaskResults(tasks, taskGraph),
229
233
  cwd,
230
234
  collectInputs,
235
+ ioSnapshots,
231
236
  });
232
237
  }
233
238
  async registerFileWatcher(config, callback) {
@@ -725,6 +730,14 @@ class DaemonClient {
725
730
  };
726
731
  return this.sendToDaemonViaQueue(message);
727
732
  }
733
+ /** Selection runs where hashing does, so the plans it builds are reused. */
734
+ selectAffectedTasks(request) {
735
+ const message = {
736
+ type: select_affected_tasks_1.SELECT_AFFECTED_TASKS,
737
+ request,
738
+ };
739
+ return this.sendToDaemonViaQueue(message);
740
+ }
728
741
  updateWorkspaceContext(createdFiles, updatedFiles, deletedFiles) {
729
742
  const message = {
730
743
  type: update_workspace_context_1.UPDATE_WORKSPACE_CONTEXT,
@@ -0,0 +1,5 @@
1
+ /** One stored version of a snapshot set: what crosses the socket in place of the handle. */
2
+ export interface IoSnapshotVersion {
3
+ commit: string;
4
+ fetchedAt: number;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import type { ProjectGraph } from '../../config/project-graph';
2
+ import type { TaskGraph } from '../../config/task-graph';
3
+ import type { TaskSelection } from '../../tasks-runner/run-command';
4
+ import type { AffectedTasksRequest } from '../../project-graph/affected/affected-tasks';
5
+ export declare const SELECT_AFFECTED_TASKS: 'SELECT_AFFECTED_TASKS';
6
+ export type HandleSelectAffectedTasksMessage = {
7
+ type: typeof SELECT_AFFECTED_TASKS;
8
+ request: AffectedTasksRequest;
9
+ };
10
+ export type SelectAffectedTasksResponse = {
11
+ /** The graph selection ran against, for the command to run with. */
12
+ projectGraph: ProjectGraph;
13
+ affectedTaskIds: string[];
14
+ taskGraph: TaskGraph;
15
+ /** Without a planning context: the plans stay in the daemon. */
16
+ taskSelection: TaskSelection;
17
+ };
18
+ export declare function isHandleSelectAffectedTasksMessage(message: unknown): message is HandleSelectAffectedTasksMessage;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SELECT_AFFECTED_TASKS = void 0;
4
+ exports.isHandleSelectAffectedTasksMessage = isHandleSelectAffectedTasksMessage;
5
+ exports.SELECT_AFFECTED_TASKS = 'SELECT_AFFECTED_TASKS';
6
+ function isHandleSelectAffectedTasksMessage(message) {
7
+ return (typeof message === 'object' &&
8
+ message !== null &&
9
+ 'type' in message &&
10
+ message['type'] === exports.SELECT_AFFECTED_TASKS);
11
+ }
@@ -1,4 +1,5 @@
1
1
  import { Task, TaskGraph } from '../../config/task-graph';
2
+ import type { IoSnapshotVersion } from '../message-types/io-snapshot-version';
2
3
  interface HashTasksPayload {
3
4
  runnerOptions: any;
4
5
  tasks: Task[];
@@ -6,6 +7,7 @@ interface HashTasksPayload {
6
7
  perTaskEnvs: Record<string, NodeJS.ProcessEnv>;
7
8
  cwd: string;
8
9
  collectInputs?: boolean;
10
+ ioSnapshots?: IoSnapshotVersion;
9
11
  }
10
12
  export declare function handleHashTasks(payload: HashTasksPayload): Promise<{
11
13
  response: import("../../hasher/task-hasher").Hash[];
@@ -5,6 +5,8 @@ exports.handleHashTasksUpfront = handleHashTasksUpfront;
5
5
  const project_graph_incremental_recomputation_1 = require("./project-graph-incremental-recomputation");
6
6
  const task_hasher_1 = require("../../hasher/task-hasher");
7
7
  const configuration_1 = require("../../config/configuration");
8
+ const io_snapshots_state_1 = require("./io-snapshots-state");
9
+ const planning_context_1 = require("./planning-context");
8
10
  /**
9
11
  * We use this not to recreated hasher for every hash operation
10
12
  * TaskHasher has a cache inside, so keeping it around results in faster performance
@@ -19,13 +21,13 @@ async function getHasher(runnerOptions) {
19
21
  const nxJson = (0, configuration_1.readNxJson)();
20
22
  if (projectGraph !== storedProjectGraph) {
21
23
  storedProjectGraph = projectGraph;
22
- storedHasher = new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, runnerOptions);
24
+ storedHasher = new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, runnerOptions, (0, planning_context_1.planningContextFor)(projectGraph, nxJson));
23
25
  }
24
26
  return storedHasher;
25
27
  }
26
28
  async function handleHashTasks(payload) {
27
29
  const hasher = await getHasher(payload.runnerOptions);
28
- const response = await hasher.hashTasks(payload.tasks, payload.taskGraph, payload.perTaskEnvs, payload.cwd, payload.collectInputs);
30
+ const response = await hasher.hashTasks(payload.tasks, payload.taskGraph, payload.perTaskEnvs, payload.cwd, payload.collectInputs, (0, io_snapshots_state_1.getIoSnapshotsForVersion)(payload.ioSnapshots));
29
31
  return {
30
32
  response,
31
33
  description: 'handleHashTasks',
@@ -33,7 +35,7 @@ async function handleHashTasks(payload) {
33
35
  }
34
36
  async function handleHashTasksUpfront(payload) {
35
37
  const hasher = await getHasher(payload.runnerOptions);
36
- const response = await hasher.hashTasksUpfront(payload.tasks, payload.taskGraph, payload.perTaskEnvs, payload.cwd, payload.collectInputs);
38
+ const response = await hasher.hashTasksUpfront(payload.tasks, payload.taskGraph, payload.perTaskEnvs, payload.cwd, payload.collectInputs, (0, io_snapshots_state_1.getIoSnapshotsForVersion)(payload.ioSnapshots));
37
39
  return {
38
40
  response,
39
41
  description: 'handleHashTasksUpfront',
@@ -0,0 +1,3 @@
1
+ import { AffectedTasksRequest } from '../../project-graph/affected/affected-tasks';
2
+ import type { HandlerResult } from './server';
3
+ export declare function handleSelectAffectedTasks(request: AffectedTasksRequest): Promise<HandlerResult>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleSelectAffectedTasks = handleSelectAffectedTasks;
4
+ const configuration_1 = require("../../config/configuration");
5
+ const affected_tasks_1 = require("../../project-graph/affected/affected-tasks");
6
+ const io_snapshots_state_1 = require("./io-snapshots-state");
7
+ const planning_context_1 = require("./planning-context");
8
+ const project_graph_incremental_recomputation_1 = require("./project-graph-incremental-recomputation");
9
+ async function handleSelectAffectedTasks(request) {
10
+ const { error, projectGraph } = await (0, project_graph_incremental_recomputation_1.getCachedSerializedProjectGraphPromise)();
11
+ if (error) {
12
+ throw error;
13
+ }
14
+ const nxJson = (0, configuration_1.readNxJson)();
15
+ const selection = await (0, affected_tasks_1.selectAffectedTasks)(projectGraph, nxJson, (0, planning_context_1.planningContextFor)(projectGraph, nxJson), request, { ioSnapshots: (0, io_snapshots_state_1.getIoSnapshotsForVersion)(request.ioSnapshots) });
16
+ const response = {
17
+ projectGraph,
18
+ affectedTaskIds: [...selection.affectedTaskIds],
19
+ taskGraph: selection.taskGraph,
20
+ taskSelection: selection.taskSelection,
21
+ };
22
+ return { response, description: 'handleSelectAffectedTasks' };
23
+ }
@@ -0,0 +1,7 @@
1
+ import type { IoSnapshots } from '../../native';
2
+ import type { IoSnapshotVersion } from '../message-types/io-snapshot-version';
3
+ /**
4
+ * Exactly the version the client hashes from, never a newer import for the
5
+ * same commit. `undefined` when it is not stored, e.g. after `nx reset`.
6
+ */
7
+ export declare function getIoSnapshotsForVersion(version: IoSnapshotVersion | undefined): IoSnapshots | undefined;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIoSnapshotsForVersion = getIoSnapshotsForVersion;
4
+ const store_1 = require("../../io-snapshots/store");
5
+ // One handle at a time: entries read for a request serve the next one while
6
+ // the version holds, and another version replaces it, so nothing accumulates
7
+ // over a long-lived daemon.
8
+ let remembered;
9
+ /**
10
+ * Exactly the version the client hashes from, never a newer import for the
11
+ * same commit. `undefined` when it is not stored, e.g. after `nx reset`.
12
+ */
13
+ function getIoSnapshotsForVersion(version) {
14
+ if (!version) {
15
+ return undefined;
16
+ }
17
+ if (remembered?.commit === version.commit &&
18
+ remembered.resolution.fetchedAt === version.fetchedAt) {
19
+ return remembered;
20
+ }
21
+ const stored = readStored(version);
22
+ if (stored) {
23
+ remembered = stored;
24
+ }
25
+ return stored;
26
+ }
27
+ function readStored({ commit, fetchedAt, }) {
28
+ try {
29
+ return (0, store_1.getIoSnapshotStore)().getVersion(commit, fetchedAt) ?? undefined;
30
+ }
31
+ catch {
32
+ // An unusable database hashes natively rather than failing the request.
33
+ return undefined;
34
+ }
35
+ }
@@ -0,0 +1,8 @@
1
+ import type { NxJsonConfiguration } from '../../config/nx-json';
2
+ import type { ProjectGraph } from '../../config/project-graph';
3
+ import { TaskPlanningContext } from '../../hasher/task-planning-context';
4
+ /**
5
+ * One planner per daemon project graph, shared by affected selection and task
6
+ * hashing, so hashing reuses the plans selection made.
7
+ */
8
+ export declare function planningContextFor(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): TaskPlanningContext;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planningContextFor = planningContextFor;
4
+ const task_planning_context_1 = require("../../hasher/task-planning-context");
5
+ let stored = null;
6
+ /**
7
+ * One planner per daemon project graph, shared by affected selection and task
8
+ * hashing, so hashing reuses the plans selection made.
9
+ */
10
+ function planningContextFor(projectGraph, nxJson) {
11
+ if (stored?.projectGraph !== projectGraph) {
12
+ stored = {
13
+ projectGraph,
14
+ context: (0, task_planning_context_1.createTaskPlanningContext)(projectGraph, nxJson),
15
+ };
16
+ }
17
+ return stored.context;
18
+ }
@@ -6,5 +6,6 @@ export type HandlerResult = {
6
6
  response?: string | object | boolean;
7
7
  };
8
8
  export declare const openSockets: Set<Socket>;
9
+ export declare function handleMessage(socket: Socket, data: Buffer): Promise<void>;
9
10
  export declare function handleResult(socket: Socket, type: string, hrFn: () => Promise<HandlerResult>, mode: 'json' | 'v8'): Promise<void>;
10
11
  export declare function startServer(): Promise<Server>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.openSockets = void 0;
4
+ exports.handleMessage = handleMessage;
4
5
  exports.handleResult = handleResult;
5
6
  exports.startServer = startServer;
6
7
  const fs_1 = require("fs");
@@ -28,6 +29,7 @@ const get_files_in_directory_1 = require("../message-types/get-files-in-director
28
29
  const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
29
30
  const get_registered_sync_generators_1 = require("../message-types/get-registered-sync-generators");
30
31
  const get_plugin_capabilities_1 = require("../message-types/get-plugin-capabilities");
32
+ const select_affected_tasks_1 = require("../message-types/select-affected-tasks");
31
33
  const get_sync_generator_changes_1 = require("../message-types/get-sync-generator-changes");
32
34
  const glob_1 = require("../message-types/glob");
33
35
  const hash_glob_1 = require("../message-types/hash-glob");
@@ -47,6 +49,7 @@ const handle_client_env_1 = require("./handle-client-env");
47
49
  const handle_get_files_in_directory_1 = require("./handle-get-files-in-directory");
48
50
  const handle_get_registered_sync_generators_1 = require("./handle-get-registered-sync-generators");
49
51
  const handle_get_plugin_capabilities_1 = require("./handle-get-plugin-capabilities");
52
+ const handle_select_affected_tasks_1 = require("./handle-select-affected-tasks");
50
53
  const handle_get_sync_generator_changes_1 = require("./handle-get-sync-generator-changes");
51
54
  const handle_glob_1 = require("./handle-glob");
52
55
  const handle_hash_glob_1 = require("./handle-hash-glob");
@@ -214,6 +217,9 @@ async function handleMessage(socket, data) {
214
217
  else if ((0, get_plugin_capabilities_1.isHandleGetPluginCapabilitiesMessage)(payload)) {
215
218
  await handleResult(socket, get_plugin_capabilities_1.GET_PLUGIN_CAPABILITIES, () => (0, handle_get_plugin_capabilities_1.handleGetPluginCapabilities)(), mode);
216
219
  }
220
+ else if ((0, select_affected_tasks_1.isHandleSelectAffectedTasksMessage)(payload)) {
221
+ await handleResult(socket, select_affected_tasks_1.SELECT_AFFECTED_TASKS, () => (0, handle_select_affected_tasks_1.handleSelectAffectedTasks)(payload.request), mode);
222
+ }
217
223
  else if ((0, update_workspace_context_1.isHandleUpdateWorkspaceContextMessage)(payload)) {
218
224
  await handleResult(socket, update_workspace_context_1.UPDATE_WORKSPACE_CONTEXT, () => (0, handle_update_workspace_context_1.handleUpdateWorkspaceContext)(payload.createdFiles, payload.updatedFiles, payload.deletedFiles), mode);
219
225
  }
@@ -1,4 +1,5 @@
1
1
  import { ExecutorContext } from '../../config/misc-interfaces';
2
+ import type { Task } from '../../config/task-graph';
2
3
  import { NoopChildProcess } from '../../tasks-runner/running-tasks/noop-child-process';
3
4
  import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks';
4
5
  export declare const LARGE_BUFFER: number;
@@ -55,5 +56,5 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
55
56
  success: boolean;
56
57
  terminalOutput: string;
57
58
  }>;
58
- export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, taskId?: string): Promise<NoopChildProcess | ParallelRunningTasks | import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | SeriallyRunningTasks>;
59
+ export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, task?: Pick<Task, 'id' | 'ultracache'>): Promise<NoopChildProcess | ParallelRunningTasks | import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | SeriallyRunningTasks>;
59
60
  export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
@@ -40,7 +40,7 @@ async function default_1(options, context) {
40
40
  success: results.code === 0,
41
41
  };
42
42
  }
43
- async function runCommands(options, context, taskId) {
43
+ async function runCommands(options, context, task) {
44
44
  const normalized = normalizeOptions(options);
45
45
  if (normalized.readyWhenStatus.length && !normalized.parallel) {
46
46
  throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
@@ -62,13 +62,27 @@ async function runCommands(options, context, taskId) {
62
62
  normalized.usePty;
63
63
  const tuiEnabled = (0, is_tui_enabled_1.isTuiEnabled)();
64
64
  try {
65
- const resolvedTaskId = taskId ??
65
+ // The orchestrator's in-process path passes the task with a stub context,
66
+ // so prefer it. `runExecutor` can name a target the task graph does not
67
+ // hold, hence the project lookup; `convert-nx-executor` has neither graph,
68
+ // and only then is the config unknowable, which counts as tracked.
69
+ const resolvedTaskId = task?.id ??
66
70
  (0, utils_1.createTaskId)(context.projectName, context.targetName, context.configurationName);
71
+ const resolvedTask = task ??
72
+ context.taskGraph?.tasks?.[resolvedTaskId] ?? {
73
+ id: resolvedTaskId,
74
+ // Both graphs are typed as present, but `convert-nx-executor` passes
75
+ // null for each.
76
+ ultracache: context.projectName && context.targetName
77
+ ? context.projectGraph?.nodes?.[context.projectName]?.data
78
+ .targets?.[context.targetName]?.ultracache
79
+ : undefined,
80
+ };
67
81
  const runningTask = isSingleCommandAndCanUsePseudoTerminal
68
- ? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context, resolvedTaskId)
82
+ ? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context, resolvedTask)
69
83
  : options.parallel
70
- ? new running_tasks_1.ParallelRunningTasks(normalized, context, resolvedTaskId)
71
- : new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled, resolvedTaskId);
84
+ ? new running_tasks_1.ParallelRunningTasks(normalized, context, resolvedTask)
85
+ : new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled, resolvedTask);
72
86
  return runningTask;
73
87
  }
74
88
  catch (e) {
@@ -2,6 +2,7 @@ import { Serializable } from 'child_process';
2
2
  import { ExecutorContext } from '../../config/misc-interfaces';
3
3
  import { PseudoTtyProcess } from '../../tasks-runner/pseudo-terminal';
4
4
  import { RunningTask } from '../../tasks-runner/running-tasks/running-task';
5
+ import type { Task } from '../../config/task-graph';
5
6
  import { NormalizedRunCommandsOptions } from './run-commands.impl';
6
7
  export declare class ParallelRunningTasks implements RunningTask {
7
8
  private readonly childProcesses;
@@ -12,7 +13,7 @@ export declare class ParallelRunningTasks implements RunningTask {
12
13
  private exited;
13
14
  private exitCode;
14
15
  private exitTerminalOutput;
15
- constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, taskId: string);
16
+ constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'>);
16
17
  getResults(): Promise<{
17
18
  code: number;
18
19
  terminalOutput: string;
@@ -27,7 +28,7 @@ export declare class ParallelRunningTasks implements RunningTask {
27
28
  }
28
29
  export declare class SeriallyRunningTasks implements RunningTask {
29
30
  private readonly tuiEnabled;
30
- private readonly taskId;
31
+ private readonly task;
31
32
  private terminalOutputChunks;
32
33
  private currentProcess;
33
34
  private exitCallbacks;
@@ -36,7 +37,7 @@ export declare class SeriallyRunningTasks implements RunningTask {
36
37
  private outputCallbacks;
37
38
  private exited;
38
39
  private exitTerminalOutput;
39
- constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, taskId: string);
40
+ constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, task: Pick<Task, 'id' | 'ultracache'>);
40
41
  private emitExit;
41
42
  getResults(): Promise<{
42
43
  code: number;
@@ -49,4 +50,4 @@ export declare class SeriallyRunningTasks implements RunningTask {
49
50
  private run;
50
51
  private createProcess;
51
52
  }
52
- export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext, taskId: string): Promise<PseudoTtyProcess>;
53
+ export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'>): Promise<PseudoTtyProcess>;
@@ -39,14 +39,14 @@ function commandExitedNonZeroWarning(command) {
39
39
  return `Warning: command "${command}" exited with non-zero status code`;
40
40
  }
41
41
  class ParallelRunningTasks {
42
- constructor(options, context, taskId) {
42
+ constructor(options, context, task) {
43
43
  this.exitCallbacks = [];
44
44
  this.outputCallbacks = [];
45
45
  // Memoized exit so late getResults()/onExit() callers don't hang.
46
46
  this.exited = false;
47
47
  this.exitCode = 0;
48
48
  this.exitTerminalOutput = '';
49
- this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile, taskId));
49
+ this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile, task));
50
50
  this.readyWhenStatus = options.readyWhenStatus;
51
51
  this.streamOutput = options.streamOutput;
52
52
  this.run();
@@ -156,9 +156,9 @@ class ParallelRunningTasks {
156
156
  }
157
157
  exports.ParallelRunningTasks = ParallelRunningTasks;
158
158
  class SeriallyRunningTasks {
159
- constructor(options, context, tuiEnabled, taskId) {
159
+ constructor(options, context, tuiEnabled, task) {
160
160
  this.tuiEnabled = tuiEnabled;
161
- this.taskId = taskId;
161
+ this.task = task;
162
162
  this.terminalOutputChunks = [];
163
163
  this.currentProcess = null;
164
164
  this.exitCallbacks = [];
@@ -225,7 +225,7 @@ class SeriallyRunningTasks {
225
225
  }
226
226
  async run(options, context) {
227
227
  for (const c of options.commands) {
228
- const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.taskId, options.usePty, options.streamOutput, options.tty, options.envFile);
228
+ const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.task, options.usePty, options.streamOutput, options.tty, options.envFile);
229
229
  this.currentProcess = childProcess;
230
230
  childProcess.onOutput((output) => {
231
231
  for (const cb of this.outputCallbacks) {
@@ -244,7 +244,7 @@ class SeriallyRunningTasks {
244
244
  }
245
245
  }
246
246
  }
247
- async createProcess(commandConfig, color, cwd, env, taskId, usePty = true, streamOutput = true, tty, envFile) {
247
+ async createProcess(commandConfig, color, cwd, env, task, usePty = true, streamOutput = true, tty, envFile) {
248
248
  // The rust runCommand is always a tty, so it will not look nice in parallel and if we need prefixes
249
249
  // currently does not work properly in windows
250
250
  if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
@@ -258,11 +258,11 @@ class SeriallyRunningTasks {
258
258
  // Skip registration if we're in a forked executor - the fork wrapper already registered
259
259
  const pid = pseudoTtyProcess.getPid();
260
260
  if (pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
261
- (0, task_io_service_1.registerTaskProcessStart)(taskId, pid);
261
+ (0, task_io_service_1.registerTaskProcessStart)(task, pid);
262
262
  }
263
263
  return pseudoTtyProcess;
264
264
  }
265
- return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile, taskId);
265
+ return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile, task);
266
266
  }
267
267
  }
268
268
  exports.SeriallyRunningTasks = SeriallyRunningTasks;
@@ -271,10 +271,10 @@ class RunningNodeProcess {
271
271
  stream(chunk, target = process.stdout) {
272
272
  streamChunk(chunk, this.streamOutput, target);
273
273
  }
274
- constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile, taskId) {
274
+ constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile, task) {
275
275
  this.readyWhenStatus = readyWhenStatus;
276
276
  this.streamOutput = streamOutput;
277
- this.taskId = taskId;
277
+ this.task = task;
278
278
  this.terminalOutputChunks = [];
279
279
  this.exitCallbacks = [];
280
280
  this.outputCallbacks = [];
@@ -304,7 +304,7 @@ class RunningNodeProcess {
304
304
  // Register process for metrics collection
305
305
  // Skip registration if we're in a forked executor - the fork wrapper already registered
306
306
  if (this.childProcess.pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
307
- (0, task_io_service_1.registerTaskProcessStart)(taskId, this.childProcess.pid);
307
+ (0, task_io_service_1.registerTaskProcessStart)(this.task, this.childProcess.pid);
308
308
  }
309
309
  this.addListeners(commandConfig);
310
310
  }
@@ -458,14 +458,14 @@ class RunningNodeProcess {
458
458
  }
459
459
  }
460
460
  }
461
- async function runSingleCommandWithPseudoTerminal(normalized, context, taskId) {
461
+ async function runSingleCommandWithPseudoTerminal(normalized, context, task) {
462
462
  const pseudoTerminal = (0, pseudo_terminal_1.createPseudoTerminal)();
463
463
  const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, normalized.commands[0], normalized.color, calculateCwd(normalized.cwd, context), normalized.env, normalized.streamOutput, pseudoTerminal ? normalized.isTTY : false, normalized.envFile);
464
464
  // Register process for metrics collection (direct run-commands execution)
465
465
  // Skip registration if we're in a forked executor - the fork wrapper already registered
466
466
  const pid = pseudoTtyProcess.getPid();
467
467
  if (pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
468
- (0, task_io_service_1.registerTaskProcessStart)(taskId, pid);
468
+ (0, task_io_service_1.registerTaskProcessStart)(task, pid);
469
469
  }
470
470
  registerProcessListener(pseudoTtyProcess, pseudoTerminal);
471
471
  return pseudoTtyProcess;
@@ -1,4 +1,11 @@
1
1
  import { NxJsonConfiguration } from '../config/nx-json';
2
2
  import { ProjectGraph } from '../config/project-graph';
3
+ import type { IoSnapshots } from '../native';
4
+ import type { TaskPlanningContext } from './task-planning-context';
3
5
  import { TaskHasher } from './task-hasher';
4
- export declare function createTaskHasher(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, runnerOptions?: any): TaskHasher;
6
+ /**
7
+ * `ioSnapshots` is this run's set (see `loadIoSnapshotsForRun`); undefined
8
+ * hashes natively. The daemon gets its version, so it hashes from the same
9
+ * set even after a newer one is imported for the commit.
10
+ */
11
+ export declare function createTaskHasher(projectGraph: ProjectGraph, nxJson: NxJsonConfiguration, runnerOptions?: any, ioSnapshots?: IoSnapshots, planningContext?: TaskPlanningContext): TaskHasher;
@@ -4,12 +4,22 @@ exports.createTaskHasher = createTaskHasher;
4
4
  const client_1 = require("../daemon/client/client");
5
5
  const build_project_graph_1 = require("../project-graph/build-project-graph");
6
6
  const task_hasher_1 = require("./task-hasher");
7
- function createTaskHasher(projectGraph, nxJson, runnerOptions) {
7
+ /**
8
+ * `ioSnapshots` is this run's set (see `loadIoSnapshotsForRun`); undefined
9
+ * hashes natively. The daemon gets its version, so it hashes from the same
10
+ * set even after a newer one is imported for the commit.
11
+ */
12
+ function createTaskHasher(projectGraph, nxJson, runnerOptions, ioSnapshots, planningContext) {
8
13
  if (client_1.daemonClient.enabled()) {
9
- return new task_hasher_1.DaemonBasedTaskHasher(client_1.daemonClient, runnerOptions);
14
+ return new task_hasher_1.DaemonBasedTaskHasher(client_1.daemonClient, runnerOptions, ioSnapshots
15
+ ? {
16
+ commit: ioSnapshots.commit,
17
+ fetchedAt: ioSnapshots.resolution.fetchedAt,
18
+ }
19
+ : undefined);
10
20
  }
11
21
  else {
12
22
  const { rustReferences } = (0, build_project_graph_1.getFileMap)();
13
- return new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, runnerOptions);
23
+ return new task_hasher_1.InProcessTaskHasher(projectGraph, nxJson, rustReferences, runnerOptions, planningContext, ioSnapshots);
14
24
  }
15
25
  }
@@ -14,7 +14,7 @@ class HashPlanInspector {
14
14
  this.projectGraph = projectGraph;
15
15
  this.workspaceRootPath = workspaceRootPath;
16
16
  this.nxJson = nxJson ?? (0, nx_json_1.readNxJson)(this.workspaceRootPath);
17
- this.projectGraphRef = (0, native_1.transferProjectGraph)((0, transform_objects_1.transformProjectGraphForRust)(this.projectGraph));
17
+ this.projectGraphRef = (0, transform_objects_1.transformProjectGraphForRust)(this.projectGraph);
18
18
  this.planner = new native_1.HashPlanner(this.nxJson, this.projectGraphRef);
19
19
  }
20
20
  async init() {
@@ -44,7 +44,7 @@ class HashPlanInspector {
44
44
  configuration: configuration,
45
45
  targets: [target],
46
46
  }, 'run-one', { printWarnings: false }, this.nxJson);
47
- // Create task graph exactly like run-one.ts does via createTaskGraphAndRunValidations
47
+ // Same task graph run-one builds via `selectTasksForProjects`.
48
48
  const taskGraph = (0, create_task_graph_1.createTaskGraph)(this.projectGraph, extraTargetDependencies, [project], nxArgs.targets, nxArgs.configuration, overrides, excludeTaskDependencies);
49
49
  // Generate task IDs for ALL tasks in the task graph (including dependencies)
50
50
  const taskIds = Object.keys(taskGraph.tasks);
@@ -1,10 +1,10 @@
1
1
  import { NxJsonConfiguration } from '../config/nx-json';
2
2
  import { ProjectGraph } from '../config/project-graph';
3
3
  import { Task, TaskGraph } from '../config/task-graph';
4
- import { TaskDetails } from '../native';
4
+ import { type IoSnapshots, TaskDetails } from '../native';
5
5
  import { TaskHasher } from './task-hasher';
6
6
  export declare function getTaskDetails(): TaskDetails | null;
7
- export declare function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, tasksDetails: TaskDetails | null): Promise<void>;
7
+ export declare function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, tasksDetails: TaskDetails | null, ioSnapshots?: IoSnapshots): Promise<void>;
8
8
  export declare function hashTask(hasher: TaskHasher, projectGraph: ProjectGraph, taskGraph: TaskGraph, task: Task, env: NodeJS.ProcessEnv, taskDetails: TaskDetails | null): Promise<void>;
9
9
  /**
10
10
  * Batch-hash `tasks`. `perTaskEnvs` must contain an entry keyed by