Commit Graph

10422 Commits

Author SHA1 Message Date
dependabot[bot]
28daa2cb2e build(deps): bump the github-actions group across 1 directory with 4 updates (#10833)
Bumps the github-actions group with 4 updates in the / directory: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact), [github/codeql-action](https://github.com/github/codeql-action) and [cbrgm/mastodon-github-action](https://github.com/cbrgm/mastodon-github-action).


Updates `actions/upload-artifact` from 6.0.0 to 7.0.0
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](b7c566a772...bbbca2ddaa)

Updates `actions/download-artifact` from 7.0.0 to 8.0.0
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](37930b1c2a...70fc10c6e5)

Updates `github/codeql-action` from 4.31.11 to 4.32.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](19b2f06db2...c793b717bc)

Updates `cbrgm/mastodon-github-action` from 2.1.23 to 2.1.26
- [Release notes](https://github.com/cbrgm/mastodon-github-action/releases)
- [Commits](3ebdc72dcd...fc8b40e2ec)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: github/codeql-action
  dependency-version: 4.32.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: cbrgm/mastodon-github-action
  dependency-version: 2.1.26
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-02 23:53:39 +01:00
Zoltan Kochan
b07c371047 fix: remove not needed tsconfig.json 2026-03-02 23:20:04 +01:00
Zoltan Kochan
4793a9380a ci: run benchmarks on node.js 25 2026-03-02 17:10:46 +01:00
Zoltan Kochan
8ab576281d ci: don't install npm separately from node 2026-03-01 20:36:28 +01:00
Zoltan Kochan
7480179239 chore: update pnpm to v11 alpha 12 2026-03-01 20:04:34 +01:00
Zoltan Kochan
ae40e6060f chore(release): 11.0.0-alpha.12 v11.0.0-alpha.12 2026-03-01 19:29:34 +01:00
Zoltan Kochan
2efb5d2919 feat: add pnpm runtime set command and deprecate pnpm env use (#10671)
* feat: add `pnpm runtime set` command and deprecate `pnpm env use`

Add a new `pnpm runtime set <name> <version> [-g]` command (alias: `rt`)
in a new `@pnpm/runtime.commands` package. It delegates to
`pnpm add <name>@runtime:<version>` supporting node, deno, and bun.

`pnpm env use` now prints a deprecation warning pointing users to the
new command.

* fix: address PR review feedback for runtime command

- Use opts.dir as cwd when --global is not passed (instead of always
  using pnpmHomeDir)
- Only pass --global-bin-dir when in global mode
- Keep deprecated env command in help output for discoverability
- Add Jest tests for the runtime command (7 tests)
2026-03-01 18:14:57 +01:00
Zoltan Kochan
543c7e4bae feat: use global virtual store for global packages and dlx (#10694)
* feat: use global virtual store for global packages and dlx

* fix(config): remove unnecessary virtualStoreDir override for global installs

When the global virtual store is disabled, the default `node_modules/.pnpm`
path works fine — no need to explicitly override it to `.pnpm`.
2026-03-01 18:03:04 +01:00
Zoltan Kochan
9587dac9c1 feat!: change default values of optimisticRepeatInstall and verifyDepsBeforeRun (#10822) 2026-03-01 17:48:13 +01:00
Zoltan Kochan
de561a55fa fix: prefer .pnpmfile.mjs by default (#10683)
* fix: prefer .pnpmfile.mjs by default

* fix: handle ERR_MODULE_NOT_FOUND for missing optional .pnpmfile.mjs

Node's dynamic import() throws ERR_MODULE_NOT_FOUND (not MODULE_NOT_FOUND
like require()) when a file doesn't exist. This caused a hard error when
tryLoadDefaultPnpmfile was enabled and .pnpmfile.mjs was absent.

* fix: load only .pnpmfile.mjs when it exists, not both .mjs and .cjs

When both .pnpmfile.mjs and .pnpmfile.cjs exist, only the .mjs file
is now loaded. Previously both were loaded and their hooks combined.
Also adds .mjs support for config dependency plugins.
2026-03-01 17:00:33 +01:00
Conny Brunnkvist
e1ea7799ea feat(cli): add -F short alias for --filter (#10821) 2026-03-01 15:51:34 +01:00
Dhruv Bhanderi
ebe166c30c fix(store): include devDependencies in bundled manifest (#10711) 2026-03-01 15:50:01 +01:00
Zoltan Kochan
fd511e4676 feat: isolated global packages (#10697)
**TLDR:** Global packages in pnpm v10 are annoying and slow because they all are installed to a single global package. Instead, we will now use a system that is similar to the one used by "pnpm dlx" (aka "pnpx").

Each globally installed package (or group of packages installed together) now gets its own isolated installation directory with its own `package.json`, `node_modules`, and lockfile. This prevents global packages from interfering with each other through peer dependency conflicts or version resolution shifts.

## Changes

- Add `@pnpm/global-packages` shared utilities package for scanning, hashing, and managing isolated global installs
- `pnpm add -g` creates isolated installs in `{pnpmHomeDir}/global/v11/{hash}/`
- `pnpm remove -g` removes the entire installation group containing the package
- `pnpm update -g` re-installs into new isolated directories and swaps symlinks
- `pnpm list -g` scans isolated directories to show installed global packages
- `pnpm outdated -g` checks each isolated installation for outdated dependencies
- `pnpm store prune` cleans up orphaned global installation directories

## Breaking changes

- `pnpm install -g` (no args) is no longer supported — use `pnpm add -g <pkg>`
- `pnpm link <pkg-name>` no longer resolves packages from the global store — only relative or absolute paths are accepted
- `pnpm link --global` is removed — use `pnpm add -g .` to register a local package's bins globally
2026-03-01 15:49:18 +01:00
Rohan Santhosh
aefd54879f docs: fix duplicated word in DirPatcher comment\n\nSigned-off-by: Rohan Santhosh <rohan@example.com> (#10817) 2026-03-01 15:26:34 +01:00
Zoltan Kochan
030001035b feat: add pnpm clean command for safe node_modules/lockfile removal (#10708)
* feat: add `pnpm clean` command for safe node_modules removal

Adds a new `pnpm clean` command that safely removes node_modules contents
from all workspace projects. Uses Node.js fs.rm() which correctly handles
NTFS junctions on Windows without following them into their targets,
preventing catastrophic data loss. Preserves non-pnpm hidden files
(e.g. .cache) and lockfiles by default; use --lockfile/-l to also
remove pnpm-lock.yaml files. Also cleans custom virtual-store-dir
when configured inside the project root.

Closes #10707

* fix: use is-subdir package instead of custom implementation, check existence before printing

- Replace custom isSubdir function with the existing is-subdir package
- Only print "Removing" and remove lockfile/virtualStoreDir when they exist
- Rethrow non-ENOENT errors instead of swallowing them

* refactor: use path-exists package, handle TOCTOU race in removeModulesDirContents

- Replace manual fs.access + try/catch with pathExists for cleaner existence checks
- Add ENOENT handling to removeModulesDirContents readdir to handle the race
  where the directory is removed between hasContentsToRemove and readdir

* refactor: use opts object with .bind for cleanProjectDir, rename to removeLockfile
2026-02-28 22:53:56 +01:00
Zoltan Kochan
e04a2fa7f0 fix(patch): use '/dev/null' instead of os.devNull for GIT_CONFIG_GLOBAL (#10757)
On Windows, os.devNull is '\\.\nul', which git cannot open as a config
file path (fatal: unable to access '\\.\nul': Invalid argument).
Git for Windows translates the literal '/dev/null' correctly via its
MSYS2 layer, fixing patch-commit on Windows.
2026-02-28 13:57:43 +01:00
Zoltan Kochan
b2611b7471 chore: update pnpm-lock.yaml (#10717) 2026-02-28 13:20:15 +01:00
Zoltan Kochan
37bc146342 chore: update cspell list 2026-02-28 02:19:07 +01:00
Ishan Gupta
f8367e88d2 fix(dlx): print help message when no arguments are provided (#10690)
* fix(dlx): print help message on calling pnpm dlx without arguments

Running `pnpm dlx` with no arguments would crash Node.js with a
TypeError as it attempted to call `.indexOf()` on an undefined variable.
This commit adds a guard clause and displays the help message instead
and exits gracefully.

Fixes #10633

* refactor: dlx

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-02-28 02:02:53 +01:00
roysandrew
143ca78d09 fix(npm-resolver): respect version constraints when falling back to workspace packages (#10704)
* fix(npm-resolver): respect version constraints when falling back to workspace packages

When link-workspace-packages=true, the fallback resolution paths (registry 404
and no matching registry version) pass update: Boolean(opts.update) to
tryResolveFromWorkspacePackages. On fresh installs without a lockfile entry,
opts.update is 'compatible' (truthy), which overrides the version spec to '*'
and matches any workspace package regardless of version.

Change both fallback call sites to pass update: false so version constraints
are always respected for non-workspace-protocol dependencies. The workspace:
protocol path returns before these blocks and correctly continues to use
opts.update.

Close #10173

* test: clarify npm-resolver test names for workspace version mismatch scenarios

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-02-28 01:52:38 +01:00
Zoltan Kochan
521e4a6ec9 fix: use headless install for injected self-referencing file: dependencies (#10714)
When a package has an injected self-referencing dependency (e.g.
"pkg": "file:" with dependenciesMeta injected: true), the lockfile
resolves it as "link:". The linkedPackagesAreUpToDate() function
incorrectly reported these projects as not up-to-date because
refToRelative() returns null for link: refs, causing pnpm to skip
the fast headless install path and do full resolution instead.
2026-02-28 01:39:42 +01:00
Umesh More
cb49a64af7 fix(patch): prevent git config path errors in patch-commit (#10640)
* fix(patch): prevent git config path errors in patch-commit

Replace HOME='' with GIT_CONFIG_GLOBAL to bypass user config
without breaking home directory resolution in restricted environments.

Fixes #6537

* fix(patch): prevent git config path errors in patch-commit

Use GIT_CONFIG_NOSYSTEM and GIT_CONFIG_GLOBAL to bypass git config
without breaking HOME path resolution in restricted environments.

Fixes #6537
2026-02-28 01:37:37 +01:00
Zoltan Kochan
05158d2cde fix: comparison of hoistPattern values (#10713) 2026-02-27 23:51:58 +01:00
Victor Sumner
97f049fb6a fix: skip re-importing packages when global virtual store is warm (#10709)
* fix: skip re-importing packages when global virtual store is warm

When node_modules is deleted but the global virtual store directories
survive, pnpm previously re-fetched every package because the skip
logic required currentLockfile to be present. Add a fast-path that
checks pathExists(dir) for GVS directories even when currentLockfile
is missing, since the GVS directory hash encodes engine, integrity,
and full dependency subgraph.

* fix: remove includeUnchangedDeps guard from GVS fast-path

The includeUnchangedDeps flag is true whenever currentHoistPattern
differs from the desired hoistPattern. After deleting node_modules,
currentHoistPattern is always undefined (read from .modules.yaml),
so the flag is always true when hoisting is configured — defeating
the optimization in the exact scenario it targets.

The guard is unnecessary because the fast-path only skips fetch/import
(fetchResponse = {}), not graph inclusion. The package is still added
to the graph with children populated, so hoisting recalculation works.

* perf: add GVS warm reinstall benchmark scenario

Adds benchmark 6: frozen lockfile reinstall with a warm global virtual
store after deleting node_modules. This measures the reattach fast-path
where all packages are skipped (no fetch/import) because their GVS
hash directories already exist.

* fix: use proper types in fetchPackage spy to pass tsgo strict checks
2026-02-27 22:51:08 +01:00
Ishan Gupta
d3a0765bea fix(dependencies-hierarchy): handle undefined pkgSnapshot in pnpm why -r (#10705)
* fix(dependencies-hierarchy): handle undefined pkgSnapshot in pnpm why -r

Running pnpm why -r crashes with TypeError due to undefined pkgSnapshot during
invokation of pkgSnapshotToResolution.

This commit wraps resolution and integrity steps with if (pkgSnapshot).
Also, added unit test for the same.

close #10700

* fix: handle undefined pkgSnapshot in pnpm why -r

* Apply suggestions from code review

#10700

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-27 17:28:55 +01:00
Zoltan Kochan
fc25fefac5 chore: update pnpm-lock.yaml (#10701) 2026-02-27 14:40:44 +01:00
Zoltan Kochan
1ab0f7bb2a fix: run @pnpm/exe setup logic in-process to fix version switching without Node.js (#10696)
When pnpm is installed as a standalone executable in environments without
a system Node.js (e.g. Docker containers), the `@pnpm/exe` preinstall
script (`node setup.js`) fails because `node` is not on PATH. This broke
version switching via the `packageManager` field in package.json since
v10.30.2, which changed `getCurrentPackageName()` to return `@pnpm/exe`
instead of platform-specific package names like `@pnpm/linux-x64`.

Install with `--ignore-scripts` and link the platform-specific binary
in-process instead. The setup logic is inlined because setup.js can't
be loaded at runtime: `require()` fails on ESM (pnpm v11+) and
`import()` is intercepted by pkg's virtual filesystem in standalone
executables.

Closes #10687
2026-02-26 10:46:43 +01:00
Zoltan Kochan
dcd16c7b36 fix: pnpm why -r --parseable (#10595)
close #8100
2026-02-26 02:00:45 +01:00
Zoltan Kochan
37091b7291 chore: update pnpm to v11 alpha 11 2026-02-25 11:58:04 +01:00
Zoltan Kochan
7f840620e2 chore: update pnpm-lock.yaml (#10645) 2026-02-25 11:57:35 +01:00
sadan4
a2591e8cda fix(shell-completion): give correct suggestions when command line ends with a space (#10607)
* fix(shell-completion): give correct suggestions when command line ends with a space

fixes an issue where if you tried to complete any part of any subcommand
with a space before <TAB> (eg: `pnpm run <TAB>`, `pnpm rm react <TAB>`),
pnpm would give you suggestions for the root command, as if you had
typed `pnpm <TAB>`

close #7964
close #5426

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-02-25 11:37:48 +01:00
thilllon
2e8816e83b feat(approve-builds): add --all flag to skip interactive prompts (#10619)
Allow approving all pending build dependencies at once without
interactive selection, useful for CI/CD pipelines and project
bootstrapping scenarios where interactive prompts are not feasible.

close #10136
2026-02-25 11:36:49 +01:00
Zoltan Kochan
84075f96bf fix: update npm-packlist (#10658) 2026-02-25 11:33:52 +01:00
Varun Chawla
e73da5e27b fix(lockfile): respect lockfile-include-tarball-url=false for non-standard URLs (#10621)
When lockfile-include-tarball-url is explicitly set to false, tarball URLs
are now always excluded from the lockfile. Previously, packages hosted under
non-standard tarball URLs would still have their tarball field written to the
lockfile even when the setting was false, causing flaky and inconsistent
behavior across environments.

The fix makes the option tri-state internally:
- true: always include tarball URLs
- false: never include tarball URLs
- undefined (not set): use the existing heuristic that includes tarball URLs
  only for packages with non-standard registry URLs

close #6667
2026-02-25 11:03:32 +01:00
btea
107b34f241 ci: skip update-lockfile on forks (#10686)
* ci: skip update-lockfile on forks

* Update .github/workflows/update-lockfile.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-25 10:26:24 +01:00
Allan Kimmer Jensen
f92ac24c1b feat(sbom): add pnpm sbom command (#10592)
* feat(sbom): add `pnpm sbom` command (#9088)

new command that generates SBOMs from the lockfile + store metadata.
supports CycloneDX 1.6 JSON and SPDX 2.3 JSON via `--sbom-format`.

two new packages following the existing `pnpm licenses` architecture:
- `@pnpm/sbom` — core library (lockfile walking, store reading, serializers)
- `@pnpm/plugin-commands-sbom` — CLI plugin wiring

uses the lockfile walker for dependency traversal and reads package.json
from the CAFS store for license/author/description metadata. `--lockfile-only`
skips the store entirely for faster CI runs where metadata isn't needed.

validated against official CycloneDX 1.6 and SPDX 2.3 JSON schemas.

* chore: add sbom-related words to cspell dictionary

* fix(sbom): address CycloneDX review feedback and bump to 1.7

Implements all 5 items from the CycloneDX maintainer review:
split scoped names into group/name, move hashes to
externalReferences distribution, use license.id for known SPDX
identifiers, switch to modern tools.components structure with
pnpm version, and bump specVersion to 1.7.

Also adds spdx-license-ids for proper license classification and
improves SPDX serializer test coverage.

* fix(sbom): fix CI bundle failure for spdx-license-ids

createRequire doesn't work in the esbuild bundle since it's a runtime
resolve, switched back to regular import which esbuild can inline.

* fix(sbom): use tarball URL for distribution externalReferences

Use actual tarball download URL instead of PURL for CycloneDX
distribution externalReferences, per review feedback.

* feat(sbom): add CycloneDX metadata and improve SBOM quality scores

adds $schema, timestamp, lifecycles (build/pre-build) to CycloneDX output
to match what npm does. also enriches both CycloneDX and SPDX with
metadata.authors, metadata.supplier, component supplier from author,
vcs externalReferences from repository, and root component details
(purl, license, description, author, vcs). SPDX now uses tarball URL
for downloadLocation instead of NOASSERTION.

renames CycloneDxToolInfo to CycloneDxOptions, passes lockfileOnly
through to the serializer for lifecycle phase selection. adds store-dir
to accepted CLI options.

* fix(sbom): address CycloneDX review feedback round 2

switches license classification from spdx-license-ids to
@cyclonedx/cyclonedx-library (SPDX.isSupportedSpdxId) for accurate
CycloneDX license ID validation per jkowalleck's feedback.

removes hardcoded metadata.authors and metadata.supplier — these are
not appropriate for a tool to set. adds --sbom-authors and
--sbom-supplier CLI flags so the SBOM consumer (e.g. ACME Corp) can
declare who they are.

removes supplier from components — supplier is the registry/distributor,
not the package author. also fixes distribution externalReference to
only emit when a real tarball URL exists, no PURL fallback.

* fix(sbom): use sub-path import for CycloneDX library to fix bundle

top-level import from @cyclonedx/cyclonedx-library drags in
validation/serialize layers with optional deps (ajv-formats, libxmljs2,
xmlbuilder2) that esbuild can't resolve during pnpm CLI bundling.

switch to @cyclonedx/cyclonedx-library/SPDX which only pulls in the
SPDX module we actually use — pure JS, no optional deps.

* chore: update manifests

* refactor: extract shared store-reading logic into @pnpm/store.pkg-finder

Both @pnpm/license-scanner and @pnpm/sbom independently implemented
nearly identical logic to read a package's file index from the
content-addressable store. This extracts that into a new shared package
that returns a uniform Map<string, string> (filename → absolute path),
simplifying both consumers.

Close #9088

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2026-02-25 08:45:21 +01:00
Zoltan Kochan
2ba8b2daf1 fix: skip exe artifact linking when platform binary is not yet built v11.0.0-alpha.11 2026-02-24 10:46:23 +01:00
Zoltan Kochan
2aa41defbd chore(release): 11.0.0-alpha.11 2026-02-24 10:38:45 +01:00
Zoltan Kochan
ea5ccfee4b fix: remove bin fields from exe artifact packages 2026-02-24 10:36:36 +01:00
Zoltan Kochan
debff6504f fix(test): skip execPath assertion on Windows in dlx node runtime test
On Windows, node.exe is hardlinked into .bin/ so process.execPath reports
the hardlink path rather than the original store location. The version
check already validates the correct node runtime is being used.
2026-02-24 00:31:05 +01:00
Zoltan Kochan
4c765b45b6 fix(link-bins): use fs.promises.realpath in getBinNodePaths tests for Windows 8.3 paths
fs.realpathSync uses a JS-only implementation that only resolves symlinks,
not Windows 8.3 short names (e.g., RUNNER~1). Switch to fs.promises.realpath
which uses the native uv_fs_realpath (GetFinalPathNameByHandleW on Windows)
to properly resolve 8.3 short paths to their long form.
2026-02-23 22:18:51 +01:00
Zoltan Kochan
339faa548f fix(link-bins): normalize temp paths in getBinNodePaths tests for Windows
On Windows, temporaryDirectory() may return 8.3 short paths (e.g.,
RUNNER~1) but getBinNodePaths resolves via fs.realpath, returning long
paths (e.g., runneradmin). Use realpathSync to normalize expected paths.
2026-02-23 20:34:55 +01:00
Zoltan Kochan
e3ec45421b fix(assert-project): check for .exe when .cmd does not exist on Windows
After hardlinking node.exe directly instead of creating a cmd-shim,
the isExecutable utility needs to also accept .exe files on Windows.
2026-02-23 17:26:43 +01:00
Zoltan Kochan
c83044e2db chore: update pnpm to v11 alpha 10 2026-02-23 16:50:12 +01:00
Zoltan Kochan
6e14ecbc91 chore: use standalone pnpm and bump packageManager to 11.0.0-alpha.10
Switch CI workflows to use standalone pnpm installation and update
the packageManager field to match the latest alpha release.
2026-02-23 16:32:02 +01:00
Zoltan Kochan
413c8cc012 chore(release): 11.0.0-alpha.10 v11.0.0-alpha.10 2026-02-23 16:24:02 +01:00
Zoltan Kochan
44d1f0b226 fix(link-bins): hardlink node.exe on Windows instead of creating a cmd-shim (#10679)
Third-party cmd shims (e.g., npm's rimraf.cmd) call node.exe from
within IF/ELSE blocks in batch files. When node resolves to node.cmd
instead of node.exe, Windows batch file chaining breaks with
"The system cannot find the path specified."

On Windows, hardlink node.exe directly into the bin directory.
On non-Windows, symlink the node binary directly.
2026-02-23 16:23:00 +01:00
Jake Bailey
ccec8e7d87 fix(config): respect lockfile: false setting from pnpm-workspace.yaml (#10672)
* fix(config): respect lockfile: false setting from pnpm-workspace.yaml

* fix(config): derive lockfile settings after all config sources are applied

* fix(config): use lockfile instead of useLockfile in integration tests
2026-02-23 16:22:29 +01:00
Zoltan Kochan
dfd5fe7387 chore: use standalone pnpm and bump packageManager to 11.0.0-alpha.9
Switch CI workflows to use standalone pnpm installation and update
the packageManager field to match the latest alpha release.
2026-02-23 14:32:38 +01:00
Zoltan Kochan
1054d72c5b chore(release): 11.0.0-alpha.9 v11.0.0-alpha.9 2026-02-23 14:24:06 +01:00