nx 17.0.3 → 17.0.5

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 (320) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -4
  3. package/bin/init-local.js +10 -60
  4. package/bin/nx-cloud.js +6 -0
  5. package/bin/nx.js +1 -9
  6. package/bin/post-install.js +5 -1
  7. package/bin/run-executor.js +1 -1
  8. package/migrations.json +18 -0
  9. package/package.json +21 -18
  10. package/plugins/package-json.js +1 -1
  11. package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
  12. package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
  13. package/release/index.d.ts +4 -0
  14. package/release/index.js +11 -0
  15. package/schemas/nx-schema.json +203 -19
  16. package/schemas/project-schema.json +20 -0
  17. package/src/adapter/angular-json.js +28 -18
  18. package/src/adapter/compat.d.ts +2 -2
  19. package/src/adapter/compat.js +6 -1
  20. package/src/adapter/ngcli-adapter.d.ts +16 -4
  21. package/src/adapter/ngcli-adapter.js +85 -28
  22. package/src/command-line/add/add.d.ts +2 -0
  23. package/src/command-line/add/add.js +169 -0
  24. package/src/command-line/add/command-object.d.ts +7 -0
  25. package/src/command-line/add/command-object.js +24 -0
  26. package/src/command-line/affected/affected.js +0 -3
  27. package/src/command-line/affected/command-object.d.ts +4 -4
  28. package/src/command-line/affected/command-object.js +53 -26
  29. package/src/command-line/affected/print-affected.js +10 -1
  30. package/src/command-line/connect/command-object.d.ts +1 -2
  31. package/src/command-line/connect/command-object.js +3 -7
  32. package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
  33. package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
  34. package/src/command-line/connect/view-logs.js +5 -21
  35. package/src/command-line/examples.js +18 -0
  36. package/src/command-line/exec/command-object.js +2 -1
  37. package/src/command-line/exec/exec.d.ts +1 -1
  38. package/src/command-line/exec/exec.js +78 -35
  39. package/src/command-line/format/format.js +13 -4
  40. package/src/command-line/generate/generate.js +9 -9
  41. package/src/command-line/generate/generator-utils.d.ts +3 -2
  42. package/src/command-line/generate/generator-utils.js +5 -5
  43. package/src/command-line/graph/graph.d.ts +1 -1
  44. package/src/command-line/graph/graph.js +82 -37
  45. package/src/command-line/init/command-object.js +70 -43
  46. package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
  47. package/src/command-line/init/implementation/add-nx-to-monorepo.js +11 -2
  48. package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
  49. package/src/command-line/init/implementation/add-nx-to-nest.js +9 -6
  50. package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
  51. package/src/command-line/init/implementation/add-nx-to-npm-repo.js +14 -4
  52. package/src/command-line/init/implementation/angular/index.js +4 -1
  53. package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
  54. package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
  55. package/src/command-line/init/implementation/angular/types.d.ts +1 -1
  56. package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
  57. package/src/command-line/init/implementation/react/index.d.ts +1 -1
  58. package/src/command-line/init/implementation/react/index.js +4 -2
  59. package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
  60. package/src/command-line/init/implementation/utils.d.ts +5 -5
  61. package/src/command-line/init/implementation/utils.js +46 -44
  62. package/src/command-line/init/{init.js → init-v1.js} +5 -13
  63. package/src/command-line/init/init-v2.d.ts +7 -0
  64. package/src/command-line/init/init-v2.js +201 -0
  65. package/src/command-line/list/list.js +6 -5
  66. package/src/command-line/migrate/command-object.js +19 -4
  67. package/src/command-line/migrate/migrate.js +21 -17
  68. package/src/command-line/new/new.js +1 -1
  69. package/src/command-line/nx-commands.js +4 -1
  70. package/src/command-line/release/changelog.d.ts +22 -1
  71. package/src/command-line/release/changelog.js +459 -257
  72. package/src/command-line/release/command-object.d.ts +29 -7
  73. package/src/command-line/release/command-object.js +120 -20
  74. package/src/command-line/release/config/config.d.ts +26 -21
  75. package/src/command-line/release/config/config.js +416 -59
  76. package/src/command-line/release/config/conventional-commits.d.ts +2 -0
  77. package/src/command-line/release/config/conventional-commits.js +98 -0
  78. package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
  79. package/src/command-line/release/config/filter-release-groups.js +38 -1
  80. package/src/command-line/release/index.d.ts +16 -0
  81. package/src/command-line/release/index.js +23 -0
  82. package/src/command-line/release/publish.d.ts +7 -3
  83. package/src/command-line/release/publish.js +89 -37
  84. package/src/command-line/release/release.d.ts +4 -0
  85. package/src/command-line/release/release.js +176 -0
  86. package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
  87. package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
  88. package/src/command-line/release/utils/exec-command.d.ts +1 -0
  89. package/src/command-line/release/utils/exec-command.js +34 -0
  90. package/src/command-line/release/utils/git.d.ts +34 -1
  91. package/src/command-line/release/utils/git.js +238 -34
  92. package/src/command-line/release/utils/github.d.ts +5 -5
  93. package/src/command-line/release/utils/github.js +155 -8
  94. package/src/command-line/release/utils/markdown.js +6 -1
  95. package/src/command-line/release/utils/print-changes.d.ts +1 -1
  96. package/src/command-line/release/utils/print-changes.js +3 -3
  97. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
  98. package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
  99. package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
  100. package/src/command-line/release/utils/semver.d.ts +8 -0
  101. package/src/command-line/release/utils/semver.js +30 -1
  102. package/src/command-line/release/utils/shared.d.ts +39 -0
  103. package/src/command-line/release/utils/shared.js +213 -0
  104. package/src/command-line/release/version.d.ts +37 -3
  105. package/src/command-line/release/version.js +312 -117
  106. package/src/command-line/repair/repair.js +13 -9
  107. package/src/command-line/report/report.d.ts +3 -0
  108. package/src/command-line/report/report.js +22 -5
  109. package/src/command-line/run/command-object.d.ts +4 -0
  110. package/src/command-line/run/command-object.js +18 -2
  111. package/src/command-line/run/executor-utils.d.ts +2 -1
  112. package/src/command-line/run/executor-utils.js +4 -4
  113. package/src/command-line/run/run-one.js +3 -6
  114. package/src/command-line/run/run.js +34 -9
  115. package/src/command-line/run-many/command-object.js +4 -1
  116. package/src/command-line/run-many/run-many.js +0 -3
  117. package/src/command-line/show/command-object.d.ts +3 -0
  118. package/src/command-line/show/command-object.js +29 -2
  119. package/src/command-line/show/show.js +9 -0
  120. package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
  121. package/src/command-line/yargs-utils/shared-options.js +23 -9
  122. package/src/commands-runner/command-graph.d.ts +13 -0
  123. package/src/commands-runner/command-graph.js +2 -0
  124. package/src/commands-runner/create-command-graph.d.ts +4 -0
  125. package/src/commands-runner/create-command-graph.js +44 -0
  126. package/src/commands-runner/get-command-projects.d.ts +3 -0
  127. package/src/commands-runner/get-command-projects.js +19 -0
  128. package/src/config/nx-json.d.ts +160 -25
  129. package/src/config/project-graph.d.ts +3 -3
  130. package/src/config/workspace-json-project-json.d.ts +23 -1
  131. package/src/config/workspaces.d.ts +1 -1
  132. package/src/config/workspaces.js +4 -6
  133. package/src/core/graph/3rdpartylicenses.txt +144 -74
  134. package/src/core/graph/environment.js +1 -1
  135. package/src/core/graph/index.html +4 -6
  136. package/src/core/graph/main.js +1 -1
  137. package/src/core/graph/runtime.js +1 -1
  138. package/src/core/graph/styles.css +3 -3
  139. package/src/core/graph/styles.js +1 -1
  140. package/src/daemon/client/client.d.ts +5 -1
  141. package/src/daemon/client/client.js +27 -8
  142. package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
  143. package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
  144. package/src/daemon/daemon-project-graph-error.d.ts +8 -0
  145. package/src/daemon/daemon-project-graph-error.js +13 -0
  146. package/src/daemon/server/handle-hash-tasks.js +12 -2
  147. package/src/daemon/server/handle-request-project-graph.js +1 -1
  148. package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
  149. package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
  150. package/src/daemon/server/shutdown-utils.js +2 -4
  151. package/src/daemon/server/watcher.js +0 -3
  152. package/src/daemon/socket-utils.d.ts +2 -1
  153. package/src/daemon/socket-utils.js +15 -4
  154. package/src/daemon/tmp-dir.d.ts +1 -0
  155. package/src/daemon/tmp-dir.js +4 -4
  156. package/src/devkit-exports.d.ts +2 -2
  157. package/src/devkit-exports.js +3 -2
  158. package/src/devkit-internals.d.ts +3 -0
  159. package/src/devkit-internals.js +7 -1
  160. package/src/executors/noop/schema.json +1 -1
  161. package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
  162. package/src/executors/run-commands/run-commands.impl.js +152 -48
  163. package/src/executors/run-commands/schema.json +11 -1
  164. package/src/executors/run-script/run-script.impl.js +43 -11
  165. package/src/executors/utils/convert-nx-executor.js +1 -1
  166. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
  167. package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
  168. package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
  169. package/src/generators/tree.d.ts +1 -0
  170. package/src/generators/utils/glob.js +2 -2
  171. package/src/generators/utils/project-configuration.js +28 -9
  172. package/src/hasher/create-task-hasher.d.ts +4 -0
  173. package/src/hasher/create-task-hasher.js +16 -0
  174. package/src/hasher/hash-task.js +9 -3
  175. package/src/hasher/native-task-hasher-impl.d.ts +19 -0
  176. package/src/hasher/native-task-hasher-impl.js +37 -0
  177. package/src/hasher/node-task-hasher-impl.d.ts +49 -0
  178. package/src/hasher/node-task-hasher-impl.js +431 -0
  179. package/src/hasher/task-hasher.d.ts +33 -21
  180. package/src/hasher/task-hasher.js +30 -428
  181. package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
  182. package/src/migrations/update-15-1-0/set-project-names.js +2 -1
  183. package/src/migrations/update-15-8-2/update-nxw.js +2 -6
  184. package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
  185. package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
  186. package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
  187. package/src/migrations/update-17-2-0/move-default-base.js +21 -0
  188. package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
  189. package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
  190. package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
  191. package/src/migrations/update-17-3-0/update-nxw.js +7 -0
  192. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
  193. package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
  194. package/src/native/index.d.ts +65 -15
  195. package/src/native/index.js +6 -2
  196. package/src/native/transform-objects.js +2 -0
  197. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
  198. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
  199. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
  200. package/src/nx-cloud/update-manager.js +2 -1
  201. package/src/plugins/js/index.d.ts +1 -1
  202. package/src/plugins/js/index.js +3 -3
  203. package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
  204. package/src/plugins/js/lock-file/lock-file.js +15 -3
  205. package/src/plugins/js/package-json/create-package-json.js +1 -1
  206. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
  207. package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
  208. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
  209. package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
  210. package/src/plugins/js/utils/register.d.ts +1 -1
  211. package/src/plugins/js/utils/register.js +28 -8
  212. package/src/plugins/js/versions.d.ts +1 -1
  213. package/src/plugins/js/versions.js +1 -1
  214. package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
  215. package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
  216. package/src/plugins/package-json-workspaces/index.d.ts +1 -0
  217. package/src/plugins/package-json-workspaces/index.js +4 -0
  218. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
  219. package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
  220. package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
  221. package/src/plugins/project-json/build-nodes/project-json.js +6 -44
  222. package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
  223. package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
  224. package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
  225. package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
  226. package/src/project-graph/affected/locators/workspace-projects.js +16 -29
  227. package/src/project-graph/build-project-graph.d.ts +20 -1
  228. package/src/project-graph/build-project-graph.js +91 -33
  229. package/src/project-graph/file-map-utils.d.ts +9 -5
  230. package/src/project-graph/file-map-utils.js +16 -63
  231. package/src/project-graph/file-utils.d.ts +1 -1
  232. package/src/project-graph/file-utils.js +44 -2
  233. package/src/project-graph/nx-deps-cache.js +1 -1
  234. package/src/project-graph/project-graph-builder.d.ts +1 -1
  235. package/src/project-graph/project-graph-builder.js +1 -1
  236. package/src/project-graph/project-graph.d.ts +32 -1
  237. package/src/project-graph/project-graph.js +147 -23
  238. package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
  239. package/src/project-graph/utils/build-all-workspace-files.js +15 -0
  240. package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
  241. package/src/project-graph/utils/normalize-project-nodes.js +7 -33
  242. package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
  243. package/src/project-graph/utils/project-configuration-utils.js +509 -62
  244. package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
  245. package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
  246. package/src/tasks-runner/batch/run-batch.js +3 -3
  247. package/src/tasks-runner/cache.js +6 -3
  248. package/src/tasks-runner/create-task-graph.js +1 -1
  249. package/src/tasks-runner/fork.d.ts +1 -0
  250. package/src/tasks-runner/fork.js +23 -0
  251. package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
  252. package/src/tasks-runner/forked-process-task-runner.js +112 -21
  253. package/src/tasks-runner/init-tasks-runner.js +1 -1
  254. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
  255. package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
  256. package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
  257. package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
  258. package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
  259. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
  260. package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
  261. package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
  262. package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
  263. package/src/tasks-runner/pseudo-ipc.js +140 -0
  264. package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
  265. package/src/tasks-runner/pseudo-terminal.js +159 -0
  266. package/src/tasks-runner/run-command.d.ts +1 -1
  267. package/src/tasks-runner/run-command.js +13 -19
  268. package/src/tasks-runner/task-env.js +1 -2
  269. package/src/tasks-runner/task-graph-utils.d.ts +7 -3
  270. package/src/tasks-runner/task-graph-utils.js +15 -15
  271. package/src/tasks-runner/task-orchestrator.js +68 -12
  272. package/src/tasks-runner/tasks-schedule.js +3 -3
  273. package/src/tasks-runner/utils.d.ts +16 -7
  274. package/src/tasks-runner/utils.js +30 -16
  275. package/src/utils/ab-testing.d.ts +36 -2
  276. package/src/utils/ab-testing.js +34 -16
  277. package/src/utils/assert-workspace-validity.js +1 -1
  278. package/src/utils/cache-directory.d.ts +1 -0
  279. package/src/utils/cache-directory.js +5 -1
  280. package/src/utils/child-process.d.ts +15 -1
  281. package/src/utils/child-process.js +91 -1
  282. package/src/utils/command-line-utils.js +2 -1
  283. package/src/utils/exit-codes.d.ts +6 -0
  284. package/src/utils/exit-codes.js +20 -0
  285. package/src/utils/fileutils.d.ts +1 -0
  286. package/src/utils/find-matching-projects.js +5 -5
  287. package/src/utils/find-workspace-root.js +1 -0
  288. package/src/utils/ignore.js +8 -1
  289. package/src/utils/json-diff.d.ts +1 -0
  290. package/src/utils/json-diff.js +2 -1
  291. package/src/utils/json.js +3 -1
  292. package/src/utils/logger.js +1 -1
  293. package/src/utils/nx-cloud-utils.d.ts +1 -1
  294. package/src/utils/nx-cloud-utils.js +9 -4
  295. package/src/utils/nx-plugin.d.ts +32 -15
  296. package/src/utils/nx-plugin.deprecated.d.ts +10 -5
  297. package/src/utils/nx-plugin.deprecated.js +23 -0
  298. package/src/utils/nx-plugin.js +71 -80
  299. package/src/utils/output.d.ts +4 -2
  300. package/src/utils/output.js +44 -9
  301. package/src/utils/package-json.d.ts +4 -4
  302. package/src/utils/package-json.js +18 -12
  303. package/src/utils/package-manager.d.ts +7 -0
  304. package/src/utils/package-manager.js +24 -4
  305. package/src/utils/params.d.ts +12 -4
  306. package/src/utils/params.js +37 -4
  307. package/src/utils/plugins/core-plugins.js +8 -0
  308. package/src/utils/plugins/installed-plugins.d.ts +2 -1
  309. package/src/utils/plugins/installed-plugins.js +2 -2
  310. package/src/utils/plugins/local-plugins.js +1 -1
  311. package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
  312. package/src/utils/plugins/plugin-capabilities.js +7 -7
  313. package/src/utils/typescript.js +1 -1
  314. package/src/utils/update-nxw.d.ts +2 -0
  315. package/src/utils/update-nxw.js +12 -0
  316. package/src/utils/workspace-configuration-check.js +1 -1
  317. package/src/utils/workspace-context.d.ts +6 -4
  318. package/src/utils/workspace-context.js +19 -9
  319. package/src/core/graph/polyfills.js +0 -1
  320. /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
