Repository navigation
[pull] main from pnpm:main - #497
Merged
Merged
Conversation
…13804) The two resolver-consulting fast rewrites still had to arrive alone. `catalogs` and `overrides` were absent from the composed pipeline, so editing `pnpm.overrides` while also removing a dependency, or changing a catalog entry in the same commit as a range bump, re-resolved the whole graph even though either change on its own is rewritten in place. Both now join the pipeline. They run last, after the shared graph epilogue, patch rekeying and the settings block, so their guards see the packages a full resolution would see; catalogs runs before overrides, the order a resolution applies the two in. The conditions that made them exclusive survive as gates: an override whose value is a `catalog:` reference still sends the whole run to the resolver, and a lockfile carrying a `time` section still bails whenever either rewrite is in play, since only a resolution can record the publish date of a version they introduce. Two lockfiles the rewrites could write wrong are fixed on the way, both reachable before this change and more likely once the two compose. An override moving a package a catalog entry records left the entry naming the version the override had just pruned; a catalog entry moving a package an unscoped override pins moved it past the pinned version. Each now hands the move to the resolver. pacquet composes the two the same way, in the reuse seed it hands the resolver. Its lockfile is always rebuilt from that resolution, catalog snapshots included, so the two wrong-lockfile cases have no counterpart there and need no mirror. Closes #13799. Part of #13696.
## Summary - Restore the Rust CLI default that freezes an existing non-empty `pnpm-lock.yaml` in CI, so an outdated lockfile fails without being rewritten. - Preserve explicit `frozenLockfile` and `preferFrozenLockfile` choices from CLI flags, trusted configuration, environment variables, and `.pnpmfile.cjs` hooks. - Recognize `CI=1`, `CI=true`, and GitHub Actions; let explicit `CI=false` opt out, and prevent repository-controlled `pnpm-workspace.yaml` from overriding CI detection. - Keep missing, byte-empty, and semantically empty lockfiles writable, and isolate CI-sensitive spawned commands in the Rust test workflow. The TypeScript CLI already has this behavior; this brings the Rust `pnpm/` port back into parity. Fixes #13760.
) pnpm remove already skips resolution when the lockfile proves the outcome; its twin did not. `pnpm add <pkg>@<version>` re-resolved the whole graph even when the requested version was one the lockfile already held — promoting a transitive dependency to a direct one, or adding to a second workspace package what a first one already depends on. The rule is the one #13779 established: resolution reuses the already-locked version it would dedupe onto rather than fetching a higher one, because preferredVersions biases it toward what the graph already holds. The importers handler now records a brand-new importer edge at that version, under the group the manifest declares, alongside the whole-new-project entry #13803 added. It reuses that change's guards: a range several locked versions satisfy under `resolutionMode: time-based` or `lowest-direct` keeps the resolver, since those pick the low end and only for a run that leaves the manifest alone, and so does a plain range on a workspace project's name, which may resolve to a link instead. A lockfile carrying `time` keeps it too: `time` records a publish date per direct dependency and is only pruned on save, never extended, so a package promoted into that position would be missing the one a resolution records. `installSome` cannot edit the manifests in place the way `uninstallSome` does — the resolution path reads them to tell a new dependency from a re-added one, and reads them again to pick the range style it saves — so the edit is staged on copies, handed to the fast update and its freshness gates, and the context takes it only once the rewrite commits. The range a selector saves is computed with the resolver's own rule, extracted as `calcVersionRange` in `@pnpm/pkg-manifest.utils` alongside the `inferRangeSpecStyle` it needs. pacquet needed only the gate: `add` already pins the manifest before the install runs, so `may_fast_update_lockfile` admits `InstallSome` and `add` stops forcing `preferFrozenLockfile` off. `update` is also `InstallSome` and keeps its explicit opt-out, so it is unaffected. Its manifest pin still consults the registry packument; only the install-side resolution is skipped. The narrow cut is a plain registry specifier. A dist tag, an alias, a `workspace:`/`catalog:`/git/tarball specifier, `--save-peer`, a `catalogMode` other than `manual`, an overridden package, and a version nothing locked satisfies all keep the resolver. Closes #13798.
`pnpm sbom` walked every package in the lockfile, so optional platform-specific dependencies that cannot be installed on the current platform (e.g. the native `@rolldown/binding-*` variants for other operating systems) were emitted as components even though they are never fetched and their metadata cannot be resolved from the store. Those components appeared without a license, while `pnpm licenses` — which filters such packages with the installability check before reading metadata — reported them correctly. Apply the same platform filter in the SBOM component walk of both stacks. It runs only when metadata is read from the store; `--lockfile-only` keeps describing the whole lockfile graph, which is platform-independent by design. Only an optional dependency is filtered: an incompatible non-optional package is still installed, so it still has metadata and still belongs in the document. The verdict is read through `checkPackageInstallability`, the side-effect-free variant, rather than `packageIsInstallable`: the latter emits a `pnpm:install-check` warn and a skipped-optional-dependency event per filtered package, and a command that only reads a lockfile must not report skips as if an install were happening. pacquet's filter is silent for the same reason. On the Rust side the check lives in `pacquet-package-is-installable` as `platform_is_supported_with_inference`, shared by `pnpm sbom` and `pnpm licenses` instead of being written out twice. The license resolution itself was already shared between the two commands (`@pnpm/deps.compliance.license-resolver`); the divergence was in which packages are walked, which is why this adds a filter to the SBOM walk rather than reusing the whole `licenses ls` implementation. That keeps SBOM generation free of extra disk or network I/O and covers all optional native bindings generically. Closes #13683 --------- Co-authored-by: Zoltan Kochan <[email protected]>
pnpm declares `--ignore-pnpmfile` on every install-family command whose option set is built from `install`'s: `add` and `update` name it directly, `dedupe` omits only `--frozen-lockfile` from it, and `fetch` and `unlink` re-export it whole. pacquet declared it nowhere, so clap rejected the argument before the install started. `ignorePnpmfile` sits in pnpm's `excludedPnpmKeys`, so it is a CLI-only boolean rather than a config-file key. It lands on the install, add, update, dedupe, fetch, and unlink argument sets, is folded into `Config` where each of those already merges its CLI flags, and gates the four places an install reaches for a pnpmfile: the `readPackage` and checksum handle in `install/run.rs`, the custom-resolver load in `resolver_setup.rs`, the custom-fetcher load on the frozen path, and `resolve_pnpmfile_paths`, which feeds both the `updateConfig` hook and the plugin pnpmfiles of config dependencies. The `shouldRefreshResolution` probe that can push a frozen install onto the resolve path is skipped for the same reason. `deploy`, `ci`, and `install-test` embed `InstallArgs`, so they inherit the flag. The workspace state records the pnpmfiles an install honored, so a run that ignores them records none. A later run that honors them again sees the list change and re-validates instead of trusting the mtime fast path. Only pacquet changes: the TypeScript CLI already has the flag. Closes #13808. --------- Co-authored-by: Zoltan Kochan <[email protected]>
…13641) Deploy prunes the optional packages that --no-optional excludes, but kept the optionalDependencies map on each snapshot it retained. The deployed lockfile then referenced packages it did not define: deploying a project that depends on [email protected] produced a lockfile whose sharp snapshot listed 25 @img/sharp-* optional dependencies against four defined entries. Clear those edges after the reachability prune, in pacquet's prune_deploy_lockfile_graph and in the TypeScript CLI's filterDeployPackageSnapshots. The snapshots handed to the latter are built fresh by convertPackageSnapshot / convertProjectSnapshotToPackageSnapshot and shared with nothing, so they are edited in place rather than cloned. Tests in both stacks assert that the default deploy keeps the optional edges and that --no-optional drops them; without the first half, clearing the edges in both modes would have passed. Related to #13623 — that issue also reports dangling symlinks in the deploy directory, which no longer reproduce on main either way. --------- Co-authored-by: Zoltan Kochan <[email protected]>
…13830) Occurrences of one package race for the children-ownership claim. A worse-ranked occurrence that arrives while the claim is vacant walks the package's children and records them, resolved under its own level's preferred-versions overlay; when the deterministically better-placed occurrence claims afterwards it kept those children, because the overlay was left out of the recorded resolution context. Which occurrence got there first is thread timing, so identical inputs produced different lockfiles run to run. Record the overlay projected down to the names the package's child edges look up — the whole of the overlay a child's version pick can read — as part of that context. A later owner then keeps the recording only when its own level offers those edges the same versions, and walks them again otherwise, so the children settle on the ranked owner's answer. The re-walk stays bounded: it stops descending wherever the projections agree, unlike the full re-walk on every claim win reverted in #13574. Verified on the issue's @teambit/bit repro (offline, warm cache): 8 identical resolves produced 2 distinct lockfiles before and 8 identical ones after, at ~25% more resolve time on that graph (4.4s -> 5.4s), half of it the projection and half the added walks. Closes #13685.
) extendFilesMap threw ERR_PNPM_UNSUPPORTED_INODE_TYPE for any inode that is neither a file nor a directory. DirPatcher.fromMultipleTargets walks the whole package directory, not just its declared files, so a FIFO anywhere in the package — 1Password's environments create one for .env — aborted syncInjectedDepsAfterScripts and left the injected dependency stale. Leave such an inode out of the inode map instead. It is then absent from the diff as well, so it is neither hardlinked into the target nor removed from it, and the rest of the package syncs. A second failure in applyPatch shares that shape: when a package replaced a file with a directory of the same name, the path landed in `modified` while its contents landed in `added`, and the addition pass reached mkdirSync on the parent before the modification pass had replaced it, dying with EEXIST. Feed `added` and `modified` through one pass instead — every directory first, shallowest first, then the files in parallel — so a directory is always in place before anything is linked into it, and always empty when it displaces what the target held. pacquet needs no matching change: it has no injected-deps syncer (the setting is only recognized as config), and its directory walker already skips non-files. Fixes #13550 --------- Co-authored-by: Zoltan Kochan <[email protected]>
`resolutionMode: lowest-direct` and `time-based` were ignored whenever a release-age cutoff was in effect, which the built-in `minimumReleaseAge` default means is almost always. The picker branched on `publishedBy` rather than composing the two: the maturity branch always took the highest mature version and never read `pickLowestVersion`, so the mode only took effect when `minimumReleaseAge: 0` was set explicitly. The two settings answer different questions. `minimumReleaseAge` narrows which versions are on offer; `resolutionMode` picks an end of what is left. So the maturity branch now picks by `pickLowestVersion` over the matured view. The fallback is unchanged: when no mature version satisfies the range it still takes the lowest regardless of maturity, so the resolver reports the violation inline instead of throwing. Both stacks had the same shape, and pacquet documented the interaction as deliberate on `PickerOpts::pick_lowest_version` — that comment was describing the bug, and is corrected. Closes #13752.
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 : )