nx 19.4.3 → 19.5.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. package/bin/init-local.js +2 -3
  2. package/package.json +30 -26
  3. package/src/adapter/angular-json.js +6 -6
  4. package/src/adapter/decorate-cli.js +1 -2
  5. package/src/adapter/ngcli-adapter.js +8 -8
  6. package/src/adapter/rxjs-for-await.js +5 -5
  7. package/src/command-line/add/add.js +2 -2
  8. package/src/command-line/affected/affected.js +2 -3
  9. package/src/command-line/connect/connect-to-nx-cloud.js +5 -6
  10. package/src/command-line/connect/view-logs.js +1 -2
  11. package/src/command-line/daemon/daemon.js +1 -2
  12. package/src/command-line/exec/exec.js +1 -2
  13. package/src/command-line/format/format.js +1 -2
  14. package/src/command-line/generate/generate.js +4 -5
  15. package/src/command-line/generate/generator-utils.js +2 -3
  16. package/src/command-line/graph/command-object.js +2 -2
  17. package/src/command-line/graph/graph.js +9 -5
  18. package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -2
  19. package/src/command-line/init/implementation/add-nx-to-nest.js +1 -2
  20. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -2
  21. package/src/command-line/init/implementation/angular/index.js +1 -2
  22. package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -2
  23. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -2
  24. package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -2
  25. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +1 -1
  26. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +7 -7
  27. package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.js +1 -2
  28. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +1 -2
  29. package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.js +1 -2
  30. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -2
  31. package/src/command-line/init/implementation/react/clean-up-files.js +1 -2
  32. package/src/command-line/init/implementation/react/index.js +1 -2
  33. package/src/command-line/init/implementation/react/read-name-from-package-json.js +1 -2
  34. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +1 -2
  35. package/src/command-line/init/implementation/react/tsconfig-setup.js +1 -2
  36. package/src/command-line/init/implementation/react/write-craco-config.js +1 -2
  37. package/src/command-line/init/implementation/react/write-vite-config.js +1 -2
  38. package/src/command-line/init/implementation/react/write-vite-index-html.js +1 -2
  39. package/src/command-line/init/implementation/utils.js +10 -11
  40. package/src/command-line/init/init-v1.js +1 -2
  41. package/src/command-line/init/init-v2.js +1 -2
  42. package/src/command-line/list/list.js +1 -2
  43. package/src/command-line/migrate/migrate.d.ts +1 -1
  44. package/src/command-line/migrate/migrate.js +5 -5
  45. package/src/command-line/new/new.js +1 -2
  46. package/src/command-line/release/changelog.js +3 -3
  47. package/src/command-line/release/config/config.js +3 -3
  48. package/src/command-line/release/config/filter-release-groups.js +1 -2
  49. package/src/command-line/release/config/version-plans.js +3 -4
  50. package/src/command-line/release/plan.js +2 -2
  51. package/src/command-line/release/publish.js +2 -2
  52. package/src/command-line/release/release.js +2 -2
  53. package/src/command-line/release/utils/batch-projects-by-generator-config.js +1 -2
  54. package/src/command-line/release/utils/exec-command.js +1 -2
  55. package/src/command-line/release/utils/git.js +11 -12
  56. package/src/command-line/release/utils/github.js +5 -6
  57. package/src/command-line/release/utils/launch-editor.js +1 -2
  58. package/src/command-line/release/utils/markdown.js +1 -2
  59. package/src/command-line/release/utils/print-changes.d.ts +0 -1
  60. package/src/command-line/release/utils/print-changes.js +2 -3
  61. package/src/command-line/release/utils/resolve-changelog-renderer.js +1 -2
  62. package/src/command-line/release/utils/resolve-nx-json-error-message.js +1 -2
  63. package/src/command-line/release/utils/resolve-semver-specifier.js +2 -3
  64. package/src/command-line/release/utils/semver.js +4 -5
  65. package/src/command-line/release/utils/shared.js +6 -6
  66. package/src/command-line/release/version.js +2 -2
  67. package/src/command-line/repair/repair.js +1 -2
  68. package/src/command-line/report/report.js +7 -7
  69. package/src/command-line/reset/reset.js +1 -2
  70. package/src/command-line/run/executor-utils.js +2 -3
  71. package/src/command-line/run/run-one.js +1 -2
  72. package/src/command-line/run/run.js +5 -6
  73. package/src/command-line/run-many/run-many.js +2 -3
  74. package/src/command-line/show/project.js +1 -2
  75. package/src/command-line/show/projects.js +1 -2
  76. package/src/command-line/watch/watch.js +8 -2
  77. package/src/command-line/yargs-utils/documentation.js +1 -2
  78. package/src/command-line/yargs-utils/shared-options.js +12 -13
  79. package/src/commands-runner/create-command-graph.js +1 -2
  80. package/src/commands-runner/get-command-projects.js +1 -2
  81. package/src/config/calculate-default-project-name.js +2 -3
  82. package/src/config/configuration.js +2 -2
  83. package/src/config/nx-json.js +2 -3
  84. package/src/config/project-graph.js +3 -3
  85. package/src/config/schema-utils.js +3 -4
  86. package/src/config/to-project-name.js +1 -2
  87. package/src/core/graph/main.js +1 -1
  88. package/src/daemon/cache.js +6 -6
  89. package/src/daemon/client/client.d.ts +1 -2
  90. package/src/daemon/client/client.js +13 -1
  91. package/src/daemon/client/daemon-socket-messenger.d.ts +0 -1
  92. package/src/daemon/client/generate-help-output.js +1 -2
  93. package/src/daemon/is-on-daemon.js +1 -2
  94. package/src/daemon/message-types/get-context-file-data.js +2 -2
  95. package/src/daemon/message-types/get-files-in-directory.js +2 -2
  96. package/src/daemon/message-types/get-nx-workspace-files.js +2 -2
  97. package/src/daemon/message-types/glob.js +2 -2
  98. package/src/daemon/message-types/hash-glob.js +2 -2
  99. package/src/daemon/message-types/task-history.js +3 -3
  100. package/src/daemon/message-types/update-context-files.js +2 -2
  101. package/src/daemon/server/file-watching/changed-projects.js +1 -2
  102. package/src/daemon/server/file-watching/file-watcher-sockets.d.ts +0 -1
  103. package/src/daemon/server/file-watching/file-watcher-sockets.js +4 -4
  104. package/src/daemon/server/handle-context-file-data.js +1 -2
  105. package/src/daemon/server/handle-get-files-in-directory.js +1 -2
  106. package/src/daemon/server/handle-get-task-history.js +1 -2
  107. package/src/daemon/server/handle-glob.js +1 -2
  108. package/src/daemon/server/handle-hash-glob.js +1 -2
  109. package/src/daemon/server/handle-hash-tasks.js +1 -2
  110. package/src/daemon/server/handle-nx-workspace-files.js +1 -2
  111. package/src/daemon/server/handle-outputs-tracking.js +2 -3
  112. package/src/daemon/server/handle-process-in-background.js +1 -2
  113. package/src/daemon/server/handle-request-project-graph.js +1 -2
  114. package/src/daemon/server/handle-request-shutdown.d.ts +0 -1
  115. package/src/daemon/server/handle-request-shutdown.js +1 -2
  116. package/src/daemon/server/handle-write-task-runs-to-history.js +1 -2
  117. package/src/daemon/server/outputs-tracking.js +7 -8
  118. package/src/daemon/server/plugins.js +2 -3
  119. package/src/daemon/server/project-graph-incremental-recomputation.js +3 -3
  120. package/src/daemon/server/server.d.ts +0 -1
  121. package/src/daemon/server/server.js +2 -3
  122. package/src/daemon/server/shutdown-utils.d.ts +0 -1
  123. package/src/daemon/server/shutdown-utils.js +9 -9
  124. package/src/daemon/server/watcher.d.ts +0 -1
  125. package/src/daemon/server/watcher.js +3 -4
  126. package/src/daemon/socket-utils.js +3 -3
  127. package/src/daemon/tmp-dir.js +6 -6
  128. package/src/devkit-exports.d.ts +1 -0
  129. package/src/devkit-exports.js +3 -1
  130. package/src/executors/noop/noop.impl.js +1 -1
  131. package/src/executors/run-commands/run-commands.impl.js +3 -3
  132. package/src/executors/run-script/run-script.impl.js +1 -1
  133. package/src/executors/utils/convert-nx-executor.js +1 -2
  134. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +1 -2
  135. package/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +1 -1
  136. package/src/generators/testing-utils/create-tree-with-empty-workspace.js +2 -3
  137. package/src/generators/testing-utils/create-tree.js +1 -2
  138. package/src/generators/tree.d.ts +0 -2
  139. package/src/generators/tree.js +3 -3
  140. package/src/generators/utils/glob.js +2 -3
  141. package/src/generators/utils/json.js +3 -4
  142. package/src/generators/utils/nx-json.js +2 -3
  143. package/src/generators/utils/project-configuration.js +7 -7
  144. package/src/hasher/create-task-hasher.js +1 -2
  145. package/src/hasher/file-hasher.js +2 -3
  146. package/src/hasher/hash-task.d.ts +0 -1
  147. package/src/hasher/hash-task.js +2 -3
  148. package/src/hasher/native-task-hasher-impl.d.ts +0 -1
  149. package/src/hasher/node-task-hasher-impl.d.ts +0 -1
  150. package/src/hasher/task-hasher.d.ts +0 -1
  151. package/src/hasher/task-hasher.js +10 -10
  152. package/src/migrations/update-15-0-0/migrate-to-inputs.js +1 -1
  153. package/src/migrations/update-15-0-0/prefix-outputs.js +1 -1
  154. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +1 -1
  155. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +1 -1
  156. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +1 -1
  157. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +1 -1
  158. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +1 -1
  159. package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +1 -1
  160. package/src/migrations/update-17-0-0/move-cache-directory.js +1 -1
  161. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +1 -1
  162. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +1 -1
  163. package/src/migrations/update-17-2-0/move-default-base.js +1 -1
  164. package/src/migrations/update-17-3-0/nx-release-path.js +2 -3
  165. package/src/migrations/update-17-3-0/update-nxw.js +1 -1
  166. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +1 -1
  167. package/src/migrations/update-19-2-0/move-workspace-data-directory.js +3 -4
  168. package/src/migrations/update-19-2-4/set-project-name.js +1 -1
  169. package/src/native/assert-supported-platform.js +1 -2
  170. package/src/native/browser.js +1 -0
  171. package/src/native/index.d.ts +178 -138
  172. package/src/native/index.js +16 -0
  173. package/src/native/native-bindings.js +352 -238
  174. package/src/native/native-file-cache-location.js +1 -2
  175. package/src/native/nx.wasi-browser.js +108 -0
  176. package/src/native/nx.wasi.cjs +139 -0
  177. package/src/native/nx.wasm32-wasi.wasm +0 -0
  178. package/src/native/transform-objects.js +1 -2
  179. package/src/native/wasi-worker-browser.mjs +32 -0
  180. package/src/native/wasi-worker.mjs +63 -0
  181. package/src/nx-cloud/debug-logger.js +1 -2
  182. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -2
  183. package/src/nx-cloud/resolution-helpers.js +1 -2
  184. package/src/nx-cloud/update-manager.js +2 -2
  185. package/src/nx-cloud/utilities/axios.js +1 -2
  186. package/src/nx-cloud/utilities/get-cloud-options.js +1 -2
  187. package/src/nx-cloud/utilities/url-shorten.js +8 -9
  188. package/src/plugins/js/hasher/hasher.js +1 -2
  189. package/src/plugins/js/lock-file/lock-file.js +6 -6
  190. package/src/plugins/js/lock-file/npm-parser.js +3 -4
  191. package/src/plugins/js/lock-file/pnpm-parser.js +3 -4
  192. package/src/plugins/js/lock-file/project-graph-pruning.js +1 -2
  193. package/src/plugins/js/lock-file/utils/package-json.js +2 -3
  194. package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +5 -6
  195. package/src/plugins/js/lock-file/yarn-parser.js +3 -4
  196. package/src/plugins/js/package-json/create-package-json.js +2 -3
  197. package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +1 -2
  198. package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +1 -2
  199. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -2
  200. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -2
  201. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -2
  202. package/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +1 -2
  203. package/src/plugins/js/utils/config.js +1 -2
  204. package/src/plugins/js/utils/register.d.ts +1 -0
  205. package/src/plugins/js/utils/register.js +7 -8
  206. package/src/plugins/js/utils/resolve-relative-to-dir.js +1 -2
  207. package/src/plugins/js/utils/typescript.js +5 -6
  208. package/src/plugins/js/versions.d.ts +1 -1
  209. package/src/plugins/js/versions.js +1 -1
  210. package/src/plugins/package-json-workspaces/create-nodes.js +5 -5
  211. package/src/plugins/project-json/build-nodes/project-json.js +3 -3
  212. package/src/project-graph/affected/affected-project-graph.js +1 -2
  213. package/src/project-graph/build-project-graph.js +3 -4
  214. package/src/project-graph/error-types.js +11 -11
  215. package/src/project-graph/file-map-utils.js +4 -5
  216. package/src/project-graph/file-utils.d.ts +1 -1
  217. package/src/project-graph/file-utils.js +7 -7
  218. package/src/project-graph/nx-deps-cache.js +8 -8
  219. package/src/project-graph/operators.js +5 -5
  220. package/src/project-graph/plugins/internal-api.js +4 -5
  221. package/src/project-graph/plugins/isolation/index.js +1 -2
  222. package/src/project-graph/plugins/isolation/messaging.d.ts +0 -2
  223. package/src/project-graph/plugins/isolation/messaging.js +4 -5
  224. package/src/project-graph/plugins/isolation/plugin-pool.js +1 -2
  225. package/src/project-graph/plugins/loader.js +7 -7
  226. package/src/project-graph/plugins/utils.js +4 -5
  227. package/src/project-graph/project-graph-builder.js +2 -2
  228. package/src/project-graph/project-graph.js +7 -8
  229. package/src/project-graph/utils/build-all-workspace-files.js +1 -2
  230. package/src/project-graph/utils/find-project-for-path.js +4 -5
  231. package/src/project-graph/utils/implicit-project-dependencies.js +1 -2
  232. package/src/project-graph/utils/normalize-project-nodes.js +2 -3
  233. package/src/project-graph/utils/project-configuration-utils.d.ts +8 -6
  234. package/src/project-graph/utils/project-configuration-utils.js +118 -54
  235. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -3
  236. package/src/project-graph/utils/retrieve-workspace-files.js +6 -7
  237. package/src/tasks-runner/create-task-graph.js +3 -3
  238. package/src/tasks-runner/forked-process-task-runner.d.ts +0 -1
  239. package/src/tasks-runner/init-tasks-runner.js +1 -2
  240. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +1 -2
  241. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +1 -2
  242. package/src/tasks-runner/life-cycles/formatting-utils.js +2 -3
  243. package/src/tasks-runner/life-cycles/pretty-time.js +1 -2
  244. package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -2
  245. package/src/tasks-runner/pseudo-ipc.d.ts +0 -1
  246. package/src/tasks-runner/pseudo-terminal.d.ts +0 -1
  247. package/src/tasks-runner/pseudo-terminal.js +5 -2
  248. package/src/tasks-runner/run-command.js +4 -5
  249. package/src/tasks-runner/task-env.d.ts +0 -1
  250. package/src/tasks-runner/task-env.js +5 -6
  251. package/src/tasks-runner/task-graph-utils.js +2 -3
  252. package/src/tasks-runner/utils.js +25 -26
  253. package/src/utils/ab-testing.js +2 -2
  254. package/src/utils/all-file-data.js +1 -2
  255. package/src/utils/assert-workspace-validity.js +1 -2
  256. package/src/utils/async-iterator.js +2 -3
  257. package/src/utils/cache-directory.js +2 -2
  258. package/src/utils/child-process.d.ts +0 -1
  259. package/src/utils/child-process.js +3 -3
  260. package/src/utils/chunkify.js +1 -2
  261. package/src/utils/code-frames.js +1 -2
  262. package/src/utils/collapse-expanded-outputs.js +1 -2
  263. package/src/utils/command-line-utils.js +5 -6
  264. package/src/utils/consume-messages-from-socket.js +1 -2
  265. package/src/utils/default-base.js +1 -2
  266. package/src/utils/dotenv.js +1 -2
  267. package/src/utils/exit-codes.d.ts +0 -1
  268. package/src/utils/exit-codes.js +1 -2
  269. package/src/utils/fileutils.d.ts +0 -1
  270. package/src/utils/fileutils.js +9 -10
  271. package/src/utils/find-matching-projects.js +2 -2
  272. package/src/utils/find-workspace-root.js +1 -2
  273. package/src/utils/get-package-name-from-import-path.js +1 -2
  274. package/src/utils/git-utils.js +4 -5
  275. package/src/utils/globs.js +1 -2
  276. package/src/utils/ignore.js +4 -4
  277. package/src/utils/installation-directory.js +2 -3
  278. package/src/utils/is-ci.js +1 -2
  279. package/src/utils/json-diff.js +5 -5
  280. package/src/utils/json.js +3 -3
  281. package/src/utils/logger.js +2 -2
  282. package/src/utils/nx-cloud-utils.js +3 -4
  283. package/src/utils/nx-plugin.deprecated.js +1 -4
  284. package/src/utils/object-sort.js +1 -2
  285. package/src/utils/package-json.js +8 -9
  286. package/src/utils/package-manager.js +13 -14
  287. package/src/utils/params.js +14 -14
  288. package/src/utils/path.js +3 -4
  289. package/src/utils/plugins/community-plugins.js +1 -2
  290. package/src/utils/plugins/core-plugins.js +2 -3
  291. package/src/utils/plugins/installed-plugins.js +3 -4
  292. package/src/utils/plugins/local-plugins.js +2 -3
  293. package/src/utils/plugins/plugin-capabilities.js +2 -3
  294. package/src/utils/plugins/shared.js +1 -2
  295. package/src/utils/print-help.js +1 -2
  296. package/src/utils/project-graph-utils.js +4 -5
  297. package/src/utils/serializable-error.js +1 -2
  298. package/src/utils/serialize-overrides-into-command-line.js +1 -2
  299. package/src/utils/serialize-target.js +1 -2
  300. package/src/utils/split-target.js +2 -3
  301. package/src/utils/strip-indents.js +1 -2
  302. package/src/utils/task-history.js +3 -3
  303. package/src/utils/update-nxw.js +1 -2
  304. package/src/utils/workspace-configuration-check.js +1 -2
  305. package/src/utils/workspace-context.js +10 -11
  306. package/src/utils/workspace-root.js +3 -3
  307. package/src/plugins/target-defaults/symbols.d.ts +0 -17
  308. package/src/plugins/target-defaults/symbols.js +0 -20
  309. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +0 -121
  310. package/src/plugins/target-defaults/target-defaults-plugin.js +0 -176
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  // Lifted in part from https://github.com/nrwl/angular-console
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.hasElements = void 0;
4
+ exports.hasElements = hasElements;
5
5
  function hasElements(obj) {
6
6
  return obj && Object.values(obj).length > 0;
7
7
  }
