@smoothbricks/nx-plugin 0.7.11 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +87 -25
  2. package/dist/.build-inputs.json +25 -17
  3. package/dist/built-output-packages.d.ts +27 -0
  4. package/dist/built-output-packages.d.ts.map +1 -0
  5. package/dist/built-output-packages.js +97 -0
  6. package/dist/cross-check-policy.d.ts +13 -1
  7. package/dist/cross-check-policy.d.ts.map +1 -1
  8. package/dist/cross-check-policy.js +13 -1
  9. package/dist/executors/bounded-exec/admission-queue.d.ts +68 -0
  10. package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -0
  11. package/dist/executors/bounded-exec/admission-queue.js +131 -0
  12. package/dist/executors/bounded-exec/cpu-grant.d.ts +14 -0
  13. package/dist/executors/bounded-exec/cpu-grant.d.ts.map +1 -0
  14. package/dist/executors/bounded-exec/cpu-grant.js +18 -0
  15. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +5 -4
  16. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
  17. package/dist/executors/bounded-exec/cpu-pool.d.ts +26 -24
  18. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  19. package/dist/executors/bounded-exec/cpu-pool.js +88 -72
  20. package/dist/executors/bounded-exec/executor.d.ts +5 -7
  21. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  22. package/dist/executors/bounded-exec/executor.js +69 -133
  23. package/dist/executors/bounded-exec/host-memory.d.ts +22 -0
  24. package/dist/executors/bounded-exec/host-memory.d.ts.map +1 -1
  25. package/dist/executors/bounded-exec/host-memory.darwin.d.ts.map +1 -1
  26. package/dist/executors/bounded-exec/host-memory.darwin.js +7 -1
  27. package/dist/executors/bounded-exec/host-memory.js +6 -0
  28. package/dist/executors/bounded-exec/host-memory.linux.d.ts +3 -1
  29. package/dist/executors/bounded-exec/host-memory.linux.d.ts.map +1 -1
  30. package/dist/executors/bounded-exec/host-memory.linux.js +43 -1
  31. package/dist/executors/bounded-exec/memory-retry.d.ts +39 -0
  32. package/dist/executors/bounded-exec/memory-retry.d.ts.map +1 -0
  33. package/dist/executors/bounded-exec/memory-retry.js +33 -0
  34. package/dist/executors/bounded-exec/parent-grant.d.ts +43 -0
  35. package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -0
  36. package/dist/executors/bounded-exec/parent-grant.js +37 -0
  37. package/dist/executors/bounded-exec/peak-charge.d.ts +17 -0
  38. package/dist/executors/bounded-exec/peak-charge.d.ts.map +1 -0
  39. package/dist/executors/bounded-exec/peak-charge.js +20 -0
  40. package/dist/executors/bounded-exec/pool-admission.d.ts +31 -7
  41. package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
  42. package/dist/executors/bounded-exec/pool-admission.js +44 -8
  43. package/dist/executors/bounded-exec/pool-environment.d.ts +25 -0
  44. package/dist/executors/bounded-exec/pool-environment.d.ts.map +1 -0
  45. package/dist/executors/bounded-exec/pool-environment.js +34 -0
  46. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  47. package/dist/executors/bounded-exec/run-cpu-pool.js +2 -2
  48. package/dist/executors/bounded-exec/verdict.d.ts +5 -18
  49. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  50. package/dist/executors/bounded-exec/verdict.js +12 -16
  51. package/dist/index.d.ts +4 -1
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +62 -21
  54. package/dist/managed-files/ci-workflow.d.ts +29 -5
  55. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  56. package/dist/managed-files/ci-workflow.js +111 -16
  57. package/dist/managed-files/context.d.ts.map +1 -1
  58. package/dist/managed-files/context.js +1 -0
  59. package/dist/managed-files/files.d.ts +3 -1
  60. package/dist/managed-files/files.d.ts.map +1 -1
  61. package/dist/managed-files/files.js +2 -0
  62. package/dist/managed-files/publish-workflow.d.ts +6 -1
  63. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  64. package/dist/managed-files/publish-workflow.js +16 -11
  65. package/dist/owned-installation.d.ts.map +1 -1
  66. package/dist/owned-installation.js +48 -14
  67. package/dist/typecheck-route.d.ts +28 -0
  68. package/dist/typecheck-route.d.ts.map +1 -0
  69. package/dist/typecheck-route.js +109 -0
  70. package/dist/workspace-manifest.d.ts +50 -5
  71. package/dist/workspace-manifest.d.ts.map +1 -1
  72. package/executors.json +10 -0
  73. package/managed/raw/patches/nx@24.0.3.patch +16 -0
  74. package/managed/raw/patches/ttsc@0.34.1.patch +93 -8
  75. package/managed/raw/tooling/direnv/apple-developer.sh +8 -1
  76. package/managed/raw/tooling/direnv/compiler-variables.sh +1 -1
  77. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +4 -2
  78. package/managed/raw/tooling/direnv/secret-references.ts +19 -5
  79. package/managed/raw/tooling/git-hooks/pre-push.sh +20 -10
  80. package/managed/templates/github/actions/forgejo-artifact.cjs +9 -9
  81. package/managed/templates/github/actions/setup-devenv/action.yml +53 -0
  82. package/package.json +2 -2
  83. package/src/built-output-packages.ts +125 -0
  84. package/src/cross-check-policy.ts +14 -1
  85. package/src/executors/bounded-exec/admission-queue.ts +163 -0
  86. package/src/executors/bounded-exec/cpu-grant.ts +32 -0
  87. package/src/executors/bounded-exec/cpu-pool-thread.ts +5 -4
  88. package/src/executors/bounded-exec/cpu-pool.ts +123 -58
  89. package/src/executors/bounded-exec/executor.ts +93 -168
  90. package/src/executors/bounded-exec/host-memory.darwin.ts +7 -1
  91. package/src/executors/bounded-exec/host-memory.linux.ts +42 -2
  92. package/src/executors/bounded-exec/host-memory.ts +25 -0
  93. package/src/executors/bounded-exec/memory-retry.ts +63 -0
  94. package/src/executors/bounded-exec/parent-grant.ts +75 -0
  95. package/src/executors/bounded-exec/peak-charge.ts +25 -0
  96. package/src/executors/bounded-exec/pool-admission.ts +66 -11
  97. package/src/executors/bounded-exec/pool-environment.ts +45 -0
  98. package/src/executors/bounded-exec/run-cpu-pool.ts +5 -4
  99. package/src/executors/bounded-exec/verdict.ts +17 -25
  100. package/src/index.ts +70 -21
  101. package/src/managed-files/ci-workflow.ts +143 -16
  102. package/src/managed-files/context.ts +1 -0
  103. package/src/managed-files/files.ts +5 -0
  104. package/src/managed-files/publish-workflow.ts +26 -10
  105. package/src/owned-installation.ts +63 -14
  106. package/src/typecheck-route.ts +64 -0
  107. package/src/workspace-manifest.ts +56 -5
  108. package/test-timings.json +141 -137
package/README.md CHANGED
@@ -882,6 +882,35 @@ target that names no `externalDependencies` at all is still keyed on every packa
882
882
  The root project owns the lockfiles, so its `default` fileset holds them. Its versionless check inputs exclude
883
883
  `bun.lock`, `bun.lockb` and `Cargo.lock`; the nodes key what they decide.
884
884
 
