@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.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +47 -1
- package/executors.json +35 -0
- package/generators.json +19 -0
- package/package.json +17 -4
- package/src/cargo/build-settings.d.ts +54 -0
- package/src/cargo/build-settings.js +93 -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 +112 -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 +87 -0
- package/src/cargo/redirections.js +195 -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/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 +54 -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 +212 -0
- package/src/executors/cargo-output.js +646 -0
- package/src/executors/cargo-output.js.map +1 -0
- package/src/executors/command.d.ts +318 -0
- package/src/executors/command.js +517 -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/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 +591 -0
- package/src/executors/group-run.js.map +1 -0
- package/src/executors/groups.d.ts +113 -0
- package/src/executors/groups.js +285 -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 +185 -0
- package/src/executors/nextest.js +498 -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 +430 -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 +520 -0
- package/src/executors/task.js.map +1 -0
- package/src/executors/test-mode.d.ts +182 -0
- package/src/executors/test-mode.js +391 -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 +109 -0
- package/src/executors/test-steps.js +535 -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 +676 -0
- package/src/graph/caching.js.map +1 -0
- package/src/graph/collisions.d.ts +106 -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 +175 -0
- package/src/graph/discovery.js +656 -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 +420 -0
- package/src/graph/inputs.js +746 -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 +182 -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/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 +367 -0
- package/src/graph/targets.js +404 -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,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listFields = void 0;
|
|
4
|
+
exports.namedInputsOf = namedInputsOf;
|
|
5
|
+
exports.weakening = weakening;
|
|
6
|
+
exports.isEmptyWeakening = isEmptyWeakening;
|
|
7
|
+
exports.weakeningSize = weakeningSize;
|
|
8
|
+
exports.describeWeakening = describeWeakening;
|
|
9
|
+
exports.nxNames = nxNames;
|
|
10
|
+
const target_defaults_layers_1 = require("./target-defaults-layers");
|
|
11
|
+
/** The lists among the checked target fields, whose meaning another layer must not narrow. */
|
|
12
|
+
exports.listFields = ["inputs", "outputs", "dependsOn"];
|
|
13
|
+
/** The inputs of a target without `inputs` (`DEFAULT_INPUTS` in Nx's task hasher). */
|
|
14
|
+
const defaultInputs = [{ input: "default" }, { dependencies: true, input: "default" }];
|
|
15
|
+
/**
|
|
16
|
+
* A project's named inputs as Nx's task hasher reads them (`getNamedInputs`
|
|
17
|
+
* in `nx/src/hasher/task-hasher.js`): Nx's built-in `default`, replaced by
|
|
18
|
+
* a definition in `nx.json`, replaced by the project's own.
|
|
19
|
+
*/
|
|
20
|
+
function namedInputsOf(nxJson, project) {
|
|
21
|
+
const named = { default: [{ fileset: "{projectRoot}/**/*" }] };
|
|
22
|
+
for (const definitions of [nxJson.namedInputs, project]) {
|
|
23
|
+
for (const [name, definition] of Object.entries((0, target_defaults_layers_1.isRecord)(definitions) ? definitions : {})) {
|
|
24
|
+
if (Array.isArray(definition)) {
|
|
25
|
+
named[name] = definition;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return named;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Inputs expanded as Nx's task hasher expands a project's own inputs
|
|
33
|
+
* (`splitInputsIntoSelfAndDependencies` and `expandSingleProjectInputs`): a
|
|
34
|
+
* name of a named input, as a string or as `{ "input": name }`, stands for
|
|
35
|
+
* its definition, recursively, and any other string for a file set; an entry
|
|
36
|
+
* for the dependencies or other projects, such as `^default`, which means
|
|
37
|
+
* what those projects define, and every other object stay as written.
|
|
38
|
+
*/
|
|
39
|
+
function expandInputs(inputs, named, chain = []) {
|
|
40
|
+
const expanded = [];
|
|
41
|
+
const expand = (name, written) => {
|
|
42
|
+
const definition = named[name];
|
|
43
|
+
if (definition !== undefined && !chain.includes(name)) {
|
|
44
|
+
expanded.push(...expandInputs(definition, named, [...chain, name]));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
expanded.push(written);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
for (const input of inputs) {
|
|
51
|
+
if (typeof input === "string") {
|
|
52
|
+
if (input.startsWith("^")) {
|
|
53
|
+
expanded.push(input);
|
|
54
|
+
}
|
|
55
|
+
else if (named[input] !== undefined) {
|
|
56
|
+
expand(input, input);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
expanded.push({ fileset: input });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if ((0, target_defaults_layers_1.isRecord)(input) &&
|
|
63
|
+
typeof input.input === "string" &&
|
|
64
|
+
input.dependencies === undefined &&
|
|
65
|
+
input.projects === undefined &&
|
|
66
|
+
input.fileset === undefined) {
|
|
67
|
+
expand(input.input, input);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
expanded.push(input);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return expanded;
|
|
74
|
+
}
|
|
75
|
+
/** The names of the named inputs that inputs read, directly or through other named inputs. */
|
|
76
|
+
function namesRead(inputs, named) {
|
|
77
|
+
const names = new Set();
|
|
78
|
+
const walk = (list) => {
|
|
79
|
+
for (const input of list) {
|
|
80
|
+
const name = typeof input === "string" && !input.startsWith("^")
|
|
81
|
+
? input
|
|
82
|
+
: (0, target_defaults_layers_1.isRecord)(input) &&
|
|
83
|
+
typeof input.input === "string" &&
|
|
84
|
+
input.dependencies === undefined &&
|
|
85
|
+
input.projects === undefined
|
|
86
|
+
? input.input
|
|
87
|
+
: undefined;
|
|
88
|
+
if (name !== undefined && named[name] !== undefined && !names.has(name)) {
|
|
89
|
+
names.add(name);
|
|
90
|
+
walk(named[name]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
walk(inputs);
|
|
95
|
+
return [...names];
|
|
96
|
+
}
|
|
97
|
+
// Whether an entry leaves files out: a pattern that starts with `!`, in a
|
|
98
|
+
// file set of the project's own or of its dependencies, or among outputs.
|
|
99
|
+
function leavesOut(field, entry) {
|
|
100
|
+
if (field === "outputs") {
|
|
101
|
+
return typeof entry === "string" && entry.startsWith("!");
|
|
102
|
+
}
|
|
103
|
+
if (typeof entry === "string") {
|
|
104
|
+
return entry.startsWith("^!");
|
|
105
|
+
}
|
|
106
|
+
return (0, target_defaults_layers_1.isRecord)(entry) && typeof entry.fileset === "string" && entry.fileset.startsWith("!");
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* What one list of the merged target means less than the expected one
|
|
110
|
+
* (`DES-TARGET-DEFAULT-GUARD`, "Other layers"): the entries of the expected
|
|
111
|
+
* list that the merged one lacks, and the negated patterns of the merged
|
|
112
|
+
* list that the expected one lacks, `inputs` compared after Nx's expansion
|
|
113
|
+
* with each side's named inputs. An added entry that is no negated pattern
|
|
114
|
+
* only widens: an input only adds to what the key hashes, an output to what
|
|
115
|
+
* Nx stores and restores, and a dependency to the tasks that run first.
|
|
116
|
+
*/
|
|
117
|
+
function weakening(field, merged, expected) {
|
|
118
|
+
const list = (meaning) => {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
return field === "inputs"
|
|
121
|
+
? expandInputs((_a = meaning.target.inputs) !== null && _a !== void 0 ? _a : defaultInputs, meaning.named)
|
|
122
|
+
: ((_b = meaning.target[field]) !== null && _b !== void 0 ? _b : []);
|
|
123
|
+
};
|
|
124
|
+
const mergedList = list(merged);
|
|
125
|
+
const expectedList = list(expected);
|
|
126
|
+
const inMerged = new Set(mergedList.map(target_defaults_layers_1.canonical));
|
|
127
|
+
const inExpected = new Set(expectedList.map(target_defaults_layers_1.canonical));
|
|
128
|
+
return {
|
|
129
|
+
lost: expectedList.filter((entry) => !inMerged.has((0, target_defaults_layers_1.canonical)(entry))),
|
|
130
|
+
leavesOut: field === "dependsOn"
|
|
131
|
+
? []
|
|
132
|
+
: mergedList.filter((entry) => leavesOut(field, entry) && !inExpected.has((0, target_defaults_layers_1.canonical)(entry))),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function isEmptyWeakening({ lost, leavesOut }) {
|
|
136
|
+
return lost.length === 0 && leavesOut.length === 0;
|
|
137
|
+
}
|
|
138
|
+
function weakeningSize({ lost, leavesOut }) {
|
|
139
|
+
return lost.length + leavesOut.length;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Adds to `loss` how one list of the merged target means less than the
|
|
143
|
+
* expected one, in the terms in which the layers wrote it: the expected
|
|
144
|
+
* entries whose meaning the merged list lacks, the entries that the merged
|
|
145
|
+
* list adds and that leave files out, and, for `inputs`, the named inputs
|
|
146
|
+
* that the target reads and that the merged project defines so that they
|
|
147
|
+
* mean less. What none of these shows is added as Nx expands it.
|
|
148
|
+
*/
|
|
149
|
+
function describeWeakening(field, merged, expected, loss) {
|
|
150
|
+
var _a, _b, _c, _d;
|
|
151
|
+
const whole = weakening(field, merged, expected);
|
|
152
|
+
if (field !== "inputs") {
|
|
153
|
+
if (whole.lost.length > 0) {
|
|
154
|
+
loss.lost[field] = whole.lost;
|
|
155
|
+
}
|
|
156
|
+
if (field === "outputs" && whole.leavesOut.length > 0) {
|
|
157
|
+
loss.leavesOut = Object.assign(Object.assign({}, loss.leavesOut), { outputs: whole.leavesOut });
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const mergedTop = (_a = merged.target.inputs) !== null && _a !== void 0 ? _a : defaultInputs;
|
|
162
|
+
const expectedTop = (_b = expected.target.inputs) !== null && _b !== void 0 ? _b : defaultInputs;
|
|
163
|
+
const mergedAll = new Set(expandInputs(mergedTop, merged.named).map(target_defaults_layers_1.canonical));
|
|
164
|
+
const expectedAll = new Set(expandInputs(expectedTop, expected.named).map(target_defaults_layers_1.canonical));
|
|
165
|
+
const writtenMerged = new Set(mergedTop.map(target_defaults_layers_1.canonical));
|
|
166
|
+
const writtenExpected = new Set(expectedTop.map(target_defaults_layers_1.canonical));
|
|
167
|
+
const lost = expectedTop.filter((entry) => !writtenMerged.has((0, target_defaults_layers_1.canonical)(entry)) &&
|
|
168
|
+
expandInputs([entry], expected.named).some((part) => !mergedAll.has((0, target_defaults_layers_1.canonical)(part))));
|
|
169
|
+
const added = mergedTop.filter((entry) => !writtenExpected.has((0, target_defaults_layers_1.canonical)(entry)) &&
|
|
170
|
+
expandInputs([entry], merged.named).some((part) => leavesOut("inputs", part) && !expectedAll.has((0, target_defaults_layers_1.canonical)(part))));
|
|
171
|
+
const redefined = [];
|
|
172
|
+
for (const name of new Set([
|
|
173
|
+
...namesRead(mergedTop, merged.named),
|
|
174
|
+
...namesRead(expectedTop, expected.named),
|
|
175
|
+
])) {
|
|
176
|
+
if ((0, target_defaults_layers_1.canonical)(merged.named[name]) === (0, target_defaults_layers_1.canonical)(expected.named[name])) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const meaning = (named) => {
|
|
180
|
+
var _a;
|
|
181
|
+
return ({
|
|
182
|
+
target: { inputs: ((_a = named[name]) !== null && _a !== void 0 ? _a : []) },
|
|
183
|
+
named,
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
const part = weakening("inputs", meaning(merged.named), meaning(expected.named));
|
|
187
|
+
if (!isEmptyWeakening(part)) {
|
|
188
|
+
redefined.push({
|
|
189
|
+
name,
|
|
190
|
+
definition: (_c = merged.named[name]) !== null && _c !== void 0 ? _c : null,
|
|
191
|
+
lost: part.lost,
|
|
192
|
+
leavesOut: part.leavesOut,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (lost.length > 0) {
|
|
197
|
+
loss.lost.inputs = lost;
|
|
198
|
+
}
|
|
199
|
+
if (added.length > 0) {
|
|
200
|
+
loss.leavesOut = Object.assign(Object.assign({}, loss.leavesOut), { inputs: added });
|
|
201
|
+
}
|
|
202
|
+
if (redefined.length > 0) {
|
|
203
|
+
loss.namedInputs = [...((_d = loss.namedInputs) !== null && _d !== void 0 ? _d : []), ...redefined];
|
|
204
|
+
}
|
|
205
|
+
if (lost.length === 0 && added.length === 0 && redefined.length === 0) {
|
|
206
|
+
loss.lost.inputs = whole.lost;
|
|
207
|
+
if (whole.leavesOut.length > 0) {
|
|
208
|
+
loss.leavesOut = Object.assign(Object.assign({}, loss.leavesOut), { inputs: whole.leavesOut });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The project references in the `dependsOn` and `inputs` of a target that
|
|
214
|
+
* the plugin declares, with the names that Nx's merge gives them where that
|
|
215
|
+
* is certain (`EVD-NX-24-PLUGIN-NODES`). Nx replaces each reference with
|
|
216
|
+
* the project that had its name when the plugin's projects were merged,
|
|
217
|
+
* and writes the final name of that project in its place once every layer
|
|
218
|
+
* is merged. A name that the plugin gave one of the projects of this entry
|
|
219
|
+
* had that project then, so it becomes the name under which the merged
|
|
220
|
+
* graph knows the project at that root. Only the forms that Nx renames are
|
|
221
|
+
* renamed: a `projects` string other than `*`, `self` and `dependencies`
|
|
222
|
+
* (`self` and `dependencies` in `inputs`), each element of a `projects`
|
|
223
|
+
* list that is no glob pattern, and a `<project>:<target>` string in
|
|
224
|
+
* `dependsOn` with exactly one colon, for which Nx can find no other
|
|
225
|
+
* reading: neither the string nor its first part names a target of the
|
|
226
|
+
* project itself, and the string names no project. Every other name stays
|
|
227
|
+
* as written, so that a reference that Nx renamed in a way that the plugin
|
|
228
|
+
* cannot prove remains a difference.
|
|
229
|
+
*
|
|
230
|
+
* @param merged The projects as Nx merged them, by name.
|
|
231
|
+
*/
|
|
232
|
+
function nxNames(projects, merged) {
|
|
233
|
+
var _a;
|
|
234
|
+
const byRoot = new Map(Object.values(merged).map((project) => [project.root, project]));
|
|
235
|
+
const finalNames = new Map();
|
|
236
|
+
for (const project of projects) {
|
|
237
|
+
const name = (_a = byRoot.get(project.root)) === null || _a === void 0 ? void 0 : _a.name;
|
|
238
|
+
if (name !== undefined) {
|
|
239
|
+
finalNames.set(project.name, name);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if ([...finalNames].every(([name, final]) => name === final)) {
|
|
243
|
+
return (_project, target) => target;
|
|
244
|
+
}
|
|
245
|
+
const projectNames = new Set([...Object.keys(merged), ...finalNames.keys()]);
|
|
246
|
+
const renamed = (name) => { var _a; return (_a = finalNames.get(name)) !== null && _a !== void 0 ? _a : name; };
|
|
247
|
+
const listed = (projects) => projects.map((name) => typeof name === "string" && !(0, target_defaults_layers_1.isGlobPattern)(name) ? renamed(name) : name);
|
|
248
|
+
const withProjects = (reference, kept) => {
|
|
249
|
+
if (!(0, target_defaults_layers_1.isRecord)(reference) || !("projects" in reference)) {
|
|
250
|
+
return reference;
|
|
251
|
+
}
|
|
252
|
+
const { projects } = reference;
|
|
253
|
+
if (typeof projects === "string") {
|
|
254
|
+
return kept.includes(projects) ? reference : Object.assign(Object.assign({}, reference), { projects: renamed(projects) });
|
|
255
|
+
}
|
|
256
|
+
return Array.isArray(projects) ? Object.assign(Object.assign({}, reference), { projects: listed(projects) }) : reference;
|
|
257
|
+
};
|
|
258
|
+
return (project, target) => {
|
|
259
|
+
var _a, _b;
|
|
260
|
+
const ownTargets = new Set([
|
|
261
|
+
...Object.keys(project.targets),
|
|
262
|
+
...Object.keys((_b = (_a = byRoot.get(project.root)) === null || _a === void 0 ? void 0 : _a.targets) !== null && _b !== void 0 ? _b : {}),
|
|
263
|
+
]);
|
|
264
|
+
const projectTarget = (dependency) => {
|
|
265
|
+
const colon = dependency.indexOf(":");
|
|
266
|
+
if (dependency.startsWith("^") ||
|
|
267
|
+
dependency.includes('"') ||
|
|
268
|
+
ownTargets.has(dependency) ||
|
|
269
|
+
colon <= 0 ||
|
|
270
|
+
colon === dependency.length - 1 ||
|
|
271
|
+
dependency.indexOf(":", colon + 1) !== -1 ||
|
|
272
|
+
ownTargets.has(dependency.slice(0, colon)) ||
|
|
273
|
+
projectNames.has(dependency)) {
|
|
274
|
+
return dependency;
|
|
275
|
+
}
|
|
276
|
+
const final = finalNames.get(dependency.slice(0, colon));
|
|
277
|
+
return final === undefined ? dependency : `${final}${dependency.slice(colon)}`;
|
|
278
|
+
};
|
|
279
|
+
return Object.assign(Object.assign(Object.assign({}, target), (target.dependsOn === undefined
|
|
280
|
+
? {}
|
|
281
|
+
: {
|
|
282
|
+
dependsOn: target.dependsOn.map((dependency) => typeof dependency === "string"
|
|
283
|
+
? projectTarget(dependency)
|
|
284
|
+
: withProjects(dependency, ["*", "self", "dependencies"])),
|
|
285
|
+
})), (target.inputs === undefined
|
|
286
|
+
? {}
|
|
287
|
+
: {
|
|
288
|
+
inputs: target.inputs.map((input) => withProjects(input, ["self", "dependencies"])),
|
|
289
|
+
}));
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=target-defaults-meaning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-defaults-meaning.js","sourceRoot":"","sources":["../../../../nx-rust/src/graph/target-defaults-meaning.ts"],"names":[],"mappings":";;;AA8DA,sCAaC;AA6FD,8BAsBC;AAED,4CAEC;AAED,sCAEC;AAUD,8CAuEC;AAsBD,0BAyEC;AApXD,qEAA8E;AAE9E,8FAA8F;AACjF,QAAA,UAAU,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AAiDtE,sFAAsF;AACtF,MAAM,aAAa,GAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAElG;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,MAA2B,EAC3B,OAA4C;IAE5C,MAAM,KAAK,GAA8B,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,EAAE,CAAC;IAC1F,KAAK,MAAM,WAAW,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;QACxD,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAA,iCAAQ,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1F,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CACnB,MAA0B,EAC1B,KAAgC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AAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACjF,CAAC,CAAC;QACF,qDACK,MAAM,GACN,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS;YAChC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAC7C,OAAO,UAAU,KAAK,QAAQ;oBAC5B,CAAC,CAAC,aAAa,CAAC,UAAU,CAAC;oBAC3B,CAAC,CAAE,YAAY,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,CAAuB,CACnF;aACF,CAAC,GACH,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS;YAC7B,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CACvB,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAiB,CACzE;aACF,CAAC,EACN;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { TargetWarning } from "./collisions";
|
|
2
|
+
import { type AppliedEntry } from "./target-defaults-layers";
|
|
3
|
+
import { type OtherLayerLoss } from "./target-defaults-meaning";
|
|
4
|
+
/**
|
|
5
|
+
* What a `targetDefaults` entry does to an inferred target that the plugin
|
|
6
|
+
* reports (`DES-TARGET-DEFAULT-GUARD`).
|
|
7
|
+
*/
|
|
8
|
+
export type TargetDefaultChange = "adds-dependencies" | "replaces-dependsOn" | "replaces-inputs" | "replaces-outputs" | "turns-on-cache";
|
|
9
|
+
/** One inferred target that a `targetDefaults` entry changes. */
|
|
10
|
+
export interface TargetDefaultFinding {
|
|
11
|
+
change: TargetDefaultChange;
|
|
12
|
+
/** A warning for an entry that only adds dependencies, an error otherwise. */
|
|
13
|
+
severity: "error" | "warning";
|
|
14
|
+
/** The entry's key in `targetDefaults`. */
|
|
15
|
+
key: string;
|
|
16
|
+
/** The elements of the key's list that Nx applies to the target, where its value is a list. */
|
|
17
|
+
elements?: number[];
|
|
18
|
+
/** The target's name, as `targetNames` gives it. */
|
|
19
|
+
target: string;
|
|
20
|
+
/** The target's executor, which an entry keyed by it would take precedence. */
|
|
21
|
+
executor: string;
|
|
22
|
+
/** The project's name in the merged graph. */
|
|
23
|
+
project: string;
|
|
24
|
+
/** The manifest the project comes from, relative to the repository root. */
|
|
25
|
+
manifest: string;
|
|
26
|
+
/** For `adds-dependencies`, the `dependsOn` entries that the entry adds. */
|
|
27
|
+
added?: unknown[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An inferred target that differs from what the plugin inferred, where the
|
|
31
|
+
* plugin could not tell which configuration made the difference.
|
|
32
|
+
*/
|
|
33
|
+
export interface UnattributedChange {
|
|
34
|
+
target: string;
|
|
35
|
+
project: string;
|
|
36
|
+
manifest: string;
|
|
37
|
+
/** The fields that differ: `cache`, `inputs`, `outputs` or `dependsOn`. */
|
|
38
|
+
fields: string[];
|
|
39
|
+
}
|
|
40
|
+
/** What `findTargetDefaultChanges` found. */
|
|
41
|
+
export interface TargetDefaultChanges {
|
|
42
|
+
findings: TargetDefaultFinding[];
|
|
43
|
+
unattributed: UnattributedChange[];
|
|
44
|
+
/** Losses that another layer made, which fail graph creation. */
|
|
45
|
+
otherLayers?: OtherLayerLoss[];
|
|
46
|
+
/** The plugins that `nx.json` lists after this one, as it writes them. */
|
|
47
|
+
laterPlugins?: string[];
|
|
48
|
+
}
|
|
49
|
+
/** What `checkTargetDefaults` found: warnings to print and an error to fail with. */
|
|
50
|
+
export interface TargetDefaultReport {
|
|
51
|
+
warnings: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Each warning once for each target it concerns, which the tasks of that
|
|
54
|
+
* target print again (`DES-DIAGNOSTICS`, "Warnings where they are seen").
|
|
55
|
+
*/
|
|
56
|
+
placed: PlacedWarning[];
|
|
57
|
+
/** Absent when no entry does what makes an error. */
|
|
58
|
+
error?: string;
|
|
59
|
+
}
|
|
60
|
+
/** A warning of {@link TargetDefaultReport} for one target of one project. */
|
|
61
|
+
export interface PlacedWarning extends TargetWarning {
|
|
62
|
+
/** The project's name in the merged graph. */
|
|
63
|
+
project: string;
|
|
64
|
+
}
|
|
65
|
+
/** The section of the user guide that says how to narrow an entry. */
|
|
66
|
+
export declare const targetDefaultsGuide = "https://github.com/convesoft/nx-rust/blob/main/nx-rust/docs/targets.mara.md#target-defaults-that-reach-rust-targets";
|
|
67
|
+
/** The section of the user guide about what other plugins may do to Rust targets. */
|
|
68
|
+
export declare const otherPluginsGuide = "https://github.com/convesoft/nx-rust/blob/main/nx-rust/docs/targets.mara.md#other-plugins-that-reach-rust-targets";
|
|
69
|
+
/** An entry as messages name it, such as `the targetDefaults entry "build" in nx.json (its element 1)`. */
|
|
70
|
+
export declare function entryName({ key, indices }: AppliedEntry): string;
|
|
71
|
+
/**
|
|
72
|
+
* The user-facing report of `findTargetDefaultChanges`: one paragraph
|
|
73
|
+
* per entry and severity, which says what the entry does to which targets
|
|
74
|
+
* of which projects and how to narrow it, and one paragraph for the losses
|
|
75
|
+
* that another layer made.
|
|
76
|
+
*/
|
|
77
|
+
export declare function describeTargetDefaultChanges(findings: readonly TargetDefaultFinding[], unattributed?: readonly UnattributedChange[], others?: Pick<TargetDefaultChanges, "otherLayers" | "laterPlugins">): TargetDefaultReport;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.otherPluginsGuide = exports.targetDefaultsGuide = void 0;
|
|
4
|
+
exports.entryName = entryName;
|
|
5
|
+
exports.describeTargetDefaultChanges = describeTargetDefaultChanges;
|
|
6
|
+
const target_defaults_layers_1 = require("./target-defaults-layers");
|
|
7
|
+
const target_defaults_meaning_1 = require("./target-defaults-meaning");
|
|
8
|
+
/** The section of the user guide that says how to narrow an entry. */
|
|
9
|
+
exports.targetDefaultsGuide = "https://github.com/convesoft/nx-rust/blob/main/nx-rust/docs/targets.mara.md#target-defaults-that-reach-rust-targets";
|
|
10
|
+
/** The section of the user guide about what other plugins may do to Rust targets. */
|
|
11
|
+
exports.otherPluginsGuide = "https://github.com/convesoft/nx-rust/blob/main/nx-rust/docs/targets.mara.md#other-plugins-that-reach-rust-targets";
|
|
12
|
+
/** An entry as messages name it, such as `the targetDefaults entry "build" in nx.json (its element 1)`. */
|
|
13
|
+
function entryName({ key, indices }) {
|
|
14
|
+
return `the targetDefaults entry "${key}" in nx.json${elements(indices)}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The user-facing report of `findTargetDefaultChanges`: one paragraph
|
|
18
|
+
* per entry and severity, which says what the entry does to which targets
|
|
19
|
+
* of which projects and how to narrow it, and one paragraph for the losses
|
|
20
|
+
* that another layer made.
|
|
21
|
+
*/
|
|
22
|
+
function describeTargetDefaultChanges(findings, unattributed = [], others = {}) {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const byEntry = groupBy(findings, (finding) => { var _a; return JSON.stringify([finding.severity, finding.key, (_a = finding.elements) !== null && _a !== void 0 ? _a : null]); });
|
|
25
|
+
const groups = (severity) => [...byEntry.values()]
|
|
26
|
+
.filter(([first]) => first.severity === severity)
|
|
27
|
+
.sort(([a], [b]) => (0, target_defaults_layers_1.compare)(a.key, b.key));
|
|
28
|
+
const errors = [
|
|
29
|
+
...groups("error").map(paragraph),
|
|
30
|
+
...(((_a = others.otherLayers) !== null && _a !== void 0 ? _a : []).length > 0
|
|
31
|
+
? [otherLayersParagraph((_b = others.otherLayers) !== null && _b !== void 0 ? _b : [], (_c = others.laterPlugins) !== null && _c !== void 0 ? _c : [])]
|
|
32
|
+
: []),
|
|
33
|
+
];
|
|
34
|
+
const warnings = groups("warning").map((group) => ({ warning: paragraph(group), group }));
|
|
35
|
+
const placed = [
|
|
36
|
+
...warnings.flatMap(({ warning, group }) => [...groupBy(group, ({ project, target }) => `${project}\0${target}`).values()].map(([{ project, target }]) => ({ project, target, warning }))),
|
|
37
|
+
...unattributed.map((change) => ({
|
|
38
|
+
project: change.project,
|
|
39
|
+
target: change.target,
|
|
40
|
+
warning: unattributedWarning(change),
|
|
41
|
+
})),
|
|
42
|
+
];
|
|
43
|
+
return Object.assign({ warnings: [...warnings.map(({ warning }) => warning), ...unattributed.map(unattributedWarning)], placed }, (errors.length === 0 ? {} : { error: errors.join("\n\n") }));
|
|
44
|
+
}
|
|
45
|
+
// The error for the losses that another layer made: a line for each field of
|
|
46
|
+
// each target, with up to three of the lost entries, the plugins listed
|
|
47
|
+
// after nx-rust and the fixes (DES-TARGET-DEFAULT-GUARD, "Other layers").
|
|
48
|
+
function otherLayersParagraph(losses, laterPlugins) {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const sorted = [...losses].sort((a, b) => (0, target_defaults_layers_1.compare)(a.project, b.project) || (0, target_defaults_layers_1.compare)(a.target, b.target));
|
|
51
|
+
// Up to three entries, then how many more.
|
|
52
|
+
// A file set that Nx's expansion wrote as an object is shown as the
|
|
53
|
+
// pattern that the layers write.
|
|
54
|
+
const some = (entries) => {
|
|
55
|
+
const shown = entries
|
|
56
|
+
.slice(0, 3)
|
|
57
|
+
.map((entry) => JSON.stringify((0, target_defaults_layers_1.isRecord)(entry) && Object.keys(entry).length === 1 && typeof entry.fileset === "string"
|
|
58
|
+
? entry.fileset
|
|
59
|
+
: entry));
|
|
60
|
+
const more = entries.length - shown.length;
|
|
61
|
+
return list(more > 0 ? [...shown, `${more} more`] : shown);
|
|
62
|
+
};
|
|
63
|
+
const lines = [];
|
|
64
|
+
for (const { target, project, manifest, lost, leavesOut, namedInputs } of sorted) {
|
|
65
|
+
const subject = `"${target}" of ${project} (${manifest})`;
|
|
66
|
+
for (const field of target_defaults_meaning_1.listFields) {
|
|
67
|
+
const entries = (_a = lost[field]) !== null && _a !== void 0 ? _a : [];
|
|
68
|
+
if (entries.length > 0) {
|
|
69
|
+
lines.push(` - ${subject} lacks entries of its "${field}" that nx-rust declares: ${some(entries)}.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const field of ["inputs", "outputs"]) {
|
|
73
|
+
const entries = (_b = leavesOut === null || leavesOut === void 0 ? void 0 : leavesOut[field]) !== null && _b !== void 0 ? _b : [];
|
|
74
|
+
if (entries.length > 0) {
|
|
75
|
+
lines.push(` - ${subject} has entries of its "${field}" that leave files out: ${some(entries)}.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const { name, definition, lost: dropped, leavesOut: excluded } of namedInputs !== null && namedInputs !== void 0 ? namedInputs : []) {
|
|
79
|
+
const effects = [
|
|
80
|
+
...(dropped.length > 0 ? [`lacks ${some(dropped)}`] : []),
|
|
81
|
+
...(excluded.length > 0 ? [`leaves files out with ${some(excluded)}`] : []),
|
|
82
|
+
];
|
|
83
|
+
lines.push(` - ${subject} reads the named input "${name}", which another layer defines for ${project} as ${JSON.stringify(definition)}, so that it ${effects.join(" and ")}.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const [first] = sorted;
|
|
87
|
+
const folder = (file) => (first.root === "." ? file : `${first.root}/${file}`);
|
|
88
|
+
const field = (_c = [...target_defaults_meaning_1.listFields].find((name) => {
|
|
89
|
+
var _a, _b, _c;
|
|
90
|
+
return ((_a = first.lost[name]) !== null && _a !== void 0 ? _a : []).length > 0 ||
|
|
91
|
+
(name !== "dependsOn" && ((_c = (_b = first.leavesOut) === null || _b === void 0 ? void 0 : _b[name]) !== null && _c !== void 0 ? _c : []).length > 0);
|
|
92
|
+
})) !== null && _c !== void 0 ? _c : "inputs";
|
|
93
|
+
const namesProjects = sorted.some(({ lost }) => Object.entries(lost).some(([field, entries]) => (entries !== null && entries !== void 0 ? entries : []).some((entry) => namesProject(entry, field === "dependsOn"))));
|
|
94
|
+
const fixes = [
|
|
95
|
+
...(laterPlugins.length > 0
|
|
96
|
+
? [
|
|
97
|
+
`Keep the plugin away from these projects with an "exclude" on its entry in nx.json, as in { "plugin": ${JSON.stringify(laterPlugins[0])}, "exclude": [${JSON.stringify(folder("**"))}] }.`,
|
|
98
|
+
]
|
|
99
|
+
: []),
|
|
100
|
+
`Where the plugin is yours, have it keep nx-rust's entries with "..." at the head of each list that it gives these targets, as in "${field}": ["...", <its entries>], and give these projects no negated pattern or named input of its own.`,
|
|
101
|
+
`If the change is intended, write it into the project.json in the project's folder, such as ${folder("project.json")}: nx-rust takes that file, and a package.json there, as the project's own statement.`,
|
|
102
|
+
...(namesProjects
|
|
103
|
+
? [
|
|
104
|
+
"Where a lost entry names a project, a project.json or package.json that renames that project makes Nx write the project's final name into the reference: name the project in the Cargo metadata as `nx show projects` lists it.",
|
|
105
|
+
]
|
|
106
|
+
: []),
|
|
107
|
+
];
|
|
108
|
+
return [
|
|
109
|
+
"Another plugin takes away or narrows what nx-rust declares for targets that it infers, and neither a targetDefaults entry in nx.json nor the projects' own project.json or package.json does it:",
|
|
110
|
+
...lines,
|
|
111
|
+
"Nx could then restore a result that running the task would not give: the cache key and nx affected miss what the task reads, a cache hit leaves out files that it writes, or the task runs without a task that it needs.",
|
|
112
|
+
laterPlugins.length > 0
|
|
113
|
+
? `nx.json lists these plugins after nx-rust, whose targets Nx merges over nx-rust's: ${list(laterPlugins.map((name) => JSON.stringify(name)))}.`
|
|
114
|
+
: "nx.json lists no plugin after nx-rust.",
|
|
115
|
+
`To keep what nx-rust declares (${exports.otherPluginsGuide}), do one of these:`,
|
|
116
|
+
...fixes.map((fix) => ` - ${fix}`),
|
|
117
|
+
`Run \`nx show target ${first.project}:${first.target} --json\` and look under "sourceMap" for the plugin behind each of these fields.`,
|
|
118
|
+
].join("\n");
|
|
119
|
+
}
|
|
120
|
+
// Whether a declared inputs or dependsOn entry names a project, which Nx
|
|
121
|
+
// gives the final name of the project that had that name (EVD-NX-24-PLUGIN-NODES):
|
|
122
|
+
// a `projects` name other than `*`, `self`, `dependencies` and a pattern with
|
|
123
|
+
// a colon, such as `directory:rust`, or a `<project>:<target>` dependency.
|
|
124
|
+
function namesProject(entry, dependsOn) {
|
|
125
|
+
if (typeof entry === "string") {
|
|
126
|
+
return dependsOn && !entry.startsWith("^") && entry.includes(":");
|
|
127
|
+
}
|
|
128
|
+
if (!(0, target_defaults_layers_1.isRecord)(entry)) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
const projects = Array.isArray(entry.projects) ? entry.projects : [entry.projects];
|
|
132
|
+
return projects.some((name) => typeof name === "string" &&
|
|
133
|
+
!["*", "self", "dependencies"].includes(name) &&
|
|
134
|
+
!name.includes(":") &&
|
|
135
|
+
!(0, target_defaults_layers_1.isGlobPattern)(name));
|
|
136
|
+
}
|
|
137
|
+
// The warning for a target whose change the plugin could not attribute.
|
|
138
|
+
function unattributedWarning({ target, project, manifest, fields }) {
|
|
139
|
+
return [
|
|
140
|
+
`The target "${target}" of the Rust project ${project} (${manifest}) differs from what nx-rust infers in ${list(fields.map((field) => `"${field}"`))}, and nx-rust cannot tell which configuration changed it: it sees the targetDefaults of nx.json and the project's own project.json and package.json, but not, for example, another plugin listed in nx.json.`,
|
|
141
|
+
`Run \`nx show target ${project}:${target} --json\` and look under "sourceMap" for the file and entry behind each of these fields. If it is a targetDefaults entry, narrow it as ${exports.targetDefaultsGuide} shows.`,
|
|
142
|
+
].join("\n");
|
|
143
|
+
}
|
|
144
|
+
const changeOrder = [
|
|
145
|
+
"turns-on-cache",
|
|
146
|
+
"replaces-inputs",
|
|
147
|
+
"replaces-outputs",
|
|
148
|
+
"replaces-dependsOn",
|
|
149
|
+
"adds-dependencies",
|
|
150
|
+
];
|
|
151
|
+
const fieldOf = {
|
|
152
|
+
"adds-dependencies": "dependsOn",
|
|
153
|
+
"replaces-dependsOn": "dependsOn",
|
|
154
|
+
"replaces-inputs": "inputs",
|
|
155
|
+
"replaces-outputs": "outputs",
|
|
156
|
+
"turns-on-cache": "cache",
|
|
157
|
+
};
|
|
158
|
+
// The paragraph for the findings of one entry and severity: a line for each
|
|
159
|
+
// change and set of projects, naming the targets, then the ways to narrow
|
|
160
|
+
// the entry that fit what it does.
|
|
161
|
+
function paragraph(findings) {
|
|
162
|
+
const [{ key, elements: indices }] = findings;
|
|
163
|
+
const lines = [];
|
|
164
|
+
for (const change of changeOrder) {
|
|
165
|
+
const ofChange = findings.filter((finding) => finding.change === change);
|
|
166
|
+
const byTargets = groupBy(groupBy(ofChange, (finding) => `${finding.project}\0${finding.manifest}`).values(), (ofProject) => JSON.stringify([...new Set(ofProject.map(({ target }) => target))]
|
|
167
|
+
.sort(target_defaults_layers_1.compare)
|
|
168
|
+
.concat(ofProject.flatMap(({ added }) => (added !== null && added !== void 0 ? added : []).map((value) => JSON.stringify(value))))));
|
|
169
|
+
for (const group of byTargets.values()) {
|
|
170
|
+
const targets = [...new Set(group.flat().map(({ target }) => `"${target}"`))].sort(target_defaults_layers_1.compare);
|
|
171
|
+
const projects = group
|
|
172
|
+
.map(([{ project, manifest }]) => `${project} (${manifest})`)
|
|
173
|
+
.sort(target_defaults_layers_1.compare);
|
|
174
|
+
const added = [
|
|
175
|
+
...new Set(group.flat().flatMap(({ added }) => (added !== null && added !== void 0 ? added : []).map((v) => JSON.stringify(v)))),
|
|
176
|
+
];
|
|
177
|
+
lines.push(` - ${describeChange(change, list(targets), list(added))} In ${list(projects)}.`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const changes = new Set(findings.map(({ change }) => change));
|
|
181
|
+
const fields = [...new Set(changeOrder.filter((c) => changes.has(c)).map((c) => fieldOf[c]))];
|
|
182
|
+
const replaced = [...changes]
|
|
183
|
+
.filter((change) => change.startsWith("replaces-"))
|
|
184
|
+
.map((change) => fieldOf[change]);
|
|
185
|
+
const executors = [...new Set(findings.map(({ executor }) => executor))].sort(target_defaults_layers_1.compare);
|
|
186
|
+
const fixes = executors.length === 1 && key === executors[0]
|
|
187
|
+
? [
|
|
188
|
+
`Remove ${list(fields.map((field) => `"${field}"`))} from the entry. It is keyed by the executor of nx-rust's targets, so it reaches only those.`,
|
|
189
|
+
`Give the entry a "filter" on "projects" that leaves these projects out, which needs the entry written as a list: "${key}": [{ "filter": { "projects": [...] }, ... }].`,
|
|
190
|
+
]
|
|
191
|
+
: [
|
|
192
|
+
`Give the entry a "filter" that leaves these projects out, which needs the entry written as a list: "${key}": [{ "filter": { "projects": ["!tag:lang:rust"] }, ... }] where the crates carry the tag lang:rust, or a filter on the "executor" of the targets the entry is meant for.`,
|
|
193
|
+
`Add an empty entry keyed by the executor of these targets, ${list(executors.map((executor) => `"${executor}": {}`))}. Nx chooses an entry keyed by a target's executor before one keyed by its name.`,
|
|
194
|
+
];
|
|
195
|
+
if (replaced.length > 0) {
|
|
196
|
+
fixes.push(`Keep what nx-rust declares by putting "..." into the entry's ${list(replaced.map((field) => `"${field}"`))} list, as in ["...", <your entries>].`);
|
|
197
|
+
}
|
|
198
|
+
return [
|
|
199
|
+
`The targetDefaults entry "${key}" in nx.json${elements(indices)} changes targets that nx-rust infers:`,
|
|
200
|
+
...lines,
|
|
201
|
+
`To narrow the entry (${exports.targetDefaultsGuide}), do one of these:`,
|
|
202
|
+
...fixes.map((fix) => ` - ${fix}`),
|
|
203
|
+
].join("\n");
|
|
204
|
+
}
|
|
205
|
+
// What a change does, for the targets and the added dependencies named.
|
|
206
|
+
function describeChange(change, targets, added) {
|
|
207
|
+
switch (change) {
|
|
208
|
+
case "turns-on-cache":
|
|
209
|
+
return `It turns on caching for ${targets}, which nx-rust leaves uncached: Nx could restore a result where running the task would give another one.`;
|
|
210
|
+
case "replaces-inputs":
|
|
211
|
+
return `It replaces the inputs that nx-rust declares for ${targets}, so that the cache key and nx affected miss files or settings that the task depends on.`;
|
|
212
|
+
case "replaces-outputs":
|
|
213
|
+
return `It replaces the outputs that nx-rust declares for ${targets}, so that a cache hit would not restore files that the task writes.`;
|
|
214
|
+
case "replaces-dependsOn":
|
|
215
|
+
return `It replaces the dependsOn that nx-rust declares for ${targets}, so that the task no longer depends on a task that it needs: the lockfile task, whose output its cache key reads, or, for a test, the build of each crate whose executables its cargo test replaces.`;
|
|
216
|
+
case "adds-dependencies":
|
|
217
|
+
return `It adds ${added} to the dependsOn of ${targets}, so that the task waits for tasks of other projects. Cargo builds what a crate depends on itself, so these only queue more cargo processes behind its build lock.`;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function groupBy(items, key) {
|
|
221
|
+
var _a;
|
|
222
|
+
const groups = new Map();
|
|
223
|
+
for (const item of items) {
|
|
224
|
+
const id = key(item);
|
|
225
|
+
groups.set(id, [...((_a = groups.get(id)) !== null && _a !== void 0 ? _a : []), item]);
|
|
226
|
+
}
|
|
227
|
+
return groups;
|
|
228
|
+
}
|
|
229
|
+
// " (its element 1)", " (its elements 0 and 2)" or nothing.
|
|
230
|
+
function elements(indices) {
|
|
231
|
+
if (indices === undefined) {
|
|
232
|
+
return "";
|
|
233
|
+
}
|
|
234
|
+
return ` (its element${indices.length === 1 ? "" : "s"} ${list(indices.map(String))})`;
|
|
235
|
+
}
|
|
236
|
+
// "a", "a and b", "a, b and c"
|
|
237
|
+
function list(items) {
|
|
238
|
+
return items.length <= 1
|
|
239
|
+
? items.join("")
|
|
240
|
+
: `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=target-defaults-report.js.map
|