ADR-0005: Self-contained runtime assets: tokens and fonts vendored at build timeСамодостаточные ресурсы времени выполнения: токены и шрифты встраиваются в сборку
ContextКонтекст
Design tokens come from @mctlhq/css and the three typefaces — Onest, Instrument Serif, JetBrains Mono, all under the SIL Open Font License — from pinned @fontsource packages. Loading either from a third-party origin at runtime would hand every reader’s IP address to that origin and make the page depend on its availability.
Токены дизайна берутся из @mctlhq/css, а три гарнитуры — Onest, Instrument Serif, JetBrains Mono, все под лицензией SIL Open Font License — из закреплённых пакетов @fontsource. Загрузка любого из этих ресурсов со сторонней площадки во время выполнения раскрыла бы ей IP-адрес каждого читателя и поставила бы страницу в зависимость от её доступности.
DecisionРешение
scripts/vendor-assets.mjs fetches tokens and fonts at build time, verifies them against pinned SHA-256 digests, and commits them under public/assets/ together with their licences; the site serves them from its own origin and the Content-Security-Policy names no external origin.
scripts/vendor-assets.mjs получает токены и шрифты во время сборки, сверяет их с закреплёнными SHA-256, и кладёт их в public/assets/ вместе с лицензиями; сайт отдаёт их со своего же домена, а Content-Security-Policy не упоминает ни одной внешней площадки.
ConsequencesПоследствия
A design system release reaches the site only through a reviewed re-pin of the digests, and the repository carries the vendored bytes. In exchange the production page makes zero third-party requests and the build succeeds offline from the committed tree.
Новая версия дизайн-системы попадает на сайт только через отрецензированное обновление закреплённых хешей, а сами файлы лежат в репозитории. Взамен продакшен-страница не делает ни одного стороннего запроса, а сборка проходит без сети из уже зафиксированного дерева.
DriversДвижущие факторы
No third-party request and no cookie is a promise the page has to keep byte for byte, not in prose.
Отсутствие сторонних запросов и cookie — обещание, которое страница обязана выполнять побайтово, а не на словах.
Revisit criteriaКритерии пересмотра
Revisit if the design system publishes a version the site must follow within days.
Пересмотреть, если дизайн-система выпустит версию, за которой сайту нужно последовать в течение дней.