885
+ ### Built-output packages
886
+
887
+ Nx keys a task on an npm package through the package's node, by the integrity the lockfile records for it. A `^` input
888
+ adds the node of every package a dependency project declares or imports, from any of its files, so a version bump of one
889
+ package re-keys every task whose dependency closure reaches an importer of it. A workspace that already keys a package
890
+ by its bytes where a task runs them (a consumer keys this plugin per executor and module closure) names it in the
891
+ plugin's `builtOutputPackages` option, and turns Nx's own lockfile analysis off:
892
+
893
+ ```json
894
+ {
895
+ "pluginsConfig": { "@nx/js": { "analyzeLockfile": false } },
896
+ "plugins": [
897
+ { "plugin": "@smoothbricks/nx-plugin", "options": { "builtOutputPackages": ["@smoothbricks/nx-plugin"] } }
898
+ ]
899
+ }
900
+ ```
901
+
902
+ The plugin then publishes the lockfile's package nodes and the edges between them, both from Nx's own parser
903
+ (`getLockFileNodes`, `getLockFileDependencies`), on the root manifest's result. Each node of a named package has the
904
+ `data.hash` `built-output:<name>`; every other node, every version and every edge is Nx's. A task that reaches a named
905
+ package therefore keeps its key across that package's version bumps, and still keys each of its dependencies by its own
906
+ integrity. Nx merges its default plugin's lockfile nodes after every configured plugin's, so while `analyzeLockfile` is
907
+ on they would replace these: the plugin refuses the option then, and refuses a name the lockfile installs nowhere
908
+ (`src/built-output-packages.ts`, `src/built-output-packages.test.ts`).
909
+
910
+ The option covers the lockfile only. A manifest that declares a named package's version is still an input wherever its
911
+ project's files are; a workspace keeps the version out of member manifests by declaring it once, in the root manifest's
912
+ `catalog`, and `catalog:` in each member.
913
+
885
914
  ### Manifest versions and validation inputs
886
915
 
887
916
  A release rewrites `version` in every package manifest it publishes and in the lockfile entries mirroring them. Those
@@ -1228,7 +1257,18 @@ Concrete targets come from concrete files:
1228
1257
  it.
1229
1258
  - `typecheck` is inferred from `tsconfig.lib.json` and runs the native compiler `SMOO_TYPECHECK_TSC` names (built by
1230
1259
  `devenv.smoo.nix` from a pinned TypeScript revision) as `-p tsconfig.lib.json --noEmit`, directly rather than through
1231
- `ttsc`. Transform plugins' diagnostics are enforced by `tsc-js`, which runs them.
1260
+ `ttsc`. Transform plugins' diagnostics are enforced by `tsc-js`, which runs them. A project whose direct dependency
1261
+ (`dependencies` or `devDependencies`, the ones ttsc discovers plugins on) declares a dialect runs
1262
+ `ttsc -p tsconfig.lib.json --noEmit` instead. A dialect is a construct the stock checker refuses and the package's
1263
+ ttsc plugin lowers before emit; its refusal is withdrawn through the driver's `DiagnosticPlugin` seam (the managed
1264
+ ttsc patch: `LoweredDiagnostics` names the checker diagnostics whose cause the plugin's `ProgramPlugin` removes, and
1265
+ every lane that gates on the program's diagnostics drops exactly those). The pinned compiler cannot judge such a
1266
+ project. The declaring package says so in its manifest,
1267
+ `"smoo": { "typecheck": { "compiler": "ttsc", "dependsOn": ["<project>:<target>"] } }`, where `dependsOn` names the
1268
+ targets that prepare the plugin binaries ttsc loads. The routed typecheck depends on them, so it loads built plugins
1269
+ and never compiles one, and the inference guesses no workspace target. A declaration of another shape refuses the
1270
+ inference by its manifest path. Its compiler is the installed ttsc, which `bun.lock` and the patches in the check
1271
+ inputs already key. A project that depends only on typia stays on the pinned compiler.
1232
1272
  - `typecheck-tests` is inferred from `tsconfig.test.json` and runs the same compiler on
1233
1273
  `-p tsconfig.test.json --noEmit`. It first rebuilds the current package's `tsc-js` output (or its non-TypeScript
1234
1274
  `build`) so self-imports resolve from its own outputs. Transform calls in test files are checked when the test runner
@@ -2430,7 +2470,15 @@ the run's memory: the least finite `memory.max` of the run's cgroup and its ance
2430
2470
  Linux, `hw.memsize` on macOS (`host-memory.ts`). A run whose memory cannot be read fails in `preTasksExecution`, naming
2431
2471
  the file or sysctl. A task whose own peak exceeds the run's memory is granted once nothing else holds memory, and its
2432
2472
  stderr says so; the wait line names the charge as `memory=<bytes>` or `memory=none`. A granted executor's sub-pool
2433
- charges no memory. A host CI scope's first run of a task it holds no record of is the `memory=none` case: the managed
2473
+ charges no memory. The charge follows the parallelism the task is lent: its record's `cpu.tokens` is the parallelism its
2474
+ peak was measured under, and the pool charges the peak in proportion to the tokens it lends when that is more
2475
+ (`ceil(peak × tokens ÷ measured)`, never less than the peak). A task whose whole ask does not fit is lent the most
2476
+ tokens that do, and its wait line names the bytes charged (`memory=<peak> charged=<bytes>`) when they differ from the
2477
+ peak. Each grant is said on the pool's stderr with the task, its charge, what the holders are charged of the run's
2478
+ memory and what the run's bound holds live (anonymous plus shared memory). A command that died of a SIGKILL this
2479
+ executor did not send, with no bound of its own ended, was killed by the kernel for memory: it runs once more, alone in
2480
+ its run's pool (`"alone":true` in the request), which grants it only while no leaf holds a grant and nothing beside it,
2481
+ and says so. A host CI scope's first run of a task it holds no record of is the `memory=none` case: the managed
2434
2482
  `setup-devenv` action starts a scope from the records of the pushes it follows (a pull request's base branch's, a
2435
2483
  release workflow's CI's) and takes, at each run, the record of every task the scope lacks
2436
2484
  (`specs/cowshed/05_gateway.md`, "Without mbx, every Nx run budgets itself").
@@ -2669,8 +2717,20 @@ to the command, which the keyed modules decide. Each entry, and what the executo
2669
2717
  the run or are said on stderr. The variable naming the cowshed executable, which the command does see, lives in the
2670
2718
  core `owned-subtree.ts`.
2671
2719
  - `gateway-lease.js`: the lease protocol the gateway's disk lease and a parent CPU pool speak, the gateway's socket path
2672
- and the grant it reads from an answer. A CPU grant reaches the command only through `cpu-pool.js` and
2673
- `runner-sizing.js`, as a token count; an absent endpoint leaves the command unsized, and a refusal fails the run.
2720
+ and the grant it reads from an answer. A CPU grant reaches the command only through `runner-sizing.js`, as a token
2721
+ count; an absent endpoint leaves the command unsized, and a refusal fails the run.
2722
+ - `cpu-pool.js`, with `pool-admission.js`, `host-memory.js` and `lease-wait.js`: the CPU pool a run serves. It decides
2723
+ how many tokens a run is lent and when: the queue order, the memory a task's recorded peak is charged and the live
2724
+ memory it is held against, the heartbeat of a wait. A pool that cannot be made or refuses fails the run.
2725
+ - `parent-grant.js`: what a run asks its parent's pool for and says of the answer, `peak-charge.js` and `cpu-grant.js`:
2726
+ the charge the task's last record names and the grant a record states. A grant reaches the command as a token count
2727
+ and nothing else, through `runner-sizing.js`; a record that cannot be read refuses the run.
2728
+ - `memory-retry.js`: whether a command the kernel killed for memory (a SIGKILL this executor did not send, to a command
2729
+ no bound of it ended) runs once more, alone in its run's pool, and how the two runs' output joins. The second run is
2730
+ the same command; only the pool it is lent from differs, and a pass after it is a pass of that command.
2731
+ - `mbx-queue.js`, with `admission-queue.js`: the snapshot of mbx's admission queue a Cargo or reserved leaf waits in and
2732
+ the run's view of it. Its text is said on stderr and its waiting decides whether the idle bound is credited, which can
2733
+ fail a run and never changes one that passes. `bounds.js` stays keyed: it decides when a bound fires.
2674
2734
  - `hang-diagnostics.js`: the snapshot taken shortly before the no-progress bound fires. It probes with `ps`, `lsof` and
