@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,112 @@
1
+ /**
2
+ * The report of `cargo metadata --format-version 1 --no-deps`, as far as the
3
+ * plugin reads it. Paths are absolute. Cargo describes the format in
4
+ * https://doc.rust-lang.org/cargo/commands/cargo-metadata.html#json-format.
5
+ */
6
+ export interface CargoMetadata {
7
+ /** The members of the workspace, which are all its packages without dependency resolution. */
8
+ packages: CargoPackage[];
9
+ /** The ids of the members. */
10
+ workspace_members: string[];
11
+ /** The folder of the workspace's root manifest. */
12
+ workspace_root: string;
13
+ /** Cargo's artifact directory. */
14
+ target_directory: string;
15
+ /** Cargo's build directory, reported by recent versions of Cargo. */
16
+ build_directory?: string;
17
+ /** `[workspace.metadata]`, or `null`. */
18
+ metadata: unknown;
19
+ }
20
+ /** A package in a {@link CargoMetadata} report. */
21
+ export interface CargoPackage {
22
+ /** Cargo's package id, which `workspace_members` refers to. */
23
+ id: string;
24
+ name: string;
25
+ /** The package's version, such as `0.1.0`. */
26
+ version: string;
27
+ /** The path of the package's `Cargo.toml`. */
28
+ manifest_path: string;
29
+ /** The dependencies as the manifest declares them, unresolved. */
30
+ dependencies: CargoDependency[];
31
+ /** The package's Cargo targets: its library, binaries, examples, tests, benches and build script. */
32
+ targets: CargoTarget[];
33
+ /**
34
+ * The package's features, each with what it turns on: other features of
35
+ * the package, `dep:<name>` and `<dependency>/<feature>` entries. Cargo
36
+ * lists the implicit feature of an optional dependency too.
37
+ */
38
+ features?: Record<string, string[]>;
39
+ /** `[package.metadata]`, or `null`. */
40
+ metadata: unknown;
41
+ /**
42
+ * The registries that the package may be published to, from its `publish`
43
+ * key: `null` without the key, `[]` for `publish = false` and for a crate
44
+ * without a version.
45
+ */
46
+ publish?: string[] | null;
47
+ }
48
+ /** A Cargo target of a {@link CargoPackage}. */
49
+ export interface CargoTarget {
50
+ name: string;
51
+ /**
52
+ * What the target is: `bin`, `example`, `test`, `bench` or `custom-build`,
53
+ * or the crate types of a library, such as `lib`, `rlib` or `cdylib`.
54
+ */
55
+ kind: string[];
56
+ /** The features that cargo needs on to build the target, from its `required-features`. */
57
+ "required-features"?: string[];
58
+ /**
59
+ * Whether `cargo test` builds and runs the target, from its `test` flag:
60
+ * on by default for libraries, binaries and tests, off for examples and
61
+ * benches. Cargo 1.91 and later report it for every target.
62
+ */
63
+ test?: boolean;
64
+ }
65
+ /** A declared dependency of a {@link CargoPackage}. */
66
+ export interface CargoDependency {
67
+ /** The name of the package depended on. */
68
+ name: string;
69
+ /** `null` for a normal dependency. */
70
+ kind: "dev" | "build" | null;
71
+ /** The version requirement as Cargo writes it, such as `^0.1`; `*` where none is given. */
72
+ req: string;
73
+ /**
74
+ * Where the dependency comes from, such as
75
+ * `registry+https://github.com/rust-lang/crates.io-index` or
76
+ * `git+https://example.com/repo.git?branch=main`; `null` for a path dependency.
77
+ */
78
+ source: string | null;
79
+ /** The folder of a path dependency; absent for any other dependency. */
80
+ path?: string;
81
+ /** Whether the dependency is optional, so that a feature turns it on. */
82
+ optional?: boolean;
83
+ /** Whether the entry keeps the dependency's default features. */
84
+ uses_default_features?: boolean;
85
+ /** The features that the entry turns on in the dependency. */
86
+ features?: string[];
87
+ /** The name under which the manifest lists the dependency, where it renames it. */
88
+ rename?: string | null;
89
+ /** The platform that the dependency is limited to, such as `cfg(windows)`; `null` for none. */
90
+ target?: string | null;
91
+ /**
92
+ * The index URL of the registry that the entry names with `registry`,
93
+ * crates.io's for `registry = "crates-io"`, and `null` for an entry
94
+ * without the key, also where the entry inherits it from
95
+ * `[workspace.dependencies]` (`EVD-CARGO-PUBLISH-REGISTRIES`).
96
+ */
97
+ registry?: string | null;
98
+ }
99
+ /** The arguments after `cargo` that request the report for `manifest`. */
100
+ export declare function metadataArguments(manifest: string): string[];
101
+ /**
102
+ * Requests the report of the workspace that `manifest` belongs to. With
103
+ * `--no-deps`, Cargo needs no network and neither creates nor changes
104
+ * `Cargo.lock`.
105
+ *
106
+ * @param manifest The absolute path of a `Cargo.toml`.
107
+ * @param cwd The folder cargo starts in.
108
+ * @throws {CargoError} When cargo cannot be started or fails.
109
+ * @throws {SyntaxError} When cargo's output is no report.
110
+ * @throws {UnsupportedCargoError} When the report comes from a Cargo older than 1.91.
111
+ */
112
+ export declare function requestMetadata(manifest: string, cwd: string): Promise<CargoMetadata>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.metadataArguments = metadataArguments;
4
+ exports.requestMetadata = requestMetadata;
5
+ const tslib_1 = require("tslib");
6
+ const cargo_version_1 = require("../compatibility/cargo-version");
7
+ const run_cargo_1 = require("./run-cargo");
8
+ /** The arguments after `cargo` that request the report for `manifest`. */
9
+ function metadataArguments(manifest) {
10
+ return ["metadata", "--format-version", "1", "--no-deps", "--manifest-path", manifest];
11
+ }
12
+ /**
13
+ * Requests the report of the workspace that `manifest` belongs to. With
14
+ * `--no-deps`, Cargo needs no network and neither creates nor changes
15
+ * `Cargo.lock`.
16
+ *
17
+ * @param manifest The absolute path of a `Cargo.toml`.
18
+ * @param cwd The folder cargo starts in.
19
+ * @throws {CargoError} When cargo cannot be started or fails.
20
+ * @throws {SyntaxError} When cargo's output is no report.
21
+ * @throws {UnsupportedCargoError} When the report comes from a Cargo older than 1.91.
22
+ */
23
+ // @mara implements DES-METADATA-REPORT
24
+ function requestMetadata(manifest, cwd) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const output = yield (0, run_cargo_1.runCargoForGraph)(metadataArguments(manifest), cwd);
27
+ const report = JSON.parse(output);
28
+ if (typeof (report === null || report === void 0 ? void 0 : report.workspace_root) !== "string" ||
29
+ !Array.isArray(report.packages) ||
30
+ !Array.isArray(report.workspace_members)) {
31
+ throw new SyntaxError("the output has no workspace_root, packages or workspace_members");
32
+ }
33
+ yield (0, cargo_version_1.checkCargoReport)(report, cwd);
34
+ return report;
35
+ });
36
+ }
37
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../nx-rust/src/cargo/metadata.ts"],"names":[],"mappings":";;AA0GA,8CAEC;AAcD,0CAYC;;AAtID,kEAAkE;AAClE,2CAA+C;AAwG/C,0EAA0E;AAC1E,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,OAAO,CAAC,UAAU,EAAE,kBAAkB,EAAE,GAAG,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AACzF,CAAC;AAED;;;;;;;;;;GAUG;AACH,uCAAuC;AACvC,SAAsB,eAAe,CAAC,QAAgB,EAAE,GAAW;;QACjE,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAgB,EAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAkB,CAAC;QACnD,IACE,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,CAAA,KAAK,QAAQ;YAC1C,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,EACxC,CAAC;YACD,MAAM,IAAI,WAAW,CAAC,iEAAiE,CAAC,CAAC;QAC3F,CAAC;QACD,MAAM,IAAA,gCAAgB,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA"}
@@ -0,0 +1,54 @@
1
+ import type { CargoMetadata, CargoPackage } from "./metadata";
2
+ /** Cargo could not report the members of a workspace, such as with their package ID specifications. */
3
+ export declare class PackageSpecReportError extends Error {
4
+ /** What cargo wrote to standard error. */
5
+ readonly stderr: string;
6
+ constructor(message: string,
7
+ /** What cargo wrote to standard error. */
8
+ stderr: string);
9
+ }
10
+ /**
11
+ * The package ID specification of each member of the Cargo workspace whose
12
+ * root folder is `workspaceRoot`, by package name, as cargo gives it to a
13
+ * command that starts there with `env` (`DES-INVOCATION`): the `id` of the
14
+ * member in the `cargo metadata --format-version 1 --no-deps` report, which
15
+ * is what `cargo pkgid` prints for the member's manifest, such as
16
+ * `path+file:///repo/rust/crates/core#core-lib@0.1.0`.
17
+ *
18
+ * The report lists the members only, whose package names cargo keeps
19
+ * distinct, so the name identifies the entry. Cargo starts in the folder
20
+ * without `--manifest-path`, as the task's own command does: the
21
+ * specification holds the path through which cargo reached the workspace,
22
+ * and a specification asked through another path, such as a symbolic link,
23
+ * matches no package there (`EVD-CARGO-PACKAGE-SPECS`). With `--no-deps`
24
+ * cargo needs no network and neither needs nor writes `Cargo.lock`, which
25
+ * `cargo pkgid` needs.
26
+ *
27
+ * @param env The whole environment of the task's command, also where rustup
28
+ * may install a toolchain for it, as for the command itself.
29
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
30
+ * prints no report.
31
+ */
32
+ export declare function memberSpecs(workspaceRoot: string, env: NodeJS.ProcessEnv): Map<string, string>;
33
+ /**
34
+ * The members of the Cargo workspace whose root folder is `workspaceRoot`,
35
+ * by package name, from the same report as {@link memberSpecs}: each with
36
+ * its `id`, the package ID specification, and the targets, features and
37
+ * dependencies that the report lists. A group of several crates reads from
38
+ * it which of each crate's targets its cargo command builds (`DES-BATCH`).
39
+ *
40
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
41
+ * prints no report.
42
+ */
43
+ export declare function memberPackages(workspaceRoot: string, env: NodeJS.ProcessEnv): Map<string, CargoPackage>;
44
+ /**
45
+ * The `cargo metadata --format-version 1 --no-deps` report of the Cargo
46
+ * workspace whose root folder is `workspaceRoot`, from a cargo started in
47
+ * that folder with `env`, as a task's own command starts there
48
+ * (`DES-INVOCATION`). With `--no-deps` cargo needs no network and neither
49
+ * needs nor writes `Cargo.lock`.
50
+ *
51
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
52
+ * prints no report with packages.
53
+ */
54
+ export declare function workspaceReport(workspaceRoot: string, env: NodeJS.ProcessEnv): CargoMetadata;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackageSpecReportError = void 0;
4
+ exports.memberSpecs = memberSpecs;
5
+ exports.memberPackages = memberPackages;
6
+ exports.workspaceReport = workspaceReport;
7
+ const node_child_process_1 = require("node:child_process");
8
+ /** Cargo could not report the members of a workspace, such as with their package ID specifications. */
9
+ class PackageSpecReportError extends Error {
10
+ constructor(message,
11
+ /** What cargo wrote to standard error. */
12
+ stderr) {
13
+ super(message);
14
+ this.stderr = stderr;
15
+ this.name = "PackageSpecReportError";
16
+ }
17
+ }
18
+ exports.PackageSpecReportError = PackageSpecReportError;
19
+ /**
20
+ * The package ID specification of each member of the Cargo workspace whose
21
+ * root folder is `workspaceRoot`, by package name, as cargo gives it to a
22
+ * command that starts there with `env` (`DES-INVOCATION`): the `id` of the
23
+ * member in the `cargo metadata --format-version 1 --no-deps` report, which
24
+ * is what `cargo pkgid` prints for the member's manifest, such as
25
+ * `path+file:///repo/rust/crates/core#core-lib@0.1.0`.
26
+ *
27
+ * The report lists the members only, whose package names cargo keeps
28
+ * distinct, so the name identifies the entry. Cargo starts in the folder
29
+ * without `--manifest-path`, as the task's own command does: the
30
+ * specification holds the path through which cargo reached the workspace,
31
+ * and a specification asked through another path, such as a symbolic link,
32
+ * matches no package there (`EVD-CARGO-PACKAGE-SPECS`). With `--no-deps`
33
+ * cargo needs no network and neither needs nor writes `Cargo.lock`, which
34
+ * `cargo pkgid` needs.
35
+ *
36
+ * @param env The whole environment of the task's command, also where rustup
37
+ * may install a toolchain for it, as for the command itself.
38
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
39
+ * prints no report.
40
+ */
41
+ // @mara implements DES-INVOCATION
42
+ function memberSpecs(workspaceRoot, env) {
43
+ const specs = new Map();
44
+ for (const pkg of workspaceReport(workspaceRoot, env).packages) {
45
+ if (typeof (pkg === null || pkg === void 0 ? void 0 : pkg.name) === "string" && typeof pkg.id === "string") {
46
+ specs.set(pkg.name, pkg.id);
47
+ }
48
+ }
49
+ return specs;
50
+ }
51
+ /**
52
+ * The members of the Cargo workspace whose root folder is `workspaceRoot`,
53
+ * by package name, from the same report as {@link memberSpecs}: each with
54
+ * its `id`, the package ID specification, and the targets, features and
55
+ * dependencies that the report lists. A group of several crates reads from
56
+ * it which of each crate's targets its cargo command builds (`DES-BATCH`).
57
+ *
58
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
59
+ * prints no report.
60
+ */
61
+ // @mara implements DES-INVOCATION
62
+ function memberPackages(workspaceRoot, env) {
63
+ const members = new Map();
64
+ for (const pkg of workspaceReport(workspaceRoot, env).packages) {
65
+ if (typeof (pkg === null || pkg === void 0 ? void 0 : pkg.name) === "string" && typeof pkg.id === "string") {
66
+ members.set(pkg.name, pkg);
67
+ }
68
+ }
69
+ return members;
70
+ }
71
+ /**
72
+ * The `cargo metadata --format-version 1 --no-deps` report of the Cargo
73
+ * workspace whose root folder is `workspaceRoot`, from a cargo started in
74
+ * that folder with `env`, as a task's own command starts there
75
+ * (`DES-INVOCATION`). With `--no-deps` cargo needs no network and neither
76
+ * needs nor writes `Cargo.lock`.
77
+ *
78
+ * @throws {PackageSpecReportError} When cargo cannot be started, fails or
79
+ * prints no report with packages.
80
+ */
81
+ function workspaceReport(workspaceRoot, env) {
82
+ const run = (0, node_child_process_1.spawnSync)("cargo", ["metadata", "--format-version", "1", "--no-deps"], {
83
+ cwd: workspaceRoot,
84
+ env,
85
+ encoding: "utf8",
86
+ // The report lists every member with its targets and dependencies.
87
+ maxBuffer: 1024 * 1024 * 1024,
88
+ stdio: ["ignore", "pipe", "pipe"],
89
+ });
90
+ if (run.error !== undefined) {
91
+ const code = run.error.code;
92
+ throw new PackageSpecReportError(code === "ENOENT" ? `cargo was not found on PATH (${run.error.message})` : run.error.message, "");
93
+ }
94
+ if (run.status !== 0) {
95
+ throw new PackageSpecReportError(run.signal ? `cargo was stopped by ${run.signal}` : `cargo exited with status ${run.status}`, run.stderr);
96
+ }
97
+ let report;
98
+ try {
99
+ report = JSON.parse(run.stdout);
100
+ }
101
+ catch (_a) {
102
+ report = {};
103
+ }
104
+ if (!Array.isArray(report === null || report === void 0 ? void 0 : report.packages)) {
105
+ throw new PackageSpecReportError("cargo printed no report with packages", run.stderr);
106
+ }
107
+ return report;
108
+ }
109
+ //# sourceMappingURL=package-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-specs.js","sourceRoot":"","sources":["../../../../nx-rust/src/cargo/package-specs.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The folders that hold the crates which cargo finds below the folder of a
3
+ * `paths` entry, walked as cargo walks it (`EVD-CARGO-REDIRECTIONS`), by
4
+ * their real paths, in the order of the walk: the folder first, each folder
5
+ * before what lies in it, and the entries of a folder sorted by name.
6
+ *
7
+ * As cargo does, the walk goes to any depth, follows a symbolic link given
8
+ * as `folder` but none below it, and takes every folder that holds a
9
+ * `Cargo.toml`, going on below it: under a crate and under a nested
10
+ * workspace alike. Below `folder` itself it skips the folders whose names
11
+ * start with `.` and those that hold `.git`, and at every level a folder
12
+ * named `target` beside a `Cargo.toml`. A folder it cannot read is skipped,
13
+ * as cargo skips it. It skips nothing else, so it also enters
14
+ * `node_modules` and Cargo's artifact and build directories, where cargo
15
+ * finds crates as well.
16
+ *
17
+ * It also takes a folder whose manifest is a virtual one or one that cargo
18
+ * cannot parse, and every crate of a name that two crates share, where cargo
19
+ * takes one: each such folder only adds a crate that cargo may use
20
+ * (`DES-METADATA-REPORT`). The path dependencies that cargo also takes from
21
+ * each crate it finds are not walked here (`pathsCandidates` in
22
+ * `discovery.ts`).
23
+ *
24
+ * @param folder The folder of the entry, an absolute path.
25
+ * @returns No folder where `folder` does not exist.
26
+ */
27
+ export declare function cratesBelowPathsFolder(folder: string): string[];
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cratesBelowPathsFolder = cratesBelowPathsFolder;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ /**
7
+ * The folders that hold the crates which cargo finds below the folder of a
8
+ * `paths` entry, walked as cargo walks it (`EVD-CARGO-REDIRECTIONS`), by
9
+ * their real paths, in the order of the walk: the folder first, each folder
10
+ * before what lies in it, and the entries of a folder sorted by name.
11
+ *
12
+ * As cargo does, the walk goes to any depth, follows a symbolic link given
13
+ * as `folder` but none below it, and takes every folder that holds a
14
+ * `Cargo.toml`, going on below it: under a crate and under a nested
15
+ * workspace alike. Below `folder` itself it skips the folders whose names
16
+ * start with `.` and those that hold `.git`, and at every level a folder
17
+ * named `target` beside a `Cargo.toml`. A folder it cannot read is skipped,
18
+ * as cargo skips it. It skips nothing else, so it also enters
19
+ * `node_modules` and Cargo's artifact and build directories, where cargo
20
+ * finds crates as well.
21
+ *
22
+ * It also takes a folder whose manifest is a virtual one or one that cargo
23
+ * cannot parse, and every crate of a name that two crates share, where cargo
24
+ * takes one: each such folder only adds a crate that cargo may use
25
+ * (`DES-METADATA-REPORT`). The path dependencies that cargo also takes from
26
+ * each crate it finds are not walked here (`pathsCandidates` in
27
+ * `discovery.ts`).
28
+ *
29
+ * @param folder The folder of the entry, an absolute path.
30
+ * @returns No folder where `folder` does not exist.
31
+ */
32
+ // @mara implements DES-METADATA-REPORT
33
+ function cratesBelowPathsFolder(folder) {
34
+ let start;
35
+ try {
36
+ start = (0, node_fs_1.realpathSync)(folder);
37
+ }
38
+ catch (_a) {
39
+ return [];
40
+ }
41
+ const crates = [];
42
+ const visit = (current) => {
43
+ const name = (0, node_path_1.basename)(current);
44
+ if (current !== start && (name.startsWith(".") || (0, node_fs_1.existsSync)((0, node_path_1.join)(current, ".git")))) {
45
+ return;
46
+ }
47
+ if (name === "target" && (0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_path_1.dirname)(current), "Cargo.toml"))) {
48
+ return;
49
+ }
50
+ if ((0, node_fs_1.existsSync)((0, node_path_1.join)(current, "Cargo.toml"))) {
51
+ crates.push(current);
52
+ }
53
+ let entries;
54
+ try {
55
+ entries = (0, node_fs_1.readdirSync)(current, { withFileTypes: true });
56
+ }
57
+ catch (_a) {
58
+ return;
59
+ }
60
+ for (const entry of entries
61
+ .filter((entry) => entry.isDirectory())
62
+ .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))) {
63
+ visit((0, node_path_1.join)(current, entry.name));
64
+ }
65
+ };
66
+ visit(start);
67
+ return crates;
68
+ }
69
+ //# sourceMappingURL=paths-crates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths-crates.js","sourceRoot":"","sources":["../../../../nx-rust/src/cargo/paths-crates.ts"],"names":[],"mappings":";;AA8BA,wDAiCC;AA/DD,qCAA6E;AAC7E,yCAAoD;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uCAAuC;AACvC,SAAgB,sBAAsB,CAAC,MAAc;IACnD,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,IAAA,sBAAY,EAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,OAAO,CAAC,CAAC;QAC/B,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACrF,OAAO;QACT,CAAC;QACD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;YAC1E,OAAO;QACT,CAAC;QACD,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,OAAiB,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,GAAG,IAAA,qBAAW,EAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO;aACxB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;aACtC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACpE,KAAK,CAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,KAAK,CAAC,CAAC;IACb,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_path_1 = require("node:path");
4
+ const real_path_1 = require("../graph/real-path");
5
+ const directories_1 = require("./directories");
6
+ const target_triples_1 = require("./target-triples");
7
+ /**
8
+ * Prints what decides the folders that cargo writes the artifacts of `build`
9
+ * and `doc` to in a workspace root without `--target`, as graph creation
10
+ * reads it for the outputs (`DES-OUTPUTS`), in two lines of text without a
11
+ * path of the checkout:
12
+ *
13
+ * 1. The triples that cargo builds for, from Cargo's configuration and
14
+ * `CARGO_BUILD_TARGET` in the environment ({@link pickedTriples}), in the
15
+ * text of {@link pickText}.
16
+ * 2. `artifacts <path>`, the artifact directory that cargo reports, as the
17
+ * outputs name it: the folder that the system reaches, relative to the
18
+ * repository's real path ({@link repositoryFolder}); or
19
+ * `artifacts outside the repository`, where the outputs name nothing.
20
+ *
21
+ * The runtime input of a cached `build` and `doc` runs it in the repository
22
+ * root with the task's environment and the workspace root, relative to the
23
+ * repository root, as its argument, so that their key follows the triples
24
+ * and the artifact directory that the task's cargo will use, also where the
25
+ * graph that the Nx daemon keeps is out of date or a dotenv file of the task
26
+ * moves the directory (`DES-INPUTS`). The directory comes from cargo's
27
+ * `cargo metadata --no-deps` report, with `RUSTUP_AUTO_INSTALL=0`, as graph
28
+ * creation asks for it. Where cargo fails, the script prints nothing,
29
+ * writes the reason and cargo's standard error to its own and fails, and
30
+ * the command prints a value that is never repeated instead.
31
+ */
32
+ // @mara implements DES-INPUTS
33
+ function printArtifactFolders() {
34
+ var _a;
35
+ const repositoryRoot = process.cwd();
36
+ const workspaceRoot = (0, node_path_1.resolve)(repositoryRoot, (_a = process.argv[2]) !== null && _a !== void 0 ? _a : ".");
37
+ let artifacts;
38
+ try {
39
+ const directories = (0, directories_1.reportedDirectories)(workspaceRoot, Object.assign(Object.assign({}, process.env), { RUSTUP_AUTO_INSTALL: "0" }));
40
+ artifacts = (0, real_path_1.repositoryFolder)(directories.artifact, repositoryRoot);
41
+ }
42
+ catch (error) {
43
+ // What cargo wrote to standard error after the reason, so that the
44
+ // executor's warning about a failing input shows cargo's own message
45
+ // (`DES-INPUTS`, "Failing runtime inputs").
46
+ const stderr = error instanceof directories_1.DirectoryReportError ? error.stderr.trim() : "";
47
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n${stderr === "" ? "" : `${stderr}\n`}`);
48
+ process.exitCode = 1;
49
+ return;
50
+ }
51
+ const triples = (0, target_triples_1.pickText)((0, target_triples_1.pickedTriples)(workspaceRoot, process.env));
52
+ const directory = artifacts.inside
53
+ ? `artifacts ${artifacts.path}`
54
+ : "artifacts outside the repository";
55
+ process.stdout.write(`${triples}\n${directory}\n`);
56
+ }
57
+ printArtifactFolders();
58
+ //# sourceMappingURL=print-artifact-folders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-artifact-folders.js","sourceRoot":"","sources":["../../../../nx-rust/src/cargo/print-artifact-folders.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,kDAAsD;AACtD,+CAA0E;AAC1E,qDAA2D;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8BAA8B;AAC9B,SAAS,oBAAoB;;IAC3B,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,aAAa,GAAG,IAAA,mBAAO,EAAC,cAAc,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,GAAG,CAAC,CAAC;IACtE,IAAI,SAA4C,CAAC;IACjD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,iCAAmB,EAAC,aAAa,kCAChD,OAAO,CAAC,GAAG,KACd,mBAAmB,EAAE,GAAG,IACxB,CAAC;QACH,SAAS,GAAG,IAAA,4BAAgB,EAAC,WAAW,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mEAAmE;QACnE,qEAAqE;QACrE,4CAA4C;QAC5C,MAAM,MAAM,GAAG,KAAK,YAAY,kCAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,EAAE,CACnG,CAAC;QACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,IAAA,yBAAQ,EAAC,IAAA,8BAAa,EAAC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM;QAChC,CAAC,CAAC,aAAa,SAAS,CAAC,IAAI,EAAE;QAC/B,CAAC,CAAC,kCAAkC,CAAC;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * A crate folder that cargo may build in place of a registry or git
3
+ * dependency when it builds a workspace, as one of its tables says.
4
+ *
5
+ * The tables cannot say whether cargo uses the crate: that depends on the
6
+ * versions the dependencies ask for and on `Cargo.lock`. A redirection is
7
+ * therefore only a crate that cargo may use.
8
+ */
9
+ export interface Redirection {
10
+ /**
11
+ * The table it comes from: `[patch]` or `[replace]` in the workspace's
12
+ * root manifest, or `[patch]` or `paths` in a configuration file.
13
+ */
14
+ table: "patch" | "replace" | "paths";
15
+ /**
16
+ * The absolute path of the folder. For `[patch]` and `[replace]` it is the
17
+ * crate's own folder; for `paths`, cargo takes every crate at or below it.
18
+ */
19
+ folder: string;
20
+ /** The absolute path of the manifest or configuration file that holds it. */
21
+ file: string;
22
+ /**
23
+ * The key of the entry's table: the source of a `[patch.<source>]` entry,
24
+ * such as `crates-io`, a registry's name or a URL, or the package id
25
+ * specification of a `[replace]` entry. Absent for `paths`.
26
+ */
27
+ key?: string;
28
+ }
29
+ /** A configuration file that cargo reads for a workspace. */
30
+ export interface ConfigFile {
31
+ /** Its absolute path. */
32
+ file: string;
33
+ /** The keys of its top level, such as `build`, `patch` or `paths`, in the file's order. */
34
+ keys: string[];
35
+ }
36
+ /** What {@link readRedirections} found. */
37
+ export interface WorkspaceRedirections {
38
+ redirections: Redirection[];
39
+ /**
40
+ * The files that `include` adds to the configuration that cargo reads,
41
+ * which change a build as the files that include them do.
42
+ */
43
+ includedFiles: string[];
44
+ /**
45
+ * Every configuration file that cargo reads for the workspace and that
46
+ * exists, those that `include` adds among them, each once, with the keys
47
+ * it sets (`DES-DIAGNOSTICS`).
48
+ */
49
+ configFiles: ConfigFile[];
50
+ /** One message for each included file that the plugin skipped. */
51
+ warnings: string[];
52
+ }
53
+ /**
54
+ * Reads the redirections that cargo applies when it builds the workspace
55
+ * whose root manifest is in `workspaceRoot`, without running cargo:
56
+ *
57
+ * - every `[patch.<source>]` and `[replace]` entry with a `path` in the root
58
+ * manifest, resolved against the manifest's folder; cargo ignores these
59
+ * tables in other manifests;
60
+ * - every `[patch.<source>]` entry with a `path`, and every `paths` entry, in
61
+ * the configuration of `workspaceRoot`, of every folder above it and of the
62
+ * Cargo home, following `include`. In each of these folders cargo reads
63
+ * `.cargo/config` where it exists, and `.cargo/config.toml` otherwise; in
64
+ * the Cargo home, `config` or `config.toml` in the same way. It resolves a
65
+ * path in such a file against the folder above the one that holds the file.
66
+ *
67
+ * The plugin's cargo commands start in the workspace root, so cargo reads
68
+ * these configuration files for them. An `include` is followed whatever the
69
+ * Cargo version: Cargo 1.91 ignores it, and a redirection that cargo does
70
+ * not apply only adds edges. For the same reason, an included file that
71
+ * cannot be read or parsed is skipped with a warning instead of failing.
72
+ * A file that does not exist is skipped.
73
+ *
74
+ * @param env Where `CARGO_HOME` is read from; without it, the Cargo home is
75
+ * `~/.cargo`.
76
+ * @throws {Error} When the root manifest or a configuration file that cargo
77
+ * reads in any version is no valid TOML, naming the file.
78
+ */
79
+ export declare function readRedirections(workspaceRoot: string, env?: NodeJS.ProcessEnv): Promise<WorkspaceRedirections>;
80
+ /**
81
+ * The configuration files cargo reads for a command started in `folder`, in
82
+ * descending precedence, as pairs of the older and the current name, of
83
+ * which cargo reads the older where it exists: those of the folder and each
84
+ * one above it, then those of the Cargo home, which cargo reads once where
85
+ * it is also one of the folders.
86
+ */
87
+ export declare function configFiles(folder: string, env: Readonly<Record<string, string | undefined>>): [string, string][];