diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..935104e --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,59 @@ +name: Benchmark + +on: + workflow_dispatch: + inputs: + fixtures: + description: Fixtures to install + default: small,medium,large + scenarios: + description: Scenarios to time + default: cold,lockfile,cache,cache+lockfile,up-to-date,stale + runs: + description: Timed runs per scenario + default: "5" + +permissions: + contents: read + +jobs: + benchmark: + runs-on: ubuntu-latest + timeout-minutes: 120 + + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Install hyperfine + run: sudo apt-get update && sudo apt-get install -y hyperfine + + - name: Build craft + run: cargo build --release -p craft + + - name: Install the package managers + working-directory: bench/tools + run: ../../target/release/craft ci + + - name: Race + env: + FIXTURES: ${{ inputs.fixtures }} + SCENARIOS: ${{ inputs.scenarios }} + RUNS: ${{ inputs.runs }} + run: bench/run.sh --fixtures "$FIXTURES" --scenarios "$SCENARIOS" --runs "$RUNS" --out bench/results/ci + + - name: Summarize + run: cat bench/results/ci/summary.md >> "$GITHUB_STEP_SUMMARY" + + - name: Upload the results + uses: actions/upload-artifact@v4 + with: + name: benchmark + path: bench/results/ci diff --git a/.gitignore b/.gitignore index 572fc8b..bf0990c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules .DS_Store /craft.lock +/bench/results diff --git a/Makefile b/Makefile index 0c18957..4ead87b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build test lint fmt craft real-world docs +.PHONY: build test lint fmt craft real-world docs bench all: build test lint @@ -22,6 +22,10 @@ docs: cargo build -q --release -p craft cd docs && ../target/release/craft install && ../target/release/craft run docs:dev +bench: + cargo build -q --release -p craft + bench/run.sh $(filter-out $@,$(MAKECMDGOALS)) + craft: cargo run -p craft -- $(filter-out $@,$(MAKECMDGOALS)) diff --git a/README.md b/README.md index 32b1988..3020289 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,23 @@ - 🧩 **npm-compatible**: ranges, dist-tags, aliases, git, tarball, `file:` and `link:` dependencies, peers, platform packages, and `.npmrc` registries and auth. - 🖥️ **Everywhere**: native binaries for Linux (glibc and musl), macOS and Windows. +## ⚡ Benchmarks + +

+ + + Install times of craft, npm, pnpm and Yarn for a Next.js app with 1,391 packages + +

