@rsc-kit/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +95 -0
  2. package/SECURITY.md +60 -0
  3. package/dist/action.d.ts +90 -0
  4. package/dist/action.d.ts.map +1 -0
  5. package/dist/action.js +137 -0
  6. package/dist/action.js.map +1 -0
  7. package/dist/build-rsc-vite.d.ts +39 -0
  8. package/dist/build-rsc-vite.d.ts.map +1 -0
  9. package/dist/build-rsc-vite.js +172 -0
  10. package/dist/build-rsc-vite.js.map +1 -0
  11. package/dist/cache.d.ts +25 -0
  12. package/dist/cache.d.ts.map +1 -0
  13. package/dist/cache.js +108 -0
  14. package/dist/cache.js.map +1 -0
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +85 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/compile.d.ts +55 -0
  20. package/dist/compile.d.ts.map +1 -0
  21. package/dist/compile.js +141 -0
  22. package/dist/compile.js.map +1 -0
  23. package/dist/devServer.d.ts +18 -0
  24. package/dist/devServer.d.ts.map +1 -0
  25. package/dist/devServer.js +70 -0
  26. package/dist/devServer.js.map +1 -0
  27. package/dist/devUrls.d.ts +11 -0
  28. package/dist/devUrls.d.ts.map +1 -0
  29. package/dist/devUrls.js +68 -0
  30. package/dist/devUrls.js.map +1 -0
  31. package/dist/embed.d.ts +21 -0
  32. package/dist/embed.d.ts.map +1 -0
  33. package/dist/embed.js +119 -0
  34. package/dist/embed.js.map +1 -0
  35. package/dist/errors.d.ts +24 -0
  36. package/dist/errors.d.ts.map +1 -0
  37. package/dist/errors.js +38 -0
  38. package/dist/errors.js.map +1 -0
  39. package/dist/export.d.ts +41 -0
  40. package/dist/export.d.ts.map +1 -0
  41. package/dist/export.js +100 -0
  42. package/dist/export.js.map +1 -0
  43. package/dist/files.d.ts +39 -0
  44. package/dist/files.d.ts.map +1 -0
  45. package/dist/files.js +146 -0
  46. package/dist/files.js.map +1 -0
  47. package/dist/headers.d.ts +81 -0
  48. package/dist/headers.d.ts.map +1 -0
  49. package/dist/headers.js +96 -0
  50. package/dist/headers.js.map +1 -0
  51. package/dist/host.d.ts +86 -0
  52. package/dist/host.d.ts.map +1 -0
  53. package/dist/host.js +590 -0
  54. package/dist/host.js.map +1 -0
  55. package/dist/js/ActivityRouter.d.ts +47 -0
  56. package/dist/js/ActivityRouter.d.ts.map +1 -0
  57. package/dist/js/ActivityRouter.js +87 -0
  58. package/dist/js/ActivityRouter.js.map +1 -0
  59. package/dist/js/DocumentTitle.d.ts +22 -0
  60. package/dist/js/DocumentTitle.d.ts.map +1 -0
  61. package/dist/js/DocumentTitle.js +28 -0
  62. package/dist/js/DocumentTitle.js.map +1 -0
  63. package/dist/js/Form.d.ts +54 -0
  64. package/dist/js/Form.d.ts.map +1 -0
  65. package/dist/js/Form.js +225 -0
  66. package/dist/js/Form.js.map +1 -0
  67. package/dist/js/Link.d.ts +29 -0
  68. package/dist/js/Link.d.ts.map +1 -0
  69. package/dist/js/Link.js +112 -0
  70. package/dist/js/Link.js.map +1 -0
  71. package/dist/js/PathnameProvider.d.ts +8 -0
  72. package/dist/js/PathnameProvider.d.ts.map +1 -0
  73. package/dist/js/PathnameProvider.js +24 -0
  74. package/dist/js/PathnameProvider.js.map +1 -0
  75. package/dist/js/RedirectBoundary.d.ts +18 -0
  76. package/dist/js/RedirectBoundary.d.ts.map +1 -0
  77. package/dist/js/RedirectBoundary.js +34 -0
  78. package/dist/js/RedirectBoundary.js.map +1 -0
  79. package/dist/js/SegmentBoundary.d.ts +8 -0
  80. package/dist/js/SegmentBoundary.d.ts.map +1 -0
  81. package/dist/js/SegmentBoundary.js +38 -0
  82. package/dist/js/SegmentBoundary.js.map +1 -0
  83. package/dist/js/SlotBoundary.d.ts +15 -0
  84. package/dist/js/SlotBoundary.d.ts.map +1 -0
  85. package/dist/js/SlotBoundary.js +17 -0
  86. package/dist/js/SlotBoundary.js.map +1 -0
  87. package/dist/js/createViteRscApp.d.ts +8 -0
  88. package/dist/js/createViteRscApp.d.ts.map +1 -0
  89. package/dist/js/createViteRscApp.js +185 -0
  90. package/dist/js/createViteRscApp.js.map +1 -0
  91. package/dist/js/errors.d.ts +51 -0
  92. package/dist/js/errors.d.ts.map +1 -0
  93. package/dist/js/errors.js +93 -0
  94. package/dist/js/errors.js.map +1 -0
  95. package/dist/js/navigate.d.ts +118 -0
  96. package/dist/js/navigate.d.ts.map +1 -0
  97. package/dist/js/navigate.js +780 -0
  98. package/dist/js/navigate.js.map +1 -0
  99. package/dist/js/onlineStore.d.ts +23 -0
  100. package/dist/js/onlineStore.d.ts.map +1 -0
  101. package/dist/js/onlineStore.js +42 -0
  102. package/dist/js/onlineStore.js.map +1 -0
  103. package/dist/js/pagePayload.d.ts +15 -0
  104. package/dist/js/pagePayload.d.ts.map +1 -0
  105. package/dist/js/pagePayload.js +39 -0
  106. package/dist/js/pagePayload.js.map +1 -0
  107. package/dist/js/router.d.ts +29 -0
  108. package/dist/js/router.d.ts.map +1 -0
  109. package/dist/js/router.js +40 -0
  110. package/dist/js/router.js.map +1 -0
  111. package/dist/js/section.d.ts +16 -0
  112. package/dist/js/section.d.ts.map +1 -0
  113. package/dist/js/section.js +55 -0
  114. package/dist/js/section.js.map +1 -0
  115. package/dist/js/segmentStore.d.ts +69 -0
  116. package/dist/js/segmentStore.d.ts.map +1 -0
  117. package/dist/js/segmentStore.js +127 -0
  118. package/dist/js/segmentStore.js.map +1 -0
  119. package/dist/js/slotStore.d.ts +35 -0
  120. package/dist/js/slotStore.d.ts.map +1 -0
  121. package/dist/js/slotStore.js +46 -0
  122. package/dist/js/slotStore.js.map +1 -0
  123. package/dist/js/standardSchema.d.ts +47 -0
  124. package/dist/js/standardSchema.d.ts.map +1 -0
  125. package/dist/js/standardSchema.js +41 -0
  126. package/dist/js/standardSchema.js.map +1 -0
  127. package/dist/js/useForm.d.ts +43 -0
  128. package/dist/js/useForm.d.ts.map +1 -0
  129. package/dist/js/useForm.js +164 -0
  130. package/dist/js/useForm.js.map +1 -0
  131. package/dist/js/useLinkStatus.d.ts +2 -0
  132. package/dist/js/useLinkStatus.d.ts.map +1 -0
  133. package/dist/js/useLinkStatus.js +3 -0
  134. package/dist/js/useLinkStatus.js.map +1 -0
  135. package/dist/js/useOnline.d.ts +8 -0
  136. package/dist/js/useOnline.d.ts.map +1 -0
  137. package/dist/js/useOnline.js +20 -0
  138. package/dist/js/useOnline.js.map +1 -0
  139. package/dist/js/usePathname.d.ts +9 -0
  140. package/dist/js/usePathname.d.ts.map +1 -0
  141. package/dist/js/usePathname.js +32 -0
  142. package/dist/js/usePathname.js.map +1 -0
  143. package/dist/js/useSearchParams.d.ts +2 -0
  144. package/dist/js/useSearchParams.d.ts.map +1 -0
  145. package/dist/js/useSearchParams.js +60 -0
  146. package/dist/js/useSearchParams.js.map +1 -0
  147. package/dist/manifest.d.ts +66 -0
  148. package/dist/manifest.d.ts.map +1 -0
  149. package/dist/manifest.js +13 -0
  150. package/dist/manifest.js.map +1 -0
  151. package/dist/prerender.d.ts +138 -0
  152. package/dist/prerender.d.ts.map +1 -0
  153. package/dist/prerender.js +387 -0
  154. package/dist/prerender.js.map +1 -0
  155. package/dist/redirect.d.ts +34 -0
  156. package/dist/redirect.d.ts.map +1 -0
  157. package/dist/redirect.js +108 -0
  158. package/dist/redirect.js.map +1 -0
  159. package/dist/redirectDigest.d.ts +20 -0
  160. package/dist/redirectDigest.d.ts.map +1 -0
  161. package/dist/redirectDigest.js +66 -0
  162. package/dist/redirectDigest.js.map +1 -0
  163. package/dist/request.d.ts +93 -0
  164. package/dist/request.d.ts.map +1 -0
  165. package/dist/request.js +308 -0
  166. package/dist/request.js.map +1 -0
  167. package/dist/revalidate.d.ts +43 -0
  168. package/dist/revalidate.d.ts.map +1 -0
  169. package/dist/revalidate.js +99 -0
  170. package/dist/revalidate.js.map +1 -0
  171. package/dist/routes.d.ts +37 -0
  172. package/dist/routes.d.ts.map +1 -0
  173. package/dist/routes.js +28 -0
  174. package/dist/routes.js.map +1 -0
  175. package/dist/routing.d.ts +52 -0
  176. package/dist/routing.d.ts.map +1 -0
  177. package/dist/routing.js +146 -0
  178. package/dist/routing.js.map +1 -0
  179. package/dist/runtime.d.ts +36 -0
  180. package/dist/runtime.d.ts.map +1 -0
  181. package/dist/runtime.js +86 -0
  182. package/dist/runtime.js.map +1 -0
  183. package/dist/safeUrl.d.ts +10 -0
  184. package/dist/safeUrl.d.ts.map +1 -0
  185. package/dist/safeUrl.js +40 -0
  186. package/dist/safeUrl.js.map +1 -0
  187. package/dist/streaming.d.ts +62 -0
  188. package/dist/streaming.d.ts.map +1 -0
  189. package/dist/streaming.js +108 -0
  190. package/dist/streaming.js.map +1 -0
  191. package/dist/types.d.ts +82 -0
  192. package/dist/vite.d.ts +109 -0
  193. package/dist/vite.d.ts.map +1 -0
  194. package/dist/vite.js +1909 -0
  195. package/dist/vite.js.map +1 -0
  196. package/dist/worker.d.ts +2 -0
  197. package/dist/worker.d.ts.map +1 -0
  198. package/dist/worker.js +863 -0
  199. package/dist/worker.js.map +1 -0
  200. package/package.json +223 -0
