@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
@@ -0,0 +1,21 @@
1
+ import type { NxJsonConfiguration } from '../config/nx-json';
2
+ export interface UltracacheCloudOptions {
3
+ accessToken?: string;
4
+ nxCloudId?: string;
5
+ url?: string;
6
+ cloud?: boolean;
7
+ }
8
+ export interface UltracacheEnv {
9
+ NX_CLOUD_USE_ULTRACACHE?: string;
10
+ NX_NO_CLOUD?: string;
11
+ /** Whether the run's env holds an Nx Cloud token. */
12
+ hasNxCloudToken?: boolean;
13
+ }
14
+ /**
15
+ * Off unless a CI run opts in with `NX_CLOUD_USE_ULTRACACHE=true` in a
16
+ * workspace that uses Nx Cloud, since there is nothing to fetch from otherwise.
17
+ * `env` defaults to this process's.
18
+ */
19
+ export declare function isUltracacheConfigurationFetchEnabled(nxJson: NxJsonConfiguration, runnerOptions?: UltracacheCloudOptions, env?: UltracacheEnv): boolean;
20
+ /** The subset of this run's environment the decision reads. */
21
+ export declare function ultracacheEnv(env?: NodeJS.ProcessEnv): UltracacheEnv;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUltracacheConfigurationFetchEnabled = isUltracacheConfigurationFetchEnabled;
4
+ exports.ultracacheEnv = ultracacheEnv;
5
+ const is_ci_1 = require("../utils/is-ci");
6
+ const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
7
+ /**
8
+ * Off unless a CI run opts in with `NX_CLOUD_USE_ULTRACACHE=true` in a
9
+ * workspace that uses Nx Cloud, since there is nothing to fetch from otherwise.
10
+ * `env` defaults to this process's.
11
+ */
12
+ function isUltracacheConfigurationFetchEnabled(nxJson, runnerOptions = {}, env = ultracacheEnv()) {
13
+ if (env.NX_NO_CLOUD === 'true' ||
14
+ nxJson.neverConnectToCloud ||
15
+ runnerOptions.cloud === false ||
16
+ env.NX_CLOUD_USE_ULTRACACHE !== 'true' ||
17
+ !(0, is_ci_1.isCI)()) {
18
+ return false;
19
+ }
20
+ return !!env.hasNxCloudToken || (0, nx_cloud_utils_1.isNxCloudConfigured)(nxJson);
21
+ }
22
+ /** The subset of this run's environment the decision reads. */
23
+ function ultracacheEnv(env = process.env) {
24
+ return {
25
+ NX_CLOUD_USE_ULTRACACHE: env.NX_CLOUD_USE_ULTRACACHE,
26
+ NX_NO_CLOUD: env.NX_NO_CLOUD,
27
+ hasNxCloudToken: !!(env.NX_CLOUD_ACCESS_TOKEN || env.NX_CLOUD_AUTH_TOKEN),
28
+ };
29
+ }
@@ -0,0 +1,21 @@
1
+ import type { UltracacheCloudOptions } from './config';
2
+ /** The Nx Cloud client's `readUltracacheConfigurations` contract, as far as nx uses it. */
3
+ export interface ReadUltracacheConfigurationsOptions {
4
+ workspaceRoot?: string;
5
+ nxCloudOptions?: UltracacheCloudOptions;
6
+ timeoutMs?: number;
7
+ }
8
+ export interface ReadUltracacheConfiguration {
9
+ commit: string;
10
+ inputs: readonly string[];
11
+ outputs: readonly string[];
12
+ }
13
+ export interface ReadUltracacheConfigurationsResult {
14
+ configurations: Readonly<Record<string, ReadUltracacheConfiguration>>;
15
+ }
16
+ /**
17
+ * Reads HEAD's Ultracache configurations from Nx Cloud. Throws with a `code`
18
+ * saying why it could not: the client's own, or `NO_CLOUD_CLIENT`, `UNSUPPORTED_CLIENT` or
19
+ * `NO_CONFIGURATIONS`.
20
+ */
21
+ export declare function fetchUltracacheConfigurations(runnerOptions: UltracacheCloudOptions): Promise<ReadUltracacheConfigurationsResult>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchUltracacheConfigurations = fetchUltracacheConfigurations;
4
+ const resolution_helpers_1 = require("../nx-cloud/resolution-helpers");
5
+ const update_manager_1 = require("../nx-cloud/update-manager");
6
+ const workspace_root_1 = require("../utils/workspace-root");
7
+ const READ_TIMEOUT_MS = 10_000;
8
+ /**
9
+ * Reads HEAD's Ultracache configurations from Nx Cloud. Throws with a `code`
10
+ * saying why it could not: the client's own, or `NO_CLOUD_CLIENT`, `UNSUPPORTED_CLIENT` or
11
+ * `NO_CONFIGURATIONS`.
12
+ */
13
+ async function fetchUltracacheConfigurations(runnerOptions) {
14
+ const client = await loadCloudClient(runnerOptions).catch((e) => {
15
+ throw codedError('NO_CLOUD_CLIENT', e instanceof Error ? e.message : String(e));
16
+ });
17
+ if (!client) {
18
+ throw codedError('NO_CLOUD_CLIENT', 'The Nx Cloud client could not be loaded');
19
+ }
20
+ if (typeof client.readUltracacheConfigurations !== 'function') {
21
+ throw codedError('UNSUPPORTED_CLIENT', 'The installed Nx Cloud client does not expose Ultracache configurations; update nx-cloud');
22
+ }
23
+ const result = await client.readUltracacheConfigurations({
24
+ workspaceRoot: workspace_root_1.workspaceRoot,
25
+ nxCloudOptions: runnerOptions,
26
+ timeoutMs: READ_TIMEOUT_MS,
27
+ });
28
+ if (!result) {
29
+ // The client returns `null` only for a `knownUpdatedAt` match, which nx
30
+ // never sends; treat it as nothing to serve rather than a broken reply.
31
+ throw codedError('NO_CONFIGURATIONS', 'Nx Cloud returned no Ultracache configurations');
32
+ }
33
+ return result;
34
+ }
35
+ async function loadCloudClient(runnerOptions) {
36
+ const client = (await (0, update_manager_1.verifyOrUpdateNxCloudClient)(runnerOptions))
37
+ ?.nxCloudClient;
38
+ client?.configureLightClientRequire()((0, resolution_helpers_1.findAncestorNodeModules)(__dirname, []));
39
+ return client;
40
+ }
41
+ function codedError(code, message) {
42
+ return Object.assign(new Error(message), { code });
43
+ }
@@ -0,0 +1,17 @@
1
+ import type { ProjectGraph } from '../config/project-graph';
2
+ import type { TaskGraph } from '../config/task-graph';
3
+ import { type UltracacheEligibilityOptions, type UltracacheReport, type UltracacheConfigurations, type TaskUltracacheSettings } from '../native';
4
+ /**
5
+ * Each task's Ultracache settings: all the native eligibility walk reads
6
+ * from a task. `null`, not `undefined`: the native map drops `undefined` keys.
7
+ */
8
+ export declare function getUltracacheSettings(taskGraph: TaskGraph): Record<string, TaskUltracacheSettings | null>;
9
+ /** The eligibility walk's view of the run's tasks, as JS resolves it. */
10
+ export declare function ultracacheEligibilityOptions(projectGraph: ProjectGraph, taskGraph: TaskGraph): UltracacheEligibilityOptions;
11
+ /**
12
+ * Reports which tasks in `taskGraph` hash from `configurations` and why the rest
13
+ * do not, with the same eligibility walk the planner uses, without building a
14
+ * planner (no project-graph transfer). Never fetches, never throws. Feeds
15
+ * the `--verbose` run summary.
16
+ */
17
+ export declare function buildUltracacheOverrides(projectGraph: ProjectGraph, taskGraph: TaskGraph, configurations: UltracacheConfigurations): UltracacheReport;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUltracacheSettings = getUltracacheSettings;
4
+ exports.ultracacheEligibilityOptions = ultracacheEligibilityOptions;
5
+ exports.buildUltracacheOverrides = buildUltracacheOverrides;
6
+ const native_1 = require("../native");
7
+ const project_graph_1 = require("../project-graph/project-graph");
8
+ const utils_1 = require("../tasks-runner/utils");
9
+ const customHasherMemo = new WeakMap();
10
+ /**
11
+ * Tasks whose executor ships a custom hasher; they are never hashed from
12
+ * their Ultracache configuration. Detected here because executors are
13
+ * resolved in JS, by the factory's presence only — invoking it would load
14
+ * user modules.
15
+ */
16
+ function customHasherTaskIds(projectGraph, taskGraph) {
17
+ const memoized = customHasherMemo.get(taskGraph);
18
+ if (memoized) {
19
+ return memoized;
20
+ }
21
+ const projects = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects;
22
+ const ids = Object.values(taskGraph.tasks)
23
+ .filter((task) => {
24
+ try {
25
+ return !!(0, utils_1.getExecutorForTask)(task, projects).hasherFactory;
26
+ }
27
+ catch {
28
+ // An unresolvable executor fails later, at execution; it is not a
29
+ // reason to withhold its configuration here.
30
+ return false;
31
+ }
32
+ })
33
+ .map((task) => task.id);
34
+ customHasherMemo.set(taskGraph, ids);
35
+ return ids;
36
+ }
37
+ /**
38
+ * Each task's Ultracache settings: all the native eligibility walk reads
39
+ * from a task. `null`, not `undefined`: the native map drops `undefined` keys.
40
+ */
41
+ function getUltracacheSettings(taskGraph) {
42
+ return Object.fromEntries(Object.entries(taskGraph.tasks).map(([id, task]) => [
43
+ id,
44
+ task.ultracache ?? null,
45
+ ]));
46
+ }
47
+ /** The eligibility walk's view of the run's tasks, as JS resolves it. */
48
+ function ultracacheEligibilityOptions(projectGraph, taskGraph) {
49
+ return {
50
+ customHasherTaskIds: customHasherTaskIds(projectGraph, taskGraph),
51
+ };
52
+ }
53
+ /**
54
+ * Reports which tasks in `taskGraph` hash from `configurations` and why the rest
55
+ * do not, with the same eligibility walk the planner uses, without building a
56
+ * planner (no project-graph transfer). Never fetches, never throws. Feeds
57
+ * the `--verbose` run summary.
58
+ */
59
+ function buildUltracacheOverrides(projectGraph, taskGraph, configurations) {
60
+ return (0, native_1.getUltracacheReport)(configurations, getUltracacheSettings(taskGraph), ultracacheEligibilityOptions(projectGraph, taskGraph));
61
+ }
@@ -0,0 +1,13 @@
1
+ import type { UltracacheReport } from '../native';
2
+ export interface UltracacheSummary {
3
+ /** The heading, e.g. "Ultracache: 12 tasks hashed from their configuration, 3 fell back". */
4
+ line: string;
5
+ /** Per-reason detail under it. */
6
+ bodyLines: string[];
7
+ }
8
+ /**
9
+ * Formats the once-per-run verbose summary of a run that resolved Ultracache
10
+ * configurations: `result` is what hashing used, `status` whether they were
11
+ * fetched or already stored.
12
+ */
13
+ export declare function formatUltracacheSummary(result: UltracacheReport, status: 'fetched' | 'cached'): UltracacheSummary;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatUltracacheSummary = formatUltracacheSummary;
4
+ /**
5
+ * Formats the once-per-run verbose summary of a run that resolved Ultracache
6
+ * configurations: `result` is what hashing used, `status` whether they were
7
+ * fetched or already stored.
8
+ */
9
+ function formatUltracacheSummary(result, status) {
10
+ const used = result.used.length;
11
+ const withheld = result.diagnostics.filter((d) => d.taskId != null);
12
+ const byReason = countByReason(withheld);
13
+ const fellBack = withheld.length;
14
+ const setLevel = result.diagnostics.find((d) => d.taskId == null);
15
+ const line = setLevel
16
+ ? `Ultracache: none used (unreadable configurations: ${setLevel.message})`
17
+ : `Ultracache: ${plural(used, 'task')} hashed from their configuration, ${plural(fellBack, 'task')} fell back${fellBack ? ` (${summarizeReasons(byReason)})` : ''}`;
18
+ const bodyLines = [`configurations: ${status}`];
19
+ bodyLines.push(`commit ${result.resolution.requestedCommit}, configurations for ${result.resolution.tasks} tasks`);
20
+ for (const d of result.diagnostics) {
21
+ bodyLines.push(describeDiagnostic(d));
22
+ }
23
+ return { line, bodyLines };
24
+ }
25
+ function describeDiagnostic(d) {
26
+ switch (d.reason) {
27
+ case 'unreadable-set':
28
+ return `unreadable Ultracache configurations: ${d.message}`;
29
+ case 'disabled':
30
+ return `${d.taskId}: ultracache.mode is off`;
31
+ case 'autofix-disabled':
32
+ return `${d.taskId}: ultracache.mode is not on`;
33
+ case 'custom-hasher':
34
+ return `${d.taskId}: uses a custom hasher`;
35
+ case 'missing':
36
+ return `${d.taskId}: no Ultracache configuration for this task`;
37
+ case 'invalid-glob':
38
+ return `${d.taskId}: configuration glob "${d.glob}" is not a valid files glob`;
39
+ case 'escapes-workspace':
40
+ return `${d.taskId}: configuration glob "${d.glob}" escapes the workspace`;
41
+ default:
42
+ return `${d.taskId ? `${d.taskId}: ` : ''}${d.reason}`;
43
+ }
44
+ }
45
+ function countByReason(diagnostics) {
46
+ const counts = new Map();
47
+ for (const d of diagnostics) {
48
+ if (d.taskId != null) {
49
+ counts.set(d.reason, (counts.get(d.reason) ?? 0) + 1);
50
+ }
51
+ }
52
+ return counts;
53
+ }
54
+ function summarizeReasons(counts) {
55
+ return [...counts.entries()]
56
+ .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
57
+ .map(([reason, n]) => `${n} ${reason}`)
58
+ .join(', ');
59
+ }
60
+ function plural(n, noun) {
61
+ return `${n} ${noun}${n === 1 ? '' : 's'}`;
62
+ }
@@ -0,0 +1,41 @@
1
+ import type { NxJsonConfiguration } from '../config/nx-json';
2
+ import { UltracacheConfigurationStore, type UltracacheConfigurations } from '../native';
3
+ import { type UltracacheCloudOptions, type UltracacheEnv } from './config';
4
+ import { type ReadUltracacheConfigurationsResult } from './fetch';
5
+ /**
6
+ * What resolving this run's Ultracache configurations came to. Only an
7
+ * outcome that resolved carries them.
8
+ */
9
+ export type UltracacheConfigurationOutcome = {
10
+ status: 'fetched' | 'cached';
11
+ configurations: UltracacheConfigurations;
12
+ } | {
13
+ status: 'skipped';
14
+ reason: string;
15
+ message: string;
16
+ };
17
+ export declare function skippedUltracacheOutcome(reason: string, message: string): UltracacheConfigurationOutcome;
18
+ /** The configurations an outcome resolved to, if any. */
19
+ export declare function configurationsOf(outcome: UltracacheConfigurationOutcome | null): UltracacheConfigurations | undefined;
20
+ /** The Ultracache configuration store in this process's workspace database. */
21
+ export declare function getUltracacheConfigurationStore(): UltracacheConfigurationStore;
22
+ /**
23
+ * Stores the configurations the Nx Cloud client read for `requestedCommit` and
24
+ * returns their handle, for `runDiscreteTasks` and `runContinuousTasks`. Exposed to the
25
+ * client through `nx/nx-cloud-internals`. Throws with the store's `code`.
26
+ */
27
+ export declare function importUltracacheConfigurations(requestedCommit: string, configurations: ReadUltracacheConfigurationsResult['configurations']): UltracacheConfigurations;
28
+ /**
29
+ * The stored version `importUltracacheConfigurations` returned, reopened by its commit and
30
+ * `resolution.fetchedAt`, so other processes hash from it without importing
31
+ * it again. `null` when it isn't stored. Exposed through `nx/nx-cloud-internals`.
32
+ */
33
+ export declare function openUltracacheConfigurations(commit: string, fetchedAt: number): UltracacheConfigurations | null;
34
+ /**
35
+ * This run's Ultracache configurations for HEAD, in the process that owns the
36
+ * fetch: the newest stored set, otherwise what Nx Cloud reads, imported into
37
+ * the store. The Nx Cloud client imports a fresh set when each CI run starts,
38
+ * so a stored set is never older than its run. Returns `null` when Ultracache
39
+ * is not enabled for this workspace; never throws.
40
+ */
41
+ export declare function loadUltracacheConfigurationsForRun(nxJson: NxJsonConfiguration, runnerOptions: UltracacheCloudOptions, env?: UltracacheEnv): Promise<UltracacheConfigurationOutcome | null>;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.skippedUltracacheOutcome = skippedUltracacheOutcome;
4
+ exports.configurationsOf = configurationsOf;
5
+ exports.getUltracacheConfigurationStore = getUltracacheConfigurationStore;
6
+ exports.importUltracacheConfigurations = importUltracacheConfigurations;
7
+ exports.openUltracacheConfigurations = openUltracacheConfigurations;
8
+ exports.loadUltracacheConfigurationsForRun = loadUltracacheConfigurationsForRun;
9
+ const path_1 = require("path");
10
+ const native_1 = require("../native");
11
+ const db_connection_1 = require("../utils/db-connection");
12
+ const git_utils_1 = require("../utils/git-utils");
13
+ const logger_1 = require("../utils/logger");
14
+ const output_1 = require("../utils/output");
15
+ const workspace_root_1 = require("../utils/workspace-root");
16
+ const config_1 = require("./config");
17
+ const fetch_1 = require("./fetch");
18
+ function skippedUltracacheOutcome(reason, message) {
19
+ return { status: 'skipped', reason, message };
20
+ }
21
+ /** The configurations an outcome resolved to, if any. */
22
+ function configurationsOf(outcome) {
23
+ return outcome && outcome.status !== 'skipped'
24
+ ? outcome.configurations
25
+ : undefined;
26
+ }
27
+ // Reasons that indicate misconfiguration rather than an expected offline
28
+ // state or a client that simply predates Ultracache.
29
+ const WARNED_REASONS = new Set([
30
+ 'unauthorized',
31
+ 'invalid-response',
32
+ 'write-failed',
33
+ ]);
34
+ /** The Ultracache configuration store in this process's workspace database. */
35
+ function getUltracacheConfigurationStore() {
36
+ return new native_1.UltracacheConfigurationStore((0, db_connection_1.getDbConnection)());
37
+ }
38
+ /**
39
+ * Stores the configurations the Nx Cloud client read for `requestedCommit` and
40
+ * returns their handle, for `runDiscreteTasks` and `runContinuousTasks`. Exposed to the
41
+ * client through `nx/nx-cloud-internals`. Throws with the store's `code`.
42
+ */
43
+ function importUltracacheConfigurations(requestedCommit, configurations) {
44
+ return getUltracacheConfigurationStore().import({
45
+ requestedCommit,
46
+ configurationsJson: JSON.stringify(configurations),
47
+ });
48
+ }
49
+ /**
50
+ * The stored version `importUltracacheConfigurations` returned, reopened by its commit and
51
+ * `resolution.fetchedAt`, so other processes hash from it without importing
52
+ * it again. `null` when it isn't stored. Exposed through `nx/nx-cloud-internals`.
53
+ */
54
+ function openUltracacheConfigurations(commit, fetchedAt) {
55
+ return getUltracacheConfigurationStore().getVersion(commit, fetchedAt);
56
+ }
57
+ /**
58
+ * This run's Ultracache configurations for HEAD, in the process that owns the
59
+ * fetch: the newest stored set, otherwise what Nx Cloud reads, imported into
60
+ * the store. The Nx Cloud client imports a fresh set when each CI run starts,
61
+ * so a stored set is never older than its run. Returns `null` when Ultracache
62
+ * is not enabled for this workspace; never throws.
63
+ */
64
+ async function loadUltracacheConfigurationsForRun(nxJson, runnerOptions, env = (0, config_1.ultracacheEnv)()) {
65
+ if (!(0, config_1.isUltracacheConfigurationFetchEnabled)(nxJson, runnerOptions, env)) {
66
+ return null;
67
+ }
68
+ const head = (0, git_utils_1.getLatestCommitSha)();
69
+ if (!head) {
70
+ return reportUltracacheConfigurationResolution(skippedUltracacheOutcome('not-a-git-repo', 'Could not resolve HEAD'));
71
+ }
72
+ try {
73
+ const store = getUltracacheConfigurationStore();
74
+ const cached = () => {
75
+ const stored = store.get(head);
76
+ return (stored &&
77
+ reportUltracacheConfigurationResolution({
78
+ status: 'cached',
79
+ configurations: stored,
80
+ }));
81
+ };
82
+ return (cached() ??
83
+ // Processes that miss together fetch once: the rest find its set.
84
+ (await withUltracacheConfigurationFetchLock(async () => {
85
+ const stored = cached();
86
+ if (stored) {
87
+ return stored;
88
+ }
89
+ const result = await (0, fetch_1.fetchUltracacheConfigurations)(runnerOptions);
90
+ return reportUltracacheConfigurationResolution({
91
+ status: 'fetched',
92
+ configurations: store.import({
93
+ requestedCommit: head,
94
+ configurationsJson: JSON.stringify(result.configurations),
95
+ }),
96
+ });
97
+ })));
98
+ }
99
+ catch (e) {
100
+ // No fallback to an older set for this commit: it would hash from a
101
+ // recording the run could not refresh, and CI can hash natively instead.
102
+ return reportUltracacheConfigurationResolution(skippedUltracacheOutcome(reasonFromError(e), errorMessage(e)));
103
+ }
104
+ }
105
+ /** Runs `fetch` holding a lock beside the workspace database, across processes. */
106
+ async function withUltracacheConfigurationFetchLock(fetch) {
107
+ if (native_1.IS_WASM) {
108
+ return fetch();
109
+ }
110
+ const lock = new native_1.FileLock((0, path_1.join)((0, db_connection_1.sharedWorkspaceDataDirectory)(workspace_root_1.workspaceRoot), 'ultracache-configuration.lock'));
111
+ while (!lock.tryLock()) {
112
+ await lock.wait();
113
+ }
114
+ try {
115
+ return await fetch();
116
+ }
117
+ finally {
118
+ lock.unlock();
119
+ }
120
+ }
121
+ const OFFLINE_CODES = new Set([
122
+ 'ECONNABORTED',
123
+ 'ECONNREFUSED',
124
+ 'ECONNRESET',
125
+ 'ENOTFOUND',
126
+ 'EAI_AGAIN',
127
+ 'ETIMEDOUT',
128
+ ]);
129
+ /** A skip reason from an error's `code`: from the Nx Cloud read or the store. */
130
+ function reasonFromError(e) {
131
+ const code = e?.code;
132
+ if (typeof code !== 'string')
133
+ return 'fetch-failed';
134
+ if (OFFLINE_CODES.has(code))
135
+ return 'offline';
136
+ return code.toLowerCase().replace(/_/g, '-');
137
+ }
138
+ function errorMessage(e) {
139
+ return e instanceof Error ? e.message : String(e);
140
+ }
141
+ /** Warns or logs what a resolution came to. */
142
+ function reportUltracacheConfigurationResolution(outcome) {
143
+ if (outcome.status === 'skipped') {
144
+ if (WARNED_REASONS.has(outcome.reason)) {
145
+ output_1.output.warn({
146
+ title: `Nx Cloud Ultracache configurations are unavailable (${outcome.reason})`,
147
+ bodyLines: [outcome.message, 'Tasks will be hashed without them.'],
148
+ });
149
+ }
150
+ else {
151
+ logger_1.logger.verbose(`Skipping Nx Cloud Ultracache configurations (${outcome.reason}): ${outcome.message}`);
152
+ }
153
+ return outcome;
154
+ }
155
+ const { resolution } = outcome.configurations;
156
+ logger_1.logger.verbose(`Nx Cloud Ultracache configurations ${outcome.status}: ${resolution.tasks} tasks for ${resolution.requestedCommit.slice(0, 12)}`);
157
+ return outcome;
158
+ }
@@ -1,4 +1,5 @@
1
1
  export declare const NX_CLOUD_URL = "https://nx.dev/nx-cloud";
