Expand description
Packaging slice 2a (#2223): loading a project’s path dependencies into one compile.
apply_graph runs once, right after parsing, on both the build’s and the
editor’s pipeline. It resolves the project’s package graph
([bynk_project::resolve_graph]), then rewrites the parsed files so every
later phase sees one flat set of units, as it always has:
- each dependency file is tagged with its package, and its unit gets the
canonical name source can’t spell ([
bynk_project::PackageId::canonical], decision C) —currencyinacme/moneybecomes$acme_money.currency; - every
uses/consumestarget is resolved against its own file’s package:money.currency, wheremoneyis one of that package’s aliases, becomes the dependency’s canonical name, and a dependency’s reference to its own unit becomes its own canonical name; - a whole-unit
consumesof a dependency unit keeps the spelling source wrote as its alias, somoney.fx.Ratesstill names the capability; - only exported units cross a package boundary (decision D), only the
units a consumer actually reaches are kept (P-5), and a dependency’s
contexts and suites are never compiled (ADR 0542). A reached dependency
adapter’s npm
requiresfold into the build with the project’s own (#2255).
The root project’s own units and the first-party units keep their names, so a project without dependencies compiles byte-identically.
Constants§
- ALIAS_
SHADOWS_ UNIT - An alias is also the first segment of one of the project’s own units.
- DEV_
DEPENDENCY_ IN_ SOURCE - #2240: a non-suite unit reaches a
[dev-dependencies]alias. - UNAPPROVED_
REQUIREMENT - #2296: a reached adapter of a fetched package requires an npm package the
project hasn’t approved in
bynk.lock. - UNIT_
NOT_ EXPORTED - A consumer reaches a unit its dependency doesn’t export.
- UNKNOWN_
UNIT - A consumer reaches a unit its dependency doesn’t declare.
- UNSUPPORTED_
IN_ DEPENDENCY - A dependency declares an
assetor anembed, which needs a per-package namespace not yet designed.
Functions§
- apply_
graph - Resolve the package graph of the project at
project_rootand fold the dependencies’ files inparsedinto the compile. A project with no dependencies is untouched.