Expand description
Packaging slice 1 (#2207, track design/tracks/packaging.md §3, §4, §6.2):
the bynk.toml tables that give a project a package identity and group
projects into a workspace — [package], [dependencies],
[dev-dependencies], [registries] and [workspace].
Everything here is checked; nothing here resolves. [registries] is inert
configuration, and a well-formed, non-empty [dev-dependencies] is refused
until slice 2b. [dependencies] path sources resolve in
crate::packages (#2223), and [workspace] drives the bynk driver’s
check, fmt and test across its members (crate::workspace).
The readers take a toml::Table and return typed configs, the way
workers_config_from and test_targets_from do; crate::check_manifest_str
calls them, and so refuses what they refuse.
Structs§
- Dependency
Spec - One
[dependencies]or[dev-dependencies]entry. - Package
Config [package]: a shareable project’s identity (track §3.2, decision D).- Registry
Config - One
[registries.<name>]entry (track §6.2, decision E). Inert until slice 4: nothing fetches. - Workspace
Config [workspace](decision C): the member globs and the paths they skip.
Enums§
- Dependency
Source - Where a declared dependency comes from: exactly one of these.
Constants§
- DEPENDENCY_
KEYS - The entry keys of a
[dependencies]or[dev-dependencies]entry. - MAX_
SEGMENT_ LEN - The longest an organisation, package or registry name segment may be.
- REGISTRY_
KEYS - The entry keys of a
[registries.<name>]entry. - RESERVED
- The organisation reserved for first-party packages (ADR 0012), and the
name
mirror-ofuses for the first-party registry.
Functions§
- dependencies_
from - A
[dependencies]or[dev-dependencies]table’s entries, each checked for shape (decision A).tableis the table’s name, for messages. - identifier_
problem - The problem with a package segment or an alias (decision G:
[a-z][a-z0-9_]*, not a keyword): each is written in source as the first segment of<alias>.<unit>. - is_
semver - Whether
versionis strict semver 2.0:MAJOR.MINOR.PATCH, no leading zeros, with an optional-prereleaseand+build. - org_
problem - The problem with an organisation segment (decision G:
[a-z][a-z0-9-]*). - package_
config_ from [package]’s typed content (decision D). An unknown key iscrate::check_manifest_str’s to refuse.- package_
name_ problem - The problem with an
org/packagename, as(segment, problem). - read_
package_ config - The project’s
[package]as both the build and the editor see it, the waycrate::read_unstable_configreads[unstable]: the overlay’sbynk.tomlwhen it holds one, otherwise the one on disk.Nonewhen there is no manifest, no[package], or one that isn’t well formed: its shape errors arecrate::check_manifest’s to report. - registries_
from [registries]’s entries, each checked (decision E), and the rules across them: an organisation is routed by one registry at most, and a mirror mirrorsbynkor a registry that isn’t itself a mirror.- registry_
name_ problem - The problem with a registry name (decision G:
[a-z][a-z0-9-]*, notbynk). - registry_
token_ var - The environment variable a registry’s token is read from (track §6.1):
BYNK_REGISTRY_<NAME>_TOKEN, the name uppercased with-mapped to_. A registry name holds no_, so two names never share a variable. - workspace_
config_ from [workspace]’s typed content (decision C). An unknown key iscrate::check_manifest_str’s to refuse; whether the globs match any member iscrate::workspace::load_workspace’s.