chore(deps): bump @vitejs/plugin-rsc to ^0.5.34 - #836
Merged
Conversation
Generated SSR entries use getClientEntryUrl() for headScripts: "preinit" instead of the deprecated loadBootstrapScriptContent. RSC runtime imports split onto @vitejs/plugin-rsc/rsc/server and /rsc/client (new internal/deps/rsc-client bridge). File-level "use cache" leaves mixed "use server" exports for plugin-rsc. Handler-level test mocks consolidated into handler-mock-factories.ts.
commit: |
…null plugin-rsc 0.5.34 matchDirective calls stmt.directive.match() after a `"directive" in node` check. Vite/oxc parseAst now emits directive: null on ordinary ExpressionStatements, so a file that mixes a cached function with a sibling handler whose first statement is an expression threw and the wrap was dropped — cache-tag and inline-handler e2e never hit.
CFCacheStore L1 writes are waitUntil-scheduled. Two back-to-back GETs in vite-plugin-cloudflare dev can both miss before the put is visible; wrangler preview usually lands in time. Poll until consecutive reads agree, matching the cloudflare-basic cache-tag e2e, so a later miss cannot overwrite the first in-flight put and fail a first-timestamp comparison.
ivogt
added a commit
that referenced
this pull request
Aug 28, 2026
Adopt @vitejs/plugin-rsc 0.5.34 APIs and the file-level "use cache" hoist fix from #836. 0.5.34 is a hard floor — upgrade the peer with the router.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
We were pinned to
@vitejs/plugin-rsc@0.5.31. From 0.5.33 the plugin deprecatesimport.meta.viteRsc.loadBootstrapScriptContentin favor ofgetClientEntryUrl()from@vitejs/plugin-rsc/ssr, and tells frameworks to import@vitejs/plugin-rsc/rsc/serverand/rsc/clientinstead of the combined/rscbarrel so Vite can drop the unusedreact-server-domprotocol side. 0.5.34 also lets file-level"use cache"and"use server"coexist in one module — plugin-rsc hoists the server functions and rebinds the original export toregisterServerReference($$hoist_*, ...), which our file-level"use cache"wrap treated as a non-function and rejected at build.Before vs after
Generated SSR entry (
headScripts: "preinit", the default):RSC runtime imports:
A custom SSR entry that only passes
loadBootstrapScriptContentstill works; conversion tobootstrapModulesstill requires an explicitheadScripts: "preinit".Consumer example
A default
rango()app needs no source change. Afterpnpm update @vitejs/plugin-rsc@^0.5.34(and@rangojs/routerthat depends on it), document renders take the client-entry URL fromgetClientEntryUrl()and Fizz emitsbootstrapModules— the same<link rel="modulepreload">+ executing module script pathheadScripts: "preinit"already used, without parsing an inlineimport("…")string.A custom SSR entry that has not adopted
getClientEntryUrlkeeps compiling:Mixed directives in one file now typecheck and transform:
getDatais wrapped withregisterCachedFunction.saveis left for plugin-rsc (both the$$hoist_*helper and theregisterServerReferencerebind).Semantics
headScripts: "preinit"(default)getClientEntryUrl()→bootstrapModules. NoloadBootstrapScriptContent.headScripts: "preload"loadBootstrapScriptContent(inline bootstrap).loadBootstrapScriptContentbootstrapModulesstill requires explicit"preinit".getClientEntryUrlwithout"preinit"console.warn; inline bootstrap path is used. Throws at construction if that path is also missing.getClientEntryUrl()under"preinit"loadBootstrapScriptContentif present.createSSRHandler/createShellCaptureHandlerthrow at construction, not per request."use cache"+ inline"use server"$$hoist_*exports andregisterServerReference($$hoist_*, …)rebinds.@vitejs/plugin-rsc0.5.31–0.5.33/rsc/server,/rsc/client,getClientEntryUrldo not exist). 0.5.34 is a hard floor.Code-change summary
@rangojs/routerdep+peer:^0.5.34.getClientEntryUrlon preinit;loadBootstrapScriptContentonly on preload.resolveBootstrap(deps, deadline?)is the single bootstrap helper (sync URL short-circuit, inline load, capture deadline race).assertBootstrapDepsruns at handler construction.internal/deps/rscimport/rsc/server; cache-runtime / segment decode import/rsc/client(internal/deps/rsc-client).use-cache-transformskips hoisted server-reference rebinds. Regression test runs plugin-rsc's realtransformServerActionServerfirst.vi.mocks consolidated intohandler-mock-factories.ts;/rsc/clientmocks carry the client surface.Test plan
pnpm run typecheckpnpm run test:unit:all(unit + Flight/RSC, every package)pnpm run lint(oxlint --deny-warnings)pnpm run format(oxfmt --check)use-cache-transform: mixed"use cache"/"use server", including post-transformServerActionServerrebind (red-before-green)preinit-client-references:getClientEntryUrlpreferred, empty URL fallback, construction throwshell-handlers: capture construction throw when neither bootstrap dep is usablegetClientEntryUrlhits a real Vite SSR environment). Not run locally in this PR — CIe2e.yml.Notes
SSRDependencies.loadBootstrapScriptContentis now optional. Custom entries that already passed it are unaffected.rangoTestAliasesnow stubs/rsc,/rsc/server,/rsc/client, and/rsc/static.