@convesoft/nx-rust 0.0.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/PLUGIN.md +106 -0
- package/README.md +51 -1
- package/docs/artifacts.mara.md +374 -0
- package/docs/caching.mara.md +999 -0
- package/docs/ci.mara.md +308 -0
- package/docs/configuration.mara.md +508 -0
- package/docs/decisions.mara.md +3267 -0
- package/docs/execution.mara.md +533 -0
- package/docs/index.mara.md +51 -0
- package/docs/product.mara.md +366 -0
- package/docs/release.mara.md +493 -0
- package/docs/setup.mara.md +486 -0
- package/docs/targets.mara.md +704 -0
- package/docs/testing.mara.md +431 -0
- package/docs/verification.mara.md +465 -0
- package/docs/workspaces.mara.md +445 -0
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +17 -4
- package/src/cargo/build-settings.d.ts +61 -0
- package/src/cargo/build-settings.js +103 -0
- package/src/cargo/build-settings.js.map +1 -0
- package/src/cargo/configured-runner.d.ts +36 -0
- package/src/cargo/configured-runner.js +99 -0
- package/src/cargo/configured-runner.js.map +1 -0
- package/src/cargo/configured-tools.d.ts +35 -0
- package/src/cargo/configured-tools.js +46 -0
- package/src/cargo/configured-tools.js.map +1 -0
- package/src/cargo/dep-info-basedir.d.ts +18 -0
- package/src/cargo/dep-info-basedir.js +38 -0
- package/src/cargo/dep-info-basedir.js.map +1 -0
- package/src/cargo/directories.d.ts +40 -0
- package/src/cargo/directories.js +89 -0
- package/src/cargo/directories.js.map +1 -0
- package/src/cargo/host-triple.d.ts +7 -0
- package/src/cargo/host-triple.js +21 -0
- package/src/cargo/host-triple.js.map +1 -0
- package/src/cargo/lockfile.d.ts +63 -0
- package/src/cargo/lockfile.js +157 -0
- package/src/cargo/lockfile.js.map +1 -0
- package/src/cargo/metadata.d.ts +114 -0
- package/src/cargo/metadata.js +37 -0
- package/src/cargo/metadata.js.map +1 -0
- package/src/cargo/package-specs.d.ts +54 -0
- package/src/cargo/package-specs.js +109 -0
- package/src/cargo/package-specs.js.map +1 -0
- package/src/cargo/paths-crates.d.ts +27 -0
- package/src/cargo/paths-crates.js +69 -0
- package/src/cargo/paths-crates.js.map +1 -0
- package/src/cargo/print-artifact-folders.d.ts +1 -0
- package/src/cargo/print-artifact-folders.js +58 -0
- package/src/cargo/print-artifact-folders.js.map +1 -0
- package/src/cargo/redirections.d.ts +90 -0
- package/src/cargo/redirections.js +200 -0
- package/src/cargo/redirections.js.map +1 -0
- package/src/cargo/run-cargo.d.ts +31 -0
- package/src/cargo/run-cargo.js +75 -0
- package/src/cargo/run-cargo.js.map +1 -0
- package/src/cargo/target-triples.d.ts +98 -0
- package/src/cargo/target-triples.js +265 -0
- package/src/cargo/target-triples.js.map +1 -0
- package/src/cargo/version-req.d.ts +12 -0
- package/src/cargo/version-req.js +122 -0
- package/src/cargo/version-req.js.map +1 -0
- package/src/cargo/warnings-setting.d.ts +24 -0
- package/src/cargo/warnings-setting.js +81 -0
- package/src/cargo/warnings-setting.js.map +1 -0
- package/src/compatibility/cargo-version.d.ts +43 -0
- package/src/compatibility/cargo-version.js +83 -0
- package/src/compatibility/cargo-version.js.map +1 -0
- package/src/compatibility/nx-bridge.d.ts +312 -0
- package/src/compatibility/nx-bridge.js +407 -0
- package/src/compatibility/nx-bridge.js.map +1 -0
- package/src/compatibility/nx-version.d.ts +104 -0
- package/src/compatibility/nx-version.js +272 -0
- package/src/compatibility/nx-version.js.map +1 -0
- package/src/executors/affected-inputs.d.ts +29 -0
- package/src/executors/affected-inputs.js +259 -0
- package/src/executors/affected-inputs.js.map +1 -0
- package/src/executors/affected-run.d.ts +54 -0
- package/src/executors/affected-run.js +394 -0
- package/src/executors/affected-run.js.map +1 -0
- package/src/executors/affected.d.ts +239 -0
- package/src/executors/affected.js +589 -0
- package/src/executors/affected.js.map +1 -0
- package/src/executors/baseline-context.d.ts +85 -0
- package/src/executors/baseline-context.js +227 -0
- package/src/executors/baseline-context.js.map +1 -0
- package/src/executors/baseline.d.ts +123 -0
- package/src/executors/baseline.js +356 -0
- package/src/executors/baseline.js.map +1 -0
- package/src/executors/batch.d.ts +75 -0
- package/src/executors/batch.js +434 -0
- package/src/executors/batch.js.map +1 -0
- package/src/executors/build-records.d.ts +110 -0
- package/src/executors/build-records.js +267 -0
- package/src/executors/build-records.js.map +1 -0
- package/src/executors/cargo/executor.d.ts +28 -0
- package/src/executors/cargo/executor.js +58 -0
- package/src/executors/cargo/executor.js.map +1 -0
- package/src/executors/cargo/schema.json +58 -0
- package/src/executors/cargo-invocation.d.ts +81 -0
- package/src/executors/cargo-invocation.js +109 -0
- package/src/executors/cargo-invocation.js.map +1 -0
- package/src/executors/cargo-output.d.ts +218 -0
- package/src/executors/cargo-output.js +660 -0
- package/src/executors/cargo-output.js.map +1 -0
- package/src/executors/command.d.ts +331 -0
- package/src/executors/command.js +547 -0
- package/src/executors/command.js.map +1 -0
- package/src/executors/coverage-baseline.d.ts +23 -0
- package/src/executors/coverage-baseline.js +284 -0
- package/src/executors/coverage-baseline.js.map +1 -0
- package/src/executors/declared-options.d.ts +21 -0
- package/src/executors/declared-options.js +58 -0
- package/src/executors/declared-options.js.map +1 -0
- package/src/executors/denied-warnings.d.ts +99 -0
- package/src/executors/denied-warnings.js +188 -0
- package/src/executors/denied-warnings.js.map +1 -0
- package/src/executors/digests.d.ts +94 -0
- package/src/executors/digests.js +190 -0
- package/src/executors/digests.js.map +1 -0
- package/src/executors/dotenv-check.d.ts +79 -0
- package/src/executors/dotenv-check.js +553 -0
- package/src/executors/dotenv-check.js.map +1 -0
- package/src/executors/group-invocations.d.ts +80 -0
- package/src/executors/group-invocations.js +253 -0
- package/src/executors/group-invocations.js.map +1 -0
- package/src/executors/group-run.d.ts +114 -0
- package/src/executors/group-run.js +601 -0
- package/src/executors/group-run.js.map +1 -0
- package/src/executors/groups.d.ts +118 -0
- package/src/executors/groups.js +304 -0
- package/src/executors/groups.js.map +1 -0
- package/src/executors/input-check.d.ts +52 -0
- package/src/executors/input-check.js +271 -0
- package/src/executors/input-check.js.map +1 -0
- package/src/executors/kept-files.d.ts +98 -0
- package/src/executors/kept-files.js +341 -0
- package/src/executors/kept-files.js.map +1 -0
- package/src/executors/lockfile/executor.d.ts +16 -0
- package/src/executors/lockfile/executor.js +37 -0
- package/src/executors/lockfile/executor.js.map +1 -0
- package/src/executors/lockfile/schema.json +50 -0
- package/src/executors/napi-build.d.ts +73 -0
- package/src/executors/napi-build.js +420 -0
- package/src/executors/napi-build.js.map +1 -0
- package/src/executors/nextest.d.ts +189 -0
- package/src/executors/nextest.js +504 -0
- package/src/executors/nextest.js.map +1 -0
- package/src/executors/nx-command.d.ts +95 -0
- package/src/executors/nx-command.js +205 -0
- package/src/executors/nx-command.js.map +1 -0
- package/src/executors/nx-task-files.d.ts +82 -0
- package/src/executors/nx-task-files.js +156 -0
- package/src/executors/nx-task-files.js.map +1 -0
- package/src/executors/print-test-mode.d.ts +1 -0
- package/src/executors/print-test-mode.js +25 -0
- package/src/executors/print-test-mode.js.map +1 -0
- package/src/executors/release-publish/executor.d.ts +24 -0
- package/src/executors/release-publish/executor.js +165 -0
- package/src/executors/release-publish/executor.js.map +1 -0
- package/src/executors/release-publish/schema.json +30 -0
- package/src/executors/run/executor.d.ts +12 -0
- package/src/executors/run/executor.js +27 -0
- package/src/executors/run/executor.js.map +1 -0
- package/src/executors/run/schema.json +45 -0
- package/src/executors/runner-script.d.ts +12 -0
- package/src/executors/runner-script.js +22 -0
- package/src/executors/runner-script.js.map +1 -0
- package/src/executors/runtime-input-check.d.ts +24 -0
- package/src/executors/runtime-input-check.js +87 -0
- package/src/executors/runtime-input-check.js.map +1 -0
- package/src/executors/shared-artifacts.d.ts +44 -0
- package/src/executors/shared-artifacts.js +132 -0
- package/src/executors/shared-artifacts.js.map +1 -0
- package/src/executors/split-words.d.ts +24 -0
- package/src/executors/split-words.js +111 -0
- package/src/executors/split-words.js.map +1 -0
- package/src/executors/stage.d.ts +163 -0
- package/src/executors/stage.js +526 -0
- package/src/executors/stage.js.map +1 -0
- package/src/executors/staged-run.d.ts +24 -0
- package/src/executors/staged-run.js +110 -0
- package/src/executors/staged-run.js.map +1 -0
- package/src/executors/task-env.d.ts +271 -0
- package/src/executors/task-env.js +494 -0
- package/src/executors/task-env.js.map +1 -0
- package/src/executors/task-execution.d.ts +61 -0
- package/src/executors/task-execution.js +122 -0
- package/src/executors/task-execution.js.map +1 -0
- package/src/executors/task-guards.d.ts +112 -0
- package/src/executors/task-guards.js +435 -0
- package/src/executors/task-guards.js.map +1 -0
- package/src/executors/task-options.d.ts +114 -0
- package/src/executors/task-options.js +258 -0
- package/src/executors/task-options.js.map +1 -0
- package/src/executors/task.d.ts +166 -0
- package/src/executors/task.js +527 -0
- package/src/executors/task.js.map +1 -0
- package/src/executors/test-mode.d.ts +185 -0
- package/src/executors/test-mode.js +397 -0
- package/src/executors/test-mode.js.map +1 -0
- package/src/executors/test-runner.d.ts +44 -0
- package/src/executors/test-runner.js +159 -0
- package/src/executors/test-runner.js.map +1 -0
- package/src/executors/test-steps.d.ts +121 -0
- package/src/executors/test-steps.js +566 -0
- package/src/executors/test-steps.js.map +1 -0
- package/src/executors/wasm-build.d.ts +56 -0
- package/src/executors/wasm-build.js +216 -0
- package/src/executors/wasm-build.js.map +1 -0
- package/src/generators/crate/binary.schema.json +28 -0
- package/src/generators/crate/crate.d.ts +24 -0
- package/src/generators/crate/crate.js +108 -0
- package/src/generators/crate/crate.js.map +1 -0
- package/src/generators/crate/enclosing-workspace.d.ts +25 -0
- package/src/generators/crate/enclosing-workspace.js +58 -0
- package/src/generators/crate/enclosing-workspace.js.map +1 -0
- package/src/generators/crate/library.schema.json +28 -0
- package/src/generators/init/graph-check.d.ts +81 -0
- package/src/generators/init/graph-check.js +299 -0
- package/src/generators/init/graph-check.js.map +1 -0
- package/src/generators/init/init.d.ts +23 -0
- package/src/generators/init/init.js +113 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/report.d.ts +19 -0
- package/src/generators/init/report.js +93 -0
- package/src/generators/init/report.js.map +1 -0
- package/src/generators/init/schema.json +9 -0
- package/src/graph/artifact-kinds.d.ts +29 -0
- package/src/graph/artifact-kinds.js +50 -0
- package/src/graph/artifact-kinds.js.map +1 -0
- package/src/graph/artifact-names.d.ts +97 -0
- package/src/graph/artifact-names.js +276 -0
- package/src/graph/artifact-names.js.map +1 -0
- package/src/graph/build-records.d.ts +74 -0
- package/src/graph/build-records.js +104 -0
- package/src/graph/build-records.js.map +1 -0
- package/src/graph/caching.d.ts +148 -0
- package/src/graph/caching.js +681 -0
- package/src/graph/caching.js.map +1 -0
- package/src/graph/clippy-input.d.ts +53 -0
- package/src/graph/clippy-input.js +107 -0
- package/src/graph/clippy-input.js.map +1 -0
- package/src/graph/collisions.d.ts +113 -0
- package/src/graph/collisions.js +156 -0
- package/src/graph/collisions.js.map +1 -0
- package/src/graph/computation-reports.d.ts +89 -0
- package/src/graph/computation-reports.js +216 -0
- package/src/graph/computation-reports.js.map +1 -0
- package/src/graph/declared-files.d.ts +190 -0
- package/src/graph/declared-files.js +600 -0
- package/src/graph/declared-files.js.map +1 -0
- package/src/graph/discovery.d.ts +190 -0
- package/src/graph/discovery.js +661 -0
- package/src/graph/discovery.js.map +1 -0
- package/src/graph/edges.d.ts +25 -0
- package/src/graph/edges.js +94 -0
- package/src/graph/edges.js.map +1 -0
- package/src/graph/entries.d.ts +83 -0
- package/src/graph/entries.js +259 -0
- package/src/graph/entries.js.map +1 -0
- package/src/graph/inputs.d.ts +422 -0
- package/src/graph/inputs.js +756 -0
- package/src/graph/inputs.js.map +1 -0
- package/src/graph/lockfile-task.d.ts +74 -0
- package/src/graph/lockfile-task.js +105 -0
- package/src/graph/lockfile-task.js.map +1 -0
- package/src/graph/names.d.ts +41 -0
- package/src/graph/names.js +34 -0
- package/src/graph/names.js.map +1 -0
- package/src/graph/napi.d.ts +107 -0
- package/src/graph/napi.js +206 -0
- package/src/graph/napi.js.map +1 -0
- package/src/graph/nx-glob.d.ts +36 -0
- package/src/graph/nx-glob.js +152 -0
- package/src/graph/nx-glob.js.map +1 -0
- package/src/graph/nx-internals.d.ts +57 -0
- package/src/graph/nx-internals.js +128 -0
- package/src/graph/nx-internals.js.map +1 -0
- package/src/graph/options.d.ts +32 -0
- package/src/graph/options.js +80 -0
- package/src/graph/options.js.map +1 -0
- package/src/graph/outputs.d.ts +75 -0
- package/src/graph/outputs.js +140 -0
- package/src/graph/outputs.js.map +1 -0
- package/src/graph/path-dependencies.d.ts +122 -0
- package/src/graph/path-dependencies.js +459 -0
- package/src/graph/path-dependencies.js.map +1 -0
- package/src/graph/plugin-package.d.ts +36 -0
- package/src/graph/plugin-package.js +132 -0
- package/src/graph/plugin-package.js.map +1 -0
- package/src/graph/plugin-version.d.ts +20 -0
- package/src/graph/plugin-version.js +153 -0
- package/src/graph/plugin-version.js.map +1 -0
- package/src/graph/projects.d.ts +141 -0
- package/src/graph/projects.js +193 -0
- package/src/graph/projects.js.map +1 -0
- package/src/graph/reached-projects.d.ts +46 -0
- package/src/graph/reached-projects.js +102 -0
- package/src/graph/reached-projects.js.map +1 -0
- package/src/graph/real-path.d.ts +47 -0
- package/src/graph/real-path.js +113 -0
- package/src/graph/real-path.js.map +1 -0
- package/src/graph/redirected-uses.d.ts +98 -0
- package/src/graph/redirected-uses.js +434 -0
- package/src/graph/redirected-uses.js.map +1 -0
- package/src/graph/registration.d.ts +121 -0
- package/src/graph/registration.js +233 -0
- package/src/graph/registration.js.map +1 -0
- package/src/graph/rustfmt-config.d.ts +42 -0
- package/src/graph/rustfmt-config.js +173 -0
- package/src/graph/rustfmt-config.js.map +1 -0
- package/src/graph/script-input.d.ts +46 -0
- package/src/graph/script-input.js +65 -0
- package/src/graph/script-input.js.map +1 -0
- package/src/graph/settings.d.ts +178 -0
- package/src/graph/settings.js +479 -0
- package/src/graph/settings.js.map +1 -0
- package/src/graph/target-defaults-causes.d.ts +33 -0
- package/src/graph/target-defaults-causes.js +202 -0
- package/src/graph/target-defaults-causes.js.map +1 -0
- package/src/graph/target-defaults-layers.d.ts +186 -0
- package/src/graph/target-defaults-layers.js +420 -0
- package/src/graph/target-defaults-layers.js.map +1 -0
- package/src/graph/target-defaults-meaning.d.ts +95 -0
- package/src/graph/target-defaults-meaning.js +292 -0
- package/src/graph/target-defaults-meaning.js.map +1 -0
- package/src/graph/target-defaults-report.d.ts +77 -0
- package/src/graph/target-defaults-report.js +242 -0
- package/src/graph/target-defaults-report.js.map +1 -0
- package/src/graph/target-defaults.d.ts +79 -0
- package/src/graph/target-defaults.js +425 -0
- package/src/graph/target-defaults.js.map +1 -0
- package/src/graph/target-fields.d.ts +16 -0
- package/src/graph/target-fields.js +134 -0
- package/src/graph/target-fields.js.map +1 -0
- package/src/graph/target-tables.d.ts +45 -0
- package/src/graph/target-tables.js +299 -0
- package/src/graph/target-tables.js.map +1 -0
- package/src/graph/targets.d.ts +371 -0
- package/src/graph/targets.js +408 -0
- package/src/graph/targets.js.map +1 -0
- package/src/graph/unification.d.ts +141 -0
- package/src/graph/unification.js +459 -0
- package/src/graph/unification.js.map +1 -0
- package/src/graph/unignored-directories.d.ts +25 -0
- package/src/graph/unignored-directories.js +89 -0
- package/src/graph/unignored-directories.js.map +1 -0
- package/src/graph/visibility.d.ts +17 -0
- package/src/graph/visibility.js +67 -0
- package/src/graph/visibility.js.map +1 -0
- package/src/graph/warnings.d.ts +38 -0
- package/src/graph/warnings.js +77 -0
- package/src/graph/warnings.js.map +1 -0
- package/src/graph/wasm.d.ts +56 -0
- package/src/graph/wasm.js +77 -0
- package/src/graph/wasm.js.map +1 -0
- package/src/index.d.ts +68 -0
- package/src/index.js +109 -0
- package/src/index.js.map +1 -0
- package/src/release/manifests.d.ts +95 -0
- package/src/release/manifests.js +164 -0
- package/src/release/manifests.js.map +1 -0
- package/src/release/places.d.ts +127 -0
- package/src/release/places.js +368 -0
- package/src/release/places.js.map +1 -0
- package/src/release/publish-cargo.d.ts +177 -0
- package/src/release/publish-cargo.js +351 -0
- package/src/release/publish-cargo.js.map +1 -0
- package/src/release/publish-crates.d.ts +124 -0
- package/src/release/publish-crates.js +242 -0
- package/src/release/publish-crates.js.map +1 -0
- package/src/release/publish-environments.d.ts +50 -0
- package/src/release/publish-environments.js +284 -0
- package/src/release/publish-environments.js.map +1 -0
- package/src/release/publish-messages.d.ts +66 -0
- package/src/release/publish-messages.js +273 -0
- package/src/release/publish-messages.js.map +1 -0
- package/src/release/publish-registry.d.ts +27 -0
- package/src/release/publish-registry.js +135 -0
- package/src/release/publish-registry.js.map +1 -0
- package/src/release/publish-settings.d.ts +26 -0
- package/src/release/publish-settings.js +56 -0
- package/src/release/publish-settings.js.map +1 -0
- package/src/release/publish.d.ts +59 -0
- package/src/release/publish.js +620 -0
- package/src/release/publish.js.map +1 -0
- package/src/release/repository.d.ts +73 -0
- package/src/release/repository.js +219 -0
- package/src/release/repository.js.map +1 -0
- package/src/release/requirements.d.ts +34 -0
- package/src/release/requirements.js +30 -0
- package/src/release/requirements.js.map +1 -0
- package/src/release/toml-edit.d.ts +67 -0
- package/src/release/toml-edit.js +453 -0
- package/src/release/toml-edit.js.map +1 -0
- package/src/release/version-actions.d.ts +133 -0
- package/src/release/version-actions.js +474 -0
- package/src/release/version-actions.js.map +1 -0
- package/src/release/version-checks.d.ts +21 -0
- package/src/release/version-checks.js +151 -0
- package/src/release/version-checks.js.map +1 -0
- package/src/release/version-lockfiles.d.ts +61 -0
- package/src/release/version-lockfiles.js +222 -0
- package/src/release/version-lockfiles.js.map +1 -0
- package/src/tools/napi-cli.d.ts +70 -0
- package/src/tools/napi-cli.js +63 -0
- package/src/tools/napi-cli.js.map +1 -0
- package/src/tools/optional-tools.d.ts +121 -0
- package/src/tools/optional-tools.js +303 -0
- package/src/tools/optional-tools.js.map +1 -0
- package/src/tools/print-napi-cli.d.ts +1 -0
- package/src/tools/print-napi-cli.js +24 -0
- package/src/tools/print-napi-cli.js.map +1 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shieldValue = exports.rootDotenvFiles = exports.runDependentVariables = exports.afterTaskLayer = exports.taskNameVariables = exports.nxRunVariables = exports.TaskEnvironmentError = void 0;
|
|
4
|
+
exports.toTaskEnvironmentError = toTaskEnvironmentError;
|
|
5
|
+
exports.readyUrlProducers = readyUrlProducers;
|
|
6
|
+
exports.cargoTaskEnvironment = cargoTaskEnvironment;
|
|
7
|
+
exports.withoutUnloadedRootValues = withoutUnloadedRootValues;
|
|
8
|
+
exports.batchTaskEnvironment = batchTaskEnvironment;
|
|
9
|
+
exports.taskEnvironments = taskEnvironments;
|
|
10
|
+
exports.taskDotenvLayer = taskDotenvLayer;
|
|
11
|
+
exports.nxTaskConfiguration = nxTaskConfiguration;
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const nx_bridge_1 = require("../compatibility/nx-bridge");
|
|
14
|
+
/**
|
|
15
|
+
* Why the batch cannot rebuild a task's environment: the installed Nx lacks,
|
|
16
|
+
* or has changed, a part through which it does. Its message is the reason
|
|
17
|
+
* alone.
|
|
18
|
+
*/
|
|
19
|
+
class TaskEnvironmentError extends Error {
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "TaskEnvironmentError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TaskEnvironmentError = TaskEnvironmentError;
|
|
26
|
+
/** Converts a bridge failure into a {@link TaskEnvironmentError} with its diagnostic wording. */
|
|
27
|
+
function toTaskEnvironmentError(error) {
|
|
28
|
+
const { failure } = error;
|
|
29
|
+
return new TaskEnvironmentError(failure.kind === "load"
|
|
30
|
+
? `${failure.module} cannot be loaded from the installed Nx (${failure.reason})`
|
|
31
|
+
: `the installed Nx lacks ${failure.exportName} in ${failure.module}`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The variables by which Nx 24 tells a task how it runs and records the
|
|
35
|
+
* task, not what the task is, and whose value in the task's process depends
|
|
36
|
+
* on the way the task runs: alone or in a batch, with which output style, in
|
|
37
|
+
* a pseudo-terminal or the terminal UI, with `--verbose` or with analytics on
|
|
38
|
+
* (`EVD-NX-24-BATCHES`, "Task environment"). The task's key, `NX_TASK_HASH`,
|
|
39
|
+
* which Nx does not hand a batch; where Nx writes the task's terminal output,
|
|
40
|
+
* whether it captures standard error into it, streams it or prefixes it,
|
|
41
|
+
* which follow the output style and the task's key; `FORCE_COLOR`, which Nx
|
|
42
|
+
* removes from a task whose output it writes to a file and sets for one whose
|
|
43
|
+
* output it pipes; the variables of Nx's pseudo-terminal, which a task run
|
|
44
|
+
* on its own in a terminal has and a task of a batch has not, one of them
|
|
45
|
+
* empty where Nx's own process has no `execArgv`; and those that the `nx`
|
|
46
|
+
* process sets from the command's options, the terminal UI's
|
|
47
|
+
* `NX_TUI_AUTO_EXIT`, `--verbose`'s `NX_VERBOSE_LOGGING`, and the session of
|
|
48
|
+
* Nx's analytics. Also the variables that Nx removes from every task, and
|
|
49
|
+
* that Nx's pseudo-terminal, which lays the task's environment over the
|
|
50
|
+
* `nx` process's own, gives back to a task run on its own in a terminal:
|
|
51
|
+
* `NX_SET_CLI`, `NX_ORIGINAL_FORCE_COLOR` and the ready signal's socket and
|
|
52
|
+
* task. The plugin leaves them out of every environment it runs cargo with,
|
|
53
|
+
* for a task run on its own as in a batch, so that no cargo command, build
|
|
54
|
+
* script or test sees them and no result can depend on them (`DES-BATCH`).
|
|
55
|
+
*/
|
|
56
|
+
exports.nxRunVariables = [
|
|
57
|
+
"NX_TASK_HASH",
|
|
58
|
+
"NX_TERMINAL_OUTPUT_PATH",
|
|
59
|
+
"NX_TERMINAL_CAPTURE_STDERR",
|
|
60
|
+
"NX_STREAM_OUTPUT",
|
|
61
|
+
"NX_PREFIX_OUTPUT",
|
|
62
|
+
"FORCE_COLOR",
|
|
63
|
+
"NX_PSEUDO_TERMINAL_EXEC_ARGV",
|
|
64
|
+
"NX_PSEUDO_IPC_PATH",
|
|
65
|
+
"NX_PSEUDO_IPC_FORK_ID",
|
|
66
|
+
"NX_TUI_AUTO_EXIT",
|
|
67
|
+
"NX_VERBOSE_LOGGING",
|
|
68
|
+
"NX_ANALYTICS_SESSION_ID",
|
|
69
|
+
"NX_SET_CLI",
|
|
70
|
+
"NX_ORIGINAL_FORCE_COLOR",
|
|
71
|
+
"NX_READY_SIGNAL_SOCKET",
|
|
72
|
+
"NX_READY_SIGNAL_TASK",
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* The variables by which Nx names a task's project, which differ between the
|
|
76
|
+
* tasks of any two crates of one target, so that tasks that share a cargo
|
|
77
|
+
* command could not share an environment with them (`DES-BATCH`): Nx's
|
|
78
|
+
* `NX_TASK_TARGET_PROJECT` and `LERNA_PACKAGE_NAME`. The maintainer decided
|
|
79
|
+
* on 15 November 2026 that cargo never gets them, whether a task runs alone
|
|
80
|
+
* or in a batch (`ADR-TASK-NAME-VARIABLES`); a build script or test that
|
|
81
|
+
* needs its crate reads `CARGO_PKG_NAME`. The task's target and
|
|
82
|
+
* configuration, which the tasks of a group share, stay.
|
|
83
|
+
*/
|
|
84
|
+
exports.taskNameVariables = ["NX_TASK_TARGET_PROJECT", "LERNA_PACKAGE_NAME"];
|
|
85
|
+
/**
|
|
86
|
+
* What Nx sets for the process of a task run on its own after the task's
|
|
87
|
+
* dotenv files and its own variables (`EVD-NX-24-BATCHES`, "Task
|
|
88
|
+
* environment"): the fork's `NX_FORKED_TASK_EXECUTOR`
|
|
89
|
+
* (`forked-process-task-runner.js`) and then `NX_CLI_SET`, which the task's
|
|
90
|
+
* process sets when it starts (`bin/run-executor.js`). A batch process has
|
|
91
|
+
* both from its start, before the batch lays each task's dotenv files over
|
|
92
|
+
* them, so the batch sets them again after its task's own variables, in the
|
|
93
|
+
* same order ({@link batchTaskEnvironment}), and a dotenv file that defines
|
|
94
|
+
* one changes the value for neither.
|
|
95
|
+
*/
|
|
96
|
+
exports.afterTaskLayer = {
|
|
97
|
+
NX_FORKED_TASK_EXECUTOR: "true",
|
|
98
|
+
NX_CLI_SET: "true",
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The continuous tasks from which Nx 24 gives the task `taskId`, run on its
|
|
102
|
+
* own, `NX_READY_URL`: those that an edge with `waitFor: "ready"` leads to
|
|
103
|
+
* and whose `readyWhen` reports ready by `signal`, the only check of Nx 24
|
|
104
|
+
* that reports a URL (`getReadyUrlEnv` in `task-orchestrator.js` and
|
|
105
|
+
* `mayReportReadyUrl` in `readiness/ready-when.js`, `EVD-NX-24-BATCHES`,
|
|
106
|
+
* "Continuous tasks"). Every other continuous dependency, with another check
|
|
107
|
+
* or none, gives the task nothing that a batch lacks (`DES-BATCH`).
|
|
108
|
+
*/
|
|
109
|
+
// @mara implements DES-BATCH
|
|
110
|
+
function readyUrlProducers(taskId, taskGraph, projectGraph) {
|
|
111
|
+
var _a, _b;
|
|
112
|
+
const edges = (_b = (_a = taskGraph.continuousDependencies) === null || _a === void 0 ? void 0 : _a[taskId]) !== null && _b !== void 0 ? _b : [];
|
|
113
|
+
return edges.flatMap((edge) => {
|
|
114
|
+
var _a, _b, _c, _d;
|
|
115
|
+
if (typeof edge !== "object" || edge === null) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
const { id, waitFor } = edge;
|
|
119
|
+
if (typeof id !== "string" || waitFor !== "ready") {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
const producer = taskGraph.tasks[id];
|
|
123
|
+
if (producer === undefined || producer.continuous === false) {
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
const readyWhen = (_d = (_c = (_b = (_a = projectGraph.nodes[producer.target.project]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.targets) === null || _c === void 0 ? void 0 : _c[producer.target.target]) === null || _d === void 0 ? void 0 : _d.readyWhen;
|
|
127
|
+
return typeof readyWhen === "object" &&
|
|
128
|
+
readyWhen !== null &&
|
|
129
|
+
readyWhen.signal != null
|
|
130
|
+
? [id]
|
|
131
|
+
: [];
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Why the value of each variable that Nx 24 sets, changes or removes on the
|
|
136
|
+
* way from the `nx` command to the process of a task or of a batch depends
|
|
137
|
+
* on how the task runs, in the process where Nx expands a task's dotenv
|
|
138
|
+
* files or where the plugin checks them (`EVD-NX-24-BATCHES`, "Task
|
|
139
|
+
* environment"). Nx expands the dotenv files of a task run on its own in the
|
|
140
|
+
* `nx` process, before it adds the task's own variables, and a batch expands
|
|
141
|
+
* them in its own process, which Nx gives variables of its own; the plugin
|
|
142
|
+
* checks them in the task's process or in the batch's. A task whose dotenv
|
|
143
|
+
* files make Nx look one of them up fails, alone as in a batch
|
|
144
|
+
* ({@link dotenvProblem}, `DES-BATCH`).
|
|
145
|
+
*
|
|
146
|
+
* Each of them is also left out of cargo's environment
|
|
147
|
+
* ({@link nxRunVariables}), set or removed by Nx after the dotenv files for
|
|
148
|
+
* every task, set by the batch after them as Nx sets it after them for a
|
|
149
|
+
* task run on its own ({@link afterTaskLayer}), or made the same for every
|
|
150
|
+
* way of running by {@link cargoTaskEnvironment}: so a dotenv file that only
|
|
151
|
+
* defines one changes nothing that cargo sees.
|
|
152
|
+
*/
|
|
153
|
+
exports.runDependentVariables = {
|
|
154
|
+
FORCE_COLOR: "Nx sets it for a batch and for a task whose output it pipes, and removes it from a task whose output it writes to a file",
|
|
155
|
+
NX_ORIGINAL_FORCE_COLOR: "Nx sets it in its own process where the command has FORCE_COLOR=0, and removes it from batches and tasks",
|
|
156
|
+
NX_WORKSPACE_ROOT: "Nx sets it for a batch, and for a task only after its dotenv files",
|
|
157
|
+
NX_SKIP_NX_CACHE: "Nx sets it for a batch, and for a task only after its dotenv files",
|
|
158
|
+
NX_INVOCATION_ANCESTOR_PIDS: "Nx adds its own process to it for a batch, and for a task only after its dotenv files",
|
|
159
|
+
NX_READY_URL: "Nx sets it for a task that waits for a continuous task that reports ready by signal, and removes it from batches",
|
|
160
|
+
NX_READY_SIGNAL_SOCKET: "Nx sets it for a task with continuous dependencies and removes it from batches",
|
|
161
|
+
NX_READY_SIGNAL_TASK: "Nx sets it for a task with continuous dependencies and removes it from batches",
|
|
162
|
+
NX_FORKED_TASK_EXECUTOR: "Nx sets it in the process of a batch and of a task, but not in its own, where it expands the dotenv files of a task run on its own",
|
|
163
|
+
NX_TUI: "Nx sets it from the output style and the terminal UI, and to false for every task",
|
|
164
|
+
NX_TUI_AUTO_EXIT: "Nx sets it from the command's --tui-auto-exit",
|
|
165
|
+
NX_STREAM_OUTPUT: "Nx sets it from the output style, the terminal UI and --batch",
|
|
166
|
+
NX_PREFIX_OUTPUT: "Nx sets it from the output style and --batch",
|
|
167
|
+
NX_VERBOSE_LOGGING: "Nx sets it from the command's --verbose",
|
|
168
|
+
NX_ANALYTICS_SESSION_ID: "Nx sets it for each command where its analytics are on",
|
|
169
|
+
NX_TASK_HASH: "Nx sets it for each task only after its dotenv files",
|
|
170
|
+
NX_TERMINAL_OUTPUT_PATH: "Nx sets it, by output style, for each task only after its dotenv files",
|
|
171
|
+
NX_TERMINAL_CAPTURE_STDERR: "Nx sets it, by output style, for each task only after its dotenv files",
|
|
172
|
+
NX_TASK_TARGET_PROJECT: "Nx sets it for each task only after its dotenv files",
|
|
173
|
+
NX_TASK_TARGET_TARGET: "Nx sets it for each task only after its dotenv files",
|
|
174
|
+
NX_TASK_TARGET_CONFIGURATION: "Nx sets it for each task only after its dotenv files",
|
|
175
|
+
LERNA_PACKAGE_NAME: "Nx sets it for each task only after its dotenv files",
|
|
176
|
+
NX_SET_CLI: "Nx removes it from each task only after its dotenv files",
|
|
177
|
+
NX_PSEUDO_TERMINAL_EXEC_ARGV: "Nx's pseudo-terminal sets it for a task that runs in a terminal, alone, after its dotenv files",
|
|
178
|
+
NX_PSEUDO_IPC_PATH: "Nx's pseudo-terminal sets it for a task that runs in a terminal, alone, after its dotenv files",
|
|
179
|
+
NX_PSEUDO_IPC_FORK_ID: "Nx's pseudo-terminal sets it for a task that runs in a terminal, alone, after its dotenv files",
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* A task's environment as the plugin runs cargo with it, and asks cargo for
|
|
183
|
+
* reports with it, as a new object: `env` without {@link nxRunVariables}
|
|
184
|
+
* and {@link taskNameVariables}, and with the variables that Nx gives the task in its own layer as that
|
|
185
|
+
* layer gives them in every way of running the task. Nx's pseudo-terminal
|
|
186
|
+
* lays the environment that Nx built for a task run on its own over the
|
|
187
|
+
* `nx` process's own, so that a variable which that layer leaves without a
|
|
188
|
+
* value comes back with the `nx` process's value in a terminal
|
|
189
|
+
* (`EVD-NX-24-BATCHES`, "Task environment"): `NX_SKIP_NX_CACHE` is `true`
|
|
190
|
+
* for a run that skips the cache and absent otherwise, and
|
|
191
|
+
* `NX_TASK_TARGET_CONFIGURATION` names the task's configuration or is
|
|
192
|
+
* absent. `NX_READY_URL`, which Nx sets only for a task that waits for a
|
|
193
|
+
* continuous task that reports ready by signal ({@link readyUrlProducers}),
|
|
194
|
+
* can otherwise only be the value of a task that runs the `nx` command, and
|
|
195
|
+
* is left out.
|
|
196
|
+
*/
|
|
197
|
+
// @mara implements DES-BATCH
|
|
198
|
+
function cargoTaskEnvironment(env, task) {
|
|
199
|
+
const copy = Object.assign({}, env);
|
|
200
|
+
for (const name of [...exports.nxRunVariables, ...exports.taskNameVariables]) {
|
|
201
|
+
delete copy[name];
|
|
202
|
+
}
|
|
203
|
+
if (copy.NX_SKIP_NX_CACHE !== "true") {
|
|
204
|
+
delete copy.NX_SKIP_NX_CACHE;
|
|
205
|
+
}
|
|
206
|
+
if (task.configuration === undefined) {
|
|
207
|
+
delete copy.NX_TASK_TARGET_CONFIGURATION;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
copy.NX_TASK_TARGET_CONFIGURATION = task.configuration;
|
|
211
|
+
}
|
|
212
|
+
if (!task.readyUrlDependency) {
|
|
213
|
+
delete copy.NX_READY_URL;
|
|
214
|
+
}
|
|
215
|
+
return copy;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The variables that Nx sets or removes for a task after its dotenv layer:
|
|
219
|
+
* those of `getEnvVariablesForTask`, `NX_READY_URL` of `getReadyUrlEnv`,
|
|
220
|
+
* and {@link afterTaskLayer}.
|
|
221
|
+
*/
|
|
222
|
+
const taskLayerVariables = [
|
|
223
|
+
"FORCE_COLOR",
|
|
224
|
+
"NX_WORKSPACE_ROOT",
|
|
225
|
+
"NX_SKIP_NX_CACHE",
|
|
226
|
+
"NX_INVOCATION_ANCESTOR_PIDS",
|
|
227
|
+
"NX_TERMINAL_OUTPUT_PATH",
|
|
228
|
+
"NX_TERMINAL_CAPTURE_STDERR",
|
|
229
|
+
"NX_STREAM_OUTPUT",
|
|
230
|
+
"NX_PREFIX_OUTPUT",
|
|
231
|
+
"NX_TASK_TARGET_PROJECT",
|
|
232
|
+
"NX_TASK_TARGET_TARGET",
|
|
233
|
+
"NX_TASK_TARGET_CONFIGURATION",
|
|
234
|
+
"NX_TASK_HASH",
|
|
235
|
+
"LERNA_PACKAGE_NAME",
|
|
236
|
+
"NX_TUI",
|
|
237
|
+
"NX_SET_CLI",
|
|
238
|
+
"NX_ORIGINAL_FORCE_COLOR",
|
|
239
|
+
"NX_READY_SIGNAL_SOCKET",
|
|
240
|
+
"NX_READY_SIGNAL_TASK",
|
|
241
|
+
"NX_READY_URL",
|
|
242
|
+
...Object.keys(exports.afterTaskLayer),
|
|
243
|
+
];
|
|
244
|
+
/**
|
|
245
|
+
* The root dotenv files that the `nx` process loads when it starts and that
|
|
246
|
+
* Nx's `getTaskSpecificEnv` removes again from every task's environment,
|
|
247
|
+
* each on its own, in this order (`unloadDotEnvFiles` in
|
|
248
|
+
* `tasks-runner/task-env.js`; `EVD-NX-24-BATCHES`, "Dotenv expansion").
|
|
249
|
+
*/
|
|
250
|
+
exports.rootDotenvFiles = [".env", ".local.env", ".env.local"];
|
|
251
|
+
/**
|
|
252
|
+
* `env` as the plugin gives it to cargo where Nx loads no dotenv files for
|
|
253
|
+
* the task, its `NX_LOAD_DOT_ENV_FILES` not being `true` (`DES-BATCH`,
|
|
254
|
+
* "Dotenv files"). Nx's `getTaskSpecificEnv` then still removes each variable
|
|
255
|
+
* whose value the root `.env`, `.local.env` or `.env.local` gives, without
|
|
256
|
+
* loading any file back, while Nx's pseudo-terminal gives a task run on its
|
|
257
|
+
* own in a terminal the `nx` process's values back (`EVD-NX-24-BATCHES`,
|
|
258
|
+
* "Task environment"). So the plugin removes them again, with Nx's own
|
|
259
|
+
* `unloadDotEnvFile`, from every variable apart from those that Nx sets
|
|
260
|
+
* after the dotenv layer: a task run on its own without a terminal and a
|
|
261
|
+
* task of a batch lack them already, and a task in a terminal loses what the
|
|
262
|
+
* pseudo-terminal gave back. Where Nx loads the files, `env` comes back as
|
|
263
|
+
* it is.
|
|
264
|
+
*
|
|
265
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks `unloadDotEnvFile`.
|
|
266
|
+
*/
|
|
267
|
+
// @mara implements DES-BATCH
|
|
268
|
+
function withoutUnloadedRootValues(env, root) {
|
|
269
|
+
if (env.NX_LOAD_DOT_ENV_FILES === "true") {
|
|
270
|
+
return env;
|
|
271
|
+
}
|
|
272
|
+
let unload;
|
|
273
|
+
try {
|
|
274
|
+
unload = (0, nx_bridge_1.loadTaskEnv)(root, ["unloadDotEnvFile"]).unloadDotEnvFile;
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
if (error instanceof nx_bridge_1.NxBridgeError) {
|
|
278
|
+
throw toTaskEnvironmentError(error);
|
|
279
|
+
}
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
282
|
+
const rest = Object.assign({}, env);
|
|
283
|
+
const kept = {};
|
|
284
|
+
for (const name of taskLayerVariables) {
|
|
285
|
+
if (Object.prototype.hasOwnProperty.call(rest, name)) {
|
|
286
|
+
kept[name] = rest[name];
|
|
287
|
+
delete rest[name];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
for (const file of exports.rootDotenvFiles) {
|
|
291
|
+
unload((0, node_path_1.join)(root, file), rest);
|
|
292
|
+
}
|
|
293
|
+
return Object.assign(Object.assign({}, rest), kept);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* The environment that the plugin gives cargo for a task of a batch, from
|
|
297
|
+
* the task's dotenv layer as Nx's `getTaskSpecificEnv` builds it in the batch
|
|
298
|
+
* process (`DES-BATCH`): Nx's `getEnvVariablesForTask` over it, as Nx calls it
|
|
299
|
+
* for a task whose output it does not write to a file;
|
|
300
|
+
* `NX_INVOCATION_ANCESTOR_PIDS` with the value that Nx gave the batch process,
|
|
301
|
+
* which it gives a task run on its own too, where computed in the batch
|
|
302
|
+
* process it would name that process as well; then {@link afterTaskLayer}, as
|
|
303
|
+
* the fork and the task's process set them for a task run on its own; and
|
|
304
|
+
* {@link cargoTaskEnvironment}. A task of a batch waits for no continuous
|
|
305
|
+
* task that reports ready by signal ({@link refuseReadyUrl} in `batch.ts`).
|
|
306
|
+
*
|
|
307
|
+
* @param processEnv The batch process's environment.
|
|
308
|
+
*/
|
|
309
|
+
// @mara implements DES-BATCH
|
|
310
|
+
function batchTaskEnvironment(base, task, taskLayer, processEnv) {
|
|
311
|
+
const env = environment(taskLayer(task, Object.assign({}, base), base.FORCE_COLOR, processEnv.NX_SKIP_NX_CACHE === "true", false, null, null), "getEnvVariablesForTask", task);
|
|
312
|
+
if (processEnv.NX_INVOCATION_ANCESTOR_PIDS === undefined) {
|
|
313
|
+
delete env.NX_INVOCATION_ANCESTOR_PIDS;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
env.NX_INVOCATION_ANCESTOR_PIDS = processEnv.NX_INVOCATION_ANCESTOR_PIDS;
|
|
317
|
+
}
|
|
318
|
+
Object.assign(env, exports.afterTaskLayer);
|
|
319
|
+
return cargoTaskEnvironment(definedOnly(env), {
|
|
320
|
+
configuration: task.target.configuration,
|
|
321
|
+
readyUrlDependency: false,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* The environment of each task of a batch, as Nx builds it for the task run
|
|
326
|
+
* on its own (`DES-BATCH`; `EVD-NX-24-BATCHES`, "Task environment"), with
|
|
327
|
+
* the functions that Nx uses for that, from `nx/src/tasks-runner/task-env`,
|
|
328
|
+
* which are no public API (`RISK-UPSTREAM-CHANGES`):
|
|
329
|
+
*
|
|
330
|
+
* 1. {@link taskDotenvLayer}: the dotenv layer of Nx's `getTaskSpecificEnv`,
|
|
331
|
+
* the environment of the `nx` command without the values that the
|
|
332
|
+
* repository's root `.env`, `.local.env` and `.env.local` gave it, with
|
|
333
|
+
* the task's dotenv files loaded in the order Nx reads them, those in the
|
|
334
|
+
* project's folder and those at the repository root named for the target
|
|
335
|
+
* or a configuration, with the root files last. Nx hands a batch process
|
|
336
|
+
* the command's environment, so the batch builds this layer from its own,
|
|
337
|
+
* which Nx made for its child processes as it makes a task's: with
|
|
338
|
+
* `NX_WORKSPACE_ROOT`, `NX_SKIP_NX_CACHE`, `NX_INVOCATION_ANCESTOR_PIDS`
|
|
339
|
+
* and `NX_FORKED_TASK_EXECUTOR`, and with `NX_CLI_SET`, which the process
|
|
340
|
+
* of a task run on its own sets too.
|
|
341
|
+
* 2. {@link batchTaskEnvironment}: Nx's `getEnvVariablesForTask` with the
|
|
342
|
+
* task's own variables, `NX_TASK_TARGET_PROJECT`, `NX_TASK_TARGET_TARGET`,
|
|
343
|
+
* `NX_TASK_TARGET_CONFIGURATION`, `LERNA_PACKAGE_NAME` and `NX_TUI=false`,
|
|
344
|
+
* and the removal of the variables that Nx keeps from every task; then
|
|
345
|
+
* what Nx sets after that layer for a task run on its own
|
|
346
|
+
* ({@link afterTaskLayer}); then {@link cargoTaskEnvironment} and
|
|
347
|
+
* {@link withoutUnloadedRootValues}, as for a task run on its own. What a
|
|
348
|
+
* task run on its own and a task of a batch give cargo is the same.
|
|
349
|
+
*
|
|
350
|
+
* Neither step writes to the batch process's environment; dotenv itself
|
|
351
|
+
* does where a vault lies beside a task's files ({@link taskDotenvLayer}).
|
|
352
|
+
*
|
|
353
|
+
* @param root The repository root, from where the installed Nx is loaded.
|
|
354
|
+
* @param shielded The variables of {@link runDependentVariables} that the
|
|
355
|
+
* task's dotenv files define ({@link shieldValue}).
|
|
356
|
+
* @returns A function that gives a task's environment, as a new object.
|
|
357
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks a function.
|
|
358
|
+
*/
|
|
359
|
+
// @mara implements DES-BATCH
|
|
360
|
+
function taskEnvironments(root, graph, shielded = () => []) {
|
|
361
|
+
let parts;
|
|
362
|
+
let taskLayer;
|
|
363
|
+
try {
|
|
364
|
+
// getEnvVariablesForTask first, as the batch's message names the first
|
|
365
|
+
// part that the installed Nx lacks.
|
|
366
|
+
const loaded = (0, nx_bridge_1.loadTaskEnv)(root, [
|
|
367
|
+
"getEnvVariablesForTask",
|
|
368
|
+
"getEnvFilesForTask",
|
|
369
|
+
"loadAndExpandDotEnvFile",
|
|
370
|
+
"unloadDotEnvFile",
|
|
371
|
+
]);
|
|
372
|
+
parts = loaded;
|
|
373
|
+
taskLayer = loaded.getEnvVariablesForTask;
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
if (error instanceof nx_bridge_1.NxBridgeError) {
|
|
377
|
+
throw toTaskEnvironmentError(error);
|
|
378
|
+
}
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
return (task) => withoutUnloadedRootValues(batchTaskEnvironment(taskDotenvLayer(parts, root, task, graph, process.env, shielded(task)), task, taskLayer, process.env), root);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* A task's dotenv layer, as Nx 24's `getTaskSpecificEnv` builds it from the
|
|
385
|
+
* process's environment, built instead on a copy of `processEnv`, so that
|
|
386
|
+
* the plugin writes nothing to the batch process's own environment
|
|
387
|
+
* (`DES-BATCH`, "Dotenv files"): Nx's `unloadDotEnvFile` removes from the copy each value that a
|
|
388
|
+
* root dotenv file ({@link rootDotenvFiles}) gives, and, where `processEnv`
|
|
389
|
+
* has `NX_LOAD_DOT_ENV_FILES=true`, Nx's `loadAndExpandDotEnvFile` loads and
|
|
390
|
+
* expands into it the files that Nx's `getEnvFilesForTask` names for the
|
|
391
|
+
* task, under `root`, which is Nx's workspace root in a batch. Which files,
|
|
392
|
+
* in which order, and how their expansion sees the copy's values is Nx's
|
|
393
|
+
* own code. The plugin repeats three facts of Nx's wrapper: the root files,
|
|
394
|
+
* the order of the calls, and the load switch. A test compares the result
|
|
395
|
+
* with `getTaskSpecificEnv` itself on the installed Nx, and another fails
|
|
396
|
+
* where the source of the wrapper changes (`VER-BATCHING`).
|
|
397
|
+
*
|
|
398
|
+
* With `DOTENV_KEY` set and a vault beside the files, dotenv 16.4.7 parses
|
|
399
|
+
* the vault into the live `process.env` before it decrypts it, so Nx's
|
|
400
|
+
* loader sets the vault's `DOTENV_VAULT_<ENVIRONMENT>` there, as it does in
|
|
401
|
+
* the `nx` process for a task run on its own; the dotenv check refuses such
|
|
402
|
+
* a task (`DES-BATCH`, nxr-gcknzm).
|
|
403
|
+
*
|
|
404
|
+
* Each name of `shielded` has {@link shieldValue} in the copy before Nx's
|
|
405
|
+
* functions see it.
|
|
406
|
+
*
|
|
407
|
+
* @param processEnv The batch process's environment; the plugin does not change it.
|
|
408
|
+
* @returns The layer, as a new object.
|
|
409
|
+
* @throws {TaskEnvironmentError} When `getEnvFilesForTask` fails or gives no
|
|
410
|
+
* list of files.
|
|
411
|
+
*/
|
|
412
|
+
// @mara implements DES-BATCH
|
|
413
|
+
function taskDotenvLayer(parts, root, task, graph, processEnv, shielded) {
|
|
414
|
+
const env = Object.assign({}, processEnv);
|
|
415
|
+
for (const name of shielded) {
|
|
416
|
+
env[name] = exports.shieldValue;
|
|
417
|
+
}
|
|
418
|
+
for (const file of exports.rootDotenvFiles) {
|
|
419
|
+
parts.unloadDotEnvFile((0, node_path_1.join)(root, file), env);
|
|
420
|
+
}
|
|
421
|
+
if (processEnv.NX_LOAD_DOT_ENV_FILES !== "true") {
|
|
422
|
+
return env;
|
|
423
|
+
}
|
|
424
|
+
let files;
|
|
425
|
+
try {
|
|
426
|
+
files = parts.getEnvFilesForTask(task, graph);
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
throw new TaskEnvironmentError(`getEnvFilesForTask of the installed Nx fails for ${task.id} (${error instanceof Error ? error.message : String(error)})`);
|
|
430
|
+
}
|
|
431
|
+
if (!Array.isArray(files) || !files.every((file) => typeof file === "string")) {
|
|
432
|
+
throw new TaskEnvironmentError(`getEnvFilesForTask of the installed Nx gives no list of files for ${task.id}`);
|
|
433
|
+
}
|
|
434
|
+
parts.loadAndExpandDotEnvFile(files.map((file) => (0, node_path_1.join)(root, file)), env);
|
|
435
|
+
return env;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The value that the batch gives, in the copy on which it builds a task's
|
|
439
|
+
* dotenv layer ({@link taskDotenvLayer}), to each variable of
|
|
440
|
+
* {@link runDependentVariables} that the task's dotenv files define
|
|
441
|
+
* (`DES-BATCH`, "Dotenv files"). dotenv-expand then takes this value, which
|
|
442
|
+
* no file gives, instead of expanding the file's, as it takes the `nx`
|
|
443
|
+
* process's own value where that process has one: so a definition whose
|
|
444
|
+
* expansion would not end, as `NX_ORIGINAL_FORCE_COLOR=${CMD}z` with
|
|
445
|
+
* `CMD=x${CMD}` in the command, which the `nx` process does not expand where
|
|
446
|
+
* the command has `FORCE_COLOR=0`, cannot exhaust the batch process's memory
|
|
447
|
+
* either. The value never reaches cargo: each of those variables is left out
|
|
448
|
+
* of cargo's environment or set after the dotenv layer in both paths.
|
|
449
|
+
*/
|
|
450
|
+
exports.shieldValue = "\u0001@convesoft/nx-rust";
|
|
451
|
+
// The variables that have a value: Node leaves an undefined one out of a
|
|
452
|
+
// child's environment, as it does for the process of a task run on its own.
|
|
453
|
+
function definedOnly(env) {
|
|
454
|
+
return Object.fromEntries(Object.entries(env).filter(([, value]) => value !== undefined));
|
|
455
|
+
}
|
|
456
|
+
// A result of Nx's that has the shape of an environment, as a new object.
|
|
457
|
+
function environment(value, part, task) {
|
|
458
|
+
if (typeof value !== "object" ||
|
|
459
|
+
value === null ||
|
|
460
|
+
!Object.values(value).every((entry) => entry === undefined || typeof entry === "string")) {
|
|
461
|
+
throw new TaskEnvironmentError(`${part} of the installed Nx gives no environment for ${task.id}`);
|
|
462
|
+
}
|
|
463
|
+
// A copy, which the batch may change without changing Nx's.
|
|
464
|
+
return Object.assign({}, value);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* The configuration with which Nx 24 would run `target` of `project` for a
|
|
468
|
+
* command that passes `configuration`, by the installed Nx's own rule
|
|
469
|
+
* (`ProcessTasks.resolveConfiguration` in `create-task-graph.js`): the
|
|
470
|
+
* configuration passed where the target declares it, otherwise the target's
|
|
471
|
+
* `defaultConfiguration`, and none where that is empty.
|
|
472
|
+
*
|
|
473
|
+
* @throws {TaskEnvironmentError} When the installed Nx lacks the rule.
|
|
474
|
+
*/
|
|
475
|
+
// @mara implements DES-RELEASE
|
|
476
|
+
function nxTaskConfiguration(root, graph, project, target, configuration) {
|
|
477
|
+
let resolve;
|
|
478
|
+
try {
|
|
479
|
+
resolve = (0, nx_bridge_1.loadCreateTaskGraph)(root).resolveConfiguration;
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
if (error instanceof nx_bridge_1.NxBridgeError) {
|
|
483
|
+
throw toTaskEnvironmentError(error);
|
|
484
|
+
}
|
|
485
|
+
throw error;
|
|
486
|
+
}
|
|
487
|
+
const node = graph.nodes[project];
|
|
488
|
+
if (node === undefined) {
|
|
489
|
+
throw new TaskEnvironmentError(`the project graph has no project ${project}`);
|
|
490
|
+
}
|
|
491
|
+
const resolved = resolve.call({ projectGraph: graph }, node, target, configuration);
|
|
492
|
+
return typeof resolved === "string" && resolved !== "" ? resolved : undefined;
|
|
493
|
+
}
|
|
494
|
+
//# sourceMappingURL=task-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-env.js","sourceRoot":"","sources":["../../../../nx-rust/src/executors/task-env.ts"],"names":[],"mappings":";;;AAsBA,wDAOC;AAwGD,8CA2BC;AA8ED,oDAiBC;AAuDD,8DAyBC;AAiBD,oDA6BC;AAyCD,4CAkCC;AAsCD,0CAoCC;AAgDD,kDAsBC;AAvlBD,yCAAiC;AACjC,0DAKoC;AAEpC;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAED,iGAAiG;AACjG,SAAgB,sBAAsB,CAAC,KAAoB;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,OAAO,IAAI,oBAAoB,CAC7B,OAAO,CAAC,IAAI,KAAK,MAAM;QACrB,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,4CAA4C,OAAO,CAAC,MAAM,GAAG;QAChF,CAAC,CAAC,0BAA0B,OAAO,CAAC,UAAU,OAAO,OAAO,CAAC,MAAM,EAAE,CACxE,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,cAAc,GAAG;IAC5B,cAAc;IACd,yBAAyB;IACzB,4BAA4B;IAC5B,kBAAkB;IAClB,kBAAkB;IAClB,aAAa;IACb,8BAA8B;IAC9B,oBAAoB;IACpB,uBAAuB;IACvB,kBAAkB;IAClB,oBAAoB;IACpB,yBAAyB;IACzB,YAAY;IACZ,yBAAyB;IACzB,wBAAwB;IACxB,sBAAsB;CACd,CAAC;AAEX;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,CAAC,wBAAwB,EAAE,oBAAoB,CAAU,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,GAAY,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAC7F,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import { type CargoInvocation } from "./cargo-invocation";
|
|
3
|
+
import { type BuildInputCheck } from "./input-check";
|
|
4
|
+
import type { DigestStep } from "./task-guards";
|
|
5
|
+
/** The cargo command of one task and the lines it prints before cargo starts. */
|
|
6
|
+
export interface TaskInvocation extends CargoInvocation {
|
|
7
|
+
/** One warning line per option that the task ignores (`DES-UNKNOWN-OPTIONS`). */
|
|
8
|
+
warnings: string[];
|
|
9
|
+
/**
|
|
10
|
+
* What the task does with the workspace's lockfile once cargo has succeeded
|
|
11
|
+
* (`DES-LOCKFILE-HASHING`): the lockfile task writes the members' digests,
|
|
12
|
+
* and a task whose key holds digests checks them again.
|
|
13
|
+
*/
|
|
14
|
+
digests?: DigestStep;
|
|
15
|
+
/**
|
|
16
|
+
* On a crate's `build`: the check of the files that cargo recorded for the
|
|
17
|
+
* crate against the task's inputs, after cargo has succeeded
|
|
18
|
+
* (`DES-BUILD-INPUT-CHECK`).
|
|
19
|
+
*/
|
|
20
|
+
inputCheck?: BuildInputCheck;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The message of a failed `hakari-check`, after cargo-hakari's own output
|
|
24
|
+
* (`DES-UNIFICATION`, "Drift"; `DES-DIAGNOSTICS`): which command failed, and
|
|
25
|
+
* that running `cargo hakari generate` and `cargo hakari manage-deps` and
|
|
26
|
+
* committing the result brings the hack crate up to date.
|
|
27
|
+
*/
|
|
28
|
+
export declare function hakariCheckFailure(task: string, args: readonly string[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* The checks of a task after its cargo call has succeeded, in one step
|
|
31
|
+
* (`DES-LOCKFILE-HASHING`, "Post-check"): first what the task does with the
|
|
32
|
+
* lockfile's digests, which the lockfile task writes and a cached task
|
|
33
|
+
* computes again, then, on a crate's `build`, the comparison of the files
|
|
34
|
+
* that cargo recorded with the task's inputs (`DES-BUILD-INPUT-CHECK`). Both
|
|
35
|
+
* run, so that a failed task names every problem at once.
|
|
36
|
+
*
|
|
37
|
+
* @returns The failure messages, without which the task succeeds, and the
|
|
38
|
+
* warning that the input check did not run, for the task's output.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checksAfterCargo(invocation: Pick<TaskInvocation, "digests" | "inputCheck">, context: ExecutorContext): Promise<{
|
|
41
|
+
failures: string[];
|
|
42
|
+
warnings: string[];
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Runs cargo for a task with the task's environment and the variables of the
|
|
46
|
+
* invocation, which no command of this version has, and with the task's
|
|
47
|
+
* standard streams. Signals that stop the executor reach cargo too.
|
|
48
|
+
*
|
|
49
|
+
* @param taskEnv The task's environment without the variables by which Nx
|
|
50
|
+
* tells it how it runs and records it (`cargoTaskEnvironment`).
|
|
51
|
+
*
|
|
52
|
+
* Unlike graph creation (`runCargoForGraph`), a task sets no
|
|
53
|
+
* `RUSTUP_AUTO_INSTALL`, so rustup behaves as for plain cargo.
|
|
54
|
+
*
|
|
55
|
+
* @param shownFor In a verbose run, the task whose command it is: the
|
|
56
|
+
* command's lines ({@link printCommand}), built from the same invocation,
|
|
57
|
+
* go to standard error before cargo starts (`DES-INVOCATION`, "Printing the
|
|
58
|
+
* command"). Undefined in every other run, which prints nothing of it.
|
|
59
|
+
* @returns Whether cargo exited with status 0.
|
|
60
|
+
*/
|
|
61
|
+
export declare function runCargo(invocation: CargoInvocation, taskEnv: NodeJS.ProcessEnv, shownFor?: string): Promise<boolean>;
|