@ohos-ports/nx 19.8.4-beta.2 → 20.8.4-beta.1

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 (367) hide show
  1. package/.eslintrc.json +146 -0
  2. package/LICENSE +1 -1
  3. package/bin/init-local.js +0 -39
  4. package/bin/nx.js +28 -15
  5. package/bin/post-install.js +7 -5
  6. package/migrations.json +11 -37
  7. package/ohos-build/build-Cargo.toml.patch +12 -0
  8. package/ohos-build/build-cargo-config.patch +20 -0
  9. package/ohos-build/index.js.patch +18 -0
  10. package/ohos-build/native-bindings.js.patch +25 -0
  11. package/ohos-build/nix-0.25.1-ohos.patch +539 -0
  12. package/ohos-build/nix-0.27.1-ohos.patch +436 -0
  13. package/package.json +25 -62
  14. package/plugins/package-json.d.ts +5 -1
  15. package/plugins/package-json.js +27 -2
  16. package/release/changelog-renderer/index.d.ts +102 -0
  17. package/release/changelog-renderer/index.js +339 -0
  18. package/release/index.d.ts +4 -0
  19. package/release/index.js +13 -0
  20. package/schemas/nx-schema.json +964 -0
  21. package/schemas/project-schema.json +331 -0
  22. package/schemas/workspace-schema.json +185 -0
  23. package/src/adapter/angular-json.js +2 -8
  24. package/src/adapter/compat.d.ts +1 -1
  25. package/src/adapter/compat.js +3 -1
  26. package/src/adapter/ngcli-adapter.js +7 -7
  27. package/src/command-line/add/add.js +21 -48
  28. package/src/command-line/affected/affected.js +3 -3
  29. package/src/command-line/connect/view-logs.js +1 -1
  30. package/src/command-line/examples.js +0 -4
  31. package/src/command-line/exec/exec.js +3 -3
  32. package/src/command-line/format/command-object.js +9 -0
  33. package/src/command-line/format/format.js +10 -6
  34. package/src/command-line/generate/command-object.js +1 -2
  35. package/src/command-line/generate/generate.d.ts +1 -1
  36. package/src/command-line/generate/generate.js +3 -1
  37. package/src/command-line/generate/generator-utils.js +10 -5
  38. package/src/command-line/graph/graph.js +6 -9
  39. package/src/command-line/import/import.js +110 -71
  40. package/src/command-line/init/command-object.js +25 -9
  41. package/src/command-line/init/configure-plugins.d.ts +34 -0
  42. package/src/command-line/init/configure-plugins.js +203 -0
  43. package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
  44. package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
  45. package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -1
  46. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +4 -3
  47. package/src/command-line/init/implementation/angular/standalone-workspace.js +8 -5
  48. package/src/command-line/init/implementation/check-compatible-with-plugins.d.ts +15 -0
  49. package/src/command-line/init/implementation/check-compatible-with-plugins.js +134 -0
  50. package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
  51. package/src/command-line/init/implementation/deduce-default-base.js +53 -0
  52. package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -1
  53. package/src/command-line/init/implementation/dot-nx/nxw.js +1 -1
  54. package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
  55. package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -1
  56. package/src/command-line/init/implementation/react/index.d.ts +1 -1
  57. package/src/command-line/init/implementation/react/index.js +33 -186
  58. package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
  59. package/src/command-line/init/implementation/utils.d.ts +6 -2
  60. package/src/command-line/init/implementation/utils.js +116 -37
  61. package/src/command-line/init/init-v1.js +2 -2
  62. package/src/command-line/init/init-v2.d.ts +2 -2
  63. package/src/command-line/init/init-v2.js +73 -55
  64. package/src/command-line/login/login.js +3 -0
  65. package/src/command-line/logout/logout.js +3 -0
  66. package/src/command-line/migrate/command-object.js +2 -96
  67. package/src/command-line/migrate/migrate.d.ts +1 -0
  68. package/src/command-line/migrate/migrate.js +111 -19
  69. package/src/command-line/nx-commands.js +20 -6
  70. package/src/command-line/register/command-object.d.ts +6 -0
  71. package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
  72. package/src/command-line/register/register.d.ts +2 -0
  73. package/src/command-line/register/register.js +9 -0
  74. package/src/command-line/release/changelog.d.ts +5 -4
  75. package/src/command-line/release/changelog.js +64 -79
  76. package/src/command-line/release/command-object.d.ts +7 -4
  77. package/src/command-line/release/command-object.js +24 -13
  78. package/src/command-line/release/config/config.d.ts +8 -7
  79. package/src/command-line/release/config/config.js +173 -43
  80. package/src/command-line/release/config/conventional-commits.js +7 -0
  81. package/src/command-line/release/config/filter-release-groups.d.ts +4 -0
  82. package/src/command-line/release/config/filter-release-groups.js +10 -3
  83. package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
  84. package/src/command-line/release/config/use-legacy-versioning.js +9 -0
  85. package/src/command-line/release/config/version-plans.js +1 -1
  86. package/src/command-line/release/index.d.ts +9 -2
  87. package/src/command-line/release/index.js +6 -1
  88. package/src/command-line/release/plan-check.js +6 -3
  89. package/src/command-line/release/plan.js +8 -4
  90. package/src/command-line/release/publish.d.ts +6 -1
  91. package/src/command-line/release/publish.js +50 -27
  92. package/src/command-line/release/release.js +33 -20
  93. package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
  94. package/src/command-line/release/utils/exec-command.js +1 -1
  95. package/src/command-line/release/utils/git.d.ts +3 -2
  96. package/src/command-line/release/utils/git.js +104 -19
  97. package/src/command-line/release/utils/github.d.ts +1 -0
  98. package/src/command-line/release/utils/github.js +6 -2
  99. package/src/command-line/release/utils/launch-editor.js +2 -2
  100. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  101. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  102. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
  103. package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
  104. package/src/command-line/release/utils/semver.d.ts +8 -0
  105. package/src/command-line/release/utils/semver.js +8 -0
  106. package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
  107. package/src/command-line/release/utils/shared-legacy.js +2 -0
  108. package/src/command-line/release/utils/shared.d.ts +11 -17
  109. package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
  110. package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
  111. package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
  112. package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
  113. package/src/command-line/release/version/project-logger.d.ts +8 -0
  114. package/src/command-line/release/version/project-logger.js +45 -0
  115. package/src/command-line/release/version/release-group-processor.d.ts +251 -0
  116. package/src/command-line/release/version/release-group-processor.js +1048 -0
  117. package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
  118. package/src/command-line/release/version/resolve-current-version.js +241 -0
  119. package/src/command-line/release/version/test-utils.d.ts +95 -0
  120. package/src/command-line/release/version/test-utils.js +416 -0
  121. package/src/command-line/release/version/topological-sort.d.ts +9 -0
  122. package/src/command-line/release/version/topological-sort.js +41 -0
  123. package/src/command-line/release/version/version-actions.d.ts +170 -0
  124. package/src/command-line/release/version/version-actions.js +183 -0
  125. package/src/command-line/release/version-legacy.d.ts +46 -0
  126. package/src/command-line/release/version-legacy.js +453 -0
  127. package/src/command-line/release/version.d.ts +0 -40
  128. package/src/command-line/release/version.js +93 -255
  129. package/src/command-line/report/report.d.ts +7 -3
  130. package/src/command-line/report/report.js +52 -16
  131. package/src/command-line/run/executor-utils.js +4 -4
  132. package/src/command-line/run/run-one.js +37 -15
  133. package/src/command-line/run/run.js +1 -2
  134. package/src/command-line/run-many/run-many.js +1 -4
  135. package/src/command-line/show/project.js +25 -3
  136. package/src/command-line/show/projects.js +4 -0
  137. package/src/command-line/sync/sync.js +3 -3
  138. package/src/command-line/watch/watch.js +1 -1
  139. package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
  140. package/src/command-line/yargs-utils/shared-options.js +26 -0
  141. package/src/config/misc-interfaces.d.ts +3 -15
  142. package/src/config/nx-json.d.ts +145 -19
  143. package/src/config/project-graph.d.ts +4 -4
  144. package/src/config/project-graph.js +8 -0
  145. package/src/config/schema-utils.d.ts +4 -3
  146. package/src/config/schema-utils.js +71 -4
  147. package/src/config/workspace-json-project-json.d.ts +23 -2
  148. package/src/core/graph/main.js +1 -1
  149. package/src/core/graph/runtime.js +1 -1
  150. package/src/core/graph/styles.css +2 -2
  151. package/src/core/graph/styles.js +1 -1
  152. package/src/daemon/client/client.d.ts +5 -0
  153. package/src/daemon/client/client.js +42 -4
  154. package/src/daemon/client/generate-help-output.js +1 -1
  155. package/src/daemon/message-types/glob.d.ts +7 -0
  156. package/src/daemon/message-types/glob.js +9 -1
  157. package/src/daemon/message-types/hash-glob.d.ts +6 -0
  158. package/src/daemon/message-types/hash-glob.js +9 -1
  159. package/src/daemon/message-types/run-tasks-execution-hooks.d.ts +13 -0
  160. package/src/daemon/message-types/run-tasks-execution-hooks.js +19 -0
  161. package/src/daemon/server/handle-glob.d.ts +1 -0
  162. package/src/daemon/server/handle-glob.js +8 -0
  163. package/src/daemon/server/handle-hash-glob.d.ts +1 -0
  164. package/src/daemon/server/handle-hash-glob.js +8 -0
  165. package/src/daemon/server/handle-hash-tasks.js +1 -1
  166. package/src/daemon/server/handle-tasks-execution-hooks.d.ts +19 -0
  167. package/src/daemon/server/handle-tasks-execution-hooks.js +35 -0
  168. package/src/daemon/server/logger.js +2 -1
  169. package/src/daemon/server/project-graph-incremental-recomputation.js +5 -5
  170. package/src/daemon/server/server.js +26 -2
  171. package/src/daemon/server/shutdown-utils.js +4 -2
  172. package/src/devkit-exports.d.ts +10 -7
  173. package/src/devkit-exports.js +4 -6
  174. package/src/devkit-internals.d.ts +4 -2
  175. package/src/devkit-internals.js +8 -3
  176. package/src/executors/run-commands/run-commands.impl.d.ts +1 -0
  177. package/src/executors/run-commands/run-commands.impl.js +11 -4
  178. package/src/executors/run-commands/schema.json +14 -0
  179. package/src/executors/run-script/run-script.impl.js +1 -1
  180. package/src/executors/utils/convert-nx-executor.js +2 -4
  181. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
  182. package/src/generators/testing-utils/create-tree.js +5 -1
  183. package/src/generators/utils/nx-json.d.ts +1 -1
  184. package/src/generators/utils/project-configuration.js +15 -4
  185. package/src/hasher/create-task-hasher.js +1 -1
  186. package/src/hasher/file-hasher.d.ts +1 -0
  187. package/src/hasher/file-hasher.js +5 -0
  188. package/src/hasher/hash-task.js +1 -1
  189. package/src/hasher/task-hasher.d.ts +2 -6
  190. package/src/hasher/task-hasher.js +6 -32
  191. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  192. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  193. package/src/migrations/update-20-0-1/use-legacy-cache.d.ts +2 -0
  194. package/src/migrations/update-20-0-1/use-legacy-cache.js +20 -0
  195. package/src/native/index.d.ts +49 -20
  196. package/src/native/index.js +18 -3
  197. package/src/native/native-bindings.js +12 -2
  198. package/src/native/nx.openharmony-arm64.node +0 -0
  199. package/src/native/nx.wasi-browser.js +11 -8
  200. package/src/native/nx.wasi.cjs +11 -8
  201. package/src/native/nx.wasm32-wasi.wasm +0 -0
  202. package/src/native/tests/__fixtures__/file-lock.fixture.js +20 -0
  203. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -2
  204. package/src/nx-cloud/update-manager.js +13 -1
  205. package/src/plugins/js/index.js +2 -2
  206. package/src/plugins/js/lock-file/lock-file.js +28 -13
  207. package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
  208. package/src/plugins/js/lock-file/utils/package-json.js +3 -1
  209. package/src/plugins/js/lock-file/yarn-parser.js +102 -44
  210. package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
  211. package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +2 -2
  212. package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +6 -20
  213. package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
  214. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +14 -2
  215. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +81 -19
  216. package/src/plugins/js/utils/config.js +2 -9
  217. package/src/plugins/js/utils/packages.d.ts +8 -0
  218. package/src/plugins/js/utils/packages.js +91 -0
  219. package/src/plugins/js/utils/register.d.ts +5 -1
  220. package/src/plugins/js/utils/register.js +2 -1
  221. package/src/plugins/js/utils/typescript.d.ts +1 -0
  222. package/src/plugins/js/utils/typescript.js +4 -3
  223. package/src/plugins/js/versions.d.ts +1 -1
  224. package/src/plugins/js/versions.js +1 -1
  225. package/src/plugins/package-json/create-nodes.d.ts +7 -8
  226. package/src/plugins/package-json/create-nodes.js +34 -12
  227. package/src/project-graph/affected/affected-project-graph.js +3 -0
  228. package/src/project-graph/affected/locators/project-glob-changes.js +16 -4
  229. package/src/project-graph/build-project-graph.d.ts +2 -1
  230. package/src/project-graph/build-project-graph.js +66 -43
  231. package/src/project-graph/error-types.d.ts +15 -12
  232. package/src/project-graph/error-types.js +109 -23
  233. package/src/project-graph/file-utils.d.ts +3 -3
  234. package/src/project-graph/file-utils.js +8 -7
  235. package/src/project-graph/nx-deps-cache.d.ts +6 -3
  236. package/src/project-graph/nx-deps-cache.js +66 -11
  237. package/src/project-graph/plugins/get-plugins.d.ts +4 -0
  238. package/src/project-graph/plugins/get-plugins.js +144 -0
  239. package/src/project-graph/plugins/in-process-loader.d.ts +10 -0
  240. package/src/project-graph/plugins/in-process-loader.js +60 -0
  241. package/src/project-graph/plugins/index.d.ts +2 -1
  242. package/src/project-graph/plugins/index.js +5 -3
  243. package/src/project-graph/plugins/isolation/enabled.d.ts +1 -0
  244. package/src/project-graph/plugins/isolation/enabled.js +19 -0
  245. package/src/project-graph/plugins/isolation/index.d.ts +2 -2
  246. package/src/project-graph/plugins/isolation/index.js +1 -7
  247. package/src/project-graph/plugins/isolation/messaging.d.ts +39 -21
  248. package/src/project-graph/plugins/isolation/messaging.js +5 -1
  249. package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
  250. package/src/project-graph/plugins/isolation/plugin-pool.js +58 -49
  251. package/src/project-graph/plugins/isolation/plugin-worker.js +79 -29
  252. package/src/project-graph/plugins/load-resolved-plugin.d.ts +3 -0
  253. package/src/project-graph/plugins/load-resolved-plugin.js +22 -0
  254. package/src/project-graph/plugins/loaded-nx-plugin.d.ts +20 -0
  255. package/src/project-graph/plugins/loaded-nx-plugin.js +80 -0
  256. package/src/project-graph/plugins/public-api.d.ts +32 -13
  257. package/src/project-graph/plugins/resolve-plugin.d.ts +15 -0
  258. package/src/project-graph/plugins/resolve-plugin.js +134 -0
  259. package/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -0
  260. package/src/project-graph/plugins/tasks-execution-hooks.js +65 -0
  261. package/src/project-graph/plugins/transpiler.d.ts +8 -0
  262. package/src/project-graph/plugins/transpiler.js +47 -0
  263. package/src/project-graph/plugins/utils.d.ts +2 -8
  264. package/src/project-graph/plugins/utils.js +2 -39
  265. package/src/project-graph/project-graph.d.ts +3 -1
  266. package/src/project-graph/project-graph.js +86 -20
  267. package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
  268. package/src/project-graph/utils/project-configuration-utils.js +55 -25
  269. package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -7
  270. package/src/project-graph/utils/retrieve-workspace-files.js +17 -23
  271. package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
  272. package/src/tasks-runner/batch/run-batch.js +2 -4
  273. package/src/tasks-runner/cache.d.ts +22 -4
  274. package/src/tasks-runner/cache.js +160 -18
  275. package/src/tasks-runner/create-task-graph.d.ts +13 -1
  276. package/src/tasks-runner/create-task-graph.js +50 -22
  277. package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
  278. package/src/tasks-runner/default-tasks-runner.js +20 -2
  279. package/src/tasks-runner/forked-process-task-runner.d.ts +4 -1
  280. package/src/tasks-runner/forked-process-task-runner.js +62 -40
  281. package/src/tasks-runner/init-tasks-runner.js +0 -2
  282. package/src/tasks-runner/life-cycle.d.ts +7 -0
  283. package/src/tasks-runner/run-command.d.ts +2 -4
  284. package/src/tasks-runner/run-command.js +51 -18
  285. package/src/tasks-runner/task-graph-utils.d.ts +11 -0
  286. package/src/tasks-runner/task-graph-utils.js +23 -0
  287. package/src/tasks-runner/task-orchestrator.js +14 -4
  288. package/src/tasks-runner/utils.js +2 -0
  289. package/src/utils/ab-testing.js +1 -1
  290. package/src/utils/assert-workspace-validity.js +4 -0
  291. package/src/utils/child-process.d.ts +4 -0
  292. package/src/utils/child-process.js +23 -30
  293. package/src/utils/command-line-utils.d.ts +5 -3
  294. package/src/utils/command-line-utils.js +37 -57
  295. package/src/utils/db-connection.d.ts +2 -1
  296. package/src/utils/db-connection.js +7 -0
  297. package/src/utils/default-base.js +1 -1
  298. package/src/utils/delayed-spinner.d.ts +42 -0
  299. package/src/utils/delayed-spinner.js +80 -0
  300. package/src/utils/find-matching-projects.js +13 -1
  301. package/src/utils/git-utils.index-filter.js +2 -2
  302. package/src/utils/git-utils.js +4 -4
  303. package/src/utils/git-utils.tree-filter.js +1 -1
  304. package/src/utils/handle-errors.js +24 -13
  305. package/src/utils/is-ci.js +4 -1
  306. package/src/utils/is-using-prettier.d.ts +3 -0
  307. package/src/utils/is-using-prettier.js +62 -0
  308. package/src/utils/nx-cloud-utils.js +3 -0
  309. package/src/utils/nx-key.d.ts +7 -0
  310. package/src/utils/nx-key.js +52 -0
  311. package/src/utils/package-json.d.ts +5 -1
  312. package/src/utils/package-json.js +9 -3
  313. package/src/utils/package-manager.d.ts +14 -0
  314. package/src/utils/package-manager.js +89 -3
  315. package/src/utils/path.js +1 -1
  316. package/src/utils/plugins/core-plugins.js +4 -0
  317. package/src/utils/plugins/plugin-capabilities.js +4 -5
  318. package/src/utils/print-help.js +3 -9
  319. package/src/utils/require-nx-key.d.ts +1 -0
  320. package/src/utils/require-nx-key.js +22 -0
  321. package/src/utils/sync-generators.js +9 -14
  322. package/src/utils/task-history.d.ts +1 -1
  323. package/src/utils/task-history.js +2 -2
  324. package/src/utils/workspace-context.d.ts +2 -0
  325. package/src/utils/workspace-context.js +16 -0
  326. package/tasks-runners/default.d.ts +1 -0
  327. package/tasks-runners/default.js +5 -0
  328. package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
  329. package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
  330. package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
  331. package/src/command-line/import/utils/needs-install.d.ts +0 -3
  332. package/src/command-line/import/utils/needs-install.js +0 -31
  333. package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
  334. package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
  335. package/src/daemon/server/plugins.d.ts +0 -3
  336. package/src/daemon/server/plugins.js +0 -32
  337. package/src/hasher/node-task-hasher-impl.d.ts +0 -48
  338. package/src/hasher/node-task-hasher-impl.js +0 -449
  339. package/src/migrations/update-15-0-0/migrate-to-inputs.d.ts +0 -2
  340. package/src/migrations/update-15-0-0/migrate-to-inputs.js +0 -102
  341. package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  342. package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
  343. package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  344. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  345. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  346. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
  347. package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  348. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  349. package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  350. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
  351. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  352. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
  353. package/src/migrations/update-16-9-0/remove-project-name-and-root-format.d.ts +0 -2
  354. package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +0 -21
  355. package/src/native/nx.ohos-arm64.node +0 -0
  356. package/src/project-graph/plugins/internal-api.d.ts +0 -29
  357. package/src/project-graph/plugins/internal-api.js +0 -134
  358. package/src/project-graph/plugins/loader.d.ts +0 -24
  359. package/src/project-graph/plugins/loader.js +0 -220
  360. package/src/utils/app-root.d.ts +0 -8
  361. package/src/utils/app-root.js +0 -12
  362. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  363. package/src/utils/nx-plugin.deprecated.js +0 -20
  364. package/src/utils/powerpack.d.ts +0 -5
  365. package/src/utils/powerpack.js +0 -33
  366. package/src/utils/workspace-configuration-check.d.ts +0 -1
  367. package/src/utils/workspace-configuration-check.js +0 -36
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
5
- const project_configuration_1 = require("../../generators/utils/project-configuration");
6
- const nx_json_1 = require("../../generators/utils/nx-json");
7
- const path_1 = require("../../utils/path");
8
- const path_2 = require("path");
9
- const json_1 = require("../../generators/utils/json");
10
- const skippedFiles = [
11
- 'package.json', // Not to be added to filesets
12
- 'babel.config.json', // Will be handled by various plugins
13
- 'karma.conf.js', // Will be handled by @nx/angular
14
- 'jest.preset.js', // Will be handled by @nx/jest
15
- '.storybook', // Will be handled by @nx/storybook
16
- // Will be handled by @nx/eslint
17
- '.eslintrc.json',
18
- '.eslintrc.js',
19
- ];
20
- async function default_1(tree) {
21
- // If the workspace doesn't have a nx.json, don't make any changes
22
- if (!tree.exists('nx.json')) {
23
- return;
24
- }
25
- const nxJson = (0, nx_json_1.readNxJson)(tree);
26
- // If this is a npm workspace, don't make any changes
27
- if (nxJson.extends === 'nx/presets/npm.json') {
28
- return;
29
- }
30
- nxJson.namedInputs ??= {
31
- default: ['{projectRoot}/**/*', 'sharedGlobals'],
32
- sharedGlobals: [],
33
- production: ['default'],
34
- };
35
- if (nxJson.namedInputs.default) {
36
- if (!nxJson.namedInputs.production) {
37
- nxJson.namedInputs.production = ['default'];
38
- }
39
- else if (!nxJson.namedInputs.production.includes('default')) {
40
- nxJson.namedInputs.production = [
41
- 'default',
42
- ...nxJson.namedInputs.production,
43
- ];
44
- }
45
- }
46
- if (isBuildATarget(tree)) {
47
- nxJson.targetDefaults ??= {};
48
- nxJson.targetDefaults.build ??= {};
49
- nxJson.targetDefaults.build.inputs ??= ['production', '^production'];
50
- }
51
- if (nxJson.implicitDependencies) {
52
- const projects = (0, project_configuration_1.getProjects)(tree);
53
- for (const [files, dependents] of Object.entries(nxJson.implicitDependencies)) {
54
- // Skip these because other plugins take care of them
55
- if (skippedFiles.includes(files)) {
56
- continue;
57
- }
58
- else if (Array.isArray(dependents)) {
59
- nxJson.namedInputs.projectSpecificFiles = [];
60
- const defaultFileset = new Set(nxJson.namedInputs.default ?? ['{projectRoot}/**/*', 'sharedGlobals']);
61
- defaultFileset.add('projectSpecificFiles');
62
- nxJson.namedInputs.default = Array.from(defaultFileset);
63
- for (const dependent of dependents) {
64
- const project = projects.get(dependent);
65
- project.namedInputs ??= {};
66
- const projectSpecificFileset = new Set(project.namedInputs.projectSpecificFiles ?? []);
67
- projectSpecificFileset.add((0, path_1.joinPathFragments)('{workspaceRoot}', files));
68
- project.namedInputs.projectSpecificFiles = Array.from(projectSpecificFileset);
69
- try {
70
- (0, project_configuration_1.updateProjectConfiguration)(tree, dependent, project);
71
- }
72
- catch {
73
- if (tree.exists((0, path_2.join)(project.root, 'package.json'))) {
74
- (0, json_1.updateJson)(tree, (0, path_2.join)(project.root, 'package.json'), (json) => {
75
- json.nx ??= {};
76
- json.nx.namedInputs ??= {};
77
- json.nx.namedInputs.projectSpecificFiles ??=
78
- project.namedInputs.projectSpecificFiles;
79
- return json;
80
- });
81
- }
82
- }
83
- }
84
- }
85
- else {
86
- nxJson.namedInputs.sharedGlobals.push((0, path_1.joinPathFragments)('{workspaceRoot}', files));
87
- }
88
- }
89
- delete nxJson.implicitDependencies;
90
- }
91
- (0, nx_json_1.updateNxJson)(tree, nxJson);
92
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
93
- }
94
- function isBuildATarget(tree) {
95
- const projects = (0, project_configuration_1.getProjects)(tree);
96
- for (const [_, project] of projects) {
97
- if (project.targets?.build) {
98
- return true;
99
- }
100
- }
101
- return false;
102
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
5
- const project_configuration_1 = require("../../generators/utils/project-configuration");
6
- const nx_json_1 = require("../../generators/utils/nx-json");
7
- const path_1 = require("path");
8
- const utils_1 = require("../../tasks-runner/utils");
9
- const json_1 = require("../../generators/utils/json");
10
- async function default_1(tree) {
11
- // If the workspace doesn't have a nx.json, don't make any changes
12
- if (!tree.exists('nx.json')) {
13
- return;
14
- }
15
- const nxJson = (0, nx_json_1.readNxJson)(tree);
16
- for (const [projectName, project] of (0, project_configuration_1.getProjects)(tree)) {
17
- for (const [_, target] of Object.entries(project.targets ?? {})) {
18
- if (!target.outputs) {
19
- continue;
20
- }
21
- target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
22
- }
23
- try {
24
- (0, project_configuration_1.updateProjectConfiguration)(tree, projectName, project);
25
- }
26
- catch {
27
- if (tree.exists((0, path_1.join)(project.root, 'package.json'))) {
28
- (0, json_1.updateJson)(tree, (0, path_1.join)(project.root, 'package.json'), (json) => {
29
- for (const target of Object.values(json.nx?.targets ?? {})) {
30
- if (target.outputs) {
31
- target.outputs = (0, utils_1.transformLegacyOutputs)(project.root, target.outputs);
32
- }
33
- }
34
- return json;
35
- });
36
- }
37
- }
38
- }
39
- if (nxJson.targetDefaults) {
40
- for (const [_, target] of Object.entries(nxJson.targetDefaults)) {
41
- if (!target.outputs) {
42
- continue;
43
- }
44
- target.outputs = (0, utils_1.transformLegacyOutputs)('{projectRoot}', target.outputs);
45
- }
46
- (0, nx_json_1.updateNxJson)(tree, nxJson);
47
- }
48
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
49
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
5
- const json_1 = require("../../generators/utils/json");
6
- async function default_1(tree) {
7
- (0, json_1.updateJson)(tree, 'package.json', (json) => {
8
- for (const deps of [json.dependencies, json.devDependencies]) {
9
- if (deps) {
10
- delete deps['@nrwl/cli'];
11
- }
12
- }
13
- return json;
14
- });
15
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
16
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const project_configuration_1 = require("../../generators/utils/project-configuration");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- async function default_1(tree) {
7
- updateDependsOnAndInputsInsideNxJson(tree);
8
- const projectsConfigurations = (0, project_configuration_1.getProjects)(tree);
9
- for (const [projectName, projectConfiguration] of projectsConfigurations) {
10
- let projectChanged = false;
11
- for (const [targetName, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
12
- for (const dependency of targetConfiguration.dependsOn ?? []) {
13
- if (typeof dependency !== 'string') {
14
- if (dependency.projects === 'self' ||
15
- dependency.projects === '{self}') {
16
- delete dependency.projects;
17
- projectChanged = true;
18
- }
19
- else if (dependency.projects === 'dependencies' ||
20
- dependency.projects === '{dependencies}') {
21
- delete dependency.projects;
22
- dependency.dependencies = true;
23
- projectChanged = true;
24
- }
25
- }
26
- }
27
- for (let i = 0; i < targetConfiguration.inputs?.length ?? 0; i++) {
28
- const input = targetConfiguration.inputs[i];
29
- if (typeof input !== 'string') {
30
- if ('projects' in input &&
31
- (input.projects === 'self' || input.projects === '{self}')) {
32
- delete input.projects;
33
- projectChanged = true;
34
- }
35
- else if ('projects' in input &&
36
- (input.projects === 'dependencies' ||
37
- input.projects === '{dependencies}')) {
38
- delete input.projects;
39
- targetConfiguration.inputs[i] = {
40
- ...input,
41
- dependencies: true,
42
- };
43
- projectChanged = true;
44
- }
45
- }
46
- }
47
- }
48
- if (projectChanged) {
49
- (0, project_configuration_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
50
- }
51
- }
52
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
53
- }
54
- function updateDependsOnAndInputsInsideNxJson(tree) {
55
- const nxJson = (0, project_configuration_1.readNxJson)(tree);
56
- let nxJsonChanged = false;
57
- for (const [target, defaults] of Object.entries(nxJson?.targetDefaults ?? {})) {
58
- for (const dependency of defaults.dependsOn ?? []) {
59
- if (typeof dependency !== 'string') {
60
- if (dependency.projects === 'self' ||
61
- dependency.projects === '{self}') {
62
- delete dependency.projects;
63
- nxJsonChanged = true;
64
- }
65
- else if (dependency.projects === 'dependencies' ||
66
- dependency.projects === '{dependencies}') {
67
- delete dependency.projects;
68
- dependency.dependencies = true;
69
- nxJsonChanged = true;
70
- }
71
- }
72
- }
73
- for (let i = 0; i < defaults.inputs?.length ?? 0; i++) {
74
- const input = defaults.inputs[i];
75
- if (typeof input !== 'string') {
76
- if ('projects' in input &&
77
- (input.projects === 'self' || input.projects === '{self}')) {
78
- delete input.projects;
79
- nxJsonChanged = true;
80
- }
81
- else if ('projects' in input &&
82
- (input.projects === 'dependencies' ||
83
- input.projects === '{dependencies}')) {
84
- delete input.projects;
85
- defaults.inputs[i] = {
86
- ...input,
87
- dependencies: true,
88
- };
89
- nxJsonChanged = true;
90
- }
91
- }
92
- }
93
- }
94
- if (nxJsonChanged) {
95
- (0, project_configuration_1.updateNxJson)(tree, nxJson);
96
- }
97
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const project_configuration_1 = require("../../generators/utils/project-configuration");
5
- const json_1 = require("../../generators/utils/json");
6
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
7
- async function default_1(tree) {
8
- (0, json_1.updateJson)(tree, 'package.json', (json) => {
9
- if (json.dependencies && json.dependencies['@nrwl/nx-cloud']) {
10
- json.dependencies['nx-cloud'] = json.dependencies['@nrwl/nx-cloud'];
11
- delete json.dependencies['@nrwl/nx-cloud'];
12
- }
13
- if (json.devDependencies && json.devDependencies['@nrwl/nx-cloud']) {
14
- json.devDependencies['nx-cloud'] = json.devDependencies['@nrwl/nx-cloud'];
15
- delete json.devDependencies['@nrwl/nx-cloud'];
16
- }
17
- return json;
18
- });
19
- const nxJson = (0, project_configuration_1.readNxJson)(tree);
20
- if (!nxJson)
21
- return;
22
- for (let opts of Object.values(nxJson.tasksRunnerOptions ?? {})) {
23
- if (opts.runner === '@nrwl/nx-cloud') {
24
- opts.runner = 'nx-cloud';
25
- }
26
- }
27
- (0, project_configuration_1.updateNxJson)(tree, nxJson);
28
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
29
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function removeRunCommandsOutputPath(tree: Tree): Promise<void>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeRunCommandsOutputPath;
4
- const path_1 = require("../../utils/path");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- const json_1 = require("../../generators/utils/json");
7
- const project_configuration_1 = require("../../generators/utils/project-configuration");
8
- async function removeRunCommandsOutputPath(tree) {
9
- for (const [project, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
10
- const targets = configuration.targets ?? {};
11
- let changed = false;
12
- for (const [, target] of Object.entries(targets)) {
13
- changed ||= updateTargetBlock(target);
14
- }
15
- if (changed) {
16
- (0, project_configuration_1.updateProjectConfiguration)(tree, project, configuration);
17
- }
18
- }
19
- if (tree.exists('nx.json')) {
20
- (0, json_1.updateJson)(tree, 'nx.json', (json) => {
21
- for (const [, target] of Object.entries(json.targetDefaults ?? {})) {
22
- updateTargetBlock(target);
23
- }
24
- return json;
25
- });
26
- }
27
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
28
- }
29
- function updateTargetBlock(target) {
30
- let changed = false;
31
- if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
32
- changed = true;
33
- const outputs = new Set(target.outputs ?? []);
34
- outputs.delete('{options.outputPath}');
35
- const newOutputs = Array.isArray(target.options.outputPath)
36
- ? target.options.outputPath.map((p) => (0, path_1.joinPathFragments)('{workspaceRoot}', p))
37
- : [(0, path_1.joinPathFragments)('{workspaceRoot}', target.options.outputPath)];
38
- for (const outputPath of newOutputs) {
39
- outputs.add(outputPath);
40
- }
41
- delete target.options.outputPath;
42
- target.outputs = Array.from(outputs);
43
- }
44
- return changed;
45
- }
@@ -1,12 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- /**
3
- * This function escapes dollar sign in env variables
4
- * It will go through:
5
- * - '.env', '.local.env', '.env.local'
6
- * - .env.[target-name], .[target-name].env
7
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
8
- * - .env.[configuration-name], .[configuration-name].env
9
- * at each project root and workspace root
10
- * @param tree
11
- */
12
- export default function escapeDollarSignEnvVariables(tree: Tree): void;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = escapeDollarSignEnvVariables;
4
- const logger_1 = require("../../utils/logger");
5
- const project_configuration_1 = require("../../generators/utils/project-configuration");
6
- /**
7
- * This function escapes dollar sign in env variables
8
- * It will go through:
9
- * - '.env', '.local.env', '.env.local'
10
- * - .env.[target-name], .[target-name].env
11
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
12
- * - .env.[configuration-name], .[configuration-name].env
13
- * at each project root and workspace root
14
- * @param tree
15
- */
16
- function escapeDollarSignEnvVariables(tree) {
17
- const envFiles = ['.env', '.local.env', '.env.local'];
18
- for (const [_, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
19
- envFiles.push(`${configuration.root}/.env`, `${configuration.root}/.local.env`, `${configuration.root}/.env.local`);
20
- for (const targetName in configuration.targets) {
21
- const task = configuration.targets[targetName];
22
- envFiles.push(`.env.${targetName}`, `.${targetName}.env`, `${configuration.root}/.env.${targetName}`, `${configuration.root}/.${targetName}.env`);
23
- if (task.configurations) {
24
- for (const configurationName in task.configurations) {
25
- envFiles.push(`.env.${targetName}.${configurationName}`, `.${targetName}.${configurationName}.env`, `.env.${configurationName}`, `.${configurationName}.env`, `${configuration.root}/.env.${targetName}.${configurationName}`, `${configuration.root}/.${targetName}.${configurationName}.env`, `${configuration.root}/.env.${configurationName}`, `${configuration.root}/.${configurationName}.env`);
26
- }
27
- }
28
- }
29
- }
30
- for (const envFile of new Set(envFiles)) {
31
- parseEnvFile(tree, envFile);
32
- }
33
- }
34
- /**
35
- * This function parse the env file and escape dollar sign
36
- * @param tree
37
- * @param envFilePath
38
- * @returns
39
- */
40
- function parseEnvFile(tree, envFilePath) {
41
- if (!tree.exists(envFilePath)) {
42
- return;
43
- }
44
- let envFileContent = tree.read(envFilePath, 'utf-8');
45
- if (!envFileContent) {
46
- // envFileContent is null if we fail to read the file for any reason
47
- // e.g. the file is not utf-8 encoded
48
- logger_1.logger.info(`Unable to update ${envFilePath}. Nx interpolates environment variables in the form of $VAR_NAME. To escape the dollar sign, use \\$VAR_NAME.`);
49
- return;
50
- }
51
- envFileContent = envFileContent
52
- .split('\n')
53
- .map((line) => {
54
- line = line.trim();
55
- if (!line || !line.includes('$')) {
56
- return line;
57
- }
58
- const declarations = line.split('=');
59
- if (declarations[1].includes('$') && !declarations[1].includes(`\\$`)) {
60
- declarations[1] = declarations[1].replace('$', `\\$`);
61
- line = declarations.join('=');
62
- }
63
- return line;
64
- })
65
- .join('\n');
66
- tree.write(envFilePath, envFileContent);
67
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function removeProjectNameAndRootFormat(tree: Tree): Promise<void>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeProjectNameAndRootFormat;
4
- const json_1 = require("../../generators/utils/json");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- async function removeProjectNameAndRootFormat(tree) {
7
- if (!tree.exists('nx.json')) {
8
- return;
9
- }
10
- (0, json_1.updateJson)(tree, 'nx.json', (nxJson) => {
11
- if (!nxJson.workspaceLayout) {
12
- return nxJson;
13
- }
14
- delete nxJson.workspaceLayout.projectNameAndRootFormat;
15
- if (Object.keys(nxJson.workspaceLayout).length === 0) {
16
- delete nxJson.workspaceLayout;
17
- }
18
- return nxJson;
19
- });
20
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
21
- }
Binary file
@@ -1,29 +0,0 @@
1
- import { PluginConfiguration } from '../../config/nx-json';
2
- import { NxPluginV1 } from '../../utils/nx-plugin.deprecated';
3
- import { CreateDependencies, CreateDependenciesContext, CreateMetadata, CreateMetadataContext, CreateNodesContextV2, CreateNodesResult, NxPluginV2 } from './public-api';
4
- import { ProjectGraph, ProjectGraphProcessor } from '../../config/project-graph';
5
- export declare class LoadedNxPlugin {
6
- readonly name: string;
7
- readonly createNodes?: [
8
- filePattern: string,
9
- fn: (matchedFiles: string[], context: CreateNodesContextV2) => Promise<Array<readonly [plugin: string, file: string, result: CreateNodesResult]>>
10
- ];
11
- readonly createDependencies?: (context: CreateDependenciesContext) => ReturnType<CreateDependencies>;
12
- readonly createMetadata?: (graph: ProjectGraph, context: CreateMetadataContext) => ReturnType<CreateMetadata>;
13
- readonly processProjectGraph?: ProjectGraphProcessor;
14
- readonly options?: unknown;
15
- readonly include?: string[];
16
- readonly exclude?: string[];
17
- constructor(plugin: NormalizedPlugin, pluginDefinition: PluginConfiguration);
18
- }
19
- export type CreateNodesResultWithContext = CreateNodesResult & {
20
- file: string;
21
- pluginName: string;
22
- };
23
- export type NormalizedPlugin = NxPluginV2 & Pick<NxPluginV1, 'processProjectGraph'>;
24
- export declare const nxPluginCache: Map<unknown, [
25
- Promise<LoadedNxPlugin>,
26
- () => void
27
- ]>;
28
- export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string): Promise<readonly [LoadedNxPlugin[], () => void]>;
29
- export declare function getDefaultPlugins(root: string): Promise<string[]>;
@@ -1,134 +0,0 @@
1
- "use strict";
2
- // This file contains the bits and bobs of the internal API for loading and interacting with Nx plugins.
3
- // For the public API, used by plugin authors, see `./public-api.ts`.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.nxPluginCache = exports.LoadedNxPlugin = void 0;
6
- exports.loadNxPlugins = loadNxPlugins;
7
- exports.getDefaultPlugins = getDefaultPlugins;
8
- const path_1 = require("path");
9
- const workspace_root_1 = require("../../utils/workspace-root");
10
- const angular_json_1 = require("../../adapter/angular-json");
11
- const isolation_1 = require("./isolation");
12
- const loader_1 = require("./loader");
13
- const utils_1 = require("./utils");
14
- const error_types_1 = require("../error-types");
15
- const native_1 = require("../../native");
16
- class LoadedNxPlugin {
17
- constructor(plugin, pluginDefinition) {
18
- this.name = plugin.name;
19
- if (typeof pluginDefinition !== 'string') {
20
- this.options = pluginDefinition.options;
21
- this.include = pluginDefinition.include;
22
- this.exclude = pluginDefinition.exclude;
23
- }
24
- if (plugin.createNodes && !plugin.createNodesV2) {
25
- this.createNodes = [
26
- plugin.createNodes[0],
27
- (configFiles, context) => (0, utils_1.createNodesFromFiles)(plugin.createNodes[1], configFiles, this.options, context).then((results) => results.map((r) => [this.name, r[0], r[1]])),
28
- ];
29
- }
30
- if (plugin.createNodesV2) {
31
- this.createNodes = [
32
- plugin.createNodesV2[0],
33
- async (configFiles, context) => {
34
- const result = await plugin.createNodesV2[1](configFiles, this.options, context);
35
- return result.map((r) => [this.name, r[0], r[1]]);
36
- },
37
- ];
38
- }
39
- if (this.createNodes) {
40
- const inner = this.createNodes[1];
41
- this.createNodes[1] = async (...args) => {
42
- performance.mark(`${plugin.name}:createNodes - start`);
43
- try {
44
- return await inner(...args);
45
- }
46
- catch (e) {
47
- if ((0, error_types_1.isAggregateCreateNodesError)(e)) {
48
- throw e;
49
- }
50
- // The underlying plugin errored out. We can't know any partial results.
51
- throw new error_types_1.AggregateCreateNodesError([[null, e]], []);
52
- }
53
- finally {
54
- performance.mark(`${plugin.name}:createNodes - end`);
55
- performance.measure(`${plugin.name}:createNodes`, `${plugin.name}:createNodes - start`, `${plugin.name}:createNodes - end`);
56
- }
57
- };
58
- }
59
- if (plugin.createDependencies) {
60
- this.createDependencies = (context) => plugin.createDependencies(this.options, context);
61
- }
62
- if (plugin.createMetadata) {
63
- this.createMetadata = (graph, context) => plugin.createMetadata(graph, this.options, context);
64
- }
65
- this.processProjectGraph = plugin.processProjectGraph;
66
- }
67
- }
68
- exports.LoadedNxPlugin = LoadedNxPlugin;
69
- // Short lived cache (cleared between cmd runs)
70
- // holding resolved nx plugin objects.
71
- // Allows loaded plugins to not be reloaded when
72
- // referenced multiple times.
73
- exports.nxPluginCache = new Map();
74
- function isIsolationEnabled() {
75
- // Explicitly enabled, regardless of further conditions
76
- if (process.env.NX_ISOLATE_PLUGINS === 'true') {
77
- return true;
78
- }
79
- if (
80
- // Explicitly disabled
81
- process.env.NX_ISOLATE_PLUGINS === 'false' ||
82
- // Isolation is disabled on WASM builds currently.
83
- native_1.IS_WASM) {
84
- return false;
85
- }
86
- // Default value
87
- return true;
88
- }
89
- async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
90
- performance.mark('loadNxPlugins:start');
91
- const loadingMethod = isIsolationEnabled()
92
- ? isolation_1.loadNxPluginInIsolation
93
- : loader_1.loadNxPlugin;
94
- plugins = await normalizePlugins(plugins, root);
95
- const result = new Array(plugins?.length);
96
- const cleanupFunctions = [];
97
- await Promise.all(plugins.map(async (plugin, idx) => {
98
- const [loadedPluginPromise, cleanup] = await loadingMethod(plugin, root);
99
- result[idx] = loadedPluginPromise;
100
- cleanupFunctions.push(cleanup);
101
- }));
102
- const ret = [
103
- await Promise.all(result),
104
- () => {
105
- for (const fn of cleanupFunctions) {
106
- fn();
107
- }
108
- if (loader_1.unregisterPluginTSTranspiler) {
109
- (0, loader_1.unregisterPluginTSTranspiler)();
110
- }
111
- },
112
- ];
113
- performance.mark('loadNxPlugins:end');
114
- performance.measure('loadNxPlugins', 'loadNxPlugins:start', 'loadNxPlugins:end');
115
- return ret;
116
- }
117
- async function normalizePlugins(plugins, root) {
118
- plugins ??= [];
119
- return [
120
- ...plugins,
121
- // Most of the nx core node plugins go on the end, s.t. it overwrites any other plugins
122
- ...(await getDefaultPlugins(root)),
123
- ];
124
- }
125
- async function getDefaultPlugins(root) {
126
- return [
127
- (0, path_1.join)(__dirname, '../../plugins/js'),
128
- ...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
129
- ? [(0, path_1.join)(__dirname, '../../adapter/angular-json')]
130
- : []),
131
- (0, path_1.join)(__dirname, '../../plugins/package-json'),
132
- (0, path_1.join)(__dirname, '../../plugins/project-json/build-nodes/project-json'),
133
- ];
134
- }