2675
2735
  `sample`, which suspends the runner for about a second, and signals nothing but its own probes. Its text and lock
2676
2736
  waits are read only once the bound has expired the run, which fails it.
@@ -2678,11 +2738,13 @@ to the command, which the keyed modules decide. Each entry, and what the executo
2678
2738
  the host census the executor quotes when a lease release fails, and the directory a CPU pool binds its socket in. A
2679
2739
  directory that cannot be made refuses the run.
2680
2740
 
2681
- `runner-sizing.js`, `cpu-pool.js` and `progress.js` are not output-neutral although they schedule: `sizeRunner` decides
2682
- what a token count does to the command's parallelism flags and test-thread variables, `cpu-pool.js` writes the jobserver
2683
- flags into `MAKEFLAGS` and `CARGO_MAKEFLAGS`, and `withProgressReport` adds `--dots` to `bun test` and `-json` to
2684
- `go test`. They stay keyed until those functions move into modules of their own. A module that comes to decide what a
2685
- value does to the command, its environment or a passing verdict leaves `outputNeutral` in the same commit.
2741
+ `runner-sizing.js`, `pool-environment.js` and `progress.js` are not output-neutral although they schedule: `sizeRunner`
2742
+ decides what a token count does to the command's parallelism flags and test-thread variables, `pool-environment.js`
2743
+ writes the pool endpoint, its count and the jobserver flags into `MAKEFLAGS` and `CARGO_MAKEFLAGS` (`cpu-pool.js` serves
2744
+ the pool and writes none of them), and `withProgressReport` adds `--dots` to `bun test` and `-json` to `go test`. They
2745
+ stay keyed until those functions move into modules of their own. A module that comes to decide what a value does to the
2746
+ command, its environment or a passing verdict leaves `outputNeutral` in the same commit; `executor-key.test.ts` names
2747
+ the keyed modules and refuses a neutral one that writes those variables.
2686
2748
 
2687
2749
  ## Test Fixtures That Run Nx
2688
2750
 
@@ -2758,22 +2820,22 @@ its root. A daemon that outlives the stop keeps the alias and the root, so the n
2758
2820
 
2759
2821
  A fixture workspace that runs real Nx with this plugin links an installation it owns, never the host's.
2760
2822
  `@smoothbricks/nx-plugin/owned-installation`'s `ownedInstallation(censusRoot, name)` copies the closure the graph
2761
- witness's installation census resolves from `censusRoot` (Nx, this plugin and TypeScript, each package with its
2762
- dependency edges relinked beside it and the top-level bins in `.bin`), and keeps the copy as `name` in `censusRoot`'s
2763
- tool cache, `node_modules/.cache/smoothbricks-nx-plugin/owned-installations/<name>`. Nothing sweeps that directory: a
2764
- cowshed fork clones it with the build volume and main adopts it at land (specs/cowshed/16_build_volumes.md), so it is
2765
- cold only after `node_modules` is reinstalled or the build volume reseeded. Making the copy is most of what a test file
2766
- costs (about 21,000 files: a 59 s copy and a 31–119 s removal per run on a loaded host), and clonefile cannot share it,
2767
- since Bun's global store and every directory a cowshed job may write lie on different volumes. On the first
2768
- `nodeModules()` of a run the census of the host closure and the proven census of the copy are compared package by
2769
- package, by what each holds: resolution edges, node types and modes, and file bytes. A package whose copy no longer
2770
- holds what the host's holds is copied again, and every package when the edges moved or the copy is unproved; a copy that
2771
- was there and failed its proof is named on stderr with the reason. Both censuses take unmoved files' hashes from the
2772
- ones recorded beside the copy, so a run that changes nothing reads no file bytes. `retire()` fails, naming the changed
2773
- nodes, if a fixture wrote into the copy, and leaves it for the next run to prove. The host's closure moves under a
2774
- fixture that reads it: a shared Bun store relinked by another install, or, in a workspace that developer-links this
2775
- plugin, the checkout its author is editing and rebuilding. Either fails the producer receipt's installation proof for
2776
- work that is not the test's.
2823
+ witness's installation census resolves from `censusRoot` (Nx, this plugin and TypeScript, each package as the nodes the
2824
+ census holds of it, so a workspace package's `.cache` its own tests write is never read, with its dependency edges
2825
+ relinked beside it and the top-level bins in `.bin`), and keeps the copy as `name` in `censusRoot`'s tool cache,
2826
+ `node_modules/.cache/smoothbricks-nx-plugin/owned-installations/<name>`. Nothing sweeps that directory: a cowshed fork
2827
+ clones it with the build volume and main adopts it at land (specs/cowshed/16_build_volumes.md), so it is cold only after
2828
+ `node_modules` is reinstalled or the build volume reseeded. Making the copy is most of what a test file costs (about
2829
+ 21,000 files: a 59 s copy and a 31–119 s removal per run on a loaded host), and clonefile cannot share it, since Bun's
2830
+ global store and every directory a cowshed job may write lie on different volumes. On the first `nodeModules()` of a run
2831
+ the census of the host closure and the proven census of the copy are compared package by package, by what each holds:
2832
+ resolution edges, node types and modes, and file bytes. A package whose copy no longer holds what the host's holds is
2833
+ copied again, and every package when the edges moved or the copy is unproved; a copy that was there and failed its proof
2834
+ is named on stderr with the reason. Both censuses take unmoved files' hashes from the ones recorded beside the copy, so
2835
+ a run that changes nothing reads no file bytes. `retire()` fails, naming the changed nodes, if a fixture wrote into the
2836
+ copy, and leaves it for the next run to prove. The host's closure moves under a fixture that reads it: a shared Bun
2837
+ store relinked by another install, or, in a workspace that developer-links this plugin, the checkout its author is
2838
+ editing and rebuilding. Either fails the producer receipt's installation proof for work that is not the test's.
2777
2839
 
2778
2840
  Test files that name one copy share it. Bun runs many test files in one process, which takes the copy once, on the first
2779
2841
  `nodeModules()` of any of them, and each file's `retire()` proves that no fixture wrote into it since that take.
@@ -14,6 +14,7 @@
14
14
  "packages/nx-plugin/src/bin/smoo-nx-test-walks.ts": "94e8af452331d765e711aa2493efbff4ddb4e6e3088343873f78d9eaa840570b",
15
15
  "packages/nx-plugin/src/bounded-test-policy.ts": "b52a8858543d25e173aad4f49002a7cdc7f70b098f6046fc56acb747065acd8a",
16
16
  "packages/nx-plugin/src/build-state-output-policy.ts": "031a75cb96a2fed0ab2ce80a98588482595f7550d5259e33edabd6e676ad3a3c",
17
+ "packages/nx-plugin/src/built-output-packages.ts": "e593f08d42298c9881d381bb8afbae858108941387f67927d6cc1f49e504e4e2",
17
18
  "packages/nx-plugin/src/bun-lock-scope.ts": "f249da592592080ee302cfaa48d607b2acaa6f516f24bafe7f12b9dd49dacaa7",
18
19
  "packages/nx-plugin/src/cargo-build-script-env.ts": "e5b45ccefc2255cd8a48121eb97132a08e136b4cbbc375d04c940d821a429b23",
19
20
  "packages/nx-plugin/src/cargo-closure-input.ts": "6f16430ec0b8949c33337353280372a7258a22d19c79ea3d3dd6bb47acb6fa0d",
@@ -23,7 +24,7 @@
23
24
  "packages/nx-plugin/src/cargo-toolchain-paths.ts": "3c622c19ed7a43166e81f9a92e8ab0e3b607690add5408cd96e95912ecf4c4c1",
