Skip to main content

Module packages

Module packages 

Source
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§

GraphProblem
What is wrong with a graph, as a coded diagnostic’s parts. bynk-check turns each into a CompileError attributed to bynk.toml.
Package
One dependency package in a resolved graph.
PackageGraph
A project’s resolved dependency graph (single version: one entry per package, however many aliases reach it).
PackageId
A package’s identity: org/package.

Constants§

DEPENDENCY_CYCLE
The package graph has a cycle.
DEPENDENCY_NOT_FOUND
A dependency’s bynk.toml isn’t readable, or isn’t a well-formed package.
DUPLICATE_SOURCE
One package reached from two different directories.
LOCK_INVALID
#2240: bynk.lock can’t be read.
NAME_MISMATCH
A path dependency’s [package] name isn’t the package its entry declares.
NOT_FETCHED
#2240: a git dependency with no lock entry, or whose store entry is missing: bynk fetch fetches 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 are resolve_graph’s to report.
display_names
Rewrite every canonical dependency unit name in text (a diagnostic’s message or note) to its display_unit_name form, and a bare encoded package segment to org/package.
display_unit_name
name as a person reads it: a canonical dependency unit name becomes org/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, or src, never tests.
resolve_graph
Resolve the path-dependency graph of the project at project_root. None with no problems when the project declares no dependencies.
routes_of
#2274: organisation → registry name, from the [registries] of the manifest at root.
split_canonical
Split a canonical dependency unit name into its package and the unit name the package itself declares. None for a project’s own or first-party unit.