@rshono/core 1.0.0-rc.7 → 1.0.0-rc.9

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 (75) hide show
  1. package/README.md +39 -13
  2. package/dist/builder/page-files.d.ts.map +1 -1
  3. package/dist/builder/page-files.js +7 -3
  4. package/dist/builder/page-files.js.map +1 -1
  5. package/dist/builder/public-env.d.ts +6 -0
  6. package/dist/builder/public-env.d.ts.map +1 -1
  7. package/dist/builder/public-env.js +6 -0
  8. package/dist/builder/public-env.js.map +1 -1
  9. package/dist/builder/rspack-config.d.ts.map +1 -1
  10. package/dist/builder/rspack-config.js +16 -19
  11. package/dist/builder/rspack-config.js.map +1 -1
  12. package/dist/cli/dev.d.ts.map +1 -1
  13. package/dist/cli/dev.js +63 -35
  14. package/dist/cli/dev.js.map +1 -1
  15. package/dist/cli/index.js +3 -4
  16. package/dist/cli/index.js.map +1 -1
  17. package/dist/config.d.ts +22 -65
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js.map +1 -1
  20. package/dist/deploy/contract.d.ts +5 -5
  21. package/dist/deploy/contract.js.map +1 -1
  22. package/dist/deploy/filesystem.d.ts.map +1 -1
  23. package/dist/deploy/filesystem.js +6 -7
  24. package/dist/deploy/filesystem.js.map +1 -1
  25. package/dist/deploy/node/runtime.d.ts +5 -5
  26. package/dist/deploy/node/runtime.d.ts.map +1 -1
  27. package/dist/deploy/node/runtime.js +7 -11
  28. package/dist/deploy/node/runtime.js.map +1 -1
  29. package/dist/deploy/presets.d.ts +2 -6
  30. package/dist/deploy/presets.d.ts.map +1 -1
  31. package/dist/deploy/presets.js +2 -6
  32. package/dist/deploy/presets.js.map +1 -1
  33. package/dist/index.js +3 -3
  34. package/dist/index.js.map +1 -1
  35. package/dist/router.d.ts +15 -20
  36. package/dist/router.d.ts.map +1 -1
  37. package/dist/router.js +2 -3
  38. package/dist/router.js.map +1 -1
  39. package/dist/runtime/context.d.ts +53 -45
  40. package/dist/runtime/context.d.ts.map +1 -1
  41. package/dist/runtime/context.js +80 -82
  42. package/dist/runtime/context.js.map +1 -1
  43. package/dist/runtime/control.d.ts.map +1 -1
  44. package/dist/runtime/control.js +7 -0
  45. package/dist/runtime/control.js.map +1 -1
  46. package/dist/runtime/dev-protocol.d.ts.map +1 -1
  47. package/dist/runtime/dev-protocol.js.map +1 -1
  48. package/dist/runtime/entry.client.js +29 -47
  49. package/dist/runtime/entry.client.js.map +1 -1
  50. package/dist/runtime/entry.rsc.d.ts.map +1 -1
  51. package/dist/runtime/entry.rsc.js +102 -138
  52. package/dist/runtime/entry.rsc.js.map +1 -1
  53. package/dist/runtime/flight-inject.d.ts +4 -4
  54. package/dist/runtime/flight-inject.js +2 -2
  55. package/dist/runtime/flight-inject.js.map +1 -1
  56. package/dist/runtime/navigation.js.map +1 -1
  57. package/dist/runtime/request.d.ts +3 -3
  58. package/dist/runtime/request.js +3 -3
  59. package/dist/runtime/request.js.map +1 -1
  60. package/dist/runtime/server.d.ts +3 -2
  61. package/dist/runtime/server.d.ts.map +1 -1
  62. package/dist/runtime/server.js +11 -8
  63. package/dist/runtime/server.js.map +1 -1
  64. package/dist/server/prerendered.d.ts +20 -35
  65. package/dist/server/prerendered.d.ts.map +1 -1
  66. package/dist/server/prerendered.js +8 -18
  67. package/dist/server/prerendered.js.map +1 -1
  68. package/dist/server/server-config.d.ts +10 -29
  69. package/dist/server/server-config.d.ts.map +1 -1
  70. package/dist/server/server-config.js +4 -70
  71. package/dist/server/server-config.js.map +1 -1
  72. package/dist/server/ssg.d.ts.map +1 -1
  73. package/dist/server/ssg.js +10 -11
  74. package/dist/server/ssg.js.map +1 -1
  75. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export { defineRoutes, } from './router.js';
18
18
  export { defineConfig } from './config.js';
19
- // Hono's own `Context` and `Handler` used to be re-exported from here "for convenience". They are
20
- // Hono's types, `hono` is a peer dependency every app already has, and importing them from two places
21
- // only raised the question of which one is right — so an endpoint module imports them from `hono`.
19
+ // Hono's `Context` and `Handler` are deliberately not re-exported: `hono` is a peer dependency every
20
+ // app already has, so an endpoint module imports them from there rather than choosing between two
21
+ // spellings of the same type.
22
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,GAab,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAA6C,MAAM,aAAa,CAAC;AAItF,kGAAkG;AAClG,sGAAsG;AACtG,mGAAmG","sourcesContent":["/**\n * `@rshono/core` — the build-time surface: route and config declaration plus the types\n * your pages and endpoints are written against. Everything here is safe to\n * import from server code; none of it pulls in runtime machinery.\n *\n * The two companion entry points are runtime-only:\n * - `@rshono/core/server` — {@link https://hono.dev | Hono} request context inside\n * server components and actions (`getRequestContext`, `redirect`, `notFound`), plus\n * `onServerError` for reporting the errors the framework catches.\n * - `@rshono/core/client` — hooks and components for `'use client'` modules\n * (`useNavigation`, `AsyncBoundary`, `CatchBoundary`).\n *\n * @see {@link https://www.rshono.com/docs/api | Docs — API reference}\n *\n * @packageDocumentation\n */\n\nexport {\n defineRoutes,\n type EndpointRoute,\n type EndpointServerModule,\n type ErrorPageInfo,\n type ErrorPageProps,\n type FallbackPage,\n type HTTPMethod,\n type PageComponent,\n type PageProps,\n type PageRoute,\n type PathParams,\n type Route,\n type RouteConfig,\n} from './router.js';\n\nexport { defineConfig, type RshonoConfig, type RspackHookContext } from './config.js';\n\nexport type { DeployTarget } from './deploy/contract.js';\n\n// Hono's own `Context` and `Handler` used to be re-exported from here \"for convenience\". They are\n// Hono's types, `hono` is a peer dependency every app already has, and importing them from two places\n// only raised the question of which one is right — so an endpoint module imports them from `hono`.\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,GAab,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAA6C,MAAM,aAAa,CAAC;AAItF,qGAAqG;AACrG,kGAAkG;AAClG,8BAA8B","sourcesContent":["/**\n * `@rshono/core` — the build-time surface: route and config declaration plus the types\n * your pages and endpoints are written against. Everything here is safe to\n * import from server code; none of it pulls in runtime machinery.\n *\n * The two companion entry points are runtime-only:\n * - `@rshono/core/server` — {@link https://hono.dev | Hono} request context inside\n * server components and actions (`getRequestContext`, `redirect`, `notFound`), plus\n * `onServerError` for reporting the errors the framework catches.\n * - `@rshono/core/client` — hooks and components for `'use client'` modules\n * (`useNavigation`, `AsyncBoundary`, `CatchBoundary`).\n *\n * @see {@link https://www.rshono.com/docs/api | Docs — API reference}\n *\n * @packageDocumentation\n */\n\nexport {\n defineRoutes,\n type EndpointRoute,\n type EndpointServerModule,\n type ErrorPageInfo,\n type ErrorPageProps,\n type FallbackPage,\n type HTTPMethod,\n type PageComponent,\n type PageProps,\n type PageRoute,\n type PathParams,\n type Route,\n type RouteConfig,\n} from './router.js';\n\nexport { defineConfig, type RshonoConfig, type RspackHookContext } from './config.js';\n\nexport type { DeployTarget } from './deploy/contract.js';\n\n// Hono's `Context` and `Handler` are deliberately not re-exported: `hono` is a peer dependency every\n// app already has, so an endpoint module imports them from there rather than choosing between two\n// spellings of the same type.\n"]}
package/dist/router.d.ts CHANGED
@@ -59,14 +59,14 @@ export interface PageProps<Path extends string = string, E extends Env = Env> {
59
59
  * the rest off it.
60
60
  *
61
61
  * A fresh instance per request that nothing else holds, so mutating it is local
62
- * to the page — but note it is *not* serializable, so a `'use client'` component
63
- * has to be handed `url.href` rather than `url`.
62
+ * to the page. It is not serializable, so a `'use client'` component has to be
63
+ * handed `url.href` rather than `url`.
64
64
  *
65
- * On a prerendered page it is the build-time URL: a `render: 'static'` route is
66
- * rendered once, against `siteUrl` and with no query string, and that one file
67
- * then answers every request whatever its own query. So `url.searchParams` is
68
- * always empty there — read the query from `useNavigation().url` in a
69
- * `'use client'` component instead, or mark the route `render: 'dynamic'`.
65
+ * On a `render: 'static'` route this is the build-time URL — rendered once
66
+ * against `siteUrl` with no query string, and that one file answers every
67
+ * request whatever its own query. So `url.searchParams` is always empty there:
68
+ * read the query from `useNavigation().url` in a `'use client'` component
69
+ * instead, or mark the route `render: 'dynamic'`.
70
70
  */
71
71
  url: URL;
72
72
  /** Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`. */
@@ -77,16 +77,12 @@ export interface PageProps<Path extends string = string, E extends Env = Env> {
77
77
  * an import.
78
78
  *
79
79
  * Server-only and never serialized: React puts a server component's *output* on
80
- * the wire, not its props. It is also a deliberately non-enumerable property, so:
81
- *
82
- * - Handing it to a `'use client'` component (`<Counter ctx={ctx} />`) fails the
83
- * render with React's *"Only plain objects … can be passed to Client
84
- * Components"* — it wraps the live request and response, which do not exist in
85
- * the browser. Read what you need here and pass plain values down.
86
- * - Spreading the page's props (`<Counter {...props} />`) drops `ctx` silently
87
- * instead, since a spread copies enumerables only. (That spread still fails,
88
- * mind — on `url`, which is enumerable and just as unserializable.)
89
- * - `Object.keys(props)`, `JSON.stringify(props)` and friends don't see it.
80
+ * the wire, not its props. It is also deliberately **non-enumerable**, so
81
+ * `Object.keys(props)`, `JSON.stringify(props)` and a `{...props}` spread all
82
+ * skip it. Handing it to a `'use client'` component directly
83
+ * (`<Counter ctx={ctx} />`) fails the render — it wraps the live request and
84
+ * response, which do not exist in the browser. Read what you need here and pass
85
+ * plain values down.
90
86
  *
91
87
  * Reading it on a `render: 'static'` route throws: a prerendered page has no
92
88
  * per-request context at build time. Mark the route `render: 'dynamic'`, or use
@@ -238,9 +234,8 @@ export type Route = PageRoute | EndpointRoute;
238
234
  * Type guard narrowing a {@link Route} to a {@link PageRoute}. Because `type` is
239
235
  * optional on page routes, anything not explicitly `'endpoint'` is a page.
240
236
  *
241
- * Framework internal — deliberately absent from `index.ts`, so it is not part of the
242
- * `@rshono/core` surface. The request renderer and the builder use it to split the
243
- * route table; an app declares its routes rather than walking them.
237
+ * Framework internal — not re-exported from `index.ts`. The request renderer and
238
+ * the SSG pass use it to split the route table.
244
239
  *
245
240
  * @internal
246
241
  */
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,KAAK,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,EAAE,CAAC;AACjD,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC;AAEpH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IACrC,SAAS,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAErH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,SAAS,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,GAAG,GAAG,GAAG;IAC1E;;;;;;;;;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SAAS,SAAS,KAAK,EAAE,EACjE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG;IAAE,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;CAAE,GACjE,WAAW,CAAC,OAAO,CAAC,CAAC;AACxB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,OAAO,SAAS,SAAS,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC"}
package/dist/router.js CHANGED
@@ -2,9 +2,8 @@
2
2
  * Type guard narrowing a {@link Route} to a {@link PageRoute}. Because `type` is
3
3
  * optional on page routes, anything not explicitly `'endpoint'` is a page.
4
4
  *
5
- * Framework internal — deliberately absent from `index.ts`, so it is not part of the
6
- * `@rshono/core` surface. The request renderer and the builder use it to split the
7
- * route table; an app declares its routes rather than walking them.
5
+ * Framework internal — not re-exported from `index.ts`. The request renderer and
6
+ * the SSG pass use it to split the route table.
8
7
  *
9
8
  * @internal
10
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAqPA;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AA0ID,MAAM,UAAU,YAAY,CAAC,KAAqC;IAChE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAE,KAAqB,CAAC;AAC3E,CAAC","sourcesContent":["import type { Env, Handler } from 'hono';\nimport type { ParamKeys, ParamKeyToRecord } from 'hono/types';\nimport type { ReactNode } from 'react';\n// Type-only, so this stays a build-time module: the import is erased and none of `context.ts`'s\n// runtime machinery (AsyncLocalStorage, hono/cookie) is pulled in by importing `@rshono/core`.\nimport type { RequestContext } from './runtime/context.js';\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {};\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\n/**\n * The `params` record implied by a route path pattern — one required `string` key\n * per `:param` segment, `Record<string, never>` for a path with no params.\n *\n * Paths use Hono's syntax, so `:id`, `:id{[0-9]+}` and `*` all work. You rarely\n * name this type directly; {@link PageProps} applies it for you.\n *\n * @typeParam P - The literal route path, e.g. `'/users/:id/posts/:postId'`.\n *\n * @example\n * ```ts\n * type P = PathParams<'/users/:id/posts/:postId'>; // { id: string; postId: string }\n * ```\n *\n * @see {@link https://hono.dev/docs/api/routing#path-parameter | Hono — path parameters}\n */\nexport type PathParams<P extends string> =\n ParamKeys<P> extends never ? Record<string, never> : Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P>>>>;\n\n/**\n * Props every page component receives. Pass the route's path as the type\n * argument to get `params` typed key-by-key; without it `params` falls back to\n * an open `Record<string, string>`.\n *\n * `defineRoutes` checks each page's props against `PageProps<path>` at compile\n * time, so a mismatched path literal is a type error at the route definition.\n *\n * The location props (`url` and `params`) mirror what a `'use client'` component\n * gets from `useNavigation()` — same names, same types — so moving a read across\n * the server/client line is a copy-paste.\n *\n * @typeParam Path - The literal path this page is mounted at, e.g. `'/profile/:id'`.\n * @typeParam E - The app's Hono {@link Env}, to type {@link RequestContext.var} and\n * {@link RequestContext.env} on {@link PageProps.ctx}.\n *\n * @example\n * ```tsx\n * import type { PageProps } from '@rshono/core';\n *\n * export default async function Profile({ params, url }: PageProps<'/profile/:id'>) {\n * const user = await db.getUser(params.id); // params.id is string\n * const tab = url.searchParams.get('tab') ?? 'overview';\n * return <Layout>{user.name} — {tab}</Layout>;\n * }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/pages#page-props | Docs — page props}\n */\nexport interface PageProps<Path extends string = string, E extends Env = Env> {\n /**\n * The absolute browser-facing request {@link URL}, proxy-header aware\n * (`X-Forwarded-Host` / `-Proto`). Read `url.pathname`, `url.searchParams` and\n * the rest off it.\n *\n * A fresh instance per request that nothing else holds, so mutating it is local\n * to the page — but note it is *not* serializable, so a `'use client'` component\n * has to be handed `url.href` rather than `url`.\n *\n * On a prerendered page it is the build-time URL: a `render: 'static'` route is\n * rendered once, against `siteUrl` and with no query string, and that one file\n * then answers every request whatever its own query. So `url.searchParams` is\n * always empty there — read the query from `useNavigation().url` in a\n * `'use client'` component instead, or mark the route `render: 'dynamic'`.\n */\n url: URL;\n /** Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`. */\n params: string extends Path ? Record<string, string> : PathParams<Path>;\n /**\n * The request context — the very object `getRequestContext()` returns, handed to the\n * page so cookies, headers, env and middleware variables are reachable without\n * an import.\n *\n * Server-only and never serialized: React puts a server component's *output* on\n * the wire, not its props. It is also a deliberately non-enumerable property, so:\n *\n * - Handing it to a `'use client'` component (`<Counter ctx={ctx} />`) fails the\n * render with React's *\"Only plain objects … can be passed to Client\n * Components\"* — it wraps the live request and response, which do not exist in\n * the browser. Read what you need here and pass plain values down.\n * - Spreading the page's props (`<Counter {...props} />`) drops `ctx` silently\n * instead, since a spread copies enumerables only. (That spread still fails,\n * mind — on `url`, which is enumerable and just as unserializable.)\n * - `Object.keys(props)`, `JSON.stringify(props)` and friends don't see it.\n *\n * Reading it on a `render: 'static'` route throws: a prerendered page has no\n * per-request context at build time. Mark the route `render: 'dynamic'`, or use\n * the `url` / `params` props — available either way, with the build-time caveat\n * noted on `url`.\n *\n * @example\n * ```tsx\n * export default function Dashboard({ ctx }: PageProps) {\n * const session = ctx.cookies.get('session');\n * if (!session) redirect('/login');\n * return <Layout>Signed in as {session}</Layout>;\n * }\n * ```\n */\n ctx: RequestContext<E>;\n}\n\n/**\n * A page: a React **server component** that renders the entire document\n * (`<html>…</html>`), usually via a shared layout. It may be `async` and await\n * data directly.\n *\n * Each page module must default-export exactly one of these. Interactive parts\n * belong in `'use client'` components the page imports — only those ship JS.\n *\n * @typeParam P - The component's props; for a page these are {@link PageProps}.\n *\n * @see {@link https://react.dev/reference/rsc/server-components | React — Server Components}\n * @see {@link https://www.rshono.com/docs/pages | Docs — pages}\n */\nexport type PageComponent<P = any> = (props: P) => ReactNode | Promise<ReactNode>;\n\n/**\n * The shape an `{ type: 'endpoint' }` route's server module must have: a single\n * named `handler` export. The module only ever loads on the server, so it is\n * safe to import a database client or read secrets from it.\n *\n * @example\n * ```ts\n * // src/health.ts\n * import type { Handler } from 'hono';\n *\n * export const handler: Handler = (c) => c.json({ ok: true });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#endpoint-routes | Docs — endpoint routes}\n */\nexport interface EndpointServerModule {\n /**\n * A Hono {@link Handler} handling every request matched by the route. It is passed Hono's\n * `Context`, so the request, response builders (`c.json`, `c.text`, `c.body`) and middleware\n * variables are all reached through it.\n *\n * @see {@link https://hono.dev/docs/api/context | Hono — Context}\n */\n handler: Handler;\n}\n\n/**\n * A page route — a path rendered by a server component. This is the default\n * route kind, so `type` can be omitted.\n *\n * @example\n * ```ts\n * { path: '/profile/:id', component: () => import('./components/profile') }\n * ```\n */\nexport interface PageRoute {\n /** Discriminates a page from an endpoint; optional because `'page'` is the default. */\n type?: 'page';\n /**\n * Hono-style path pattern, e.g. `/`, `/profile/:id`, `/files/*`. Routes are matched in\n * declaration order.\n *\n * @see {@link https://hono.dev/docs/api/routing | Hono — routing}\n */\n path: string;\n /**\n * Dynamic import of the page module, whose default export is the\n * {@link PageComponent}.\n *\n * Write it inline as shown — the framework detects that exact\n * `() => import('…')` form and injects Rspack's `'use server-entry'`\n * directive into the module for you (that directive is what attaches the\n * page's client JS/CSS, giving per-page code splitting). If you wire the\n * component up any other way — a variable, a barrel re-export, a computed\n * specifier — add `'use server-entry'` as the first line of the page module\n * yourself; the framework throws a descriptive error when neither happened.\n *\n * @see {@link https://www.rshono.com/docs/pages#the-use-server-entry-directive | Docs — the `'use server-entry'` directive}\n */\n component: () => Promise<{ default: PageComponent }>;\n /** `'static'` prerenders the route at build time; `'dynamic'` (the default) renders per request. */\n render?: 'static' | 'dynamic';\n /**\n * For a `render: 'static'` route with params: the param sets to prerender, one\n * HTML file each. Runs at build time only, on the server, so it may hit a\n * database or read the filesystem.\n *\n * A parameterised static route without `staticPaths` falls back to rendering\n * per request (with a build warning). Wildcard (`*`), optional and regex\n * params can't be prerendered.\n *\n * @example\n * ```ts\n * {\n * path: '/docs/:slug',\n * render: 'static',\n * component: () => import('./components/documentation'),\n * staticPaths: async () => (await db.docs.all()).map((d) => ({ slug: d.slug })),\n * }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#static-rendering | Docs — static rendering}\n */\n staticPaths?: () => Array<Record<string, string>> | Promise<Array<Record<string, string>>>;\n}\n\n/**\n * An endpoint route — a path served by a raw Hono handler instead of a React\n * component. Use it for JSON APIs, webhooks, redirects, feeds, or anything that\n * isn't an HTML page.\n *\n * @example\n * ```ts\n * { type: 'endpoint', path: '/api/health', server: () => import('./health') }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#endpoint-routes | Docs — endpoint routes}\n */\nexport interface EndpointRoute {\n /** Marks this route as an endpoint rather than a page. Required. */\n type: 'endpoint';\n /**\n * Hono-style path pattern, e.g. `/api/health`, `/api/users/:id`.\n *\n * @see {@link https://hono.dev/docs/api/routing | Hono — routing}\n */\n path: string;\n /** HTTP method to match. Defaults to `'all'` — every method. */\n method?: HTTPMethod;\n /** Dynamic import of the {@link EndpointServerModule} exporting `handler`. */\n server: () => Promise<EndpointServerModule>;\n}\n\n/** HTTP methods an {@link EndpointRoute} can match. `'all'` matches every method. */\nexport type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'all';\n\n/** Any entry in the `routes` array: a {@link PageRoute} or an {@link EndpointRoute}. */\nexport type Route = PageRoute | EndpointRoute;\n\n/**\n * Type guard narrowing a {@link Route} to a {@link PageRoute}. Because `type` is\n * optional on page routes, anything not explicitly `'endpoint'` is a page.\n *\n * Framework internal — deliberately absent from `index.ts`, so it is not part of the\n * `@rshono/core` surface. The request renderer and the builder use it to split the\n * route table; an app declares its routes rather than walking them.\n *\n * @internal\n */\nexport function isPageRoute(route: Route): route is PageRoute {\n return route.type !== 'endpoint';\n}\n\n/**\n * A page the framework falls back to rather than routes to — `notFound` and\n * `error` in {@link RouteConfig}. Same contract as a {@link PageRoute}\n * `component`, without a path of its own.\n */\nexport interface FallbackPage {\n /** Dynamic import of the page module; its default export is the {@link PageComponent}. */\n component: () => Promise<{ default: PageComponent }>;\n}\n\n/**\n * The error detail handed to the `error` page. Redacted in production: the\n * message is a generic `'Internal Server Error'` and there is no `stack`. In dev\n * you get the real message plus the stack.\n */\nexport interface ErrorPageInfo {\n /** The thrown error's message in dev; `'Internal Server Error'` in production. */\n message: string;\n /** The stack trace. Present in dev only. */\n stack?: string;\n}\n\n/**\n * Props for the `error` page declared in {@link RouteConfig.error} — the usual\n * {@link PageProps} plus the redaction-aware {@link ErrorPageInfo}.\n *\n * @typeParam E - The app's Hono {@link Env}, forwarded to {@link PageProps.ctx}.\n *\n * @example\n * ```tsx\n * import type { ErrorPageProps } from '@rshono/core';\n *\n * export default function ServerError({ error }: ErrorPageProps) {\n * return <html><body><h1>Something went wrong</h1><p>{error.message}</p></body></html>;\n * }\n * ```\n */\nexport type ErrorPageProps<E extends Env = Env> = PageProps<string, E> & {\n /** The error that failed the request, redacted in production — see {@link ErrorPageInfo}. */\n error: ErrorPageInfo;\n};\n\n/**\n * The object form accepted by {@link defineRoutes}: the route table plus the two\n * optional framework-owned pages.\n *\n * @typeParam TRoutes - Inferred tuple of route literals, which is what makes the\n * per-route `path` → props check possible.\n *\n * @see {@link https://www.rshono.com/docs/routing#notfound-and-error | Docs — notFound and error pages}\n */\nexport interface RouteConfig<TRoutes extends readonly Route[] = readonly Route[]> {\n /** Every page and endpoint in the app, matched in order. */\n routes: TRoutes;\n /** Page rendered with a 404 status for unmatched paths and for `notFound()` calls. */\n notFound?: FallbackPage;\n /** Page rendered with a 500 status when a request throws. Receives {@link ErrorPageProps}. */\n error?: FallbackPage;\n}\n\n// `PageProps<P, any>`, not `PageProps<P>`: this check is about the *path* matching the page's\n// `params`, and pinning the Env to the default would additionally demand that a page declaring its\n// own (`PageProps<'/x', MyEnv>`, to type `ctx.var`) accept a `RequestContext<Env>` — which it doesn't, so every\n// such page would fail its own route check. `any` makes `ctx` compatible either way.\ntype ValidateRoute<R> = R extends {\n path: infer P extends string;\n component: () => Promise<{ default: PageComponent<infer CP> }>;\n}\n ? [PageProps<P, any>] extends [CP]\n ? R\n : R & { component: `component props are not satisfied by PageProps<'${P}'>` }\n : R;\n\ntype ValidateRoutes<TRoutes extends readonly Route[]> = { [K in keyof TRoutes]: ValidateRoute<TRoutes[K]> };\n\n/**\n * Declares the app's route table. Default-export the result as `routes` from\n * `src/routes.ts` — the one file rshono requires.\n *\n * `routes.ts` only ever runs on the server, so importing server-only modules\n * from it (e.g. inside `staticPaths`) is safe.\n *\n * Beyond typing the config, this cross-checks every page against its own path:\n * if a component's props aren't satisfied by `PageProps<'<its path>'>`, the\n * `component` field errors with `component props are not satisfied by\n * PageProps<'/…'>`. Fix it by matching the page's `PageProps<Path>` type\n * argument to the path it's mounted at.\n *\n * A bare {@link Route} array is accepted as shorthand — see the second overload.\n *\n * @param config - A {@link RouteConfig}: the `routes` array plus the optional\n * `notFound` and `error` pages.\n * @returns The config, unchanged and fully typed.\n *\n * @example\n * ```ts\n * // src/routes.ts\n * import { defineRoutes } from '@rshono/core';\n *\n * export const routes = defineRoutes({\n * routes: [\n * { path: '/', component: () => import('./components/home') },\n * { path: '/profile/:id', component: () => import('./components/profile') },\n * {\n * path: '/docs/:slug',\n * render: 'static',\n * component: () => import('./components/documentation'),\n * staticPaths: async () => [{ slug: 'getting-started' }, { slug: 'deployment' }],\n * },\n * { type: 'endpoint', path: '/api/health', server: () => import('./health') },\n * ],\n * notFound: { component: () => import('./components/404') },\n * error: { component: () => import('./components/500') },\n * });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing | Docs — routing}\n */\nexport function defineRoutes<const TRoutes extends readonly Route[]>(\n config: RouteConfig<TRoutes> & { routes: ValidateRoutes<TRoutes> },\n): RouteConfig<TRoutes>;\n/**\n * Array shorthand for {@link defineRoutes} — equivalent to `defineRoutes({ routes })`, for an app\n * with no `notFound` or `error` page.\n *\n * @param routes - The {@link Route} array; each page is checked against its own `path`.\n * @returns A {@link RouteConfig} wrapping them.\n *\n * @example\n * ```ts\n * export const routes = defineRoutes([{ path: '/', component: () => import('./components/home') }]);\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing | Docs — routing}\n */\nexport function defineRoutes<const TRoutes extends readonly Route[]>(routes: TRoutes & ValidateRoutes<TRoutes>): RouteConfig<TRoutes>;\nexport function defineRoutes(input: readonly Route[] | RouteConfig): RouteConfig {\n return Array.isArray(input) ? { routes: input } : (input as RouteConfig);\n}\n"]}
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAiPA;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AA0ID,MAAM,UAAU,YAAY,CAAC,KAAqC;IAChE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAE,KAAqB,CAAC;AAC3E,CAAC","sourcesContent":["import type { Env, Handler } from 'hono';\nimport type { ParamKeys, ParamKeyToRecord } from 'hono/types';\nimport type { ReactNode } from 'react';\n// Type-only, so this stays a build-time module: the import is erased and none of `context.ts`'s\n// runtime machinery (AsyncLocalStorage, hono/cookie) is pulled in by importing `@rshono/core`.\nimport type { RequestContext } from './runtime/context.js';\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {};\ntype UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\n\n/**\n * The `params` record implied by a route path pattern — one required `string` key\n * per `:param` segment, `Record<string, never>` for a path with no params.\n *\n * Paths use Hono's syntax, so `:id`, `:id{[0-9]+}` and `*` all work. You rarely\n * name this type directly; {@link PageProps} applies it for you.\n *\n * @typeParam P - The literal route path, e.g. `'/users/:id/posts/:postId'`.\n *\n * @example\n * ```ts\n * type P = PathParams<'/users/:id/posts/:postId'>; // { id: string; postId: string }\n * ```\n *\n * @see {@link https://hono.dev/docs/api/routing#path-parameter | Hono — path parameters}\n */\nexport type PathParams<P extends string> =\n ParamKeys<P> extends never ? Record<string, never> : Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P>>>>;\n\n/**\n * Props every page component receives. Pass the route's path as the type\n * argument to get `params` typed key-by-key; without it `params` falls back to\n * an open `Record<string, string>`.\n *\n * `defineRoutes` checks each page's props against `PageProps<path>` at compile\n * time, so a mismatched path literal is a type error at the route definition.\n *\n * The location props (`url` and `params`) mirror what a `'use client'` component\n * gets from `useNavigation()` — same names, same types — so moving a read across\n * the server/client line is a copy-paste.\n *\n * @typeParam Path - The literal path this page is mounted at, e.g. `'/profile/:id'`.\n * @typeParam E - The app's Hono {@link Env}, to type {@link RequestContext.var} and\n * {@link RequestContext.env} on {@link PageProps.ctx}.\n *\n * @example\n * ```tsx\n * import type { PageProps } from '@rshono/core';\n *\n * export default async function Profile({ params, url }: PageProps<'/profile/:id'>) {\n * const user = await db.getUser(params.id); // params.id is string\n * const tab = url.searchParams.get('tab') ?? 'overview';\n * return <Layout>{user.name} — {tab}</Layout>;\n * }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/pages#page-props | Docs — page props}\n */\nexport interface PageProps<Path extends string = string, E extends Env = Env> {\n /**\n * The absolute browser-facing request {@link URL}, proxy-header aware\n * (`X-Forwarded-Host` / `-Proto`). Read `url.pathname`, `url.searchParams` and\n * the rest off it.\n *\n * A fresh instance per request that nothing else holds, so mutating it is local\n * to the page. It is not serializable, so a `'use client'` component has to be\n * handed `url.href` rather than `url`.\n *\n * On a `render: 'static'` route this is the build-time URL — rendered once\n * against `siteUrl` with no query string, and that one file answers every\n * request whatever its own query. So `url.searchParams` is always empty there:\n * read the query from `useNavigation().url` in a `'use client'` component\n * instead, or mark the route `render: 'dynamic'`.\n */\n url: URL;\n /** Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`. */\n params: string extends Path ? Record<string, string> : PathParams<Path>;\n /**\n * The request context — the very object `getRequestContext()` returns, handed to the\n * page so cookies, headers, env and middleware variables are reachable without\n * an import.\n *\n * Server-only and never serialized: React puts a server component's *output* on\n * the wire, not its props. It is also deliberately **non-enumerable**, so\n * `Object.keys(props)`, `JSON.stringify(props)` and a `{...props}` spread all\n * skip it. Handing it to a `'use client'` component directly\n * (`<Counter ctx={ctx} />`) fails the render — it wraps the live request and\n * response, which do not exist in the browser. Read what you need here and pass\n * plain values down.\n *\n * Reading it on a `render: 'static'` route throws: a prerendered page has no\n * per-request context at build time. Mark the route `render: 'dynamic'`, or use\n * the `url` / `params` props — available either way, with the build-time caveat\n * noted on `url`.\n *\n * @example\n * ```tsx\n * export default function Dashboard({ ctx }: PageProps) {\n * const session = ctx.cookies.get('session');\n * if (!session) redirect('/login');\n * return <Layout>Signed in as {session}</Layout>;\n * }\n * ```\n */\n ctx: RequestContext<E>;\n}\n\n/**\n * A page: a React **server component** that renders the entire document\n * (`<html>…</html>`), usually via a shared layout. It may be `async` and await\n * data directly.\n *\n * Each page module must default-export exactly one of these. Interactive parts\n * belong in `'use client'` components the page imports — only those ship JS.\n *\n * @typeParam P - The component's props; for a page these are {@link PageProps}.\n *\n * @see {@link https://react.dev/reference/rsc/server-components | React — Server Components}\n * @see {@link https://www.rshono.com/docs/pages | Docs — pages}\n */\nexport type PageComponent<P = any> = (props: P) => ReactNode | Promise<ReactNode>;\n\n/**\n * The shape an `{ type: 'endpoint' }` route's server module must have: a single\n * named `handler` export. The module only ever loads on the server, so it is\n * safe to import a database client or read secrets from it.\n *\n * @example\n * ```ts\n * // src/health.ts\n * import type { Handler } from 'hono';\n *\n * export const handler: Handler = (c) => c.json({ ok: true });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#endpoint-routes | Docs — endpoint routes}\n */\nexport interface EndpointServerModule {\n /**\n * A Hono {@link Handler} handling every request matched by the route. It is passed Hono's\n * `Context`, so the request, response builders (`c.json`, `c.text`, `c.body`) and middleware\n * variables are all reached through it.\n *\n * @see {@link https://hono.dev/docs/api/context | Hono — Context}\n */\n handler: Handler;\n}\n\n/**\n * A page route — a path rendered by a server component. This is the default\n * route kind, so `type` can be omitted.\n *\n * @example\n * ```ts\n * { path: '/profile/:id', component: () => import('./components/profile') }\n * ```\n */\nexport interface PageRoute {\n /** Discriminates a page from an endpoint; optional because `'page'` is the default. */\n type?: 'page';\n /**\n * Hono-style path pattern, e.g. `/`, `/profile/:id`, `/files/*`. Routes are matched in\n * declaration order.\n *\n * @see {@link https://hono.dev/docs/api/routing | Hono — routing}\n */\n path: string;\n /**\n * Dynamic import of the page module, whose default export is the\n * {@link PageComponent}.\n *\n * Write it inline as shown — the framework detects that exact\n * `() => import('…')` form and injects Rspack's `'use server-entry'`\n * directive into the module for you (that directive is what attaches the\n * page's client JS/CSS, giving per-page code splitting). If you wire the\n * component up any other way — a variable, a barrel re-export, a computed\n * specifier — add `'use server-entry'` as the first line of the page module\n * yourself; the framework throws a descriptive error when neither happened.\n *\n * @see {@link https://www.rshono.com/docs/pages#the-use-server-entry-directive | Docs — the `'use server-entry'` directive}\n */\n component: () => Promise<{ default: PageComponent }>;\n /** `'static'` prerenders the route at build time; `'dynamic'` (the default) renders per request. */\n render?: 'static' | 'dynamic';\n /**\n * For a `render: 'static'` route with params: the param sets to prerender, one\n * HTML file each. Runs at build time only, on the server, so it may hit a\n * database or read the filesystem.\n *\n * A parameterised static route without `staticPaths` falls back to rendering\n * per request (with a build warning). Wildcard (`*`), optional and regex\n * params can't be prerendered.\n *\n * @example\n * ```ts\n * {\n * path: '/docs/:slug',\n * render: 'static',\n * component: () => import('./components/documentation'),\n * staticPaths: async () => (await db.docs.all()).map((d) => ({ slug: d.slug })),\n * }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#static-rendering | Docs — static rendering}\n */\n staticPaths?: () => Array<Record<string, string>> | Promise<Array<Record<string, string>>>;\n}\n\n/**\n * An endpoint route — a path served by a raw Hono handler instead of a React\n * component. Use it for JSON APIs, webhooks, redirects, feeds, or anything that\n * isn't an HTML page.\n *\n * @example\n * ```ts\n * { type: 'endpoint', path: '/api/health', server: () => import('./health') }\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing#endpoint-routes | Docs — endpoint routes}\n */\nexport interface EndpointRoute {\n /** Marks this route as an endpoint rather than a page. Required. */\n type: 'endpoint';\n /**\n * Hono-style path pattern, e.g. `/api/health`, `/api/users/:id`.\n *\n * @see {@link https://hono.dev/docs/api/routing | Hono — routing}\n */\n path: string;\n /** HTTP method to match. Defaults to `'all'` — every method. */\n method?: HTTPMethod;\n /** Dynamic import of the {@link EndpointServerModule} exporting `handler`. */\n server: () => Promise<EndpointServerModule>;\n}\n\n/** HTTP methods an {@link EndpointRoute} can match. `'all'` matches every method. */\nexport type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'all';\n\n/** Any entry in the `routes` array: a {@link PageRoute} or an {@link EndpointRoute}. */\nexport type Route = PageRoute | EndpointRoute;\n\n/**\n * Type guard narrowing a {@link Route} to a {@link PageRoute}. Because `type` is\n * optional on page routes, anything not explicitly `'endpoint'` is a page.\n *\n * Framework internal — not re-exported from `index.ts`. The request renderer and\n * the SSG pass use it to split the route table.\n *\n * @internal\n */\nexport function isPageRoute(route: Route): route is PageRoute {\n return route.type !== 'endpoint';\n}\n\n/**\n * A page the framework falls back to rather than routes to — `notFound` and\n * `error` in {@link RouteConfig}. Same contract as a {@link PageRoute}\n * `component`, without a path of its own.\n */\nexport interface FallbackPage {\n /** Dynamic import of the page module; its default export is the {@link PageComponent}. */\n component: () => Promise<{ default: PageComponent }>;\n}\n\n/**\n * The error detail handed to the `error` page. Redacted in production: the\n * message is a generic `'Internal Server Error'` and there is no `stack`. In dev\n * you get the real message plus the stack.\n */\nexport interface ErrorPageInfo {\n /** The thrown error's message in dev; `'Internal Server Error'` in production. */\n message: string;\n /** The stack trace. Present in dev only. */\n stack?: string;\n}\n\n/**\n * Props for the `error` page declared in {@link RouteConfig.error} — the usual\n * {@link PageProps} plus the redaction-aware {@link ErrorPageInfo}.\n *\n * @typeParam E - The app's Hono {@link Env}, forwarded to {@link PageProps.ctx}.\n *\n * @example\n * ```tsx\n * import type { ErrorPageProps } from '@rshono/core';\n *\n * export default function ServerError({ error }: ErrorPageProps) {\n * return <html><body><h1>Something went wrong</h1><p>{error.message}</p></body></html>;\n * }\n * ```\n */\nexport type ErrorPageProps<E extends Env = Env> = PageProps<string, E> & {\n /** The error that failed the request, redacted in production — see {@link ErrorPageInfo}. */\n error: ErrorPageInfo;\n};\n\n/**\n * The object form accepted by {@link defineRoutes}: the route table plus the two\n * optional framework-owned pages.\n *\n * @typeParam TRoutes - Inferred tuple of route literals, which is what makes the\n * per-route `path` → props check possible.\n *\n * @see {@link https://www.rshono.com/docs/routing#notfound-and-error | Docs — notFound and error pages}\n */\nexport interface RouteConfig<TRoutes extends readonly Route[] = readonly Route[]> {\n /** Every page and endpoint in the app, matched in order. */\n routes: TRoutes;\n /** Page rendered with a 404 status for unmatched paths and for `notFound()` calls. */\n notFound?: FallbackPage;\n /** Page rendered with a 500 status when a request throws. Receives {@link ErrorPageProps}. */\n error?: FallbackPage;\n}\n\n// `PageProps<P, any>`, not `PageProps<P>`: this checks the *path* against the page's `params`, and\n// pinning the Env to the default would additionally demand that a page declaring its own\n// (`PageProps<'/x', MyEnv>`, to type `ctx.var`) accept a `RequestContext<Env>` — which it doesn't, so\n// every such page would fail its own route check. `any` makes `ctx` compatible either way.\ntype ValidateRoute<R> = R extends {\n path: infer P extends string;\n component: () => Promise<{ default: PageComponent<infer CP> }>;\n}\n ? [PageProps<P, any>] extends [CP]\n ? R\n : R & { component: `component props are not satisfied by PageProps<'${P}'>` }\n : R;\n\ntype ValidateRoutes<TRoutes extends readonly Route[]> = { [K in keyof TRoutes]: ValidateRoute<TRoutes[K]> };\n\n/**\n * Declares the app's route table. Default-export the result as `routes` from\n * `src/routes.ts` — the one file rshono requires.\n *\n * `routes.ts` only ever runs on the server, so importing server-only modules\n * from it (e.g. inside `staticPaths`) is safe.\n *\n * Beyond typing the config, this cross-checks every page against its own path:\n * if a component's props aren't satisfied by `PageProps<'<its path>'>`, the\n * `component` field errors with `component props are not satisfied by\n * PageProps<'/…'>`. Fix it by matching the page's `PageProps<Path>` type\n * argument to the path it's mounted at.\n *\n * A bare {@link Route} array is accepted as shorthand — see the second overload.\n *\n * @param config - A {@link RouteConfig}: the `routes` array plus the optional\n * `notFound` and `error` pages.\n * @returns The config, unchanged and fully typed.\n *\n * @example\n * ```ts\n * // src/routes.ts\n * import { defineRoutes } from '@rshono/core';\n *\n * export const routes = defineRoutes({\n * routes: [\n * { path: '/', component: () => import('./components/home') },\n * { path: '/profile/:id', component: () => import('./components/profile') },\n * {\n * path: '/docs/:slug',\n * render: 'static',\n * component: () => import('./components/documentation'),\n * staticPaths: async () => [{ slug: 'getting-started' }, { slug: 'deployment' }],\n * },\n * { type: 'endpoint', path: '/api/health', server: () => import('./health') },\n * ],\n * notFound: { component: () => import('./components/404') },\n * error: { component: () => import('./components/500') },\n * });\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing | Docs — routing}\n */\nexport function defineRoutes<const TRoutes extends readonly Route[]>(\n config: RouteConfig<TRoutes> & { routes: ValidateRoutes<TRoutes> },\n): RouteConfig<TRoutes>;\n/**\n * Array shorthand for {@link defineRoutes} — equivalent to `defineRoutes({ routes })`, for an app\n * with no `notFound` or `error` page.\n *\n * @param routes - The {@link Route} array; each page is checked against its own `path`.\n * @returns A {@link RouteConfig} wrapping them.\n *\n * @example\n * ```ts\n * export const routes = defineRoutes([{ path: '/', component: () => import('./components/home') }]);\n * ```\n *\n * @see {@link https://www.rshono.com/docs/routing | Docs — routing}\n */\nexport function defineRoutes<const TRoutes extends readonly Route[]>(routes: TRoutes & ValidateRoutes<TRoutes>): RouteConfig<TRoutes>;\nexport function defineRoutes(input: readonly Route[] | RouteConfig): RouteConfig {\n return Array.isArray(input) ? { routes: input } : (input as RouteConfig);\n}\n"]}
@@ -44,30 +44,45 @@ export declare function beginPageRender(c: Context): void;
44
44
  */
45
45
  export declare function runWithContext<T>(c: Context, fn: () => T): T;
46
46
  /**
47
- * Reads the matched route params, returning an empty object when there is no
48
- * active route match (rather than throwing), so the fallback behaviour stays in
49
- * one place.
47
+ * The matched route params, or an empty object when there is no active match.
50
48
  *
51
- * Framework internal — the request renderer calls this to build a page's `params`
52
- * prop, and {@link RequestContext.params} caches it. Read them from that prop, or
53
- * from `ctx.params` outside a page.
49
+ * Framework internal — the request renderer calls this to build a page's `params` prop, and
50
+ * {@link RequestContext.params} caches it. Read them from that prop, or from `ctx.params`.
54
51
  *
55
52
  * @internal
56
53
  */
57
54
  export declare function readParams(c: Context): Record<string, string>;
58
55
  /**
59
- * Resolves the browser-facing {@link URL} for a request.
56
+ * Resolves the browser-facing {@link URL} for a request, from a Hono {@link Context}.
60
57
  *
61
- * `c.req.url` reflects the internal address the server was reached on, which is wrong behind a
62
- * proxy or load balancer. `X-Forwarded-Host` / `X-Forwarded-Proto` fix that up — **but only when
63
- * `trustProxy` is enabled in `rshono.config.ts`** (always the case under `rshono dev`). Those
64
- * headers are client-supplied: honouring them unconditionally lets anyone who can reach the server
65
- * dictate the origin of every absolute URL the app builds — canonical tags, emails, redirects — and
66
- * poison a shared cache with them. So the default is to ignore them entirely.
58
+ * `c.req.url` reflects the internal address the server was reached on, which is wrong behind a proxy.
59
+ * `X-Forwarded-Host` / `X-Forwarded-Proto` fix that up — **but only when `trustProxy` is enabled in
60
+ * `rshono.config.ts`** (always so under `rshono dev`). They are client-supplied, so honouring them
61
+ * unconditionally would let anyone who can reach the server dictate the origin of every absolute URL
62
+ * the app builds, and poison a shared cache with it.
67
63
  *
68
- * Framework internal — prefer {@link RequestContext.url}, which caches the result per request.
64
+ * This is the form for **middleware**, which is handed `c` and runs outside the request context. In
65
+ * a server component or a `'use server'` action prefer {@link RequestContext.url}, which is this same
66
+ * value cached per request.
69
67
  *
70
- * @internal
68
+ * Its main use is giving Hono's own middleware the origin the browser actually used, since they all
69
+ * read `c.req.url` on their own and so see the internal one:
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * // src/server.ts — a CSRF check that still works behind a proxy that rewrites Host
74
+ * import { publicUrl } from '@rshono/core/server';
75
+ * import { csrf } from 'hono/csrf';
76
+ *
77
+ * server.use(csrf({ origin: (origin, c) => origin === publicUrl(c).origin }));
78
+ * ```
79
+ *
80
+ * A fresh instance per call, so mutating it disturbs nothing else.
81
+ *
82
+ * @param c - The Hono {@link Context} for the request.
83
+ * @returns The browser-facing URL — proxy-corrected under `trustProxy`, `c.req.url` otherwise.
84
+ *
85
+ * @see {@link https://www.rshono.com/docs/configuration#proxy-headers | Docs — proxy headers}
71
86
  */
72
87
  export declare function publicUrl(c: Context): URL;
73
88
  /**
@@ -114,14 +129,12 @@ export declare class RequestContext<E extends Env = Env> {
114
129
  */
115
130
  constructor(c: Context<E>);
116
131
  /**
117
- * The underlying Hono {@link Context} — the escape hatch for the long tail this wrapper does not
118
- * expose. Everything a page or action actually reaches for has a home of its own now
119
- * ({@link RequestContext.req}, {@link RequestContext.params}, {@link RequestContext.setHeader}), so
120
- * this is for what is left: `executionCtx.waitUntil()` on Workers, and whatever Hono adds next.
132
+ * The underlying Hono {@link Context} — the escape hatch for what this wrapper does not expose,
133
+ * such as `executionCtx.waitUntil()` on Workers.
121
134
  *
122
- * Be aware that the response builders on it (`redirect`, `notFound`, `json`, `body`, `status`, …)
123
- * still do nothing from inside a page, for the reason the stubs on this class explain — reaching
124
- * them through here bypasses the error, it does not make them work.
135
+ * Its response builders (`redirect`, `notFound`, `json`, `body`, `status`, …) still do nothing from
136
+ * inside a page, for the reason the stubs on this class explain: reaching them through here
137
+ * bypasses the error, it does not make them work.
125
138
  *
126
139
  * @example
127
140
  * ```ts
@@ -136,9 +149,9 @@ export declare class RequestContext<E extends Env = Env> {
136
149
  * {@link Context.req}, unwrapped, so `ctx.req.header('authorization')` rather than
137
150
  * `ctx.hono.req.header(…)`.
138
151
  *
139
- * Reads only. Setting a response header is {@link RequestContext.setHeader}, which is a different
140
- * thing living in a different place on purpose — Hono's `c.header()` writing the *response* while
141
- * `c.req.header()` reads the *request* is a well-worn source of confusion.
152
+ * Reads only. Setting a *response* header is {@link RequestContext.setHeader}, deliberately in a
153
+ * different place — Hono's `c.header()` writing the response while `c.req.header()` reads the
154
+ * request is a well-worn source of confusion.
142
155
  *
143
156
  * @example
144
157
  * ```ts
@@ -152,12 +165,12 @@ export declare class RequestContext<E extends Env = Env> {
152
165
  */
153
166
  get req(): Context<E>['req'];
154
167
  /**
155
- * Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`.
168
+ * Matched route params for this request, e.g. `{ id: '42' }` for `/profile/:id`. Empty when there
169
+ * is no active route match.
156
170
  *
157
- * A **page** is handed these as its `params` prop, typed key-by-key from its route path, and that
158
- * is the better read where it is available. This is the same record for everywhere else — a nested
159
- * server component, or a `'use server'` action — which get no props from the framework. Empty when
160
- * there is no active route match rather than throwing.
171
+ * A **page** is handed the same record as its `params` prop, typed key-by-key from its route path,
172
+ * and that is the better read where it is available. This is for everywhere else — a nested server
173
+ * component, or a `'use server'` action — which get no props from the framework.
161
174
  */
162
175
  get params(): Record<string, string>;
163
176
  /**
@@ -238,15 +251,14 @@ export declare class RequestContext<E extends Env = Env> {
238
251
  * Sets a header on the response — from a `'use server'` action, which is the one place a request
239
252
  * context exists *and* the response is still open.
240
253
  *
241
- * From inside a page it throws. By then the response head is committed: a page streams, and on a
242
- * soft navigation the flight response is built before the component's first line runs. Hono's
254
+ * From inside a page it throws: a page streams, so by then the response head is committed. Hono's
243
255
  * `c.header()` fails there silently and inconsistently — landing on a full page load, vanishing on
244
256
  * a soft navigation — so this refuses rather than doing it half the time.
245
257
  *
246
- * Middleware and `{ type: 'endpoint' }` routes run outside the request context (no
247
- * {@link getRequestContext} there) but are handed Hono's `c` directly, so they set headers with
248
- * `c.header(…)`. That is also where a header belonging to the *page* rather than to one action
249
- * goes — `Cache-Control`, `X-Robots-Tag` — since middleware runs before the render.
258
+ * Middleware and `{ type: 'endpoint' }` routes run outside the request context but are handed
259
+ * Hono's `c` directly, so they use `c.header(…)`. That is also where a header belonging to the
260
+ * *page* rather than to one action goes — `Cache-Control`, `X-Robots-Tag` — since middleware runs
261
+ * before the render.
250
262
  *
251
263
  * @param name - Header name, case-insensitive.
252
264
  * @param value - Header value.
@@ -285,16 +297,12 @@ export declare class RequestContext<E extends Env = Env> {
285
297
  header(...args: unknown[]): never;
286
298
  }
287
299
  /**
288
- * Returns the {@link RequestContext} for the current request.
289
- *
290
- * This is the primary entry point for reading request data from a server
291
- * component or server action — the URL, cookies, params, env, and middleware
292
- * variables. The returned wrapper is memoised per request, so repeated calls in
293
- * the same request are cheap and return the same instance.
300
+ * Returns the {@link RequestContext} for the current request — the URL, cookies, params, env and
301
+ * middleware variables, read from a server component or a server action. Memoised per request, so
302
+ * repeated calls return the same instance.
294
303
  *
295
- * A **page** component is handed the very same object as its `ctx` prop, so this
296
- * import is for everywhere else: a nested server component, or a `'use server'`
297
- * action module — neither of which receives props from the framework.
304
+ * A **page** component is handed that same object as its `ctx` prop, so this import is for everywhere
305
+ * else: a nested server component, or a `'use server'` action module.
298
306
  *
299
307
  * @typeParam E - The app's Hono {@link Env}, to type {@link RequestContext.var} and {@link RequestContext.env}.
300
308
  * @throws If called at module load, where there is no ambient context to resolve.
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EA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