@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,756 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.variablesEnd = exports.crateInputTargets = exports.environmentVariables = exports.defaultInputSettings = exports.crateInputName = void 0;
4
+ exports.namedInputs = namedInputs;
5
+ exports.repositoryDefaultInputs = repositoryDefaultInputs;
6
+ exports.targetInputs = targetInputs;
7
+ exports.wholeWorkspaceKey = wholeWorkspaceKey;
8
+ exports.holdsEveryDigest = holdsEveryDigest;
9
+ exports.memberManifests = memberManifests;
10
+ exports.externalDependencyInputs = externalDependencyInputs;
11
+ exports.lockfileInputs = lockfileInputs;
12
+ exports.environmentInputs = environmentInputs;
13
+ exports.toolchainCommand = toolchainCommand;
14
+ exports.artifactFoldersCommand = artifactFoldersCommand;
15
+ exports.testModeCommand = testModeCommand;
16
+ exports.pluginVersionInput = pluginVersionInput;
17
+ const node_path_1 = require("node:path");
18
+ const configured_tools_1 = require("../cargo/configured-tools");
19
+ const clippy_input_1 = require("./clippy-input");
20
+ const lockfile_task_1 = require("./lockfile-task");
21
+ const napi_1 = require("./napi");
22
+ const script_input_1 = require("./script-input");
23
+ const wasm_1 = require("./wasm");
24
+ /**
25
+ * The name of the crate's own named input: the files that decide what the
26
+ * crate is when another crate builds it, the folders of the crates without a
27
+ * project that it reaches, what the repository adds to its key, and the
28
+ * repository's own `default` apart from its patterns under the project's
29
+ * folder (`DES-INPUTS`). Dependents hash it through `^default`.
30
+ *
31
+ * It is `default` because a `^` input fails the hash of a task when a project
32
+ * that the task's project depends on has no named input of that name
33
+ * (`EVD-NX-24-INPUTS-OUTPUTS`), and a crate can depend on a project of another
34
+ * plugin, such as a JS project. Every project has a `default`: Nx's own,
35
+ * `{projectRoot}/**\/*`, or the one in `nx.json`.
36
+ */
37
+ exports.crateInputName = "default";
38
+ /** The settings of a workspace that sets none of them. */
39
+ exports.defaultInputSettings = {
40
+ featureUnification: "workspace-build",
41
+ testRunner: "cargo",
42
+ added: { envInputs: [], runtimeInputs: [], fileInputs: [] },
43
+ };
44
+ /**
45
+ * The environment variables of `DES-INPUTS` that every cached target hashes,
46
+ * apart from those for a triple and those for some targets only.
47
+ */
48
+ exports.environmentVariables = [
49
+ "RUSTFLAGS",
50
+ "CARGO_ENCODED_RUSTFLAGS",
51
+ "RUSTDOCFLAGS",
52
+ "CARGO_ENCODED_RUSTDOCFLAGS",
53
+ "RUSTC",
54
+ "RUSTC_WRAPPER",
55
+ "RUSTC_WORKSPACE_WRAPPER",
56
+ "RUSTDOC",
57
+ "RUSTC_BOOTSTRAP",
58
+ "CARGO_BUILD_TARGET",
59
+ "CARGO_BUILD_RUSTFLAGS",
60
+ "CARGO_BUILD_RUSTDOCFLAGS",
61
+ "CARGO_BUILD_RUSTC",
62
+ "CARGO_BUILD_RUSTC_WRAPPER",
63
+ "CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER",
64
+ "CARGO_BUILD_RUSTDOC",
65
+ "CC",
66
+ "CXX",
67
+ "AR",
68
+ "CFLAGS",
69
+ "CXXFLAGS",
70
+ "PKG_CONFIG_PATH",
71
+ "MACOSX_DEPLOYMENT_TARGET",
72
+ "OPENSSL_DIR",
73
+ "OPENSSL_LIB_DIR",
74
+ "OPENSSL_INCLUDE_DIR",
75
+ "OPENSSL_STATIC",
76
+ "OPENSSL_NO_VENDOR",
77
+ ];
78
+ /** The targets that compile, which hash `CARGO_BUILD_WARNINGS` (`DES-INPUTS`). */
79
+ const compilingTargets = new Set([
80
+ "build",
81
+ "check",
82
+ "lint",
83
+ "test",
84
+ "bench",
85
+ "run",
86
+ "napi-build",
87
+ "wasm-build",
88
+ "doc",
89
+ ]);
90
+ /**
91
+ * The targets that get the inputs of `DES-INPUTS`: the cached targets of
92
+ * `DES-TARGETS`, and `fmt`, `bench` and `run`, which are not cached but
93
+ * whose inputs make `nx affected` select them.
94
+ */
95
+ exports.crateInputTargets = new Set([
96
+ "build",
97
+ "check",
98
+ "lint",
99
+ "test",
100
+ "fmt-check",
101
+ "fmt",
102
+ "bench",
103
+ "run",
104
+ "napi-build",
105
+ "wasm-build",
106
+ "doc",
107
+ ]);
108
+ /**
109
+ * The files of the toolchain and of Cargo's configuration that apply in a
110
+ * folder and below it. Cargo reads `.cargo/config`, the older name, where it
111
+ * exists, in place of `.cargo/config.toml`.
112
+ */
113
+ const workspaceFileNames = [
114
+ "rust-toolchain.toml",
115
+ "rust-toolchain",
116
+ ".cargo/config.toml",
117
+ ".cargo/config",
118
+ ];
119
+ /** The configuration files of the tool that a target runs, looked up from the crate up to the root. */
120
+ const toolFileNames = {
121
+ lint: ["clippy.toml", ".clippy.toml"],
122
+ "fmt-check": ["rustfmt.toml", ".rustfmt.toml"],
123
+ fmt: ["rustfmt.toml", ".rustfmt.toml"],
124
+ };
125
+ /**
126
+ * The project's named inputs: {@link crateInputName}, which its targets and
127
+ * those of its dependents hash.
128
+ *
129
+ * It holds every file of the project's folder that belongs to no nested
130
+ * project, except the files that `napi-build` writes there
131
+ * ({@link napiOutputFiles}), the package folder that `wasm-build` writes
132
+ * there ({@link wasmPackageFolder}) and the workspace's `Cargo.lock` where the
133
+ * folder is the workspace root, which reaches the keys of the crate and of those that
134
+ * depend on it only through the digests of the lockfile task
135
+ * ({@link externalDependencyInputs}); the root manifest of the crate's
136
+ * workspace, whose fields the crate can inherit, also when another
137
+ * workspace builds it (`EVD-CARGO-DEPENDENCY-SIDE`); the folder and
138
+ * workspace manifest of every crate without a project that the crate
139
+ * reaches, with what each of them declares and adds; what the repository
140
+ * adds; and the repository's own `default` without its patterns under the
141
+ * project's folder. A variable or command that a crate without a project
142
+ * adds appears once, and not where the crate's own additions or the
143
+ * repository's `default` hold it ({@link withoutRepeatedAdditions}). A
144
+ * pattern that the repository negates in a target's own `inputs` takes
145
+ * files out of it, on the repository's responsibility.
146
+ */
147
+ // @mara implements DES-INPUTS
148
+ // @mara implements REQ-INPUT-FILES
149
+ function namedInputs(subject, context, settings = exports.defaultInputSettings) {
150
+ var _a;
151
+ const crateFiles = ["{projectRoot}/**/*"];
152
+ if (subject.isWorkspaceProject) {
153
+ crateFiles.push("!{projectRoot}/Cargo.lock");
154
+ }
155
+ // The files that `napi-build` and `wasm-build` write into the crate's
156
+ // folder are their outputs and no input (`DES-ARTIFACT-STEPS`).
157
+ if ((0, napi_1.producesNodeAddon)(subject)) {
158
+ crateFiles.push(...(0, napi_1.napiOutputFiles)((0, napi_1.napiAddon)(subject, context)).map((file) => `!{projectRoot}/${file}`));
159
+ }
160
+ if ((0, wasm_1.producesWasmPackage)(subject)) {
161
+ crateFiles.push(`!{projectRoot}/${wasm_1.wasmPackageFolder}/**/*`);
162
+ }
163
+ const workspaceRoot = workspaceFolder(subject, context);
164
+ if (workspaceRoot !== subject.root) {
165
+ crateFiles.push(fromRoot(workspaceRoot, "Cargo.toml"));
166
+ }
167
+ const pathDependencies = subject.pkg
168
+ ? ((_a = context.pathDependencyInputs.get(subject.pkg.manifest_path)) !== null && _a !== void 0 ? _a : [])
169
+ : [];
170
+ const own = [
171
+ ...settings.added.fileInputs,
172
+ ...settings.added.envInputs.map((env) => ({ env })),
173
+ ...settings.added.runtimeInputs.map((runtime) => ({ runtime })),
174
+ ...context.repositoryDefault,
175
+ ];
176
+ return {
177
+ [exports.crateInputName]: [...crateFiles, ...withoutRepeatedAdditions(pathDependencies, own), ...own],
178
+ };
179
+ }
180
+ /**
181
+ * `inputs` without the `env` and `runtime` entries whose variable or
182
+ * command `elsewhere` holds already, so that a variable or command that
183
+ * several crates add, or that the crate adds itself, is declared once
184
+ * (`DES-INPUTS`, "Added variables and commands"). Other entries stay.
185
+ */
186
+ function withoutRepeatedAdditions(inputs, elsewhere) {
187
+ const held = new Set(elsewhere.map(additionKey).filter((key) => key !== undefined));
188
+ return inputs.filter((input) => {
189
+ const key = additionKey(input);
190
+ return key === undefined || !held.has(key);
191
+ });
192
+ }
193
+ // What an `env` or `runtime` entry names, as one string; `undefined` for
194
+ // any other input.
195
+ function additionKey(input) {
196
+ if (typeof input !== "object" || input === null) {
197
+ return undefined;
198
+ }
199
+ if ("env" in input && typeof input.env === "string") {
200
+ return `env:${input.env}`;
201
+ }
202
+ if ("runtime" in input && typeof input.runtime === "string") {
203
+ return `runtime:${input.runtime}`;
204
+ }
205
+ return undefined;
206
+ }
207
+ /**
208
+ * The entries of the repository's `default` named input, from `nx.json`,
209
+ * that a crate's own `default` keeps: every entry but a file set under
210
+ * `{projectRoot}`, negated or not, and a reference to `default` itself.
211
+ * Named inputs such as `sharedGlobals`, `env`, `runtime` and
212
+ * `externalDependencies` entries and file sets under `{workspaceRoot}` thus
213
+ * still reach a crate's key, while what the crate hashes of its own folder
214
+ * is the plugin's to say (`DES-INPUTS`). Nx's own `default`, where `nx.json`
215
+ * has none, holds nothing else.
216
+ */
217
+ // @mara implements DES-INPUTS
218
+ function repositoryDefaultInputs(namedInputs) {
219
+ const entries = namedInputs === null || namedInputs === void 0 ? void 0 : namedInputs[exports.crateInputName];
220
+ if (!Array.isArray(entries)) {
221
+ return [];
222
+ }
223
+ return entries.filter((entry) => {
224
+ if (typeof entry === "string") {
225
+ return entry !== exports.crateInputName && !/^!?\{projectRoot\}/.test(entry);
226
+ }
227
+ if (typeof entry !== "object" || entry === null) {
228
+ return false;
229
+ }
230
+ const fileset = entry.fileset;
231
+ return typeof fileset !== "string" || !/^!?\{projectRoot\}/.test(fileset);
232
+ });
233
+ }
234
+ /**
235
+ * The inputs of one of the project's targets, in the order of the table in
236
+ * `DES-INPUTS`: the crate's files and those of its dependencies, the
237
+ * workspace files, the redirected crates that the crate may use without an
238
+ * edge, the members' manifests, the path crates outside the workspace that
239
+ * any member reaches, the tool's configuration, the external dependencies,
240
+ * the environment, the toolchain with Cargo's profile and target
241
+ * variables, and the plugin. A variable or command that a redirected crate
242
+ * without an edge or a crate outside the workspace adds appears once, and
243
+ * not where the crate's named input or another entry of the target holds
244
+ * it.
245
+ *
246
+ * Under the `cargo` and `workspace-build` strategies, a target that reads
247
+ * digests holds what a build of the whole workspace compiles the crate
248
+ * with: the digests of every member ({@link holdsEveryDigest}) and the
249
+ * crates outside the workspace that any member reaches
250
+ * ({@link InputContext.outsideCrateInputs}), beside every member's manifest
251
+ * (`DES-INPUTS`, "Whole-workspace builds").
252
+ *
253
+ * @param readsDigest Whether the target depends on the workspace's lockfile
254
+ * task and hashes digests of it: a cached target other than `fmt-check`
255
+ * (`DES-LOCKFILE-HASHING`).
256
+ * @returns `undefined` for a target that `DES-INPUTS` gives no such inputs:
257
+ * `lockfile`, `audit`, `deny` and `update` keep theirs from
258
+ * `DES-WORKSPACE-TARGETS`.
259
+ */
260
+ // @mara implements DES-INPUTS
261
+ // @mara implements REQ-INPUT-FILES
262
+ // @mara implements REQ-ENV-ALLOWLIST
263
+ // @mara implements REQ-TOOLCHAIN-KEY
264
+ function targetInputs(target, subject, context, settings = exports.defaultInputSettings, readsDigest = false) {
265
+ var _a, _b, _c, _d;
266
+ if (!exports.crateInputTargets.has(target)) {
267
+ return undefined;
268
+ }
269
+ const workspaceRoot = workspaceFolder(subject, context);
270
+ const redirected = subject.pkg === undefined
271
+ ? []
272
+ : ((_a = context.redirectedInputs.get(subject.pkg.manifest_path)) !== null && _a !== void 0 ? _a : []);
273
+ const named = namedInputs(subject, context, settings)[exports.crateInputName];
274
+ const outside = readsDigest && settings.featureUnification !== "hakari"
275
+ ? withoutHeldInputs((_c = (_b = context.outsideCrateInputs) === null || _b === void 0 ? void 0 : _b.get(wholeWorkspaceKey(subject))) !== null && _c !== void 0 ? _c : [], [
276
+ ...named,
277
+ ...redirected,
278
+ ])
279
+ : [];
280
+ const after = [
281
+ ...(settings.featureUnification === "hakari"
282
+ ? hackCrateInputs(settings, readsDigest)
283
+ : memberManifestInputs(subject, context)),
284
+ ...outside,
285
+ ...toolConfigurationInputs(target, subject, workspaceRoot, settings),
286
+ ...(target === "fmt" || target === "fmt-check"
287
+ ? []
288
+ : externalDependencyInputs(target, subject, workspaceRoot, readsDigest, settings)),
289
+ ...environmentInputs(target),
290
+ ...(target === "lint"
291
+ ? [
292
+ {
293
+ runtime: (0, clippy_input_1.clippyConfigurationCommand)(workspaceRoot, subject.workspace.clippyFolders),
294
+ },
295
+ ]
296
+ : []),
297
+ {
298
+ runtime: toolchainCommand(workspaceRoot, (_d = subject.workspace.configuredTools) !== null && _d !== void 0 ? _d : configured_tools_1.noConfiguredTools, rustdocTargets.has(target), target === "test" && settings.testRunner === "nextest"),
299
+ },
300
+ ...(target === "test" && settings.affectedTests === true
301
+ ? [{ runtime: testModeCommand(workspaceRoot) }]
302
+ : []),
303
+ pluginVersionInput(context.plugin),
304
+ ];
305
+ return [
306
+ exports.crateInputName,
307
+ `^${exports.crateInputName}`,
308
+ ...workspaceFiles(subject, context.repositoryRoot),
309
+ ...withoutRepeatedAdditions(redirected, [...named, ...after]),
310
+ ...after,
311
+ ];
312
+ }
313
+ /**
314
+ * The inputs that stand in for the other members' manifests under `hakari`
315
+ * (`DES-INPUTS`, "Hack crate"), on every target that reads a digest: the
316
+ * hack crate's manifest and the configuration file of cargo-hakari, as file
317
+ * inputs from the repository root. A member reaches the hack crate's folder
318
+ * through its edge already; the manifest is named directly as well, so that
319
+ * it is in the key of a member whose dependency on the hack crate is
320
+ * missing, until the drift check reports that.
321
+ */
322
+ // @mara implements DES-INPUTS
323
+ function hackCrateInputs(settings, readsDigest) {
324
+ if (!readsDigest || settings.hakari === undefined) {
325
+ return [];
326
+ }
327
+ return [
328
+ `{workspaceRoot}/${settings.hakari.hackManifest}`,
329
+ `{workspaceRoot}/${settings.hakari.configFile}`,
330
+ ];
331
+ }
332
+ /**
333
+ * The key under which {@link InputContext.outsideCrateInputs} holds a
334
+ * project's inputs: the manifest of its crate, or for a workspace project
335
+ * without one, the root manifest of its workspace, whose `doc` builds every
336
+ * member.
337
+ */
338
+ function wholeWorkspaceKey(subject) {
339
+ var _a, _b;
340
+ return (_b = (_a = subject.pkg) === null || _a === void 0 ? void 0 : _a.manifest_path) !== null && _b !== void 0 ? _b : (0, node_path_1.join)(subject.workspace.report.workspace_root, "Cargo.toml");
341
+ }
342
+ /**
343
+ * Whether a target that depends on the lockfile task holds the digests of
344
+ * every member of its workspace rather than its crate's own
345
+ * (`DES-LOCKFILE-HASHING`, "Crate targets"): `doc`, which builds every
346
+ * member, a workspace project without a crate, and every such target under
347
+ * the `cargo` and `workspace-build` strategies, which build each crate with
348
+ * the features of the whole workspace (`DES-INPUTS`, "External
349
+ * dependencies"). Under `hakari`, the others hold their crate's own.
350
+ */
351
+ // @mara implements DES-LOCKFILE-HASHING
352
+ function holdsEveryDigest(target, subject, settings) {
353
+ return target === "doc" || subject.pkg === undefined || settings.featureUnification !== "hakari";
354
+ }
355
+ /**
356
+ * `inputs` without those that `held` holds already: an entry equal to one
357
+ * of `held`, and an `env` or `runtime` entry whose variable or command
358
+ * `held` names, so that what the crate's own inputs hold, through its path
359
+ * dependencies or a redirection, is not named again.
360
+ */
361
+ function withoutHeldInputs(inputs, held) {
362
+ const entries = new Set(held.map((input) => JSON.stringify(input)));
363
+ return withoutRepeatedAdditions(inputs, held).filter((input) => !entries.has(JSON.stringify(input)));
364
+ }
365
+ /** The targets whose cargo command runs rustdoc: `doc`, and `test` for doctests. */
366
+ const rustdocTargets = new Set(["doc", "test"]);
367
+ /**
368
+ * The files of the context that cargo runs in: each `rust-toolchain.toml`,
369
+ * `rust-toolchain`, `.cargo/config.toml` and `.cargo/config` in the folders
370
+ * above the project's, up to the repository root. Those in the project's own
371
+ * folder are among its files, and the workspace's root manifest is in its
372
+ * named input. The files that a configuration's `include` adds count too.
373
+ * Each is named by its path, whether or not it exists, so that
374
+ * adding one changes the key. They stay out of the named input: cargo takes
375
+ * them from the folder it starts in, not from a dependency's
376
+ * (`EVD-CARGO-DEPENDENCY-SIDE`).
377
+ *
378
+ * @param own Whether the files in the project's own folder count too.
379
+ */
380
+ function workspaceFiles(subject, repositoryRoot, own = false) {
381
+ var _a;
382
+ const files = [];
383
+ // The files that a configuration's `include` adds, inside the repository.
384
+ for (const included of (_a = subject.workspace.configIncludes) !== null && _a !== void 0 ? _a : []) {
385
+ const path = repositoryPath(repositoryRoot, included);
386
+ if (path !== undefined && path !== "") {
387
+ files.push(`{workspaceRoot}/${path}`);
388
+ }
389
+ }
390
+ for (const folder of [...(own ? [subject.root] : []), ...foldersAbove(subject.root)]) {
391
+ files.push(...workspaceFileNames.map((name) => fromRoot(folder, name)));
392
+ }
393
+ return files;
394
+ }
395
+ /**
396
+ * The manifests of the workspace's other members inside the repository,
397
+ * which the `cargo` and `workspace-build` strategies make inputs of every
398
+ * member (`DES-INPUTS`, "Member manifests").
399
+ */
400
+ function memberManifestInputs(subject, context) {
401
+ var _a;
402
+ const own = (_a = subject.pkg) === null || _a === void 0 ? void 0 : _a.manifest_path;
403
+ return memberManifests(subject.workspace, context.repositoryRoot, own);
404
+ }
405
+ /**
406
+ * The manifests of the workspace's members as `{workspaceRoot}` paths, those
407
+ * inside the repository only, because Nx hashes no file outside it; sorted,
408
+ * and without `except`.
409
+ */
410
+ function memberManifests(workspace, repositoryRoot, except) {
411
+ const members = new Set(workspace.report.workspace_members);
412
+ return workspace.report.packages
413
+ .filter((pkg) => members.has(pkg.id) && pkg.manifest_path !== except)
414
+ .map((pkg) => repositoryPath(repositoryRoot, pkg.manifest_path))
415
+ .filter((path) => path !== undefined && path !== "")
416
+ .sort()
417
+ .map((path) => `{workspaceRoot}/${path}`);
418
+ }
419
+ /**
420
+ * The configuration of the tool the target runs: clippy's for `lint`,
421
+ * rustfmt's for `fmt-check` and `fmt`, in each folder above the crate's, and
422
+ * the workspace's `.config/nextest.toml` for a `test` that nextest runs.
423
+ */
424
+ function toolConfigurationInputs(target, subject, workspaceRoot, settings) {
425
+ var _a;
426
+ if (target === "test") {
427
+ return settings.testRunner === "nextest" && workspaceRoot !== subject.root
428
+ ? [fromRoot(workspaceRoot, ".config/nextest.toml")]
429
+ : [];
430
+ }
431
+ const names = (_a = toolFileNames[target]) !== null && _a !== void 0 ? _a : [];
432
+ return foldersAbove(subject.root).flatMap((folder) => names.map((name) => fromRoot(folder, name)));
433
+ }
434
+ /**
435
+ * The external dependencies of the crate (`DES-INPUTS`, "External
436
+ * dependencies"). A target that depends on the workspace's lockfile task
437
+ * hashes digests among that task's outputs: those of every member where
438
+ * {@link holdsEveryDigest} says so, otherwise the crate's own, through a
439
+ * `dependentTasksOutputFiles` input, with an `env` input for
440
+ * `NX_RUST_RUN_ID`, which a run that excludes task dependencies sets to a
441
+ * new value (`DES-LOCKFILE-HASHING`). It has no
442
+ * `Cargo.lock` as a file input: Nx hashes such an input before the run
443
+ * starts, before the lockfile task can update the file
444
+ * (`EVD-NX-24-LOCKFILE-UPDATE`).
445
+ *
446
+ * A target that is not cached, `bench` and `run`, or `build` and `doc`
447
+ * where the plugin leaves them uncached, does not depend on the lockfile
448
+ * task. Its inputs only decide what `nx affected` selects, so it names the
449
+ * workspace's `Cargo.lock`, read also where Git ignores it, as `audit` and
450
+ * `update` do (`DES-INPUTS`, "Uncached targets").
451
+ *
452
+ * `fmt` and `fmt-check` have neither: `cargo fmt` reads no lockfile.
453
+ */
454
+ // @mara implements DES-LOCKFILE-HASHING
455
+ // @mara implements REQ-EXTERNAL-DEPS
456
+ function externalDependencyInputs(target, subject, workspaceRoot, readsDigest, settings = exports.defaultInputSettings) {
457
+ if (!readsDigest) {
458
+ return [{ fileset: fromRoot(workspaceRoot, "Cargo.lock"), includeIgnored: true }];
459
+ }
460
+ const digests = subject.pkg === undefined || holdsEveryDigest(target, subject, settings)
461
+ ? `${(0, lockfile_task_1.digestFolder)(workspaceRoot)}/*.digest`
462
+ : (0, lockfile_task_1.digestFile)(workspaceRoot, subject.pkg.name);
463
+ return [{ dependentTasksOutputFiles: digests }, { env: lockfile_task_1.runIdVariable }];
464
+ }
465
+ /**
466
+ * The inputs of the lockfile task (`DES-WORKSPACE-TARGETS`), which only
467
+ * decide what `nx affected` selects, since the task is not cached: the
468
+ * workspace's `Cargo.lock`, read also where Git ignores it, its root
469
+ * manifest, the manifests of its members and of the path packages they
470
+ * reach inside the repository, the workspace files that apply in the
471
+ * workspace root, where the task's cargo runs, and the plugin's input
472
+ * ({@link pluginVersionInput}). The files are named from the repository
473
+ * root, because a pattern under the workspace project's root misses the
474
+ * files of the crate projects nested in it (`EVD-NX-24-LOCKFILE-UPDATE`).
475
+ */
476
+ // @mara implements DES-WORKSPACE-TARGETS
477
+ // @mara implements DES-LOCKFILE-HASHING
478
+ function lockfileInputs(subject, context) {
479
+ var _a, _b;
480
+ const workspaceRoot = workspaceFolder(subject, context);
481
+ const manifests = new Set([
482
+ ...memberManifests(subject.workspace, context.repositoryRoot),
483
+ ...((_b = (_a = context.pathPackageManifests) === null || _a === void 0 ? void 0 : _a.get(workspaceRoot)) !== null && _b !== void 0 ? _b : []),
484
+ ]);
485
+ manifests.delete(fromRoot(workspaceRoot, "Cargo.toml"));
486
+ return [
487
+ { fileset: fromRoot(workspaceRoot, "Cargo.lock"), includeIgnored: true },
488
+ fromRoot(workspaceRoot, "Cargo.toml"),
489
+ ...[...manifests].sort(),
490
+ ...workspaceFiles(Object.assign(Object.assign({}, subject), { root: workspaceRoot }), context.repositoryRoot, true),
491
+ pluginVersionInput(context.plugin),
492
+ ];
493
+ }
494
+ /**
495
+ * One `env` input per variable of `DES-INPUTS` that applies to the target:
496
+ * the fixed list, `CARGO_BUILD_WARNINGS` on the targets that compile, and
497
+ * `CLIPPY_CONF_DIR` on `lint`, whose value alone this hashes: the
498
+ * configuration file in its folder, and in each folder that Cargo's `[env]`
499
+ * names for it, reaches the key through {@link clippyConfigurationCommand}. The variables whose names start with
500
+ * `CARGO_PROFILE_` or `CARGO_TARGET_` are in the toolchain command instead
501
+ * ({@link toolchainCommand}).
502
+ */
503
+ function environmentInputs(target) {
504
+ const names = [...exports.environmentVariables];
505
+ if (compilingTargets.has(target)) {
506
+ names.push("CARGO_BUILD_WARNINGS");
507
+ }
508
+ if (target === "lint") {
509
+ names.push("CLIPPY_CONF_DIR");
510
+ }
511
+ return names.map((env) => ({ env }));
512
+ }
513
+ /**
514
+ * The command of the toolchain input, one shell per task's key (`DES-INPUTS`,
515
+ * `REQ-TOOLCHAIN-KEY`). In the workspace root, where the plugin's cargo
516
+ * commands run, it prints:
517
+ *
518
+ * - what `rustc -Vv` writes, as rustup or `PATH` resolve it there with the
519
+ * task's environment: the toolchain of the task's cargo, and the compiler
520
+ * that cargo runs where no setting names another;
521
+ * - where a setting names another compiler, what that compiler's `-Vv`
522
+ * writes: the one that `RUSTC` in the task's environment names, else
523
+ * `CARGO_BUILD_RUSTC`, else `build.rustc` of Cargo's configuration as
524
+ * graph creation read it, which may name two (`configuredTools`);
525
+ * - with `rustdoc`, for the targets that run it, the same for the rustdoc
526
+ * that `RUSTDOC`, `CARGO_BUILD_RUSTDOC` or `build.rustdoc` names;
527
+ * - every variable of the task's environment whose name starts with
528
+ * `CARGO_PROFILE_` or `CARGO_TARGET_`, with its value, sorted, apart from
529
+ * `CARGO_TARGET_DIR`, which says where the artifacts go and not what they
530
+ * are (`REQ-ENV-ALLOWLIST`). Those two families are open ended, with a
531
+ * profile's or a triple's name in each variable, so no list of `env`
532
+ * inputs can name them;
533
+ * - on a `test` that nextest runs, what `cargo nextest --version` writes in
534
+ * the workspace root, as cargo finds nextest there with the task's
535
+ * environment, or `cargo-nextest: not found` where it fails, so that
536
+ * another version of nextest, or none, changes the key, and every
537
+ * variable whose name starts with `NEXTEST_`, with its value, sorted in
538
+ * with the others: they choose nextest's profile or change what its run
539
+ * does, and no list names them all either.
540
+ *
541
+ * A named program runs as cargo runs it: a path with a `/` from the
542
+ * workspace root, which is also cargo's folder, and a bare name through
543
+ * `PATH`. Where nothing names a compiler or a rustdoc, the command prints
544
+ * what it printed before these settings counted, so those keys stay the
545
+ * same: Nx keys a runtime input on what it prints, not on its text
546
+ * (`EVD-CARGO-COMPILER-SELECTION`). Nx runs the command through `sh -c` in
547
+ * the repository root, with the task's dotenv files loaded
548
+ * (`EVD-NX-24-INPUT-SEMANTICS`).
549
+ *
550
+ * rustup may not install a toolchain for it (`ADR-GRAPH-NO-TOOLCHAIN-INSTALL`).
551
+ * When a version query fails, as for a pinned toolchain that is not
552
+ * installed, for a named compiler that does not exist or for an empty
553
+ * `RUSTC`, on which cargo fails too, or when the folder is missing, the
554
+ * command prints a random value in its place, new at each evaluation, so
555
+ * that no result stored under the key is ever restored and the task runs
556
+ * as plain cargo would (`EVD-RUSTUP-MISSING-TOOLCHAIN`). The command always
557
+ * ends with status 0; Nx keys a task on what a runtime input prints
558
+ * whatever its status.
559
+ *
560
+ * @param workspaceRoot The workspace's root folder, relative to the repository root.
561
+ * @param tools What `build.rustc` and `build.rustdoc` name in the workspace root.
562
+ * @param rustdoc Whether the target's cargo command runs rustdoc.
563
+ * @param nextest Whether nextest runs the target's tests; without it the
564
+ * command is the one it has always been, so that no other key changes.
565
+ */
566
+ // @mara implements REQ-TOOLCHAIN-KEY
567
+ // @mara implements REQ-ENV-ALLOWLIST
568
+ function toolchainCommand(workspaceRoot, tools = configured_tools_1.noConfiguredTools, rustdoc = false, nextest = false) {
569
+ const folder = workspaceRoot === "." ? "." : `./${workspaceRoot}`;
570
+ const versions = [
571
+ versionCommand("rustc"),
572
+ namedToolVersion("RUSTC", tools.rustc),
573
+ ...(rustdoc ? [namedToolVersion("RUSTDOC", tools.rustdoc)] : []),
574
+ ];
575
+ return [
576
+ // In a subshell before the toolchain's versions, whose `cd` stays in
577
+ // effect for the rest of the command.
578
+ ...(nextest
579
+ ? [
580
+ `( cd ${shellQuote(folder)} && ${versionCommand("cargo nextest", "--version")} ) || echo 'cargo-nextest: not found'`,
581
+ ]
582
+ : []),
583
+ `{ cd ${shellQuote(folder)} && ${versions.join(" && ")} || ${script_input_1.unrepeatableValue}; }`,
584
+ variablesCommand(nextest ? "^(CARGO_(PROFILE|TARGET)_|NEXTEST_)" : "^CARGO_(PROFILE|TARGET)_"),
585
+ "true",
586
+ ].join("; ");
587
+ }
588
+ /**
589
+ * Shell text that prints each variable of the environment whose name
590
+ * matches the extended regular expression `pattern`, apart from
591
+ * `CARGO_TARGET_DIR`, as one line `NAME=value`, sorted bytewise
592
+ * (`DES-INPUTS`, "Variables"). It reads the variables with POSIX awk's
593
+ * `ENVIRON`, so that a value holds whatever it holds: a line of `env`'s
594
+ * output cannot tell the continuation of a multi-line value from another
595
+ * variable, which let the end of such a value leave the key and a variable
596
+ * of another name enter it. In a name or value that holds a backslash or a
597
+ * line break, a backslash becomes `\\` and a line break `\n`, so that each
598
+ * variable keeps one line and two environments never print the same text;
599
+ * any other line is what `env` printed, so that those keys stay the same.
600
+ * After the last variable it prints the line {@link variablesEnd}, since
601
+ * Nx trims the whitespace at the end of what a runtime input prints, which
602
+ * would otherwise take a trailing space off the last value
603
+ * (`EVD-RUNTIME-INPUT-SCRIPTS`). Where awk fails, the text prints a value
604
+ * that no other evaluation prints ({@link unrepeatableValue}), as the
605
+ * toolchain's versions do.
606
+ */
607
+ /** The line after the variables of the toolchain command ({@link variablesCommand}). */
608
+ exports.variablesEnd = "end of variables";
609
+ function variablesCommand(pattern) {
610
+ const program = [
611
+ "function escaped(text, out, i, c) {",
612
+ 'out = ""; for (i = 1; i <= length(text); i++) { c = substr(text, i, 1);',
613
+ 'if (c == "\\\\") out = out "\\\\\\\\"; else if (c == "\\n") out = out "\\\\n"; else out = out c }',
614
+ "return out }",
615
+ "BEGIN { n = 0; for (name in ENVIRON) {",
616
+ `if (name !~ /${pattern}/ || name == "CARGO_TARGET_DIR") continue;`,
617
+ 'line = name "=" ENVIRON[name];',
618
+ 'if (index(line, "\\\\") || index(line, "\\n")) line = escaped(line);',
619
+ "for (i = n++; i > 0 && lines[i - 1] > line; i--) lines[i] = lines[i - 1];",
620
+ "lines[i] = line }",
621
+ `for (i = 0; i < n; i++) print lines[i]; print "${exports.variablesEnd}" }`,
622
+ ].join(" ");
623
+ return `{ LC_ALL=C awk '${program}' || ${script_input_1.unrepeatableValue}; }`;
624
+ }
625
+ /**
626
+ * Shell text that prints the `-Vv` of the program that `variable`, else
627
+ * `CARGO_BUILD_<variable>`, else Cargo's configuration names, and nothing
628
+ * where none names one. A variable that is set but empty counts as it is,
629
+ * so the query fails, as cargo does.
630
+ */
631
+ function namedToolVersion(variable, configured) {
632
+ const setting = `CARGO_BUILD_${variable}`;
633
+ const fromEnvironment = versionCommand(`"\${${variable}-$${setting}}"`);
634
+ const fromConfiguration = configured
635
+ .map((program) => versionCommand(shellQuote(program)))
636
+ .join(" && ");
637
+ return [
638
+ `if [ -n "\${${variable}+x}\${${setting}+x}" ]; then ${fromEnvironment};`,
639
+ ...(fromConfiguration === "" ? [] : [`else ${fromConfiguration};`]),
640
+ "fi",
641
+ ].join(" ");
642
+ }
643
+ /**
644
+ * The version of a program, given as shell text, `-Vv` unless `flag` names
645
+ * another, without rustup installing a toolchain for it.
646
+ */
647
+ function versionCommand(program, flag = "-Vv") {
648
+ return `RUSTUP_AUTO_INSTALL=0 ${program} ${flag} 2>/dev/null`;
649
+ }
650
+ /**
651
+ * The plugin's script that prints the triples that cargo builds for and its
652
+ * artifact directory (`print-artifact-folders.ts`), compiled beside this
653
+ * module.
654
+ */
655
+ const artifactFoldersScript = (0, node_path_1.join)(__dirname, "..", "cargo", "print-artifact-folders.js");
656
+ /**
657
+ * The command of the artifact input of a cached `build` and `doc`, one per
658
+ * workspace (`DES-INPUTS`, `DES-OUTPUTS`): the plugin's own script prints
659
+ * the triples that cargo will build for in the workspace root without
660
+ * `--target`, read with the function that graph creation uses, and the
661
+ * artifact directory that cargo reports there, as the outputs name it,
662
+ * both with the task's environment. The key thereby follows the folders
663
+ * that the task's cargo will write to, also where the graph that the Nx
664
+ * daemon keeps is older than a change to a configuration file that Nx does
665
+ * not watch, such as the Cargo home's, and where a dotenv file that Nx loads
666
+ * only for the task moves the artifact directory; the outputs still name
667
+ * the graph's folders, and the executor then fails the task before cargo
668
+ * runs (`taskInvocation` in `task.ts`).
669
+ *
670
+ * The command names Node, the script and the workspace root, relative to
671
+ * the repository root where Nx runs it, by paths that reach no key: Nx keys
672
+ * a task on what a runtime input prints and not on its command, and the
673
+ * script prints no path of the checkout, so checkouts in other folders
674
+ * share the keys (`EVD-CARGO-TRIPLE-FOLDERS`). Where the script cannot run,
675
+ * as for a plugin that Nx loads from its TypeScript source, or cargo fails,
676
+ * as for a pinned toolchain that is not installed, the command prints a
677
+ * line that says so and a random value, new at each evaluation, so that no
678
+ * result stored under the key is ever restored ({@link scriptInputCommand}),
679
+ * and the executor says why when the task runs. It always ends with status
680
+ * 0, like {@link toolchainCommand}.
681
+ *
682
+ * @param workspaceRoot The workspace's root folder, relative to the repository root.
683
+ */
684
+ // @mara implements DES-INPUTS
685
+ function artifactFoldersCommand(workspaceRoot, script = artifactFoldersScript) {
686
+ return (0, script_input_1.scriptInputCommand)(script, workspaceRoot);
687
+ }
688
+ /**
689
+ * The plugin's script that prints the test mode (`print-test-mode.ts`),
690
+ * compiled beside the executors.
691
+ */
692
+ const testModeScript = (0, node_path_1.join)(__dirname, "..", "executors", "print-test-mode.js");
693
+ /**
694
+ * The command of the test mode input of a `test` in a workspace that uses
695
+ * selection (`DES-TEST-MODE`, `REQ-TEST-MODE-KEY`): the plugin's own script
696
+ * prints `full`, `affected:<baseline commits>`, or a line that names an
697
+ * invalid `NX_RUST_TEST_MODE`, from the task's environment and
698
+ * cargo-affected's database in the workspace root, read without writing to
699
+ * it and without starting cargo-affected. Nx runs it in the repository
700
+ * root with the task's environment, afresh for every task of every run
701
+ * (`EVD-NX-24-INPUT-SEMANTICS`), and the test executor decides the mode by
702
+ * the same rule. Like {@link artifactFoldersCommand}, it names Node, the
703
+ * script and the workspace root by paths that reach no key, and where the
704
+ * script cannot run, as for a plugin that Nx loads from its TypeScript
705
+ * source, it prints a line that says so and a random value, new at each
706
+ * evaluation, so that no stored result is restored
707
+ * ({@link scriptInputCommand}). It always ends with status 0.
708
+ *
709
+ * @param workspaceRoot The workspace's root folder, relative to the repository root.
710
+ */
711
+ // @mara implements DES-TEST-MODE
712
+ // @mara implements REQ-TEST-MODE-KEY
713
+ function testModeCommand(workspaceRoot, script = testModeScript) {
714
+ return (0, script_input_1.scriptInputCommand)(script, workspaceRoot);
715
+ }
716
+ /**
717
+ * The input that carries the plugin's own version into the key
718
+ * (`DES-INPUTS`, "Plugin"): the plugin's package, where Nx has an npm node
719
+ * for it, and no external node otherwise. Every inferred target has it. On
720
+ * an uncached target it only decides what `nx affected` selects: an upgrade
721
+ * of the plugin selects the target, and a change to the JS lockfile outside
722
+ * the plugin's package does not, as it would without an
723
+ * `externalDependencies` input (`EVD-NX-24-EXTERNAL-NODES`).
724
+ */
725
+ function pluginVersionInput(plugin) {
726
+ return { externalDependencies: plugin.kind === "node" ? [plugin.packageName] : [] };
727
+ }
728
+ /** The workspace's root folder relative to the repository root, `.` for the root itself. */
729
+ function workspaceFolder(subject, context) {
730
+ return repositoryPath(context.repositoryRoot, subject.workspace.report.workspace_root) || ".";
731
+ }
732
+ /** The folders above `folder`, from its parent up to the repository root `.`; none for the root. */
733
+ function foldersAbove(folder) {
734
+ const folders = [];
735
+ let current = folder;
736
+ while (current !== ".") {
737
+ current = node_path_1.posix.dirname(current);
738
+ folders.push(current);
739
+ }
740
+ return folders;
741
+ }
742
+ /** `{workspaceRoot}/<folder>/<file>`, without a `.` segment. */
743
+ function fromRoot(folder, file) {
744
+ return folder === "." ? `{workspaceRoot}/${file}` : `{workspaceRoot}/${folder}/${file}`;
745
+ }
746
+ /** The path relative to the repository root, or `undefined` outside it. */
747
+ function repositoryPath(repositoryRoot, path) {
748
+ const inside = (0, node_path_1.relative)(repositoryRoot, path);
749
+ return inside === ".." || inside.startsWith("../") || node_path_1.posix.isAbsolute(inside)
750
+ ? undefined
751
+ : inside;
752
+ }
753
+ function shellQuote(value) {
754
+ return `'${value.split("'").join(`'"'"'`)}'`;
755
+ }
756
+ //# sourceMappingURL=inputs.js.map