Skip to content

[pull] main from pnpm:main - #509

Merged
pull[bot] merged 3 commits into
dwongdev:mainfrom
pnpm:main
Aug 16, 2026
Merged

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

Conversation

@pull

@pull pull Bot commented Aug 16, 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 : )

Jasperhino and others added 3 commits August 16, 2026 10:50
A worker call arriving after the CLI's final finishWorkers() — typically
a tarball fetch for a never-linked package (foreign-arch optional
dependency) delayed past install completion by a network retry — lazily
re-created the worker pool. Nothing ever finished the new pool, so its
idle worker thread kept the process alive until an external timeout
killed it: pnpm printed 'Done in Xs' and then hung.

finishWorkers() now keeps the finished pool's reference. Straggler tasks
are still serviced: each spawns a worker in the finished pool, and
checkinWorker tears it down again because the pool is finishing. The
global.finishWorkers clear (349019b) that fixes Jest chain-accumulation
hangs is kept; only the pool-reference clear from 1941ce7 is reverted,
and the fetch-after-finishWorkers scenario that commit protected still
passes (installing/commands test suite).

close #12297
Scope the tarball URL percent-decoding to the public registry

The canonical registry tarball URL check unescaped `%2f`/`%2F` before
comparing, so a scoped package served only from the encoded path (GitHub
Enterprise Server) had its URL classified as canonical and dropped from the
lockfile; the next install rebuilt the unencoded URL and got a 404.

registry.npmjs.org serves a scoped package from both the encoded and the
unencoded path, so the unescape is kept there and encoded npmjs URLs already
recorded in a lockfile keep resolving to `{ integrity }` rather than churning.
Everywhere else the match is now exact apart from the protocol, so the encoded
URL stays in `pnpm-lock.yaml` and is requested verbatim.

Closes #13534
…3931)

With a global virtual store, package directories live outside the
project, so Node's upward node_modules walk from their real paths never
reaches the project's hoisted node_modules — undeclared (phantom)
dependencies stop resolving, and Node ignores NODE_PATH entirely for
ESM imports (Related to #9618).

When enableGlobalVirtualStore is on (and extendNodePath is not
disabled), every child process pnpm spawns — run, exec, lifecycle
scripts, dlx — now receives NODE_PATH pointing at the private hoist dir
and the root node_modules, plus a NODE_OPTIONS --import flag that
registers a resolve hook restoring NODE_PATH lookups for ESM, replacing
the plugin-esm-node-path config dependency.

The flag is a self-contained constant: the registration module and the
hook are nested data: URLs, so no loader file has to exist on disk and
the flag stays valid regardless of which project or pnpm version
spawned the child. It prefers module.registerHooks() (in-thread, no
DEP0205 deprecation warning) and falls back to module.register() on
Node >=18.19 <22.15. Everything outside the RFC 3986 unreserved set is
percent-encoded: encodeURIComponent alone leaves single quotes bare,
and the NODE_OPTIONS tokenizer treats those as quote delimiters.

Both stacks embed identical hook sources and each asserts its derived
flag against the shared golden file
pnpm11/exec/esm-node-path-loader/test/import-flag.txt, so they cannot
drift apart silently.

Where the nodeOptions setting overwrites NODE_OPTIONS (run, exec,
recursive run, install lifecycle), the flag is re-applied. pacquet's
dlx and global installs force GVS off for their self-contained trees
and now strip the injected env from the caller's cloned config, so a
tool never resolves phantoms from the invoking project's tree; the
TypeScript dlx (GVS on by default) adds the flag and lets the bin shim
supply NODE_PATH.

This deliberately does not address the TypeScript-compiler side of
#13210: tsc, tsserver, and bundlers implement their own
resolution and honor neither NODE_PATH nor Node loader hooks. That
class remains packageExtensions / compat-DB territory.
@pull pull Bot locked and limited conversation to collaborators Aug 16, 2026
@pull pull Bot added the ⤵️ pull label Aug 16, 2026
@pull
pull Bot merged commit ae462e1 into dwongdev:main Aug 16, 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.

3 participants