Skip to content

feat(cloudflare): add read-only Static Assets prerender cache - #3344

Draft
james-elicx wants to merge 5 commits into
codex/cloudflare-discourage-prerenderfrom
codex/static-assets-prerender-cache
Draft

james-elicx wants to merge 5 commits into
codex/cloudflare-discourage-prerenderfrom
codex/static-assets-prerender-cache

Conversation

@james-elicx

@james-elicx james-elicx commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary

  • add staticAssetsAdapter() as a read-only App Router response cache backed by the Workers ASSETS binding
  • package locally prerendered HTML, RSC, and metadata responses into hashed files under the configured client assets output
  • add static-assets to Cloudflare init with a (read-only; App Router only) warning and automatically configure build-time prerendering
  • preserve an independent KV data-cache choice when Static Assets is selected
  • let cache adapters explicitly opt into local prerender output, while other Cloudflare Worker deploys continue using staged prewarming
  • keep runtime writes and invalidations as no-ops; a new deployment replaces the packaged cache

This is stacked on #3340 because that PR establishes the default rule that Cloudflare Worker deploys do not locally prerender unless an output mode or adapter explicitly consumes those artifacts.

import { staticAssetsAdapter } from "@vinext/cloudflare/cache/static-assets-adapter";

vinext({
  prerender: true,
  cache: { cdn: staticAssetsAdapter() },
});

Validation

  • 504 focused init, cache-adapter, deploy, staged warmup, KV, and real-workerd tests
  • full vp run check across 1,431 typed files
  • vp run vinext#build
  • vp run @vinext/cloudflare#build
  • real workerd test verifies prerendered HTML and RSC requests both return X-Vinext-Cache: HIT without a false build-time binding warning
  • custom Static Assets bindings and client output directories remain aligned with Wrangler, while mismatches fail before init mutates files
  • deploy regression verifies Static Assets still packages local prerender output while ordinary Worker adapters use staged prewarming
  • independent cumulative stack review: CLEAN

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3344

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3344

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3344

vinext

npm i https://pkg.pr.new/vinext@3344

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3344

commit: d347398

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-export preview production
web preview production

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared d347398 against base 92e4956 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.2 KB 142.2 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.6 KB 129.6 KB ⚫ +0.0%
Dev server cold start vinext 3.21 s 3.16 s ⚫ -1.5%
Production build time vinext 3.67 s 3.64 s ⚫ -0.7%
RSC entry closure size (gzip) vinext 121.1 KB 121.1 KB ⚫ +0.0%
Server bundle size (gzip) vinext 218.3 KB 218.3 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant