mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #670] [CLOSED] feat: populate Workers KV with pre-rendered pages at deploy time #759
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#759
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/670
Author: @NathanDrake2406
Created: 3/23/2026
Status: ❌ Closed
Base:
main← Head:feat/populate-kv-deploy📝 Commits (7)
7c2f8c8feat: add deploy-time KV population module6cce829feat: integrate KV population into deploy pipeline833a935refactor: TPR uses shared populate-kv helpers for KV upload754a7f9refactor: remove as casts and clean up test imports68f3762fix: filter to App Router routes and remove --app-prefix flage8fb96drefactor: hoist invariant URL and headers out of upload loop92d84d3ci: retrigger📊 Changes
4 files changed (+1049 additions, -64 deletions)
View changed files
➕
packages/vinext/src/cloudflare/populate-kv.ts(+330 -0)📝
packages/vinext/src/cloudflare/tpr.ts(+25 -63)📝
packages/vinext/src/deploy.ts(+34 -1)➕
tests/populate-kv.test.ts(+660 -0)📄 Description
Summary
Closes #562. Depends on #653 — requires
buildId,trailingSlash, androuterfields in the prerender manifest. Should be merged after #653.cloudflare/populate-kv.ts— reads prerender manifest + HTML/RSC files, constructs cache entries matching the runtime format exactly, uploads via Cloudflare REST bulk APICLOUDFLARE_API_TOKEN+VINEXT_CACHEKV namespace + prerender manifest all exist.--no-populate-kvto opt out.uploadToKV(80 lines) with shared helpers, fixing three bugs: wrong key format (cache:<path>→cache:app:<buildId>:<path>:html), wrong TTL (10x revalidate → fixed 30-day), missing tags (empty[]→ full hierarchy forrevalidatePath())Key format parity
Deploy-time keys match the runtime
__isrCacheKeyinapp-rsc-entry.tsexactly:Two entries per route (
:html+:rsc) with full tag hierarchy (_N_T_/layout, intermediate layouts, leaf page tag) sorevalidatePath()works on seeded entries.Design decisions
pages:...) and value shape (kind: "PAGES"). Routes withoutrouter: "app"are skipped.KVCacheHandler.set()default--app-prefixflag — removed after review; it would write prefixed keys without wiring the prefix into the generated runtime, creating silently unreadable entries.appPrefixremains on the programmaticPopulateKVOptionsfor advanced users who configure both sides.Test plan
vp checkpasses (0 warnings, 0 errors)CLOUDFLARE_API_TOKEN=... vinext deploy --prerender-allon a test project with ISR routeswrangler kv key list --binding VINEXT_CACHEX-Vinext-Cache: HIT🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.