package/dist/host.js ADDED
@@ -0,0 +1,590 @@
1
+ // Everything a JavaScript host has to do to serve the RSC engine.
2
+ //
3
+ // PHP needs ~2,400 lines for this because it cannot run JavaScript: a socket
4
+ // bridge, a worker pool, a frame protocol. A JS host imports the engine and
5
+ // calls it, and what remains is the part every host would otherwise rewrite —
6
+ // matching a url to a route, negotiating how much of the page to send, and
7
+ // speaking the header protocol the client expects.
8
+ //
9
+ // Deliberately not Hono, or Express, or anything: this takes a Request and
10
+ // returns a Response, so it runs under Bun.serve, Deno, Workers, Node's
11
+ // fetch adapters and any framework built on them. `./hono` is the three-line
12
+ // binding for one of them.
13
+ //
14
+ // const rsc = createRscHandler({ engine, manifest, assets })
15
+ // Bun.serve({ fetch: (req) => rsc(req).then((r) => r ?? new Response('', { status: 404 })) })
16
+ import { matchIntercept, matchRoute, retentionKey, sharedDepth } from './routing.js';
17
+ import { pathKey, patternKey } from './prerender.js';
18
+ import { withRevalidation } from './revalidate.js';
19
+ export { revalidate } from './revalidate.js';
20
+ import { withRedirect } from './redirect.js';
21
+ import { withCache } from './cache.js';
22
+ import { withRequest, withResponseDraft } from './request.js';
23
+ export { redirect } from './redirect.js';
24
+ // Re-exported, not redefined: routing.ts is the one implementation, shared with
25
+ // the prerenderer and the generated bundle, and this stays the adapter's
26
+ // public surface so a host imports from one place.
27
+ export { matchIntercept, matchRoute, sharedDepth } from './routing.js';
28
+ import { FLIGHT_TYPE, HEADER, HTML_TYPE, PER_CLIENT, REVALIDATE, VARY_ON_RSC } from './headers.js';
29
+ /**
30
+ * The answer to a redirect that was decided before anything was written.
31
+ *
32
+ * A document gets a real status code. A payload request must NOT: `fetch`
33
+ * follows a 3xx transparently, so the client would receive the destination's
34
+ * HTML and hand it to the Flight decoder, which reports its own confusion
35
+ * rather than the redirect. It gets 204 and a header instead, and navigates
36
+ * itself — which is also what makes the redirect an SPA one.
37
+ */
38
+ /**
39
+ * A string safe to write inside a <script> element.
40
+ *
41
+ * `JSON.stringify` escapes for JavaScript, and this is not a JavaScript
42
+ * context — it is HTML that happens to contain JavaScript. The parser ends the
43
+ * element at the first `</script`, wherever it appears, so a destination
44
+ * carrying one closes the tag and whatever follows is markup the browser runs.
45
+ *
46
+ * That destination is routinely computed rather than written — redirect()
47
+ * documents "remembering where someone was going and sending them back to it"
48
+ * as the usual case, which is a query string or a cookie arriving verbatim
49
+ * here. U+2028 and U+2029 are escaped too: legal in JSON, line terminators in
50
+ * JavaScript.
51
+ */
52
+ function inScript(value) {
53
+ return JSON.stringify(value)
54
+ .replace(/</g, '\\u003c')
55
+ .replace(/\u2028/g, '\\u2028')
56
+ .replace(/\u2029/g, '\\u2029');
57
+ }
58
+ function redirectResponse(to, isPayloadRequest) {
59
+ if (isPayloadRequest) {
60
+ return new Response(null, {
61
+ status: 204,
62
+ headers: { [HEADER.redirect]: to.location, Vary: VARY_ON_RSC },
63
+ });
64
+ }
65
+ return new Response(null, {
66
+ status: to.status,
67
+ headers: { Location: to.location, Vary: VARY_ON_RSC },
68
+ });
69
+ }
70
+ /**
71
+ * Append the redirect a render asked for after its shell had already gone out.
72
+ *
73
+ * The status line is spent by then, so the instruction travels in the body. A
74
+ * script rather than waiting for hydration to notice the error digest: it runs
75
+ * as the browser parses it, which is sooner, and it is the only path that
76
+ * works at all for a route shipping no client runtime.
77
+ *
78
+ * Read on flush, because that is when the render has finished and a redirect
79
+ * from inside a Suspense boundary is finally known.
80
+ */
81
+ function appendLateRedirect(stream, taken) {
82
+ // An engine that answered with a finished body rather than a stream has no
83
+ // late window at all: the render was over before this was called, so the
84
+ // caller's own check already saw everything there was to see.
85
+ if (typeof stream?.getReader !== 'function')
86
+ return stream;
87
+ const encoder = new TextEncoder();
88
+ const reader = stream.getReader();
89
+ // Read-and-re-emit rather than pipeThrough(new TransformStream(...)): a
90
+ // TransformStream from a different realm than the stream it is piped into
91
+ // is rejected outright, and a host embedded in a runtime that supplies its
92
+ // own web streams is exactly that case.
93
+ return new ReadableStream({
94
+ async pull(controller) {
95
+ const { done, value } = await reader.read();
96
+ if (!done) {
97
+ controller.enqueue(value);
98
+ return;
99
+ }
100
+ const to = taken();
101
+ // replace, so Back does not return to a url that redirected.
102
+ if (to) {
103
+ controller.enqueue(encoder.encode(`<script>location.replace(${inScript(to.location)})</script>`));
104
+ }
105
+ controller.close();
106
+ },
107
+ cancel(reason) {
108
+ return reader.cancel(reason);
109
+ },
110
+ });
111
+ }
112
+ export function createRscHandler(options) {
113
+ const { engine, assets, version } = options;
114
+ // Annotated rather than inferred: the narrowing below is lost inside the
115
+ // closures that use it, and every one of them runs after the throw.
116
+ const manifest = options.manifest ?? engine.manifest?.();
117
+ if (!manifest) {
118
+ throw new Error('No route table. Pass `manifest`, or build with a plugin version that embeds one in the bundle.');
119
+ }
120
+ const routes = manifest;
121
+ // Only when this host has functions of its own. Installing unconditionally
122
+ // overwrites whatever was already registered — a prerenderer sharing the
123
+ // same engine instance, or a host that set its own up first — and the
124
+ // symptom is every call failing as unregistered.
125
+ if (options.rpc)
126
+ installHostFunctions(options.rpc);
127
+ function installHostFunctions(fns) {
128
+ engine.installHostFn(async (name, ...args) => {
129
+ const fn = fns[name];
130
+ if (!fn) {
131
+ // Louder than returning null: a typo in a server component otherwise
132
+ // renders as missing data with nothing anywhere saying why.
133
+ throw new Error(`No host function named ${JSON.stringify(name)}. Registered: ${Object.keys(fns).join(', ') || '(none)'}`);
134
+ }
135
+ return await fn(...args);
136
+ });
137
+ }
138
+ async function propsFor(match, request) {
139
+ return options.props ? await options.props(match, request) : match.params;
140
+ }
141
+ /** The page a server action was invoked from, so it can re-render regions of it. */
142
+ function pageContext(match, props) {
143
+ return {
144
+ component: match.route.component,
145
+ props,
146
+ layouts: match.route.layouts.map((component) => ({ component, props: {} })),
147
+ loadings: match.route.loadings,
148
+ parallelSlots: match.route.slots,
149
+ // What may be named in X-RSC-Revalidate — see renderRevalidated.
150
+ sections: match.route.sections,
151
+ };
152
+ }
153
+ function withVersion(headers) {
154
+ return version ? { ...headers, [HEADER.version]: version } : headers;
155
+ }
156
+ // A build made for export ships a client that asks for payloads by url,
157
+ // because a static host cannot read a header. Serving that build from a
158
+ // server is a reasonable thing to do — previewing an export, or one build
159
+ // used both ways — and without this every navigation 404s in the console
160
+ // while the page itself looks fine.
161
+ const payloadName = manifest.build?.payloadName || '';
162
+ /**
163
+ * The page a payload url belongs to, if this is one.
164
+ *
165
+ * Both the whole-document name and the depth variants beside it: a client
166
+ * built for export asks for index.seg1.rsc when it already holds a layout,
167
+ * and matching only the plain name leaves that as a 404 no page reports.
168
+ */
169
+ const payloadNames = new RegExp('/' + payloadName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/^index\\\./, 'index(\\.seg\\d+)?\\.') + '$');
170
+ function pageForPayload(pathname) {
171
+ if (payloadName === '')
172
+ return null;
173
+ const match = payloadNames.exec(pathname);
174
+ if (!match)
175
+ return null;
176
+ return pathname.slice(0, match.index) || '/';
177
+ }
178
+ // One memo table per request, opened at the outermost point so that
179
+ // everything below shares it: middleware, layouts, the page, and an action. A
180
+ // guard that reads the session and a layout that reads it again are one
181
+ // query, not two.
182
+ return async function handle(request) {
183
+ return await withRequest(request, () => withCache(() =>
184
+ // Open for the whole request and sealed the moment an answer exists,
185
+ // so middleware — which runs before any rendering — can put headers on
186
+ // it, and a component, which runs after, is told why it cannot.
187
+ withResponseDraft(async ({ taken, seal }) => {
188
+ const response = await route(request);
189
+ seal();
190
+ if (!response)
191
+ return null;
192
+ const collected = taken();
193
+ collected.forEach((value, name) => {
194
+ // Set-Cookie is applied below, once per cookie: iterating a Headers
195
+ // gives it joined in some runtimes and per-cookie in others, and a
196
+ // joined one is a single malformed cookie the browser discards.
197
+ if (name.toLowerCase() === 'set-cookie')
198
+ return;
199
+ // set, not append: a middleware asking for a header means that
200
+ // value, not that value added to whatever the host already chose.
201
+ response.headers.set(name, value);
202
+ });
203
+ // Appended, because several cookies are several headers.
204
+ for (const cookie of collected.getSetCookie()) {
205
+ response.headers.append('Set-Cookie', cookie);
206
+ }
207
+ return response;
208
+ })));
209
+ };
210
+ async function route(request) {
211
+ let url = new URL(request.url);
212
+ const asPayload = pageForPayload(url.pathname);
213
+ if (asPayload !== null) {
214
+ // Rewritten to the page it is asking about, with the header the rest of
215
+ // this handler reads — one path through, however the client asked.
216
+ url = new URL(asPayload + url.search, url.origin);
217
+ const headers = new Headers(request.headers);
218
+ headers.set(HEADER.rsc, '1');
219
+ request = new Request(url, { method: request.method, headers });
220
+ }
221
+ if (assets) {
222
+ const asset = await assets(url.pathname, request);
223
+ if (asset)
224
+ return asset;
225
+ }
226
+ if (request.method === 'POST' && url.pathname === HEADER.actionPath) {
227
+ return await handleAction(request, url);
228
+ }
229
+ if (request.method !== 'GET' && request.method !== 'HEAD')
230
+ return null;
231
+ // One named region of this page, asked for without mutating anything to
232
+ // earn it. What an action invalidated does not come through here — that
233
+ // travels back inside the action's own answer, which is the whole point of
234
+ // marking rather than telling the client to go and ask.
235
+ const revalidating = request.headers.get(HEADER.revalidate);
236
+ if (revalidating !== null && request.headers.get(HEADER.rsc) !== null) {
237
+ return await handleRevalidate(request, url, revalidating);
238
+ }
239
+ // An intercepted navigation renders the page you are already on, with the
240
+ // interceptor dropped into one of its slots — so the modal opens over it
241
+ // and the url changes. Only ever on a client navigation: a hard load has
242
+ // no referer to open over and gets the real page.
243
+ const interceptSlot = request.headers.get(HEADER.intercept);
244
+ if (interceptSlot !== null && request.headers.get(HEADER.rsc) !== null) {
245
+ return await handleIntercept(request, url, interceptSlot);
246
+ }
247
+ // Only now. A frozen page is a whole page, and both requests above ask for
248
+ // something smaller than one: answering a named region with the whole
249
+ // document puts the entire page inside that region, and answering an
250
+ // interception with it replaces the page the modal was opening over.
251
+ const match = matchRoute(routes, url.pathname);
252
+ if (options.prerendered) {
253
+ // A guarded route can still be frozen: whether the content is the same
254
+ // for everyone, and whether this caller may see it, are different
255
+ // questions. The build answers the first; this answers the second, and
256
+ // only then is the frozen page handed over.
257
+ const refusal = await refuseUnlessAllowed(request, match);
258
+ if (refusal)
259
+ return refusal;
260
+ const frozen = await servePrerendered(request, url, options.prerendered);
261
+ if (frozen)
262
+ return frozen;
263
+ }
264
+ if (!match)
265
+ return null;
266
+ const props = await propsFor(match, request);
267
+ const layouts = match.route.layouts.map((component) => ({ component, props: {} }));
268
+ const chain = match.route.layouts;
269
+ // A payload request says so with a header on the page's own url, so one
270
+ // route serves both the document and the navigation that follows it.
271
+ if (request.headers.get(HEADER.rsc) === null) {
272
+ // Scoped to this render, so two requests redirecting at once cannot read
273
+ // each other's destination.
274
+ return await withRedirect(async (taken) => {
275
+ // Awaited, and that await is the whole design: React resolves this
276
+ // when the SHELL is ready, so a redirect thrown above every Suspense
277
+ // boundary rejects here — before a byte is written, with a status line
278
+ // still available. Nothing is buffered to make that true.
279
+ let htmlStream;
280
+ try {
281
+ ;
282
+ ({ htmlStream } = await engine.handleRscHtmlStream(match.route.component, props, layouts, match.route.loadings, match.route.slots, {}, undefined, url.pathname,
283
+ // A route that ships no runtime gets no bootstrap and no segment
284
+ // boundary — the boundary is itself a client component, so leaving
285
+ // it in means no page could ever be JS-free.
286
+ match.route.clientJs !== false));
287
+ }
288
+ catch (error) {
289
+ // A rejected shell is how a redirect above every boundary arrives:
290
+ // React could not finish the shell, because the component that would
291
+ // have produced it left instead.
292
+ //
293
+ // The scope decides, not the error. React catches what a component
294
+ // threw and re-raises its own — whose message is stripped in
295
+ // production — so testing the caught value for a redirect signal
296
+ // fails exactly where it matters, and the answer is a 500 with the
297
+ // destination sitting in a scope nobody read.
298
+ const refused = taken();
299
+ if (refused)
300
+ return redirectResponse(refused, false);
301
+ throw error;
302
+ }
303
+ const early = taken();
304
+ if (early)
305
+ return redirectResponse(early, false);
306
+ return new Response(appendLateRedirect(htmlStream, taken), {
307
+ headers: withVersion({
308
+ 'Content-Type': HTML_TYPE,
309
+ [HEADER.layouts]: chain.join(','),
310
+ Vary: VARY_ON_RSC,
311
+ 'Cache-Control': match.route.middleware?.length ? PER_CLIENT : REVALIDATE,
312
+ }),
313
+ });
314
+ });
315
+ }
316
+ const from = sharedDepth(request.headers.get(HEADER.segments), chain);
317
+ // Proposed by the host, decided by the engine: an interceptor can force a
318
+ // wider render than the client asked for, so what goes back is the depth
319
+ // that came out, never the one that went in.
320
+ return await withRedirect(async (taken) => {
321
+ let stream;
322
+ let segmentDepth;
323
+ try {
324
+ ;
325
+ ({ stream, segmentDepth } = await engine.handleRscStream(match.route.component, props, layouts, match.route.loadings, match.route.slots, {}, from, url.pathname));
326
+ }
327
+ catch (error) {
328
+ // Same reasoning as the document path: what the render recorded is
329
+ // reliable, what React re-raised is not.
330
+ const refused = taken();
331
+ if (refused)
332
+ return redirectResponse(refused, true);
333
+ throw error;
334
+ }
335
+ const early = taken();
336
+ // 204 and a header. A payload request that redirected later than this
337
+ // carries the destination in the error digest instead, and the client's
338
+ // RedirectBoundary performs it.
339
+ if (early)
340
+ return redirectResponse(early, true);
341
+ return new Response(stream, {
342
+ headers: withVersion({
343
+ 'Content-Type': FLIGHT_TYPE,
344
+ [HEADER.segmentDepth]: String(segmentDepth),
345
+ [HEADER.layouts]: chain.join(','),
346
+ Vary: VARY_ON_RSC,
347
+ 'Cache-Control': PER_CLIENT,
348
+ }),
349
+ });
350
+ });
351
+ }
352
+ /**
353
+ * A page rendered at build time, if there is one for this url.
354
+ *
355
+ * The payload has to match the depth the client shares, not simply exist.
356
+ * Serving the whole document to a client that already holds the layouts
357
+ * replaces the root — and replacing the root unmounts everything retained
358
+ * behind it, so going back stops restoring what you had.
359
+ */
360
+ async function servePrerendered(request, url, source) {
361
+ const key = pathKey(url.pathname);
362
+ const read = async (name) => await source(name);
363
+ // Before anything else: a route that only redirects was frozen as the
364
+ // redirect itself, so there is no page under this url and never will be.
365
+ const frozenRedirect = await read(`${key}.redirect.json`);
366
+ if (frozenRedirect !== null) {
367
+ const to = JSON.parse(frozenRedirect);
368
+ return redirectResponse(to, request.headers.get(HEADER.rsc) !== null);
369
+ }
370
+ if (request.headers.get(HEADER.rsc) === null) {
371
+ // A frozen page first; then a shell, under this url or under the route's
372
+ // pattern. Nothing in a shell varies by param, so one shell serves every
373
+ // url its route matches — which is the only way a route whose urls were
374
+ // never listed gets anything frozen at all.
375
+ const route = matchRoute(routes, url.pathname);
376
+ const html = (await read(`${key}.html`)) ??
377
+ (await read(`${key}.ppr.html`)) ??
378
+ (route ? await read(`${patternKey(route.route)}.ppr.html`) : null);
379
+ return html === null
380
+ ? null
381
+ : new Response(html, {
382
+ headers: withVersion({
383
+ 'Content-Type': HTML_TYPE,
384
+ Vary: VARY_ON_RSC,
385
+ 'Cache-Control': route?.route.middleware?.length ? PER_CLIENT : REVALIDATE,
386
+ }),
387
+ });
388
+ }
389
+ // Only the document is ever served frozen for a shell. The payload is what
390
+ // fills it in, and it has to be rendered now — answering with a frozen one
391
+ // would hand back the same fallbacks the shell already shows, and the page
392
+ // would never finish loading.
393
+ const meta = await read(`${key}.meta.json`);
394
+ // Both or neither: without the chain there is no way to know which depth a
395
+ // payload is for, and guessing means handing the client a segment for a
396
+ // boundary it does not have.
397
+ if (meta === null)
398
+ return null;
399
+ const chain = (JSON.parse(meta).layouts ?? []);
400
+ const shared = sharedDepth(request.headers.get(HEADER.segments), chain);
401
+ // The variant for exactly this depth, or the whole document. Anything else
402
+ // would be a payload for a boundary the client is not holding.
403
+ const variant = shared > 0 ? await read(`${key}.seg${shared}.flight`) : null;
404
+ const payload = variant ?? (await read(`${key}.flight`));
405
+ if (payload === null)
406
+ return null;
407
+ return new Response(payload, {
408
+ headers: withVersion({
409
+ 'Content-Type': FLIGHT_TYPE,
410
+ [HEADER.segmentDepth]: String(variant ? shared : 0),
411
+ [HEADER.layouts]: chain.join(','),
412
+ Vary: VARY_ON_RSC,
413
+ 'Cache-Control': PER_CLIENT,
414
+ }),
415
+ });
416
+ }
417
+ /**
418
+ * The middleware of a route, or null to go ahead.
419
+ *
420
+ * Used wherever a render can be reached without the engine running the chain
421
+ * itself: a page served from disk, and an interception, which renders a
422
+ * component the route table did not choose.
423
+ *
424
+ * Asked before anything is read or rendered — the answer to a refusal must
425
+ * not be a page that has already been fetched.
426
+ */
427
+ async function refuseUnlessAllowed(request, match) {
428
+ if (!match?.route.middleware?.length)
429
+ return null;
430
+ // A route that declares middleware and an engine that cannot run it is not
431
+ // "no middleware" — it is a check that silently does not happen. Refusing
432
+ // is the only safe reading, and it names the cause rather than serving the
433
+ // guarded page. Reachable when a host runs a bundle built by an older
434
+ // plugin, where the export did not exist.
435
+ if (!engine.runRouteMiddleware) {
436
+ return new Response('This route declares middleware, and the engine cannot run it. ' +
437
+ 'Rebuild the app against the current @rsc-kit/core.', { status: 500 });
438
+ }
439
+ const asPayload = request.headers.get(HEADER.rsc) !== null;
440
+ return await withRedirect(async (taken) => {
441
+ try {
442
+ await engine.runRouteMiddleware(match.route.component, await propsFor(match, request));
443
+ }
444
+ catch (error) {
445
+ const refused = taken();
446
+ if (refused)
447
+ return redirectResponse(refused, asPayload);
448
+ throw error;
449
+ }
450
+ const refused = taken();
451
+ return refused ? redirectResponse(refused, asPayload) : null;
452
+ });
453
+ }
454
+ async function handleRevalidate(request, url, target) {
455
+ if (!engine.handleRscRevalidate) {
456
+ return new Response('This build cannot revalidate', { status: 501 });
457
+ }
458
+ const match = matchRoute(routes, url.pathname);
459
+ if (!match)
460
+ return new Response('No such page', { status: 404 });
461
+ // Scoped like the render paths: a guard above the target may refuse, and
462
+ // that refusal is an answer rather than a failure.
463
+ return await withRedirect(async (taken) => {
464
+ let rscPayload;
465
+ try {
466
+ ;
467
+ ({ rscPayload } = await engine.handleRscRevalidate(target, pageContext(match, await propsFor(match, request))));
468
+ }
469
+ catch (error) {
470
+ const refused = taken();
471
+ if (refused)
472
+ return redirectResponse(refused, true);
473
+ throw error;
474
+ }
475
+ const refused = taken();
476
+ if (refused)
477
+ return redirectResponse(refused, true);
478
+ return new Response(rscPayload, {
479
+ headers: withVersion({
480
+ 'Content-Type': FLIGHT_TYPE,
481
+ // Echoed so the client can tell which region it is holding.
482
+ [HEADER.revalidate]: target,
483
+ Vary: VARY_ON_RSC,
484
+ 'Cache-Control': 'private, no-store',
485
+ }),
486
+ });
487
+ });
488
+ }
489
+ async function handleIntercept(request, url, slot) {
490
+ const intercept = matchIntercept(routes, url.pathname, slot);
491
+ if (!intercept)
492
+ return new Response('No interceptor for this url', { status: 404 });
493
+ // The guards of the route being intercepted, before anything is rendered.
494
+ //
495
+ // An interceptor exists to show the same resource as the route it stands in
496
+ // for — a modal over /orders/[id] shows that order. So it has to be behind
497
+ // the same checks, and nothing else in this path runs them: the engine is
498
+ // handed the interceptor component, which the route table did not choose
499
+ // and whose middleware chain is keyed off manifest().routes, where an
500
+ // interceptor does not appear.
501
+ //
502
+ // Derived from the url, never from X-RSC-Referer. The referer is a header
503
+ // the caller writes, and guarding by it means the caller picks the guard.
504
+ const intercepted = matchRoute(routes, url.pathname);
505
+ // Nothing to guard means nothing to serve. A url that matches an
506
+ // interceptor but no route has no middleware chain to consult, so there is
507
+ // no way to know whether this caller may see it — and an interceptor
508
+ // stands in for a route, so a url with no route behind it is not a page
509
+ // anyone was entitled to open a modal over.
510
+ if (!intercepted)
511
+ return new Response('No such page', { status: 404 });
512
+ const refusal = await refuseUnlessAllowed(request, intercepted);
513
+ if (refusal)
514
+ return refusal;
515
+ const referer = request.headers.get(HEADER.referer);
516
+ const under = referer ? matchRoute(routes, new URL(referer, url.origin).pathname) : null;
517
+ // Without a page to open over there is nothing to intercept: render the
518
+ // interceptor on its own rather than answering with the wrong page.
519
+ const component = under ? under.route.component : intercept.component;
520
+ const props = under ? await propsFor(under, request) : intercept.params;
521
+ const chain = under ? under.route.layouts : [];
522
+ const slots = under ? under.route.slots : {};
523
+ const loadings = under ? under.route.loadings : [];
524
+ // The interceptor alone, when there is a page to open it over and this
525
+ // build can render a region on its own.
526
+ //
527
+ // Re-rendering the page underneath would put the modal on screen at the
528
+ // cost of rebuilding everything below the layout that declares the slot —
529
+ // so opening a modal from a half-filled form throws the form away. The
530
+ // page beneath is already mounted and correct; only the slot is new.
531
+ if (under && engine.handleRscRevalidate) {
532
+ const { rscPayload } = await engine.handleRscRevalidate(slot, {
533
+ component: under.route.component,
534
+ // The target's params, not the page's: a modal for /posts/hello opened
535
+ // from /feed is about hello.
536
+ props: intercept.params,
537
+ layouts: [],
538
+ loadings: [],
539
+ // Named as the slot so the renderer finds it there, but pointing at
540
+ // the interceptor rather than the default this route would otherwise
541
+ // fill it with.
542
+ parallelSlots: { [slot]: intercept.component },
543
+ });
544
+ return new Response(rscPayload, {
545
+ headers: withVersion({
546
+ 'Content-Type': FLIGHT_TYPE,
547
+ // Says what this payload is, so the client puts it in the slot
548
+ // instead of treating it as a segment of the page.
549
+ [HEADER.revalidate]: slot,
550
+ Vary: VARY_ON_RSC,
551
+ // Per-client by construction: which region this is was chosen by a
552
+ // request header, so a shared cache has nothing useful to key on.
553
+ 'Cache-Control': 'private, no-store',
554
+ }),
555
+ });
556
+ }
557
+ const { stream, segmentDepth } = await engine.handleRscStream(component, props, chain.map((layout) => ({ component: layout, props: {} })), loadings, slots, {}, sharedDepth(request.headers.get(HEADER.segments), chain), retentionKey(url.pathname, slot));
558
+ return new Response(stream, {
559
+ headers: withVersion({
560
+ 'Content-Type': FLIGHT_TYPE,
561
+ [HEADER.segmentDepth]: String(segmentDepth),
562
+ [HEADER.layouts]: chain.join(','),
563
+ Vary: VARY_ON_RSC,
564
+ 'Cache-Control': PER_CLIENT,
565
+ }),
566
+ });
567
+ }
568
+ async function handleAction(request, url) {
569
+ const actionId = request.headers.get(HEADER.action);
570
+ if (!actionId)
571
+ return new Response('Missing X-RSC-Action', { status: 400 });
572
+ // The body travels as application/octet-stream so a host that parses
573
+ // multipart cannot consume it first; its real type rides in a header.
574
+ const body = new Uint8Array(await request.arrayBuffer());
575
+ const contentType = request.headers.get(HEADER.contentType) ?? 'text/plain;charset=UTF-8';
576
+ // Where it was invoked from, so anything the action invalidates can be
577
+ // re-rendered against the page that is actually on screen.
578
+ const referer = request.headers.get(HEADER.referer);
579
+ const match = referer ? matchRoute(routes, new URL(referer, url.origin).pathname) : null;
580
+ const page = match ? pageContext(match, await propsFor(match, request)) : undefined;
581
+ // Scoped to this action: revalidate() called anywhere inside it, at any
582
+ // depth, marks here and nowhere else — two requests can be in flight and
583
+ // marking is per-request state.
584
+ const { stream } = await withRevalidation((taken) => engine.handleAction(actionId, body, contentType, page, taken));
585
+ return new Response(stream, {
586
+ headers: withVersion({ 'Content-Type': 'text/x-component; charset=utf-8' }),
587
+ });
588
+ }
589
+ }
590
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,mDAA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