@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,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.commandCopyLifetime = void 0;
4
+ exports.heldMembers = heldMembers;
5
+ exports.writeDigests = writeDigests;
6
+ exports.checkDigests = checkDigests;
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = require("node:path");
9
+ const lockfile_1 = require("../cargo/lockfile");
10
+ const lockfile_task_1 = require("../graph/lockfile-task");
11
+ /**
12
+ * The members whose digests a task's key holds, in the order the check
13
+ * after cargo's call compares them ({@link checkDigests}): those that the
14
+ * target's metadata names, the crate's own, and where the metadata says
15
+ * that the key holds every member's digest (`everyDigest`), each other
16
+ * member of the workspace as its lockfile task's metadata names them
17
+ * (`DES-LOCKFILE-HASHING`, "Post-check"). So the check names the crate's own
18
+ * digest where that changed, and another member's only where the crate's
19
+ * stayed the same.
20
+ *
21
+ * @param workspaceMembers The members that the lockfile task writes digests for.
22
+ * @returns `undefined` where the key holds every member's digest but the
23
+ * lockfile task names no member, so that the list cannot be known.
24
+ */
25
+ // @mara implements DES-LOCKFILE-HASHING
26
+ function heldMembers(own, everyDigest, workspaceMembers) {
27
+ if (!everyDigest) {
28
+ return [...own];
29
+ }
30
+ if (workspaceMembers === undefined || workspaceMembers.length === 0) {
31
+ return undefined;
32
+ }
33
+ const names = new Set(own.map((member) => member.name));
34
+ return [...own, ...workspaceMembers.filter((member) => !names.has(member.name))];
35
+ }
36
+ /** How old a private copy may get before a lockfile task removes it, in milliseconds. */
37
+ exports.commandCopyLifetime = 24 * 60 * 60 * 1000;
38
+ /**
39
+ * The step of the lockfile task after `cargo update --workspace`: one file
40
+ * per member in the workspace's digest folder, named after its package
41
+ * name and holding its digest of the `Cargo.lock` that cargo left
42
+ * (`DES-LOCKFILE-HASHING`), which is what Nx hashes into the keys of the
43
+ * tasks that depend on the task; and the same files in a folder private to
44
+ * the task's `nx` command, which no other command writes, for the check
45
+ * after cargo's call ({@link checkDigests}). Other files in the digest
46
+ * folder, such as those of removed members, are deleted, so that the folder
47
+ * holds exactly the task's output, and so are the private folders of other
48
+ * commands that are older than a day, which a stopped command left. Each
49
+ * file is replaced in one step, so that a reader never sees part of one.
50
+ *
51
+ * @param task The task, `<project>:<target>`, for the message.
52
+ * @param now The current time, in milliseconds.
53
+ * @returns The message to fail the task with, or `undefined` once the
54
+ * digests are written.
55
+ */
56
+ // @mara implements DES-LOCKFILE-HASHING
57
+ function writeDigests(task, step, now = Date.now()) {
58
+ let digests;
59
+ try {
60
+ const lockfile = readLockfile(step.lockfile);
61
+ digests = new Map(step.members.map((member) => [fileName(member), (0, lockfile_1.memberDigest)(lockfile, member)]));
62
+ }
63
+ catch (error) {
64
+ if (error instanceof lockfile_1.LockfileError) {
65
+ return `${task}: nx-rust cannot read the digests of the workspace's members from ${step.lockfile}, which cargo update left: ${error.message}.`;
66
+ }
67
+ throw error;
68
+ }
69
+ removeOldCommandFolders((0, node_path_1.join)(step.folder, lockfile_task_1.commandsFolderName), now);
70
+ for (const folder of [step.commandFolder, step.folder]) {
71
+ if (folder === undefined) {
72
+ continue;
73
+ }
74
+ (0, node_fs_1.mkdirSync)(folder, { recursive: true });
75
+ for (const [file, digest] of digests) {
76
+ const temporary = (0, node_path_1.join)(folder, `.${file}.${process.pid}.tmp`);
77
+ (0, node_fs_1.writeFileSync)(temporary, `${digest}\n`);
78
+ (0, node_fs_1.renameSync)(temporary, (0, node_path_1.join)(folder, file));
79
+ }
80
+ }
81
+ for (const file of (0, node_fs_1.readdirSync)(step.folder)) {
82
+ if (!digests.has(file) && file !== lockfile_task_1.commandsFolderName) {
83
+ (0, node_fs_1.rmSync)((0, node_path_1.join)(step.folder, file), { recursive: true, force: true });
84
+ }
85
+ }
86
+ return undefined;
87
+ }
88
+ /**
89
+ * The check of `DES-LOCKFILE-HASHING`, "Post-check", after the cargo call of
90
+ * a task whose key holds digests. For each member, three values must be
91
+ * equal: the digest that the lockfile task of the task's own `nx` command
92
+ * wrote to its private copy, the shared digest file, which Nx hashed into
93
+ * the key, as it is now, and the digest computed again from `Cargo.lock`
94
+ * now. A difference means that a manifest or `Cargo.lock` changed while the
95
+ * run went on, also through another `nx` command, whose lockfile task
96
+ * rewrites the shared file, so that cargo may have built with locked
97
+ * dependencies that the task's key does not describe. The task then fails,
98
+ * so that Nx stores nothing for it. A missing private copy fails it as
99
+ * well: the shared file alone cannot show what the key holds.
100
+ *
101
+ * @returns The message to fail the task with, or `undefined` when every digest matches.
102
+ */
103
+ // @mara implements DES-LOCKFILE-HASHING
104
+ // @mara implements DES-DIAGNOSTICS
105
+ function checkDigests(check) {
106
+ const where = check.workspace === "." ? "at the repository root" : `in ${check.workspace}`;
107
+ const failure = (reason) => [
108
+ `${check.task}: ${reason}`,
109
+ `Cargo.lock of the Cargo workspace ${where}, or its digest, changed while the run went on, such as through an edit of a Cargo.toml or through another nx command that ran at the same time, so that cargo may have built with locked dependencies that the task's cache key does not describe. The task fails, so that Nx stores no result for it; run it again.`,
110
+ ].join("\n");
111
+ if (check.commandFolder === undefined) {
112
+ return failure("this nx command has no id from the plugin's preTasksExecution hook, so nx-rust cannot tell which digests its lockfile task wrote.");
113
+ }
114
+ let lockfile;
115
+ try {
116
+ lockfile = readLockfile(check.lockfile);
117
+ }
118
+ catch (error) {
119
+ if (error instanceof lockfile_1.LockfileError) {
120
+ return failure(`nx-rust cannot read ${check.lockfile} after cargo's call: ${error.message}.`);
121
+ }
122
+ throw error;
123
+ }
124
+ for (const member of check.members) {
125
+ let current;
126
+ try {
127
+ current = (0, lockfile_1.memberDigest)(lockfile, member);
128
+ }
129
+ catch (error) {
130
+ if (error instanceof lockfile_1.LockfileError) {
131
+ return failure(`after cargo's call, ${check.lockfile} no longer gives the locked dependencies of ${member.name}: ${error.message}.`);
132
+ }
133
+ throw error;
134
+ }
135
+ const own = readDigest((0, node_path_1.join)(check.commandFolder, fileName(member)));
136
+ if (own === undefined) {
137
+ return failure(`the digest of the locked dependencies of ${member.name} that this command's lockfile task wrote is missing from ${check.commandFolder}.`);
138
+ }
139
+ const shared = readDigest((0, node_path_1.join)(check.folder, fileName(member)));
140
+ if (shared !== own || current !== own) {
141
+ return failure(`the locked dependencies of ${member.name} had the digest ${own} when this command's lockfile task ran; now Cargo.lock gives ${current}, and the digest file that Nx hashed holds ${shared !== null && shared !== void 0 ? shared : "nothing"}.`);
142
+ }
143
+ }
144
+ return undefined;
145
+ }
146
+ function fileName(member) {
147
+ return (0, lockfile_task_1.digestFileName)(member.name);
148
+ }
149
+ // The digest in a file, or `undefined` where it cannot be read.
150
+ function readDigest(file) {
151
+ try {
152
+ return (0, node_fs_1.readFileSync)(file, "utf8").trim();
153
+ }
154
+ catch (_a) {
155
+ return undefined;
156
+ }
157
+ }
158
+ // Removes the private folders of commands that were last written more than
159
+ // a day ago.
160
+ function removeOldCommandFolders(commands, now) {
161
+ let names;
162
+ try {
163
+ names = (0, node_fs_1.readdirSync)(commands);
164
+ }
165
+ catch (_a) {
166
+ return;
167
+ }
168
+ for (const name of names) {
169
+ const folder = (0, node_path_1.join)(commands, name);
170
+ try {
171
+ if (now - (0, node_fs_1.statSync)(folder).mtimeMs > exports.commandCopyLifetime) {
172
+ (0, node_fs_1.rmSync)(folder, { recursive: true, force: true });
173
+ }
174
+ }
175
+ catch (_b) {
176
+ // Removed by another command meanwhile.
177
+ }
178
+ }
179
+ }
180
+ function readLockfile(path) {
181
+ let text;
182
+ try {
183
+ text = (0, node_fs_1.readFileSync)(path, "utf8");
184
+ }
185
+ catch (error) {
186
+ throw new lockfile_1.LockfileError(`it cannot be read (${error.message})`);
187
+ }
188
+ return (0, lockfile_1.parseLockfile)(text);
189
+ }
190
+ //# sourceMappingURL=digests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digests.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/digests.ts"],"names":[],"mappings":";;;AA6EA,kCAaC;AAwBD,oCAmCC;AAmBD,oCA+CC;AAvND,qCAQiB;AACjB,yCAAiC;AACjC,gDAM2B;AAC3B,0DAA4E;AA6C5E;;;;;;;;;;;;;GAaG;AACH,wCAAwC;AACxC,SAAgB,WAAW,CACzB,GAA8B,EAC9B,WAAoB,EACpB,gBAAuD;IAEvD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,yFAAyF;AAC5E,QAAA,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AACH,wCAAwC;AACxC,SAAgB,YAAY,CAC1B,IAAY,EACZ,IAAiB,EACjB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,IAAI,OAA4B,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,OA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AC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,aAAa;AACb,SAAS,uBAAuB,CAAC,QAAgB,EAAE,GAAW;IAC5D,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACH,KAAK,GAAG,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,WAAM,CAAC;QACP,OAAO;IACT,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAA,gBAAI,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC;YACH,IAAI,GAAG,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC,CAAC,OAAO,GAAG,2BAAmB,EAAE,CAAC;gBACzD,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,wCAAwC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAA,sBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,wBAAa,CAAC,sBAAuB,KAAe,CAAC,OAAO,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,79 @@
1
+ import type { ProjectGraph, Task } from "@nx/devkit";
2
+ /** The task that {@link dotenvProblem} checks, as Nx's `getEnvFilesForTask` reads it. */
3
+ export type DotenvTask = Pick<Task, "id" | "projectRoot"> & {
4
+ target: {
5
+ project: string;
6
+ target: string;
7
+ configuration?: string;
8
+ };
9
+ };
10
+ /** A task's dotenv files as dotenv reads them for Nx. */
11
+ export interface TaskDotenv {
12
+ /** The paths, relative to the repository root, of the files that exist. */
13
+ existing: string[];
14
+ /** Each variable's value from the first file that defines it, as dotenv merges them. */
15
+ raw: Record<string, string>;
16
+ /** The file that gives each variable of {@link raw}. */
17
+ origin: Map<string, string>;
18
+ /** The files that define `NX_LOAD_DOT_ENV_FILES`. */
19
+ loadSwitches: string[];
20
+ /** The vaults that dotenv would read where `DOTENV_KEY` is set. */
21
+ vaults: string[];
22
+ }
23
+ /**
24
+ * The dotenv files that Nx loads for `task` and what they define, read with
25
+ * the installed Nx's `getEnvFilesForTask` and dotenv's own parser; files that
26
+ * do not exist are not read.
27
+ *
28
+ * @throws {TaskEnvironmentError} When the installed Nx lacks what it reads.
29
+ */
30
+ export declare function readTaskDotenv(task: DotenvTask, graph: ProjectGraph, root: string): TaskDotenv;
31
+ /**
32
+ * Every name that one of the dotenv files that Nx loads for `task` defines,
33
+ * in any of them.
34
+ *
35
+ * @throws {TaskEnvironmentError} When the installed Nx lacks what it reads.
36
+ */
37
+ export declare function dotenvDefinitions(task: DotenvTask, graph: ProjectGraph, root: string): string[];
38
+ /**
39
+ * Why a task's dotenv files cannot be shown to give cargo the same values in
40
+ * every way of running the task, or `undefined` where they can (`DES-BATCH`,
41
+ * "Dotenv files"). The same check runs for a task run on its own and for a
42
+ * task of a batch, before any cargo command, and reads the files that Nx loads
43
+ * for the task and nothing else; without any, it reads nothing.
44
+ *
45
+ * A vault that dotenv would read because `DOTENV_KEY` is set fails the task
46
+ * first, whether or not a plain file exists beside it and whether or not Nx
47
+ * loads the task's files, since Nx reads the root vaults when it removes the
48
+ * root files' values from the task.
49
+ *
50
+ * Whether Nx loads the files, the `nx` process's `NX_LOAD_DOT_ENV_FILES`
51
+ * decides, which a file that defines the variable could change in the
52
+ * environment that the task ends with: a task whose files define it fails,
53
+ * and otherwise the task's environment has the value that decided.
54
+ *
55
+ * Nx expands the dotenv files of a task run on its own in the `nx` process
56
+ * and a batch expands them in its own process, where the variables of
57
+ * {@link runDependentVariables} can have other values; the plugin checks them
58
+ * in the task's or the batch's process, where they can differ again. Every
59
+ * other variable has the same value in all of these processes. From every
60
+ * variable that the files define and that is not in
61
+ * {@link runDependentVariables}, the check walks `$VAR`, `${VAR...}` and
62
+ * `$$VAR` references statically as the installed `dotenv-expand` matches,
63
+ * splits (including `split(null)` on `"null"`), escapes (`(?<!\\)`), and
64
+ * replaces them, through the raw definitions and the values in `env` of every
65
+ * variable reached, following both branches of every `:-`, `-`, `:+` and `+`
66
+ * with a visited set for cycles, and fails the task where a variable of
67
+ * {@link runDependentVariables} is reached or where a value holds a form from
68
+ * which a variable name could be assembled. A source-text tripwire test guards
69
+ * those `dotenv-expand` behaviours instead of a run-time version pin.
70
+ * Diagnostics never include text from any variable's value.
71
+ *
72
+ * @param env The environment that the plugin gives cargo for the task: the
73
+ * values that the files gave it, and every other variable as the process
74
+ * that expanded them had it, apart from those of the set.
75
+ * @throws {TaskEnvironmentError} When the installed Nx lacks what the check
76
+ * reads.
77
+ */
78
+ export declare function dotenvProblem(task: DotenvTask, graph: ProjectGraph, root: string, env: NodeJS.ProcessEnv): string | undefined;
79
+ export declare function nxDependency(nxFile: string, name: string): Record<string, unknown>;