@depup/nx 23.2.1-depup.8 → 23.3.0-depup.0

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 (350) hide show
  1. package/README.md +7 -18
  2. package/changes.json +9 -53
  3. package/dist/bin/init-local.js +7 -1
  4. package/dist/nx-cloud-internals.d.ts +1 -0
  5. package/dist/nx-cloud-internals.js +9 -0
  6. package/dist/plugins/package-json.js +1 -1
  7. package/dist/src/command-line/add/add.js +5 -1
  8. package/dist/src/command-line/affected/affected.js +70 -9
  9. package/dist/src/command-line/affected/command-object.js +1 -1
  10. package/dist/src/command-line/format/format.js +2 -18
  11. package/dist/src/command-line/graph/graph.d.ts +31 -0
  12. package/dist/src/command-line/graph/graph.js +113 -20
  13. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +0 -3
  14. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +0 -3
  15. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +0 -3
  16. package/dist/src/command-line/init/implementation/angular/index.js +0 -3
  17. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +0 -3
  18. package/dist/src/command-line/init/implementation/format.js +2 -3
  19. package/dist/src/command-line/init/implementation/utils.d.ts +0 -1
  20. package/dist/src/command-line/init/implementation/utils.js +6 -9
  21. package/dist/src/command-line/init/init-v2.js +0 -3
  22. package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +25 -0
  23. package/dist/src/command-line/migrate/agentic/capture-generator-output.js +121 -5
  24. package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +21 -0
  25. package/dist/src/command-line/migrate/agentic/close-agent-session.js +126 -0
  26. package/dist/src/command-line/migrate/agentic/definitions.d.ts +24 -0
  27. package/dist/src/command-line/migrate/agentic/definitions.js +79 -20
  28. package/dist/src/command-line/migrate/agentic/format-command.d.ts +14 -0
  29. package/dist/src/command-line/migrate/agentic/format-command.js +44 -0
  30. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +3 -3
  31. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +3 -3
  32. package/dist/src/command-line/migrate/agentic/handoff.d.ts +50 -17
  33. package/dist/src/command-line/migrate/agentic/handoff.js +166 -24
  34. package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +23 -0
  35. package/dist/src/command-line/migrate/agentic/instruction-files.js +41 -0
  36. package/dist/src/command-line/migrate/agentic/master/invocations.d.ts +12 -0
  37. package/dist/src/command-line/migrate/agentic/master/invocations.js +54 -0
  38. package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +16 -0
  39. package/dist/src/command-line/migrate/agentic/master/run-master-session.js +175 -0
  40. package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +31 -0
  41. package/dist/src/command-line/migrate/agentic/master/spawn-master.js +222 -0
  42. package/dist/src/command-line/migrate/agentic/prompts/final-validation.d.ts +13 -0
  43. package/dist/src/command-line/migrate/agentic/prompts/final-validation.js +41 -0
  44. package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +17 -0
  45. package/dist/src/command-line/migrate/agentic/prompts/fragments.js +90 -0
  46. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +4 -3
  47. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +25 -1
  48. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +57 -34
  49. package/dist/src/command-line/migrate/agentic/run-step.js +28 -4
  50. package/dist/src/command-line/migrate/agentic/runner.d.ts +3 -15
  51. package/dist/src/command-line/migrate/agentic/runner.js +57 -239
  52. package/dist/src/command-line/migrate/agentic/terminal-repair.d.ts +1 -0
  53. package/dist/src/command-line/migrate/agentic/terminal-repair.js +27 -0
  54. package/dist/src/command-line/migrate/agentic/types.d.ts +23 -8
  55. package/dist/src/command-line/migrate/agentic/types.js +10 -7
  56. package/dist/src/command-line/migrate/agentic/windows-cmd.d.ts +33 -0
  57. package/dist/src/command-line/migrate/agentic/windows-cmd.js +88 -0
  58. package/dist/src/command-line/migrate/command-object.d.ts +2 -0
  59. package/dist/src/command-line/migrate/command-object.js +11 -1
  60. package/dist/src/command-line/migrate/deferred-output.d.ts +44 -0
  61. package/dist/src/command-line/migrate/deferred-output.js +92 -0
  62. package/dist/src/command-line/migrate/execute-migration.d.ts +9 -3
  63. package/dist/src/command-line/migrate/execute-migration.js +53 -16
  64. package/dist/src/command-line/migrate/migrate-analytics.d.ts +34 -9
  65. package/dist/src/command-line/migrate/migrate-analytics.js +71 -10
  66. package/dist/src/command-line/migrate/migrate-commits.d.ts +5 -4
  67. package/dist/src/command-line/migrate/migrate-commits.js +16 -6
  68. package/dist/src/command-line/migrate/migrate-config.d.ts +5 -2
  69. package/dist/src/command-line/migrate/migrate-config.js +19 -11
  70. package/dist/src/command-line/migrate/migrate-output.d.ts +3 -7
  71. package/dist/src/command-line/migrate/migrate-output.js +3 -7
  72. package/dist/src/command-line/migrate/migrate.d.ts +3 -0
  73. package/dist/src/command-line/migrate/migrate.js +183 -46
  74. package/dist/src/command-line/migrate/resolve-package-version.js +2 -19
  75. package/dist/src/command-line/migrate/run/agent-output.d.ts +11 -0
  76. package/dist/src/command-line/migrate/run/agent-output.js +21 -2
  77. package/dist/src/command-line/migrate/run/agent-work-payload.d.ts +37 -0
  78. package/dist/src/command-line/migrate/run/agent-work-payload.js +156 -0
  79. package/dist/src/command-line/migrate/run/atomic-write.d.ts +8 -0
  80. package/dist/src/command-line/migrate/run/atomic-write.js +17 -0
  81. package/dist/src/command-line/migrate/run/broker.d.ts +150 -0
  82. package/dist/src/command-line/migrate/run/broker.js +568 -0
  83. package/dist/src/command-line/migrate/run/clean-retry.d.ts +12 -0
  84. package/dist/src/command-line/migrate/run/clean-retry.js +99 -0
  85. package/dist/src/command-line/migrate/run/existing-run-report.d.ts +55 -0
  86. package/dist/src/command-line/migrate/run/existing-run-report.js +227 -0
  87. package/dist/src/command-line/migrate/run/give-up.d.ts +41 -0
  88. package/dist/src/command-line/migrate/run/give-up.js +148 -0
  89. package/dist/src/command-line/migrate/run/index.d.ts +9 -6
  90. package/dist/src/command-line/migrate/run/index.js +21 -2
  91. package/dist/src/command-line/migrate/run/issues.d.ts +127 -0
  92. package/dist/src/command-line/migrate/run/issues.js +1121 -0
  93. package/dist/src/command-line/migrate/run/orchestrator.d.ts +59 -1
  94. package/dist/src/command-line/migrate/run/orchestrator.js +1529 -457
  95. package/dist/src/command-line/migrate/run/run-id.d.ts +0 -8
  96. package/dist/src/command-line/migrate/run/run-id.js +0 -30
  97. package/dist/src/command-line/migrate/run/run-state.d.ts +77 -17
  98. package/dist/src/command-line/migrate/run/run-state.js +263 -32
  99. package/dist/src/command-line/migrate/run/runbook.d.ts +18 -0
  100. package/dist/src/command-line/migrate/run/runbook.js +118 -0
  101. package/dist/src/command-line/migrate/run/state-lock.d.ts +33 -2
  102. package/dist/src/command-line/migrate/run/state-lock.js +128 -2
  103. package/dist/src/command-line/migrate/run/state-machine.d.ts +50 -1
  104. package/dist/src/command-line/migrate/run/state-machine.js +339 -26
  105. package/dist/src/command-line/migrate/run/util.d.ts +3 -1
  106. package/dist/src/command-line/migrate/run/util.js +24 -3
  107. package/dist/src/command-line/migrate/run/worker.js +290 -129
  108. package/dist/src/command-line/migrate/step-actions.d.ts +1 -1
  109. package/dist/src/command-line/migrate/step-actions.js +7 -1
  110. package/dist/src/command-line/migrate/text.d.ts +6 -0
  111. package/dist/src/command-line/migrate/text.js +25 -0
  112. package/dist/src/command-line/migrate/version-skew-guard.js +2 -0
  113. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +5 -11
  114. package/dist/src/command-line/release/publish.js +11 -8
  115. package/dist/src/command-line/release/utils/get-touched-projects-for-group.js +3 -3
  116. package/dist/src/command-line/release/utils/release-graph.js +1 -1
  117. package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -8
  118. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +3 -3
  119. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.d.ts +4 -2
  120. package/dist/src/command-line/release/utils/remote-release-clients/remote-release-client.js +37 -3
  121. package/dist/src/command-line/release/version/version-actions.d.ts +3 -0
  122. package/dist/src/command-line/reset/reset.js +10 -4
  123. package/dist/src/command-line/run/run-one.js +5 -1
  124. package/dist/src/command-line/run-many/run-many.js +6 -12
  125. package/dist/src/command-line/show/command-object.js +1 -1
  126. package/dist/src/command-line/show/projects.js +52 -1
  127. package/dist/src/command-line/yargs-utils/shared-options.d.ts +5 -1
  128. package/dist/src/command-line/yargs-utils/shared-options.js +38 -4
  129. package/dist/src/config/task-graph.d.ts +1 -1
  130. package/dist/src/config/workspace-json-project-json.d.ts +23 -1
  131. package/dist/src/core/graph/main.js +1 -1
  132. package/dist/src/core/graph/runtime.js +1 -1
  133. package/dist/src/core/graph/styles.js +1 -1
  134. package/dist/src/daemon/client/client.d.ts +14 -8
  135. package/dist/src/daemon/client/client.js +41 -12
  136. package/dist/src/daemon/message-types/get-plugin-capabilities.d.ts +5 -0
  137. package/dist/src/daemon/message-types/get-plugin-capabilities.js +11 -0
  138. package/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts +3 -2
  139. package/dist/src/daemon/message-types/select-affected-tasks.d.ts +21 -0
  140. package/dist/src/daemon/message-types/select-affected-tasks.js +11 -0
  141. package/dist/src/daemon/message-types/ultracache-configuration-version.d.ts +8 -0
  142. package/dist/src/daemon/message-types/ultracache-configuration-version.js +2 -0
  143. package/dist/src/daemon/server/dotenv-graph-changes.d.ts +1 -1
  144. package/dist/src/daemon/server/dotenv-graph-changes.js +2 -2
  145. package/dist/src/daemon/server/handle-get-plugin-capabilities.d.ts +2 -0
  146. package/dist/src/daemon/server/handle-get-plugin-capabilities.js +13 -0
  147. package/dist/src/daemon/server/handle-hash-tasks.d.ts +10 -2
  148. package/dist/src/daemon/server/handle-hash-tasks.js +18 -3
  149. package/dist/src/daemon/server/handle-select-affected-tasks.d.ts +3 -0
  150. package/dist/src/daemon/server/handle-select-affected-tasks.js +26 -0
  151. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +3 -2
  152. package/dist/src/daemon/server/{handle-outputs-changes.d.ts → handle-watch-events.d.ts} +4 -4
  153. package/dist/src/daemon/server/{handle-outputs-changes.js → handle-watch-events.js} +36 -37
  154. package/dist/src/daemon/server/outputs-tracking.d.ts +7 -19
  155. package/dist/src/daemon/server/outputs-tracking.js +7 -107
  156. package/dist/src/daemon/server/planning-context.d.ts +8 -0
  157. package/dist/src/daemon/server/planning-context.js +18 -0
  158. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +22 -7
  159. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +104 -74
  160. package/dist/src/daemon/server/restart-checks.d.ts +22 -0
  161. package/dist/src/daemon/server/restart-checks.js +77 -0
  162. package/dist/src/daemon/server/server.d.ts +1 -0
  163. package/dist/src/daemon/server/server.js +54 -30
  164. package/dist/src/daemon/server/shutdown-utils.d.ts +0 -5
  165. package/dist/src/daemon/server/shutdown-utils.js +3 -26
  166. package/dist/src/daemon/server/ultracache-configuration-state.d.ts +7 -0
  167. package/dist/src/daemon/server/ultracache-configuration-state.js +36 -0
  168. package/dist/src/devkit-internals.d.ts +3 -1
  169. package/dist/src/devkit-internals.js +8 -3
  170. package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -1
  171. package/dist/src/executors/run-commands/run-commands.impl.js +19 -5
  172. package/dist/src/executors/run-commands/running-tasks.d.ts +5 -4
  173. package/dist/src/executors/run-commands/running-tasks.js +13 -13
  174. package/dist/src/hasher/create-task-hasher.d.ts +8 -1
  175. package/dist/src/hasher/create-task-hasher.js +13 -3
  176. package/dist/src/hasher/hash-plan-inspector.js +2 -2
  177. package/dist/src/hasher/hash-task.d.ts +2 -2
  178. package/dist/src/hasher/hash-task.js +28 -17
  179. package/dist/src/hasher/native-task-hasher-impl.d.ts +20 -4
  180. package/dist/src/hasher/native-task-hasher-impl.js +75 -9
  181. package/dist/src/hasher/task-hasher.d.ts +24 -7
  182. package/dist/src/hasher/task-hasher.js +27 -8
  183. package/dist/src/hasher/task-planning-context.d.ts +13 -0
  184. package/dist/src/hasher/task-planning-context.js +12 -0
  185. package/dist/src/native/index.d.ts +582 -21
  186. package/dist/src/native/index.js +3 -3
  187. package/dist/src/native/native-bindings.js +13 -1
  188. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  189. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  190. package/dist/src/native/transform-objects.d.ts +11 -2
  191. package/dist/src/native/transform-objects.js +46 -0
  192. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +15 -8
  193. package/dist/src/nx-cloud/update-manager.d.ts +3 -0
  194. package/dist/src/nx-cloud/update-manager.js +19 -13
  195. package/dist/src/nx-cloud/utilities/client.d.ts +1 -1
  196. package/dist/src/nx-cloud/utilities/client.js +1 -1
  197. package/dist/src/nx-cloud/utilities/is-workspace-claimed.js +2 -1
  198. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.d.ts +5 -0
  199. package/dist/src/nx-cloud/utilities/nx-cloud-http-client.js +16 -0
  200. package/dist/src/nx-cloud/utilities/url-shorten.js +17 -10
  201. package/dist/src/plugins/js/index.js +45 -64
  202. package/dist/src/plugins/js/lock-file/lock-file.d.ts +4 -4
  203. package/dist/src/plugins/js/lock-file/lock-file.js +6 -7
  204. package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -1
  205. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +2 -0
  206. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +22 -0
  207. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.d.ts +10 -2
  208. package/dist/src/plugins/js/project-graph/affected/lock-file-changes.js +51 -29
  209. package/dist/src/plugins/js/project-graph/affected/npm-packages.d.ts +10 -2
  210. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +32 -11
  211. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +22 -18
  212. package/dist/src/plugins/js/utils/register.js +13 -4
  213. package/dist/src/plugins/package-json/create-nodes.d.ts +2 -2
  214. package/dist/src/plugins/package-json/create-nodes.js +13 -13
  215. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +14 -0
  216. package/dist/src/project-graph/affected/affected-project-graph.js +5 -18
  217. package/dist/src/project-graph/affected/affected-projects.d.ts +7 -0
  218. package/dist/src/project-graph/affected/affected-projects.js +42 -0
  219. package/dist/src/project-graph/affected/affected-reasons.d.ts +116 -0
  220. package/dist/src/project-graph/affected/affected-reasons.js +459 -0
  221. package/dist/src/project-graph/affected/affected-tasks.d.ts +103 -0
  222. package/dist/src/project-graph/affected/affected-tasks.js +386 -0
  223. package/dist/src/project-graph/affected/print-explanation.d.ts +11 -0
  224. package/dist/src/project-graph/affected/print-explanation.js +44 -0
  225. package/dist/src/project-graph/error-types.d.ts +5 -0
  226. package/dist/src/project-graph/error-types.js +44 -5
  227. package/dist/src/project-graph/file-utils.d.ts +2 -0
  228. package/dist/src/project-graph/file-utils.js +12 -3
  229. package/dist/src/project-graph/nx-deps-cache.d.ts +5 -2
  230. package/dist/src/project-graph/nx-deps-cache.js +4 -4
  231. package/dist/src/project-graph/plugins/get-plugins.d.ts +3 -1
  232. package/dist/src/project-graph/plugins/get-plugins.js +60 -82
  233. package/dist/src/project-graph/plugins/in-process-loader.d.ts +1 -1
  234. package/dist/src/project-graph/plugins/in-process-loader.js +1 -4
  235. package/dist/src/project-graph/plugins/isolation/index.d.ts +1 -1
  236. package/dist/src/project-graph/plugins/isolation/index.js +3 -1
  237. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +8 -0
  238. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +42 -6
  239. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.d.ts +10 -1
  240. package/dist/src/project-graph/plugins/isolation/load-isolated-plugin.js +67 -17
  241. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +3 -2
  242. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +5 -1
  243. package/dist/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -2
  244. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +14 -1
  245. package/dist/src/project-graph/plugins/nx-plugin-capabilities.d.ts +6 -0
  246. package/dist/src/project-graph/plugins/nx-plugin-capabilities.js +28 -0
  247. package/dist/src/project-graph/plugins/task-results-stub.d.ts +50 -0
  248. package/dist/src/project-graph/plugins/task-results-stub.js +111 -0
  249. package/dist/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -2
  250. package/dist/src/project-graph/plugins/tasks-execution-hooks.js +14 -1
  251. package/dist/src/project-graph/project-graph.js +43 -42
  252. package/dist/src/project-graph/utils/project-configuration/target-merging.js +67 -0
  253. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +83 -0
  254. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +1 -0
  255. package/dist/src/project-graph/utils/project-configuration/utils.js +1 -0
  256. package/dist/src/tasks-runner/batch/run-batch.js +15 -0
  257. package/dist/src/tasks-runner/cache.d.ts +37 -2
  258. package/dist/src/tasks-runner/cache.js +42 -1
  259. package/dist/src/tasks-runner/create-task-graph.d.ts +24 -1
  260. package/dist/src/tasks-runner/create-task-graph.js +57 -2
  261. package/dist/src/tasks-runner/default-tasks-runner.js +1 -1
  262. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  263. package/dist/src/tasks-runner/forked-process-task-runner.js +11 -10
  264. package/dist/src/tasks-runner/init-tasks-runner.d.ts +7 -2
  265. package/dist/src/tasks-runner/init-tasks-runner.js +15 -7
  266. package/dist/src/tasks-runner/is-tui-enabled.js +4 -3
  267. package/dist/src/tasks-runner/life-cycle.d.ts +7 -0
  268. package/dist/src/tasks-runner/life-cycle.js +7 -0
  269. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.d.ts +35 -0
  270. package/dist/src/tasks-runner/life-cycles/summary-terminal-output-life-cycle.js +146 -0
  271. package/dist/src/tasks-runner/prune-task-graph.d.ts +17 -0
  272. package/dist/src/tasks-runner/prune-task-graph.js +45 -0
  273. package/dist/src/tasks-runner/run-command.d.ts +41 -5
  274. package/dist/src/tasks-runner/run-command.js +98 -22
  275. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +93 -19
  276. package/dist/src/tasks-runner/running-tasks/batch-process.js +184 -88
  277. package/dist/src/tasks-runner/task-io-service.d.ts +11 -3
  278. package/dist/src/tasks-runner/task-io-service.js +14 -5
  279. package/dist/src/tasks-runner/task-orchestrator.d.ts +71 -4
  280. package/dist/src/tasks-runner/task-orchestrator.js +266 -66
  281. package/dist/src/tasks-runner/tasks-runner.d.ts +2 -0
  282. package/dist/src/tasks-runner/terminal-output-path.d.ts +11 -0
  283. package/dist/src/tasks-runner/terminal-output-path.js +18 -0
  284. package/dist/src/tasks-runner/utils.d.ts +5 -0
  285. package/dist/src/tasks-runner/utils.js +14 -2
  286. package/dist/src/ultracache/config.d.ts +21 -0
  287. package/dist/src/ultracache/config.js +29 -0
  288. package/dist/src/ultracache/fetch.d.ts +21 -0
  289. package/dist/src/ultracache/fetch.js +43 -0
  290. package/dist/src/ultracache/overrides.d.ts +17 -0
  291. package/dist/src/ultracache/overrides.js +61 -0
  292. package/dist/src/ultracache/report.d.ts +13 -0
  293. package/dist/src/ultracache/report.js +62 -0
  294. package/dist/src/ultracache/store.d.ts +41 -0
  295. package/dist/src/ultracache/store.js +158 -0
  296. package/dist/src/utils/ab-testing.d.ts +4 -1
  297. package/dist/src/utils/ab-testing.js +22 -19
  298. package/dist/src/utils/chunkify.d.ts +1 -7
  299. package/dist/src/utils/chunkify.js +2 -8
  300. package/dist/src/utils/command-line-utils.d.ts +20 -0
  301. package/dist/src/utils/command-line-utils.js +10 -3
  302. package/dist/src/utils/create-cli-options.d.ts +6 -0
  303. package/dist/src/utils/create-cli-options.js +29 -0
  304. package/dist/src/utils/db-connection.d.ts +2 -0
  305. package/dist/src/utils/db-connection.js +2 -0
  306. package/dist/src/utils/formatters/index.d.ts +6 -0
  307. package/dist/src/utils/formatters/index.js +5 -0
  308. package/dist/src/utils/formatters/prettier.d.ts +0 -8
  309. package/dist/src/utils/formatters/prettier.js +4 -26
  310. package/dist/src/utils/git-utils.d.ts +19 -0
  311. package/dist/src/utils/git-utils.js +97 -39
  312. package/dist/src/utils/handle-errors.js +5 -43
  313. package/dist/src/utils/http-client.d.ts +27 -0
  314. package/dist/src/utils/http-client.js +193 -0
  315. package/dist/src/utils/installed-nx-version.js +2 -48
  316. package/dist/src/utils/json-diff.d.ts +4 -2
  317. package/dist/src/utils/json-diff.js +6 -94
  318. package/dist/src/utils/min-release-age/packument.js +1 -1
  319. package/dist/src/utils/nx-cloud-utils.d.ts +2 -0
  320. package/dist/src/utils/nx-cloud-utils.js +6 -1
  321. package/dist/src/utils/output.d.ts +22 -3
  322. package/dist/src/utils/output.js +28 -5
  323. package/dist/src/utils/package-json.d.ts +25 -0
  324. package/dist/src/utils/package-json.js +49 -6
  325. package/dist/src/utils/package-manager.d.ts +6 -0
  326. package/dist/src/utils/package-manager.js +10 -0
  327. package/dist/src/utils/plugins/plugin-capabilities.js +7 -2
  328. package/dist/src/utils/project-graph-utils.d.ts +2 -0
  329. package/dist/src/utils/project-graph-utils.js +12 -0
  330. package/dist/src/utils/provenance.js +20 -4
  331. package/dist/src/utils/serialize-overrides-into-command-line.js +2 -4
  332. package/dist/src/utils/workspace-context.d.ts +51 -3
  333. package/dist/src/utils/workspace-context.js +174 -10
  334. package/package.json +36 -98
  335. package/schemas/nx-schema.json +38 -0
  336. package/schemas/project-schema.json +35 -0
  337. package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +0 -9
  338. package/dist/src/daemon/server/file-watching/route-workspace-changes.js +0 -76
  339. package/dist/src/daemon/server/watcher.d.ts +0 -18
  340. package/dist/src/daemon/server/watcher.js +0 -126
  341. package/dist/src/nx-cloud/utilities/axios.d.ts +0 -4
  342. package/dist/src/nx-cloud/utilities/axios.js +0 -17
  343. package/dist/src/project-graph/affected/locators/project-glob-changes.d.ts +0 -2
  344. package/dist/src/project-graph/affected/locators/project-glob-changes.js +0 -47
  345. package/dist/src/project-graph/affected/locators/workspace-json-changes.d.ts +0 -4
  346. package/dist/src/project-graph/affected/locators/workspace-json-changes.js +0 -47
  347. package/dist/src/project-graph/affected/locators/workspace-projects.d.ts +0 -3
  348. package/dist/src/project-graph/affected/locators/workspace-projects.js +0 -74
  349. package/dist/src/utils/collapse-expanded-outputs.d.ts +0 -10
  350. package/dist/src/utils/collapse-expanded-outputs.js +0 -72
