Repository navigation
[pull] main from pnpm:main - #337
Merged
Merged
Conversation
…12458) On the exact-version disk fast path in pickPackage(), promote the parsed packument into the in-memory metaCache so later resolutions of the same package in one install skip the disk read and parse. In large monorepos this brings adding a package down from minutes to seconds. The in-memory cache key is now registry-qualified via a shared getPkgMetaCacheKey(registry, name, fullMetadata) helper. Previously the key was only the package name (plus a `:full` suffix) while the on-disk mirror was registry-qualified, so a package of the same name served by two registries in one install could share one cache slot and resolve the wrong tarball/integrity. The registry is threaded through createNpmResolutionVerifier's shared-meta reads (readSharedMeta / readSharedMetaForTrust), which already noted that a registry-qualified read required the resolver's metaCache key shape to change first. Added a regression test that resolves the same package name from two registries and asserts each gets its own tarball. The Rust pacquet port already implements both behaviors (registry-scoped cache key and disk-fast-path cache population), so no port is required. --------- Co-authored-by: Zoltan Kochan <[email protected]>
…12445) * feat(sbom): add issue-tracker external reference from package bugs Emits a CycloneDX `issue-tracker` external reference for components (and the root) whose package.json declares a `bugs` URL. The value is parsed with `new URL()` and kept only when the protocol is http(s), so malformed values and email-only bug contacts are dropped while uppercase schemes still pass. A single shared helper handles both transitive components and the root package. Like homepage and repository, this is populated from package metadata, so it appears only when the store is read (not in --lockfile-only mode). * fix(sbom): emit the normalized issue-tracker URL, not the raw bugs value bugsUrlFromField used new URL() only as a validity gate but returned the raw input string, so a crafted http(s) `bugs` value containing CR/LF or whitespace would pass verbatim into the CycloneDX externalReferences url (format iri-reference). Return parsed.href instead: new URL strips CR/LF/tab and percent-encodes spaces and control characters, so the emitted url is always a clean, single-line value. * fix(sbom): strip credentials from the issue-tracker URL bugsUrlFromField returned new URL().href, which preserves any embedded username:password. An SBOM is a shareable, often-published artifact, so a bugs value like https://user:token@tracker/... would leak the credentials into externalReferences[].url. Clear username and password before emitting; the tracker URL itself stays useful.
Add `pacquet why <pkg>` command that shows the reverse dependency tree for a given package. Reads the lockfile, inverts the dependency graph, and renders a tree with cycle detection and deduplication. Flags: --depth <n>, --exclude-peers (reserved for parity).
…ent to a single disjunction (#12516) `minimumReleaseAgeExclude` (and `trustPolicyExclude`) ignored every rule after the first match for a given package, so two separate exact-version entries like `[[email protected], [email protected]]` could still trip the policy for the second version while `[[email protected] || 2.5.6]` (a single disjunction entry) worked. That made list semantics depend on whether the user happened to merge versions into one `||` selector, which is surprising and unsafe for supply-chain exclusion lists. Walk every matching rule and merge consecutive `name@version[...]` matches in source order with duplicates removed. A bare-name or wildcard match still terminates the walk, with first-match precedence between bare and exact rules: a wildcard listed after an exact-version rule no longer silently widens the exclusion to every version of the package, while a bare-name rule listed first keeps its existing `AnyVersion` semantics. Apply the same change to the pacquet port so both stacks stay in sync. Closes #12463 --------- Co-authored-by: Zoltan Kochan <[email protected]>
Port yarn berry's popularity-based ident preference (buildPreferenceMap / getHoistIdentMap) into the real-hoist crate so that, when multiple versions of one name compete for the root node_modules slot, the most-used version wins — with the root's direct dependencies always preferred first. This matches pnpm's hoisted node-linker layout, which pacquet previously diverged from by hoisting the first-visited version. Mechanism: - build_hoist_ident_map / add_dependent / PreferenceEntry build a per-name list of candidate idents ordered most-preferred-first (root deps, then by the count of distinct dependents + peer-dependents, stable on ties). - A new AbsorbDecision::Defer plus is_preferred_ident gates free-slot absorption: only the currently-preferred ident may take a free root slot; a non-preferred version stays nested. - hoist_into_root performs a per-pass ident shift (VecDeque::pop_front) that promotes the next candidate when the preferred ident still hasn't reached the root, so a less-preferred version can land once the preferred one is proven unreachable. - HoistCtx bundles root, border_names, and the ident map to keep hoist_subtree within the argument limit. Tests: unit tests for the preference machinery and most-used-wins precedence, a dep-graph workspace test, and two frozen-lockfile CLI e2e tests (single-project and workspace) ported from installing/deps-restorer/test/index.ts. TEST_PORTING.md is updated accordingly. --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Zoltan Kochan <[email protected]>
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 : )