Repository navigation
perf(pnpm): install without a readPackage hook - #10787
Conversation
PR Summary by QodoSpeed up pnpm installs by removing the readPackage hook
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit f11eaee |
|
Code review by qodo was updated up to the latest commit 81ee6a5 |
Every dependency manifest the engine resolved went through a JavaScript readPackage hook. Its jobs now have static equivalents in @pnpm/napi: - `@teambit/legacy` and `@teambit/harmony` are removed with `"-"` overrides. The `@*` selector matches only semver ranges, so the `link:` dependencies Bit's linker adds stay, as the hook kept them. - An injected workspace project gets its raw manifest through `dependencyManifest` instead of the hook swapping it in by directory. - Stripping the scripts of never-built packages did nothing: they are already denied with `allowBuilds: false`. Without a hook there is no checksum to record. Lockfiles restored from a component's dependency graph need the install's overrides instead, so the graph records the lockfile's `overrides`, and a graph resolved with the old hooks (checksum `bit-1`) stands for the overrides that replaced them, so existing graphs keep being reused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fests The overrides match only semver ranges, while the removed hooks dropped the core dependencies under any spec but link:. Only a workspace project can declare one with a workspace:, file: or npm: spec, so they are removed from the workspace manifests before the install. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…file has no resolutions Co-Authored-By: Claude Opus 5.5 <[email protected]>
12.12.0 checks allowBuilds denials before dangerouslyAllowAllBuilds, so a workspace with dangerouslyAllowAllScripts and neverBuiltDependencies now passes the allow-all flag together with the denials. Before, that mode passed only the denials, and the engine built nothing else. 12.12.0 also compares injected projects with their dependencyManifest when checking lockfile freshness, so a repeat install reports "Already up to date". Co-Authored-By: Claude Opus 5.5 <[email protected]>
81ee6a5 to
8f23681
Compare
|
Code review by qodo was updated up to the latest commit 8f23681 |
## Proposed Changes - **Bump `@pnpm/napi` to 12.13.0.** `pnpm-lock.yaml` changes only in the napi version entries. - 12.13.0 ships the engine changes for a store shared over a network filesystem, where the Rust engine was slower than pnpm v10 and two concurrent installs could corrupt the store index: - **`storeIndexFormat: files`** (pnpm/pnpm#16875, pnpm/pnpm#16879, pnpm/pnpm#16890): the store's package index as one file per package instead of the SQLite `index.db`, whose locking does not work across machines. Reads take no lock. Bit does not set it. The engine honours `PNPM_CONFIG_STORE_INDEX_FORMAT=files` in the environment or `storeIndexFormat: files` in the global pnpm config, and a store that already has a per-file index is detected on its own, whatever the setting says. - **Lockfile-reused subtrees stay out of the resolution warm-up** (pnpm/pnpm#16886). On a 5,100-package capsule install the engine resolved ~5,650 packages from registry metadata that the walk then took from the lockfile anyway, 22 s of a 28 s resolution. - **Store verification runs during resolution** when `enableModulesDir: false` (pnpm/pnpm#16888), with a package's files checked in parallel. On a network-filesystem store this removed a 19 s pause between resolution and fetching. - Installed with Bit 2.2.104 so the lockfile keeps the `overrides` form that #10787 writes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) — Claude Code (Fable 5.1) Co-authored-by: Claude Fable 5.1 <[email protected]>
Proposed Changes
@pnpm/napihas supported since v12.0.0 (fix(napi): deterministic overrides, hook-free install options, and large-workspace install fixes pnpm/pnpm#13492):@teambit/legacyand@teambit/harmonyare removed with"@teambit/legacy@*": "-"style overrides, which cover registry packages. The@*selector matches only semver ranges, so thelink:dependencies Bit's linker adds stay, as the hook kept them. A workspace project can also declare them withworkspace:,file:ornpm:specs, so they are removed from the workspace manifests before the install as well.projects[].dependencyManifest. Before, the hook swapped it in by directory.allowBuilds: false.pnpmfileChecksumto record. pnpm instead compares the lockfile'soverrideswith the install's, so the dependency graph now records them, like the settings from fix(pnpm): restore the lockfile settings a dependency graph was resolved under #10784. A graph resolved with the old hooks (checksumbit-1) is read as having the two removal overrides, so existing graphs keep being reused.bit signof a component with about 5,500 dependencies: the component capsule's install took 34 s instead of 72 s. The env capsules reused their restored lockfiles either way.bit installspends 5 s in the engine instead of 12 s.@pnpm/napi12.12.0 (below), a repeatbit installin this repo is "Already up to date" and the engine call takes under a second (926 ms).@pnpm/napi12.12.0. It includes two engine fixes this PR builds on:dependencyManifest. Before, every repeat install resolved again.allowBuildsdenials outrankdangerouslyAllowAllBuilds. WithdangerouslyAllowAllScriptsandneverBuiltDependenciesboth set, Bit now passes the allow-all flag together with the denials. Before, it passed only the denials, so no other package was built.pnpm-lock.yaml: it gains the@teambit/legacy@*override and dropspnpmfileChecksum: bit-1. The resolutions are identical. This workspace forces a harmony version, so there is no harmony removal here.🤖 Generated with Claude Code