@smoothbricks/nx-plugin 0.4.26 → 0.4.27
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/README.md +994 -117
- package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-bound-failures.js +31 -0
- package/dist/bin/smoo-nx-cargo-hash.js +28 -3
- package/dist/bin/smoo-nx-exec.js +15 -73
- package/dist/bin/smoo-nx-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-failures.js +3 -0
- package/dist/bin/smoo-nx-nextest-extract.js +3 -2
- package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-walks.js +34 -0
- package/dist/bounded-test-policy.d.ts +7 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +101 -40
- package/dist/build-state-output-policy.d.ts +25 -0
- package/dist/build-state-output-policy.d.ts.map +1 -0
- package/dist/build-state-output-policy.js +64 -0
- package/dist/cargo-closure-input.d.ts +3 -2
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +16 -15
- package/dist/cargo-dev-profile.d.ts +37 -0
- package/dist/cargo-dev-profile.d.ts.map +1 -0
- package/dist/cargo-dev-profile.js +108 -0
- package/dist/cargo-source-hash.d.ts +43 -6
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +309 -73
- package/dist/cargo-toolchain-policy.d.ts +4 -0
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +5 -0
- package/dist/cargo-workspace.d.ts +101 -5
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +291 -10
- package/dist/cross-check-policy.d.ts +21 -3
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +24 -6
- package/dist/disk-command-policy.d.ts +7 -0
- package/dist/disk-command-policy.d.ts.map +1 -0
- package/dist/disk-command-policy.js +98 -0
- package/dist/ensure-built-receipt.d.ts +25 -0
- package/dist/ensure-built-receipt.d.ts.map +1 -0
- package/dist/ensure-built-receipt.js +261 -0
- package/dist/ensure-built-witness.d.ts +57 -0
- package/dist/ensure-built-witness.d.ts.map +1 -0
- package/dist/ensure-built-witness.js +412 -0
- package/dist/ensure-built.d.ts +207 -12
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +576 -202
- package/dist/eslint-file-set.d.ts +7 -0
- package/dist/eslint-file-set.d.ts.map +1 -0
- package/dist/eslint-file-set.js +12 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool.js +379 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/disk-lease.js +91 -0
- package/dist/executors/bounded-exec/executor.d.ts +45 -2
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +447 -52
- package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/gateway-lease.js +143 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
- package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
- package/dist/executors/bounded-exec/progress.d.ts +35 -0
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress.js +79 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp.js +1528 -0
- package/dist/executors/bounded-exec/schema.d.ts +29 -11
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +162 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
- package/dist/executors/bounded-exec/verdict.js +318 -0
- package/dist/executors/shard-timings/executor.d.ts +14 -0
- package/dist/executors/shard-timings/executor.d.ts.map +1 -0
- package/dist/executors/shard-timings/executor.js +25 -0
- package/dist/executors/shard-timings/schema.d.ts +4 -0
- package/dist/executors/shard-timings/schema.d.ts.map +1 -0
- package/dist/executors/shard-timings/schema.js +1 -0
- package/dist/failure-summary.d.ts +5 -0
- package/dist/failure-summary.d.ts.map +1 -0
- package/dist/failure-summary.js +118 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +6 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +370 -138
- package/dist/managed-files/ci-workflow.d.ts +13 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +44 -13
- package/dist/managed-files/files.d.ts +7 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +62 -8
- package/dist/managed-files/json-edit.d.ts +21 -0
- package/dist/managed-files/json-edit.d.ts.map +1 -0
- package/dist/managed-files/json-edit.js +295 -0
- package/dist/managed-files/managed-format.d.ts +33 -1
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +82 -2
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
- package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +231 -48
- package/dist/managed-files/tree.d.ts +5 -0
- package/dist/managed-files/tree.d.ts.map +1 -1
- package/dist/managed-files/tree.js +5 -3
- package/dist/manifest-hash.d.ts.map +1 -1
- package/dist/manifest-hash.js +2 -5
- package/dist/nextest-code-bound.d.ts +62 -0
- package/dist/nextest-code-bound.d.ts.map +1 -0
- package/dist/nextest-code-bound.js +154 -0
- package/dist/nextest-extraction.d.ts +24 -8
- package/dist/nextest-extraction.d.ts.map +1 -1
- package/dist/nextest-extraction.js +42 -7
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +3 -5
- package/dist/release-config-policy.d.ts.map +1 -1
- package/dist/release-config-policy.js +3 -5
- package/dist/runtime-input.d.ts +14 -0
- package/dist/runtime-input.d.ts.map +1 -0
- package/dist/runtime-input.js +15 -0
- package/dist/rust-tokens.d.ts +11 -0
- package/dist/rust-tokens.d.ts.map +1 -0
- package/dist/rust-tokens.js +81 -0
- package/dist/task-results.d.ts +6 -0
- package/dist/task-results.d.ts.map +1 -0
- package/dist/task-results.js +61 -0
- package/dist/test-program.d.ts +54 -0
- package/dist/test-program.d.ts.map +1 -0
- package/dist/test-program.js +292 -0
- package/dist/test-timings.d.ts +71 -0
- package/dist/test-timings.d.ts.map +1 -0
- package/dist/test-timings.js +393 -0
- package/dist/test-walk-policy.d.ts +103 -0
- package/dist/test-walk-policy.d.ts.map +1 -0
- package/dist/test-walk-policy.js +657 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +824 -0
- package/dist/type-guards.d.ts +3 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +4 -0
- package/dist/typecheck-test-policy.d.ts +8 -5
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +113 -100
- package/dist/workspace-config-policy.d.ts +8 -0
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +175 -63
- package/dist/workspace-index.d.ts +12 -0
- package/dist/workspace-index.d.ts.map +1 -0
- package/dist/workspace-index.js +17 -0
- package/dist/workspace-manifest.d.ts +37 -0
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +5 -0
- package/loader.js +13 -11
- package/managed/raw/envrc +33 -67
- package/managed/raw/git-format-staged.yml +30 -35
- package/managed/raw/patches/nx@23.2.1.patch +3484 -0
- package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
- package/managed/raw/tooling/direnv/developer-links.ts +569 -11
- package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -93
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
- package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
- package/managed/raw/tooling/direnv/repo-path +14 -2
- package/managed/raw/tooling/direnv/setup-environment.ts +962 -148
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
- package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
- package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
- package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
- package/managed/templates/github/actions/cache-nx/action.yml +1 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
- package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
- package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
- package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
- package/managed/templates/github/workflows/managed-files.yml +1 -2
- package/nextest.toml +8 -41
- package/package.json +74 -12
- package/runtime-input.sh +81 -0
- package/src/__tests__/counted-cargo.ts +33 -14
- package/src/__tests__/fixture-nx-env.ts +111 -46
- package/src/__tests__/progress-clock.ts +43 -0
- package/src/__tests__/runtime-input.ts +23 -0
- package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
- package/src/bin/smoo-nx-bound-failures.ts +33 -0
- package/src/bin/smoo-nx-cargo-hash.ts +28 -3
- package/src/bin/smoo-nx-exec.ts +16 -74
- package/src/bin/smoo-nx-failures.ts +4 -0
- package/src/bin/smoo-nx-nextest-extract.ts +3 -2
- package/src/bin/smoo-nx-test-walks.ts +42 -0
- package/src/bounded-test-policy.test.ts +268 -21
- package/src/bounded-test-policy.ts +114 -42
- package/src/build-state-output-policy.test.ts +115 -0
- package/src/build-state-output-policy.ts +90 -0
- package/src/bun-bootstrap.test.ts +57 -3
- package/src/bun-file-packages.test.ts +47 -0
- package/src/cargo-closure-input.test.ts +138 -66
- package/src/cargo-closure-input.ts +17 -15
- package/src/cargo-dev-profile.ts +137 -0
- package/src/cargo-resolve-cache.test.ts +70 -1
- package/src/cargo-source-hash.test.ts +193 -97
- package/src/cargo-source-hash.ts +345 -68
- package/src/cargo-toolchain-policy.ts +6 -0
- package/src/cargo-workspace.test.ts +320 -0
- package/src/cargo-workspace.ts +336 -10
- package/src/cross-check-policy.test.ts +59 -1
- package/src/cross-check-policy.ts +25 -6
- package/src/disk-command-policy.test.ts +61 -0
- package/src/disk-command-policy.ts +107 -0
- package/src/ensure-built-receipt.test.ts +184 -0
- package/src/ensure-built-receipt.ts +263 -0
- package/src/ensure-built-witness.test.ts +344 -0
- package/src/ensure-built-witness.ts +252 -0
- package/src/ensure-built.test.ts +1036 -578
- package/src/ensure-built.ts +820 -224
- package/src/eslint-file-set.ts +9 -0
- package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
- package/src/executors/bounded-exec/cpu-pool.ts +417 -0
- package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
- package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
- package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
- package/src/executors/bounded-exec/disk-lease.ts +139 -0
- package/src/executors/bounded-exec/executor-host.test.ts +778 -0
- package/src/executors/bounded-exec/executor.test.ts +1116 -63
- package/src/executors/bounded-exec/executor.ts +565 -67
- package/src/executors/bounded-exec/gateway-lease.ts +176 -0
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
- package/src/executors/bounded-exec/progress.test.ts +79 -0
- package/src/executors/bounded-exec/progress.ts +118 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
- package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
- package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
- package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
- package/src/executors/bounded-exec/ram-temp.ts +1918 -0
- package/src/executors/bounded-exec/schema.json +11 -5
- package/src/executors/bounded-exec/schema.ts +27 -11
- package/src/executors/bounded-exec/verdict.test.ts +440 -0
- package/src/executors/bounded-exec/verdict.ts +433 -0
- package/src/executors/shard-timings/executor.ts +36 -0
- package/src/executors/shard-timings/schema.json +21 -0
- package/src/executors/shard-timings/schema.ts +4 -0
- package/src/failure-summary.ts +119 -0
- package/src/generators/bounded-test-targets/generator.test.ts +4 -4
- package/src/generators/bun-test-tracing/generator.test.ts +2 -2
- package/src/generators/create-package/generator.test.ts +6 -0
- package/src/generators/create-package/generator.ts +6 -2
- package/src/host-controller-wiring.test.ts +31 -0
- package/src/index.test.ts +909 -295
- package/src/index.ts +441 -143
- package/src/linked-snapshots.nx.test.ts +172 -0
- package/src/managed-files/ci-workflow.ts +54 -13
- package/src/managed-files/files.ts +65 -9
- package/src/managed-files/forgejo-artifact.test.ts +395 -0
- package/src/managed-files/generator.test.ts +60 -1
- package/src/managed-files/json-edit.test.ts +216 -0
- package/src/managed-files/json-edit.ts +290 -0
- package/src/managed-files/managed-format-json.test.ts +308 -0
- package/src/managed-files/managed-format.ts +90 -2
- package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
- package/src/managed-files/publish-workflow.ts +285 -67
- package/src/managed-files/repo-path.test.ts +129 -0
- package/src/managed-files/trace-db-artifact.test.ts +7 -0
- package/src/managed-files/tree.ts +11 -3
- package/src/manifest-hash.ts +2 -6
- package/src/nextest-code-bound.test.ts +155 -0
- package/src/nextest-code-bound.ts +195 -0
- package/src/nextest-extraction.test.ts +37 -5
- package/src/nextest-extraction.ts +51 -9
- package/src/nextest-partitions.test.ts +427 -82
- package/src/nx-cache-bound.test.ts +5 -10
- package/src/nx-cache-restore-mtime.test.ts +170 -0
- package/src/nx-daemon-claim.test.ts +277 -0
- package/src/nx-daemon-idle-cpu.test.ts +81 -0
- package/src/nx-daemon-idle-policy.test.ts +51 -0
- package/src/nx-daemon-ignore-files.test.ts +210 -0
- package/src/nx-daemon-root-normalization.test.ts +105 -0
- package/src/nx-daemon-validity.test.ts +925 -0
- package/src/nx-dot-input-policy.test.ts +353 -0
- package/src/nx-failure-life-cycles.test.ts +207 -0
- package/src/nx-files-archive-racy.test.ts +97 -0
- package/src/nx-foreign-workspace-env.test.ts +329 -0
- package/src/nx-incomplete-run-summary.test.ts +70 -0
- package/src/nx-plugin-load-errors.test.ts +120 -0
- package/src/nx-project-resolution-cache.test.ts +176 -0
- package/src/nx-raw-inputs.test.ts +166 -0
- package/src/nx-resident-graph-workers.test.ts +7 -16
- package/src/nx-run-information.test.ts +118 -0
- package/src/nx-skipped-task-exit.test.ts +180 -0
- package/src/nx-state-location.test.ts +63 -0
- package/src/nx-store-resolution.test.ts +26 -25
- package/src/nx-task-graph-cycles.test.ts +148 -0
- package/src/nx-task-output-lease.test.ts +414 -0
- package/src/nx-use-local.test.ts +103 -0
- package/src/package-target-policy.ts +3 -6
- package/src/release-config-policy.ts +3 -6
- package/src/runtime-input.test.ts +215 -0
- package/src/runtime-input.ts +17 -0
- package/src/rust-tokens.ts +78 -0
- package/src/serial-group-wiring.test.ts +326 -0
- package/src/task-history-namespace.test.ts +87 -89
- package/src/task-results.test.ts +226 -0
- package/src/task-results.ts +75 -0
- package/src/test-program.test.ts +303 -0
- package/src/test-program.ts +341 -0
- package/src/test-timings.test.ts +240 -0
- package/src/test-timings.ts +311 -0
- package/src/test-walk-policy.test.ts +585 -0
- package/src/test-walk-policy.ts +731 -0
- package/src/testing.test.ts +509 -0
- package/src/testing.ts +922 -0
- package/src/type-guards.ts +4 -0
- package/src/typecheck-test-policy.test.ts +496 -11
- package/src/typecheck-test-policy.ts +137 -103
- package/src/workspace-config-policy.test.ts +212 -13
- package/src/workspace-config-policy.ts +101 -73
- package/src/workspace-index.ts +18 -0
- package/src/workspace-manifest.ts +41 -0
- package/test-timings.json +85 -30
- package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -665
- package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { closeSync, lstatSync, openSync, readdirSync, readFileSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import typia from 'typia';
|
|
5
|
+
/** Identity of a previously read node, not a timestamp freshness threshold. */
|
|
6
|
+
export function nodeStamp(stats) {
|
|
7
|
+
return `${stats.dev}:${stats.ino}:${stats.mode}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`;
|
|
8
|
+
}
|
|
9
|
+
/** An absent, unreadable or malformed optional witness never authorizes reuse. */
|
|
10
|
+
export function readGraphWitness(path) {
|
|
11
|
+
try {
|
|
12
|
+
return (() => {
|
|
13
|
+
const _ip0 = input => "string" === typeof input["path"];
|
|
14
|
+
const _ip1 = input => "string" === typeof input["name"];
|
|
15
|
+
const _ip2 = input => undefined === input["description"] || "string" === typeof input["description"];
|
|
16
|
+
const _ip3 = input => "string" === typeof input["target"];
|
|
17
|
+
const _ip4 = input => "string" === typeof input["input"];
|
|
18
|
+
const _ip5 = input => true === input["dependencies"];
|
|
19
|
+
const _ip6 = input => "string" === typeof input["fileset"];
|
|
20
|
+
const _ip7 = input => undefined === input["technologies"] || Array.isArray(input["technologies"]) && input["technologies"].every(elem => "string" === typeof elem);
|
|
21
|
+
const _ip9 = input => "string" === typeof input["packageName"];
|
|
22
|
+
const _ip10 = input => "string" === typeof input["type"];
|
|
23
|
+
const _ip8 = input => {
|
|
24
|
+
const array = input;
|
|
25
|
+
const tuplePredicators = [
|
|
26
|
+
[
|
|
27
|
+
top => top.length === 1 && "*" === top[0],
|
|
28
|
+
entire => entire.length === 1 && "*" === entire[0]
|
|
29
|
+
]
|
|
30
|
+
];
|
|
31
|
+
for (const pred of tuplePredicators)
|
|
32
|
+
if (pred[0](array))
|
|
33
|
+
return pred[1](array);
|
|
34
|
+
const top = input[0];
|
|
35
|
+
if (0 === input.length)
|
|
36
|
+
return true;
|
|
37
|
+
const arrayPredicators = [
|
|
38
|
+
[
|
|
39
|
+
top => "string" === typeof top,
|
|
40
|
+
entire => entire.every(elem => "string" === typeof elem)
|
|
41
|
+
]
|
|
42
|
+
];
|
|
43
|
+
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
44
|
+
if (1 === passed.length)
|
|
45
|
+
return passed[0][1](array);
|
|
46
|
+
else if (1 < passed.length)
|
|
47
|
+
for (const pred of passed)
|
|
48
|
+
if (array.every(value => true === pred[0](value)))
|
|
49
|
+
return pred[1](array);
|
|
50
|
+
return false;
|
|
51
|
+
};
|
|
52
|
+
const _io0 = input => 1 === input.version && "string" === typeof input.workspaceRoot && "string" === typeof input.environment && "string" === typeof input.installation && ("object" === typeof input.snapshot && null !== input.snapshot && _io1(input.snapshot)) && ("object" === typeof input.projectGraph && null !== input.projectGraph && _io4(input.projectGraph));
|
|
53
|
+
const _io1 = input => Array.isArray(input.files) && input.files.every(elem => "object" === typeof elem && null !== elem && _io2(elem)) && (Array.isArray(input.nodes) && input.nodes.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && "boolean" === typeof input.stable;
|
|
54
|
+
const _io10 = input => (undefined === input.executor || "string" === typeof input.executor) && (undefined === input.command || "string" === typeof input.command) && (undefined === input.outputs || Array.isArray(input.outputs) && input.outputs.every(elem => "string" === typeof elem)) && (undefined === input.dependsOn || Array.isArray(input.dependsOn) && input.dependsOn.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && _io11(elem)))) && (undefined === input.inputs || Array.isArray(input.inputs) && input.inputs.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && _iu0(elem)))) && true && (undefined === input.configurations || "object" === typeof input.configurations && null !== input.configurations && false === Array.isArray(input.configurations) && _io23(input.configurations)) && (undefined === input.defaultConfiguration || "string" === typeof input.defaultConfiguration) && (undefined === input.cache || "boolean" === typeof input.cache) && (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) && _io24(input.metadata)) && (undefined === input.parallelism || "boolean" === typeof input.parallelism) && (undefined === input.continuous || "boolean" === typeof input.continuous) && (undefined === input.syncGenerators || Array.isArray(input.syncGenerators) && input.syncGenerators.every(elem => "string" === typeof elem)) && (undefined === input["..."] || true === input["..."]);
|
|
55
|
+
const _io11 = input => null !== input.projects && (undefined === input.projects || "string" === typeof input.projects || Array.isArray(input.projects) && input.projects.every(elem => "string" === typeof elem)) && (undefined === input.dependencies || "boolean" === typeof input.dependencies) && _ip3(input) && (undefined === input.params || "forward" === input.params || "ignore" === input.params) && (undefined === input.options || "forward" === input.options || "ignore" === input.options);
|
|
56
|
+
const _io12 = input => "string" === typeof input.json && (undefined === input.fields || Array.isArray(input.fields) && input.fields.every(elem => "string" === typeof elem)) && (undefined === input.excludeFields || Array.isArray(input.excludeFields) && input.excludeFields.every(elem => "string" === typeof elem));
|
|
57
|
+
const _io13 = input => _ip4(input) && (null !== input.projects && undefined !== input.projects && ("string" === typeof input.projects || Array.isArray(input.projects) && input.projects.every(elem => "string" === typeof elem)));
|
|
58
|
+
const _io14 = input => _ip4(input) && _ip5(input);
|
|
59
|
+
const _io15 = input => _ip4(input);
|
|
60
|
+
const _io16 = input => _ip6(input);
|
|
61
|
+
const _io17 = input => _ip6(input) && _ip5(input);
|
|
62
|
+
const _io18 = input => "string" === typeof input.runtime;
|
|
63
|
+
const _io19 = input => Array.isArray(input.externalDependencies) && input.externalDependencies.every(elem => "string" === typeof elem);
|
|
64
|
+
const _io2 = input => "string" === typeof input.file && "string" === typeof input.hash;
|
|
65
|
+
const _io20 = input => "string" === typeof input.dependentTasksOutputFiles && (undefined === input.transitive || "boolean" === typeof input.transitive);
|
|
66
|
+
const _io21 = input => "string" === typeof input.env;
|
|
67
|
+
const _io22 = input => "absolute" === input.workingDirectory || "relative" === input.workingDirectory;
|
|
68
|
+
const _io23 = input => Object.keys(input).every(key => {
|
|
69
|
+
const value = input[key];
|
|
70
|
+
if (undefined === value)
|
|
71
|
+
return true;
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
const _io24 = input => _ip2(input) && _ip7(input) && (undefined === input.nonAtomizedTarget || "string" === typeof input.nonAtomizedTarget) && (undefined === input.help || "object" === typeof input.help && null !== input.help && _io25(input.help)) && Object.keys(input).every(key => {
|
|
75
|
+
if (["description", "technologies", "nonAtomizedTarget", "help"].some(prop => key === prop))
|
|
76
|
+
return true;
|
|
77
|
+
const value = input[key];
|
|
78
|
+
if (undefined === value)
|
|
79
|
+
return true;
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
const _io25 = input => "string" === typeof input.command && ("object" === typeof input.example && null !== input.example && false === Array.isArray(input.example) && _io26(input.example));
|
|
83
|
+
const _io26 = input => (undefined === input.options || "object" === typeof input.options && null !== input.options && false === Array.isArray(input.options) && _io27(input.options)) && (undefined === input.args || Array.isArray(input.args) && input.args.every(elem => "string" === typeof elem));
|
|
84
|
+
const _io27 = input => Object.keys(input).every(key => {
|
|
85
|
+
const value = input[key];
|
|
86
|
+
if (undefined === value)
|
|
87
|
+
return true;
|
|
88
|
+
return true;
|
|
89
|
+
});
|
|
90
|
+
const _io28 = input => Object.keys(input).every(key => {
|
|
91
|
+
const value = input[key];
|
|
92
|
+
if (undefined === value)
|
|
93
|
+
return true;
|
|
94
|
+
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io29(value);
|
|
95
|
+
});
|
|
96
|
+
const _io29 = input => Object.keys(input).every(key => {
|
|
97
|
+
const value = input[key];
|
|
98
|
+
if (undefined === value)
|
|
99
|
+
return true;
|
|
100
|
+
return true;
|
|
101
|
+
});
|
|
102
|
+
const _io3 = input => _ip0(input) && "string" === typeof input.stamp;
|
|
103
|
+
const _io30 = input => Object.keys(input).every(key => {
|
|
104
|
+
const value = input[key];
|
|
105
|
+
if (undefined === value)
|
|
106
|
+
return true;
|
|
107
|
+
return Array.isArray(value) && value.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && _iu0(elem)));
|
|
108
|
+
});
|
|
109
|
+
const _io31 = input => (undefined === input.version || "object" === typeof input.version && null !== input.version && false === Array.isArray(input.version) && _io32(input.version)) && (null !== input.docker && (undefined === input.docker || true === input.docker || "object" === typeof input.docker && null !== input.docker && false === Array.isArray(input.docker) && _io34(input.docker)));
|
|
110
|
+
const _io32 = input => (undefined === input.manifestRootsToUpdate || Array.isArray(input.manifestRootsToUpdate) && input.manifestRootsToUpdate.every(elem => null !== elem && undefined !== elem && ("string" === typeof elem || "object" === typeof elem && null !== elem && _io33(elem)))) && (undefined === input.currentVersionResolver || "disk" === input.currentVersionResolver || "git-tag" === input.currentVersionResolver || "none" === input.currentVersionResolver || "registry" === input.currentVersionResolver) && (undefined === input.currentVersionResolverMetadata || "object" === typeof input.currentVersionResolverMetadata && null !== input.currentVersionResolverMetadata && false === Array.isArray(input.currentVersionResolverMetadata) && _io27(input.currentVersionResolverMetadata)) && (undefined === input.fallbackCurrentVersionResolver || "disk" === input.fallbackCurrentVersionResolver) && (undefined === input.versionPrefix || "" === input.versionPrefix || "=" === input.versionPrefix || "^" === input.versionPrefix || "auto" === input.versionPrefix || "~" === input.versionPrefix) && (undefined === input.versionActions || "string" === typeof input.versionActions) && (undefined === input.versionActionsOptions || "object" === typeof input.versionActionsOptions && null !== input.versionActionsOptions && false === Array.isArray(input.versionActionsOptions) && _io27(input.versionActionsOptions)) && (undefined === input.preserveLocalDependencyProtocols || "boolean" === typeof input.preserveLocalDependencyProtocols);
|
|
111
|
+
const _io33 = input => _ip0(input) && "boolean" === typeof input.preserveLocalDependencyProtocols;
|
|
112
|
+
const _io34 = input => (undefined === input.preVersionCommand || "string" === typeof input.preVersionCommand) && (null !== input.skipVersionActions && (undefined === input.skipVersionActions || "boolean" === typeof input.skipVersionActions || Array.isArray(input.skipVersionActions) && input.skipVersionActions.every(elem => "string" === typeof elem))) && (undefined === input.versionSchemes || "object" === typeof input.versionSchemes && null !== input.versionSchemes && false === Array.isArray(input.versionSchemes) && _io35(input.versionSchemes)) && (undefined === input.repositoryName || "string" === typeof input.repositoryName) && (undefined === input.registryUrl || "string" === typeof input.registryUrl);
|
|
113
|
+
const _io35 = input => Object.keys(input).every(key => {
|
|
114
|
+
const value = input[key];
|
|
115
|
+
if (undefined === value)
|
|
116
|
+
return true;
|
|
117
|
+
return "string" === typeof value;
|
|
118
|
+
});
|
|
119
|
+
const _io36 = input => _ip2(input) && _ip7(input) && (undefined === input.targetGroups || "object" === typeof input.targetGroups && null !== input.targetGroups && false === Array.isArray(input.targetGroups) && _io37(input.targetGroups)) && (undefined === input.owners || "object" === typeof input.owners && null !== input.owners && false === Array.isArray(input.owners) && _io38(input.owners)) && (undefined === input.js || "object" === typeof input.js && null !== input.js && _io43(input.js)) && Object.keys(input).every(key => {
|
|
120
|
+
if (["description", "technologies", "targetGroups", "owners", "js"].some(prop => key === prop))
|
|
121
|
+
return true;
|
|
122
|
+
const value = input[key];
|
|
123
|
+
if (undefined === value)
|
|
124
|
+
return true;
|
|
125
|
+
return true;
|
|
126
|
+
});
|
|
127
|
+
const _io37 = input => Object.keys(input).every(key => {
|
|
128
|
+
const value = input[key];
|
|
129
|
+
if (undefined === value)
|
|
130
|
+
return true;
|
|
131
|
+
return Array.isArray(value) && value.every(elem => "string" === typeof elem);
|
|
132
|
+
});
|
|
133
|
+
const _io38 = input => Object.keys(input).every(key => {
|
|
134
|
+
const value = input[key];
|
|
135
|
+
if (undefined === value)
|
|
136
|
+
return true;
|
|
137
|
+
return "object" === typeof value && null !== value && _io39(value);
|
|
138
|
+
});
|
|
139
|
+
const _io39 = input => Array.isArray(input.ownedFiles) && input.ownedFiles.every(elem => "object" === typeof elem && null !== elem && _io40(elem));
|
|
140
|
+
const _io4 = input => "object" === typeof input.nodes && null !== input.nodes && false === Array.isArray(input.nodes) && _io5(input.nodes) && (undefined === input.externalNodes || "object" === typeof input.externalNodes && null !== input.externalNodes && false === Array.isArray(input.externalNodes) && _io46(input.externalNodes)) && ("object" === typeof input.dependencies && null !== input.dependencies && false === Array.isArray(input.dependencies) && _io49(input.dependencies)) && (undefined === input.version || "string" === typeof input.version);
|
|
141
|
+
const _io40 = input => null !== input.files && undefined !== input.files && (Array.isArray(input.files) && (_ip8(input.files) || false)) && (undefined === input.fromConfig || "object" === typeof input.fromConfig && null !== input.fromConfig && _io41(input.fromConfig));
|
|
142
|
+
const _io41 = input => "string" === typeof input.filePath && ("object" === typeof input.location && null !== input.location && _io42(input.location));
|
|
143
|
+
const _io42 = input => "number" === typeof input.startLine && "number" === typeof input.endLine;
|
|
144
|
+
const _io43 = input => _ip9(input) && (undefined === input.packageVersion || "string" === typeof input.packageVersion) && (null !== input.packageExports && (undefined === input.packageExports || "string" === typeof input.packageExports || "object" === typeof input.packageExports && null !== input.packageExports && false === Array.isArray(input.packageExports) && _io44(input.packageExports))) && (undefined === input.packageMain || "string" === typeof input.packageMain) && (undefined === input.isInPackageManagerWorkspaces || "boolean" === typeof input.isInPackageManagerWorkspaces);
|
|
145
|
+
const _io44 = input => Object.keys(input).every(key => {
|
|
146
|
+
const value = input[key];
|
|
147
|
+
if (undefined === value)
|
|
148
|
+
return true;
|
|
149
|
+
return null !== value && undefined !== value && ("string" === typeof value || "object" === typeof value && null !== value && false === Array.isArray(value) && _io45(value));
|
|
150
|
+
});
|
|
151
|
+
const _io45 = input => (undefined === input.types || "string" === typeof input.types) && (undefined === input.require || "string" === typeof input.require) && (undefined === input["import"] || "string" === typeof input["import"]) && (undefined === input.development || "string" === typeof input.development) && (undefined === input["default"] || "string" === typeof input["default"]);
|
|
152
|
+
const _io46 = input => Object.keys(input).every(key => {
|
|
153
|
+
const value = input[key];
|
|
154
|
+
if (undefined === value)
|
|
155
|
+
return true;
|
|
156
|
+
return "object" === typeof value && null !== value && _io47(value);
|
|
157
|
+
});
|
|
158
|
+
const _io47 = input => _ip10(input) && _ip1(input) && ("object" === typeof input.data && null !== input.data && _io48(input.data));
|
|
159
|
+
const _io48 = input => "string" === typeof input.version && _ip9(input) && (undefined === input.hash || "string" === typeof input.hash);
|
|
160
|
+
const _io49 = input => Object.keys(input).every(key => {
|
|
161
|
+
const value = input[key];
|
|
162
|
+
if (undefined === value)
|
|
163
|
+
return true;
|
|
164
|
+
return Array.isArray(value) && value.every(elem => "object" === typeof elem && null !== elem && _io50(elem));
|
|
165
|
+
});
|
|
166
|
+
const _io5 = input => Object.keys(input).every(key => {
|
|
167
|
+
const value = input[key];
|
|
168
|
+
if (undefined === value)
|
|
169
|
+
return true;
|
|
170
|
+
return "object" === typeof value && null !== value && _io6(value);
|
|
171
|
+
});
|
|
172
|
+
const _io50 = input => _ip10(input) && _ip3(input) && "string" === typeof input.source;
|
|
173
|
+
const _io6 = input => ("app" === input.type || "e2e" === input.type || "lib" === input.type) && _ip1(input) && ("object" === typeof input.data && null !== input.data && _io7(input.data));
|
|
174
|
+
const _io7 = input => _io8(input) && _ip2(input);
|
|
175
|
+
const _io8 = input => (undefined === input.name || "string" === typeof input.name) && (undefined === input.targets || "object" === typeof input.targets && null !== input.targets && false === Array.isArray(input.targets) && _io9(input.targets)) && "string" === typeof input.root && (undefined === input.sourceRoot || "string" === typeof input.sourceRoot) && (undefined === input.projectType || "application" === input.projectType || "library" === input.projectType) && (undefined === input.generators || "object" === typeof input.generators && null !== input.generators && false === Array.isArray(input.generators) && _io28(input.generators)) && (undefined === input.implicitDependencies || Array.isArray(input.implicitDependencies) && input.implicitDependencies.every(elem => "string" === typeof elem)) && (undefined === input.namedInputs || "object" === typeof input.namedInputs && null !== input.namedInputs && false === Array.isArray(input.namedInputs) && _io30(input.namedInputs)) && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (undefined === input.release || "object" === typeof input.release && null !== input.release && false === Array.isArray(input.release) && _io31(input.release)) && (undefined === input.metadata || "object" === typeof input.metadata && null !== input.metadata && false === Array.isArray(input.metadata) && _io36(input.metadata));
|
|
176
|
+
const _io9 = input => Object.keys(input).every(key => {
|
|
177
|
+
const value = input[key];
|
|
178
|
+
if (undefined === value)
|
|
179
|
+
return true;
|
|
180
|
+
return "object" === typeof value && null !== value && false === Array.isArray(value) && _io10(value);
|
|
181
|
+
});
|
|
182
|
+
const _iu0 = input => (() => {
|
|
183
|
+
if (undefined !== input.json)
|
|
184
|
+
return _io12(input);
|
|
185
|
+
else if (undefined !== input.projects)
|
|
186
|
+
return _io13(input);
|
|
187
|
+
else if (undefined !== input.runtime)
|
|
188
|
+
return _io18(input);
|
|
189
|
+
else if (undefined !== input.externalDependencies)
|
|
190
|
+
return _io19(input);
|
|
191
|
+
else if (undefined !== input.dependentTasksOutputFiles)
|
|
192
|
+
return _io20(input);
|
|
193
|
+
else if (undefined !== input.env)
|
|
194
|
+
return _io21(input);
|
|
195
|
+
else if (undefined !== input.workingDirectory)
|
|
196
|
+
return _io22(input);
|
|
197
|
+
else
|
|
198
|
+
return (() => {
|
|
199
|
+
if (_io14(input))
|
|
200
|
+
return _io14(input);
|
|
201
|
+
if (_io15(input))
|
|
202
|
+
return _io15(input);
|
|
203
|
+
if (_io16(input))
|
|
204
|
+
return _io16(input);
|
|
205
|
+
if (_io17(input))
|
|
206
|
+
return _io17(input);
|
|
207
|
+
return false;
|
|
208
|
+
})();
|
|
209
|
+
})();
|
|
210
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
211
|
+
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
212
|
+
})()(readFileSync(path, 'utf8'));
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
if (error instanceof SyntaxError || systemError(error))
|
|
216
|
+
return null;
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function writeWitness(path, value) {
|
|
221
|
+
const temporary = `${path}.${randomUUID()}`;
|
|
222
|
+
try {
|
|
223
|
+
writeFileSync(temporary, JSON.stringify(value), { flag: 'wx', mode: 0o600 });
|
|
224
|
+
renameSync(temporary, path);
|
|
225
|
+
}
|
|
226
|
+
finally {
|
|
227
|
+
rmSync(temporary, { force: true });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/** Capture exact node identity and rehash new/replaced/rewritten nodes.
|
|
231
|
+
* Nx's Unix archive uses whole-second mtimes, so allFileData alone cannot
|
|
232
|
+
* prove an immediate same-second rewrite. An unbound archive hash is never
|
|
233
|
+
* admitted: on the first capture every file is rehashed through Nx itself.
|
|
234
|
+
*/
|
|
235
|
+
export function workspaceSnapshot(workspaceRoot, context, previous) {
|
|
236
|
+
const files = context.allFileData();
|
|
237
|
+
const prior = new Map(previous?.nodes.map((node) => [node.path, node.stamp]));
|
|
238
|
+
const nodes = [];
|
|
239
|
+
const changed = [];
|
|
240
|
+
let complete = true;
|
|
241
|
+
for (const { file } of files) {
|
|
242
|
+
const path = join(workspaceRoot, file);
|
|
243
|
+
const stats = lstatSync(path, { bigint: true });
|
|
244
|
+
const node = { path, stamp: nodeStamp(stats) };
|
|
245
|
+
nodes.push(node);
|
|
246
|
+
let moved = prior.get(path) !== node.stamp;
|
|
247
|
+
if (stats.isSymbolicLink()) {
|
|
248
|
+
const physical = realpathSync(path);
|
|
249
|
+
const targetStats = lstatSync(physical, { bigint: true });
|
|
250
|
+
const target = { path: physical, stamp: nodeStamp(targetStats) };
|
|
251
|
+
nodes.push(target);
|
|
252
|
+
moved ||= prior.get(physical) !== target.stamp;
|
|
253
|
+
// A file table does not prove the membership of an external directory.
|
|
254
|
+
if (!targetStats.isFile())
|
|
255
|
+
complete = false;
|
|
256
|
+
}
|
|
257
|
+
if (moved)
|
|
258
|
+
changed.push(file);
|
|
259
|
+
}
|
|
260
|
+
if (changed.length > 0)
|
|
261
|
+
context.incrementalUpdate(changed, []);
|
|
262
|
+
return { files: context.allFileData(), nodes, stable: complete && nodesUnchanged(nodes) };
|
|
263
|
+
}
|
|
264
|
+
export function nodesUnchanged(nodes) {
|
|
265
|
+
for (const node of nodes) {
|
|
266
|
+
try {
|
|
267
|
+
if (nodeStamp(lstatSync(node.path, { bigint: true })) !== node.stamp)
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
if (systemError(error))
|
|
272
|
+
return false;
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
/** Membership and content are exact. Outputs do not exempt manifests or
|
|
279
|
+
* newly created/deleted files; this graph witness has no output exclusions.
|
|
280
|
+
*/
|
|
281
|
+
export function snapshotsEqual(left, right) {
|
|
282
|
+
if (!left.stable || !right.stable || left.files.length !== right.files.length)
|
|
283
|
+
return false;
|
|
284
|
+
const hashes = new Map(left.files.map(({ file, hash }) => [file, hash]));
|
|
285
|
+
return right.files.every(({ file, hash }) => hashes.get(file) === hash);
|
|
286
|
+
}
|
|
287
|
+
export function reusableGraph(witness, workspaceRoot, environment, installation, snapshot) {
|
|
288
|
+
return witness !== null &&
|
|
289
|
+
witness.version === 1 &&
|
|
290
|
+
witness.workspaceRoot === workspaceRoot &&
|
|
291
|
+
installation !== null &&
|
|
292
|
+
witness.installation === installation &&
|
|
293
|
+
witness.environment === environment &&
|
|
294
|
+
snapshotsEqual(witness.snapshot, snapshot)
|
|
295
|
+
? witness.projectGraph
|
|
296
|
+
: null;
|
|
297
|
+
}
|
|
298
|
+
/** Plugins with opaque external graph inputs cannot borrow this proof.
|
|
299
|
+
* For the repository plugin and Nx, bind the entire owned module/file tree
|
|
300
|
+
* and its dependency/optional/peer resolution closure, including each alias,
|
|
301
|
+
* physical target and package manifest. SHA-256 binds every regular file's
|
|
302
|
+
* bytes, including manifest metadata; pre/post node stamps still reject a
|
|
303
|
+
* tree that moved while reading. A missing optional dependency is recorded too.
|
|
304
|
+
*/
|
|
305
|
+
export function graphInstallationIdentity(workspaceRoot, nxJson, resolvePackage) {
|
|
306
|
+
const plugins = (nxJson.plugins ?? []).map((plugin) => (typeof plugin === 'string' ? plugin : plugin.plugin));
|
|
307
|
+
if (plugins.some((plugin) => plugin !== '@smoothbricks/nx-plugin'))
|
|
308
|
+
return null;
|
|
309
|
+
const nodes = [];
|
|
310
|
+
const files = [];
|
|
311
|
+
const buffer = Buffer.allocUnsafe(64 * 1024);
|
|
312
|
+
const resolutions = [];
|
|
313
|
+
const visited = new Set();
|
|
314
|
+
const declaredDirectoryLinks = new Set();
|
|
315
|
+
function walk(path) {
|
|
316
|
+
const stats = lstatSync(path, { bigint: true });
|
|
317
|
+
nodes.push({ path, stamp: nodeStamp(stats) });
|
|
318
|
+
if (stats.isSymbolicLink()) {
|
|
319
|
+
const physical = realpathSync(path);
|
|
320
|
+
if (lstatSync(physical).isDirectory() && !declaredDirectoryLinks.has(path)) {
|
|
321
|
+
throw new Error(`Unproved directory link in graph package: ${path}`);
|
|
322
|
+
}
|
|
323
|
+
walk(physical);
|
|
324
|
+
}
|
|
325
|
+
else if (stats.isDirectory()) {
|
|
326
|
+
for (const name of readdirSync(path).sort()) {
|
|
327
|
+
if (name !== 'node_modules' && name !== '.git' && name !== '.nx')
|
|
328
|
+
walk(join(path, name));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
else if (!stats.isFile()) {
|
|
332
|
+
throw new Error(`Unproved graph package node: ${path}`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
const hash = createHash('sha256');
|
|
336
|
+
const fd = openSync(path, 'r');
|
|
337
|
+
try {
|
|
338
|
+
for (let count = readSync(fd, buffer); count > 0; count = readSync(fd, buffer)) {
|
|
339
|
+
hash.update(buffer.subarray(0, count));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
finally {
|
|
343
|
+
closeSync(fd);
|
|
344
|
+
}
|
|
345
|
+
files.push({ path, sha256: hash.digest('hex') });
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function visit(name, from, optional) {
|
|
349
|
+
let resolved;
|
|
350
|
+
try {
|
|
351
|
+
resolved = resolvePackage(name, [from]);
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
if (optional && systemError(error) && error.code === 'MODULE_NOT_FOUND') {
|
|
355
|
+
resolutions.push([from, name, null]);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
const physical = realpathSync(resolved.path);
|
|
361
|
+
resolutions.push([from, name, physical]);
|
|
362
|
+
if (visited.has(physical))
|
|
363
|
+
return;
|
|
364
|
+
visited.add(physical);
|
|
365
|
+
const packageRoot = dirname(physical);
|
|
366
|
+
const manifest = resolved.packageJson;
|
|
367
|
+
// A package-owned published dist lane may live on its build volume. Its
|
|
368
|
+
// link node and every physical target node remain part of this proof.
|
|
369
|
+
if (manifest.files?.includes('dist'))
|
|
370
|
+
declaredDirectoryLinks.add(join(packageRoot, 'dist'));
|
|
371
|
+
walk(packageRoot);
|
|
372
|
+
const dependencies = { ...manifest.peerDependencies, ...manifest.dependencies, ...manifest.optionalDependencies };
|
|
373
|
+
for (const dependency of Object.keys(dependencies).sort()) {
|
|
374
|
+
visit(dependency, packageRoot, manifest.optionalDependencies?.[dependency] !== undefined ||
|
|
375
|
+
manifest.peerDependenciesMeta?.[dependency]?.optional === true);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
for (const name of ['nx', ...plugins])
|
|
380
|
+
visit(name, workspaceRoot, false);
|
|
381
|
+
visit('typescript', workspaceRoot, true);
|
|
382
|
+
return nodesUnchanged(nodes) ? JSON.stringify({ resolutions, nodes, files }) : null;
|
|
383
|
+
}
|
|
384
|
+
catch (error) {
|
|
385
|
+
if (systemError(error) && ['EACCES', 'EPERM', 'EIO'].includes(error.code))
|
|
386
|
+
throw error;
|
|
387
|
+
// Installation uncertainty disables only graph reuse. Nx's authoritative
|
|
388
|
+
// RPC remains responsible for diagnosing invalid plugin installations.
|
|
389
|
+
if (error instanceof Error)
|
|
390
|
+
return null;
|
|
391
|
+
throw error;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
export function readArtifactWitness(path) {
|
|
395
|
+
try {
|
|
396
|
+
return (() => {
|
|
397
|
+
const _io0 = input => 1 === input.version && "string" === typeof input.workspaceRoot && "string" === typeof input.claims && (Array.isArray(input.nodes) && input.nodes.every(elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
398
|
+
const _io1 = input => _io2(input) && "string" === typeof input.taskId;
|
|
399
|
+
const _io2 = input => "string" === typeof input.path && "string" === typeof input.stamp;
|
|
400
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
401
|
+
return input => { input = JSON.parse(input); return __is(input) ? input : null; };
|
|
402
|
+
})()(readFileSync(path, 'utf8'));
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
if (error instanceof SyntaxError || systemError(error))
|
|
406
|
+
return null;
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function systemError(error) {
|
|
411
|
+
return error instanceof Error && 'code' in error && typeof error.code === 'string';
|
|
412
|
+
}
|