Skip to content

[pull] main from pnpm:main - #449

Merged
pull[bot] merged 2 commits into
dwongdev:mainfrom
pnpm:main
Jul 27, 2026
Merged

pull[bot] merged 2 commits into
dwongdev:mainfrom
pnpm:main

Conversation

@pull

@pull pull Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

zkochan added 2 commits July 27, 2026 00:21
pacquet never ran the root project's `pnpm:devPreinstall` script. The
hook exists so a workspace can prepare state that resolution or linking
consumes: vercel/next.js uses it to generate a placeholder `next` bin,
and without it every dependent's shim was linked against a file that no
step of the install ever created.

Run it once per install from the lockfile directory, for the root
project only, right after `pnpm:context` and before the lockfile is
touched — including before the frozen path's freshness check, matching
where pnpm runs it at the top of `mutateModules`' `_install`.

The gates were each checked against pnpm 11.17.0 on the same fixture:

- `--ignore-scripts` skips it, as it does every other project script.
- `--lockfile-only` and `--dry-run` skip it. pnpm reaches the same
  outcome indirectly: `lockfileOnly` forces `ignoreScripts`, and
  `--dry-run` sets `lockfileOnly`.
- A repeat "Already up to date" install skips it in both stacks — the
  optimistic short-circuit returns before pnpm's `_install` and before
  this call site.
- A rebuild skips it: `pnpm rebuild` never enters `mutateModules`.
- `ignore_manifest_check` skips it, covering both `pacquet fetch`
  (pnpm's `ignorePackageManifest`) and the TypeScript CLI delegating a
  frozen materialization, which already ran the hook itself before
  handing the install over.

One duplicate remains: the TypeScript CLI's resolve-mode delegation
(`runPacquet.run({ resolve: true })`) drops both injected flags, so it
runs the hook and pacquet then runs it again. Every way to suppress it
was worse than the symptom — restating a ten-clause delegation
predicate in `_install`, where it would drift, or inventing a private
env-var marker — and the hook is idempotent by contract.

The env setup shared with the project-script path is split in two:
`pnpm:devPreinstall` takes the plain `extraEnv` + `nodeOptions`, without
the `.package-map.json` `NODE_OPTIONS` entry, because pnpm adds that one
only once it links and builds and the file does not exist yet when the
hook runs.

Closes #13313
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
@pull pull Bot locked and limited conversation to collaborators Jul 27, 2026
@pull pull Bot added the ⤵️ pull label Jul 27, 2026
@pull
pull Bot merged commit 5ed47dc into dwongdev:main Jul 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant