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#924
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/892
Author: @NathanDrake2406
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/26/2026
Merged by: @james-elicx
Base:
main← Head:nathan/font-google-helpers📝 Commits (5)
6aed8eavendor Google Fonts metadata from Next.js8755baeport Google Fonts URL pipeline from Next.jsf833894port Google Fonts options validator from Next.jsb67c713fold attribution into font-metadata header, drop unused exportsc1abf20address PR 892 review: document subsets parity, harden preload-disable test📊 Changes
10 files changed (+16771 additions, -0 deletions)
View changed files
➕
packages/vinext/src/build/google-fonts/build-url.ts(+69 -0)➕
packages/vinext/src/build/google-fonts/font-data.json(+16071 -0)➕
packages/vinext/src/build/google-fonts/font-metadata.ts(+33 -0)➕
packages/vinext/src/build/google-fonts/get-axes.ts(+83 -0)➕
packages/vinext/src/build/google-fonts/sort-variants.ts(+24 -0)➕
packages/vinext/src/build/google-fonts/validate.ts(+165 -0)➕
tests/google-fonts/build-url.test.ts(+75 -0)➕
tests/google-fonts/get-axes.test.ts(+82 -0)➕
tests/google-fonts/sort-variants.test.ts(+42 -0)➕
tests/google-fonts/validate.test.ts(+127 -0)📄 Description
What this changes
Vendors
font-data.jsonfromvercel/next.jsand ports four pure helpers that consume it. Build-time scaffolding only; no runtime wired up.font-data.jsonnext.js/packages/font/src/google/font-data.jsonfont-metadata.tssort-variants.tsnext.js/packages/font/src/google/sort-fonts-variant-values.tsbuild-url.tsnext.js/packages/font/src/google/get-google-fonts-url.tsget-axes.tsnext.js/packages/font/src/google/get-font-axes.tsvalidate.tsnext.js/packages/font/src/google/validate-google-font-function-call.tsWhy
Issue #885:
:wght@100..900is hardcoded in the shim and plugin URL builders, so fonts with narrower axes (Sen 400..800, Anton 400) get HTTP 400 from Google. Investigation also found four sibling bugs in the same code: italic-only requests drop italic, theaxesoption is ignored,weight: 'variable'400s, unknown families build URLs silently.The minimal fix (drop the hardcoded range) regresses Inter from 9 weights to 1. Next.js avoids both regressions by validating + resolving axes against bundled metadata. This PR vendors that metadata and ports the helpers; PR 2 swaps the consumers and adds a Sen fixture.
Approach
Three commits: vendor metadata, port URL pipeline, port validator. A fourth cleanup commit drops
NOTICE.mdand an unused barrel aftervp run knipflagged them; Vercel's MIT attribution lives in thefont-metadata.tsheader instead.Validation
vp test run tests/google-fonts/: 37 new tests pass (regression case for #885, italic-only branch, axes on non-variable, unknown family, unknown subsets, preload auto-disable, every throw branch)vp test run tests/font-google.test.ts: 84 existing tests still passvp check packages/vinext/src/build/google-fonts/ tests/google-fonts/: cleanvp run knip: cleanRisks / follow-ups
next.js/packages/font/src/google/font-data.json.Playwrite AR Guides. If upstream adds a subset to that family the fixture needs to change.PR 2 (next)
shims/font-google-base.tsandplugins/fonts.tsto use the new pipelinecatch { return; }around the build-time fetch so 400s surface as build errorstests/fixtures/font-narrow-axis/(Sen) for CI regression coveragetests/font-google.test.tsfor the new throw pathsRefs #885.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.