@depup/nx 23.1.2-depup.1 → 23.2.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 (296) hide show
  1. package/README.md +7 -6
  2. package/changes.json +12 -8
  3. package/dist/bin/init-local.js +3 -5
  4. package/dist/bin/nx.js +1 -0
  5. package/dist/src/adapter/ngcli-adapter.js +60 -1
  6. package/dist/src/ai/constants.d.ts +15 -0
  7. package/dist/src/ai/constants.js +17 -1
  8. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +57 -9
  9. package/dist/src/ai/utils.d.ts +13 -0
  10. package/dist/src/ai/utils.js +29 -0
  11. package/dist/src/analytics/analytics.js +2 -4
  12. package/dist/src/command-line/completion/command-object.js +7 -12
  13. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +42 -31
  14. package/dist/src/command-line/format/format.js +84 -101
  15. package/dist/src/command-line/generate/generate.js +35 -35
  16. package/dist/src/command-line/import/import.js +29 -38
  17. package/dist/src/command-line/init/ai-agent-prompts.js +5 -11
  18. package/dist/src/command-line/init/command-object.js +4 -2
  19. package/dist/src/command-line/init/configure-plugins.js +4 -1
  20. package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -32
  21. package/dist/src/command-line/init/implementation/add-nx-to-nest.js +17 -21
  22. package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +8 -21
  23. package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +3 -17
  24. package/dist/src/command-line/init/implementation/angular/index.js +10 -15
  25. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -0
  26. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +8 -2
  27. package/dist/src/command-line/init/implementation/check-compatible-with-plugins.js +2 -0
  28. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +5 -0
  29. package/dist/src/command-line/init/implementation/format.d.ts +18 -0
  30. package/dist/src/command-line/init/implementation/format.js +114 -0
  31. package/dist/src/command-line/init/implementation/utils.js +8 -8
  32. package/dist/src/command-line/init/init-v1.js +15 -18
  33. package/dist/src/command-line/init/init-v2.js +77 -66
  34. package/dist/src/command-line/migrate/agentic/definitions.js +36 -9
  35. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +37 -22
  36. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +30 -39
  37. package/dist/src/command-line/migrate/agentic/handoff.d.ts +7 -7
  38. package/dist/src/command-line/migrate/agentic/handoff.js +13 -10
  39. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +7 -12
  40. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +7 -0
  41. package/dist/src/command-line/migrate/agentic/run-step.d.ts +10 -0
  42. package/dist/src/command-line/migrate/agentic/run-step.js +1 -0
  43. package/dist/src/command-line/migrate/agentic/runner.js +24 -24
  44. package/dist/src/command-line/migrate/agentic/select.d.ts +10 -2
  45. package/dist/src/command-line/migrate/agentic/select.js +30 -32
  46. package/dist/src/command-line/migrate/agentic/types.d.ts +33 -3
  47. package/dist/src/command-line/migrate/agentic/types.js +35 -0
  48. package/dist/src/command-line/migrate/command-object.d.ts +6 -0
  49. package/dist/src/command-line/migrate/command-object.js +19 -1
  50. package/dist/src/command-line/migrate/execute-migration.d.ts +28 -9
  51. package/dist/src/command-line/migrate/execute-migration.js +112 -27
  52. package/dist/src/command-line/migrate/migrate-analytics.d.ts +35 -0
  53. package/dist/src/command-line/migrate/migrate-analytics.js +64 -0
  54. package/dist/src/command-line/migrate/migrate-commits.d.ts +38 -8
  55. package/dist/src/command-line/migrate/migrate-commits.js +130 -15
  56. package/dist/src/command-line/migrate/migrate-config.d.ts +13 -12
  57. package/dist/src/command-line/migrate/migrate-config.js +22 -14
  58. package/dist/src/command-line/migrate/migrate-output.d.ts +45 -7
  59. package/dist/src/command-line/migrate/migrate-output.js +52 -8
  60. package/dist/src/command-line/migrate/migrate-ui-api.d.ts +2 -1
  61. package/dist/src/command-line/migrate/migrate-ui-api.js +16 -7
  62. package/dist/src/command-line/migrate/migrate.d.ts +24 -55
  63. package/dist/src/command-line/migrate/migrate.js +553 -226
  64. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  65. package/dist/src/command-line/migrate/multi-major.js +7 -10
  66. package/dist/src/command-line/migrate/resolve-package-version.js +4 -8
  67. package/dist/src/command-line/migrate/run/agent-output.d.ts +20 -0
  68. package/dist/src/command-line/migrate/run/agent-output.js +65 -0
  69. package/dist/src/command-line/migrate/run/index.d.ts +9 -0
  70. package/dist/src/command-line/migrate/run/index.js +23 -0
  71. package/dist/src/command-line/migrate/run/orchestrator.d.ts +20 -0
  72. package/dist/src/command-line/migrate/run/orchestrator.js +1200 -0
  73. package/dist/src/command-line/migrate/run/run-id.d.ts +16 -0
  74. package/dist/src/command-line/migrate/run/run-id.js +56 -0
  75. package/dist/src/command-line/migrate/run/run-state.d.ts +157 -0
  76. package/dist/src/command-line/migrate/run/run-state.js +438 -0
  77. package/dist/src/command-line/migrate/run/state-lock.d.ts +25 -0
  78. package/dist/src/command-line/migrate/run/state-lock.js +76 -0
  79. package/dist/src/command-line/migrate/run/state-machine.d.ts +84 -0
  80. package/dist/src/command-line/migrate/run/state-machine.js +315 -0
  81. package/dist/src/command-line/migrate/run/util.d.ts +59 -0
  82. package/dist/src/command-line/migrate/run/util.js +148 -0
  83. package/dist/src/command-line/migrate/run/worker.d.ts +16 -0
  84. package/dist/src/command-line/migrate/run/worker.js +682 -0
  85. package/dist/src/command-line/migrate/run-migration-process.js +6 -5
  86. package/dist/src/command-line/migrate/safe-prompt.d.ts +14 -26
  87. package/dist/src/command-line/migrate/safe-prompt.js +32 -43
  88. package/dist/src/command-line/migrate/sort-migrations.d.ts +16 -0
  89. package/dist/src/command-line/migrate/sort-migrations.js +32 -0
  90. package/dist/src/command-line/migrate/step-actions.d.ts +5 -0
  91. package/dist/src/command-line/migrate/step-actions.js +12 -0
  92. package/dist/src/command-line/migrate/text.d.ts +18 -0
  93. package/dist/src/command-line/migrate/text.js +26 -0
  94. package/dist/src/command-line/migrate/version-skew-guard.d.ts +60 -0
  95. package/dist/src/command-line/migrate/version-skew-guard.js +175 -0
  96. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +16 -20
  97. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.d.ts +2 -0
  98. package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +16 -0
  99. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.d.ts +4 -0
  100. package/dist/src/command-line/nx-cloud/start-nx-agents/start-nx-agents.js +13 -0
  101. package/dist/src/command-line/nx-commands.js +26 -24
  102. package/dist/src/command-line/release/changelog.js +6 -17
  103. package/dist/src/command-line/release/plan.js +15 -28
  104. package/dist/src/command-line/release/publish.js +5 -0
  105. package/dist/src/command-line/release/release.js +6 -17
  106. package/dist/src/command-line/release/utils/release-graph.d.ts +1 -0
  107. package/dist/src/command-line/release/utils/release-graph.js +10 -2
  108. package/dist/src/command-line/release/utils/remote-release-clients/github.js +10 -22
  109. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +13 -22
  110. package/dist/src/command-line/release/utils/resolve-semver-specifier.js +19 -41
  111. package/dist/src/command-line/release/version/resolve-current-version.js +7 -10
  112. package/dist/src/command-line/release/version.js +2 -2
  113. package/dist/src/command-line/reset/reset.js +17 -15
  114. package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  115. package/dist/src/command-line/yargs-utils/shared-options.js +3 -1
  116. package/dist/src/config/misc-interfaces.d.ts +19 -7
  117. package/dist/src/core/graph/main.js +1 -1
  118. package/dist/src/core/graph/styles.js +1 -1
  119. package/dist/src/daemon/client/client.d.ts +2 -7
  120. package/dist/src/daemon/client/client.js +113 -28
  121. package/dist/src/daemon/client/daemon-environment.d.ts +35 -0
  122. package/dist/src/daemon/client/daemon-environment.js +106 -6
  123. package/dist/src/daemon/client/daemon-socket-messenger.d.ts +1 -1
  124. package/dist/src/daemon/client/daemon-socket-messenger.js +8 -3
  125. package/dist/src/daemon/is-v8-serializer-enabled.d.ts +2 -2
  126. package/dist/src/daemon/is-v8-serializer-enabled.js +2 -2
  127. package/dist/src/daemon/message-types/daemon-message.d.ts +2 -1
  128. package/dist/src/daemon/message-types/daemon-message.js +25 -2
  129. package/dist/src/daemon/sandbox-socket-hint.d.ts +27 -0
  130. package/dist/src/daemon/sandbox-socket-hint.js +136 -0
  131. package/dist/src/daemon/server/client-socket-context.d.ts +1 -1
  132. package/dist/src/daemon/server/client-socket-context.js +2 -3
  133. package/dist/src/daemon/server/dotenv-graph-changes.d.ts +97 -0
  134. package/dist/src/daemon/server/dotenv-graph-changes.js +284 -0
  135. package/dist/src/daemon/server/handle-client-env.d.ts +8 -0
  136. package/dist/src/daemon/server/handle-client-env.js +92 -0
  137. package/dist/src/daemon/server/handle-outputs-changes.d.ts +10 -0
  138. package/dist/src/daemon/server/handle-outputs-changes.js +86 -0
  139. package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +21 -0
  140. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +159 -6
  141. package/dist/src/daemon/server/server.js +36 -72
  142. package/dist/src/daemon/server/shutdown-utils.d.ts +1 -1
  143. package/dist/src/daemon/server/shutdown-utils.js +2 -2
  144. package/dist/src/daemon/socket-utils.d.ts +26 -7
  145. package/dist/src/daemon/socket-utils.js +45 -31
  146. package/dist/src/daemon/tmp-dir.d.ts +10 -0
  147. package/dist/src/daemon/tmp-dir.js +21 -37
  148. package/dist/src/devkit-internals.d.ts +20 -9
  149. package/dist/src/devkit-internals.js +49 -6
  150. package/dist/src/executors/run-commands/running-tasks.js +46 -29
  151. package/dist/src/generators/internal-utils/{format-changed-files-with-prettier-if-available.d.ts → format-changed-files.d.ts} +6 -6
  152. package/dist/src/generators/internal-utils/format-changed-files.js +163 -0
  153. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +15 -0
  154. package/dist/src/generators/testing-utils/create-tree-with-empty-workspace.js +21 -3
  155. package/dist/src/migrations/update-15-0-0/prefix-outputs.js +2 -2
  156. package/dist/src/migrations/update-16-0-0/remove-nrwl-cli.js +2 -2
  157. package/dist/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +2 -2
  158. package/dist/src/migrations/update-16-0-0/update-nx-cloud-runner.js +2 -2
  159. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +2 -2
  160. package/dist/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +2 -2
  161. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +2 -2
  162. package/dist/src/migrations/update-17-2-0/move-default-base.js +2 -2
  163. package/dist/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +2 -2
  164. package/dist/src/migrations/update-19-2-4/set-project-name.js +2 -2
  165. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.js +2 -2
  166. package/dist/src/migrations/update-20-0-1/use-legacy-cache.js +2 -2
  167. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.js +2 -2
  168. package/dist/src/migrations/update-21-0-0/release-version-config-changes.js +2 -2
  169. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.js +2 -2
  170. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.js +2 -2
  171. package/dist/src/migrations/update-22-0-0/consolidate-release-tag-config.js +2 -2
  172. package/dist/src/migrations/update-22-0-0/release-version-config-changes.js +2 -2
  173. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.js +2 -2
  174. package/dist/src/migrations/update-22-6-0/add-claude-settings-local-to-git-ignore.js +2 -2
  175. package/dist/src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore.js +2 -2
  176. package/dist/src/migrations/update-22-7-0/add-polygraph-to-git-ignore.js +2 -2
  177. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +2 -2
  178. package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +2 -2
  179. package/dist/src/native/index.d.ts +7 -3
  180. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  181. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  182. package/dist/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -3
  183. package/dist/src/nx-cloud/utilities/url-shorten.d.ts +1 -4
  184. package/dist/src/nx-cloud/utilities/url-shorten.js +9 -8
  185. package/dist/src/plugins/js/lock-file/lock-file.d.ts +46 -4
  186. package/dist/src/plugins/js/lock-file/lock-file.js +192 -15
  187. package/dist/src/plugins/js/lock-file/npm-parser.js +10 -3
  188. package/dist/src/plugins/js/lock-file/pnpm-parser.js +356 -62
  189. package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +25 -1
  190. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +78 -4
  191. package/dist/src/plugins/js/lock-file/pruned-output.d.ts +330 -0
  192. package/dist/src/plugins/js/lock-file/pruned-output.js +1441 -0
  193. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -0
  194. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +6 -5
  195. package/dist/src/plugins/js/utils/register.d.ts +11 -0
  196. package/dist/src/plugins/js/utils/register.js +40 -6
  197. package/dist/src/project-graph/plugins/get-plugins.d.ts +27 -1
  198. package/dist/src/project-graph/plugins/get-plugins.js +110 -5
  199. package/dist/src/project-graph/plugins/isolation/enabled.js +1 -4
  200. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +16 -0
  201. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +69 -11
  202. package/dist/src/project-graph/plugins/isolation/messaging.js +1 -3
  203. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +23 -2
  204. package/dist/src/project-graph/project-graph.js +27 -2
  205. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +7 -0
  206. package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +14 -6
  207. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +47 -21
  208. package/dist/src/tasks-runner/is-tui-enabled.js +3 -1
  209. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  210. package/dist/src/tasks-runner/life-cycle.js +2 -2
  211. package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +12 -0
  212. package/dist/src/tasks-runner/life-cycles/performance-report.js +62 -3
  213. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +26 -1
  214. package/dist/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +99 -5
  215. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +26 -0
  216. package/dist/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +113 -17
  217. package/dist/src/tasks-runner/pseudo-ipc.js +14 -13
  218. package/dist/src/tasks-runner/pseudo-terminal.d.ts +17 -3
  219. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  220. package/dist/src/tasks-runner/run-command.js +32 -39
  221. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +55 -0
  222. package/dist/src/tasks-runner/running-tasks/batch-process.js +161 -8
  223. package/dist/src/tasks-runner/task-env.d.ts +25 -0
  224. package/dist/src/tasks-runner/task-env.js +39 -0
  225. package/dist/src/tasks-runner/task-orchestrator.d.ts +68 -0
  226. package/dist/src/tasks-runner/task-orchestrator.js +159 -8
  227. package/dist/src/utils/analytics-enabled.d.ts +7 -0
  228. package/dist/src/utils/analytics-enabled.js +11 -0
  229. package/dist/src/utils/analytics-prompt.js +4 -7
  230. package/dist/src/utils/cache-directory.d.ts +62 -3
  231. package/dist/src/utils/cache-directory.js +276 -25
  232. package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
  233. package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
  234. package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
  235. package/dist/src/utils/catalog/bun-manager.js +130 -0
  236. package/dist/src/utils/catalog/index.d.ts +1 -1
  237. package/dist/src/utils/catalog/index.js +1 -1
  238. package/dist/src/utils/catalog/manager-factory.js +3 -0
  239. package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
  240. package/dist/src/utils/catalog/manager-utils.js +9 -4
  241. package/dist/src/utils/catalog/manager.d.ts +13 -1
  242. package/dist/src/utils/catalog/manager.js +30 -0
  243. package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
  244. package/dist/src/utils/catalog/pnpm-manager.js +3 -0
  245. package/dist/src/utils/catalog/types.d.ts +4 -0
  246. package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
  247. package/dist/src/utils/catalog/yarn-manager.js +23 -32
  248. package/dist/src/utils/child-process.d.ts +31 -1
  249. package/dist/src/utils/child-process.js +103 -0
  250. package/dist/src/utils/chunkify.d.ts +7 -1
  251. package/dist/src/utils/chunkify.js +10 -3
  252. package/dist/src/utils/consume-messages-from-socket.d.ts +42 -7
  253. package/dist/src/utils/consume-messages-from-socket.js +273 -38
  254. package/dist/src/utils/db-connection.js +8 -16
  255. package/dist/src/utils/exit-codes.d.ts +9 -0
  256. package/dist/src/utils/exit-codes.js +19 -0
  257. package/dist/src/utils/formatters/index.d.ts +13 -0
  258. package/dist/src/utils/formatters/index.js +74 -0
  259. package/dist/src/utils/formatters/oxfmt.d.ts +32 -0
  260. package/dist/src/utils/formatters/oxfmt.js +764 -0
  261. package/dist/src/utils/formatters/prettier.d.ts +26 -0
  262. package/dist/src/utils/formatters/prettier.js +201 -0
  263. package/dist/src/utils/formatters/shared.d.ts +5 -0
  264. package/dist/src/utils/formatters/shared.js +8 -0
  265. package/dist/src/utils/git-utils.d.ts +38 -2
  266. package/dist/src/utils/git-utils.js +422 -19
  267. package/dist/src/utils/has-nx-js-plugin.d.ts +1 -1
  268. package/dist/src/utils/has-nx-js-plugin.js +1 -1
  269. package/dist/src/utils/ignore.d.ts +47 -5
  270. package/dist/src/utils/ignore.js +93 -11
  271. package/dist/src/utils/kill-child-on-host-exit.d.ts +7 -0
  272. package/dist/src/utils/kill-child-on-host-exit.js +42 -0
  273. package/dist/src/utils/nx-console-prompt.js +3 -6
  274. package/dist/src/utils/nx-tmp-dir.d.ts +5 -0
  275. package/dist/src/utils/nx-tmp-dir.js +7 -2
  276. package/dist/src/utils/output.d.ts +153 -0
  277. package/dist/src/utils/output.js +289 -5
  278. package/dist/src/utils/owned-private-dir.d.ts +13 -0
  279. package/dist/src/utils/owned-private-dir.js +39 -0
  280. package/dist/src/utils/package-json.d.ts +2 -0
  281. package/dist/src/utils/package-manager.js +17 -7
  282. package/dist/src/utils/params.d.ts +7 -1
  283. package/dist/src/utils/params.js +64 -6
  284. package/dist/src/utils/permission-errors.d.ts +11 -0
  285. package/dist/src/utils/permission-errors.js +17 -0
  286. package/dist/src/utils/plugins/core-plugins.js +4 -0
  287. package/dist/src/utils/prompt-helpers.d.ts +53 -0
  288. package/dist/src/utils/prompt-helpers.js +111 -0
  289. package/dist/src/utils/socket-refused-exit-code.d.ts +15 -0
  290. package/dist/src/utils/socket-refused-exit-code.js +18 -0
  291. package/dist/src/utils/write-formatted-json-file.d.ts +3 -2
  292. package/dist/src/utils/write-formatted-json-file.js +5 -4
  293. package/package.json +33 -24
  294. package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +0 -88
  295. package/dist/src/utils/is-using-prettier.d.ts +0 -3
  296. package/dist/src/utils/is-using-prettier.js +0 -62
