Skip to content

fix(deps-resolver): close two Astro lockfile divergences - #13374

Merged
zkochan merged 1 commit into
mainfrom
fix-13334
Jul 25, 2026
Merged

zkochan merged 1 commit into
mainfrom
fix-13334

Conversation

@zkochan

@zkochan zkochan commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Related to #13334.

I reproduced the report against main (0754566903) with pnpm 11.17.0 as the reference: same Astro checkout, same trustPolicy removal, pnpm install --lockfile-only with each CLI. The diff is now 306 lines, not the 957 the issue recorded on 12.0.0-alpha.21 — most of the peer-context examples in the report (the [email protected] contexts, sharp × @types/node, @testing-library/svelte × vitest) already resolve identically on main.

Of what is left, three independent bugs accounted for 149 lines. One of them — a project's own peerDependencies reaching its lockfile importer entry without autoInstallPeers — landed separately as #13372 while this was in review, so this PR now carries the other two (143 lines). With #13372 on main, the diff drops to 157 lines.

1. A scoped workspace package referenced as file: is never deduped back to link:.
injected_workspace_target recovers the file: payload from a resolved package id by splitting on the first @. pacquet prefixes the manifest name onto a file: workspace pick, so a scoped id reads @test/pkg@file:packages/… — the leading @ was taken for the separator and the file: strip failed. Every one of Astro's nested fixture packages is scoped, so all of them were recorded as root-relative file: snapshots (plus five spurious packages: / snapshots: rows) where pnpm 11 records link:pkg. Splitting on the whole @file: separator fixes it. This is pacquet-only: upstream's dedupeInjectedDeps reads a bare file:<path> id, so it has no name to strip.

2. bundledDependencies are resolved as if they were regular dependencies.
npm ships bundled deps inside the package's own tarball, and pnpm's getNonDevWantedDependencies filters them out of the wanted set before resolution. pacquet's extract_children had no such filter, so napi-wasm was installed under @parcel/watcher-wasm (and the whole @napi-rs / @emnapi / @tybys set under @tailwindcss/oxide-wasm32-wasi), adding packages the lockfile should not contain. Both spellings are honored and true means "every entry of dependencies", as upstream. Alias validation still runs over bundled entries, so an unusable alias is rejected either way — also as upstream.

3. A project's own peerDependencies leak into its lockfile importer entry. Landed independently as #13372 (closing #13325) while this PR was in review — same root cause, same gate on autoInstallPeers. Dropped from this branch in favour of the version on main.

Both are pacquet-only — the TypeScript CLI is the reference and already behaves correctly here, so there is nothing to mirror.

What is still divergent (157 lines), and why it is not in this PR

Both remaining causes need design work rather than a targeted fix, so I left them for the issue rather than guessing:

  • The parentPkgAliases arm of upstream's peer-shadowed-dependency omission. When a package declares the same name in both dependencies and peerDependencies, upstream drops it from dependencies — under autoInstallPeers always, and otherwise only when the name is already visible in the resolving parent's alias scope. pacquet models the first arm (omit_peer_shadowed_dependencies) and documents the second as unmodeled. That is what drops the wrangler peer from @cloudflare/vite-plugin and the @atcute/lexicons peer from @atcute/identity, which then cascades into duplicate @cloudflare/vite-plugin variants and an extra @cloudflare/workers-types entry in @flue/cli's transitivePeerDependencies. Modeling it means threading a parent-alias set into a decision that pacquet currently memoizes per package id under a deterministic-owner rule, so "first occurrence wins" (upstream's effective behavior) would have to be re-derived without reintroducing order dependence.

  • Local file:*.tgz tarballs. The local resolver's file branch returns no manifest, so the resolved id stays the bare file:<path>.tgz with no name prefix. That fails to parse as a PackageKey, and build_packages_and_snapshots silently skips it — fake-data-pkg is referenced from an importer but has no packages: / snapshots: row. This is not Astro-specific: a bare pnpm add ./pkg-1.0.0.tgz reproduces it, and the install leaves a dangling symlink into an empty virtual-store directory, so local tarball deps do not install at all today. Fixing it needs both a manifest at resolve time (extracting the tarball, as the remote-tarball resolver does) and a local-file arm in the fetch path.

  • @standard-community/standard-json / standard-openapi peer contexts. These packages declare no dependencies at all, so this is not the shadowing bug. pacquet produces two extra variants that upstream's dedupePeerDependents would collapse; pacquet's collapsed_target_matches_parent guard — added in fix(pacquet): match pnpm lockfile resolution #12372 to compensate for a peer-resolution divergence — blocks the child-edge rewrite that would orphan them. Removing the guard would regress pacquet: nondeterministic optional-peer suffix for webpack-dev-server on the babylon fixture #12330, so this belongs with the peer-resolution design work above.

Squash Commit Body

Resolving the Astro workspace with pacquet produced a `pnpm-lock.yaml`
that differed from pnpm 11's by 306 lines. Two independent bugs account
for 143 of them.

