nx 23.0.0-beta.2 → 23.0.0-beta.21

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 (274) hide show
  1. package/dist/bin/init-local.js +11 -20
  2. package/dist/bin/nx.d.ts +1 -0
  3. package/dist/bin/nx.js +28 -2
  4. package/dist/plugins/package-json.js +4 -2
  5. package/dist/src/adapter/ngcli-adapter.d.ts +2 -1
  6. package/dist/src/adapter/ngcli-adapter.js +25 -2
  7. package/dist/src/ai/clone-ai-config-repo.js +20 -3
  8. package/dist/src/analytics/analytics.js +10 -1
  9. package/dist/src/command-line/add/completion.d.ts +1 -0
  10. package/dist/src/command-line/add/completion.js +15 -0
  11. package/dist/src/command-line/affected/completion.d.ts +1 -0
  12. package/dist/src/command-line/affected/completion.js +15 -0
  13. package/dist/src/command-line/completion/argv-layout.d.ts +6 -0
  14. package/dist/src/command-line/completion/argv-layout.js +19 -0
  15. package/dist/src/command-line/completion/command-completions.d.ts +19 -0
  16. package/dist/src/command-line/completion/command-completions.js +120 -0
  17. package/dist/src/command-line/completion/command-handlers.d.ts +30 -0
  18. package/dist/src/command-line/completion/command-handlers.js +69 -0
  19. package/dist/src/command-line/completion/command-object.d.ts +10 -0
  20. package/dist/src/command-line/completion/command-object.js +95 -0
  21. package/dist/src/command-line/completion/completion-providers.d.ts +21 -0
  22. package/dist/src/command-line/completion/completion-providers.js +194 -0
  23. package/dist/src/command-line/completion/infix-targets.d.ts +1 -0
  24. package/dist/src/command-line/completion/infix-targets.js +48 -0
  25. package/dist/src/command-line/completion/metadata.d.ts +22 -0
  26. package/dist/src/command-line/completion/metadata.js +71 -0
  27. package/dist/src/command-line/completion/registrations.d.ts +9 -0
  28. package/dist/src/command-line/completion/registrations.js +16 -0
  29. package/dist/src/command-line/completion/scripts/bash.sh +51 -0
  30. package/dist/src/command-line/completion/scripts/fish.fish +47 -0
  31. package/dist/src/command-line/completion/scripts/powershell.ps1 +52 -0
  32. package/dist/src/command-line/completion/scripts/zsh.zsh +69 -0
  33. package/dist/src/command-line/completion/scripts.d.ts +18 -0
  34. package/dist/src/command-line/completion/scripts.js +140 -0
  35. package/dist/src/command-line/completion/trigger.d.ts +3 -0
  36. package/dist/src/command-line/completion/trigger.js +21 -0
  37. package/dist/src/command-line/completion/value-completions.d.ts +3 -0
  38. package/dist/src/command-line/completion/value-completions.js +21 -0
  39. package/dist/src/command-line/examples.js +1 -1
  40. package/dist/src/command-line/format/format.js +15 -5
  41. package/dist/src/command-line/generate/completion.d.ts +1 -0
  42. package/dist/src/command-line/generate/completion.js +9 -0
  43. package/dist/src/command-line/graph/completion.d.ts +1 -0
  44. package/dist/src/command-line/graph/completion.js +13 -0
  45. package/dist/src/command-line/init/implementation/angular/standalone-workspace.js +14 -18
  46. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -0
  47. package/dist/src/command-line/init/implementation/utils.d.ts +7 -1
  48. package/dist/src/command-line/init/implementation/utils.js +51 -14
  49. package/dist/src/command-line/migrate/agentic/capture-generator-output.d.ts +22 -0
  50. package/dist/src/command-line/migrate/agentic/capture-generator-output.js +100 -0
  51. package/dist/src/command-line/migrate/agentic/cli-args.d.ts +12 -0
  52. package/dist/src/command-line/migrate/agentic/cli-args.js +38 -0
  53. package/dist/src/command-line/migrate/agentic/definitions.d.ts +6 -0
  54. package/dist/src/command-line/migrate/agentic/definitions.js +98 -0
  55. package/dist/src/command-line/migrate/agentic/detect-installed.d.ts +10 -0
  56. package/dist/src/command-line/migrate/agentic/detect-installed.js +68 -0
  57. package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +46 -0
  58. package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +87 -0
  59. package/dist/src/command-line/migrate/agentic/handoff.d.ts +63 -0
  60. package/dist/src/command-line/migrate/agentic/handoff.js +183 -0
  61. package/dist/src/command-line/migrate/agentic/inception.d.ts +9 -0
  62. package/dist/src/command-line/migrate/agentic/inception.js +15 -0
  63. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +22 -0
  64. package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +50 -0
  65. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +51 -0
  66. package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +65 -0
  67. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +44 -0
  68. package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +52 -0
  69. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +21 -0
  70. package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +26 -0
  71. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +18 -0
  72. package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +130 -0
  73. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +46 -0
  74. package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +88 -0
  75. package/dist/src/command-line/migrate/agentic/run-step.d.ts +51 -0
  76. package/dist/src/command-line/migrate/agentic/run-step.js +121 -0
  77. package/dist/src/command-line/migrate/agentic/runner.d.ts +33 -0
  78. package/dist/src/command-line/migrate/agentic/runner.js +442 -0
  79. package/dist/src/command-line/migrate/agentic/select.d.ts +14 -0
  80. package/dist/src/command-line/migrate/agentic/select.js +150 -0
  81. package/dist/src/command-line/migrate/agentic/types.d.ts +102 -0
  82. package/dist/src/command-line/migrate/agentic/types.js +2 -0
  83. package/dist/src/command-line/migrate/command-object.d.ts +1 -0
  84. package/dist/src/command-line/migrate/command-object.js +32 -7
  85. package/dist/src/command-line/migrate/migrate-commits.d.ts +50 -0
  86. package/dist/src/command-line/migrate/migrate-commits.js +102 -0
  87. package/dist/src/command-line/migrate/migrate-output.d.ts +180 -0
  88. package/dist/src/command-line/migrate/migrate-output.js +258 -0
  89. package/dist/src/command-line/migrate/migrate.d.ts +122 -12
  90. package/dist/src/command-line/migrate/migrate.js +1036 -217
  91. package/dist/src/command-line/migrate/migration-shape.d.ts +8 -0
  92. package/dist/src/command-line/migrate/migration-shape.js +13 -0
  93. package/dist/src/command-line/migrate/multi-major.d.ts +30 -0
  94. package/dist/src/command-line/migrate/multi-major.js +185 -0
  95. package/dist/src/command-line/migrate/prompt-files.d.ts +31 -0
  96. package/dist/src/command-line/migrate/prompt-files.js +141 -0
  97. package/dist/src/command-line/migrate/run-migration-process.js +28 -6
  98. package/dist/src/command-line/migrate/safe-prompt.d.ts +28 -0
  99. package/dist/src/command-line/migrate/safe-prompt.js +49 -0
  100. package/dist/src/command-line/migrate/update-filters.d.ts +11 -0
  101. package/dist/src/command-line/migrate/update-filters.js +44 -0
  102. package/dist/src/command-line/migrate/version-utils.d.ts +6 -0
  103. package/dist/src/command-line/migrate/version-utils.js +59 -0
  104. package/dist/src/command-line/nx-commands.js +9 -0
  105. package/dist/src/command-line/release/config/config.d.ts +3 -6
  106. package/dist/src/command-line/release/config/config.js +77 -45
  107. package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
  108. package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
  109. package/dist/src/command-line/release/utils/release-graph.js +2 -3
  110. package/dist/src/command-line/release/utils/repository-git-tags.js +1 -1
  111. package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +7 -19
  112. package/dist/src/command-line/release/version/resolve-current-version.js +1 -1
  113. package/dist/src/command-line/release/version/version-actions.js +3 -7
  114. package/dist/src/command-line/report/report.js +2 -2
  115. package/dist/src/command-line/run/completion.d.ts +1 -0
  116. package/dist/src/command-line/run/completion.js +7 -0
  117. package/dist/src/command-line/run-many/completion.d.ts +1 -0
  118. package/dist/src/command-line/run-many/completion.js +13 -0
  119. package/dist/src/command-line/show/completion.d.ts +1 -0
  120. package/dist/src/command-line/show/completion.js +27 -0
  121. package/dist/src/command-line/show/show-target/info.d.ts +1 -0
  122. package/dist/src/command-line/show/show-target/info.js +100 -19
  123. package/dist/src/command-line/watch/command-object.js +24 -4
  124. package/dist/src/command-line/watch/completion.d.ts +1 -0
  125. package/dist/src/command-line/watch/completion.js +10 -0
  126. package/dist/src/command-line/watch/watch.d.ts +7 -0
  127. package/dist/src/command-line/watch/watch.js +1 -1
  128. package/dist/src/config/misc-interfaces.d.ts +25 -2
  129. package/dist/src/config/nx-json.d.ts +43 -56
  130. package/dist/src/config/schema-utils.d.ts +21 -0
  131. package/dist/src/config/schema-utils.js +92 -18
  132. package/dist/src/config/task-graph.d.ts +4 -107
  133. package/dist/src/core/graph/main.js +1 -1
  134. package/dist/src/core/graph/styles.css +2 -3
  135. package/dist/src/core/graph/styles.js +1 -1
  136. package/dist/src/daemon/client/client.d.ts +1 -1
  137. package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +1 -1
  138. package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
  139. package/dist/src/daemon/server/file-watching/route-workspace-changes.d.ts +9 -0
  140. package/dist/src/daemon/server/file-watching/route-workspace-changes.js +76 -0
  141. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +45 -11
  142. package/dist/src/daemon/server/server.js +4 -43
  143. package/dist/src/daemon/server/start.d.ts +1 -1
  144. package/dist/src/daemon/server/start.js +2 -0
  145. package/dist/src/devkit-exports.d.ts +2 -2
  146. package/dist/src/devkit-internals.d.ts +5 -1
  147. package/dist/src/devkit-internals.js +17 -1
  148. package/dist/src/executors/run-commands/running-tasks.d.ts +7 -0
  149. package/dist/src/executors/run-commands/running-tasks.js +178 -105
  150. package/dist/src/executors/run-script/run-script.impl.js +3 -10
  151. package/dist/src/executors/utils/convert-nx-executor.js +1 -1
  152. package/dist/src/hasher/hash-plan-inspector.d.ts +1 -1
  153. package/dist/src/hasher/task-hasher.js +6 -4
  154. package/dist/src/index.d.ts +1 -1
  155. package/dist/src/index.js +0 -3
  156. package/dist/src/migrations/update-16-2-0/remove-run-commands-output-path.js +6 -2
  157. package/dist/src/migrations/update-17-0-0/move-cache-directory.md +31 -0
  158. package/dist/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +20 -4
  159. package/dist/src/migrations/update-20-0-0/move-use-daemon-process.md +27 -0
  160. package/dist/src/migrations/update-20-0-1/use-legacy-cache.md +24 -0
  161. package/dist/src/migrations/update-21-0-0/release-changelog-config-changes.md +49 -0
  162. package/dist/src/migrations/update-21-0-0/release-version-config-changes.md +54 -0
  163. package/dist/src/migrations/update-21-0-0/remove-custom-tasks-runner.md +28 -0
  164. package/dist/src/migrations/update-21-0-0/remove-legacy-cache.md +22 -0
  165. package/dist/src/migrations/update-22-2-0/add-self-healing-to-gitignore.md +11 -0
  166. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.d.ts +2 -0
  167. package/dist/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.js +16 -0
  168. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +9 -0
  169. package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +18 -0
  170. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.d.ts +35 -0
  171. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.js +139 -0
  172. package/dist/src/migrations/update-23-0-0/convert-target-defaults-to-array.md +66 -0
  173. package/dist/src/native/index.d.ts +79 -2
  174. package/dist/src/native/native-bindings.js +3 -0
  175. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  176. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  177. package/dist/src/plugins/js/lock-file/npm-parser.js +37 -19
  178. package/dist/src/plugins/js/lock-file/pnpm-parser.js +51 -4
  179. package/dist/src/plugins/js/lock-file/project-graph-pruning.js +12 -4
  180. package/dist/src/plugins/js/utils/packages.js +1 -1
  181. package/dist/src/plugins/js/utils/register.d.ts +103 -14
  182. package/dist/src/plugins/js/utils/register.js +434 -39
  183. package/dist/src/plugins/js/utils/typescript.d.ts +7 -0
  184. package/dist/src/plugins/js/utils/typescript.js +39 -0
  185. package/dist/src/plugins/package-json/create-nodes.d.ts +3 -2
  186. package/dist/src/plugins/package-json/create-nodes.js +7 -5
  187. package/dist/src/project-graph/affected/locators/project-glob-changes.js +2 -1
  188. package/dist/src/project-graph/build-project-graph.d.ts +5 -0
  189. package/dist/src/project-graph/build-project-graph.js +6 -2
  190. package/dist/src/project-graph/file-map-utils.d.ts +5 -0
  191. package/dist/src/project-graph/file-map-utils.js +10 -1
  192. package/dist/src/project-graph/plugins/get-plugins.d.ts +7 -2
  193. package/dist/src/project-graph/plugins/get-plugins.js +8 -5
  194. package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
  195. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -0
  196. package/dist/src/project-graph/plugins/resolve-plugin.d.ts +7 -4
  197. package/dist/src/project-graph/plugins/resolve-plugin.js +152 -33
  198. package/dist/src/project-graph/plugins/tasks-execution-hooks.js +4 -2
  199. package/dist/src/project-graph/plugins/transpiler.d.ts +12 -0
  200. package/dist/src/project-graph/plugins/transpiler.js +37 -0
  201. package/dist/src/project-graph/plugins/utils.js +13 -7
  202. package/dist/src/project-graph/project-graph.js +1 -1
  203. package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +95 -4
  204. package/dist/src/project-graph/utils/project-configuration/target-defaults.js +515 -68
  205. package/dist/src/project-graph/utils/project-configuration-utils.d.ts +13 -5
  206. package/dist/src/project-graph/utils/project-configuration-utils.js +14 -6
  207. package/dist/src/project-graph/utils/retrieve-workspace-files.js +1 -1
  208. package/dist/src/tasks-runner/create-task-graph.d.ts +4 -4
  209. package/dist/src/tasks-runner/create-task-graph.js +1 -1
  210. package/dist/src/tasks-runner/default-tasks-runner.d.ts +0 -2
  211. package/dist/src/tasks-runner/forked-process-task-runner.d.ts +1 -1
  212. package/dist/src/tasks-runner/forked-process-task-runner.js +11 -6
  213. package/dist/src/tasks-runner/init-tasks-runner.d.ts +0 -15
  214. package/dist/src/tasks-runner/init-tasks-runner.js +0 -63
  215. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +18 -0
  216. package/dist/src/tasks-runner/legacy-depends-on-warning.js +109 -0
  217. package/dist/src/tasks-runner/life-cycle.d.ts +7 -8
  218. package/dist/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +6 -6
  219. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -2
  220. package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -5
  221. package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +11 -2
  222. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  223. package/dist/src/tasks-runner/pseudo-terminal.js +22 -10
  224. package/dist/src/tasks-runner/run-command.js +8 -11
  225. package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +1 -1
  226. package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -5
  227. package/dist/src/tasks-runner/running-tasks/node-child-process.d.ts +2 -2
  228. package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -7
  229. package/dist/src/tasks-runner/task-env.d.ts +1 -1
  230. package/dist/src/tasks-runner/task-env.js +6 -1
  231. package/dist/src/tasks-runner/task-orchestrator.d.ts +11 -1
  232. package/dist/src/tasks-runner/task-orchestrator.js +112 -38
  233. package/dist/src/tasks-runner/tasks-schedule.js +3 -3
  234. package/dist/src/tasks-runner/utils.d.ts +7 -8
  235. package/dist/src/tasks-runner/utils.js +23 -27
  236. package/dist/src/utils/child-process.js +2 -2
  237. package/dist/src/utils/compile-cache.d.ts +24 -0
  238. package/dist/src/utils/compile-cache.js +49 -0
  239. package/dist/src/utils/enable-compile-cache.d.ts +1 -0
  240. package/dist/src/utils/enable-compile-cache.js +7 -0
  241. package/dist/src/utils/fileutils.d.ts +0 -8
  242. package/dist/src/utils/fileutils.js +0 -40
  243. package/dist/src/utils/git-utils.d.ts +15 -0
  244. package/dist/src/utils/git-utils.js +138 -0
  245. package/dist/src/utils/handle-import.d.ts +4 -1
  246. package/dist/src/utils/handle-import.js +56 -2
  247. package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
  248. package/dist/src/utils/has-nx-js-plugin.js +24 -0
  249. package/dist/src/utils/installed-nx-version.d.ts +14 -4
  250. package/dist/src/utils/installed-nx-version.js +54 -7
  251. package/dist/src/utils/logger.d.ts +12 -1
  252. package/dist/src/utils/logger.js +57 -36
  253. package/dist/src/utils/nx-key.d.ts +0 -1
  254. package/dist/src/utils/nx-key.js +20 -23
  255. package/dist/src/utils/nx-package-group.d.ts +8 -0
  256. package/dist/src/utils/nx-package-group.js +15 -0
  257. package/dist/src/utils/output.d.ts +3 -2
  258. package/dist/src/utils/output.js +29 -28
  259. package/dist/src/utils/package-json.d.ts +14 -1
  260. package/dist/src/utils/package-json.js +20 -21
  261. package/dist/src/utils/perf-logging.js +3 -1
  262. package/dist/src/utils/plugin-cache-utils.d.ts +13 -4
  263. package/dist/src/utils/plugin-cache-utils.js +23 -13
  264. package/dist/src/utils/plugins/local-plugins.d.ts +18 -0
  265. package/dist/src/utils/plugins/local-plugins.js +30 -0
  266. package/dist/src/utils/tar.d.ts +8 -0
  267. package/dist/src/utils/tar.js +44 -0
  268. package/migrations.json +16 -0
  269. package/package.json +28 -28
  270. package/schemas/nx-schema.json +114 -80
  271. package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +0 -7
  272. package/dist/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +0 -155
  273. package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +0 -16
  274. package/dist/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +0 -121
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.showTargetInfoHandler = showTargetInfoHandler;
4
4
  const task_hasher_1 = require("../../../hasher/task-hasher");
5
+ const create_task_graph_1 = require("../../../tasks-runner/create-task-graph");
5
6
  const utils_1 = require("../../../tasks-runner/utils");
6
7
  const utils_2 = require("./utils");
7
8
  // ── Handler ─────────────────────────────────────────────────────────
@@ -19,10 +20,9 @@ function resolveTargetInfoData(t) {
19
20
  allTargetNames.add(name);
20
21
  }
21
22
  }
22
- const extraTargetDeps = Object.fromEntries(Object.entries(nxJson.targetDefaults ?? {})
23
- .filter(([, config]) => config.dependsOn)
24
- .map(([name, config]) => [name, config.dependsOn]));
25
- const depConfigs = (0, utils_1.getDependencyConfigs)({ project: projectName, target: targetName }, extraTargetDeps, graph, [...allTargetNames]);
23
+ const depConfigs = (0, utils_1.getDependencyConfigs)({ project: projectName, target: targetName },
24
+ // no programmatic extras — `dependsOn` is already merged into the graph node
25
+ {}, graph, [...allTargetNames]) ?? [];
26
26
  // Determine the hoisted command value and which option key it came from
27
27
  let command;
28
28
  let commandSourceKey;
@@ -43,18 +43,7 @@ function resolveTargetInfoData(t) {
43
43
  command = targetConfig.options.script;
44
44
  commandSourceKey = 'options.script';
45
45
  }
46
- const dependsOn = [];
47
- const depSourceIndices = [];
48
- if (depConfigs && depConfigs.length > 0) {
49
- for (let i = 0; i < depConfigs.length; i++) {
50
- const dep = depConfigs[i];
51
- const projects = resolveDependencyProjects(dep, projectName, graph);
52
- for (const p of projects) {
53
- dependsOn.push(`${p}:${dep.target}`);
54
- depSourceIndices.push(i);
55
- }
56
- }
57
- }
46
+ const { dependsOn, depSourceIndices, transitiveTasks } = resolveTaskGraphDependencies(graph, {}, projectName, targetName, configuration, depConfigs);
58
47
  const configurations = Object.keys(targetConfig.configurations ?? {});
59
48
  const targetSourceMap = extractTargetSourceMap(node.data.root, targetName, sourceMaps);
60
49
  const usesCustomHasher = (0, utils_2.hasCustomHasher)(projectName, targetName, graph);
@@ -68,6 +57,7 @@ function resolveTargetInfoData(t) {
68
57
  ...(dependsOn.length > 0
69
58
  ? { dependsOn, _depSources: depSourceIndices }
70
59
  : {}),
60
+ ...(transitiveTasks.length > 0 ? { transitiveTasks } : {}),
71
61
  parallelism: targetConfig.parallelism ?? true,
72
62
  continuous: targetConfig.continuous ?? false,
73
63
  cache: targetConfig.cache ?? false,
@@ -110,6 +100,93 @@ function resolveDependencyProjects(dep, projectName, graph) {
110
100
  }
111
101
  return [projectName];
112
102
  }
