nx 23.2.0-beta.0 → 23.2.0-beta.10

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 (374) hide show
  1. package/dist/bin/init-local.js +3 -5
  2. package/dist/bin/nx.js +3 -1
  3. package/dist/release/changelog-renderer/index.js +4 -5
  4. package/dist/release/index.d.ts +1 -1
  5. package/dist/src/adapter/ngcli-adapter.js +60 -1
  6. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +35 -15
  7. package/dist/src/analytics/analytics.d.ts +6 -0
  8. package/dist/src/analytics/analytics.js +16 -10
  9. package/dist/src/analytics/index.d.ts +1 -1
  10. package/dist/src/analytics/index.js +2 -1
  11. package/dist/src/command-line/add/add.js +5 -0
  12. package/dist/src/command-line/affected/affected.js +1 -0
  13. package/dist/src/command-line/completion/command-object.js +7 -12
  14. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +19 -25
  15. package/dist/src/command-line/format/format.js +84 -101
  16. package/dist/src/command-line/generate/generate.js +35 -35
  17. package/dist/src/command-line/graph/graph.d.ts +1 -0
  18. package/dist/src/command-line/graph/graph.js +15 -6
  19. package/dist/src/command-line/import/import.js +30 -40
  20. package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
  21. package/dist/src/command-line/init/ai-agent-prompts.js +12 -17
  22. package/dist/src/command-line/init/command-object.js +14 -4
  23. package/dist/src/command-line/init/configure-plugins.js +4 -1
  24. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
  25. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
  26. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
  27. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
  28. package/dist/src/command-line/init/implementation/angular/index.js +10 -15
  29. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
  30. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +5 -0
  31. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
  32. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
  33. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +9 -1
  34. package/dist/src/command-line/init/implementation/format.d.ts +18 -0
  35. package/dist/src/command-line/init/implementation/format.js +114 -0
  36. package/dist/src/command-line/init/implementation/utils.js +8 -0
  37. package/dist/src/command-line/init/init-v1.js +15 -18
  38. package/dist/src/command-line/init/init-v2.js +40 -57
  39. package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
  40. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
  41. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
  42. package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
  43. package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
  44. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
  45. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
  46. package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
  47. package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
  48. package/dist/src/command-line/migrate/agentic/runner.js +24 -24
  49. package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
  50. package/dist/src/command-line/migrate/agentic/select.js +30 -32
  51. package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
  52. package/dist/src/command-line/migrate/agentic/types.js +35 -0
  53. package/dist/src/command-line/migrate/command-object.d.ts +6 -0
  54. package/dist/src/command-line/migrate/command-object.js +19 -1
  55. package/dist/src/command-line/migrate/execute-migration.d.ts +91 -0
  56. package/dist/src/command-line/migrate/execute-migration.js +474 -0
  57. package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
  58. package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
  59. package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
  60. package/dist/src/command-line/migrate/migrate-commits.js +130 -15
  61. package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
  62. package/dist/src/command-line/migrate/migrate-config.js +22 -14
  63. package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
  64. package/dist/src/command-line/migrate/migrate-output.js +52 -8
  65. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  66. package/dist/src/command-line/migrate/migrate-ui-api.js +33 -19
  67. package/dist/src/command-line/migrate/migrate.d.ts +29 -113
  68. package/dist/src/command-line/migrate/migrate.js +666 -664
  69. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  70. package/dist/src/command-line/migrate/multi-major.js +7 -10
  71. package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
  72. package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
  73. package/dist/src/command-line/migrate/run/agent-output.js +65 -0
  74. package/dist/src/command-line/migrate/run/index.d.ts +9 -0
  75. package/dist/src/command-line/migrate/run/index.js +23 -0
  76. package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
  77. package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
  78. package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
  79. package/dist/src/command-line/migrate/run/run-id.js +56 -0
  80. package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
  81. package/dist/src/command-line/migrate/run/run-state.js +438 -0
  82. package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
  83. package/dist/src/command-line/migrate/run/state-lock.js +76 -0
  84. package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
  85. package/dist/src/command-line/migrate/run/state-machine.js +315 -0
  86. package/dist/src/command-line/migrate/run/util.d.ts +59 -0
  87. package/dist/src/command-line/migrate/run/util.js +148 -0
  88. package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
  89. package/dist/src/command-line/migrate/run/worker.js +682 -0
  90. package/dist/src/command-line/migrate/run-migration-process.js +6 -5
  91. package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
  92. package/dist/src/command-line/migrate/safe-prompt.js +32 -43
  93. package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
  94. package/dist/src/command-line/migrate/sort-migrations.js +32 -0
  95. package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
  96. package/dist/src/command-line/migrate/step-actions.js +12 -0
  97. package/dist/src/command-line/migrate/text.d.ts +18 -0
  98. package/dist/src/command-line/migrate/text.js +26 -0
  99. package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
  100. package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
  101. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -21
  102. package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
  103. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
  104. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
  105. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
  106. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
  107. package/dist/src/command-line/nx-commands.js +26 -24
  108. package/dist/src/command-line/release/changelog.js +11 -17
  109. package/dist/src/command-line/release/index.d.ts +1 -1
  110. package/dist/src/command-line/release/plan.js +15 -28
  111. package/dist/src/command-line/release/publish.js +5 -0
  112. package/dist/src/command-line/release/release.js +6 -17
  113. package/dist/src/command-line/release/utils/git.js +1 -1
  114. package/dist/src/command-line/release/utils/release-graph.d.ts +20 -2
  115. package/dist/src/command-line/release/utils/release-graph.js +81 -21
  116. package/dist/src/command-line/release/utils/remote-release-clients/github.js +17 -23
  117. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +14 -23
  118. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
  119. package/dist/src/command-line/release/utils/shared.d.ts +2 -2
  120. package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
  121. package/dist/src/command-line/release/version/release-group-processor.js +80 -6
  122. package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
  123. package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
  124. package/dist/src/command-line/release/version/version-actions.js +9 -1
  125. package/dist/src/command-line/release/version.js +10 -6
  126. package/dist/src/command-line/reset/reset.js +6 -1
  127. package/dist/src/command-line/run/run-one.js +1 -0
  128. package/dist/src/command-line/run-many/run-many.js +1 -0
  129. package/dist/src/command-line/show/show-target/inputs.js +50 -153
  130. package/dist/src/command-line/show/show-target/outputs.js +48 -173
  131. package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
  132. package/dist/src/command-line/show/show-target/utils.js +83 -3
  133. package/dist/src/command-line/watch/watch.js +13 -0
  134. package/dist/src/command-line/yargs-utils/shared-options.d.ts +2 -2
  135. package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
  136. package/dist/src/commands-runner/create-command-graph.js +5 -0
  137. package/dist/src/config/misc-interfaces.d.ts +19 -7
  138. package/dist/src/config/nx-json.d.ts +5 -3
  139. package/dist/src/core/graph/main.js +1 -1
  140. package/dist/src/core/graph/styles.js +1 -1
  141. package/dist/src/daemon/client/client.d.ts +52 -1
  142. package/dist/src/daemon/client/client.js +160 -36
  143. package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
  144. package/dist/src/daemon/client/daemon-environment.js +110 -2
  145. package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
  146. package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
  147. package/dist/src/daemon/message-types/daemon-message.js +25 -0
  148. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
  149. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
  150. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  151. package/dist/src/daemon/server/latest-nx.js +5 -2
  152. package/dist/src/daemon/server/server.js +31 -4
  153. package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
  154. package/dist/src/daemon/server/shutdown-utils.js +11 -4
  155. package/dist/src/daemon/socket-utils.d.ts +1 -0
  156. package/dist/src/daemon/socket-utils.js +24 -3
  157. package/dist/src/daemon/tmp-dir.d.ts +43 -3
  158. package/dist/src/daemon/tmp-dir.js +437 -15
  159. package/dist/src/devkit-internals.d.ts +105 -8
  160. package/dist/src/devkit-internals.js +223 -7
  161. package/dist/src/executors/run-commands/running-tasks.js +46 -29
  162. package/dist/src/generators/internal-utils/format-changed-files.d.ts +24 -0
  163. package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
  164. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
  165. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
  166. package/dist/src/generators/tree.d.ts +4 -2
  167. package/dist/src/generators/utils/nx-json.js +13 -3
  168. package/dist/src/hasher/check-task-files.d.ts +86 -0
  169. package/dist/src/hasher/check-task-files.js +378 -0
  170. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
  171. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
  172. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
  173. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
  174. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
  175. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
  176. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
  177. package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
  178. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
  179. package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
  180. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
  181. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
  182. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
  183. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
  184. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
  185. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
  186. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
  187. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
  188. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
  189. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
  190. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
  191. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
  192. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
  193. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
  194. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
  195. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
  196. package/dist/src/native/index.d.ts +37 -4
  197. package/dist/src/native/index.js +71 -28
  198. package/dist/src/native/native-bindings.js +3 -0
  199. package/dist/src/native/native-file-cache-location.d.ts +17 -1
  200. package/dist/src/native/native-file-cache-location.js +86 -12
  201. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  202. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  203. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
  204. package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
  205. package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
  206. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
  207. package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
  208. package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
  209. package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
  210. package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
  211. package/dist/src/plugins/js/lock-file/pnpm-parser.js +420 -64
  212. package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
  213. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +92 -12
  214. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
  215. package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
  216. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
  217. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +9 -5
  218. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
  219. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
  220. package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
  221. package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
  222. package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
  223. package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
  224. package/dist/src/project-graph/build-project-graph.js +7 -1
  225. package/dist/src/project-graph/error-types.d.ts +12 -1
  226. package/dist/src/project-graph/error-types.js +27 -2
  227. package/dist/src/project-graph/file-utils.js +6 -1
  228. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
  229. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
  230. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
  231. package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
  232. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
  233. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
  234. package/dist/src/project-graph/project-graph.js +23 -0
  235. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
  236. package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
  237. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +12 -8
  238. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +30 -21
  239. package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
  240. package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
  241. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
  242. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
  243. package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
  244. package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
  245. package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
  246. package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
  247. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
  248. package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
  249. package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
  250. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  251. package/dist/src/tasks-runner/life-cycle.js +2 -2
  252. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +9 -4
  253. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
  254. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +28 -8
  255. package/dist/src/tasks-runner/life-cycles/performance-report.js +117 -30
  256. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
  257. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
  258. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
  259. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
  260. package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
  261. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  262. package/dist/src/tasks-runner/run-command.js +28 -35
  263. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
  264. package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
  265. package/dist/src/tasks-runner/task-env.d.ts +9 -0
  266. package/dist/src/tasks-runner/task-env.js +31 -4
  267. package/dist/src/tasks-runner/task-orchestrator.d.ts +72 -1
  268. package/dist/src/tasks-runner/task-orchestrator.js +182 -18
  269. package/dist/src/tasks-runner/utils.js +2 -6
  270. package/dist/src/utils/acknowledge-build-scripts.js +7 -5
  271. package/dist/src/utils/analytics-enabled.d.ts +7 -0
  272. package/dist/src/utils/analytics-enabled.js +11 -0
  273. package/dist/src/utils/analytics-prompt.d.ts +0 -6
  274. package/dist/src/utils/analytics-prompt.js +4 -58
  275. package/dist/src/utils/assert-workspace-validity.js +7 -2
  276. package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
  277. package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
  278. package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
  279. package/dist/src/utils/catalog/bun-manager.js +130 -0
  280. package/dist/src/utils/catalog/index.d.ts +1 -1
  281. package/dist/src/utils/catalog/index.js +1 -1
  282. package/dist/src/utils/catalog/manager-factory.js +3 -0
  283. package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
  284. package/dist/src/utils/catalog/manager-utils.js +9 -4
  285. package/dist/src/utils/catalog/manager.d.ts +13 -1
  286. package/dist/src/utils/catalog/manager.js +30 -0
  287. package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
  288. package/dist/src/utils/catalog/pnpm-manager.js +3 -0
  289. package/dist/src/utils/catalog/types.d.ts +4 -0
  290. package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
  291. package/dist/src/utils/catalog/yarn-manager.js +23 -32
  292. package/dist/src/utils/child-process.d.ts +31 -1
  293. package/dist/src/utils/child-process.js +103 -0
  294. package/dist/src/utils/chunkify.d.ts +7 -1
  295. package/dist/src/utils/chunkify.js +10 -3
  296. package/dist/src/utils/command-line-utils.js +30 -20
  297. package/dist/src/utils/exit-codes.d.ts +9 -0
  298. package/dist/src/utils/exit-codes.js +19 -0
  299. package/dist/src/utils/fileutils.d.ts +5 -0
  300. package/dist/src/utils/fileutils.js +7 -2
  301. package/dist/src/utils/formatters/index.d.ts +13 -0
  302. package/dist/src/utils/formatters/index.js +74 -0
  303. package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
  304. package/dist/src/utils/formatters/oxfmt.js +764 -0
  305. package/dist/src/utils/formatters/prettier.d.ts +26 -0
  306. package/dist/src/utils/formatters/prettier.js +201 -0
  307. package/dist/src/utils/formatters/shared.d.ts +5 -0
  308. package/dist/src/utils/formatters/shared.js +8 -0
  309. package/dist/src/utils/git-revision.d.ts +12 -0
  310. package/dist/src/utils/git-revision.js +25 -0
  311. package/dist/src/utils/git-utils.d.ts +48 -2
  312. package/dist/src/utils/git-utils.js +220 -14
  313. package/dist/src/utils/git-worktrees.d.ts +30 -0
  314. package/dist/src/utils/git-worktrees.js +212 -0
  315. package/dist/src/utils/ignore.d.ts +170 -1
  316. package/dist/src/utils/ignore.js +263 -11
  317. package/dist/src/utils/long-running-target.d.ts +10 -0
  318. package/dist/src/utils/long-running-target.js +19 -0
  319. package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
  320. package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
  321. package/dist/src/utils/min-release-age/packument.js +1 -1
  322. package/dist/src/utils/nx-console-prompt.js +3 -6
  323. package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
  324. package/dist/src/utils/nx-tmp-dir.js +40 -0
  325. package/dist/src/utils/output.d.ts +153 -0
  326. package/dist/src/utils/output.js +289 -5
  327. package/dist/src/utils/owned-private-dir.d.ts +132 -0
  328. package/dist/src/utils/owned-private-dir.js +323 -0
  329. package/dist/src/utils/package-json.d.ts +2 -0
  330. package/dist/src/utils/package-json.js +11 -7
  331. package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
  332. package/dist/src/utils/package-manager-config/bunfig.js +49 -0
  333. package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
  334. package/dist/src/utils/package-manager-config/npmrc.js +124 -0
  335. package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
  336. package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
  337. package/dist/src/utils/package-manager.d.ts +23 -2
  338. package/dist/src/utils/package-manager.js +268 -44
  339. package/dist/src/utils/params.d.ts +7 -1
  340. package/dist/src/utils/params.js +64 -6
  341. package/dist/src/utils/plugins/core-plugins.js +4 -0
  342. package/dist/src/utils/prompt-helpers.d.ts +53 -0
  343. package/dist/src/utils/prompt-helpers.js +111 -0
  344. package/dist/src/utils/provenance.js +6 -14
  345. package/dist/src/utils/registry-config/bun.d.ts +2 -0
  346. package/dist/src/utils/registry-config/bun.js +257 -0
  347. package/dist/src/utils/registry-config/index.d.ts +13 -0
  348. package/dist/src/utils/registry-config/index.js +102 -0
  349. package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
  350. package/dist/src/utils/registry-config/pnpm.js +1551 -0
  351. package/dist/src/utils/registry-config/utils.d.ts +195 -0
  352. package/dist/src/utils/registry-config/utils.js +496 -0
  353. package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
  354. package/dist/src/utils/registry-config/yarn-berry.js +612 -0
  355. package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
  356. package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
  357. package/dist/src/utils/safe-spawn.d.ts +24 -0
  358. package/dist/src/utils/safe-spawn.js +104 -0
  359. package/dist/src/utils/shell-quoting.d.ts +15 -0
  360. package/dist/src/utils/shell-quoting.js +35 -0
  361. package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
  362. package/dist/src/utils/wait-for-socket-connection.js +14 -8
  363. package/dist/src/utils/workspace-id.d.ts +20 -0
  364. package/dist/src/utils/workspace-id.js +54 -0
  365. package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
  366. package/dist/src/utils/write-formatted-json-file.js +5 -4
  367. package/migrations.json +6 -0
  368. package/package.json +29 -19
  369. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +0 -19
  370. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -81
  371. package/dist/src/utils/is-using-prettier.d.ts +0 -3
  372. package/dist/src/utils/is-using-prettier.js +0 -62
  373. package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
  374. package/dist/src/utils/min-release-age/npmrc.js +0 -45
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pruneProjectGraph = pruneProjectGraph;
4
+ exports.isLocalPathSpecifier = isLocalPathSpecifier;
5
+ exports.findLocalPathNode = findLocalPathNode;
4
6
  exports.findNodeMatchingVersion = findNodeMatchingVersion;
