@rshono/core 1.0.0-rc.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 (189) hide show
  1. package/README.md +273 -0
  2. package/bin/rshono.mjs +15 -0
  3. package/dist/builder/env-shadow-loader.cjs +26 -0
  4. package/dist/builder/page-entry-loader.cjs +7 -0
  5. package/dist/builder/page-files.d.ts +2 -0
  6. package/dist/builder/page-files.d.ts.map +1 -0
  7. package/dist/builder/page-files.js +45 -0
  8. package/dist/builder/page-files.js.map +1 -0
  9. package/dist/builder/public-env.d.ts +2 -0
  10. package/dist/builder/public-env.d.ts.map +1 -0
  11. package/dist/builder/public-env.js +5 -0
  12. package/dist/builder/public-env.js.map +1 -0
  13. package/dist/builder/rspack-config.d.ts +14 -0
  14. package/dist/builder/rspack-config.d.ts.map +1 -0
  15. package/dist/builder/rspack-config.js +235 -0
  16. package/dist/builder/rspack-config.js.map +1 -0
  17. package/dist/cli/build.d.ts +11 -0
  18. package/dist/cli/build.d.ts.map +1 -0
  19. package/dist/cli/build.js +64 -0
  20. package/dist/cli/build.js.map +1 -0
  21. package/dist/cli/dev.d.ts +9 -0
  22. package/dist/cli/dev.d.ts.map +1 -0
  23. package/dist/cli/dev.js +210 -0
  24. package/dist/cli/dev.js.map +1 -0
  25. package/dist/cli/index.d.ts +2 -0
  26. package/dist/cli/index.d.ts.map +1 -0
  27. package/dist/cli/index.js +77 -0
  28. package/dist/cli/index.js.map +1 -0
  29. package/dist/cli/start.d.ts +8 -0
  30. package/dist/cli/start.d.ts.map +1 -0
  31. package/dist/cli/start.js +39 -0
  32. package/dist/cli/start.js.map +1 -0
  33. package/dist/config.d.ts +121 -0
  34. package/dist/config.d.ts.map +1 -0
  35. package/dist/config.js +5 -0
  36. package/dist/config.js.map +1 -0
  37. package/dist/deploy/aws-lambda/runtime.d.ts +14 -0
  38. package/dist/deploy/aws-lambda/runtime.d.ts.map +1 -0
  39. package/dist/deploy/aws-lambda/runtime.js +24 -0
  40. package/dist/deploy/aws-lambda/runtime.js.map +1 -0
  41. package/dist/deploy/build-marker.d.ts +15 -0
  42. package/dist/deploy/build-marker.d.ts.map +1 -0
  43. package/dist/deploy/build-marker.js +26 -0
  44. package/dist/deploy/build-marker.js.map +1 -0
  45. package/dist/deploy/bun/runtime.d.ts +11 -0
  46. package/dist/deploy/bun/runtime.d.ts.map +1 -0
  47. package/dist/deploy/bun/runtime.js +22 -0
  48. package/dist/deploy/bun/runtime.js.map +1 -0
  49. package/dist/deploy/cloudflare/build.d.ts +7 -0
  50. package/dist/deploy/cloudflare/build.d.ts.map +1 -0
  51. package/dist/deploy/cloudflare/build.js +74 -0
  52. package/dist/deploy/cloudflare/build.js.map +1 -0
  53. package/dist/deploy/cloudflare/runtime.d.ts +10 -0
  54. package/dist/deploy/cloudflare/runtime.d.ts.map +1 -0
  55. package/dist/deploy/cloudflare/runtime.js +129 -0
  56. package/dist/deploy/cloudflare/runtime.js.map +1 -0
  57. package/dist/deploy/contract.d.ts +65 -0
  58. package/dist/deploy/contract.d.ts.map +1 -0
  59. package/dist/deploy/contract.js +2 -0
  60. package/dist/deploy/contract.js.map +1 -0
  61. package/dist/deploy/deno/runtime.d.ts +11 -0
  62. package/dist/deploy/deno/runtime.d.ts.map +1 -0
  63. package/dist/deploy/deno/runtime.js +16 -0
  64. package/dist/deploy/deno/runtime.js.map +1 -0
  65. package/dist/deploy/filesystem.d.ts +10 -0
  66. package/dist/deploy/filesystem.d.ts.map +1 -0
  67. package/dist/deploy/filesystem.js +47 -0
  68. package/dist/deploy/filesystem.js.map +1 -0
  69. package/dist/deploy/listen.d.ts +20 -0
  70. package/dist/deploy/listen.d.ts.map +1 -0
  71. package/dist/deploy/listen.js +24 -0
  72. package/dist/deploy/listen.js.map +1 -0
  73. package/dist/deploy/netlify/build.d.ts +8 -0
  74. package/dist/deploy/netlify/build.d.ts.map +1 -0
  75. package/dist/deploy/netlify/build.js +52 -0
  76. package/dist/deploy/netlify/build.js.map +1 -0
  77. package/dist/deploy/netlify/runtime.d.ts +13 -0
  78. package/dist/deploy/netlify/runtime.d.ts.map +1 -0
  79. package/dist/deploy/netlify/runtime.js +24 -0
  80. package/dist/deploy/netlify/runtime.js.map +1 -0
  81. package/dist/deploy/node/runtime.d.ts +7 -0
  82. package/dist/deploy/node/runtime.d.ts.map +1 -0
  83. package/dist/deploy/node/runtime.js +36 -0
  84. package/dist/deploy/node/runtime.js.map +1 -0
  85. package/dist/deploy/presets.d.ts +88 -0
  86. package/dist/deploy/presets.d.ts.map +1 -0
  87. package/dist/deploy/presets.js +110 -0
  88. package/dist/deploy/presets.js.map +1 -0
  89. package/dist/deploy/vercel/build.d.ts +3 -0
  90. package/dist/deploy/vercel/build.d.ts.map +1 -0
  91. package/dist/deploy/vercel/build.js +56 -0
  92. package/dist/deploy/vercel/build.js.map +1 -0
  93. package/dist/deploy/vercel/runtime.d.ts +14 -0
  94. package/dist/deploy/vercel/runtime.d.ts.map +1 -0
  95. package/dist/deploy/vercel/runtime.js +26 -0
  96. package/dist/deploy/vercel/runtime.js.map +1 -0
  97. package/dist/index.d.ts +23 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +17 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/router.d.ts +337 -0
  102. package/dist/router.d.ts.map +1 -0
  103. package/dist/router.js +18 -0
  104. package/dist/router.js.map +1 -0
  105. package/dist/runtime/boundaries.d.ts +102 -0
  106. package/dist/runtime/boundaries.d.ts.map +1 -0
  107. package/dist/runtime/boundaries.js +101 -0
  108. package/dist/runtime/boundaries.js.map +1 -0
  109. package/dist/runtime/client.d.ts +16 -0
  110. package/dist/runtime/client.d.ts.map +1 -0
  111. package/dist/runtime/client.js +16 -0
  112. package/dist/runtime/client.js.map +1 -0
  113. package/dist/runtime/context.d.ts +271 -0
  114. package/dist/runtime/context.d.ts.map +1 -0
  115. package/dist/runtime/context.js +360 -0
  116. package/dist/runtime/context.js.map +1 -0
  117. package/dist/runtime/control.d.ts +18 -0
  118. package/dist/runtime/control.d.ts.map +1 -0
  119. package/dist/runtime/control.js +39 -0
  120. package/dist/runtime/control.js.map +1 -0
  121. package/dist/runtime/dev-protocol.d.ts +22 -0
  122. package/dist/runtime/dev-protocol.d.ts.map +1 -0
  123. package/dist/runtime/dev-protocol.js +2 -0
  124. package/dist/runtime/dev-protocol.js.map +1 -0
  125. package/dist/runtime/empty-server-app.d.ts +3 -0
  126. package/dist/runtime/empty-server-app.d.ts.map +1 -0
  127. package/dist/runtime/empty-server-app.js +2 -0
  128. package/dist/runtime/empty-server-app.js.map +1 -0
  129. package/dist/runtime/entry.client.d.ts +2 -0
  130. package/dist/runtime/entry.client.d.ts.map +1 -0
  131. package/dist/runtime/entry.client.js +453 -0
  132. package/dist/runtime/entry.client.js.map +1 -0
  133. package/dist/runtime/entry.rsc.d.ts +32 -0
  134. package/dist/runtime/entry.rsc.d.ts.map +1 -0
  135. package/dist/runtime/entry.rsc.js +466 -0
  136. package/dist/runtime/entry.rsc.js.map +1 -0
  137. package/dist/runtime/entry.ssr.d.ts +25 -0
  138. package/dist/runtime/entry.ssr.d.ts.map +1 -0
  139. package/dist/runtime/entry.ssr.js +86 -0
  140. package/dist/runtime/entry.ssr.js.map +1 -0
  141. package/dist/runtime/navigation.d.ts +114 -0
  142. package/dist/runtime/navigation.d.ts.map +1 -0
  143. package/dist/runtime/navigation.js +112 -0
  144. package/dist/runtime/navigation.js.map +1 -0
  145. package/dist/runtime/request.d.ts +35 -0
  146. package/dist/runtime/request.d.ts.map +1 -0
  147. package/dist/runtime/request.js +39 -0
  148. package/dist/runtime/request.js.map +1 -0
  149. package/dist/runtime/server.d.ts +24 -0
  150. package/dist/runtime/server.d.ts.map +1 -0
  151. package/dist/runtime/server.js +24 -0
  152. package/dist/runtime/server.js.map +1 -0
  153. package/dist/server/compress.d.ts +15 -0
  154. package/dist/server/compress.d.ts.map +1 -0
  155. package/dist/server/compress.js +76 -0
  156. package/dist/server/compress.js.map +1 -0
  157. package/dist/server/headers.d.ts +24 -0
  158. package/dist/server/headers.d.ts.map +1 -0
  159. package/dist/server/headers.js +44 -0
  160. package/dist/server/headers.js.map +1 -0
  161. package/dist/server/load-config.d.ts +7 -0
  162. package/dist/server/load-config.d.ts.map +1 -0
  163. package/dist/server/load-config.js +41 -0
  164. package/dist/server/load-config.js.map +1 -0
  165. package/dist/server/load-env.d.ts +2 -0
  166. package/dist/server/load-env.d.ts.map +1 -0
  167. package/dist/server/load-env.js +10 -0
  168. package/dist/server/load-env.js.map +1 -0
  169. package/dist/server/prerendered.d.ts +67 -0
  170. package/dist/server/prerendered.d.ts.map +1 -0
  171. package/dist/server/prerendered.js +39 -0
  172. package/dist/server/prerendered.js.map +1 -0
  173. package/dist/server/server-config.d.ts +72 -0
  174. package/dist/server/server-config.d.ts.map +1 -0
  175. package/dist/server/server-config.js +94 -0
  176. package/dist/server/server-config.js.map +1 -0
  177. package/dist/server/shutdown.d.ts +7 -0
  178. package/dist/server/shutdown.d.ts.map +1 -0
  179. package/dist/server/shutdown.js +11 -0
  180. package/dist/server/shutdown.js.map +1 -0
  181. package/dist/server/ssg.d.ts +25 -0
  182. package/dist/server/ssg.d.ts.map +1 -0
  183. package/dist/server/ssg.js +160 -0
  184. package/dist/server/ssg.js.map +1 -0
  185. package/dist/server/static.d.ts +14 -0
  186. package/dist/server/static.d.ts.map +1 -0
  187. package/dist/server/static.js +30 -0
  188. package/dist/server/static.js.map +1 -0
  189. package/package.json +86 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.client.js","sourceRoot":"","sources":["../../src/runtime/entry.client.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MA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AC;gBAC9D,MAAM;QACV,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,kGAAkG;AAClG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;IACrE,SAAS,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { hydrateRoot } from 'react-dom/client';\nimport {\n createFromFetch,\n createFromReadableStream,\n createTemporaryReferenceSet,\n encodeReply,\n setServerCallback,\n} from 'react-server-dom-rspack/client.browser';\nimport { rscStream } from 'rsc-html-stream/client';\nimport { isControlDigest, parseRedirectDigest } from './control.js';\nimport type { DevMessage } from './dev-protocol.js';\nimport type { RscPayload } from './entry.rsc.js';\nimport { RouterContext, type Router } from './navigation.js';\nimport { createRscRequest } from './request.js';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\n/**\n * Guarantees somewhere to attach the fatal overlay. React's root container is the whole `document`,\n * so by the time an uncaught error has torn the tree down, `<body>` — or even `<html>` — may be gone.\n */\nfunction overlayHost(): HTMLElement {\n if (!document.documentElement) document.appendChild(document.createElement('html'));\n if (!document.body) document.documentElement.appendChild(document.createElement('body'));\n return document.body;\n}\n\n/**\n * Replaces the white screen of death with something readable.\n *\n * Because the root container is `document`, an uncaught render error leaves a genuinely blank page\n * with the reason only in the console — so this paints the reason over it instead. In development\n * that's the full stack; in production it's a generic notice plus a reload button, since the tree is\n * unrecoverable and reloading is the only way forward.\n *\n * Written with DOM calls rather than React (the renderer is what just failed) and `textContent`\n * rather than `innerHTML` (an error message is untrusted input).\n */\nfunction showFatal(error: unknown, componentStack?: string | null): void {\n // Queued rather than run inline: React's teardown happens after this callback returns, and would\n // remove a node appended synchronously along with the rest of the tree.\n setTimeout(() => {\n const host = overlayHost();\n host.querySelector('[data-rshono-fatal]')?.remove();\n\n const box = document.createElement('div');\n box.setAttribute('data-rshono-fatal', '');\n box.setAttribute('role', 'alert'); // the page is gone; announce it rather than leaving silence\n box.style.cssText =\n 'position:fixed;inset:0;z-index:2147483647;overflow:auto;padding:1.5rem;background:#18181b;color:#f4f4f5;' +\n 'font:14px/1.6 ui-monospace,SFMono-Regular,Menlo,monospace;text-align:left';\n\n const title = document.createElement('div');\n title.textContent = isDev ? 'Unhandled error' : 'Something went wrong';\n title.style.cssText = 'font-size:1.0625rem;font-weight:700;color:#f87171;margin:0 0 0.75rem';\n box.appendChild(title);\n\n if (isDev) {\n const detail = document.createElement('pre');\n detail.style.cssText = 'margin:0;white-space:pre-wrap;word-break:break-word';\n detail.textContent =\n (error instanceof Error ? (error.stack ?? `${error.name}: ${error.message}`) : String(error)) +\n (componentStack ? `\\n\\nComponent stack:${componentStack}` : '');\n box.appendChild(detail);\n } else {\n const message = document.createElement('p');\n message.textContent = 'This page hit an unexpected error and can’t continue.';\n message.style.cssText = 'margin:0 0 1rem;color:#d4d4d8';\n box.appendChild(message);\n }\n\n const reload = document.createElement('button');\n reload.textContent = 'Reload page';\n reload.style.cssText =\n 'margin-top:1.25rem;padding:0.5rem 1rem;font:inherit;color:#18181b;background:#f4f4f5;border:0;border-radius:4px;cursor:pointer';\n reload.addEventListener('click', () => window.location.reload());\n box.appendChild(reload);\n\n host.appendChild(box);\n }, 0);\n}\n\n// In-memory flight-payload cache keyed by same-origin path+search. `data-prefetch`\n// links warm it on hover/focus; a navigation to a warmed URL resolves instantly and\n// clears the entry (a prefetch is used at most once, so re-visits always re-fetch).\nconst payloadCache = new Map<string, Promise<RscPayload>>();\n\n// Bounded so a long session over a link-dense app can't grow it without limit. Insertion-ordered,\n// so the first key is the least recently warmed.\nconst MAX_WARMED_PAYLOADS = 8;\n\nfunction cacheKey(href: string): string | null {\n const url = new URL(href, location.href);\n if (url.origin !== location.origin) return null;\n return url.pathname + url.search;\n}\n\nfunction requestPayload(href: string): Promise<RscPayload> {\n return createFromFetch<RscPayload>(fetch(createRscRequest(new URL(href, location.href).href)));\n}\n\nfunction warmPayload(href: string): void {\n const key = cacheKey(href);\n if (!key || key === cacheKey(location.href) || payloadCache.has(key)) return;\n const promise = requestPayload(href);\n payloadCache.set(key, promise);\n // One entry in means at most one out, and the first key is the oldest.\n if (payloadCache.size > MAX_WARMED_PAYLOADS) payloadCache.delete(payloadCache.keys().next().value!);\n // Don't cache failures, and swallow the rejection until (or unless) a nav awaits it.\n promise.catch(() => {\n if (payloadCache.get(key) === promise) payloadCache.delete(key);\n });\n}\n\nfunction takePayload(href: string): Promise<RscPayload> {\n const key = cacheKey(href);\n if (key) {\n const cached = payloadCache.get(key);\n if (cached) {\n payloadCache.delete(key);\n return cached;\n }\n }\n return requestPayload(href);\n}\n\nasync function main() {\n const cspMeta = document.querySelector('meta[property=\"csp-nonce\"]') as HTMLMetaElement | null;\n if (cspMeta?.nonce) __webpack_nonce__ = cspMeta.nonce;\n\n // Both are replaced by BrowserRoot's own on mount. The defaults matter: `setServerCallback` is\n // registered before hydration, so an action or refresh firing in that window would otherwise call\n // an unassigned binding. Until there's a root to update, a full reload is the honest fallback.\n let setPayload: (v: RscPayload) => void = () => {\n window.location.reload();\n };\n // Runs work inside the nav transition so useNavigation().pending stays true across the round-trip.\n let startNav: (run: () => void | Promise<void>) => void = (run) => {\n void run();\n };\n\n const initialPayload = await createFromReadableStream<RscPayload>(rscStream);\n\n function push(href: string) {\n const target = new URL(href, window.location.href);\n if (target.origin !== window.location.origin) {\n window.location.assign(target.href);\n return;\n }\n window.history.pushState(null, '', target.href);\n }\n\n function replace(href: string) {\n const target = new URL(href, window.location.href);\n if (target.origin !== window.location.origin) {\n window.location.replace(target.href);\n return;\n }\n window.history.replaceState(null, '', target.href);\n }\n\n const back = () => window.history.back();\n const forward = () => window.history.forward();\n // A refresh keeps the URL, so it can't ride the history patch like push/replace — it drives the flight re-fetch directly (bypassing any warmed cache to get fresh data).\n const refresh = () =>\n startNav(async () => {\n try {\n await fetchRscPayload(true);\n } catch {\n window.location.reload();\n }\n });\n\n /**\n * Turns a control-signal digest — how `redirect()` / `notFound()` reach the browser — into a real\n * navigation. Returns false for anything else, so callers can fall through to their own handling.\n *\n * `hard` forces a full document load, for signals that surfaced *through React* (a nested\n * component's redirect, reported via the root error handlers). React unmounts the root on an\n * uncaught error, so there is no live tree left to soft-navigate with. A signal caught earlier —\n * a top-level payload rejection — still swaps the payload in place.\n */\n function handleControlDigest(error: unknown, { hard = false }: { hard?: boolean } = {}): boolean {\n const digest = (error as { digest?: unknown } | null)?.digest;\n if (!isControlDigest(digest)) return false;\n const redirect = parseRedirectDigest(digest);\n if (!redirect) {\n window.location.reload();\n } else if (hard) {\n window.location.assign(new URL(redirect.location, window.location.href).href);\n } else {\n push(redirect.location);\n }\n return true;\n }\n\n async function fetchRscPayload(force = false) {\n let payload: RscPayload;\n try {\n payload = await (force ? requestPayload(window.location.href) : takePayload(window.location.href));\n } catch (error) {\n if (handleControlDigest(error)) return;\n throw error;\n }\n if (payload.redirect) return push(payload.redirect);\n setPayload(payload);\n }\n\n function BrowserRoot() {\n const [payload, setPayloadState] = React.useState(initialPayload);\n const [pending, startTransition] = React.useTransition();\n\n React.useEffect(() => {\n setPayload = (v) => setPayloadState(v);\n startNav = (run) => startTransition(run);\n }, [startTransition]);\n\n React.useEffect(\n () =>\n listenNavigation(\n (restoreScroll) =>\n startNav(async () => {\n try {\n await fetchRscPayload();\n restoreScroll();\n } catch {\n window.location.reload();\n }\n }),\n warmPayload,\n ),\n [],\n );\n\n const router = React.useMemo<Router>(() => ({ push, replace, back, forward, refresh, pending }), [pending]);\n\n return <RouterContext.Provider value={router}>{payload.root}</RouterContext.Provider>;\n }\n\n setServerCallback(async (id, args) => {\n const temporaryReferences = createTemporaryReferenceSet();\n const request = createRscRequest(window.location.href, {\n id,\n body: await encodeReply(args, { temporaryReferences }),\n });\n // The action is about to mutate who-knows-what, so anything warmed up to now is pre-mutation\n // data. Cleared before the round-trip so it happens even if the action throws.\n payloadCache.clear();\n let payload: RscPayload;\n try {\n payload = await createFromFetch<RscPayload>(fetch(request), { temporaryReferences });\n } catch (error) {\n if (handleControlDigest(error)) return undefined;\n throw error;\n }\n if (payload.redirect) {\n push(payload.redirect);\n return undefined;\n }\n React.startTransition(() => setPayload(payload));\n if (payload.notFound) return undefined;\n const result = payload.returnValue!;\n if (!result.ok) throw result.error;\n return result.value;\n });\n\n // A `redirect()` / `notFound()` from a component *below* the page root can only reach us through\n // React: it rides the flight payload as an error at that component's position, and boundaries\n // re-throw it (see boundaries.tsx) so it lands here rather than rendering an error fallback.\n //\n // Anything that isn't a control signal falls back to what React would have done on its own —\n // console for a caught error, `reportError` (i.e. window.onerror, so error-reporting tools still\n // see it) for an uncaught one. Overriding these hooks means opting out of that default, so it has\n // to be put back by hand.\n hydrateRoot(document, <BrowserRoot />, {\n formState: initialPayload.formState,\n onCaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true })) return;\n // A boundary handled this and the tree is intact, so no overlay: whatever fallback the app\n // chose is the right thing to have on screen.\n console.error(error, errorInfo.componentStack ?? '');\n },\n onUncaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true })) return;\n // Nothing caught it, so React tears the root down — and the root is `document`. This is the\n // white screen; paint the reason over it.\n globalThis.reportError(error);\n showFatal(error, errorInfo.componentStack);\n },\n });\n\n if (import.meta.webpackHot) {\n // Server code may have changed, so drop any warmed payloads and re-fetch fresh.\n initDevRefresh(() => {\n payloadCache.clear();\n return fetchRscPayload(true);\n });\n }\n}\n\ntype NavigationType = 'push' | 'replace' | 'pop';\n\n/** Hover/focus dwell time before a `data-prefetch` link warms its payload. */\nconst PREFETCH_DELAY_MS = 120;\n\n// An `<a>` we intercept for soft navigation: same-origin, same tab, not a download,\n// and not explicitly opted out with `data-native` (which forces a full browser navigation).\nfunction isRouterLink(link: HTMLAnchorElement): boolean {\n return (\n !!link.href &&\n (!link.target || link.target === '_self') &&\n link.origin === location.origin &&\n !link.hasAttribute('download') &&\n !link.hasAttribute('data-native')\n );\n}\n\nfunction listenNavigation(onNavigation: (restoreScroll: () => void) => void, prefetch: (href: string) => void): () => void {\n // Scroll restoration. We tag each history entry with a stable numeric key in its\n // `history.state` and remember scrollY per key, so back/forward restores the exact\n // position while push scrolls to the top. `manual` hands restoration to us.\n const scrollByKey = new Map<number, number>();\n let seq = 0;\n const prevRestoration = window.history.scrollRestoration;\n try {\n window.history.scrollRestoration = 'manual';\n } catch {}\n\n const keyOf = (): number | null => {\n const state = window.history.state as { __rshonoScroll?: unknown } | null;\n return state && typeof state.__rshonoScroll === 'number' ? state.__rshonoScroll : null;\n };\n const tag = (state: unknown, key: number) => ({ ...(state as object | null), __rshonoScroll: key });\n\n if (keyOf() === null) {\n window.history.replaceState(tag(window.history.state, seq++), '');\n }\n\n let scrollRaf = 0;\n const onScroll = () => {\n if (scrollRaf) return;\n scrollRaf = requestAnimationFrame(() => {\n scrollRaf = 0;\n const key = keyOf();\n if (key !== null) scrollByKey.set(key, window.scrollY);\n });\n };\n window.addEventListener('scroll', onScroll, { passive: true });\n\n const restoreScrollFor = (type: NavigationType) => () => {\n if (type === 'replace') return;\n const key = keyOf();\n requestAnimationFrame(() => {\n const y = type === 'pop' && key !== null ? (scrollByKey.get(key) ?? 0) : 0;\n window.scrollTo(0, y);\n });\n };\n const notify = (type: NavigationType) => onNavigation(restoreScrollFor(type));\n\n const onPopState = () => notify('pop');\n window.addEventListener('popstate', onPopState);\n\n const oldPushState = window.history.pushState;\n window.history.pushState = function (state, unused, url) {\n const res = oldPushState.call(this, tag(state, seq++), unused, url as string);\n notify('push');\n return res;\n };\n\n const oldReplaceState = window.history.replaceState;\n window.history.replaceState = function (state, unused, url) {\n const res = oldReplaceState.call(this, tag(state, keyOf() ?? seq++), unused, url as string);\n notify('replace');\n return res;\n };\n\n function onClick(e: MouseEvent) {\n const link = (e.target as Element).closest('a');\n if (\n link &&\n link instanceof HTMLAnchorElement &&\n isRouterLink(link) &&\n e.button === 0 &&\n !e.metaKey &&\n !e.ctrlKey &&\n !e.altKey &&\n !e.shiftKey &&\n !e.defaultPrevented\n ) {\n if (link.hash && link.pathname === location.pathname && link.search === location.search) return;\n e.preventDefault();\n history.pushState(null, '', link.href);\n }\n }\n document.addEventListener('click', onClick);\n\n // A prefetch is a full server render, so it waits out a short dwell time on one shared timer:\n // sweeping the cursor across a list of prefetch links costs one request (for the link the pointer\n // settled on), not one per link.\n let prefetchTimer: ReturnType<typeof setTimeout> | undefined;\n function onPrefetch(e: Event) {\n const target = e.target;\n if (!(target instanceof Element)) return;\n const link = target.closest('a[data-prefetch]');\n if (!(link instanceof HTMLAnchorElement) || !isRouterLink(link)) return;\n const { href } = link;\n clearTimeout(prefetchTimer);\n prefetchTimer = setTimeout(() => prefetch(href), PREFETCH_DELAY_MS);\n }\n document.addEventListener('pointerover', onPrefetch);\n document.addEventListener('focusin', onPrefetch);\n\n return () => {\n clearTimeout(prefetchTimer);\n document.removeEventListener('click', onClick);\n document.removeEventListener('pointerover', onPrefetch);\n document.removeEventListener('focusin', onPrefetch);\n window.removeEventListener('popstate', onPopState);\n window.removeEventListener('scroll', onScroll);\n window.history.pushState = oldPushState;\n window.history.replaceState = oldReplaceState;\n try {\n window.history.scrollRestoration = prevRestoration;\n } catch {}\n };\n}\n\n/**\n * Dev-only refresh client (stripped from prod bundles: the whole call is\n * guarded by import.meta.webpackHot). Listens to the CLI's SSE endpoint:\n *\n * client-built → hot-apply the waiting updates (react-refresh keeps\n * component state); any failure falls back to reload.\n * rsc-update → server component code changed: re-fetch the flight\n * payload for the current URL, state preserved.\n * hello → sent on (re)connect with the latest build hash; a\n * mismatch means events were missed — resync.\n */\nfunction initDevRefresh(fetchRscPayload: () => Promise<void>) {\n let connectedOnce = false;\n\n async function applyClientUpdate(hash: string) {\n const hot = import.meta.webpackHot!;\n if (hash === __webpack_hash__) return;\n if (hot.status() !== 'idle') {\n window.location.reload();\n return;\n }\n try {\n await hot.check(true);\n if (hash !== __webpack_hash__) await applyClientUpdate(hash);\n } catch (error) {\n console.warn('[rshono] hot update failed, reloading:', error);\n window.location.reload();\n }\n }\n\n const source = new EventSource('/_rshono/hmr');\n source.onmessage = async (event) => {\n const message = JSON.parse(event.data) as DevMessage;\n switch (message.type) {\n case 'hello':\n if (connectedOnce) {\n if (message.hash && message.hash !== __webpack_hash__) await applyClientUpdate(message.hash);\n await fetchRscPayload().catch(() => window.location.reload());\n }\n connectedOnce = true;\n break;\n case 'client-built':\n if (message.hash) await applyClientUpdate(message.hash);\n break;\n case 'rsc-update':\n console.log('[rshono] server components updated');\n await fetchRscPayload().catch(() => window.location.reload());\n break;\n }\n };\n}\n\n// Bootstrap failures (a truncated or malformed initial flight payload, most likely) would otherwise\n// be an unhandled rejection: nothing hydrates, nothing is reported, and the page just sits there.\nmain().catch((error) => {\n console.error('[rshono] the client runtime failed to start:', error);\n showFatal(error);\n});\n"]}
@@ -0,0 +1,32 @@
1
+ import { Hono } from 'hono';
2
+ import type React from 'react';
3
+ import type { ReactFormState } from 'react-dom/client';
4
+ import { type Route } from '../router.js';
5
+ export declare const routes: readonly Route[];
6
+ /** The result of a server action, as a discriminated union (a `Result<T, E>`) rather than an `ok` flag over one field. */
7
+ export type ActionResult = {
8
+ ok: true;
9
+ value: unknown;
10
+ } | {
11
+ ok: false;
12
+ error: unknown;
13
+ };
14
+ export type RscPayload = {
15
+ root: React.ReactNode;
16
+ returnValue?: ActionResult;
17
+ formState?: ReactFormState;
18
+ redirect?: string;
19
+ notFound?: boolean;
20
+ };
21
+ export declare const app: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
22
+ /**
23
+ * The app, handed to whatever is hosting it.
24
+ *
25
+ * On a platform where rshono owns the process this binds a port and the default export is nothing;
26
+ * where the host owns it, this *is* the export the platform looks for — so the same entry serves
27
+ * both without a per-platform entry file. `app` and `routes` stay named exports either way, because
28
+ * `rshono build` imports them to prerender `render: 'static'` routes.
29
+ */
30
+ declare const _default: unknown;
31
+ export default _default;
32
+ //# sourceMappingURL=entry.rsc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.rsc.d.ts","sourceRoot":"","sources":["../../src/runtime/entry.rsc.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwBvD,OAAO,EAAsF,KAAK,KAAK,EAAoB,MAAM,cAAc,CAAC;AAyChJ,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAAuB,CAAC;AAE3D,0HAA0H;AAC1H,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAycF,eAAO,MAAM,GAAG,4EAAa,CAAC;AAE9B;;;;;;;GAOG"}
@@ -0,0 +1,466 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Hono } from 'hono';
3
+ import { bodyLimit } from 'hono/body-limit';
4
+ // The JSX factory, by name: the page element is created with this directly rather than as
5
+ // `<Page {...props} />`, because a spread would drop the non-enumerable `ctx` prop. See `pageProps`.
6
+ import { jsx } from 'react/jsx-runtime';
7
+ // The bare specifier, not `/server.node`: the package ships a build per runtime behind export
8
+ // conditions (`node`, `workerd`, `deno`, `edge-light`), and the RSC layer's `conditionNames` is what
9
+ // picks one — so a non-Node deploy target gets its own build instead of Node's by hard-coded path.
10
+ import { createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, loadServerAction, renderToReadableStream, } from 'react-server-dom-rspack/server';
11
+ // Resolved by the '@rshono/deploy' alias to the selected preset's runtime module — the one place
12
+ // this file knows anything about where it is running. See `deploy/contract.ts`.
13
+ import { runtime } from '@rshono/deploy';
14
+ // @ts-expect-error — resolved by the '@rshono/routes' alias to the app's routes.ts
15
+ import { routes as userRoutes } from '@rshono/routes';
16
+ // @ts-expect-error — resolved by the '@rshono/server-app' alias (src/server.ts or the empty fallback)
17
+ import * as serverAppModule from '@rshono/server-app';
18
+ import { isPageRoute } from '../router.js';
19
+ import { appendVary, etagMatches } from '../server/headers.js';
20
+ import { getContext, publicUrl, readParams, reportServerError, runWithContext } from './context.js';
21
+ import { isControlSignal, RedirectSignal } from './control.js';
22
+ import { renderHTML } from './entry.ssr.js';
23
+ import { RouterProvider } from './navigation.js';
24
+ import { acceptsRsc, isActionRequest, parseRenderRequest, wantsRsc } from './request.js';
25
+ const serverApp = (serverAppModule.default ?? null);
26
+ // Framework settings resolved from rshono.config.ts and compiled into the bundle at build time
27
+ // (see builder/rspack-config.ts). These have no runtime env-var interface — env is for secrets.
28
+ // Named after their ServerConfig fields, so what a setting does here is one grep from where it is
29
+ // resolved. `isDev` among them: the build mode is decided by which command produced the bundle, not
30
+ // by `process.env.NODE_ENV`, and not every runtime this deploys to has a `process` to read anyway.
31
+ const CONFIG = __RSHONO_CONFIG__;
32
+ const { isDev, renderTimeoutMs, cspEnabled, checkOrigin, maxBodyBytes, compress: compressEnabled } = CONFIG;
33
+ /** Extra cross-origin hosts permitted to post server actions, beyond the app's own origin. */
34
+ const allowedOrigins = new Set(CONFIG.allowedOrigins);
35
+ /** How long a prerendered page may be reused before revalidating. Also what `public/` files get. */
36
+ const SSG_CACHE_CONTROL = 'public, max-age=300';
37
+ /**
38
+ * The two content types a page can be served as. Both come back from the *same* URL depending on
39
+ * the `Accept` header, which is what makes `Vary` non-optional here.
40
+ */
41
+ const PAGE_CONTENT_TYPE = /^(?:text\/html|text\/x-component)\b/;
42
+ // The CSP is fixed per build apart from the nonce, so assemble everything but `script-src` once.
43
+ const CSP_STATIC = Object.entries(CONFIG.cspDirectives)
44
+ .filter(([name]) => name !== 'script-src')
45
+ .map(([name, value]) => `${name} ${value}`)
46
+ .join('; ');
47
+ const CSP_SCRIPT_SRC = CONFIG.cspDirectives['script-src'] ?? "'self'";
48
+ // Called here rather than at the top of the deploy runtime's own module so the timing is unchanged:
49
+ // `.env` is loaded once every import above has been evaluated, exactly as before.
50
+ runtime.loadEnv();
51
+ const routeConfig = userRoutes;
52
+ export const routes = routeConfig.routes;
53
+ /**
54
+ * CSRF guard for server-action POSTs, layering the two signals a browser gives us.
55
+ *
56
+ * `Sec-Fetch-Site` is set by the browser and unforgeable by page script, so `same-origin` settles
57
+ * the question on its own — and short-circuiting on it is what keeps the check from misfiring on a
58
+ * legitimate request whose `Host` the proxy rewrote. Everything else falls back to comparing the
59
+ * `Origin` host against our own (see {@link publicUrl} — deliberately *not* against a raw
60
+ * `X-Forwarded-Host`, which the client controls unless `trustProxy` says a proxy owns it).
61
+ *
62
+ * A missing `Origin` is treated as same-origin: no-JS form posts from older browsers omit it, and
63
+ * those same browsers send no `Sec-Fetch-Site` either, so there is nothing left to check. Hosts are
64
+ * compared case-insensitively; the scheme is not compared, so this alone won't stop an
65
+ * `http://` origin posting to the `https://` site (HSTS is the control for that).
66
+ */
67
+ function isSameOriginAction(c) {
68
+ if (!checkOrigin)
69
+ return true;
70
+ const secFetchSite = c.req.header('sec-fetch-site');
71
+ if (secFetchSite === 'same-origin')
72
+ return true;
73
+ const origin = c.req.header('origin');
74
+ const originHost = origin ? URL.parse(origin)?.host.toLowerCase() || null : null;
75
+ if (origin !== undefined && originHost === null)
76
+ return false; // an Origin we can't parse is untrusted.
77
+ const trusted = originHost !== null && (originHost === publicUrl(c).host.toLowerCase() || allowedOrigins.has(originHost));
78
+ if (secFetchSite && secFetchSite !== 'none') {
79
+ // The browser tells us (unforgeably) this didn't originate from our own site — only a
80
+ // trusted (allowlisted) Origin may proceed.
81
+ return trusted;
82
+ }
83
+ if (originHost === null)
84
+ return true;
85
+ return trusted;
86
+ }
87
+ async function loadPageModule(load, label) {
88
+ const mod = await load();
89
+ const Page = mod.default;
90
+ if (typeof Page !== 'function') {
91
+ throw new Error(`[rshono] The page module for ${label} must default-export a server component.`);
92
+ }
93
+ if (!Page.entryJsFiles) {
94
+ throw new Error(`[rshono] The page component for ${label} is missing its client-asset info ('use server-entry'). ` +
95
+ "The directive is added automatically for inline `component: () => import('…')` thunks in routes.ts. " +
96
+ "If this page is wired up another way, put 'use server-entry' on the first line of the page module yourself — " +
97
+ "and make sure the page is a server component (a 'use client' page must be wrapped by a server component instead).");
98
+ }
99
+ return Page;
100
+ }
101
+ /** A browser navigation or a crawler, as opposed to a fetch that would rather have plain text. */
102
+ function acceptsHtml(c) {
103
+ return c.req.header('accept')?.includes('text/html') ?? false;
104
+ }
105
+ /** A lazy once-cell: runs `load` at most once and caches the promise, but clears a rejection so a later call can retry. */
106
+ function once(load) {
107
+ let promise;
108
+ return () => {
109
+ if (!promise) {
110
+ const pending = (promise = load());
111
+ pending.catch(() => {
112
+ // Only clear if we're still holding the rejected promise (a later successful load may have already replaced it).
113
+ if (promise === pending)
114
+ promise = undefined;
115
+ });
116
+ }
117
+ return promise;
118
+ };
119
+ }
120
+ /**
121
+ * Owns the render-deadline lifecycle in one place (the RAII / `defer` pattern — a
122
+ * `using` declaration doesn't fit because the timer must outlive this call to keep
123
+ * guarding the *stream*, not just the function scope). The timer is released on
124
+ * exactly one of: the stream finishing ({@link RenderDeadline.guard}), an explicit
125
+ * {@link RenderDeadline.clear} on an error path, or the signal aborting (client
126
+ * disconnect, or the deadline firing itself). A manually-cleared timer instead of
127
+ * `AbortSignal.timeout()` so a fast response doesn't leave one pending to fire later.
128
+ *
129
+ * One deadline covers the whole request — server action included, not just the render — so a
130
+ * hung action can't pin a socket open indefinitely either.
131
+ */
132
+ function createRenderDeadline(requestSignal, ms) {
133
+ const controller = new AbortController();
134
+ const timer = setTimeout(() => controller.abort(new Error(`[rshono] request exceeded ${ms}ms`)), ms);
135
+ timer.unref?.();
136
+ const signal = AbortSignal.any([requestSignal, controller.signal]);
137
+ const clear = () => clearTimeout(timer);
138
+ signal.addEventListener('abort', clear, { once: true });
139
+ return {
140
+ signal,
141
+ clear,
142
+ guard: (stream) => stream.pipeThrough(new TransformStream({ flush: clear })),
143
+ race(work) {
144
+ if (signal.aborted)
145
+ return Promise.reject(signal.reason);
146
+ const { promise: aborted, reject } = Promise.withResolvers();
147
+ const onAbort = () => reject(signal.reason);
148
+ signal.addEventListener('abort', onAbort, { once: true });
149
+ // `Promise.race` subscribes to `work` either way, so abandoning it can't surface as an
150
+ // unhandled rejection. Detach on settle so a long-lived signal doesn't accumulate listeners.
151
+ return Promise.race([work, aborted]).finally(() => signal.removeEventListener('abort', onAbort));
152
+ },
153
+ };
154
+ }
155
+ /**
156
+ * Builds the props a page component is called with.
157
+ *
158
+ * `url` and `params` match `useNavigation()` field for field, so a read can move between a page and
159
+ * a `'use client'` component unchanged. The `URL` is this page's own — `Ctx` parses its own — so a
160
+ * page that mutates it cannot disturb anything else on the request.
161
+ *
162
+ * `ctx` is *defined* rather than assigned, and both parts of how carry their weight:
163
+ *
164
+ * - **A getter**, so nothing is built for the pages that never read it, and so a `render: 'static'`
165
+ * page that does read it gets {@link getContext}'s own "no per-request context while
166
+ * prerendering" error rather than a bare `undefined` — one explanation, in one place.
167
+ * - **Non-enumerable**, so React's *development-only* serialization of a server component's props
168
+ * (the debug channel behind component stacks and the performance track) skips it. That walks own
169
+ * enumerable properties, and `ctx.raw` is the Hono {@link Context} — whose `env` holds the
170
+ * runtime's bindings. An enumerable `ctx` ships every one of them, secrets included, to the
171
+ * browser in dev, and grows a small page's flight payload by well over 10 kB. Production never
172
+ * serializes a server component's props at all, so this is the dev half of the same guarantee.
173
+ *
174
+ * The cost is that the element has to be created by handing this object to `jsx()` *by reference*:
175
+ * a `<Page {...props} />` spread copies enumerable properties only, and would drop `ctx` silently.
176
+ */
177
+ function pageProps(c, errorInfo) {
178
+ const props = { url: publicUrl(c), params: readParams(c), ...(errorInfo ? { error: errorInfo } : null) };
179
+ Object.defineProperty(props, 'ctx', { get: getContext, enumerable: false, configurable: true });
180
+ return props;
181
+ }
182
+ async function renderComponent(c, Page, opts) {
183
+ const deadline = opts.deadline ?? createRenderDeadline(c.req.raw.signal, renderTimeoutMs);
184
+ const signal = deadline.signal;
185
+ const nonce = cspEnabled && !opts.isRsc ? crypto.randomUUID() : undefined;
186
+ const props = pageProps(c, opts.errorInfo);
187
+ const root = (_jsxs(_Fragment, { children: [nonce && _jsx("meta", { property: "csp-nonce", nonce: nonce }), Page.entryCssFiles?.map((href) => (_jsx("link", { rel: "stylesheet", href: href, precedence: "default" }, href))), _jsx(RouterProvider, { href: props.url.href, params: props.params, children: jsx(Page, props) })] }));
188
+ // `notFound` only when it is true, so the flight payload of an ordinary page doesn't carry the key.
189
+ const rscPayload = { root, formState: opts.formState, returnValue: opts.returnValue, ...(opts.notFound ? { notFound: true } : null) };
190
+ let controlSignal;
191
+ const rscStream = renderToReadableStream(rscPayload, {
192
+ temporaryReferences: opts.temporaryReferences,
193
+ signal,
194
+ onError(error) {
195
+ if (isControlSignal(error)) {
196
+ controlSignal = error;
197
+ return error.digest;
198
+ }
199
+ if (!signal.aborted)
200
+ reportServerError(error, { source: 'render', request: c.req.raw, message: '[rshono] render error:' });
201
+ },
202
+ });
203
+ if (opts.isRsc) {
204
+ return c.body(deadline.guard(rscStream), (opts.status ?? 200), {
205
+ 'content-type': 'text/x-component;charset=utf-8',
206
+ });
207
+ }
208
+ let ssrResult;
209
+ try {
210
+ ssrResult = await renderHTML(rscStream, {
211
+ bootstrapScripts: Page.entryJsFiles,
212
+ formState: opts.formState,
213
+ signal,
214
+ nonce,
215
+ onShellError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR shell error:' }),
216
+ onError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR error:' }),
217
+ });
218
+ }
219
+ catch (error) {
220
+ deadline.clear();
221
+ if (controlSignal)
222
+ throw controlSignal;
223
+ throw error;
224
+ }
225
+ if (controlSignal) {
226
+ deadline.clear();
227
+ throw controlSignal;
228
+ }
229
+ const headers = { 'content-type': 'text/html;charset=utf-8' };
230
+ if (nonce) {
231
+ // The nonce is always appended to whatever `script-src` resolved to, so overriding the
232
+ // directive in `cspDirectives` can widen the policy but can't accidentally drop the nonce.
233
+ // Dev additionally needs 'unsafe-eval' for react-refresh.
234
+ const scriptSrc = `script-src ${CSP_SCRIPT_SRC} 'nonce-${nonce}'${isDev ? " 'unsafe-eval'" : ''}`;
235
+ headers['content-security-policy'] = CSP_STATIC ? `${CSP_STATIC}; ${scriptSrc}` : scriptSrc;
236
+ }
237
+ return c.body(deadline.guard(ssrResult.stream), (ssrResult.status ?? opts.status ?? 200), headers);
238
+ }
239
+ async function renderPage(c, loadPage) {
240
+ const request = c.req.raw;
241
+ const renderRequest = parseRenderRequest(request);
242
+ // Created before the action runs so the deadline covers the whole request, then handed to
243
+ // `renderComponent` so the render doesn't get a fresh budget of its own.
244
+ const deadline = createRenderDeadline(request.signal, renderTimeoutMs);
245
+ let returnValue;
246
+ let formState;
247
+ let temporaryReferences;
248
+ let actionStatus;
249
+ if (isActionRequest(renderRequest)) {
250
+ if (!isSameOriginAction(c)) {
251
+ deadline.clear();
252
+ return c.text('Forbidden: cross-origin server action rejected', 403);
253
+ }
254
+ if (renderRequest.kind === 'rsc-action') {
255
+ // Checked before the body is decoded, so an unknown id costs nothing to reject — and
256
+ // `loadServerAction` would otherwise fault on the missing manifest entry, turning a bad
257
+ // request into an unhandled 500. `hasOwn` so `__proto__` doesn't resolve to a manifest entry.
258
+ if (!Object.hasOwn(__rspack_rsc_manifest__.serverManifest, renderRequest.actionId)) {
259
+ deadline.clear();
260
+ return c.text('Bad Request: unknown server action', 400);
261
+ }
262
+ const contentType = request.headers.get('content-type');
263
+ const body = contentType?.startsWith('multipart/form-data') ? await request.formData() : await request.text();
264
+ temporaryReferences = createTemporaryReferenceSet();
265
+ const args = await decodeReply(body, { temporaryReferences });
266
+ const action = loadServerAction(renderRequest.actionId);
267
+ try {
268
+ returnValue = { ok: true, value: await deadline.race(action.apply(null, args)) };
269
+ }
270
+ catch (error) {
271
+ if (isControlSignal(error))
272
+ throw error;
273
+ // React sends a thrown action error to the client as an opaque marker in production — no
274
+ // message, no digest — so without this the failure would be invisible on both ends.
275
+ reportServerError(error, { source: 'action', request, message: '[rshono] server action error:' });
276
+ returnValue = { ok: false, error };
277
+ actionStatus = 500;
278
+ }
279
+ }
280
+ else {
281
+ const formData = await request.formData();
282
+ const decodedAction = await decodeAction(formData, __rspack_rsc_manifest__.serverManifest);
283
+ if (decodedAction) {
284
+ const result = await deadline.race(decodedAction());
285
+ formState = (await decodeFormState(result, formData, __rspack_rsc_manifest__.serverManifest)) ?? undefined;
286
+ }
287
+ }
288
+ }
289
+ const Page = await loadPage();
290
+ return renderComponent(c, Page, {
291
+ status: actionStatus,
292
+ isRsc: wantsRsc(renderRequest),
293
+ formState,
294
+ returnValue,
295
+ temporaryReferences,
296
+ deadline,
297
+ });
298
+ }
299
+ function buildApp() {
300
+ const app = new Hono();
301
+ // Outermost, so it wraps the finished response — headers and all — on the way out. A platform that
302
+ // compresses for us (or cannot stream a compressor) offers none, and the setting has nothing to do.
303
+ if (compressEnabled && runtime.compress)
304
+ app.use(runtime.compress);
305
+ // Cheap, unconditional headers that only matter when something else has gone wrong: stop
306
+ // content-type sniffing, keep the full URL (paths, query) out of cross-origin referrers, and
307
+ // refuse to be framed by another origin (clickjacking). `frame-ancestors` in the opt-in CSP is
308
+ // stricter and takes precedence where both apply; this is the floor for everyone else.
309
+ // Set after `next()` so a route or middleware that sets its own value wins.
310
+ app.use(async (c, next) => {
311
+ await next();
312
+ const headers = c.res.headers;
313
+ if (!headers.has('x-content-type-options'))
314
+ headers.set('x-content-type-options', 'nosniff');
315
+ if (!headers.has('referrer-policy'))
316
+ headers.set('referrer-policy', 'strict-origin-when-cross-origin');
317
+ if (!headers.has('x-frame-options'))
318
+ headers.set('x-frame-options', 'SAMEORIGIN');
319
+ // Page responses only, from here down. Two things are true of them and of nothing else served
320
+ // here: one URL answers with either an HTML document or a flight payload depending on `Accept`,
321
+ // and the default page is request-specific (cookies, session, headers).
322
+ if (!PAGE_CONTENT_TYPE.test(headers.get('content-type') ?? ''))
323
+ return;
324
+ appendVary(headers, 'Accept');
325
+ // Without this a page carries no cache directives at all, and a shared cache — a CDN, a
326
+ // corporate proxy — is free to store a logged-in user's page and hand it to someone else.
327
+ // `private` forbids exactly that; `no-cache` makes the browser revalidate its own copy rather
328
+ // than re-showing a stale personalised page. Neither blocks bfcache, which `no-store` would.
329
+ // A prerendered page, or anything a route set deliberately, already has its own value.
330
+ if (!headers.has('cache-control'))
331
+ headers.set('cache-control', 'private, no-cache');
332
+ });
333
+ // A memory-exhaustion guard for *every* route — pages and actions, `{ type: 'endpoint' }` routes
334
+ // and the src/server.ts sub-app alike — since anything that buffers a body (`.json()`,
335
+ // `.formData()`) is exposed, not just server actions. Rejects an over-cap `Content-Length` up
336
+ // front and otherwise counts the stream, so a chunked or under-reported body is still cut off.
337
+ if (maxBodyBytes > 0) {
338
+ app.use(bodyLimit({ maxSize: maxBodyBytes, onError: (c) => c.text('Payload Too Large', 413) }));
339
+ }
340
+ runtime.mountStaticAssets(app);
341
+ // Mounted ahead of the page routes so the sub-app's middleware (auth, logging, trailing-slash)
342
+ // wraps page requests too. The flip side: a *terminal* handler in src/server.ts at the same path
343
+ // as a page route wins over the page.
344
+ if (serverApp) {
345
+ app.route('/', serverApp);
346
+ }
347
+ const memoizePage = (page, label) => once(() => loadPageModule(page.component, label));
348
+ const loadNotFoundPage = routeConfig.notFound ? memoizePage(routeConfig.notFound, 'the notFound page') : null;
349
+ /** Turns a thrown `redirect()` / `notFound()` into the response it stands for. */
350
+ const respondToControlSignal = async (c, signal) => {
351
+ const isRsc = wantsRsc(parseRenderRequest(c.req.raw));
352
+ if (signal instanceof RedirectSignal) {
353
+ if (isRsc) {
354
+ return c.body(renderToReadableStream({ root: null, redirect: signal.location }, { signal: c.req.raw.signal }), 200, {
355
+ 'content-type': 'text/x-component;charset=utf-8',
356
+ });
357
+ }
358
+ return c.redirect(signal.location, signal.status);
359
+ }
360
+ if (loadNotFoundPage) {
361
+ return renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc, notFound: true });
362
+ }
363
+ // Plain text, but still one of the two answers this URL gives depending on `Accept`.
364
+ return c.text('Not Found', 404, { vary: 'Accept' });
365
+ };
366
+ for (const route of routes) {
367
+ if (isPageRoute(route)) {
368
+ // Both are fixed for the life of the process, so resolve them once here instead of per request.
369
+ const servesPrerendered = !isDev && route.render === 'static';
370
+ const loadPage = once(() => loadPageModule(route.component, `"${route.path}"`));
371
+ const handler = async (c) => {
372
+ try {
373
+ if (servesPrerendered && c.req.method === 'GET') {
374
+ const isRsc = acceptsRsc(c.req.raw);
375
+ // Both representations are prerendered, so a soft navigation is served from the build too
376
+ // rather than re-rendering a page that was already built. The exception is the HTML
377
+ // under `csp`, which has to be rendered per request to carry its nonce — the flight
378
+ // payload never carries one, so it stays servable either way.
379
+ if (!(cspEnabled && !isRsc)) {
380
+ const page = await runtime.readPrerendered(c, isRsc ? 'flight' : 'html');
381
+ // A prerendered page is request-independent by construction, so it is safe to cache
382
+ // publicly; the short max-age matches what `public/` files get. The ETag turns the
383
+ // revalidation that follows into a 304 rather than the page all over again.
384
+ //
385
+ // Answered outside `runWithContext`: no app code runs on this path, so there is no
386
+ // `getContext()` to serve and no reason to pay for the AsyncLocalStorage scope.
387
+ if (page !== null) {
388
+ const headers = {
389
+ 'cache-control': SSG_CACHE_CONTROL,
390
+ etag: page.etag,
391
+ vary: 'Accept',
392
+ 'content-type': isRsc ? 'text/x-component;charset=utf-8' : 'text/html;charset=utf-8',
393
+ };
394
+ if (etagMatches(c.req.header('if-none-match'), page.etag))
395
+ return c.body(null, 304, headers);
396
+ return c.body(page.body, 200, { ...headers, 'content-length': page.contentLength });
397
+ }
398
+ }
399
+ }
400
+ return await runWithContext(c, () => renderPage(c, loadPage));
401
+ }
402
+ catch (error) {
403
+ if (isControlSignal(error))
404
+ return runWithContext(c, () => respondToControlSignal(c, error));
405
+ throw error;
406
+ }
407
+ };
408
+ app.on(['GET', 'POST'], route.path, handler);
409
+ }
410
+ else {
411
+ const loadEndpoint = once(() => route.server());
412
+ const handler = async (c, next) => {
413
+ const { handler: endpointHandler } = await loadEndpoint();
414
+ return endpointHandler(c, next);
415
+ };
416
+ const method = route.method ?? 'all';
417
+ if (method === 'all')
418
+ app.all(route.path, handler);
419
+ else
420
+ app.on(method.toUpperCase(), route.path, handler);
421
+ }
422
+ }
423
+ runtime.mountPublicFallback(app);
424
+ app.notFound(async (c) => {
425
+ const isRsc = wantsRsc(parseRenderRequest(c.req.raw));
426
+ if (loadNotFoundPage && (isRsc || acceptsHtml(c))) {
427
+ return runWithContext(c, async () => renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc }));
428
+ }
429
+ return c.text('Not Found', 404, { vary: 'Accept' });
430
+ });
431
+ const loadErrorPage = routeConfig.error ? memoizePage(routeConfig.error, 'the error page') : null;
432
+ app.onError(async (error, c) => {
433
+ if (isControlSignal(error))
434
+ return runWithContext(c, () => respondToControlSignal(c, error));
435
+ reportServerError(error, { source: 'request', request: c.req.raw, message: '[rshono] request error:' });
436
+ const isRsc = wantsRsc(parseRenderRequest(c.req.raw));
437
+ if (loadErrorPage && (isRsc || acceptsHtml(c))) {
438
+ const errorInfo = isDev
439
+ ? {
440
+ message: error instanceof Error ? error.message : String(error),
441
+ stack: error instanceof Error ? error.stack : undefined,
442
+ }
443
+ : { message: 'Internal Server Error' };
444
+ try {
445
+ return await runWithContext(c, async () => renderComponent(c, await loadErrorPage(), { status: 500, isRsc, errorInfo }));
446
+ }
447
+ catch (renderError) {
448
+ reportServerError(renderError, { source: 'request', request: c.req.raw, message: '[rshono] the error page failed to render:' });
449
+ }
450
+ }
451
+ const detail = isDev ? `\n\n${error instanceof Error ? (error.stack ?? error.message) : String(error)}` : '';
452
+ return c.text(`Internal Server Error${detail}`, 500, { vary: 'Accept' });
453
+ });
454
+ return app;
455
+ }
456
+ export const app = buildApp();
457
+ /**
458
+ * The app, handed to whatever is hosting it.
459
+ *
460
+ * On a platform where rshono owns the process this binds a port and the default export is nothing;
461
+ * where the host owns it, this *is* the export the platform looks for — so the same entry serves
462
+ * both without a per-platform entry file. `app` and `routes` stay named exports either way, because
463
+ * `rshono build` imports them to prerender `render: 'static'` routes.
464
+ */
465
+ export default runtime.serveApp(app);
466
+ //# sourceMappingURL=entry.rsc.js.map