103
+ /**
104
+ * Builds a task graph rooted at the requested target and returns:
105
+ * - `dependsOn`: direct task dependencies of the root, with real
106
+ * project/target resolution applied.
107
+ * - `depSourceIndices`: for each direct dep, the index of the original
108
+ * depConfig it corresponds to (for source-map hints), or -1 if unknown.
109
+ * - `transitiveTasks`: task IDs reachable through the direct deps (not
110
+ * the root, not direct deps).
111
+ *
112
+ * If `createTaskGraph` throws (e.g. circular dependencies), falls back to
113
+ * the `depConfig`-based resolution so the output still shows the configured
114
+ * list rather than silently collapsing to empty.
115
+ */
116
+ function resolveTaskGraphDependencies(graph, extraTargetDeps, projectName, targetName, configuration, depConfigs) {
117
+ try {
118
+ const taskGraph = (0, create_task_graph_1.createTaskGraph)(graph, extraTargetDeps, [projectName], [targetName], configuration, {});
119
+ const rootId = (0, utils_1.createTaskId)(projectName, targetName, configuration);
120
+ const directDeps = taskGraph.dependencies[rootId] ?? [];
121
+ const directDepSet = new Set(directDeps);
122
+ const depSourceIndices = directDeps.map((depTaskId) => {
123
+ const task = taskGraph.tasks[depTaskId];
124
+ if (!task)
125
+ return -1;
126
+ return findDepConfigIndex(task.target, depConfigs, projectName, graph);
127
+ });
128
+ // `Object.keys(dependencies)` gives the set of real (non-dummy) tasks
129
+ // in the graph — `filterDummyTasks` (called inside `createTaskGraph`)
130
+ // removes dummy entries from `dependencies` but leaves them in `tasks`.
131
+ const transitiveTasks = Object.keys(taskGraph.dependencies).filter((id) => id !== rootId && !directDepSet.has(id));
132
+ return { dependsOn: directDeps, depSourceIndices, transitiveTasks };
133
+ }
134
+ catch {
135
+ return {
136
+ ...resolveDependsOnFromConfigs(depConfigs, projectName, graph),
137
+ transitiveTasks: [],
138
+ };
139
+ }
140
+ }
141
+ function resolveDependsOnFromConfigs(depConfigs, projectName, graph) {
142
+ const dependsOn = [];
143
+ const depSourceIndices = [];
144
+ for (let i = 0; i < depConfigs.length; i++) {
145
+ const dep = depConfigs[i];
146
+ const projects = resolveDependencyProjects(dep, projectName, graph);
147
+ for (const p of projects) {
148
+ dependsOn.push(`${p}:${dep.target}`);
149
+ depSourceIndices.push(i);
150
+ }
151
+ }
152
+ return { dependsOn, depSourceIndices };
153
+ }
154
+ /**
155
+ * Builds the summary line shown beneath the direct `Depends On` list.
156
+ *
157
+ * Up to 3 unique target names: list them (`and 5 build, compile transitive tasks`).
158
+ * Beyond that: collapse to the count alone (`and 12 transitive tasks`).
159
+ */
160
+ function formatTransitiveSummary(taskIds) {
161
+ const count = taskIds.length;
162
+ const plural = count === 1 ? 'task' : 'tasks';
163
+ const targetNames = uniqueTargetNames(taskIds);
164
+ if (targetNames.length === 0 || targetNames.length > 3) {
165
+ return `and ${count} transitive ${plural}`;
166
+ }
167
+ return `and ${count} ${targetNames.join(', ')} transitive ${plural}`;
168
+ }
169
+ function uniqueTargetNames(taskIds) {
170
+ const set = new Set();
171
+ for (const id of taskIds) {
172
+ // task ids are `project:target` or `project:target:config`
173
+ const parts = id.split(':');
174
+ if (parts.length >= 2)
175
+ set.add(parts[1]);
176
+ }
177
+ return [...set].sort();
178
+ }
179
+ function findDepConfigIndex(taskTarget, depConfigs, rootProject, graph) {
180
+ for (let i = 0; i < depConfigs.length; i++) {
181
+ const dep = depConfigs[i];
182
+ if (dep.target !== taskTarget.target)
183
+ continue;
184
+ const resolved = resolveDependencyProjects(dep, rootProject, graph);
185
+ if (resolved.includes(taskTarget.project))
186
+ return i;
187
+ }
188
+ return -1;
189
+ }
113
190
  /**
114
191
  * Expands named inputs (e.g. "production") to their definitions while
115
192
  * tracking which original input index each expanded item came from.
@@ -216,11 +293,15 @@ function renderTargetInfo(data, args) {
216
293
  if (data.dependsOn && data.dependsOn.length > 0) {
217
294
  console.log(`${c.bold('Depends On')}:`);
218
295
  for (let i = 0; i < data.dependsOn.length; i++) {
219
- const hint = data._depSources?.[i] !== undefined
220
- ? sourceHint(`dependsOn.${data._depSources[i]}`, 'dependsOn')
221
- : '';
296
+ const srcIdx = data._depSources?.[i];
297
+ const hint = srcIdx !== undefined && srcIdx >= 0
298
+ ? sourceHint(`dependsOn.${srcIdx}`, 'dependsOn')
299
+ : sourceHint('dependsOn');
222
300
  console.log(` ${data.dependsOn[i]}${hint}`);
223
301
  }
302
+ if (data.transitiveTasks && data.transitiveTasks.length > 0) {
303
+ console.log(` ${c.dim(formatTransitiveSummary(data.transitiveTasks))}`);
304
+ }
224
305
  }
225
306
  console.log(`${c.bold('Parallelism')}: ${data.parallelism}${sourceHint('parallelism')}`);
226
307
  console.log(`${c.bold('Continuous')}: ${data.continuous}${sourceHint('continuous')}`);
@@ -13,7 +13,7 @@ exports.yargsWatchCommand = {
13
13
  },
14
14
  };
15
15
  function withWatchOptions(yargs) {
16
- return (0, shared_options_1.withVerbose)(yargs)
16
+ return ((0, shared_options_1.withVerbose)(yargs)
17
17
  .parserConfiguration({
18
18
  'strip-dashed': true,
19
19
  'populate--': true,
@@ -28,10 +28,16 @@ function withWatchOptions(yargs) {
28
28
  type: 'boolean',
29
29
  description: 'Watch all projects.',
30
30
  })
31
- .option('includeDependentProjects', {
31
+ .option('includeDependencies', {
32
32
  type: 'boolean',
33
- description: 'When watching selected projects, include dependent projects as well.',
33
+ description: 'When watching selected projects, also include the projects they depend on.',
34
34
  alias: 'd',
35
+ })
36
+ // TODO(v24): remove the deprecated --includeDependentProjects alias
37
+ .option('includeDependentProjects', {
38
+ type: 'boolean',
39
+ hidden: true,
40
+ describe: "Deprecated in favor of --includeDependencies; will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.",
35
41
  })
36
42
  .option('includeGlobalWorkspaceFiles', {
37
43
  type: 'boolean',
@@ -67,5 +73,19 @@ function withWatchOptions(yargs) {
67
73
  else {
68
74
  throw Error('No command specified for watch mode.');
69
75
  }
70
- }, true);
76
+ // --includeDependentProjects was renamed to --includeDependencies in
77
+ // Nx 23 because the original name was misleading: it includes the
78
+ // watched project's *dependencies*, not its dependents. The new flag
79
+ // is functionally identical — only the name changed. Map the legacy
80
+ // name through so existing scripts keep working during the
81
+ // deprecation window.
82
+ // TODO(v24): remove the legacy includeDependentProjects pass-through
83
+ const a = args;
84
+ if (a.includeDependentProjects !== undefined &&
85
+ a.includeDependencies === undefined) {
86
+ a.includeDependencies = a.includeDependentProjects;
87
+ // eslint-disable-next-line no-console
88
+ console.warn("--includeDependentProjects is deprecated in favor of --includeDependencies and will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.");
89
+ }
90
+ }, true));
71
91
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const metadata_1 = require("../completion/metadata");
4
+ const completion_providers_1 = require("../completion/completion-providers");
5
+ (0, metadata_1.registerCompletion)('watch', {
6
+ flags: {
7
+ projects: completion_providers_1.getProjectNameCompletions,
8
+ p: completion_providers_1.getProjectNameCompletions,
9
+ },
10
+ });
@@ -2,6 +2,13 @@ import { ChangedFile } from '../../daemon/client/client';
2
2
  export interface WatchArguments {
3
3
  projects?: string[];
4
4
  all?: boolean;
5
+ includeDependencies?: boolean;
6
+ /**
7
+ * @deprecated Renamed to {@link WatchArguments.includeDependencies}; will be
8
+ * removed in Nx 24. The original name was misleading: this flag includes
9
+ * the watched project's dependencies, not its dependents. The new property
10
+ * is functionally identical — only the name changed.
11
+ */
5
12
  includeDependentProjects?: boolean;
