Media / foldkit-media
The variant space
A server makes only what its Variant.space({ widths?, formats?, qualities?, revision? })
allows: the width ladder, a set of formats (AVIF and WebP by default) and a set
of qualities (none by default: no URL names one, and the encoder uses its own).
A request outside it is refused before any work, so an original has at most
space.size variants, whoever asks: 16 for Variant.standard. Give Provider.hosted and
the server the same space; the provider refuses, when defined, a format or
quality its server would refuse.
A variant's URL names its bytes, kept for a year, so a change to what a
variant is (the encoder's settings, how it resizes) is a new revision of
the space, never new bytes behind an old URL. Variant.space({ revision: 1 })
writes w640.r1.avif; revision 0, the default, writes no revision, so every
URL written before revisions keeps its spelling. A server of revision 2 still
answers what earlier ones wrote: an earlier revision's variant while its store
keeps it, and else a 302 to the current revision's URL, kept briefly, since
a rollback, or a server of the earlier revision still in the rollout, answers
the old URL again. A later revision it answers as it would a width it does not
make, briefly, since the next release in a rollout may.