Commit Graph

4042 Commits

Author SHA1 Message Date
Zoltan Kochan
f54347e415 feat: replace pkg with Node.js SEA for standalone executables (#10661)
* feat: switch from pkg to Node.js SEA for creating standalone executables

Replace @yao-pkg/pkg with Node.js native Single Executable Applications
(--build-sea, Node.js 25.5+). The SEA binary embeds only pnpm.cjs (CJS
bootstrap), while pnpm.mjs and all assets live in a dist/ directory
shipped alongside the binary in platform-specific tarballs.

* refactor: move dist/ from platform packages to @pnpm/exe

The dist/ directory (pnpm.mjs, worker.js, templates, etc.) is identical
across all platforms, so ship it once in @pnpm/exe instead of duplicating
it in each platform package. Platform packages now only contain the
binary. The self-updater installs @pnpm/exe (not the platform package)
so it gets both dist/ and the binary via optionalDependencies.

* refactor: externalize @reflink/reflink in esbuild bundle

Make @reflink/reflink external in both the main and worker esbuild
bundles so the require() calls resolve at runtime from dist/node_modules
instead of being inlined. Add @reflink/reflink as a production dependency
of both pnpm (bundled into dist/node_modules by bundle-deps.ts) and
@pnpm/exe (installed by npm alongside the binary).

For GitHub release tarballs, only the target platform's reflink package
is kept. For @pnpm/exe npm publishing, all reflink platform packages
are stripped from dist/ since npm installs the right one automatically.

* chore: update cspell list

* test: update system-node-version tests for SEA detection

Mock @pnpm/cli-meta's detectIfCurrentPkgIsExecutable instead of
setting process.pkg, which is no longer used for SEA detection.

* test: improve cli-meta test coverage for SEA migration

Add tests for detectIfCurrentPkgIsExecutable() (non-SEA path) and
isExecutedByCorepack() which were previously untested. The SEA=true
path of detectIfCurrentPkgIsExecutable() cannot be unit tested since
node:sea is unavailable in an ESM test environment.

* refactor: move GitHub tarball assembly to copy-artifacts.ts

build-artifacts.ts (prepublishOnly of @pnpm/exe) now only builds the
SEA executables and prepares the exe npm dist/. The per-target dist/
assembly for GitHub release tarballs moves to copy-artifacts.ts, which
is the natural owner of that concern.

Other changes:
- Extract getReflinkKeepPackages/stripReflinkPackages to reflink-utils.ts
  with tests using node:test
- Move --force from top-level pnpm install in release.yml to the pnpm
  deploy in bundle-deps.ts, where it is actually needed to install all
  @reflink/reflink-* platform packages into dist/node_modules
- Change @pnpm/exe prepublishOnly to run pnpm's full prepublishOnly
  (compile + bundle-deps) so dist/node_modules is populated before
  build-artifacts.ts and copy-artifacts.ts read from pnpm/dist

* fix: copy dist/ alongside binary when running pnpm setup for SEA

When the pnpm CLI is a Node.js SEA binary, it requires a dist/ directory
adjacent to the executable at runtime (containing pnpm.mjs and bundled
node_modules). The copyCli function in plugin-commands-setup now copies
dist/ from alongside the current binary into the tools directory so that
the installed pnpm works correctly after `pnpm setup`.


* fix: avoid argument list too long when creating Windows zip archives


* fix: propagate errors in copy-artifacts script

Previously errors in createArtifactTarball were swallowed, causing the
script to exit 0 even when artifact creation failed. Now errors are
re-thrown with a descriptive message, and the top-level IIFE has a
.catch() handler that sets a non-zero exit code.


* refactor: remove reflink-utils.ts from @pnpm/exe

The stripReflinkPackages call in build-artifacts.ts stripped all platform
packages while keeping @reflink/reflink. Instead, just remove the entire
@reflink directory from dist/ — @pnpm/exe already declares @reflink/reflink
as a runtime dependency, so npm installs it (along with the right platform
package via optionalDependencies) automatically.

This eliminates reflink-utils.ts, its tests, and the code duplication with
copy-artifacts.ts.
2026-02-22 12:45:50 +01:00
Zoltan Kochan
50fbecae7d refactor(env): pnpm env use now delegates to pnpm add --global (#10666)
This PR overhauls `pnpm env` use to route through pnpm's own install machinery instead of maintaining a parallel code path with manual symlink/shim/hardlink logic.

```
pnpm env use -g <version>
```

now runs:

```
pnpm add --global node@runtime:<version>
```

via `@pnpm/exec.pnpm-cli-runner`. All manual symlink, hardlink, and cmd-shim code in `envUse.ts` is gone (~1000 lines removed across the package).

### Changes

**npm and npx shims on all platforms**

Added `getNodeBinsForCurrentOS(platform)` to `@pnpm/constants`, returning a `Record<string, string>` with the correct relative paths for `node`, `npm`, and `npx` inside a Node.js distribution. `BinaryResolution.bin` is widened from `string` to `string | Record<string, string>` in `@pnpm/resolver-base` and `@pnpm/lockfile.types`, so the node resolver can set all three entries and pnpm's bin-linker creates shims for each automatically.

**Windows npm/npx fix**

`addFilesFromDir` was skipping root-level `node_modules/` (to avoid storing a package's own dependencies), which stripped the bundled `npm` from Node.js Windows zip archives. Added an `includeNodeModules` option and enabled it from the binary fetcher so Windows distributions keep their full contents.

**Removed subcommands**

`pnpm env add` and `pnpm env remove` are removed. `pnpm env use` handles both installing and activating a version. `pnpm env list` now always lists remote versions (the `--remote` flag is no longer required, though it is kept for backwards compatibility).

**musl support**

On Alpine Linux and other musl-based systems, the musl variant of Node.js is automatically downloaded from [unofficial-builds.nodejs.org](https://unofficial-builds.nodejs.org).
2026-02-22 12:06:34 +01:00
Zoltan Kochan
e18a879d72 feat!: drop Node.js 22.12 support 2026-02-18 14:54:09 +01:00
Zoltan Kochan
56a59df674 perf: persist bundled manifest in store index to avoid reading package.json from CAFS (#10473)
close #10461
2026-02-17 12:03:08 +01:00
Zoltan Kochan
7d5ada0701 feat: reverse pnpm why tree and improve list/why output (#10615)
- **`pnpm why` now shows a reverse dependency tree.** The searched package appears at the root with its dependants as branches, walking back to workspace roots. This replaces the previous forward-tree output which was noisy and hard to read for deeply nested dependencies.
- **Replaced `archy` with a new `@pnpm/text.tree-renderer` package** that renders trees using box-drawing characters (├──, └──, │) and supports grouped sections, dim connectors, and deduplication markers.
- **Show peer dependency hash suffixes** in `pnpm list` and `pnpm why` output to distinguish between different peer-dep variants of the same package.
- **Improved `pnpm list` visual output:** bold importer nodes, dimmed workspace paths, dependency grouping, package count summary, and deterministic sort order.
- **Added `--long` support to `pnpm why`** and the ability to read package manifests from the CAS store.
- **Deduplicated shared code** between `list` and `why` commands into a common module, and reused `getPkgInfo` in the why tree builder.
2026-02-15 14:38:43 +01:00
Khải
cc7c0d22df refactor!: replace npm publish with libnpmpublish (#10591)
* chore(deps): add `libnpmpublish` to catalog

* chore(deps): install `libnpmpublish`

* feat: publishableManifest (wip)

* feat: publishableManifest (wip)

* chore(cspell): libnpmpublish

* test: fix

* feat: validate field and version

* chore: @npm/types

* chore: todo

* refactor: reorganize

* feat: transformRequiredFields

* chore(deps): patch `libnpmpublish`

* fix: `BaseManifest.config`

* fix: eslint

* chore(git): revert a patch that doesn't work

This reverts commit 45f2c6a6c2.

We will use type casting

* feat: `engines.runtime`

* feat: normalize bin

* fix: `bin === ''`

* test: fix

* refactor: inference friendly

* feat: `peerDependenciesMeta`

* refactor: group into a directory

* refactor: use `ramda.pipe`

* refactor: less intrusive type assertion

* feat!: returning `ExportedManifest`

* refactor: remove unnecessary file

* docs: add a todo

* refactor: getNetworkConfigs (#10458)

Some tests are added as a bonus

* feat: `publishPackedPkg` (wip)

* feat: replace `\t` with 4 spaces

* fix: newline

* fix: newline

* refactor: extract `FailedToPublishError`

* test: FailedToPublishError

* feat: registryConfigKeys

* feat: `publishPackedPkg` (wip)

* feat(config/getNetworkConfigs): load auth info

* feat(config/getNetworkConfigs): load auth info (#10491)

* feat: `publishPackedPkg` (wip)

* refactor: extract a `static` function

* fix: inheritance, override, and merge

* feat: `executeTokenHelper`

* fix: use the visible `globalWarn`

* feat: add options

* feat: add more options

* docs: more links

* fix: private packages

* fix: --dry-run

* feat: log more things

* fix: name

* fix: tag

* refactor: remove extraneous `assertPublicPackage`

* feat: use `publishPackedPkg` for directories

* refactor: require only necessary fields

* refactor: extractManifestFromPacked

* fix: extractManifestFromPacked

* test: extractManifestFromPacked

* feat: isTarballPath

* feat: use `publishPackedPkg` for tarballs

* style: add an empty line for clarity

* refactor: remove unnecessary works

* feat: --otp

* feat: PNPM_CONFIG_OTP

* feat: oidc

* test: fix name collision

* fix: eslint

* test: disable a false test

* feat: set `provenance`

* docs(todo): auto provenance

* refactor: run oidc in `createPublishOptions`

* fix: correct auth keys for `libnpmpublish`

* docs: changeset

* fix: incorrect `password` field

* fix: typo, grammar

* chore(git): resolve merge conflict ahead of time

In preparation for https://github.com/pnpm/pnpm/pull/10385

* fix: field name

* fix(config): decoding `_password`

* fix: edge case of partial `cert`/`key`

* fix: ensure `registry` always match its config key

* fix: `_password`

* test: correct a name

* test: more specific assertions

* fix: grammar

* docs(changeset): fix grammar

* docs: fix grammar

* fix: clean up after failure

* test: fix windows

* feat(provenance): auto detect

* refactor: consistent name

* fix: correct error names

* refactor: extract the `provenance` code

* feat: show code and body of an error

* refactor: use `encodeURIComponent`

* refactor: rename a type

* refactor: use the try-catch model

* refactor: move `normalizeBinObject`

* refactor: split `oidc` into `idToken` and `authToken`

* refactor: run `next` on `stream`'s `'end'`

* fix: use the correct encoding

* feat: guard against weird names

* test: `transform/engines`

Closes https://github.com/pnpm/pnpm/pull/10599

* test: `transformPeerDependenciesMeta`

Closes https://github.com/pnpm/pnpm/pull/10600

* refactor: dependency inject the `Date` too

* refactor: export an interface

* test: oidc

Closes https://github.com/pnpm/pnpm/pull/10598

* refactor: re-arrange imports

* refactor: remove unnecessary type casts

* refactor: improve test
2026-02-12 21:10:54 +01:00
Zoltan Kochan
1b4df57a01 feat!: drop Node.js 20 and 21 support (#10569) 2026-02-08 19:16:24 +01:00
Zoltan Kochan
57e99b6996 chore: update pnpm-lock.yaml (#10558)
---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-06 03:28:39 +01:00
Johan Quan Vo
7b1c189f2e feat!: remove deprecated patch options (#10505)
* refactor: remove allowNonAppliedPatches

* refactor: remove ignorePatchFailures

* refactor: remove `strict` field in groupPatchedDependencies

* test: update test failure in package patching

* test: fix

* docs: update changesets

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-01-27 17:08:45 +01:00
Zoltan Kochan
3c40892b90 feat!: remove old way of declaring node.js in dependencies (#10507) 2026-01-25 16:07:30 +01:00
Zoltan Kochan
c55c6146d9 feat!: bump store version to v11 (#10506) 2026-01-24 21:36:39 +01:00
Zoltan Kochan
e3b35b6f37 style: update eslint to v9 (#10474) 2026-01-17 12:01:23 +01:00
Johan Quan Vo
cc1b8e310a fix: use tarball URL returned in package metadata (#10431)
close #10254
2026-01-16 17:31:04 +01:00
Zoltan Kochan
a00f9e515c chore: use typescript-go (#10452) 2026-01-14 01:18:13 +01:00
baozj
9c0637f531 docs: fix typos on changelogs (#10441)
Co-authored-by: baozj <www.1670370148@qq.com>
2026-01-12 12:15:36 +01:00
Zoltan Kochan
8b4bdf9a83 refactor: replace onlyBuiltDependencies and ignoredBuiltDependencies with allowBuilds (#10401) 2026-01-02 23:21:17 +01:00
Zoltan Kochan
cb367b9515 feat!: deprecate old settings that were replaced by allowBuilds (#10382) 2026-01-02 12:22:42 +01:00
Brandon Cheng
11352aabbf chore: migrate remaining package.json scripts using ts-node (#10380)
* chore: remove unused test scripts

* chore: migrate remaining `package.json` scripts using `ts-node`
2025-12-30 06:27:28 +01:00
Zoltan Kochan
71de2b3f2b feat!: remove use-node-version CLI option and pnpm.executionEnv.nodeVersion manifest field (#10373) 2025-12-27 22:41:53 +01:00
Brandon Cheng
db72923b5c fix: forward $NODE_OPTIONS when running jest for debug terminals (#10364)
* fix: forward existing `$NODE_OPTIONS` when running jest

* chore: update `package.json` files for meta-updater changes

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2025-12-27 22:10:52 +01:00
Zoltan Kochan
c4045fc689 fix: update unscoped package storage location in virtual global store (#10363) 2025-12-25 21:13:41 +01:00
Dasa Paddock
29764fb140 feat(hooks): add beforePacking hook (#10303)
* feat(hooks): add `readPackageForPublishing` hook

* feat: pass project `dir` parameter to `readPackageForPublishing` hook

* chore: cleanup

* fix: add support for multiple pnpmfiles

* test: readPackageForPublishing hook

* test: add more tests

* test: small update

* refactor: pass in `hooks` as an option

* test: pass in `hooks` as an option

* test: small update

* chore: rename `readPackageForPublishing` to `beforePacking`
2025-12-21 15:49:47 +01:00
Zoltan Kochan
76718b32ad feat: create a new field for allowing/disallowing builds (#10311)
ref #10235
2025-12-13 22:14:27 +01:00
Zoltan Kochan
05fb1aee5f fix: reporting ignored dependency builds (#10276) 2025-12-06 16:32:19 +01:00
Zoltan Kochan
5f73b0f2b6 perf: always link runtimes from the global virtual store directory (#10233) 2025-12-01 14:27:18 +01:00
Trevor Burnham
38b8e357b5 feat: add custom resolvers and fetchers (#10246) 2025-11-30 14:19:04 +01:00
Khải
3aa50c8365 feat(init): --bare (#10228)
* feat(init): fields preset

* feat: replace `init-preset` with `init-bare`

* feat: remove init-bare

close #10226

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2025-11-29 14:55:02 +01:00
Zoltan Kochan
1e6de2539b fix: dependency graph hash calculation (#10236) 2025-11-25 20:36:52 +01:00
Ryo Matsukawa
8ffb1a7f0c fix: display npm: protocol for aliased packages in list and why (#10084)
* fix: support alias resolution in pnpm why with npm:
protocol

* refactor: make alias required instead of optional

* refactor: reorder field to put alias first
2025-11-20 01:08:53 +01:00
Zoltan Kochan
7e2910e70f chore(release): 11.0.0-alpha.0 2025-11-13 15:44:27 +01:00
Khải
075aa993bb feat(config): global yaml (#10145)
* feat(config): global `rc.yaml`

* fix: undefined `rawConfig`

* test: add a test

* feat: re-export `isSupportedNpmConfig`

* feat: return `'compat'` to distinguish compatibility reason

* docs: `isSupportedNpmConfig`

* fix: eslint

* docs: clarify the case of the config key

* feat(cli/config/set): target yaml for pnpm-specific settings

* fix: read the correct file

* fix: write to the correct directory

* refactor: remove disabled code

* refactor: get `configDir` directly

* docs: remove outdated documentation

* test: fix a test

* test: rename

* fix: explicitly tell npm the config file path

* test: add a test

* test: add a test

* test: fix a test

* fix: local config dir

* fix: `managingAuthSettings`

* test: rename

* test: fix

* test: add a test

* test: demonstrate choosing config files

* test: fix

* docs: yet another consideration

* test: demonstrate choosing config files

* fix: correct local config file names in test helper

* test: demonstrate choosing config files

* test: use the helper

* test: add a test

* test: correct a test

* test: fix

* test: fix

* fix: eslint

* test: remove duplicate

* feat: validate `rc.yaml`

* docs: changeset

* test: fix `configDelete.test.ts`

* feat: other `npm` call-sites

* fix: make optional again

* feat: remove the change from `publish`

* fix: eslint

* refactor: just one is sufficient

* refactor: replace type union with 3 functions

* refactor(test): extract helper functions

* fix: add `rc.yaml` to `rawConfig`

* test: keep workspace settings out of `rc.yaml`

* test: fix `spawn ENOENT`

* chore(git): revert invalid change

This reverts commit 1ff6fe2323.

* feat: rename `rc.yaml` to `config.yaml`

* refactor: replace `acceptNonRc` with `!globalSettingsOnly`

* feat!: remove compat completely

* refactor: rename a function

* fix: no actual catalogs

* refactor: replace bool flag with preemptive filter

* feat!: filter global config keys

* test: fix

* fix: exclude `deploy-all-files`

* fix: reverse schema merge order

* feat(cli/config/set): validate global config yaml key

* test: remove duplicated assertion

* docs: correct

* docs: goal changed
2025-11-11 11:24:06 +01:00
Ryo Matsukawa
10bc39152e feat: add support for npm package trust evidence check via a new trustPolicy setting (#10103)
close #8889

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2025-11-09 23:23:58 +01:00
Zoltan Kochan
efb48dcab5 feat: install js runtime as prod dependency (#10141) 2025-10-31 17:12:50 +01:00
Zoltan Kochan
3ce5f82bd7 Merge remote-tracking branch 'origin/main' into v11 2025-10-28 18:40:05 +01:00
Zoltan Kochan
49f03d14ee chore(release): 10.20.0 2025-10-28 17:35:21 +01:00
Khải
ae43ac79fa feat(cli/config)!: breaking changes (#9854)
* feat(cli/config)!: breaking changes

* refactor(test): remove `deepNullProto` and reuse `getOutputString`

* feat(cli/config/list): censor protected settings

* test: censorship of protected settings

* docs(changeset): censorship of protected settings

* fix: eslint

* feat(config)!: exclude non-option from `rawConfig`

* fix: eslint

* refactor: move default registries to builtin (#9886)

* feat(config)!: filter rc settings

* feat(config): don't exclude non-options

This reverts commit a79f72dbfb.

* feat(cli/config/get)!: print array as json

* test: fix

* docs(changeset): correct

* test: fix

* feat(cli/config)!: only kebabize option fields (wip)

* chore(git): revert the implementation

This reverts commit 529f9bdd47.

* test: restore

This reverts commit d8191e0ed8.

* feat(cli/config)!: only kebabize option fields (wip)

* feat: use `types` instead

* feat(cli/config/get)!: only kebabize rc fields

* test: add

* test: non-rc kebab-case keys

* test: correct

* docs(changeset): correct

* docs(changeset): style

* docs(changeset): correct

* test: only kebabize rc fields

* fix: import path

* fix: eslint

* fix: `isCamelCase`

* feat(cli/config/set)!: forbid unknown rc fields

* test: fix existing test

* test: refuse unsupported rc settings

* feat: hint

* feat(cli/config/set)!: refuse kebab-case workspace-specific settings

* feat(config)!: ignore non-camelCase from `pnpm-workspace.yaml`

* test: config get

* test: config list

* refactor: extract shared code into its own package

* test: `isCamelCase`

* feat(cli/config/list)!: consistent naming cases

* refactor: make it more reusable

* feat(cli/config/get)!: consistent naming cases

* feat(cli/config/get): censor protected settings

* test: `get ''` should be the same as `list`

* docs(test): quotation marks

* refactor: remove unnecessary `test.each`

* docs(changeset): case changes

* test: unknown keys

* docs(changeset): correct

* docs(changeset): non camelCase from `pnpm-workspace.yaml`

* fix: eslint

* docs(changeset): correct terminology

* docs(changeset): clarify

* feat!: do not load non-auth and non-registry

* fix: implementation

* test: no hidden settings

* fix: eslint

* fix: do not drop default values

* test: fix

* test: remove irrelevant tests

* test: fix (wip)

* fix: auth

* test: skip an inapplicable test

* test: temporary skip a test

* test: fix 'respects testPattern'

* test: fix 'respects changedFilesIgnorePattern'

* test: fix 'changedFilesIgnorePattern is respected'

* test: rename a test

* test: fix `package-lock=false`

* feat: exception for `managePackageManagerVersions`

* test: `managePackageManagerVersions: false`

* test: fix (wip)

* test: workaround

* fix: default `optional` to `true`

* fix: `filter` on `pnpm-workspace.yaml`

* test: fix

* test: disable ones that no longer apply

* chore(git): revert incorrect change

* fix: `filter` on `pnpm-workspace.yaml` (#10127)

* fix: `filter` on `pnpm-workspace.yaml`

* docs: changeset

* fix: actual fix

* fix: don't set default on config

* docs(readme): correct a package description

* fix: typo

* test: fix

* test: use a field that wouldn't be ignored

* test: replace some `.npmrc` with `pnpm-workspace.yaml`

* docs(changeset): less awkward wordings

* docs(changeset): correction
2025-10-28 17:09:15 +01:00
Zoltan Kochan
dab9abef5c Merge remote-tracking branch 'origin/main' into v11 2025-10-24 14:19:07 +02:00
Zoltan Kochan
0cde1287c8 chore: update repository fields 2025-10-23 11:57:12 +02:00
Zoltan Kochan
43d7b18c2f chore(release): 10.19.0 2025-10-21 15:30:20 +02:00
Zoltan Kochan
dee39ecb8a feat: support allowing the build of specific versions of dependencies (#10104)
close #10076
2025-10-21 12:38:16 +02:00
Ryo Matsukawa
7c1382f7b7 feat: add support for exact versions in minimumReleaseAgeExclude (#10059)
close #9985

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2025-10-18 11:10:08 +02:00
Zoltan Kochan
1bfc105da0 chore(release): 10.18.3 2025-10-14 11:27:45 +02:00
Zoltan Kochan
a43166624e Merge remote-tracking branch 'origin/main' into v11 2025-10-10 10:01:19 +02:00
Zoltan Kochan
1b15e45ae9 chore(release): 10.18.2 2025-10-09 16:56:04 +02:00
Nikita Skovoroda
b9effa2b09 fix: inline ndjson parse with updated deps (#10054)
* chore: inline ndjson parse with updated deps

* docs: add changeset

* refactor: implement CR suggestion

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2025-10-09 16:27:06 +02:00
Zoltan Kochan
651a27aea4 chore(release): 10.18.1 2025-10-06 14:13:59 +02:00
Zoltan Kochan
8fcdda9e2c fix: setup should create a command shim (#10045)
close #5700
2025-10-06 14:00:36 +02:00
Zoltan Kochan
6618431aee chore(release): libs 2025-09-29 11:56:00 +02:00
Zoltan Kochan
f307b9a130 Merge remote-tracking branch 'origin/main' into v11 2025-09-24 10:51:53 +02:00
Zoltan Kochan
f6242c333b chore(release): 10.17.1 2025-09-22 15:09:34 +02:00