@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,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maxRecordBytes = exports.nxCommandVariable = void 0;
4
+ exports.commandRecords = commandRecords;
5
+ exports.excludesTaskDependencies = excludesTaskDependencies;
6
+ exports.preTasksExecution = preTasksExecution;
7
+ exports.postTasksExecution = postTasksExecution;
8
+ exports.recordedNxCommand = recordedNxCommand;
9
+ exports.parseAsNx = parseAsNx;
10
+ const node_crypto_1 = require("node:crypto");
11
+ const node_fs_1 = require("node:fs");
12
+ const node_path_1 = require("node:path");
13
+ const nx_bridge_1 = require("../compatibility/nx-bridge");
14
+ const lockfile_task_1 = require("../graph/lockfile-task");
15
+ const test_mode_1 = require("./test-mode");
16
+ /**
17
+ * The variable in which the plugin's `preTasksExecution` hook records the
18
+ * arguments of the `nx` command for the command's tasks, as a JSON list of
19
+ * strings (`DES-UNKNOWN-OPTIONS`, paragraph "Record").
20
+ */
21
+ exports.nxCommandVariable = "NX_RUST_NX_COMMAND";
22
+ /**
23
+ * The longest record, in bytes. Linux refuses to start a process with an
24
+ * environment variable longer than 128 KiB, so a longer record would fail
25
+ * every task of the command; it is left empty instead, which counts as no
26
+ * record.
27
+ */
28
+ exports.maxRecordBytes = 64 * 1024;
29
+ /**
30
+ * The variables that the hook sets for the tasks of a command, each computed
31
+ * from the command's arguments as Nx gives them to the hook: `process.argv`
32
+ * of the `nx` process, `--` included.
33
+ *
34
+ * Every variable here is set on every command, so that a value left in the
35
+ * environment by an earlier command, such as in the Nx daemon, which runs the
36
+ * hook in its own process, never reaches a task:
37
+ *
38
+ * - `NX_RUST_NX_COMMAND`, the arguments as a JSON list (`DES-UNKNOWN-OPTIONS`);
39
+ * - `NX_RUST_RUN_ID`, a value that no other run has when the command excludes
40
+ * task dependencies, and the empty string otherwise
41
+ * (`DES-LOCKFILE-HASHING`, "Excluded dependencies"). Every cached target
42
+ * that depends on the lockfile task hashes it, so that such a run, which
43
+ * runs no lockfile task, runs those tasks and stores nothing that is
44
+ * restored again, while a normal run keeps its keys;
45
+ * - `NX_RUST_COMMAND_ID`, an id of the command's own, under which its
46
+ * lockfile tasks keep a private copy of their digests for the check after
47
+ * cargo's call (`DES-LOCKFILE-HASHING`, "Post-check"). It starts with the
48
+ * id that Nx gives the command's hooks, so that
49
+ * {@link postTasksExecution} finds the copies, and ends with a random
50
+ * value, because Nx makes that id from the arguments and the millisecond.
51
+ * No target names it as an input.
52
+ *
53
+ * @param commandId The `id` that Nx gives the command's hooks.
54
+ */
55
+ // @mara implements DES-LOCKFILE-HASHING
56
+ function commandRecords(argv, commandId = "", workspaceRoot) {
57
+ const record = JSON.stringify(argv);
58
+ return {
59
+ [exports.nxCommandVariable]: Buffer.byteLength(record) <= exports.maxRecordBytes ? record : "",
60
+ [lockfile_task_1.runIdVariable]: excludesTaskDependencies(argv, workspaceRoot) ? (0, node_crypto_1.randomUUID)() : "",
61
+ [lockfile_task_1.commandIdVariable]: `${commandIdPrefix(commandId)}${(0, node_crypto_1.randomUUID)()}`,
62
+ };
63
+ }
64
+ /** The start of the {@link commandIdVariable} of the command whose hooks get `id`. */
65
+ function commandIdPrefix(id) {
66
+ return `${id.replace(/[^A-Za-z0-9]/g, "")}-`;
67
+ }
68
+ /**
69
+ * Whether the arguments of an `nx` command exclude task dependencies, as
70
+ * Nx reads its boolean option `excludeTaskDependencies`: with the
71
+ * `yargs-parser` of the installed `nx` package, which takes
72
+ * `--exclude-task-dependencies`, `--excludeTaskDependencies`, `=true`,
73
+ * `=false` and `--no-exclude-task-dependencies` as Nx does. Words after
74
+ * `--` go to the tasks and do not count.
75
+ */
76
+ function excludesTaskDependencies(argv, workspaceRoot) {
77
+ const parsed = (0, nx_bridge_1.loadNxYargsParser)(workspaceRoot)([...argv], {
78
+ boolean: ["excludeTaskDependencies"],
79
+ configuration: { "populate--": true },
80
+ });
81
+ return parsed.excludeTaskDependencies === true;
82
+ }
83
+ /**
84
+ * The plugin's `preTasksExecution` hook, which Nx calls once per entry of the
85
+ * plugin before a command such as `nx run`, `nx run-many` or `nx affected`
86
+ * runs its tasks.
87
+ *
88
+ * It assigns each of {@link commandRecords} to `process.env`. Nx carries
89
+ * such an assignment to the `nx` process, whose tasks inherit it, also when
90
+ * the hook runs in the daemon or in a plugin worker, where Nx records the
91
+ * assignment and applies it to the `nx` process; a deletion would not be
92
+ * carried (`EVD-NX-OPTION-VALIDATION`). The command's record enters no
93
+ * task's cache key; `NX_RUST_RUN_ID` enters the keys of the targets that
94
+ * depend on the lockfile task. Every task of a command gets the same values.
95
+ */
96
+ // @mara implements DES-UNKNOWN-OPTIONS
97
+ function preTasksExecution(_options, context) {
98
+ var _a, _b;
99
+ for (const [name, value] of Object.entries(commandRecords((_a = context.argv) !== null && _a !== void 0 ? _a : [], (_b = context.id) !== null && _b !== void 0 ? _b : "", context.workspaceRoot))) {
100
+ process.env[name] = value;
101
+ }
102
+ }
103
+ /**
104
+ * The plugin's `postTasksExecution` hook, which Nx calls once per entry of
105
+ * the plugin after a command has run its tasks, with the `id` that the
106
+ * command's `preTasksExecution` got. It removes the private copies of the
107
+ * digests that the command's lockfile tasks wrote (`DES-LOCKFILE-HASHING`),
108
+ * and the command's record of test modes with those that stopped commands
109
+ * left more than a day ago (`DES-TEST-MODE`). It removes what it can and
110
+ * never fails the command.
111
+ * A command that does not get here, because it was stopped, leaves its
112
+ * copies to the next lockfile task of the workspace, which removes those
113
+ * older than a day.
114
+ */
115
+ // @mara implements DES-LOCKFILE-HASHING
116
+ function postTasksExecution(_options, context) {
117
+ var _a;
118
+ const prefix = commandIdPrefix((_a = context.id) !== null && _a !== void 0 ? _a : "");
119
+ if (prefix === "-") {
120
+ return;
121
+ }
122
+ // The records of the test mode (`DES-TEST-MODE`): this command's, and
123
+ // those that a stopped command left more than a day ago.
124
+ const records = (0, node_path_1.join)(context.workspaceRoot, test_mode_1.testModeRecordRoot);
125
+ const dayAgo = Date.now() - 24 * 60 * 60 * 1000;
126
+ for (const command of entries(records)) {
127
+ const folder = (0, node_path_1.join)(records, command);
128
+ if (command.startsWith(prefix) || modifiedBefore(folder, dayAgo)) {
129
+ removeQuietly(folder);
130
+ }
131
+ }
132
+ const root = (0, node_path_1.join)(context.workspaceRoot, lockfile_task_1.digestRoot);
133
+ for (const workspace of entries(root)) {
134
+ const commands = (0, node_path_1.join)(root, workspace, lockfile_task_1.commandsFolderName);
135
+ for (const command of entries(commands)) {
136
+ if (command.startsWith(prefix)) {
137
+ removeQuietly((0, node_path_1.join)(commands, command));
138
+ }
139
+ }
140
+ }
141
+ }
142
+ // Removes a folder where it can: the cleanup never fails the command, and a
143
+ // record left in place makes later tasks in affected mode run their full
144
+ // suite at worst (`DES-TEST-MODE`).
145
+ function removeQuietly(folder) {
146
+ try {
147
+ (0, node_fs_1.rmSync)(folder, { recursive: true, force: true });
148
+ }
149
+ catch (_a) {
150
+ // Left for a later command.
151
+ }
152
+ }
153
+ // Whether a file or folder was last modified before `time`; not where it is gone.
154
+ function modifiedBefore(path, time) {
155
+ try {
156
+ return (0, node_fs_1.statSync)(path).mtimeMs < time;
157
+ }
158
+ catch (_a) {
159
+ return false;
160
+ }
161
+ }
162
+ // The names in a folder, none where it does not exist.
163
+ function entries(folder) {
164
+ try {
165
+ return (0, node_fs_1.readdirSync)(folder);
166
+ }
167
+ catch (_a) {
168
+ return [];
169
+ }
170
+ }
171
+ /**
172
+ * The arguments of the `nx` command that started the task, as the hook
173
+ * recorded them in `env`, or `undefined` when there is no record, when it is
174
+ * empty, or when it is not a JSON list of strings.
175
+ */
176
+ function recordedNxCommand(env = process.env) {
177
+ const value = env[exports.nxCommandVariable];
178
+ if (value === undefined || value === "") {
179
+ return undefined;
180
+ }
181
+ try {
182
+ const argv = JSON.parse(value);
183
+ return Array.isArray(argv) && argv.every((word) => typeof word === "string") ? argv : undefined;
184
+ }
185
+ catch (_a) {
186
+ return undefined;
187
+ }
188
+ }
189
+ /**
190
+ * The options that Nx parses from `args` when it hands them to a task as
191
+ * overrides: with the `yargs-parser` that the installed `nx` package uses,
192
+ * configured as Nx configures it there (`createOverrides` in
193
+ * `utils/command-line-utils.js` of `nx` 24), and without `_` when no
194
+ * positional word is left.
195
+ */
196
+ function parseAsNx(args, workspaceRoot) {
197
+ const parsed = (0, nx_bridge_1.loadNxYargsParser)(workspaceRoot)([...args], {
198
+ configuration: { "camel-case-expansion": false, "dot-notation": true },
199
+ });
200
+ if (parsed._ === undefined || parsed._.length === 0) {
201
+ delete parsed._;
202
+ }
203
+ return parsed;
204
+ }
205
+ //# sourceMappingURL=nx-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-command.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/nx-command.ts"],"names":[],"mappings":";;;AAuDA,wCAWC;AAeD,4DAMC;AAgBD,8CAMC;AAeD,gDAwBC;AAoCD,8CAWC;AAYD,8BAQC;AAtND,6CAAyC;AACzC,qCAAwD;AACxD,yCAAiC;AACjC,0DAA+D;AAC/D,0DAKgC;AAChC,2CAAiD;AAEjD;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD;;;;;GAKG;AACU,QAAA,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wCAAwC;AACxC,SAAgB,cAAc,CAC5B,IAAuB,EACvB,SAAS,GAAG,EAAE,EACd,aAAsB;IAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO;QACL,CAAC,yBAAiB,CAAC,EAAE,MAAM,CAAC,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H,SAAgB,SAAS,CAAC,IAAuB,EAAE,aAAsB;IACvE,MAAM,MAAM,GAAoB,IAAA,6BAAiB,EAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;QAC1E,aAAa,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE;KACvE,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,82 @@
1
+ import type { ExecutorContext } from "@nx/devkit";
2
+ import { NxBridgeError, type NxHashPlanInspector } from "../compatibility/nx-bridge";
3
+ /** What Nx knows about the files of one task, from the Nx installed in the repository. */
4
+ export interface NxTaskFiles {
5
+ /**
6
+ * The files that Nx's hash of the task reads, by their paths relative to
7
+ * the repository root: Nx's own matching of the task's file inputs.
8
+ */
9
+ inputFiles: ReadonlySet<string>;
10
+ /**
11
+ * The files that Nx sees below a folder, relative to the repository root:
12
+ * none that `.gitignore`, `.nxignore` or Nx's fixed exclusions leave out,
13
+ * and none below a symbolic link to a folder. The repository is listed on
14
+ * the first call alone, so an instance serves one check and is made after
15
+ * the cargo call whose build it judges, and after
16
+ * {@link resetNxWorkspaceContext} has cleared the context of this process.
17
+ *
18
+ * @param folder A path relative to the repository root, `""` for the root.
19
+ */
20
+ filesBelow(folder: string): string[];
21
+ }
22
+ /**
23
+ * Why the check cannot ask the installed Nx about a task's files: a part
24
+ * that it lacks or that has changed. Its message is one line, the reason
25
+ * alone ({@link skippedCheckWarning}).
26
+ */
27
+ export declare class NxTaskFilesError extends Error {
28
+ constructor(message: string);
29
+ }
30
+ /** Converts a bridge failure into an {@link NxTaskFilesError} with its diagnostic wording. */
31
+ export declare function toTaskFilesError(error: NxBridgeError): NxTaskFilesError;
32
+ /** The internal parts of the installed Nx that the check uses, loaded. */
33
+ export interface NxTaskFileParts {
34
+ /** `HashPlanInspector` of `nx/src/hasher/hash-plan-inspector`. */
35
+ Inspector: new (...args: unknown[]) => NxHashPlanInspector;
36
+ /** `globWithWorkspaceContextSync` of `nx/src/utils/workspace-context`. */
37
+ glob: (workspaceRoot: string, globs: string[]) => unknown;
38
+ /** `resetWorkspaceContext` of `nx/src/utils/workspace-context`. */
39
+ reset: () => void;
40
+ }
41
+ /**
42
+ * Loads the parts of the installed Nx through which the check matches a
43
+ * build's files with its inputs, which are not public API
44
+ * (`RISK-UPSTREAM-CHANGES`): `HashPlanInspector`, which expands a task's
45
+ * hash plan into the files it reads with Nx's own matching, and the glob and
46
+ * the reset of the workspace context that it reads the files from. Without
47
+ * the reset the check could judge a build by a list older than its cargo
48
+ * call, so it is as necessary as the other two.
49
+ *
50
+ * @throws {NxTaskFilesError} When the installed Nx lacks one of them, naming it.
51
+ */
52
+ export declare function nxTaskFileParts(workspaceRoot: string): NxTaskFileParts;
53
+ /**
54
+ * Clears Nx's workspace context in this process, from which
55
+ * `HashPlanInspector` and the glob read the repository's files: Nx makes it
56
+ * on first use and keeps it for the life of the process, so that in a batch
57
+ * process a later group's check would read the files as they were when an
58
+ * earlier group's check first listed them. Cleared after a cargo call, the
59
+ * next read lists the files as the call left them (`DES-BUILD-INPUT-CHECK`,
60
+ * point 5). Called once after the cargo calls of a group and before any of
61
+ * its checks, which run at the same time, never between two of them.
62
+ *
63
+ * Where the installed Nx lacks a part of the check, nothing is cleared: each
64
+ * check then fails to load the parts and warns that it did not run.
65
+ */
66
+ export declare function resetNxWorkspaceContext(workspaceRoot: string): void;
67
+ /**
68
+ * The files that Nx hashes for the task of `context`, and those that it sees
69
+ * in the repository, through the parts that {@link nxTaskFileParts} loaded.
70
+ * Both run in this process, without the daemon.
71
+ *
72
+ * @throws {NxTaskFilesError} When a part gives a result of another shape, or
73
+ * Nx gave the executor no project graph.
74
+ */
75
+ export declare function nxTaskFiles({ Inspector, glob }: NxTaskFileParts, context: ExecutorContext): Promise<NxTaskFiles>;
76
+ /**
77
+ * The one warning line of a task whose check did not run because the
78
+ * installed Nx lacks, or has changed, a part that it needs
79
+ * (`DES-DIAGNOSTICS`). Only an Nx that the plugin does not support can,
80
+ * which `NX_RUST_ALLOW_UNSUPPORTED_NX` lets the plugin run with.
81
+ */
82
+ export declare function skippedCheckWarning(task: string, error: NxTaskFilesError): string;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NxTaskFilesError = void 0;
4
+ exports.toTaskFilesError = toTaskFilesError;
5
+ exports.nxTaskFileParts = nxTaskFileParts;
6
+ exports.resetNxWorkspaceContext = resetNxWorkspaceContext;
7
+ exports.nxTaskFiles = nxTaskFiles;
8
+ exports.skippedCheckWarning = skippedCheckWarning;
9
+ const tslib_1 = require("tslib");
10
+ const nx_bridge_1 = require("../compatibility/nx-bridge");
11
+ /**
12
+ * Why the check cannot ask the installed Nx about a task's files: a part
13
+ * that it lacks or that has changed. Its message is one line, the reason
14
+ * alone ({@link skippedCheckWarning}).
15
+ */
16
+ class NxTaskFilesError extends Error {
17
+ constructor(message) {
18
+ super(message);
19
+ this.name = "NxTaskFilesError";
20
+ }
21
+ }
22
+ exports.NxTaskFilesError = NxTaskFilesError;
23
+ /** Converts a bridge failure into an {@link NxTaskFilesError} with its diagnostic wording. */
24
+ function toTaskFilesError(error) {
25
+ const { failure } = error;
26
+ return new NxTaskFilesError(failure.kind === "load"
27
+ ? `${failure.module} cannot be loaded from the installed Nx (${failure.reason})`
28
+ : `the installed Nx lacks ${failure.exportName} in ${failure.module}`);
29
+ }
30
+ /**
31
+ * Loads the parts of the installed Nx through which the check matches a
32
+ * build's files with its inputs, which are not public API
33
+ * (`RISK-UPSTREAM-CHANGES`): `HashPlanInspector`, which expands a task's
34
+ * hash plan into the files it reads with Nx's own matching, and the glob and
35
+ * the reset of the workspace context that it reads the files from. Without
36
+ * the reset the check could judge a build by a list older than its cargo
37
+ * call, so it is as necessary as the other two.
38
+ *
39
+ * @throws {NxTaskFilesError} When the installed Nx lacks one of them, naming it.
40
+ */
41
+ // @mara implements DES-BUILD-INPUT-CHECK
42
+ function nxTaskFileParts(workspaceRoot) {
43
+ try {
44
+ const { HashPlanInspector: Inspector } = (0, nx_bridge_1.loadHashPlanInspector)(workspaceRoot);
45
+ const { globWithWorkspaceContextSync: glob, resetWorkspaceContext: reset } = (0, nx_bridge_1.loadWorkspaceContext)(workspaceRoot, [
46
+ "globWithWorkspaceContextSync",
47
+ "resetWorkspaceContext",
48
+ ]);
49
+ return { Inspector, glob, reset };
50
+ }
51
+ catch (error) {
52
+ if (error instanceof nx_bridge_1.NxBridgeError) {
53
+ throw toTaskFilesError(error);
54
+ }
55
+ throw error;
56
+ }
57
+ }
58
+ /**
59
+ * Clears Nx's workspace context in this process, from which
60
+ * `HashPlanInspector` and the glob read the repository's files: Nx makes it
61
+ * on first use and keeps it for the life of the process, so that in a batch
62
+ * process a later group's check would read the files as they were when an
63
+ * earlier group's check first listed them. Cleared after a cargo call, the
64
+ * next read lists the files as the call left them (`DES-BUILD-INPUT-CHECK`,
65
+ * point 5). Called once after the cargo calls of a group and before any of
66
+ * its checks, which run at the same time, never between two of them.
67
+ *
68
+ * Where the installed Nx lacks a part of the check, nothing is cleared: each
69
+ * check then fails to load the parts and warns that it did not run.
70
+ */
71
+ // @mara implements DES-BUILD-INPUT-CHECK
72
+ function resetNxWorkspaceContext(workspaceRoot) {
73
+ let parts;
74
+ try {
75
+ parts = nxTaskFileParts(workspaceRoot);
76
+ }
77
+ catch (error) {
78
+ if (error instanceof NxTaskFilesError) {
79
+ return;
80
+ }
81
+ throw error;
82
+ }
83
+ parts.reset();
84
+ }
85
+ /**
86
+ * The files that Nx hashes for the task of `context`, and those that it sees
87
+ * in the repository, through the parts that {@link nxTaskFileParts} loaded.
88
+ * Both run in this process, without the daemon.
89
+ *
90
+ * @throws {NxTaskFilesError} When a part gives a result of another shape, or
91
+ * Nx gave the executor no project graph.
92
+ */
93
+ // @mara implements DES-BUILD-INPUT-CHECK
94
+ function nxTaskFiles(_a, context_1) {
95
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ Inspector, glob }, context) {
96
+ var _b, _c, _d;
97
+ const project = (_b = context.projectName) !== null && _b !== void 0 ? _b : "";
98
+ const target = (_c = context.targetName) !== null && _c !== void 0 ? _c : "";
99
+ if (context.projectGraph === undefined) {
100
+ throw new NxTaskFilesError("Nx gave the executor no project graph");
101
+ }
102
+ const inspector = new Inspector(context.projectGraph, context.root, context.nxJsonConfiguration);
103
+ if (typeof inspector.init !== "function" || typeof inspector.inspectTaskInputs !== "function") {
104
+ throw new NxTaskFilesError("HashPlanInspector of the installed Nx lacks init or inspectTaskInputs");
105
+ }
106
+ yield inspector.init();
107
+ const configuration = context.configurationName || undefined;
108
+ const inputs = inspector.inspectTaskInputs(Object.assign({ project, target }, (configuration === undefined ? {} : { configuration })), {}, {}, true);
109
+ // The task's id as Nx forms it; where Nx resolved the configuration
110
+ // otherwise, the one task of the project's target.
111
+ const id = [project, target, configuration].filter((part) => part !== undefined).join(":");
112
+ const candidates = Object.keys(inputs !== null && inputs !== void 0 ? inputs : {}).filter((key) => key === `${project}:${target}` || key.startsWith(`${project}:${target}:`));
113
+ const key = id in (inputs !== null && inputs !== void 0 ? inputs : {}) ? id : candidates.length === 1 ? candidates[0] : id;
114
+ const files = (_d = inputs === null || inputs === void 0 ? void 0 : inputs[key]) === null || _d === void 0 ? void 0 : _d.files;
115
+ if (!isPathList(files)) {
116
+ throw new NxTaskFilesError(`the inputs that HashPlanInspector of the installed Nx gives for ${id} hold no list of files`);
117
+ }
118
+ // The repository's files as Nx sees them, listed once on first use and
119
+ // kept for the instance's lifetime. The check makes an instance after the
120
+ // task's cargo call and after the workspace context was cleared
121
+ // (resetNxWorkspaceContext), and drops it when that task's comparison
122
+ // ends, with no write of files in between (`DES-BUILD-INPUT-CHECK`), so
123
+ // neither this list nor the inspector's files can be older than the build
124
+ // it judges.
125
+ let repositoryFiles;
126
+ return {
127
+ inputFiles: new Set(files),
128
+ filesBelow(folder) {
129
+ if (repositoryFiles === undefined) {
130
+ const all = glob(context.root, ["**/*"]);
131
+ if (!isPathList(all)) {
132
+ throw new NxTaskFilesError("globWithWorkspaceContextSync of the installed Nx gives no list of file paths");
133
+ }
134
+ repositoryFiles = all;
135
+ }
136
+ return folder === ""
137
+ ? [...repositoryFiles]
138
+ : repositoryFiles.filter((file) => file.startsWith(`${folder}/`));
139
+ },
140
+ };
141
+ });
142
+ }
143
+ /**
144
+ * The one warning line of a task whose check did not run because the
145
+ * installed Nx lacks, or has changed, a part that it needs
146
+ * (`DES-DIAGNOSTICS`). Only an Nx that the plugin does not support can,
147
+ * which `NX_RUST_ALLOW_UNSUPPORTED_NX` lets the plugin run with.
148
+ */
149
+ // @mara implements DES-DIAGNOSTICS
150
+ function skippedCheckWarning(task, error) {
151
+ return `nx-rust: ${task}: the build input check did not run, because ${error.message}, so Nx caches the result without it. Use an Nx version that @convesoft/nx-rust supports, or a version of @convesoft/nx-rust that supports the installed one.`;
152
+ }
153
+ function isPathList(value) {
154
+ return Array.isArray(value) && value.every((path) => typeof path === "string");
155
+ }
156
+ //# sourceMappingURL=nx-task-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-task-files.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/nx-task-files.ts"],"names":[],"mappings":";;;AAyCA,4CAOC;AAwBD,0CAeC;AAgBD,0DAWC;AAWD,kCA6DC;AASD,kDAEC;;AApMD,0DAKoC;AAsBpC;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED,8FAA8F;AAC9F,SAAgB,gBAAgB,CAAC,KAAoB;IACnD,M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oBACtB,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;YACtE,CAAC;SACF,CAAC;IACJ,CAAC;CAAA;AAED;;;;;GAKG;AACH,mCAAmC;AACnC,SAAgB,mBAAmB,CAAC,IAAY,EAAE,KAAuB;IACvE,OAAO,YAAY,IAAI,gDAAgD,KAAK,CAAC,OAAO,+JAA+J,CAAC;AACtP,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AACjF,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_mode_1 = require("./test-mode");
4
+ /**
5
+ * Prints the test mode of a `test` task in a workspace that uses selection
6
+ * (`DES-TEST-MODE`): `full`, `affected:<commits>` or the line for an invalid
7
+ * `NX_RUST_TEST_MODE`, by the rule that the test executor applies as well,
8
+ * or a value that is never restored where a subset of the same `nx` command
9
+ * ran in another mode or the record cannot be written
10
+ * ({@link printedTestMode}).
11
+ *
12
+ * The runtime input of such a `test` runs it in the repository root with
13
+ * the task's environment and the workspace root, relative to the repository
14
+ * root, as its argument. It reads cargo-affected's database without writing
15
+ * to it and starts no other program, so that it costs a start of Node and a
16
+ * query; in a run, it adds the line it prints to the command's record in
17
+ * the plugin's folder under `.nx/workspace-data`.
18
+ */
19
+ // @mara implements DES-TEST-MODE
20
+ function printTestMode() {
21
+ var _a;
22
+ process.stdout.write(`${(0, test_mode_1.printedTestMode)(process.env, process.cwd(), (_a = process.argv[2]) !== null && _a !== void 0 ? _a : ".")}\n`);
23
+ }
24
+ printTestMode();
25
+ //# sourceMappingURL=print-test-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-test-mode.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/print-test-mode.ts"],"names":[],"mappings":";;AAAA,2CAA8C;AAE9C;;;;;;;;;;;;;;GAcG;AACH,iCAAiC;AACjC,SAAS,aAAa;;IACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,2BAAe,EAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,GAAG,CAAC,IAAI,CAAC,CAAC;AACnG,CAAC;AAED,aAAa,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { ExecutorContext, TaskGraph } from "@nx/devkit";
2
+ import { type PublishReport } from "../../release/publish";
3
+ /**
4
+ * The executor of `nx-release-publish`, `@convesoft/nx-rust:release-publish`,
5
+ * for a task that Nx runs on its own, as with `NX_BATCH_MODE=false`: the task
6
+ * runs the same checks as in a batch and one `cargo publish --locked -p
7
+ * <crate>` for its own crate, with its target registry (`DES-RELEASE`,
8
+ * "Without a batch"), after the dotenv check of the cargo executors
9
+ * (`DES-RELEASE`, "Dotenv files").
10
+ */
11
+ export default function releasePublish(options: Record<string, unknown>, context: ExecutorContext): Promise<{
12
+ success: boolean;
13
+ }>;
14
+ /**
15
+ * The batch implementation of `@convesoft/nx-rust:release-publish`, which
16
+ * receives the runnable `nx-release-publish` tasks of one release group
17
+ * (`EVD-NX-24-PUBLISH-BATCHES`) and publishes the crates of each Cargo
18
+ * workspace and registry with one `cargo publish` (`DES-RELEASE`, "Batch";
19
+ * `ADR-BATCHED-PUBLISH`). Each task gets the environment that it gets when
20
+ * it runs on its own (`DES-BATCH`), checked as there (`DES-RELEASE`,
21
+ * "Dotenv files"), and a result of its own, also where its environment cannot
22
+ * be rebuilt.
23
+ */
24
+ export declare function batch(taskGraph: TaskGraph, inputs: Record<string, Record<string, unknown>>, _overrides: unknown, context: ExecutorContext): AsyncGenerator<PublishReport>;