composer-wire
The Composer v2 repository wire format — the
metadata documents a Composer 2 client and a Composer repository exchange — as
reusable Rust types, plus the composer/2.0 minify/expand algorithm.
PackageDocument— ap2/{vendor}/{name}.jsondocument (the per-package version list), withexpand()(apply the minified diff) andminified()/flat()constructors.RootManifest— the rootpackages.json(metadata-url,available-packages, …); unknown keys are preserved on round-trip.expand_versions/minify_versions— thecomposer/2.0minified-metadata algorithm and its exact inverse.
use PackageDocument;
// `body` is a `p2/<vendor>/<name>.json` response (minified or not).
let by_name = parse?.expand; // fully-materialized versions
A client parses and expands upstream metadata; a server builds and minifies
metadata to serve. Sharing one implementation means the producer and consumer of
the wire format can't drift — expand_versions(minify_versions(v)) == v.
Part of the composer-rs
workspace — shared Composer-domain crates for the cresset-tools family
(bougie,
sconce). Extracted from
bougie-composer.
License
EUPL-1.2.