@@ -1,13 +1,80 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.output = void 0;
4
+ exports.isStaticOutputStyle = isStaticOutputStyle;
5
+ exports.printsFullTaskOutput = printsFullTaskOutput;
6
+ exports.isLogGroupingEnabled = isLogGroupingEnabled;
7
+ exports.shouldGroupBatchOutput = shouldGroupBatchOutput;
4
8
  exports.orange = orange;
5
9
  const tslib_1 = require("tslib");
10
+ const figures = tslib_1.__importStar(require("figures"));
11
+ const fs_1 = require("fs");
6
12
  const os_1 = require("os");
7
13
  const pc = tslib_1.__importStar(require("picocolors"));
8
14
  const readline = tslib_1.__importStar(require("readline"));
9
15
  const GH_GROUP_PREFIX = '::group::';
10
16
  const GH_GROUP_SUFFIX = '::endgroup::';
17
+ /**
18
+ * `static-failures-only` is `static` with successful tasks collapsed to a single
19
+ * line. They select the same life cycle and differ only in what it prints, so
20
+ * everywhere the life cycle is chosen, the TUI is ruled out, or output is
21
+ * routed, the two behave identically.
22
+ */
23
+ function isStaticOutputStyle(outputStyle) {
24
+ return outputStyle === 'static' || outputStyle === 'static-failures-only';
25
+ }
26
+ /**
27
+ * Whether a run prints every task's output in full rather than collapsing the
28
+ * ones that succeeded. Both static life cycles and the batch renderer have to
29
+ * agree on this, so they read it from here rather than each deriving it.
30
+ *
31
+ * Exactly one style collapses, and it is also what a run that named no style
32
+ * gets. Every other style prints in full because it was asked for explicitly,
33
+ * so none may quietly withhold output. Note the static life cycles serve more
34
+ * styles than the static-sounding ones: `shouldUseDynamicLifeCycle` bails on
35
+ * `isCI()` before it looks at the style at all, so in CI `dynamic` and `tui`
36
+ * land here too. This is written as a deny-list for that reason — a new style
37
+ * prints in full until someone decides otherwise, rather than silently
38
+ * collapsing because an allow-list did not list it.
39
+ *
40
+ * Resolving the absent case here rather than assigning `outputStyle` upstream is
41
+ * deliberate: the value is also read by the orchestrator to decide whether a
42
+ * task streams, and naming the default there stops `shouldStreamOutput` from
43
+ * ever being consulted — including for the continuous tasks that must stream.
44
+ */
45
+ function printsFullTaskOutput(args) {
46
+ return (!!args.verbose ||
47
+ (args.outputStyle ?? 'static-failures-only') !== 'static-failures-only');
48
+ }
49
+ /**
50
+ * Whether task output should be wrapped in collapsible log groups. Grouping
51
+ * requires each task's output to be written as one contiguous block, which is
52
+ * why batch mode's implicit streaming backs off when this is on. It does not
53
+ * govern streaming in general — an explicit `--output-style`, the TUI, and
54
+ * long running tasks all still stream.
55
+ */
56
+ function isLogGroupingEnabled() {
57
+ return (process.env.NX_SKIP_LOG_GROUPING !== 'true' && !!process.env.GITHUB_ACTIONS);
58
+ }
59
+ /**
60
+ * Whether a batch task's output should be held back from the live stream and
61
+ * rendered inside a fold instead. A batch worker writes to stdout/stderr live,
62
+ * so forwarding that copy would put its bytes outside the group and defeat the
63
+ * fold; what is held back is written to a file and rendered by the orchestrator.
64
+ *
65
+ * Note it is the captured file, not each task's `terminalOutput`, that makes
66
+ * this lossless. A worker is free to write bytes it attributes to no task —
67
+ * `@nx/maven`'s exit-code dump, `@nx/gradle`'s configuration phase — and those
68
+ * appear in no `terminalOutput` at all, so the fold has to be able to fall back
69
+ * to the file. See `TaskOrchestrator.printGroupedBatchOutput` for when it does.
70
+ *
71
+ * This is only worth doing when grouping is on and the user has not asked to
72
+ * stream — an explicit stream style (which sets NX_STREAM_OUTPUT) wants the
73
+ * live copy, folds or not.
74
+ */
75
+ function shouldGroupBatchOutput() {
76
+ return isLogGroupingEnabled() && process.env.NX_STREAM_OUTPUT !== 'true';
77
+ }
11
78
  /**
12
79
  * Custom orange color using ANSI 256-color code 214.
13
80
  * picocolors does not support keyword-based colors like chalk,
@@ -50,6 +117,45 @@ class CLIOutput {
50
117
  this.bold = pc.bold;
51
118
  this.underline = pc.underline;
52
119
  this.dim = pc.dim;
120
+ /**
121
+ * Whether the terminal is positioned at the start of a line. Task output does
122
+ * not reliably end in a newline, so writers that must begin on a fresh line
123
+ * ask for one via {@link ensureLineStart} rather than guessing.
124
+ *
125
+ * Holding that true means a writer that can leave the cursor mid-line has to
126
+ * be routed through this class or declared to it. The ones that exist today:
127
+ *
128
+ * - This class's own writes, via {@link writeToStream}.
129
+ * - A batch worker's live output, via {@link writeTaskOutputChunk}.
130
+ * - `nx:run-commands`, which is the only executor that runs in the main
131
+ * process (`task-orchestrator.ts` gates that on the executor name), and
132
+ * whose raw writes go through {@link writeTaskOutputChunk} for this reason.
133
+ * Its `addColorAndPrefix` splits on newlines without ever appending one, so
134
+ * its chunks routinely end mid-line.
135
+ * - A pseudo-terminal task, which cannot be routed: the native side writes to
136
+ * this process's stdout from Rust, at arbitrary PTY read boundaries. It
137
+ * declares itself via {@link noteExternalWrite} instead, which is why that
138
+ * exists.
139
+ *
140
+ * Two bypasses are deliberate and safe, both because they re-emit output a
141
+ * whole line at a time via `formatPrefixedLines`, which appends `EOL` to every
142
+ * line it writes: forked task streaming through
143
+ * `NodeChildProcessWithNonDirectOutput`'s `addPrefixTransformer`, and
144
+ * `writePrefixedLines` for a main-process `nx:run-commands` under
145
+ * `NX_PREFIX_OUTPUT`.
146
+ *
147
+ * One bypass is known and is NOT safe. With `NX_NATIVE_COMMAND_RUNNER=false`,
148
+ * `forkProcessLegacy` forks with inherited stdio and yields
149
+ * `NodeChildProcessWithDirectOutput`, whose child writes straight to this
150
+ * process's fd 1 at arbitrary boundaries — unroutable and undeclarable from
151
+ * here. Line tracking is simply wrong on that path; it degrades to the
152
+ * pre-tracking behavior of a glued marker rather than to anything new. Do not
153
+ * read this list as closed: it is what is known, and the way to tell you are
154
+ * adding to it is that you are writing to stdout during a run without going
155
+ * through {@link writeToStream}, {@link writeTaskOutputChunk} or
156
+ * {@link noteExternalWrite}.
157
+ */
158
+ this.atLineStart = true;
53
159
  }