8
- exports.hasElements = hasElements;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printHelp = void 0;
3
+ exports.printHelp = printHelp;
4
4
  const chalk = require("chalk");
5
5
  const stringWidth = require("string-width");
6
6
  const logger_1 = require("./logger");
@@ -36,7 +36,6 @@ ${generateLinkOutput({
36
36
  })}
37
37
  `);
38
38
  }
39
- exports.printHelp = printHelp;
40
39
  function generateOverviewOutput({ pluginName, name, description, mode, aliases, }) {
41
40
  switch (mode) {
42
41
  case 'generate':
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAllProjectNodeDependencies = exports.getSourceDirOfDependentProjects = exports.projectHasTargetAndConfiguration = exports.projectHasTarget = void 0;
3
+ exports.projectHasTarget = projectHasTarget;
4
+ exports.projectHasTargetAndConfiguration = projectHasTargetAndConfiguration;
5
+ exports.getSourceDirOfDependentProjects = getSourceDirOfDependentProjects;
6
+ exports.findAllProjectNodeDependencies = findAllProjectNodeDependencies;
4
7
  const project_graph_1 = require("../project-graph/project-graph");
5
8
  function projectHasTarget(project, target) {
6
9
  return !!(project.data &&
7
10
  project.data.targets &&
8
11
  project.data.targets[target]);
9
12
  }
10
- exports.projectHasTarget = projectHasTarget;
11
13
  function projectHasTargetAndConfiguration(project, target, configuration) {
12
14
  return (projectHasTarget(project, target) &&
13
15
  project.data.targets[target].configurations &&
14
16
  project.data.targets[target].configurations[configuration]);
15
17
  }
16
- exports.projectHasTargetAndConfiguration = projectHasTargetAndConfiguration;
17
18
  function getSourceDirOfDependentProjects(projectName, projectGraph = (0, project_graph_1.readCachedProjectGraph)()) {
18
19
  if (!projectGraph.nodes[projectName]) {
19
20
  throw new Error(`Couldn't find project "${projectName}" in this Nx workspace`);
@@ -29,7 +30,6 @@ function getSourceDirOfDependentProjects(projectName, projectGraph = (0, project
29
30
  return result;
30
31
  }, [[], []]);
31
32
  }
32
- exports.getSourceDirOfDependentProjects = getSourceDirOfDependentProjects;
33
33
  /**
34
34
  * Find all internal project dependencies.
35
35
  * All the external (npm) dependencies will be filtered out unless includeExternalDependencies is set to true
@@ -43,7 +43,6 @@ function findAllProjectNodeDependencies(parentNodeName, projectGraph = (0, proje
43
43
  collectDependentProjectNodesNames(projectGraph, dependencyNodeNames, parentNodeName, includeExternalDependencies);
44
44
  return Array.from(dependencyNodeNames);
45
45
  }
46
- exports.findAllProjectNodeDependencies = findAllProjectNodeDependencies;
47
46
  // Recursively get all the dependencies of the node
48
47
  function collectDependentProjectNodesNames(nxDeps, dependencyNodeNames, parentNodeName, includeExternalDependencies) {
49
48
  const dependencies = nxDeps.dependencies[parentNodeName];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSerializableError = void 0;
3
+ exports.createSerializableError = createSerializableError;
4
4
  /**
5
5
  * This function transforms an error into an object which can be properly serialized and deserialized to be sent between processes.
6
6
  */
