mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #262] [CLOSED] feat(font): replace generated font catalog with Vite import-rewriting transform #425
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#425
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/262
Author: @yunus25jmi1
Created: 3/5/2026
Status: ❌ Closed
Base:
main← Head:feat/font-vite-transform📝 Commits (3)
8c1d17ffeat(font): replace generated font catalog with Vite import-rewriting transformd977bc8Merge origin/main into feat/font-vite-transform - resolve conflicts4ec675cfix: apply oxfmt formatting after merge with main📊 Changes
9 files changed (+343 additions, -2437 deletions)
View changed files
📝
CLAUDE.md(+1 -1)📝
packages/vinext/src/index.ts(+215 -102)📝
packages/vinext/src/shims/font-google-base.ts(+4 -3)➖
packages/vinext/src/shims/font-google.generated.ts(+0 -2251)📝
packages/vinext/src/shims/font-google.ts(+1 -1)📝
packages/vinext/src/shims/next-shims-font-google.generated.d.ts(+1 -0)📝
scripts/generate-google-fonts.js(+1 -17)📝
tests/font-google.test.ts(+108 -57)📝
tests/shims.test.ts(+12 -5)📄 Description
Summary
Closes #200
Instead of a 1928-line generated font catalog (
font-google.generated.ts) that re-exports every Google Font as acreateFontLoadercall, thevinext:google-fontsVite plugin now rewritesnext/font/googleimport statements at compile time.Before
After
The plugin rewrites imports at compile time across all Vite environments (RSC, SSR, client):
Self-hosted font fetching during production builds continues to work as before.
Changes
packages/vinext/src/shims/font-google.generated.ts(1928 lines / ~70 KB)font-google.tsto exportcreateFontLoaderinstead of re-exporting the catalogcreateFontLoaderexport tonext-shims-font-google.generated.d.tsfor IDE autocompletevinext:google-fontsVite plugin to perform import-time transforms in dev + buildfont-google-base.tsto handle underscore-style names (Roboto_Mono→'Roboto Mono') for users who skip the Vite plugingenerate-google-fonts.jsto only generate.d.ts(no longer generates.tscatalog)createFontLoaderAPI instead of named exportsTesting
font-google.test.tstests passshims.test.tspassentry-templates.test.tstests pass🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.