+ +- **Warm cache:** 1.72 s with a lockfile and 1.78 s without, the fastest of the four. pnpm takes 1.80 s and 1.91 s, npm and Yarn 7–12 s. +- **Cold install:** 18.4 s, against pnpm's 28.8 s, Yarn's 30.0 s and npm's 63.0 s. +- **Already installed:** 6 ms, 6× faster than pnpm and over 100× faster than npm and Yarn. +- **Memory:** the leanest of the four in every scenario; 71 MB with a warm cache, where npm peaks at 2.9 GB. +- **Behind pnpm** once cached metadata is older than the registry's 5-minute `max-age`: craft checks every package with the registry and takes 7.35 s, while pnpm trusts its cache and takes 1.80 s. + +Every project, scenario and peak memory, and how it's kept fair: [Benchmarks](https://craftpkg.github.io/craft/guide/benchmarks) on the website, or the full tables in [`bench/README.md`](bench/README.md). + ## 🚀 Installation ```bash diff --git a/REMAINING.md b/REMAINING.md index f2a5244..5df499d 100644 --- a/REMAINING.md +++ b/REMAINING.md @@ -1,6 +1,6 @@ # Craft — Remaining Work -Status of the Rust package manager as of **2026-10-24**, and the ordered list of work needed to finalize it. +Status of the Rust package manager as of **2026-10-26**, and the ordered list of work needed to finalize it. Work through tasks top to bottom: each phase unblocks the next. Tick a task's box when it is merged. **Known-bug tests:** every open bug that has a scenario is an `#[ignore = "fixed by : …"]` end-to-end test in @@ -82,6 +82,16 @@ no lifecycle scripts, `craft run` doesn't put `.bin` on `PATH`. | 5.5 | Streaming downloads (hash while writing) | P2 | [x] | | 5.6 | Metadata disk cache (ETag / 304) | P2 | [x] | | 5.7 | Registry configuration (`.npmrc`, scopes, auth) | P1 | [x] | +| 5.8 | Clone whole store entries into `node_modules` | P2 | [x] | +| 5.9 | Lean packuments: abbreviated, parsed lazily, not all kept (supersedes 5.1) | P2 | [x] | +| 5.10 | Fetch tarballs off the resolution path | P2 | [ ] | +| 5.11 | Install straight from the lockfile's graph | P2 | [ ] | +| 5.12 | Extract while downloading | P2 | [ ] | +| 5.13 | One network client, fewer manifest reads, no graph clones | P2 | [ ] | +| 5.14 | Benchmark: isolate pnpm's store, add a stale-cache scenario | P2 | [x] | +| 5.15 | Skip freeing memory at exit | P2 | [x] | +| 5.16 | Link while importing, prune only what changed | P2 | [x] | +| 5.17 | Trust fresh-enough metadata (minimum release age) | P2 | [ ] | | **Phase 6 — CLI & UX** | | | | | 6.1 | Progress output and install summary | P2 | [x] | | 6.2 | Error reporting (no panics, contextual messages) | P2 | [x] | @@ -637,7 +647,9 @@ README says "`package-lock.json` support (coming soon)" — decide whether that Measured: cold install of this repo's `package.json` ≈ 4.8 s, 149 MB RSS; warm ≈ 3.3 s. -### 5.1 Abbreviated packuments · P2 — ⏸ deferred +**Benchmark findings (2026-10-25).** `make bench` (`bench/README.md`) races craft against npm, pnpm and Yarn. craft wins already-installed projects by 6–140×, but loses every warm-cache scenario to pnpm by 2–6×, cold installs of `large` by 2.6× (an artefact: pnpm was reaching its existing store, see 5.14), and peaks at 5.5 GB without a lockfile (pnpm: 663 MB). Profiling `large` (1,391 packages, 112,916 files) traced it to four causes, fixed by 5.8–5.13. A second round after 5.8 (2026-10-26) added 5.14–5.17; work through them as 5.14, 5.15, 5.16, 5.9, 5.17, then 5.10–5.13. After each, run `make` and `make bench`, and update the tables in `bench/README.md`. Memory budget for `large`: under 500 MB peak without a lockfile, under 150 MB with one; every new concurrent stage reuses an existing limit. + +### 5.1 Abbreviated packuments · P2 — ⏸ deferred, superseded by 5.9 > Deferred after measuring: the registry's abbreviated ("corgi") manifests drop `libc` (so `@rollup/rollup-linux-x64-musl` and `-gnu` become indistinguishable on Linux, breaking 4.2) and `scripts` (only `hasInstallScript` remains), and with gzip from 5.4 the saving is small — `typescript` 2.02 MB full vs 1.70 MB abbreviated compressed, `@types/node` 1.43 vs 1.11 MB. Revisit with a fallback to the full manifest for packages whose `os` includes `linux`. Meanwhile install scripts are read from the installed package's own package.json, which also covers registries that serve abbreviated metadata. @@ -685,6 +697,95 @@ Measured: cold install of this repo's `package.json` ≈ 4.8 s, 149 MB RSS; warm - URL-encode scoped names: `@scope%2fname`. - Never log tokens (verbose mode prints URLs). +### 5.8 Clone whole store entries · P2 — ✔ done + +> Done: on macOS, `fsutil::import_dir` clones a store entry into its staging directory with one `clonefile` call (through `reflink-copy`) and renames it in as before. When the filesystem can't (not APFS, another volume) it falls back to the per-file clone → hardlink → copy path for the rest of the process; other failures fall back for that package only. Copies that skip entries (`file:` directories) stay per file. Measured with `make bench` (warm cache and lockfile): `large` 9.03 s → 1.97 s (pnpm 1.85 s), `medium` 756 → 254 ms (pnpm 271 ms), `small` 286 → 135 ms (pnpm 212 ms); without a lockfile `large` 12.78 → 5.54 s. Memory unchanged. Linux is unchanged and still unmeasured. + +Warm-cache installs spend their time in the kernel: `fsutil::copy::copy_tree` clones file by file, 112,916 `clonefileat` calls for `large`. A warm-cache install with a lockfile measured 16 s wall, 0.5 s user, 48 s sys and 491k involuntary context switches. Cloning the same store per file took 15.9 s on one thread and about 9 s on 4–16 threads; `clonefile()` once per package directory took **1.15 s** for all 1,246 entries. + +- On macOS, import a store entry with one `clonefile(entry, staging)` and keep the staging-then-rename publish. Fall back to the per-file path when it fails (another volume, not APFS). +- Linux keeps per-file reflinks or hardlinks; get a Linux baseline from the Benchmark workflow before tuning it. +- Packages whose install scripts run keep getting a real copy (`replace_with_copy`). +- Expected: `large` warm cache with a lockfile, 9 s → about 2 s. + +### 5.9 Lean packuments · P2 — ✔ done + +> Done: craft requests abbreviated packuments and caches each one as `.packument`: a format line, a JSON header holding the dist-tags and every version's offset and length, then the manifests as the registry sent them. Resolving reads only the header, picks a version, and parses only that manifest, re-reading the header from the same open file so a packument another install rewrote meanwhile still reads consistently. The old `.json` is deleted when its packument is written again. Abbreviated manifests lack `libc`, so for a version whose `os` includes `linux` and that declares no `libc`, craft fetches the full manifest from `//` and caches it for good; `craft.lock` keeps every package's `libc` as before. Measured with `make bench` (no lockfile): warm cache `large` 4.29 → 1.78 s and 5.5 GB → 71 MB (pnpm 1.91 s, 401 MB), `medium` 982 → 229 ms (pnpm 282 ms), `small` 243 → 107 ms (pnpm 147 ms); cold `large` 31.08 → 18.38 s (pnpm 28.82 s) and 5.5 GB → 418 MB; past the `max-age` `large` 8.50 → 7.35 s, still behind pnpm's 1.80 s (5.17). + +Without a lockfile, craft peaks at 5.5 GB on `large`. It requests full packuments (no `Accept` header): 1.1 GB on disk for 1,280 names, with vite 37 MB, next 30 MB and firebase 29 MB. It parses every version into `PackageJson`, whose `#[serde(flatten)] other: HashMap` turns each field into a JSON tree. Then it keeps all of them in `NpmResolver.packuments` until the install ends. Abbreviated metadata is far smaller (vite 37 MB → 2.3 MB, firebase 29 → 9.6 MB), but not always (next 30 → 25 MB, from thousands of canaries), so parsing must get lazier too. + +- Send `Accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*`, and give the metadata cache a new directory for the new format. +- Parse `versions` as raw JSON (`Box`); select from the keys and `dist-tags`; fully parse only the chosen version into a typed manifest without a flattened catch-all map. Keep only that per name. +- Store it like pnpm's `pnpm-meta-v1` cache: each file starts with a small index of `dist-tags` and every version with the byte offset and length of its manifest, so resolution reads the index, picks a version, and parses only that version's bytes. +- Measured 2026-10-26 (`large`, fresh cache): resolution takes 2.6 s and about 3 s of CPU, almost all of it reading and parsing 1.1 GB of JSON; pnpm resolves the same tree in about 0.15 s from its indexed cache. Expected: a few hundred milliseconds, peak memory under 500 MB. +- `libc`, which 5.1 was deferred over: abbreviated manifests lack it, so a package for the other Linux libc is downloaded, then skipped once its own `package.json` shows `libc`. That costs a few small downloads on Linux and never installs the wrong package. Scripts are already read from the installed `package.json`. + +### 5.10 Fetch tarballs off the resolution path · P2 + +`InstallPipe::resolve_package` downloads and extracts a package before resolving its dependencies, so a cold install's critical path is tree depth × (metadata request + download + extraction): 31–37 s for `large`, level with Yarn's 30 s, while 5.11's empty-cache install with a lockfile shows the same waterfall at 20 s against npm's 12 s. + +- Resolve dependencies from the packument as soon as a version is chosen; start each tarball's fetch as its own task, bounded by the network and extraction permits, and join them all before linking. + +### 5.11 Install straight from the lockfile's graph · P2 + +`craft.lock` records every package's resolved `dependencies`, `peerDependencies` and `optionalDependencies`, but `LockPreferences` keeps only versions and returns `package: None`. A package's dependencies are therefore found by extracting it and reading its `package.json`, the same waterfall again: 22 s for `large` with an empty cache, against npm's 13.5 s. + +- When package.json matches craft.lock, build the `ResolutionGraph` from the lockfile alone, fetch every missing tarball in one parallel pass (5.10), and read bins from the store while linking. When only some dependencies changed, re-resolve just those. +- Test with the mock registry: a lockfile install makes no packument requests and downloads in parallel. + +### 5.12 Extract while downloading · P2 + +Each tarball is written to disk, reopened and extracted, with a `create_dir_all` and a separate `set_permissions` per file. + +- Decompress and unpack the response stream into the staging directory while hashing the compressed bytes; rename into the store only once the integrity matches. +- flate2's `zlib-rs` backend; create files with their mode; skip directories already created. + +### 5.13 One network client, fewer manifest reads, no graph clones · P2 + +- `Resolver` and `NpmResolver` each build a `Network`: two connection pools and two `network-concurrency` semaphores. Share one. +- `LifecyclePipe::pending` reads `package.json` for every package on every install (1,243 for `large`); filter by `trustedDependencies` first. +- The graph is cloned whole into the linker and the scripts pass, every node carrying its manifest; borrow it or share it behind an `Arc`. +- Then tune metadata concurrency over HTTP/2 against the benchmark rather than by guess. +- `bench/report.mjs`: report peak memory for every fixture, so each change is judged on time and memory. +- The scripts scan is 0.15 s of a 1.97 s install on `large` with a lockfile (measured 2026-10-26). + +### 5.14 Benchmark: isolate pnpm's store, add a stale-cache scenario · P2 — ✔ done + +> Done: `bench/run.sh` gives pnpm `PNPM_HOME` inside its own home and unsets `npm_config_*`, `PNPM_*`, `YARN_*` and `COREPACK_*` from the caller's environment. The new `stale` scenario copies each home right after setup, waits until the registry's 300 s `max-age` has passed, and restores the copy before every run. Re-measured 2026-10-26: pnpm's cold install of `large` is 43.65 s, not 14.26 s, and craft (31.08 s) is level with Yarn (29.80 s); past the `max-age`, `large` takes craft 9.72 s, npm 40.50 s, Yarn 10.46 s and pnpm 1.79 s. + +pnpm keeps its store under `PNPM_HOME`, not `HOME`, so a `PNPM_HOME` exported by the shell leaks into the benchmark: every run so far used and wrote to the user's own `~/Library/pnpm/store/v11` (25 GB). pnpm's cold and lockfile-with-empty-cache rows therefore had its tarballs already; its warm rows are unaffected. + +- Set `PNPM_HOME` to the package manager's own home in `install_command`, and check for other variables that leak the same way (`npm_config_*`, `YARN_*`, `COREPACK_*`). +- Re-run the cold and lockfile scenarios and replace those rows in `bench/README.md`. +- Add a scenario whose metadata cache is older than the registry's `max-age` (300 s). In the warm-cache scenario every run lands within it, which hides that craft then revalidates every packument: 22–24 s on `large`, against pnpm's 2.0 s. + +### 5.15 Skip freeing memory at exit · P2 — ✔ done + +> Done: `InstallPipe::into_graph` resolves the graph and then leaks the pipe, with the resolver's packuments, instead of dropping it; `install`, `update` and `add` use it. Measured with `make bench` (no lockfile): warm cache `large` 5.54 → 4.47 s, `medium` 1.37 → 1.02 s, `small` 307 → 263 ms; past the `max-age` `large` 9.72 → 8.50 s. Peak memory unchanged (5.9). While measuring, the `large` warm-cache runs turned out to cross the registry's `max-age` mid-run, since setting up all four package managers takes about 4.7 minutes: `bench/run.sh` now times each package manager on its own and sets it up again right before its warm-cache runs. + +Without a lockfile, `large` spends about 1 s after its last phase dropping 5.8 GB of parsed packuments and the graph. Leaving the resolver undropped took the install from 5.62 s to 4.65 s. + +- At the end of a command, leak the resolver and the graph (`std::mem::forget`) instead of dropping them; the process exits right after and the OS reclaims the memory. Keep the lockfile and state writes before it. +- Still worth it after 5.9, which shrinks the memory but not the graph. + +### 5.16 Link while importing, prune only what changed · P2 — ✔ done + +> Done: `LinkerPipe` creates every dependency link, the hoisted links and the root links while the imports run, then links bins once the imports are in (linking a bin makes its file executable). Hoisting runs concurrently instead of one link at a time. Pruning is skipped when `node_modules` didn't exist before the install; otherwise `prune_to_graph` keeps exactly the graph's entries and roots, without following every link in the virtual store. `craft remove` still prunes by reachability. Measured with `make bench` (warm cache and lockfile): `large` 1.97 → 1.72 s (pnpm 1.80 s), `medium` 254 → 217 ms (pnpm 246 ms), `small` 135 → 103 ms (pnpm 128 ms); without a lockfile, `large` 4.47 → 4.29 s. Short of the 1.3 s expected: dependency links compete with the clones and finish only about 60 ms after them. What's left besides the clones is the scripts scan (0.155 s) and copying the graph into the linker (about 0.06–0.1 s), both in 5.13. + +After 5.8, `large` with a warm cache and a lockfile takes 1.97 s against pnpm's 1.85 s. Measured breakdown: resolving from the lockfile 60–90 ms, cloning 1,249 entries 1.22–1.35 s, linking dependencies 0.19 s, hoisting 0.14 s, pruning 0.20 s, the scripts scan 0.15 s (5.13). The clone is a floor: one `clonefile` per entry takes 1.15–1.20 s on 1 to 32 threads, as APFS serializes them (hardlinking the same files took 13.5 s). pnpm 12 is a native binary that calls the same `clonefile`, so craft wins only by cutting the rest. + +- Link each entry's dependencies as soon as that entry is imported, and run hoisting and the root links concurrently, not one link at a time. Symlinking mostly overlaps with clones: 1.20 s + 0.26 s apart, 1.35 s together. +- Skip pruning when `node_modules` didn't exist before the install. On an update, prune what the previous `node_modules/.craft/state` has and the new graph lacks, instead of reading every link in the virtual store. +- Expected with 5.13's scripts scan: `large` about 1.3 s, ahead of pnpm. The same applies without a lockfile, where linking takes 1.8 s. +- Below the clone floor only a shared global virtual store would go (projects symlink entries in a store-wide `links` directory, as pnpm's opt-in global virtual store does). It breaks packages that rely on undeclared dependencies, so leave it for later, opt-in. + +### 5.17 Trust fresh-enough metadata (minimum release age) · P2 + +Once a cached packument is older than its `max-age` (300 s on the npm registry), craft revalidates it before resolving, one dependency level at a time and 16 at a time, and any packument that changed comes back in full: 22–24 s for `large`. pnpm installed the same project without a lockfile in 2.0 s from a cache about 21 hours old, with no network connections at all (sampled throughout the install, and it also succeeded against an unreachable registry). Its cache records `minimumReleaseAge: 1440`. When versions younger than that age aren't eligible, a packument cached more recently than that age already lists every version resolution may choose. + +- Add `minimum-release-age` (pnpm's `.npmrc` key, in minutes): versions published more recently are skipped while resolving, which also protects against freshly published malicious versions. Use a cached packument without asking while it is younger than that age. Whether craft defaults to pnpm's one day is a behaviour change to decide. +- Without it, still revalidate every name the cache holds in parallel, ahead of the dependency walk instead of level by level. 5.9's abbreviated metadata keeps the changed responses small. + --- ## Phase 6 — CLI & UX diff --git a/apps/craft/tests/e2e/cache.rs b/apps/craft/tests/e2e/cache.rs index 50e8a6c..66404a1 100644 --- a/apps/craft/tests/e2e/cache.rs +++ b/apps/craft/tests/e2e/cache.rs @@ -27,6 +27,17 @@ fn installed_twice(registry: &MockRegistry, second_args: &[&str]) -> Project { second } +#[test] +fn requests_abbreviated_metadata() { + let registry = MockRegistry::start(); + publish_debug(®istry); + let project = Project::new(®istry, json!({ "dependencies": { "debug": "^4.0.0" } })); + + project.craft().arg("install").assert().success(); + + assert_eq!(registry.abbreviated_responses(), 2); +} + #[test] fn revalidates_cached_metadata_with_etags() { let registry = MockRegistry::start(); diff --git a/apps/craft/tests/e2e/platforms.rs b/apps/craft/tests/e2e/platforms.rs index e7152fa..e7119c4 100644 --- a/apps/craft/tests/e2e/platforms.rs +++ b/apps/craft/tests/e2e/platforms.rs @@ -132,6 +132,34 @@ fn locks_every_platform_so_the_lockfile_installs_anywhere() { assert_eq!(binary(&mac), "darwin-arm64"); } +#[test] +fn locks_the_libc_of_linux_packages_it_never_downloads() { + let registry = MockRegistry::start(); + publish_esbuild(®istry); + let mac = Project::new( + ®istry, + json!({ "dependencies": { "esbuild": "0.25.0" } }), + ); + craft_for(&mac, "darwin", "arm64", "") + .arg("install") + .assert() + .success(); + let lock = mac.read_file("craft.lock"); + let parsed: Value = serde_json::from_str(&lock).expect("craft.lock is JSON"); + assert_eq!( + parsed["packages"]["@esbuild/linux-x64-musl@0.25.0"]["libc"], + json!(["musl"]) + ); + + let linux = mac.sibling(json!({ "dependencies": { "esbuild": "0.25.0" } })); + linux.write_file("craft.lock", &lock); + craft_for(&linux, "linux", "x64", "musl") + .args(["install", "--frozen-lockfile"]) + .assert() + .success(); + assert_eq!(binary(&linux), "linux-x64-musl"); +} + #[test] fn skips_optional_dependencies_that_fail_to_install() { let registry = MockRegistry::start(); diff --git a/bench/README.md b/bench/README.md new file mode 100644 index 0000000..f59ca99 --- /dev/null +++ b/bench/README.md @@ -0,0 +1,112 @@ +# Benchmarks + +Races `craft install` against npm, pnpm and Yarn on real projects, timed with [hyperfine](https://github.com/sharkdp/hyperfine). + +```sh +make bench # every fixture and scenario, 5 runs each +make bench -- --fixtures small --runs 3 # a quick round +bench/run.sh --pms craft,pnpm --scenarios cold,up-to-date +``` + +It needs Node.js and hyperfine (`brew install hyperfine`, `apt install hyperfine`). The package managers it races are pinned in `tools/package.json` and installed there on the first run. Results go to `bench/results//`: a `summary.md` table, hyperfine's JSON for each scenario, and the lockfile each package manager wrote. + +The **Benchmark** workflow runs it on a GitHub-hosted Ubuntu runner (Actions → Benchmark → Run workflow), puts the table in the run's summary and uploads the results. + +## Results + +2026-10-25 and 2026-10-26 · macOS, Apple M5 Max, 18 cores, 48 GB · `craft 0.1.0` · `npm 12.2.1` · `pnpm 12.15.0` · `yarn 4.18.1` · `node 24.18.0` + +Mean wall time of 5 runs ± standard deviation, with the fastest in bold and how many times slower the others are. Rows were measured again, for all four, as craft changed: empty cache after pnpm's store was isolated (5.14 in `REMAINING.md`); warm cache with a lockfile and already installed after craft started linking while it imports (5.16); cold, warm cache and stale cache after craft started reading abbreviated metadata (5.9). To refresh, run `make bench` and replace these tables with its `summary.md`. + +### small + +An Express API server, 186 packages. + +| | craft | npm | pnpm | yarn | +|---|---:|---:|---:|---:| +| Cold: no cache, no lockfile | **1.33 s ± 120 ms** | 2.97 s ± 444 ms (2.2×) | 2.77 s ± 59 ms (2.1×) | 2.40 s ± 210 ms (1.8×) | +| Lockfile, empty cache | **1.06 s ± 74 ms** | 1.36 s ± 322 ms (1.3×) | 4.54 s ± 1.25 s (4.3×) | 2.26 s ± 381 ms (2.1×) | +| Warm cache, no lockfile | **107 ms ± 1.8 ms** | 758 ms ± 7.1 ms (7.1×) | 147 ms ± 1.7 ms (1.4×) | 1.07 s ± 109 ms (10.0×) | +| Warm cache past its max-age, no lockfile | 633 ms ± 47 ms (4.0×) | 1.89 s ± 226 ms (12.0×) | **157 ms ± 8.3 ms** | 1.01 s ± 95 ms (6.4×) | +| Warm cache and lockfile | **103 ms ± 5.0 ms** | 442 ms ± 4.9 ms (4.3×) | 128 ms ± 2.4 ms (1.2×) | 459 ms ± 5.0 ms (4.4×) | +| Already installed | **4.3 ms ± 0.2 ms** | 171 ms ± 1.1 ms (39.9×) | 35 ms ± 1.3 ms (8.2×) | 226 ms ± 0.9 ms (52.8×) | + +### medium + +A Vite and React single-page app, 293 packages. + +| | craft | npm | pnpm | yarn | +|---|---:|---:|---:|---:| +| Cold: no cache, no lockfile | **4.83 s ± 274 ms** | 11.28 s ± 780 ms (2.3×) | 6.13 s ± 203 ms (1.3×) | 6.36 s ± 319 ms (1.3×) | +| Lockfile, empty cache | **2.40 s ± 43 ms** | 2.78 s ± 356 ms (1.2×) | 11.86 s ± 5.82 s (4.9×) | 4.43 s ± 1.04 s (1.8×) | +| Warm cache, no lockfile | **229 ms ± 4.9 ms** | 2.28 s ± 23 ms (10.0×) | 282 ms ± 3.7 ms (1.2×) | 1.67 s ± 76 ms (7.3×) | +| Warm cache past its max-age, no lockfile | 917 ms ± 44 ms (3.4×) | 4.93 s ± 816 ms (18.4×) | **268 ms ± 3.1 ms** | 1.62 s ± 82 ms (6.1×) | +| Warm cache and lockfile | **217 ms ± 13 ms** | 946 ms ± 3.0 ms (4.4×) | 246 ms ± 8.1 ms (1.1×) | 935 ms ± 22 ms (4.3×) | +| Already installed | **4.5 ms ± 0.1 ms** | 197 ms ± 1.3 ms (43.6×) | 35 ms ± 0.8 ms (7.8×) | 299 ms ± 0.8 ms (66.4×) | + +### large + +A Next.js app with a design system, cloud SDKs, Storybook, Jest, Playwright and a webpack toolchain, 1391 packages. + +| | craft | npm | pnpm | yarn | +|---|---:|---:|---:|---:| +| Cold: no cache, no lockfile | **18.38 s ± 1.73 s** | 62.98 s ± 14.08 s (3.4×) | 28.82 s ± 3.42 s (1.6×) | 29.97 s ± 7.11 s (1.6×) | +| Lockfile, empty cache | 19.82 s ± 10.01 s (1.6×) | **12.03 s ± 424 ms** | 29.34 s ± 10.30 s (2.4×) | 20.08 s ± 6.06 s (1.7×) | +| Warm cache, no lockfile | **1.78 s ± 13 ms** | 12.38 s ± 236 ms (6.9×) | 1.91 s ± 66 ms (1.1×) | 9.58 s ± 138 ms (5.4×) | +| Warm cache past its max-age, no lockfile | 7.35 s ± 655 ms (4.1×) | 41.53 s ± 3.01 s (23.1×) | **1.80 s ± 9.1 ms** | 9.64 s ± 149 ms (5.4×) | +| Warm cache and lockfile | **1.72 s ± 12 ms** | 7.26 s ± 57 ms (4.2×) | 1.80 s ± 34 ms (1.0×) | 7.67 s ± 26 ms (4.5×) | +| Already installed | **5.9 ms ± 0.3 ms** | 673 ms ± 1.8 ms (113.8×) | 35 ms ± 0.6 ms (6.0×) | 900 ms ± 3.0 ms (152.2×) | + +Peak memory on `large`, which hyperfine 2 records alongside the time: + +| | craft | npm | pnpm | yarn | +|---|---:|---:|---:|---:| +| Cold: no cache, no lockfile | **418 MB** | 841 MB | 792 MB | 4.9 GB | +| Lockfile, empty cache | **126 MB** | 613 MB | 513 MB | 4.1 GB | +| Warm cache, no lockfile | **71 MB** | 2.9 GB | 401 MB | 2.2 GB | +| Warm cache past its max-age, no lockfile | **67 MB** | 2.6 GB | 398 MB | 2.1 GB | +| Warm cache and lockfile | **93 MB** | 2.0 GB | 219 MB | 1.7 GB | +| Already installed | **13 MB** | 254 MB | 49 MB | 334 MB | + +### What it shows + +- **Already installed** is craft's clear win: it answers from `node_modules/.craft/state` in about 5 ms, 6–9× faster than pnpm and 40–150× faster than npm and Yarn. +- **Warm cache with a lockfile:** craft now wins on all three. It clones each package from the store with one `clonefile` call and links while the clones run (`large`: 9.03 s → 1.72 s, pnpm 1.80 s). +- **Warm cache without a lockfile:** craft now wins on all three too. It reads the registry's abbreviated metadata and keeps it on disk indexed by version, parsing only the manifest it picks (`large`: 4.29 s → 1.78 s and 5.5 GB → 71 MB, pnpm 1.91 s). +- **Past the registry's 5-minute `max-age`**, craft and npm revalidate every packument and fall 3–23× behind pnpm, which resolves from its cache without a single request (5.17). Yarn doesn't slow down either. +- **Cold installs:** craft is fastest on all three (`large`: 18.4 s, pnpm 28.8 s, Yarn 30.0 s, npm 63.0 s), helped by abbreviated metadata being a fraction of the full packuments. +- **Lockfile, empty cache:** craft is fastest on `small` and `medium`; on `large` npm leads (12.0 s to craft's 19.8 s). +- **Memory:** craft is the leanest of the four in every scenario, peaking at 418 MB for a cold `large` install, where Yarn reaches 4.9 GB. +- **Cold and empty-cache** runs are bound by the registry and the network: their deviations reach 50%, so differences under about 1.5× there aren't meaningful. + +## Fixtures + +| | | +|---|---| +| `small` | An Express API server | +| `medium` | A Vite and React single-page app, with ESLint, Vitest and Tailwind | +| `large` | A Next.js app with MUI, Firebase and the AWS SDK, plus Storybook, Jest, Playwright, Cypress and webpack | + +A fixture is a directory holding a `package.json`; add one and pass its name to `--fixtures`. Every package manager must be able to install it without flags such as `--legacy-peer-deps`. + +## Scenarios + +| | Cache | Lockfile | node_modules | Like | +|---|:-:|:-:|:-:|---| +| `cold` | | | | a first install on a new machine | +| `lockfile` | | ✓ | | CI without a cache | +| `cache` | ✓ | | | adding a project on a machine that has installed before | +| `cache+lockfile` | ✓ | ✓ | | CI with a cache, or a fresh clone | +| `up-to-date` | ✓ | ✓ | ✓ | running install again | +| `stale` | older than `max-age` | | | installing again later that day | + +Before `cache`, each package manager is set up again right before its own runs, so its metadata stays within the registry's `max-age` throughout. `stale` restores each package manager's home as setup left it, waiting first until the registry's 5-minute `max-age` has passed, so each one decides for itself whether its cached metadata is still good enough. + +## Keeping it fair + +- Each package manager gets its own `HOME` (and XDG directories, and pnpm its `PNPM_HOME`), so its cache, store and config start empty, and your own `.npmrc` or `.yarnrc.yml` don't apply. Deleting that home is what empties its cache. `npm_config_*`, `PNPM_*`, `YARN_*` and `COREPACK_*` variables from your shell are unset. +- Each one installs the fixture once before timing, and the run fails unless every direct dependency is in `node_modules`. The lockfile from that install is restored before every run that has one. +- No install scripts run: npm, pnpm and Yarn get `--ignore-scripts` (Yarn `enableScripts: false`), and craft runs none because the fixtures trust no package. +- npm skips `audit` and `fund`, which are extra requests after the install. Yarn uses the `node-modules` linker, so everyone writes a `node_modules`. +- `CI=false` is set, so no one switches to frozen or immutable installs. +- Everything else is each package manager's default. Every install hits the real npm registry, so cold and lockfile numbers move with the network; compare them within one run, not across runs. diff --git a/bench/fixtures/large/package.json b/bench/fixtures/large/package.json new file mode 100644 index 0000000..b4c5481 --- /dev/null +++ b/bench/fixtures/large/package.json @@ -0,0 +1,51 @@ +{ + "name": "bench-large", + "description": "A Next.js app with a design system, cloud SDKs, Storybook, Jest, Playwright and a webpack toolchain", + "private": true, + "dependencies": { + "@apollo/client": "^4.3.5", + "@aws-sdk/client-s3": "^3.1156.0", + "@emotion/react": "^11.14.0", + "@emotion/styled": "^11.14.1", + "@mui/icons-material": "^9.5.0", + "@mui/material": "^9.5.0", + "@reduxjs/toolkit": "^2.13.0", + "axios": "^1.20.0", + "date-fns": "^4.4.0", + "firebase": "^13.1.0", + "graphql": "^17.0.2", + "lodash": "^4.18.1", + "next": "^16.4.3", + "react": "^19.3.1", + "react-dom": "^19.3.1", + "react-redux": "^9.3.0" + }, + "devDependencies": { + "@babel/core": "^8.0.9", + "@babel/preset-env": "^8.0.7", + "@babel/preset-react": "^8.0.1", + "@babel/preset-typescript": "^8.0.7", + "@playwright/test": "^1.64.1", + "@storybook/react-vite": "^10.6.3", + "@types/jest": "^30.0.0", + "@types/lodash": "^4.17.27", + "@types/node": "^26.6.5", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "babel-jest": "^30.5.2", + "cypress": "^16.2.0", + "eslint": "^10.13.0", + "eslint-config-next": "^16.4.3", + "husky": "^9.1.7", + "jest": "^30.5.2", + "lint-staged": "^17.6.0", + "prettier": "^3.9.10", + "sass": "^1.106.1", + "storybook": "^10.6.3", + "ts-node": "^10.9.2", + "typescript": "~6.0.3", + "webpack": "^5.112.2", + "webpack-cli": "^7.2.3", + "webpack-dev-server": "^6.1.0" + } +} diff --git a/bench/fixtures/medium/package.json b/bench/fixtures/medium/package.json new file mode 100644 index 0000000..19b13f0 --- /dev/null +++ b/bench/fixtures/medium/package.json @@ -0,0 +1,31 @@ +{ + "name": "bench-medium", + "description": "A Vite and React single-page app", + "private": true, + "dependencies": { + "@tanstack/react-query": "^5.104.5", + "clsx": "^2.1.1", + "react": "^19.3.1", + "react-dom": "^19.3.1", + "react-router": "^8.5.0", + "zustand": "^5.0.16" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@tailwindcss/vite": "^4.3.3", + "@testing-library/jest-dom": "^7.0.1", + "@testing-library/react": "^16.3.3", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", + "@vitejs/plugin-react": "^6.1.2", + "eslint": "^10.13.0", + "eslint-plugin-react-hooks": "^7.1.1", + "jsdom": "^30.1.3", + "prettier": "^3.9.10", + "tailwindcss": "^4.3.3", + "typescript": "~6.0.3", + "typescript-eslint": "^8.72.0", + "vite": "^8.3.5", + "vitest": "^5.0.5" + } +} diff --git a/bench/fixtures/small/package.json b/bench/fixtures/small/package.json new file mode 100644 index 0000000..d569d2f --- /dev/null +++ b/bench/fixtures/small/package.json @@ -0,0 +1,26 @@ +{ + "name": "bench-small", + "description": "An Express API server", + "private": true, + "dependencies": { + "bcryptjs": "^3.0.3", + "cors": "^2.8.6", + "dotenv": "^18.0.9", + "express": "^5.3.0", + "helmet": "^8.3.0", + "jsonwebtoken": "^9.0.3", + "morgan": "^1.12.1", + "pg": "^8.23.1", + "pino": "^10.4.0", + "zod": "^4.6.7" + }, + "devDependencies": { + "@types/cors": "^2.8.19", + "@types/express": "^5.0.6", + "@types/jsonwebtoken": "^9.0.10", + "@types/node": "^26.6.5", + "nodemon": "^3.1.14", + "tsx": "^4.23.15", + "typescript": "~6.0.3" + } +} diff --git a/bench/publish.mjs b/bench/publish.mjs new file mode 100644 index 0000000..fae457b --- /dev/null +++ b/bench/publish.mjs @@ -0,0 +1,149 @@ +// Publishes benchmark results to the website and the README: the data behind the docs' +// benchmark charts, and the chart image the README shows. Takes one or more result +// directories; a scenario measured in a later one replaces the same scenario from an earlier. +// +// node bench/publish.mjs bench/results/ [bench/results/ ...] +import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' +import { cpus, totalmem } from 'node:os' +import { join } from 'node:path' + +import { + FIXTURES, + SCENARIOS, + fixtureManifest, + formatRatio, + formatSeconds, + packageCount, + readScenario, +} from './results.mjs' + +const runs = process.argv.slice(2) +if (runs.length === 0) { + console.error('usage: node bench/publish.mjs ...') + process.exit(2) +} + +const root = new URL('../', import.meta.url).pathname +const data = { + date: new Date().toISOString().slice(0, 10), + machine: `${process.platform === 'darwin' ? 'macOS' : process.platform}, ${cpus()[0].model}, ${cpus().length} cores, ${Math.round(totalmem() / 2 ** 30)} GB`, + versions: readVersions(runs.at(-1)), + scenarios: Object.entries(SCENARIOS).map(([id, label]) => ({ id, label })), + fixtures: FIXTURES.map(fixtureData).filter((fixture) => fixture.scenarios.length > 0), +} + +const dataPath = join(root, 'docs/.vitepress/theme/benchmarks.json') +mkdirSync(join(root, 'docs/.vitepress/theme'), { recursive: true }) +writeFileSync(dataPath, `${JSON.stringify(data, null, 2)}\n`) +console.log(`wrote ${dataPath}`) + +const large = data.fixtures.find((fixture) => fixture.name === 'large') +if (large) { + for (const [theme, colors] of Object.entries(themes())) { + const path = join(root, `docs/public/benchmarks-${theme}.svg`) + writeFileSync(path, chart(large, colors)) + console.log(`wrote ${path}`) + } +} + +function fixtureData(name) { + const scenarios = [] + let packages + for (const id of Object.keys(SCENARIOS)) { + for (const run of runs) { + const results = readScenario(run, name, id) + if (!results) { + continue + } + packages = packageCount(run, name) ?? packages + const measured = results.map(({ name: pm, mean, stddev, memory }) => ({ pm, mean, stddev, memory })) + const existing = scenarios.findIndex((scenario) => scenario.id === id) + const scenario = { id, results: measured } + if (existing === -1) { + scenarios.push(scenario) + } else { + scenarios[existing] = scenario + } + } + } + return { name, description: fixtureManifest(name).description, packages, scenarios } +} + +function readVersions(run) { + return Object.fromEntries( + readFileSync(join(run, 'versions.txt'), 'utf8') + .trim() + .split('\n') + .map((line) => line.split(' ')), + ) +} + +// The README chart: the large fixture's everyday scenarios, one panel each, bars scaled per panel. +function chart(fixture, colors) { + const panels = ['cache+lockfile', 'cache', 'cold', 'up-to-date'] + .map((id) => fixture.scenarios.find((scenario) => scenario.id === id)) + .filter(Boolean) + const width = 760 + const labelWidth = 64 + const valueWidth = 150 + const barHeight = 18 + const rowGap = 8 + const panelGap = 30 + const titleHeight = 26 + const headerHeight = 54 + const barArea = width - labelWidth - valueWidth - 24 + + let y = headerHeight + const parts = [ + `Installing a ${fixture.packages.toLocaleString('en-US')}-package Next.js app`, + `Mean wall time, lower is better · ${escape(data.machine)} · ${data.date}`, + ] + for (const panel of panels) { + const label = SCENARIOS[panel.id] + parts.push(`${escape(label)}`) + y += titleHeight + const fastest = Math.min(...panel.results.map((result) => result.mean)) + const slowest = Math.max(...panel.results.map((result) => result.mean)) + for (const result of panel.results) { + const barWidth = Math.max(2, (result.mean / slowest) * barArea) + const isCraft = result.pm === 'craft' + const isFastest = result.mean === fastest + const ratio = isFastest ? 'fastest' : formatRatio(result.mean / fastest) + const fill = isCraft ? colors.craft : colors.other + parts.push( + `${result.pm}`, + ``, + `${formatSeconds(result.mean)} ${ratio}`, + ) + y += barHeight + rowGap + } + y += panelGap - rowGap + } + + const height = y - panelGap + rowGap + 8 + return ` + +${parts.join('\n')} + +` +} + +function themes() { + return { + light: { text: '#1f2328', muted: '#656d76', craft: '#f07020', craftText: '#c2410c', other: '#d0d7de' }, + dark: { text: '#e6edf3', muted: '#8d96a0', craft: '#fb923c', craftText: '#fdba74', other: '#3d444d' }, + } +} + +function escape(text) { + return text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>') +} diff --git a/bench/report.mjs b/bench/report.mjs new file mode 100644 index 0000000..0b6a48a --- /dev/null +++ b/bench/report.mjs @@ -0,0 +1,88 @@ +import { readdirSync, readFileSync } from 'node:fs' +import { cpus, totalmem } from 'node:os' +import { join } from 'node:path' + +import { + FIXTURES, + SCENARIOS, + fixtureManifest, + formatBytes, + formatSeconds, + packageCount, + readScenario, +} from './results.mjs' + +const out = process.argv[2] +const versions = readFileSync(join(out, 'versions.txt'), 'utf8').trim().split('\n') +const fixtures = readdirSync(out, { withFileTypes: true }) + .filter((entry) => entry.isDirectory()) + .map((entry) => entry.name) + .sort(byFixtureSize) + +const lines = [ + '# craft benchmark', + '', + `${new Date().toISOString().slice(0, 10)} · ${process.platform} ${process.arch} · ${cpus()[0].model} · ${cpus().length} cores · ${Math.round(totalmem() / 2 ** 30)} GB`, + '', + versions.map((version) => `\`${version}\``).join(' · '), + '', +] + +for (const fixture of fixtures) { + lines.push(...fixtureSection(fixture)) +} + +console.log(lines.join('\n')) + +function fixtureSection(fixture) { + const scenarios = Object.keys(SCENARIOS).filter((scenario) => readScenario(out, fixture, scenario)) + const runs = scenarios.map((scenario) => readScenario(out, fixture, scenario)) + const pms = runs[0]?.map((result) => result.name) ?? [] + const packages = packageCount(out, fixture) + const count = packages === undefined ? '' : `, ${packages} packages` + + const section = [`## ${fixture}`, '', `${fixtureManifest(fixture).description}${count}.`, ''] + section.push(`| | ${pms.join(' | ')} |`, `|---|${pms.map(() => '---:').join('|')}|`) + scenarios.forEach((scenario, index) => { + section.push(`| ${SCENARIOS[scenario]} | ${timings(runs[index]).join(' | ')} |`) + }) + section.push('') + + const hasMemory = runs.flat().some((result) => result.memory !== undefined) + if (!hasMemory) { + return section + } + section.push('Peak memory:', '', `| | ${pms.join(' | ')} |`, `|---|${pms.map(() => '---:').join('|')}|`) + scenarios.forEach((scenario, index) => { + section.push(`| ${SCENARIOS[scenario]} | ${memories(runs[index]).join(' | ')} |`) + }) + section.push('') + return section +} + +function timings(results) { + const fastest = Math.min(...results.map((result) => result.mean)) + return results.map((result) => { + const spread = result.stddev ? ` ± ${formatSeconds(result.stddev)}` : '' + const time = `${formatSeconds(result.mean)}${spread}` + if (result.mean === fastest) { + return `**${time}**` + } + return `${time} (${(result.mean / fastest).toFixed(1)}×)` + }) +} + +function memories(results) { + const leanest = Math.min(...results.map((result) => result.memory ?? Infinity)) + return results.map((result) => { + if (result.memory === undefined) { + return '–' + } + const memory = formatBytes(result.memory) + return result.memory === leanest ? `**${memory}**` : memory + }) +} + +function byFixtureSize(left, right) { + return FIXTURES.indexOf(left) - FIXTURES.indexOf(right) +} diff --git a/bench/results.mjs b/bench/results.mjs new file mode 100644 index 0000000..8ba358a --- /dev/null +++ b/bench/results.mjs @@ -0,0 +1,74 @@ +import { existsSync, readFileSync } from 'node:fs' +import { join } from 'node:path' + +export const SCENARIOS = { + cold: 'Cold: no cache, no lockfile', + lockfile: 'Lockfile, empty cache', + cache: 'Warm cache, no lockfile', + stale: 'Warm cache past its max-age, no lockfile', + 'cache+lockfile': 'Warm cache and lockfile', + 'up-to-date': 'Already installed', +} + +export const FIXTURES = ['small', 'medium', 'large'] + +/** Each package manager's result for one scenario of a run, or undefined if it wasn't timed. */ +export function readScenario(run, fixture, scenario) { + const path = join(run, fixture, `${scenario}.json`) + if (!existsSync(path)) { + return undefined + } + return JSON.parse(readFileSync(path, 'utf8')).results.map(wallClock) +} + +/** How many packages the fixture installs, from the lockfile craft wrote in that run. */ +export function packageCount(run, fixture) { + const lockfile = join(run, fixture, 'craft.lock') + if (!existsSync(lockfile)) { + return undefined + } + return Object.keys(JSON.parse(readFileSync(lockfile, 'utf8')).packages).length +} + +export function fixtureManifest(fixture) { + return JSON.parse(readFileSync(new URL(`./fixtures/${fixture}/package.json`, import.meta.url), 'utf8')) +} + +export function formatSeconds(seconds) { + if (seconds < 0.01) { + return `${(seconds * 1000).toFixed(1)} ms` + } + if (seconds < 1) { + return `${Math.round(seconds * 1000)} ms` + } + return `${seconds.toFixed(2)} s` +} + +/** How many times slower than the fastest, precise enough that a near tie doesn't read as one. */ +export function formatRatio(ratio) { + const digits = ratio < 1.1 ? 2 : ratio < 10 ? 1 : 0 + return `${ratio.toFixed(digits)}×` +} + +export function formatBytes(bytes) { + const megabytes = bytes / 2 ** 20 + if (megabytes < 1024) { + return `${Math.round(megabytes)} MB` + } + return `${(megabytes / 1024).toFixed(1)} GB` +} + +// hyperfine 2 nests the statistics under summary; hyperfine 1 keeps them at the top, with +// memory per run. +function wallClock(result) { + const { mean, stddev } = result.summary?.time_wall_clock ?? result + const memory = result.summary?.memory_peak_resident?.mean ?? average(result.memory_usage_byte) + return { name: result.name ?? result.command, mean, stddev, memory } +} + +function average(values) { + if (!values?.length) { + return undefined + } + return values.reduce((sum, value) => sum + value, 0) / values.length +} diff --git a/bench/run.sh b/bench/run.sh new file mode 100755 index 0000000..f64299d --- /dev/null +++ b/bench/run.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +# Races craft against npm, pnpm and Yarn on the fixtures in bench/fixtures. +set -euo pipefail + +BENCH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT="$(dirname "$BENCH")" +CRAFT="${CRAFT:-$ROOT/target/release/craft}" +TOOLS="$BENCH/tools/node_modules/.bin" +TEMP="${TMPDIR:-/tmp}" +WORK="${BENCH_WORK:-${TEMP%/}/craft-bench}" +OUT="$BENCH/results/$(date +%Y%m%d-%H%M%S)" +FIXTURES="small,medium,large" +SCENARIOS="cold,lockfile,cache,cache+lockfile,up-to-date,stale" +PMS="craft,npm,pnpm,yarn" +RUNS=5 + +usage() { + cat <) + +Scenarios say what an install starts from: + cold nothing: no cache, no lockfile, no node_modules + lockfile a lockfile, with an empty cache + cache a warm cache, without a lockfile + cache+lockfile a warm cache and a lockfile + up-to-date everything already installed + stale the cache as setup left it, past the registry's max-age, without a lockfile + +Environment: CRAFT (craft binary, default target/release/craft), +BENCH_WORK (scratch directory, default \$TMPDIR/craft-bench). +EOF +} + +while [ $# -gt 0 ]; do + case "$1" in + --fixtures) FIXTURES="$2"; shift 2 ;; + --scenarios) SCENARIOS="$2"; shift 2 ;; + --pms) PMS="$2"; shift 2 ;; + --runs) RUNS="$2"; shift 2 ;; + --out) OUT="$2"; shift 2 ;; + -h|--help) usage; exit 0 ;; + *) echo "unknown option: $1" >&2; usage >&2; exit 2 ;; + esac +done + +# Every package manager sees a plain, non-CI terminal session, so none of them +# switches to frozen-lockfile or immutable installs. +export CI=false + +# Package manager settings from the caller's environment would reach past the +# per-package-manager HOME, as PNPM_HOME does with pnpm's store. +while read -r name; do + unset "$name" +done < <(env | grep -ioE '^(npm_config_|pnpm_|yarn_|corepack_)[a-z0-9_]*=' | tr -d =) + +# How long the registry lets a cached packument be used without asking again. +MAX_AGE=300 + +require() { + command -v "$1" >/dev/null || { echo "error: $1 is not installed${2:+ ($2)}" >&2; exit 1; } +} + +lockfile_of() { + case "$1" in + craft) echo craft.lock ;; + npm) echo package-lock.json ;; + pnpm) echo pnpm-lock.yaml ;; + yarn) echo yarn.lock ;; + esac +} + +# The install command of a package manager. Each one gets its own HOME, so its +# cache, store and config start from nothing and are cleared by deleting it. +install_command() { + local pm="$1" home="$2" + local env="HOME='$home' XDG_CACHE_HOME='$home/.cache' XDG_DATA_HOME='$home/.local/share' XDG_STATE_HOME='$home/.local/state' XDG_CONFIG_HOME='$home/.config'" + case "$pm" in + craft) echo "$env CRAFT_HOME='$home/.craft' '$CRAFT' install" ;; + npm) echo "$env npm_config_cache='$home/.npm' '$TOOLS/npm' install --ignore-scripts --no-audit --no-fund --no-update-notifier" ;; + pnpm) echo "$env PNPM_HOME='$home/.pnpm' '$TOOLS/pnpm' install --ignore-scripts" ;; + yarn) echo "$env YARN_NODE_LINKER=node-modules YARN_ENABLE_SCRIPTS=false YARN_ENABLE_TELEMETRY=false '$TOOLS/yarn' install" ;; + esac +} + +# What a scenario removes before every run. Yarn keeps its install state in +# .yarn rather than node_modules, so it goes with node_modules. +prepare_command() { + local scenario="$1" project="$2" home="$3" lockfile="$4" saved="$5" + local modules="rm -rf '$project/node_modules' '$project/.yarn'" + local restore="cp '$saved' '$project/$lockfile'" + case "$scenario" in + cold) echo "$modules '$project/$lockfile' '$home'" ;; + lockfile) echo "$modules '$home' && $restore" ;; + cache) echo "$modules '$project/$lockfile'" ;; + cache+lockfile) echo "$modules && $restore" ;; + up-to-date) echo "true" ;; + stale) echo "$modules '$project/$lockfile' '$home' && $(copy_tree "$home.setup" "$home")" ;; + esac +} + +needs_warmup() { + case "$1" in + cold|lockfile) return 1 ;; + *) return 0 ;; + esac +} + +# Copies a directory keeping its timestamps, cloning files where the filesystem can. +copy_tree() { + local source="$1" dest="$2" + case "$(uname)" in + Darwin) echo "cp -cpR '$source' '$dest'" ;; + *) echo "cp -a --reflink=auto '$source' '$dest'" ;; + esac +} + +has_scenario() { + [[ ",$SCENARIOS," == *",$1,"* ]] +} + +# Joins each package manager's hyperfine results for a scenario into one file. +merge_results() { + local dir="$1" scenario="$2" + local parts=() pm + for pm in "${pms[@]}"; do + parts+=("$dir/$scenario.$pm.json") + done + node -e ' + const { readFileSync, writeFileSync } = require("node:fs") + const [out, ...parts] = process.argv.slice(1) + const results = parts.flatMap((part) => JSON.parse(readFileSync(part, "utf8")).results) + writeFileSync(out, JSON.stringify({ results }, null, 2)) + ' "$dir/$scenario.json" "${parts[@]}" + rm "${parts[@]}" +} + +# Waits until every cache setup wrote is older than the registry's max-age, so a +# package manager that honours it has to ask the registry again. +wait_for_stale_caches() { + local fixture="$1" + local ready=$(($(cat "$WORK/$fixture/setup-done") + MAX_AGE + 1)) + local now + now="$(date +%s)" + if [ "$now" -lt "$ready" ]; then + echo "Waiting $((ready - now)) s for the caches to pass the registry's max-age" + sleep $((ready - now)) + fi +} + +# Installs a fixture once, keeps the lockfile it wrote, and checks every direct +# dependency landed, so a package manager that silently did nothing can't win. +setup() { + local fixture="$1" pm="$2" + local dir="$WORK/$fixture/$pm" lockfile + lockfile="$(lockfile_of "$pm")" + rm -rf "$dir" + mkdir -p "$dir/project" + cp "$BENCH/fixtures/$fixture/package.json" "$dir/project/" + if ! (cd "$dir/project" && eval "$(install_command "$pm" "$dir/home")") >"$dir/setup.log" 2>&1; then + echo "error: $pm failed to install $fixture, see $dir/setup.log" >&2 + tail -20 "$dir/setup.log" >&2 + exit 1 + fi + cp "$dir/project/$lockfile" "$dir/lockfile" + mkdir -p "$OUT/$fixture" + cp "$dir/lockfile" "$OUT/$fixture/$lockfile" + node "$BENCH/verify.mjs" "$dir/project" + if has_scenario stale; then + rm -rf "$dir/home.setup" + eval "$(copy_tree "$dir/home" "$dir/home.setup")" + fi + date +%s >"$WORK/$fixture/setup-done" +} + +require node +require hyperfine "brew install hyperfine, or see https://github.com/sharkdp/hyperfine" +[ -x "$CRAFT" ] || { echo "error: no craft binary at $CRAFT; run cargo build --release -p craft" >&2; exit 1; } +if [ ! -x "$TOOLS/pnpm" ]; then + echo "Installing the pinned package managers into bench/tools" + (cd "$BENCH/tools" && "$CRAFT" install --frozen-lockfile --silent) +fi + +IFS=, read -r -a fixtures <<<"$FIXTURES" +IFS=, read -r -a scenarios <<<"$SCENARIOS" +IFS=, read -r -a pms <<<"$PMS" +for pm in "${pms[@]}"; do + [ -n "$(lockfile_of "$pm")" ] || { echo "error: no package manager named $pm" >&2; exit 2; } +done +for scenario in "${scenarios[@]}"; do + [ -n "$(prepare_command "$scenario" - - - -)" ] || { echo "error: no scenario named $scenario" >&2; exit 2; } +done +for fixture in "${fixtures[@]}"; do + [ -f "$BENCH/fixtures/$fixture/package.json" ] || { echo "error: no fixture named $fixture" >&2; exit 2; } +done + +mkdir -p "$OUT" +{ + for pm in "${pms[@]}"; do + case "$pm" in + craft) echo "craft $("$CRAFT" --version | awk '{print $NF}')" ;; + *) echo "$pm $("$TOOLS/$pm" --version)" ;; + esac + done + echo "node $(node --version | tr -d v)" +} >"$OUT/versions.txt" + +for fixture in "${fixtures[@]}"; do + for pm in "${pms[@]}"; do + echo "Setting up $fixture with $pm" + setup "$fixture" "$pm" + done + + for scenario in "${scenarios[@]}"; do + [ "$scenario" = stale ] && wait_for_stale_caches "$fixture" + echo + echo "=== $fixture: $scenario" + for pm in "${pms[@]}"; do + # Setting up every package manager takes minutes on large fixtures, long + # enough for the first one's metadata to pass max-age during its runs. + if [ "$scenario" = cache ]; then + echo "Setting up $fixture with $pm again, so its metadata is within max-age" + setup "$fixture" "$pm" + fi + dir="$WORK/$fixture/$pm" + project="$dir/project" + prepare="$(prepare_command "$scenario" "$project" "$dir/home" "$(lockfile_of "$pm")" "$dir/lockfile")" + args=(--shell=bash --runs "$RUNS" --export-json "$OUT/$fixture/$scenario.$pm.json") + needs_warmup "$scenario" && args+=(--warmup 1) + hyperfine "${args[@]}" --prepare "$prepare" --command-name "$pm" "cd '$project' && $(install_command "$pm" "$dir/home")" + done + merge_results "$OUT/$fixture" "$scenario" + done +done + +node "$BENCH/report.mjs" "$OUT" | tee "$OUT/summary.md" diff --git a/bench/tools/craft.lock b/bench/tools/craft.lock new file mode 100644 index 0000000..7017803 --- /dev/null +++ b/bench/tools/craft.lock @@ -0,0 +1,2119 @@ +{ + "lockfileVersion": 1, + "importers": { + ".": { + "devDependencies": { + "@yarnpkg/cli-dist": { + "specifier": "4.18.1", + "version": "@yarnpkg/cli-dist@4.18.1" + }, + "npm": { + "specifier": "12.2.1", + "version": "npm@12.2.1" + }, + "pnpm": { + "specifier": "12.15.0", + "version": "pnpm@12.15.0" + } + } + } + }, + "packages": { + "@gar/promise-retry@1.0.3": { + "name": "@gar/promise-retry", + "version": "1.0.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@gar/promise-retry/-/promise-retry-1.0.3.tgz", + "integrity": "sha512-GmzA9ckNokPypTg10pgpeHNQe7ph+iIKKmhKu3Ob9ANkswreCx7R3cKmY781K8QK3AqVL3xVh9A42JvIAbkkSA==" + } + }, + "@isaacs/fs-minipass@4.0.1": { + "name": "@isaacs/fs-minipass", + "version": "4.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "@isaacs/string-locale-compare@1.1.0": { + "name": "@isaacs/string-locale-compare", + "version": "1.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz", + "integrity": "sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==" + } + }, + "@npmcli/agent@5.0.2": { + "name": "@npmcli/agent", + "version": "5.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/agent/-/agent-5.0.2.tgz", + "integrity": "sha512-EkzGmEsgbQ1rqWkRJe2P0oQHx/ylZozDUNPMXCklLuSFL3GY+QyEfBUjhjCsgGXzh4OGpnHvkboSQgczjP/jJg==" + }, + "dependencies": { + "agent-base": "agent-base@9.0.0", + "http-proxy-agent": "http-proxy-agent@9.1.0", + "https-proxy-agent": "https-proxy-agent@9.1.0", + "lru-cache": "lru-cache@11.5.3", + "socks-proxy-agent": "socks-proxy-agent@10.1.0" + } + }, + "@npmcli/arborist@10.0.4": { + "name": "@npmcli/arborist", + "version": "10.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-10.0.4.tgz", + "integrity": "sha512-QMVxWzrv+XmBjjBGIqEQTQ1uKzfAA7YTT0Q7AaJ5MvmlsfWLffV5mt9pZGUAugHg4q/lIMHzkhFgWMgqFo87kA==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@isaacs/string-locale-compare": "@isaacs/string-locale-compare@1.1.0", + "@npmcli/fs": "@npmcli/fs@6.0.0", + "@npmcli/installed-package-contents": "@npmcli/installed-package-contents@5.0.0", + "@npmcli/map-workspaces": "@npmcli/map-workspaces@6.0.0", + "@npmcli/metavuln-calculator": "@npmcli/metavuln-calculator@10.0.0", + "@npmcli/name-from-folder": "@npmcli/name-from-folder@5.0.0", + "@npmcli/node-gyp": "@npmcli/node-gyp@6.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "@npmcli/query": "@npmcli/query@5.0.0", + "@npmcli/redact": "@npmcli/redact@5.0.0", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "bin-links": "bin-links@7.0.1", + "cacache": "cacache@21.0.1", + "common-ancestor-path": "common-ancestor-path@2.0.0", + "diff": "diff@8.0.4", + "hosted-git-info": "hosted-git-info@10.1.1", + "json-stringify-nice": "json-stringify-nice@1.1.4", + "lru-cache": "lru-cache@11.5.3", + "minimatch": "minimatch@10.2.6", + "nopt": "nopt@10.0.1", + "npm-install-checks": "npm-install-checks@9.0.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "npm-pick-manifest": "npm-pick-manifest@12.0.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1", + "pacote": "pacote@22.0.1", + "parse-conflict-json": "parse-conflict-json@6.0.0", + "proc-log": "proc-log@7.0.0", + "proggy": "proggy@4.0.0", + "promise-all-reject-late": "promise-all-reject-late@1.0.1", + "promise-call-limit": "promise-call-limit@3.0.2", + "semver": "semver@7.8.5", + "ssri": "ssri@14.0.0", + "treeverse": "treeverse@3.0.0", + "validate-npm-package-name": "validate-npm-package-name@8.0.0", + "walk-up-path": "walk-up-path@4.0.0" + } + }, + "@npmcli/config@11.2.0": { + "name": "@npmcli/config", + "version": "11.2.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/config/-/config-11.2.0.tgz", + "integrity": "sha512-PZtUL2rXqThZUT5KGsbVEGdrJswgBoY56X8hXIozwoayHC/rRsaJCIz4nsBzHJvNpCjGEbufJqStaqB7Qdd4ww==" + }, + "dependencies": { + "@npmcli/map-workspaces": "@npmcli/map-workspaces@6.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "ci-info": "ci-info@4.4.0", + "ini": "ini@7.0.0", + "nopt": "nopt@10.0.1", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "walk-up-path": "walk-up-path@4.0.0" + } + }, + "@npmcli/fs@6.0.0": { + "name": "@npmcli/fs", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/fs/-/fs-6.0.0.tgz", + "integrity": "sha512-AheOs4swKka/XLtht6xxJDPezlQ7K2IYQ9Y8lST4JLDjnralnWuMM9AE2CdVcgQJ5omrXhsRzM7F7aYmeZBvKQ==" + }, + "dependencies": { + "semver": "semver@7.8.5" + } + }, + "@npmcli/git@8.0.0": { + "name": "@npmcli/git", + "version": "8.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/git/-/git-8.0.0.tgz", + "integrity": "sha512-5P1oo+TbxZNAiiMBtpzHA8QyEGh5D69LYLexNWJEDXLdxnAZvT/SLitGJBXxjtCE4ftAcFOS/Tu2185MeIjooQ==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@npmcli/promise-spawn": "@npmcli/promise-spawn@10.0.1", + "ini": "ini@7.0.0", + "lru-cache": "lru-cache@11.5.3", + "npm-pick-manifest": "npm-pick-manifest@12.0.0", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "which": "which@7.0.0" + } + }, + "@npmcli/installed-package-contents@5.0.0": { + "name": "@npmcli/installed-package-contents", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/installed-package-contents/-/installed-package-contents-5.0.0.tgz", + "integrity": "sha512-6Ay12sf2Lh7U1ifvnS1mq7TZFeh/rXHMXye+kV7jQrANIubaoVcleeh4HdFumxhsRYwm9OaHycB5lYmSwGrcIQ==" + }, + "dependencies": { + "npm-bundled": "npm-bundled@6.0.0", + "npm-normalize-package-bin": "npm-normalize-package-bin@6.0.0" + } + }, + "@npmcli/map-workspaces@6.0.0": { + "name": "@npmcli/map-workspaces", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-6.0.0.tgz", + "integrity": "sha512-Dsex7XBea0BoFRbfALMbNuaNqeI3kbZJxiBMQhFvPUNluv0yEeKMd5FLIXy0NCsOuGMYQkLa+i219CadnoqLbg==" + }, + "dependencies": { + "@npmcli/name-from-folder": "@npmcli/name-from-folder@5.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "glob": "glob@13.0.6", + "minimatch": "minimatch@10.2.6" + } + }, + "@npmcli/metavuln-calculator@10.0.0": { + "name": "@npmcli/metavuln-calculator", + "version": "10.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/metavuln-calculator/-/metavuln-calculator-10.0.0.tgz", + "integrity": "sha512-fC56lpGOae+unrFx6hoiWeWa0/4q+bLhOQTSrB65qcy+Zm34i1OdBcevAQFJJdUB/3i9uXw7PjdrrRjt0KSKXw==" + }, + "dependencies": { + "cacache": "cacache@21.0.1", + "json-parse-even-better-errors": "json-parse-even-better-errors@6.0.0", + "pacote": "pacote@22.0.1", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5" + } + }, + "@npmcli/name-from-folder@5.0.0": { + "name": "@npmcli/name-from-folder", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/name-from-folder/-/name-from-folder-5.0.0.tgz", + "integrity": "sha512-Mua2i5asmOn4sGGAsANS9Guamo7sgUd4BihhQWzlNGz6l/Ki23CzC2oGe4I94r2k/39ImCjDLbyu/rSJr/SXoA==" + } + }, + "@npmcli/node-gyp@6.0.0": { + "name": "@npmcli/node-gyp", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-6.0.0.tgz", + "integrity": "sha512-MFakpea4pcZNlHSTbMi15HK8RY8zl2UpgDtxhZCWOer+KRN3x7HFIMk/fKpOMgR55L4LIcA2qn8IHeyABhIFtw==" + } + }, + "@npmcli/package-json@8.0.0": { + "name": "@npmcli/package-json", + "version": "8.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-8.0.0.tgz", + "integrity": "sha512-agNZzYQ18MR0wKp3Emg1q5QbcC8CXigYp3Z3CvB0Sax9Ge9aF4cVyyuSG+5SbACSrZUKTvMjVULWiE1RJA38wg==" + }, + "dependencies": { + "@npmcli/git": "@npmcli/git@8.0.0", + "glob": "glob@13.0.6", + "hosted-git-info": "hosted-git-info@10.1.1", + "json-parse-even-better-errors": "json-parse-even-better-errors@6.0.0", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "spdx-expression-parse": "spdx-expression-parse@4.0.0" + } + }, + "@npmcli/promise-spawn@10.0.1": { + "name": "@npmcli/promise-spawn", + "version": "10.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-10.0.1.tgz", + "integrity": "sha512-IstFcKAoEIZ7olS9iTwBsyNOZkIturafO2da9ocSP3LifRlm1+sxuo8IVM5phg5sNe0tNYLT0ZqCBRTLNzz0AA==" + }, + "dependencies": { + "which": "which@7.0.0" + } + }, + "@npmcli/query@5.0.0": { + "name": "@npmcli/query", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/query/-/query-5.0.0.tgz", + "integrity": "sha512-8TZWfTQOsODpLqo9SVhVjHovmKXNpevHU0gO9e+y4V4fRIOneiXy0u0sMP9LmS71XivrEWfZWg50ReH4WRT4aQ==" + }, + "dependencies": { + "postcss-selector-parser": "postcss-selector-parser@7.1.7" + } + }, + "@npmcli/redact@5.0.0": { + "name": "@npmcli/redact", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/redact/-/redact-5.0.0.tgz", + "integrity": "sha512-3zcN5Q3yEmeyxXBzqB6fXPQFzYa2ROsGFSr69W0ArXIAGJqxl/aFECOVPD2kbkYPm0U/EHxFKgclK3UA9WQg5A==" + } + }, + "@npmcli/run-script@11.0.0": { + "name": "@npmcli/run-script", + "version": "11.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-11.0.0.tgz", + "integrity": "sha512-leBRl6F5F0TvWut8m1/aZcMTUHi2vXjKeMJ/Ik1lW7Q7Yy16Dhtkklu+cEqQww1p1NeLnUNzV3+uwpzqRcy9vw==" + }, + "dependencies": { + "@npmcli/node-gyp": "@npmcli/node-gyp@6.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "@npmcli/promise-spawn": "@npmcli/promise-spawn@10.0.1", + "node-gyp": "node-gyp@13.1.0", + "proc-log": "proc-log@7.0.0" + } + }, + "@pnpm/exe.android-arm64@12.15.0": { + "name": "@pnpm/exe.android-arm64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.android-arm64/-/exe.android-arm64-12.15.0.tgz", + "integrity": "sha512-eVCqmscY70LGvgRzu3mi8IBWBFGix+a6mNZoWmXxESsBdeiKEF9xQSuaeel10yn+zI7TXy2jlI63vFLzETk+aQ==" + }, + "os": [ + "android" + ], + "cpu": [ + "arm64" + ] + }, + "@pnpm/exe.android-x64@12.15.0": { + "name": "@pnpm/exe.android-x64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.android-x64/-/exe.android-x64-12.15.0.tgz", + "integrity": "sha512-Gx/WbkFcdUFUg8g8AShezcS9EiQxfYvdAm2hfKLO8sfJmJvKOCt5fzlgHWDzmGhoclibgW+tUGZ/KF4F4wOTCA==" + }, + "os": [ + "android" + ], + "cpu": [ + "x64" + ] + }, + "@pnpm/exe.darwin-arm64@12.15.0": { + "name": "@pnpm/exe.darwin-arm64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.darwin-arm64/-/exe.darwin-arm64-12.15.0.tgz", + "integrity": "sha512-N0ZykiDWCvqSBJvt71j7cSoBR993FqvYZFtmpCtqvW3pguiI+NAgraLPA5OTwu5mV+/d8hYpVcPktJA3xFDLtA==" + }, + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ] + }, + "@pnpm/exe.darwin-x64@12.15.0": { + "name": "@pnpm/exe.darwin-x64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.darwin-x64/-/exe.darwin-x64-12.15.0.tgz", + "integrity": "sha512-7Ntr2HlBUxzwWOg7NwDxCbRW/3vXuqKO+hcXm+w3SBi9rrHY53li1wLqWVT7Gjxd+lVEHM1QJZo6WJEGFU8C6A==" + }, + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ] + }, + "@pnpm/exe.freebsd-x64@12.15.0": { + "name": "@pnpm/exe.freebsd-x64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.freebsd-x64/-/exe.freebsd-x64-12.15.0.tgz", + "integrity": "sha512-btOiyL7fL7W4uQGH0aqFai2TNC3IoKcZ7gNHBVbEFZt2dWrnrD0SufL3iGs3fLlmb4OtuU35uf4Zpr9V9Jh9mA==" + }, + "os": [ + "freebsd" + ], + "cpu": [ + "x64" + ] + }, + "@pnpm/exe.linux-arm64-musl@12.15.0": { + "name": "@pnpm/exe.linux-arm64-musl", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-arm64-musl/-/exe.linux-arm64-musl-12.15.0.tgz", + "integrity": "sha512-pNC38k+O+90FOjbPNSnw0E7apq1PKTmz3fFe1amn+lys/U5kL++uzir8bRiho8ONcyA3d9EU7wdqcY0DKkj+JA==" + }, + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ] + }, + "@pnpm/exe.linux-arm64@12.15.0": { + "name": "@pnpm/exe.linux-arm64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-arm64/-/exe.linux-arm64-12.15.0.tgz", + "integrity": "sha512-qML/8aCXslh8td/w4U+HJNqUcZ2+m6EfTbWScIzZRmyPsRFN+xB4LP1U/hymxc1iSJiKtG56HJx2fvUErWFIGw==" + }, + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ] + }, + "@pnpm/exe.linux-ppc64@12.15.0": { + "name": "@pnpm/exe.linux-ppc64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-ppc64/-/exe.linux-ppc64-12.15.0.tgz", + "integrity": "sha512-tjRDUUl7RCJ6T/6eoNPxOqkwU4Mzi5RtTXmSAxujyz37OTwwsMU7Ps087Zk4gHcUvRSeyF40ZFsew3vtE+nmUA==" + }, + "os": [ + "linux" + ], + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ] + }, + "@pnpm/exe.linux-riscv64@12.15.0": { + "name": "@pnpm/exe.linux-riscv64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-riscv64/-/exe.linux-riscv64-12.15.0.tgz", + "integrity": "sha512-bF1uBWEfbwaeryz6lIiaJ8AWD082otZfvzGX5l+6LZRpRwUEpJHUsJrORaYP5/cNMv5ZR2p6TvvcJcQzwtDzmw==" + }, + "os": [ + "linux" + ], + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ] + }, + "@pnpm/exe.linux-s390x@12.15.0": { + "name": "@pnpm/exe.linux-s390x", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-s390x/-/exe.linux-s390x-12.15.0.tgz", + "integrity": "sha512-zKMhIzsexYMToeLmqV5jPsvV/f9vwsJb2kUH2NFYzalbxImeBrlA4kL7GwF8gD4pagV6jYYcJb8RjbZIdjHptg==" + }, + "os": [ + "linux" + ], + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ] + }, + "@pnpm/exe.linux-x64-musl@12.15.0": { + "name": "@pnpm/exe.linux-x64-musl", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-x64-musl/-/exe.linux-x64-musl-12.15.0.tgz", + "integrity": "sha512-A9J0Jg0Rdx+qQU4qXtwyST5tto9IOu1zi4fDk35nbc6DWahggbcKtFvZPKFwL2qgUXGXOX//hXv6z/sp6emO8A==" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ] + }, + "@pnpm/exe.linux-x64@12.15.0": { + "name": "@pnpm/exe.linux-x64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.linux-x64/-/exe.linux-x64-12.15.0.tgz", + "integrity": "sha512-yc+QlZR+9+nr29J4fRzhMoapgxTBDndq/+peyoq1XUufnQFnfbXUMFudDIKzHi545linGqmOmXfn0NoufNgcOg==" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ] + }, + "@pnpm/exe.win32-arm64@12.15.0": { + "name": "@pnpm/exe.win32-arm64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.win32-arm64/-/exe.win32-arm64-12.15.0.tgz", + "integrity": "sha512-fPXZxuY1VclkOga9bc53qNCXcegfeoBR8+Ue+AospDwKzuGGSHll0oDxkLfkmpjyRqpe7bH5DyQPYp/xSMaIVA==" + }, + "os": [ + "win32" + ], + "cpu": [ + "arm64" + ] + }, + "@pnpm/exe.win32-x64@12.15.0": { + "name": "@pnpm/exe.win32-x64", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@pnpm/exe.win32-x64/-/exe.win32-x64-12.15.0.tgz", + "integrity": "sha512-nrd+Tp1We1DGj4DGG5Bea9lZNh9y1PjlLBdEwdInS4D0h0UIDtM7JaGGGDJhNzIwcHASyihWI7HLV+dtG+fhYg==" + }, + "os": [ + "win32" + ], + "cpu": [ + "x64" + ] + }, + "@sigstore/bundle@5.0.0": { + "name": "@sigstore/bundle", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-5.0.0.tgz", + "integrity": "sha512-wefjygudENbzbQMks1t5u34EP0fFoD0XvaEP7DOUP/sXKvogzEJYFw5E6pegGyp3onGWzVEYKVa3bNZWyTYX+A==" + }, + "dependencies": { + "@sigstore/protobuf-specs": "@sigstore/protobuf-specs@0.5.2" + } + }, + "@sigstore/core@4.0.1": { + "name": "@sigstore/core", + "version": "4.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/core/-/core-4.0.1.tgz", + "integrity": "sha512-9v5hRjujn5NXq8o7XFEUgLyAtdr5Iisb4pzM05u3K61IS5q3hP3luWAndk0RkPPLTUFoTbg7Vb84UQ1ZQeajWQ==" + } + }, + "@sigstore/protobuf-specs@0.5.2": { + "name": "@sigstore/protobuf-specs", + "version": "0.5.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/protobuf-specs/-/protobuf-specs-0.5.2.tgz", + "integrity": "sha512-SQqvFMt4V78fdjcDdYX6HbiVSOR4QK3ZgwCa2KOsopAgPIHy1rU5UDUmzLl02r5oyyaYcYHR1hpwDRk/yUe+Mw==" + } + }, + "@sigstore/sign@5.0.0": { + "name": "@sigstore/sign", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/sign/-/sign-5.0.0.tgz", + "integrity": "sha512-DSFivqz9/i5AkwZ5fq0YdjaJlc4o1WeS2Zffon0kqtChx0vy4W9NOjkEet9bF2vkzOufX72eVH8kZBIGtcBp1w==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@sigstore/bundle": "@sigstore/bundle@5.0.0", + "@sigstore/core": "@sigstore/core@4.0.1", + "@sigstore/protobuf-specs": "@sigstore/protobuf-specs@0.5.2", + "make-fetch-happen": "make-fetch-happen@16.0.1", + "proc-log": "proc-log@7.0.0" + } + }, + "@sigstore/tuf@5.0.0": { + "name": "@sigstore/tuf", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/tuf/-/tuf-5.0.0.tgz", + "integrity": "sha512-Zyqg9tcHps3uRAlKHLNmsW4ohsUZAjb9G+31r7lg0ICh/JOcadzmJsIRdjKljlRHpaR0K4aJ2kXXIdywdcdMlA==" + }, + "dependencies": { + "@sigstore/protobuf-specs": "@sigstore/protobuf-specs@0.5.2", + "tuf-js": "tuf-js@6.0.0" + } + }, + "@sigstore/verify@4.1.2": { + "name": "@sigstore/verify", + "version": "4.1.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@sigstore/verify/-/verify-4.1.2.tgz", + "integrity": "sha512-BfD9eLrz3A/DG58aSgfgZYmIR6V9Yw96QVN/frtu2bEH7ctSTk2TDvHU12un3JsDPBTqTNkqkIkucjxljpOFqQ==" + }, + "dependencies": { + "@sigstore/bundle": "@sigstore/bundle@5.0.0", + "@sigstore/core": "@sigstore/core@4.0.1", + "@sigstore/protobuf-specs": "@sigstore/protobuf-specs@0.5.2" + } + }, + "@tufjs/canonical-json@2.0.0": { + "name": "@tufjs/canonical-json", + "version": "2.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", + "integrity": "sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==" + } + }, + "@tufjs/models@5.0.0": { + "name": "@tufjs/models", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@tufjs/models/-/models-5.0.0.tgz", + "integrity": "sha512-U4mVcdFGOi6pt8n38LdWZp67Svn7ppnU1Pj8SGOVaBi1X4gm+G4ztQlLfkoJbKSHfjA6WeaiJp2A4V83AJF6nQ==" + }, + "dependencies": { + "@tufjs/canonical-json": "@tufjs/canonical-json@2.0.0", + "minimatch": "minimatch@10.2.6" + } + }, + "@yarnpkg/cli-dist@4.18.1": { + "name": "@yarnpkg/cli-dist", + "version": "4.18.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/@yarnpkg/cli-dist/-/cli-dist-4.18.1.tgz", + "integrity": "sha512-EH+A4TxAtBWXKE0DGQxW9Bo9crXHLJ73mfxjTQJuv8XonNWWTpei8BQ5JjczHJNU9GROTycwMFn8iOvRIZXUcA==" + } + }, + "abbrev@5.0.0": { + "name": "abbrev", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/abbrev/-/abbrev-5.0.0.tgz", + "integrity": "sha512-/XrFJgzQQQHpti1raDJC6m4ws6aNktmjBlhk8Fdlk7LwCEuDoieEJJY9OFHjfiFJFFRM2tK+Ky/IsfbbmlMu1w==" + } + }, + "agent-base@9.0.0": { + "name": "agent-base", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/agent-base/-/agent-base-9.0.0.tgz", + "integrity": "sha512-TQf59BsZnytt8GdJKLPfUZ54g/iaUL2OWDSFCCvMOhsHduDQxO8xC4PNeyIkVcA5KwL2phPSv0douC0fgWzmnA==" + } + }, + "aproba@2.1.0": { + "name": "aproba", + "version": "2.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/aproba/-/aproba-2.1.0.tgz", + "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==" + } + }, + "archy@1.0.0": { + "name": "archy", + "version": "1.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==" + } + }, + "balanced-match@4.0.4": { + "name": "balanced-match", + "version": "4.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==" + } + }, + "bin-links@7.0.1": { + "name": "bin-links", + "version": "7.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/bin-links/-/bin-links-7.0.1.tgz", + "integrity": "sha512-lgxd7FtxW02eSuafotQOGEQf1iGfDExMz2BRaL+e1tU5xTLx+vvSVA5oHIO6B1tR91LDKcWqYGsktUHdFMtHHQ==" + }, + "dependencies": { + "cmd-shim": "cmd-shim@9.0.2", + "npm-normalize-package-bin": "npm-normalize-package-bin@6.0.0", + "proc-log": "proc-log@7.0.0", + "read-cmd-shim": "read-cmd-shim@7.0.1", + "write-file-atomic": "write-file-atomic@8.0.0" + } + }, + "binary-extensions@3.2.0": { + "name": "binary-extensions", + "version": "3.2.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-3.2.0.tgz", + "integrity": "sha512-DjR9rgAOMQn9TrUHzijJUtvoKviDRvFxuIyqZrubxHqRpQN9OzfXrrLivm7xb3q8oJSKsiuBor4bAS2wafLnVQ==" + } + }, + "brace-expansion@5.0.12": { + "name": "brace-expansion", + "version": "5.0.12", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==" + }, + "dependencies": { + "balanced-match": "balanced-match@4.0.4" + } + }, + "cacache@21.0.1": { + "name": "cacache", + "version": "21.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/cacache/-/cacache-21.0.1.tgz", + "integrity": "sha512-pTwz/uj3Jyp6WXdJ6fWhR+7LVxVs6RyroQSn7KJwHsSxXuyGSp0pcMVcwSwTpCFq1X2YG8QBe0W+vN+cr0SwzA==" + }, + "dependencies": { + "@npmcli/fs": "@npmcli/fs@6.0.0", + "fs-minipass": "fs-minipass@3.0.3", + "glob": "glob@13.0.6", + "lru-cache": "lru-cache@11.5.3", + "minipass": "minipass@7.1.3", + "minipass-collect": "minipass-collect@2.0.1", + "minipass-flush": "minipass-flush@1.0.7", + "minipass-pipeline": "minipass-pipeline@1.2.4", + "p-map": "p-map@7.1.1", + "ssri": "ssri@14.0.0" + } + }, + "chalk@5.6.2": { + "name": "chalk", + "version": "5.6.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==" + } + }, + "chownr@3.0.0": { + "name": "chownr", + "version": "3.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==" + } + }, + "ci-info@4.4.0": { + "name": "ci-info", + "version": "4.4.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", + "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==" + } + }, + "cidr-regex@7.1.2": { + "name": "cidr-regex", + "version": "7.1.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-7.1.2.tgz", + "integrity": "sha512-D8F5oI0M5PagJvTjyycBf7LG+LufTNLrg0WY9J0cPUuG1dIWC2hFvl5SNQr8btm4Qtl7bS7IPvhw/+30IyhBmA==" + } + }, + "cmd-shim@9.0.2": { + "name": "cmd-shim", + "version": "9.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-9.0.2.tgz", + "integrity": "sha512-xVHoI+wNrM4tDB9iC1idf/8D0tYnVimlBp/5zHW+x1sGjjRD69NvR9th3Z1JAYGN/BTW4he6aZFYV6kzy+k+jw==" + } + }, + "common-ancestor-path@2.0.0": { + "name": "common-ancestor-path", + "version": "2.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==" + } + }, + "content-type@2.1.0": { + "name": "content-type", + "version": "2.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==" + } + }, + "cssesc@3.0.0": { + "name": "cssesc", + "version": "3.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==" + } + }, + "debug@4.4.3": { + "name": "debug", + "version": "4.4.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==" + }, + "dependencies": { + "ms": "ms@2.1.3" + } + }, + "diff@8.0.4": { + "name": "diff", + "version": "8.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==" + } + }, + "env-paths@2.2.1": { + "name": "env-paths", + "version": "2.2.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==" + } + }, + "exponential-backoff@3.1.3": { + "name": "exponential-backoff", + "version": "3.1.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", + "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==" + } + }, + "fastest-levenshtein@1.0.16": { + "name": "fastest-levenshtein", + "version": "1.0.16", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==" + } + }, + "fdir@6.5.0_picomatch@4.0.7": { + "name": "fdir", + "version": "6.5.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==" + }, + "peerDependencies": { + "picomatch": "picomatch@4.0.7" + } + }, + "fs-minipass@3.0.3": { + "name": "fs-minipass", + "version": "3.0.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "glob@13.0.6": { + "name": "glob", + "version": "13.0.6", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==" + }, + "dependencies": { + "minimatch": "minimatch@10.2.6", + "minipass": "minipass@7.1.3", + "path-scurry": "path-scurry@2.0.2" + } + }, + "graceful-fs@4.2.11": { + "name": "graceful-fs", + "version": "4.2.11", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + } + }, + "hosted-git-info@10.1.1": { + "name": "hosted-git-info", + "version": "10.1.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-10.1.1.tgz", + "integrity": "sha512-DeOnSPAvOndYKfw075gt8yZzQ7S2hNztw34zBTfhIzLhmBTswIBg5/y+pqu/VD5cYWm5goAFTusDmUEmKZ0PEQ==" + }, + "dependencies": { + "lru-cache": "lru-cache@11.5.3" + } + }, + "http-cache-semantics@4.3.0": { + "name": "http-cache-semantics", + "version": "4.3.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.3.0.tgz", + "integrity": "sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==" + } + }, + "http-proxy-agent@9.1.0": { + "name": "http-proxy-agent", + "version": "9.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-9.1.0.tgz", + "integrity": "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig==" + }, + "dependencies": { + "agent-base": "agent-base@9.0.0", + "debug": "debug@4.4.3", + "proxy-agent-negotiate": "proxy-agent-negotiate@1.1.0" + } + }, + "https-proxy-agent@9.1.0": { + "name": "https-proxy-agent", + "version": "9.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-9.1.0.tgz", + "integrity": "sha512-ag87y7cJJ9/3+GxFr8Oy4O5faDsGRGnBGsJj/YjOSsSx/5eadKLYTMPlzuR6obgoCDDm0abAAZitXXQkMOPSpA==" + }, + "dependencies": { + "agent-base": "agent-base@9.0.0", + "debug": "debug@4.4.3", + "proxy-agent-negotiate": "proxy-agent-negotiate@1.1.0" + } + }, + "iconv-lite@0.7.3": { + "name": "iconv-lite", + "version": "0.7.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==" + }, + "dependencies": { + "safer-buffer": "safer-buffer@2.1.2" + } + }, + "ignore-walk@9.0.0": { + "name": "ignore-walk", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-9.0.0.tgz", + "integrity": "sha512-tCBEZV2z2FNpIDl2vrhiWzIHzs4qOAuIDEO85eS02vZ3L1U3P56qpPL8GuGGAijDktAEaq2swMkO/Fmbo7YmfQ==" + }, + "dependencies": { + "minimatch": "minimatch@10.2.6" + } + }, + "ini@7.0.0": { + "name": "ini", + "version": "7.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ini/-/ini-7.0.0.tgz", + "integrity": "sha512-ifK0CgjALofS5bkrcTy4RaQ9Vx2Knf/eLeIO+NaswQEpH1UblrtTSCIvN71qQDMq0PeQ/SSPojvEJp9vvvfr+w==" + } + }, + "init-package-json@9.0.0": { + "name": "init-package-json", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/init-package-json/-/init-package-json-9.0.0.tgz", + "integrity": "sha512-aYDqz4jgX1plB2GDCFYStlOh67QXVpAIeNgDq8rRGVDYMvLE39yYlf8+CjYY2chVOVfqLsSIycFYznHWozZ9CA==" + }, + "dependencies": { + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "promzard": "promzard@4.0.0", + "read": "read@6.0.0", + "semver": "semver@7.8.5", + "validate-npm-package-name": "validate-npm-package-name@8.0.0" + } + }, + "ip-address@10.7.5": { + "name": "ip-address", + "version": "10.7.5", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.5.tgz", + "integrity": "sha512-t2v0rkILYv9WXmSL7TpAaU3HXgaFYOPUcH3QHgwQ++gpJuH3bqyMy4Fvt/DJCTKwzH3Cf+bAp5W/mFL39KPLzA==" + } + }, + "is-cidr@7.0.3": { + "name": "is-cidr", + "version": "7.0.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/is-cidr/-/is-cidr-7.0.3.tgz", + "integrity": "sha512-lNg3nOT+LHKO4vughx1zLUpWUWkt87qu1dBzVrzzOpliIx6gnSIUCXvQfV0FzSHCm6p4ym7BhbakusmZQEC6pw==" + }, + "dependencies": { + "cidr-regex": "cidr-regex@7.1.2" + } + }, + "isexe@4.0.0": { + "name": "isexe", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/isexe/-/isexe-4.0.0.tgz", + "integrity": "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw==" + } + }, + "json-parse-even-better-errors@6.0.0": { + "name": "json-parse-even-better-errors", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-6.0.0.tgz", + "integrity": "sha512-2/8adwnK1/+Fdjyts4r6wSpfANWw8zdNhU9U/Llk59c6O+DjSisPWPykwoL8gZmocP9Dy64S7oie2g+Mia123A==" + } + }, + "json-stringify-nice@1.1.4": { + "name": "json-stringify-nice", + "version": "1.1.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz", + "integrity": "sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw==" + } + }, + "jsonparse@1.3.1": { + "name": "jsonparse", + "version": "1.3.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" + } + }, + "just-diff-apply@5.5.0": { + "name": "just-diff-apply", + "version": "5.5.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/just-diff-apply/-/just-diff-apply-5.5.0.tgz", + "integrity": "sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw==" + } + }, + "just-diff@6.0.2": { + "name": "just-diff", + "version": "6.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz", + "integrity": "sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA==" + } + }, + "libnpmaccess@11.0.0": { + "name": "libnpmaccess", + "version": "11.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmaccess/-/libnpmaccess-11.0.0.tgz", + "integrity": "sha512-qku5OaTtCv7f4xq5lmZMh4H6pd9WRalww3WF4PEk/aFo1Bpi7/IRCzy28EQBvyrprhzZGifbpM378U4waB9/0Q==" + }, + "dependencies": { + "npm-package-arg": "npm-package-arg@14.0.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1" + } + }, + "libnpmdiff@9.0.4": { + "name": "libnpmdiff", + "version": "9.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmdiff/-/libnpmdiff-9.0.4.tgz", + "integrity": "sha512-yMXW5Uu/ELhrHmnMQLZ1JXZxErCHCr/eq6ubMzV8ZCzzVOLTOK3ItTld+dYJTmqfM7w9tiuhYtI6ScWA+n88Dw==" + }, + "dependencies": { + "@npmcli/arborist": "@npmcli/arborist@10.0.4", + "@npmcli/installed-package-contents": "@npmcli/installed-package-contents@5.0.0", + "binary-extensions": "binary-extensions@3.2.0", + "diff": "diff@8.0.4", + "minimatch": "minimatch@10.2.6", + "npm-package-arg": "npm-package-arg@14.0.0", + "pacote": "pacote@22.0.1", + "tar": "tar@7.5.22" + } + }, + "libnpmexec@11.0.4": { + "name": "libnpmexec", + "version": "11.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmexec/-/libnpmexec-11.0.4.tgz", + "integrity": "sha512-zpgxYS2Ob56x7YZtK+lb9LPnIYa/leDLKXb/InokZBfcZxaQp4POTCUOge6BKsvhgGcN4ySNsv94GK5JsxhWjQ==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@npmcli/arborist": "@npmcli/arborist@10.0.4", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "ci-info": "ci-info@4.4.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "pacote": "pacote@22.0.1", + "proc-log": "proc-log@7.0.0", + "read": "read@6.0.0", + "semver": "semver@7.8.5", + "signal-exit": "signal-exit@4.1.0", + "walk-up-path": "walk-up-path@4.0.0" + } + }, + "libnpmfund@8.0.4": { + "name": "libnpmfund", + "version": "8.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmfund/-/libnpmfund-8.0.4.tgz", + "integrity": "sha512-T4WQsQ/m5Tn+ovr+bfJc+DDTEeBcQvdaHDKDHpLKqIv27bbztdVCDQWIOiAfXhQaqOWkLmHGM/qAi6PeTC8x9Q==" + }, + "dependencies": { + "@npmcli/arborist": "@npmcli/arborist@10.0.4" + } + }, + "libnpmorg@9.0.0": { + "name": "libnpmorg", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmorg/-/libnpmorg-9.0.0.tgz", + "integrity": "sha512-cPiStT2aFEGu5/so+VZlQDb5AuhiYFsEAHBOCjuXWbBQP2EcGmr6doOUNRV17L2HNTw1Wvqnq2+nSrINdBphAg==" + }, + "dependencies": { + "aproba": "aproba@2.1.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1" + } + }, + "libnpmpack@10.0.4": { + "name": "libnpmpack", + "version": "10.0.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmpack/-/libnpmpack-10.0.4.tgz", + "integrity": "sha512-I42lWghQC3wow13OBuGr/1zxNlKMe8bc4q8bgqSlyFOceuoPnJH4c0+mcNL7e6hOLshgzBbSILo2TmLCSMgGig==" + }, + "dependencies": { + "@npmcli/arborist": "@npmcli/arborist@10.0.4", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "pacote": "pacote@22.0.1" + } + }, + "libnpmpublish@12.0.1": { + "name": "libnpmpublish", + "version": "12.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmpublish/-/libnpmpublish-12.0.1.tgz", + "integrity": "sha512-gG32Hgikbb8mx+c+b2MKseuQcwKbiIl7wM4a5+scxuRtu/Q7L/fbywMyLD4naUfL0yexdKWzfi6kglMz6BGOWQ==" + }, + "dependencies": { + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "ci-info": "ci-info@4.4.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "sigstore": "sigstore@5.0.0", + "ssri": "ssri@14.0.0" + } + }, + "libnpmsearch@10.0.0": { + "name": "libnpmsearch", + "version": "10.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmsearch/-/libnpmsearch-10.0.0.tgz", + "integrity": "sha512-dNDPxoeIY8IC3ftpOaMGbaHMcxngu4PEyTdR5XZnWgh62QaCucUVK+7z7i2igIEUiOe4HJbZw/sU/5VOCCjkmA==" + }, + "dependencies": { + "npm-registry-fetch": "npm-registry-fetch@20.0.1" + } + }, + "libnpmteam@9.0.0": { + "name": "libnpmteam", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmteam/-/libnpmteam-9.0.0.tgz", + "integrity": "sha512-zZhmjQlRZDUyoHC1/Knc5lG7NVLZfu3wEGaotvILo6xKxE/njDDeZVJa2CS/cmZZ5ki7rSXg+0GNlqusiHqPTQ==" + }, + "dependencies": { + "aproba": "aproba@2.1.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1" + } + }, + "libnpmversion@9.0.0": { + "name": "libnpmversion", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/libnpmversion/-/libnpmversion-9.0.0.tgz", + "integrity": "sha512-v7vTEPiODFT6ciWXoVWEpsD5fPFNoyQ35OvrZgK7F0ZjJxR23l+UBvGzkhPGYc8Fft39k90Ej+l3/zCGu5tzcg==" + }, + "dependencies": { + "@npmcli/git": "@npmcli/git@8.0.0", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "json-parse-even-better-errors": "json-parse-even-better-errors@6.0.0", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5" + } + }, + "lru-cache@11.5.3": { + "name": "lru-cache", + "version": "11.5.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==" + } + }, + "make-fetch-happen@16.0.1": { + "name": "make-fetch-happen", + "version": "16.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-16.0.1.tgz", + "integrity": "sha512-uUv1yxHzaKVVEPfcFeGSNov/Cehjv08ovlY8ImTljgL7Q+SiA0dAYLQ6SYVa2kkKqNj4Y3aZEI7xv2teadie0A==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@npmcli/agent": "@npmcli/agent@5.0.2", + "@npmcli/redact": "@npmcli/redact@5.0.0", + "cacache": "cacache@21.0.1", + "http-cache-semantics": "http-cache-semantics@4.3.0", + "minipass": "minipass@7.1.3", + "minipass-fetch": "minipass-fetch@6.0.0", + "minipass-flush": "minipass-flush@1.0.7", + "minipass-pipeline": "minipass-pipeline@1.2.4", + "negotiator": "negotiator@1.1.0", + "proc-log": "proc-log@7.0.0", + "ssri": "ssri@14.0.0" + } + }, + "minimatch@10.2.6": { + "name": "minimatch", + "version": "10.2.6", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==" + }, + "dependencies": { + "brace-expansion": "brace-expansion@5.0.12" + } + }, + "minipass-collect@2.0.1": { + "name": "minipass-collect", + "version": "2.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "minipass-fetch@6.0.0": { + "name": "minipass-fetch", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-6.0.0.tgz", + "integrity": "sha512-AWI8bKapGmgx/J0E6IGYSKj8TiHebZkmKWSs8raPSw8KXwgEAJ+Bw3+LSdXHR6T/RHKAWCOYk2MiLrYluaUU6w==" + }, + "dependencies": { + "minipass": "minipass@7.1.3", + "minipass-sized": "minipass-sized@2.0.0", + "minizlib": "minizlib@3.1.0" + }, + "optionalDependencies": { + "iconv-lite": "iconv-lite@0.7.3" + } + }, + "minipass-flush@1.0.7": { + "name": "minipass-flush", + "version": "1.0.7", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.7.tgz", + "integrity": "sha512-TbqTz9cUwWyHS2Dy89P3ocAGUGxKjjLuR9z8w4WUTGAVgEj17/4nhgo2Du56i0Fm3Pm30g4iA8Lcqctc76jCzA==" + }, + "dependencies": { + "minipass": "minipass@3.3.6" + } + }, + "minipass-pipeline@1.2.4": { + "name": "minipass-pipeline", + "version": "1.2.4", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==" + }, + "dependencies": { + "minipass": "minipass@3.3.6" + } + }, + "minipass-sized@2.0.0": { + "name": "minipass-sized", + "version": "2.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-2.0.0.tgz", + "integrity": "sha512-zSsHhto5BcUVM2m1LurnXY6M//cGhVaegT71OfOXoprxT6o780GZd792ea6FfrQkuU4usHZIUczAQMRUE2plzA==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "minipass@3.3.6": { + "name": "minipass", + "version": "3.3.6", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==" + }, + "dependencies": { + "yallist": "yallist@4.0.0" + } + }, + "minipass@7.1.3": { + "name": "minipass", + "version": "7.1.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==" + } + }, + "minizlib@3.1.0": { + "name": "minizlib", + "version": "3.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "ms@2.1.3": { + "name": "ms", + "version": "2.1.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + }, + "mute-stream@4.0.0": { + "name": "mute-stream", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/mute-stream/-/mute-stream-4.0.0.tgz", + "integrity": "sha512-gSrprq0fJ3EiOErzjdIZrjysVVmJ4uu1QWfCDss5LypA5OXvrMje5Ym5z6V6RLyJ2eF87lasX7t6a0AnFvZblg==" + } + }, + "negotiator@1.1.0": { + "name": "negotiator", + "version": "1.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==" + }, + "dependencies": { + "content-type": "content-type@2.1.0" + } + }, + "node-gyp@13.1.0": { + "name": "node-gyp", + "version": "13.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/node-gyp/-/node-gyp-13.1.0.tgz", + "integrity": "sha512-FpNzOLFACKG0oRBYbZ5WOeWD1EqRTIWX90MaRIWTO18lVYPx8fqIjrdS3pihjnCkSmgop6zVGkSqg1vXZLksuw==" + }, + "dependencies": { + "env-paths": "env-paths@2.2.1", + "exponential-backoff": "exponential-backoff@3.1.3", + "graceful-fs": "graceful-fs@4.2.11", + "nopt": "nopt@10.0.1", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "tar": "tar@7.5.22", + "tinyglobby": "tinyglobby@0.2.17", + "undici": "undici@8.12.3", + "which": "which@7.0.0" + } + }, + "nopt@10.0.1": { + "name": "nopt", + "version": "10.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/nopt/-/nopt-10.0.1.tgz", + "integrity": "sha512-df3sBr/6ax9hSGuC3CspvLlbnX8cP5L5nZwXF8cGN8l0zSWR6BvzmQ6jPUKjvo6+/xdpkNvEcucBNUdBeeV13g==" + }, + "dependencies": { + "abbrev": "abbrev@5.0.0" + } + }, + "npm-audit-report@8.0.0": { + "name": "npm-audit-report", + "version": "8.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-8.0.0.tgz", + "integrity": "sha512-LrRtLB4NKdXin5dw4yxcES8GDXncfoVVcYzkn8bdwc0etpHmxtKKwwI1YTWpQ9+lEmzEnZo10Lzb11QLxuuBnA==" + } + }, + "npm-bundled@6.0.0": { + "name": "npm-bundled", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-6.0.0.tgz", + "integrity": "sha512-EqdodKEW6pYM+dPxA66TZQfMEqVDiuzjDM9edSjuPI1mXUbUJwVxkgqMZSJvs8RTXz2CGq8HUol/AffTZX5g8w==" + }, + "dependencies": { + "npm-normalize-package-bin": "npm-normalize-package-bin@6.0.0" + } + }, + "npm-install-checks@9.0.0": { + "name": "npm-install-checks", + "version": "9.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-9.0.0.tgz", + "integrity": "sha512-t05Izcgi7p15cpldqoiXYpjzlkTTvBw33sgjmL/JjcvtV0ydbm2O4iEXO8A6smqComu5FAQhUas86HTMQ6Z1Uw==" + }, + "dependencies": { + "semver": "semver@7.8.5" + } + }, + "npm-normalize-package-bin@6.0.0": { + "name": "npm-normalize-package-bin", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-6.0.0.tgz", + "integrity": "sha512-tdt4aFn9QamlhdN3HV2D2ccpBwO5/fyjjbXUxYA6uBjyekMZcZvDq0aSj9t5Jo+tih6AYFnt/cuIRn9013e0Uw==" + } + }, + "npm-package-arg@14.0.0": { + "name": "npm-package-arg", + "version": "14.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-14.0.0.tgz", + "integrity": "sha512-69XQh3k+dtGa1p+7RaR57IuG3rCko96xr/nUfN4yDYBXbTYICiWcOpsFKLN2GtGE9cyIljE+f1exnaYt9MvM+Q==" + }, + "dependencies": { + "hosted-git-info": "hosted-git-info@10.1.1", + "proc-log": "proc-log@7.0.0", + "semver": "semver@7.8.5", + "validate-npm-package-name": "validate-npm-package-name@8.0.0" + } + }, + "npm-packlist@11.3.0": { + "name": "npm-packlist", + "version": "11.3.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-11.3.0.tgz", + "integrity": "sha512-cS1yVkyriZgQAbiK8PtwhZHEtsFOsKHsCg5Ww2ONckAvXIspgqd6o4WirOzvkupU24iMRZ4xtO4kb2iK2rbnag==" + }, + "dependencies": { + "glob": "glob@13.0.6", + "ignore-walk": "ignore-walk@9.0.0", + "proc-log": "proc-log@7.0.0" + } + }, + "npm-pick-manifest@12.0.0": { + "name": "npm-pick-manifest", + "version": "12.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-12.0.0.tgz", + "integrity": "sha512-8Fs3YLrnNOhrCdPNZy18MzNgVC58LTDAFzq1FdZO/p3BHeCC/coz+t4F5Pxabys8HJpyTUorMea26GkXsb4J/Q==" + }, + "dependencies": { + "npm-install-checks": "npm-install-checks@9.0.0", + "npm-normalize-package-bin": "npm-normalize-package-bin@6.0.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "semver": "semver@7.8.5" + } + }, + "npm-profile@13.0.1": { + "name": "npm-profile", + "version": "13.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-profile/-/npm-profile-13.0.1.tgz", + "integrity": "sha512-buFDWLwggBSiT5wsjhoSHNvGy+KHaBI5n8ilvSOBkrQUbEsyKYdCV6PloJGFsQ53ZqXCqhwds/8dbvyHQuH3IA==" + }, + "dependencies": { + "npm-registry-fetch": "npm-registry-fetch@20.0.1", + "proc-log": "proc-log@7.0.0" + } + }, + "npm-registry-fetch@20.0.1": { + "name": "npm-registry-fetch", + "version": "20.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-20.0.1.tgz", + "integrity": "sha512-vzc1svxw/kw1IRjFsLi6gaxe1Olqm88V0tIfu2u5raL0b1gChe6ZEXNkyUlKxUC7s/egt5NxZHkbY18tMKKLfQ==" + }, + "dependencies": { + "@npmcli/redact": "@npmcli/redact@5.0.0", + "jsonparse": "jsonparse@1.3.1", + "make-fetch-happen": "make-fetch-happen@16.0.1", + "minipass": "minipass@7.1.3", + "minipass-fetch": "minipass-fetch@6.0.0", + "minizlib": "minizlib@3.1.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "proc-log": "proc-log@7.0.0" + } + }, + "npm-user-validate@5.0.0": { + "name": "npm-user-validate", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm-user-validate/-/npm-user-validate-5.0.0.tgz", + "integrity": "sha512-yZKlDPJOukQIRzXL+qYyuczXtnQTSF732zT6umGfy/8DxXEAdnv22eA/UpBsC0Fv9s4yfDYkK1pLnCPB0GxsqQ==" + } + }, + "npm@12.2.1": { + "name": "npm", + "version": "12.2.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/npm/-/npm-12.2.1.tgz", + "integrity": "sha512-bKCmFRVT/BB+YPEYbZwQ1XUI3N5t4xKSpU1MxOjo7z3iWzKBJ0ZXRC1xFdEN+TC7N5TdywaBzf2dMXGJq/e2PQ==" + }, + "dependencies": { + "@isaacs/string-locale-compare": "@isaacs/string-locale-compare@1.1.0", + "@npmcli/arborist": "@npmcli/arborist@10.0.4", + "@npmcli/config": "@npmcli/config@11.2.0", + "@npmcli/fs": "@npmcli/fs@6.0.0", + "@npmcli/git": "@npmcli/git@8.0.0", + "@npmcli/map-workspaces": "@npmcli/map-workspaces@6.0.0", + "@npmcli/metavuln-calculator": "@npmcli/metavuln-calculator@10.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "@npmcli/promise-spawn": "@npmcli/promise-spawn@10.0.1", + "@npmcli/redact": "@npmcli/redact@5.0.0", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "@sigstore/tuf": "@sigstore/tuf@5.0.0", + "abbrev": "abbrev@5.0.0", + "archy": "archy@1.0.0", + "bin-links": "bin-links@7.0.1", + "cacache": "cacache@21.0.1", + "chalk": "chalk@5.6.2", + "ci-info": "ci-info@4.4.0", + "diff": "diff@8.0.4", + "fastest-levenshtein": "fastest-levenshtein@1.0.16", + "fs-minipass": "fs-minipass@3.0.3", + "glob": "glob@13.0.6", + "graceful-fs": "graceful-fs@4.2.11", + "hosted-git-info": "hosted-git-info@10.1.1", + "ini": "ini@7.0.0", + "init-package-json": "init-package-json@9.0.0", + "is-cidr": "is-cidr@7.0.3", + "json-parse-even-better-errors": "json-parse-even-better-errors@6.0.0", + "libnpmaccess": "libnpmaccess@11.0.0", + "libnpmdiff": "libnpmdiff@9.0.4", + "libnpmexec": "libnpmexec@11.0.4", + "libnpmfund": "libnpmfund@8.0.4", + "libnpmorg": "libnpmorg@9.0.0", + "libnpmpack": "libnpmpack@10.0.4", + "libnpmpublish": "libnpmpublish@12.0.1", + "libnpmsearch": "libnpmsearch@10.0.0", + "libnpmteam": "libnpmteam@9.0.0", + "libnpmversion": "libnpmversion@9.0.0", + "make-fetch-happen": "make-fetch-happen@16.0.1", + "minimatch": "minimatch@10.2.6", + "minipass": "minipass@7.1.3", + "minipass-pipeline": "minipass-pipeline@1.2.4", + "ms": "ms@2.1.3", + "node-gyp": "node-gyp@13.1.0", + "nopt": "nopt@10.0.1", + "npm-audit-report": "npm-audit-report@8.0.0", + "npm-install-checks": "npm-install-checks@9.0.0", + "npm-package-arg": "npm-package-arg@14.0.0", + "npm-pick-manifest": "npm-pick-manifest@12.0.0", + "npm-profile": "npm-profile@13.0.1", + "npm-registry-fetch": "npm-registry-fetch@20.0.1", + "npm-user-validate": "npm-user-validate@5.0.0", + "p-map": "p-map@7.1.1", + "pacote": "pacote@22.0.1", + "parse-conflict-json": "parse-conflict-json@6.0.0", + "proc-log": "proc-log@7.0.0", + "qrcode-terminal": "qrcode-terminal@0.12.0", + "read": "read@6.0.0", + "semver": "semver@7.8.5", + "spdx-expression-parse": "spdx-expression-parse@4.0.0", + "ssri": "ssri@14.0.0", + "supports-color": "supports-color@10.2.2", + "tar": "tar@7.5.22", + "text-table": "text-table@0.2.0", + "tiny-relative-date": "tiny-relative-date@2.0.2", + "treeverse": "treeverse@3.0.0", + "validate-npm-package-name": "validate-npm-package-name@8.0.0", + "which": "which@7.0.0" + } + }, + "p-map@7.1.1": { + "name": "p-map", + "version": "7.1.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/p-map/-/p-map-7.1.1.tgz", + "integrity": "sha512-6Lh3jQPLthYujSrlw6ccWXBGZTkoTCz27Hd92g79LH/kjAbgoEu0t442cCCNbegPSJsA0lwDX8z0bcKtkpA32g==" + } + }, + "pacote@22.0.1": { + "name": "pacote", + "version": "22.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/pacote/-/pacote-22.0.1.tgz", + "integrity": "sha512-pu51B21E5u3MXD+ujjYO09ppqXmFLph1iPR17ySgKoakAj/iDApcMoQprUff8Wj96emV2tFhMRFkCvEMFnIDPQ==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@npmcli/git": "@npmcli/git@8.0.0", + "@npmcli/installed-package-contents": "@npmcli/installed-package-contents@5.0.0", + "@npmcli/package-json": "@npmcli/package-json@8.0.0", + "@npmcli/promise-spawn": "@npmcli/promise-spawn@10.0.1", + "@npmcli/run-script": "@npmcli/run-script@11.0.0", + "cacache": "cacache@21.0.1", + "fs-minipass": "fs-minipass@3.0.3", + "minipass": "minipass@7.1.3", + "npm-package-arg": "npm-package-arg@14.0.0", + "npm-packlist": "npm-packlist@11.3.0", + "npm-pick-manifest": "npm-pick-manifest@12.0.0", + "npm-registry-fetch": "npm-registry-fetch@20.0.1", + "proc-log": "proc-log@7.0.0", + "sigstore": "sigstore@5.0.0", + "ssri": "ssri@14.0.0", + "tar": "tar@7.5.22" + } + }, + "parse-conflict-json@6.0.0": { + "name": "parse-conflict-json", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/parse-conflict-json/-/parse-conflict-json-6.0.0.tgz", + "integrity": "sha512-JIdsITvN0yVRpYxiip9DpCduYi75AryIDSCf6ez/Yul6PV46L0B/8SxSvLiMmWiUZKopLrD1BZgexxCfufoT9w==" + }, + "dependencies": { + "json-parse-even-better-errors": "json-parse-even-better-errors@6.0.0", + "just-diff": "just-diff@6.0.2", + "just-diff-apply": "just-diff-apply@5.5.0" + } + }, + "path-scurry@2.0.2": { + "name": "path-scurry", + "version": "2.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==" + }, + "dependencies": { + "lru-cache": "lru-cache@11.5.3", + "minipass": "minipass@7.1.3" + } + }, + "picomatch@4.0.7": { + "name": "picomatch", + "version": "4.0.7", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==" + } + }, + "pnpm@12.15.0": { + "name": "pnpm", + "version": "12.15.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/pnpm/-/pnpm-12.15.0.tgz", + "integrity": "sha512-s5UdbW/0qfE9x89WzSjSuOs328ycaOUuHhGRhz6p+CoBcoerULqtxczElPA2xnwOR+sTYIwvo29HcRth6hKOYQ==" + }, + "optionalDependencies": { + "@pnpm/exe.android-arm64": "@pnpm/exe.android-arm64@12.15.0", + "@pnpm/exe.android-x64": "@pnpm/exe.android-x64@12.15.0", + "@pnpm/exe.darwin-arm64": "@pnpm/exe.darwin-arm64@12.15.0", + "@pnpm/exe.darwin-x64": "@pnpm/exe.darwin-x64@12.15.0", + "@pnpm/exe.freebsd-x64": "@pnpm/exe.freebsd-x64@12.15.0", + "@pnpm/exe.linux-arm64": "@pnpm/exe.linux-arm64@12.15.0", + "@pnpm/exe.linux-arm64-musl": "@pnpm/exe.linux-arm64-musl@12.15.0", + "@pnpm/exe.linux-ppc64": "@pnpm/exe.linux-ppc64@12.15.0", + "@pnpm/exe.linux-riscv64": "@pnpm/exe.linux-riscv64@12.15.0", + "@pnpm/exe.linux-s390x": "@pnpm/exe.linux-s390x@12.15.0", + "@pnpm/exe.linux-x64": "@pnpm/exe.linux-x64@12.15.0", + "@pnpm/exe.linux-x64-musl": "@pnpm/exe.linux-x64-musl@12.15.0", + "@pnpm/exe.win32-arm64": "@pnpm/exe.win32-arm64@12.15.0", + "@pnpm/exe.win32-x64": "@pnpm/exe.win32-x64@12.15.0" + } + }, + "postcss-selector-parser@7.1.7": { + "name": "postcss-selector-parser", + "version": "7.1.7", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.7.tgz", + "integrity": "sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==" + }, + "dependencies": { + "cssesc": "cssesc@3.0.0", + "util-deprecate": "util-deprecate@1.0.2" + } + }, + "proc-log@7.0.0": { + "name": "proc-log", + "version": "7.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/proc-log/-/proc-log-7.0.0.tgz", + "integrity": "sha512-FYgfaA69XZ93zaXLoMNQ+ViDXGGBgR8aLh03txzcFhV+9xOXx7+8DLCULrKKpR9+GsH9ZfHm82aSUPpozX0Ztg==" + } + }, + "proggy@4.0.0": { + "name": "proggy", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/proggy/-/proggy-4.0.0.tgz", + "integrity": "sha512-MbA4R+WQT76ZBm/5JUpV9yqcJt92175+Y0Bodg3HgiXzrmKu7Ggq+bpn6y6wHH+gN9NcyKn3yg1+d47VaKwNAQ==" + } + }, + "promise-all-reject-late@1.0.1": { + "name": "promise-all-reject-late", + "version": "1.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz", + "integrity": "sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw==" + } + }, + "promise-call-limit@3.0.2": { + "name": "promise-call-limit", + "version": "3.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/promise-call-limit/-/promise-call-limit-3.0.2.tgz", + "integrity": "sha512-mRPQO2T1QQVw11E7+UdCJu7S61eJVWknzml9sC1heAdj1jxl0fWMBypIt9ZOcLFf8FkG995ZD7RnVk7HH72fZw==" + } + }, + "promzard@4.0.0": { + "name": "promzard", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/promzard/-/promzard-4.0.0.tgz", + "integrity": "sha512-zqf38XGznB+ECFHQPGt0RNQCh0YF+r5iac0EZloSQlEWDxt0vCS39PEtUShBJOZU0tcJ+USPvmnyGo+3CEFwcQ==" + }, + "dependencies": { + "read": "read@6.0.0" + } + }, + "proxy-agent-negotiate@1.1.0": { + "name": "proxy-agent-negotiate", + "version": "1.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/proxy-agent-negotiate/-/proxy-agent-negotiate-1.1.0.tgz", + "integrity": "sha512-N8IBcM3UgCVzz2L2Lqv8DVntDnnC8/hiV4nEDUPkqq72TPUgYWjQc+bdZlBPZK9LzPAvOY//gAt0S0DApoOXWQ==" + } + }, + "qrcode-terminal@0.12.0": { + "name": "qrcode-terminal", + "version": "0.12.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz", + "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==" + } + }, + "read-cmd-shim@7.0.1": { + "name": "read-cmd-shim", + "version": "7.0.1", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-7.0.1.tgz", + "integrity": "sha512-GhAsW4iJS0xNqv8P6HocT3gb5HCKHtEBKLIN7fE2oWr27jGIEihu48lXyGGeexkbiLv1XAbwyXvgjYMfT81kZA==" + } + }, + "read@6.0.0": { + "name": "read", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/read/-/read-6.0.0.tgz", + "integrity": "sha512-Tg/LaEke7h9SDbp0xJJj53oa4s1VPPySVnxQF9nUS9DgA25M/ZCLk7RVF1kHjytC87XbkgQKmQ/79+DQgEIqLA==" + }, + "dependencies": { + "mute-stream": "mute-stream@4.0.0" + } + }, + "safer-buffer@2.1.2": { + "name": "safer-buffer", + "version": "2.1.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + } + }, + "semver@7.8.5": { + "name": "semver", + "version": "7.8.5", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==" + } + }, + "signal-exit@4.1.0": { + "name": "signal-exit", + "version": "4.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==" + } + }, + "sigstore@5.0.0": { + "name": "sigstore", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/sigstore/-/sigstore-5.0.0.tgz", + "integrity": "sha512-hJqJfoG/e4qFQaauQL00c6J6FrHLBGKtkFvW3JbTSIEFOhLrSjdSM/gWd/yUOfYo/gsERehTXGC1VZWX+9X4Dg==" + }, + "dependencies": { + "@sigstore/bundle": "@sigstore/bundle@5.0.0", + "@sigstore/core": "@sigstore/core@4.0.1", + "@sigstore/protobuf-specs": "@sigstore/protobuf-specs@0.5.2", + "@sigstore/sign": "@sigstore/sign@5.0.0", + "@sigstore/tuf": "@sigstore/tuf@5.0.0", + "@sigstore/verify": "@sigstore/verify@4.1.2" + } + }, + "smart-buffer@4.2.0": { + "name": "smart-buffer", + "version": "4.2.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==" + } + }, + "socks-proxy-agent@10.1.0": { + "name": "socks-proxy-agent", + "version": "10.1.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-10.1.0.tgz", + "integrity": "sha512-WlMj/67cEJ6MDI1OcsnjuYKDNDoyPCCYZ249kuuXPiMDw9F8PXkVaQ7YWu3siTydfQ/4BEZcvGzu+aYvz7dDCQ==" + }, + "dependencies": { + "agent-base": "agent-base@9.0.0", + "debug": "debug@4.4.3", + "socks": "socks@2.8.10" + } + }, + "socks@2.8.10": { + "name": "socks", + "version": "2.8.10", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/socks/-/socks-2.8.10.tgz", + "integrity": "sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==" + }, + "dependencies": { + "ip-address": "ip-address@10.7.5", + "smart-buffer": "smart-buffer@4.2.0" + } + }, + "spdx-exceptions@2.5.0": { + "name": "spdx-exceptions", + "version": "2.5.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + } + }, + "spdx-expression-parse@4.0.0": { + "name": "spdx-expression-parse", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==" + }, + "dependencies": { + "spdx-exceptions": "spdx-exceptions@2.5.0", + "spdx-license-ids": "spdx-license-ids@3.0.24" + } + }, + "spdx-license-ids@3.0.24": { + "name": "spdx-license-ids", + "version": "3.0.24", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.24.tgz", + "integrity": "sha512-cLS9TtWkIQFyLkJ3/5aFQAOHOSKTlOs/7WDut/XPSdjom1fJhUdkepeJAKXa9Y05+FabHd0sti+Et559vDtkpQ==" + } + }, + "ssri@14.0.0": { + "name": "ssri", + "version": "14.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/ssri/-/ssri-14.0.0.tgz", + "integrity": "sha512-jQxKI0yx0ZnTKrqjKkLDV2DXkBQn3k49JVmVqDGcDwKDtGDbImD/GXsq04KD0VVzCQQ9wZJYal3RwR1GzWTSow==" + }, + "dependencies": { + "minipass": "minipass@7.1.3" + } + }, + "supports-color@10.2.2": { + "name": "supports-color", + "version": "10.2.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==" + } + }, + "tar@7.5.22": { + "name": "tar", + "version": "7.5.22", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/tar/-/tar-7.5.22.tgz", + "integrity": "sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==" + }, + "dependencies": { + "@isaacs/fs-minipass": "@isaacs/fs-minipass@4.0.1", + "chownr": "chownr@3.0.0", + "minipass": "minipass@7.1.3", + "minizlib": "minizlib@3.1.0", + "yallist": "yallist@5.0.0" + } + }, + "text-table@0.2.0": { + "name": "text-table", + "version": "0.2.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + } + }, + "tiny-relative-date@2.0.2": { + "name": "tiny-relative-date", + "version": "2.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/tiny-relative-date/-/tiny-relative-date-2.0.2.tgz", + "integrity": "sha512-rGxAbeL9z3J4pI2GtBEoFaavHdO4RKAU54hEuOef5kfx5aPqiQtbhYktMOTL5OA33db8BjsDcLXuNp+/v19PHw==" + } + }, + "tinyglobby@0.2.17": { + "name": "tinyglobby", + "version": "0.2.17", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==" + }, + "dependencies": { + "fdir": "fdir@6.5.0_picomatch@4.0.7", + "picomatch": "picomatch@4.0.7" + } + }, + "treeverse@3.0.0": { + "name": "treeverse", + "version": "3.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/treeverse/-/treeverse-3.0.0.tgz", + "integrity": "sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ==" + } + }, + "tuf-js@6.0.0": { + "name": "tuf-js", + "version": "6.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/tuf-js/-/tuf-js-6.0.0.tgz", + "integrity": "sha512-zlJVOIO68hmgo1//X4ENEcTGfuOTAtDPi8PsTsG+FyxD85E/ww1ZnwBbWo/yCEExGpI+Kilg7Z3qCdHX2BoJTQ==" + }, + "dependencies": { + "@gar/promise-retry": "@gar/promise-retry@1.0.3", + "@tufjs/models": "@tufjs/models@5.0.0", + "debug": "debug@4.4.3" + } + }, + "undici@8.12.3": { + "name": "undici", + "version": "8.12.3", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz", + "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==" + } + }, + "util-deprecate@1.0.2": { + "name": "util-deprecate", + "version": "1.0.2", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + } + }, + "validate-npm-package-name@8.0.0": { + "name": "validate-npm-package-name", + "version": "8.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-8.0.0.tgz", + "integrity": "sha512-SCv6OOV6Xj2/3cXy3dGmADluJTNcL3o7hZAglNPTe+WYuEuvxgJzxPrSDLZhF+CwyQOubqgecjMmTJGMVLWjYQ==" + } + }, + "walk-up-path@4.0.0": { + "name": "walk-up-path", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-4.0.0.tgz", + "integrity": "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==" + } + }, + "which@7.0.0": { + "name": "which", + "version": "7.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/which/-/which-7.0.0.tgz", + "integrity": "sha512-RancgH2dmbLdHl6LRhEqvklWMgl/Hdnun0Y90KhBOLkMefg8Qa7/Zel8Sm+8HEcP6DEjzsWzpkuBQEZok58isA==" + }, + "dependencies": { + "isexe": "isexe@4.0.0" + } + }, + "write-file-atomic@8.0.0": { + "name": "write-file-atomic", + "version": "8.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-8.0.0.tgz", + "integrity": "sha512-dYwyZredl67GyLLIHJnRM3h2PcOmN5SkcgC7eM5DPDEOEl6dLFqVrMg3F1Ea32usj4VSVZtd2H4MtKTNOf6nPg==" + }, + "dependencies": { + "signal-exit": "signal-exit@4.1.0" + } + }, + "yallist@4.0.0": { + "name": "yallist", + "version": "4.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + }, + "yallist@5.0.0": { + "name": "yallist", + "version": "5.0.0", + "resolution": { + "type": "registry", + "tarball": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==" + } + } + } +} diff --git a/bench/tools/package.json b/bench/tools/package.json new file mode 100644 index 0000000..1b02ed0 --- /dev/null +++ b/bench/tools/package.json @@ -0,0 +1,10 @@ +{ + "name": "bench-tools", + "description": "The package managers the benchmark races craft against, pinned", + "private": true, + "devDependencies": { + "@yarnpkg/cli-dist": "4.18.1", + "npm": "12.2.1", + "pnpm": "12.15.0" + } +} diff --git a/bench/verify.mjs b/bench/verify.mjs new file mode 100644 index 0000000..a1f44d7 --- /dev/null +++ b/bench/verify.mjs @@ -0,0 +1,12 @@ +import { existsSync, readFileSync } from 'node:fs' +import { join } from 'node:path' + +const project = process.argv[2] +const manifest = JSON.parse(readFileSync(join(project, 'package.json'), 'utf8')) +const direct = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies }) +const missing = direct.filter((name) => !existsSync(join(project, 'node_modules', name, 'package.json'))) + +if (missing.length > 0) { + console.error(`error: ${project} is missing ${missing.join(', ')}`) + process.exit(1) +} diff --git a/crates/actor/src/add_package_actor.rs b/crates/actor/src/add_package_actor.rs index f00b4e7..d30f1db 100644 --- a/crates/actor/src/add_package_actor.rs +++ b/crates/actor/src/add_package_actor.rs @@ -60,7 +60,7 @@ impl Actor for AddPackageActor { let mut graph = InstallPipe::new(&self.context, [existing, added.clone()].concat()) .with_lockfile(lockfile.as_ref()) - .run() + .into_graph() .await?; let added_roots: Vec = added .iter() diff --git a/crates/actor/src/install_actor.rs b/crates/actor/src/install_actor.rs index 242647b..3269e35 100644 --- a/crates/actor/src/install_actor.rs +++ b/crates/actor/src/install_actor.rs @@ -67,7 +67,7 @@ impl Actor for InstallActor { if is_frozen { pipe = pipe.frozen(); } - let graph = pipe.run().await?; + let graph = pipe.into_graph().await?; LinkerPipe::new(&self.context, graph.clone()).run().await?; run_install_scripts(&self.context, graph.clone(), &package_json, &policy, true).await?; diff --git a/crates/actor/src/remove_package_actor.rs b/crates/actor/src/remove_package_actor.rs index 99415c9..30dad15 100644 --- a/crates/actor/src/remove_package_actor.rs +++ b/crates/actor/src/remove_package_actor.rs @@ -39,7 +39,7 @@ impl Actor for RemovePackageActor { debug::warning!("Package {} not found in node_modules", package_name); } } - prune_node_modules(&node_modules, None).await?; + prune_node_modules(&node_modules).await?; let package_json_path = self.context.package_json_path(); if !package_json_path.exists() { diff --git a/crates/actor/src/update_actor.rs b/crates/actor/src/update_actor.rs index cf1c260..dd39e29 100644 --- a/crates/actor/src/update_actor.rs +++ b/crates/actor/src/update_actor.rs @@ -59,7 +59,7 @@ impl Actor for UpdateActor { let preferred = lockfile.as_ref().filter(|_| !updates_everything); let graph = InstallPipe::new(&self.context, packages) .with_lockfile(preferred) - .run() + .into_graph() .await?; LinkerPipe::new(&self.context, graph.clone()).run().await?; let policy = script_policy(&package_json, false); diff --git a/crates/fsutil/src/copy.rs b/crates/fsutil/src/copy.rs index 6e2d322..b684d8b 100644 --- a/crates/fsutil/src/copy.rs +++ b/crates/fsutil/src/copy.rs @@ -11,6 +11,10 @@ static STAGING_COUNTER: AtomicUsize = AtomicUsize::new(0); /// (unsupported filesystem, different device) it is not retried for every file. static STORE_IMPORT_METHOD: AtomicU8 = AtomicU8::new(Method::Clone as u8); static SOURCE_IMPORT_METHOD: AtomicU8 = AtomicU8::new(Method::Clone as u8); +/// Whether whole directories can still be cloned in one call; off once the filesystem says it +/// can't, like the per-file methods. +#[cfg(target_os = "macos")] +static TREE_CLONE_WORKS: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(true); #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] #[repr(u8)] @@ -92,6 +96,10 @@ async fn stage( let (source_dir, staging_dir) = (source.to_path_buf(), staging.clone()); let excluded: Vec = excluded.iter().map(|name| name.to_string()).collect(); let copied = tokio::task::spawn_blocking(move || { + let is_whole_tree = excluded.is_empty(); + if is_whole_tree && clone_tree(&source_dir, &staging_dir) { + return Ok(()); + } copy_tree(&source_dir, &staging_dir, &excluded, import) }) .await @@ -104,6 +112,32 @@ async fn stage( Ok(staging) } +/// Clones the directory `source` as `dest` with a single `clonefile`, far cheaper than a clone per +/// file. Leaves nothing at `dest` when it fails, so the caller can copy instead. +#[cfg(target_os = "macos")] +fn clone_tree(source: &Path, dest: &Path) -> bool { + if !TREE_CLONE_WORKS.load(Ordering::Relaxed) { + return false; + } + let Err(error) = reflink_copy::reflink(source, dest) else { + return true; + }; + let is_unsupported = matches!( + error.kind(), + io::ErrorKind::Unsupported | io::ErrorKind::CrossesDevices + ); + if is_unsupported { + TREE_CLONE_WORKS.store(false, Ordering::Relaxed); + } + let _ = fs::remove_dir_all(dest); + false +} + +#[cfg(not(target_os = "macos"))] +fn clone_tree(_source: &Path, _dest: &Path) -> bool { + false +} + fn copy_tree(source: &Path, dest: &Path, excluded: &[String], import: Import) -> io::Result<()> { fs::create_dir_all(dest)?; for entry in fs::read_dir(source)? { @@ -269,6 +303,26 @@ mod tests { assert_eq!(fs::read_dir(dest.parent().unwrap()).unwrap().count(), 1); } + #[tokio::test] + async fn test_imports_without_hardlinks_never_share_the_store_files() { + let dir = tempfile::tempdir().unwrap(); + let store_entry = dir.path().join("store/pkg@1.0.0-abc"); + fs::create_dir_all(store_entry.join("lib")).unwrap(); + fs::write(store_entry.join("lib/index.js"), "original").unwrap(); + let dest = dir + .path() + .join("app/node_modules/.craft/pkg@1.0.0/node_modules/pkg"); + + import_dir(&store_entry, &dest, false).await.unwrap(); + fs::write(dest.join("lib/index.js"), "built").unwrap(); + + assert_eq!( + fs::read_to_string(store_entry.join("lib/index.js")).unwrap(), + "original" + ); + assert_eq!(fs::read_dir(dest.parent().unwrap()).unwrap().count(), 1); + } + #[test] fn test_falls_back_from_cheaper_methods() { assert!(next_method(Method::Clone, Import::FromStore) == Method::Hardlink); diff --git a/crates/network/src/network.rs b/crates/network/src/network.rs index d62d547..aca38b9 100644 --- a/crates/network/src/network.rs +++ b/crates/network/src/network.rs @@ -11,8 +11,8 @@ use bytes::Bytes; use contract::{NetworkError, NetworkMode, RegistryConfig, Result, user_agent}; use reqwest::StatusCode; use reqwest::header::{ - AUTHORIZATION, CACHE_CONTROL, ETAG, HeaderMap, HeaderValue, IF_MODIFIED_SINCE, IF_NONE_MATCH, - LAST_MODIFIED, RETRY_AFTER, + ACCEPT, AUTHORIZATION, CACHE_CONTROL, ETAG, HeaderMap, HeaderValue, IF_MODIFIED_SINCE, + IF_NONE_MATCH, LAST_MODIFIED, RETRY_AFTER, }; use reqwest::{Certificate, Client, ClientBuilder, NoProxy, Proxy, RequestBuilder}; use serde::de::DeserializeOwned; @@ -25,6 +25,10 @@ const READ_TIMEOUT: Duration = Duration::from_secs(60); const BASE_RETRY_DELAY: Duration = Duration::from_millis(500); const MAX_RETRY_DELAY: Duration = Duration::from_secs(30); const MAX_JITTER_MILLIS: u64 = 250; +/// Abbreviated packuments carry what installing needs at a fraction of the size; registries +/// without them answer with the full document. +const ABBREVIATED_PACKUMENT: &str = + "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"; #[derive(Debug)] pub struct Network { @@ -58,15 +62,15 @@ impl Network { } } - /// GETs `url` conditionally on the cached copy's validators: `NotModified` means the cached - /// body is still current. - pub async fn fetch_revalidated( + /// GETs the packument at `url`, abbreviated where the registry has it, conditionally on the + /// cached copy's validators: `NotModified` means the cached body is still current. + pub async fn fetch_packument( &self, url: &str, cached: Option<&Validators>, ) -> Result { self.with_retries(url, || async { - let mut request = self.get(url); + let mut request = self.get(url).header(ACCEPT, ABBREVIATED_PACKUMENT); if let Some(etag) = cached.and_then(|cached| cached.etag.as_deref()) { request = request.header(IF_NONE_MATCH, etag); } @@ -142,7 +146,7 @@ impl Network { impl Network { /// GETs `url` and reads the whole body, with retries. - async fn get_body(&self, url: &str) -> Result { + pub async fn get_body(&self, url: &str) -> Result { self.with_retries(url, || async { let response = self.send(url).await?; response.bytes().await.map_err(Failure::from_transport) diff --git a/crates/package/src/install_package.rs b/crates/package/src/install_package.rs index 8ff00c9..e354f16 100644 --- a/crates/package/src/install_package.rs +++ b/crates/package/src/install_package.rs @@ -2,8 +2,8 @@ use std::fmt::Display; use std::path::PathBuf; use crate::DependencySection; +pub use crate::PackageJson; use crate::dependency_spec::{is_location, split_name_and_spec}; -pub use crate::{NpmPackage, PackageJson}; #[derive(Debug, Clone)] pub struct InstallPackage { diff --git a/crates/package/src/lib.rs b/crates/package/src/lib.rs index 4fc137f..d790cba 100644 --- a/crates/package/src/lib.rs +++ b/crates/package/src/lib.rs @@ -6,6 +6,6 @@ pub mod project_manifest; pub use dependency_spec::{DependencySpec, VersionRequirement}; pub use install_package::InstallPackage; -pub use npm::{NpmPackage, PackageBin, PackageJson, PeerSpec}; +pub use npm::{PackageBin, PackageJson, PeerSpec}; pub use platform::PlatformConstraints; pub use project_manifest::{DependencySection, ProjectManifest}; diff --git a/crates/package/src/npm.rs b/crates/package/src/npm.rs index 3745f3a..3a8c777 100644 --- a/crates/package/src/npm.rs +++ b/crates/package/src/npm.rs @@ -157,14 +157,6 @@ pub struct PackageDist { pub shasum: Option, } -#[derive(Debug, Deserialize)] -pub struct NpmPackage { - pub name: String, - #[serde(rename = "dist-tags")] - pub dist_tags: HashMap, - pub versions: HashMap, -} - /// Published manifests are loosely typed: some old ones put objects among their scripts /// (`"blanket": { "pattern": … }`). Like npm, only the string entries count. fn string_entries<'de, D>( diff --git a/crates/pipeline/src/pipes/install_pipe.rs b/crates/pipeline/src/pipes/install_pipe.rs index f0ea351..0ea541d 100644 --- a/crates/pipeline/src/pipes/install_pipe.rs +++ b/crates/pipeline/src/pipes/install_pipe.rs @@ -57,6 +57,14 @@ impl InstallPipe { self } + /// Resolves the graph, then leaks the pipe instead of dropping it: the command exits soon + /// after, and freeing every parsed packument one by one takes about a second on large trees. + pub async fn into_graph(self) -> Result { + let graph = self.run().await; + std::mem::forget(self); + graph + } + // async_recursion marks the boxed future it returns `#[must_use]` a second time. #[allow(clippy::double_must_use)] #[async_recursion::async_recursion] diff --git a/crates/pipeline/src/pipes/linker_pipe.rs b/crates/pipeline/src/pipes/linker_pipe.rs index 8f9aacd..d18458e 100644 --- a/crates/pipeline/src/pipes/linker_pipe.rs +++ b/crates/pipeline/src/pipes/linker_pipe.rs @@ -8,8 +8,8 @@ use node_semver::Version; use resolver::{ArtifactSource, DependencyKind, Edge, NodeId, ResolutionGraph, ResolvedNode}; use super::bins::package_bins; -use super::prune::prune_node_modules; -use super::virtual_store::VirtualStore; +use super::prune::prune_to_graph; +use super::virtual_store::{VirtualStore, entry_name}; const LINK_CONCURRENCY: usize = 16; const COPY_EXCLUDED: [&str; 2] = ["node_modules", ".git"]; @@ -51,7 +51,7 @@ impl LinkerPipe { imported.with_context(|| format!("failed to import {node_id} into node_modules")) } - /// Links a package's dependencies beside it in its virtual store entry, plus their bins. + /// Links a package's dependencies beside it in its virtual store entry. async fn link_dependencies(&self, node_id: &NodeId, node: &ResolvedNode) -> Result<()> { let is_link = matches!(node.artifact.source, ArtifactSource::Link { .. }); if is_link || node.dependencies.is_empty() { @@ -69,6 +69,17 @@ impl LinkerPipe { } self.link_edge(edge, &modules_dir).await?; } + Ok(()) + } + + /// Links the bins of a package's dependencies beside it. Linking a bin makes its file + /// executable, so the dependencies must be imported first. + async fn link_dependency_bins(&self, node_id: &NodeId, node: &ResolvedNode) -> Result<()> { + let is_link = matches!(node.artifact.source, ArtifactSource::Link { .. }); + if is_link || node.dependencies.is_empty() { + return Ok(()); + } + let modules_dir = self.store.modules_dir(node_id, &node.artifact); self.link_bins(&node.dependencies, &modules_dir).await } @@ -104,17 +115,19 @@ impl LinkerPipe { } } - let hoist_dir = self.store.hoist_dir(); + let hoist_dir = &self.store.hoist_dir(); let installed = hoisted.into_iter().filter(|(_, edge)| { self.graph .target(edge) .is_ok_and(|node| self.supports(node)) }); - for (name, edge) in installed { - let package_dir = self.target_dir(edge)?; - self.link_dir(&package_dir, &hoist_dir.join(name)).await?; - } - Ok(()) + let links: Vec<_> = installed + .map(|(name, edge)| async move { + let package_dir = self.target_dir(edge)?; + self.link_dir(&package_dir, &hoist_dir.join(name)).await + }) + .collect(); + run_all(links).await } /// Links the bins of `edges` into `node_modules/.bin`, one package at a time in name order, @@ -203,61 +216,66 @@ impl LinkerPipe { impl Pipeline<()> for LinkerPipe { async fn run(&self) -> Result<()> { - let node_modules = self.context.node_modules_dir(); - fsutil::ensure_dir(&node_modules).await?; + let node_modules = &self.context.node_modules_dir(); + let is_fresh = !node_modules.exists(); + fsutil::ensure_dir(node_modules).await?; self.context .reporter .status(format!("Linking {} packages", self.graph.nodes.len())); - let nodes: Vec<(NodeId, ResolvedNode)> = self - .graph - .nodes - .iter() - .map(|(id, node)| (id.clone(), node.clone())) - .collect(); - - run_all( - nodes - .clone() - .into_iter() - .map(|(id, node)| async move { self.import_package(&id, &node).await }), - ) - .await?; - run_all( - nodes - .into_iter() - .map(|(id, node)| async move { self.link_dependencies(&id, &node).await }), - ) - .await?; - self.hoist().await?; - - let node_modules = &node_modules; + let nodes = &self.graph.nodes; let mut roots = Vec::new(); for root in &self.graph.roots { if self.is_installable(root, "the project")? { - roots.push(root.clone()); + roots.push(root); } } - run_all( - roots - .into_iter() - .map(|root| async move { self.link_edge(&root, node_modules).await }), - ) - .await?; + + let imports: Vec<_> = nodes + .iter() + .map(|(id, node)| self.import_package(id, node)) + .collect(); + let dependency_links: Vec<_> = nodes + .iter() + .map(|(id, node)| self.link_dependencies(id, node)) + .collect(); + let root_links: Vec<_> = roots + .iter() + .map(|root| self.link_edge(root, node_modules)) + .collect(); + let links = async { + run_all(dependency_links).await?; + self.hoist().await?; + run_all(root_links).await + }; + // Imports are cloned one at a time by the filesystem, so links are made meanwhile. + futures::try_join!(run_all(imports), links)?; + let bins: Vec<_> = nodes + .iter() + .map(|(id, node)| self.link_dependency_bins(id, node)) + .collect(); + run_all(bins).await?; self.link_bins(&self.graph.roots, node_modules).await?; + if is_fresh { + return Ok(()); + } let root_names: HashSet = self .graph .roots .iter() .map(|root| root.name.clone()) .collect(); - prune_node_modules(node_modules, Some(&root_names)) + let entries: HashSet = nodes + .iter() + .map(|(id, node)| entry_name(id, &node.artifact)) + .collect(); + prune_to_graph(node_modules, &root_names, &entries) .await .context("failed to prune node_modules") } } -async fn run_all(tasks: impl Iterator>>) -> Result<()> { +async fn run_all(tasks: Vec>>) -> Result<()> { let results: Vec> = stream::iter(tasks) .buffer_unordered(LINK_CONCURRENCY) .collect() diff --git a/crates/pipeline/src/pipes/prune.rs b/crates/pipeline/src/pipes/prune.rs index 1c93720..65af4e5 100644 --- a/crates/pipeline/src/pipes/prune.rs +++ b/crates/pipeline/src/pipes/prune.rs @@ -6,26 +6,36 @@ use tokio::fs; use super::virtual_store::{HOIST_DIR, INSTALLED_STATE, VIRTUAL_STORE_DIR}; -/// Removes what the project no longer uses from `node_modules`: top-level links to packages -/// outside `keep_roots` (when given), every virtual store entry no top-level link reaches, -/// and links left dangling by those removals. Only symlinks craft could have made are removed at -/// the top level; dot entries such as `.cache` and real directories are left alone. -pub async fn prune_node_modules( +/// Removes what the project no longer uses from `node_modules`: every virtual store entry no +/// top-level link reaches, and links left dangling by that. +pub async fn prune_node_modules(node_modules: &Path) -> io::Result<()> { + let virtual_store = node_modules.join(VIRTUAL_STORE_DIR); + let reachable = reachable_entries(node_modules, &virtual_store).await?; + remove_entries_outside(node_modules, &reachable).await +} + +/// Removes what `node_modules` holds beyond a graph just linked into it: top-level links to +/// packages outside `roots`, virtual store entries outside `entries`, and links left dangling by +/// those removals. Only symlinks craft could have made are removed at the top level; dot entries +/// such as `.cache` and real directories are left alone. +pub(crate) async fn prune_to_graph( node_modules: &Path, - keep_roots: Option<&HashSet>, + roots: &HashSet, + entries: &HashSet, ) -> io::Result<()> { - if let Some(keep_roots) = keep_roots { - for (name, path) in package_entries(node_modules).await? { - let is_kept = keep_roots.contains(&name); - if !is_kept && fs::symlink_metadata(&path).await?.is_symlink() { - debug::info!("Pruning {}", name); - fsutil::remove_entry(&path).await?; - } + for (name, path) in package_entries(node_modules).await? { + let is_kept = roots.contains(&name); + if !is_kept && fs::symlink_metadata(&path).await?.is_symlink() { + debug::info!("Pruning {}", name); + fsutil::remove_entry(&path).await?; } } + remove_entries_outside(node_modules, entries).await +} +/// Removes every virtual store entry not in `kept`, then the links left dangling. +async fn remove_entries_outside(node_modules: &Path, kept: &HashSet) -> io::Result<()> { let virtual_store = node_modules.join(VIRTUAL_STORE_DIR); - let reachable = reachable_entries(node_modules, &virtual_store).await?; let mut entries = match fs::read_dir(&virtual_store).await { Ok(entries) => entries, Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(()), @@ -34,7 +44,7 @@ pub async fn prune_node_modules( while let Some(entry) = entries.next_entry().await? { let name = entry.file_name().to_string_lossy().into_owned(); let is_craft_file = name == HOIST_DIR || name == INSTALLED_STATE; - let is_unused = !is_craft_file && !reachable.contains(&name); + let is_unused = !is_craft_file && !kept.contains(&name); if is_unused { debug::info!("Pruning {}", name); fsutil::remove_entry(&entry.path()).await?; @@ -187,7 +197,7 @@ mod tests { let node_modules = dir.path().join("node_modules"); layout(&node_modules); - prune_node_modules(&node_modules, None).await.unwrap(); + prune_node_modules(&node_modules).await.unwrap(); let craft = node_modules.join(".craft"); assert!(craft.join("a@1.0.0").exists()); @@ -197,6 +207,26 @@ mod tests { assert!(node_modules.join(".cache/tool").exists()); } + #[tokio::test] + async fn test_pruning_to_a_graph_keeps_its_entries_even_when_unlinked() { + let dir = tempfile::tempdir().unwrap(); + let node_modules = dir.path().join("node_modules"); + layout(&node_modules); + let roots = HashSet::from(["a".to_string()]); + let entries = HashSet::from(["a@1.0.0".to_string(), "c@1.0.0".to_string()]); + + prune_to_graph(&node_modules, &roots, &entries) + .await + .unwrap(); + + let craft = node_modules.join(".craft"); + assert!(craft.join("a@1.0.0").exists()); + assert!(!craft.join("b@1.0.0").exists()); + assert!(std::fs::symlink_metadata(craft.join("a@1.0.0/node_modules/b")).is_ok()); + assert!(craft.join("c@1.0.0").exists()); + assert!(craft.join("node_modules/c").exists()); + } + #[tokio::test] async fn test_removes_top_level_links_outside_the_kept_roots() { let dir = tempfile::tempdir().unwrap(); @@ -208,7 +238,7 @@ mod tests { std::fs::create_dir_all(node_modules.join(".bin")).unwrap(); symlink("../a/cli.js", node_modules.join(".bin/a")).unwrap(); - prune_node_modules(&node_modules, Some(&HashSet::new())) + prune_to_graph(&node_modules, &HashSet::new(), &HashSet::new()) .await .unwrap(); diff --git a/crates/pipeline/src/pipes/virtual_store.rs b/crates/pipeline/src/pipes/virtual_store.rs index d6894ef..dfb3d5c 100644 --- a/crates/pipeline/src/pipes/virtual_store.rs +++ b/crates/pipeline/src/pipes/virtual_store.rs @@ -65,7 +65,7 @@ impl VirtualStore { /// The instance id for registry packages — `@`, plus `_@` for /// each resolved peer — with `/` escaped (`@scope/x` → `@scope+x`); other sources are told apart /// by a hash of their id. -fn entry_name(node_id: &NodeId, artifact: &ResolvedArtifact) -> String { +pub(crate) fn entry_name(node_id: &NodeId, artifact: &ResolvedArtifact) -> String { let name = artifact.name.replace('/', "+"); let source_hash = || short_hash(&node_id.to_string()); let entry = match &artifact.source { diff --git a/crates/resolver/Cargo.toml b/crates/resolver/Cargo.toml index 79288e4..1e4a09a 100644 --- a/crates/resolver/Cargo.toml +++ b/crates/resolver/Cargo.toml @@ -17,7 +17,7 @@ tarball = { path = "../tarball" } sha2 = "0.10" tempfile = "3.10" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde_json = { version = "1.0", features = ["raw_value"] } [dev-dependencies] serde_json = "1.0" diff --git a/crates/resolver/src/lib.rs b/crates/resolver/src/lib.rs index 005ec93..7ce5377 100644 --- a/crates/resolver/src/lib.rs +++ b/crates/resolver/src/lib.rs @@ -4,6 +4,7 @@ pub mod graph; mod locked; mod metadata_cache; pub mod npm; +mod packument; pub mod resolved_artifact; pub mod resolver; mod sources; diff --git a/crates/resolver/src/metadata_cache.rs b/crates/resolver/src/metadata_cache.rs index 2556b4d..c5b99bb 100644 --- a/crates/resolver/src/metadata_cache.rs +++ b/crates/resolver/src/metadata_cache.rs @@ -14,7 +14,8 @@ pub(crate) struct MetadataCache { } pub(crate) struct CachedPackument { - pub body: Vec, + /// The packument, encoded as [`Packument`](crate::packument::Packument) reads it. + pub path: PathBuf, pub validators: Validators, fetched_at: u64, } @@ -40,24 +41,34 @@ impl MetadataCache { } pub async fn read(&self, registry: &str, name: &str) -> Option { - let (body_path, meta_path) = self.paths(registry, name); + let (path, meta_path) = self.paths(registry, name); let meta: CacheMeta = serde_json::from_slice(&tokio::fs::read(meta_path).await.ok()?).ok()?; - let body = tokio::fs::read(body_path).await.ok()?; - Some(CachedPackument { - body, + let is_cached = tokio::fs::try_exists(&path).await.unwrap_or(false); + is_cached.then_some(CachedPackument { + path, validators: meta.validators, fetched_at: meta.fetched_at, }) } - pub async fn write(&self, registry: &str, name: &str, body: &[u8], validators: Validators) { - let (body_path, _) = self.paths(registry, name); - if let Err(error) = fsutil::write_if_changed(&body_path, body).await { + /// Caches an encoded packument, returning where it was written. Drops the full packument + /// cached before packuments were encoded. + pub async fn write( + &self, + registry: &str, + name: &str, + encoded: &[u8], + validators: Validators, + ) -> Option { + let (path, _) = self.paths(registry, name); + if let Err(error) = fsutil::write_if_changed(&path, encoded).await { debug::warning!("Could not cache metadata of {name}: {error}"); - return; + return None; } + let _ = tokio::fs::remove_file(path.with_extension("json")).await; self.touch(registry, name, validators).await; + Some(path) } /// Records that the cached body was just confirmed current. @@ -75,11 +86,32 @@ impl MetadataCache { } } + /// The full manifest of one published version, which never changes once cached. + pub async fn read_version(&self, registry: &str, name: &str, version: &str) -> Option> { + tokio::fs::read(self.version_path(registry, name, version)) + .await + .ok() + } + + pub async fn write_version(&self, registry: &str, name: &str, version: &str, manifest: &[u8]) { + let path = self.version_path(registry, name, version); + if let Err(error) = fsutil::write_if_changed(&path, manifest).await { + debug::warning!("Could not cache metadata of {name}@{version}: {error}"); + } + } + + fn version_path(&self, registry: &str, name: &str, version: &str) -> PathBuf { + let file = name.replace('/', "+"); + self.dir + .join(short_hash(registry)) + .join(format!("{file}@{version}.json")) + } + fn paths(&self, registry: &str, name: &str) -> (PathBuf, PathBuf) { let file = name.replace('/', "+"); let dir = self.dir.join(short_hash(registry)); ( - dir.join(format!("{file}.json")), + dir.join(format!("{file}.packument")), dir.join(format!("{file}.meta.json")), ) } @@ -96,7 +128,7 @@ mod tests { use super::*; #[tokio::test] - async fn test_round_trips_bodies_and_validators() { + async fn test_round_trips_packuments_and_validators() { let dir = tempfile::tempdir().unwrap(); let cache = MetadataCache::new(dir.path().to_path_buf()); assert!( @@ -111,11 +143,11 @@ mod tests { last_modified: None, max_age: Some(300), }; - cache + let written = cache .write( "https://registry.test", "@types/node", - b"{}", + b"encoded", validators.clone(), ) .await; @@ -124,7 +156,8 @@ mod tests { .read("https://registry.test", "@types/node") .await .unwrap(); - assert_eq!(cached.body, b"{}"); + assert_eq!(written.as_ref(), Some(&cached.path)); + assert_eq!(std::fs::read(&cached.path).unwrap(), b"encoded"); assert_eq!(cached.validators, validators); assert!(cached.is_fresh()); assert!( @@ -138,7 +171,7 @@ mod tests { #[test] fn test_entries_without_max_age_are_never_fresh() { let cached = CachedPackument { - body: Vec::new(), + path: PathBuf::new(), validators: Validators::default(), fetched_at: now(), }; diff --git a/crates/resolver/src/npm.rs b/crates/resolver/src/npm.rs index f5bc790..99f59ef 100644 --- a/crates/resolver/src/npm.rs +++ b/crates/resolver/src/npm.rs @@ -10,12 +10,13 @@ use network::Revalidated; use std::path::PathBuf; use crate::metadata_cache::{CachedPackument, MetadataCache}; +use crate::packument::Packument; use network::{Integrity, Network}; use node_semver::{Range, Version}; -use package::{NpmPackage, PlatformConstraints, VersionRequirement}; +use package::{PackageJson, PlatformConstraints, VersionRequirement}; /// One fetch per package name, shared by every concurrent request for it. -type PackumentCell = Arc>>; +type PackumentCell = Arc>>; #[derive(Debug)] pub struct NpmResolver { @@ -37,7 +38,7 @@ impl NpmResolver { /// The package's metadata, fetched once per install however many ranges ask for it. A /// failed fetch is not remembered, so a later request tries again. - async fn packument(&self, name: &str) -> Result> { + async fn packument(&self, name: &str) -> Result> { let cell = { let mut packuments = self .packuments @@ -51,13 +52,14 @@ impl NpmResolver { /// From the metadata cache when the network mode allows or the registry says it's still /// current, from the registry otherwise. - async fn load_packument(&self, name: &str) -> Result> { + async fn load_packument(&self, name: &str) -> Result> { let registry = self.registry.registry_for(name); let url = packument_url(registry, name); let cached = self.cache.read(registry, name).await; - let cached_packument = cached - .as_ref() - .and_then(|cached| serde_json::from_slice::(&cached.body).ok()); + let cached_packument = match &cached { + Some(cached) => Packument::cached(cached.path.clone()).await.ok(), + None => None, + }; let may_use_cache = match self.registry.network_mode { NetworkMode::Offline | NetworkMode::PreferOffline => true, @@ -78,7 +80,7 @@ impl NpmResolver { .flatten(); let revalidated = self .client - .fetch_revalidated(&url, validators) + .fetch_packument(&url, validators) .await .map_err(|error| registry_error(name, registry, error))?; match (revalidated, cached_packument) { @@ -87,9 +89,12 @@ impl NpmResolver { Ok(Arc::new(packument)) } (Revalidated::Fresh { body, validators }, _) => { - let packument: NpmPackage = serde_json::from_slice(&body) - .map_err(|error| registry_error(name, registry, error.into()))?; - self.cache.write(registry, name, &body, validators).await; + let encoded = Packument::encode(&body) + .map_err(|error| registry_error(name, registry, error))?; + let packument = match self.cache.write(registry, name, &encoded, validators).await { + Some(path) => Packument::cached(path).await?, + None => Packument::in_memory(encoded)?, + }; Ok(Arc::new(packument)) } (Revalidated::NotModified(_), None) => Err(anyhow::anyhow!( @@ -103,15 +108,16 @@ impl NpmResolver { name: &str, requirement: &VersionRequirement, ) -> Result { - let npm_package = self.packument(name).await?; + let packument = self.packument(name).await?; - let version = select_version(&npm_package, requirement) + let version = select_version(&packument, requirement) .ok_or_else(|| anyhow::anyhow!("no version of {name} matches {requirement}"))?; - let pkg_json = npm_package - .versions - .get(&version) - .ok_or_else(|| anyhow::anyhow!("Package JSON not found for {name}@{version}"))?; + let pkg_json = packument + .manifest(&version) + .await + .map_err(|error| error.context(format!("could not read {name}@{version}")))?; + let pkg_json = self.with_libc(name, &version, pkg_json).await; let dist = pkg_json .dist @@ -125,14 +131,49 @@ impl NpmResolver { tarball_url: dist.tarball.clone(), }, integrity: Integrity::from_dist(dist.integrity.as_deref(), dist.shasum.as_deref())?, - platform: PlatformConstraints::from_manifest(pkg_json), - package: Some(pkg_json.clone()), + platform: PlatformConstraints::from_manifest(&pkg_json), + package: Some(pkg_json), }; debug::trace!("Resolved {name}@{requirement} to {version}"); Ok(resolved) } + + /// Abbreviated manifests leave out `libc`, which tells a Linux package's glibc and musl + /// builds apart, so a Linux package's full manifest is fetched once and kept. Without it the + /// package counts as installable with either libc. + async fn with_libc(&self, name: &str, version: &str, manifest: PackageJson) -> PackageJson { + let has_libc = manifest.other.contains_key("libc"); + let is_for_linux = PlatformConstraints::from_manifest(&manifest) + .os + .iter() + .any(|os| os == "linux"); + if has_libc || !is_for_linux { + return manifest; + } + match self.full_manifest(name, version).await { + Ok(full) => full, + Err(error) => { + debug::warning!("Could not read the libc of {name}@{version}: {error:#}"); + manifest + } + } + } + + async fn full_manifest(&self, name: &str, version: &str) -> Result { + let registry = self.registry.registry_for(name); + if let Some(cached) = self.cache.read_version(registry, name, version).await { + return Ok(serde_json::from_slice(&cached)?); + } + let url = format!("{}/{version}", packument_url(registry, name)); + let body = self.client.get_body(&url).await?; + let manifest = serde_json::from_slice(&body)?; + self.cache + .write_version(registry, name, version, &body) + .await; + Ok(manifest) + } } /// Scoped names are requested as `@scope%2fname`, as npm does; some registries require it. @@ -164,14 +205,14 @@ fn registry_error(name: &str, registry: &str, error: anyhow::Error) -> anyhow::E /// Picks the published version npm would install: the version a tag points at, or for a /// range the `latest` tag when it satisfies the range, otherwise the highest satisfying version. -fn select_version(npm_package: &NpmPackage, requirement: &VersionRequirement) -> Option { +fn select_version(packument: &Packument, requirement: &VersionRequirement) -> Option { match requirement { - VersionRequirement::Exact(version) => published_versions(npm_package) + VersionRequirement::Exact(version) => published_versions(packument) .find(|(published, _)| published == version) .map(|(_, key)| key.clone()), - VersionRequirement::Tag(tag) => npm_package.dist_tags.get(tag).cloned(), + VersionRequirement::Tag(tag) => packument.dist_tags.get(tag).cloned(), VersionRequirement::Range(range) => { - let latest = npm_package.dist_tags.get("latest"); + let latest = packument.dist_tags.get("latest"); let latest_satisfies = latest .and_then(|latest| Version::parse(latest).ok()) .is_some_and(|latest| range.satisfies(&latest)); @@ -179,23 +220,23 @@ fn select_version(npm_package: &NpmPackage, requirement: &VersionRequirement) -> return latest.cloned(); } - highest_satisfying(npm_package, range) + highest_satisfying(packument, range) } } } -fn highest_satisfying(npm_package: &NpmPackage, range: &Range) -> Option { - published_versions(npm_package) +fn highest_satisfying(packument: &Packument, range: &Range) -> Option { + published_versions(packument) .filter(|(version, _)| range.satisfies(version)) .max_by(|(a, _), (b, _)| a.cmp(b)) .map(|(_, key)| key.clone()) } /// Published versions that parse as semver, paired with their key in the packument. -fn published_versions(npm_package: &NpmPackage) -> impl Iterator { - npm_package +fn published_versions(packument: &Packument) -> impl Iterator { + packument .versions - .keys() + .iter() .filter_map(|key| Version::parse(key).ok().map(|version| (version, key))) } @@ -340,7 +381,7 @@ mod tests { ); } - fn select(npm_package: &NpmPackage, spec: &str) -> Option { + fn select(npm_package: &Packument, spec: &str) -> Option { select_version(npm_package, &requirement(spec)) } @@ -349,17 +390,17 @@ mod tests { dependency.registry_target().unwrap().1.clone() } - fn packument(latest: &str, versions: &[&str]) -> NpmPackage { + fn packument(latest: &str, versions: &[&str]) -> Packument { let versions: serde_json::Map = versions .iter() .map(|version| (version.to_string(), json!({ "version": version }))) .collect(); - - serde_json::from_value(json!({ + let body = json!({ "name": "pkg", "dist-tags": { "latest": latest }, "versions": versions, - })) - .unwrap() + }); + + Packument::in_memory(Packument::encode(body.to_string().as_bytes()).unwrap()).unwrap() } } diff --git a/crates/resolver/src/packument.rs b/crates/resolver/src/packument.rs new file mode 100644 index 0000000..b5994b2 --- /dev/null +++ b/crates/resolver/src/packument.rs @@ -0,0 +1,220 @@ +use std::collections::{BTreeMap, HashMap}; +use std::fs::File; +use std::io::{self, BufRead, BufReader, Cursor, Seek, SeekFrom}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; + +use anyhow::{Context as _, Result}; +use package::PackageJson; +use serde::{Deserialize, Serialize}; +use serde_json::value::RawValue; + +const FORMAT: &str = "craft-packument-v1"; + +/// A package's registry metadata as resolving needs it: its dist-tags and published versions, +/// with every version's manifest left unparsed until one is chosen. +/// +/// The encoding is a format line, a JSON header holding the dist-tags and where each manifest +/// lies, then the manifests exactly as the registry sent them. +#[derive(Debug)] +pub(crate) struct Packument { + pub dist_tags: HashMap, + pub versions: Vec, + source: Source, +} + +#[derive(Debug, Clone)] +enum Source { + Cached(PathBuf), + Memory(Arc>), +} + +#[derive(Serialize, Deserialize)] +struct Header { + #[serde(rename = "distTags")] + dist_tags: HashMap, + /// Each version's manifest as its offset after the header and its length. + versions: BTreeMap, +} + +#[derive(Deserialize)] +struct RegistryPackument<'a> { + #[serde(rename = "dist-tags", default)] + dist_tags: HashMap, + #[serde(borrow, default)] + versions: HashMap, +} + +impl Packument { + /// Encodes a packument as the registry sent it. + pub fn encode(body: &[u8]) -> Result> { + let packument: RegistryPackument = serde_json::from_slice(body)?; + let mut versions: Vec<(String, &RawValue)> = packument.versions.into_iter().collect(); + versions.sort_by(|a, b| a.0.cmp(&b.0)); + + let mut manifests = Vec::new(); + let mut index = BTreeMap::new(); + for (version, manifest) in versions { + let bytes = manifest.get().as_bytes(); + index.insert(version, (manifests.len() as u64, bytes.len() as u64)); + manifests.extend_from_slice(bytes); + } + let header = serde_json::to_vec(&Header { + dist_tags: packument.dist_tags, + versions: index, + })?; + + let mut encoded = Vec::with_capacity(FORMAT.len() + header.len() + manifests.len() + 2); + encoded.extend_from_slice(FORMAT.as_bytes()); + encoded.push(b'\n'); + encoded.extend_from_slice(&header); + encoded.push(b'\n'); + encoded.extend_from_slice(&manifests); + Ok(encoded) + } + + /// Reads the header of an encoded packument file, leaving its manifests on disk. + pub async fn cached(path: PathBuf) -> Result { + let source = Source::Cached(path); + let header = source + .clone() + .read(|reader| Ok(read_header(reader)?.0)) + .await?; + Ok(Self::with_header(header, source)) + } + + pub fn in_memory(encoded: Vec) -> Result { + let header = read_header(&mut Cursor::new(&encoded))?.0; + Ok(Self::with_header(header, Source::Memory(Arc::new(encoded)))) + } + + /// The manifest of `version`, parsed only now. The header is read again from the same open + /// file, so a packument another install rewrote meanwhile is still read consistently. + pub async fn manifest(&self, version: &str) -> Result { + let version = version.to_string(); + self.source + .clone() + .read(move |reader| { + let (header, start) = read_header(reader)?; + let (offset, length) = *header + .versions + .get(&version) + .with_context(|| format!("version {version} is no longer published"))?; + reader.seek(SeekFrom::Start(start + offset))?; + let mut manifest = vec![0; usize::try_from(length)?]; + reader.read_exact(&mut manifest)?; + Ok(serde_json::from_slice(&manifest)?) + }) + .await + } + + fn with_header(header: Header, source: Source) -> Self { + Self { + dist_tags: header.dist_tags, + versions: header.versions.into_keys().collect(), + source, + } + } +} + +impl Source { + async fn read( + self, + read: impl FnOnce(&mut dyn ReadSeek) -> Result + Send + 'static, + ) -> Result { + tokio::task::spawn_blocking(move || match self { + Self::Cached(path) => { + let mut reader = BufReader::new(open(&path)?); + read(&mut reader) + } + Self::Memory(encoded) => read(&mut Cursor::new(encoded.as_slice())), + }) + .await? + } +} + +trait ReadSeek: BufRead + Seek {} + +impl ReadSeek for T {} + +fn open(path: &Path) -> Result { + File::open(path).with_context(|| format!("could not read {}", path.display())) +} + +/// The header, and where the manifests start. +fn read_header(reader: &mut dyn ReadSeek) -> Result<(Header, u64)> { + let mut format = String::new(); + reader.read_line(&mut format)?; + if format.trim_end() != FORMAT { + return Err(io::Error::new(io::ErrorKind::InvalidData, "not an encoded packument").into()); + } + let mut header = Vec::new(); + reader.read_until(b'\n', &mut header)?; + let start = (format.len() + header.len()) as u64; + Ok((serde_json::from_slice(&header)?, start)) +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + + fn registry_body() -> Vec { + json!({ + "name": "pkg", + "dist-tags": { "latest": "1.1.0" }, + "versions": { + "1.0.0": { "name": "pkg", "version": "1.0.0", "dependencies": { "a": "^1.0.0" } }, + "1.1.0": { "name": "pkg", "version": "1.1.0", "description": "line\nbreak" }, + }, + }) + .to_string() + .into_bytes() + } + + #[tokio::test] + async fn test_reads_only_the_chosen_manifest_back() { + let packument = Packument::in_memory(Packument::encode(®istry_body()).unwrap()).unwrap(); + + assert_eq!(packument.versions, ["1.0.0", "1.1.0"]); + assert_eq!(packument.dist_tags["latest"], "1.1.0"); + let manifest = packument.manifest("1.0.0").await.unwrap(); + assert_eq!(manifest.version.as_deref(), Some("1.0.0")); + assert_eq!(manifest.dependencies.unwrap()["a"], "^1.0.0"); + assert!(packument.manifest("2.0.0").await.is_err()); + } + + #[tokio::test] + async fn test_reads_manifests_from_the_file_as_it_is_now() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("pkg.packument"); + std::fs::write(&path, Packument::encode(®istry_body()).unwrap()).unwrap(); + let packument = Packument::cached(path.clone()).await.unwrap(); + + let republished = json!({ + "dist-tags": { "latest": "1.0.0" }, + "versions": { + "0.9.0": { "version": "0.9.0" }, + "1.0.0": { "version": "1.0.0", "description": "a longer manifest than before" }, + }, + }); + std::fs::write( + &path, + Packument::encode(republished.to_string().as_bytes()).unwrap(), + ) + .unwrap(); + + let manifest = packument.manifest("1.0.0").await.unwrap(); + assert_eq!(manifest.version.as_deref(), Some("1.0.0")); + assert!(packument.manifest("1.1.0").await.is_err()); + } + + #[tokio::test] + async fn test_rejects_files_in_another_format() { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("pkg.json"); + std::fs::write(&path, registry_body()).unwrap(); + + assert!(Packument::cached(path).await.is_err()); + } +} diff --git a/crates/testkit/src/registry.rs b/crates/testkit/src/registry.rs index a52ff56..547840c 100644 --- a/crates/testkit/src/registry.rs +++ b/crates/testkit/src/registry.rs @@ -12,6 +12,25 @@ use sha2::{Digest, Sha512}; use crate::package_fixture::{PackageFixture, unscoped_name}; +const ABBREVIATED_PACKUMENT: &str = "application/vnd.npm.install-v1+json"; +const ABBREVIATED_FIELDS: [&str; 15] = [ + "name", + "version", + "deprecated", + "dependencies", + "optionalDependencies", + "devDependencies", + "bundleDependencies", + "peerDependencies", + "peerDependenciesMeta", + "bin", + "directories", + "dist", + "engines", + "os", + "cpu", +]; + /// An npm-compatible registry on `127.0.0.1` serving packuments and tarballs built from /// [`PackageFixture`]s. Stops when dropped. pub struct MockRegistry { @@ -33,6 +52,14 @@ struct MockResponse { max_age: Option, } +#[derive(Default)] +struct RequestHeaders { + authorization: Option, + user_agent: Option, + if_none_match: Option, + wants_abbreviated: bool, +} + #[derive(Default)] struct RegistryState { packuments: HashMap, @@ -48,6 +75,7 @@ struct RegistryState { pending_failures: Option<(usize, u16, Option)>, in_flight: usize, max_in_flight: usize, + abbreviated: usize, /// `Cache-Control: max-age` to send with packuments. max_age: Option, not_modified: usize, @@ -192,6 +220,11 @@ impl MockRegistry { lock(&self.state).not_modified } + /// How many packuments were served abbreviated, as asked for with `Accept`. + pub fn abbreviated_responses(&self) -> usize { + lock(&self.state).abbreviated + } + /// The most requests that were being answered at the same time. pub fn max_concurrent_requests(&self) -> usize { lock(&self.state).max_in_flight @@ -229,13 +262,13 @@ impl Drop for MockRegistry { } impl RegistryState { - fn respond_authorized( - &mut self, - url: &str, - authorization: Option, - user_agent: Option, - if_none_match: Option, - ) -> MockResponse { + fn respond_authorized(&mut self, url: &str, request: RequestHeaders) -> MockResponse { + let RequestHeaders { + authorization, + user_agent, + if_none_match, + wants_abbreviated, + } = request; self.user_agents.push(user_agent); if let Some((remaining, status, retry_after)) = self.pending_failures.take() { if remaining > 1 { @@ -265,7 +298,7 @@ impl RegistryState { ..MockResponse::default() }; } - let response = self.respond(url); + let response = self.respond(url, wants_abbreviated); let is_not_modified = response.etag.is_some() && response.etag == if_none_match; if is_not_modified { self.not_modified += 1; @@ -278,7 +311,7 @@ impl RegistryState { response } - fn respond(&mut self, url: &str) -> MockResponse { + fn respond(&mut self, url: &str, wants_abbreviated: bool) -> MockResponse { let path = decode_path(url); self.requested_paths.push(path.clone()); @@ -291,12 +324,32 @@ impl RegistryState { }; } - match self.packuments.get(path.trim_start_matches('/')) { + let name = path.trim_start_matches('/'); + let version_manifest = name.rsplit_once('/').and_then(|(name, version)| { + let manifest = self.packuments.get(name)?.get("versions")?.get(version)?; + Some(manifest.to_string().into_bytes()) + }); + if let Some(body) = version_manifest { + return MockResponse { + status: 200, + content_type: "application/json", + body, + ..MockResponse::default() + }; + } + + match self.packuments.get(name) { Some(packument) => { - let body = packument.to_string().into_bytes(); + let (content_type, body) = if wants_abbreviated { + self.abbreviated += 1; + (ABBREVIATED_PACKUMENT, abbreviated(packument).to_string()) + } else { + ("application/json", packument.to_string()) + }; + let body = body.into_bytes(); MockResponse { status: 200, - content_type: "application/json", + content_type, etag: Some(format!("\"{}\"", sri_sha512(&body))), max_age: self.max_age, body, @@ -323,6 +376,36 @@ fn tarball_path(name: &str, version: &str) -> String { format!("/{name}/-/{}-{version}.tgz", unscoped_name(name)) } +/// The packument as the npm registry abbreviates it: only what installing needs, so no +/// `scripts` and no `libc`. +fn abbreviated(packument: &Value) -> Value { + let versions: Map = packument["versions"] + .as_object() + .into_iter() + .flatten() + .map(|(version, manifest)| (version.clone(), abbreviated_manifest(manifest))) + .collect(); + json!({ + "name": packument["name"], + "dist-tags": packument["dist-tags"], + "versions": versions, + }) +} + +fn abbreviated_manifest(manifest: &Value) -> Value { + let mut kept: Map = ABBREVIATED_FIELDS + .iter() + .filter_map(|field| Some((field.to_string(), manifest.get(*field)?.clone()))) + .collect(); + let has_install_script = ["preinstall", "install", "postinstall"] + .iter() + .any(|event| manifest["scripts"].get(event).is_some()); + if has_install_script { + kept.insert("hasInstallScript".to_string(), json!(true)); + } + Value::Object(kept) +} + fn empty_packument(name: &str) -> Value { json!({ "name": name, @@ -379,9 +462,7 @@ fn answer(stream: &mut S, state: &Mutex) { return; } let mut header_line = String::new(); - let mut authorization = None; - let mut user_agent = None; - let mut if_none_match = None; + let mut headers = RequestHeaders::default(); loop { header_line.clear(); let is_end_of_headers = matches!(reader.read_line(&mut header_line), Ok(0) | Err(_)) @@ -392,11 +473,13 @@ fn answer(stream: &mut S, state: &Mutex) { if let Some((name, value)) = header_line.split_once(':') { let name = name.trim(); if name.eq_ignore_ascii_case("authorization") { - authorization = Some(value.trim().to_string()); + headers.authorization = Some(value.trim().to_string()); } else if name.eq_ignore_ascii_case("user-agent") { - user_agent = Some(value.trim().to_string()); + headers.user_agent = Some(value.trim().to_string()); } else if name.eq_ignore_ascii_case("if-none-match") { - if_none_match = Some(value.trim().to_string()); + headers.if_none_match = Some(value.trim().to_string()); + } else if name.eq_ignore_ascii_case("accept") { + headers.wants_abbreviated = value.contains(ABBREVIATED_PACKUMENT); } } } @@ -412,7 +495,7 @@ fn answer(stream: &mut S, state: &Mutex) { } .to_string(); drop(reader); - let response = lock(state).respond_authorized(&path, authorization, user_agent, if_none_match); + let response = lock(state).respond_authorized(&path, headers); let reason = match response.status { 200 => "OK", 304 => "Not Modified", diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 55303ae..74b08cd 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -30,6 +30,7 @@ export default defineConfig({ nav: [ { text: 'Guide', link: '/guide/introduction', activeMatch: '/guide/' }, { text: 'CLI', link: '/reference/cli', activeMatch: '/reference/' }, + { text: 'Benchmarks', link: '/guide/benchmarks' }, { text: 'Contributing', link: '/contributing/', activeMatch: '/contributing/' }, ], @@ -41,6 +42,7 @@ export default defineConfig({ { text: 'Introduction', link: '/guide/introduction' }, { text: 'Installation', link: '/guide/installation' }, { text: 'Quick start', link: '/guide/getting-started' }, + { text: 'Benchmarks', link: '/guide/benchmarks' }, ], }, { diff --git a/docs/.vitepress/theme/BenchmarkChart.vue b/docs/.vitepress/theme/BenchmarkChart.vue new file mode 100644 index 0000000..f0d2aff --- /dev/null +++ b/docs/.vitepress/theme/BenchmarkChart.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/docs/.vitepress/theme/benchmarks.json b/docs/.vitepress/theme/benchmarks.json new file mode 100644 index 0000000..a492f49 --- /dev/null +++ b/docs/.vitepress/theme/benchmarks.json @@ -0,0 +1,582 @@ +{ + "date": "2026-10-26", + "machine": "macOS, Apple M5 Max, 18 cores, 48 GB", + "versions": { + "craft": "0.1.0", + "npm": "12.2.1", + "pnpm": "12.15.0", + "yarn": "4.18.1", + "node": "24.18.0" + }, + "scenarios": [ + { + "id": "cold", + "label": "Cold: no cache, no lockfile" + }, + { + "id": "lockfile", + "label": "Lockfile, empty cache" + }, + { + "id": "cache", + "label": "Warm cache, no lockfile" + }, + { + "id": "stale", + "label": "Warm cache past its max-age, no lockfile" + }, + { + "id": "cache+lockfile", + "label": "Warm cache and lockfile" + }, + { + "id": "up-to-date", + "label": "Already installed" + } + ], + "fixtures": [ + { + "name": "small", + "description": "An Express API server", + "packages": 186, + "scenarios": [ + { + "id": "cold", + "results": [ + { + "pm": "craft", + "mean": 1.3311488424199998, + "stddev": 0.12004012154349235, + "memory": 89332121.6 + }, + { + "pm": "npm", + "mean": 2.97275273106, + "stddev": 0.4442353209903284, + "memory": 434097356.8 + }, + { + "pm": "pnpm", + "mean": 2.77015667762, + "stddev": 0.05881654870145175, + "memory": 160228966.4 + }, + { + "pm": "yarn", + "mean": 2.4049139984, + "stddev": 0.21042630221755235, + "memory": 1235428966.4 + } + ] + }, + { + "id": "lockfile", + "results": [ + { + "pm": "craft", + "mean": 1.06378302182, + "stddev": 0.07359055341653395, + "memory": 28613017.6 + }, + { + "pm": "npm", + "mean": 1.3617196798199998, + "stddev": 0.32248480288135173, + "memory": 231145472 + }, + { + "pm": "pnpm", + "mean": 4.544045946820001, + "stddev": 1.2455218365966054, + "memory": 136272281.6 + }, + { + "pm": "yarn", + "mean": 2.2646792216200002, + "stddev": 0.38069060222975315, + "memory": 1113328844.8 + } + ] + }, + { + "id": "cache", + "results": [ + { + "pm": "craft", + "mean": 0.1071274199, + "stddev": 0.0018132763279918762, + "memory": 20935475.2 + }, + { + "pm": "npm", + "mean": 0.75839589248, + "stddev": 0.007051049680532216, + "memory": 536015667.2 + }, + { + "pm": "pnpm", + "mean": 0.147327525, + "stddev": 0.0017209925639216992, + "memory": 57032704 + }, + { + "pm": "yarn", + "mean": 1.0693780167, + "stddev": 0.10907452366651879, + "memory": 444422553.6 + } + ] + }, + { + "id": "stale", + "results": [ + { + "pm": "craft", + "mean": 0.63325575324, + "stddev": 0.04684059240427672, + "memory": 23858380.8 + }, + { + "pm": "npm", + "mean": 1.89245690258, + "stddev": 0.22582006070095118, + "memory": 504990924.8 + }, + { + "pm": "pnpm", + "mean": 0.1574623484, + "stddev": 0.008315520707734505, + "memory": 56495308.8 + }, + { + "pm": "yarn", + "mean": 1.01326288224, + "stddev": 0.09499969442482871, + "memory": 443000422.4 + } + ] + }, + { + "id": "cache+lockfile", + "results": [ + { + "pm": "craft", + "mean": 0.10325529326, + "stddev": 0.004951622709427084, + "memory": 20568473.6 + }, + { + "pm": "npm", + "mean": 0.44185577268, + "stddev": 0.004915859483964186, + "memory": 242365235.2 + }, + { + "pm": "pnpm", + "mean": 0.12798430064, + "stddev": 0.002375706132906746, + "memory": 51671859.2 + }, + { + "pm": "yarn", + "mean": 0.45888635918, + "stddev": 0.0050237904508043645, + "memory": 340433305.6 + } + ] + }, + { + "id": "up-to-date", + "results": [ + { + "pm": "craft", + "mean": 0.00428894846, + "stddev": 0.00015218079258631816, + "memory": 9872998.4 + }, + { + "pm": "npm", + "mean": 0.17107603162, + "stddev": 0.001095463293730644, + "memory": 120733696 + }, + { + "pm": "pnpm", + "mean": 0.03529213358, + "stddev": 0.0013168803488949547, + "memory": 51603046.4 + }, + { + "pm": "yarn", + "mean": 0.22629167392, + "stddev": 0.0009483804451069193, + "memory": 189884006.4 + } + ] + } + ] + }, + { + "name": "medium", + "description": "A Vite and React single-page app", + "packages": 293, + "scenarios": [ + { + "id": "cold", + "results": [ + { + "pm": "craft", + "mean": 4.82764793572, + "stddev": 0.274152316497868, + "memory": 219306393.6 + }, + { + "pm": "npm", + "mean": 11.28069248998, + "stddev": 0.7795076492334752, + "memory": 866202419.2 + }, + { + "pm": "pnpm", + "mean": 6.1278105923799995, + "stddev": 0.20277284998190198, + "memory": 296432435.2 + }, + { + "pm": "yarn", + "mean": 6.3556335991, + "stddev": 0.3188607029412768, + "memory": 1874844057.6 + } + ] + }, + { + "id": "lockfile", + "results": [ + { + "pm": "craft", + "mean": 2.4005967509199997, + "stddev": 0.042888474418185156, + "memory": 36159488 + }, + { + "pm": "npm", + "mean": 2.78026292572, + "stddev": 0.3556882479940618, + "memory": 327968358.4 + }, + { + "pm": "pnpm", + "mean": 11.856059875920002, + "stddev": 5.817909143559615, + "memory": 202434150.4 + }, + { + "pm": "yarn", + "mean": 4.42948565092, + "stddev": 1.0379288864223697, + "memory": 1301728460.8 + } + ] + }, + { + "id": "cache", + "results": [ + { + "pm": "craft", + "mean": 0.22860727685999999, + "stddev": 0.00488368556579032, + "memory": 32931840 + }, + { + "pm": "npm", + "mean": 2.27656850468, + "stddev": 0.022725402618677303, + "memory": 1204528742.4 + }, + { + "pm": "pnpm", + "mean": 0.28237308002000006, + "stddev": 0.003709067455764486, + "memory": 103117619.2 + }, + { + "pm": "yarn", + "mean": 1.67338339824, + "stddev": 0.07636695715820391, + "memory": 763035648 + } + ] + }, + { + "id": "stale", + "results": [ + { + "pm": "craft", + "mean": 0.91720820672, + "stddev": 0.044351508293199365, + "memory": 33954201.6 + }, + { + "pm": "npm", + "mean": 4.9311963493, + "stddev": 0.8158141616397961, + "memory": 1202457804.8 + }, + { + "pm": "pnpm", + "mean": 0.26821626, + "stddev": 0.00312922219438421, + "memory": 102753894.4 + }, + { + "pm": "yarn", + "mean": 1.6248059064, + "stddev": 0.08239598651071203, + "memory": 759624499.2 + } + ] + }, + { + "id": "cache+lockfile", + "results": [ + { + "pm": "craft", + "mean": 0.21654557338000005, + "stddev": 0.012634203380920597, + "memory": 25912934.4 + }, + { + "pm": "npm", + "mean": 0.94625258602, + "stddev": 0.0029600643582805503, + "memory": 494498611.2 + }, + { + "pm": "pnpm", + "mean": 0.24649864629999998, + "stddev": 0.008133728195618637, + "memory": 55934976 + }, + { + "pm": "yarn", + "mean": 0.9347210017800001, + "stddev": 0.02223774743993278, + "memory": 541517414.4 + } + ] + }, + { + "id": "up-to-date", + "results": [ + { + "pm": "craft", + "mean": 0.004508331020000001, + "stddev": 0.00009751485521550006, + "memory": 10194124.8 + }, + { + "pm": "npm", + "mean": 0.19676625572, + "stddev": 0.0013433731577073805, + "memory": 132867686.4 + }, + { + "pm": "pnpm", + "mean": 0.035205152360000005, + "stddev": 0.000849683739911328, + "memory": 51619430.4 + }, + { + "pm": "yarn", + "mean": 0.29943260652000003, + "stddev": 0.0007862495951113154, + "memory": 215184179.2 + } + ] + } + ] + }, + { + "name": "large", + "description": "A Next.js app with a design system, cloud SDKs, Storybook, Jest, Playwright and a webpack toolchain", + "packages": 1391, + "scenarios": [ + { + "id": "cold", + "results": [ + { + "pm": "craft", + "mean": 18.3841824076, + "stddev": 1.7322687439914632, + "memory": 438255616 + }, + { + "pm": "npm", + "mean": 62.98016401619999, + "stddev": 14.076855952233771, + "memory": 881698406.4 + }, + { + "pm": "pnpm", + "mean": 28.8160734059, + "stddev": 3.4178054897826287, + "memory": 829987225.6 + }, + { + "pm": "yarn", + "mean": 29.97464289016, + "stddev": 7.111237499454953, + "memory": 5292192563.2 + } + ] + }, + { + "id": "lockfile", + "results": [ + { + "pm": "craft", + "mean": 19.8198686375, + "stddev": 10.010639056552435, + "memory": 131773235.2 + }, + { + "pm": "npm", + "mean": 12.0333777291, + "stddev": 0.4238009315778987, + "memory": 642514944 + }, + { + "pm": "pnpm", + "mean": 29.336259287300003, + "stddev": 10.297275445253199, + "memory": 537470566.4 + }, + { + "pm": "yarn", + "mean": 20.082850220700003, + "stddev": 6.061264556596707, + "memory": 4450172928 + } + ] + }, + { + "id": "cache", + "results": [ + { + "pm": "craft", + "mean": 1.7828754679200003, + "stddev": 0.013107797599585356, + "memory": 74589798.4 + }, + { + "pm": "npm", + "mean": 12.37949057064, + "stddev": 0.23643495359615607, + "memory": 3127073177.6 + }, + { + "pm": "pnpm", + "mean": 1.9131755885800001, + "stddev": 0.06563136381461325, + "memory": 420393779.2 + }, + { + "pm": "yarn", + "mean": 9.57778362606, + "stddev": 0.13756442620653014, + "memory": 2319011020.8 + } + ] + }, + { + "id": "stale", + "results": [ + { + "pm": "craft", + "mean": 7.350320944239999, + "stddev": 0.6548157910285187, + "memory": 70418432 + }, + { + "pm": "npm", + "mean": 41.5348778676, + "stddev": 3.006058175575289, + "memory": 2798315110.4 + }, + { + "pm": "pnpm", + "mean": 1.80099027842, + "stddev": 0.009076417144596121, + "memory": 417261158.4 + }, + { + "pm": "yarn", + "mean": 9.64434142166, + "stddev": 0.14854185931607058, + "memory": 2305327104 + } + ] + }, + { + "id": "cache+lockfile", + "results": [ + { + "pm": "craft", + "mean": 1.71865208584, + "stddev": 0.011834906832004345, + "memory": 97599488 + }, + { + "pm": "npm", + "mean": 7.25862482984, + "stddev": 0.05656920054858743, + "memory": 2174890803.2 + }, + { + "pm": "pnpm", + "mean": 1.8012657874599998, + "stddev": 0.0342296603406601, + "memory": 229680742.4 + }, + { + "pm": "yarn", + "mean": 7.67033317664, + "stddev": 0.026033410628089337, + "memory": 1827310796.8 + } + ] + }, + { + "id": "up-to-date", + "results": [ + { + "pm": "craft", + "mean": 0.005912678360000001, + "stddev": 0.00027119019207559884, + "memory": 13995212.8 + }, + { + "pm": "npm", + "mean": 0.6726889627999999, + "stddev": 0.0018393022053138377, + "memory": 266515251.2 + }, + { + "pm": "pnpm", + "mean": 0.035345261040000006, + "stddev": 0.000623800284822556, + "memory": 51616153.6 + }, + { + "pm": "yarn", + "mean": 0.8998663990400001, + "stddev": 0.0029720517155990044, + "memory": 349759078.4 + } + ] + } + ] + } + ] +} diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts new file mode 100644 index 0000000..92f9a63 --- /dev/null +++ b/docs/.vitepress/theme/index.ts @@ -0,0 +1,11 @@ +import DefaultTheme from 'vitepress/theme' +import type { Theme } from 'vitepress' + +import BenchmarkChart from './BenchmarkChart.vue' + +export default { + extends: DefaultTheme, + enhanceApp({ app }) { + app.component('BenchmarkChart', BenchmarkChart) + }, +} satisfies Theme diff --git a/docs/contributing/testing.md b/docs/contributing/testing.md index 8996ee7..8f4b3e3 100644 --- a/docs/contributing/testing.md +++ b/docs/contributing/testing.md @@ -4,6 +4,7 @@ make # fmt check, clippy, unit and end-to-end tests make real-world # scenarios against registry.npmjs.org and GitHub docker/windows/test.sh # the whole suite built for Windows, run under Wine +make bench # race craft against npm, pnpm and Yarn ``` ## Unit tests @@ -48,3 +49,7 @@ docker/windows/test.sh run:: # arguments go to each test executable ``` Wine is not Windows: CI's `windows-latest` job has the final word. On Apple Silicon, Docker's Rosetta emulation can crash Wine processes; switching Docker Desktop to QEMU emulation avoids that. + +## Benchmarks + +`make bench` times `craft install` against npm, pnpm and Yarn on three real projects, from a cold machine to an already installed project, with hyperfine. The **Benchmark** workflow runs the same on a GitHub-hosted runner. See [`bench/README.md`](https://github.com/craftpkg/craft/blob/main/bench/README.md) for the fixtures, the scenarios and how each package manager is kept on equal terms. diff --git a/docs/guide/benchmarks.md b/docs/guide/benchmarks.md new file mode 100644 index 0000000..5ae8d0e --- /dev/null +++ b/docs/guide/benchmarks.md @@ -0,0 +1,72 @@ + + +# Benchmarks + +craft, npm, pnpm and Yarn install the same three projects from six starting points, from a first install on a new machine to running `install` again in a project that is already installed. Pick a project, and switch between time and memory: + + + +