@@ -31,4 +31,3 @@ function createSerializableError(error) {
31
31
  });
32
32
  return res;
33
33
  }
34
- exports.createSerializableError = createSerializableError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeOverridesIntoCommandLine = void 0;
3
+ exports.serializeOverridesIntoCommandLine = serializeOverridesIntoCommandLine;
4
4
  const flat_1 = require("flat");
5
5
  function serializeOverridesIntoCommandLine(options) {
6
6
  const unparsed = options._ ? [...options._] : [];
@@ -12,7 +12,6 @@ function serializeOverridesIntoCommandLine(options) {
12
12
  }
13
13
  return unparsed;
14
14
  }
15
- exports.serializeOverridesIntoCommandLine = serializeOverridesIntoCommandLine;
16
15
  function serializeOption(key, value, unparsed) {
17
16
  if (value === true) {
18
17
  unparsed.push(`--${key}`);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeTarget = void 0;
3
+ exports.serializeTarget = serializeTarget;
4
4
  function serializeTarget(project, target, configuration) {
5
5
  return [project, target, configuration].filter((part) => !!part).join(':');
6
6
  }
7
- exports.serializeTarget = serializeTarget;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitByColons = exports.splitTarget = void 0;
3
+ exports.splitTarget = splitTarget;
4
+ exports.splitByColons = splitByColons;
4
5
  function splitTarget(s, projectGraph) {
5
6
  let [project, ...segments] = splitByColons(s);
6
7
  const validTargets = projectGraph.nodes[project]
@@ -9,7 +10,6 @@ function splitTarget(s, projectGraph) {
9
10
  const validTargetNames = new Set(Object.keys(validTargets ?? {}));
10
11
  return [project, ...groupJointSegments(segments, validTargetNames)];
11
12
  }
12
- exports.splitTarget = splitTarget;
13
13
  function groupJointSegments(segments, validTargetNames) {
14
14
  for (let endingSegmentIdx = segments.length; endingSegmentIdx > 0; endingSegmentIdx--) {
15
15
  const potentialTargetName = segments.slice(0, endingSegmentIdx).join(':');
@@ -46,4 +46,3 @@ function splitByColons(s) {
46
46
  parts.push(currentPart);
47
47
  return parts;
48
48
  }
49
- exports.splitByColons = splitByColons;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripIndents = void 0;
3
+ exports.stripIndents = stripIndents;
4
4
  /**
5
5
  * Removes indents, which is useful for printing warning and messages.
6
6
  *
@@ -21,4 +21,3 @@ function stripIndents(strings, ...values) {
21
21
  .join('\n')
22
22
  .trim();
23
23
  }
24
- exports.stripIndents = stripIndents;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.taskHistoryFile = exports.writeTaskRunsToHistory = exports.getHistoryForHashes = void 0;
3
+ exports.taskHistoryFile = void 0;
4
+ exports.getHistoryForHashes = getHistoryForHashes;
5
+ exports.writeTaskRunsToHistory = writeTaskRunsToHistory;
4
6
  const fs_1 = require("fs");
5
7
  const path_1 = require("path");
6
8
  const client_1 = require("../daemon/client/client");
@@ -37,7 +39,6 @@ async function getHistoryForHashes(hashes) {
37
39
  }
38
40
  return await client_1.daemonClient.getTaskHistoryForHashes(hashes);
39
41
  }
40
- exports.getHistoryForHashes = getHistoryForHashes;
41
42
  async function writeTaskRunsToHistory(taskRuns) {
42
43
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
43
44
  if (taskHistory === undefined) {
@@ -58,7 +59,6 @@ async function writeTaskRunsToHistory(taskRuns) {
58
59
  await client_1.daemonClient.writeTaskRunsToHistory(taskRuns);
59
60
  }
60
61
  }
61
- exports.writeTaskRunsToHistory = writeTaskRunsToHistory;
62
62
  exports.taskHistoryFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'task-history.csv');
63
63
  function loadTaskHistoryFromDisk() {
64
64
  taskHashToIndicesMap.clear();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateNxw = void 0;
3
+ exports.updateNxw = updateNxw;
4
4
  const add_nx_scripts_1 = require("../command-line/init/implementation/dot-nx/add-nx-scripts");
5
5
  const path_1 = require("../utils/path");
6
6
  function updateNxw(tree) {
@@ -9,4 +9,3 @@ function updateNxw(tree) {
9
9
  tree.write(wrapperPath, (0, add_nx_scripts_1.getNxWrapperContents)());
10
10
  }
11
11
  }
12
- exports.updateNxw = updateNxw;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workspaceConfigurationCheck = void 0;
3
+ exports.workspaceConfigurationCheck = workspaceConfigurationCheck;
4
4
  const workspace_root_1 = require("./workspace-root");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
@@ -34,4 +34,3 @@ function workspaceConfigurationCheck() {
34
34
  }
35
35
  }
36
36
  }
37
- exports.workspaceConfigurationCheck = workspaceConfigurationCheck;
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetWorkspaceContext = exports.updateProjectFiles = exports.getFilesInDirectoryUsingContext = exports.getAllFileDataInContext = exports.updateFilesInContext = exports.hashWithWorkspaceContext = exports.globWithWorkspaceContext = exports.globWithWorkspaceContextSync = exports.getNxWorkspaceFilesFromContext = exports.setupWorkspaceContext = void 0;
3
+ exports.setupWorkspaceContext = setupWorkspaceContext;
4
+ exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
5
+ exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
6
+ exports.globWithWorkspaceContext = globWithWorkspaceContext;
7
+ exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
8
+ exports.updateFilesInContext = updateFilesInContext;
9
+ exports.getAllFileDataInContext = getAllFileDataInContext;
10
+ exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
11
+ exports.updateProjectFiles = updateProjectFiles;
12
+ exports.resetWorkspaceContext = resetWorkspaceContext;
4
13
  const perf_hooks_1 = require("perf_hooks");
5
14
  const cache_directory_1 = require("./cache-directory");
6
15
  const is_on_daemon_1 = require("../daemon/is-on-daemon");
@@ -13,7 +22,6 @@ function setupWorkspaceContext(workspaceRoot) {
13
22
  perf_hooks_1.performance.mark('workspace-context:end');
14
23
  perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
15
24
  }
16
- exports.setupWorkspaceContext = setupWorkspaceContext;
17
25
  async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
18
26
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
19
27
  ensureContextAvailable(workspaceRoot);
@@ -21,7 +29,6 @@ async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap) {
21
29
  }
22
30
  return client_1.daemonClient.getWorkspaceFiles(projectRootMap);
23
31
  }
24
- exports.getNxWorkspaceFilesFromContext = getNxWorkspaceFilesFromContext;
25
32
  /**
26
33
  * Sync method to get files matching globs from workspace context.
27
34
  * NOTE: This method will create the workspace context if it doesn't exist.
@@ -33,7 +40,6 @@ function globWithWorkspaceContextSync(workspaceRoot, globs, exclude) {
33
40
  ensureContextAvailable(workspaceRoot);
34
41
  return workspaceContext.glob(globs, exclude);
35
42
  }
36
- exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
37
43
  async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
38
44
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
39
45
  ensureContextAvailable(workspaceRoot);
@@ -43,7 +49,6 @@ async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
43
49
  return client_1.daemonClient.glob(globs, exclude);
44
50
  }
45
51
  }
46
- exports.globWithWorkspaceContext = globWithWorkspaceContext;
47
52
  async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
48
53
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
49
54
  ensureContextAvailable(workspaceRoot);
@@ -51,11 +56,9 @@ async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
51
56
  }
52
57
  return client_1.daemonClient.hashGlob(globs, exclude);
53
58
  }
54
- exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
55
59
  function updateFilesInContext(updatedFiles, deletedFiles) {
56
60
  return workspaceContext?.incrementalUpdate(updatedFiles, deletedFiles);
57
61
  }
58
- exports.updateFilesInContext = updateFilesInContext;
59
62
  async function getAllFileDataInContext(workspaceRoot) {
60
63
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
61
64
  ensureContextAvailable(workspaceRoot);
@@ -63,7 +66,6 @@ async function getAllFileDataInContext(workspaceRoot) {
63
66
  }
64
67
  return client_1.daemonClient.getWorkspaceContextFileData();
65
68
  }
66
- exports.getAllFileDataInContext = getAllFileDataInContext;
67
69
  async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
68
70
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
69
71
  ensureContextAvailable(workspaceRoot);
@@ -71,11 +73,9 @@ async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
71
73
  }
72
74
  return client_1.daemonClient.getFilesInDirectory(dir);
73
75
  }
74
- exports.getFilesInDirectoryUsingContext = getFilesInDirectoryUsingContext;
75
76
  function updateProjectFiles(projectRootMappings, rustReferences, updatedFiles, deletedFiles) {
76
77
  return workspaceContext?.updateProjectFiles(projectRootMappings, rustReferences.projectFiles, rustReferences.globalFiles, updatedFiles, deletedFiles);
77
78
  }
78
- exports.updateProjectFiles = updateProjectFiles;
79
79
  function ensureContextAvailable(workspaceRoot) {
80
80
  if (!workspaceContext || workspaceContext?.workspaceRoot !== workspaceRoot) {
81
81
  setupWorkspaceContext(workspaceRoot);
@@ -84,4 +84,3 @@ function ensureContextAvailable(workspaceRoot) {
84
84
  function resetWorkspaceContext() {
85
85
  workspaceContext = undefined;
86
86
  }
87
- exports.resetWorkspaceContext = resetWorkspaceContext;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workspaceRootInner = exports.setWorkspaceRoot = exports.workspaceRoot = void 0;
3
+ exports.workspaceRoot = void 0;
4
+ exports.setWorkspaceRoot = setWorkspaceRoot;
5
+ exports.workspaceRootInner = workspaceRootInner;
4
6
  const path = require("path");
5
7
  const fileutils_1 = require("./fileutils");
6
8
  /**
@@ -11,7 +13,6 @@ exports.workspaceRoot = workspaceRootInner(process.cwd(), process.cwd());
11
13
  function setWorkspaceRoot(root) {
12
14
  exports.workspaceRoot = root;
13
15
  }
14
- exports.setWorkspaceRoot = setWorkspaceRoot;
15
16
  function workspaceRootInner(dir, candidateRoot) {
16
17
  if (process.env.NX_WORKSPACE_ROOT_PATH)
17
18
  return process.env.NX_WORKSPACE_ROOT_PATH;
@@ -36,4 +37,3 @@ function workspaceRootInner(dir, candidateRoot) {
36
37
  return workspaceRootInner(path.dirname(dir), candidateRoot);
37
38
  }
38
39
  }
39
- exports.workspaceRootInner = workspaceRootInner;
@@ -1,17 +0,0 @@
1
- /**
2
- * This marks that a target provides information which should modify a target already registered
3
- * on the project via other plugins. If the target has not already been registered, and this symbol is true,
4
- * the information provided by it will be discarded.
5
- *
6
- * NOTE: This cannot be a symbol, as they are not serialized in JSON the communication
7
- * between the plugin-worker and the main process.
8
- */
9
- export declare const ONLY_MODIFIES_EXISTING_TARGET = "NX_ONLY_MODIFIES_EXISTING_TARGET";
10
- /**
11
- * This is used to override the source file for the target defaults plugin.
12
- * This allows the plugin to use the project files as the context, but point to nx.json as the source file.
13
- *
14
- * NOTE: This cannot be a symbol, as they are not serialized in JSON the communication
15
- * between the plugin-worker and the main process.
16
- */
17
- export declare const OVERRIDE_SOURCE_FILE = "NX_OVERRIDE_SOURCE_FILE";
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OVERRIDE_SOURCE_FILE = exports.ONLY_MODIFIES_EXISTING_TARGET = void 0;
4
- /**
5
- * This marks that a target provides information which should modify a target already registered
6
- * on the project via other plugins. If the target has not already been registered, and this symbol is true,
7
- * the information provided by it will be discarded.
8
- *
9
- * NOTE: This cannot be a symbol, as they are not serialized in JSON the communication
10
- * between the plugin-worker and the main process.
11
- */
12
- exports.ONLY_MODIFIES_EXISTING_TARGET = 'NX_ONLY_MODIFIES_EXISTING_TARGET';
13
- /**
14
- * This is used to override the source file for the target defaults plugin.
15
- * This allows the plugin to use the project files as the context, but point to nx.json as the source file.
16
- *
17
- * NOTE: This cannot be a symbol, as they are not serialized in JSON the communication
18
- * between the plugin-worker and the main process.
19
- */
20
- exports.OVERRIDE_SOURCE_FILE = 'NX_OVERRIDE_SOURCE_FILE';
@@ -1,121 +0,0 @@
1
- import { TargetConfiguration } from '../../config/workspace-json-project-json';
2
- import { NxPluginV2 } from '../../project-graph/plugins';
3
- export declare const TargetDefaultsPlugin: NxPluginV2;
4
- export default TargetDefaultsPlugin;
5
- /**
6
- * This fn gets target info that would make a target uniquely compatible
7
- * with what is described by project.json or package.json. As the merge process
8
- * for config happens, without this, the target defaults may be compatible
9
- * with a config from a plugin and then that combined target be incompatible
10
- * with the project json configuration resulting in the target default values
11
- * being scrapped. By adding enough information from the project.json / package.json,
12
- * we can make sure that the target after merging is compatible with the defined target.
13
- */
14
- export declare function getTargetInfo(target: string, projectJsonTargets: Record<string, TargetConfiguration>, packageJsonTargets: Record<string, TargetConfiguration>): {
15
- command: string;
16
- metadata: {
17
- [x: string]: any;
18
- description?: string;
19
- technologies?: string[];
20
- nonAtomizedTarget?: string;
21
- help?: {
22
- command: string;
23
- example: {
24
- options?: Record<string, unknown>;
25
- args?: string[];
26
- };
27
- };
28
- };
29
- executor?: undefined;
30
- options?: undefined;
31
- } | {
32
- executor: string;
33
- options: {
34
- command: any;
35
- commands?: undefined;
36
- script?: undefined;
37
- };
38
- metadata: {
39
- [x: string]: any;
40
- description?: string;
41
- technologies?: string[];
42
- nonAtomizedTarget?: string;
43
- help?: {
44
- command: string;
45
- example: {
46
- options?: Record<string, unknown>;
47
- args?: string[];
48
- };
49
- };
50
- };
51
- command?: undefined;
52
- } | {
53
- executor: string;
54
- options: {
55
- commands: any;
56
- command?: undefined;
57
- script?: undefined;
58
- };
59
- metadata: {
60
- [x: string]: any;
61
- description?: string;
62
- technologies?: string[];
63
- nonAtomizedTarget?: string;
64
- help?: {
65
- command: string;
66
- example: {
67
- options?: Record<string, unknown>;
68
- args?: string[];
69
- };
70
- };
71
- };
72
- command?: undefined;
73
- } | {
74
- executor: string;
75
- metadata: {
76
- [x: string]: any;
77
- description?: string;
78
- technologies?: string[];
79
- nonAtomizedTarget?: string;
80
- help?: {
81
- command: string;
82
- example: {
83
- options?: Record<string, unknown>;
84
- args?: string[];
85
- };
86
- };
87
- };
88
- command?: undefined;
89
- options?: undefined;
90
- } | {
91
- executor: string;
92
- options: {
93
- script: any;
94
- command?: undefined;
95
- commands?: undefined;
96
- };
97
- metadata: {
98
- [x: string]: any;
99
- description?: string;
100
- technologies?: string[];
101
- nonAtomizedTarget?: string;
102
- help?: {
103
- command: string;
104
- example: {
105
- options?: Record<string, unknown>;
106
- args?: string[];
107
- };
108
- };
109
- };
110
- command?: undefined;
111
- } | {
112
- executor: string;
113
- command?: undefined;
114
- metadata?: undefined;
115
- options?: undefined;
116
- } | {
117
- command?: undefined;
118
- metadata?: undefined;
119
- executor?: undefined;
120
- options?: undefined;
121
- };
@@ -1,176 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTargetInfo = exports.TargetDefaultsPlugin = void 0;
4
- const minimatch_1 = require("minimatch");
5
- const node_fs_1 = require("node:fs");
6
- const node_path_1 = require("node:path");
7
- const fileutils_1 = require("../../utils/fileutils");
8
- const globs_1 = require("../../utils/globs");
9
- const package_json_1 = require("../../utils/package-json");
10
- const package_json_workspaces_1 = require("../package-json-workspaces");
11
- const symbols_1 = require("./symbols");
12
- exports.TargetDefaultsPlugin = {
13
- name: 'nx/core/target-defaults',
14
- createNodes: [
15
- '{package.json,**/package.json,project.json,**/project.json}',
16
- (configFile, _, ctx) => {
17
- const fileName = (0, node_path_1.basename)(configFile);
18
- const root = (0, node_path_1.dirname)(configFile);
19
- const packageManagerWorkspacesGlob = (0, globs_1.combineGlobPatterns)((0, package_json_workspaces_1.getGlobPatternsFromPackageManagerWorkspaces)(ctx.workspaceRoot));
20
- // Only process once if package.json + project.json both exist
21
- if (fileName === 'package.json' &&
22
- (0, node_fs_1.existsSync)((0, node_path_1.join)(ctx.workspaceRoot, root, 'project.json'))) {
23
- return {};
24
- }
25
- else if (fileName === 'package.json' &&
26
- !(0, minimatch_1.minimatch)(configFile, packageManagerWorkspacesGlob)) {
27
- return {};
28
- }
29
- // If no target defaults, this does nothing
30
- const targetDefaults = ctx.nxJsonConfiguration?.targetDefaults;
31
- if (!targetDefaults) {
32
- return {};
33
- }
34
- const projectJson = readJsonOrNull((0, node_path_1.join)(ctx.workspaceRoot, root, 'project.json'));
35
- const packageJson = readJsonOrNull((0, node_path_1.join)(ctx.workspaceRoot, root, 'package.json'));
36
- const packageJsonTargets = (0, package_json_1.readTargetsFromPackageJson)(packageJson);
37
- const projectDefinedTargets = new Set([
38
- ...Object.keys(projectJson?.targets ?? {}),
39
- ...(packageJson ? Object.keys(packageJsonTargets) : []),
40
- ]);
41
- const executorToTargetMap = getExecutorToTargetMap(packageJsonTargets, projectJson?.targets);
42
- const modifiedTargets = {};
43
- for (const defaultSpecifier in targetDefaults) {
44
- const targetNames = executorToTargetMap.get(defaultSpecifier) ?? new Set();
45
- targetNames.add(defaultSpecifier);
46
- for (const targetName of targetNames) {
47
- // Prevents `build` from overwriting `@nx/js:tsc` if both are present
48
- // and build is specified later in the ordering.
49
- if (!modifiedTargets[targetName] || targetName !== defaultSpecifier) {
50
- const defaults = JSON.parse(JSON.stringify(targetDefaults[defaultSpecifier]));
51
- modifiedTargets[targetName] = {
52
- ...getTargetInfo(targetName, projectJson?.targets, packageJsonTargets),
53
- ...defaults,
54
- };
55
- }
56
- // TODO: Remove this after we figure out a way to define new targets
57
- // in target defaults
58
- if (!projectDefinedTargets.has(targetName)) {
59
- modifiedTargets[targetName][symbols_1.ONLY_MODIFIES_EXISTING_TARGET] = true;
60
- }
61
- }
62
- }
63
- return {
64
- projects: {
65
- [root]: {
66
- targets: modifiedTargets,
67
- },
68
- },
69
- [symbols_1.OVERRIDE_SOURCE_FILE]: 'nx.json',
70
- };
71
- },
72
- ],
73
- };
74
- exports.default = exports.TargetDefaultsPlugin;
75
- function getExecutorToTargetMap(packageJsonTargets, projectJsonTargets) {
76
- const executorToTargetMap = new Map();
77
- const targets = Object.keys({
78
- ...projectJsonTargets,
79
- ...packageJsonTargets,
80
- });
81
- for (const target of targets) {
82
- const executor = getTargetExecutor(target, projectJsonTargets, packageJsonTargets);
83
- const targetsForExecutor = executorToTargetMap.get(executor) ?? new Set();
84
- targetsForExecutor.add(target);
85
- executorToTargetMap.set(executor, targetsForExecutor);
86
- }
87
- return executorToTargetMap;
88
- }
89
- function readJsonOrNull(path) {
90
- if ((0, node_fs_1.existsSync)(path)) {
91
- return (0, fileutils_1.readJsonFile)(path);
92
- }
93
- else {
94
- return null;
95
- }
96
- }
97
- /**
98
- * This fn gets target info that would make a target uniquely compatible
99
- * with what is described by project.json or package.json. As the merge process
100
- * for config happens, without this, the target defaults may be compatible
101
- * with a config from a plugin and then that combined target be incompatible
102
- * with the project json configuration resulting in the target default values
103
- * being scrapped. By adding enough information from the project.json / package.json,
104
- * we can make sure that the target after merging is compatible with the defined target.
105
- */
106
- function getTargetInfo(target, projectJsonTargets, packageJsonTargets) {
107
- const projectJsonTarget = projectJsonTargets?.[target];
108
- const packageJsonTarget = packageJsonTargets?.[target];
109
- const executor = getTargetExecutor(target, projectJsonTargets, packageJsonTargets);
110
- const targetOptions = {
111
- ...packageJsonTarget?.options,
112
- ...projectJsonTarget?.options,
113
- };
114
- const metadata = {
115
- ...packageJsonTarget?.metadata,
116
- ...projectJsonTarget?.metadata,
117
- };
118
- if (projectJsonTarget?.command) {
119
- return {
120
- command: projectJsonTarget?.command,
121
- metadata,
122
- };
123
- }
124
- if (executor === 'nx:run-commands') {
125
- if (targetOptions?.command) {
126
- return {
127
- executor: 'nx:run-commands',
128
- options: {
129
- command: targetOptions?.command,
130
- },
131
- metadata,
132
- };
133
- }
134
- else if (targetOptions?.commands) {
135
- return {
136
- executor: 'nx:run-commands',
137
- options: {
138
- commands: targetOptions.commands,
139
- },
140
- metadata,
141
- };
142
- }
143
- return {
144
- executor: 'nx:run-commands',
145
- metadata,
146
- };
147
- }
148
- if (executor === 'nx:run-script') {
149
- return {
150
- executor: 'nx:run-script',
151
- options: {
152
- script: targetOptions?.script ?? target,
153
- },
154
- metadata,
155
- };
156
- }
157
- if (executor) {
158
- return { executor };
159
- }
160
- return {};
161
- }
162
- exports.getTargetInfo = getTargetInfo;
163
- function getTargetExecutor(target, projectJsonTargets, packageJsonTargets) {
164
- const projectJsonTargetConfiguration = projectJsonTargets?.[target];
165
- const packageJsonTargetConfiguration = packageJsonTargets?.[target];
166
- if (!projectJsonTargetConfiguration && packageJsonTargetConfiguration) {
167
- return packageJsonTargetConfiguration?.executor;
168
- }
169
- if (projectJsonTargetConfiguration?.executor) {
170
- return projectJsonTargetConfiguration.executor;
171
- }
172
- if (projectJsonTargetConfiguration?.command) {
173
- return 'nx:run-commands';
174
- }
175
- return null;
176
- }