Expand description
Packaging slice 2a (#2223, track design/tracks/packaging.md §3.3, §6.3):
the dependency graph of a project’s path dependencies.
resolve_graph reads the project’s [dependencies], then each path
dependency’s own bynk.toml, and returns the packages the build loads:
where each lives, the source trees it contributes, what it exports, and
which package each of its aliases names. It resolves nothing over a
network and reads only manifests — the overlay first, then the disk, the
way crate::read_package_config already does — so the CLI, check and
the editor build the same graph from the same project root.
A dependency’s units get a canonical name that source can’t spell
(PackageId::encoded): the unit currency of acme/money is
$acme_money.currency inside the compiler. $ is never part of a Bynk
identifier, so the name can’t collide with any unit a project declares; it
is a valid TypeScript identifier once . becomes _, so the emitter’s
identifier sites need no change; and crate::commons_dir_for maps it to
deps/<org>/<package>/…, the output layout (decision G). Diagnostics show
it as acme/money:currency (display_names).
Structs§
- Graph
Problem - What is wrong with a graph, as a coded diagnostic’s parts.
bynk-checkturns each into aCompileErrorattributed tobynk.toml. - Package
- One dependency package in a resolved graph.
- Package
Graph - A project’s resolved dependency graph (single version: one entry per package, however many aliases reach it).
- Package
Id - A package’s identity:
org/package.
Constants§
- DEPENDENCY_
CYCLE - The package graph has a cycle.
- DEPENDENCY_
NOT_ FOUND - A dependency’s
bynk.tomlisn’t readable, or isn’t a well-formed package. - DUPLICATE_
SOURCE - One package reached from two different directories.
- LOCK_
INVALID - #2240:
bynk.lockcan’t be read. - NAME_
MISMATCH - A path dependency’s
[package] nameisn’t the package its entry declares. - NOT_
FETCHED - #2240: a git dependency with no lock entry, or whose store entry is
missing:
bynk fetchfetches it. - PATH_
OUTSIDE_ ROOT - A path dependency declared by a dependency, outside the workspace.
- SOURCE_
MISMATCH - #2274: a locked registry package whose organisation now routes elsewhere.
- UNAVAILABLE
- #2274: an organisation no registry serves (the first-party registry isn’t live yet).
- VERSION_
CONFLICT - #2240: one package reached at two different git commits.
Functions§
- dependency_
trees - Every dependency source tree of the project at
project_root— what discovery walks and what the CLI’s source map partitions into. Problems areresolve_graph’s to report. - display_
names - Rewrite every canonical dependency unit name in
text(a diagnostic’s message or note) to itsdisplay_unit_nameform, and a bare encoded package segment toorg/package. - display_
unit_ name nameas a person reads it: a canonical dependency unit name becomesorg/package:unit; any other name is returned unchanged.- package_
source_ roots - #2255: a dependency package’s source roots — what the compile walks for
it (
resolve_graph): its[paths] include, orsrc, nevertests. - resolve_
graph - Resolve the path-dependency graph of the project at
project_root.Nonewith no problems when the project declares no dependencies. - routes_
of - #2274: organisation → registry name, from the
[registries]of the manifest atroot. - split_
canonical - Split a canonical dependency unit name into its package and the unit name
the package itself declares.
Nonefor a project’s own or first-party unit.