2
+ export declare const NX_CLOUD_DEMO_URL = "https://cloud.nx.app/demo/intro";
2
3
  /**
3
4
  * Clickable Nx Cloud marketing link for cloud prompt footers. The visible text
4
5
  * stays the clean `NX_CLOUD_URL` while clicks carry UTM attribution; terminals
@@ -7,6 +8,8 @@ export declare const NX_CLOUD_URL = "https://nx.dev/nx-cloud";
7
8
  * different commands.
8
9
  */
9
10
  export declare function nxCloudHyperlink(utmContent: string): string;
11
+ /** Same as `nxCloudHyperlink`, pointing at the Nx Cloud demo (CLOUD-4640). */
12
+ export declare function nxCloudDemoHyperlink(utmContent: string): string;
10
13
  /**
11
14
  * Meta payload types for recordStat telemetry (matches CNW format).
12
15
  */
@@ -25,7 +28,7 @@ export interface RecordStatMetaError {
25
28
  [key: string]: string | boolean;
26
29
  }
27
30
  export type RecordStatMeta = RecordStatMetaStart | RecordStatMetaComplete | RecordStatMetaError;
28
- export type MessageOptionKey = 'yes' | 'skip' | 'never';
31
+ export type MessageOptionKey = 'yes' | 'skip';
29
32
  interface MessageData {
30
33
  code: string;
31
34
  message: string;
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.messages = exports.PromptMessages = exports.NX_CLOUD_URL = void 0;
3
+ exports.messages = exports.PromptMessages = exports.NX_CLOUD_DEMO_URL = exports.NX_CLOUD_URL = void 0;
4
4
  exports.nxCloudHyperlink = nxCloudHyperlink;
5
+ exports.nxCloudDemoHyperlink = nxCloudDemoHyperlink;
5
6
  exports.recordStat = recordStat;
6
- const tslib_1 = require("tslib");
7
7
  const node_child_process_1 = require("node:child_process");
8
8
  const is_ci_1 = require("./is-ci");
9
9
  const package_manager_1 = require("./package-manager");
10
10
  const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
11
11
  const terminal_link_1 = require("./terminal-link");
12
- const pc = tslib_1.__importStar(require("picocolors"));
12
+ const http_client_1 = require("./http-client");
13
13
  exports.NX_CLOUD_URL = 'https://nx.dev/nx-cloud';
14
+ exports.NX_CLOUD_DEMO_URL = 'https://cloud.nx.app/demo/intro';
14
15
  /**
15
16
  * Clickable Nx Cloud marketing link for cloud prompt footers. The visible text
16
17
  * stays the clean `NX_CLOUD_URL` while clicks carry UTM attribution; terminals
@@ -19,8 +20,14 @@ exports.NX_CLOUD_URL = 'https://nx.dev/nx-cloud';
19
20
  * different commands.
20
21
  */
21
22
  function nxCloudHyperlink(utmContent) {
22
- const tracked = `${exports.NX_CLOUD_URL}?utm_source=nx-cli&utm_medium=cli&utm_campaign=nx-cloud-connect&utm_content=${utmContent}`;
23
- return (0, terminal_link_1.terminalLink)(exports.NX_CLOUD_URL, tracked);
23
+ return trackedHyperlink(exports.NX_CLOUD_URL, utmContent);
24
+ }
25
+ /** Same as `nxCloudHyperlink`, pointing at the Nx Cloud demo (CLOUD-4640). */
26
+ function nxCloudDemoHyperlink(utmContent) {
27
+ return trackedHyperlink(exports.NX_CLOUD_DEMO_URL, utmContent);
28
+ }
29
+ function trackedHyperlink(url, utmContent) {
30
+ return (0, terminal_link_1.terminalLink)(url, `${url}?utm_source=nx-cli&utm_medium=cli&utm_campaign=nx-cloud-connect&utm_content=${utmContent}`);
24
31
  }
25
32
  const messageOptions = {
26
33
  setupNxCloud: [
@@ -31,7 +38,6 @@ const messageOptions = {
31
38
  choices: [
32
39
  { value: 'yes', name: 'Yes' },
33
40
  { value: 'skip', name: 'Skip for now' },
34
- { value: 'never', name: pc.dim("No, don't ask again") },
35
41
  ],
36
42
  footer: '\nFree for small teams. Remote caching and task distribution. 2-minute setup:',
37
43
  },
@@ -42,7 +48,6 @@ const messageOptions = {
42
48
  choices: [
43
49
  { value: 'yes', name: 'Yes' },
44
50
  { value: 'skip', name: 'Skip for now' },
45
- { value: 'never', name: pc.dim("No, don't ask again") },
46
51
  ],
47
52
  footer: '\nLearn about it at',
48
53
  hint: `\n(it's free and can be disabled any time)`,
@@ -98,19 +103,17 @@ async function recordStat(opts) {
98
103
  if (!shouldRecordStats()) {
99
104
  return;
100
105
  }
101
- const axios = require('axios');
102
- await (axios['default'] ?? axios)
103
- .create({
104
- baseURL: (0, get_cloud_options_1.getCloudUrl)(),
106
+ await (0, http_client_1.httpRequest)(`${(0, get_cloud_options_1.getCloudUrl)()}/nx-cloud/stats`, {
107
+ method: 'POST',
105
108
  timeout: 400,
106
- })
107
- .post('/nx-cloud/stats', {
108
- command: opts.command,
109
- isCI: (0, is_ci_1.isCI)(),
110
- useCloud: opts.useCloud,
111
- meta: opts.meta
112
- ? JSON.stringify({ ...opts.meta, nxVersion: opts.nxVersion })
113
- : opts.nxVersion,
109
+ data: {
110
+ command: opts.command,
111
+ isCI: (0, is_ci_1.isCI)(),
112
+ useCloud: opts.useCloud,
113
+ meta: opts.meta
114
+ ? JSON.stringify({ ...opts.meta, nxVersion: opts.nxVersion })
115
+ : opts.nxVersion,
116
+ },
114
117
  });
115
118
  }
116
119
  catch (e) {
@@ -1,10 +1,4 @@
1
- export declare function chunkify(target: string[], maxChunkLength?: number,
2
- /**
3
- * How long each entry will be once it reaches the command line. Callers that
4
- * quote or escape afterwards pass that transformation's length here, so the
5
- * chunk is sized against what is actually spawned rather than the raw string.
6
- */
7
- measure?: (item: string) => number): string[][];
1
+ export declare function chunkify(target: string[], maxChunkLength?: number): string[][];
8
2
  /**
9
3
  * Get the maximum length of a command-line argument string based on current platform
10
4
  *
@@ -3,18 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chunkify = chunkify;
4
4
  exports.getMaxArgLength = getMaxArgLength;
5
5
  const TERMINAL_SIZE = getMaxArgLength();
6
- function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500,
7
- /**
8
- * How long each entry will be once it reaches the command line. Callers that
9
- * quote or escape afterwards pass that transformation's length here, so the
10
- * chunk is sized against what is actually spawned rather than the raw string.
11
- */
12
- measure = (item) => item.length) {
6
+ function chunkify(target, maxChunkLength = TERMINAL_SIZE - 500) {
13
7
  const chunks = [];
14
8
  let currentChunk = [];
15
9
  let currentChunkLength = 0;
16
10
  for (const file of target) {
17
- const length = measure(file);
11
+ const length = file.length;
18
12
  if (
19
13
  // Prevent empty chunk if first file path is longer than maxChunkLength
20
14
  currentChunk.length &&
@@ -1,6 +1,7 @@
1
1
  import type { Arguments } from 'yargs';
2
2
  import { NxJsonConfiguration } from '../config/nx-json';
3
3
  import { ProjectGraph } from '../config/project-graph';
4
+ import type { OutputStyle } from '../command-line/yargs-utils/shared-options';
4
5
  export interface RawNxArgs extends NxArgs {
5
6
  prod?: boolean;
6
7
  }
@@ -27,7 +28,26 @@ export interface NxArgs {
27
28
  select?: string;
28
29
  graph?: string | boolean;
29
30
  skipNxCache?: boolean;
31
+ explain?: string | boolean;
30
32
  skipRemoteCache?: boolean;
33
+ /**
34
+ * The style the user named - CLI flag or `NX_DEFAULT_OUTPUT_STYLE`. Left
35
+ * undefined when they named none, and that absence is load-bearing: it is how
36
+ * the streaming and renderer-selection decisions tell "the user wants static"
37
+ * from "we defaulted to static", which stream continuous tasks differently.
38
+ */
39
+ specifiedOutputStyle?: OutputStyle;
40
+ /**
41
+ * What the run actually renders with, after the TUI, agent and failures-only
42
+ * defaults are applied. Always set. Every decision about what to PRINT reads
43
+ * this; every decision about what the user ASKED FOR reads the field above.
44
+ */
45
+ resolvedOutputStyle?: OutputStyle;
46
+ /**
47
+ * @deprecated Read `specifiedOutputStyle` for what the user named, or
48
+ * `resolvedOutputStyle` for what the run renders with. This will be removed
49
+ * in Nx 24.
50
+ */
31
51
  outputStyle?: string;
32
52
  tui?: boolean;
33
53
  nxBail?: boolean;