`dedupe_injected_deps` splits a resolved package id into its name and
its `file:` payload on the first `@`. A scoped id
(`@test/pkg@file:packages/…`) starts with `@`, so the split returned the
scope tail and the `file:` strip failed — the injected workspace dep was
never recognized and stayed a `file:` snapshot where pnpm records
`link:`. Split on the whole `@file:` separator instead.

`extract_children` walked every entry of `dependencies` and
`optionalDependencies`, including the ones the manifest declares as
bundled. npm ships those inside the package's own tarball, and pnpm's
`getNonDevWantedDependencies` filters them out before resolution; the
missing filter pulled extra packages into the lockfile (`napi-wasm`
under `@parcel/watcher-wasm`, the whole `@napi-rs`/`@emnapi` set under
`@tailwindcss/oxide-wasm32-wasi`). Both spellings are honored, and
`true` means every entry of `dependencies`, matching npm. The bundled
set is computed once and shared by both `collect_deps` calls, so an
alias declared in both groups is dropped from both — upstream filters
the merged `{...optionalDependencies, ...dependencies}` map and reaches
the same result. The alias validation still runs over bundled entries
so an unusable alias is rejected either way, as it is upstream.

A third divergence from the same reproduction — a project's own
`peerDependencies` reaching its lockfile importer entry without
`autoInstallPeers` — landed separately as pnpm/pnpm#13372 while this was
in review, so it is no longer part of this change.

The remaining divergences — the `parentPkgAliases` arm of upstream's
peer-shadowed-dependency omission, and local `file:*.tgz` tarballs
resolving without a manifest — are described in the issue; both need
design work beyond this change.

Related to pnpm/pnpm#13334.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
    (pacquet-only bugs; the TypeScript CLI is the reference and already correct.)
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.

Written by an agent (Claude Code, claude-opus-5).

Copilot AI review requested due to automatic review settings July 25, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@zkochan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 986093e0-f8df-46f1-835a-c00773481d2f

📥 Commits

Reviewing files that changed from the base of the PR and between d17710c and 4cf3553.

