Skip to main content

apply_peer_contexts

Function apply_peer_contexts 

Source
pub fn apply_peer_contexts(
    canonical: LockfileGraph,
    options: &PeerContextOptions,
) -> Result<LockfileGraph, Error>
Expand description

Compute peer-context suffixes over an already-resolved graph.

Takes a canonical graph — one LockedPackage per (name, version) with peer_dependencies populated — and produces a contextualized graph whose keys and transitive references carry (peer@ver) suffixes when packages resolve peers differently in different subtrees. Drives the sibling-symlink wiring in aube-linker for peers, so every fetch/materialize site sees a per-context identity for any package whose peers disambiguate.

Public so lockfile-driven installs can run the pass over graphs parsed from npm/yarn/bun lockfiles (which emit canonical form — no peer suffixes — and would otherwise leave peer-dependent packages without their peers as .aube/<pkg>/node_modules/<peer> siblings). Fresh resolves call it internally from Resolver::resolve.