24
25
  "packages/nx-plugin/src/cargo-toolchain-policy.ts": "9c7bae572b57046dcc1e3d577b4abb25e877cf551efcca1b837c4bb5a8c62203",
25
26
  "packages/nx-plugin/src/cargo-workspace.ts": "ecbe5e0545e07a68ba02d18a2ed362a545e902e947a52af1dab112b71f91f633",
26
- "packages/nx-plugin/src/cross-check-policy.ts": "923b5807808c9983f4fe8fae1011db6f318119c8deffbb443ad77dcfb0368cd7",
27
+ "packages/nx-plugin/src/cross-check-policy.ts": "3a22f798805dca09f6452d929d86c0d76621bdd32d5d1f21fe02c75cf7335e2f",
27
28
  "packages/nx-plugin/src/deploy-policy.ts": "2f6202000dceca84d472f417affce50fd2ec3cab87c969443d83ec6e1d4ccf71",
28
29
  "packages/nx-plugin/src/disk-command-policy.ts": "fb8731ccf41cff47b88f30165b08dc8d551068c436f4e49cb2b62aa4b49be43c",
29
30
  "packages/nx-plugin/src/ensure-built-receipt.ts": "f80084d91d37c5132822bf26b45e6a9ae35e54e366cedbb9d69a2abd663ca419",
@@ -34,33 +35,39 @@
34
35
  "packages/nx-plugin/src/eslint-sources.ts": "976a2b8e0520b5f6aaf397a272791817a4f385507bc0cbaad4b114fefa8decf5",
35
36
  "packages/nx-plugin/src/executors/all-verdicts/executor.ts": "4d3aac65aa2e03a2d24d149c412aa18f2e66a6a36a4e88993122b10e9355c8f0",
36
37
  "packages/nx-plugin/src/executors/all-verdicts/schema.ts": "2ca6bd8d2f19d851f291ab6a5227167399b9dc8ed0fda0248b69896d77e471f1",
38
+ "packages/nx-plugin/src/executors/bounded-exec/admission-queue.ts": "86664180f8296032f7c96022a790285799e666d92360a10b7a5cc6f3facd58eb",
37
39
  "packages/nx-plugin/src/executors/bounded-exec/bounds.ts": "fecc48ea66df1c2ba526dc0322ab7760cfc1a4e85d99a72a7a43f040448970f0",
38
- "packages/nx-plugin/src/executors/bounded-exec/cpu-pool-thread.ts": "bc7d113a044bb830e4db4c373c2f366fadfbb212353e34ef9a5e7dccf876aee6",
39
- "packages/nx-plugin/src/executors/bounded-exec/cpu-pool.ts": "0f2085296486ebfc63b356fb92c4ec77670de5ac9877bbaf2772ea3aaabbf9f9",
40
+ "packages/nx-plugin/src/executors/bounded-exec/cpu-grant.ts": "c5217349c23be537d9b6a0a52445f3ee442402fdbd08f1d33a3095c52051616d",
41
+ "packages/nx-plugin/src/executors/bounded-exec/cpu-pool-thread.ts": "47697a9531df5fd6fcdf4e706fc7e5874bca1717c838496673bf148c691f1e9e",
42
+ "packages/nx-plugin/src/executors/bounded-exec/cpu-pool.ts": "bc122174ccf628b769c73197b7a78987d033b5e7ea6cb5ddbeac384310fdd22a",
40
43
  "packages/nx-plugin/src/executors/bounded-exec/disk-lease.ts": "1a3f6a6fa590d9a2550490bb6906dc91b6c05fbef235b025eaf257eb5310e92d",
41
- "packages/nx-plugin/src/executors/bounded-exec/executor.ts": "49c29558c8b4f3db21a807d6c2e453ca5805ffd8b41f8f79d3837fde33a92396",
44
+ "packages/nx-plugin/src/executors/bounded-exec/executor.ts": "36174568082dc0e37b26a67e082aec64898df43aebb47826c8f9ec3ead81b83a",
42
45
  "packages/nx-plugin/src/executors/bounded-exec/gateway-lease.ts": "f3f73bd92db30e4857f98fb8bd2b9a75b2a5a2a318f094e075ed803c1f9a0117",
43
46
  "packages/nx-plugin/src/executors/bounded-exec/hang-diagnostics.ts": "bcaa9e52384f6c481a9cc2835ba6e8ffe167afa3cb51623fdf8dc3493876f335",
44
- "packages/nx-plugin/src/executors/bounded-exec/host-memory.darwin.ts": "235ea2aaaee024d750ffe8fae5570c04d607b0eeb2fa2f0fc4309812c95692c1",
45
- "packages/nx-plugin/src/executors/bounded-exec/host-memory.linux.ts": "d473dc8475066d4914c419b6b803b6937ebb2577348f0dda8f9ed9def60e8584",
46
- "packages/nx-plugin/src/executors/bounded-exec/host-memory.ts": "cc7e94023adad2c3645c7a4ba18d07545426ae8d02840a2cf8117494d0915234",
47
+ "packages/nx-plugin/src/executors/bounded-exec/host-memory.darwin.ts": "ce1c12e3f8ebe06034d2e9ecd332f907c567fb2d0a71f3c1c5acccb687488fc8",
48
+ "packages/nx-plugin/src/executors/bounded-exec/host-memory.linux.ts": "465171b065355df13af73fad9c8101d48f6bb060cf41cb50d8dd272abf693b08",
49
+ "packages/nx-plugin/src/executors/bounded-exec/host-memory.ts": "6d02f33e950c89162deb9131bd3c0819ab19bf54dd600da557d7869491eaf99a",
47
50
  "packages/nx-plugin/src/executors/bounded-exec/leaf-peak.ts": "0b1b94992b2cbb9e3759785424ceb202667053c5571edf3a79cdd0b206e54a1d",
48
51
  "packages/nx-plugin/src/executors/bounded-exec/lease-wait.ts": "59d8ac94d0b8b75858971c5bb28ee421fca4f7685577274fe8bbaf0c01ba462a",
49
52
  "packages/nx-plugin/src/executors/bounded-exec/lock-wait.ts": "b14a23b49759a777f4b3338ced003adaf76837c2c38462458f76a7fef1b95d9e",
50
53
  "packages/nx-plugin/src/executors/bounded-exec/mbx-pool.ts": "4ef48c1887c1fb29000cdc581686332db6fd503ee07ccdb5f0241fb033249097",
51
54
  "packages/nx-plugin/src/executors/bounded-exec/mbx-queue.ts": "ac309e28e5ee78fa08d628edb00e33532514f7572166770799ae86d468c12b4e",
52
55
  "packages/nx-plugin/src/executors/bounded-exec/mbx-reservations.ts": "1d51ef403f1ea3606d570370265d21421add7d5ca48d74480e9cde12793d0786",
56
+ "packages/nx-plugin/src/executors/bounded-exec/memory-retry.ts": "e56fd04f8a8ad03247099a1d005fcbcda6def6aa7656e9515309f6f2438fe88d",
53
57
  "packages/nx-plugin/src/executors/bounded-exec/no-space.ts": "ec032968d89f9e853796012705a06c06cfc4da54bf6e6f10a526f98daca3d077",
54
58
  "packages/nx-plugin/src/executors/bounded-exec/owned-subtree.ts": "cb5edf2b5fe2c1b5b961f8c0ff16ec7bfae3c22ad75dfd671b74f1a4a865863f",
59
+ "packages/nx-plugin/src/executors/bounded-exec/parent-grant.ts": "9e3826a336220c2453725a07516dfb9a89c84f5febe2b0620ea4be91ae437b3b",
60
+ "packages/nx-plugin/src/executors/bounded-exec/peak-charge.ts": "6721d2d4968550d99a6d10b47483d5e1685cea0ad694ea71abeef3d1adc48d77",
55
61
  "packages/nx-plugin/src/executors/bounded-exec/peak-waiter.ts": "3d9a60f8e61d160cf4151746c160f836954f57aca896127a5ef9df4d09c26180",