@@ -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");
@@ -14,7 +15,6 @@ const native_1 = require("../../native");
14
15
  const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
15
16
  require("../../utils/perf-logging");
16
17
  const versions_1 = require("../../utils/versions");
17
- const workspace_context_1 = require("../../utils/workspace-context");
18
18
  const workspace_root_1 = require("../../utils/workspace-root");
19
19
  const cache_1 = require("../cache");
20
20
  const is_nx_version_mismatch_1 = require("../is-nx-version-mismatch");
@@ -28,6 +28,8 @@ const get_context_file_data_1 = require("../message-types/get-context-file-data"
28
28
  const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
29
29
  const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
30
30
  const get_registered_sync_generators_1 = require("../message-types/get-registered-sync-generators");
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");
@@ -38,7 +40,6 @@ const task_history_1 = require("../message-types/task-history");
38
40
  const update_workspace_context_1 = require("../message-types/update-workspace-context");
39
41
  const socket_utils_1 = require("../socket-utils");
40
42
  const file_change_events_1 = require("./file-watching/file-change-events");
41
- const route_workspace_changes_1 = require("./file-watching/route-workspace-changes");
42
43
  const file_watcher_sockets_1 = require("./file-watching/file-watcher-sockets");
43
44
  const handle_configure_ai_agents_1 = require("./handle-configure-ai-agents");
44
45
  const handle_context_file_data_1 = require("./handle-context-file-data");
@@ -47,6 +48,8 @@ const handle_force_shutdown_1 = require("./handle-force-shutdown");
47
48
  const handle_client_env_1 = require("./handle-client-env");
48
49
  const handle_get_files_in_directory_1 = require("./handle-get-files-in-directory");
49
50
  const handle_get_registered_sync_generators_1 = require("./handle-get-registered-sync-generators");
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");
@@ -60,12 +63,14 @@ const handle_request_shutdown_1 = require("./handle-request-shutdown");
60
63
  const handle_task_history_1 = require("./handle-task-history");
61
64
  const handle_tasks_execution_hooks_1 = require("./handle-tasks-execution-hooks");
62
65
  const handle_update_workspace_context_1 = require("./handle-update-workspace-context");
63
- const handle_outputs_changes_1 = require("./handle-outputs-changes");
66
+ const handle_watch_events_1 = require("./handle-watch-events");
64
67
  const project_graph_incremental_recomputation_1 = require("./project-graph-incremental-recomputation");
68
+ const restart_checks_1 = require("./restart-checks");
65
69
  const project_graph_listener_sockets_1 = require("./project-graph-listener-sockets");
66
70
  const shutdown_utils_1 = require("./shutdown-utils");
67
71
  const sync_generators_1 = require("./sync-generators");
68
- const watcher_1 = require("./watcher");
72
+ const workspace_context_1 = require("../../utils/workspace-context");
73
+ const is_ci_1 = require("../../utils/is-ci");
69
74
  let workspaceWatcherError;
70
75
  global.NX_DAEMON = true;
71
76
  process.env.NX_DAEMON_PROCESS = 'true';
@@ -106,9 +111,9 @@ async function handleMessage(socket, data) {
106
111
  if (workspaceWatcherError) {
107
112
  await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `File watcher error in the workspace '${workspace_root_1.workspaceRoot}'.`, workspaceWatcherError);
108
113
  }
109
- const outputsWatcherTerminalError = (0, handle_outputs_changes_1.getOutputsWatcherTerminalError)();
110
- if (outputsWatcherTerminalError) {
111
- await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `File watcher error in the workspace '${workspace_root_1.workspaceRoot}'.`, outputsWatcherTerminalError);
114
+ const watchTerminalError = (0, handle_watch_events_1.getWatchTerminalError)();
115
+ if (watchTerminalError) {
116
+ await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `File watcher error in the workspace '${workspace_root_1.workspaceRoot}'.`, watchTerminalError);
112
117
  }
113
118
  (0, shutdown_utils_1.resetInactivityTimeout)(handleInactivityTimeout);
114
119
  const unparsedPayload = data;
@@ -146,6 +151,9 @@ async function handleMessage(socket, data) {
146
151
  else if (payload.type === 'HASH_TASKS') {
147
152
  await handleResult(socket, 'HASH_TASKS', () => (0, handle_hash_tasks_1.handleHashTasks)(payload), mode);
148
153
  }
154
+ else if (payload.type === 'HASH_TASKS_UPFRONT') {
155
+ await handleResult(socket, 'HASH_TASKS_UPFRONT', () => (0, handle_hash_tasks_1.handleHashTasksUpfront)(payload), mode);
156
+ }
149
157
  else if (payload.type === 'PROCESS_IN_BACKGROUND') {
150
158
  await handleResult(socket, 'PROCESS_IN_BACKGROUND', () => (0, handle_process_in_background_1.handleProcessInBackground)(payload), mode);
151
159
  }
@@ -206,6 +214,12 @@ async function handleMessage(socket, data) {
206
214
  else if ((0, get_registered_sync_generators_1.isHandleGetRegisteredSyncGeneratorsMessage)(payload)) {
207
215
  await handleResult(socket, get_registered_sync_generators_1.GET_REGISTERED_SYNC_GENERATORS, () => (0, handle_get_registered_sync_generators_1.handleGetRegisteredSyncGenerators)(), mode);
208
216
  }
217
+ else if ((0, get_plugin_capabilities_1.isHandleGetPluginCapabilitiesMessage)(payload)) {
218
+ await handleResult(socket, get_plugin_capabilities_1.GET_PLUGIN_CAPABILITIES, () => (0, handle_get_plugin_capabilities_1.handleGetPluginCapabilities)(), mode);
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
+ }
209
223
  else if ((0, update_workspace_context_1.isHandleUpdateWorkspaceContextMessage)(payload)) {
210
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);
211
225
  }
@@ -323,7 +337,7 @@ function lockFileHashChanged() {
323
337
  * we need to recompute the cached serialized project graph so that it is readily
324
338
  * available for the next client request to the server.
325
339
  */
326
- const handleWorkspaceChanges = async (err, changeEvents) => {
340
+ const handleWorkspaceChanges = (err, batch) => {
327
341
  if (workspaceWatcherError) {
328
342
  logger_1.serverLogger.watcherLog('Skipping handleWorkspaceChanges because of a previously recorded watcher error.');
329
343
  return;
@@ -338,8 +352,7 @@ const handleWorkspaceChanges = async (err, changeEvents) => {
338
352
  (0, file_watcher_sockets_1.notifyFileWatcherSocketsOfError)(error);
339
353
  return;
340
354
  }
341
- logger_1.serverLogger.watcherLog((0, watcher_1.convertChangeEventsToLogMessage)(changeEvents));
342
- (0, route_workspace_changes_1.routeWorkspaceChanges)(changeEvents);
355
+ (0, project_graph_incremental_recomputation_1.routeAppliedChanges)(batch);
343
356
  }
344
357
  catch (err) {
345
358
  logger_1.serverLogger.watcherLog(`Unexpected workspace error`, err.message);
@@ -349,14 +362,17 @@ const handleWorkspaceChanges = async (err, changeEvents) => {
349
362
  }
350
363
  };
351
364
  async function startServer() {
352
- // Watch before scan: a file written during boot must be visible to the
353
- // watcher or the scan below. Scan-first left a blind window where such
354
- // files stayed invisible to both until an unrelated change arrived.
355
- if (!(0, shutdown_utils_1.getWatcherInstance)()) {
356
- (0, shutdown_utils_1.storeWatcherInstance)(await (0, watcher_1.watchWorkspace)(server, handleWorkspaceChanges));
365
+ // The workspace context owns the daemon's one watch and starts it before
366
+ // it scans, so a file written during boot is visible to one or the other.
367
+ if (!(0, workspace_context_1.isWatchingWorkspaceContext)()) {
368
+ (0, restart_checks_1.registerDaemonForRestartChecks)(server, exports.openSockets);
369
+ (0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot, {
370
+ watch: true,
371
+ alwaysWatch: [restart_checks_1.relativeServerProcess],
372
+ });
373
+ (0, workspace_context_1.subscribeToWorkspaceChanges)(workspace_root_1.workspaceRoot, handleWorkspaceChanges);
357
374
  logger_1.serverLogger.watcherLog(`Subscribed to changes within: ${workspace_root_1.workspaceRoot} (native)`);
358
375
  }
359
- (0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
360
376
  // Initialize analytics for daemon process
361
377
  await (0, analytics_1.startAnalytics)();
362
378
  const socketPath = (0, socket_utils_1.getFullOsSocketPath)();
@@ -434,27 +450,35 @@ async function startServer() {
434
450
  }
435
451
  // this triggers the storage of the lock file hash
436
452
  daemonIsOutdated();
437
- if (!(0, shutdown_utils_1.getOutputWatcherInstance)()) {
438
- (0, shutdown_utils_1.storeOutputWatcherInstance)(await (0, watcher_1.watchOutputFiles)(server, handle_outputs_changes_1.handleOutputsChanges));
439
- }
453
+ // Every event the watch delivers, gitignored outputs and dotenv
454
+ // files included.
455
+ (0, workspace_context_1.subscribeToWatchEvents)(workspace_root_1.workspaceRoot, (err, events) => {
456
+ if (!err && events && (0, restart_checks_1.stopDaemonIfReplaced)(events)) {
457
+ return;
458
+ }
459
+ if (err || events?.length) {
460
+ (0, handle_watch_events_1.handleWatchEvents)(err, events);
461
+ }
462
+ });
440
463
  // listen for project graph recomputation events to collect and schedule sync generators
441
464
  (0, project_graph_incremental_recomputation_1.registerProjectGraphRecomputationListener)(sync_generators_1.collectAndScheduleSyncGenerators);
442
465
  // register file change listener to invalidate sync generator cache
443
466
  (0, file_change_events_1.registerFileChangeListener)(sync_generators_1.clearSyncGeneratorsCache);
444
- // trigger an initial project graph recomputation
445
- (0, project_graph_incremental_recomputation_1.scheduleProjectGraphRecomputation)([], [], []);
446
- // Kick off Nx Console check in background to prime the cache
447
- (0, handle_nx_console_1.handleGetNxConsoleStatus)().catch(() => {
448
- // Ignore errors, this is a background operation
449
- });
450
- // Kick off AI agents outdated check in background to prime the cache
451
- (0, handle_configure_ai_agents_1.handleGetConfigureAiAgentsStatus)().catch(() => {
452
- // Ignore errors, this is a background operation
453
- });
467
+ (0, project_graph_incremental_recomputation_1.scheduleInitialProjectGraphComputation)();
468
+ // Prime the Nx Console and AI agents caches in the background. Both
469
+ // pull nx@latest, and the CLI never shows their results in CI.
470
+ if (!(0, is_ci_1.isCI)()) {
471
+ (0, handle_nx_console_1.handleGetNxConsoleStatus)().catch(() => {
472
+ // Ignore errors, this is a background operation
473
+ });
474
+ (0, handle_configure_ai_agents_1.handleGetConfigureAiAgentsStatus)().catch(() => {
475
+ // Ignore errors, this is a background operation
476
+ });
477
+ }
454
478
  return resolve(server);
455
479
  }
456
480
  catch (err) {
457
- await handleWorkspaceChanges(err, []);
481
+ await handleWorkspaceChanges(err, null);
458
482
  }
459
483
  });
460
484
  }
@@ -1,10 +1,5 @@
1
1
  import type { Server, Socket } from 'net';
2
- import type { Watcher } from '../../native';
3
2
  export declare const SERVER_INACTIVITY_TIMEOUT_MS: 10800000;
4
- export declare function storeWatcherInstance(instance: Watcher): void;
5
- export declare function getWatcherInstance(): Watcher;
6
- export declare function storeOutputWatcherInstance(instance: Watcher): void;
7
- export declare function getOutputWatcherInstance(): Watcher;
8
3
  interface HandleServerProcessTerminationParams {
9
4
  server: Server;
10
5
  reason: string;
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SERVER_INACTIVITY_TIMEOUT_MS = void 0;
4
- exports.storeWatcherInstance = storeWatcherInstance;
5
- exports.getWatcherInstance = getWatcherInstance;
6
- exports.storeOutputWatcherInstance = storeOutputWatcherInstance;
7
- exports.getOutputWatcherInstance = getOutputWatcherInstance;
8
4
  exports.handleServerProcessTermination = handleServerProcessTermination;
9
5
  exports.handleServerProcessTerminationWithRestart = handleServerProcessTerminationWithRestart;
10
6
  exports.resetInactivityTimeout = resetInactivityTimeout;
@@ -15,6 +11,7 @@ const workspace_root_1 = require("../../utils/workspace-root");
15
11
  const logger_1 = require("../logger");
16
12
  const socket_utils_1 = require("../socket-utils");
17
13
  const cache_1 = require("../cache");
14
+ const workspace_context_1 = require("../../utils/workspace-context");
18
15
  const error_types_1 = require("../../project-graph/error-types");
19
16
  const get_plugins_1 = require("../../project-graph/plugins/get-plugins");
20
17
  const consume_messages_from_socket_1 = require("../../utils/consume-messages-from-socket");
@@ -61,20 +58,6 @@ async function startNewDaemonInBackground() {
61
58
  backgroundProcess.unref();
62
59
  logger_1.serverLogger.log('Started new daemon process in background');
63
60
  }
64
- let watcherInstance;
65
- function storeWatcherInstance(instance) {
66
- watcherInstance = instance;
67
- }
68
- function getWatcherInstance() {
69
- return watcherInstance;
70
- }
71
- let outputWatcherInstance;
72
- function storeOutputWatcherInstance(instance) {
73
- outputWatcherInstance = instance;
74
- }
75
- function getOutputWatcherInstance() {
76
- return outputWatcherInstance;
77
- }
78
61
  async function handleServerProcessTermination({ server, reason, sockets, }) {
79
62
  await performShutdown(server, reason, sockets);
80
63
  }
@@ -95,14 +78,8 @@ async function performShutdown(server, reason, sockets) {
95
78
  socket.destroy();
96
79
  }
97
80
  });
98
- if (watcherInstance) {
99
- await watcherInstance.stop();
100
- logger_1.serverLogger.watcherLog(`Stopping the watcher for ${workspace_root_1.workspaceRoot} (sources)`);
101
- }
102
- if (outputWatcherInstance) {
103
- await outputWatcherInstance.stop();
104
- logger_1.serverLogger.watcherLog(`Stopping the watcher for ${workspace_root_1.workspaceRoot} (outputs)`);
105
- }
81
+ (0, workspace_context_1.stopWatchingWorkspaceContext)();
82
+ logger_1.serverLogger.watcherLog(`Stopping the watch for ${workspace_root_1.workspaceRoot}`);
106
83
  (0, cache_1.deleteDaemonJsonProcessCache)();
107
84
  (0, get_plugins_1.cleanupPlugins)();
108
85
  // Clean up shared latest Nx installation
@@ -0,0 +1,7 @@
1
+ import type { UltracacheConfigurations } from '../../native';
2
+ import type { UltracacheConfigurationVersion } from '../message-types/ultracache-configuration-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 getUltracacheConfigurationsForVersion(version: UltracacheConfigurationVersion | undefined): UltracacheConfigurations | undefined;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUltracacheConfigurationsForVersion = getUltracacheConfigurationsForVersion;
4
+ const store_1 = require("../../ultracache/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 getUltracacheConfigurationsForVersion(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.getUltracacheConfigurationStore)().getVersion(commit, fetchedAt) ??
30
+ undefined);
31
+ }
32
+ catch {
33
+ // An unusable database hashes natively rather than failing the request.
34
+ return undefined;
35
+ }
36
+ }
@@ -47,6 +47,8 @@ export { getEnvFilesForTask, getGraphTimeDotEnvForTask, } from './tasks-runner/t
47
47
  export { getEnvPathsForTask } from './tasks-runner/task-env-paths';
