mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #785] [MERGED] fix(plugins): track font call ranges during transform #845
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#845
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/785
Author: @Divkix
Created: 4/5/2026
Status: ✅ Merged
Merged: 4/9/2026
Merged by: @james-elicx
Base:
main← Head:fix/issue-751-next-font-google-transform📝 Commits (8)
c92de34fix(plugins): track font call ranges during transform0e44a62test(fonts): remove duplicate test and add E2E build test for #751ed6295cstyle(fonts): fix lint and formatting issues in #751 test73858a1style: fix formatting in font-google-multiple layout0676075refactor(tests): move font-google-multiple to standalone fixture and improve assertions68883affix(tests): address PR review feedback on font transform build test65bb0dechore: update pnpm-lock.yaml for font-google-multiple fixturec636958fix(tests): handle pre-existing node_modules and correct build output extension in font-google-build test📊 Changes
6 files changed (+158 additions, -0 deletions)
View changed files
📝
packages/vinext/src/plugins/fonts.ts(+1 -0)📝
pnpm-lock.yaml(+25 -0)➕
tests/fixtures/font-google-multiple/app/layout.tsx(+28 -0)➕
tests/fixtures/font-google-multiple/app/page.tsx(+8 -0)➕
tests/fixtures/font-google-multiple/package.json(+16 -0)➕
tests/font-google-build.test.ts(+80 -0)📄 Description
Summary
The
injectSelfHostedCssfunction was callings.overwrite()to transform font calls but not adding the call range tooverwrittenRanges. Every others.overwrite()call in the transform hook already tracks its range — this was the only one that didn't. This is a defensive consistency fix that prevents a theoretical double-overwrite if the named-call and member-call regexes ever match overlapping spans.Note: This does not fix #751. The double-comma bug from #751's original report was already fixed by #719. The remaining open issue on #751 is about missing named exports from the font-google shim at build time — a different problem.
Changes
overwrittenRanges.push([callStart, callEnd])after font call transformation ininjectSelfHostedCsscreateBuilder + buildApp()pipeline with multiple Google fonts (Geist + Geist_Mono), asserting that_selfHostedCSSinjection appears in the outputTesting
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.