Repository navigation
[pull] main from pnpm:main - #443
Merged
Merged
Conversation
…e settings in the Rust engine (#13283) `frozenLockfile`, `savePrefix`, `savePeer` and `saveCatalogName` are now read from `pnpm-workspace.yaml` and `PNPM_CONFIG_*` by the Rust engine, not only accepted as CLI flags. `Config::frozen_lockfile` is an `Option<bool>` so an unset setting stays distinguishable from an explicit `false`; `install` layers the new `--frozen-lockfile` / `--no-frozen-lockfile` pair over it with the existing `resolve_bool_override` helper, and `for_reresolving_install` sets `no_frozen_lockfile` so a `patch-commit` / `unlink` reinstall re-resolves rather than failing against the stale lockfile. `savePeer` gets the same treatment through a new `--no-save-peer`, which the TypeScript CLI already accepts by way of nopt's `--no-` handling of boolean flags. `frozenLockfile`, `savePeer` and `saveCatalogName` are cleared by `clear_workspace_only_fields`, so they cannot be set in the global `config.yaml` — they are in pnpm's `excludedPnpmKeys`. `savePrefix` is an npm key and stays readable there. Related to #12042.
…egistry (#13285) pacquet already reads the layered `.npmrc` cascade (user < auth.ini < project) and rescopes each source's unscoped per-registry settings before the merge, so a project `.npmrc` that only sets `registry=` cannot pull a user-level credential to another host. Four gaps in that rescope remained, all of them behaviors the TypeScript CLI already had; this closes them. - An unscoped `cert=` / `key=` kept its `\n` escapes literally, while the URL-scoped `//host/:cert=` spelling expanded them. The two spellings of the same identity now produce byte-identical PEMs: expansion moved into the parser, so it happens once for both. - The rescope moved the structured credentials but left `raw_ini_config` holding the unscoped key, so `pnpm config get` / `pnpm config list` reported a credential under a key that no longer had any effect. Each setting's raw spelling now moves with its structured value. `tokenHelper` takes its value from the parsed credential instead: npm has no unscoped spelling for it, so `is_ini_config_key` never captures one, yet pacquet honors the setting. - The deprecation warning identified the source as `<user>/.npmrc` or `auth.ini` rather than the path actually read, never mentioned `tokenHelper` (which was rescoped but omitted from the key list), and the unparsable-registry variant did not say why the settings were dropped. Both warnings now name the file, list every key, and match pnpm's wording. - `build_auth_headers` still had a fallback that keyed leftover unscoped credentials at `config.registry` — the resolved default registry, which repository config can move. That is the rebind the rescope exists to prevent, so the fallback is gone, along with the empty-string default slot in `AuthHeaders::from_creds_map` that fed it. A debug assertion documents that credentials reach header building already pinned. The `@pnpm/napi` bindings kept an equivalent slot. `authHeaderByUri` accepts `""` for the host's default-registry credential, and it was applied at whatever `config.registry` resolved to — reachable from the project's own `.npmrc`. Dropping it outright would have silently broken auth for embedders that pass it, so it is pinned the same way a `.npmrc` credential is: to the `registry` / `registries.default` of the same overlay, or npmjs when the overlay declares neither. An explicit key for that URI still wins, and an unparsable registry drops the header instead of sending it somewhere unintended. Both auth maps canonicalize a key as it is stored rather than leaving that to `AuthHeaders::from_map`, so `//reg.com` and `//reg.com/` cannot survive as two entries that collapse later in whichever order the map iterates — which would have made the "explicit key wins" guarantee depend on iteration order. `normalize_auth_key` is public so the napi binding applies the same rule rather than repeating it. The deprecation warnings quote the source path instead of Debug-formatting it; `{:?}` escapes backslashes, so on Windows the message named `"C:\\Users\\...\\.npmrc"`. Closes #11950.
Edge-aware `engineStrict` dispatch landed in #13172, and the real port of the upstream `fail on unsupported dependency of optional dependency` test landed alongside it in #13173. The `known_failures` stub for the same scenario was left behind, so `just known-failures` still advertised the behavior as unimplemented while the real test was already green. Closes #13143.
… catalogs, resolution mode) (#13279) pnpr resolves and enforces policy server-side, and neither client runs its own verifyLockfileResolutions when a pnpr server is configured. The server assigns each field from the request unconditionally, so a field a client omits is cleared rather than defaulted, and the server resolves under inputs the user never chose. The TypeScript client sent only minimumReleaseAge of the verification policy, so minimumReleaseAgeExclude entries stopped applying and the input-lockfile verifier could reject a lockfile whose entries the user had explicitly excluded. It also never sent the resolution mode, so --frozen-lockfile silently resolved and rewrote the lockfile it promises to leave alone. pacquet never sent catalogs, so every catalog: specifier failed to resolve — the bug #13233 fixed for the TypeScript client and the server, leaving the Rust client behind. Drop the TRUST_POLICY_INCOMPATIBLE_WITH_PNPR guard, written before the server gained trust-policy enforcement and refusing an install pacquet runs happily.
…pendency (#13288) Two of the gaps tracked in #12101. `--workspace` (pacquet): a workspace-link update rewrites each matched direct dependency to a `workspace:` specifier before the install resolves it, so the existing `workspace:` resolver produces the link and its errors. Which dependencies are matched follows the TypeScript CLI exactly: with no selectors, every direct dependency (minus `updateConfig.ignoreDependencies`) that a workspace project publishes; with selectors, the direct dependencies they match, where naming one the workspace does not publish fails with ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND. `--latest` and running outside a workspace are rejected up front with the same codes the TypeScript CLI uses. Selecting nothing to link is not an error: the run falls through to the ordinary update branches. The written specifier reproduces `calcSpecifierForWorkspaceDep`: `saveWorkspaceProtocol: 'rolling'` (the default) writes the declared range operator alone, so a sibling's next release does not invalidate the entry; otherwise the linked version is written under that operator. This adds `saveWorkspaceProtocol` to pacquet's config, which is why it leaves the not-ported list in `pnpm_default_parity`. The workspace-packages map the resolver already builds is reused as the source of link targets. `--depth` (pacquet): the flag was only consulted as a `> 0` predicate gating the name matcher, so a compatible bump always behaved as `depth = Infinity`. `UpdateDepth` now travels with the seed policy into the resolver and gates reuse per node, matching pnpm's `currentDepth <= updateDepth`. The subtree-reuse memo is keyed by depth bucket, collapsed to a single bucket for an unlimited update and to `max_depth + 1` beyond the ceiling, so the common case costs nothing. `--workspace` fixes (TypeScript): two cases linked dependencies the user never named, which pacquet would otherwise have had to reproduce. Both come from `params` being rewritten into the matched dependency names before the workspace block reads it, so the block could not tell "the user named nothing" from "the user's selectors matched nothing". With `updateConfig.ignoreDependencies` set, `createWorkspaceSpecs` threw ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND for the project's ordinary registry dependencies; those are now skipped, as they already were when nothing was ignored. Selectors that matched no direct dependency left `params` empty, which the workspace block answered by linking every workspace dependency. Both now key off whether the user named any package. Related to #12101.
…mand (#13287) pacquet ignored the project's packageManager / devEngines.packageManager pin whenever it could not switch to it, and ignored devEngines.runtime / engines.runtime entirely, so a project the TypeScript CLI refuses to install installed cleanly under pacquet. Port pnpm's pre-command block into the module that already owned the version switch, renamed switch_cli_version -> pre_command: - checkPackageManager: ERR_PNPM_BAD_PM_VERSION / ERR_PNPM_OTHER_PM_EXPECTED with pnpm's messages and hints, including the corepack wording, since corepack picks the running version and pnpm cannot switch under it. - getWantedRuntimes + checkRuntime: ERR_PNPM_BAD_RUNTIME_VERSION against the Node.js / Deno / Bun on the system, devEngines.runtime winning over engines.runtime. The probe mirrors `@pnpm/engine.runtime.system-version`. - The --global opt-out, the skipped-command set, and the --version path, which checks the package manager but not the runtimes. pmOnFail / runtimeOnFail are honored as bypasses and accepted as bare --pm-on-fail= / --runtime-on-fail= flags: pnpm takes every setting that way and the hints these errors print name them, so otherwise the error pointed at a flag pacquet rejected. With manage-package-manager-versions off, a pin that only asked pnpm to switch is no longer reported. That opt-out is the user taking over version selection; corepack is the opposite case, where the version is managed and wrong, so it still reports. syncEnvLockfile, the issue's third item, already runs in pacquet's install pipelines. Widening it to every command is left out: pacquet hard-fails a frozen install whose packageManagerDependencies are stale, and an unconditional pre-command sync would repair the lockfile before that check could fire. Closes #11947
pnpm parses `--workspace-root` in its CLI arg pass: it points `--dir` at
the workspace root, and under `--recursive` it pushes a `{<root>}`
inclusion selector so the run narrows to the root project. pacquet
surfaced neither, so the `pnpm add -D <pkg> <pkg> -w` form from a
workspace subdirectory died in clap with `unexpected argument '-w'
found`.
Declare `-w` as a CLI-wide flag, apply the `--dir` redirect between the
`--filter` and recursive-by-default promotions (where pnpm applies it),
and thread it into `Config` alongside the other CLI-only selectors.
`AutoExcludeRoot::root_exclusion` becomes `root_selector`: under
`--workspace-root` it returns the `{<root>}` inclusion for every
recursive command, otherwise the existing `run` / `exec` / `add` /
`test` `!{<root>}` exclusion.
`--global` and a missing workspace are rejected with pnpm's
`ERR_PNPM_OPTIONS_CONFLICT` / `ERR_PNPM_NOT_IN_WORKSPACE` codes and
messages. `CliCommand::is_global` reassembles pnpm's CLI-wide
`--global` view from the per-subcommand flags pacquet declares.
Closes #13031
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…13293) `fail_on_unsupported_dependency_of_optional_dependency` printed the captured stderr unconditionally on its way to asserting on it, so every run of the suite emitted the install's error output as noise. The assertion already includes the stderr in its failure message. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…13298) `pacquet update --interactive` presented one flat list labelled `<name> <current> ❯ <target>`, so a project with many outdated dependencies gave no clue which were production dependencies and which were dev, and the versions did not line up. `update_choices` now mirrors pnpm's `getUpdateChoices`: the outdated set is deduplicated, split into one group per dependency type — GitHub Actions get their own, as upstream titles them — and each group is rendered as a column-aligned table under a `Package`/`Current`/`Target`/ `URL` header, with the current versions right-aligned. The deduplication runs before the grouping and its key does not include the dependency type, so a package outdated under two types is offered once, under whichever type was seen first. That is upstream's behavior (its `uniqBy` precedes its `groupBy` over the same key) and the ported tests pin it. Groups appear in the order their dependency type is first seen, matching `groupBy`'s insertion order. `dialoguer` has no unselectable item, so the group headings and column headers are ordinary items whose rows carry no package; `selected_packages` drops them from the answer. Ports `getUpdateChoices.test.ts` from `pnpm11/installing/commands/test/update/`. The rendered padding is pacquet's own — upstream lays its table out with `@zkochan/table` — so the ports assert the grouping, ordering, and alignment rather than byte-identical output. The `Workspace` column and the `URL` column's width behavior (#12395) are left for follow-ups. Related to #12101.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )