@rshono/core 1.0.0-rc.12 → 1.0.0-rc.13

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 (143) hide show
  1. package/bin/rshono.mjs +3 -4
  2. package/dist/builder/env-shadow-loader.cjs +5 -5
  3. package/dist/builder/page-files.js +5 -5
  4. package/dist/builder/page-files.js.map +1 -1
  5. package/dist/builder/public-env.d.ts +5 -4
  6. package/dist/builder/public-env.d.ts.map +1 -1
  7. package/dist/builder/public-env.js +5 -4
  8. package/dist/builder/public-env.js.map +1 -1
  9. package/dist/builder/rspack-config.d.ts +5 -11
  10. package/dist/builder/rspack-config.d.ts.map +1 -1
  11. package/dist/builder/rspack-config.js +28 -50
  12. package/dist/builder/rspack-config.js.map +1 -1
  13. package/dist/cli/build.js +2 -2
  14. package/dist/cli/build.js.map +1 -1
  15. package/dist/cli/dev.d.ts.map +1 -1
  16. package/dist/cli/dev.js +30 -40
  17. package/dist/cli/dev.js.map +1 -1
  18. package/dist/cli/index.js +4 -4
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli/start.d.ts.map +1 -1
  21. package/dist/cli/start.js +2 -3
  22. package/dist/cli/start.js.map +1 -1
  23. package/dist/config.d.ts +28 -31
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/config.js +2 -2
  26. package/dist/config.js.map +1 -1
  27. package/dist/deploy/aws-lambda/runtime.d.ts +4 -6
  28. package/dist/deploy/aws-lambda/runtime.d.ts.map +1 -1
  29. package/dist/deploy/aws-lambda/runtime.js +5 -8
  30. package/dist/deploy/aws-lambda/runtime.js.map +1 -1
  31. package/dist/deploy/build-marker.d.ts +3 -5
  32. package/dist/deploy/build-marker.d.ts.map +1 -1
  33. package/dist/deploy/build-marker.js +3 -5
  34. package/dist/deploy/build-marker.js.map +1 -1
  35. package/dist/deploy/cloudflare/build.d.ts.map +1 -1
  36. package/dist/deploy/cloudflare/build.js +6 -10
  37. package/dist/deploy/cloudflare/build.js.map +1 -1
  38. package/dist/deploy/cloudflare/runtime.d.ts +2 -5
  39. package/dist/deploy/cloudflare/runtime.d.ts.map +1 -1
  40. package/dist/deploy/cloudflare/runtime.js +19 -32
  41. package/dist/deploy/cloudflare/runtime.js.map +1 -1
  42. package/dist/deploy/contract.d.ts +25 -42
  43. package/dist/deploy/contract.d.ts.map +1 -1
  44. package/dist/deploy/contract.js.map +1 -1
  45. package/dist/deploy/filesystem.d.ts +3 -5
  46. package/dist/deploy/filesystem.d.ts.map +1 -1
  47. package/dist/deploy/filesystem.js +7 -11
  48. package/dist/deploy/filesystem.js.map +1 -1
  49. package/dist/deploy/node/runtime.d.ts +4 -5
  50. package/dist/deploy/node/runtime.d.ts.map +1 -1
  51. package/dist/deploy/node/runtime.js +9 -15
  52. package/dist/deploy/node/runtime.js.map +1 -1
  53. package/dist/deploy/presets.d.ts +19 -29
  54. package/dist/deploy/presets.d.ts.map +1 -1
  55. package/dist/deploy/presets.js +18 -25
  56. package/dist/deploy/presets.js.map +1 -1
  57. package/dist/deploy/vercel/build.d.ts.map +1 -1
  58. package/dist/deploy/vercel/build.js +9 -12
  59. package/dist/deploy/vercel/build.js.map +1 -1
  60. package/dist/deploy/vercel/runtime.d.ts +4 -7
  61. package/dist/deploy/vercel/runtime.d.ts.map +1 -1
  62. package/dist/deploy/vercel/runtime.js +4 -7
  63. package/dist/deploy/vercel/runtime.js.map +1 -1
  64. package/dist/index.d.ts +13 -9
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +15 -12
  67. package/dist/index.js.map +1 -1
  68. package/dist/router.d.ts +65 -93
  69. package/dist/router.d.ts.map +1 -1
  70. package/dist/router.js +2 -5
  71. package/dist/router.js.map +1 -1
  72. package/dist/runtime/boundaries.d.ts +24 -30
  73. package/dist/runtime/boundaries.d.ts.map +1 -1
  74. package/dist/runtime/boundaries.js +15 -22
  75. package/dist/runtime/boundaries.js.map +1 -1
  76. package/dist/runtime/client.d.ts +16 -7
  77. package/dist/runtime/client.d.ts.map +1 -1
  78. package/dist/runtime/client.js +16 -7
  79. package/dist/runtime/client.js.map +1 -1
  80. package/dist/runtime/context.d.ts +89 -118
  81. package/dist/runtime/context.d.ts.map +1 -1
  82. package/dist/runtime/context.js +107 -167
  83. package/dist/runtime/context.js.map +1 -1
  84. package/dist/runtime/control.js +3 -3
  85. package/dist/runtime/control.js.map +1 -1
  86. package/dist/runtime/dev-protocol.d.ts +4 -8
  87. package/dist/runtime/dev-protocol.d.ts.map +1 -1
  88. package/dist/runtime/dev-protocol.js.map +1 -1
  89. package/dist/runtime/entry.client.js +69 -105
  90. package/dist/runtime/entry.client.js.map +1 -1
  91. package/dist/runtime/entry.rsc.d.ts +5 -6
  92. package/dist/runtime/entry.rsc.d.ts.map +1 -1
  93. package/dist/runtime/entry.rsc.js +67 -122
  94. package/dist/runtime/entry.rsc.js.map +1 -1
  95. package/dist/runtime/entry.ssr.d.ts +7 -12
  96. package/dist/runtime/entry.ssr.d.ts.map +1 -1
  97. package/dist/runtime/entry.ssr.js +13 -24
  98. package/dist/runtime/entry.ssr.js.map +1 -1
  99. package/dist/runtime/flight-inject.d.ts +10 -17
  100. package/dist/runtime/flight-inject.d.ts.map +1 -1
  101. package/dist/runtime/flight-inject.js +35 -53
  102. package/dist/runtime/flight-inject.js.map +1 -1
  103. package/dist/runtime/hot-update.d.ts +20 -27
  104. package/dist/runtime/hot-update.d.ts.map +1 -1
  105. package/dist/runtime/hot-update.js +17 -23
  106. package/dist/runtime/hot-update.js.map +1 -1
  107. package/dist/runtime/navigation.d.ts +14 -19
  108. package/dist/runtime/navigation.d.ts.map +1 -1
  109. package/dist/runtime/navigation.js +9 -13
  110. package/dist/runtime/navigation.js.map +1 -1
  111. package/dist/runtime/request.d.ts +4 -6
  112. package/dist/runtime/request.d.ts.map +1 -1
  113. package/dist/runtime/request.js +2 -3
  114. package/dist/runtime/request.js.map +1 -1
  115. package/dist/runtime/server.d.ts +18 -10
  116. package/dist/runtime/server.d.ts.map +1 -1
  117. package/dist/runtime/server.js +21 -19
  118. package/dist/runtime/server.js.map +1 -1
  119. package/dist/server/headers.d.ts +8 -15
  120. package/dist/server/headers.d.ts.map +1 -1
  121. package/dist/server/headers.js +8 -15
  122. package/dist/server/headers.js.map +1 -1
  123. package/dist/server/load-config.d.ts +2 -2
  124. package/dist/server/load-config.d.ts.map +1 -1
  125. package/dist/server/load-config.js +6 -9
  126. package/dist/server/load-config.js.map +1 -1
  127. package/dist/server/prerendered.d.ts +30 -43
  128. package/dist/server/prerendered.d.ts.map +1 -1
  129. package/dist/server/prerendered.js +20 -29
  130. package/dist/server/prerendered.js.map +1 -1
  131. package/dist/server/server-config.d.ts +13 -28
  132. package/dist/server/server-config.d.ts.map +1 -1
  133. package/dist/server/server-config.js +5 -10
  134. package/dist/server/server-config.js.map +1 -1
  135. package/dist/server/shutdown.d.ts +2 -3
  136. package/dist/server/shutdown.d.ts.map +1 -1
  137. package/dist/server/shutdown.js +2 -3
  138. package/dist/server/shutdown.js.map +1 -1
  139. package/dist/server/ssg.d.ts +3 -6
  140. package/dist/server/ssg.d.ts.map +1 -1
  141. package/dist/server/ssg.js +11 -20
  142. package/dist/server/ssg.js.map +1 -1
  143. package/package.json +1 -1
