mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 00:09:23 +02:00
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#925
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/893
Author: @NathanDrake2406
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @james-elicx
Base:
main← Head:nathan/fix-font-google-narrow-axis📝 Commits (4)
86dfebdshim: rewrite buildGoogleFontsUrl on top of the new build-url helper8d20bbeplugin: validate options against metadata, surface HTTP errors as build errors5f68e02tests: regression coverage for the #885 narrow-axis bug and validator throws50e0b79address google font review feedback📊 Changes
6 files changed (+354 additions, -81 deletions)
View changed files
📝
examples/app-router-nitro/app/layout.tsx(+1 -1)📝
packages/vinext/src/build/google-fonts/validate.ts(+6 -0)📝
packages/vinext/src/plugins/fonts.ts(+71 -37)📝
packages/vinext/src/shims/font-google-base.ts(+38 -34)📝
tests/font-google.test.ts(+228 -9)📝
tests/google-fonts/validate.test.ts(+10 -0)📄 Description
What this changes
Wires the metadata-driven Google Fonts pipeline from #892 into the two consumers that previously hardcoded
:wght@100..900. Fixes issue #885 and related Google Fonts URL bugs.shims/font-google-base.tsbuildGoogleFontsUrlon top of the pure URL builder. No metadata in the shim, so the Worker bundle stays small. Empty options andweight: 'variable'no longer emit invalid fallback axes.plugins/fonts.tsvalidateGoogleFontOptions+getFontAxes+buildGoogleFontsUrl. Surface validation errors and HTTP 4xx/5xx as build errors, with bounded Google response bodies.build/google-fonts/validate.tsaxesvalues before font capability checks so object-form migration errors are clearer.examples/app-router-nitrosubsetsoption to itsGeist_Monocall so the example still builds under the stricter validator.tests/*weight: 'variable'fallback behavior, plugin-levelaxes, validation errors, HTTP error truncation, and network-error fallback.Why
Issue #885: vinext hardcoded
:wght@100..900in two URL builders, so fonts whosewghtaxis is narrower (Sen 400..800, Anton 400) returned HTTP 400 from Google and rendered assans-seriffallback. Investigation found related cases broken by the same code path: italic-only style requests dropped italic in dev fallback, the documentedaxesoption was ignored by the plugin path,weight: 'variable'could produce a rejected dev fallback URL, and unknown families silently produced URLs that Google rejected at request time.Approach
weight: 'variable'is dropped in the dev fallback because the shim intentionally has no metadata.axes: ['opsz']through the plugin pipeline, and clearer object-form axes errors.Validation
vp test run tests/font-google.test.ts tests/google-fonts/build-url.test.ts tests/google-fonts/validate.test.ts: 120 tests passvp check examples/app-router-nitro/app/layout.tsx packages/vinext/src/plugins/fonts.ts packages/vinext/src/shims/font-google-base.ts packages/vinext/src/build/google-fonts/validate.ts tests/font-google.test.ts tests/google-fonts/validate.test.ts: cleanvp run --filter vinext-app-router-nitro build: passRisks / release notes
fontCacheis keyed by URL. Existing on-disk caches under.vinext/fonts/<hash>/are stale for affected fonts; one refetch per font on next build.subsets: [...]orpreload: false; in-tree examples now satisfy this.ital=1instead of accidentally also shipping the regular face. This matches Next.js and the intent ofstyle: ['italic'], but it is user-visible for code that relied on the old side effect.weight: 'variable', so dev mode under dynamic options returns Google's default static face instead of a full variable range. Production uses the metadata-aware path and is unaffected.Playwrite AR Guides(empty subsets in current upstream metadata). If a future canary refresh adds a subset to that family the fixture needs to change.Closes #885.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.