54
160
  /**
55
161
  * Longer dash character which forms more of a continuous line when place side to side
@@ -63,8 +169,59 @@ class CLIOutput {
63
169
  return divider;
64
170
  }
65
171
  writeToStream(str, stream = process.stdout) {
172
+ // stdout and stderr share one cursor wherever this matters — a CI log, a
173
+ // terminal — so a write to either moves it.
174
+ if ((stream === process.stdout || stream === process.stderr) &&
175
+ str.length > 0) {
176
+ this.atLineStart = str.endsWith('\n');
177
+ }
66
178
  stream.write(str);
67
179
  }
180
+ /**
181
+ * Forwards a chunk of a task's output live, keeping {@link atLineStart}
182
+ * accurate. Batch workers write raw chunks that routinely end mid-line, and a
183
+ * collapsed summary line must not be glued onto one.
184
+ *
185
+ * @internal Not part of the output API plugins may rely on.
186
+ */
187
+ writeTaskOutputChunk(chunk, stream = process.stdout) {
188
+ if (chunk.length > 0 &&
189
+ (stream === process.stdout || stream === process.stderr)) {
190
+ // A Buffer is written through undecoded so a chunk that splits a
191
+ // multi-byte character is not mangled; 0x0a only ever encodes a newline
192
+ // in UTF-8, so its last byte answers the question on its own.
193
+ this.atLineStart =
194
+ typeof chunk === 'string'
195
+ ? chunk.endsWith('\n')
196
+ : chunk[chunk.length - 1] === 0x0a;
197
+ }
198
+ stream.write(chunk);
199
+ }
200
+ /**
201
+ * Declares output this class could not route — a pseudo-terminal task's, which
202
+ * the native side writes straight to our stdout — so the next writer needing a
203
+ * fresh line asks for one instead of trusting a stale position.
204
+ *
205
+ * The chunk is inspected rather than assumed mid-line, so output that did end
206
+ * on a line boundary does not cost a blank line. PTY chunks often end in an
207
+ * escape sequence after the newline, and that reads as mid-line, which is the
208
+ * safe direction to be wrong in: a spare newline, never a glued one.
209
+ */
210
+ noteExternalWrite(chunk) {
211
+ if (chunk === undefined || chunk.length === 0) {
212
+ this.atLineStart = false;
213
+ return;
214
+ }
215
+ this.atLineStart =
216
+ typeof chunk === 'string'
217
+ ? chunk.endsWith('\n')
218
+ : chunk[chunk.length - 1] === 0x0a;
219
+ }
220
+ ensureLineStart() {
221
+ if (!this.atLineStart) {
222
+ this.addNewline();
223
+ }
224
+ }
68
225
  overwriteLine(lineText = '') {
69
226
  // Ensure we always start writing from column 0.
70
227
  readline.cursorTo(process.stdout, 0);
@@ -182,8 +339,8 @@ class CLIOutput {
182
339
  }
183
340
  logCommandOutput(message, taskStatus, output) {
184
341
  let commandOutputWithStatus = this.getCommandWithStatus(message, taskStatus);
185
- if (process.env.NX_SKIP_LOG_GROUPING !== 'true' &&
186
- process.env.GITHUB_ACTIONS) {
342
+ const grouped = isLogGroupingEnabled();
343
+ if (grouped) {
187
344
  const icon = this.getStatusIcon(taskStatus);
188
345
  commandOutputWithStatus = `${GH_GROUP_PREFIX}${icon} ${commandOutputWithStatus}`;
189
346
  }
@@ -192,9 +349,120 @@ class CLIOutput {
192
349
  this.addNewline();
193
350
  this.addNewline();
194
351
  this.writeToStream(output);
195
- if (process.env.NX_SKIP_LOG_GROUPING !== 'true' &&
196
- process.env.GITHUB_ACTIONS) {
197
- this.writeToStream(GH_GROUP_SUFFIX);
352
+ if (grouped) {
353
+ // GitHub only recognizes ::endgroup:: as a workflow command when it
354
+ // starts a line, and task output routinely lacks a trailing newline.
355
+ this.ensureLineStart();
356
+ this.writeToStream(`${GH_GROUP_SUFFIX}${os_1.EOL}`);
357
+ }
358
+ }
359
+ /**
360
+ * A single line standing in for a task's full output, used when the output
361
+ * itself carries no information worth printing (a success, or a cache hit).
362
+ * Statuses that carry a diagnosable body are deliberately not accepted here.
363
+ */
364
+ logCommandSummary(message, taskStatus) {
365
+ // The preceding task may have left the cursor mid-line, and this line must
366
+ // not be glued onto the end of that task's output.
367
+ this.ensureLineStart();
368
+ const icon = pc.green(figures.tick);
369
+ const command = this.addTaskStatus(taskStatus, this.formatCommand(this.normalizeMessage(message)));
370
+ this.writeToStream(`${icon} ${command}${os_1.EOL}`);
371
+ }
372
+ /**
373
+ * A one-line stand-in for a task whose full output is shown elsewhere — used
374
+ * for the tasks of a batch rendered as a single log group rather than per
375
+ * task. `note` points the reader at that group.
376
+ */
377
+ logCommandRedirect(message,
378
+ // A skipped task never ran, so it has no fold to be redirected to - and the
379
+ // icon ladder below would render it with the success tick. Excluding it
380
+ // makes the call site's `status !== 'skipped'` check a consequence of the
381
+ // type rather than a convention to remember.
382
+ taskStatus, note) {
383
+ this.ensureLineStart();
384
+ // A stopped task did not fail; it never got to finish. The TUI summary
385
+ // already draws that distinction, so use the same glyph.
386
+ const icon = taskStatus === 'stopped'
387
+ ? pc.cyan(figures.squareSmallFilled)
388
+ : taskStatus === 'failure'
389
+ ? pc.red(figures.cross)
390
+ : pc.green(figures.tick);
391
+ const command = this.formatCommand(this.normalizeMessage(message));
392
+ this.writeToStream(`${icon} ${command} ${pc.dim(note)}${os_1.EOL}`);
393
+ }
394
+ /**
395
+ * Prints a batch's combined output as one log group. A batch runner's
396
+ * diagnostics — a crash, a config-phase error, a runner summary — belong to no
397
+ * single task, so the group is labelled with the batch rather than a task.
398
+ *
399
+ * The batch's own output is copied straight from the file it was captured
400
+ * into, so an arbitrarily long log costs a fixed amount of memory here.
401
+ * Nothing is withheld: this rendering is chosen because the whole log was
402
+ * asked for, because no task claimed any of it, or because a task failed or
403
+ * was stopped — in which case repeating claimed bytes beside the per-task
404
+ * blocks is deliberate (see TaskOrchestrator.printGroupedBatchOutput).
405
+ */
406
+ logBatchGroup(label, body, taskStatus) {
407
+ const grouped = isLogGroupingEnabled();
408
+ let header = `${pc.dim('> ')}${pc.bold(label)}`;
409
+ if (grouped) {
410
+ header = `${GH_GROUP_PREFIX}${this.getStatusIcon(taskStatus)} ${header}`;
411
+ }
412
+ this.addNewline();
413
+ this.writeToStream(header);
414
+ this.addNewline();
415
+ this.addNewline();
416
+ try {
417
+ if (body.capturedOutputPath) {
418
+ this.copyFileToStream(body.capturedOutputPath);
419
+ }
420
+ if (body.trailer) {
421
+ this.ensureLineStart();
422
+ this.writeToStream(`${body.trailer}${os_1.EOL}`);
423
+ }
424
+ }
425
+ finally {
426
+ // The header is already on the stream, so an exception while rendering
427
+ // the body must not skip the terminator: GitHub would fold every line
428
+ // after this point into a group that never closes, swallowing the rest of
429
+ // the run's output rather than just this batch's.
430
+ if (grouped) {
431
+ this.ensureLineStart();
432
+ this.writeToStream(`${GH_GROUP_SUFFIX}${os_1.EOL}`);
433
+ }
434
+ else {
435
+ this.ensureLineStart();
436
+ }
437
+ }
438
+ }
439
+ /**
440
+ * Copies a file to stdout a chunk at a time. Reading it into one string would
441
+ * reintroduce the unbounded growth that writing it to disk avoided, and a
442
+ * long batch log can exceed the maximum length of a JS string.
443
+ */
444
+ copyFileToStream(path) {
445
+ let fd;
446
+ try {
447
+ fd = (0, fs_1.openSync)(path, 'r');
448
+ }
449
+ catch {
450
+ // The batch left nothing behind, or it is already cleaned up. The tasks'
451
+ // own redirect lines still point at this group.
452
+ return;
453
+ }
454
+ try {
455
+ const buffer = Buffer.allocUnsafe(64 * 1024);
456
+ let bytesRead;
457
+ while ((bytesRead = (0, fs_1.readSync)(fd, buffer, 0, buffer.length, null)) > 0) {
458
+ // Copy before writing. `stream.write` queues a Buffer by reference, and
459
+ // stdout is a pipe wherever grouping is on, so a backed-up write would
460
+ // still be holding this memory when the next read overwrites it.
461
+ this.writeTaskOutputChunk(Buffer.from(buffer.subarray(0, bytesRead)));
462
+ }
463
+ }
464
+ finally {
465
+ (0, fs_1.closeSync)(fd);
198
466
  }
199
467
  }
200
468
  getCommandWithStatus(message, taskStatus) {
@@ -207,12 +475,28 @@ class CLIOutput {
207
475
  return '✅';
208
476
  case 'failure':
209
477
  return '❌';
478
+ case 'stopped':
479
+ return '⏹️';
210
480
  case 'skipped':
211
481
  case 'local-cache-kept-existing':
212
482
  return '⏩';
213
483
  case 'local-cache':
214
484
  case 'remote-cache':
215
485
  return '🔁';
486
+ default: {
487
+ // The repo compiles with `strict: false`, so a `: string` return type
488
+ // alone does not reject a fallthrough - `undefined` stays assignable.
489
+ // This does: a new `TaskStatus` member fails to narrow to `never` here.
490
+ // Worth the lines because the gap already shipped once, rendering
491
+ // `::group::undefined > nx run ...` for a stopped task.
492
+ const unhandled = taskStatus;
493
+ void unhandled;
494
+ // Returning `unhandled` would print the status text where an icon goes
495
+ // (`::group::queued > nx run ...`) for a value that reached us over IPC
496
+ // or from cache metadata without passing the compiler. No icon reads
497
+ // better than a wrong one.
498
+ return '';
499
+ }
216
500
  }
217
501
  }
218
502
  normalizeMessage(message) {
@@ -72,6 +72,19 @@ export declare class DirectoryRefusedError extends Error {
72
72
  readonly refusal: DirRefusal;
73
73
  constructor(refusal: DirRefusal);
74
74
  }
75
+ /**
76
+ * The spelling to compare a directory by. `resolve` does not dereference
77
+ * symlinks, and on macOS `/tmp` is a symlink to `/private/tmp`, so an
78
+ * exact-match list would wave through an alias of a root it means to refuse.
79
+ *
80
+ * Resolves the longest ancestor that exists and re-appends the rest: Nx's own
81
+ * roots are absent before its first run, and canonicalizing whole paths only
82
+ * would degrade this to a string match on exactly a fresh machine.
83
+ *
84
+ * Only `ENOENT` walks up — any other errno means the path exists and cannot be
85
+ * read through, which `ensureOwnedPrivateDir` cannot establish either.
86
+ */
87
+ export declare function canonicalDir(dir: string): string;
75
88
  /**
76
89
  * Whether a shared container is safe to keep an owner-only directory under.
77
90
  *
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DirectoryRefusedError = void 0;
4
4
  exports.describeRefusal = describeRefusal;
5
5
  exports.remedyFor = remedyFor;
6
+ exports.canonicalDir = canonicalDir;
6
7
  exports.isSafeSharedRoot = isSafeSharedRoot;
7
8
  exports.isPeerWritable = isPeerWritable;
8
9
  exports.ensureSafeSharedRoot = ensureSafeSharedRoot;
@@ -11,6 +12,7 @@ exports.getUserSegment = getUserSegment;
11
12
  exports.ensureOwnedPrivateDir = ensureOwnedPrivateDir;
12
13
  const node_fs_1 = require("node:fs");
13
14
  const node_os_1 = require("node:os");
15
+ const node_path_1 = require("node:path");
14
16
  // A string discriminant, not a boolean `ok`: this repo compiles with
15
17
  // `strict: false`, where TypeScript does not narrow a union on a boolean literal.
16
18
  const allow = (path) => ({ status: 'ok', path });
@@ -127,6 +129,43 @@ function chmodRealDirectory(path, mode) {
127
129
  (0, node_fs_1.closeSync)(fd);
128
130
  }
129
131
  }
132
+ /**
133
+ * The spelling to compare a directory by. `resolve` does not dereference
134
+ * symlinks, and on macOS `/tmp` is a symlink to `/private/tmp`, so an
135
+ * exact-match list would wave through an alias of a root it means to refuse.
136
+ *
137
+ * Resolves the longest ancestor that exists and re-appends the rest: Nx's own
138
+ * roots are absent before its first run, and canonicalizing whole paths only
139
+ * would degrade this to a string match on exactly a fresh machine.
140
+ *
141
+ * Only `ENOENT` walks up — any other errno means the path exists and cannot be
142
+ * read through, which `ensureOwnedPrivateDir` cannot establish either.
143
+ */
144
+ function canonicalDir(dir) {
145
+ const resolved = (0, node_path_1.resolve)(dir);
146
+ const missing = [];
147
+ let candidate = resolved;
148
+ // Terminates at the filesystem root, where `dirname` is a fixed point.
149
+ while ((0, node_path_1.dirname)(candidate) !== candidate) {
150
+ try {
151
+ return (0, node_path_1.join)((0, node_fs_1.realpathSync)(candidate), ...missing);
152
+ }
153
+ catch (e) {
154
+ if (e?.code !== 'ENOENT') {
155
+ return resolved;
156
+ }
157
+ missing.unshift((0, node_path_1.basename)(candidate));
158
+ candidate = (0, node_path_1.dirname)(candidate);
159
+ }
160
+ }
161
+ // The root itself: resolve it directly rather than walking past it.
162
+ try {
163
+ return (0, node_path_1.join)((0, node_fs_1.realpathSync)(candidate), ...missing);
164
+ }
165
+ catch {
166
+ return resolved;
167
+ }
168
+ }
130
169
  /**
131
170
  * Sticky. Restricts rename and unlink in a writable directory to the owner of
132
171
  * each entry — plus the directory's own owner, which is why the ownership check
@@ -61,6 +61,8 @@ export interface PackageJson {
61
61
  libc?: string[];
62
62
  };
63
63
  ignoredOptionalDependencies?: string[];
64
+ packageExtensions?: Record<string, unknown>;
65
+ patchedDependencies?: Record<string, string>;
64
66
  };
65
67
  overrides?: PackageOverride;
66
68
  allowScripts?: Record<string, boolean>;
@@ -175,19 +175,22 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
175
175
  };
176
176
  },
177
177
  pnpm: () => {
178
- let modernPnpm, includeDoubleDashBeforeArgs, allowRegistryConfigKey;
178
+ let modernPnpm, includeDoubleDashBeforeArgs, configForm, scopedForm;
179
179
  try {
180
180
  const pnpmVersion = getPackageManagerVersion('pnpm', root);
181
181
  modernPnpm = (0, semver_1.gte)(pnpmVersion, '6.13.0');
182
182
  includeDoubleDashBeforeArgs = (0, semver_1.lt)(pnpmVersion, '7.0.0');
183
- // Support for --@scope:registry was added in pnpm v10.5.0 and backported to v9.15.7.
184
- // Versions >=10.0.0 and <10.5.0 do NOT support this CLI option.
185
- allowRegistryConfigKey = (0, semver_1.satisfies)(pnpmVersion, '>=9.15.7 <10.0.0 || >=10.5.0');
183
+ configForm = (0, semver_1.gte)(pnpmVersion, '11.0.0');
184
+ // Support for --@scope:registry was added in pnpm v10.5.0 and
185
+ // backported to v9.15.7. Starting with pnpm 11, the equivalent
186
+ // option is --config.@scope:registry.
187
+ scopedForm = (0, semver_1.satisfies)(pnpmVersion, '>=9.15.7 <10.0.0 || >=10.5.0 <11.0.0');
186
188
  }
187
189
  catch {
188
190
  modernPnpm = true;
189
191
  includeDoubleDashBeforeArgs = true;
190
- allowRegistryConfigKey = false;
192
+ configForm = false;
193
+ scopedForm = false;
191
194
  }
192
195
  const isPnpmWorkspace = (0, fs_1.existsSync)((0, path_1.join)(root, 'pnpm-workspace.yaml'));
193
196
  return {
@@ -211,7 +214,11 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
211
214
  list: 'pnpm ls --depth 100',
212
215
  why: 'pnpm why',
213
216
  getRegistryUrl: 'pnpm config get registry',
214
- publish: (packageRoot, registry, registryConfigKey, tag) => `pnpm publish "${packageRoot}" --json --"${allowRegistryConfigKey ? registryConfigKey : 'registry'}=${registry}" --tag=${tag} --no-git-checks`,
217
+ publish: (packageRoot, registry, registryConfigKey, tag) => `pnpm publish "${packageRoot}" --json --"${configForm
218
+ ? `config.${registryConfigKey}`
219
+ : scopedForm
220
+ ? registryConfigKey
221
+ : 'registry'}=${registry}" --tag=${tag} --no-git-checks`,
215
222
  ignoreScriptsFlag: '--ignore-scripts',
216
223
  };
217
224
  },
@@ -268,7 +275,10 @@ function getPackageManagerVersion(packageManager = detectPackageManager(), cwd =
268
275
  }
269
276
  if (!version) {
270
277
  try {
271
- version = (0, child_process_1.execSync)(`${packageManager} --version`, {
278
+ const versionArgs = packageManager === 'pnpm'
279
+ ? '--ignore-workspace --version'
280
+ : '--version';
281
+ version = (0, child_process_1.execSync)(`${packageManager} ${versionArgs}`, {
272
282
  cwd,
273
283
  encoding: 'utf-8',
274
284
  windowsHide: true,
@@ -125,16 +125,22 @@ export declare function warnDeprecations(opts: {
125
125
  export declare function convertSmartDefaultsIntoNamedParams(opts: {
126
126
  [k: string]: any;
127
127
  }, schema: Schema, defaultProjectName: string | null, relativeCwd: string | null): void;
128
- type Prompt = ConstructorParameters<typeof import('enquirer').Prompt>[0] & {
128
+ type Prompt = {
129
129
  name: string;
130
130
  type: 'input' | 'autocomplete' | 'multiselect' | 'confirm' | 'numeral';
131
131
  message: string;
132
132
  initial?: any;
133
+ /**
134
+ * Retained because {@link getPromptsForSchema} is exported and asserted on;
135
+ * the prompt itself scrolls rather than truncating.
136
+ */
133
137
  limit?: number;
134
138
  choices?: (string | {
135
139
  name: string;
136
140
  message: string;
137
141
  })[];
142
+ /** Returns `true` when valid, otherwise the message to show. */
143
+ validate?: (value: any) => boolean | string;
138
144
  };
139
145
  export declare function getPromptsForSchema(opts: Options, schema: Schema, projectsConfigurations: ProjectsConfigurations): Prompt[];
140
146
  export {};
@@ -14,7 +14,7 @@ exports.warnDeprecations = warnDeprecations;
14
14
  exports.convertSmartDefaultsIntoNamedParams = convertSmartDefaultsIntoNamedParams;
15
15
  exports.getPromptsForSchema = getPromptsForSchema;
16
16
  const logger_1 = require("./logger");
17
- const handle_import_1 = require("./handle-import");
17
+ const prompt_helpers_1 = require("./prompt-helpers");
18
18
  function camelCase(input) {
19
19
  if (input.indexOf('-') > 1) {
20
20
  return input
@@ -658,13 +658,71 @@ function getPromptsForSchema(opts, schema, projectsConfigurations) {
658
658
  return prompts;
659
659
  }
660
660
  async function promptForValues(opts, schema, projectsConfigurations) {
661
- return await (await (0, handle_import_1.handleImport)('enquirer'))
662
- .prompt(getPromptsForSchema(opts, schema, projectsConfigurations))
663
- .then((values) => ({ ...opts, ...values }))
664
- .catch((e) => {
661
+ try {
662
+ const values = {};
663
+ // Asked one at a time; a schema prompt has no cross-question state, so the
664
+ // order is just the schema's own.
665
+ for (const question of getPromptsForSchema(opts, schema, projectsConfigurations)) {
666
+ values[question.name] = await askSchemaQuestion(question);
667
+ }
668
+ return { ...opts, ...values };
669
+ }
670
+ catch (e) {
665
671
  console.error(e);
666
672
  process.exit(1);
667
- });
673
+ }
674
+ }
675
+ async function askSchemaQuestion(question) {
676
+ const validate = question.validate
677
+ ? (value) => {
678
+ const result = question.validate(value);
679
+ return result === true
680
+ ? undefined
681
+ : typeof result === 'string'
682
+ ? result
683
+ : 'Invalid value';
684
+ }
685
+ : undefined;
686
+ const choices = (question.choices ?? []).map((c) => typeof c === 'string' ? { value: c } : { value: c.name, label: c.message });
687
+ switch (question.type) {
688
+ case 'confirm':
689
+ return (0, prompt_helpers_1.confirmationPrompt)({
690
+ message: question.message,
691
+ initial: question.initial !== false,
692
+ });
693
+ case 'multiselect':
694
+ return (0, prompt_helpers_1.multiselectPrompt)({
695
+ message: question.message,
696
+ choices,
697
+ initialValues: Array.isArray(question.initial)
698
+ ? question.initial
699
+ : undefined,
700
+ });
701
+ case 'autocomplete':
702
+ return (0, prompt_helpers_1.selectPrompt)({
703
+ message: question.message,
704
+ choices,
705
+ initial: question.initial,
706
+ });
707
+ case 'numeral': {
708
+ // No numeric prompt; the answer is parsed back so the schema still
709
+ // receives a number.
710
+ const answer = await (0, prompt_helpers_1.textPrompt)({
711
+ message: question.message,
712
+ initialValue: question.initial === undefined ? undefined : String(question.initial),
713
+ validate: (value) => value !== '' && !Number.isNaN(Number(value))
714
+ ? validate?.(Number(value))
715
+ : 'Please enter a number',
716
+ });
717
+ return Number(answer);
718
+ }
719
+ default:
720
+ return (0, prompt_helpers_1.textPrompt)({
721
+ message: question.message,
722
+ initialValue: typeof question.initial === 'string' ? question.initial : undefined,
723
+ validate,
724
+ });
725
+ }
668
726
  }
669
727
  function findSchemaForProperty(propName, schema) {
670
728
  if (propName in schema.properties) {
@@ -0,0 +1,11 @@
1
+ /**
2
+ * EACCES and EPERM are the two errnos that mean the operating system refused
3
+ * us, rather than that nothing was there or nothing was listening. What they
4
+ * call for differs by what was being opened -- a socket owned by another user,
5
+ * a sandbox denying a bind, a settings file the agent harness protects -- but
6
+ * they share the property that retrying cannot change the answer.
7
+ *
8
+ * Deliberately import-free: the plugin worker entry point and the daemon client
9
+ * both reach this, and neither can afford to pull a module graph in for it.
10
+ */
11
+ export declare function isPermissionDenied(error: unknown): boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPermissionDenied = isPermissionDenied;
4
+ /**
5
+ * EACCES and EPERM are the two errnos that mean the operating system refused
6
+ * us, rather than that nothing was there or nothing was listening. What they
7
+ * call for differs by what was being opened -- a socket owned by another user,
8
+ * a sandbox denying a bind, a settings file the agent harness protects -- but
9
+ * they share the property that retrying cannot change the answer.
10
+ *
11
+ * Deliberately import-free: the plugin worker entry point and the daemon client
12
+ * both reach this, and neither can afford to pull a module graph in for it.
13
+ */
14
+ function isPermissionDenied(error) {
15
+ const code = error?.code;
16
+ return code === 'EACCES' || code === 'EPERM';
17
+ }
@@ -42,6 +42,10 @@ exports.CORE_PLUGINS = [
42
42
  name: '@nx/eslint',
43
43
  capabilities: 'executors,generators',
44
44
  },
45
+ {
46
+ name: '@nx/oxlint',
47
+ capabilities: 'generators',
48
+ },
45
49
  {
46
50
  name: '@nx/nest',
47
51
  capabilities: 'generators',