56
- "packages/nx-plugin/src/executors/bounded-exec/pool-admission.ts": "384819f66b486a4075685d9a5c240011a342966eeb5c39ecafe1656529f16c21",
62
+ "packages/nx-plugin/src/executors/bounded-exec/pool-admission.ts": "0cc84dbda8d2cf472a0ee9ec14ab136a219ab2ed223e9769ef45590efbb4b793",
63
+ "packages/nx-plugin/src/executors/bounded-exec/pool-environment.ts": "00046e682376dfabedba3f1743b04656bd6a031b0ac4e594ae47e8f7beb2b68a",
57
64
  "packages/nx-plugin/src/executors/bounded-exec/progress.ts": "ed926f7b4991ebf7a7c8876ab0ea00295934d058c774e3f811963a85d209979b",
58
65
  "packages/nx-plugin/src/executors/bounded-exec/ram-attach.ts": "865eb5c277d9ab4b258013030938aeee762b731a7298fa8ad3c5eba3026df77a",
59
66
  "packages/nx-plugin/src/executors/bounded-exec/ram-detach.ts": "535d26114d14d0d94db76227ea7ba52b1ae0b590d7dbac22993b6796d255e666",
60
67
  "packages/nx-plugin/src/executors/bounded-exec/ram-temp-fixtures.ts": "075da4ecfd1cf7dd98fc8c894599dcf2720faba07ac30b8e5592964178849359",
61
68
  "packages/nx-plugin/src/executors/bounded-exec/ram-temp-held.ts": "7c32555bc6dab3f767925b55b68684d33a69393050342d06f055fb81e8e5332b",
62
69
  "packages/nx-plugin/src/executors/bounded-exec/ram-temp.ts": "8d66e6ac13c4ccf6172586b9857d5114b48e027bdcb305f94f6828076c1f7eb4",
63
- "packages/nx-plugin/src/executors/bounded-exec/run-cpu-pool.ts": "180dc2b185e22c5280182115ca99d52debd2461e51f971ba284aa9a8bef634fb",
70
+ "packages/nx-plugin/src/executors/bounded-exec/run-cpu-pool.ts": "17148ca7a51aff54d9cbb01db558a828804b158f46e4d3d85d39449d2b644861",
64
71
  "packages/nx-plugin/src/executors/bounded-exec/runner-hook.ts": "606eab5db826e571eb15df618315e01cc773d09fd647beb1c00f6434df58ffad",
65
72
  "packages/nx-plugin/src/executors/bounded-exec/runner-lifecycle.ts": "b2a7c901296bb6c139909297bbdbab5bd00e94319c022307d006b0e1293f6454",
66
73
  "packages/nx-plugin/src/executors/bounded-exec/runner-sizing.ts": "bffd2ba0f80758944ca682838832bdbe20ae12eb9a4f75084a3df82ae7786145",
@@ -68,7 +75,7 @@
68
75
  "packages/nx-plugin/src/executors/bounded-exec/schema.ts": "74eb04eaa8d90d966a98ca2b1b7fffc7d2205a55a1e38958effa641b72c680a3",
69
76
  "packages/nx-plugin/src/executors/bounded-exec/test-result-writer.ts": "df7668a11d105a1f88d2187ef8b0edff9db7ba56d8176b5bc35daf1359667637",
70
77
  "packages/nx-plugin/src/executors/bounded-exec/test-results.ts": "4f83dc3accd7892f45385796522267adad9401326d0cd9ce4d4e1145b9023577",
71
- "packages/nx-plugin/src/executors/bounded-exec/verdict.ts": "7ec4b86fbdacc3b6ef0829a19d76e32858f196c2e741f5e69e3b0e395a03a12f",
78
+ "packages/nx-plugin/src/executors/bounded-exec/verdict.ts": "7fc9211a5cad1b8152756526dec0d2dae92730378f0d03c4d2ca4e522bf35aa4",
72
79
  "packages/nx-plugin/src/executors/cargo-zigbuild/executor.ts": "622a5f36897d9eb1f7465654e88f4291aedee9767603028d20c1e819b91d72f4",
73
80
  "packages/nx-plugin/src/executors/cargo-zigbuild/schema.ts": "e5cf3b0cc91a2d003a63ca0c9a93f1ec08263469b8a19dbe338b2dc0c0810747",
74
81
  "packages/nx-plugin/src/executors/scriptc-native/executor.ts": "4db61da4444d3a30acd3995b6cf53a4bc403a40fe856d88b2c30ce467badbea8",
@@ -94,11 +101,11 @@
94
101
  "packages/nx-plugin/src/generators/make-public/schema.d.ts": "5e7bd2f1ce16795df4c919d6d53588ea85b574c84400940b6322275f96f60357",
95
102
  "packages/nx-plugin/src/go-tests.ts": "8e356b6ee276e6e836c404353b0ffb5ccec5beb261126f167f730e6e01e9c2b6",
96
103
  "packages/nx-plugin/src/graph-input-contract.ts": "8a1aec1294960ae80bcff55a0370c95004a911bf1afe6caa47e666da3baeac43",
97
- "packages/nx-plugin/src/index.ts": "223dd22b1bc871a24c9a7a7b66e2d496870cac40b52281f7119356a09287a96a",
104
+ "packages/nx-plugin/src/index.ts": "45d965a45f9769dc8d08fda1cedf81e4f1b7df6d98724351f33ae6d059917b73",
98
105
  "packages/nx-plugin/src/managed-assets.ts": "9cea959c09f3163992e666eecc5a65ec1f1b63c81fc56c5e99088507d02c5e3b",
99
- "packages/nx-plugin/src/managed-files/ci-workflow.ts": "57773e51bae9b3334f77b77fa42a82a1ab011aa9a371e958e24f5747231ba0e5",
100
- "packages/nx-plugin/src/managed-files/context.ts": "5b83c000322382cb781df4f415f3759388e69686b76779599572a62a5c4dd28c",
101
- "packages/nx-plugin/src/managed-files/files.ts": "c88d4f6ab100f25e8e0453f898ed42d8cf067d8c102b2c2984a1f33fb1b34a2c",
106
+ "packages/nx-plugin/src/managed-files/ci-workflow.ts": "c48f80cf3b215a8b41fdeb220e653a3a26ee288e833b1bb215f8f15de006e5ae",
107
+ "packages/nx-plugin/src/managed-files/context.ts": "472553c8e15f5bb72f7167ca3f3c5ce5171f479a3cdf2fb4b9f86d1f1addf4bd",
108
+ "packages/nx-plugin/src/managed-files/files.ts": "e26217a7833ff16a3bd5d6925f184f07cdffdc5a15f4ea41e22866edeb957a5e",
102
109
  "packages/nx-plugin/src/managed-files/generator.ts": "8cf1a1b121645c5ead86c163c9da03f612efb2fff6aabed3ea858d87d6cbd0b3",
103
110
  "packages/nx-plugin/src/managed-files/github-runs-on.ts": "a049ca60a79dec57f77e5d18090569a9b8b78818219f236fe352e7705500f531",
104
111
  "packages/nx-plugin/src/managed-files/json-edit.ts": "81bc6dd10fffff583cc9f2269f0c2fd2f76b1c5aedbc7d068cf29878371497c2",
@@ -107,13 +114,13 @@
107
114
  "packages/nx-plugin/src/managed-files/paths.ts": "0727cde9a3eea88420290b63cb4c9a3ffab857b39e0411eed3c4ddeb4e563745",
108
115
  "packages/nx-plugin/src/managed-files/pr-preview-cleanup-workflow.ts": "0f34805a6d737f364c23801da62aefcd4afdc7ba87e911019dd6301be640b385",
109
116
  "packages/nx-plugin/src/managed-files/private-npm-policy.ts": "795882f98b2c2434e7c0115e93a7b4c0da6142ae0602274b362893c49a46d5a7",