+ Measured on {{ benchmarks.machine }} with + craft {{ benchmarks.versions.craft }}, npm {{ benchmarks.versions.npm }}, + pnpm {{ benchmarks.versions.pnpm }}, Yarn {{ benchmarks.versions.yarn }} and + Node.js {{ benchmarks.versions.node }}. Each bar is the mean of 5 runs. +

+ +## Highlights + +- **Already installed:** craft answers in 4–6 ms from the state it keeps in `node_modules/.craft`, 6–8× faster than pnpm and 40–150× faster than npm and Yarn. +- **Warm cache:** craft is fastest on all three projects, with or without a lockfile. The large app installs in 1.72 s with a lockfile and 1.78 s without, against pnpm's 1.80 s and 1.91 s, and npm and Yarn's 7–12 s. +- **Cold:** a first install of the large app takes craft 18.4 s, pnpm 28.8 s, Yarn 30.0 s and npm 63.0 s. +- **Memory:** craft uses the least memory of the four in every scenario. The large app peaks at 71 MB with a warm cache, where pnpm needs 401 MB and npm 2.9 GB. +- **Where craft is behind:** once cached metadata is past the registry's 5-minute `max-age`, craft asks the registry whether each package changed, while pnpm trusts its cache. That costs craft 7.35 s on the large app to pnpm's 1.80 s. With a lockfile and an empty cache, npm installs the large app in 12.0 s to craft's 19.8 s. + +## What each scenario starts from + +| Scenario | Cache | Lockfile | `node_modules` | Like | +| --- | :-: | :-: | :-: | --- | +| Cold | | | | a first install on a new machine | +| Lockfile, empty cache | | ✓ | | CI without a cache | +| Warm cache, no lockfile | ✓ | | | adding a project on a machine that has installed before | +| Warm cache past its max-age | older than 5 minutes | | | installing again later that day | +| Warm cache and lockfile | ✓ | ✓ | | CI with a cache, or a fresh clone | +| Already installed | ✓ | ✓ | ✓ | running `install` again | + +The npm registry lets clients reuse cached metadata for 5 minutes (`max-age=300`). Past that, a package manager either asks the registry again or decides for itself that its cache is good enough, which is what the "past its max-age" scenario shows. + +## The projects + +| Project | Packages | What it is | +| --- | --: | --- | +| `small` | 186 | An Express API server | +| `medium` | 293 | A Vite and React single-page app, with ESLint, Vitest and Tailwind | +| `large` | 1,391 | A Next.js app with MUI, Firebase and the AWS SDK, plus Storybook, Jest, Playwright, Cypress and webpack | + +## Keeping it fair + +- Each package manager gets its own home directory, cache and store, so none of them reuses another's downloads or your own configuration. +- Each one installs the project once before timing, and the run fails unless every direct dependency landed in `node_modules`. +- No install scripts run: npm, pnpm and Yarn get `--ignore-scripts`, and the projects trust no package in craft. +- npm skips `audit` and `fund`, and Yarn uses its `node-modules` linker, so everyone writes a `node_modules`. +- Before the warm-cache runs, each package manager is set up again right before its own runs, so its metadata stays within the registry's `max-age` throughout. +- Every install hits the real npm registry, so cold and empty-cache numbers move with the network. + +## Run it yourself + +The benchmark lives in [`bench/`](https://github.com/craftpkg/craft/tree/main/bench) and needs Node.js and [hyperfine](https://github.com/sharkdp/hyperfine): + +```sh +make bench # every project and scenario, 5 runs each +make bench -- --fixtures small --runs 3 # a quick round +``` + +The **Benchmark** workflow runs the same thing on a GitHub-hosted Ubuntu runner. Full tables, including the medium and small projects' memory, are in [`bench/README.md`](https://github.com/craftpkg/craft/blob/main/bench/README.md). + + diff --git a/docs/index.md b/docs/index.md index 5abfaa5..c481608 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,6 +23,8 @@ features: - icon: ⚡ title: Fast details: Parallel resolution and downloads, registry metadata cached on disk and revalidated with ETags, and packages cloned from a global store. An unchanged project installs in milliseconds. + link: /guide/benchmarks + linkText: See the benchmarks - icon: 🔒 title: Deterministic details: craft.lock records every resolved version, tarball and integrity hash. Frozen installs, the default in CI, install exactly that. @@ -55,3 +57,11 @@ craft run build # run a script ``` See [Installation](/guide/installation) for release binaries, Windows and building from source. + +## Benchmarks + +craft against npm, pnpm and Yarn on the largest project in the benchmark: + + + +Every project, scenario and peak memory, and how it's kept fair: [Benchmarks](/guide/benchmarks). diff --git a/docs/public/benchmarks-dark.svg b/docs/public/benchmarks-dark.svg new file mode 100644 index 0000000..88207ee --- /dev/null +++ b/docs/public/benchmarks-dark.svg @@ -0,0 +1,66 @@ + + +Installing a 1,391-package Next.js app +Mean wall time, lower is better · macOS, Apple M5 Max, 18 cores, 48 GB · 2026-10-26 +Warm cache and lockfile +craft + +1.72 s fastest +npm + +7.26 s 4.2× +pnpm + +1.80 s 1.05× +yarn + +7.67 s 4.5× +Warm cache, no lockfile +craft + +1.78 s fastest +npm + +12.38 s 6.9× +pnpm + +1.91 s 1.07× +yarn + +9.58 s 5.4× +Cold: no cache, no lockfile +craft + +18.38 s fastest +npm + +62.98 s 3.4× +pnpm + +28.82 s 1.6× +yarn + +29.97 s 1.6× +Already installed +craft + +5.9 ms fastest +npm + +673 ms 114× +pnpm + +35 ms 6.0× +yarn + +900 ms 152× + diff --git a/docs/public/benchmarks-light.svg b/docs/public/benchmarks-light.svg new file mode 100644 index 0000000..be88d30 --- /dev/null +++ b/docs/public/benchmarks-light.svg @@ -0,0 +1,66 @@ + + +Installing a 1,391-package Next.js app +Mean wall time, lower is better · macOS, Apple M5 Max, 18 cores, 48 GB · 2026-10-26 +Warm cache and lockfile +craft + +1.72 s fastest +npm + +7.26 s 4.2× +pnpm + +1.80 s 1.05× +yarn + +7.67 s 4.5× +Warm cache, no lockfile +craft + +1.78 s fastest +npm + +12.38 s 6.9× +pnpm + +1.91 s 1.07× +yarn + +9.58 s 5.4× +Cold: no cache, no lockfile +craft + +18.38 s fastest +npm + +62.98 s 3.4× +pnpm + +28.82 s 1.6× +yarn + +29.97 s 1.6× +Already installed +craft + +5.9 ms fastest +npm + +673 ms 114× +pnpm + +35 ms 6.0× +yarn + +900 ms 152× +