@smoothbricks/nx-plugin 0.5.6 → 0.6.0
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 +1095 -360
- package/dist/.build-inputs.json +138 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +13 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +126 -47
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/all-verdicts/executor.d.ts +35 -0
- package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
- package/dist/executors/all-verdicts/executor.js +133 -0
- package/dist/executors/all-verdicts/schema.d.ts +10 -0
- package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
- package/dist/executors/all-verdicts/schema.js +2 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +54 -119
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +371 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +81 -28
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +68 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +40 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +88 -19
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +164 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -215
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +75 -48
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +21 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +77 -13
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +132 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/all-verdicts/executor.ts +164 -0
- package/src/executors/all-verdicts/schema.json +22 -0
- package/src/executors/all-verdicts/schema.ts +10 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool.ts +51 -117
- package/src/executors/bounded-exec/executor.ts +423 -259
- package/src/executors/bounded-exec/gateway-lease.ts +82 -33
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +89 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +137 -34
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/executor.ts +205 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +792 -225
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +68 -45
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +123 -98
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3319
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
|
@@ -19,18 +19,6 @@
|
|
|
19
19
|
pkgs,
|
|
20
20
|
...
|
|
21
21
|
}: let
|
|
22
|
-
# ttsc's native-plugin patch compiles microsoft/typescript-go with one
|
|
23
|
-
# corrected file. `go list -m` only fills `.Dir` after the module is already
|
|
24
|
-
# in GOMODCACHE, which CI does not restore (and GOPROXY is often off under
|
|
25
|
-
# nix). Pin the commit ttsc 0.30.4's patch requires so the tree is in the
|
|
26
|
-
# devenv closure and TTSC_TYPESCRIPT_GO_DIR names it.
|
|
27
|
-
typescriptGo = pkgs.fetchFromGitHub {
|
|
28
|
-
owner = "microsoft";
|
|
29
|
-
repo = "typescript-go";
|
|
30
|
-
rev = "56ab4af42157";
|
|
31
|
-
hash = "sha256-ebjX+1+9axEqsnZXCRZSumA38gPNdmoz98tMt2oftN4=";
|
|
32
|
-
};
|
|
33
|
-
|
|
34
22
|
# The nixpkgs the Go pin below comes from (devenv.yaml `nixpkgs-go`).
|
|
35
23
|
goPkgs = import inputs.nixpkgs-go {inherit (pkgs.stdenv.hostPlatform) system;};
|
|
36
24
|
|
|
@@ -44,8 +32,8 @@
|
|
|
44
32
|
# The revision is can1357/TypeScript perf/checker-speedups-v3: 36 checker,
|
|
45
33
|
# arena and scheduler commits on microsoft/TypeScript main 6ad8c56f9b5a,
|
|
46
34
|
# while they are upstreamed. Its Go module (tsc/, Go 1.27) builds with the
|
|
47
|
-
# nixpkgs-go input's go_1_27 inside this derivation
|
|
48
|
-
#
|
|
35
|
+
# nixpkgs-go input's go_1_27 inside this derivation, the same Go the shell
|
|
36
|
+
# provides because ttsc vendors that line. The sparse checkout keeps the ~61k test baselines out of
|
|
49
37
|
# the store, and GOWORK=off keeps the repository's go.work (tools/) out of
|
|
50
38
|
# the module build.
|
|
51
39
|
typecheckTsc = goPkgs.buildGo127Module {
|
|
@@ -93,18 +81,27 @@
|
|
|
93
81
|
# same files for anything that names it.
|
|
94
82
|
rustToolchainBin = "${config.languages.rust.toolchainPackage}/bin";
|
|
95
83
|
|
|
84
|
+
# The cc-rs compiler variables this shell's `env` declares (a Linux shell
|
|
85
|
+
# pins its native compiler there): compiler-variables.sh keeps them and
|
|
86
|
+
# drops every other one the shell inherits (enterShell item 9).
|
|
87
|
+
declaredCompilerVariables =
|
|
88
|
+
lib.filter
|
|
89
|
+
(name: builtins.match "((HOST|TARGET)_)?(CC|CXX|AR|RANLIB|CFLAGS|CXXFLAGS|ARFLAGS|RANLIBFLAGS)(_[a-z].*)?" name != null)
|
|
90
|
+
(lib.attrNames config.env);
|
|
91
|
+
|
|
96
92
|
# Expose pyflakes without propagating a second interpreter into the shell.
|
|
97
93
|
pyflakesBin = pkgs.runCommandLocal "pyflakes-${pkgs.python3Packages.pyflakes.version}" {} ''
|
|
98
94
|
mkdir -p "$out/bin"
|
|
99
95
|
ln -s ${pkgs.python3Packages.pyflakes}/bin/pyflakes "$out/bin/pyflakes"
|
|
100
96
|
'';
|
|
101
97
|
|
|
102
|
-
# Builds every Linux artifact and the cross clippy; see
|
|
103
|
-
# below for where it applies and why.
|
|
104
|
-
#
|
|
105
|
-
#
|
|
98
|
+
# Builds every Linux Rust artifact and the cross clippy; see
|
|
99
|
+
# `profiles.linux-cross` below for where it applies and why. zig itself is in
|
|
100
|
+
# the base shell (see `pkgs.zig` in `packages`). The rust-std set is every
|
|
101
|
+
# Linux triple an artifact ships for except x86_64-unknown-linux-gnu, which the
|
|
102
|
+
# base shell already carries.
|
|
106
103
|
linuxToolchain = {
|
|
107
|
-
packages = [pkgs.
|
|
104
|
+
packages = [pkgs.cargo-zigbuild];
|
|
108
105
|
languages.rust.targets = [
|
|
109
106
|
"aarch64-unknown-linux-gnu"
|
|
110
107
|
"x86_64-unknown-linux-musl"
|
|
@@ -112,6 +109,11 @@
|
|
|
112
109
|
];
|
|
113
110
|
};
|
|
114
111
|
in {
|
|
112
|
+
# The one evaluation of the nixpkgs-go package set, as a module argument. A
|
|
113
|
+
# repository's devenv.nix that needs this Go takes `goPkgs` instead of
|
|
114
|
+
# importing the same Go inputs again and repeating package-set evaluation.
|
|
115
|
+
_module.args.goPkgs = goPkgs;
|
|
116
|
+
|
|
115
117
|
# nixpkgs carries actionlint, not the jdx fork. Supply the immutable upstream
|
|
116
118
|
# release as a normal package, with the same pin in developer shells and CI.
|
|
117
119
|
# Nix fetches/verifies it once; validation never installs or compiles a tool.
|
|
@@ -182,7 +184,15 @@ in {
|
|
|
182
184
|
# `nx migrate` run with the installed CLI instead of the newest one;
|
|
183
185
|
# `NX_USE_LOCAL=false nx migrate` restores that for the one command.
|
|
184
186
|
NX_USE_LOCAL = "true";
|
|
185
|
-
|
|
187
|
+
# Nx loads every project-graph plugin in a worker process of its own by
|
|
188
|
+
# default, so each daemon keeps one resident Node process per plugin
|
|
189
|
+
# beside itself. Off, the daemon (or a daemonless client) loads them in
|
|
190
|
+
# its own process. Measured on a 56-project consumer's shed (2026-10-22,
|
|
191
|
+
# three restarts each): the same project graph and the same hash for all
|
|
192
|
+
# 443 tasks of `nx run-many -t lint`; the daemon tree went from 8
|
|
193
|
+
# processes, about 1.75 GB RSS, to 1 process, about 0.65 GB. Nx 23.2.1
|
|
194
|
+
# reads only "false" as off (project-graph/plugins/isolation/enabled.js).
|
|
195
|
+
NX_ISOLATE_PLUGINS = "false";
|
|
186
196
|
SMOO_TYPECHECK_TSC = "${typecheckTsc}/bin/tsc";
|
|
187
197
|
}
|
|
188
198
|
# Playwright's downloaded Ubuntu browser has no runtime closure on NixOS
|
|
@@ -261,10 +271,10 @@ in {
|
|
|
261
271
|
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxToolchain.languages.rust.targets;
|
|
262
272
|
};
|
|
263
273
|
|
|
264
|
-
# The Linux toolchain:
|
|
265
|
-
# rust-std set. It builds every published Linux artifact — static musl
|
|
266
|
-
# glibc 2.17 N-API addons — and `check:linux`'s cross clippy, with the
|
|
267
|
-
# command on every host. zig carries glibc symbol-version stubs for every
|
|
274
|
+
# The Linux Rust toolchain: cargo-zigbuild driving zig, plus the Linux
|
|
275
|
+
# rust-std set. It builds every published Linux Rust artifact — static musl
|
|
276
|
+
# CLIs, glibc 2.17 N-API addons — and `check:linux`'s cross clippy, with the
|
|
277
|
+
# same command on every host. zig carries glibc symbol-version stubs for every
|
|
268
278
|
# glibc and the musl sources inside its own store path, so nothing on the
|
|
269
279
|
# build machine reaches the artifact: no loader path, no RUNPATH, no build
|
|
270
280
|
# host's glibc floor. cargo-zigbuild supplies the `zig cc` shims and per-triple
|
|
@@ -273,10 +283,13 @@ in {
|
|
|
273
283
|
# A Linux host carries it in the base shell, because its ordinary `build`
|
|
274
284
|
# includes its own platform's artifacts. A macOS host opts in through the
|
|
275
285
|
# `linux-cross` profile, activated by `devenv -P linux-cross` and driven by
|
|
276
|
-
# the root `check:linux` script:
|
|
277
|
-
#
|
|
278
|
-
#
|
|
279
|
-
#
|
|
286
|
+
# the root `check:linux` script: the three rust-std targets are about 0.5 GiB
|
|
287
|
+
# and nothing else on Darwin needs them. zig is not in the profile: every
|
|
288
|
+
# host's base shell carries it, because the scriptc-<arch>-<family> targets
|
|
289
|
+
# compile every platform's executables through `zig cc` on every host, the
|
|
290
|
+
# host's own platform included (see `pkgs.zig` in `packages` below). devenv
|
|
291
|
+
# 2.2.3 has first-class profiles, so this is one gated module in the shared
|
|
292
|
+
# file rather than a second config directory that would re-import and re-pin
|
|
280
293
|
# everything here.
|
|
281
294
|
#
|
|
282
295
|
# The profile supplies the toolchain and nothing else. CARGO_BUILD_TARGET is
|
|
@@ -341,7 +354,7 @@ in {
|
|
|
341
354
|
# comment that rots.
|
|
342
355
|
#
|
|
343
356
|
# It needs its own input because the fleet's nixpkgs does not carry that patch:
|
|
344
|
-
# devenv-nixpkgs rolling
|
|
357
|
+
# devenv-nixpkgs rolling has no Go 1.27, while ttsc 0.34.1 vendors go1.27.3.
|
|
345
358
|
# Same idiom, and same reason, for any single-package pin — one leaf package
|
|
346
359
|
# from a nixpkgs that has it, lock-pinned, prebuilt, rather than a fleet-wide
|
|
347
360
|
# bump that would move rustc, bun and node too. Not every pairing is
|
|
@@ -381,7 +394,7 @@ in {
|
|
|
381
394
|
# `nixpkgs_2`.
|
|
382
395
|
packages =
|
|
383
396
|
[
|
|
384
|
-
goPkgs.
|
|
397
|
+
goPkgs.go_1_27
|
|
385
398
|
pkgs.nodejs_26
|
|
386
399
|
pkgs.binaryen
|
|
387
400
|
# Smoo's GitHub Actions validator uses the managed prebuilt package above.
|
|
@@ -392,17 +405,26 @@ in {
|
|
|
392
405
|
# Test runner for inferred Cargo test targets. Generated targets must never
|
|
393
406
|
# depend on an ambient host installation that CI does not reproduce.
|
|
394
407
|
pkgs.cargo-nextest
|
|
395
|
-
#
|
|
396
|
-
#
|
|
397
|
-
#
|
|
398
|
-
|
|
399
|
-
pkgs.cargo-sweep
|
|
408
|
+
# The nx-plugin's Cargo retention holds Cargo's profile locks through a
|
|
409
|
+
# perl child: perl's flock is the flock(2) Cargo takes, and the kernel
|
|
410
|
+
# drops it with the child however the Nx process ends.
|
|
411
|
+
pkgs.perl
|
|
400
412
|
# The stable-toolchain arm of smoo's workspace feature-unification policy:
|
|
401
413
|
# `cargo hakari` generates and wires the workspace-hack crate that unifies
|
|
402
414
|
# features when `[resolver] feature-unification` — nightly-only, and what
|
|
403
415
|
# the channel above selects — is unavailable. `smoo monorepo validate` runs
|
|
404
416
|
# `cargo hakari verify` for a workspace that took that route.
|
|
405
417
|
pkgs.cargo-hakari
|
|
418
|
+
# The C compiler driver of every scriptc-<arch>-<family> target, on every
|
|
419
|
+
# host: scriptc refuses an SCRIPTC_TARGET build unless SCRIPTC_CC=zigcc
|
|
420
|
+
# (no other driver has cross sysroots), and the host's own platform builds
|
|
421
|
+
# the same way, so the darwin-x64 binary a macOS publish leg builds on an
|
|
422
|
+
# arm64 runner and the darwin-arm64 one a developer builds take one path.
|
|
423
|
+
# A profile cannot carry it: repair-pending rebuilds historical release
|
|
424
|
+
# commits in a plain `devenv shell`, which passes no profile (see the note
|
|
425
|
+
# on profiles below). The closure is about 380 MiB, fetched once per Nix
|
|
426
|
+
# store, not per checkout.
|
|
427
|
+
pkgs.zig
|
|
406
428
|
]
|
|
407
429
|
++ lib.optionals pkgs.stdenv.hostPlatform.isLinux ([pkgs.chromium] ++ linuxToolchain.packages);
|
|
408
430
|
|
|
@@ -473,6 +495,13 @@ in {
|
|
|
473
495
|
# and no checkout path can name, so it is gated by `status` (exit 0 when
|
|
474
496
|
# CARGO_HOME holds them) rather than execIfModified.
|
|
475
497
|
#
|
|
498
|
+
# Each fetch is bounded (tooling/direnv/cargo-fetch-bound.ts): cargo holds its
|
|
499
|
+
# global package-cache lock while it runs, so a fetch that stalls stops every
|
|
500
|
+
# cargo that shares CARGO_HOME. It runs in a process group of its own under a
|
|
501
|
+
# deadline that kills the group, and git, which has no low-speed limit of its
|
|
502
|
+
# own, drops a transfer that has all but stopped. A fetch that ends either
|
|
503
|
+
# way fails the task and records nothing.
|
|
504
|
+
#
|
|
476
505
|
# smoo:developer-links points the packages the root package.json's
|
|
477
506
|
# `smoo.developerLinks` declares at their local checkouts, after an install
|
|
478
507
|
# and in every tree that installed them (tooling/direnv/developer-links.ts).
|
|
@@ -503,8 +532,10 @@ in {
|
|
|
503
532
|
"../../tooling/workspace.gitconfig"
|
|
504
533
|
"setup-environment.ts"
|
|
505
534
|
"developer-links.ts"
|
|
535
|
+
"installed-bun-links.ts"
|
|
506
536
|
"linked-snapshots.ts"
|
|
507
537
|
"secret-references.ts"
|
|
538
|
+
"uv-relocation.ts"
|
|
508
539
|
"../../node_modules/.smoo-install"
|
|
509
540
|
"../../node_modules/@typescript/native/bin/tsc"
|
|
510
541
|
];
|
|
@@ -610,6 +641,9 @@ in {
|
|
|
610
641
|
# nixpkgs xcbuild's `xcrun` are dropped, each one announced, so Xcode's
|
|
611
642
|
# clang compiles against the licensed SDK and `xcrun` is Apple's.
|
|
612
643
|
# tooling/direnv/apple-developer.sh does it and states why.
|
|
644
|
+
# 9. cc-rs's compiler variables are this shell's: the ones its `env`
|
|
645
|
+
# declares and no others. tooling/direnv/compiler-variables.sh drops
|
|
646
|
+
# and announces every other one the shell inherits, and states why.
|
|
613
647
|
# Nx's own socket fallback (under HOME or TMPDIR) can exceed the Unix socket
|
|
614
648
|
# limit in a checkout, and an inherited NX_SOCKET_DIR may be another
|
|
615
649
|
# workspace's: tooling/direnv/nx-socket-dir.sh, sourced below, names this
|
|
@@ -618,12 +652,17 @@ in {
|
|
|
618
652
|
# they run.
|
|
619
653
|
(lib.mkBefore ''
|
|
620
654
|
cd "$DEVENV_ROOT/../.."
|
|
655
|
+
# A bare assignment: export's status would hide repo-path's refusal of a
|
|
656
|
+
# cowshed workspace it could not serve, and the shell would enter with an
|
|
657
|
+
# empty PATH.
|
|
658
|
+
PATH="$("$PWD/tooling/direnv/repo-path")" || exit $?
|
|
621
659
|
# Direct `devenv shell` skips .envrc. Reuse cowshed's one environment writer
|
|
622
660
|
# before project hooks, rather than restating its CI/compiler-cache policy.
|
|
661
|
+
# After repo-path, which serves a workspace cowshed had not served yet, so
|
|
662
|
+
# the shell enters on the file that serve wrote.
|
|
623
663
|
if [ -f .cowshed/env ]; then
|
|
624
664
|
. "$PWD/.cowshed/env"
|
|
625
665
|
fi
|
|
626
|
-
export PATH="$("$PWD/tooling/direnv/repo-path")"
|
|
627
666
|
export PATH="${rustToolchainBin}:$PATH"
|
|
628
667
|
# devenv enters the shell with TMPDIR unset (not empty) on every platform.
|
|
629
668
|
# Tools then fall back to /tmp, which on Darwin is not the per-user
|
|
@@ -650,7 +689,8 @@ in {
|
|
|
650
689
|
# gives every workspace its own socket dir, and in a cowshed checkout the
|
|
651
690
|
# one literal path its host shells and sandboxed jobs all share, and
|
|
652
691
|
# states why.
|
|
653
|
-
. "$DEVENV_ROOT/nx-socket-dir.sh"
|
|
692
|
+
. "$DEVENV_ROOT/nx-socket-dir.sh" || exit $?
|
|
693
|
+
. "$DEVENV_ROOT/compiler-variables.sh" ${lib.escapeShellArgs declaredCompilerVariables}
|
|
654
694
|
${lib.optionalString pkgs.stdenv.isDarwin ''
|
|
655
695
|
. "$DEVENV_ROOT/apple-developer.sh" /nix/store
|
|
656
696
|
''}
|
|
@@ -661,7 +701,7 @@ in {
|
|
|
661
701
|
(lib.mkAfter ''
|
|
662
702
|
# Project hooks may prepend real Cargo. Reuse the managed PATH writer
|
|
663
703
|
# last: its served install identity is the host's, not the private HOME.
|
|
664
|
-
|
|
704
|
+
PATH="$("$DEVENV_ROOT/repo-path")" || exit $?
|
|
665
705
|
bun "$DEVENV_ROOT/toolchain-stamp.ts" || exit $?
|
|
666
706
|
if [ -n "$DEVENV_SHELL_PWD" ]; then
|
|
667
707
|
cd "$DEVENV_SHELL_PWD"
|
|
@@ -20,18 +20,20 @@ add_repo_paths() {
|
|
|
20
20
|
# The CLI that evaluates the shell must be the commit whose modules the shell is
|
|
21
21
|
# locked to, so this installs the commit devenv.lock's `devenv` node names and
|
|
22
22
|
# nothing here restates it. `smoo monorepo check` holds that node to a release:
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
# such
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
23
|
+
# it must name its remote and a commit that one of that remote's tags from
|
|
24
|
+
# v2.0.4 on names, which `git ls-remote` answers on every run. devenv.yaml
|
|
25
|
+
# declares such a lock as `github:cachix/devenv/v2.3.1?dir=src/modules`.
|
|
26
|
+
# devenv.cachix.org has pinned the aarch64-darwin, aarch64-linux and
|
|
27
|
+
# x86_64-linux builds of every release from v2.0.4 on for good, so on those
|
|
28
|
+
# three systems the install substitutes rather than compiles. From v2.2 on
|
|
29
|
+
# devenv builds nothing for x86_64-darwin, so on an Intel macOS runner
|
|
30
|
+
# installing such a release fails rather than compiles; there only v2.0.4 to
|
|
31
|
+
# v2.1.2 are pinned. Some older tags, such as v2.0.3, have no pin, and their
|
|
32
|
+
# builds are already gone. The cache drops the build of any commit no tag
|
|
33
|
+
# names, an ancestor of a release included, after about six weeks, after which
|
|
34
|
+
# every cold runner compiles devenv from source (a build of main commit
|
|
35
|
+
# 4ed83c00, which reported 2.1.3 but was never tagged, was pushed on 2026-07-15
|
|
36
|
+
# and was gone by 2026-10-13).
|
|
35
37
|
#
|
|
36
38
|
# An unpinned `github:cachix/devenv` instead installs whatever HEAD is on the day
|
|
37
39
|
# a cold runner misses the store cache — a version that moves with no commit
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Dirent,
|
|
3
|
+
existsSync,
|
|
4
|
+
lstatSync,
|
|
5
|
+
readdirSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
readlinkSync,
|
|
8
|
+
realpathSync,
|
|
9
|
+
statSync,
|
|
10
|
+
} from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { unreadableDeveloperLinks } from './developer-links.ts';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What a Bun install left linked in node_modules, read from the filesystem alone: whether every package a consumer
|
|
16
|
+
* resolves reaches a readable manifest (verifyInstalledBunLinks, before an install writes its success receipt), and
|
|
17
|
+
* which store links the installed tree reaches dangle (danglingStoreLinks, which makes a matching stamp stale).
|
|
18
|
+
* setup-environment.ts owns the workspace enumeration and passes each member's node_modules directory in.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export type BunInstallIntegrityOperation =
|
|
22
|
+
| 'inspect isolated store'
|
|
23
|
+
| 'resolve installed path'
|
|
24
|
+
| 'list installed package aliases'
|
|
25
|
+
| 'read installed package manifest';
|
|
26
|
+
|
|
27
|
+
export class BunInstallIntegrityError extends Error {
|
|
28
|
+
readonly code = 'BUN_INSTALL_INTEGRITY';
|
|
29
|
+
|
|
30
|
+
constructor(
|
|
31
|
+
public readonly operation: BunInstallIntegrityOperation,
|
|
32
|
+
public readonly actualPath: string,
|
|
33
|
+
public readonly expectedTarget: string,
|
|
34
|
+
cause: unknown,
|
|
35
|
+
) {
|
|
36
|
+
super(
|
|
37
|
+
`Bun install integrity: ${operation} failed for ${actualPath}; expected target ${expectedTarget}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
38
|
+
{ cause },
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Link/manifest admission only, once before an install writes its success receipt. `members` is the node_modules
|
|
45
|
+
* directory of every workspace member, beside its manifest.
|
|
46
|
+
*/
|
|
47
|
+
export function verifyInstalledBunLinks(
|
|
48
|
+
root: string,
|
|
49
|
+
members: readonly string[],
|
|
50
|
+
): BunInstallIntegrityError | undefined {
|
|
51
|
+
const store = path.join(root, 'node_modules', '.bun');
|
|
52
|
+
let actualPath = store;
|
|
53
|
+
let expectedTarget = store;
|
|
54
|
+
let operation: BunInstallIntegrityOperation = 'inspect isolated store';
|
|
55
|
+
// Developer links whose target this process may not read (developer-links.ts): the install
|
|
56
|
+
// did not make them and nothing here can read what they name, so they are not admitted here.
|
|
57
|
+
let unreadable: ReadonlySet<string> = new Set();
|
|
58
|
+
|
|
59
|
+
const select = (candidate: string, symbolicLink: boolean): void => {
|
|
60
|
+
actualPath = candidate;
|
|
61
|
+
expectedTarget = candidate;
|
|
62
|
+
operation = 'resolve installed path';
|
|
63
|
+
if (symbolicLink) {
|
|
64
|
+
const target = readlinkSync(candidate);
|
|
65
|
+
expectedTarget = path.resolve(path.dirname(candidate), target);
|
|
66
|
+
expectedTarget = path.resolve(realpathSync(path.dirname(candidate)), target);
|
|
67
|
+
}
|
|
68
|
+
realpathSync(candidate);
|
|
69
|
+
};
|
|
70
|
+
const manifest = (candidate: string, symbolicLink: boolean): void => {
|
|
71
|
+
if (unreadable.has(candidate)) return;
|
|
72
|
+
select(candidate, symbolicLink);
|
|
73
|
+
operation = 'read installed package manifest';
|
|
74
|
+
JSON.parse(readFileSync(path.join(candidate, 'package.json'), 'utf8'));
|
|
75
|
+
};
|
|
76
|
+
const aliases = (tree: string, symbolicLink = false): void => {
|
|
77
|
+
select(tree, symbolicLink);
|
|
78
|
+
operation = 'list installed package aliases';
|
|
79
|
+
for (const entry of readdirSync(tree, { withFileTypes: true })) {
|
|
80
|
+
if (entry.name.startsWith('.')) continue;
|
|
81
|
+
const candidate = path.join(tree, entry.name);
|
|
82
|
+
if (entry.name.startsWith('@')) {
|
|
83
|
+
select(candidate, entry.isSymbolicLink());
|
|
84
|
+
operation = 'list installed package aliases';
|
|
85
|
+
for (const scoped of readdirSync(candidate, { withFileTypes: true })) {
|
|
86
|
+
if (!scoped.name.startsWith('.')) manifest(path.join(candidate, scoped.name), scoped.isSymbolicLink());
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
manifest(candidate, entry.isSymbolicLink());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Admission walks the live closure, not every directory in the store. A restored store can
|
|
95
|
+
// carry superseded peer variants of packages the install also wrote under other variants:
|
|
96
|
+
// their links point into the install cache of the machine that wrote them and dangle here,
|
|
97
|
+
// and their own dependency aliases dangle with them. Nothing the install produced references
|
|
98
|
+
// those variants, so they are not broken live links. An entry is walked strictly when a link
|
|
99
|
+
// in the live tree resolves into it, or when it is the only variant of its package and
|
|
100
|
+
// version — a sole dangling variant still refuses, because there is no replacement to point
|
|
101
|
+
// at. Same package and version alone is never reachability proof.
|
|
102
|
+
const identityOf = (name: string): string | null => /^(.+@\d[^+]*)(\+.*)?$/.exec(name)?.[1] ?? null;
|
|
103
|
+
try {
|
|
104
|
+
unreadable = new Set(unreadableDeveloperLinks(root));
|
|
105
|
+
const state = lstatSync(store, { throwIfNoEntry: false });
|
|
106
|
+
// A hoisted install has no isolated store to admit.
|
|
107
|
+
if (state === undefined) return undefined;
|
|
108
|
+
select(store, state.isSymbolicLink());
|
|
109
|
+
operation = 'inspect isolated store';
|
|
110
|
+
const entries = readdirSync(store, { withFileTypes: true }).filter((entry) => !entry.name.startsWith('.'));
|
|
111
|
+
const identityCounts = new Map<string, number>();
|
|
112
|
+
for (const entry of entries) {
|
|
113
|
+
if (entry.name === 'node_modules' || !(entry.isDirectory() || entry.isSymbolicLink())) continue;
|
|
114
|
+
const identity = identityOf(entry.name) ?? entry.name;
|
|
115
|
+
identityCounts.set(identity, (identityCounts.get(identity) ?? 0) + 1);
|
|
116
|
+
}
|
|
117
|
+
const referenced = referencedStoreEntries(root, store, entries, members);
|
|
118
|
+
// Package aliases are what every consumer actually resolves: each package they name must
|
|
119
|
+
// resolve to a readable manifest, wherever it points — into the store, into the install
|
|
120
|
+
// cache, or at a workspace member. The same strict walk applies at the root and in every
|
|
121
|
+
// workspace member's node_modules; member links seeded the closure above, and seeding is
|
|
122
|
+
// not validation. No identity waiver applies: an alias whose target does not exist is a
|
|
123
|
+
// broken import, however intact a same-version sibling is.
|
|
124
|
+
const checkPackage = (candidate: string, symbolicLink: boolean): void => {
|
|
125
|
+
try {
|
|
126
|
+
// Only a plain metadata file is skipped; a package alias that resolves to a regular
|
|
127
|
+
// file is a broken package and manifest() refuses it below.
|
|
128
|
+
if (!symbolicLink && !statSync(candidate).isDirectory()) return;
|
|
129
|
+
} catch {
|
|
130
|
+
// Dangling: manifest() refuses it with the path named.
|
|
131
|
+
}
|
|
132
|
+
manifest(candidate, symbolicLink);
|
|
133
|
+
};
|
|
134
|
+
const walkPackageAliases = (modules: string): void => {
|
|
135
|
+
for (const child of readdirSync(modules, { withFileTypes: true })) {
|
|
136
|
+
if (child.name.startsWith('.')) continue;
|
|
137
|
+
const childPath = path.join(modules, child.name);
|
|
138
|
+
if (child.name.startsWith('@')) {
|
|
139
|
+
// A scope is a namespace, symlinked or not: the same strict alias walk as the store's.
|
|
140
|
+
aliases(childPath, child.isSymbolicLink());
|
|
141
|
+
} else {
|
|
142
|
+
checkPackage(childPath, child.isSymbolicLink());
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
walkPackageAliases(path.join(root, 'node_modules'));
|
|
147
|
+
for (const modules of members) {
|
|
148
|
+
// A member with nothing installed has no aliases to validate; a present directory is
|
|
149
|
+
// walked with the root's strictness.
|
|
150
|
+
if (existsSync(modules)) walkPackageAliases(modules);
|
|
151
|
+
}
|
|
152
|
+
for (const entry of entries) {
|
|
153
|
+
const candidate = path.join(store, entry.name);
|
|
154
|
+
if (entry.name === 'node_modules') {
|
|
155
|
+
aliases(candidate, entry.isSymbolicLink());
|
|
156
|
+
} else if (entry.isDirectory() || entry.isSymbolicLink()) {
|
|
157
|
+
const identity = identityOf(entry.name) ?? entry.name;
|
|
158
|
+
// An unreferenced variant beside others of its package and version is superseded
|
|
159
|
+
// garbage the install left behind; nothing live resolves through it, so it is not
|
|
160
|
+
// walked. A sole variant is walked: there is no replacement to point at.
|
|
161
|
+
if (!referenced.has(entry.name) && (identityCounts.get(identity) ?? 0) > 1) continue;
|
|
162
|
+
select(candidate, entry.isSymbolicLink());
|
|
163
|
+
aliases(path.join(candidate, 'node_modules'));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return undefined;
|
|
167
|
+
} catch (cause) {
|
|
168
|
+
return new BunInstallIntegrityError(operation, actualPath, expectedTarget, cause);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The store entries the installed tree reaches. Every link in the root's node_modules, the
|
|
174
|
+
* store's own and each workspace member's that resolves into an entry makes that entry live,
|
|
175
|
+
* and so does every link in a live entry's own node_modules, to a fixed point. Member links
|
|
176
|
+
* are as live as root links.
|
|
177
|
+
*/
|
|
178
|
+
function referencedStoreEntries(
|
|
179
|
+
root: string,
|
|
180
|
+
store: string,
|
|
181
|
+
entries: readonly Dirent[],
|
|
182
|
+
members: readonly string[],
|
|
183
|
+
): Set<string> {
|
|
184
|
+
const referenced = new Set<string>();
|
|
185
|
+
const knownEntries = new Set(entries.filter((entry) => entry.name !== 'node_modules').map((entry) => entry.name));
|
|
186
|
+
// Where each store entry actually lives: a link can reach an entry through its install
|
|
187
|
+
// cache target (whose basename carries a cache suffix the entry name does not), so live
|
|
188
|
+
// reachability is also containment inside an entry's real directory, not name matching.
|
|
189
|
+
const entryReals = new Map<string, string>();
|
|
190
|
+
for (const entry of entries) {
|
|
191
|
+
if (entry.name === 'node_modules' || !(entry.isDirectory() || entry.isSymbolicLink())) continue;
|
|
192
|
+
try {
|
|
193
|
+
entryReals.set(entry.name, realpathSync(path.join(store, entry.name)));
|
|
194
|
+
} catch {
|
|
195
|
+
// A dangling entry has no real directory for a live alias to land inside.
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const scanLinks = (dir: string, owner: string | null): void => {
|
|
199
|
+
let children: Dirent[];
|
|
200
|
+
try {
|
|
201
|
+
children = readdirSync(dir, { withFileTypes: true });
|
|
202
|
+
} catch {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
for (const child of children) {
|
|
206
|
+
if (child.name.startsWith('.')) continue;
|
|
207
|
+
const childPath = path.join(dir, child.name);
|
|
208
|
+
if (child.name.startsWith('@')) {
|
|
209
|
+
// A scope is a namespace, symlinked or not: traverse it, never treat it as a package.
|
|
210
|
+
let isDirectory = false;
|
|
211
|
+
try {
|
|
212
|
+
isDirectory = statSync(childPath).isDirectory();
|
|
213
|
+
} catch {
|
|
214
|
+
isDirectory = false;
|
|
215
|
+
}
|
|
216
|
+
if (isDirectory) {
|
|
217
|
+
scanLinks(childPath, owner);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (!child.isSymbolicLink()) continue;
|
|
222
|
+
let target: string;
|
|
223
|
+
try {
|
|
224
|
+
target = readlinkSync(childPath);
|
|
225
|
+
} catch {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// The alias's canonical endpoint is what it actually reaches — through intermediate
|
|
229
|
+
// symlinks as well as its literal target — and is what select() already witnesses.
|
|
230
|
+
// A dangling alias has no endpoint; fall back to resolving its literal target
|
|
231
|
+
// against the physical parent, so a live reference to a broken entry still marks
|
|
232
|
+
// that entry referenced.
|
|
233
|
+
let physicalDir = path.dirname(childPath);
|
|
234
|
+
try {
|
|
235
|
+
physicalDir = realpathSync(physicalDir);
|
|
236
|
+
} catch {
|
|
237
|
+
// Keep the lexical parent; the segment mark below still applies.
|
|
238
|
+
}
|
|
239
|
+
let endpoint: string | null = null;
|
|
240
|
+
try {
|
|
241
|
+
endpoint = realpathSync(childPath);
|
|
242
|
+
} catch {
|
|
243
|
+
endpoint = null;
|
|
244
|
+
}
|
|
245
|
+
const resolved = endpoint ?? path.resolve(physicalDir, target);
|
|
246
|
+
if (endpoint !== null) {
|
|
247
|
+
// The canonical endpoint is authoritative: the entry whose real directory
|
|
248
|
+
// contains it is the live target, whatever any path segment happens to name.
|
|
249
|
+
for (const [name, real] of entryReals) {
|
|
250
|
+
if (name !== owner && (endpoint === real || endpoint.startsWith(`${real}${path.sep}`))) {
|
|
251
|
+
referenced.add(name);
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
for (const segment of resolved.split(path.sep)) {
|
|
257
|
+
if (knownEntries.has(segment) && segment !== owner) {
|
|
258
|
+
referenced.add(segment);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
scanLinks(path.join(root, 'node_modules'), null);
|
|
266
|
+
scanLinks(path.join(store, 'node_modules'), null);
|
|
267
|
+
for (const modules of members) scanLinks(modules, null);
|
|
268
|
+
let grew = true;
|
|
269
|
+
while (grew) {
|
|
270
|
+
grew = false;
|
|
271
|
+
for (const entry of entries) {
|
|
272
|
+
if (entry.name === 'node_modules' || !(entry.isDirectory() || entry.isSymbolicLink())) continue;
|
|
273
|
+
if (!referenced.has(entry.name)) continue;
|
|
274
|
+
const before = referenced.size;
|
|
275
|
+
scanLinks(path.join(store, entry.name, 'node_modules'), entry.name);
|
|
276
|
+
if (referenced.size > before) grew = true;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return referenced;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The store links the installed tree reaches whose target in Bun's install cache is gone. Under
|
|
284
|
+
* `globalStore` each node_modules/.bun/<entry> is a link into that cache, and one that dangles
|
|
285
|
+
* names a cache entry that no longer exists: the install is out of date, as it is while a
|
|
286
|
+
* developer link dangles, and `bun install` links the entry again (measured, Bun 1.4.3). A
|
|
287
|
+
* dangling variant nothing live reaches is superseded garbage the install leaves in place (see
|
|
288
|
+
* verifyInstalledBunLinks), so it never makes the install stale: no install would change it.
|
|
289
|
+
* The closure is walked only when some store link dangles, so `members` is asked for only then.
|
|
290
|
+
*/
|
|
291
|
+
export function danglingStoreLinks(root: string, members: () => readonly string[]): string[] {
|
|
292
|
+
const store = path.join(root, 'node_modules', '.bun');
|
|
293
|
+
let entries: Dirent[];
|
|
294
|
+
try {
|
|
295
|
+
entries = readdirSync(store, { withFileTypes: true }).filter((entry) => !entry.name.startsWith('.'));
|
|
296
|
+
} catch (error) {
|
|
297
|
+
// A hoisted install, or none yet, has no store to link from.
|
|
298
|
+
if (error instanceof Error && 'code' in error && (error.code === 'ENOENT' || error.code === 'ENOTDIR')) return [];
|
|
299
|
+
throw error;
|
|
300
|
+
}
|
|
301
|
+
const dangling = entries.filter(
|
|
302
|
+
(entry) =>
|
|
303
|
+
entry.isSymbolicLink() && statSync(path.join(store, entry.name), { throwIfNoEntry: false }) === undefined,
|
|
304
|
+
);
|
|
305
|
+
if (dangling.length === 0) return [];
|
|
306
|
+
const referenced = referencedStoreEntries(root, store, entries, members());
|
|
307
|
+
return dangling.filter((entry) => referenced.has(entry.name)).map((entry) => path.join(store, entry.name));
|
|
308
|
+
}
|