110
- "packages/nx-plugin/src/managed-files/publish-workflow.ts": "cc339390ddd41ac04d965b8adc8a4fe60a4a549df8b779d169dc10ace8722708",
117
+ "packages/nx-plugin/src/managed-files/publish-workflow.ts": "7cc056bbf0d33b264535d1a650547db959b1cf7c1a6ad975edce7a7ee8bc0a3c",
111
118
  "packages/nx-plugin/src/managed-files/tree.ts": "a6b7dc515796a3824199938ce70af7d2b45347ed32064b487f3d5f381509dc54",
112
119
  "packages/nx-plugin/src/manifest-hash.ts": "26cb2598853801cf70785386e1847feba7f04780b43809597004b7fb7ecbc2b6",
113
120
  "packages/nx-plugin/src/nextest-code-bound.ts": "e1036934a35f1b65e0f43bddbea259e01a1100e553cdeaefc2db8823a4517340",
114
121
  "packages/nx-plugin/src/nextest-timings.ts": "3d3c87e8a6e701e5e87073754257a442b9e2045665de31a9571b8c38dc8bfd0b",
115
122
  "packages/nx-plugin/src/nx-publish.ts": "0e660129843e7656d8d68b4f6df967739df66aa99264f709124d5ea25c62f7a2",
116
- "packages/nx-plugin/src/owned-installation.ts": "d44c1c485668250542f1b91c7aa45864e54e8a51535bb65d0c2aeadaa50955d9",
123
+ "packages/nx-plugin/src/owned-installation.ts": "83d9d02d985eedbaa4d03c7d41121191977356c60cf8d68aee08172a66b148e7",
117
124
  "packages/nx-plugin/src/package-target-policy.ts": "32b88c9e6ae54e2ae5492086ff7f4d1147e9f53f014a0614f48953a649bb8cc7",
118
125
  "packages/nx-plugin/src/platform-targets.ts": "a2a1aa3a7fae87931e6387275983435c7f76ce8a91808a9c47eb111bd83cad8f",
119
126
  "packages/nx-plugin/src/process-children.darwin.ts": "a2f95428b94738e53a6d6bee0cbb721bd22a6608432ec393520d0c7baa468329",
@@ -137,12 +144,13 @@
137
144
  "packages/nx-plugin/src/testing.ts": "ef26d48eb7b90d682778cbbff678c9cc25df57a6775cb58b8c925e8fb829fe6a",
138
145
  "packages/nx-plugin/src/tool-bins.ts": "8e5b194d76ce854fd33ad464017c021af401a2d92383f5c31168652b73656601",
139
146
  "packages/nx-plugin/src/type-guards.ts": "87d87a9bb83f0f4614b9f615d8cc7347772cb1418dc1946978987147c0d6ef0c",
147
+ "packages/nx-plugin/src/typecheck-route.ts": "c2e1256582670ad18e3b2cb18d34dbf6a647c6575d4b43715f08b58bce50f84d",
140
148
  "packages/nx-plugin/src/typecheck-test-policy.ts": "5f6b1ff0dbf4bcac84721e60452790fb5e4ce41ee35ca2f1d033d51575ed53d7",
141
149
  "packages/nx-plugin/src/version-actions.cts": "c579ed33d5641bd487024429758582fe1f7bde376cfbd4a4a4325aa70fb71883",
142
150
  "packages/nx-plugin/src/wait-why-policy.ts": "f10a5370665c0c38dc778d7532b2cd2b008221efea097b788aeaba8ee63745ea",
143
151
  "packages/nx-plugin/src/workspace-config-policy.ts": "6cd57431636ecc08eb550aa6771192fe3800159351d21dbb1057df51f8c3955b",
144
152
  "packages/nx-plugin/src/workspace-index.ts": "b2036b48bae92d618027bcc1f876eb9312627ed035d4753eead70b23aa482cc5",
145
- "packages/nx-plugin/src/workspace-manifest.ts": "9f64639c1a1aaf4aa11115352448aee926f7615b4479992a5c2cb79e5c41ea93",
153
+ "packages/nx-plugin/src/workspace-manifest.ts": "44d20244ff5fac9b6397e6c0ce6d9eac25d16f95c6a0c21a8cc70ca17067ce26",
146
154
  "packages/nx-plugin/src/workspace-package-policy.ts": "f569ce4e5d27168ea83aa41893573cb869d6f062d37133e95911fdd1d709fa8c",
147
155
  "packages/nx-plugin/tsconfig.lib.json": "553a96cc72e10c187d5e7d3da767270d8184ae07929139e417345c770b8d84d1"
148
156
  },
@@ -0,0 +1,27 @@
1
+ import type { CreateDependenciesContext, CreateNodesContextV2, ProjectGraphExternalNode, RawProjectGraphDependency } from 'nx/src/devkit-exports.js';
2
+ /**
3
+ * Built-output packages: lockfile package nodes that carry no version identity for the packages a workspace keys by
4
+ * what its tasks run.
5
+ *
6
+ * Nx keys a task on an npm package through the package's external node, hashing the integrity the lockfile records for
7
+ * it (`hash_external`). A `^` input adds the node of every package a dependency project declares or imports, from any
8
+ * of its files, so a version bump of one package re-keys every task whose dependency closure reaches an importer of it.
9
+ * That is wrong for a package the workspace already keys by its bytes where a task runs them, as a consumer keys the Nx
10
+ * plugin per executor and module closure. The plugin's `builtOutputPackages` option names such packages.
11
+ *
12
+ * The workspace turns Nx's own lockfile analysis off (`pluginsConfig["@nx/js"].analyzeLockfile: false`): Nx merges its
13
+ * default plugin's nodes after every configured plugin's, so they would replace these. This plugin then publishes the
14
+ * nodes and package edges Nx's own parser makes (`getLockFileNodes`, `getLockFileDependencies`), every node of a named
15
+ * package with a `data.hash` that names the package alone. Only that hash differs from Nx's graph: names, versions and
16
+ * edges stay, so a task that reaches a named package still keys each of its dependencies by its own integrity.
17
+ */
18
+ /** The `data.hash` of a named package's nodes: the package's name, the one identity Nx's graph keys it by. */
19
+ export declare function builtOutputHash(packageName: string): string;
20
+ /**
21
+ * The lockfile's package nodes, each of a named package hashed by {@link builtOutputHash}; none when the option names
22
+ * no package. Refuses while Nx's own nodes would replace them, and for a named package the lockfile installs nowhere.
23
+ */
24
+ export declare function builtOutputLockfileNodes(options: unknown, context: CreateNodesContextV2): Record<string, ProjectGraphExternalNode>;
25
+ /** The package edges Nx's parser reads from the lockfile whose nodes the graph holds; none when no package is named. */
26
+ export declare function builtOutputLockfileDependencies(options: unknown, context: CreateDependenciesContext): RawProjectGraphDependency[];
27
+ //# sourceMappingURL=built-output-packages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"built-output-packages.d.ts","sourceRoot":"","sources":["../src/built-output-packages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAUlC;;;;;;;;;;;;;;;GAeG;AAEH,8GAA8G;AAC9G,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE3D;AAyCD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CA4B1C;AAED,wHAAwH;AACxH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CAI7B"}
@@ -0,0 +1,97 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { hashArray } from 'nx/src/hasher/file-hasher.js';
4
+ import { readBunLockFile } from 'nx/src/plugins/js/lock-file/bun-parser.js';
5
+ import { getLockFileDependencies, getLockFileName, getLockFileNodes } from 'nx/src/plugins/js/lock-file/lock-file.js';
6
+ import { jsPluginConfig } from 'nx/src/plugins/js/utils/config.js';
7
+ import { detectPackageManager } from 'nx/src/utils/package-manager.js';
8
+ import { nxVersion } from 'nx/src/utils/versions.js';
9
+ import { isRecord } from './type-guards.js';
10
+ /**
11
+ * Built-output packages: lockfile package nodes that carry no version identity for the packages a workspace keys by
12
+ * what its tasks run.
13
+ *
14
+ * Nx keys a task on an npm package through the package's external node, hashing the integrity the lockfile records for
15
+ * it (`hash_external`). A `^` input adds the node of every package a dependency project declares or imports, from any
16
+ * of its files, so a version bump of one package re-keys every task whose dependency closure reaches an importer of it.
17
+ * That is wrong for a package the workspace already keys by its bytes where a task runs them, as a consumer keys the Nx
18
+ * plugin per executor and module closure. The plugin's `builtOutputPackages` option names such packages.
19
+ *
20
+ * The workspace turns Nx's own lockfile analysis off (`pluginsConfig["@nx/js"].analyzeLockfile: false`): Nx merges its
21
+ * default plugin's nodes after every configured plugin's, so they would replace these. This plugin then publishes the
22
+ * nodes and package edges Nx's own parser makes (`getLockFileNodes`, `getLockFileDependencies`), every node of a named
23
+ * package with a `data.hash` that names the package alone. Only that hash differs from Nx's graph: names, versions and
24
+ * edges stay, so a task that reaches a named package still keys each of its dependencies by its own integrity.
25
+ */
26
+ /** The `data.hash` of a named package's nodes: the package's name, the one identity Nx's graph keys it by. */
27
+ export function builtOutputHash(packageName) {
28
+ return `built-output:${packageName}`;
29
+ }
30
+ /**
31
+ * The read whose nodes createNodes published last. An install can rewrite the lockfile between the two hooks, so
32
+ * createDependencies links the nodes the graph holds, as Nx's own lockfile plugin does.
33
+ */
34
+ let published;
35
+ /** The packages the option names, or null when it names none. */
36
+ function namedPackages(options) {
37
+ if (!isRecord(options) || options.builtOutputPackages === undefined)
38
+ return null;
39
+ const names = options.builtOutputPackages;
40
+ if (!Array.isArray(names) || !names.every((name) => typeof name === 'string' && name.length > 0)) {
41
+ throw new Error('builtOutputPackages must be a list of package names');
42
+ }
43
+ return names.length === 0 ? null : new Set(names);
44
+ }
45
+ /** The workspace's lockfile, as Nx's own lockfile plugin reads it, and Nx's parse of it. */
46
+ function readLockfile(context) {
47
+ const packageManager = detectPackageManager(context.workspaceRoot);
48
+ const lockFile = getLockFileName(packageManager);
49
+ const path = join(context.workspaceRoot, lockFile);
50
+ if (!existsSync(path))
51
+ throw new Error(`builtOutputPackages names packages, but ${path} does not exist`);
52
+ const contents = packageManager === 'bun' ? readBunLockFile(path) : readFileSync(path, 'utf-8');
53
+ const hash = hashArray([nxVersion, contents]);
54
+ if (published?.hash === hash)
55
+ return published;
56
+ const { nodes, keyMap } = getLockFileNodes(packageManager, lockFile, contents, hash, context);
57
+ return { packageManager, lockFile, contents, hash, nodes, keyMap };
58
+ }
59
+ /**
60
+ * The lockfile's package nodes, each of a named package hashed by {@link builtOutputHash}; none when the option names
61
+ * no package. Refuses while Nx's own nodes would replace them, and for a named package the lockfile installs nowhere.
62
+ */
63
+ export function builtOutputLockfileNodes(options, context) {
64
+ const packages = namedPackages(options);
65
+ if (packages === null)
66
+ return {};
67
+ if (jsPluginConfig(context.nxJsonConfiguration).analyzeLockfile) {
68
+ throw new Error(`builtOutputPackages (${[...packages].join(', ')}) needs nx.json pluginsConfig["@nx/js"].analyzeLockfile ` +
69
+ "set to false: Nx merges its own lockfile nodes after this plugin's, and they would key each of these " +
70
+ 'packages by its version');
71
+ }
72
+ const read = readLockfile(context);
73
+ published = read;
74
+ const nodes = {};
75
+ const found = new Set();
76
+ for (const [name, node] of Object.entries(read.nodes)) {
77
+ const packageName = node.data.packageName;
78
+ if (!packages.has(packageName)) {
79
+ nodes[name] = node;
80
+ continue;
81
+ }
82
+ found.add(packageName);
83
+ nodes[name] = { ...node, data: { ...node.data, hash: builtOutputHash(packageName) } };
84
+ }
85
+ const absent = [...packages].filter((name) => !found.has(name));
86
+ if (absent.length > 0) {
87
+ throw new Error(`builtOutputPackages names ${absent.join(', ')}, which ${read.lockFile} installs nowhere`);
88
+ }
89
+ return nodes;
90
+ }
91
+ /** The package edges Nx's parser reads from the lockfile whose nodes the graph holds; none when no package is named. */
92
+ export function builtOutputLockfileDependencies(options, context) {
93
+ if (namedPackages(options) === null)
94
+ return [];
95
+ const read = published ?? readLockfile(context);
96
+ return getLockFileDependencies(read.packageManager, read.lockFile, read.contents, read.hash, context, read.keyMap);
97
+ }
@@ -156,17 +156,29 @@ export declare const CARGO_CROSS_LINT_COMMAND = "[ \"${SMOO_CROSS_LINT_REPLAY_ON
156
156
  export declare const CARGO_LINT_CLIPPY_COMMAND: string;
157
157
  /** Root `package.json` script name, in the repo's `verb:qualifier` style. */
158
158
  export declare const CROSS_CHECK_SCRIPT_NAME = "check:linux";
159
+ /**
160
+ * The caller variables a declared command keeps: cowshed clears the environment of every command a land runs, its
161
+ * gate and its push among them, and passes these on when the caller has them, with a `PATH`
162
+ * (specs/cowshed/02_workspaces.md, "The declared commands' environment"). The managed pre-push hook spells the same
163
+ * list in shell, and a test holds the two equal.
164
+ */
165
+ export declare const DECLARED_COMMAND_IDENTITY: readonly ['HOME', 'USER', 'LOGNAME', 'TERM', 'LANG', 'SSH_AUTH_SOCK'];
159
166
  /**
160
167
  * The developer entry point: one command on macOS that reports what CI's Linux
161
168
  * job would. A plain Nx run, because every managed devenv shell carries the
162
169
  * cross toolchain; the land gate's Nx graph holds the same target.
163
170
  *
171
+ * It runs from the environment the land gate and the pre-push probe run in: the identity variables and `PATH` alone,
172
+ * with the checkout's devenv entered over them. Run in the caller's shell, it keyed every cargo task on whatever that
173
+ * shell carried and the checkout does not declare (an `AR=ar` from a parent directory's devenv moved the toolchain
174
+ * input), so its verdict was one the probe never asks for.
175
+ *
164
176
  * Deliberately NOT `--quiet`. The pre-push gate is a probe: it consults the Nx
165
177
  * cache and refuses a push that has no hit, never starting a compile of its own.
166
178
  * The clippy behind this script is unbounded, so a silent terminal is
167
179
  * indistinguishable from a hang.
168
180
  */
169
- export declare const CROSS_CHECK_SCRIPT_COMMAND = "nx run-many -t cargo-lint-cross";
181
+ export declare const CROSS_CHECK_SCRIPT_COMMAND: string;
170
182
  /**
171
183
  * A cross-built test archive and the target that EXECUTES it, per foreign
172
184
  * target triple the cargo workspace declares in
@@ -1 +1 @@
1
- {"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,2EAA2E,CAAC;AAEjH;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAO9E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAYrD,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,uCAAqC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,wBAAwB,ggBAA0L,CAAC;AAEhO;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,QAErC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,oCAA8C,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAID,iFAAiF;AACjF,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvF"}
1
+ {"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,2EAA2E,CAAC;AAEjH;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAO9E;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAYrD,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,uCAAqC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,wBAAwB,ggBAA0L,CAAC;AAEhO;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,QAErC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,YAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAU,CAAC;AAE/G;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,QAAgK,CAAC;AAExM;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAID,iFAAiF;AACjF,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvF"}
@@ -171,17 +171,29 @@ export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${CARGO_ZIGB
171
171
  export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(`clippy --workspace --all-targets --target-dir target/cargo-lint ${CARGO_DENY_WARNINGS}`);
172
172
  /** Root `package.json` script name, in the repo's `verb:qualifier` style. */