48
48
  export { hashDaemonClientEnv, getDaemonClientEnvGeneration, getAppliedDaemonClientEnv, applyDaemonEnvFromClient, } from './daemon/client/daemon-environment';
49
49
  export { isCI } from './utils/is-ci';
50
+ export { createCliOptions } from './utils/create-cli-options';
51
+ export { createOverrides } from './utils/command-line-utils';
50
52
  export { isUsingPrettierInTree, prettierConfigFiles, } from './utils/formatters/prettier';
51
53
  export { detectFormatter, detectFormatterInTree } from './utils/formatters';
52
54
  export type { FormatterType } from './utils/formatters';
@@ -85,7 +87,7 @@ export { getRelativeProjectJsonSchemaPath } from './generators/utils/project-con
85
87
  export { hashFile } from './hasher/file-hasher';
86
88
  export { filterUsingGlobPatterns, getTargetInputs } from './hasher/task-hasher';
87
89
  export type { JsonInput } from './native';
88
- export { killProcessTreeGraceful } from './native';
90
+ export { isAiAgent, killProcessTreeGraceful } from './native';
89
91
  export { killChildOnHostExit } from './utils/kill-child-on-host-exit';
90
92
  export { connectToNxCloud } from './nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud';
91
93
  export type { NxCloudOnBoardingStatus } from './nx-cloud/models/onboarding-status';
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDaemonClientEnvGeneration = exports.hashDaemonClientEnv = exports.getEnvPathsForTask = exports.getGraphTimeDotEnvForTask = exports.getEnvFilesForTask = exports.interpolate = exports.requireWithTsconfigFallback = exports.isTsEsmNamedExportLinkageError = exports.isRequireInEsmScopeError = exports.forceRegisterEsmLoader = exports.loadTsFile = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappings = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmpAsync = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.confirmationPrompt = exports.textPrompt = exports.multiselectPrompt = exports.selectPrompt = exports.splitTarget = exports.createPrettierIgnoreChecker = exports.createOxfmtIgnoreChecker = exports.createGitIgnoreChecker = exports.readTargetDefaultsForTarget = exports.createTargetDefaultsResults = exports.findMatchingProjects = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.findMatchingTargetNames = exports.resolveCommandSyntacticSugar = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.parseVersionFromPackageManagerField = exports.createTempNpmDirectory = void 0;
4
- exports.createNxCloudOnboardingURL = exports.getNxCloudAppOnBoardingUrl = exports.createNxCloudOnboardingURLForWelcomeApp = exports.connectToNxCloud = exports.killChildOnHostExit = exports.killProcessTreeGraceful = exports.getTargetInputs = exports.filterUsingGlobPatterns = exports.hashFile = exports.getRelativeProjectJsonSchemaPath = exports.FsTree = exports.LARGE_BUFFER = exports.daemonClient = exports.isProjectGraphProjectNode = exports.isProjectGraphExternalNode = exports.fileDataDepType = exports.fileDataDepTarget = exports.BatchFunctionRunner = exports.getGeneratorInformation = exports.setupAiAgentsGenerator = exports.toOldFormat = exports.toNewFormat = exports.runCommandsExecutor = exports.acknowledgeBuildScripts = exports.getCatalogDependenciesFromPackageJson = exports.getCatalogManager = exports.checkFilesAreOutputs = exports.checkFilesAreInputs = exports.PromptResolutionError = exports.resolvePrompt = exports.SchemaResolutionError = exports.ImplementationResolutionError = exports.resolveSchema = exports.resolveImplementation = exports.emitPluginWorkerLog = exports.safeWriteFileCache = exports.PluginCache = exports.handleImport = exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.oxfmtConfigFiles = exports.formatFilesWithOxfmt = exports.detectFormatterInTree = exports.detectFormatter = exports.prettierConfigFiles = exports.isUsingPrettierInTree = exports.isCI = exports.applyDaemonEnvFromClient = exports.getAppliedDaemonClientEnv = void 0;
5
- exports.normalizeDependencyConfigDefinition = exports.isCacheableTask = exports.getUnparsedOverrideArgs = exports.getTargetConfigurationForTask = exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getOutputs = exports.getExecutorNameForTask = exports.getExecutorForTask = exports.getDependencyConfigs = exports.getCustomHasher = exports.getCliPath = exports.expandWildcardTargetConfiguration = exports.expandInitiatingTasksThroughNoop = exports.expandDependencyConfigSyntaxSugar = exports.createTaskId = exports.calculateReverseDeps = exports.createRunManyDynamicOutputRenderer = exports.CompositeLifeCycle = exports.RemoteCacheV2 = exports.Cache = exports.readCachedProjectConfiguration = exports.preventRecursionInGraphConstruction = exports.handleProjectGraphError = exports.createProjectGraphAndSourceMapsAsync = exports.buildProjectGraphAndSourceMapsWithoutDaemon = exports.isNpmProject = exports.readFileMapCache = exports.readPackageJson = exports.isWholeFileChange = exports.isLockFileChange = exports.isDeletedFileChange = exports.defaultFileRead = exports.calculateFileChanges = exports.WholeFileChange = exports.TEN_MEGABYTES = exports.LockFileChange = exports.DeletedFileChange = exports.buildPackageJsonWorkspacesMatcher = exports.buildPackageJsonPatterns = exports.getGlobPatternsFromPackageManagerWorkspaces = exports.registerTsConfigPaths = exports.getWorkspacePackagesFromGraph = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.findProjectsNpmDependencies = exports.createPackageJson = exports.getLockFileName = exports.generatePrunedDeployOutput = exports.createLockFile = void 0;
6
- exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = exports.setupWorkspaceContext = exports.resetWorkspaceContext = exports.globWithWorkspaceContext = exports.getFilesInDirectoryUsingContext = exports.nxVersion = exports.SyncError = exports.quoteShellArg = exports.getSourceDirOfDependentProjects = exports.findAllProjectNodeDependencies = exports.findInstalledPlugins = exports.deriveGroupNameFromTarget = exports.warnUnshippableLocalPathSpec = exports.relocatePrunedLocalPathSpec = exports.movePeerDependencyToDependencies = exports.dropEmptyPeerDependencySections = exports.readNxMigrateConfig = exports.isNxCloudUsed = exports.getNxCloudUrl = exports.orange = exports.NX_PREFIX = exports.getNxRequirePaths = exports.isGlobPattern = exports.combineGlobPatterns = exports.getLatestCommitSha = exports.readFileIfExisting = exports.isRelativePath = exports.fileExists = exports.directoryExists = exports.createDirectory = exports.deduceDefaultBase = exports.codeFrameColumns = exports.runNxSync = exports.workspaceDataDirectory = exports.getLastValueFromAsyncIterableIterator = exports.validateOutputs = exports.unparse = exports.transformLegacyOutputs = exports.shouldStreamOutput = exports.removeTasksFromTaskGraph = exports.readProjectAndTargetFromTargetString = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = void 0;
4
+ exports.connectToNxCloud = exports.killChildOnHostExit = exports.killProcessTreeGraceful = exports.isAiAgent = exports.getTargetInputs = exports.filterUsingGlobPatterns = exports.hashFile = exports.getRelativeProjectJsonSchemaPath = exports.FsTree = exports.LARGE_BUFFER = exports.daemonClient = exports.isProjectGraphProjectNode = exports.isProjectGraphExternalNode = exports.fileDataDepType = exports.fileDataDepTarget = exports.BatchFunctionRunner = exports.getGeneratorInformation = exports.setupAiAgentsGenerator = exports.toOldFormat = exports.toNewFormat = exports.runCommandsExecutor = exports.acknowledgeBuildScripts = exports.getCatalogDependenciesFromPackageJson = exports.getCatalogManager = exports.checkFilesAreOutputs = exports.checkFilesAreInputs = exports.PromptResolutionError = exports.resolvePrompt = exports.SchemaResolutionError = exports.ImplementationResolutionError = exports.resolveSchema = exports.resolveImplementation = exports.emitPluginWorkerLog = exports.safeWriteFileCache = exports.PluginCache = exports.handleImport = exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.oxfmtConfigFiles = exports.formatFilesWithOxfmt = exports.detectFormatterInTree = exports.detectFormatter = exports.prettierConfigFiles = exports.isUsingPrettierInTree = exports.createOverrides = exports.createCliOptions = exports.isCI = exports.applyDaemonEnvFromClient = exports.getAppliedDaemonClientEnv = void 0;
5
+ exports.getTargetConfigurationForTask = exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getOutputs = exports.getExecutorNameForTask = exports.getExecutorForTask = exports.getDependencyConfigs = exports.getCustomHasher = exports.getCliPath = exports.expandWildcardTargetConfiguration = exports.expandInitiatingTasksThroughNoop = exports.expandDependencyConfigSyntaxSugar = exports.createTaskId = exports.calculateReverseDeps = exports.createRunManyDynamicOutputRenderer = exports.CompositeLifeCycle = exports.RemoteCacheV2 = exports.Cache = exports.readCachedProjectConfiguration = exports.preventRecursionInGraphConstruction = exports.handleProjectGraphError = exports.createProjectGraphAndSourceMapsAsync = exports.buildProjectGraphAndSourceMapsWithoutDaemon = exports.isNpmProject = exports.readFileMapCache = exports.readPackageJson = exports.isWholeFileChange = exports.isLockFileChange = exports.isDeletedFileChange = exports.defaultFileRead = exports.calculateFileChanges = exports.WholeFileChange = exports.TEN_MEGABYTES = exports.LockFileChange = exports.DeletedFileChange = exports.buildPackageJsonWorkspacesMatcher = exports.buildPackageJsonPatterns = exports.getGlobPatternsFromPackageManagerWorkspaces = exports.registerTsConfigPaths = exports.getWorkspacePackagesFromGraph = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.findProjectsNpmDependencies = exports.createPackageJson = exports.getLockFileName = exports.generatePrunedDeployOutput = exports.createLockFile = exports.createNxCloudOnboardingURL = exports.getNxCloudAppOnBoardingUrl = exports.createNxCloudOnboardingURLForWelcomeApp = void 0;
6
+ exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = exports.setupWorkspaceContext = exports.resetWorkspaceContext = exports.globWithWorkspaceContext = exports.getFilesInDirectoryUsingContext = exports.nxVersion = exports.SyncError = exports.quoteShellArg = exports.getSourceDirOfDependentProjects = exports.findAllProjectNodeDependencies = exports.findInstalledPlugins = exports.deriveGroupNameFromTarget = exports.warnUnshippableLocalPathSpec = exports.relocatePrunedLocalPathSpec = exports.movePeerDependencyToDependencies = exports.dropEmptyPeerDependencySections = exports.readNxMigrateConfig = exports.isNxCloudUsed = exports.getNxCloudUrl = exports.orange = exports.NX_PREFIX = exports.getNxRequirePaths = exports.isGlobPattern = exports.combineGlobPatterns = exports.getLatestCommitSha = exports.readFileIfExisting = exports.isRelativePath = exports.fileExists = exports.directoryExists = exports.createDirectory = exports.deduceDefaultBase = exports.codeFrameColumns = exports.runNxSync = exports.workspaceDataDirectory = exports.getLastValueFromAsyncIterableIterator = exports.validateOutputs = exports.unparse = exports.transformLegacyOutputs = exports.shouldStreamOutput = exports.removeTasksFromTaskGraph = exports.readProjectAndTargetFromTargetString = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = exports.normalizeDependencyConfigDefinition = exports.isCacheableTask = exports.getUnparsedOverrideArgs = void 0;
7
7
  const tslib_1 = require("tslib");
