Repository navigation
[pull] main from pnpm:main - #496
Merged
Merged
Conversation
… how (#13794) A specifier that does not ask for SSH resolves over HTTPS, because the URL pnpm records is shared by every machine that installs the lockfile (#13290). On a machine whose git cannot use that transport - a container without the host's CA certificates, say - resolution then failed with a raw execa dump: "Command failed with exit code 128: git ls-remote -- 'https://github.com/...'" and a JS stack, naming neither the dependency nor a way forward. A failed ls-remote is now ERR_PNPM_GIT_RESOLVE_FAILED, naming the dependency and redacting the credentials a URL git echoes back can carry. When the resolution went over HTTPS, the error also says why, and points at git's own url.<base>.insteadOf to substitute the transport on this machine only, leaving the recorded URL alone. A missing git binary says so instead of surfacing a bare spawn error. The TypeScript resolver also stops probing anonymous HTTPS git access for a repository the visibility probe already proved public: both outcomes of that probe recorded the same resolution, so its only effect was an extra ls-remote round-trip per git dependency. pacquet never probed. Carrying the code and the remediation across pacquet's type-erased resolver seam takes the mechanism resolver-base documents for exactly that: the diagnostic is boxed outermost and recovered by downcast, in the tree walker and in add. Related to #13743.
…ogs` to `catalogPrune` (#13653) Added a new setting `minimumReleaseAgeExcludePrune`. When enabled, `pnpm add`, `pnpm update`, and `pnpm remove` prune the `minimumReleaseAgeExclude` entries in `pnpm-workspace.yaml` that the freshly written lockfile no longer resolves: exact versions that are gone are dropped (the entry goes away once none remain), and entries for packages absent from the lockfile are removed too. A narrowed version union is rewritten canonically via `mergePackageVersionSpecs`. Name patterns and unparsable entries are kept verbatim, so the pass never rejects a hand-written entry. The name groups the setting with `minimumReleaseAgeExclude`, the list it acts on, matching how `minimumReleaseAgeStrict`, `minimumReleaseAgeIgnoreMissingTime`, and `trustPolicyIgnoreAfter` sort with their families. `cleanupUnusedCatalogs` is renamed to `catalogPrune` for the same reason: it groups with `catalogMode`, and both settings now name the same operation with the same verb, the one `pnpm prune` and `pnpm store prune` already use. It is singular because the pass prunes the `catalog:` block as well as `catalogs:`, exactly as `catalogMode` governs both. The former name stays accepted — as a serde alias applied before the canonical key in pacquet, and as a `catalogPrune ??= cleanupUnusedCatalogs` fallback in the TypeScript config reader — so the canonical key wins when both are set, in both stacks. No warning is emitted; `cleanupUnusedCatalogs` is an alias, not a deprecation. The pass may only drop an entry it can prove nothing resolves, so it needs a lockfile that covers every project `minimumReleaseAgeExclude` governs. It is skipped when `sharedWorkspaceLockfile` is false (a per-project lockfile makes every sibling project's entry look unresolved), when `lockfile` is false (the on-disk lockfile would be stale), and when the install returned no new lockfile — a frozen install or a pnpr-delegated one, where an empty resolved set would otherwise prune the whole list. The presence of the resolved-versions map is the single gate on both stacks; there is no separate boolean for the writer to disagree with. In the TypeScript CLI the versions come from the in-memory lockfile that `mutateModules` resolved, newly forwarded as `MutateModulesResult.newLockfile`. In pacquet the pass runs as a second, post-install write of `pnpm-workspace.yaml` (the catalog write has to precede the install so the resolver reads the new entries back), reading the lockfile the install just wrote. Registry-qualified snapshot keys (`<name>@<registry>:<version>`) register their version; packages resolved only from a non-semver source (git, tarball, `file:`) register their name with no version, so their bare-name entry survives while versioned ones are pruned. Cleanup runs before `addedMinimumReleaseAgeExcludes` is merged, so an exclusion approved during the same install is never pruned by the same write. Related to #11668 --------- Co-authored-by: Zoltan Kochan <[email protected]>
…13803) Adding a package to a workspace always paid a full resolution, even when every dependency it declared was already locked for a sibling — the normal case for a package scaffolded from a template. The importers handler now writes such a project's whole entry from the versions the lockfile already holds, by the rule #13779 established for a single changed range: the already-locked version resolution would dedupe onto. The project arrives as an importer with nothing recorded rather than a missing one, because reading the lockfile seeds an empty entry for every project that has none. The gate that asked whether every project had an importer was therefore always satisfied; the fallback that actually fired was the handler's, on the first alias with no recorded reference. pacquet does not seed, so its handler takes both shapes. A dependency that resolves to a directory keeps the resolver, since only it decides whether a plain range on a workspace project's name becomes a link. So do a non-semver specifier and a range no locked version satisfies. So does a range several locked versions satisfy under `resolutionMode: time-based` or `lowest-direct`. Those modes resolve a direct dependency to the lowest satisfying version, and they apply only to a run that leaves the manifest alone, so which end of the range wins is not a property of the lockfile. With one candidate the two ends coincide, so an exact specifier keeps its fast path. This closes the same gap in the changed-range reuse. The overrides handler keeps taking the highest: `resolutionMode` moves only direct dependencies, and an override names a package at any depth. A new importer is the one edit that adds reachability, so the shared epilogue has to recompute the `optional` flags rather than leave them: a package only optional dependencies reached can stop being optional. `GraphEdits.movedAcrossOptional` becomes `optionalFlagsAreStale` to cover both causes. Both stacks. A byte-identity test runs the same addition through the fast path and through a forced resolution, including on a time-based lockfile, where the new direct dependency was transitive-only before and so carries no publish date of its own. Item 3 of #13696, closes #13800.
Switch global installs over atomically in both implementations. Generate the command shims from the group's stable hash link rather than the install directory it points at, and move that link with a rename before linking rather than after, so activating a new install is a single operation and the shims are left byte-identical. Restore the previous bins and hash link when a step that does write fails, and defer destructive cleanup until activation succeeds. Cleanup preserves bins that still belong to an installed package, attempts every artifact removal, and reports diagnostics without hiding the original failure. --------- Co-authored-by: Zoltan Kochan <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
`EnvLockfile::read` loaded the whole `pnpm-lock.yaml` into a `String` and sliced the leading env document out of it. Since the switch to the project's package-manager version, that read happens on every command in a project that pins pnpm through `devEngines.packageManager` or a v12+ `packageManager` field — most projects — to consume a document that is a fraction of a percent of the file. Read the file in 64 KB chunks instead, stopping at the separator that closes the env document, and rejecting a lockfile that does not begin with `---\n` as soon as those 4 bytes are in. The cost is now flat in the size of the lockfile: on an 8 MB lockfile, reading the env document takes ~15µs instead of ~390µs. The BOM and CRLF normalization that `normalize_lockfile_content` did over the whole file happens per chunk, withholding a carriage return that ends a chunk until the next one says whether an LF follows it. This mirrors `streamReadFirstYamlDocument` in `pnpm11/lockfile/fs/src/yamlDocuments.ts`, which the TypeScript CLI already uses. Behavior, output, and file format are unchanged in both stacks, so there is nothing to port back. Closes #13819
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 : )