@@ -1 +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,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,iGAAiG;AACjG,2EAA2E;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;A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K,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;IACrG,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 { isControlDigest, parseRedirectDigest } from './control.js';\nimport type { DevMessage } from './dev-protocol.js';\nimport type { RscPayload } from './entry.rsc.js';\n// Dev-only, and reached only from inside an `import.meta.webpackHot` branch — which a production\n// build compiles to `false`, leaving this module unreferenced and dropped.\nimport { walkHotUpdates } from './hot-update.js';\nimport { RouterContext, type NavigationRouter } from './navigation.js';\nimport { createRscRequest } from './request.js';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\ndeclare global {\n /** The array the payload `<script>` tags `flight-inject.ts` emits push their chunks into. */\n var __FLIGHT_DATA: Array<string | Uint8Array> | undefined;\n}\n\n/** The flight payload the document carried, read back out of `__FLIGHT_DATA` — see `flight-inject.ts`, which writes it. */\nfunction readFlightPayload(): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n // Assigned synchronously by `start`, which `new ReadableStream` runs before it returns.\n let controller!: ReadableStreamDefaultController<Uint8Array>;\n const stream = new ReadableStream<Uint8Array>({\n start: (c) => void (controller = c),\n });\n const enqueue = (chunk: string | Uint8Array) => controller.enqueue(typeof chunk === 'string' ? encoder.encode(chunk) : chunk);\n\n // Payload scripts interleave with the document, so some have already run by the time this module\n // is evaluated — those are in the array — and the rest run after it, arriving through `push`.\n const data = (self.__FLIGHT_DATA ??= []);\n for (const chunk of data) enqueue(chunk);\n data.push = enqueue as typeof data.push;\n\n // The last payload script lands before the document finishes parsing, so that is what says there\n // is no more of it to come.\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => controller.close(), { once: true });\n } else {\n controller.close();\n }\n return stream;\n}\n\n/** Created at module evaluation, not inside `main()`, so no chunk can be pushed before it is watching. */\nconst flightStream = readFlightPayload();\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/**\n * Asks a URL for its flight payload.\n *\n * Deliberately uncached: every navigation fetches at the moment it is asked for, so a payload can\n * never be staler than the click that wanted it, and the browser's own HTTP cache is what makes a\n * repeat visit cheap.\n */\nfunction requestPayload(href: string): Promise<RscPayload> {\n return createFromFetch<RscPayload>(fetch(createRscRequest(new URL(href, location.href).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>(flightStream);\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 // A refresh keeps the URL, so it can't ride the history patch like push/replace — it drives the\n // flight re-fetch directly.\n const refresh = () =>\n startNav(async () => {\n try {\n await fetchRscPayload();\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() {\n let payload: RscPayload;\n try {\n payload = await requestPayload(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 // The scroll a fetched navigation still owes, held until its payload is on screen.\n const pendingScroll = React.useRef<(() => void) | null>(null);\n\n React.useEffect(() => {\n setPayload = (v) => setPayloadState(v);\n startNav = (run) => startTransition(run);\n }, [startTransition]);\n\n /**\n * Scrolls where the navigation asked, once React has put its payload in the DOM.\n *\n * This has to wait for the commit rather than the fetch: a `#hash` target does not exist until the\n * new tree does, and until then the page a scroll would move is still the outgoing one. A layout\n * effect runs before the browser paints, so the pre-scroll position is never on screen.\n */\n React.useLayoutEffect(() => {\n const scroll = pendingScroll.current;\n pendingScroll.current = null;\n scroll?.();\n }, [payload]);\n\n React.useEffect(() => {\n const stopNavigating = listenNavigation((afterRender) =>\n startNav(async () => {\n try {\n await fetchRscPayload();\n pendingScroll.current = afterRender;\n } catch {\n window.location.reload();\n }\n }),\n );\n const stopUpgradingLinks = listenLinks();\n return () => {\n stopUpgradingLinks();\n stopNavigating();\n };\n }, []);\n\n const router = React.useMemo<NavigationRouter>(() => ({ push, replace, 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 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 reaches us through React: it\n // rides the flight payload as an error at that component's position, and boundaries re-throw it\n // (see boundaries.tsx) so it lands here rather than rendering an error fallback.\n //\n // Installing these hooks opts out of React's own defaults, so anything that isn't a control signal\n // has to be put back by hand: console for a caught error, `reportError` (i.e. window.onerror, so\n // error-reporting tools still see it) for an uncaught one.\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 initDevRefresh(fetchRscPayload);\n }\n}\n\ntype NavigationType = 'push' | 'replace' | 'pop';\n\n/**\n * Runs teardown in reverse and empties the list, so a second call is a no-op. Collecting these as\n * setup goes keeps each undo next to the thing it undoes.\n */\nfunction disposeAll(undo: Array<() => void>): void {\n for (const dispose of undo.splice(0).reverse()) dispose();\n}\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\n/**\n * Upgrades the app's anchors: a plain left-click becomes a soft navigation.\n *\n * Kept apart from `listenNavigation` because the two share no state — a click here only calls\n * `history.pushState`, which is where that function picks the navigation up.\n */\nfunction listenLinks(): () => void {\n const undo: Array<() => void> = [];\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 undo.push(() => document.removeEventListener('click', onClick));\n\n return () => disposeAll(undo);\n}\n\n/**\n * The element the current `#fragment` names, if it is on the page.\n *\n * A fragment is percent-encoded and an `id` attribute is not, so it has to be decoded first. A\n * hand-written URL can carry a `%` that is not an escape, which throws — take the fragment literally\n * then, since that is the closest thing to an id it could have meant.\n */\nfunction fragmentTarget(): HTMLElement | null {\n const fragment = location.hash.slice(1);\n if (!fragment) return null;\n let id = fragment;\n try {\n id = decodeURIComponent(fragment);\n } catch {}\n return document.getElementById(id);\n}\n\nfunction listenNavigation(onNavigation: (afterRender: () => void) => void): () => void {\n const undo: Array<() => void> = [];\n\n // Scroll restoration is the browser's. `auto` is set explicitly rather than left at the default,\n // because it is a statement: the browser remembers a traversal's offset for us, and nothing here\n // tracks one.\n const prevRestoration = window.history.scrollRestoration;\n try {\n window.history.scrollRestoration = 'auto';\n } catch {}\n undo.push(() => {\n try {\n window.history.scrollRestoration = prevRestoration;\n } catch {}\n });\n\n /**\n * A push is not a real navigation to the browser, so nothing resets the scroll offset — without\n * this a click through to a new page lands wherever the last one was scrolled to. A `#hash` names\n * where to land instead, and one naming nothing on the page falls back to the top, as a browser\n * does. `replace` keeps its position deliberately, and a traversal is the browser's to restore.\n *\n * `scrollIntoView` rather than `scrollTo`, because it is the algorithm a browser's own fragment jump\n * uses — so `scroll-padding-top` still applies. Neither call passes a `behavior`, leaving\n * `scroll-behavior: smooth` the app's to ask for.\n *\n * The caller decides *when* this runs; for a navigation that fetched a payload it has to be after\n * the commit — see the layout effect in `BrowserRoot`.\n */\n const afterRenderFor = (type: NavigationType) => () => {\n if (type !== 'push') return;\n const target = fragmentTarget();\n if (target) target.scrollIntoView();\n else window.scrollTo(0, 0);\n };\n\n const documentUrl = () => location.pathname + location.search;\n\n // What the payload on screen was rendered for. Only the document part: the server never sees the\n // fragment, so two URLs differing by one render identically.\n let renderedUrl = documentUrl();\n\n /**\n * A navigation that moves only the fragment — `#a` → `#b`, or back out of a same-page anchor —\n * leaves the document unchanged, so the payload already on screen is the right one. Fetching\n * another would be a wasted round-trip that re-renders the page out from under the jump.\n *\n * `router.refresh()` is unaffected: it drives the re-fetch directly rather than through here, and\n * remains the way to ask for fresh data at an unchanged URL.\n */\n const notify = (type: NavigationType) => {\n const afterRender = afterRenderFor(type);\n if (documentUrl() === renderedUrl) {\n afterRender();\n return;\n }\n renderedUrl = documentUrl();\n onNavigation(afterRender);\n };\n\n const onPopState = () => notify('pop');\n window.addEventListener('popstate', onPopState);\n undo.push(() => window.removeEventListener('popstate', onPopState));\n\n const oldPushState = window.history.pushState;\n window.history.pushState = function (state, unused, url) {\n const res = oldPushState.call(this, state, unused, url as string);\n notify('push');\n return res;\n };\n undo.push(() => {\n window.history.pushState = oldPushState;\n });\n\n const oldReplaceState = window.history.replaceState;\n window.history.replaceState = function (state, unused, url) {\n const res = oldReplaceState.call(this, state, unused, url as string);\n notify('replace');\n return res;\n };\n undo.push(() => {\n window.history.replaceState = oldReplaceState;\n });\n\n return () => disposeAll(undo);\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); anything the page can't be patched\n * up to falls back to a reload — see walkHotUpdates.\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 const hot = import.meta.webpackHot!;\n let connectedOnce = false;\n /** The newest build the dev server has announced — what {@link applyClientUpdate} walks towards. */\n let targetHash: string | undefined;\n\n /** Gives up on patching the page and takes the whole document from the dev server instead. */\n function reload(reason: string, error?: unknown): void {\n console.warn(`[rshono] ${reason} — reloading`, ...(error === undefined ? [] : [error]));\n window.location.reload();\n }\n\n async function applyClientUpdate(): Promise<void> {\n const giveUp = await walkHotUpdates(\n hot,\n () => __webpack_hash__,\n () => targetHash,\n );\n if (giveUp) reload(giveUp.reason, giveUp.error);\n }\n\n async function handle(message: DevMessage): Promise<void> {\n switch (message.type) {\n case 'hello':\n targetHash = message.hash ?? targetHash;\n if (connectedOnce) {\n await applyClientUpdate();\n await fetchRscPayload().catch(() => window.location.reload());\n }\n connectedOnce = true;\n break;\n case 'client-built':\n targetHash = message.hash;\n await applyClientUpdate();\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 const source = new EventSource('/_rshono/hmr');\n // Chained rather than handled as they arrive: a burst of saves puts several frames on the wire\n // inside the time one `hot.check` takes, and two of those overlapping is an error webpack throws\n // on (\"check() is only allowed in idle status\") — which would turn every burst into a full reload.\n // Nothing is dropped by queueing, because `targetHash` is shared: whichever handler runs next\n // walks to the newest build rather than to the one its own frame named.\n let queue: Promise<void> = Promise.resolve();\n source.onmessage = (event) => {\n const message = JSON.parse(event.data) as DevMessage;\n queue = queue.then(() => handle(message)).catch((error) => reload('the dev client failed', error));\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"]}
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,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGpE,sGAAsG;AACtG,6CAA6C;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAOrD,0GAA0G;AAC1G,SAAS,iBAAiB;IACxB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,wFAAwF;IACxF,IAAI,UAAwD,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,cAAc,CAAa;QAC5C,KAAK,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createFromReadableStream,\n createTemporaryReferenceSet,\n encodeReply,\n setServerCallback,\n} from 'react-server-dom-rspack/client.browser';\nimport { isControlDigest, parseRedirectDigest } from './control.js';\nimport type { DevMessage } from './dev-protocol.js';\nimport type { RscPayload } from './entry.rsc.js';\n// Dev-only: its one caller sits behind `import.meta.webpackHot`, which a production build compiles to\n// `false` — so this module is dropped there.\nimport { walkHotUpdates } from './hot-update.js';\nimport { RouterContext, type NavigationRouter } from './navigation.js';\nimport { createRscRequest } from './request.js';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\ndeclare global {\n /** The array the payload `<script>` tags `flight-inject.ts` emits push their chunks into. */\n var __FLIGHT_DATA: Array<string | Uint8Array> | undefined;\n}\n\n/** The flight payload the document carried, read back out of `__FLIGHT_DATA` — see `flight-inject.ts`. */\nfunction readFlightPayload(): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n // Assigned synchronously by `start`, which `new ReadableStream` runs before it returns.\n let controller!: ReadableStreamDefaultController<Uint8Array>;\n const stream = new ReadableStream<Uint8Array>({\n start: (c) => void (controller = c),\n });\n const enqueue = (chunk: string | Uint8Array) => controller.enqueue(typeof chunk === 'string' ? encoder.encode(chunk) : chunk);\n\n // Payload scripts interleave with the document: the ones that already ran are in the array, the rest\n // arrive through `push`.\n const data = (self.__FLIGHT_DATA ??= []);\n for (const chunk of data) enqueue(chunk);\n data.push = enqueue as typeof data.push;\n\n // The last payload script lands before parsing finishes, so that is what closes the stream.\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => controller.close(), { once: true });\n } else {\n controller.close();\n }\n return stream;\n}\n\n/** Created at module evaluation, not inside `main()`, so no chunk can be pushed before it is watching. */\nconst flightStream = readFlightPayload();\n\n/** Guarantees somewhere to attach the fatal overlay: the root container is `document`, so a teardown can take `<body>` with it. */\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 * Paints the reason for an uncaught render error over the blank page it leaves behind — the full stack in\n * dev, a generic notice and a reload button in production.\n *\n * DOM calls rather than React (the renderer is what just failed), and `textContent` rather than\n * `innerHTML` (an error message is untrusted input).\n */\nfunction showFatal(error: unknown, componentStack?: string | null): void {\n // Queued: React's teardown runs after this callback returns and would remove a node appended inline.\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');\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/**\n * Asks a URL for its flight payload. Deliberately uncached — a payload can never be staler than the click\n * that wanted it, and the browser's own HTTP cache is what makes a repeat visit cheap.\n */\nfunction requestPayload(href: string): Promise<RscPayload> {\n return createFromFetch<RscPayload>(fetch(createRscRequest(new URL(href, location.href).href)));\n}\n\nasync function main() {\n // The assertion is load-bearing under the compiler that builds this: TypeScript 7 declares `nonce` on\n // HTMLElement, 6 declares it on Element. ESLint runs the older lib — where the narrowing is redundant —\n // so it reports an assertion that `tsc` requires. Believe `typecheck`, not the rule.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\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 cover the window before hydration, where\n // `setServerCallback` is already registered but there is no root to update — a reload is the honest answer.\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>(flightStream);\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 // A refresh keeps the URL, so it can't ride the history patch like push/replace and drives the re-fetch itself.\n const refresh = () =>\n startNav(async () => {\n try {\n await fetchRscPayload();\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 fall through to their own handling.\n *\n * `hard` forces a full document load, for signals that surfaced *through React*: it unmounts the root on\n * an uncaught error, leaving no live tree to soft-navigate with.\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() {\n let payload: RscPayload;\n try {\n payload = await requestPayload(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 // The scroll a fetched navigation still owes, held until its payload is on screen.\n const pendingScroll = React.useRef<(() => void) | null>(null);\n\n React.useEffect(() => {\n setPayload = (v) => setPayloadState(v);\n startNav = (run) => startTransition(run);\n }, [startTransition]);\n\n /**\n * Scrolls where the navigation asked, once React has put its payload in the DOM — a `#hash` target does\n * not exist until the new tree does. A layout effect, so the pre-scroll position is never painted.\n */\n React.useLayoutEffect(() => {\n const scroll = pendingScroll.current;\n pendingScroll.current = null;\n scroll?.();\n }, [payload]);\n\n React.useEffect(() => {\n const stopNavigating = listenNavigation((afterRender) =>\n startNav(async () => {\n try {\n await fetchRscPayload();\n pendingScroll.current = afterRender;\n } catch {\n window.location.reload();\n }\n }),\n );\n const stopUpgradingLinks = listenLinks();\n return () => {\n stopUpgradingLinks();\n stopNavigating();\n };\n }, []);\n\n const router = React.useMemo<NavigationRouter>(() => ({ push, replace, 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 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 reaches us through React: it rides the\n // flight payload as an error, and boundaries re-throw it so it lands here rather than in a fallback.\n //\n // Installing these hooks opts out of React's own defaults, so everything that isn't a control signal has to\n // be put back by hand — `reportError` rather than a bare log, so error-reporting tools still see it.\n hydrateRoot(document, <BrowserRoot />, {\n formState: initialPayload.formState,\n onCaughtError: (error, errorInfo) => {\n if (handleControlDigest(error, { hard: true })) return;\n // A boundary handled it and the tree is intact, so no overlay over the app's own fallback.\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`.\n globalThis.reportError(error);\n showFatal(error, errorInfo.componentStack);\n },\n });\n\n if (import.meta.webpackHot) {\n initDevRefresh(fetchRscPayload);\n }\n}\n\ntype NavigationType = 'push' | 'replace' | 'pop';\n\n/** Runs teardown in reverse and empties the list, so a second call is a no-op. */\nfunction disposeAll(undo: Array<() => void>): void {\n for (const dispose of undo.splice(0).reverse()) dispose();\n}\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\n/**\n * Upgrades the app's anchors: a plain left-click becomes a soft navigation. It shares no state with\n * `listenNavigation` — a click only calls `history.pushState`, which is where that picks the navigation up.\n */\nfunction listenLinks(): () => void {\n const undo: Array<() => void> = [];\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 undo.push(() => document.removeEventListener('click', onClick));\n\n return () => disposeAll(undo);\n}\n\n/**\n * The element the current `#fragment` names, if it is on the page. A fragment is percent-encoded and an `id`\n * is not, so it is decoded first — and taken literally when a hand-written `%` makes that throw.\n */\nfunction fragmentTarget(): HTMLElement | null {\n const fragment = location.hash.slice(1);\n if (!fragment) return null;\n let id = fragment;\n try {\n id = decodeURIComponent(fragment);\n } catch {\n // Malformed escape — the literal fragment is the better guess at the id than nothing.\n }\n return document.getElementById(id);\n}\n\nfunction listenNavigation(onNavigation: (afterRender: () => void) => void): () => void {\n const undo: Array<() => void> = [];\n\n // Set explicitly as a statement of intent: the browser remembers a traversal's offset, and nothing here\n // tracks one.\n const prevRestoration = window.history.scrollRestoration;\n try {\n window.history.scrollRestoration = 'auto';\n } catch {\n // Not settable in every browser, and only a preference — the navigation still works without it.\n }\n undo.push(() => {\n try {\n window.history.scrollRestoration = prevRestoration;\n } catch {\n // As above: if it could not be set, it cannot be put back either.\n }\n });\n\n /**\n * A push is not a real navigation to the browser, so nothing resets the scroll offset. A `#hash` names\n * where to land instead; `replace` keeps its position, and a traversal is the browser's to restore.\n *\n * `scrollIntoView` is the algorithm a browser's own fragment jump uses, so `scroll-padding-top` still\n * applies. Neither call passes a `behavior`, leaving `scroll-behavior: smooth` the app's to ask for.\n */\n const afterRenderFor = (type: NavigationType) => () => {\n if (type !== 'push') return;\n const target = fragmentTarget();\n if (target) target.scrollIntoView();\n else window.scrollTo(0, 0);\n };\n\n const documentUrl = () => location.pathname + location.search;\n\n // What the payload on screen was rendered for. The document part only: the server never sees the fragment.\n let renderedUrl = documentUrl();\n\n /**\n * A navigation that moves only the fragment leaves the document unchanged, so the payload on screen is\n * already the right one — fetching another would re-render the page out from under the jump.\n * `router.refresh()` is unaffected, and remains the way to ask for fresh data at an unchanged URL.\n */\n const notify = (type: NavigationType) => {\n const afterRender = afterRenderFor(type);\n if (documentUrl() === renderedUrl) {\n afterRender();\n return;\n }\n renderedUrl = documentUrl();\n onNavigation(afterRender);\n };\n\n const onPopState = () => notify('pop');\n window.addEventListener('popstate', onPopState);\n undo.push(() => window.removeEventListener('popstate', onPopState));\n\n // Saved unbound on purpose, and called back with `.call(this, …)` below — patching `history` is the only\n // way to see a navigation the app makes itself, and the receiver is restored at every call site.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const oldPushState = window.history.pushState;\n window.history.pushState = function (state, unused, url) {\n const res = oldPushState.call(this, state, unused, url as string);\n notify('push');\n return res;\n };\n undo.push(() => {\n window.history.pushState = oldPushState;\n });\n\n // eslint-disable-next-line @typescript-eslint/unbound-method -- as with `pushState` above.\n const oldReplaceState = window.history.replaceState;\n window.history.replaceState = function (state, unused, url) {\n const res = oldReplaceState.call(this, state, unused, url as string);\n notify('replace');\n return res;\n };\n undo.push(() => {\n window.history.replaceState = oldReplaceState;\n });\n\n return () => disposeAll(undo);\n}\n\n/**\n * Dev-only refresh client, listening to the CLI's SSE endpoint:\n *\n * client-built → hot-apply the waiting updates; anything the page can't be patched up to reloads.\n * rsc-update → server component code changed: re-fetch the flight payload, state preserved.\n * hello → sent on (re)connect with the latest build hash; a mismatch means a missed event.\n */\nfunction initDevRefresh(fetchRscPayload: () => Promise<void>) {\n const hot = import.meta.webpackHot!;\n let connectedOnce = false;\n /** The newest build the dev server has announced — what {@link applyClientUpdate} walks towards. */\n let targetHash: string | undefined;\n\n function reload(reason: string, error?: unknown): void {\n console.warn(`[rshono] ${reason} — reloading`, ...(error === undefined ? [] : [error]));\n window.location.reload();\n }\n\n async function applyClientUpdate(): Promise<void> {\n const giveUp = await walkHotUpdates(\n hot,\n () => __webpack_hash__,\n () => targetHash,\n );\n if (giveUp) reload(giveUp.reason, giveUp.error);\n }\n\n async function handle(message: DevMessage): Promise<void> {\n switch (message.type) {\n case 'hello':\n targetHash = message.hash ?? targetHash;\n if (connectedOnce) {\n await applyClientUpdate();\n await fetchRscPayload().catch(() => window.location.reload());\n }\n connectedOnce = true;\n break;\n case 'client-built':\n targetHash = message.hash;\n await applyClientUpdate();\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 const source = new EventSource('/_rshono/hmr');\n // Chained rather than handled as they arrive: `hot.check` may only run from `idle`, and a burst of saves\n // puts several frames on the wire inside the time one takes. Queueing drops nothing, because `targetHash`\n // is shared — whichever handler runs next walks to the newest build.\n let queue: Promise<void> = Promise.resolve();\n source.onmessage = (event: MessageEvent<string>) => {\n const message = JSON.parse(event.data) as DevMessage;\n queue = queue.then(() => handle(message)).catch((error) => reload('the dev client failed', error));\n };\n}\n\n// A bootstrap failure — a truncated initial payload, most likely — would otherwise be an unhandled\n// 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"]}
@@ -3,7 +3,7 @@ import type React from 'react';
3
3
  import type { ReactFormState } from 'react-dom/client';
4
4
  import { type Route } from '../router.js';
5
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. */
6
+ /** The result of a server action, as a `Result<T, E>` rather than an `ok` flag over one field. */
7
7
  export type ActionResult = {
8
8
  ok: true;
9
9
  value: unknown;
@@ -20,12 +20,11 @@ export type RscPayload = {
20
20
  };
21
21
  export declare const app: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
22
22
  /**
23
- * The app, handed to whatever is hosting it.
23
+ * The app, handed to whatever is hosting it: this binds a port and exports nothing where rshono owns the
24
+ * process, and *is* the export the platform looks for where the host owns it — so one entry serves both.
24
25
  *
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.
26
+ * `app` and `routes` stay named exports either way, because `rshono build` imports them to prerender
27
+ * `render: 'static'` routes.
29
28
  */
30
29
  declare const _default: unknown;
31
30
  export default _default;
@@ -1 +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;AAO5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwBvD,OAAO,EAA0F,KAAK,KAAK,EAAoB,MAAM,cAAc,CAAC;AAgCpJ,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;AAqbF,eAAO,MAAM,GAAG,4EAAa,CAAC;AAE9B;;;;;;;GAOG"}
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;AAK5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAsBvD,OAAO,EAA0F,KAAK,KAAK,EAAoB,MAAM,cAAc,CAAC;AAwBpJ,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAAuB,CAAC;AAE3D,kGAAkG;AAClG,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;AAyYF,eAAO,MAAM,GAAG,4EAAa,CAAC;AAE9B;;;;;;GAMG"}
@@ -1,15 +1,13 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Hono } from 'hono';
3
3
  import { HTTPException } from 'hono/http-exception';
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`.
4
+ // Called directly rather than as `<Page {...props} />`: a spread would drop the non-enumerable `ctx`
5
+ // prop. See `pageProps`.
6
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, and the RSC layer's `conditionNames` picks one — so a non-Node deploy target gets its
9
- // own build rather than Node's by hard-coded path.
7
+ // The bare specifier, not `/server.node`: the RSC layer's `conditionNames` picks the build for the
8
+ // deploy target being compiled for.
10
9
  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`.
10
+ // Aliased at build time to the selected preset's runtime — the one place this file knows where it runs.
13
11
  import { runtime } from '@rshono/deploy';
14
12
  // @ts-expect-error — resolved by the '@rshono/routes' alias to the app's routes.ts
15
13
  import { routes as userRoutes } from '@rshono/routes';
@@ -23,34 +21,21 @@ import { renderHTML } from './entry.ssr.js';
23
21
  import { RouterProvider } from './navigation.js';
24
22
  import { acceptsRsc, isActionRequest, parseRenderRequest, requestWantsRsc, wantsRsc } from './request.js';
25
23
  const serverApp = (serverAppModule.default ?? null);
26
- // Framework settings resolved from rshono.config.ts and compiled into the bundle at build time (see
27
- // builder/rspack-config.ts). There is no runtime env-var interface for these — env is for secrets.
28
- // `isDev` among them: the build mode is decided by which command produced the bundle, and not every
29
- // runtime this deploys to has a `process.env.NODE_ENV` to read.
24
+ // Compiled into the bundle from rshono.config.ts by DefinePlugin; there is no runtime env-var interface.
30
25
  const { isDev } = __RSHONO_CONFIG__;
31
26
  /** How long a prerendered page may be reused before revalidating. Also what `public/` files get. */
