mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1085] [CLOSED] refactor(entries): dedupe ISR wrapper codegen and config serialization #1083
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#1083
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/1085
Author: @james-elicx
Created: 5/5/2026
Status: ❌ Closed
Base:
main← Head:refactor/entries-codegen-helpers📝 Commits (2)
ce9c7berefactor(entries): dedupe ISR wrapper codegen and config serializationf1bee9brefactor(entries): address review nits📊 Changes
3 files changed (+193 additions, -57 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+34 -15)📝
packages/vinext/src/entries/pages-server-entry.ts(+12 -42)📝
packages/vinext/src/entries/runtime-entry-module.ts(+147 -0)📄 Description
Summary
Pure refactor of the entry-template generators to consolidate the bits that pages-server-entry.ts and app-rsc-entry.ts copy-pasted from each other:
pages-server-entry.tsemitted four thin forwarder functions (isrGet/isrSet/isrCacheKey/triggerBackgroundRegeneration) over the shared__sharedIsr*imports. Extracted togenerateIsrWrapperCode()inruntime-entry-module.tsso future entries can reuse the block.JSON.stringifychains. Extracted as two helpers inruntime-entry-module.ts:serializePagesConfig()returns the compoundvinextConfigJsonobject plus the narroweri18nConfigJsonprojection consumed by the SSR entry.serializeAppConfig()returns per-field JSON literals matching the App Router RSC entry's__basePath/__configRedirects/__expireTimestyle. The existingDEFAULT_EXPIRE_TIMEstays inapp-rsc-entry.tsand is passed in.The emitted runtime code is byte-identical to before (each replacement re-derives the same
JSON.stringifychain on the same input). Verified by inspecting the per-field diff plus a full pass oftests/app-router.test.tsandtests/pages-router.test.ts(508/508 passing; one teardown-hook flake unrelated to this change). Follow-up to #1058 and #1079.Files changed
packages/vinext/src/entries/runtime-entry-module.ts— newgenerateIsrWrapperCode(),serializePagesConfig(),serializeAppConfig(), and a privateEntryConfigInputtype.packages/vinext/src/entries/pages-server-entry.ts— calls the two helpers.packages/vinext/src/entries/app-rsc-entry.ts— callsserializeAppConfig(); thebp/ts/redirects/ etc. locals collapse into the destructured JSON literals.Test plan
pnpm vp test run tests/app-router.test.ts tests/pages-router.test.ts— 508/508 passing.pnpm fmt --writeclean.pnpm knipclean (no unused exports).tsc --noEmitclean.JSON.stringify(x)reduces to the same chain on the same input, so emitted-string output is byte-identical.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.