@convesoft/nx-rust 0.0.0 → 1.0.0-rc.2

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 (418) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/PLUGIN.md +106 -0
  4. package/README.md +51 -1
  5. package/docs/artifacts.mara.md +374 -0
  6. package/docs/caching.mara.md +999 -0
  7. package/docs/ci.mara.md +308 -0
  8. package/docs/configuration.mara.md +508 -0
  9. package/docs/decisions.mara.md +3267 -0
  10. package/docs/execution.mara.md +533 -0
  11. package/docs/index.mara.md +51 -0
  12. package/docs/product.mara.md +366 -0
  13. package/docs/release.mara.md +493 -0
  14. package/docs/setup.mara.md +486 -0
  15. package/docs/targets.mara.md +704 -0
  16. package/docs/testing.mara.md +431 -0
  17. package/docs/verification.mara.md +465 -0
  18. package/docs/workspaces.mara.md +445 -0
  19. package/executors.json +35 -0
  20. package/generators.json +19 -0
  21. package/package.json +17 -4
  22. package/src/cargo/build-settings.d.ts +61 -0
  23. package/src/cargo/build-settings.js +103 -0
  24. package/src/cargo/build-settings.js.map +1 -0
  25. package/src/cargo/configured-runner.d.ts +36 -0
  26. package/src/cargo/configured-runner.js +99 -0
  27. package/src/cargo/configured-runner.js.map +1 -0
  28. package/src/cargo/configured-tools.d.ts +35 -0
  29. package/src/cargo/configured-tools.js +46 -0
  30. package/src/cargo/configured-tools.js.map +1 -0
  31. package/src/cargo/dep-info-basedir.d.ts +18 -0
  32. package/src/cargo/dep-info-basedir.js +38 -0
  33. package/src/cargo/dep-info-basedir.js.map +1 -0
  34. package/src/cargo/directories.d.ts +40 -0
  35. package/src/cargo/directories.js +89 -0
  36. package/src/cargo/directories.js.map +1 -0
  37. package/src/cargo/host-triple.d.ts +7 -0
  38. package/src/cargo/host-triple.js +21 -0
  39. package/src/cargo/host-triple.js.map +1 -0
  40. package/src/cargo/lockfile.d.ts +63 -0
  41. package/src/cargo/lockfile.js +157 -0
  42. package/src/cargo/lockfile.js.map +1 -0
  43. package/src/cargo/metadata.d.ts +114 -0
  44. package/src/cargo/metadata.js +37 -0
  45. package/src/cargo/metadata.js.map +1 -0
  46. package/src/cargo/package-specs.d.ts +54 -0
  47. package/src/cargo/package-specs.js +109 -0
  48. package/src/cargo/package-specs.js.map +1 -0
  49. package/src/cargo/paths-crates.d.ts +27 -0
  50. package/src/cargo/paths-crates.js +69 -0
  51. package/src/cargo/paths-crates.js.map +1 -0
  52. package/src/cargo/print-artifact-folders.d.ts +1 -0
  53. package/src/cargo/print-artifact-folders.js +58 -0
  54. package/src/cargo/print-artifact-folders.js.map +1 -0
  55. package/src/cargo/redirections.d.ts +90 -0
  56. package/src/cargo/redirections.js +200 -0
  57. package/src/cargo/redirections.js.map +1 -0
  58. package/src/cargo/run-cargo.d.ts +31 -0
  59. package/src/cargo/run-cargo.js +75 -0
  60. package/src/cargo/run-cargo.js.map +1 -0
  61. package/src/cargo/target-triples.d.ts +98 -0
  62. package/src/cargo/target-triples.js +265 -0
  63. package/src/cargo/target-triples.js.map +1 -0
  64. package/src/cargo/version-req.d.ts +12 -0
  65. package/src/cargo/version-req.js +122 -0
  66. package/src/cargo/version-req.js.map +1 -0
  67. package/src/cargo/warnings-setting.d.ts +24 -0
  68. package/src/cargo/warnings-setting.js +81 -0
  69. package/src/cargo/warnings-setting.js.map +1 -0
  70. package/src/compatibility/cargo-version.d.ts +43 -0
  71. package/src/compatibility/cargo-version.js +83 -0
  72. package/src/compatibility/cargo-version.js.map +1 -0
  73. package/src/compatibility/nx-bridge.d.ts +312 -0
  74. package/src/compatibility/nx-bridge.js +407 -0
  75. package/src/compatibility/nx-bridge.js.map +1 -0
  76. package/src/compatibility/nx-version.d.ts +104 -0
  77. package/src/compatibility/nx-version.js +272 -0
  78. package/src/compatibility/nx-version.js.map +1 -0
  79. package/src/executors/affected-inputs.d.ts +29 -0
  80. package/src/executors/affected-inputs.js +259 -0
  81. package/src/executors/affected-inputs.js.map +1 -0
  82. package/src/executors/affected-run.d.ts +54 -0
  83. package/src/executors/affected-run.js +394 -0
  84. package/src/executors/affected-run.js.map +1 -0
  85. package/src/executors/affected.d.ts +239 -0
  86. package/src/executors/affected.js +589 -0
  87. package/src/executors/affected.js.map +1 -0
  88. package/src/executors/baseline-context.d.ts +85 -0
  89. package/src/executors/baseline-context.js +227 -0
  90. package/src/executors/baseline-context.js.map +1 -0
  91. package/src/executors/baseline.d.ts +123 -0
  92. package/src/executors/baseline.js +356 -0
  93. package/src/executors/baseline.js.map +1 -0
  94. package/src/executors/batch.d.ts +75 -0
  95. package/src/executors/batch.js +434 -0
  96. package/src/executors/batch.js.map +1 -0
  97. package/src/executors/build-records.d.ts +110 -0
  98. package/src/executors/build-records.js +267 -0
  99. package/src/executors/build-records.js.map +1 -0
  100. package/src/executors/cargo/executor.d.ts +28 -0
  101. package/src/executors/cargo/executor.js +58 -0
  102. package/src/executors/cargo/executor.js.map +1 -0
  103. package/src/executors/cargo/schema.json +58 -0
  104. package/src/executors/cargo-invocation.d.ts +81 -0
  105. package/src/executors/cargo-invocation.js +109 -0
  106. package/src/executors/cargo-invocation.js.map +1 -0
  107. package/src/executors/cargo-output.d.ts +218 -0
  108. package/src/executors/cargo-output.js +660 -0
  109. package/src/executors/cargo-output.js.map +1 -0
  110. package/src/executors/command.d.ts +331 -0
  111. package/src/executors/command.js +547 -0
  112. package/src/executors/command.js.map +1 -0
  113. package/src/executors/coverage-baseline.d.ts +23 -0
  114. package/src/executors/coverage-baseline.js +284 -0
  115. package/src/executors/coverage-baseline.js.map +1 -0
  116. package/src/executors/declared-options.d.ts +21 -0
  117. package/src/executors/declared-options.js +58 -0
  118. package/src/executors/declared-options.js.map +1 -0
  119. package/src/executors/denied-warnings.d.ts +99 -0
  120. package/src/executors/denied-warnings.js +188 -0
  121. package/src/executors/denied-warnings.js.map +1 -0
  122. package/src/executors/digests.d.ts +94 -0
  123. package/src/executors/digests.js +190 -0
  124. package/src/executors/digests.js.map +1 -0
  125. package/src/executors/dotenv-check.d.ts +79 -0
  126. package/src/executors/dotenv-check.js +553 -0
  127. package/src/executors/dotenv-check.js.map +1 -0
  128. package/src/executors/group-invocations.d.ts +80 -0
  129. package/src/executors/group-invocations.js +253 -0
  130. package/src/executors/group-invocations.js.map +1 -0
  131. package/src/executors/group-run.d.ts +114 -0
  132. package/src/executors/group-run.js +601 -0
  133. package/src/executors/group-run.js.map +1 -0
  134. package/src/executors/groups.d.ts +118 -0
  135. package/src/executors/groups.js +304 -0
  136. package/src/executors/groups.js.map +1 -0
  137. package/src/executors/input-check.d.ts +52 -0
  138. package/src/executors/input-check.js +271 -0
  139. package/src/executors/input-check.js.map +1 -0
  140. package/src/executors/kept-files.d.ts +98 -0
  141. package/src/executors/kept-files.js +341 -0
  142. package/src/executors/kept-files.js.map +1 -0
  143. package/src/executors/lockfile/executor.d.ts +16 -0
  144. package/src/executors/lockfile/executor.js +37 -0
  145. package/src/executors/lockfile/executor.js.map +1 -0
  146. package/src/executors/lockfile/schema.json +50 -0
  147. package/src/executors/napi-build.d.ts +73 -0
  148. package/src/executors/napi-build.js +420 -0
  149. package/src/executors/napi-build.js.map +1 -0
  150. package/src/executors/nextest.d.ts +189 -0
  151. package/src/executors/nextest.js +504 -0
  152. package/src/executors/nextest.js.map +1 -0
  153. package/src/executors/nx-command.d.ts +95 -0
  154. package/src/executors/nx-command.js +205 -0
  155. package/src/executors/nx-command.js.map +1 -0
  156. package/src/executors/nx-task-files.d.ts +82 -0
  157. package/src/executors/nx-task-files.js +156 -0
  158. package/src/executors/nx-task-files.js.map +1 -0
  159. package/src/executors/print-test-mode.d.ts +1 -0
  160. package/src/executors/print-test-mode.js +25 -0
  161. package/src/executors/print-test-mode.js.map +1 -0
  162. package/src/executors/release-publish/executor.d.ts +24 -0
  163. package/src/executors/release-publish/executor.js +165 -0
  164. package/src/executors/release-publish/executor.js.map +1 -0
  165. package/src/executors/release-publish/schema.json +30 -0
  166. package/src/executors/run/executor.d.ts +12 -0
  167. package/src/executors/run/executor.js +27 -0
  168. package/src/executors/run/executor.js.map +1 -0
  169. package/src/executors/run/schema.json +45 -0
  170. package/src/executors/runner-script.d.ts +12 -0
  171. package/src/executors/runner-script.js +22 -0
  172. package/src/executors/runner-script.js.map +1 -0
  173. package/src/executors/runtime-input-check.d.ts +24 -0
  174. package/src/executors/runtime-input-check.js +87 -0
  175. package/src/executors/runtime-input-check.js.map +1 -0
  176. package/src/executors/shared-artifacts.d.ts +44 -0
  177. package/src/executors/shared-artifacts.js +132 -0
  178. package/src/executors/shared-artifacts.js.map +1 -0
  179. package/src/executors/split-words.d.ts +24 -0
  180. package/src/executors/split-words.js +111 -0
  181. package/src/executors/split-words.js.map +1 -0
  182. package/src/executors/stage.d.ts +163 -0
  183. package/src/executors/stage.js +526 -0
  184. package/src/executors/stage.js.map +1 -0
  185. package/src/executors/staged-run.d.ts +24 -0
  186. package/src/executors/staged-run.js +110 -0
  187. package/src/executors/staged-run.js.map +1 -0
  188. package/src/executors/task-env.d.ts +271 -0
  189. package/src/executors/task-env.js +494 -0
  190. package/src/executors/task-env.js.map +1 -0
  191. package/src/executors/task-execution.d.ts +61 -0
  192. package/src/executors/task-execution.js +122 -0
  193. package/src/executors/task-execution.js.map +1 -0
  194. package/src/executors/task-guards.d.ts +112 -0
  195. package/src/executors/task-guards.js +435 -0
  196. package/src/executors/task-guards.js.map +1 -0
  197. package/src/executors/task-options.d.ts +114 -0
  198. package/src/executors/task-options.js +258 -0
  199. package/src/executors/task-options.js.map +1 -0
  200. package/src/executors/task.d.ts +166 -0
  201. package/src/executors/task.js +527 -0
  202. package/src/executors/task.js.map +1 -0
  203. package/src/executors/test-mode.d.ts +185 -0
  204. package/src/executors/test-mode.js +397 -0
  205. package/src/executors/test-mode.js.map +1 -0
  206. package/src/executors/test-runner.d.ts +44 -0
  207. package/src/executors/test-runner.js +159 -0
  208. package/src/executors/test-runner.js.map +1 -0
  209. package/src/executors/test-steps.d.ts +121 -0
  210. package/src/executors/test-steps.js +566 -0
  211. package/src/executors/test-steps.js.map +1 -0
  212. package/src/executors/wasm-build.d.ts +56 -0
  213. package/src/executors/wasm-build.js +216 -0
  214. package/src/executors/wasm-build.js.map +1 -0
  215. package/src/generators/crate/binary.schema.json +28 -0
  216. package/src/generators/crate/crate.d.ts +24 -0
  217. package/src/generators/crate/crate.js +108 -0
  218. package/src/generators/crate/crate.js.map +1 -0
  219. package/src/generators/crate/enclosing-workspace.d.ts +25 -0
  220. package/src/generators/crate/enclosing-workspace.js +58 -0
  221. package/src/generators/crate/enclosing-workspace.js.map +1 -0
  222. package/src/generators/crate/library.schema.json +28 -0
  223. package/src/generators/init/graph-check.d.ts +81 -0
  224. package/src/generators/init/graph-check.js +299 -0
  225. package/src/generators/init/graph-check.js.map +1 -0
  226. package/src/generators/init/init.d.ts +23 -0
  227. package/src/generators/init/init.js +113 -0
  228. package/src/generators/init/init.js.map +1 -0
  229. package/src/generators/init/report.d.ts +19 -0
  230. package/src/generators/init/report.js +93 -0
  231. package/src/generators/init/report.js.map +1 -0
  232. package/src/generators/init/schema.json +9 -0
  233. package/src/graph/artifact-kinds.d.ts +29 -0
  234. package/src/graph/artifact-kinds.js +50 -0
  235. package/src/graph/artifact-kinds.js.map +1 -0
  236. package/src/graph/artifact-names.d.ts +97 -0
  237. package/src/graph/artifact-names.js +276 -0
  238. package/src/graph/artifact-names.js.map +1 -0
  239. package/src/graph/build-records.d.ts +74 -0
  240. package/src/graph/build-records.js +104 -0
  241. package/src/graph/build-records.js.map +1 -0
  242. package/src/graph/caching.d.ts +148 -0
  243. package/src/graph/caching.js +681 -0
  244. package/src/graph/caching.js.map +1 -0
  245. package/src/graph/clippy-input.d.ts +53 -0
  246. package/src/graph/clippy-input.js +107 -0
  247. package/src/graph/clippy-input.js.map +1 -0
  248. package/src/graph/collisions.d.ts +113 -0
  249. package/src/graph/collisions.js +156 -0
  250. package/src/graph/collisions.js.map +1 -0
  251. package/src/graph/computation-reports.d.ts +89 -0
  252. package/src/graph/computation-reports.js +216 -0
  253. package/src/graph/computation-reports.js.map +1 -0
  254. package/src/graph/declared-files.d.ts +190 -0
  255. package/src/graph/declared-files.js +600 -0
  256. package/src/graph/declared-files.js.map +1 -0
  257. package/src/graph/discovery.d.ts +190 -0
  258. package/src/graph/discovery.js +661 -0
  259. package/src/graph/discovery.js.map +1 -0
  260. package/src/graph/edges.d.ts +25 -0
  261. package/src/graph/edges.js +94 -0
  262. package/src/graph/edges.js.map +1 -0
  263. package/src/graph/entries.d.ts +83 -0
  264. package/src/graph/entries.js +259 -0
  265. package/src/graph/entries.js.map +1 -0
  266. package/src/graph/inputs.d.ts +422 -0
  267. package/src/graph/inputs.js +756 -0
  268. package/src/graph/inputs.js.map +1 -0
  269. package/src/graph/lockfile-task.d.ts +74 -0
  270. package/src/graph/lockfile-task.js +105 -0
  271. package/src/graph/lockfile-task.js.map +1 -0
  272. package/src/graph/names.d.ts +41 -0
  273. package/src/graph/names.js +34 -0
  274. package/src/graph/names.js.map +1 -0
  275. package/src/graph/napi.d.ts +107 -0
  276. package/src/graph/napi.js +206 -0
  277. package/src/graph/napi.js.map +1 -0
  278. package/src/graph/nx-glob.d.ts +36 -0
  279. package/src/graph/nx-glob.js +152 -0
  280. package/src/graph/nx-glob.js.map +1 -0
  281. package/src/graph/nx-internals.d.ts +57 -0
  282. package/src/graph/nx-internals.js +128 -0
  283. package/src/graph/nx-internals.js.map +1 -0
  284. package/src/graph/options.d.ts +32 -0
  285. package/src/graph/options.js +80 -0
  286. package/src/graph/options.js.map +1 -0
  287. package/src/graph/outputs.d.ts +75 -0
  288. package/src/graph/outputs.js +140 -0
  289. package/src/graph/outputs.js.map +1 -0
  290. package/src/graph/path-dependencies.d.ts +122 -0
  291. package/src/graph/path-dependencies.js +459 -0
  292. package/src/graph/path-dependencies.js.map +1 -0
  293. package/src/graph/plugin-package.d.ts +36 -0
  294. package/src/graph/plugin-package.js +132 -0
  295. package/src/graph/plugin-package.js.map +1 -0
  296. package/src/graph/plugin-version.d.ts +20 -0
  297. package/src/graph/plugin-version.js +153 -0
  298. package/src/graph/plugin-version.js.map +1 -0
  299. package/src/graph/projects.d.ts +141 -0
  300. package/src/graph/projects.js +193 -0
  301. package/src/graph/projects.js.map +1 -0
  302. package/src/graph/reached-projects.d.ts +46 -0
  303. package/src/graph/reached-projects.js +102 -0
  304. package/src/graph/reached-projects.js.map +1 -0
  305. package/src/graph/real-path.d.ts +47 -0
  306. package/src/graph/real-path.js +113 -0
  307. package/src/graph/real-path.js.map +1 -0
  308. package/src/graph/redirected-uses.d.ts +98 -0
  309. package/src/graph/redirected-uses.js +434 -0
  310. package/src/graph/redirected-uses.js.map +1 -0
  311. package/src/graph/registration.d.ts +121 -0
  312. package/src/graph/registration.js +233 -0
  313. package/src/graph/registration.js.map +1 -0
  314. package/src/graph/rustfmt-config.d.ts +42 -0
  315. package/src/graph/rustfmt-config.js +173 -0
  316. package/src/graph/rustfmt-config.js.map +1 -0
  317. package/src/graph/script-input.d.ts +46 -0
  318. package/src/graph/script-input.js +65 -0
  319. package/src/graph/script-input.js.map +1 -0
  320. package/src/graph/settings.d.ts +178 -0
  321. package/src/graph/settings.js +479 -0
  322. package/src/graph/settings.js.map +1 -0
  323. package/src/graph/target-defaults-causes.d.ts +33 -0
  324. package/src/graph/target-defaults-causes.js +202 -0
  325. package/src/graph/target-defaults-causes.js.map +1 -0
  326. package/src/graph/target-defaults-layers.d.ts +186 -0
  327. package/src/graph/target-defaults-layers.js +420 -0
  328. package/src/graph/target-defaults-layers.js.map +1 -0
  329. package/src/graph/target-defaults-meaning.d.ts +95 -0
  330. package/src/graph/target-defaults-meaning.js +292 -0
  331. package/src/graph/target-defaults-meaning.js.map +1 -0
  332. package/src/graph/target-defaults-report.d.ts +77 -0
  333. package/src/graph/target-defaults-report.js +242 -0
  334. package/src/graph/target-defaults-report.js.map +1 -0
  335. package/src/graph/target-defaults.d.ts +79 -0
  336. package/src/graph/target-defaults.js +425 -0
  337. package/src/graph/target-defaults.js.map +1 -0
  338. package/src/graph/target-fields.d.ts +16 -0
  339. package/src/graph/target-fields.js +134 -0
  340. package/src/graph/target-fields.js.map +1 -0
  341. package/src/graph/target-tables.d.ts +45 -0
  342. package/src/graph/target-tables.js +299 -0
  343. package/src/graph/target-tables.js.map +1 -0
  344. package/src/graph/targets.d.ts +371 -0
  345. package/src/graph/targets.js +408 -0
  346. package/src/graph/targets.js.map +1 -0
  347. package/src/graph/unification.d.ts +141 -0
  348. package/src/graph/unification.js +459 -0
  349. package/src/graph/unification.js.map +1 -0
  350. package/src/graph/unignored-directories.d.ts +25 -0
  351. package/src/graph/unignored-directories.js +89 -0
  352. package/src/graph/unignored-directories.js.map +1 -0
  353. package/src/graph/visibility.d.ts +17 -0
  354. package/src/graph/visibility.js +67 -0
  355. package/src/graph/visibility.js.map +1 -0
  356. package/src/graph/warnings.d.ts +38 -0
  357. package/src/graph/warnings.js +77 -0
  358. package/src/graph/warnings.js.map +1 -0
  359. package/src/graph/wasm.d.ts +56 -0
  360. package/src/graph/wasm.js +77 -0
  361. package/src/graph/wasm.js.map +1 -0
  362. package/src/index.d.ts +68 -0
  363. package/src/index.js +109 -0
  364. package/src/index.js.map +1 -0
  365. package/src/release/manifests.d.ts +95 -0
  366. package/src/release/manifests.js +164 -0
  367. package/src/release/manifests.js.map +1 -0
  368. package/src/release/places.d.ts +127 -0
  369. package/src/release/places.js +368 -0
  370. package/src/release/places.js.map +1 -0
  371. package/src/release/publish-cargo.d.ts +177 -0
  372. package/src/release/publish-cargo.js +351 -0
  373. package/src/release/publish-cargo.js.map +1 -0
  374. package/src/release/publish-crates.d.ts +124 -0
  375. package/src/release/publish-crates.js +242 -0
  376. package/src/release/publish-crates.js.map +1 -0
  377. package/src/release/publish-environments.d.ts +50 -0
  378. package/src/release/publish-environments.js +284 -0
  379. package/src/release/publish-environments.js.map +1 -0
  380. package/src/release/publish-messages.d.ts +66 -0
  381. package/src/release/publish-messages.js +273 -0
  382. package/src/release/publish-messages.js.map +1 -0
  383. package/src/release/publish-registry.d.ts +27 -0
  384. package/src/release/publish-registry.js +135 -0
  385. package/src/release/publish-registry.js.map +1 -0
  386. package/src/release/publish-settings.d.ts +26 -0
  387. package/src/release/publish-settings.js +56 -0
  388. package/src/release/publish-settings.js.map +1 -0
  389. package/src/release/publish.d.ts +59 -0
  390. package/src/release/publish.js +620 -0
  391. package/src/release/publish.js.map +1 -0
  392. package/src/release/repository.d.ts +73 -0
  393. package/src/release/repository.js +219 -0
  394. package/src/release/repository.js.map +1 -0
  395. package/src/release/requirements.d.ts +34 -0
  396. package/src/release/requirements.js +30 -0
  397. package/src/release/requirements.js.map +1 -0
  398. package/src/release/toml-edit.d.ts +67 -0
  399. package/src/release/toml-edit.js +453 -0
  400. package/src/release/toml-edit.js.map +1 -0
  401. package/src/release/version-actions.d.ts +133 -0
  402. package/src/release/version-actions.js +474 -0
  403. package/src/release/version-actions.js.map +1 -0
  404. package/src/release/version-checks.d.ts +21 -0
  405. package/src/release/version-checks.js +151 -0
  406. package/src/release/version-checks.js.map +1 -0
  407. package/src/release/version-lockfiles.d.ts +61 -0
  408. package/src/release/version-lockfiles.js +222 -0
  409. package/src/release/version-lockfiles.js.map +1 -0
  410. package/src/tools/napi-cli.d.ts +70 -0
  411. package/src/tools/napi-cli.js +63 -0
  412. package/src/tools/napi-cli.js.map +1 -0
  413. package/src/tools/optional-tools.d.ts +121 -0
  414. package/src/tools/optional-tools.js +303 -0
  415. package/src/tools/optional-tools.js.map +1 -0
  416. package/src/tools/print-napi-cli.d.ts +1 -0
  417. package/src/tools/print-napi-cli.js +24 -0
  418. package/src/tools/print-napi-cli.js.map +1 -0
@@ -0,0 +1,81 @@
1
+ import type { NxJsonConfiguration, PluginConfiguration } from "@nx/devkit";
2
+ import type { CargoWorkspace } from "../../graph/discovery";
3
+ import type { FeatureUnification } from "../../graph/settings";
4
+ /** The name under which `nx.json` lists the plugin. */
5
+ export declare const pluginName = "@convesoft/nx-rust";
6
+ /** What graph creation found with the plugin's entries in `nx.json`. */
7
+ export interface GraphCheck {
8
+ /**
9
+ * The `Cargo.toml` files that Nx sees in the repository, relative to its
10
+ * root, before the entries' `include` and `exclude` apply.
11
+ */
12
+ manifests: string[];
13
+ /** The Cargo workspaces the entries found, each once, in the order they were found. */
14
+ workspaces: CargoWorkspace[];
15
+ /**
16
+ * The roots of the workspaces whose settings choose the nextest runner
17
+ * (`testRunner`), relative to the repository root.
18
+ */
19
+ nextestWorkspaces?: string[];
20
+ /**
21
+ * The roots of the workspaces whose settings turn on the selection of
22
+ * affected tests (`affectedTests`), relative to the repository root.
23
+ */
24
+ affectedTestsWorkspaces?: string[];
25
+ /**
26
+ * The feature-unification strategy that graph creation chose for each of
27
+ * them, by the workspace's root folder (`DES-UNIFICATION`).
28
+ */
29
+ strategies?: ReadonlyMap<string, FeatureUnification>;
30
+ }
31
+ /** Graph creation would fail with the plugin's entries in `nx.json`. */
32
+ export declare class GraphCheckError extends Error {
33
+ /** The errors that Nx reports for graph creation, each as Nx words it. */
34
+ readonly errors: string[];
35
+ constructor(
36
+ /** The errors that Nx reports for graph creation, each as Nx words it. */
37
+ errors: string[]);
38
+ }
39
+ /**
40
+ * The installed Nx lacks the internal parts of Nx through which the check
41
+ * runs graph creation, or they work differently from what the check expects.
42
+ */
43
+ export declare class UnsupportedNxError extends Error {
44
+ /** The version of the installed Nx, if it could be read. */
45
+ readonly nxVersion: string | undefined;
46
+ /** What is missing or different. */
47
+ readonly detail: string;
48
+ constructor(
49
+ /** The version of the installed Nx, if it could be read. */
50
+ nxVersion: string | undefined,
51
+ /** What is missing or different. */
52
+ detail: string);
53
+ }
54
+ /** Whether a `plugins` entry of `nx.json` is one of this plugin. */
55
+ export declare function isPluginEntry(entry: PluginConfiguration): boolean;
56
+ /**
57
+ * Creates the project graph as Nx would with `nxJson`, as far as the
58
+ * plugin's checks need it, without writing anything, and returns what the
59
+ * plugin found.
60
+ *
61
+ * First it checks the installed Nx as the plugin does when it loads. Then
62
+ * each entry of the plugin in `nxJson.plugins` runs the plugin's own
63
+ * `createNodes` through Nx's project-configuration step, together with the
64
+ * other plugins that `nxJson` lists and Nx's default plugins, in the order
65
+ * graph creation runs them. Nx hands each entry the `Cargo.toml` files of
66
+ * its workspace context that the entry's `include` and `exclude` let
67
+ * through, and merges the projects of all plugins, as graph creation does.
68
+ * Each entry's `createDependencies` then runs on the merged projects and
69
+ * the repository's files. Every check that graph creation makes in the
70
+ * plugin therefore runs here too, and the warnings it prints are printed
71
+ * again. Nx's project-configuration step and plugin loader are not part of
72
+ * its public API: the end-to-end suite checks them on each supported Nx
73
+ * major (`REQ-COMPATIBILITY`).
74
+ *
75
+ * @param nxJson `nx.json` as it would be, with the plugin's entries.
76
+ * @param workspaceRoot The absolute path of the repository root.
77
+ * @throws {GraphCheckError} When graph creation would fail.
78
+ * @throws {UnsupportedNxError} When the installed Nx lacks those internal
79
+ * parts, or they return something the check cannot read.
80
+ */
81
+ export declare function checkGraphCreation(nxJson: NxJsonConfiguration, workspaceRoot: string): Promise<GraphCheck>;
@@ -0,0 +1,299 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedNxError = exports.GraphCheckError = exports.pluginName = void 0;
4
+ exports.isPluginEntry = isPluginEntry;
5
+ exports.checkGraphCreation = checkGraphCreation;
6
+ const tslib_1 = require("tslib");
7
+ const node_path_1 = require("node:path");
8
+ const nx_bridge_1 = require("../../compatibility/nx-bridge");
9
+ const nx_version_1 = require("../../compatibility/nx-version");
10
+ const registration_1 = require("../../graph/registration");
11
+ const plugin = require("../../index");
12
+ /** The name under which `nx.json` lists the plugin. */
13
+ exports.pluginName = "@convesoft/nx-rust";
14
+ /** Graph creation would fail with the plugin's entries in `nx.json`. */
15
+ class GraphCheckError extends Error {
16
+ constructor(
17
+ /** The errors that Nx reports for graph creation, each as Nx words it. */
18
+ errors) {
19
+ super(errors.join("\n\n"));
20
+ this.errors = errors;
21
+ this.name = "GraphCheckError";
22
+ }
23
+ }
24
+ exports.GraphCheckError = GraphCheckError;
25
+ /**
26
+ * The installed Nx lacks the internal parts of Nx through which the check
27
+ * runs graph creation, or they work differently from what the check expects.
28
+ */
29
+ class UnsupportedNxError extends Error {
30
+ constructor(
31
+ /** The version of the installed Nx, if it could be read. */
32
+ nxVersion,
33
+ /** What is missing or different. */
34
+ detail) {
35
+ const nx = nxVersion === undefined ? "the installed Nx" : `the installed Nx ${nxVersion}`;
36
+ super([
37
+ `nx-rust cannot check this repository with ${nx}: ${detail}.`,
38
+ `This version of ${exports.pluginName} supports ${(0, nx_version_1.describeNxMajors)((0, nx_version_1.supportedNxMajors)())}. It runs the checks of graph creation through parts of Nx that are not public API, and ${nx} does not have them in the form it expects.`,
39
+ `Use a supported Nx version, or a version of ${exports.pluginName} that supports ${nx}.`,
40
+ ].join("\n"));
41
+ this.nxVersion = nxVersion;
42
+ this.detail = detail;
43
+ this.name = "UnsupportedNxError";
44
+ }
45
+ }
46
+ exports.UnsupportedNxError = UnsupportedNxError;
47
+ /** Whether a `plugins` entry of `nx.json` is one of this plugin. */
48
+ function isPluginEntry(entry) {
49
+ return (typeof entry === "string" ? entry : entry.plugin) === exports.pluginName;
50
+ }
51
+ /**
52
+ * Creates the project graph as Nx would with `nxJson`, as far as the
53
+ * plugin's checks need it, without writing anything, and returns what the
54
+ * plugin found.
55
+ *
56
+ * First it checks the installed Nx as the plugin does when it loads. Then
57
+ * each entry of the plugin in `nxJson.plugins` runs the plugin's own
58
+ * `createNodes` through Nx's project-configuration step, together with the
59
+ * other plugins that `nxJson` lists and Nx's default plugins, in the order
60
+ * graph creation runs them. Nx hands each entry the `Cargo.toml` files of
61
+ * its workspace context that the entry's `include` and `exclude` let
62
+ * through, and merges the projects of all plugins, as graph creation does.
63
+ * Each entry's `createDependencies` then runs on the merged projects and
64
+ * the repository's files. Every check that graph creation makes in the
65
+ * plugin therefore runs here too, and the warnings it prints are printed
66
+ * again. Nx's project-configuration step and plugin loader are not part of
67
+ * its public API: the end-to-end suite checks them on each supported Nx
68
+ * major (`REQ-COMPATIBILITY`).
69
+ *
70
+ * @param nxJson `nx.json` as it would be, with the plugin's entries.
71
+ * @param workspaceRoot The absolute path of the repository root.
72
+ * @throws {GraphCheckError} When graph creation would fail.
73
+ * @throws {UnsupportedNxError} When the installed Nx lacks those internal
74
+ * parts, or they return something the check cannot read.
75
+ */
76
+ // @mara implements DES-GENERATORS
77
+ // @mara implements DES-DIAGNOSTICS
78
+ function checkGraphCreation(nxJson, workspaceRoot) {
79
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
80
+ var _a, _b, _c, _d, _e;
81
+ let verdict;
82
+ try {
83
+ verdict = (0, nx_version_1.nxVerdictFor)(workspaceRoot, process.env);
84
+ }
85
+ catch (error) {
86
+ // The version of the installed Nx cannot be read: loading the plugin
87
+ // fails with this message as well.
88
+ throw new GraphCheckError([error instanceof Error ? error.message : String(error)]);
89
+ }
90
+ if (verdict.kind === "error") {
91
+ throw new GraphCheckError([verdict.message]);
92
+ }
93
+ const nx = nxInternals(workspaceRoot);
94
+ const plugins = (_a = nxJson.plugins) !== null && _a !== void 0 ? _a : [];
95
+ // Nx copies the plugin module once per entry, so that each entry gets a
96
+ // registration of its own (index.ts); the copies here do the same.
97
+ const entries = plugins.flatMap((entry, index) => isPluginEntry(entry) ? [{ entry, index, copy: Object.assign(Object.assign({}, plugin), { name: exports.pluginName }) }] : []);
98
+ const loaded = new Map(entries.map(({ entry, index, copy }) => [index, new nx.LoadedNxPlugin(copy, entry, index)]));
99
+ const others = yield loadOtherPlugins(nx, nxJson, workspaceRoot);
100
+ const otherSpecified = [...others.specifiedPlugins];
101
+ const specifiedPlugins = plugins.map((_entry, index) => { var _a; return (_a = loaded.get(index)) !== null && _a !== void 0 ? _a : otherSpecified.shift(); });
102
+ const errors = [];
103
+ const result = yield whileCreatingGraph(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
104
+ try {
105
+ return yield nx.retrieveProjectConfigurations({ specifiedPlugins, defaultPlugins: others.defaultPlugins }, workspaceRoot, nxJson);
106
+ }
107
+ catch (error) {
108
+ if (nx.isProjectConfigurationsError(error)) {
109
+ errors.push(...errorMessages(error));
110
+ return error.partialProjectConfigurationsResult;
111
+ }
112
+ throw error;
113
+ }
114
+ }));
115
+ const configurations = readConfigurations(result, workspaceRoot);
116
+ const context = yield dependenciesContext(nx, configurations, nxJson, workspaceRoot);
117
+ for (const [, loadedEntry] of [...loaded].sort(([a], [b]) => a - b)) {
118
+ try {
119
+ yield ((_b = loadedEntry.createDependencies) === null || _b === void 0 ? void 0 : _b.call(loadedEntry, context));
120
+ }
121
+ catch (cause) {
122
+ errors.push(dependenciesErrorMessage(nx, exports.pluginName, cause));
123
+ }
124
+ }
125
+ if (errors.length > 0) {
126
+ throw new GraphCheckError(errors);
127
+ }
128
+ const workspaces = new Map();
129
+ const nextestWorkspaces = new Set();
130
+ const affectedTestsWorkspaces = new Set();
131
+ const strategies = new Map();
132
+ for (const { copy } of entries) {
133
+ const graph = (0, registration_1.registrationOf)(copy).graphForDependencies(workspaceRoot);
134
+ for (const workspace of (_c = graph === null || graph === void 0 ? void 0 : graph.discovery.workspaces) !== null && _c !== void 0 ? _c : []) {
135
+ if (!workspaces.has(workspace.root)) {
136
+ workspaces.set(workspace.root, workspace);
137
+ const strategy = (_d = graph === null || graph === void 0 ? void 0 : graph.strategies) === null || _d === void 0 ? void 0 : _d.get(workspace.root);
138
+ if (strategy !== undefined) {
139
+ strategies.set(workspace.root, strategy.featureUnification);
140
+ }
141
+ }
142
+ }
143
+ for (const project of (_e = graph === null || graph === void 0 ? void 0 : graph.projects) !== null && _e !== void 0 ? _e : []) {
144
+ if (project.settings.workspace.testRunner === "nextest") {
145
+ nextestWorkspaces.add(project.workspace.root);
146
+ }
147
+ if (project.settings.workspace.affectedTests) {
148
+ affectedTestsWorkspaces.add(project.workspace.root);
149
+ }
150
+ }
151
+ }
152
+ return {
153
+ manifests: [
154
+ ...new Set(configurations.matchingProjectFiles.filter((file) => (0, node_path_1.basename)(file) === "Cargo.toml")),
155
+ ].sort(),
156
+ workspaces: [...workspaces.values()],
157
+ nextestWorkspaces: [...nextestWorkspaces].sort(),
158
+ affectedTestsWorkspaces: [...affectedTestsWorkspaces].sort(),
159
+ strategies,
160
+ };
161
+ });
162
+ }
163
+ /**
164
+ * Nx's internals from the Nx installed in the repository, which is the Nx
165
+ * that runs the generator, after checking that each part the check uses is
166
+ * there and is what the check calls: a constructor or a function.
167
+ *
168
+ * @throws {UnsupportedNxError} When a part is missing or of another kind.
169
+ */
170
+ function nxInternals(workspaceRoot) {
171
+ const version = (0, nx_bridge_1.readNxPackageVersion)(workspaceRoot);
172
+ try {
173
+ const devkit = (0, nx_bridge_1.loadDevkitInternals)(workspaceRoot, ["LoadedNxPlugin", "retrieveProjectConfigurations", "isProjectConfigurationsError"], { optional: ["ProcessDependenciesError"] });
174
+ const { getPluginsSeparated } = (0, nx_bridge_1.loadGetPlugins)(workspaceRoot);
175
+ const { retrieveWorkspaceFiles } = (0, nx_bridge_1.loadRetrieveWorkspaceFiles)(workspaceRoot, [
176
+ "retrieveWorkspaceFiles",
177
+ ]);
178
+ return Object.assign(Object.assign({ version, LoadedNxPlugin: devkit.LoadedNxPlugin, retrieveProjectConfigurations: devkit.retrieveProjectConfigurations, isProjectConfigurationsError: devkit.isProjectConfigurationsError }, (devkit.ProcessDependenciesError === undefined
179
+ ? {}
180
+ : { ProcessDependenciesError: devkit.ProcessDependenciesError })), { getPluginsSeparated,
181
+ retrieveWorkspaceFiles });
182
+ }
183
+ catch (error) {
184
+ if (error instanceof nx_bridge_1.NxBridgeError) {
185
+ const detail = error.failure.kind === "load"
186
+ ? `${error.failure.module} could not be loaded (${error.failure.fullReason})`
187
+ : error.message;
188
+ throw new UnsupportedNxError(version, detail);
189
+ }
190
+ throw error;
191
+ }
192
+ }
193
+ // The plugins of `nx.json` other than this one's entries, and Nx's default
194
+ // plugins, loaded the way graph creation loads them. A plugin that fails to
195
+ // load fails graph creation as well.
196
+ function loadOtherPlugins(nx, nxJson, workspaceRoot) {
197
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
198
+ var _a;
199
+ const otherEntries = ((_a = nxJson.plugins) !== null && _a !== void 0 ? _a : []).filter((entry) => !isPluginEntry(entry));
200
+ let separated;
201
+ try {
202
+ separated = yield nx.getPluginsSeparated(Object.assign(Object.assign({}, nxJson), { plugins: otherEntries }), workspaceRoot);
203
+ }
204
+ catch (error) {
205
+ throw new GraphCheckError([error instanceof Error ? error.message : String(error)]);
206
+ }
207
+ const { specifiedPlugins, defaultPlugins } = (separated !== null && separated !== void 0 ? separated : {});
208
+ if (!Array.isArray(specifiedPlugins) ||
209
+ !Array.isArray(defaultPlugins) ||
210
+ specifiedPlugins.length !== otherEntries.length) {
211
+ throw new UnsupportedNxError(nx.version, "the result of getPluginsSeparated from nx/src/project-graph/plugins/get-plugins is not one specified plugin per entry and a list of default plugins");
212
+ }
213
+ return { specifiedPlugins, defaultPlugins };
214
+ });
215
+ }
216
+ function readConfigurations(result, workspaceRoot) {
217
+ var _a;
218
+ const value = (result !== null && result !== void 0 ? result : {});
219
+ const isRecord = (x) => typeof x === "object" && x !== null && !Array.isArray(x);
220
+ if (!Array.isArray(value.matchingProjectFiles) ||
221
+ !value.matchingProjectFiles.every((file) => typeof file === "string")) {
222
+ throw new UnsupportedNxError((0, nx_bridge_1.readNxPackageVersion)(workspaceRoot), "the result of retrieveProjectConfigurations from nx/src/devkit-internals has no matchingProjectFiles list of file paths");
223
+ }
224
+ if (!isRecord(value.projects) || !isRecord(value.projectRootMap)) {
225
+ throw new UnsupportedNxError((0, nx_bridge_1.readNxPackageVersion)(workspaceRoot), "the result of retrieveProjectConfigurations from nx/src/devkit-internals has no projects and projectRootMap by project root");
226
+ }
227
+ return {
228
+ projects: value.projects,
229
+ projectRootMap: value.projectRootMap,
230
+ externalNodes: (_a = value.externalNodes) !== null && _a !== void 0 ? _a : {},
231
+ matchingProjectFiles: value.matchingProjectFiles,
232
+ };
233
+ }
234
+ // What graph creation hands `createDependencies`: the merged projects by
235
+ // name, which keeps the last of several projects that share one, and the
236
+ // files of the repository by project.
237
+ function dependenciesContext(nx, configurations, nxJson, workspaceRoot) {
238
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
239
+ const projects = {};
240
+ for (const project of Object.values(configurations.projects)) {
241
+ projects[project.name] = project;
242
+ }
243
+ const files = (yield nx.retrieveWorkspaceFiles(workspaceRoot, configurations.projectRootMap));
244
+ const fileMap = files === null || files === void 0 ? void 0 : files.fileMap;
245
+ if (typeof (fileMap === null || fileMap === void 0 ? void 0 : fileMap.projectFileMap) !== "object" ||
246
+ fileMap.projectFileMap === null ||
247
+ !Array.isArray(fileMap.nonProjectFiles)) {
248
+ throw new UnsupportedNxError(nx.version, "the result of retrieveWorkspaceFiles from nx/src/project-graph/utils/retrieve-workspace-files has no fileMap with projectFileMap and nonProjectFiles");
249
+ }
250
+ return {
251
+ nxJsonConfiguration: nxJson,
252
+ projects,
253
+ externalNodes: configurations.externalNodes,
254
+ workspaceRoot,
255
+ fileMap,
256
+ filesToProcess: fileMap,
257
+ };
258
+ });
259
+ }
260
+ // Runs `create` as graph creation runs plugins, with the flag that Nx sets
261
+ // while it creates the graph.
262
+ function whileCreatingGraph(create) {
263
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
264
+ const graphCreation = globalThis;
265
+ const wasCreating = graphCreation.NX_GRAPH_CREATION;
266
+ graphCreation.NX_GRAPH_CREATION = true;
267
+ try {
268
+ return yield create();
269
+ }
270
+ finally {
271
+ if (wasCreating === undefined) {
272
+ delete graphCreation.NX_GRAPH_CREATION;
273
+ }
274
+ else {
275
+ graphCreation.NX_GRAPH_CREATION = wasCreating;
276
+ }
277
+ }
278
+ });
279
+ }
280
+ // The messages of the errors that Nx collected for graph creation, or the
281
+ // message of the error itself where it holds no list of them.
282
+ function errorMessages(error) {
283
+ var _a;
284
+ const messages = Array.isArray(error.errors)
285
+ ? error.errors.map((e) => e === null || e === void 0 ? void 0 : e.message)
286
+ : [];
287
+ return messages.length > 0 && messages.every((message) => typeof message === "string")
288
+ ? messages
289
+ : [String((_a = error.message) !== null && _a !== void 0 ? _a : error)];
290
+ }
291
+ // The message with which graph creation reports an error of
292
+ // `createDependencies`.
293
+ function dependenciesErrorMessage(nx, name, cause) {
294
+ const error = cause instanceof Error ? cause : new Error(String(cause));
295
+ return nx.ProcessDependenciesError === undefined
296
+ ? `The "${name}" plugin threw an error while creating dependencies: ${error.message}`
297
+ : new nx.ProcessDependenciesError(name, { cause: error }).message;
298
+ }
299
+ //# sourceMappingURL=graph-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-check.js","sourceRoot":"","sources":["../../../../../nx-rust/src/generators/init/graph-check.ts"],"names":[],"mappings":";;;AAoFA,sCAEC;AA6BD,gDA+FC;;AA5MD,yCAAqC;AACrC,6DAMuC;AACvC,+DAAmG;AAGnG,2DAA0D;AAC1D,sCAAuC;AAEvC,uDAAuD;AAC1C,QAAA,UAAU,GAAG,oBAAoB,CAAC;AA4B/C,wEAAwE;AACxE,MAAa,eAAgB,SAAQ,KAAK;IACxC;IACE,0EAA0E;IACjE,MAAgB;QAEzB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAFlB,WAAM,GAAN,MAAM,CAAU;QAGzB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AARD,0CAQC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAC3C;IACE,4DAA4D;IACnD,SAA6B;IACtC,oCAAoC;IAC3B,MAAc;QAEvB,MAAM,EAAE,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,SAAS,EAAE,CAAC;QAC1F,KAAK,CACH;YACE,6CAA6C,EAAE,KAAK,MAAM,GAAG;YAC7D,mBAAmB,kBAAU,aAAa,IAAA,6BAAgB,EAAC,IAAA,8BAAiB,GAAE,CAAC,2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,0EAA0E;AAC1E,8DAA8D;AAC9D,SAAS,aAAa,CAAC,KAA8C;;IACnE,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1C,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAA+B,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,OAAO,CAAC;QACnE,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC;QACpF,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,CAAC,MAAM,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,4DAA4D;AAC5D,wBAAwB;AACxB,SAAS,wBAAwB,CAAC,EAAe,EAAE,IAAY,EAAE,KAAc;IAC7E,MAAM,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS;QAC9C,CAAC,CAAC,QAAQ,IAAI,wDAAwD,KAAK,CAAC,OAAO,EAAE;QACrF,CAAC,CAAC,IAAI,EAAE,CAAC,wBAAwB,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Tree } from "@nx/devkit";
2
+ /** The options of `init`, which has none of its own. */
3
+ export type InitGeneratorSchema = Record<string, never>;
4
+ /**
5
+ * The executors of the plugin's targets, each of which gets an empty
6
+ * `targetDefaults` entry where `nx.json` has none for it.
7
+ */
8
+ export declare const shieldedExecutors: string[];
9
+ /**
10
+ * The generator that `nx add @convesoft/nx-rust` runs once Nx has installed
11
+ * the package. It checks the repository the way graph creation will once
12
+ * the plugin is registered, registers the plugin in `nx.json`, adds an empty
13
+ * `targetDefaults` entry for each of {@link shieldedExecutors} that is
14
+ * missing, and reports. These are its only changes; an entry that is there
15
+ * already, a plugin entry with its options included, stays as it is.
16
+ *
17
+ * @throws {Error} When graph creation would fail with the plugin, before
18
+ * anything is written.
19
+ */
20
+ export declare function initGenerator(tree: Tree, _options: InitGeneratorSchema): Promise<void>;
21
+ /** What `init` says about the `targetDefaults` entries it added. */
22
+ export declare function addedEntriesMessage(executors: string[]): string;
23
+ export default initGenerator;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shieldedExecutors = void 0;
4
+ exports.initGenerator = initGenerator;
5
+ exports.addedEntriesMessage = addedEntriesMessage;
6
+ const tslib_1 = require("tslib");
7
+ const devkit_1 = require("@nx/devkit");
8
+ const target_defaults_report_1 = require("../../graph/target-defaults-report");
9
+ const targets_1 = require("../../graph/targets");
10
+ const graph_check_1 = require("./graph-check");
11
+ const report_1 = require("./report");
12
+ /**
13
+ * The executors of the plugin's targets, each of which gets an empty
14
+ * `targetDefaults` entry where `nx.json` has none for it.
15
+ */
16
+ exports.shieldedExecutors = [
17
+ targets_1.cargoExecutor,
18
+ targets_1.cargoOutputsExecutor,
19
+ targets_1.runExecutor,
20
+ targets_1.lockfileExecutor,
21
+ targets_1.releasePublishExecutor,
22
+ ];
23
+ /**
24
+ * The generator that `nx add @convesoft/nx-rust` runs once Nx has installed
25
+ * the package. It checks the repository the way graph creation will once
26
+ * the plugin is registered, registers the plugin in `nx.json`, adds an empty
27
+ * `targetDefaults` entry for each of {@link shieldedExecutors} that is
28
+ * missing, and reports. These are its only changes; an entry that is there
29
+ * already, a plugin entry with its options included, stays as it is.
30
+ *
31
+ * @throws {Error} When graph creation would fail with the plugin, before
32
+ * anything is written.
33
+ */
34
+ // @mara implements DES-GENERATORS
35
+ function initGenerator(tree, _options) {
36
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
+ var _a, _b, _c;
38
+ const nxJson = (_a = (0, devkit_1.readNxJson)(tree)) !== null && _a !== void 0 ? _a : {};
39
+ const registered = ((_b = nxJson.plugins) !== null && _b !== void 0 ? _b : []).some(graph_check_1.isPluginEntry);
40
+ const plugins = registered ? nxJson.plugins : [...((_c = nxJson.plugins) !== null && _c !== void 0 ? _c : []), graph_check_1.pluginName];
41
+ const missing = exports.shieldedExecutors.filter((executor) => { var _a; return !Object.prototype.hasOwnProperty.call((_a = nxJson.targetDefaults) !== null && _a !== void 0 ? _a : {}, executor); });
42
+ const targetDefaults = missing.length === 0
43
+ ? nxJson.targetDefaults
44
+ : Object.assign(Object.assign({}, nxJson.targetDefaults), Object.fromEntries(missing.map((executor) => [executor, {}])));
45
+ // 1. Check, on nx.json as it will be.
46
+ let check;
47
+ try {
48
+ check = yield (0, graph_check_1.checkGraphCreation)(Object.assign(Object.assign({}, nxJson), { plugins, targetDefaults }), tree.root);
49
+ }
50
+ catch (error) {
51
+ if (error instanceof graph_check_1.GraphCheckError || error instanceof graph_check_1.UnsupportedNxError) {
52
+ const graph = error instanceof graph_check_1.GraphCheckError;
53
+ throw new Error([
54
+ registered
55
+ ? graph
56
+ ? "Nx cannot create the project graph with nx-rust as nx.json registers it."
57
+ : "nx-rust cannot check the project graph that nx.json registers it for."
58
+ : graph
59
+ ? "nx-rust was not added to nx.json: Nx could not create the project graph with it."
60
+ : "nx-rust was not added to nx.json: it could not check the project graph.",
61
+ "",
62
+ error.message,
63
+ "",
64
+ `nx.json is unchanged. Fix the problem above and run \`nx add ${graph_check_1.pluginName}\` again.`,
65
+ ].join("\n"));
66
+ }
67
+ throw error;
68
+ }
69
+ // 2. Register.
70
+ const changes = Object.assign(Object.assign({}, (registered ? {} : { plugins })), (missing.length === 0 ? {} : { targetDefaults }));
71
+ if (Object.keys(changes).length > 0) {
72
+ write(tree, changes);
73
+ yield (0, devkit_1.formatFiles)(tree);
74
+ }
75
+ // 3. Report.
76
+ if (missing.length > 0) {
77
+ devkit_1.logger.info(addedEntriesMessage(missing));
78
+ }
79
+ const report = (0, report_1.initReport)(check, tree.root, process.env);
80
+ for (const warning of report.warnings) {
81
+ devkit_1.logger.warn(warning);
82
+ }
83
+ for (const info of report.info) {
84
+ devkit_1.logger.info(info);
85
+ }
86
+ });
87
+ }
88
+ /** What `init` says about the `targetDefaults` entries it added. */
89
+ function addedEntriesMessage(executors) {
90
+ const names = list(executors.map((executor) => `"${executor}": {}`));
91
+ return [
92
+ `Added ${names} to targetDefaults in nx.json, keyed by the executors of the targets that nx-rust infers.`,
93
+ `Nx chooses an entry keyed by a target's executor before one keyed by the target's name or a glob, so entries such as "build" or "test" apply to your other projects and not to Rust targets, whose inputs, outputs, caching and dependencies nx-rust declares itself (${target_defaults_report_1.targetDefaultsGuide}).`,
94
+ ].join("\n");
95
+ }
96
+ // "a", "a and b", "a, b and c"
97
+ function list(items) {
98
+ return items.length <= 1
99
+ ? items.join("")
100
+ : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
101
+ }
102
+ // Writes `changes` into nx.json, leaving its other keys as they are. Where
103
+ // nx.json extends another file and only that file has a key, the combined
104
+ // value goes into nx.json, which is what Nx reads then.
105
+ function write(tree, changes) {
106
+ if (!tree.exists("nx.json")) {
107
+ (0, devkit_1.writeJson)(tree, "nx.json", changes);
108
+ return;
109
+ }
110
+ (0, devkit_1.updateJson)(tree, "nx.json", (json) => (Object.assign(Object.assign({}, json), changes)));
111
+ }
112
+ exports.default = initGenerator;
113
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../nx-rust/src/generators/init/init.ts"],"names":[],"mappings":";;;AAqDA,sCA8DC;AAGD,kDAMC;;AA5HD,uCAQoB;AACpB,+EAAyE;AACzE,iDAM6B;AAC7B,+CAMuB;AACvB,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AAC,CAAC;AACxF,CAAC;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { OptionalTool } from "../../tools/optional-tools";
2
+ import type { GraphCheck } from "./graph-check";
3
+ /** What `init` prints after the check, by severity. */
4
+ export interface InitReport {
5
+ warnings: string[];
6
+ info: string[];
7
+ }
8
+ /** The `build.build-dir` setting that the caching guidance suggests. */
9
+ export declare const suggestedBuildDirSetting: string[];
10
+ /**
11
+ * The report of step 3 of `init`: the tools of the table that are missing,
12
+ * as warnings where the configuration needs them and on one line otherwise,
13
+ * the workspaces whose build directory lies inside the repository, and how
14
+ * to create a crate where there is none. The warnings that graph creation
15
+ * gives are printed by the check itself.
16
+ *
17
+ * @param env The environment whose `PATH` and `CARGO_HOME` say where tools are installed.
18
+ */
19
+ export declare function initReport(check: GraphCheck, workspaceRoot: string, env: NodeJS.ProcessEnv, tools?: readonly OptionalTool[]): InitReport;