6
13
  includeGlobalWorkspaceFiles?: boolean;
7
14
  verbose?: boolean;
@@ -149,7 +149,7 @@ async function watch(args) {
149
149
  }
150
150
  await client_1.daemonClient.registerFileWatcher({
151
151
  watchProjects: whatToWatch,
152
- includeDependentProjects: args.includeDependentProjects,
152
+ includeDependencies: args.includeDependencies ?? args.includeDependentProjects,
153
153
  includeGlobalWorkspaceFiles: args.includeGlobalWorkspaceFiles,
154
154
  }, async (err, data) => {
155
155
  if (err === 'reconnecting') {
@@ -61,12 +61,28 @@ export type PackageJsonUpdates = {
61
61
  * Returning a string[] from the migration function will be interpreted as
62
62
  * a list of next steps to be displayed to the user.
63
63
  */
64
- export type Migration = (tree: Tree) => void | Promise<void> | string[] | Promise<string[]>;
64
+ /**
65
+ * Structured return value for a migration function.
66
+ *
67
+ * - `nextSteps`: workspace-wide notes surfaced to the human in the `nx migrate`
68
+ * post-run summary. Same audience as the legacy `string[]` return.
69
+ * - `agentContext`: for hybrid migrations (`implementation` + `prompt`). When the
70
+ * paired prompt runs under `--agentic`, these strings are delivered to the
71
+ * agent as part of its outer prompt. When no agent runs, this bucket is
72
+ * silently dropped — it is agent-only by contract. Content meant for the
73
+ * human in any scenario belongs in `nextSteps`.
74
+ */
75
+ export interface MigrationReturnObject {
76
+ nextSteps?: string[];
77
+ agentContext?: string[];
78
+ }
79
+ export type Migration = (tree: Tree) => void | string[] | MigrationReturnObject | Promise<void | string[] | MigrationReturnObject>;
65
80
  export interface MigrationsJsonEntry {
66
81
  version: string;
67
82
  description?: string;
68
83
  implementation?: string;
69
84
  factory?: string;
85
+ prompt?: string;
70
86
  requires?: Record<string, string>;
71
87
  }
72
88
  export type MigrationDetailsWithId = GeneratedMigrationDetails & {
@@ -77,7 +93,8 @@ export interface GeneratedMigrationDetails {
77
93
  version: string;
78
94
  package: string;
79
95
  description: string;
80
- implementation: string;
96
+ implementation?: string;
97
+ prompt?: string;
81
98
  }
82
99
  export interface MigrationsJson {
83
100
  name?: string;
@@ -148,6 +165,12 @@ export type TaskResult = {
148
165
  terminalOutput: string;
149
166
  startTime?: number;
150
167
  endTime?: number;
168
+ /**
169
+ * Explicit status. When set, takes precedence over `success`. Required for
170
+ * batch executors that need to distinguish `'skipped'` peers (tasks that
171
+ * never ran because a sibling failed) from real failures.
172
+ */
173
+ status?: 'success' | 'failure' | 'skipped';
151
174
  };
152
175
  export type BatchExecutorResult = Record<string, TaskResult>;
153
176
  export type BatchExecutorTaskResult = {
@@ -18,7 +18,43 @@ export interface NxAffectedConfig {
18
18
  */
19
19
  defaultBase?: string;
20
20
  }
21
- export type TargetDefaults = Record<string, Partial<TargetConfiguration>>;
21
+ /**
22
+ * A single entry in the array-shaped `targetDefaults` configuration.
23
+ * Supports filtering the default's applicability by project set and/or the
24
+ * plugin that originated the target.
25
+ *
26
+ * Either `target` or `executor` must be set. An entry with both narrows
27
+ * the match further (target name AND executor must agree).
28
+ */
29
+ export type TargetDefaultEntry = {
30
+ /**
31
+ * Target name or glob pattern (e.g. `build`, `e2e-ci--*`). When omitted,
32
+ * the entry matches by `executor` alone.
33
+ */
34
+ target?: string;
35
+ /**
36
+ * Restrict the default to a subset of projects. Accepts any pattern
37
+ * supported by `findMatchingProjects` (project names, globs, `tag:foo`,
38
+ * directory globs, negation with `!`).
39
+ */
40
+ projects?: string | string[];
41
+ /**
42
+ * Restrict the default to targets originated by a specific plugin
43
+ * (e.g. `@nx/vite`). Matches against the plugin that wrote the target's
44
+ * `executor` or `command`.
45
+ */
46
+ plugin?: string;
47
+ } & Partial<TargetConfiguration>;
48
+ /**
49
+ * @deprecated Use the array-shaped {@link TargetDefaultEntry}[] form instead.
50
+ * Retained so devkit helpers can still read nx.json files that predate the
51
+ * migration.
52
+ * @todo(v24) Remove this type and all branches that read it.
53
+ */
54
+ export type TargetDefaultsRecord = Record<string, Partial<TargetConfiguration>>;
55
+ export type TargetDefaults = TargetDefaultEntry[] | TargetDefaultsRecord;
56
+ /** Internal-only: the post-normalization shape consumed by the nx core matcher. */
57
+ export type NormalizedTargetDefaults = TargetDefaultEntry[];
22
58
  export type TargetDependencies = Record<string, (TargetDependencyConfig | string)[]>;
23
59
  export interface NrwlJsPluginConfig {
24
60
  analyzeSourceFiles?: boolean;
@@ -179,7 +215,7 @@ export interface NxReleaseVersionConfiguration {
179
215
  * The new version will be "1.2.0" and the current version range in dependents is already "^1.0.0"
180
216
  * Therefore, the manifest file is not updated.
181
217
  *
182
- * This is false by default.
218
+ * This is true by default. Set to false to always rewrite dependent manifests with the new version.
183
219
  */
184
220
  preserveMatchingDependencyRanges?: boolean | Array<'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies'>;
185
221
  /**
@@ -195,7 +231,7 @@ export interface NxReleaseVersionConfiguration {
195
231
  *
196
232
  * Versions 1.0.0 and above are unaffected.
197
233
  *
198
- * This is false by default for backward compatibility.
234
+ * This is true by default. Set to false to opt out and treat all bumps the same regardless of major version.
199
235
  */
200
236
  adjustSemverBumpsForZeroMajorVersion?: boolean;
201
237
  /**
@@ -215,7 +251,7 @@ export interface NxReleaseChangelogConfiguration {
215
251
  * Optionally create a release containing all relevant changes on a supported version control system, it
216
252
  * is false by default.
217
253
  *
218
- * NOTE: if createRelease is set on a group of projects, it will cause the default releaseTagPattern of
254
+ * NOTE: if createRelease is set on a group of projects, it will cause the default releaseTag.pattern of
219
255
  * "{projectName}@{version}" to be used for those projects, even when versioning everything together.
220
256
  */
221
257
  createRelease?: false | 'github' | 'gitlab' | {
@@ -426,7 +462,7 @@ export interface NxReleaseConfiguration {
426
462
  */
427
463
  pattern?: string;
428
464
  /**
429
- * By default, we will try and resolve the latest match for the releaseTagPattern from the current branch,
465
+ * By default, we will try and resolve the latest match for the releaseTag.pattern from the current branch,
430
466
  * falling back to all branches if no match is found on the current branch.
431
467
  *
432
468
  * - Setting this to true will cause us to ALWAYS check all branches for the latest match.
@@ -468,31 +504,10 @@ export interface NxReleaseConfiguration {
468
504
  * If "strictPreid" is set to false, the git tag "my-lib@1.2.4-beta.1" will always be resolved as the latest tag that matches the pattern,
469
505
  * regardless of any preid which gets passed to nx release.
470
506
  *
471
- * NOTE: This feature was added in a minor version and is therefore set to false by default, but this may change in a future major version.
507
+ * This is true by default. Set to false to always resolve the latest matching tag regardless of preid.
472
508
  */
473
509
  strictPreid?: boolean;
474
510
  };
475
- /**
476
- * @deprecated Use `releaseTag.pattern` instead. Will be removed in Nx 23.
477
- * Optionally override the git/release tag pattern to use for this group.
478
- */
479
- releaseTagPattern?: string;
480
- /**
481
- * @deprecated Use `releaseTag.checkAllBranchesWhen` instead. Will be removed in Nx 23.
482
- */
483
- releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
484
- /**
485
- * @deprecated Use `releaseTag.requireSemver` instead. Will be removed in Nx 23.
486
- */
487
- releaseTagPatternRequireSemver?: boolean;
488
- /**
489
- * @deprecated Use `releaseTag.preferDockerVersion` instead. Will be removed in Nx 23.
490
- */
491
- releaseTagPatternPreferDockerVersion?: boolean | 'both';
492
- /**
493
- * @deprecated Use `releaseTag.strictPreid` instead. Will be removed in Nx 23.
494
- */
495
- releaseTagPatternStrictPreid?: boolean;
496
511
  /**
497
512
  * Enables using version plans as a specifier source for versioning and
498
513
  * to determine changes for changelog generation.
@@ -598,38 +613,10 @@ export interface NxReleaseConfiguration {
598
613
  * If "strictPreid" is set to false, the git tag "my-lib@1.2.4-beta.1" will always be resolved as the latest tag that matches the pattern,
599
614
  * regardless of any preid which gets passed to nx release.
600
615
  *
601
- * NOTE: This feature was added in a minor version and is therefore set to false by default, but this may change in a future major version.
616
+ * This is true by default. Set to false to always resolve the latest matching tag regardless of preid.
602
617
  */
603
618
  strictPreid?: boolean;
604
619
  };
605
- /**
606
- * @deprecated Use `releaseTag.pattern` instead. Will be removed in Nx 23.
607
- * Optionally override the git/release tag pattern to use. This field is the source of truth
608
- * for changelog generation and release tagging, as well as for conventional commits parsing.
609
- *
610
- * It supports interpolating the version as {version} and (if releasing independently or forcing
611
- * project level version control system releases) the project name as {projectName} within the string.
612
- *
613
- * The default releaseTagPattern for fixed/unified releases is: "v{version}"
614
- * The default releaseTagPattern for independent releases at the project level is: "{projectName}@{version}"
615
- */
616
- releaseTagPattern?: string;
617
- /**
618
- * @deprecated Use `releaseTag.checkAllBranchesWhen` instead. Will be removed in Nx 23.
619
- */
620
- releaseTagPatternCheckAllBranchesWhen?: boolean | string[];
621
- /**
622
- * @deprecated Use `releaseTag.requireSemver` instead. Will be removed in Nx 23.
623
- */
624
- releaseTagPatternRequireSemver?: boolean;
625
- /**
626
- * @deprecated Use `releaseTag.preferDockerVersion` instead. Will be removed in Nx 23.
627
- */
628
- releaseTagPatternPreferDockerVersion?: boolean | 'both';
629
- /**
630
- * @deprecated Use `releaseTag.strictPreid` instead. Will be removed in Nx 23.
631
- */
632
- releaseTagPatternStrictPreid?: boolean;
633
620
  /**
634
621
  * Enable and configure automatic git operations as part of the release
635
622
  */
@@ -1,4 +1,25 @@
1
1
  import type { ProjectConfiguration } from './workspace-json-project-json';
2
+ /**
3
+ * Thrown when the schema file of an executor or generator cannot be resolved.
4
+ */
5
+ export declare class SchemaResolutionError extends Error {
6
+ readonly schemaPath: string;
7
+ readonly directory: string;
8
+ constructor(schemaPath: string, directory: string, options?: {
9
+ cause?: unknown;
10
+ });
11
+ }
12
+ /**
13
+ * Thrown when the implementation module of an executor or generator cannot be
14
+ * resolved.
15
+ */
16
+ export declare class ImplementationResolutionError extends Error {
17
+ readonly implementationModulePath: string;
18
+ readonly directory: string;
19
+ constructor(implementationModulePath: string, directory: string, options?: {
20
+ cause?: unknown;
21
+ });
22
+ }
2
23
  /**
3
24
  * This function is used to get the implementation factory of an executor or generator.
4
25
  * @param implementation path to the implementation
@@ -1,14 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImplementationResolutionError = exports.SchemaResolutionError = void 0;
3
4
  exports.getImplementationFactory = getImplementationFactory;
4
5
  exports.resolveImplementation = resolveImplementation;
5
6
  exports.resolveSchema = resolveSchema;
6
7
  const fs_1 = require("fs");
7
8
  const path_1 = require("path");
8
9
  const resolve_exports_1 = require("resolve.exports");
10
+ const register_1 = require("../plugins/js/utils/register");
9
11
  const packages_1 = require("../plugins/js/utils/packages");
10
- const plugins_1 = require("../project-graph/plugins");
12
+ const typescript_1 = require("../plugins/js/utils/typescript");
13
+ const find_project_for_path_1 = require("../project-graph/utils/find-project-for-path");
14
+ const fileutils_1 = require("../utils/fileutils");
15
+ const package_json_1 = require("../utils/package-json");
11
16
  const path_2 = require("../utils/path");
17
+ const workspace_root_1 = require("../utils/workspace-root");
18
+ /**
19
+ * Thrown when the schema file of an executor or generator cannot be resolved.
20
+ */
21
+ class SchemaResolutionError extends Error {
22
+ constructor(schemaPath, directory, options) {
23
+ super(`Could not resolve schema "${schemaPath}" from "${directory}".`, options);
24
+ this.schemaPath = schemaPath;
25
+ this.directory = directory;
26
+ this.name = 'SchemaResolutionError';
27
+ }
28
+ }
29
+ exports.SchemaResolutionError = SchemaResolutionError;
30
+ /**
31
+ * Thrown when the implementation module of an executor or generator cannot be
32
+ * resolved.
33
+ */
34
+ class ImplementationResolutionError extends Error {
35
+ constructor(implementationModulePath, directory, options) {
36
+ super(`Could not resolve "${implementationModulePath}" from "${directory}".`, options);
37
+ this.implementationModulePath = implementationModulePath;
38
+ this.directory = directory;
39
+ this.name = 'ImplementationResolutionError';
40
+ }
41
+ }
42
+ exports.ImplementationResolutionError = ImplementationResolutionError;
12
43
  /**
13
44
  * This function is used to get the implementation factory of an executor or generator.
14
45
  * @param implementation path to the implementation
@@ -19,10 +50,14 @@ function getImplementationFactory(implementation, directory, packageName, projec
19
50
  const [implementationModulePath, implementationExportName] = implementation.split('#');
20
51
  return () => {
21
52
  const modulePath = resolveImplementation(implementationModulePath, directory, packageName, projects);
22
- if ((0, path_1.extname)(modulePath) === '.ts') {
23
- (0, plugins_1.registerPluginTSTranspiler)();
24
- }
25
- const module = require(modulePath);
53
+ // Route .ts entrypoints through loadTsFile so the native-strip ->
54
+ // swc/ts-node fallback chain runs. Plain require() bypasses the matcher
55
+ // set and bubbles errors like extensionless `./schema` imports (strict
56
+ // ESM resolution failures) straight to the CLI. JS entrypoints use
57
+ // requireWithTsconfigFallback so workspace-alias imports still resolve.
58
+ const module = /\.[cm]?ts$/.test(modulePath)
59
+ ? (0, register_1.loadTsFile)(modulePath)
60
+ : (0, register_1.requireWithTsconfigFallback)(modulePath);
26
61
  return implementationExportName
27
62
  ? module[implementationExportName]
28
63
  : (module.default ?? module);
@@ -59,7 +94,7 @@ function resolveImplementation(implementationModulePath, directory, packageName,
59
94
  }
60
95
  catch { }
61
96
  }
62
- throw new Error(`Could not resolve "${implementationModulePath}" from "${directory}".`);
97
+ throw new ImplementationResolutionError(implementationModulePath, directory);
63
98
  }
64
99
  function resolveSchema(schemaPath, directory, packageName, projects) {
65
100
  if (!directory.includes('node_modules')) {
@@ -75,24 +110,63 @@ function resolveSchema(schemaPath, directory, packageName, projects) {
75
110
  if ((0, fs_1.existsSync)(maybeSchemaPath)) {
76
111
  return maybeSchemaPath;
77
112
  }
78
- return require.resolve(schemaPath, {
79
- paths: [directory],
80
- });
113
+ try {
114
+ return require.resolve(schemaPath, {
115
+ paths: [directory],
116
+ });
117
+ }
118
+ catch (e) {
119
+ throw new SchemaResolutionError(schemaPath, directory, { cause: e });
120
+ }
81
121
  }
82
- let packageToProjectMap;
122
+ let projectRootMappings;
123
+ function getProjectForDirectory(directory, projects) {
124
+ projectRootMappings ??=
125
+ (0, find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations)(projects);
126
+ const projectName = (0, find_project_for_path_1.findProjectForPath)((0, path_1.relative)(workspace_root_1.workspaceRoot, directory), projectRootMappings);
127
+ return projectName ? projects[projectName] : null;
128
+ }
129
+ /**
130
+ * Reads the JS package metadata (package name and exports) for a project
131
+ * directly from its `package.json`. Used as a fallback when a project's graph
132
+ * metadata doesn't include the JS metadata.
133
+ */
134
+ function readJsPackageMetadata(project) {
135
+ const packageJsonPath = (0, path_1.join)(workspace_root_1.workspaceRoot, project.root, 'package.json');
136
+ if (!(0, fs_1.existsSync)(packageJsonPath)) {
137
+ return null;
138
+ }
139
+ try {
140
+ const packageJson = (0, fileutils_1.readJsonFile)(packageJsonPath);
141
+ return (0, package_json_1.getMetadataFromPackageJson)(packageJson, false).js;
142
+ }
143
+ catch {
144
+ return null;
145
+ }
146
+ }
147
+ let packageMetadata;
83
148
  function tryResolveFromSource(path, directory, packageName, projects) {
84
- packageToProjectMap ??=
85
- (0, packages_1.getWorkspacePackagesMetadata)(projects).packageToProjectMap;
86
- const localProject = packageToProjectMap[packageName];
149
+ packageMetadata ??= (0, packages_1.getWorkspacePackagesMetadata)(projects);
150
+ let localProject = packageMetadata.packageToProjectMap[packageName];
151
+ // The `packageName` might be a path to the collection rather than an actual
152
+ // package name (e.g. when a generator/executor collection is referenced by
153
+ // path). In that case, `directory` points inside the local project, so we
154
+ // find the project that contains it.
155
+ localProject ??= getProjectForDirectory(directory, projects);
87
156
  if (!localProject) {
88
- // it doesn't match any of the package names from the local projects
89
157
  return null;
90
158
  }
159
+ const js = localProject.metadata?.js ??
160
+ readJsPackageMetadata(localProject);
161
+ if (!js) {
162
+ return null;
163
+ }
164
+ const name = js.packageName;
165
+ const exports = js.packageExports;
91
166
  try {
92
- const fromExports = (0, resolve_exports_1.resolve)({
93
- name: localProject.metadata.js.packageName,
94
- exports: localProject.metadata.js.packageExports,
95
- }, path, { conditions: ['development'] });
167
+ const fromExports = (0, resolve_exports_1.resolve)({ name, exports }, path, {
168
+ conditions: (0, typescript_1.getRootTsConfigResolveExportsConditions)(),
169
+ });
96
170
  if (fromExports && fromExports.length) {
97
171
  for (const exportPath of fromExports) {
98
172
  if ((0, fs_1.existsSync)((0, path_1.join)(directory, exportPath))) {