173
173
  export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
174
+ /**
175
+ * The caller variables a declared command keeps: cowshed clears the environment of every command a land runs, its
176
+ * gate and its push among them, and passes these on when the caller has them, with a `PATH`
177
+ * (specs/cowshed/02_workspaces.md, "The declared commands' environment"). The managed pre-push hook spells the same
178
+ * list in shell, and a test holds the two equal.
179
+ */
180
+ export const DECLARED_COMMAND_IDENTITY = ['HOME', 'USER', 'LOGNAME', 'TERM', 'LANG', 'SSH_AUTH_SOCK'];
174
181
  /**
175
182
  * The developer entry point: one command on macOS that reports what CI's Linux
176
183
  * job would. A plain Nx run, because every managed devenv shell carries the
177
184
  * cross toolchain; the land gate's Nx graph holds the same target.
178
185
  *
186
+ * It runs from the environment the land gate and the pre-push probe run in: the identity variables and `PATH` alone,
187
+ * with the checkout's devenv entered over them. Run in the caller's shell, it keyed every cargo task on whatever that
188
+ * shell carried and the checkout does not declare (an `AR=ar` from a parent directory's devenv moved the toolchain
189
+ * input), so its verdict was one the probe never asks for.
190
+ *
179
191
  * Deliberately NOT `--quiet`. The pre-push gate is a probe: it consults the Nx
180
192
  * cache and refuses a push that has no hit, never starting a compile of its own.
181
193
  * The clippy behind this script is unbounded, so a silent terminal is
182
194
  * indistinguishable from a hang.
183
195
  */
184
- export const CROSS_CHECK_SCRIPT_COMMAND = `nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
196
+ export const CROSS_CHECK_SCRIPT_COMMAND = `env -i ${DECLARED_COMMAND_IDENTITY.map((name) => `${name}="$${name}"`).join(' ')} PATH="$PATH" direnv exec "$PWD" nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
185
197
  /**
186
198
  * A cross-built test archive and the target that EXECUTES it, per foreign
187
199
  * target triple the cargo workspace declares in
@@ -0,0 +1,68 @@
1
+ import { type BoundEvent } from './bounds.js';
2
+ import { snapshotMbxQueue } from './mbx-queue.js';
3
+ import { type AdmissionQueueWait } from './verdict.js';
4
+ /**
5
+ * What a Cargo or reserved leaf waits in: mbx's admission queue. The snapshots of it are said on stderr and decide
6
+ * whether the wait is credited against the idle bound, so they can fail a run and never change a command that passes:
7
+ * the key leaves this out (README, "Bounded exec key"). The bounds themselves (bounds.ts) stay keyed.
8
+ */
9
+ /** The mbx host a snapshot runs `mbx` through; the real one unless a test injects another. */
10
+ export type QueueHost = Parameters<typeof snapshotMbxQueue>[3];
11
+ /** What the run tells its observation of itself. */
12
+ export interface ObservationHost {
13
+ /** The run is over: it settled or a bound expired. Nothing more is observed or credited. */
14
+ over(): boolean;
15
+ /** The command's pid, once it is spawned. */
16
+ pid(): number | undefined;
17
+ /** The environment the command runs with, through which mbx finds its session. */
18
+ environment(): NodeJS.ProcessEnv;
19
+ /** Told, never thrown. */
20
+ tell(text: string): void;
21
+ /** The bounds' next event. */
22
+ step(event: BoundEvent): void;
23
+ /** Whether the command is running a test. */
24
+ testing(): boolean;
25
+ readonly queueHost: QueueHost | undefined;
26
+ }
27
+ /** One run's view of the admission queue its leaf waits in. */
28
+ export declare class AdmissionObservation {
29
+ private readonly host;
30
+ /** mbx granted the leaf its cores. */
31
+ admitted: boolean;
32
+ private wait;
33
+ private requests;
34
+ /**
35
+ * Why the last admission snapshot failed, while the one after it has not succeeded; null otherwise. A snapshot only
36
+ * decides whether waiting on mbx admission is credited against the idle bound, so a failed one withholds that credit
37
+ * and ends nothing: the bounds decide, and an idle expiry names it.
38
+ */
39
+ private failure;
40
+ /** When the last successful snapshot completed (`Date.now()`): credit runs to it and no further. */
41
+ private confirmedAt;
42
+ private readonly abort;
43
+ private timer;
44
+ private snapshot;
45
+ private lastDiagnostic;
46
+ private lastDiagnosticAt;
47
+ private lastSnapshotDiagnostics;
48
+ constructor(host: ObservationHost);
49
+ /** Why the last snapshot failed, while the one after it has not succeeded. */
50
+ get unconfirmed(): string | null;
51
+ /**
52
+ * A reserved leaf's own request on its run's endpoint is its admission wait; a Cargo leaf's comes from mbx's report.
53
+ * `reserved` is whether the leaf holds a reservation of its own.
54
+ */
55
+ queueWait(reserved: boolean): AdmissionQueueWait | null;
56
+ /** A reserved leaf's request began to wait on its run's endpoint. */
57
+ waiting(): void;
58
+ /** Only mbx's activity report says whether a Cargo leaf's compiler or test waits in the pool: poll it. */
59
+ poll(): void;
60
+ /** The run ended: the wait stops counting and no snapshot is taken or credited again. */
61
+ stop(): void;
62
+ /** The snapshot in flight, if any, has finished. */
63
+ idle(): Promise<void>;
64
+ private unconfirm;
65
+ /** Take a snapshot; `fresh` drains an older poll first. */
66
+ refresh(fresh: boolean): Promise<void>;
67
+ }
68
+ //# sourceMappingURL=admission-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission-queue.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/admission-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAwC,MAAM,aAAa,CAAC;AAErG,OAAO,EAA4C,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,cAAc,CAAC;AAE/E;;;;GAIG;AAEH,8FAA8F;AAC9F,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,IAAI,IAAI,OAAO,CAAC;IAChB,6CAA6C;IAC7C,GAAG,IAAI,MAAM,GAAG,SAAS,CAAC;IAC1B,kFAAkF;IAClF,WAAW,IAAI,MAAM,CAAC,UAAU,CAAC;IACjC,0BAA0B;IAC1B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8BAA8B;IAC9B,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,6CAA6C;IAC7C,OAAO,IAAI,OAAO,CAAC;IACnB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAC3C;AAED,+DAA+D;AAC/D,qBAAa,oBAAoB;IAoBnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAnBjC,sCAAsC;IACtC,QAAQ,UAAS;IACjB,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,QAAQ,CAAmC;IACnD;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAuB;IACtC,oGAAoG;IACpG,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAC/C,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,uBAAuB,CAAM;IAErC,YAA6B,IAAI,EAAE,eAAe,EAAI;IAEtD,8EAA8E;IAC9E,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAItD;IAED,qEAAqE;IACrE,OAAO,IAAI,IAAI,CAEd;IAED,0GAA0G;IAC1G,IAAI,IAAI,IAAI,CAKX;IAED,yFAAyF;IACzF,IAAI,IAAI,IAAI,CAIX;IAED,oDAAoD;IAC9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;IAED,OAAO,CAAC,SAAS;IAmBjB,2DAA2D;IACrD,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C3C;CACF"}