8
8
  /**
9
9
  * Note to developers: STOP! These are nx internals, not part of the public
@@ -112,6 +112,10 @@ Object.defineProperty(exports, "getAppliedDaemonClientEnv", { enumerable: true,
112
112
  Object.defineProperty(exports, "applyDaemonEnvFromClient", { enumerable: true, get: function () { return daemon_environment_1.applyDaemonEnvFromClient; } });
113
113
  var is_ci_1 = require("./utils/is-ci");
114
114
  Object.defineProperty(exports, "isCI", { enumerable: true, get: function () { return is_ci_1.isCI; } });
115
+ var create_cli_options_1 = require("./utils/create-cli-options");
116
+ Object.defineProperty(exports, "createCliOptions", { enumerable: true, get: function () { return create_cli_options_1.createCliOptions; } });
117
+ var command_line_utils_1 = require("./utils/command-line-utils");
118
+ Object.defineProperty(exports, "createOverrides", { enumerable: true, get: function () { return command_line_utils_1.createOverrides; } });
115
119
  var prettier_1 = require("./utils/formatters/prettier");
116
120
  Object.defineProperty(exports, "isUsingPrettierInTree", { enumerable: true, get: function () { return prettier_1.isUsingPrettierInTree; } });
117
121
  Object.defineProperty(exports, "prettierConfigFiles", { enumerable: true, get: function () { return prettier_1.prettierConfigFiles; } });
@@ -181,6 +185,7 @@ var task_hasher_1 = require("./hasher/task-hasher");
181
185
  Object.defineProperty(exports, "filterUsingGlobPatterns", { enumerable: true, get: function () { return task_hasher_1.filterUsingGlobPatterns; } });
182
186
  Object.defineProperty(exports, "getTargetInputs", { enumerable: true, get: function () { return task_hasher_1.getTargetInputs; } });
183
187
  var native_1 = require("./native");
188
+ Object.defineProperty(exports, "isAiAgent", { enumerable: true, get: function () { return native_1.isAiAgent; } });
184
189
  Object.defineProperty(exports, "killProcessTreeGraceful", { enumerable: true, get: function () { return native_1.killProcessTreeGraceful; } });
185
190
  var kill_child_on_host_exit_1 = require("./utils/kill-child-on-host-exit");
186
191
  Object.defineProperty(exports, "killChildOnHostExit", { enumerable: true, get: function () { return kill_child_on_host_exit_1.killChildOnHostExit; } });
@@ -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 { UltracacheConfigurations } 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
+ * `ultracacheConfigurations` is this run's set (see `loadUltracacheConfigurationsForRun`); 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, ultracacheConfigurations?: UltracacheConfigurations, 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
+ * `ultracacheConfigurations` is this run's set (see `loadUltracacheConfigurationsForRun`); 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, ultracacheConfigurations, 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, ultracacheConfigurations
15
+ ? {
16
+ commit: ultracacheConfigurations.commit,
17
+ fetchedAt: ultracacheConfigurations.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, ultracacheConfigurations);
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);