@@ -2,15 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const json_1 = require("../../generators/utils/json");
4
4
  const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
5
+ const nx_json_1 = require("../../generators/utils/nx-json");
6
+ const update_manager_1 = require("../../nx-cloud/update-manager");
7
+ const run_command_1 = require("../../tasks-runner/run-command");
8
+ const output_1 = require("../../utils/output");
5
9
  async function migrate(tree) {
6
10
  if (!tree.exists('nx.json')) {
7
11
  return;
8
12
  }
13
+ const nxJson = (0, nx_json_1.readNxJson)(tree);
14
+ // Already migrated
15
+ if (!nxJson.tasksRunnerOptions?.default) {
16
+ return;
17
+ }
18
+ const nxCloudClientSupported = await isNxCloudClientSupported(nxJson);
9
19
  (0, json_1.updateJson)(tree, 'nx.json', (nxJson) => {
10
- // Already migrated
11
- if (!nxJson.tasksRunnerOptions?.default) {
12
- return nxJson;
13
- }
14
20
  const { runner, options } = nxJson.tasksRunnerOptions.default;
15
21
  // This property shouldn't ever be part of tasks runner options.
16
22
  if (options.useDaemonProcess !== undefined) {
@@ -28,18 +34,13 @@ async function migrate(tree) {
28
34
  if (options.url) {
29
35
  nxJson.nxCloudUrl = options.url;
30
36
  delete options.url;
31
- if ([
32
- 'https://nx.app',
33
- 'https://cloud.nx.app',
34
- 'https://staging.nx.app',
35
- 'https://snapshot.nx.app',
36
- ].includes(nxJson.nxCloudUrl)) {
37
- removeNxCloudDependency(tree);
38
- }
39
37
  }
40
- else {
38
+ if (nxCloudClientSupported) {
41
39
  removeNxCloudDependency(tree);
42
40
  }
41
+ else {
42
+ options.useLightClient = false;
43
+ }
43
44
  if (options.encryptionKey) {
44
45
  nxJson.nxCloudEncryptionKey = options.encryptionKey;
45
46
  delete options.encryptionKey;
@@ -73,6 +74,41 @@ async function migrate(tree) {
73
74
  await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
74
75
  }
75
76
  exports.default = migrate;
77
+ async function isNxCloudClientSupported(nxJson) {
78
+ const nxCloudOptions = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
79
+ // Non enterprise workspaces support the Nx Cloud Client
80
+ if (!isNxCloudEnterpriseWorkspace(nxJson)) {
81
+ return true;
82
+ }
83
+ // If we can get the nx cloud client, it's supported
84
+ try {
85
+ await (0, update_manager_1.verifyOrUpdateNxCloudClient)(nxCloudOptions);
86
+ return true;
87
+ }
88
+ catch (e) {
89
+ if (e instanceof update_manager_1.NxCloudEnterpriseOutdatedError) {
90
+ output_1.output.warn({
91
+ title: 'Nx Cloud Instance is outdated.',
92
+ bodyLines: [
93
+ 'If you are an Nx Enterprise customer, please reach out to your assigned Developer Productivity Engineer.',
94
+ 'If you are NOT an Nx Enterprise customer but are seeing this message, please reach out to cloud-support@nrwl.io.',
95
+ ],
96
+ });
97
+ }
98
+ return false;
99
+ }
100
+ }
101
+ function isNxCloudEnterpriseWorkspace(nxJson) {
102
+ const { runner, options } = nxJson.tasksRunnerOptions.default;
103
+ return ((runner === 'nx-cloud' || runner === '@nrwl/nx-cloud') &&
104
+ options.url &&
105
+ ![
106
+ 'https://nx.app',
107
+ 'https://cloud.nx.app',
108
+ 'https://staging.nx.app',
109
+ 'https://snapshot.nx.app',
110
+ ].includes(options.url));
111
+ }
76
112
  function removeNxCloudDependency(tree) {
77
113
  if (tree.exists('package.json')) {
78
114
  (0, json_1.updateJson)(tree, 'package.json', (packageJson) => {
@@ -0,0 +1,5 @@
1
+ import { Tree } from '../../generators/tree';
2
+ /**
3
+ * Updates existing workspaces to move nx.json's affected.defaultBase to nx.json's base.
4
+ */
5
+ export default function update(host: Tree): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
+ const nx_json_1 = require("../../generators/utils/nx-json");
5
+ const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
+ /**
7
+ * Updates existing workspaces to move nx.json's affected.defaultBase to nx.json's base.
8
+ */
9
+ async function update(host) {
10
+ const nxJson = (0, nx_json_1.readNxJson)(host);
11
+ if (nxJson?.affected?.defaultBase) {
12
+ nxJson.defaultBase = nxJson.affected.defaultBase;
13
+ delete nxJson.affected.defaultBase;
14
+ if (Object.keys(nxJson.affected).length === 0) {
15
+ delete nxJson.affected;
16
+ }
17
+ (0, nx_json_1.updateNxJson)(host, nxJson);
18
+ }
19
+ await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(host);
20
+ }
21
+ exports.default = update;
@@ -0,0 +1,3 @@
1
+ import { Tree } from '../../generators/tree';
2
+ export default function nxReleasePath(tree: Tree): void;
3
+ export declare function visitNotIgnoredFiles(tree: Tree, dirPath: string, visitor: (path: string) => void): void;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.visitNotIgnoredFiles = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const ignore_1 = require("../../utils/ignore");
6
+ function nxReleasePath(tree) {
7
+ visitNotIgnoredFiles(tree, '', (file) => {
8
+ const contents = tree.read(file).toString('utf-8');
9
+ if (
10
+ // the deep import usage should be replaced by the new location
11
+ contents.includes('nx/src/command-line/release') ||
12
+ // changelog-renderer has moved into nx/release
13
+ contents.includes('nx/changelog-renderer')) {
14
+ const finalContents = contents
15
+ // replace instances of old changelog renderer location
16
+ .replace(/nx\/changelog-renderer/g, 'nx/release/changelog-renderer')
17
+ // replace instances of deep import for programmatic API (only perform the replacement if an actual import by checking for trailing ' or ")
18
+ .replace(/nx\/src\/command-line\/release(['"])/g, 'nx/release$1');
19
+ tree.write(file, finalContents);
20
+ }
21
+ });
22
+ }
23
+ exports.default = nxReleasePath;
24
+ // Adapted from devkit
25
+ function visitNotIgnoredFiles(tree, dirPath = tree.root, visitor) {
26
+ const ig = (0, ignore_1.getIgnoreObject)();
27
+ dirPath = normalizePathRelativeToRoot(dirPath, tree.root);
28
+ if (dirPath !== '' && ig?.ignores(dirPath)) {
29
+ return;
30
+ }
31
+ for (const child of tree.children(dirPath)) {
32
+ const fullPath = (0, node_path_1.join)(dirPath, child);
33
+ if (ig?.ignores(fullPath)) {
34
+ continue;
35
+ }
36
+ if (tree.isFile(fullPath)) {
37
+ visitor(fullPath);
38
+ }
39
+ else {
40
+ visitNotIgnoredFiles(tree, fullPath, visitor);
41
+ }
42
+ }
43
+ }
44
+ exports.visitNotIgnoredFiles = visitNotIgnoredFiles;
45
+ // Copied from devkit
46
+ function normalizePathRelativeToRoot(path, root) {
47
+ return (0, node_path_1.relative)(root, (0, node_path_1.join)(root, path)).split(node_path_1.sep).join('/');
48
+ }
@@ -0,0 +1,2 @@
1
+ import type { Tree } from '../../generators/tree';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const update_nxw_1 = require("../../utils/update-nxw");
4
+ async function default_1(tree) {
5
+ (0, update_nxw_1.updateNxw)(tree);
6
+ }
7
+ exports.default = default_1;
@@ -0,0 +1,2 @@
1
+ import { Tree } from '../../generators/tree';
2
+ export default function migrate(tree: Tree): void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const nx_json_1 = require("../../generators/utils/nx-json");
4
+ function migrate(tree) {
5
+ const nxJson = (0, nx_json_1.readNxJson)(tree);
6
+ nxJson.useInferencePlugins = false;
7
+ (0, nx_json_1.updateNxJson)(tree, nxJson);
8
+ }
9
+ exports.default = migrate;
@@ -3,6 +3,12 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
+ export class ExternalObject<T> {
7
+ readonly '': {
8
+ readonly '': unique symbol
9
+ [K: symbol]: T
10
+ }
11
+ }
6
12
  /**
7
13
  * Expands the given entries into a list of existing directories and files.
8
14
  * This is used for copying outputs to and from the cache
@@ -17,8 +23,12 @@ export function remove(src: string): void
17
23
  export function copy(src: string, dest: string): void
18
24
  export function hashArray(input: Array<string>): string
19
25
  export function hashFile(file: string): string | null
20
- export function hashFiles(workspaceRoot: string): Record<string, string>
21
26
  export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
27
+ /**
28
+ * Transfer the project graph from the JS world to the Rust world, so that we can pass the project graph via memory quicker
29
+ * This wont be needed once the project graph is created in Rust
30
+ */
31
+ export function transferProjectGraph(projectGraph: ProjectGraph): ExternalObject<ProjectGraph>
22
32
  export interface ExternalNodeData {
23
33
  version: string
24
34
  hash?: string
@@ -31,6 +41,8 @@ export interface Target {
31
41
  executor?: string
32
42
  inputs?: Array<JsInputs>
33
43
  outputs?: Array<string>
44
+ options?: string
45
+ configurations?: string
34
46
  }
35
47
  export interface Project {
36
48
  root: string
@@ -43,6 +55,13 @@ export interface ProjectGraph {
43
55
  dependencies: Record<string, Array<string>>
44
56
  externalNodes: Record<string, ExternalNode>
45
57
  }
58
+ export interface HashDetails {
59
+ value: string
60
+ details: Record<string, string>
61
+ }
62
+ export interface HasherOptions {
63
+ selectivelyHashTsConfig: boolean
64
+ }
46
65
  export interface Task {
47
66
  id: string
48
67
  target: TaskTarget
@@ -87,7 +106,6 @@ export interface DepsOutputsInput {
87
106
  /** Stripped version of the NxJson interface for use in rust */
88
107
  export interface NxJson {
89
108
  namedInputs?: Record<string, Array<JsInputs>>
90
- targetDefaults?: Record<string, Target>
91
109
  }
92
110
  export const enum EventType {
93
111
  delete = 'delete',
@@ -103,32 +121,62 @@ export const enum WorkspaceErrors {
103
121
  ParseError = 'ParseError',
104
122
  Generic = 'Generic'
105
123
  }
106
- export interface ConfigurationParserResult {
107
- projectNodes: Record<string, object>
108
- externalNodes: Record<string, object>
109
- }
110
124
  export interface NxWorkspaceFiles {
111
- projectFileMap: Record<string, Array<FileData>>
125
+ projectFileMap: ProjectFiles
112
126
  globalFiles: Array<FileData>
113
- projectConfigurations: Record<string, object>
114
- externalNodes: Record<string, object>
127
+ externalReferences?: NxWorkspaceFilesExternals
128
+ }
129
+ export interface NxWorkspaceFilesExternals {
130
+ projectFiles: ExternalObject<ProjectFiles>
131
+ globalFiles: ExternalObject<Array<FileData>>
132
+ allWorkspaceFiles: ExternalObject<Array<FileData>>
115
133
  }
134
+ export interface UpdatedWorkspaceFiles {
135
+ fileMap: FileMap
136
+ externalReferences: NxWorkspaceFilesExternals
137
+ }
138
+ export interface FileMap {
139
+ projectFileMap: ProjectFiles
140
+ nonProjectFiles: Array<FileData>
141
+ }
142
+ export function testOnlyTransferFileMap(projectFiles: Record<string, Array<FileData>>, nonProjectFiles: Array<FileData>): NxWorkspaceFilesExternals
116
143
  export class ImportResult {
117
144
  file: string
118
145
  sourceProject: string
119
146
  dynamicImportExpressions: Array<string>
120
147
  staticImportExpressions: Array<string>
121
148
  }
149
+ export class ChildProcess {
150
+ kill(): void
151
+ onExit(callback: (message: string) => void): void
152
+ onOutput(callback: (message: string) => void): void
153
+ }
154
+ export class RustPseudoTerminal {
155
+ constructor()
156
+ runCommand(command: string, commandDir?: string | undefined | null, jsEnv?: Record<string, string> | undefined | null, quiet?: boolean | undefined | null): ChildProcess
157
+ /**
158
+ * This allows us to run a pseudoterminal with a fake node ipc channel
159
+ * this makes it possible to be backwards compatible with the old implementation
160
+ */
161
+ fork(id: string, forkScript: string, pseudoIpcPath: string, commandDir: string | undefined | null, jsEnv: Record<string, string> | undefined | null, quiet: boolean): ChildProcess
162
+ }
122
163
  export class HashPlanner {
123
- constructor(workspaceRoot: string, nxJson: NxJson, projectGraph: ProjectGraph)
164
+ constructor(nxJson: NxJson, projectGraph: ExternalObject<ProjectGraph>)
124
165
  getPlans(taskIds: Array<string>, taskGraph: TaskGraph): Record<string, string[]>
125
166
  getPlansReference(taskIds: Array<string>, taskGraph: TaskGraph): JsExternal
126
167
  }
168
+ export class TaskHasher {
169
+ constructor(workspaceRoot: string, projectGraph: ExternalObject<ProjectGraph>, projectFileMap: ExternalObject<ProjectFiles>, allWorkspaceFiles: ExternalObject<Array<FileData>>, tsConfig: Buffer, tsConfigPaths: Record<string, Array<string>>, options?: HasherOptions | undefined | null)
170
+ hashPlans(hashPlans: ExternalObject<Record<string, Array<HashInstruction>>>, jsEnv: Record<string, string>): NapiDashMap
171
+ }
127
172
  export class Watcher {
128
173
  origin: string
129
174
  /**
130
175
  * Creates a new Watcher instance.
131
- * If `useIgnore` is set to false, no ignores will be used, even when `additionalGlobs` is set
176
+ * Will always ignore the following directories:
177
+ * * .git/
178
+ * * node_modules/
179
+ * * .nx/
132
180
  */
133
181
  constructor(origin: string, additionalGlobs?: Array<string> | undefined | null, useIgnore?: boolean | undefined | null)
134
182
  watch(callback: (err: string | null, events: WatchEvent[]) => void): void
@@ -136,10 +184,12 @@ export class Watcher {
136
184
  }
137
185
  export class WorkspaceContext {
138
186
  workspaceRoot: string
139
- constructor(workspaceRoot: string)
140
- getWorkspaceFiles(globs: Array<string>, parseConfigurations: (arg0: Array<string>) => ConfigurationParserResult): NxWorkspaceFiles
141
- glob(globs: Array<string>): Array<string>
142
- getProjectConfigurations(globs: Array<string>, parseConfigurations: (arg0: Array<string>) => ConfigurationParserResult): ConfigurationParserResult
187
+ constructor(workspaceRoot: string, cacheDir: string)
188
+ getWorkspaceFiles(projectRootMap: Record<string, string>): NxWorkspaceFiles
189
+ glob(globs: Array<string>, exclude?: Array<string> | undefined | null): Array<string>
190
+ hashFilesMatchingGlob(globs: Array<string>, exclude?: Array<string> | undefined | null): string
143
191
  incrementalUpdate(updatedFiles: Array<string>, deletedFiles: Array<string>): Record<string, string>
192
+ updateProjectFiles(projectRootMappings: ProjectRootMappings, projectFiles: ExternalObject<ProjectFiles>, globalFiles: ExternalObject<Array<FileData>>, updatedFiles: Record<string, string>, deletedFiles: Array<string>): UpdatedWorkspaceFiles
144
193
  allFileData(): Array<FileData>
194
+ getFilesInDirectory(directory: string): Array<string>
145
195
  }
@@ -246,7 +246,7 @@ if (!nativeBinding) {
246
246
  throw new Error(`Failed to load native binding`)
247
247
  }
248
248
 
249
- const { expandOutputs, getFilesForOutputs, remove, copy, hashArray, hashFile, hashFiles, ImportResult, findImports, HashPlanner, EventType, Watcher, WorkspaceContext, WorkspaceErrors } = nativeBinding
249
+ const { expandOutputs, getFilesForOutputs, remove, copy, hashArray, hashFile, ImportResult, findImports, transferProjectGraph, ChildProcess, RustPseudoTerminal, HashPlanner, TaskHasher, EventType, Watcher, WorkspaceContext, WorkspaceErrors, testOnlyTransferFileMap } = nativeBinding
250
250
 
251
251
  module.exports.expandOutputs = expandOutputs
252
252
  module.exports.getFilesForOutputs = getFilesForOutputs
@@ -254,11 +254,15 @@ module.exports.remove = remove
254
254
  module.exports.copy = copy
255
255
  module.exports.hashArray = hashArray
256
256
  module.exports.hashFile = hashFile
257
- module.exports.hashFiles = hashFiles
258
257
  module.exports.ImportResult = ImportResult
259
258
  module.exports.findImports = findImports
259
+ module.exports.transferProjectGraph = transferProjectGraph
260
+ module.exports.ChildProcess = ChildProcess
261
+ module.exports.RustPseudoTerminal = RustPseudoTerminal
260
262
  module.exports.HashPlanner = HashPlanner
263
+ module.exports.TaskHasher = TaskHasher
261
264
  module.exports.EventType = EventType
262
265
  module.exports.Watcher = Watcher
263
266
  module.exports.WorkspaceContext = WorkspaceContext
264
267
  module.exports.WorkspaceErrors = WorkspaceErrors
268
+ module.exports.testOnlyTransferFileMap = testOnlyTransferFileMap
@@ -12,6 +12,8 @@ function transformProjectGraphForRust(graph) {
12
12
  executor: targetConfig.executor,
13
13
  inputs: targetConfig.inputs,
14
14
  outputs: targetConfig.outputs,
15
+ options: JSON.stringify(targetConfig.options),
16
+ configurations: JSON.stringify(targetConfig.configurations),
15
17
  };
16
18
  }
17
19
  nodes[projectName] = {
@@ -2,6 +2,7 @@ import { Tree } from '../../../generators/tree';
2
2
  interface ConnectToNxCloudOptions {
3
3
  analytics: boolean;
4
4
  installationSource: string;
5
+ hideFormatLogs?: boolean;
5
6
  }
6
7
  export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<() => void>;
7
8
  export default connectToNxCloud;
@@ -57,25 +57,24 @@ async function createNxCloudWorkspace(workspaceName, installationSource, nxInitD
57
57
  return response.data;
58
58
  }
59
59
  function printSuccessMessage(url) {
60
- let host = 'nx.app';
60
+ let origin = 'https://nx.app';
61
61
  try {
62
- host = new node_url_1.URL(url).host;
62
+ origin = new node_url_1.URL(url).origin;
63
63
  }
64
64
  catch (e) { }
65
65
  output_1.output.note({
66
- title: `Distributed caching via Nx Cloud has been enabled`,
66
+ title: `Your Nx Cloud workspace is public`,
67
67
  bodyLines: [
68
- `In addition to the caching, Nx Cloud provides config-free distributed execution,`,
69
- `UI for viewing complex runs and GitHub integration. Learn more at https://nx.app`,
70
- ``,
71
- `Your workspace is currently unclaimed. Run details from unclaimed workspaces can be viewed on ${host} by anyone`,
72
- `with the link. Claim your workspace at the following link to restrict access.`,
73
- ``,
74
- `${url}`,
68
+ `To restrict access, connect it to your Nx Cloud account:`,
69
+ `- Push your changes`,
70
+ `- Login at ${origin} to connect your repository`,
75
71
  ],
76
72
  });
77
73
  }
78
74
  function addNxCloudOptionsToNxJson(tree, nxJson, token) {
75
+ nxJson ??= {
76
+ extends: 'nx/presets/npm.json',
77
+ };
79
78
  nxJson.nxCloudAccessToken = token;
80
79
  const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
81
80
  if (overrideUrl) {
@@ -85,7 +84,7 @@ function addNxCloudOptionsToNxJson(tree, nxJson, token) {
85
84
  }
86
85
  async function connectToNxCloud(tree, schema) {
87
86
  const nxJson = (0, nx_json_1.readNxJson)(tree);
88
- if (nxJson.neverConnectToCloud) {
87
+ if (nxJson?.neverConnectToCloud) {
89
88
  return () => {
90
89
  printCloudConnectionDisabledMessage();
91
90
  };
@@ -94,7 +93,9 @@ async function connectToNxCloud(tree, schema) {
94
93
  // TODO: Change to using loading light client when that is enabled by default
95
94
  const r = await createNxCloudWorkspace(getRootPackageName(tree), schema.installationSource, getNxInitDate());
96
95
  addNxCloudOptionsToNxJson(tree, nxJson, r.token);
97
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
96
+ await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
97
+ silent: schema.hideFormatLogs,
98
+ });
98
99
  return () => printSuccessMessage(r.url);
99
100
  }
100
101
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "http://json-schema.org/schema",
2
+ "$schema": "https://json-schema.org/schema",
3
3
  "id": "NxCloudInit",
4
4
  "title": "Add Nx Cloud Configuration to the workspace",
5
5
  "description": "Connect a workspace to Nx Cloud.",
@@ -15,6 +15,11 @@
15
15
  "type": "string",
16
16
  "description": "Name of Nx Cloud installation invoker (ex. user, add-nx-to-monorepo, create-nx-workspace, nx-upgrade",
17
17
  "default": "user"
18
+ },
19
+ "hideFormatLogs": {
20
+ "type": "boolean",
21
+ "description": "Hide formatting logs",
22
+ "x-priority": "internal"
18
23
  }
19
24
  },
20
25
  "additionalProperties": false,
@@ -211,7 +211,8 @@ async function downloadAndExtractClientBundle(axios, runnerBundleInstallDirector
211
211
  const outputFilePath = (0, path_1.join)(bundleExtractLocation, headers.name);
212
212
  const writeStream = (0, fs_1.createWriteStream)(outputFilePath);
213
213
  stream.pipe(writeStream);
214
- stream.on('end', function () {
214
+ // Continue the tar stream after the write stream closes
215
+ writeStream.on('close', () => {
215
216
  next();
216
217
  });
217
218
  stream.resume();
@@ -1,4 +1,4 @@
1
1
  import { CreateDependencies, CreateNodes } from '../../utils/nx-plugin';
2
- export declare const name = "nx-js-graph-plugin";
2
+ export declare const name = "nx/js/dependencies-and-lockfile";
3
3
  export declare const createNodes: CreateNodes;
4
4
  export declare const createDependencies: CreateDependencies;
@@ -14,7 +14,7 @@ const file_hasher_1 = require("../../hasher/file-hasher");
14
14
  const package_manager_1 = require("../../utils/package-manager");
15
15
  const workspace_root_1 = require("../../utils/workspace-root");
16
16
  const versions_1 = require("../../utils/versions");
17
- exports.name = 'nx-js-graph-plugin';
17
+ exports.name = 'nx/js/dependencies-and-lockfile';
18
18
  let parsedLockFile = {};
19
19
  exports.createNodes = [
20
20
  // Look for all lockfiles
@@ -39,7 +39,7 @@ exports.createNodes = [
39
39
  externalNodes: nodes,
40
40
  };
41
41
  }
42
- const externalNodes = (0, lock_file_1.getLockFileNodes)(packageManager, lockFileContents, lockFileHash);
42
+ const externalNodes = (0, lock_file_1.getLockFileNodes)(packageManager, lockFileContents, lockFileHash, context);
43
43
  parsedLockFile.externalNodes = externalNodes;
44
44
  return {
45
45
  externalNodes,
@@ -53,7 +53,7 @@ const createDependencies = (_, ctx) => {
53
53
  // lockfile may not exist yet
54
54
  if (pluginConfig.analyzeLockfile &&
55
55
  (0, lock_file_1.lockFileExists)(packageManager) &&
56
- parsedLockFile) {
56
+ parsedLockFile.externalNodes) {
57
57
  const lockFilePath = (0, path_1.join)(workspace_root_1.workspaceRoot, (0, lock_file_1.getLockFileName)(packageManager));
58
58
  const lockFileContents = (0, fs_1.readFileSync)(lockFilePath).toString();
59
59
  const lockFileHash = getLockFileHash(lockFileContents);
@@ -6,12 +6,12 @@ import { PackageManager } from '../../../utils/package-manager';
6
6
  import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
7
7
  import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
8
8
  import { PackageJson } from '../../../utils/package-json';
9
- import { CreateDependenciesContext } from '../../../utils/nx-plugin';
9
+ import { CreateDependenciesContext, CreateNodesContext } from '../../../utils/nx-plugin';
10
10
  export declare const LOCKFILES: string[];
11
11
  /**
12
12
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
13
13
  */
14
- export declare function getLockFileNodes(packageManager: PackageManager, contents: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
14
+ export declare function getLockFileNodes(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateNodesContext): Record<string, ProjectGraphExternalNode>;
15
15
  /**
16
16
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
17
17
  */
@@ -26,10 +26,10 @@ const PNPM_LOCK_PATH = (0, path_1.join)(workspace_root_1.workspaceRoot, PNPM_LOC
26
26
  /**
27
27
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
28
28
  */
29
- function getLockFileNodes(packageManager, contents, lockFileHash) {
29
+ function getLockFileNodes(packageManager, contents, lockFileHash, context) {
30
30
  try {
31
31
  if (packageManager === 'yarn') {
32
- const packageJson = (0, fileutils_1.readJsonFile)('package.json');
32
+ const packageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, 'package.json'));
33
33
  return (0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson);
34
34
  }
35
35
  if (packageManager === 'pnpm') {
@@ -109,6 +109,18 @@ function getLockFileName(packageManager) {
109
109
  throw new Error(`Unknown package manager: ${packageManager}`);
110
110
  }
111
111
  exports.getLockFileName = getLockFileName;
112
+ function getLockFilePath(packageManager) {
113
+ if (packageManager === 'yarn') {
114
+ return YARN_LOCK_PATH;
115
+ }
116
+ if (packageManager === 'pnpm') {
117
+ return PNPM_LOCK_PATH;
118
+ }
119
+ if (packageManager === 'npm') {
120
+ return NPM_LOCK_PATH;
121
+ }
122
+ throw new Error(`Unknown package manager: ${packageManager}`);
123
+ }
112
124
  /**
113
125
  * Create lock file based on the root level lock file and (pruned) package.json
114
126
  *
@@ -119,7 +131,7 @@ exports.getLockFileName = getLockFileName;
119
131
  */
120
132
  function createLockFile(packageJson, graph, packageManager = (0, package_manager_1.detectPackageManager)(workspace_root_1.workspaceRoot)) {
121
133
  const normalizedPackageJson = (0, package_json_1.normalizePackageJson)(packageJson);
122
- const content = (0, fs_1.readFileSync)(getLockFileName(packageManager), 'utf8');
134
+ const content = (0, fs_1.readFileSync)(getLockFilePath(packageManager), 'utf8');
123
135
  try {
124
136
  if (packageManager === 'yarn') {
125
137
  const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
@@ -6,10 +6,10 @@ const object_sort_1 = require("../../../utils/object-sort");
6
6
  const project_graph_1 = require("../../../config/project-graph");
7
7
  const fs_1 = require("fs");
8
8
  const workspace_root_1 = require("../../../utils/workspace-root");
9
- const task_hasher_1 = require("../../../hasher/task-hasher");
10
9
  const configuration_1 = require("../../../config/configuration");
11
10
  const nx_deps_cache_1 = require("../../../project-graph/nx-deps-cache");
12
11
  const path_1 = require("path");
12
+ const task_hasher_1 = require("../../../hasher/task-hasher");
13
13
  /**
14
14
  * Creates a package.json in the output directory for support to install dependencies within containers.
15
15
  *
@@ -1,6 +1,6 @@
1
1
  import type { Scanner } from 'typescript';
2
2
  /**
3
- * @deprecated This is deprecated and will be removed in Nx 18.
3
+ * @deprecated This is deprecated and will be removed in Nx 19.
4
4
  * This was not intended to be exposed.
5
5
  * Please talk to us if you need this.
6
6
  */
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stripSourceCode = void 0;
4
4
  let SyntaxKind;
5
5
  /**
6
- * @deprecated This is deprecated and will be removed in Nx 18.
6
+ * @deprecated This is deprecated and will be removed in Nx 19.
7
7
  * This was not intended to be exposed.
8
8
  * Please talk to us if you need this.
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import { DependencyType } from '../../../../config/project-graph';
2
2
  /**
3
- * @deprecated This is deprecated and will be removed in Nx 18.
3
+ * @deprecated This is deprecated and will be removed in Nx 19.
4
4
  * This was not intended to be exposed.
5
5
  * Please talk to us if you need this.
6
6
  */
@@ -7,7 +7,7 @@ const file_utils_1 = require("../../../../project-graph/file-utils");
7
7
  const strip_source_code_1 = require("./strip-source-code");
8
8
  let tsModule;
9
9
  /**
10
- * @deprecated This is deprecated and will be removed in Nx 18.
10
+ * @deprecated This is deprecated and will be removed in Nx 19.
11
11
  * This was not intended to be exposed.
12
12
  * Please talk to us if you need this.
13
13
  */
@@ -19,7 +19,7 @@ export declare function registerTsProject(tsConfigPath: string): () => void;
19
19
  * workspace path mapping will not, for example).
20
20
  *
21
21
  * @returns cleanup function
22
- * @deprecated This signature will be removed in Nx v18. You should pass the full path to the tsconfig in the first argument.
22
+ * @deprecated This signature will be removed in Nx v19. You should pass the full path to the tsconfig in the first argument.
23
23
  */
24
24
  export declare function registerTsProject(path: string, configFilename: string): any;
25
25
  export declare function getSwcTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;