📒 Files selected for processing (5)
  • .changeset/astro-lockfile-resolution-parity.md
  • pnpm/crates/resolving-deps-resolver/src/dedupe_injected_deps.rs
  • pnpm/crates/resolving-deps-resolver/src/dedupe_injected_deps/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-13334

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix pacquet lockfile parity with pnpm 11 for Astro edge cases

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Fix scoped @scope/*@file: workspace ids so injected deps dedupe back to link:.
• Skip bundledDependencies/bundleDependencies when walking manifests to avoid extra lockfile
 entries.
• Prevent importers' own peerDependencies from leaking into lockfile entries when
 autoInstallPeers is off.
Diagram

graph TD
  A["Manifests"] --> B["Resolve tree\n(bundled filter)"] --> C["DependenciesGraph"] --> D["Dedupe injected\n(scoped @file:)"] --> E["Lockfile writer\n(peers gating)"] --> F[("pnpm-lock.yaml")]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Introduce a structured parser for resolved package ids
  • ➕ Avoids string-splitting edge cases (e.g., scoped names, future protocol variants).
  • ➕ Centralizes package-id parsing rules and makes tests more explicit.
  • ➖ Bigger refactor and wider surface-area change for a targeted parity fix.
  • ➖ May require plumbing new types across crates/interfaces.
2. Port upstream pnpm logic directly (minimal divergence)
  • ➕ Reduces long-term drift from pnpm behavior; easier parity maintenance.
  • ➕ Potentially reuses well-tested upstream semantics.
  • ➖ May not map cleanly onto pacquet’s current data shapes (e.g., prefixed file: ids).
  • ➖ Could increase coupling or require larger rewrites than this PR’s surgical fixes.

Recommendation: The PR’s targeted fixes are appropriate for closing known lockfile divergences while keeping churn low, and the added regression tests should prevent reintroductions. If similar string-format issues recur, consider a follow-up to parse resolved package ids via a dedicated type instead of ad-hoc splitting.

Files changed (7) +233 / -18

Bug fix (3) +70 / -18
dependencies_graph_to_lockfile.rsGate importer specifier lookup on autoInstallPeers +32/-11

Gate importer specifier lookup on autoInstallPeers

• Threads 'auto_install_peers' into importer construction and uses it to control whether 'peerDependencies' participate in specifier lookup. Prevents an importer’s own peers from appearing in its lockfile entry when 'autoInstallPeers' is disabled.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile.rs

dedupe_injected_deps.rsFix scoped workspace '@scope/name@file:' splitting for injected dedupe +6/-5

Fix scoped workspace '@scope/name@file:' splitting for injected dedupe

• Updates injected workspace target detection to split on the '@file:' separator instead of the first '@'. This correctly handles scoped package names and allows 'file:' snapshots to dedupe back to 'link:'.

pnpm/crates/resolving-deps-resolver/src/dedupe_injected_deps.rs

resolve_dependency_tree.rsFilter bundledDependencies during child extraction +32/-2

Filter bundledDependencies during child extraction

• Introduces bundled dependency name extraction supporting 'bundledDependencies' and 'bundleDependencies' (including 'true' meaning all dependencies). Excludes bundled entries from the dependency walk while preserving alias validation behavior.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

Tests (3) +154 / -0
tests.rsAdd regression tests for own peer dependency lockfile emission +60/-0

Add regression tests for own peer dependency lockfile emission

• Adds fixtures and two tests verifying that an importer’s own peer dependency is omitted from the lockfile when 'autoInstallPeers' is off, and included with the correct specifier when on. Protects against peer leakage regressions.

pnpm/crates/package-manager/src/dependencies_graph_to_lockfile/tests.rs

tests.rsAdd regression test for scoped injected workspace dedupe +30/-0

Add regression test for scoped injected workspace dedupe

• Adds a test covering scoped package ids formatted as '@scope/name@file:<path>', asserting they rewrite to 'link:' and that the unreachable 'file:' snapshot is pruned. Validates the new parsing behavior.

pnpm/crates/resolving-deps-resolver/src/dedupe_injected_deps/tests.rs

tests.rsAdd tests ensuring bundled dependencies are not walked +64/-0

Add tests ensuring bundled dependencies are not walked

• Adds unit tests asserting bundled deps are excluded from 'extract_children', including alternate key spelling and boolean 'true' semantics. Uses a small helper to build 'ResolveResult' fixtures.

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs

Documentation (1) +9 / -0
astro-lockfile-resolution-parity.mdAdd changeset documenting three lockfile parity fixes +9/-0

Add changeset documenting three lockfile parity fixes

• Introduces a patch changeset describing the three resolver/lockfile parity fixes and the Astro reproduction context. Serves as release notes for the behavioral changes.

.changeset/astro-lockfile-resolution-parity.md

@greptile-apps

greptile-apps Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported optional duplicate is excluded because both dependency traversals share the same bundled-name set, and the added regression test directly pins that behavior; no blocking failure remains.

Reviews (3): Last reviewed commit: "fix(deps-resolver): close two Astro lock..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.02     10.6±0.13ms    35.4 MB/sec    1.00     10.4±0.17ms    36.1 MB/sec
packument/parse                1.01     37.7±0.53µs  1758.3 MB/sec    1.00     37.3±0.61µs  1776.7 MB/sec
tarball/download_dependency    1.00      2.9±0.08ms  1509.2 KB/sec    1.01      2.9±0.16ms  1495.0 KB/sec

Copilot AI review requested due to automatic review settings July 25, 2026 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Resolving the Astro workspace with pacquet produced a `pnpm-lock.yaml`
that differed from pnpm 11's by 306 lines. Two independent bugs account
for 143 of them.

`dedupe_injected_deps` splits a resolved package id into its name and
its `file:` payload on the first `@`. A scoped id
(`@test/pkg@file:packages/…`) starts with `@`, so the split returned the
scope tail and the `file:` strip failed — the injected workspace dep was
never recognized and stayed a `file:` snapshot where pnpm records
`link:`. Split on the whole `@file:` separator instead.

`extract_children` walked every entry of `dependencies` and
`optionalDependencies`, including the ones the manifest declares as
bundled. npm ships those inside the package's own tarball, and pnpm's
`getNonDevWantedDependencies` filters them out before resolution; the
missing filter pulled extra packages into the lockfile (`napi-wasm`
under `@parcel/watcher-wasm`, the whole `@napi-rs`/`@emnapi` set under
`@tailwindcss/oxide-wasm32-wasi`). Both spellings are honored, and
`true` means every entry of `dependencies`, matching npm. The bundled
set is computed once and shared by both `collect_deps` calls, so an
alias declared in both groups is dropped from both — upstream filters
the merged `{...optionalDependencies, ...dependencies}` map and reaches
the same result. The alias validation still runs over bundled entries
so an unusable alias is rejected either way, as it is upstream.

A third divergence from the same reproduction — a project's own
`peerDependencies` reaching its lockfile importer entry without
`autoInstallPeers` — landed separately as #13372 while this was
in review, so it is no longer part of this change.

The remaining divergences — the `parentPkgAliases` arm of upstream's
peer-shadowed-dependency omission, and local `file:*.tgz` tarballs
resolving without a manifest — are described in the issue; both need
design work beyond this change.

Related to #13334.
Copilot AI review requested due to automatic review settings July 25, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan zkochan changed the title fix(deps-resolver): close three Astro lockfile divergences fix(deps-resolver): close two Astro lockfile divergences Jul 25, 2026
@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan

zkochan commented Jul 25, 2026

Copy link
Copy Markdown
Member Author

Rebased onto main and force-pushed (4cf3553368) — #13372 landed the third fix in this branch (the autoInstallPeers gate on read_manifest_specifier) independently while this was in review, so I dropped my version of it and its tests in favour of the one on main. Title, description and changeset now describe the remaining two fixes.

The commit hash in my earlier reply above (d88902cb7d) no longer exists after the rebase; that test is bundled_dependencies_true_also_drops_the_optional_duplicate in pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs, now part of 4cf3553368.


Written by an agent (Claude Code, claude-opus-5).

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Informational

1. Changeset missing pnpm entry 📘 Rule violation § Compliance
Description
The new changeset only declares a pacquet bump and omits pnpm, which violates the requirement
that changesets explicitly include the pnpm package with a valid bump type. This can lead to
missing or incorrect release versioning for pnpm-related changes.
Code

.changeset/astro-lockfile-resolution-parity.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

⭐ Low

Multiple recent PRs rejected adding required "pnpm" entry to pacquet-only changesets; team often
keeps only pacquet bump.

PR-#13343
PR-#13349
PR-#12995

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires changeset front-matter to contain an entry for the pnpm package
with a valid bump type. The added changeset front-matter shows only "pacquet": patch and no
"pnpm" entry.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/astro-lockfile-resolution-parity.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The changeset front-matter does not include an entry for `pnpm`, but the compliance checklist requires that every new/modified changeset explicitly declares the `pnpm` package with a valid bump type (`patch`/`minor`/`major`).

## Issue Context
This PR adds a new changeset file `.changeset/astro-lockfile-resolution-parity.md` whose front-matter currently lists only `pacquet`.

## Fix Focus Areas
- .changeset/astro-lockfile-resolution-parity.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.22%. Comparing base (d17710c) to head (4cf3553).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13374      +/-   ##
==========================================
- Coverage   87.22%   87.22%   -0.01%     
==========================================
  Files         536      536              
  Lines       92059    92075      +16     
==========================================
+ Hits        80297    80310      +13     
- Misses      11762    11765       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 4cf355336808

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.594 ± 0.150 2.365 2.791 1.74 ± 0.19
pacquet@main 2.479 ± 0.131 2.337 2.680 1.66 ± 0.18
pnpr@HEAD 1.510 ± 0.127 1.339 1.701 1.01 ± 0.13
pnpr@main 1.490 ± 0.142 1.353 1.750 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5944862990199997,
      "stddev": 0.14964301157176216,
      "median": 2.63200859642,
      "user": 1.54391918,
      "system": 1.2197647,
      "min": 2.36515168992,
      "max": 2.7914015189200003,
      "times": [
        2.68733124592,
        2.37705623892,
        2.7914015189200003,
        2.36515168992,
        2.68633583392,
        2.47083062792,
        2.57768135892,
        2.71574285292,
        2.55920467992,
        2.71412694292
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4787595799199997,
      "stddev": 0.13127652420305608,
      "median": 2.42216287842,
      "user": 1.4926504799999998,
      "system": 1.2682534999999997,
      "min": 2.33685848292,
      "max": 2.68016261292,
      "times": [
        2.68016261292,
        2.37663615492,
        2.37658210692,
        2.57955647992,
        2.38830677992,
        2.33685848292,
        2.57960985992,
        2.65341795892,
        2.45601897692,
        2.36044638592
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5096904955200001,
      "stddev": 0.12691867104830634,
      "median": 1.5209123144199999,
      "user": 1.0401517799999997,
      "system": 1.1516616999999998,
      "min": 1.33945969392,
      "max": 1.70115031792,
      "times": [
        1.63248852492,
        1.38264347792,
        1.61315303492,
        1.50070821992,
        1.70115031792,
        1.59268503292,
        1.44117722992,
        1.35232301392,
        1.33945969392,
        1.54111640892
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4901939729199998,
      "stddev": 0.14204367931334205,
      "median": 1.45493280692,
      "user": 1.06899568,
      "system": 1.1057242999999999,
      "min": 1.35288945892,
      "max": 1.75025783692,
      "times": [
        1.54804664192,
        1.46516187892,
        1.35288945892,
        1.7198324069200002,
        1.36765361192,
        1.47589481592,
        1.37258318092,
        1.4049161619200001,
        1.75025783692,
        1.44470373492
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 259.8 ± 4.4 252.8 265.8 1.02 ± 0.03
pacquet@main 255.2 ± 6.5 244.8 264.2 1.00
pnpr@HEAD 268.4 ± 13.3 253.6 294.4 1.05 ± 0.06
pnpr@main 264.1 ± 10.6 250.5 282.9 1.03 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25980370738,
      "stddev": 0.004391606393130098,
      "median": 0.26053963238,
      "user": 0.21725076,
      "system": 0.5329374,
      "min": 0.25278966938,
      "max": 0.26576930138000004,
      "times": [
        0.25376331238000005,
        0.25278966938,
        0.25923387938000003,
        0.26576930138000004,
        0.25611312638,
        0.25924492038,
        0.26220183638000005,
        0.26386183138,
        0.26322485238000004,
        0.26183434438000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25524531918000004,
      "stddev": 0.006543541334922731,
      "median": 0.25400140038,
      "user": 0.20137686000000002,
      "system": 0.5336700999999999,
      "min": 0.24483356438000003,
      "max": 0.26418348738,
      "times": [
        0.24483356438000003,
        0.26202960238,
        0.24808513338000002,
        0.26418348738,
        0.25254998938,
        0.26336914338,
        0.25132404038,
        0.25412223838000003,
        0.25807543038,
        0.25388056238
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26841438468000006,
      "stddev": 0.013341288337162523,
      "median": 0.26754808488000004,
      "user": 0.21673146000000001,
      "system": 0.5151856,
      "min": 0.25355301638000005,
      "max": 0.29435602138000005,
      "times": [
        0.27737453738,
        0.29435602138000005,
        0.26490582638000004,
        0.27068760938,
        0.27019034338000003,
        0.28255903538000005,
        0.25504254038,
        0.25812100538000005,
        0.25735391138,
        0.25355301638000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26406341578000003,
      "stddev": 0.01055887323353747,
      "median": 0.26012343988000003,
      "user": 0.19375865999999997,
      "system": 0.5284834,
      "min": 0.25054002538000003,
      "max": 0.28291119838,
      "times": [
        0.28291119838,
        0.27405126138,
        0.27112692638,
        0.25551441838000005,
        0.25459548938000004,
        0.25838950038,
        0.25054002538000003,
        0.25852327338000003,
        0.26172360638000003,
        0.27325845838
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.775 ± 0.016 2.748 2.801 1.67 ± 0.19
pacquet@main 2.763 ± 0.023 2.729 2.800 1.67 ± 0.19
pnpr@HEAD 1.657 ± 0.141 1.433 1.859 1.00 ± 0.14
pnpr@main 1.657 ± 0.184 1.434 1.890 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.77468813964,
      "stddev": 0.01645209818665853,
      "median": 2.77601209424,
      "user": 1.68880482,
      "system": 1.33929688,
      "min": 2.74827756524,
      "max": 2.80050698624,
      "times": [
        2.74827756524,
        2.77100947324,
        2.77458781324,
        2.75039180324,
        2.77678799424,
        2.77731887324,
        2.7959766992399997,
        2.77591388924,
        2.77611029924,
        2.80050698624
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.76345490964,
      "stddev": 0.022911400272955688,
      "median": 2.76602429524,
      "user": 1.65156022,
      "system": 1.32960458,
      "min": 2.72933301724,
      "max": 2.79978405624,
      "times": [
        2.79978405624,
        2.78300326224,
        2.7344728422399998,
        2.77994070824,
        2.72933301724,
        2.76245461624,
        2.7425316992399997,
        2.77786739624,
        2.75556752424,
        2.7695939742399998
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6574729997400002,
      "stddev": 0.14083191226223515,
      "median": 1.66077001624,
      "user": 1.02107802,
      "system": 1.1725410799999998,
      "min": 1.43279540824,
      "max": 1.85937175024,
      "times": [
        1.55523686924,
        1.6119252342400001,
        1.70961479824,
        1.8276271722400002,
        1.7270506252400002,
        1.76476525824,
        1.52615498324,
        1.5601878982400001,
        1.43279540824,
        1.85937175024
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6566435183400003,
      "stddev": 0.1842999885538109,
      "median": 1.59944015574,
      "user": 1.02326332,
      "system": 1.15948198,
      "min": 1.4341945022400002,
      "max": 1.8895708482400002,
      "times": [
        1.8895708482400002,
        1.4341945022400002,
        1.8727614912400001,
        1.59517916524,
        1.60370114624,
        1.49584447524,
        1.4366460352400001,
        1.56298586324,
        1.8414580832400003,
        1.83409357324
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 588.3 ± 12.6 565.2 604.5 1.93 ± 0.05
pacquet@main 581.7 ± 8.0 571.7 595.1 1.91 ± 0.04
pnpr@HEAD 305.1 ± 4.4 299.2 312.1 1.00
pnpr@main 305.2 ± 7.8 294.0 323.6 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.58825881976,
      "stddev": 0.012584049793713161,
      "median": 0.5889749715600001,
      "user": 0.7053858,
      "system": 0.6848935399999998,
      "min": 0.5651863330600001,
      "max": 0.6044993180600001,
      "times": [
        0.5945590370600001,
        0.5769004310600001,
        0.5752222830600001,
        0.58974230106,
        0.5882076420600001,
        0.5651863330600001,
        0.6044993180600001,
        0.6014249680600001,
        0.5989721410600001,
        0.5878737430600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5817132032600001,
      "stddev": 0.007958772842930464,
      "median": 0.5842068425600001,
      "user": 0.7243756,
      "system": 0.6634284399999999,
      "min": 0.5716588770600001,
      "max": 0.5950567830600001,
      "times": [
        0.5784761170600001,
        0.57189057206,
        0.58831549506,
        0.5950567830600001,
        0.5854338920600001,
        0.5838967090600001,
        0.5859635580600001,
        0.5716588770600001,
        0.5719230530600001,
        0.5845169760600001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30512893526,
      "stddev": 0.004385032748802316,
      "median": 0.30432693206,
      "user": 0.20780559999999998,
      "system": 0.53079714,
      "min": 0.29919498306000003,
      "max": 0.31207048606,
      "times": [
        0.30470160706,
        0.30149618406,
        0.31207048606,
        0.30844416006,
        0.30133384906,
        0.30395225706,
        0.29919498306000003,
        0.30150327706,
        0.31019722006,
        0.30839532906
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30520481136000005,
      "stddev": 0.007847240138844351,
      "median": 0.30589579506,
      "user": 0.18590439999999997,
      "system": 0.54539834,
      "min": 0.29399702106000003,
      "max": 0.32357292406,
      "times": [
        0.32357292406,
        0.30574268706,
        0.30633304706000003,
        0.30700848906,
        0.29808490506,
        0.30148155706,
        0.29399702106000003,
        0.30812407806000003,
        0.30165450206,
        0.30604890306
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.904 ± 0.008 1.887 1.915 6.33 ± 0.13
pacquet@main 1.897 ± 0.008 1.884 1.906 6.30 ± 0.13
pnpr@HEAD 0.301 ± 0.006 0.295 0.314 1.00
pnpr@main 0.305 ± 0.007 0.295 0.316 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9035476063000005,
      "stddev": 0.00792106484039395,
      "median": 1.9050627057000002,
      "user": 0.9261310999999999,
      "system": 0.7639899399999999,
      "min": 1.8872435787,
      "max": 1.9146985917000001,
      "times": [
        1.9042568687,
        1.9052250517000002,
        1.9088205477000002,
        1.8943651027,
        1.9146985917000001,
        1.9091200017,
        1.9049003597,
        1.9070404287,
        1.8872435787,
        1.8998055317
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8971776766000001,
      "stddev": 0.007964065258940877,
      "median": 1.9005601892000001,
      "user": 0.9423331000000003,
      "system": 0.7314158399999999,
      "min": 1.8840921677000002,
      "max": 1.9064762397000001,
      "times": [
        1.9010233267,
        1.9064762397000001,
        1.9039069427000002,
        1.8975155637,
        1.8895042247000002,
        1.8840921677000002,
        1.9000970517000002,
        1.9027080967,
        1.9010924657000001,
        1.8853606867000001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3009353255,
      "stddev": 0.006270500240425738,
      "median": 0.2990858087,
      "user": 0.21205670000000004,
      "system": 0.5231700399999999,
      "min": 0.29498311670000005,
      "max": 0.31430698770000004,
      "times": [
        0.29571193670000007,
        0.29591205470000004,
        0.29498311670000005,
        0.31430698770000004,
        0.29719881670000003,
        0.30411092670000006,
        0.29674755770000005,
        0.30097280070000004,
        0.30763086170000004,
        0.30177819570000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30479155240000005,
      "stddev": 0.007052208880477475,
      "median": 0.3038227242,
      "user": 0.21647420000000003,
      "system": 0.5162786399999999,
      "min": 0.2951655597,
      "max": 0.31579174070000005,
      "times": [
        0.3007536377,
        0.29697489470000005,
        0.29958449670000004,
        0.2951655597,
        0.3020922167,
        0.31184811970000004,
        0.3072551647,
        0.3128964617,
        0.30555323170000004,
        0.31579174070000005
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 347.7 ± 10.0 335.7 363.3 4.00 ± 0.15
pacquet@main 351.4 ± 9.3 335.7 366.3 4.04 ± 0.14
pnpr@HEAD 86.9 ± 2.1 81.7 90.9 1.00
pnpr@main 87.1 ± 1.8 82.3 90.6 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3477340977200001,
      "stddev": 0.010038401231679539,
      "median": 0.34467218472000005,
      "user": 0.34203308,
      "system": 0.05390651999999999,
      "min": 0.33569827072,
      "max": 0.36326971472,
      "times": [
        0.33569827072,
        0.35983201472000004,
        0.34052080672000007,
        0.34508612072000006,
        0.33765266672000005,
        0.34123170472000003,
        0.36022162372000005,
        0.36326971472,
        0.34956980572000007,
        0.34425824872000005
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3513940537200001,
      "stddev": 0.009286224282300646,
      "median": 0.35229386122000006,
      "user": 0.34790368,
      "system": 0.05194041999999999,
      "min": 0.33572632372000005,
      "max": 0.36630505072,
      "times": [
        0.36172118572000006,
        0.36630505072,
        0.35380062072000007,
        0.35078710172000005,
        0.34857202172000007,
        0.34400726972000006,
        0.35520225072000006,
        0.33572632372000005,
        0.34162573772000004,
        0.35619297472000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08687192323612905,
      "stddev": 0.0020966661061373104,
      "median": 0.08710810072,
      "user": 0.020607325161290317,
      "system": 0.009287567741935487,
      "min": 0.08174125872,
      "max": 0.09091924372,
      "times": [
        0.09026246772,
        0.08441747572,
        0.08714602172000001,
        0.08918365672,
        0.08566835072000001,
        0.08767240172,
        0.08923711772000001,
        0.08589924572,
        0.08472628672,
        0.08708200172,
        0.08298489972,
        0.08803822072,
        0.08881149572000001,
        0.08610280872000001,
        0.08624388372,
        0.08174125872,
        0.08503755372,
        0.08839125472,
        0.08459389872,
        0.08710810072,
        0.08891002172,
        0.08755486172,
        0.08663672372,
        0.08615882372,
        0.08831897872,
        0.08771588472,
        0.08677641672,
        0.09091924372,
        0.08369696972,
        0.08832341772,
        0.08766987672
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08714206726545455,
      "stddev": 0.0017689766761070172,
      "median": 0.08713497072,
      "user": 0.02105319515151515,
      "system": 0.008866472727272723,
      "min": 0.08228467172000001,
      "max": 0.09056804272,
      "times": [
        0.08590344172,
        0.08968863772,
        0.08472671672,
        0.08919386672,
        0.08516037372,
        0.08717954472,
        0.09052662472,
        0.08581133972,
        0.08773701472,
        0.08959117372,
        0.09056804272,
        0.08608171872,
        0.08760027672000001,
        0.08766438772,
        0.08648183172,
        0.08763309872,
        0.08698363572000001,
        0.08703141572,
        0.08700396372000001,
        0.08777700972000001,
        0.08624481572,
        0.08691530772,
        0.08735647772,
        0.08399275672,
        0.08586920772000001,
        0.08731305672,
        0.08847443272,
        0.08590387472,
        0.08228467172000001,
        0.08861721072,
        0.08659806972,
        0.08863925172,
        0.08713497072
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.515 ± 0.163 4.413 4.838 1.28 ± 0.06
pacquet@main 4.519 ± 0.109 4.420 4.696 1.28 ± 0.04
pnpr@HEAD 3.554 ± 0.126 3.422 3.790 1.01 ± 0.04
pnpr@main 3.535 ± 0.087 3.437 3.657 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.51516789554,
      "stddev": 0.1625700217028838,
      "median": 4.44752999594,
      "user": 1.66653162,
      "system": 1.3221722200000001,
      "min": 4.41269712644,
      "max": 4.83768730144,
      "times": [
        4.48188286444,
        4.41789718344,
        4.8033136164400005,
        4.4409653994400005,
        4.83768730144,
        4.42018318744,
        4.41269712644,
        4.42378090544,
        4.45917677844,
        4.45409459244
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.5194249838400005,
      "stddev": 0.10898729529879053,
      "median": 4.458903915940001,
      "user": 1.7201307199999998,
      "system": 1.32593082,
      "min": 4.41962106244,
      "max": 4.6956774684400004,
      "times": [
        4.4305894744400005,
        4.62150525644,
        4.6956774684400004,
        4.4477216874400005,
        4.42949495344,
        4.41962106244,
        4.45414753944,
        4.46366029244,
        4.68051292844,
        4.55131917544
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.55438765324,
      "stddev": 0.12629688423576868,
      "median": 3.53354829544,
      "user": 1.17345312,
      "system": 1.20049472,
      "min": 3.42216660244,
      "max": 3.78972648644,
      "times": [
        3.45239477044,
        3.42961372644,
        3.42216660244,
        3.66591247944,
        3.68924932844,
        3.78972648644,
        3.57449484144,
        3.45322170644,
        3.56951640144,
        3.4975801894400003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.53547962764,
      "stddev": 0.08670734983760245,
      "median": 3.51642882744,
      "user": 1.1820252199999999,
      "system": 1.17816692,
      "min": 3.43667306144,
      "max": 3.65705001844,
      "times": [
        3.43667306144,
        3.60034865844,
        3.4438535964400003,
        3.65705001844,
        3.50937637944,
        3.47396728844,
        3.4510910414400002,
        3.60585197144,
        3.52348127544,
        3.6531029854400003
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13374
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,748.28 ms
(+0.44%)Baseline: 2,736.35 ms
3,283.62 ms
(83.70%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,887.24 ms
(-0.19%)Baseline: 1,890.81 ms
2,268.97 ms
(83.18%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
565.19 ms
(-1.44%)Baseline: 573.43 ms
688.11 ms
(82.14%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
335.70 ms
(-2.88%)Baseline: 345.66 ms
414.79 ms
(80.93%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,365.15 ms
(+0.05%)Baseline: 2,363.96 ms
2,836.75 ms
(83.38%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,412.70 ms
(-0.36%)Baseline: 4,428.69 ms
5,314.43 ms
(83.03%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
252.79 ms
(+2.54%)Baseline: 246.52 ms
295.82 ms
(85.45%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13374
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,432.80 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
294.98 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
299.19 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
81.74 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,339.46 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,422.17 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
253.55 ms
🐰 View full continuous benchmarking report in Bencher

zkochan added a commit that referenced this pull request Jul 26, 2026
Investigating #13326 showed its reproduction already matches
pnpm 11 byte for byte, fixed by eab73b3 (#13374) filtering
bundled names out of `extract_children`. Porting the upstream
`bundledDependencies` install suite — which had no pacquet counterpart,
and is why the original defect shipped — surfaced two gaps that fix did
not cover.

A manifest may declare `bundleDependencies: true` instead of a name
list, which npm and pnpm both read as "every entry of `dependencies`
ships inside this tarball". The lockfile writer only understood the list
form, and `PackageMetadata::bundled_dependencies` was typed
`Option<Vec<String>>`, so the boolean could neither be written nor read
back — a `pnpm-lock.yaml` written by pnpm 11 for such a package failed
to parse. Model the field as the `string[] | boolean` union pnpm
records, behind one shared `BundledDependencies::from_manifest` that
both the install and env-installer writers call.

The field's presence is also what tells the installer a package carries
a populated `node_modules` of its own whose bins belong in that
package's `node_modules/.bin`. Bundled packages are not lockfile
children, so neither linker reached them: the isolated path's per-slot
walk iterates `snapshot.dependencies`, and the hoisted path iterates
graph nodes — `has_bundled_dependencies` was computed and stored on
every hoisted node but had no reader. Both paths now run the second bin
pass upstream's `linkAllBins` and `building/during-install` run.

No platform gate is added to the resolver. The issue asks for one, but
pnpm 11 resolves the subtree of a platform-incompatible optional package
too (`[email protected]` on Linux, `@img/sharp-darwin-arm64`'s libvips
edge), and `skip_optional_dependency_that_does_not_support_the_current_os`
already asserts pacquet matches that.

Related to #13326
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
Resolving the Astro workspace with pacquet produced a `pnpm-lock.yaml`
that differed from pnpm 11's by 306 lines. Two independent bugs account
for 143 of them.

`dedupe_injected_deps` splits a resolved package id into its name and
its `file:` payload on the first `@`. A scoped id
(`@test/pkg@file:packages/…`) starts with `@`, so the split returned the
scope tail and the `file:` strip failed — the injected workspace dep was
never recognized and stayed a `file:` snapshot where pnpm records
`link:`. Split on the whole `@file:` separator instead.

`extract_children` walked every entry of `dependencies` and
`optionalDependencies`, including the ones the manifest declares as
bundled. npm ships those inside the package's own tarball, and pnpm's
`getNonDevWantedDependencies` filters them out before resolution; the
missing filter pulled extra packages into the lockfile (`napi-wasm`
under `@parcel/watcher-wasm`, the whole `@napi-rs`/`@emnapi` set under
`@tailwindcss/oxide-wasm32-wasi`). Both spellings are honored, and
`true` means every entry of `dependencies`, matching npm. The bundled
set is computed once and shared by both `collect_deps` calls, so an
alias declared in both groups is dropped from both — upstream filters
the merged `{...optionalDependencies, ...dependencies}` map and reaches
the same result. The alias validation still runs over bundled entries
so an unusable alias is rejected either way, as it is upstream.

A third divergence from the same reproduction — a project's own
`peerDependencies` reaching its lockfile importer entry without
`autoInstallPeers` — landed separately as pnpm#13372 while this was
in review, so it is no longer part of this change.

The remaining divergences — the `parentPkgAliases` arm of upstream's
peer-shadowed-dependency omission, and local `file:*.tgz` tarballs
resolving without a manifest — are described in the issue; both need
design work beyond this change.

Related to pnpm#13334.
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
Investigating pnpm#13326 showed its reproduction already matches
pnpm 11 byte for byte, fixed by eab73b3 (pnpm#13374) filtering
bundled names out of `extract_children`. Porting the upstream
`bundledDependencies` install suite — which had no pacquet counterpart,
and is why the original defect shipped — surfaced two gaps that fix did
not cover.

A manifest may declare `bundleDependencies: true` instead of a name
list, which npm and pnpm both read as "every entry of `dependencies`
ships inside this tarball". The lockfile writer only understood the list
form, and `PackageMetadata::bundled_dependencies` was typed
`Option<Vec<String>>`, so the boolean could neither be written nor read
back — a `pnpm-lock.yaml` written by pnpm 11 for such a package failed
to parse. Model the field as the `string[] | boolean` union pnpm
records, behind one shared `BundledDependencies::from_manifest` that
both the install and env-installer writers call.

The field's presence is also what tells the installer a package carries
a populated `node_modules` of its own whose bins belong in that
package's `node_modules/.bin`. Bundled packages are not lockfile
children, so neither linker reached them: the isolated path's per-slot
walk iterates `snapshot.dependencies`, and the hoisted path iterates
graph nodes — `has_bundled_dependencies` was computed and stored on
every hoisted node but had no reader. Both paths now run the second bin
pass upstream's `linkAllBins` and `building/during-install` run.

No platform gate is added to the resolver. The issue asks for one, but
pnpm 11 resolves the subtree of a platform-incompatible optional package
too (`[email protected]` on Linux, `@img/sharp-darwin-arm64`'s libvips
edge), and `skip_optional_dependency_that_does_not_support_the_current_os`
already asserts pacquet matches that.

Related to pnpm#13326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants