@convesoft/nx-rust 0.0.0-stage → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +48 -2
  4. package/executors.json +35 -0
  5. package/generators.json +19 -0
  6. package/package.json +26 -4
  7. package/src/cargo/build-settings.d.ts +54 -0
  8. package/src/cargo/build-settings.js +93 -0
  9. package/src/cargo/build-settings.js.map +1 -0
  10. package/src/cargo/configured-runner.d.ts +36 -0
  11. package/src/cargo/configured-runner.js +99 -0
  12. package/src/cargo/configured-runner.js.map +1 -0
  13. package/src/cargo/configured-tools.d.ts +35 -0
  14. package/src/cargo/configured-tools.js +46 -0
  15. package/src/cargo/configured-tools.js.map +1 -0
  16. package/src/cargo/dep-info-basedir.d.ts +18 -0
  17. package/src/cargo/dep-info-basedir.js +38 -0
  18. package/src/cargo/dep-info-basedir.js.map +1 -0
  19. package/src/cargo/directories.d.ts +40 -0
  20. package/src/cargo/directories.js +89 -0
  21. package/src/cargo/directories.js.map +1 -0
  22. package/src/cargo/host-triple.d.ts +7 -0
  23. package/src/cargo/host-triple.js +21 -0
  24. package/src/cargo/host-triple.js.map +1 -0
  25. package/src/cargo/lockfile.d.ts +63 -0
  26. package/src/cargo/lockfile.js +157 -0
  27. package/src/cargo/lockfile.js.map +1 -0
  28. package/src/cargo/metadata.d.ts +112 -0
  29. package/src/cargo/metadata.js +37 -0
  30. package/src/cargo/metadata.js.map +1 -0
  31. package/src/cargo/package-specs.d.ts +54 -0
  32. package/src/cargo/package-specs.js +109 -0
  33. package/src/cargo/package-specs.js.map +1 -0
  34. package/src/cargo/paths-crates.d.ts +27 -0
  35. package/src/cargo/paths-crates.js +69 -0
  36. package/src/cargo/paths-crates.js.map +1 -0
  37. package/src/cargo/print-artifact-folders.d.ts +1 -0
  38. package/src/cargo/print-artifact-folders.js +58 -0
  39. package/src/cargo/print-artifact-folders.js.map +1 -0
  40. package/src/cargo/redirections.d.ts +87 -0
  41. package/src/cargo/redirections.js +195 -0
  42. package/src/cargo/redirections.js.map +1 -0
  43. package/src/cargo/run-cargo.d.ts +31 -0
  44. package/src/cargo/run-cargo.js +75 -0
  45. package/src/cargo/run-cargo.js.map +1 -0
  46. package/src/cargo/target-triples.d.ts +98 -0
  47. package/src/cargo/target-triples.js +265 -0
  48. package/src/cargo/target-triples.js.map +1 -0
  49. package/src/cargo/version-req.d.ts +12 -0
  50. package/src/cargo/version-req.js +122 -0
  51. package/src/cargo/version-req.js.map +1 -0
  52. package/src/compatibility/cargo-version.d.ts +43 -0
  53. package/src/compatibility/cargo-version.js +83 -0
  54. package/src/compatibility/cargo-version.js.map +1 -0
  55. package/src/compatibility/nx-bridge.d.ts +312 -0
  56. package/src/compatibility/nx-bridge.js +407 -0
  57. package/src/compatibility/nx-bridge.js.map +1 -0
  58. package/src/compatibility/nx-version.d.ts +104 -0
  59. package/src/compatibility/nx-version.js +272 -0
  60. package/src/compatibility/nx-version.js.map +1 -0
  61. package/src/executors/affected-inputs.d.ts +29 -0
  62. package/src/executors/affected-inputs.js +259 -0
  63. package/src/executors/affected-inputs.js.map +1 -0
  64. package/src/executors/affected-run.d.ts +54 -0
  65. package/src/executors/affected-run.js +394 -0
  66. package/src/executors/affected-run.js.map +1 -0
  67. package/src/executors/affected.d.ts +239 -0
  68. package/src/executors/affected.js +589 -0
  69. package/src/executors/affected.js.map +1 -0
  70. package/src/executors/baseline-context.d.ts +85 -0
  71. package/src/executors/baseline-context.js +227 -0
  72. package/src/executors/baseline-context.js.map +1 -0
  73. package/src/executors/baseline.d.ts +123 -0
  74. package/src/executors/baseline.js +356 -0
  75. package/src/executors/baseline.js.map +1 -0
  76. package/src/executors/batch.d.ts +75 -0
  77. package/src/executors/batch.js +434 -0
  78. package/src/executors/batch.js.map +1 -0
  79. package/src/executors/build-records.d.ts +110 -0
  80. package/src/executors/build-records.js +267 -0
  81. package/src/executors/build-records.js.map +1 -0
  82. package/src/executors/cargo/executor.d.ts +28 -0
  83. package/src/executors/cargo/executor.js +58 -0
  84. package/src/executors/cargo/executor.js.map +1 -0
  85. package/src/executors/cargo/schema.json +54 -0
  86. package/src/executors/cargo-invocation.d.ts +81 -0
  87. package/src/executors/cargo-invocation.js +109 -0
  88. package/src/executors/cargo-invocation.js.map +1 -0
  89. package/src/executors/cargo-output.d.ts +212 -0
  90. package/src/executors/cargo-output.js +646 -0
  91. package/src/executors/cargo-output.js.map +1 -0
  92. package/src/executors/command.d.ts +318 -0
  93. package/src/executors/command.js +517 -0
  94. package/src/executors/command.js.map +1 -0
  95. package/src/executors/coverage-baseline.d.ts +23 -0
  96. package/src/executors/coverage-baseline.js +284 -0
  97. package/src/executors/coverage-baseline.js.map +1 -0
  98. package/src/executors/declared-options.d.ts +21 -0
  99. package/src/executors/declared-options.js +58 -0
  100. package/src/executors/declared-options.js.map +1 -0
  101. package/src/executors/digests.d.ts +94 -0
  102. package/src/executors/digests.js +190 -0
  103. package/src/executors/digests.js.map +1 -0
  104. package/src/executors/dotenv-check.d.ts +79 -0
  105. package/src/executors/dotenv-check.js +553 -0
  106. package/src/executors/dotenv-check.js.map +1 -0
  107. package/src/executors/group-invocations.d.ts +80 -0
  108. package/src/executors/group-invocations.js +253 -0
  109. package/src/executors/group-invocations.js.map +1 -0
  110. package/src/executors/group-run.d.ts +114 -0
  111. package/src/executors/group-run.js +591 -0
  112. package/src/executors/group-run.js.map +1 -0
  113. package/src/executors/groups.d.ts +113 -0
  114. package/src/executors/groups.js +285 -0
  115. package/src/executors/groups.js.map +1 -0
  116. package/src/executors/input-check.d.ts +52 -0
  117. package/src/executors/input-check.js +271 -0
  118. package/src/executors/input-check.js.map +1 -0
  119. package/src/executors/kept-files.d.ts +98 -0
  120. package/src/executors/kept-files.js +341 -0
  121. package/src/executors/kept-files.js.map +1 -0
  122. package/src/executors/lockfile/executor.d.ts +16 -0
  123. package/src/executors/lockfile/executor.js +37 -0
  124. package/src/executors/lockfile/executor.js.map +1 -0
  125. package/src/executors/lockfile/schema.json +50 -0
  126. package/src/executors/napi-build.d.ts +73 -0
  127. package/src/executors/napi-build.js +420 -0
  128. package/src/executors/napi-build.js.map +1 -0
  129. package/src/executors/nextest.d.ts +185 -0
  130. package/src/executors/nextest.js +498 -0
  131. package/src/executors/nextest.js.map +1 -0
  132. package/src/executors/nx-command.d.ts +95 -0
  133. package/src/executors/nx-command.js +205 -0
  134. package/src/executors/nx-command.js.map +1 -0
  135. package/src/executors/nx-task-files.d.ts +82 -0
  136. package/src/executors/nx-task-files.js +156 -0
  137. package/src/executors/nx-task-files.js.map +1 -0
  138. package/src/executors/print-test-mode.d.ts +1 -0
  139. package/src/executors/print-test-mode.js +25 -0
  140. package/src/executors/print-test-mode.js.map +1 -0
  141. package/src/executors/release-publish/executor.d.ts +24 -0
  142. package/src/executors/release-publish/executor.js +165 -0
  143. package/src/executors/release-publish/executor.js.map +1 -0
  144. package/src/executors/release-publish/schema.json +30 -0
  145. package/src/executors/run/executor.d.ts +12 -0
  146. package/src/executors/run/executor.js +27 -0
  147. package/src/executors/run/executor.js.map +1 -0
  148. package/src/executors/run/schema.json +45 -0
  149. package/src/executors/runner-script.d.ts +12 -0
  150. package/src/executors/runner-script.js +22 -0
  151. package/src/executors/runner-script.js.map +1 -0
  152. package/src/executors/runtime-input-check.d.ts +24 -0
  153. package/src/executors/runtime-input-check.js +87 -0
  154. package/src/executors/runtime-input-check.js.map +1 -0
  155. package/src/executors/shared-artifacts.d.ts +44 -0
  156. package/src/executors/shared-artifacts.js +132 -0
  157. package/src/executors/shared-artifacts.js.map +1 -0
  158. package/src/executors/split-words.d.ts +24 -0
  159. package/src/executors/split-words.js +111 -0
  160. package/src/executors/split-words.js.map +1 -0
  161. package/src/executors/stage.d.ts +163 -0
  162. package/src/executors/stage.js +526 -0
  163. package/src/executors/stage.js.map +1 -0
  164. package/src/executors/staged-run.d.ts +24 -0
  165. package/src/executors/staged-run.js +110 -0
  166. package/src/executors/staged-run.js.map +1 -0
  167. package/src/executors/task-env.d.ts +271 -0
  168. package/src/executors/task-env.js +494 -0
  169. package/src/executors/task-env.js.map +1 -0
  170. package/src/executors/task-execution.d.ts +61 -0
  171. package/src/executors/task-execution.js +122 -0
  172. package/src/executors/task-execution.js.map +1 -0
  173. package/src/executors/task-guards.d.ts +112 -0
  174. package/src/executors/task-guards.js +430 -0
  175. package/src/executors/task-guards.js.map +1 -0
  176. package/src/executors/task-options.d.ts +114 -0
  177. package/src/executors/task-options.js +258 -0
  178. package/src/executors/task-options.js.map +1 -0
  179. package/src/executors/task.d.ts +166 -0
  180. package/src/executors/task.js +520 -0
  181. package/src/executors/task.js.map +1 -0
  182. package/src/executors/test-mode.d.ts +182 -0
  183. package/src/executors/test-mode.js +391 -0
  184. package/src/executors/test-mode.js.map +1 -0
  185. package/src/executors/test-runner.d.ts +44 -0
  186. package/src/executors/test-runner.js +159 -0
  187. package/src/executors/test-runner.js.map +1 -0
  188. package/src/executors/test-steps.d.ts +109 -0
  189. package/src/executors/test-steps.js +535 -0
  190. package/src/executors/test-steps.js.map +1 -0
  191. package/src/executors/wasm-build.d.ts +56 -0
  192. package/src/executors/wasm-build.js +216 -0
  193. package/src/executors/wasm-build.js.map +1 -0
  194. package/src/generators/crate/binary.schema.json +28 -0
  195. package/src/generators/crate/crate.d.ts +24 -0
  196. package/src/generators/crate/crate.js +108 -0
  197. package/src/generators/crate/crate.js.map +1 -0
  198. package/src/generators/crate/enclosing-workspace.d.ts +25 -0
  199. package/src/generators/crate/enclosing-workspace.js +58 -0
  200. package/src/generators/crate/enclosing-workspace.js.map +1 -0
  201. package/src/generators/crate/library.schema.json +28 -0
  202. package/src/generators/init/graph-check.d.ts +81 -0
  203. package/src/generators/init/graph-check.js +299 -0
  204. package/src/generators/init/graph-check.js.map +1 -0
  205. package/src/generators/init/init.d.ts +23 -0
  206. package/src/generators/init/init.js +113 -0
  207. package/src/generators/init/init.js.map +1 -0
  208. package/src/generators/init/report.d.ts +19 -0
  209. package/src/generators/init/report.js +93 -0
  210. package/src/generators/init/report.js.map +1 -0
  211. package/src/generators/init/schema.json +9 -0
  212. package/src/graph/artifact-kinds.d.ts +29 -0
  213. package/src/graph/artifact-kinds.js +50 -0
  214. package/src/graph/artifact-kinds.js.map +1 -0
  215. package/src/graph/artifact-names.d.ts +97 -0
  216. package/src/graph/artifact-names.js +276 -0
  217. package/src/graph/artifact-names.js.map +1 -0
  218. package/src/graph/build-records.d.ts +74 -0
  219. package/src/graph/build-records.js +104 -0
  220. package/src/graph/build-records.js.map +1 -0
  221. package/src/graph/caching.d.ts +148 -0
  222. package/src/graph/caching.js +676 -0
  223. package/src/graph/caching.js.map +1 -0
  224. package/src/graph/collisions.d.ts +106 -0
  225. package/src/graph/collisions.js +156 -0
  226. package/src/graph/collisions.js.map +1 -0
  227. package/src/graph/computation-reports.d.ts +89 -0
  228. package/src/graph/computation-reports.js +216 -0
  229. package/src/graph/computation-reports.js.map +1 -0
  230. package/src/graph/declared-files.d.ts +190 -0
  231. package/src/graph/declared-files.js +600 -0
  232. package/src/graph/declared-files.js.map +1 -0
  233. package/src/graph/discovery.d.ts +175 -0
  234. package/src/graph/discovery.js +656 -0
  235. package/src/graph/discovery.js.map +1 -0
  236. package/src/graph/edges.d.ts +25 -0
  237. package/src/graph/edges.js +94 -0
  238. package/src/graph/edges.js.map +1 -0
  239. package/src/graph/entries.d.ts +83 -0
  240. package/src/graph/entries.js +259 -0
  241. package/src/graph/entries.js.map +1 -0
  242. package/src/graph/inputs.d.ts +420 -0
  243. package/src/graph/inputs.js +746 -0
  244. package/src/graph/inputs.js.map +1 -0
  245. package/src/graph/lockfile-task.d.ts +74 -0
  246. package/src/graph/lockfile-task.js +105 -0
  247. package/src/graph/lockfile-task.js.map +1 -0
  248. package/src/graph/names.d.ts +41 -0
  249. package/src/graph/names.js +34 -0
  250. package/src/graph/names.js.map +1 -0
  251. package/src/graph/napi.d.ts +107 -0
  252. package/src/graph/napi.js +206 -0
  253. package/src/graph/napi.js.map +1 -0
  254. package/src/graph/nx-glob.d.ts +36 -0
  255. package/src/graph/nx-glob.js +152 -0
  256. package/src/graph/nx-glob.js.map +1 -0
  257. package/src/graph/nx-internals.d.ts +57 -0
  258. package/src/graph/nx-internals.js +128 -0
  259. package/src/graph/nx-internals.js.map +1 -0
  260. package/src/graph/options.d.ts +32 -0
  261. package/src/graph/options.js +80 -0
  262. package/src/graph/options.js.map +1 -0
  263. package/src/graph/outputs.d.ts +75 -0
  264. package/src/graph/outputs.js +140 -0
  265. package/src/graph/outputs.js.map +1 -0
  266. package/src/graph/path-dependencies.d.ts +122 -0
  267. package/src/graph/path-dependencies.js +459 -0
  268. package/src/graph/path-dependencies.js.map +1 -0
  269. package/src/graph/plugin-package.d.ts +36 -0
  270. package/src/graph/plugin-package.js +132 -0
  271. package/src/graph/plugin-package.js.map +1 -0
  272. package/src/graph/plugin-version.d.ts +20 -0
  273. package/src/graph/plugin-version.js +153 -0
  274. package/src/graph/plugin-version.js.map +1 -0
  275. package/src/graph/projects.d.ts +141 -0
  276. package/src/graph/projects.js +182 -0
  277. package/src/graph/projects.js.map +1 -0
  278. package/src/graph/reached-projects.d.ts +46 -0
  279. package/src/graph/reached-projects.js +102 -0
  280. package/src/graph/reached-projects.js.map +1 -0
  281. package/src/graph/real-path.d.ts +47 -0
  282. package/src/graph/real-path.js +113 -0
  283. package/src/graph/real-path.js.map +1 -0
  284. package/src/graph/redirected-uses.d.ts +98 -0
  285. package/src/graph/redirected-uses.js +434 -0
  286. package/src/graph/redirected-uses.js.map +1 -0
  287. package/src/graph/registration.d.ts +121 -0
  288. package/src/graph/registration.js +233 -0
  289. package/src/graph/registration.js.map +1 -0
  290. package/src/graph/script-input.d.ts +46 -0
  291. package/src/graph/script-input.js +65 -0
  292. package/src/graph/script-input.js.map +1 -0
  293. package/src/graph/settings.d.ts +178 -0
  294. package/src/graph/settings.js +479 -0
  295. package/src/graph/settings.js.map +1 -0
  296. package/src/graph/target-defaults-causes.d.ts +33 -0
  297. package/src/graph/target-defaults-causes.js +202 -0
  298. package/src/graph/target-defaults-causes.js.map +1 -0
  299. package/src/graph/target-defaults-layers.d.ts +186 -0
  300. package/src/graph/target-defaults-layers.js +420 -0
  301. package/src/graph/target-defaults-layers.js.map +1 -0
  302. package/src/graph/target-defaults-meaning.d.ts +95 -0
  303. package/src/graph/target-defaults-meaning.js +292 -0
  304. package/src/graph/target-defaults-meaning.js.map +1 -0
  305. package/src/graph/target-defaults-report.d.ts +77 -0
  306. package/src/graph/target-defaults-report.js +242 -0
  307. package/src/graph/target-defaults-report.js.map +1 -0
  308. package/src/graph/target-defaults.d.ts +79 -0
  309. package/src/graph/target-defaults.js +425 -0
  310. package/src/graph/target-defaults.js.map +1 -0
  311. package/src/graph/target-fields.d.ts +16 -0
  312. package/src/graph/target-fields.js +134 -0
  313. package/src/graph/target-fields.js.map +1 -0
  314. package/src/graph/target-tables.d.ts +45 -0
  315. package/src/graph/target-tables.js +299 -0
  316. package/src/graph/target-tables.js.map +1 -0
  317. package/src/graph/targets.d.ts +367 -0
  318. package/src/graph/targets.js +404 -0
  319. package/src/graph/targets.js.map +1 -0
  320. package/src/graph/unification.d.ts +141 -0
  321. package/src/graph/unification.js +459 -0
  322. package/src/graph/unification.js.map +1 -0
  323. package/src/graph/unignored-directories.d.ts +25 -0
  324. package/src/graph/unignored-directories.js +89 -0
  325. package/src/graph/unignored-directories.js.map +1 -0
  326. package/src/graph/visibility.d.ts +17 -0
  327. package/src/graph/visibility.js +67 -0
  328. package/src/graph/visibility.js.map +1 -0
  329. package/src/graph/warnings.d.ts +38 -0
  330. package/src/graph/warnings.js +77 -0
  331. package/src/graph/warnings.js.map +1 -0
  332. package/src/graph/wasm.d.ts +56 -0
  333. package/src/graph/wasm.js +77 -0
  334. package/src/graph/wasm.js.map +1 -0
  335. package/src/index.d.ts +68 -0
  336. package/src/index.js +109 -0
  337. package/src/index.js.map +1 -0
  338. package/src/release/manifests.d.ts +95 -0
  339. package/src/release/manifests.js +164 -0
  340. package/src/release/manifests.js.map +1 -0
  341. package/src/release/places.d.ts +127 -0
  342. package/src/release/places.js +368 -0
  343. package/src/release/places.js.map +1 -0
  344. package/src/release/publish-cargo.d.ts +177 -0
  345. package/src/release/publish-cargo.js +351 -0
  346. package/src/release/publish-cargo.js.map +1 -0
  347. package/src/release/publish-crates.d.ts +124 -0
  348. package/src/release/publish-crates.js +242 -0
  349. package/src/release/publish-crates.js.map +1 -0
  350. package/src/release/publish-environments.d.ts +50 -0
  351. package/src/release/publish-environments.js +284 -0
  352. package/src/release/publish-environments.js.map +1 -0
  353. package/src/release/publish-messages.d.ts +66 -0
  354. package/src/release/publish-messages.js +273 -0
  355. package/src/release/publish-messages.js.map +1 -0
  356. package/src/release/publish-registry.d.ts +27 -0
  357. package/src/release/publish-registry.js +135 -0
  358. package/src/release/publish-registry.js.map +1 -0
  359. package/src/release/publish-settings.d.ts +26 -0
  360. package/src/release/publish-settings.js +56 -0
  361. package/src/release/publish-settings.js.map +1 -0
  362. package/src/release/publish.d.ts +59 -0
  363. package/src/release/publish.js +620 -0
  364. package/src/release/publish.js.map +1 -0
  365. package/src/release/repository.d.ts +73 -0
  366. package/src/release/repository.js +219 -0
  367. package/src/release/repository.js.map +1 -0
  368. package/src/release/requirements.d.ts +34 -0
  369. package/src/release/requirements.js +30 -0
  370. package/src/release/requirements.js.map +1 -0
  371. package/src/release/toml-edit.d.ts +67 -0
  372. package/src/release/toml-edit.js +453 -0
  373. package/src/release/toml-edit.js.map +1 -0
  374. package/src/release/version-actions.d.ts +133 -0
  375. package/src/release/version-actions.js +474 -0
  376. package/src/release/version-actions.js.map +1 -0
  377. package/src/release/version-checks.d.ts +21 -0
  378. package/src/release/version-checks.js +151 -0
  379. package/src/release/version-checks.js.map +1 -0
  380. package/src/release/version-lockfiles.d.ts +61 -0
  381. package/src/release/version-lockfiles.js +222 -0
  382. package/src/release/version-lockfiles.js.map +1 -0
  383. package/src/tools/napi-cli.d.ts +70 -0
  384. package/src/tools/napi-cli.js +63 -0
  385. package/src/tools/napi-cli.js.map +1 -0
  386. package/src/tools/optional-tools.d.ts +121 -0
  387. package/src/tools/optional-tools.js +303 -0
  388. package/src/tools/optional-tools.js.map +1 -0
  389. package/src/tools/print-napi-cli.d.ts +1 -0
  390. package/src/tools/print-napi-cli.js +24 -0
  391. package/src/tools/print-napi-cli.js.map +1 -0
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Registration = void 0;
4
+ exports.registrationOf = registrationOf;
5
+ exports.entryRegistration = entryRegistration;
6
+ const tslib_1 = require("tslib");
7
+ const nx_version_1 = require("../compatibility/nx-version");
8
+ const caching_1 = require("./caching");
9
+ const computation_reports_1 = require("./computation-reports");
10
+ const discovery_1 = require("./discovery");
11
+ const entries_1 = require("./entries");
12
+ const projects_1 = require("./projects");
13
+ const settings_1 = require("./settings");
14
+ const target_defaults_causes_1 = require("./target-defaults-causes");
15
+ const unification_1 = require("./unification");
16
+ /**
17
+ * One entry of the plugin in `nx.json`, with what its `createNodes` hook
18
+ * found for its `createDependencies` and `createMetadata` hooks.
19
+ *
20
+ * Nx loads the plugin module once per process and copies its properties for
21
+ * each entry, reading `createNodes` anew for each copy. Each read creates a
22
+ * registration with a `createNodes` of its own ({@link Registration.createNodes}).
23
+ * Nx calls the function of the copy's `createNodes` tuple as an element of
24
+ * that tuple, so that its `this` is the tuple and not the copy, and
25
+ * `createDependencies` and `createMetadata` as methods of the entry's copy, so {@link registrationOf}
26
+ * finds the registration through the copy's `createNodes`. Nothing else that
27
+ * Nx passes to the hooks tells the entries apart: their context is the same
28
+ * for all, and the options of an entry without options are `undefined`
29
+ * (EVD-NX-24-PLUGIN-ENTRIES). An entry's later hooks therefore see only what
30
+ * its own `createNodes` discovered, whether Nx runs the entries in one
31
+ * process or each in a worker of its own.
32
+ *
33
+ * Where a call shows that this does not hold, the hook fails rather than
34
+ * answer with another entry's projects ({@link entryRegistration}).
35
+ */
36
+ // @mara implements DES-DISCOVERY
37
+ // @mara implements DES-METADATA-REPORT
38
+ // @mara implements DES-PROJECT-GRAPH
39
+ // @mara implements DES-TARGET-DEFAULT-GUARD
40
+ class Registration {
41
+ constructor() {
42
+ this.started = 0;
43
+ this.createNodes = [
44
+ entries_1.manifestPattern,
45
+ (manifests, options, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
46
+ const graph = yield this.discover(manifests, context.workspaceRoot, options, context.nxJsonConfiguration);
47
+ // Nx's plugin interface has no channel for warnings; standard error
48
+ // reaches the terminal without the daemon and its log file with it.
49
+ // The warnings of the projects' caching are printed where they are
50
+ // found (`cacheContext` in `caching.ts`).
51
+ for (const warning of graph.discovery.warnings) {
52
+ console.warn(warning);
53
+ }
54
+ // A copy: in its own process, Nx merges the lists of the nodes it
55
+ // receives without copying them and rewrites the project names in
56
+ // their dependsOn and inputs in place (EVD-NX-24-PLUGIN-NODES). The
57
+ // graph kept for createDependencies has to stay what the plugin
58
+ // inferred, which DES-TARGET-DEFAULT-GUARD compares with what Nx
59
+ // merged.
60
+ return structuredClone((0, projects_1.projectNodes)(graph.projects));
61
+ }),
62
+ ];
63
+ registrations.set(this.createNodes, this);
64
+ }
65
+ /**
66
+ * Discovers the Cargo workspaces for this entry's `createNodes`, infers
67
+ * their projects and targets and keeps both for its `createDependencies`.
68
+ * Every call requests the reports afresh, sharing them only with the other
69
+ * entries of the same graph computation.
70
+ *
71
+ * Nx calls `createDependencies` after `createNodes` in the same process. A
72
+ * daemon can start a computation while an earlier one is still running and
73
+ * then drops the earlier one, so the result of the call that started last
74
+ * is kept, even if an earlier call finishes after it. Nx 24 hands an entry
75
+ * all its manifests in one call, so each call is taken as a computation of
76
+ * its own.
77
+ *
78
+ * @param options The entry's plugin options.
79
+ * @param nxJson `nx.json`, whose `plugins` name the entries of the plugin,
80
+ * no two of which may receive manifests of one workspace (`checkEntries`
81
+ * in `entries.ts`), which says whether Nx analyses the JS lockfile
82
+ * (`pluginInput` in `plugin-package.ts`), and whose `namedInputs` give
83
+ * the repository's `default` (`cacheContext` in `caching.ts`).
84
+ * @throws {Error} When the call cannot be this entry's alone (see
85
+ * {@link Registration.claim}), when the installed Nx is not supported (see
86
+ * {@link checkNxForGraph}), when the options are invalid, when discovery
87
+ * fails (see {@link discoverWorkspaces}), when a metadata table is
88
+ * invalid (see {@link readSettings}), when two entries of the plugin
89
+ * receive manifests of one workspace, or the plugin cannot tell whether
90
+ * they do (see {@link checkEntries}), when a `fileInputs` pattern resolves where
91
+ * Nx cannot hash it, or when the targets cannot be given their names
92
+ * and tables (see {@link inferProjects}).
93
+ */
94
+ discover(manifests, workspaceRoot, options, nxJson) {
95
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
96
+ var _a;
97
+ // Before the first await: it decides which computation this call joins.
98
+ const reports = (0, computation_reports_1.computationReports)();
99
+ this.claim(options);
100
+ const sequence = ++this.started;
101
+ let graph;
102
+ try {
103
+ const nxWarning = (0, nx_version_1.checkNxForGraph)(workspaceRoot, reports);
104
+ const pluginOptions = (0, settings_1.readPluginOptions)(options);
105
+ const discovery = yield (0, discovery_1.discoverWorkspaces)(manifests, workspaceRoot, reports);
106
+ const settings = (0, settings_1.readSettings)(discovery, pluginOptions);
107
+ const view = yield (0, entries_1.checkEntries)(discovery, manifests, nxJson);
108
+ const strategies = (0, unification_1.workspaceStrategies)(discovery, settings);
109
+ const context = yield (0, caching_1.cacheContext)(discovery, nxJson, nxWarning === undefined ? [] : [nxWarning], reports, view, strategies);
110
+ const projects = (0, projects_1.inferProjects)(discovery, settings, context);
111
+ const causes = yield (0, target_defaults_causes_1.targetDefaultCauses)(projects, nxJson, workspaceRoot);
112
+ graph = {
113
+ discovery,
114
+ strategies,
115
+ projects: (0, projects_1.withWarningsInputs)(projects, workspaceRoot, causes),
116
+ declaredPatterns: [
117
+ ...projects.flatMap((project) => project.declaredPatterns),
118
+ ...((_a = context.declaredPatterns) !== null && _a !== void 0 ? _a : []),
119
+ ],
120
+ };
121
+ return graph;
122
+ }
123
+ finally {
124
+ if (this.latest === undefined || this.latest.sequence < sequence) {
125
+ this.latest = { sequence, workspaceRoot, graph };
126
+ }
127
+ }
128
+ });
129
+ }
130
+ /**
131
+ * Takes a `createNodes` call for this entry, or fails where it comes with
132
+ * other options than the entry's first call, which shows that entries
133
+ * share this registration. Calls with the entry's options may overlap, as
134
+ * where the daemon starts a graph computation before an earlier one has
135
+ * finished; {@link Registration.discover} keeps the newest.
136
+ */
137
+ claim(options) {
138
+ var _a;
139
+ if (this.options !== undefined && this.options.value !== options) {
140
+ throw entryError("createNodes", "it got other options than the entry's earlier call");
141
+ }
142
+ (_a = this.options) !== null && _a !== void 0 ? _a : (this.options = { value: options });
143
+ }
144
+ /**
145
+ * This registration, for a later hook of the entry, which Nx calls with the
146
+ * options that it passed to the entry's `createNodes`.
147
+ *
148
+ * @throws {Error} When `options` are not those.
149
+ */
150
+ forHook(hook, options) {
151
+ if (this.options !== undefined && this.options.value !== options) {
152
+ throw entryError(hook, "it got other options than the entry's createNodes");
153
+ }
154
+ return this;
155
+ }
156
+ /**
157
+ * What this entry's `createNodes` found for the graph computation that
158
+ * `createDependencies` belongs to, or `undefined` when it failed: Nx still
159
+ * calls `createDependencies` then, and graph creation fails with the error
160
+ * of `createNodes`.
161
+ *
162
+ * @throws {Error} When `createNodes` has not run for `workspaceRoot`.
163
+ */
164
+ graphForDependencies(workspaceRoot) {
165
+ if (this.latest === undefined || this.latest.workspaceRoot !== workspaceRoot) {
166
+ throw new Error(`nx-rust found no Cargo workspaces for ${workspaceRoot}: Nx asked for the dependencies before the projects. Please report this at https://github.com/convesoft/nx-rust/issues together with the Nx version and command.`);
167
+ }
168
+ return this.latest.graph;
169
+ }
170
+ /**
171
+ * Keeps the warnings that `createDependencies` found for targets of this
172
+ * entry's projects with the graph computation they belong to, for
173
+ * `createMetadata`, which Nx calls after it in the same process.
174
+ */
175
+ recordTargetWarnings(workspaceRoot, warnings) {
176
+ var _a;
177
+ if (((_a = this.latest) === null || _a === void 0 ? void 0 : _a.workspaceRoot) === workspaceRoot) {
178
+ this.latest.targetWarnings = warnings;
179
+ }
180
+ }
181
+ /**
182
+ * The warnings that `createDependencies` found in the graph computation
183
+ * that `createMetadata` belongs to, by project name, each with its target;
184
+ * none where it found none or did not run.
185
+ */
186
+ targetWarnings(workspaceRoot) {
187
+ var _a, _b, _c;
188
+ const byProject = new Map();
189
+ if (((_a = this.latest) === null || _a === void 0 ? void 0 : _a.workspaceRoot) !== workspaceRoot) {
190
+ return byProject;
191
+ }
192
+ for (const { project, target, warning } of (_b = this.latest.targetWarnings) !== null && _b !== void 0 ? _b : []) {
193
+ byProject.set(project, [...((_c = byProject.get(project)) !== null && _c !== void 0 ? _c : []), { target, warning }]);
194
+ }
195
+ return byProject;
196
+ }
197
+ }
198
+ exports.Registration = Registration;
199
+ const registrations = new WeakMap();
200
+ /**
201
+ * The registration of the plugin entry that `plugin`, Nx's copy of the
202
+ * plugin module for that entry, belongs to.
203
+ *
204
+ * @throws {Error} When `plugin` is no such copy, as where a later hook is
205
+ * called detached from the copy, after destructuring, rather than as a
206
+ * method of the copy.
207
+ */
208
+ function registrationOf(plugin, hook = "createDependencies") {
209
+ const createNodes = plugin === null || plugin === void 0 ? void 0 : plugin.createNodes;
210
+ const registration = typeof createNodes === "object" && createNodes !== null
211
+ ? registrations.get(createNodes)
212
+ : undefined;
213
+ if (registration === undefined) {
214
+ throw entryError(hook, "Nx did not call it as a method of its copy of the plugin for the entry");
215
+ }
216
+ return registration;
217
+ }
218
+ /**
219
+ * The registration of the entry whose `hook` Nx called as a method of
220
+ * `plugin` with `options`: {@link registrationOf}, checked against the
221
+ * options of the entry's `createNodes` ({@link Registration.forHook}).
222
+ *
223
+ * @throws {Error} When the plugin cannot tell that the call is the entry's.
224
+ */
225
+ function entryRegistration(plugin, hook, options) {
226
+ return registrationOf(plugin, hook).forHook(hook, options);
227
+ }
228
+ // A wrong graph is worse than none (GOAL-TRUSTED-CACHE): where a call may
229
+ // belong to another entry, the hook fails instead of answering.
230
+ function entryError(hook, reason) {
231
+ return new Error(`nx-rust could not tell which of its entries in nx.json Nx called ${hook} for: ${reason}. It stops rather than answer with the projects of another entry. Please report this at https://github.com/convesoft/nx-rust/issues together with the Nx version, the plugin's entries in nx.json and the command.`);
232
+ }
233
+ //# sourceMappingURL=registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/registration.ts"],"names":[],"mappings":";;;AAyPA,wCAaC;AASD,8CAEC;;AAhRD,4DAA8D;AAC9D,uCAAyC;AACzC,+DAA2D;AAC3D,2CAAiD;AACjD,uCAA0D;AAE1D,yCAAyF;AACzF,yCAA6D;AAC7D,qEAA+D;AAE/D,+CAAoD;AAgBpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iCAAiC;AACjC,uCAAuC;AACvC,qCAAqC;AACrC,4CAA4C;AAC5C,MAAa,YAAY;IAavB;QAVQ,YAAO,GAAG,CAAC,CAAC;QAWlB,IAAI,CAAC,WAAW,GAAG;YACjB,yBAAe;YACf,CAAO,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;gBACpC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAC/B,SAAS,EACT,OAAO,CAAC,aAAa,EACrB,OAAO,EACP,OAAO,CAAC,mBAAmB,CAC5B,CAAC;gBACF,oEAAoE;gBACpE,oEAAoE;gBACpE,mEAAmE;gBACnE,0CAA0C;gBAC1C,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;oBAC/C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;gBACD,kEAAkE;gBAClE,kEAAkE;gBAClE,oEAAoE;gBACpE,gEAAgE;gBAChE,iEAAiE;gBACjE,UAAU;gBACV,OAAO,eAAe,CAAC,IAAA,uBAAY,EAAC,KAAK,CAAC,QAAQ,C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;IACzE,MAAM,WAAW,GAAI,MAAuD,aAAvD,MAAM,uBAAN,MAAM,CAAmD,WAAW,CAAC;IAC1F,MAAM,YAAY,GAChB,OAAO,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI;QACrD,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC;QAChC,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,UAAU,CACd,IAAI,EACJ,wEAAwE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,MAAe,EAAE,IAAY,EAAE,OAAgB;IAC/E,OAAO,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC;AAED,0EAA0E;AAC1E,gEAAgE;AAChE,SAAS,UAAU,CAAC,IAAY,EAAE,MAAc;IAC9C,OAAO,IAAI,KAAK,CACd,oEAAoE,IAAI,SAAS,MAAM,oNAAoN,CAC5S,CAAC;AACJ,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The line that the command of a runtime input running one of the plugin's
3
+ * Node scripts prints, before its random value, where the script cannot run
4
+ * or fails (`DES-INPUTS`, "Failing runtime inputs"). The executor looks for
5
+ * it when it runs such a command again (`failedInputWarnings`).
6
+ */
7
+ export declare const failedInputLine = "@convesoft/nx-rust: this runtime input failed";
8
+ /**
9
+ * The variable that names the file descriptor to which the command of a
10
+ * script input sends the script's standard error: where it is unset, as
11
+ * when Nx hashes a task, descriptor 3, which the command opens on
12
+ * `/dev/null`; and `2`, the command's own standard error, where the
13
+ * executor runs the command again to say why it failed.
14
+ */
15
+ export declare const inputErrorsVariable = "NX_RUST_INPUT_ERRORS";
16
+ /**
17
+ * Shell text that prints a value that no other evaluation prints, for a
18
+ * runtime input whose query failed, so that Nx never restores a result
19
+ * stored under that key (`DES-INPUTS`, "Failing runtime inputs"). It asks
20
+ * `od` for 16 bytes of `/dev/urandom`, and where `od` is missing or fails,
21
+ * as on a `PATH` that leaves it out with the tool whose failure the value
22
+ * covers, it reads them from `/dev/urandom` with the shell's own `read` and
23
+ * prints each as two hexadecimal digits with its own `printf`, in a
24
+ * subshell with `LC_ALL=C`, so that it needs no program besides the shell.
25
+ * Where `/dev/urandom` cannot be read either, it prints the process ids of
26
+ * the shell and of its parent and, where `date` exists, the time; without
27
+ * `date`, two such runs in fresh process namespaces can repeat it
28
+ * (nxr-ntvnds). It writes nothing to standard error, which
29
+ * Nx would hash as well.
30
+ */
31
+ export declare const unrepeatableValue: string;
32
+ /**
33
+ * The command of a runtime input that runs one of the plugin's Node scripts
34
+ * in the repository root with `argument`, a folder relative to it
35
+ * (`DES-INPUTS`): the Node that creates the graph, the script and the folder,
36
+ * by paths that reach no key, since Nx keys a task on what a runtime input
37
+ * prints and not on its command. Where the script cannot run, as for a
38
+ * plugin that Nx loads from its TypeScript source or a Node that is gone, or
39
+ * fails, the command prints {@link failedInputLine} on a line of its own,
40
+ * also after output without a final line break, and then
41
+ * {@link unrepeatableValue}, so that no result stored under the key is ever
42
+ * restored. It always ends with status 0, as Nx keys a task on what a
43
+ * runtime input prints whatever its status (`EVD-RUSTUP-MISSING-TOOLCHAIN`).
44
+ * The script's standard error goes where {@link inputErrorsVariable} says.
45
+ */
46
+ export declare function scriptInputCommand(script: string, argument: string): string;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unrepeatableValue = exports.inputErrorsVariable = exports.failedInputLine = void 0;
4
+ exports.scriptInputCommand = scriptInputCommand;
5
+ const artifact_kinds_1 = require("./artifact-kinds");
6
+ /**
7
+ * The line that the command of a runtime input running one of the plugin's
8
+ * Node scripts prints, before its random value, where the script cannot run
9
+ * or fails (`DES-INPUTS`, "Failing runtime inputs"). The executor looks for
10
+ * it when it runs such a command again (`failedInputWarnings`).
11
+ */
12
+ exports.failedInputLine = "@convesoft/nx-rust: this runtime input failed";
13
+ /**
14
+ * The variable that names the file descriptor to which the command of a
15
+ * script input sends the script's standard error: where it is unset, as
16
+ * when Nx hashes a task, descriptor 3, which the command opens on
17
+ * `/dev/null`; and `2`, the command's own standard error, where the
18
+ * executor runs the command again to say why it failed.
19
+ */
20
+ exports.inputErrorsVariable = "NX_RUST_INPUT_ERRORS";
21
+ /**
22
+ * Shell text that prints a value that no other evaluation prints, for a
23
+ * runtime input whose query failed, so that Nx never restores a result
24
+ * stored under that key (`DES-INPUTS`, "Failing runtime inputs"). It asks
25
+ * `od` for 16 bytes of `/dev/urandom`, and where `od` is missing or fails,
26
+ * as on a `PATH` that leaves it out with the tool whose failure the value
27
+ * covers, it reads them from `/dev/urandom` with the shell's own `read` and
28
+ * prints each as two hexadecimal digits with its own `printf`, in a
29
+ * subshell with `LC_ALL=C`, so that it needs no program besides the shell.
30
+ * Where `/dev/urandom` cannot be read either, it prints the process ids of
31
+ * the shell and of its parent and, where `date` exists, the time; without
32
+ * `date`, two such runs in fresh process namespaces can repeat it
33
+ * (nxr-ntvnds). It writes nothing to standard error, which
34
+ * Nx would hash as well.
35
+ */
36
+ exports.unrepeatableValue = [
37
+ "{ od -An -N16 -tx1 /dev/urandom 2>/dev/null ||",
38
+ "( LC_ALL=C; n=0; i=0;",
39
+ "while [ $i -lt 16 ] && [ $n -lt 64 ]; do n=$((n + 1)); IFS= read -r c </dev/urandom;",
40
+ `while [ -n "$c" ] && [ $i -lt 16 ]; do printf %02x "'$c"; c=\${c#?}; i=$((i + 1)); done; done;`,
41
+ "[ $i -eq 16 ] && echo ) 2>/dev/null ||",
42
+ 'echo "process $$ $PPID $(date +%s.%N 2>/dev/null)"; }',
43
+ ].join(" ");
44
+ /**
45
+ * The command of a runtime input that runs one of the plugin's Node scripts
46
+ * in the repository root with `argument`, a folder relative to it
47
+ * (`DES-INPUTS`): the Node that creates the graph, the script and the folder,
48
+ * by paths that reach no key, since Nx keys a task on what a runtime input
49
+ * prints and not on its command. Where the script cannot run, as for a
50
+ * plugin that Nx loads from its TypeScript source or a Node that is gone, or
51
+ * fails, the command prints {@link failedInputLine} on a line of its own,
52
+ * also after output without a final line break, and then
53
+ * {@link unrepeatableValue}, so that no result stored under the key is ever
54
+ * restored. It always ends with status 0, as Nx keys a task on what a
55
+ * runtime input prints whatever its status (`EVD-RUSTUP-MISSING-TOOLCHAIN`).
56
+ * The script's standard error goes where {@link inputErrorsVariable} says.
57
+ */
58
+ // @mara implements DES-INPUTS
59
+ function scriptInputCommand(script, argument) {
60
+ return [
61
+ `{ ${(0, artifact_kinds_1.shellQuote)(process.execPath)} ${(0, artifact_kinds_1.shellQuote)(script)} ${(0, artifact_kinds_1.shellQuote)(argument)} 2>&"\${${exports.inputErrorsVariable}:-3}" || { echo; echo ${(0, artifact_kinds_1.shellQuote)(exports.failedInputLine)}; ${exports.unrepeatableValue}; }; } 3>/dev/null`,
62
+ "true",
63
+ ].join("; ");
64
+ }
65
+ //# sourceMappingURL=script-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-input.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/script-input.ts"],"names":[],"mappings":";;;AA0DA,gDAKC;AA/DD,qDAA8C;AAE9C;;;;;GAKG;AACU,QAAA,eAAe,GAAG,+CAA+C,CAAC;AAE/E;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACU,QAAA,iBAAiB,GAAG;IAC/B,gDAAgD;IAChD,uBAAuB;IACvB,sFAAsF;IACtF,gGAAgG;IAChG,wCAAwC;IACxC,uDAAuD;CACxD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ;;;;;;;;;;;;;GAaG;AACH,8BAA8B;AAC9B,SAAgB,kBAAkB,CAAC,MAAc,EAAE,QAAgB;IACjE,OAAO;QACL,KAAK,IAAA,2BAAU,EAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAA,2BAAU,EAAC,MAAM,CAAC,IAAI,IAAA,2BAAU,EAAC,QAAQ,CAAC,WAAW,2BAAmB,yBAAyB,IAAA,2BAAU,EAAC,uBAAe,CAAC,KAAK,yBAAiB,oBAAoB;QAC3M,MAAM;KACP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,178 @@
1
+ import type { TargetConfiguration } from "@nx/devkit";
2
+ import type { CargoMetadata, CargoPackage } from "../cargo/metadata";
3
+ import type { CargoDiscovery, CargoWorkspace } from "./discovery";
4
+ import { TargetNames } from "./options";
5
+ /** The test runner of a workspace (`DES-TEST-RUN`). */
6
+ export type TestRunner = "cargo" | "nextest";
7
+ /** The feature-unification strategy of a workspace (`DES-UNIFICATION`). */
8
+ export type FeatureUnification = "hakari" | "cargo" | "workspace-build";
9
+ /** A kind of artifact that `artifacts` names (`DES-ARTIFACT-STEPS`). */
10
+ export type ArtifactKind = "napi" | "wasm";
11
+ /** The options of one entry of the plugin in `nx.json`, validated. */
12
+ export interface PluginOptions {
13
+ targetNames: TargetNames;
14
+ /** Locked mode for the plugin's commands (`DES-INVOCATION`); `false` where unset. */
15
+ locked: boolean;
16
+ testRunner?: TestRunner;
17
+ affectedTests?: boolean;
18
+ featureUnification?: FeatureUnification;
19
+ envInputs: readonly string[];
20
+ runtimeInputs: readonly string[];
21
+ }
22
+ /** The header of a metadata table, which messages name. */
23
+ export type MetadataTable = "[package.metadata.nx]" | "[workspace.metadata.nx]" | "[workspace.metadata.nx.project]";
24
+ /** A `targets.<name>` table of a metadata table, with where it is written. */
25
+ export interface TargetTable {
26
+ /**
27
+ * The key of the table. It addresses the inferred target of that name
28
+ * after `targetNames`, or else defines an extra target.
29
+ */
30
+ name: string;
31
+ /** The table as written, shaped like an Nx target. */
32
+ target: TargetConfiguration;
33
+ /** The manifest that holds it, relative to the repository root. */
34
+ manifest: string;
35
+ /** The table it is under. */
36
+ table: MetadataTable;
37
+ }
38
+ /** A pattern of `fileInputs`, which is relative to the folder of the manifest that holds it. */
39
+ export interface FileInput {
40
+ pattern: string;
41
+ /** The manifest that holds the pattern, relative to the repository root. */
42
+ manifest: string;
43
+ }
44
+ /**
45
+ * The settings of one workspace: the plugin options of the entry that
46
+ * received it, with `[workspace.metadata.nx]` of its root manifest laid
47
+ * over them (`DES-PLUGIN-OPTIONS`).
48
+ */
49
+ export interface WorkspaceSettings {
50
+ /** The workspace's root manifest, relative to the repository root. */
51
+ rootManifest: string;
52
+ /** Locked mode, from the plugin options only (`DES-INVOCATION`). */
53
+ locked: boolean;
54
+ testRunner: TestRunner;
55
+ affectedTests: boolean;
56
+ /**
57
+ * The strategy that the workspace table or the plugin options set.
58
+ * `undefined` means the default of `DES-UNIFICATION`, which depends on
59
+ * whether the workspace has a cargo-hakari configuration (nxr-k64tm5).
60
+ */
61
+ featureUnification?: FeatureUnification;
62
+ /** Put in front of the package name of each member without a `name` of its own. */
63
+ namePrefix?: string;
64
+ /** The workspace table's tags, which every member and the workspace project have. */
65
+ tags: readonly string[];
66
+ /** The workspace table's implicit dependencies, which every member has. */
67
+ implicitDependencies: readonly string[];
68
+ /** The variables of the plugin options and of the workspace table. */
69
+ envInputs: readonly string[];
70
+ /** The commands of the plugin options and of the workspace table. */
71
+ runtimeInputs: readonly string[];
72
+ /** The patterns of the workspace table. */
73
+ fileInputs: readonly FileInput[];
74
+ }
75
+ /**
76
+ * What the settings give one project of the plugin: a crate, or the
77
+ * workspace project of a root manifest without a crate. Lists that add up
78
+ * across levels hold the values of every level that applies to the project.
79
+ */
80
+ export interface ProjectSettings {
81
+ workspace: WorkspaceSettings;
82
+ /**
83
+ * The `name` that the crate's table, or the `project` table for a
84
+ * workspace project, sets.
85
+ */
86
+ name?: string;
87
+ tags: readonly string[];
88
+ implicitDependencies: readonly string[];
89
+ /** The variables of the plugin options and of both tables, for a crate; none for a workspace project. */
90
+ envInputs: readonly string[];
91
+ /** The commands of the plugin options and of both tables, for a crate; none for a workspace project. */
92
+ runtimeInputs: readonly string[];
93
+ /** The patterns of both tables, for a crate; none for a workspace project. */
94
+ fileInputs: readonly FileInput[];
95
+ /** The crate's `artifacts`, in place of the inferred kinds; absent where it sets none. */
96
+ artifacts?: readonly ArtifactKind[];
97
+ /** The target tables for the project, in order of precedence: the workspace table's first. */
98
+ targets: readonly TargetTable[];
99
+ }
100
+ /** The settings of every workspace and project of one graph computation. */
101
+ export declare class GraphSettings {
102
+ readonly options: PluginOptions;
103
+ private readonly workspaces;
104
+ private readonly crates;
105
+ private readonly workspaceProjects;
106
+ constructor(options: PluginOptions, workspaces: ReadonlyMap<CargoWorkspace, WorkspaceSettings>, crates: ReadonlyMap<string, ProjectSettings>, workspaceProjects: ReadonlyMap<CargoWorkspace, ProjectSettings>);
107
+ /** The settings of a workspace that discovery found. */
108
+ workspace(workspace: CargoWorkspace): WorkspaceSettings;
109
+ /** The settings of a member that discovery handed over. */
110
+ crate(pkg: CargoPackage): ProjectSettings;
111
+ /** The settings of the workspace project of a root manifest without a crate. */
112
+ workspaceProject(workspace: CargoWorkspace): ProjectSettings;
113
+ }
114
+ /**
115
+ * Reads the options of the plugin's entry in `nx.json`, as Nx passes them to
116
+ * `createNodes`: each setting that `DES-PLUGIN-OPTIONS` gives the plugin
117
+ * options, validated.
118
+ *
119
+ * @throws {Error} When a key is unknown there or a value is invalid, naming
120
+ * `nx.json` and each such key.
121
+ */
122
+ export declare function readPluginOptions(options: unknown): PluginOptions;
123
+ /**
124
+ * Reads `[workspace.metadata.nx]` of each workspace that discovery found,
125
+ * with its `project` table, and `[package.metadata.nx]` of each member that
126
+ * becomes a project, from the `cargo metadata` reports (`DES-METADATA-REPORT`),
127
+ * and combines them with the plugin options by the precedence of
128
+ * `DES-PLUGIN-OPTIONS`: a crate's value wins over the workspace's, which wins
129
+ * over the plugin options', and tags, `implicitDependencies`, `fileInputs`,
130
+ * `envInputs` and `runtimeInputs` add up.
131
+ *
132
+ * @throws {Error} Naming every manifest with an unknown key, an invalid
133
+ * value, an `implicitDependencies` entry starting with `!`, or a `project`
134
+ * table in a root manifest that defines a crate.
135
+ */
136
+ export declare function readSettings(discovery: CargoDiscovery, options: PluginOptions): GraphSettings;
137
+ /**
138
+ * The error for a workspace that turns on the selection of affected tests
139
+ * without the nextest runner (`REQ-AFFECTED-TESTS`, `DES-DIAGNOSTICS`): it
140
+ * names both options, where each of their values comes from, and what to
141
+ * change. `undefined` where the workspace does not select or uses nextest.
142
+ */
143
+ export declare function affectedTestsRunnerProblem(rootManifest: string, table: {
144
+ testRunner?: TestRunner;
145
+ affectedTests?: boolean;
146
+ }, options: {
147
+ testRunner?: TestRunner;
148
+ affectedTests?: boolean;
149
+ }): string | undefined;
150
+ /**
151
+ * The `fileInputs` of a crate that another crate's inputs name by its
152
+ * folder, beside an edge, such as a path dependency without a project: those
153
+ * of its workspace's table and of its own, each with its manifest, as
154
+ * {@link readSettings} reads them for a project (`DES-INPUTS`). Only that key
155
+ * is read.
156
+ *
157
+ * @param report The `cargo metadata` report of the crate's workspace.
158
+ * @param problems Where a value of the wrong type is reported.
159
+ */
160
+ export declare function readCrateFileInputs(pkg: CargoPackage, report: CargoMetadata, repositoryRoot: string, problems: string[]): FileInput[];
161
+ /**
162
+ * The variables and commands that a crate adds to its key with `envInputs`
163
+ * and `runtimeInputs` in its workspace's table and in its own, each once, for
164
+ * a crate that another crate's inputs name by its folder in place of an
165
+ * edge, which would have brought them in the crate's named input
166
+ * (`DES-INPUTS`, "Added variables and commands"). Only those keys are read,
167
+ * as {@link readSettings} reads them for a project; the plugin options'
168
+ * additions reach every crate of the entry already.
169
+ *
170
+ * @param report The `cargo metadata` report of the crate's workspace.
171
+ * @param problems Where a value of the wrong type is reported.
172
+ */
173
+ export declare function readCrateAddedInputs(pkg: CargoPackage, report: CargoMetadata, repositoryRoot: string, problems: string[]): {
174
+ envInputs: string[];
175
+ runtimeInputs: string[];
176
+ };
177
+ /** The header of a target table in messages, such as `[package.metadata.nx.targets.test]`. */
178
+ export declare function targetHeader(table: MetadataTable, target: string, ...path: string[]): string;