5
7
  exports.addNodesAndDependencies = addNodesAndDependencies;
6
8
  exports.rehoistNodes = rehoistNodes;
@@ -10,15 +12,23 @@ const project_graph_builder_1 = require("../../../project-graph/project-graph-bu
10
12
  const catalog_1 = require("../../../utils/catalog");
11
13
  const workspace_root_1 = require("../../../utils/workspace-root");
12
14
  const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
15
+ const pruned_output_1 = require("./pruned-output");
13
16
  /**
14
17
  * Prune project graph's external nodes and their dependencies
15
18
  * based on the pruned package.json
16
19
  */
17
- function pruneProjectGraph(graph, prunedPackageJson, workspaceRootPath = workspace_root_1.workspaceRoot) {
20
+ function pruneProjectGraph(graph, prunedPackageJson, workspaceRootPath = workspace_root_1.workspaceRoot, packageManager) {
18
21
  const builder = new project_graph_builder_1.ProjectGraphBuilder();
19
22
  const workspacePackages = (0, get_workspace_packages_from_graph_1.getWorkspacePackagesFromGraph)(graph);
20
- const combinedDependencies = normalizeDependencies(prunedPackageJson, graph, workspacePackages, workspaceRootPath);
23
+ const { combinedDependencies, localPathNodes } = normalizeDependencies(prunedPackageJson, graph, workspacePackages, workspaceRootPath, packageManager);
21
24
  addNodesAndDependencies(graph, combinedDependencies, workspacePackages, builder);
25
+ // A local-path dependency is keyed in the lockfile by the target's real
26
+ // package name, which an aliased one does not share with its manifest entry,
27
+ // so the name-based lookup above cannot reach its node. Add the nodes matched
28
+ // by target path rather than repeating that match here.
29
+ for (const node of localPathNodes) {
30
+ traverseNode(graph, builder, node);
31
+ }
22
32
  for (const project of workspacePackages.values()) {
23
33
  const node = graph.nodes[project.name];
24
34
  builder.addNode(node);
@@ -30,7 +40,9 @@ function pruneProjectGraph(graph, prunedPackageJson, workspaceRootPath = workspa
30
40
  }
31
41
  // ensure that dependency ranges from package.json (e.g. ^1.0.0)
32
42
  // are replaced with the actual version based on the available nodes (e.g. 1.0.1)
33
- function normalizeDependencies(packageJson, graph, workspacePackages, workspaceRootPath) {
43
+ // Also returns the external nodes matched for local-path dependencies, whose
44
+ // names the caller cannot re-derive from the returned map.
45
+ function normalizeDependencies(packageJson, graph, workspacePackages, workspaceRootPath, packageManager) {
34
46
  const { dependencies, devDependencies, optionalDependencies, peerDependencies, } = packageJson;
35
47
  const combinedDependencies = {
36
48
  ...dependencies,
@@ -38,6 +50,7 @@ function normalizeDependencies(packageJson, graph, workspacePackages, workspaceR
38
50
  ...optionalDependencies,
39
51
  ...peerDependencies,
40
52
  };
53
+ const localPathNodes = [];
41
54
  const manager = (0, catalog_1.getCatalogManager)(workspaceRootPath);
42
55
  Object.entries(combinedDependencies).forEach(([packageName, versionRange]) => {
43
56
  let resolvedVersionRange = versionRange;
@@ -59,6 +72,16 @@ function normalizeDependencies(packageJson, graph, workspacePackages, workspaceR
59
72
  }
60
73
  // otherwise we need to find the correct version
61
74
  const node = findNodeMatchingVersion(graph, packageName, resolvedVersionRange);
75
+ // A file:/link: local-path dependency (e.g. a vendored tarball) records a
76
+ // path where a version would go, so the version-based lookups above never
77
+ // match it; findLocalPathNode matches it on that path instead (pnpm-only,
78
+ // matching the rest of the local-path handling).
79
+ const localPathNode = !node &&
80
+ packageManager === 'pnpm' &&
81
+ !workspacePackages.has(packageName) &&
82
+ isLocalPathSpecifier(resolvedVersionRange)
83
+ ? findLocalPathNode(graph, packageName, resolvedVersionRange)
84
+ : undefined;
62
85
  if (node) {
63
86
  combinedDependencies[packageName] = node.data.version;
64
87
  }
@@ -66,11 +89,62 @@ function normalizeDependencies(packageJson, graph, workspacePackages, workspaceR
66
89
  // workspace module, leave as is
67
90
  combinedDependencies[packageName] = resolvedVersionRange;
68
91
  }
92
+ else if (localPathNode) {
93
+ combinedDependencies[packageName] = localPathNode.data.version;
94
+ localPathNodes.push(localPathNode);
95
+ }
96
+ else if (packageManager === 'pnpm' &&
97
+ resolvedVersionRange.startsWith('link:')) {
98
+ // Only a link: is valid importer-only in a pnpm lockfile (see
99
+ // mapRootSnapshot); a nodeless file: (stale lockfile) or npm/yarn still throw.
100
+ combinedDependencies[packageName] = resolvedVersionRange;
101
+ }
69
102
  else {
70
103
  throw new Error(`Pruned lock file creation failed. The following package was not found in the root lock file: ${packageName}@${resolvedVersionRange}`);
71
104
  }
72
105
  });
73
- return combinedDependencies;
106
+ return { combinedDependencies, localPathNodes };
107
+ }
108
+ /**
109
+ * A `file:` (local tarball or directory) or `link:` specifier resolves to a
110
+ * single local package. pnpm records its path relative to the workspace root in
111
+ * the lockfile, while the manifest records it relative to the declaring package,
112
+ * so the two never match by string.
113
+ */
114
+ function isLocalPathSpecifier(versionExpr) {
115
+ return versionExpr.startsWith('file:') || versionExpr.startsWith('link:');
116
+ }
117
+ /**
118
+ * The external node for a `file:`/`link:` local-path dependency.
119
+ *
120
+ * The target path is what identifies one: an aliased dependency (`"alias":
121
+ * "file:libs/x"`) is keyed in the lockfile by the target's real package name, so
122
+ * the manifest's own name matches nothing. A manifest the pruned output already
123
+ * rewrote carries a workspace-root-relative path, relocated under the shipped
124
+ * output directory, which strips back to the path the lockfile records.
125
+ *
126
+ * A manifest that was not rewritten records the path relative to the declaring
127
+ * package instead, and this has no way to resolve that against the workspace
128
+ * root, so it falls back to the package name. Two local-path packages sharing a
129
+ * name cannot be told apart by it, so that throws rather than risking a match to
130
+ * the wrong one.
131
+ */
132
+ function findLocalPathNode(graph, packageName, versionExpr) {
133
+ const localPathNodes = Object.values(graph.externalNodes).filter((node) => isLocalPathSpecifier(node.data.version));
134
+ // Only the manifest side is read back from its shipped location; the lock
135
+ // file records the source path, which relocation never touched.
136
+ const sourceSpec = (0, pruned_output_1.uncontainLocalPathSpec)(versionExpr);
137
+ const targetMatch = localPathNodes.find((node) => (0, pruned_output_1.normalizeLocalPathSpec)(node.data.version) === sourceSpec);
138
+ if (targetMatch) {
139
+ return targetMatch;
140
+ }
141
+ const matches = localPathNodes.filter((node) => node.data.packageName === packageName);
142
+ if (matches.length > 1) {
143
+ throw new Error(`Pruned lock file creation failed. Multiple local-path packages named "${packageName}" were found in the lock file (${matches
144
+ .map((node) => node.data.version)
145
+ .join(', ')}), so the manifest's "${packageName}" dependency cannot be matched to one of them. Rename the packages so their names are unique.`);
146
+ }
147
+ return matches[0];
74
148
  }
75
149
  function findNodeMatchingVersion(graph, packageName, versionExpr) {
76
150
  if (versionExpr === '*') {
@@ -177,17 +251,23 @@ function switchNodeToHoisted(node, builder, invBuilder) {
177
251
  const sources = Object.keys(builder.graph.dependencies).filter((name) => builder.graph.dependencies[name].some((d) => d.target === previousName));
178
252
  builder.removeNode(node.name);
179
253
  invBuilder.removeNode(node.name);
180
- // modify the node and re-add it
181
- node.name = `npm:${node.data.packageName}`;
182
- builder.addExternalNode(node);
183
- invBuilder.addExternalNode(node);
254
+ // Re-add under the hoisted name as a new object. The node is shared by
255
+ // reference with the caller's graph, so renaming it in place would leave that
256
+ // graph with a node keyed `npm:<pkg>@<version>` but named `npm:<pkg>`, and
257
+ // every later prune of the same graph would fail to resolve the edge.
258
+ const hoistedNode = {
259
+ ...node,
260
+ name: `npm:${node.data.packageName}`,
261
+ };
262
+ builder.addExternalNode(hoistedNode);
263
+ invBuilder.addExternalNode(hoistedNode);
184
264
  targets.forEach((target) => {
185
- builder.addStaticDependency(node.name, target);
186
- invBuilder.addStaticDependency(target, node.name);
265
+ builder.addStaticDependency(hoistedNode.name, target);
266
+ invBuilder.addStaticDependency(target, hoistedNode.name);
187
267
  });
188
268
  sources.forEach((source) => {
189
- builder.addStaticDependency(source, node.name);
190
- invBuilder.addStaticDependency(node.name, source);
269
+ builder.addStaticDependency(source, hoistedNode.name);
270
+ invBuilder.addStaticDependency(hoistedNode.name, source);
191
271
  });
192
272
  }
193
273
  // BFS to find the shortest path to a dependency specified in package.json
@@ -0,0 +1,330 @@
1
+ import type { Lockfile } from '@pnpm/lockfile-types';
2
+ import type { PackageJson } from '../../../utils/package-json';
3
+ export type PnpmLockfileConfigField = keyof Lockfile | 'catalogs';
4
+ export declare const PNPM_LOCKFILE_RESOLUTION_CONFIG_FIELDS: PnpmLockfileConfigField[];
5
+ /**
6
+ * Drops the resolution-time pnpm config a pruned standalone lockfile already
7
+ * resolves into its snapshots, then drops an emptied `pnpm` block. Re-declaring
8
+ * it next to a pruned lockfile makes pnpm <=10 fail with
9
+ * ERR_PNPM_LOCKFILE_CONFIG_MISMATCH. Only for an actually pruned lockfile: the
10
+ * root-lockfile fallback keeps the config, which that lockfile still declares.
11
+ *
12
+ * Counterpart to `stripStandaloneLockfileConfig` in the pnpm lock-file parser,
13
+ * which drops the same fields from the generated lockfile.
14
+ */
15
+ export declare function stripPrunedLockfilePnpmConfig(packageJson: PackageJson): void;
16
+ /**
17
+ * Drops the `pnpm.patchedDependencies` the emitted manifest inherited from the
18
+ * project it was built from. The declaration a pruned output needs is the one
19
+ * `getPrunedPnpmPatchArtifacts` derives from the lockfile shipping beside it; an
20
+ * inherited one names the workspace's patch paths rather than the output's, and
21
+ * survives even when the output ships no patch file at all, which fails the
22
+ * install as pnpm hashes every declared patch. pnpm reads the field from the
23
+ * workspace root alone, so a project-level block was inert at home and cannot be
24
+ * trusted here either.
25
+ */
26
+ export declare function dropInheritedPnpmPatchedDependencies(packageJson: PackageJson): void;
27
+ /**
28
+ * pnpm config resolved once per prune and threaded into the settings-yaml and
29
+ * patch-artifact builders, so neither repeats the pnpm version probe or the
30
+ * patched-dependency resolution.
31
+ */
32
+ type PrunedPnpmConfig = {
33
+ pnpmMajor: number | null;
34
+ patchedDependencies: Record<string, string>;
35
+ };
36
+ /**
37
+ * Builds the settings-only pnpm-workspace.yaml every standalone pruned output
38
+ * ships. Unconditional because a conditional artifact cannot be retracted: a
39
+ * cache replay restores only the files the replayed entry holds and a bundler
40
+ * overwrites rather than cleans its output directory, so an earlier build's
41
+ * copy would survive and its stale settings would apply. A `packages: []`-only
42
+ * file is inert, verified installable with identical module resolution on
43
+ * pnpm 9, 10 and 11.
44
+ *
45
+ * pnpm 11+ reads build approvals (`allowBuilds`), `supportedArchitectures` and
46
+ * `patchedDependencies` only from pnpm-workspace.yaml, so those are carried
47
+ * from the workspace root; pass `prunedLockfileContent` to scope the approvals
48
+ * to the packages the pruned lockfile keeps (an approval for an absent package
49
+ * is inert either way, this only keeps the emitted file accurate). On
50
+ * pnpm <=10, which reads them from the emitted package.json instead (see
51
+ * `getPrunedPnpmPackageJsonBuildSettings`), or when the workspace declares
52
+ * none, the file holds only `packages: []`. Resolution-time config stays out:
53
+ * the pruned lockfile bakes it in (`stripPrunedLockfilePnpmConfig`).
54
+ *
55
+ * The major is the build machine's pnpm, which is all that is knowable at
56
+ * build time: an output built on pnpm <=10 but deployed on pnpm 11+ will not
57
+ * pick its approvals up. `precomputed` lets a caller pass the pnpm major and
58
+ * pruned patchedDependencies it already resolved instead of recomputing them.
59
+ */
60
+ export declare function getPrunedPnpmInstallSettingsYaml(workspaceRootPath?: string, prunedLockfileContent?: string, precomputed?: PrunedPnpmConfig): string;
61
+ /**
62
+ * The path a `.patch` file takes inside the pruned output, always under the
63
+ * output's declared `patches/` directory: a source path outside it would fall
64
+ * outside the prune target's cached `patches` output and be dropped on a cache
65
+ * replay, and a `..` asset name is not one a bundler can emit. The source
66
+ * sub-structure is kept so same-named patches in different directories stay
67
+ * distinct. The path is collapsed first, the way pnpm collapses it before
68
+ * recording it in the lockfile (`./x` and `a/../x` are both stored as `x`), so
69
+ * the config path read here and the lockfile path read by
70
+ * `filterPatchedDependenciesToPrunedPackages` (which calls this same helper)
71
+ * produce the same destination. A `..` left after collapsing escapes the
72
+ * workspace and is dropped, the one way two sources can still meet on one
73
+ * destination; `getPrunedPnpmPatchArtifacts` rejects that pair rather than
74
+ * shipping one file for both.
75
+ */
76
+ export declare function normalizePrunedPatchPath(patchPath: string): string;
77
+ type PrunedPnpmPackageJsonBuildSettings = Pick<NonNullable<PackageJson['pnpm']>, 'onlyBuiltDependencies' | 'neverBuiltDependencies' | 'supportedArchitectures'>;
78
+ /**
79
+ * The pnpm build-script approvals a standalone pruned output declares in its
80
+ * emitted package.json so native production deps still run their build scripts
81
+ * on pnpm <=10; null on pnpm 11+, which reads approvals only from
82
+ * pnpm-workspace.yaml (`getPrunedPnpmInstallSettingsYaml` carries them there;
83
+ * keep the two in sync when pnpm moves the read again). Both root sources
84
+ * (pnpm-workspace.yaml wins over the package.json `pnpm` field) are read, and
85
+ * a pnpm 10.26+ `allowBuilds` map is folded into the on/never-built lists
86
+ * pnpm <=10 understands. Approvals are scoped to the packages the pruned
87
+ * lockfile keeps (one for a dropped package is inert); when the lockfile's
88
+ * names cannot be extracted (a pre-v9 lockfile, unparseable content) they are
89
+ * carried verbatim instead of scoped to nothing.
90
+ */
91
+ export declare function getPrunedPnpmPackageJsonBuildSettings(workspaceRootPath?: string, prunedLockfileContent?: string, precomputed?: PrunedPnpmConfig): PrunedPnpmPackageJsonBuildSettings | null;
92
+ /**
93
+ * Patch artifacts a standalone pruned output must ship to keep a `pnpm patch`
94
+ * workspace installable: the `.patch` files (path relative to the output root,
95
+ * plus content) and, on pnpm 10 and below, the `patchedDependencies` map to
96
+ * declare in the emitted package.json. On pnpm 11+ that map is carried in
97
+ * pnpm-workspace.yaml (see `getPrunedPnpmInstallSettingsYaml`), so
98
+ * `packageJsonPatchedDependencies` is null there. Both are scoped to the patches
99
+ * the pruned lockfile keeps. Returns the file contents so the file-writing prune
100
+ * paths and the bundler asset pipelines can each ship them their own way.
101
+ */
102
+ export declare function getPrunedPnpmPatchArtifacts(workspaceRootPath?: string, prunedLockfileContent?: string, precomputed?: PrunedPnpmConfig): {
103
+ patchFiles: Array<{
104
+ path: string;
105
+ content: string;
106
+ }>;
107
+ packageJsonPatchedDependencies: Record<string, string> | null;
108
+ };
109
+ /**
110
+ * Non-workspace local-path deps (`file:` tarballs/dirs, `link:` targets) ship
111
+ * under this single output directory rather than at their workspace-relative
112
+ * path. A generated `prune-lockfile` target declares dynamic output paths it
113
+ * cannot enumerate at generate time; corralling every vendored artifact under
114
+ * one directory lets `getPruneTargets` declare it, so a cache replay restores it
115
+ * (an artifact shipped outside a declared output is dropped on replay, breaking
116
+ * the standalone deploy). The manifest specifiers and pruned-lockfile refs are
117
+ * relocated into this directory to match; source reads strip it back off.
118
+ */
119
+ export declare const LOCAL_PATH_MODULES_DIR = "local_path_modules";
120
+ /**
121
+ * Relocates a workspace-relative local-path into the shipped output directory.
122
+ * Injective, so `uncontainLocalPath` recovers the source path for every input:
123
+ * a workspace directory literally named `local_path_modules/` relocates like
124
+ * any other rather than being mistaken for an already-relocated path. Callers
125
+ * must therefore relocate each path exactly once.
126
+ */
127
+ export declare function containLocalPath(wsRelativePath: string): string;
128
+ /**
129
+ * The workspace-relative source path of a shipped local-path artifact, i.e. the
130
+ * inverse of `containLocalPath`. A path that is not under the shipped directory
131
+ * (an unshippable target left at its original spec) is returned unchanged.
132
+ */
133
+ export declare function uncontainLocalPath(shippedPath: string): string;
134
+ /**
135
+ * A `file:`/`link:` specifier with its path separators unified, so specifiers
136
+ * that differ only in how they were authored compare equal. Returns anything
137
+ * that is not a local-path specifier unchanged.
138
+ */
139
+ export declare function normalizeLocalPathSpec(spec: string): string;
140
+ /**
141
+ * A relocated `file:`/`link:` specifier read back as the source path it was
142
+ * relocated from, so it compares equal to the source specifier for the same
143
+ * target (`normalizeLocalPathSpec`). Relocation is injective and strips exactly
144
+ * one level, so only the relocated side of a comparison may go through this: a
145
+ * source path that itself starts with the shipped directory's name relocates
146
+ * like any other, and stripping it too would read it as a different target.
147
+ */
148
+ export declare function uncontainLocalPathSpec(spec: string): string;
149
+ /**
150
+ * Warns when a workspace directory occupies the output path of a copied
151
+ * workspace module. Both spell `workspace_modules/<name>`, so no later pass can
152
+ * tell them apart: the vendored source is read as the copied module and never
153
+ * ships, leaving the lockfile pointing at a path the output does not carry.
154
+ */
155
+ export declare function warnOnWorkspaceModulePathCollision(sourcePackages: Record<string, unknown> | undefined, synthesizedModulePaths: ReadonlySet<string>): void;
156
+ /**
157
+ * Relocates every shippable non-workspace `file:` local-path reference in a
158
+ * pruned lockfile (package keys, resolutions, and snapshot/importer dependency
159
+ * refs) under `LOCAL_PATH_MODULES_DIR`, matching where the artifacts ship, so a
160
+ * standalone `pnpm install` resolves them. `link:` refs are relocated upstream
161
+ * (`containShippedLocalLinkRefs` for the source snapshots, the assembly's own
162
+ * synthesis sites for the rest); only `file:` paths, which the source lockfile
163
+ * carries verbatim, are contained here. Workspace-module and escaping paths
164
+ * are left untouched. Mutates `lockfile` in place; the key rename and every ref
165
+ * use the same `file:` path, so they stay in sync.
166
+ *
167
+ * Takes the normalized document rather than a looser shape: dependency refs are
168
+ * rewritten only where they are plain strings, which is what normalization
169
+ * guarantees. A raw v9 file records an importer ref as `{ specifier, version }`
170
+ * and would have its package key renamed while that ref kept pointing at the
171
+ * old path.
172
+ */
173
+ export declare function containShippedLocalFilePaths(lockfile: Partial<Pick<Lockfile, 'importers' | 'packages'>>, synthesizedModulePaths?: ReadonlySet<string>): void;
174
+ /**
175
+ * Relocates the shippable `link:` refs a source lockfile's package snapshots
176
+ * carry, so they resolve from the pruned output's root. pnpm reads a snapshot
177
+ * `link:` ref against the lockfile directory, which is the workspace root at
178
+ * source and the deploy root in the output, so a ref left verbatim points at a
179
+ * path the standalone output does not carry once the target ships under
180
+ * `LOCAL_PATH_MODULES_DIR`. A target that cannot ship keeps its ref, matching
181
+ * the copied manifest; the artifact collector reports why.
182
+ *
183
+ * Takes the source snapshots alone rather than the assembled document: the
184
+ * assembly relocates its own refs at their synthesis site, and a second pass
185
+ * cannot tell an already-relocated path from a workspace path that starts with
186
+ * the shipped directory's name. Mutates the snapshots in place.
187
+ */
188
+ export declare function containShippedLocalLinkRefs(sourceSnapshots: Record<string, unknown> | undefined): void;
189
+ /**
190
+ * The non-workspace local-path packages a standalone pruned output must ship so
191
+ * `pnpm install` can resolve them. The pruned lockfile records each path
192
+ * relocated under `LOCAL_PATH_MODULES_DIR` (see containLocalPath), so `path`
193
+ * ships there while `sourcePath` reads from the original workspace location.
194
+ * Three shapes ship: a `file:` tarball (the `.tgz`), a `file:` directory not
195
+ * under `workspace_modules/` (copied workspace modules ship via
196
+ * copy-workspace-modules and are skipped here), and a `link:` target directory
197
+ * (a root importer `link:` version, or a package `link:` snapshot ref).
198
+ * `node_modules` is filtered from every directory copy; a symlink inside a
199
+ * shipped tree is skipped with a warning while a symlinked root ships when it
200
+ * resolves under the workspace root; entries are deduped by destination; a
201
+ * source missing on disk or resolving outside the workspace root is skipped
202
+ * with a warning (not reproducibly deployable). Source paths rather than bytes
203
+ * so the file-writing prune paths can copy without buffering whole trees.
204
+ */
205
+ export declare function getPrunedPnpmLocalPathArtifacts(workspaceRootPath?: string, prunedLockfileContent?: string): Array<{
206
+ path: string;
207
+ sourcePath: string;
208
+ }>;
209
+ /**
210
+ * Fails the pruned build when a shipped local-path target has a required
211
+ * dependency that will not be resolvable in the standalone deploy: a `link:`
212
+ * target (a symlink, not a packed package, so pnpm never installs its
213
+ * dependency closure) or a `file:` directory package whose lockfile entry
214
+ * carries no dependency edges (a peer backfilled when `autoInstallPeers` is
215
+ * off). Both install, `pnpm install --frozen-lockfile` exits 0, and the target
216
+ * resolves its `require`s only from the deploy-root node_modules, so a
217
+ * required dep missing there fails at runtime with MODULE_NOT_FOUND; this
218
+ * throws at build time with the remedy.
219
+ *
220
+ * Only a required dep absent from the app's installed direct deps fails. A
221
+ * peer or optional dep of the target, or a required dep present only in the
222
+ * app's devDependencies (a `--prod` install may omit it), warns instead; these
223
+ * are not provably broken. The app's own peerDependencies count as installed:
224
+ * the pruned root importer folds them into `dependencies` (mirroring pnpm's
225
+ * autoInstallPeers). A backfilled `file:` tarball peer's manifest is inside
226
+ * the archive and is not read, so its closure is not validated. pnpm-only;
227
+ * call sites gate on the package manager.
228
+ */
229
+ export declare function validatePrunedLocalPathClosure(packageJson: PackageJson, workspaceRootPath: string, prunedLockfileContent?: string): void;
230
+ /**
231
+ * Relocates a `file:`/`link:` specifier recorded relative to `sourceDir` so it
232
+ * resolves from `destDir` (both workspace-root-relative posix paths, '' meaning
233
+ * the workspace root itself) to the target's shipped location under
234
+ * `LOCAL_PATH_MODULES_DIR`. Returns null for a non-local-path spec. When the
235
+ * target cannot ship into the pruned output, `spec` is returned unchanged with
236
+ * the `reason`: absolute or escaping the workspace root (`outside-workspace`),
237
+ * or the workspace root itself (`workspace-root`).
238
+ * Every layer of the pruned output (app manifest, copied-module manifests,
239
+ * lockfile snapshot refs) relocates through this one function so the layers
240
+ * cannot disagree.
241
+ */
242
+ export declare function relocatePrunedLocalPathSpec(spec: string, sourceDir: string, destDir: string): {
243
+ spec: string;
244
+ reason?: 'outside-workspace' | 'workspace-root';
245
+ } | null;
246
+ /**
247
+ * Warns when a pruned pnpm lockfile needs install-time artifacts that only
248
+ * `generatePrunedDeployOutput` ships, naming the ones this workspace actually
249
+ * needs. For callers of
250
+ * the bare `createLockFile`, which hands back a lockfile and nothing else: the
251
+ * pieces below live outside it, so an output assembled from the lockfile and
252
+ * the manifest alone installs without the workspace's build-script approvals,
253
+ * patches, or vendored local paths. Silent when the workspace needs none of
254
+ * them, which is the common case.
255
+ */
256
+ export declare function warnIncompletePrunedPnpmOutput(lockFileContent: string, workspaceRootPath?: string): void;
257
+ /** Warns that a local-path target cannot ship, with the reason-specific remedy. */
258
+ export declare function warnUnshippableLocalPathSpec(description: string, reason: 'outside-workspace' | 'workspace-root'): void;
259
+ /**
260
+ * The manifest shape the peer-dependency helpers below touch. Kept structural so
261
+ * the copied-module manifests the `@nx/js` prune executors carry, which are not
262
+ * full `PackageJson`s, go through the same helpers.
263
+ */
264
+ type PeerDependencyManifest = {
265
+ dependencies?: Record<string, string>;
266
+ peerDependencies?: Record<string, string>;
267
+ peerDependenciesMeta?: Record<string, unknown>;
268
+ };
269
+ /**
270
+ * Moves a peer dependency into `dependencies` under the given specifier: pnpm
271
+ * rejects a `file:`/`link:` spec under peerDependencies outright, so a shipped
272
+ * local path or workspace module declared there would fail the whole install.
273
+ * The `peerDependenciesMeta` entry goes with it, since the optional/required
274
+ * marker is orphaned once the dependency is no longer a peer.
275
+ */
276
+ export declare function movePeerDependencyToDependencies(packageJson: PeerDependencyManifest, name: string, spec: string): void;
277
+ /**
278
+ * Drops a `peerDependencies`/`peerDependenciesMeta` section left empty by
279
+ * `movePeerDependencyToDependencies`, so a manifest that declared nothing but
280
+ * moved peers does not ship an empty section.
281
+ */
282
+ export declare function dropEmptyPeerDependencySections(packageJson: PeerDependencyManifest): void;
283
+ /**
284
+ * Rewrites a standalone pruned manifest's non-workspace local-path specifiers
285
+ * (`file:` tarball/dir, `link:` dir) to their shipped location under
286
+ * `LOCAL_PATH_MODULES_DIR`, so a non-frozen `pnpm install` of the deploy
287
+ * output resolves them from where the shipped source sits (see
288
+ * `getPrunedPnpmLocalPathArtifacts`). Mutates `packageJson` in place.
289
+ * pnpm-only; call sites gate on the package manager.
290
+ *
291
+ * Per specifier, in order: resolve a `catalog:` reference first (the bundler's
292
+ * `createPackageJson` does not), skip a workspace package (copied to
293
+ * `workspace_modules/`), then relocate from `projectRoot`-relative to the
294
+ * shipped location. A `file:`/`link:` peer dependency is moved into
295
+ * `dependencies` with its `peerDependenciesMeta` entry dropped even when the
296
+ * target cannot ship (pnpm rejects such a spec under peerDependencies
297
+ * outright, so leaving it would fail the whole install), mirroring the
298
+ * workspace-module handling. An unshippable target otherwise keeps its
299
+ * specifier, with a warning.
300
+ */
301
+ export declare function rewritePrunedLocalPathSpecifiers(packageJson: PackageJson, projectRoot: string, workspaceRootPath: string, workspacePackageNames: Set<string>): void;
302
+ export type PrunedDeployArtifact = {
303
+ path: string;
304
+ content: string | Buffer;
305
+ sourcePath?: never;
306
+ } | {
307
+ path: string;
308
+ sourcePath: string;
309
+ content?: never;
310
+ };
311
+ /**
312
+ * The pnpm install-time artifacts a standalone pruned output needs, as data
313
+ * for a caller to write or emit: the settings-only pnpm-workspace.yaml, the
314
+ * `pnpm patch` files, and the non-workspace local-path dependencies (carried
315
+ * as a source path rather than content so a directory sink can copy them
316
+ * straight across). Everything is resolved before returning, so a colliding
317
+ * patch path aborts before the caller ships anything. The pnpm <=10
318
+ * build-script approvals and `patchedDependencies` declaration are folded onto
319
+ * `packageJson` in place (see `getPrunedPnpmPackageJsonBuildSettings`), so
320
+ * write or emit the manifest after this returns.
321
+ *
322
+ * Pass `includeLocalPathArtifacts: false` for the root-lockfile fallback
323
+ * (`pruned: false` from `createPrunedLockfile`): its importer references the
324
+ * whole workspace, so shipping its local-path trees would copy unrelated
325
+ * sources into the output.
326
+ */
327
+ export declare function getPrunedPnpmInstallArtifacts(workspaceRootPath: string, prunedLockfileContent: string, packageJson: PackageJson, options?: {
328
+ includeLocalPathArtifacts?: boolean;
329
+ }): PrunedDeployArtifact[];
330
+ export {};