@convesoft/nx-rust 0.0.0 → 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 +47 -1
  4. package/executors.json +35 -0
  5. package/generators.json +19 -0
  6. package/package.json +17 -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,284 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDotenvStore = createDotenvStore;
4
+ exports.otherRunTasks = otherRunTasks;
5
+ exports.ownRunner = ownRunner;
6
+ exports.dotenvValue = dotenvValue;
7
+ exports.dotenvOrigins = dotenvOrigins;
8
+ exports.environmentKey = environmentKey;
9
+ exports.withProjectRoot = withProjectRoot;
10
+ exports.contextOf = contextOf;
11
+ exports.configuredOptions = configuredOptions;
12
+ const node_path_1 = require("node:path");
13
+ const dotenv_check_1 = require("../executors/dotenv-check");
14
+ const task_env_1 = require("../executors/task-env");
15
+ const collisions_1 = require("../graph/collisions");
16
+ const real_path_1 = require("../graph/real-path");
17
+ const targets_1 = require("../graph/targets");
18
+ const publish_crates_1 = require("./publish-crates");
19
+ const publish_messages_1 = require("./publish-messages");
20
+ const publish_settings_1 = require("./publish-settings");
21
+ function createDotenvStore(context) {
22
+ return {
23
+ context,
24
+ root: context.root,
25
+ dotenvs: new Map(),
26
+ };
27
+ }
28
+ /**
29
+ * The other `nx-release-publish` tasks of the run's task graph, those of
30
+ * crates whose tasks the executor did not receive, as when Nx runs each
31
+ * task on its own (`DES-RELEASE`, "Checks before the first call"): never
32
+ * one of `received`, the tasks that it received, also those that failed
33
+ * before they were prepared. Each
34
+ * gets the environment of a received task whose dotenv files give the
35
+ * same Cargo settings (**A dependency's environment**), or, where none
36
+ * does, the first one's, and says why it is foreign.
37
+ */
38
+ function otherRunTasks(dotenvStore, crateStore, tasks, received, othersByFolder) {
39
+ var _a, _b, _c, _d;
40
+ const [first] = tasks;
41
+ const others = [];
42
+ if (first === undefined) {
43
+ return others;
44
+ }
45
+ for (const graphTask of Object.values((_b = (_a = dotenvStore.context.taskGraph) === null || _a === void 0 ? void 0 : _a.tasks) !== null && _b !== void 0 ? _b : {})) {
46
+ if (graphTask.target.target !== targets_1.releasePublishTarget || received.has(graphTask.id)) {
47
+ continue;
48
+ }
49
+ const project = (_d = (_c = dotenvStore.context.projectsConfigurations) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d[graphTask.target.project];
50
+ const cargo = project === undefined ? undefined : (0, collisions_1.cargoMetadataOf)(project);
51
+ if ((cargo === null || cargo === void 0 ? void 0 : cargo.packageName) === undefined) {
52
+ continue;
53
+ }
54
+ const task = withProjectRoot(graphTask, project === null || project === void 0 ? void 0 : project.root);
55
+ let runner = first;
56
+ let foreign;
57
+ const same = tasks.find((candidate) => sameDotenvSettings(dotenvStore, candidate.task, task) === true);
58
+ if (same !== undefined) {
59
+ runner = same;
60
+ }
61
+ else {
62
+ foreign = dotenvComparison(dotenvStore, first.task, task);
63
+ }
64
+ const workspaceRoot = (0, real_path_1.realPath)((0, node_path_1.join)(dotenvStore.root, (0, node_path_1.dirname)(cargo.workspaceManifest)));
65
+ const report = (0, publish_crates_1.reportOf)(crateStore, workspaceRoot, runner.env, runner.envKey);
66
+ const folder = (0, real_path_1.realPath)((0, node_path_1.join)(dotenvStore.root, (0, node_path_1.dirname)(cargo.manifest)));
67
+ const pkg = "failure" in report
68
+ ? undefined
69
+ : report.packages.find((candidate) => (0, real_path_1.realPath)((0, node_path_1.dirname)(candidate.manifest_path)) === folder);
70
+ if ("failure" in report || pkg === undefined) {
71
+ continue;
72
+ }
73
+ const other = Object.assign({ id: graphTask.id, label: (0, publish_messages_1.labelOf)(graphTask), task, crate: (0, publish_crates_1.crateOf)(crateStore, pkg, workspaceRoot, report), env: runner.env, envKey: runner.envKey, dryRun: runner.dryRun, head: [], start: Date.now() }, (foreign === undefined ? {} : { foreign }));
74
+ others.push(other);
75
+ othersByFolder.set(other.crate.folder, other);
76
+ }
77
+ return others;
78
+ }
79
+ /**
80
+ * What the cargo commands for `dependency` run with, the environment of
81
+ * its own task (`DES-RELEASE`, "A dependency's environment"): the task
82
+ * that the executor received for it, or another task of the run for it;
83
+ * otherwise `task`, where the dependency has no `nx-release-publish`
84
+ * task, or where the dotenv files that Nx loads for the dependency's task
85
+ * give the same Cargo settings as those of `task`. Otherwise the message
86
+ * of `task` that says why its environment cannot be established.
87
+ */
88
+ function ownRunner(dotenvStore, byFolder, othersByFolder, dependency, task) {
89
+ var _a, _b, _c;
90
+ const own = (_a = byFolder.get(dependency.folder)) !== null && _a !== void 0 ? _a : othersByFolder.get(dependency.folder);
91
+ if (own !== undefined && own.foreign === undefined) {
92
+ return own;
93
+ }
94
+ const project = dependency.project === undefined
95
+ ? undefined
96
+ : (_c = (_b = dotenvStore.context.projectsConfigurations) === null || _b === void 0 ? void 0 : _b.projects) === null || _c === void 0 ? void 0 : _c[dependency.project];
97
+ if (dependency.project === undefined || !dependency.hasPublishTarget || project === undefined) {
98
+ return task;
99
+ }
100
+ let dependencyTask;
101
+ if (own !== undefined) {
102
+ // In the run's task graph, as Nx built it, with its configuration.
103
+ dependencyTask = own.task;
104
+ }
105
+ else {
106
+ const outside = taskOutsideRun(dotenvStore, dependency, dependency.project, project, task);
107
+ if ("failure" in outside) {
108
+ return outside;
109
+ }
110
+ dependencyTask = outside.task;
111
+ }
112
+ if (sameDotenvSettings(dotenvStore, task.task, dependencyTask) === true) {
113
+ return task;
114
+ }
115
+ return {
116
+ failure: `${task.label}: ${task.crate.name} depends on ${dependency.name}, which ${(0, publish_messages_1.labelOf)(dependencyTask)} publishes, and @convesoft/nx-rust cannot rebuild the environment of that task, because ${own === undefined ? "the run does not hand it to this" : "Nx runs it on its own, apart from this"} task, while ${dotenvComparison(dotenvStore, task.task, dependencyTask)}. So it cannot establish where ${dependency.name} goes, and nothing was uploaded for ${task.crate.name}. Publish both in one nx release publish with batches, as it runs by default, or give the crates of one release the same Cargo settings, such as in the environment of the command or in .cargo/config.toml.`,
117
+ };
118
+ }
119
+ /**
120
+ * The `nx-release-publish` task of `dependency`'s project, which is not in
121
+ * the run's task graph, with the configuration that Nx would give it in a
122
+ * command like this one (`DES-RELEASE`, "A dependency's environment"):
123
+ * the configuration of `task` where `task`'s target did not take it as its
124
+ * own default and the dependency's target declares it, otherwise the
125
+ * dependency's `defaultConfiguration`, by Nx's own rule. Because another
126
+ * command may have published the dependency with any configuration, the
127
+ * task counts only where every configuration that its target declares,
128
+ * and none, give the same Cargo settings; otherwise the message of `task`
129
+ * that names the configurations that differ.
130
+ */
131
+ function taskOutsideRun(dotenvStore, dependency, projectName, project, task) {
132
+ var _a, _b, _c, _d, _e, _f, _g;
133
+ const variant = (configuration) => withProjectRoot({
134
+ id: `${projectName}:${targets_1.releasePublishTarget}${configuration === undefined ? "" : `:${configuration}`}`,
135
+ target: Object.assign({ project: projectName, target: targets_1.releasePublishTarget }, (configuration === undefined ? {} : { configuration })),
136
+ overrides: {},
137
+ outputs: [],
138
+ cache: false,
139
+ parallelism: true,
140
+ }, project.root);
141
+ const graph = dotenvStore.context.projectGraph;
142
+ const fail = (reason) => ({
143
+ failure: `${task.label}: ${task.crate.name} depends on ${dependency.name}, which ${projectName}:${targets_1.releasePublishTarget} publishes outside this run, and ${reason}. So @convesoft/nx-rust cannot establish where ${dependency.name} goes, and nothing was uploaded for ${task.crate.name}.`,
144
+ });
145
+ if (graph === undefined) {
146
+ return fail("Nx gave the task no project graph to tell that task's configuration");
147
+ }
148
+ const dependentTarget = (_d = (_c = (_b = (_a = dotenvStore.context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[task.task.target.project]) === null || _c === void 0 ? void 0 : _c.targets) === null || _d === void 0 ? void 0 : _d[targets_1.releasePublishTarget];
149
+ const own = task.task.target.configuration;
150
+ // A configuration that the dependent's target took as its own default
151
+ // may not have been passed by the command.
152
+ const passed = own !== undefined && own !== (dependentTarget === null || dependentTarget === void 0 ? void 0 : dependentTarget.defaultConfiguration) ? own : undefined;
153
+ let configuration;
154
+ try {
155
+ configuration = (0, task_env_1.nxTaskConfiguration)(dotenvStore.root, graph, projectName, targets_1.releasePublishTarget, passed);
156
+ }
157
+ catch (error) {
158
+ if (!(error instanceof task_env_1.TaskEnvironmentError)) {
159
+ throw error;
160
+ }
161
+ return fail(`it cannot tell that task's configuration (${error.message})`);
162
+ }
163
+ const resolved = variant(configuration);
164
+ const declared = Object.keys((_g = (_f = (_e = project.targets) === null || _e === void 0 ? void 0 : _e[targets_1.releasePublishTarget]) === null || _f === void 0 ? void 0 : _f.configurations) !== null && _g !== void 0 ? _g : {});
165
+ const differing = [undefined, ...declared]
166
+ .filter((other) => other !== configuration)
167
+ .map(variant)
168
+ .filter((other) => sameDotenvSettings(dotenvStore, resolved, other) !== true);
169
+ if (differing.length > 0) {
170
+ return {
171
+ failure: [
172
+ `${task.label}: ${task.crate.name} depends on ${dependency.name}, which ${projectName}:${targets_1.releasePublishTarget} publishes outside this run, and the configurations of that target give different Cargo settings, so @convesoft/nx-rust cannot tell with which of them ${dependency.name} was published, cannot establish where it went, and nothing was uploaded for ${task.crate.name}:`,
173
+ ...differing.map((other) => ` ${dotenvComparison(dotenvStore, resolved, other)}.`),
174
+ ` Give every configuration of ${projectName}:${targets_1.releasePublishTarget} the same Cargo settings, such as in the environment of the command or in .cargo/config.toml rather than in a dotenv file of one configuration, or publish ${dependency.name} and ${task.crate.name} in one nx release publish with batches.`,
175
+ ].join("\n"),
176
+ };
177
+ }
178
+ return { task: resolved };
179
+ }
180
+ /**
181
+ * Whether the dotenv files that Nx loads for two tasks give the same Cargo
182
+ * settings ({@link dotenvSettings}); `undefined` where they cannot be read.
183
+ */
184
+ function sameDotenvSettings(store, a, b) {
185
+ const first = dotenvOf(store, a);
186
+ const second = dotenvOf(store, b);
187
+ if ("failure" in first || "failure" in second) {
188
+ return undefined;
189
+ }
190
+ return (0, publish_settings_1.dotenvDifferences)((0, publish_settings_1.dotenvSettings)(first), (0, publish_settings_1.dotenvSettings)(second)).length === 0;
191
+ }
192
+ /** How the Cargo settings of the dotenv files of two tasks differ, as a clause. */
193
+ function dotenvComparison(store, a, b) {
194
+ const first = dotenvOf(store, a);
195
+ const second = dotenvOf(store, b);
196
+ if ("failure" in first || "failure" in second) {
197
+ return `@convesoft/nx-rust cannot read their dotenv files to compare their Cargo settings (${"failure" in first ? first.failure : second.failure})`;
198
+ }
199
+ const names = (0, publish_settings_1.dotenvDifferences)((0, publish_settings_1.dotenvSettings)(first), (0, publish_settings_1.dotenvSettings)(second));
200
+ return `the dotenv files that Nx loads for ${(0, publish_messages_1.configuredLabel)(a)} and ${(0, publish_messages_1.configuredLabel)(b)} give different values to ${(0, publish_messages_1.sentenceAnd)(names)}${dotenvFiles(store, a, b, names)}`;
201
+ }
202
+ /** Where the dotenv files of two tasks define `names`, as a parenthesis. */
203
+ function dotenvFiles(store, a, b, names) {
204
+ const files = [a, b].flatMap((task) => {
205
+ const origin = dotenvOrigins(store, task);
206
+ return names.flatMap((name) => {
207
+ const file = origin.get(name);
208
+ return file === undefined ? [] : [file];
209
+ });
210
+ });
211
+ const unique = [...new Set(files)];
212
+ return unique.length === 0 ? "" : ` (${unique.join(", ")})`;
213
+ }
214
+ /** The values that the dotenv files of `task` define, before expansion, or why they cannot be read. */
215
+ function dotenvOf(store, task) {
216
+ let dotenv = store.dotenvs.get(task.id);
217
+ if (dotenv === undefined) {
218
+ const graph = store.context.projectGraph;
219
+ if (graph === undefined) {
220
+ dotenv = { failure: "Nx gave the task no project graph" };
221
+ }
222
+ else {
223
+ try {
224
+ dotenv = (0, dotenv_check_1.readTaskDotenv)(task, graph, store.root).raw;
225
+ }
226
+ catch (error) {
227
+ if (!(error instanceof task_env_1.TaskEnvironmentError)) {
228
+ throw error;
229
+ }
230
+ dotenv = { failure: error.message };
231
+ }
232
+ }
233
+ store.dotenvs.set(task.id, dotenv);
234
+ }
235
+ return dotenv;
236
+ }
237
+ /** The value that the dotenv files of `task` give `name`, before expansion. */
238
+ function dotenvValue(store, task, name) {
239
+ const dotenv = dotenvOf(store, task);
240
+ return "failure" in dotenv ? undefined : dotenv[name];
241
+ }
242
+ /** The file that gives each variable of the dotenv files of `task`, relative to the repository root. */
243
+ function dotenvOrigins(store, task) {
244
+ const graph = store.context.projectGraph;
245
+ if (graph === undefined) {
246
+ return new Map();
247
+ }
248
+ try {
249
+ return (0, dotenv_check_1.readTaskDotenv)(task, graph, store.root).origin;
250
+ }
251
+ catch (error) {
252
+ if (!(error instanceof task_env_1.TaskEnvironmentError)) {
253
+ throw error;
254
+ }
255
+ return new Map();
256
+ }
257
+ }
258
+ /** A key of an environment's variables that have a value, in a fixed order. */
259
+ function environmentKey(env) {
260
+ return JSON.stringify(Object.entries(env)
261
+ .filter((entry) => entry[1] !== undefined)
262
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
263
+ }
264
+ /** `task` with its project's root, which Nx's dotenv files of a task need. */
265
+ function withProjectRoot(task, root) {
266
+ return task.projectRoot === undefined && root !== undefined
267
+ ? Object.assign(Object.assign({}, task), { projectRoot: root }) : task;
268
+ }
269
+ /**
270
+ * The executor context of one task, as Nx gives it to the task run on its
271
+ * own: the run's context with the task's project, target and configuration.
272
+ */
273
+ function contextOf(task, context) {
274
+ var _a, _b, _c, _d;
275
+ const { project, target, configuration } = task.target;
276
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, context), { projectName: project, targetName: target }), (configuration === undefined ? {} : { configurationName: configuration })), { target: (_d = (_c = (_b = (_a = context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) === null || _b === void 0 ? void 0 : _b[project]) === null || _c === void 0 ? void 0 : _c.targets) === null || _d === void 0 ? void 0 : _d[target] });
277
+ }
278
+ /** The target's options with those of the active configuration laid over them, as Nx merges them. */
279
+ function configuredOptions(context) {
280
+ var _a, _b, _c;
281
+ const configuration = context.configurationName;
282
+ return Object.assign(Object.assign({}, (_a = context.target) === null || _a === void 0 ? void 0 : _a.options), (configuration ? (_c = (_b = context.target) === null || _b === void 0 ? void 0 : _b.configurations) === null || _c === void 0 ? void 0 : _c[configuration] : undefined));
283
+ }
284
+ //# sourceMappingURL=publish-environments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-environments.js","sourceRoot":"","sources":["../../../../nx-rust/src/release/publish-environments.ts"],"names":[],"mappings":";;AA2BA,8CAMC;AAYD,sCA6DC;AAWD,8BAmCC;AAqJD,kCAGC;AAGD,sCAaC;AAGD,wCAMC;AAGD,0CAIC;AAMD,8BASC;AAGD,8CAMC;AAvWD,yCAA0C;AAC1C,4DAA2D;AAC3D,oDAAkF;AAClF,oDAAsD;AACtD,kDAA8C;AAC9C,8CAAwD;AACxD,qDAQ0B;AAC1B,yDAA2E;AAC3E,yDAAuE;AAUvE,SAAgB,iBAAiB,CAAC,OAAwB;IACxD,OAAO;QACL,OAAO;QACP,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,IAAI,GAAG,EAAE;KACnB,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAC3B,WAAwB,EACxB,UAAsB,EACtB,KAA0B,EAC1B,QAA6B,EAC7B,cAAkC;;IAElC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACtB,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,MAAA,MAAA,WAAW,CAAC,OAAO,CAAC,SAAS,0CAAE,KAAK,mCAAI,EAAE,CAAC,EAAE,CAAC;QAClF,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,KAAK,8BAAoB,IAAI,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,C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B;IAClE,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QACzD,CAAC,iCAAM,IAAI,KAAE,WAAW,EAAE,IAAI,IAC9B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAU,EAAE,OAAwB;;IAC5D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;IACvD,mEACK,OAAO,KACV,WAAW,EAAE,OAAO,EACpB,UAAU,EAAE,MAAM,KACf,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC,KAC5E,MAAM,EAAE,MAAA,MAAA,MAAA,MAAA,OAAO,CAAC,sBAAsB,0CAAE,QAAQ,0CAAG,OAAO,CAAC,0CAAE,OAAO,0CAAG,MAAM,CAAC,IAC9E;AACJ,CAAC;AAED,qGAAqG;AACrG,SAAgB,iBAAiB,CAAC,OAAwB;;IACxD,MAAM,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAChD,uCACK,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,GACvB,CAAC,aAAa,CAAC,CAAC,CAAC,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,cAAc,0CAAG,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAChF;AACJ,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { Task } from "@nx/devkit";
2
+ import { type Lookup, type Registry } from "./publish-cargo";
3
+ import type { Crate, DependencyLink, Prepared, Runner } from "./publish-crates";
4
+ /** The options of `@convesoft/nx-rust:release-publish` that Nx's npm publishing has and cargo has not. */
5
+ export declare const npmOptions: Readonly<Record<string, string>>;
6
+ /**
7
+ * The check _Dependencies published elsewhere_: the registry that the
8
+ * dependency's entry points to has to be established as the dependency's
9
+ * own target registry, which only three cases do (`DES-RELEASE`, "Where a
10
+ * dependency points").
11
+ *
12
+ * @returns The failure message, or `undefined` where the check passes.
13
+ */
14
+ export declare function publishedElsewhere(task: Prepared, link: DependencyLink, established: {
15
+ target: Registry;
16
+ source: string;
17
+ }, own: Runner): string | undefined;
18
+ /**
19
+ * The message of a task whose options hold `registry` (`DES-RELEASE`,
20
+ * "Options"; `ADR-PUBLISH-REGISTRY-OPTION`): where the value came from, as
21
+ * the overrides of the task graph tell it, Cargo's own ways to choose a
22
+ * registry, and how npm packages alone get one.
23
+ */
24
+ export declare function registryOptionMessage(label: string, value: unknown, task: Task): string;
25
+ /** The line of a task that ignores one of npm's options `tag`, `access` and `otp` (`DES-RELEASE`, "Options"). */
26
+ export declare function npmOptionLine(label: string, name: string, value: unknown, task: Task): string;
27
+ export declare function notVerifiedMessage(task: Prepared, dependency: Crate, dependencyTask: string): string;
28
+ /**
29
+ * A crate of the run that depends on a crate whose task the executor
30
+ * received and failed before it read that crate, as by the dotenv check
31
+ * (`DES-RELEASE`, "Dotenv files"): the dependency's registry and version cannot be
32
+ * told without that task's environment, so the crate is not published.
33
+ */
34
+ export declare function refusedDependencyMessage(task: Prepared, dependency: Crate, refused: string): string;
35
+ export declare function publishFirstMessage(task: Prepared, dependency: Crate, registry: Registry, failed: Prepared | undefined): string;
36
+ /**
37
+ * The check _Unpublished dependencies_ (`DES-RELEASE`): a dependency that is
38
+ * not published to the registry that its entry points to, through
39
+ * `publish = false` or a `publish` list that does not hold that registry by
40
+ * the entry's own name, `crates-io` for crates.io, fails the crate, because
41
+ * cargo packages the dependency for that registry whatever its `publish`
42
+ * says (`EVD-CARGO-PUBLISH`). Where the entry points to a registry whose
43
+ * name the executor did not find, a `publish` list cannot be compared with
44
+ * it, and the crate fails as well. For a hack crate, the message adds
45
+ * cargo-hakari's two ways (**Hack crate**).
46
+ *
47
+ * @param manifest The dependency's manifest, relative to the repository root.
48
+ * @returns The failure message, or `undefined` where the check passes.
49
+ */
50
+ export declare function unpublishedMessage(task: {
51
+ label: string;
52
+ crate: {
53
+ name: string;
54
+ };
55
+ }, link: DependencyLink, manifest: string): string | undefined;
56
+ /** The guidance for a crate that would publish to crates.io where the Cargo configuration replaces crates.io (`ADR-PUBLISH-REPLACED-CRATES-IO`). */
57
+ export declare function replacedCratesIoAdvice(crate: string): string;
58
+ /** The message of a lookup that did not establish its source or failed (`DES-RELEASE`, "Lookups"). */
59
+ export declare function lookupFailure(task: Prepared, crate: Crate, registry: Registry, lookup: Lookup, folder: string): string;
60
+ /** Each line of a message indented by two spaces. */
61
+ export declare function indented(message: string): string;
62
+ /** "a, b and c". */
63
+ export declare function sentenceAnd(items: readonly string[]): string;
64
+ /** `<project>:<target>`, with `:<configuration>` where the task has one. */
65
+ export declare function configuredLabel(task: Task): string;
66
+ export declare function labelOf(task: Task): string;
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.npmOptions = void 0;
4
+ exports.publishedElsewhere = publishedElsewhere;
5
+ exports.registryOptionMessage = registryOptionMessage;
6
+ exports.npmOptionLine = npmOptionLine;
7
+ exports.notVerifiedMessage = notVerifiedMessage;
8
+ exports.refusedDependencyMessage = refusedDependencyMessage;
9
+ exports.publishFirstMessage = publishFirstMessage;
10
+ exports.unpublishedMessage = unpublishedMessage;
11
+ exports.replacedCratesIoAdvice = replacedCratesIoAdvice;
12
+ exports.lookupFailure = lookupFailure;
13
+ exports.indented = indented;
14
+ exports.sentenceAnd = sentenceAnd;
15
+ exports.configuredLabel = configuredLabel;
16
+ exports.labelOf = labelOf;
17
+ const node_util_1 = require("node:util");
18
+ const targets_1 = require("../graph/targets");
19
+ const publish_cargo_1 = require("./publish-cargo");
20
+ const publish_settings_1 = require("./publish-settings");
21
+ /** The options of `@convesoft/nx-rust:release-publish` that Nx's npm publishing has and cargo has not. */
22
+ exports.npmOptions = {
23
+ tag: "distribution tags",
24
+ access: "access levels",
25
+ otp: "one-time passwords",
26
+ };
27
+ /** cargo-hakari's guide to publishing crates that depend on the hack crate. */
28
+ const hakariPublishing = "https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing";
29
+ /**
30
+ * The check _Dependencies published elsewhere_: the registry that the
31
+ * dependency's entry points to has to be established as the dependency's
32
+ * own target registry, which only three cases do (`DES-RELEASE`, "Where a
33
+ * dependency points").
34
+ *
35
+ * @returns The failure message, or `undefined` where the check passes.
36
+ */
37
+ function publishedElsewhere(task, link, established, own) {
38
+ const { dependency, points } = link;
39
+ const { target } = established;
40
+ const sameWorkspace = dependency.workspaceRoot === task.crate.workspaceRoot;
41
+ // Cargo's settings, apart from the choice of the target registry, in
42
+ // which the two environments differ.
43
+ const differing = (0, publish_settings_1.settingDifferences)(task.env, own.env, ["CARGO_REGISTRY_DEFAULT"]);
44
+ if (points.kind === "crates-io" && target.kind === "crates-io") {
45
+ return undefined;
46
+ }
47
+ let reason;
48
+ if (points.kind === "named" && target.kind === "named") {
49
+ if (sameWorkspace && points.name === target.name && differing.length === 0) {
50
+ return undefined;
51
+ }
52
+ const variable = indexVariable(target.name);
53
+ const index = own.env[variable];
54
+ if (index !== undefined && sameIndex(index, points.index)) {
55
+ return undefined;
56
+ }
57
+ const where = own.envKey === task.envKey ? "" : `in the environment of ${own.label}, `;
58
+ reason = !sameWorkspace
59
+ ? `the two crates lie in different Cargo workspaces, whose configuration files can give one name different indexes, and ${where}${variable} ${index === undefined ? "is not set" : `gives ${index}`} where the entry's index is ${points.index}`
60
+ : points.name === target.name
61
+ ? `${task.label} and ${own.label} run with different Cargo settings, ${sentenceAnd(differing)}, with which one name can stand for different indexes, and ${where}${variable} ${index === undefined ? "is not set" : `gives ${index}`} where the entry's index is ${points.index}`
62
+ : `the entry names \`${points.name}\`, not \`${target.name}\`, and ${where}${variable} does not give \`${target.name}\` the index that \`${points.name}\` has (${points.index})`;
63
+ }
64
+ else if (points.kind === "crates-io") {
65
+ reason =
66
+ "the entry has no `registry` key, so the published crate would depend on crates.io's crate of that name, also where the Cargo configuration replaces crates.io";
67
+ }
68
+ else {
69
+ reason = `the entry names \`${points.name}\``;
70
+ }
71
+ const pointsLabel = points.kind === "crates-io" ? "crates.io" : `the registry \`${points.name}\``;
72
+ const remedies = target.kind === "crates-io"
73
+ ? ["remove the `registry` key from that entry, so that it points to crates.io"]
74
+ : [
75
+ `add \`registry = "${target.name}"\` to that entry, or correct it to name \`${target.name}\``,
76
+ "configure each registry's index under one name",
77
+ ...(sameWorkspace
78
+ ? []
79
+ : [
80
+ `because ${dependency.name} lies in another Cargo workspace, give the registry's index in the environment as ${indexVariable(target.name)}, so that it is the same for every workspace, or keep both crates in one Cargo workspace`,
81
+ ]),
82
+ ];
83
+ if (own.envKey !== task.envKey) {
84
+ remedies.push("give the crates of one release the same Cargo settings, such as in the environment of the command or in .cargo/config.toml, rather than in a dotenv file of one crate");
85
+ }
86
+ return [
87
+ `${task.label}: ${task.crate.name} depends on ${dependency.name} through the entry in ${link.entryManifest}, which points to ${pointsLabel}, while ${dependency.name} is published to ${(0, publish_cargo_1.registryLabel)(target)}, ${established.source}, and @convesoft/nx-rust cannot establish that these are one registry: ${reason}. Nothing was uploaded for ${task.crate.name}: cargo would publish it with a dependency on the crate of that name in ${pointsLabel}.`,
88
+ ` To publish it, ${sentence(remedies)}.`,
89
+ ].join("\n");
90
+ }
91
+ /**
92
+ * The message of a task whose options hold `registry` (`DES-RELEASE`,
93
+ * "Options"; `ADR-PUBLISH-REGISTRY-OPTION`): where the value came from, as
94
+ * the overrides of the task graph tell it, Cargo's own ways to choose a
95
+ * registry, and how npm packages alone get one.
96
+ */
97
+ // @mara implements DES-RELEASE
98
+ function registryOptionMessage(label, value, task) {
99
+ const source = passedToCommand(task, "registry", value)
100
+ ? `${label}: the option \`registry\` (${valueText(value)}) was passed to \`nx release publish\`, and nx-rust does not map it to a Cargo registry. Nothing was published.`
101
+ : [
102
+ `${label}: the option \`registry\` (${valueText(value)}) comes from the workspace's configuration, and nx-rust does not map it to a Cargo registry. Nothing was published.`,
103
+ ` Run \`nx show target ${label} --json\` and look under \`sourceMap\` for the file and entry. An entry of \`targetDefaults\` keyed by \`${targets_1.releasePublishTarget}\` and written for npm reaches crates as well, unless it has a \`filter\` or nx.json has the empty entry keyed by "${targets_1.releasePublishExecutor}" that \`nx add @convesoft/nx-rust\` adds; an entry keyed by "@nx/js:release-publish" reaches npm packages only.`,
104
+ ].join("\n");
105
+ return [
106
+ source,
107
+ ` Cargo chooses the registry itself: set \`publish = ["<name>"]\` in the crate's Cargo.toml or \`registry.default\` in .cargo/config.toml, or run \`CARGO_REGISTRY_DEFAULT=<name> nx release publish\` for one run. Dependencies on crates of this repository then need \`registry = "<name>"\` in their entries.`,
108
+ " To give npm packages alone a registry, publish them in a run of their own (`nx release publish --groups <group> --registry <url>`) or set it in .npmrc.",
109
+ ].join("\n");
110
+ }
111
+ /** The line of a task that ignores one of npm's options `tag`, `access` and `otp` (`DES-RELEASE`, "Options"). */
112
+ function npmOptionLine(label, name, value, task) {
113
+ const source = passedToCommand(task, name, value)
114
+ ? "passed to `nx release publish`"
115
+ : `which comes from the workspace's configuration (run \`nx show target ${label} --json\` and look under \`sourceMap\`)`;
116
+ return `${label}: ignoring option \`${name}\` (${valueText(value)}), ${source}: it is npm's, and cargo publish has no ${exports.npmOptions[name]}. Nothing changes for crates; to give it to npm packages alone, publish them in a run of their own.`;
117
+ }
118
+ function notVerifiedMessage(task, dependency, dependencyTask) {
119
+ return `${task.label}: ${task.crate.name} ${task.crate.version} was not verified, because it needs ${dependency.name} ${dependency.version}, which ${dependencyTask} would publish in another cargo call, and a dry run of one cargo call cannot verify a crate against a version that another call would publish. Nothing was uploaded. The real nx release publish checks before the upload that ${dependency.name} ${dependency.version} is in the registry.`;
120
+ }
121
+ /**
122
+ * A crate of the run that depends on a crate whose task the executor
123
+ * received and failed before it read that crate, as by the dotenv check
124
+ * (`DES-RELEASE`, "Dotenv files"): the dependency's registry and version cannot be
125
+ * told without that task's environment, so the crate is not published.
126
+ */
127
+ function refusedDependencyMessage(task, dependency, refused) {
128
+ return `${task.label}: ${task.crate.name} needs ${dependency.name} ${dependency.version}, which ${refused} would publish, and that task failed in this run, so @convesoft/nx-rust can tell neither where ${dependency.name} goes nor whether it is there, does not publish ${task.crate.name}, and nothing was uploaded for it. Correct what ${refused} reports and run nx release publish again.`;
129
+ }
130
+ function publishFirstMessage(task, dependency, registry, failed) {
131
+ const head = `${task.label}: ${task.crate.name} needs ${dependency.name} ${dependency.version}, which is not in ${(0, publish_cargo_1.registryLabel)(registry)} yet${failed === undefined ? "" : `, because ${failed.label} failed in this run`}, so @convesoft/nx-rust does not publish ${task.crate.name}, and nothing was uploaded for it: cargo would publish it against an older version of ${dependency.name} that its requirement accepts.`;
132
+ if (dependency.hack) {
133
+ return `${head} ${dependency.name} is the hack crate of cargo-hakari, which @convesoft/nx-rust never publishes: publish its stub ${dependency.name} ${dependency.version} to ${(0, publish_cargo_1.registryLabel)(registry)} once yourself, as ${hakariPublishing} describes, and run nx release publish again.`;
134
+ }
135
+ return `${head} Publish ${dependency.name} first: in the same nx release publish, which publishes a dependency's Cargo workspace and release group first, or by running ${dependency.project === undefined ? `the publishing of ${dependency.name}` : `${dependency.project}:${targets_1.releasePublishTarget}`} before this task.`;
136
+ }
137
+ /**
138
+ * The check _Unpublished dependencies_ (`DES-RELEASE`): a dependency that is
139
+ * not published to the registry that its entry points to, through
140
+ * `publish = false` or a `publish` list that does not hold that registry by
141
+ * the entry's own name, `crates-io` for crates.io, fails the crate, because
142
+ * cargo packages the dependency for that registry whatever its `publish`
143
+ * says (`EVD-CARGO-PUBLISH`). Where the entry points to a registry whose
144
+ * name the executor did not find, a `publish` list cannot be compared with
145
+ * it, and the crate fails as well. For a hack crate, the message adds
146
+ * cargo-hakari's two ways (**Hack crate**).
147
+ *
148
+ * @param manifest The dependency's manifest, relative to the repository root.
149
+ * @returns The failure message, or `undefined` where the check passes.
150
+ */
151
+ // @mara implements DES-RELEASE
152
+ function unpublishedMessage(task, link, manifest) {
153
+ const { dependency, points } = link;
154
+ const list = dependency.publish;
155
+ if (list === null) {
156
+ return undefined;
157
+ }
158
+ const crate = task.crate.name;
159
+ if (points.kind === "named" && points.name === "") {
160
+ return [
161
+ `${task.label}: ${crate} depends on ${dependency.name} through the entry in ${link.entryManifest}, which points to the registry with the index ${points.index}, and @convesoft/nx-rust finds no \`registry\` key in that entry, so it cannot establish whether the publish list of ${dependency.name} in ${manifest}, ${JSON.stringify(list)}, holds that registry. Nothing was uploaded for ${crate}.`,
162
+ ` To publish it, name the registry in that entry with \`registry = "<name>"\`, by a name that the publish list of ${dependency.name} holds.`,
163
+ ].join("\n");
164
+ }
165
+ const name = points.kind === "crates-io" ? "crates-io" : points.name;
166
+ if (list.includes(name)) {
167
+ return undefined;
168
+ }
169
+ const pointsLabel = points.kind === "crates-io" ? "crates.io" : `the registry \`${points.name}\``;
170
+ const why = list.length === 0
171
+ ? `${manifest} sets \`publish = false\``
172
+ : `its publish list in ${manifest}, ${JSON.stringify(list)}, does not hold \`${name}\``;
173
+ const remedies = [
174
+ list.length === 0
175
+ ? `publish ${dependency.name} to ${pointsLabel} as well, by removing \`publish = false\` from its manifest`
176
+ : `publish ${dependency.name} to ${pointsLabel} as well, by adding "${name}" to its publish list`,
177
+ ...(list.length === 0
178
+ ? []
179
+ : [
180
+ `name in that entry, with its \`registry\` key, a registry that the publish list of ${dependency.name} holds, ${sentenceOr(list.map((entry) => `\`${entry}\``))}`,
181
+ ]),
182
+ `make ${dependency.name} no normal or build dependency of ${crate}`,
183
+ ];
184
+ return [
185
+ `${task.label}: ${crate} depends on ${dependency.name} through the entry in ${link.entryManifest}, which points to ${pointsLabel}, and ${dependency.name} is not published there: ${why}. Nothing was uploaded for ${crate}: cargo would package it for ${pointsLabel} with a dependency on ${dependency.name}, which fails to resolve there or resolves to an unrelated crate of that name.`,
186
+ ` To publish it, ${sentenceWith(remedies, "or")}.`,
187
+ ...(dependency.hack
188
+ ? [
189
+ ` ${dependency.name} is the hack crate of cargo-hakari, which @convesoft/nx-rust never publishes. cargo-hakari offers two ways: publish a stub of the hack crate once under a name of your own and without \`publish = false\`, after which ${crate} publishes normally; or publish ${crate} with \`cargo hakari publish -p ${crate}\` outside Nx, which takes the dependency out for the upload. See ${hakariPublishing}.`,
190
+ ]
191
+ : []),
192
+ ].join("\n");
193
+ }
194
+ /** The guidance for a crate that would publish to crates.io where the Cargo configuration replaces crates.io (`ADR-PUBLISH-REPLACED-CRATES-IO`). */
195
+ function replacedCratesIoAdvice(crate) {
196
+ return `The Cargo configuration replaces crates.io, such as with a mirror, so @convesoft/nx-rust cannot establish that its checks ask crates.io, where cargo would upload ${crate}. Publish ${crate} to crates.io from a job whose Cargo configuration does not replace crates.io, or publish it to another registry with \`publish = ["<name>"]\`, registry.default or CARGO_REGISTRY_DEFAULT.`;
197
+ }
198
+ /** The message of a lookup that did not establish its source or failed (`DES-RELEASE`, "Lookups"). */
199
+ function lookupFailure(task, crate, registry, lookup, folder) {
200
+ if (lookup.kind === "failed") {
201
+ return [
202
+ `${task.label}: \`${lookup.command}\`, run in ${folder}, failed, so @convesoft/nx-rust cannot tell whether ${crate.name} ${crate.version} is in ${(0, publish_cargo_1.registryLabel)(registry)}, and nothing was uploaded for ${task.crate.name}. Make sure that the registry can be reached and run nx release publish again. cargo printed:`,
203
+ lookup.output.trimEnd(),
204
+ ].join("\n");
205
+ }
206
+ if (lookup.kind !== "unestablished") {
207
+ return `${task.label}: the lookup of ${crate.name} ${crate.version} in ${(0, publish_cargo_1.registryLabel)(registry)} gave no answer.`;
208
+ }
209
+ const head = `${task.label}: \`${lookup.command}\`, run in ${folder}, showed ${lookup.shown} in place of ${(0, publish_cargo_1.registryLabel)(registry)}, so @convesoft/nx-rust cannot tell which registry it asked about ${crate.name} ${crate.version}, and nothing was uploaded for ${task.crate.name}.`;
210
+ if (registry.kind === "crates-io" && lookup.shown !== "no line that starts with Updating") {
211
+ return [head, ` ${replacedCratesIoAdvice(crate.name)}`].join("\n");
212
+ }
213
+ return [
214
+ head,
215
+ ` Configure each registry under one name, the same in every Cargo workspace, without a source replacement for the registry you publish to, and publish online: offline, as with CARGO_NET_OFFLINE=true or net.offline, cargo does not show which registry it asked, and it refuses to publish anyway.`,
216
+ ].join("\n");
217
+ }
218
+ /** `CARGO_REGISTRIES_<NAME>_INDEX` for a registry's name, as cargo spells it. */
219
+ function indexVariable(name) {
220
+ return `CARGO_REGISTRIES_${name.toUpperCase().replace(/-/g, "_")}_INDEX`;
221
+ }
222
+ /** Whether two index URLs are the same, apart from a final `/`. */
223
+ function sameIndex(a, b) {
224
+ return a.replace(/\/$/, "") === b.replace(/\/$/, "");
225
+ }
226
+ /** Each line of a message indented by two spaces. */
227
+ function indented(message) {
228
+ return message
229
+ .split("\n")
230
+ .map((line) => ` ${line}`)
231
+ .join("\n");
232
+ }
233
+ /** "a, b and c". */
234
+ function sentenceAnd(items) {
235
+ return items.length <= 1
236
+ ? items.join("")
237
+ : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
238
+ }
239
+ /** `<project>:<target>`, with `:<configuration>` where the task has one. */
240
+ function configuredLabel(task) {
241
+ const { configuration } = task.target;
242
+ return configuration === undefined ? labelOf(task) : `${labelOf(task)}:${configuration}`;
243
+ }
244
+ function labelOf(task) {
245
+ return `${task.target.project}:${task.target.target}`;
246
+ }
247
+ /** Whether Nx put `name` with `value` among the overrides of the task, which it does only for options of the command. */
248
+ function passedToCommand(task, name, value) {
249
+ const overrides = task.overrides;
250
+ return (overrides !== undefined &&
251
+ Object.prototype.hasOwnProperty.call(overrides, name) &&
252
+ (0, node_util_1.isDeepStrictEqual)(overrides[name], value));
253
+ }
254
+ function valueText(value) {
255
+ return typeof value === "string" ? value : JSON.stringify(value);
256
+ }
257
+ /** "a; b; and c" as the end of a sentence. */
258
+ function sentence(items) {
259
+ return sentenceWith(items, "and");
260
+ }
261
+ /** "a; b; <word> c" as the end of a sentence. */
262
+ function sentenceWith(items, word) {
263
+ return items.length <= 1
264
+ ? items.join("")
265
+ : `${items.slice(0, -1).join("; ")}; ${word} ${items[items.length - 1]}`;
266
+ }
267
+ /** "a, b or c". */
268
+ function sentenceOr(items) {
269
+ return items.length <= 1
270
+ ? items.join("")
271
+ : `${items.slice(0, -1).join(", ")} or ${items[items.length - 1]}`;
272
+ }
273
+ //# sourceMappingURL=publish-messages.js.map