32
27
  const SSG_CACHE_CONTROL = 'public, max-age=300';
33
- /**
34
- * The two content types a page can be served as. Both come back from the *same* URL depending on
35
- * the `Accept` header, which is what makes `Vary` non-optional here.
36
- */
28
+ /** The two content types a page can be served as, from the same URL — which is what makes `Vary` non-optional. */
37
29
  const PAGE_CONTENT_TYPE = /^(?:text\/html|text\/x-component)\b/;
38
- // Called here rather than at the top of the deploy runtime's own module so the timing is unchanged:
39
- // `.env` is loaded once every import above has been evaluated, exactly as before.
40
30
  runtime.loadEnv();
41
31
  const routeConfig = userRoutes;
42
32
  export const routes = routeConfig.routes;
43
33
  /**
44
34
  * The per-request CSP nonce, if the app asked for one.
45
35
  *
46
- * The framework does not mint this. `secureHeaders()` from `hono/secure-headers` does, when its
47
- * policy contains the `NONCE` placeholder, and it stores it here — so an app opts into a
48
- * nonce-based CSP by registering that middleware in `src/server.ts` and the framework's only job is
49
- * to stamp the value into the render.
50
- *
51
- * Readable from a route handler because `secureHeaders` resolves its directives *before* calling
52
- * `next()`; the header itself is written on the way back out. Absent when the app registered no CSP,
53
- * or one with no nonce in it — a fixed policy needs nothing from the render.
36
+ * The framework never mints it: `secureHeaders()` does, when its policy contains the `NONCE`
37
+ * placeholder, and stores it here — so all the framework does is stamp the value into the render. It is
38
+ * readable from a route handler because `secureHeaders` resolves its directives before `next()`.
54
39
  */
55
40
  function cspNonce(c) {
56
41
  return c.get('secureHeadersNonce');
@@ -75,20 +60,18 @@ function acceptsHtml(c) {
75
60
  }
76
61
  /**
77
62
  * The 404 for an app with no `notFound` page, and for a client that wanted neither HTML nor a flight
78
- * payload. Shared for the `Vary`: this is still one of the answers a page URL gives depending on
79
- * `Accept`, and a cache not told so can hand a plain-text 404 to a browser asking for a document.
63
+ * payload. It carries the `Vary` too: this is one of the answers a page URL gives depending on `Accept`.
80
64
  */
81
65
  function plainNotFound(c) {
82
66
  return c.text('Not Found', 404, { vary: 'Accept' });
83
67
  }
84
- /** A lazy once-cell: runs `load` at most once and caches the promise, but clears a rejection so a later call can retry. */
68
+ /** A lazy once-cell: runs `load` at most once, but clears a rejection so a later call can retry. */
85
69
  function once(load) {
86
70
  let promise;
87
71
  return () => {
88
72
  if (!promise) {
89
73
  const pending = (promise = load());
90
74
  pending.catch(() => {
91
- // Only clear if we're still holding the rejected promise (a later successful load may have already replaced it).
92
75
  if (promise === pending)
93
76
  promise = undefined;
94
77
  });
@@ -97,11 +80,8 @@ function once(load) {
97
80
  };
98
81
  }
99
82
  /**
100
- * Passes `stream` through untouched, calling `done` once it ends — however it ends.
101
- *
102
- * Used on the flight-only response path, which has no transform of its own to hang a completion hook
103
- * off (the document path has {@link injectFlightPayload}). `done` must be idempotent: a cancelled
104
- * response can reach both `cancel` and the abort forwarder.
83
+ * Passes `stream` through untouched, calling `done` however it ends — for the flight-only response
84
+ * path, which has no transform of its own to hang a completion hook off. `done` must be idempotent.
105
85
  */
106
86
  function releaseWhenDone(stream, done) {
107
87
  return stream.pipeThrough(new TransformStream({
@@ -115,23 +95,16 @@ function releaseWhenDone(stream, done) {
115
95
  /**
116
96
  * Builds the props a page component is called with.
117
97
  *
118
- * `url` and `params` match `useNavigation()` field for field, so a read can move between a page and a
119
- * `'use client'` component unchanged. The `URL` is this page's own, so mutating it cannot disturb
120
- * anything else on the request.
121
- *
122
- * `ctx` is *defined* rather than assigned, and both halves of how carry their weight:
98
+ * `ctx` is *defined* rather than assigned, and both halves are load-bearing:
123
99
  *
124
- * - **A getter**, so nothing is built for the pages that never read it, and so a `render: 'static'`
125
- * page that does read it gets {@link getRequestContext}'s "no per-request context while
126
- * prerendering" error rather than a bare `undefined`.
127
- * - **Non-enumerable**, so React's *development-only* serialization of a server component's props
128
- * (the debug channel behind component stacks and the performance track) skips it. That walks own
129
- * enumerable properties, and `ctx.hono` is the Hono {@link Context} — whose `env` holds the
130
- * runtime's bindings. An enumerable `ctx` would ship every one of them, secrets included, to the
131
- * browser in dev, and add well over 10 kB to a small page's flight payload.
100
+ * - **A getter**, so nothing is built for the pages that never read it, and a `render: 'static'` page
101
+ * that does gets {@link getRequestContext}'s prerendering error rather than a bare `undefined`.
102
+ * - **Non-enumerable**, so React's dev-only serialization of a server component's props skips it. That
103
+ * walks own enumerable properties, and `ctx.hono.env` holds the runtime's bindings — an enumerable
104
+ * `ctx` would ship every secret to the browser in dev.
132
105
  *
133
- * The cost is that the element has to be created by handing this object to `jsx()` *by reference*: a
134
- * `<Page {...props} />` spread copies enumerable properties only, and would drop `ctx` silently.
106
+ * The cost: the element is created by handing this object to `jsx()` by reference, since a
107
+ * `<Page {...props} />` spread would silently drop `ctx`.
135
108
  */
136
109
  function pageProps(c, errorInfo) {
137
110
  const props = { url: publicUrl(c), params: readParams(c), ...(errorInfo ? { error: errorInfo } : null) };
@@ -139,16 +112,11 @@ function pageProps(c, errorInfo) {
139
112
  return props;
140
113
  }
141
114
  async function renderComponent(c, Page, opts) {
142
- // A client going away aborts the render — but React's renderers must never be handed
143
- // `c.req.raw.signal` to watch for it. Both add an `abort` listener and only remove it if the abort
144
- // fires, so on the happy path that listener stays on a request-lifetime signal and through it pins
145
- // the flight request, the Fizz request and the whole rendered tree (~169 kB per `/ssr` request,
146
- // never reclaimed by a major GC).
147
- //
148
- // So the render gets a controller of its own and the request signal only forwards into it: the
149
- // forwarder is `once`, so an abort removes it, and `release` removes it on the normal path. Not
150
- // `AbortSignal.any()` — a signal it produced is *composite*, and Node holds every composite signal
151
- // carrying an `abort` listener in a process-lifetime set until it aborts or loses its last listener.
115
+ // React's renderers must never be handed `c.req.raw.signal`: they add an `abort` listener and only
116
+ // remove it if the abort fires, so on the happy path it stays on a request-lifetime signal and pins the
117
+ // whole rendered tree. The render gets its own controller and the request signal forwards into it —
118
+ // `release` detaches on the normal path. Not `AbortSignal.any()`, whose composite signals Node holds in
119
+ // a process-lifetime set until they abort.
152
120
  const requestSignal = c.req.raw.signal;
153
121
  const renderAbort = new AbortController();
154
122
  const signal = renderAbort.signal;
@@ -157,20 +125,16 @@ async function renderComponent(c, Page, opts) {
157
125
  renderAbort.abort(requestSignal.reason);
158
126
  else
159
127
  requestSignal.addEventListener('abort', forwardAbort, { once: true });
160
- /** Detaches the forwarder once the response has been written, so nothing survives the request. */
161
128
  const release = () => requestSignal.removeEventListener('abort', forwardAbort);
162
- // Documents only: the nonce goes on the bootstrap scripts and the `<meta>` React hydrates from,
163
- // and a flight payload has neither. Leaving it off there is also what keeps a prerendered flight
164
- // payload servable from disk under a nonce-based CSP.
129
+ // Documents only: the nonce goes on the bootstrap scripts and the `<meta>` React hydrates from, and a
130
+ // flight payload has neither — which is what keeps a prerendered one servable under a nonce-based CSP.
165
131
  const nonce = opts.isRsc ? undefined : cspNonce(c);
166
132
  const props = pageProps(c, opts.errorInfo);
167
133
  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) })] }));
168
- // `notFound` only when it is true, so the flight payload of an ordinary page doesn't carry the key.
134
+ // `notFound` only when true, so an ordinary page's payload doesn't carry the key.
169
135
  const rscPayload = { root, formState: opts.formState, returnValue: opts.returnValue, ...(opts.notFound ? { notFound: true } : null) };
170
- // Past this line the response head belongs to the framework, so `ctx.setHeader()` and
171
- // `ctx.cookies.set()` start throwing rather than writing somewhere nothing will read. It has to be
172
- // the last thing before the render: a server action ran earlier in `renderPage` and legitimately
173
- // writes to the response, and so does any middleware that wrapped this handler.
136
+ // The last thing before the render: past here the response head is the framework's, so `ctx.setHeader()`
137
+ // starts throwing — while the action `renderPage` just ran, and the middleware around it, legitimately wrote.
174
138
  beginPageRender(c);
175
139
  let controlSignal;
176
140
  const rscStream = renderToReadableStream(rscPayload, {
@@ -225,9 +189,8 @@ async function renderPage(c, loadPage) {
225
189
  let actionStatus;
226
190
  if (isActionRequest(renderRequest)) {
227
191
  if (renderRequest.kind === 'rsc-action') {
228
- // Checked before the body is decoded, so an unknown id costs nothing to reject — and
229
- // `loadServerAction` would otherwise fault on the missing manifest entry, turning a bad
230
- // request into an unhandled 500. `hasOwn` so `__proto__` doesn't resolve to a manifest entry.
192
+ // Before the body is decoded, so an unknown id costs nothing to reject. `hasOwn` so `__proto__`
193
+ // does not resolve to a manifest entry.
231
194
  if (!Object.hasOwn(__rspack_rsc_manifest__.serverManifest, renderRequest.actionId)) {
232
195
  return c.text('Bad Request: unknown server action', 400);
233
196
  }
@@ -237,13 +200,13 @@ async function renderPage(c, loadPage) {
237
200
  const args = await decodeReply(body, { temporaryReferences });
238
201
  const action = loadServerAction(renderRequest.actionId);
239
202
  try {
240
- returnValue = { ok: true, value: await action.apply(null, args) };
203
+ returnValue = { ok: true, value: await action(...args) };
241
204
  }
242
205
  catch (error) {
243
206
  if (isControlSignal(error))
244
207
  throw error;
245
- // React sends a thrown action error to the client as an opaque marker in production — no
246
- // message, no digest — so without this the failure would be invisible on both ends.
208
+ // In production React sends a thrown action error to the client as an opaque marker, so this is
209
+ // the only place the real one is visible.
247
210
  reportServerError(error, { source: 'action', request, message: '[rshono] server action error:' });
248
211
  returnValue = { ok: false, error };
249
212
  actionStatus = 500;
@@ -269,13 +232,10 @@ async function renderPage(c, loadPage) {
269
232
  }
270
233
  function buildApp() {
271
234
  const app = new Hono();
272
- // Baseline security headers: stop content-type sniffing, keep the full URL out of cross-origin
273
- // referrers, and refuse to be framed by another origin. A floor, not a policy — an app that wants
274
- // the full set registers `secureHeaders()` from `hono/secure-headers` in src/server.ts, and
275
- // because this is registered first it unwinds *last* and the "only if unset" checks stand aside
276
- // for whatever that set. Kept in the framework rather than left to the app because it is
277
- // registered ahead of `mountStaticAssets`, which is a terminal handler the sub-app never sees:
278
- // without this, `/_static/*` would carry no security headers at all.
235
+ // A floor, not a policy: an app wanting the full set registers `secureHeaders()` in src/server.ts, and
236
+ // because this is registered first it unwinds last, so the "only if unset" checks stand aside for it.
237
+ // Owned by the framework because it also has to cover `mountStaticAssets` — a terminal handler the
238
+ // app's own middleware never sees.
279
239
  app.use(async (c, next) => {
280
240
  await next();
281
241
  const headers = c.res.headers;
@@ -285,33 +245,26 @@ function buildApp() {
285
245
  headers.set('referrer-policy', 'strict-origin-when-cross-origin');
286
246
  if (!headers.has('x-frame-options'))
287
247
  headers.set('x-frame-options', 'SAMEORIGIN');
288
- // React Refresh compiles updates with `eval`, so a dev build cannot run under any CSP an app
289
- // would sensibly write for production. Widened here rather than asked of the app, so one policy
290
- // in src/server.ts serves both and nobody debugs a blocked HMR socket. Only ever in dev, and
291
- // only when the app has a `script-src` to widen.
248
+ // React Refresh compiles updates with `eval`, so a dev build cannot run under a production CSP.
249
+ // Widened here so one policy in src/server.ts serves both.
292
250
  if (isDev) {
293
251
  const csp = headers.get('content-security-policy');
294
252
  if (csp?.includes('script-src ')) {
295
253
  headers.set('content-security-policy', csp.replace('script-src ', "script-src 'unsafe-eval' "));
296
254
  }
297
255
  }
298
- // Page responses only, from here down: one URL answers with either an HTML document or a flight
299
- // payload depending on `Accept`, and the default page is request-specific.
256
+ // Page responses only from here down.
300
257
  if (!PAGE_CONTENT_TYPE.test(headers.get('content-type') ?? ''))
301
258
  return;
302
259
  appendVary(headers, 'Accept');
303
- // Without this a page carries no cache directives at all, and a shared cache — a CDN, a corporate
304
- // proxy — is free to store a logged-in user's page and hand it to someone else. `private` forbids
305
- // that; `no-cache` makes the browser revalidate rather than re-show a stale personalised page.
306
- // Neither blocks bfcache, which `no-store` would. A prerendered page already has its own value.
260
+ // Without a default a shared cache is free to store a logged-in user's page and hand it to someone
261
+ // else. `private, no-cache` forbids that without blocking bfcache, which `no-store` would.
307
262
  if (!headers.has('cache-control'))
308
263
  headers.set('cache-control', 'private, no-cache');
309
264
  });
310
265
  runtime.mountStaticAssets(app);
311
- // Mounted ahead of the page routes so the sub-app's middleware (auth, logging, trailing-slash,
312
- // and the security middleware the framework no longer owns — `csrf()`, `bodyLimit()`,
313
- // `secureHeaders()`) wraps page requests too. The flip side: a *terminal* handler in
314
- // src/server.ts at the same path as a page route wins over the page.
266
+ // Ahead of the page routes, so the app's own middleware (`csrf()`, `bodyLimit()`, auth, logging) wraps
267
+ // page requests too. The flip side: a *terminal* handler in src/server.ts shadows a page at the same path.
315
268
  if (serverApp) {
316
269
  app.route('/', serverApp);
317
270
  }
@@ -322,8 +275,7 @@ function buildApp() {
322
275
  const isRsc = requestWantsRsc(c.req.raw);
323
276
  if (signal instanceof RedirectSignal) {
324
277
  if (isRsc) {
325
- // No `signal`, deliberately — see `renderComponent`. This payload is two fields and no
326
- // component tree, so there is nothing worth aborting and nothing worth a listener.
278
+ // No `signal`: two fields and no component tree, so there is nothing worth aborting.
327
279
  return c.body(renderToReadableStream({ root: null, redirect: signal.location }), 200, {
328
280
  'content-type': 'text/x-component;charset=utf-8',
329
281
  });
@@ -337,29 +289,22 @@ function buildApp() {
337
289
  };
338
290
  for (const route of routes) {
339
291
  if (isPageRoute(route)) {
340
- // Both are fixed for the life of the process, so resolve them once here instead of per request.
292
+ // Both fixed for the life of the process, so resolved once rather than per request.
341
293
  const servesPrerendered = !isDev && route.render === 'static';
342
294
  const loadPage = once(() => loadPageModule(route.component, `"${route.path}"`));
343
295
  const handler = async (c) => {
344
296
  try {
345
297
  if (servesPrerendered && c.req.method === 'GET') {
346
298
  const isRsc = acceptsRsc(c.req.raw);
347
- // A prerendered file is one fixed set of bytes, so it cannot carry a per-request nonce:
348
- // where the app's CSP has one, the *document* has to be rendered per request. The flight
349
- // payload never carries a nonce, so it stays servable from the build either way.
350
- //
351
- // Decided per request rather than per build, which is what moving the CSP to
352
- // `secureHeaders()` buys: an app whose policy carries no `NONCE` keeps its prerendered
353
- // documents, where the old build-time `csp: true` flag gave every one of them up.
299
+ // One fixed set of bytes cannot carry a per-request nonce, so a document has to be rendered
300
+ // where the app's CSP has one. Decided per request, so an app whose policy carries no `NONCE`
301
+ // keeps its prerendered documents. A flight payload never carries a nonce either way.
354
302
  const mustRenderForNonce = !isRsc && cspNonce(c) !== undefined;
355
303
  if (!mustRenderForNonce) {
356
304
  const page = await runtime.readPrerendered(c, isRsc ? 'flight' : 'html');
357
- // A prerendered page is request-independent by construction, so it is safe to cache
358
- // publicly; the short max-age matches what `public/` files get, and the ETag turns the
359
- // revalidation that follows into a 304 rather than the page all over again.
360
- //
361
- // Answered outside `runWithContext`: no app code runs on this path, so there is no
362
- // `getRequestContext()` to serve and no reason to pay for the AsyncLocalStorage scope.
305
+ // Request-independent by construction, so it is safe to cache publicly; the ETag turns the
306
+ // revalidation that follows into a 304. Answered outside `runWithContext` — no app code runs
307
+ // on this path, so there is no `getRequestContext()` to serve.
363
308
  if (page !== null) {
364
309
  const headers = {
365
310
  'cache-control': SSG_CACHE_CONTROL,
@@ -387,6 +332,9 @@ function buildApp() {
387
332
  const loadEndpoint = once(() => route.server());
388
333
  const handler = async (c, next) => {
389
334
  const { handler: endpointHandler } = await loadEndpoint();
335
+ // Hono's `Handler` leaves its return parameter defaulted to `any`, so this hands back exactly what
336
+ // the app's own handler is declared to return — there is nothing narrower to assert here.
337
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
390
338
  return endpointHandler(c, next);
391
339
  };
392
340
  const method = route.method ?? 'all';
@@ -408,12 +356,10 @@ function buildApp() {
408
356
  app.onError(async (error, c) => {
409
357
  if (isControlSignal(error))
410
358
  return runWithContext(c, () => respondToControlSignal(c, error));
411
- // Registering an `onError` at all replaces Hono's default handler, which is what would otherwise
412
- // turn an `HTTPException` into the response it carries. Without this every middleware that
413
- // rejects a request by throwing one — `csrf()` with a 403, `bodyLimit()` with a 413, an app's own
414
- // `throw new HTTPException(401)` — would surface as a 500 error page instead of its own status.
415
- // Rebuilt through `c` rather than returned as-is, exactly as Hono's own default does, so headers
416
- // already prepared on the context (`c.header(…)` from middleware that ran first) survive.
359
+ // Registering an `onError` replaces Hono's default handler, which is what turns an `HTTPException`
360
+ // into the response it carries — without this, `csrf()`'s 403 and `bodyLimit()`'s 413 would both
361
+ // surface as a 500 error page. Rebuilt through `c`, as Hono's default does, so headers middleware
362
+ // already prepared survive.
417
363
  if (error instanceof HTTPException) {
418
364
  const res = error.getResponse();
419
365
  return c.newResponse(res.body, res);
@@ -441,12 +387,11 @@ function buildApp() {
441
387
  }
442
388
  export const app = buildApp();
443
389
  /**
444
- * The app, handed to whatever is hosting it.
390
+ * The app, handed to whatever is hosting it: this binds a port and exports nothing where rshono owns the
391
+ * process, and *is* the export the platform looks for where the host owns it — so one entry serves both.
445
392
  *
446
- * On a platform where rshono owns the process this binds a port and the default export is nothing;
447
- * where the host owns it, this *is* the export the platform looks for — so the same entry serves
448
- * both without a per-platform entry file. `app` and `routes` stay named exports either way, because
449
- * `rshono build` imports them to prerender `render: 'static'` routes.
393
+ * `app` and `routes` stay named exports either way, because `rshono build` imports them to prerender
394
+ * `render: 'static'` routes.
450
395
  */
451
396
  export default runtime.serveApp(app);
452
397
  //# sourceMappingURL=entry.rsc.js.map