feat: expose theme preload links in /sites/_hashes#128
Merged
Conversation
a2c7497 to
53ae2ba
Compare
53ae2ba to
4f84b96
Compare
4f84b96 to
40dda6e
Compare
40dda6e to
2590910
Compare
2590910 to
8123d5e
Compare
b2c5302 to
599f4b9
Compare
The sites _hashes payload exposes a `preloadLinks` list so portals and lib-served SPAs can emit `<link rel="preload">` for a site's resources before the theme stylesheet. - simple-directory forwards the theme's `preloadLinks` verbatim (href + as / type / crossorigin) — a plain relay, no transform, no dedup, no logic. - a site without its own `preloadLinks` falls back to the default theme's; `config.ts` drops the default link when the operator sets a custom body font.
599f4b9 to
77aabc5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose a
preloadLinkslist inGET /sites/_hashesso SPA consumers (@data-fair/libserve-spa, the Nuxt portal) can emit<link rel="preload">and fetch a site's resources in parallel with the theme stylesheet.What changed:
GET /sites/_hashesreturnspreloadLinks: [{ href, as?, type?, crossorigin? }](renamed fromfonts), taken straight from the theme'spreloadLinksfield (defined in @data-fair/lib, populated by the portals manager for custom fonts).preloadLinksverbatim (or the default theme's when the site sets none). No dedup, no per-resource logic, no{SITE_PATH}templating — the producer (portals + default theme) builds the complete, final list.config.tsdrops the default Nunito link when the operator configures a custom body font viaTHEME_*.Why: load a site's fonts (and tomorrow other resources like a logo) in parallel with the theme instead of waiting for
_theme.css. Per review, SD does nothing but move the link list to where consumers need it.Regression risks:
_hashesfield renamedfonts→preloadLinks; lib (feat: site resource preloads via theme schema and SPA injection lib#40,serve-spa) and portals (feat(portal): preload site fonts from sd _hashes portals#73) read the new key — deploy together.@data-fair/lib-common-typesrelease (themepreloadLinkswith explicithref/as/type/crossorigin).{SITE_PATH}resolution — intentional; that logic now lives with the producer, and the default href is absolute now that sitePath is being deprecated.@data-fair/lib-express^1.19→^1.23(andlib-node^2.12.1→^2.13.1) — that's how thepreloadLinkstheme field reaches this service. The bump also changes pseudo-session behavior: non-GET requests on a pseudo session now return 403 instead of 401 (lib-expresssession.js).pseudo-session.api.spec.ts's keepalive assertion was updated to match; any external consumer keying on401for that case will now see403.