@rshono/core 1.0.0-rc.6 → 1.0.0-rc.7
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.
- package/README.md +165 -164
- package/dist/config.d.ts +45 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -1
- package/dist/config.js.map +1 -1
- package/dist/deploy/contract.d.ts +12 -7
- package/dist/deploy/contract.d.ts.map +1 -1
- package/dist/deploy/contract.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/router.d.ts +67 -24
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js.map +1 -1
- package/dist/runtime/boundaries.d.ts +10 -0
- package/dist/runtime/boundaries.d.ts.map +1 -1
- package/dist/runtime/boundaries.js +6 -0
- package/dist/runtime/boundaries.js.map +1 -1
- package/dist/runtime/client.d.ts +5 -3
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +5 -3
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/context.d.ts +165 -23
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +244 -24
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/entry.rsc.d.ts.map +1 -1
- package/dist/runtime/entry.rsc.js +7 -2
- package/dist/runtime/entry.rsc.js.map +1 -1
- package/dist/runtime/navigation.d.ts +11 -0
- package/dist/runtime/navigation.d.ts.map +1 -1
- package/dist/runtime/navigation.js +3 -0
- package/dist/runtime/navigation.js.map +1 -1
- package/dist/runtime/server.d.ts +4 -10
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +10 -10
- package/dist/runtime/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.rsc.js","sourceRoot":"","sources":["../../src/runtime/entry.rsc.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAA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AE,OAAO,EAAE,2CAA2C,EAAE,CAAC,CAAC;YAClI,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7G,OAAO,CAAC,CAAC,IAAI,CAAC,wBAAwB,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;AAE9B;;;;;;;GAOG;AACH,eAAe,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import type { Context, Handler } from 'hono';\nimport { Hono } from 'hono';\nimport { bodyLimit } from 'hono/body-limit';\nimport type { ContentfulStatusCode, RedirectStatusCode } from 'hono/utils/http-status';\nimport type React from 'react';\nimport type { ReactFormState } from 'react-dom/client';\n// The JSX factory, by name: the page element is created with this directly rather than as\n// `<Page {...props} />`, because a spread would drop the non-enumerable `ctx` prop. See `pageProps`.\nimport { jsx } from 'react/jsx-runtime';\n// The bare specifier, not `/server.node`: the package ships a build per runtime behind export\n// conditions (`node`, `workerd`, `deno`, `edge-light`), and the RSC layer's `conditionNames` is what\n// picks one — so a non-Node deploy target gets its own build instead of Node's by hard-coded path.\nimport {\n createTemporaryReferenceSet,\n decodeAction,\n decodeFormState,\n decodeReply,\n loadServerAction,\n renderToReadableStream,\n type ServerEntry,\n type TemporaryReferenceSet,\n} from 'react-server-dom-rspack/server';\n// Resolved by the '@rshono/deploy' alias to the selected preset's runtime module — the one place\n// this file knows anything about where it is running. See `deploy/contract.ts`.\nimport { runtime } from '@rshono/deploy';\n// @ts-expect-error — resolved by the '@rshono/routes' alias to the app's routes.ts\nimport { routes as userRoutes } from '@rshono/routes';\n// @ts-expect-error — resolved by the '@rshono/server-app' alias (src/server.ts or the empty fallback)\nimport * as serverAppModule from '@rshono/server-app';\nimport { isPageRoute, type ErrorPageInfo, type FallbackPage, type PageComponent, type PageProps, type Route, type RouteConfig } from '../router.js';\nimport { appendVary, etagMatches } from '../server/headers.js';\nimport { getRequestContext, publicUrl, readParams, reportServerError, runWithContext } from './context.js';\nimport { isControlSignal, RedirectSignal, type ControlSignal } from './control.js';\nimport { renderHTML } from './entry.ssr.js';\n// Type-only, so it is erased — the RSC layer does not take its own instance of the SSR layer's module.\nimport type { CancellableTransformer } from './flight-inject.js';\nimport { RouterProvider } from './navigation.js';\nimport { acceptsRsc, isActionRequest, parseRenderRequest, requestWantsRsc, wantsRsc } from './request.js';\n\nconst serverApp = ((serverAppModule as { default?: unknown }).default ?? null) as Hono | null;\n\n// Framework settings resolved from rshono.config.ts and compiled into the bundle at build time\n// (see builder/rspack-config.ts). These have no runtime env-var interface — env is for secrets.\n// Named after their ServerConfig fields, so what a setting does here is one grep from where it is\n// resolved. `isDev` among them: the build mode is decided by which command produced the bundle, not\n// by `process.env.NODE_ENV`, and not every runtime this deploys to has a `process` to read anyway.\nconst CONFIG = __RSHONO_CONFIG__;\nconst { isDev, cspEnabled, checkOrigin, maxBodyBytes } = CONFIG;\n/** Extra cross-origin hosts permitted to post server actions, beyond the app's own origin. */\nconst allowedOrigins = new Set(CONFIG.allowedOrigins);\n\n/** How long a prerendered page may be reused before revalidating. Also what `public/` files get. */\nconst SSG_CACHE_CONTROL = 'public, max-age=300';\n\n/**\n * The two content types a page can be served as. Both come back from the *same* URL depending on\n * the `Accept` header, which is what makes `Vary` non-optional here.\n */\nconst PAGE_CONTENT_TYPE = /^(?:text\\/html|text\\/x-component)\\b/;\n\n// The CSP is fixed per build apart from the nonce, so assemble everything but `script-src` once.\nconst CSP_STATIC = Object.entries(CONFIG.cspDirectives)\n .filter(([name]) => name !== 'script-src')\n .map(([name, value]) => `${name} ${value}`)\n .join('; ');\nconst CSP_SCRIPT_SRC = CONFIG.cspDirectives['script-src'] ?? \"'self'\";\n\n// Called here rather than at the top of the deploy runtime's own module so the timing is unchanged:\n// `.env` is loaded once every import above has been evaluated, exactly as before.\nruntime.loadEnv();\n\nconst routeConfig = userRoutes as RouteConfig;\nexport const routes: readonly Route[] = routeConfig.routes;\n\n/** The result of a server action, as a discriminated union (a `Result<T, E>`) rather than an `ok` flag over one field. */\nexport type ActionResult = { ok: true; value: unknown } | { ok: false; error: unknown };\n\nexport type RscPayload = {\n root: React.ReactNode;\n returnValue?: ActionResult;\n formState?: ReactFormState;\n redirect?: string;\n notFound?: boolean;\n};\n\n/**\n * CSRF guard for server-action POSTs, layering the two signals a browser gives us.\n *\n * `Sec-Fetch-Site` is set by the browser and unforgeable by page script, so `same-origin` settles\n * the question on its own — and short-circuiting on it is what keeps the check from misfiring on a\n * legitimate request whose `Host` the proxy rewrote. Everything else falls back to comparing the\n * `Origin` host against our own (see {@link publicUrl} — deliberately *not* against a raw\n * `X-Forwarded-Host`, which the client controls unless `trustProxy` says a proxy owns it).\n *\n * A missing `Origin` is treated as same-origin: no-JS form posts from older browsers omit it, and\n * those same browsers send no `Sec-Fetch-Site` either, so there is nothing left to check. Hosts are\n * compared case-insensitively; the scheme is not compared, so this alone won't stop an\n * `http://` origin posting to the `https://` site (HSTS is the control for that).\n */\nfunction isSameOriginAction(c: Context): boolean {\n if (!checkOrigin) return true;\n\n const secFetchSite = c.req.header('sec-fetch-site');\n if (secFetchSite === 'same-origin') return true;\n\n const origin = c.req.header('origin');\n const originHost = origin ? URL.parse(origin)?.host.toLowerCase() || null : null;\n if (origin !== undefined && originHost === null) return false; // an Origin we can't parse is untrusted.\n\n const trusted = originHost !== null && (originHost === publicUrl(c).host.toLowerCase() || allowedOrigins.has(originHost));\n\n if (secFetchSite && secFetchSite !== 'none') {\n // The browser tells us (unforgeably) this didn't originate from our own site — only a\n // trusted (allowlisted) Origin may proceed.\n return trusted;\n }\n\n if (originHost === null) return true;\n return trusted;\n}\n\nasync function loadPageModule(load: () => Promise<{ default: PageComponent }>, label: string): Promise<ServerEntry<PageComponent>> {\n const mod = await load();\n const Page = mod.default as ServerEntry<PageComponent> | undefined;\n if (typeof Page !== 'function') {\n throw new Error(`[rshono] The page module for ${label} must default-export a server component.`);\n }\n if (!Page.entryJsFiles) {\n throw new Error(\n `[rshono] The page component for ${label} is missing its client-asset info ('use server-entry'). ` +\n \"The directive is added automatically for inline `component: () => import('…')` thunks in routes.ts. \" +\n \"If this page is wired up another way, put 'use server-entry' on the first line of the page module yourself — \" +\n \"and make sure the page is a server component (a 'use client' page must be wrapped by a server component instead).\",\n );\n }\n return Page;\n}\n\n/** A browser navigation or a crawler, as opposed to a fetch that would rather have plain text. */\nfunction acceptsHtml(c: Context): boolean {\n return c.req.header('accept')?.includes('text/html') ?? false;\n}\n\n/** A lazy once-cell: runs `load` at most once and caches the promise, but clears a rejection so a later call can retry. */\nfunction once<T>(load: () => Promise<T>): () => Promise<T> {\n let promise: Promise<T> | undefined;\n return () => {\n if (!promise) {\n const pending = (promise = load());\n pending.catch(() => {\n // Only clear if we're still holding the rejected promise (a later successful load may have already replaced it).\n if (promise === pending) promise = undefined;\n });\n }\n return promise;\n };\n}\n\n/**\n * Passes `stream` through untouched, calling `done` once it ends — however it ends.\n *\n * Used on the flight-only response path, which has no transform of its own to hang a completion hook\n * off (the document path has {@link injectFlightPayload}). `done` must be idempotent: a cancelled\n * response can reach both `cancel` and the abort forwarder.\n */\nfunction releaseWhenDone(stream: ReadableStream<Uint8Array>, done: () => void): ReadableStream<Uint8Array> {\n return stream.pipeThrough(\n new TransformStream<Uint8Array, Uint8Array>({\n transform(chunk, controller) {\n controller.enqueue(chunk);\n },\n flush: done,\n cancel: done,\n } as CancellableTransformer<Uint8Array, Uint8Array>),\n );\n}\n\ninterface ComponentRenderOptions {\n status?: number;\n isRsc: boolean;\n formState?: ReactFormState;\n returnValue?: RscPayload['returnValue'];\n temporaryReferences?: TemporaryReferenceSet;\n /** Passed when the page being rendered is the `error` page, which takes it as an extra prop. */\n errorInfo?: ErrorPageInfo;\n /** Marks the payload as the not-found page, so a soft navigation can tell it apart from the page it asked for. */\n notFound?: boolean;\n}\n\n/**\n * There is no render deadline here any more.\n *\n * A `renderTimeout` setting used to wrap every request in an `AbortController` with a timer, covering\n * the server action as well as the flight and SSR passes. Every host this deploys to enforces its own\n * request timeout — Workers, Vercel and Lambda all do — so the only shape that needed one was a Node\n * process facing the internet directly, and there a proxy is both the conventional and the more capable\n * place for it. The README shows the middleware for a Node deploy that wants one in-process.\n *\n * What the deadline *also* did was carry the client-disconnect signal into the two React renderers, and\n * that is kept — but not by handing them `c.req.raw.signal`. Both React renderers add an `abort`\n * listener to whatever signal they are given and only remove it if the abort fires, so a listener left on\n * a request-lifetime signal pins the flight request, the Fizz request and the whole rendered tree. That\n * is not theoretical: handing them the request signal directly cost ~169 kB per `/ssr` request, never\n * reclaimed by a major GC, and took GC from 5.8% to 12.9% of wall time under load.\n *\n * The deadline's own `AbortController` was, accidentally, what had kept that collectable — its signal\n * died with the render. So {@link renderComponent} keeps a per-render controller and forwards the request\n * signal into it, releasing the forwarder when the response ends. Never through `AbortSignal.any([...])`,\n * which reads better and leaks worse: a signal it produced is *composite*, and Node holds every composite\n * signal carrying an `abort` listener in a process-lifetime set (`gcPersistentSignals`) until it either\n * aborts or loses its last listener.\n */\n\n/**\n * Builds the props a page component is called with.\n *\n * `url` and `params` match `useNavigation()` field for field, so a read can move between a page and\n * a `'use client'` component unchanged. The `URL` is this page's own — `RequestContext` parses its own — so a\n * page that mutates it cannot disturb anything else on the request.\n *\n * `ctx` is *defined* rather than assigned, and both parts of how carry their weight:\n *\n * - **A getter**, so nothing is built for the pages that never read it, and so a `render: 'static'`\n * page that does read it gets {@link getRequestContext}'s own \"no per-request context while\n * prerendering\" error rather than a bare `undefined` — one explanation, in one place.\n * - **Non-enumerable**, so React's *development-only* serialization of a server component's props\n * (the debug channel behind component stacks and the performance track) skips it. That walks own\n * enumerable properties, and `ctx.raw` is the Hono {@link Context} — whose `env` holds the\n * runtime's bindings. An enumerable `ctx` ships every one of them, secrets included, to the\n * browser in dev, and grows a small page's flight payload by well over 10 kB. Production never\n * serializes a server component's props at all, so this is the dev half of the same guarantee.\n *\n * The cost is that the element has to be created by handing this object to `jsx()` *by reference*:\n * a `<Page {...props} />` spread copies enumerable properties only, and would drop `ctx` silently.\n */\nfunction pageProps(c: Context, errorInfo: ErrorPageInfo | undefined): PageProps & { error?: ErrorPageInfo } {\n const props = { url: publicUrl(c), params: readParams(c), ...(errorInfo ? { error: errorInfo } : null) };\n Object.defineProperty(props, 'ctx', { get: getRequestContext, enumerable: false, configurable: true });\n return props as PageProps & { error?: ErrorPageInfo };\n}\n\nasync function renderComponent(c: Context, Page: ServerEntry<PageComponent>, opts: ComponentRenderOptions): Promise<Response> {\n // The client going away is the one thing that still aborts a render — but React's renderers must not\n // be handed `c.req.raw.signal` to watch for it. Both of them add an `abort` listener and only remove\n // it if the abort fires, so on the happy path the listener stays on a signal that lives as long as the\n // request object, and through it pins the flight request, the Fizz request and the whole rendered\n // tree. Measured at ~169 kB per `/ssr` request, never reclaimed by a major GC.\n //\n // So the render gets a controller of its own and the request signal only forwards into it. The\n // forwarding listener is `once`, so an abort removes it, and {@link release} removes it on the normal\n // path — which is what keeps the request from retaining the render. Deliberately not\n // `AbortSignal.any()`: a signal it produced is *composite*, and Node holds every composite signal\n // carrying an `abort` listener in a process-lifetime set until it aborts or loses its last listener,\n // which is a worse leak than the one being fixed here.\n const requestSignal = c.req.raw.signal;\n const renderAbort = new AbortController();\n const signal = renderAbort.signal;\n const forwardAbort = () => renderAbort.abort(requestSignal.reason);\n if (requestSignal.aborted) renderAbort.abort(requestSignal.reason);\n else requestSignal.addEventListener('abort', forwardAbort, { once: true });\n /** Detaches the forwarder once the response has been written, so nothing survives the request. */\n const release = () => requestSignal.removeEventListener('abort', forwardAbort);\n\n const nonce = cspEnabled && !opts.isRsc ? crypto.randomUUID() : undefined;\n const props = pageProps(c, opts.errorInfo);\n const root = (\n <>\n {nonce && <meta property=\"csp-nonce\" nonce={nonce} />}\n {Page.entryCssFiles?.map((href) => (\n <link key={href} rel=\"stylesheet\" href={href} precedence=\"default\" />\n ))}\n {/* `href`, not the `URL` itself: these props cross into a client component, so they have to be serializable. */}\n <RouterProvider href={props.url.href} params={props.params}>\n {jsx(Page, props)}\n </RouterProvider>\n </>\n );\n\n // `notFound` only when it is true, so the flight payload of an ordinary page doesn't carry the key.\n const rscPayload: RscPayload = { root, formState: opts.formState, returnValue: opts.returnValue, ...(opts.notFound ? { notFound: true } : null) };\n\n let controlSignal: ControlSignal | undefined;\n const rscStream = renderToReadableStream(rscPayload, {\n temporaryReferences: opts.temporaryReferences,\n signal,\n onError(error) {\n if (isControlSignal(error)) {\n controlSignal = error;\n return error.digest;\n }\n if (!signal.aborted) reportServerError(error, { source: 'render', request: c.req.raw, message: '[rshono] render error:' });\n },\n });\n\n if (opts.isRsc) {\n return c.body(releaseWhenDone(rscStream, release), (opts.status ?? 200) as ContentfulStatusCode, {\n 'content-type': 'text/x-component;charset=utf-8',\n });\n }\n\n let ssrResult: Awaited<ReturnType<typeof renderHTML>>;\n try {\n ssrResult = await renderHTML(rscStream, {\n bootstrapScripts: Page.entryJsFiles,\n formState: opts.formState,\n signal,\n nonce,\n onDone: release,\n onShellError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR shell error:' }),\n onError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR error:' }),\n });\n } catch (error) {\n release();\n if (controlSignal) throw controlSignal;\n throw error;\n }\n if (controlSignal) {\n release();\n throw controlSignal;\n }\n const headers: Record<string, string> = { 'content-type': 'text/html;charset=utf-8' };\n if (nonce) {\n // The nonce is always appended to whatever `script-src` resolved to, so overriding the\n // directive in `cspDirectives` can widen the policy but can't accidentally drop the nonce.\n // Dev additionally needs 'unsafe-eval' for react-refresh.\n const scriptSrc = `script-src ${CSP_SCRIPT_SRC} 'nonce-${nonce}'${isDev ? \" 'unsafe-eval'\" : ''}`;\n headers['content-security-policy'] = CSP_STATIC ? `${CSP_STATIC}; ${scriptSrc}` : scriptSrc;\n }\n return c.body(ssrResult.stream, (ssrResult.status ?? opts.status ?? 200) as ContentfulStatusCode, headers);\n}\n\nasync function renderPage(c: Context, loadPage: () => Promise<ServerEntry<PageComponent>>): Promise<Response> {\n const request = c.req.raw;\n const renderRequest = parseRenderRequest(request);\n\n let returnValue: ActionResult | undefined;\n let formState: ReactFormState | undefined;\n let temporaryReferences: TemporaryReferenceSet | undefined;\n let actionStatus: number | undefined;\n if (isActionRequest(renderRequest)) {\n if (!isSameOriginAction(c)) {\n return c.text('Forbidden: cross-origin server action rejected', 403);\n }\n if (renderRequest.kind === 'rsc-action') {\n // Checked before the body is decoded, so an unknown id costs nothing to reject — and\n // `loadServerAction` would otherwise fault on the missing manifest entry, turning a bad\n // request into an unhandled 500. `hasOwn` so `__proto__` doesn't resolve to a manifest entry.\n if (!Object.hasOwn(__rspack_rsc_manifest__.serverManifest, renderRequest.actionId)) {\n return c.text('Bad Request: unknown server action', 400);\n }\n const contentType = request.headers.get('content-type');\n const body = contentType?.startsWith('multipart/form-data') ? await request.formData() : await request.text();\n temporaryReferences = createTemporaryReferenceSet();\n const args = await decodeReply<unknown[]>(body, { temporaryReferences });\n const action = loadServerAction(renderRequest.actionId);\n try {\n returnValue = { ok: true, value: await action.apply(null, args) };\n } catch (error) {\n if (isControlSignal(error)) throw error;\n // React sends a thrown action error to the client as an opaque marker in production — no\n // message, no digest — so without this the failure would be invisible on both ends.\n reportServerError(error, { source: 'action', request, message: '[rshono] server action error:' });\n returnValue = { ok: false, error };\n actionStatus = 500;\n }\n } else {\n const formData = await request.formData();\n const decodedAction = await decodeAction(formData, __rspack_rsc_manifest__.serverManifest);\n if (decodedAction) {\n const result = await decodedAction();\n formState = (await decodeFormState(result, formData, __rspack_rsc_manifest__.serverManifest)) ?? undefined;\n }\n }\n }\n\n const Page = await loadPage();\n return renderComponent(c, Page, {\n status: actionStatus,\n isRsc: wantsRsc(renderRequest),\n formState,\n returnValue,\n temporaryReferences,\n });\n}\n\nfunction buildApp(): Hono {\n const app = new Hono();\n\n // Cheap, unconditional headers that only matter when something else has gone wrong: stop\n // content-type sniffing, keep the full URL (paths, query) out of cross-origin referrers, and\n // refuse to be framed by another origin (clickjacking). `frame-ancestors` in the opt-in CSP is\n // stricter and takes precedence where both apply; this is the floor for everyone else.\n // Set after `next()` so a route or middleware that sets its own value wins.\n app.use(async (c, next) => {\n await next();\n const headers = c.res.headers;\n if (!headers.has('x-content-type-options')) headers.set('x-content-type-options', 'nosniff');\n if (!headers.has('referrer-policy')) headers.set('referrer-policy', 'strict-origin-when-cross-origin');\n if (!headers.has('x-frame-options')) headers.set('x-frame-options', 'SAMEORIGIN');\n\n // Page responses only, from here down. Two things are true of them and of nothing else served\n // here: one URL answers with either an HTML document or a flight payload depending on `Accept`,\n // and the default page is request-specific (cookies, session, headers).\n if (!PAGE_CONTENT_TYPE.test(headers.get('content-type') ?? '')) return;\n appendVary(headers, 'Accept');\n // Without this a page carries no cache directives at all, and a shared cache — a CDN, a\n // corporate proxy — is free to store a logged-in user's page and hand it to someone else.\n // `private` forbids exactly that; `no-cache` makes the browser revalidate its own copy rather\n // than re-showing a stale personalised page. Neither blocks bfcache, which `no-store` would.\n // A prerendered page, or anything a route set deliberately, already has its own value.\n if (!headers.has('cache-control')) headers.set('cache-control', 'private, no-cache');\n });\n\n // A memory-exhaustion guard for *every* route — pages and actions, `{ type: 'endpoint' }` routes\n // and the src/server.ts sub-app alike — since anything that buffers a body (`.json()`,\n // `.formData()`) is exposed, not just server actions. Rejects an over-cap `Content-Length` up\n // front and otherwise counts the stream, so a chunked or under-reported body is still cut off.\n if (maxBodyBytes > 0) {\n app.use(bodyLimit({ maxSize: maxBodyBytes, onError: (c) => c.text('Payload Too Large', 413) }));\n }\n\n runtime.mountStaticAssets(app);\n\n // Mounted ahead of the page routes so the sub-app's middleware (auth, logging, trailing-slash)\n // wraps page requests too. The flip side: a *terminal* handler in src/server.ts at the same path\n // as a page route wins over the page.\n if (serverApp) {\n app.route('/', serverApp);\n }\n\n const memoizePage = (page: FallbackPage, label: string) => once(() => loadPageModule(page.component, label));\n const loadNotFoundPage = routeConfig.notFound ? memoizePage(routeConfig.notFound, 'the notFound page') : null;\n\n /** Turns a thrown `redirect()` / `notFound()` into the response it stands for. */\n const respondToControlSignal = async (c: Context, signal: ControlSignal): Promise<Response> => {\n const isRsc = requestWantsRsc(c.req.raw);\n if (signal instanceof RedirectSignal) {\n if (isRsc) {\n return c.body(renderToReadableStream({ root: null, redirect: signal.location } satisfies RscPayload, { signal: c.req.raw.signal }), 200, {\n 'content-type': 'text/x-component;charset=utf-8',\n });\n }\n return c.redirect(signal.location, signal.status as RedirectStatusCode);\n }\n if (loadNotFoundPage) {\n return renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc, notFound: true });\n }\n // Plain text, but still one of the two answers this URL gives depending on `Accept`.\n return c.text('Not Found', 404, { vary: 'Accept' });\n };\n\n for (const route of routes) {\n if (isPageRoute(route)) {\n // Both are fixed for the life of the process, so resolve them once here instead of per request.\n const servesPrerendered = !isDev && route.render === 'static';\n const loadPage = once(() => loadPageModule(route.component, `\"${route.path}\"`));\n\n const handler: Handler = async (c) => {\n try {\n if (servesPrerendered && c.req.method === 'GET') {\n const isRsc = acceptsRsc(c.req.raw);\n // A prerendered file is one fixed set of bytes, so it cannot carry a per-request nonce:\n // under `csp` the *document* has to be rendered per request. The flight payload never\n // carries a nonce, so it stays servable from the build either way.\n const mustRenderForNonce = cspEnabled && !isRsc;\n // Otherwise both representations come from the build, so a soft navigation is served from\n // it too rather than re-rendering a page that was already built.\n if (!mustRenderForNonce) {\n const page = await runtime.readPrerendered(c, isRsc ? 'flight' : 'html');\n // A prerendered page is request-independent by construction, so it is safe to cache\n // publicly; the short max-age matches what `public/` files get. The ETag turns the\n // revalidation that follows into a 304 rather than the page all over again.\n //\n // Answered outside `runWithContext`: no app code runs on this path, so there is no\n // `getRequestContext()` to serve and no reason to pay for the AsyncLocalStorage scope.\n if (page !== null) {\n const headers = {\n 'cache-control': SSG_CACHE_CONTROL,\n etag: page.etag,\n vary: 'Accept',\n 'content-type': isRsc ? 'text/x-component;charset=utf-8' : 'text/html;charset=utf-8',\n };\n if (etagMatches(c.req.header('if-none-match'), page.etag)) return c.body(null, 304, headers);\n return c.body(page.body, 200, { ...headers, 'content-length': page.contentLength });\n }\n }\n }\n return await runWithContext(c, () => renderPage(c, loadPage));\n } catch (error) {\n if (isControlSignal(error)) return runWithContext(c, () => respondToControlSignal(c, error));\n throw error;\n }\n };\n app.on(['GET', 'POST'], route.path, handler);\n } else {\n const loadEndpoint = once(() => route.server());\n const handler: Handler = async (c, next) => {\n const { handler: endpointHandler } = await loadEndpoint();\n return endpointHandler(c, next);\n };\n const method = route.method ?? 'all';\n if (method === 'all') app.all(route.path, handler);\n else app.on(method.toUpperCase(), route.path, handler);\n }\n }\n\n runtime.mountPublicFallback(app);\n\n app.notFound(async (c) => {\n const isRsc = requestWantsRsc(c.req.raw);\n if (loadNotFoundPage && (isRsc || acceptsHtml(c))) {\n return runWithContext(c, async () => renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc }));\n }\n return c.text('Not Found', 404, { vary: 'Accept' });\n });\n\n const loadErrorPage = routeConfig.error ? memoizePage(routeConfig.error, 'the error page') : null;\n app.onError(async (error, c) => {\n if (isControlSignal(error)) return runWithContext(c, () => respondToControlSignal(c, error));\n reportServerError(error, { source: 'request', request: c.req.raw, message: '[rshono] request error:' });\n const isRsc = requestWantsRsc(c.req.raw);\n if (loadErrorPage && (isRsc || acceptsHtml(c))) {\n const errorInfo: ErrorPageInfo = isDev\n ? {\n message: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n }\n : { message: 'Internal Server Error' };\n try {\n return await runWithContext(c, async () => renderComponent(c, await loadErrorPage(), { status: 500, isRsc, errorInfo }));\n } catch (renderError) {\n reportServerError(renderError, { source: 'request', request: c.req.raw, message: '[rshono] the error page failed to render:' });\n }\n }\n const detail = isDev ? `\\n\\n${error instanceof Error ? (error.stack ?? error.message) : String(error)}` : '';\n return c.text(`Internal Server Error${detail}`, 500, { vary: 'Accept' });\n });\n\n return app;\n}\n\nexport const app = buildApp();\n\n/**\n * The app, handed to whatever is hosting it.\n *\n * On a platform where rshono owns the process this binds a port and the default export is nothing;\n * where the host owns it, this *is* the export the platform looks for — so the same entry serves\n * both without a per-platform entry file. `app` and `routes` stay named exports either way, because\n * `rshono build` imports them to prerender `render: 'static'` routes.\n */\nexport default runtime.serveApp(app);\n"]}
|
|
1
|
+
{"version":3,"file":"entry.rsc.js","sourceRoot":"","sources":["../../src/runtime/entry.rsc.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,0FAA0F;AAC1F,qGAAqG;AACrG,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,8FAA8F;AAC9F,qGAAqG;AACrG,mGAAmG;AACnG,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,sBAAsB,GAGvB,MAAM,gCAAgC,CAAC;AACxC,iGAAiG;AACjG,gFAAgF;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,mFAAmF;AACnF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtD,sGAAsG;AACtG,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAA2G,MAAM,cAAc,CAAC;AACpJ,OAAO,EAAE,UAAU,EAAE,WAAW,E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C;AAE9B;;;;;;;GAOG;AACH,eAAe,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import type { Context, Handler } from 'hono';\nimport { Hono } from 'hono';\nimport { bodyLimit } from 'hono/body-limit';\nimport type { ContentfulStatusCode, RedirectStatusCode } from 'hono/utils/http-status';\nimport type React from 'react';\nimport type { ReactFormState } from 'react-dom/client';\n// The JSX factory, by name: the page element is created with this directly rather than as\n// `<Page {...props} />`, because a spread would drop the non-enumerable `ctx` prop. See `pageProps`.\nimport { jsx } from 'react/jsx-runtime';\n// The bare specifier, not `/server.node`: the package ships a build per runtime behind export\n// conditions (`node`, `workerd`, `deno`, `edge-light`), and the RSC layer's `conditionNames` is what\n// picks one — so a non-Node deploy target gets its own build instead of Node's by hard-coded path.\nimport {\n createTemporaryReferenceSet,\n decodeAction,\n decodeFormState,\n decodeReply,\n loadServerAction,\n renderToReadableStream,\n type ServerEntry,\n type TemporaryReferenceSet,\n} from 'react-server-dom-rspack/server';\n// Resolved by the '@rshono/deploy' alias to the selected preset's runtime module — the one place\n// this file knows anything about where it is running. See `deploy/contract.ts`.\nimport { runtime } from '@rshono/deploy';\n// @ts-expect-error — resolved by the '@rshono/routes' alias to the app's routes.ts\nimport { routes as userRoutes } from '@rshono/routes';\n// @ts-expect-error — resolved by the '@rshono/server-app' alias (src/server.ts or the empty fallback)\nimport * as serverAppModule from '@rshono/server-app';\nimport { isPageRoute, type ErrorPageInfo, type FallbackPage, type PageComponent, type PageProps, type Route, type RouteConfig } from '../router.js';\nimport { appendVary, etagMatches } from '../server/headers.js';\nimport { beginPageRender, getRequestContext, publicUrl, readParams, reportServerError, runWithContext } from './context.js';\nimport { isControlSignal, RedirectSignal, type ControlSignal } from './control.js';\nimport { renderHTML } from './entry.ssr.js';\n// Type-only, so it is erased — the RSC layer does not take its own instance of the SSR layer's module.\nimport type { CancellableTransformer } from './flight-inject.js';\nimport { RouterProvider } from './navigation.js';\nimport { acceptsRsc, isActionRequest, parseRenderRequest, requestWantsRsc, wantsRsc } from './request.js';\n\nconst serverApp = ((serverAppModule as { default?: unknown }).default ?? null) as Hono | null;\n\n// Framework settings resolved from rshono.config.ts and compiled into the bundle at build time\n// (see builder/rspack-config.ts). These have no runtime env-var interface — env is for secrets.\n// Named after their ServerConfig fields, so what a setting does here is one grep from where it is\n// resolved. `isDev` among them: the build mode is decided by which command produced the bundle, not\n// by `process.env.NODE_ENV`, and not every runtime this deploys to has a `process` to read anyway.\nconst CONFIG = __RSHONO_CONFIG__;\nconst { isDev, cspEnabled, checkOrigin, maxBodyBytes } = CONFIG;\n/** Extra cross-origin hosts permitted to post server actions, beyond the app's own origin. */\nconst allowedOrigins = new Set(CONFIG.allowedOrigins);\n\n/** How long a prerendered page may be reused before revalidating. Also what `public/` files get. */\nconst SSG_CACHE_CONTROL = 'public, max-age=300';\n\n/**\n * The two content types a page can be served as. Both come back from the *same* URL depending on\n * the `Accept` header, which is what makes `Vary` non-optional here.\n */\nconst PAGE_CONTENT_TYPE = /^(?:text\\/html|text\\/x-component)\\b/;\n\n// The CSP is fixed per build apart from the nonce, so assemble everything but `script-src` once.\nconst CSP_STATIC = Object.entries(CONFIG.cspDirectives)\n .filter(([name]) => name !== 'script-src')\n .map(([name, value]) => `${name} ${value}`)\n .join('; ');\nconst CSP_SCRIPT_SRC = CONFIG.cspDirectives['script-src'] ?? \"'self'\";\n\n// Called here rather than at the top of the deploy runtime's own module so the timing is unchanged:\n// `.env` is loaded once every import above has been evaluated, exactly as before.\nruntime.loadEnv();\n\nconst routeConfig = userRoutes as RouteConfig;\nexport const routes: readonly Route[] = routeConfig.routes;\n\n/** The result of a server action, as a discriminated union (a `Result<T, E>`) rather than an `ok` flag over one field. */\nexport type ActionResult = { ok: true; value: unknown } | { ok: false; error: unknown };\n\nexport type RscPayload = {\n root: React.ReactNode;\n returnValue?: ActionResult;\n formState?: ReactFormState;\n redirect?: string;\n notFound?: boolean;\n};\n\n/**\n * CSRF guard for server-action POSTs, layering the two signals a browser gives us.\n *\n * `Sec-Fetch-Site` is set by the browser and unforgeable by page script, so `same-origin` settles\n * the question on its own — and short-circuiting on it is what keeps the check from misfiring on a\n * legitimate request whose `Host` the proxy rewrote. Everything else falls back to comparing the\n * `Origin` host against our own (see {@link publicUrl} — deliberately *not* against a raw\n * `X-Forwarded-Host`, which the client controls unless `trustProxy` says a proxy owns it).\n *\n * A missing `Origin` is treated as same-origin: no-JS form posts from older browsers omit it, and\n * those same browsers send no `Sec-Fetch-Site` either, so there is nothing left to check. Hosts are\n * compared case-insensitively; the scheme is not compared, so this alone won't stop an\n * `http://` origin posting to the `https://` site (HSTS is the control for that).\n */\nfunction isSameOriginAction(c: Context): boolean {\n if (!checkOrigin) return true;\n\n const secFetchSite = c.req.header('sec-fetch-site');\n if (secFetchSite === 'same-origin') return true;\n\n const origin = c.req.header('origin');\n const originHost = origin ? URL.parse(origin)?.host.toLowerCase() || null : null;\n if (origin !== undefined && originHost === null) return false; // an Origin we can't parse is untrusted.\n\n const trusted = originHost !== null && (originHost === publicUrl(c).host.toLowerCase() || allowedOrigins.has(originHost));\n\n if (secFetchSite && secFetchSite !== 'none') {\n // The browser tells us (unforgeably) this didn't originate from our own site — only a\n // trusted (allowlisted) Origin may proceed.\n return trusted;\n }\n\n if (originHost === null) return true;\n return trusted;\n}\n\nasync function loadPageModule(load: () => Promise<{ default: PageComponent }>, label: string): Promise<ServerEntry<PageComponent>> {\n const mod = await load();\n const Page = mod.default as ServerEntry<PageComponent> | undefined;\n if (typeof Page !== 'function') {\n throw new Error(`[rshono] The page module for ${label} must default-export a server component.`);\n }\n if (!Page.entryJsFiles) {\n throw new Error(\n `[rshono] The page component for ${label} is missing its client-asset info ('use server-entry'). ` +\n \"The directive is added automatically for inline `component: () => import('…')` thunks in routes.ts. \" +\n \"If this page is wired up another way, put 'use server-entry' on the first line of the page module yourself — \" +\n \"and make sure the page is a server component (a 'use client' page must be wrapped by a server component instead).\",\n );\n }\n return Page;\n}\n\n/** A browser navigation or a crawler, as opposed to a fetch that would rather have plain text. */\nfunction acceptsHtml(c: Context): boolean {\n return c.req.header('accept')?.includes('text/html') ?? false;\n}\n\n/** A lazy once-cell: runs `load` at most once and caches the promise, but clears a rejection so a later call can retry. */\nfunction once<T>(load: () => Promise<T>): () => Promise<T> {\n let promise: Promise<T> | undefined;\n return () => {\n if (!promise) {\n const pending = (promise = load());\n pending.catch(() => {\n // Only clear if we're still holding the rejected promise (a later successful load may have already replaced it).\n if (promise === pending) promise = undefined;\n });\n }\n return promise;\n };\n}\n\n/**\n * Passes `stream` through untouched, calling `done` once it ends — however it ends.\n *\n * Used on the flight-only response path, which has no transform of its own to hang a completion hook\n * off (the document path has {@link injectFlightPayload}). `done` must be idempotent: a cancelled\n * response can reach both `cancel` and the abort forwarder.\n */\nfunction releaseWhenDone(stream: ReadableStream<Uint8Array>, done: () => void): ReadableStream<Uint8Array> {\n return stream.pipeThrough(\n new TransformStream<Uint8Array, Uint8Array>({\n transform(chunk, controller) {\n controller.enqueue(chunk);\n },\n flush: done,\n cancel: done,\n } as CancellableTransformer<Uint8Array, Uint8Array>),\n );\n}\n\ninterface ComponentRenderOptions {\n status?: number;\n isRsc: boolean;\n formState?: ReactFormState;\n returnValue?: RscPayload['returnValue'];\n temporaryReferences?: TemporaryReferenceSet;\n /** Passed when the page being rendered is the `error` page, which takes it as an extra prop. */\n errorInfo?: ErrorPageInfo;\n /** Marks the payload as the not-found page, so a soft navigation can tell it apart from the page it asked for. */\n notFound?: boolean;\n}\n\n/**\n * There is no render deadline here any more.\n *\n * A `renderTimeout` setting used to wrap every request in an `AbortController` with a timer, covering\n * the server action as well as the flight and SSR passes. Every host this deploys to enforces its own\n * request timeout — Workers, Vercel and Lambda all do — so the only shape that needed one was a Node\n * process facing the internet directly, and there a proxy is both the conventional and the more capable\n * place for it. The README shows the middleware for a Node deploy that wants one in-process.\n *\n * What the deadline *also* did was carry the client-disconnect signal into the two React renderers, and\n * that is kept — but not by handing them `c.req.raw.signal`. Both React renderers add an `abort`\n * listener to whatever signal they are given and only remove it if the abort fires, so a listener left on\n * a request-lifetime signal pins the flight request, the Fizz request and the whole rendered tree. That\n * is not theoretical: handing them the request signal directly cost ~169 kB per `/ssr` request, never\n * reclaimed by a major GC, and took GC from 5.8% to 12.9% of wall time under load.\n *\n * The deadline's own `AbortController` was, accidentally, what had kept that collectable — its signal\n * died with the render. So {@link renderComponent} keeps a per-render controller and forwards the request\n * signal into it, releasing the forwarder when the response ends. Never through `AbortSignal.any([...])`,\n * which reads better and leaks worse: a signal it produced is *composite*, and Node holds every composite\n * signal carrying an `abort` listener in a process-lifetime set (`gcPersistentSignals`) until it either\n * aborts or loses its last listener.\n */\n\n/**\n * Builds the props a page component is called with.\n *\n * `url` and `params` match `useNavigation()` field for field, so a read can move between a page and\n * a `'use client'` component unchanged. The `URL` is this page's own — `RequestContext` parses its own — so a\n * page that mutates it cannot disturb anything else on the request.\n *\n * `ctx` is *defined* rather than assigned, and both parts of how carry their weight:\n *\n * - **A getter**, so nothing is built for the pages that never read it, and so a `render: 'static'`\n * page that does read it gets {@link getRequestContext}'s own \"no per-request context while\n * prerendering\" error rather than a bare `undefined` — one explanation, in one place.\n * - **Non-enumerable**, so React's *development-only* serialization of a server component's props\n * (the debug channel behind component stacks and the performance track) skips it. That walks own\n * enumerable properties, and `ctx.hono` is the Hono {@link Context} — whose `env` holds the\n * runtime's bindings. An enumerable `ctx` ships every one of them, secrets included, to the\n * browser in dev, and grows a small page's flight payload by well over 10 kB. Production never\n * serializes a server component's props at all, so this is the dev half of the same guarantee.\n *\n * The cost is that the element has to be created by handing this object to `jsx()` *by reference*:\n * a `<Page {...props} />` spread copies enumerable properties only, and would drop `ctx` silently.\n */\nfunction pageProps(c: Context, errorInfo: ErrorPageInfo | undefined): PageProps & { error?: ErrorPageInfo } {\n const props = { url: publicUrl(c), params: readParams(c), ...(errorInfo ? { error: errorInfo } : null) };\n Object.defineProperty(props, 'ctx', { get: getRequestContext, enumerable: false, configurable: true });\n return props as PageProps & { error?: ErrorPageInfo };\n}\n\nasync function renderComponent(c: Context, Page: ServerEntry<PageComponent>, opts: ComponentRenderOptions): Promise<Response> {\n // The client going away is the one thing that still aborts a render — but React's renderers must not\n // be handed `c.req.raw.signal` to watch for it. Both of them add an `abort` listener and only remove\n // it if the abort fires, so on the happy path the listener stays on a signal that lives as long as the\n // request object, and through it pins the flight request, the Fizz request and the whole rendered\n // tree. Measured at ~169 kB per `/ssr` request, never reclaimed by a major GC.\n //\n // So the render gets a controller of its own and the request signal only forwards into it. The\n // forwarding listener is `once`, so an abort removes it, and {@link release} removes it on the normal\n // path — which is what keeps the request from retaining the render. Deliberately not\n // `AbortSignal.any()`: a signal it produced is *composite*, and Node holds every composite signal\n // carrying an `abort` listener in a process-lifetime set until it aborts or loses its last listener,\n // which is a worse leak than the one being fixed here.\n const requestSignal = c.req.raw.signal;\n const renderAbort = new AbortController();\n const signal = renderAbort.signal;\n const forwardAbort = () => renderAbort.abort(requestSignal.reason);\n if (requestSignal.aborted) renderAbort.abort(requestSignal.reason);\n else requestSignal.addEventListener('abort', forwardAbort, { once: true });\n /** Detaches the forwarder once the response has been written, so nothing survives the request. */\n const release = () => requestSignal.removeEventListener('abort', forwardAbort);\n\n const nonce = cspEnabled && !opts.isRsc ? crypto.randomUUID() : undefined;\n const props = pageProps(c, opts.errorInfo);\n const root = (\n <>\n {nonce && <meta property=\"csp-nonce\" nonce={nonce} />}\n {Page.entryCssFiles?.map((href) => (\n <link key={href} rel=\"stylesheet\" href={href} precedence=\"default\" />\n ))}\n {/* `href`, not the `URL` itself: these props cross into a client component, so they have to be serializable. */}\n <RouterProvider href={props.url.href} params={props.params}>\n {jsx(Page, props)}\n </RouterProvider>\n </>\n );\n\n // `notFound` only when it is true, so the flight payload of an ordinary page doesn't carry the key.\n const rscPayload: RscPayload = { root, formState: opts.formState, returnValue: opts.returnValue, ...(opts.notFound ? { notFound: true } : null) };\n\n // Past this line the response head belongs to the framework, so `ctx.setHeader()` and\n // `ctx.cookies.set()` start throwing rather than writing somewhere nothing will read. It has to be\n // the last thing before the render: a server action ran earlier in `renderPage` and legitimately\n // writes to the response, and so does any middleware that wrapped this handler.\n beginPageRender(c);\n\n let controlSignal: ControlSignal | undefined;\n const rscStream = renderToReadableStream(rscPayload, {\n temporaryReferences: opts.temporaryReferences,\n signal,\n onError(error) {\n if (isControlSignal(error)) {\n controlSignal = error;\n return error.digest;\n }\n if (!signal.aborted) reportServerError(error, { source: 'render', request: c.req.raw, message: '[rshono] render error:' });\n },\n });\n\n if (opts.isRsc) {\n return c.body(releaseWhenDone(rscStream, release), (opts.status ?? 200) as ContentfulStatusCode, {\n 'content-type': 'text/x-component;charset=utf-8',\n });\n }\n\n let ssrResult: Awaited<ReturnType<typeof renderHTML>>;\n try {\n ssrResult = await renderHTML(rscStream, {\n bootstrapScripts: Page.entryJsFiles,\n formState: opts.formState,\n signal,\n nonce,\n onDone: release,\n onShellError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR shell error:' }),\n onError: (error) => reportServerError(error, { source: 'ssr', request: c.req.raw, message: '[rshono] SSR error:' }),\n });\n } catch (error) {\n release();\n if (controlSignal) throw controlSignal;\n throw error;\n }\n if (controlSignal) {\n release();\n throw controlSignal;\n }\n const headers: Record<string, string> = { 'content-type': 'text/html;charset=utf-8' };\n if (nonce) {\n // The nonce is always appended to whatever `script-src` resolved to, so overriding the\n // directive in `cspDirectives` can widen the policy but can't accidentally drop the nonce.\n // Dev additionally needs 'unsafe-eval' for react-refresh.\n const scriptSrc = `script-src ${CSP_SCRIPT_SRC} 'nonce-${nonce}'${isDev ? \" 'unsafe-eval'\" : ''}`;\n headers['content-security-policy'] = CSP_STATIC ? `${CSP_STATIC}; ${scriptSrc}` : scriptSrc;\n }\n return c.body(ssrResult.stream, (ssrResult.status ?? opts.status ?? 200) as ContentfulStatusCode, headers);\n}\n\nasync function renderPage(c: Context, loadPage: () => Promise<ServerEntry<PageComponent>>): Promise<Response> {\n const request = c.req.raw;\n const renderRequest = parseRenderRequest(request);\n\n let returnValue: ActionResult | undefined;\n let formState: ReactFormState | undefined;\n let temporaryReferences: TemporaryReferenceSet | undefined;\n let actionStatus: number | undefined;\n if (isActionRequest(renderRequest)) {\n if (!isSameOriginAction(c)) {\n return c.text('Forbidden: cross-origin server action rejected', 403);\n }\n if (renderRequest.kind === 'rsc-action') {\n // Checked before the body is decoded, so an unknown id costs nothing to reject — and\n // `loadServerAction` would otherwise fault on the missing manifest entry, turning a bad\n // request into an unhandled 500. `hasOwn` so `__proto__` doesn't resolve to a manifest entry.\n if (!Object.hasOwn(__rspack_rsc_manifest__.serverManifest, renderRequest.actionId)) {\n return c.text('Bad Request: unknown server action', 400);\n }\n const contentType = request.headers.get('content-type');\n const body = contentType?.startsWith('multipart/form-data') ? await request.formData() : await request.text();\n temporaryReferences = createTemporaryReferenceSet();\n const args = await decodeReply<unknown[]>(body, { temporaryReferences });\n const action = loadServerAction(renderRequest.actionId);\n try {\n returnValue = { ok: true, value: await action.apply(null, args) };\n } catch (error) {\n if (isControlSignal(error)) throw error;\n // React sends a thrown action error to the client as an opaque marker in production — no\n // message, no digest — so without this the failure would be invisible on both ends.\n reportServerError(error, { source: 'action', request, message: '[rshono] server action error:' });\n returnValue = { ok: false, error };\n actionStatus = 500;\n }\n } else {\n const formData = await request.formData();\n const decodedAction = await decodeAction(formData, __rspack_rsc_manifest__.serverManifest);\n if (decodedAction) {\n const result = await decodedAction();\n formState = (await decodeFormState(result, formData, __rspack_rsc_manifest__.serverManifest)) ?? undefined;\n }\n }\n }\n\n const Page = await loadPage();\n return renderComponent(c, Page, {\n status: actionStatus,\n isRsc: wantsRsc(renderRequest),\n formState,\n returnValue,\n temporaryReferences,\n });\n}\n\nfunction buildApp(): Hono {\n const app = new Hono();\n\n // Cheap, unconditional headers that only matter when something else has gone wrong: stop\n // content-type sniffing, keep the full URL (paths, query) out of cross-origin referrers, and\n // refuse to be framed by another origin (clickjacking). `frame-ancestors` in the opt-in CSP is\n // stricter and takes precedence where both apply; this is the floor for everyone else.\n // Set after `next()` so a route or middleware that sets its own value wins.\n app.use(async (c, next) => {\n await next();\n const headers = c.res.headers;\n if (!headers.has('x-content-type-options')) headers.set('x-content-type-options', 'nosniff');\n if (!headers.has('referrer-policy')) headers.set('referrer-policy', 'strict-origin-when-cross-origin');\n if (!headers.has('x-frame-options')) headers.set('x-frame-options', 'SAMEORIGIN');\n\n // Page responses only, from here down. Two things are true of them and of nothing else served\n // here: one URL answers with either an HTML document or a flight payload depending on `Accept`,\n // and the default page is request-specific (cookies, session, headers).\n if (!PAGE_CONTENT_TYPE.test(headers.get('content-type') ?? '')) return;\n appendVary(headers, 'Accept');\n // Without this a page carries no cache directives at all, and a shared cache — a CDN, a\n // corporate proxy — is free to store a logged-in user's page and hand it to someone else.\n // `private` forbids exactly that; `no-cache` makes the browser revalidate its own copy rather\n // than re-showing a stale personalised page. Neither blocks bfcache, which `no-store` would.\n // A prerendered page, or anything a route set deliberately, already has its own value.\n if (!headers.has('cache-control')) headers.set('cache-control', 'private, no-cache');\n });\n\n // A memory-exhaustion guard for *every* route — pages and actions, `{ type: 'endpoint' }` routes\n // and the src/server.ts sub-app alike — since anything that buffers a body (`.json()`,\n // `.formData()`) is exposed, not just server actions. Rejects an over-cap `Content-Length` up\n // front and otherwise counts the stream, so a chunked or under-reported body is still cut off.\n if (maxBodyBytes > 0) {\n app.use(bodyLimit({ maxSize: maxBodyBytes, onError: (c) => c.text('Payload Too Large', 413) }));\n }\n\n runtime.mountStaticAssets(app);\n\n // Mounted ahead of the page routes so the sub-app's middleware (auth, logging, trailing-slash)\n // wraps page requests too. The flip side: a *terminal* handler in src/server.ts at the same path\n // as a page route wins over the page.\n if (serverApp) {\n app.route('/', serverApp);\n }\n\n const memoizePage = (page: FallbackPage, label: string) => once(() => loadPageModule(page.component, label));\n const loadNotFoundPage = routeConfig.notFound ? memoizePage(routeConfig.notFound, 'the notFound page') : null;\n\n /** Turns a thrown `redirect()` / `notFound()` into the response it stands for. */\n const respondToControlSignal = async (c: Context, signal: ControlSignal): Promise<Response> => {\n const isRsc = requestWantsRsc(c.req.raw);\n if (signal instanceof RedirectSignal) {\n if (isRsc) {\n return c.body(renderToReadableStream({ root: null, redirect: signal.location } satisfies RscPayload, { signal: c.req.raw.signal }), 200, {\n 'content-type': 'text/x-component;charset=utf-8',\n });\n }\n return c.redirect(signal.location, signal.status as RedirectStatusCode);\n }\n if (loadNotFoundPage) {\n return renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc, notFound: true });\n }\n // Plain text, but still one of the two answers this URL gives depending on `Accept`.\n return c.text('Not Found', 404, { vary: 'Accept' });\n };\n\n for (const route of routes) {\n if (isPageRoute(route)) {\n // Both are fixed for the life of the process, so resolve them once here instead of per request.\n const servesPrerendered = !isDev && route.render === 'static';\n const loadPage = once(() => loadPageModule(route.component, `\"${route.path}\"`));\n\n const handler: Handler = async (c) => {\n try {\n if (servesPrerendered && c.req.method === 'GET') {\n const isRsc = acceptsRsc(c.req.raw);\n // A prerendered file is one fixed set of bytes, so it cannot carry a per-request nonce:\n // under `csp` the *document* has to be rendered per request. The flight payload never\n // carries a nonce, so it stays servable from the build either way.\n const mustRenderForNonce = cspEnabled && !isRsc;\n // Otherwise both representations come from the build, so a soft navigation is served from\n // it too rather than re-rendering a page that was already built.\n if (!mustRenderForNonce) {\n const page = await runtime.readPrerendered(c, isRsc ? 'flight' : 'html');\n // A prerendered page is request-independent by construction, so it is safe to cache\n // publicly; the short max-age matches what `public/` files get. The ETag turns the\n // revalidation that follows into a 304 rather than the page all over again.\n //\n // Answered outside `runWithContext`: no app code runs on this path, so there is no\n // `getRequestContext()` to serve and no reason to pay for the AsyncLocalStorage scope.\n if (page !== null) {\n const headers = {\n 'cache-control': SSG_CACHE_CONTROL,\n etag: page.etag,\n vary: 'Accept',\n 'content-type': isRsc ? 'text/x-component;charset=utf-8' : 'text/html;charset=utf-8',\n };\n if (etagMatches(c.req.header('if-none-match'), page.etag)) return c.body(null, 304, headers);\n return c.body(page.body, 200, { ...headers, 'content-length': page.contentLength });\n }\n }\n }\n return await runWithContext(c, () => renderPage(c, loadPage));\n } catch (error) {\n if (isControlSignal(error)) return runWithContext(c, () => respondToControlSignal(c, error));\n throw error;\n }\n };\n app.on(['GET', 'POST'], route.path, handler);\n } else {\n const loadEndpoint = once(() => route.server());\n const handler: Handler = async (c, next) => {\n const { handler: endpointHandler } = await loadEndpoint();\n return endpointHandler(c, next);\n };\n const method = route.method ?? 'all';\n if (method === 'all') app.all(route.path, handler);\n else app.on(method.toUpperCase(), route.path, handler);\n }\n }\n\n runtime.mountPublicFallback(app);\n\n app.notFound(async (c) => {\n const isRsc = requestWantsRsc(c.req.raw);\n if (loadNotFoundPage && (isRsc || acceptsHtml(c))) {\n return runWithContext(c, async () => renderComponent(c, await loadNotFoundPage(), { status: 404, isRsc }));\n }\n return c.text('Not Found', 404, { vary: 'Accept' });\n });\n\n const loadErrorPage = routeConfig.error ? memoizePage(routeConfig.error, 'the error page') : null;\n app.onError(async (error, c) => {\n if (isControlSignal(error)) return runWithContext(c, () => respondToControlSignal(c, error));\n reportServerError(error, { source: 'request', request: c.req.raw, message: '[rshono] request error:' });\n const isRsc = requestWantsRsc(c.req.raw);\n if (loadErrorPage && (isRsc || acceptsHtml(c))) {\n const errorInfo: ErrorPageInfo = isDev\n ? {\n message: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n }\n : { message: 'Internal Server Error' };\n try {\n return await runWithContext(c, async () => renderComponent(c, await loadErrorPage(), { status: 500, isRsc, errorInfo }));\n } catch (renderError) {\n reportServerError(renderError, { source: 'request', request: c.req.raw, message: '[rshono] the error page failed to render:' });\n }\n }\n const detail = isDev ? `\\n\\n${error instanceof Error ? (error.stack ?? error.message) : String(error)}` : '';\n return c.text(`Internal Server Error${detail}`, 500, { vary: 'Accept' });\n });\n\n return app;\n}\n\nexport const app = buildApp();\n\n/**\n * The app, handed to whatever is hosting it.\n *\n * On a platform where rshono owns the process this binds a port and the default export is nothing;\n * where the host owns it, this *is* the export the platform looks for — so the same entry serves\n * both without a per-platform entry file. `app` and `routes` stay named exports either way, because\n * `rshono build` imports them to prerender `render: 'static'` routes.\n */\nexport default runtime.serveApp(app);\n"]}
|
|
@@ -5,6 +5,14 @@ import { type ReactNode } from 'react';
|
|
|
5
5
|
* `push` / `replace` / `refresh` are **soft** navigations: the new page's flight
|
|
6
6
|
* payload is fetched and applied in place, so client component state outside the
|
|
7
7
|
* changed subtree survives. Off-site or non-HTTP hrefs fall back to a full load.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const { router } = useNavigation();
|
|
12
|
+
* router.push('/dashboard'); // navigate, new history entry
|
|
13
|
+
* router.replace('/login'); // navigate, no new entry
|
|
14
|
+
* router.refresh(); // re-run this route's server components
|
|
15
|
+
* ```
|
|
8
16
|
*/
|
|
9
17
|
export interface NavigationRouter {
|
|
10
18
|
/** Navigates to `href` and pushes a new history entry. */
|
|
@@ -80,6 +88,9 @@ export declare function RouterProvider({ href, params, children }: {
|
|
|
80
88
|
* ({@link NavigationRouter}) with `push` / `replace` / `refresh` / `pending`.
|
|
81
89
|
* @throws If called outside a page's React tree, where there is no navigation
|
|
82
90
|
* context to read.
|
|
91
|
+
*
|
|
92
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreclient | Docs — `@rshono/core/client`}
|
|
93
|
+
* @see {@link https://www.rshono.com/docs/pages#client-components | Docs — client components}
|
|
83
94
|
*/
|
|
84
95
|
export declare function useNavigation(): NavigationState;
|
|
85
96
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/runtime/navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/runtime/navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sFAAsF;IACtF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sFAAsF;IACtF,OAAO,IAAI,IAAI,CAAC;IAChB,kGAAkG;IAClG,OAAO,EAAE,OAAO,CAAC;CAClB;AAKD,oGAAoG;AACpG,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,EAAE,GAAG,CAAC;IACT,yFAAyF;IACzF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,4DAA4D;IAC5D,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,2CAAiD,CAAC;AAI5E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAK/H;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,aAAa,IAAI,eAAe,CAQ/C"}
|
|
@@ -55,6 +55,9 @@ export function RouterProvider({ href, params, children }) {
|
|
|
55
55
|
* ({@link NavigationRouter}) with `push` / `replace` / `refresh` / `pending`.
|
|
56
56
|
* @throws If called outside a page's React tree, where there is no navigation
|
|
57
57
|
* context to read.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreclient | Docs — `@rshono/core/client`}
|
|
60
|
+
* @see {@link https://www.rshono.com/docs/pages#client-components | Docs — client components}
|
|
58
61
|
*/
|
|
59
62
|
export function useNavigation() {
|
|
60
63
|
const value = useContext(NavigationContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/runtime/navigation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/runtime/navigation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AA6C3E,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,aAAa,GAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAmB,aAAa,CAAC,CAAC;AAE5E,MAAM,iBAAiB,GAAG,aAAa,CAAyB,IAAI,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAyE;IAC9H,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAkB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/G,OAAO,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAA8B,CAAC;AAC3F,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,mKAAmK,CACpK,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["'use client';\n\nimport { createContext, useContext, useMemo, type ReactNode } from 'react';\n\n/**\n * Imperative navigation actions, reached as `useNavigation().router`.\n *\n * `push` / `replace` / `refresh` are **soft** navigations: the new page's flight\n * payload is fetched and applied in place, so client component state outside the\n * changed subtree survives. Off-site or non-HTTP hrefs fall back to a full load.\n *\n * @example\n * ```tsx\n * const { router } = useNavigation();\n * router.push('/dashboard'); // navigate, new history entry\n * router.replace('/login'); // navigate, no new entry\n * router.refresh(); // re-run this route's server components\n * ```\n */\nexport interface NavigationRouter {\n /** Navigates to `href` and pushes a new history entry. */\n push(href: string): void;\n /** Navigates to `href`, replacing the current history entry instead of adding one. */\n replace(href: string): void;\n /** Re-fetches the current route from the server, re-running its server components. */\n refresh(): void;\n /** `true` while a soft navigation is in flight — use it to disable controls or show a spinner. */\n pending: boolean;\n}\n\n// No `back()` / `forward()`: they were verbatim aliases for `history.back()` and `history.forward()`,\n// which need no framework. Traversal is picked up by the `popstate` listener either way.\n\n/** The current location plus the {@link NavigationRouter}, as returned by {@link useNavigation}. */\nexport interface NavigationState {\n /**\n * The full current {@link URL} — read `url.pathname`, `url.searchParams` and the\n * rest off it. A fresh instance per navigation, so mutating it affects nothing\n * else; it is not written back to the address bar either.\n */\n url: URL;\n /** Matched route params for the current page, e.g. `{ id: '42' }` for `/profile/:id`. */\n params: Record<string, string>;\n /** Imperative navigation actions and the `pending` flag. */\n router: NavigationRouter;\n}\n\nconst noop = () => {};\n\nconst defaultRouter: NavigationRouter = { push: noop, replace: noop, refresh: noop, pending: false };\n\n/**\n * Carries the live {@link NavigationRouter} implementation from the hydration runtime down\n * to {@link RouterProvider}. Framework internal — read the router through\n * {@link useNavigation} instead.\n *\n * @internal\n */\nexport const RouterContext = createContext<NavigationRouter>(defaultRouter);\n\nconst NavigationContext = createContext<NavigationState | null>(null);\n\n/**\n * Publishes the per-render location and params so {@link useNavigation} can read\n * them. Framework internal — the RSC entry wraps every page in one.\n *\n * @internal\n */\nexport function RouterProvider({ href, params, children }: { href: string; params: Record<string, string>; children: ReactNode }) {\n const router = useContext(RouterContext);\n const value = useMemo<NavigationState>(() => ({ url: new URL(href), params, router }), [href, params, router]);\n\n return <NavigationContext.Provider value={value}>{children}</NavigationContext.Provider>;\n}\n\n/**\n * Reactive access to the current URL and programmatic navigation, in one hook.\n *\n * Call it from a `'use client'` component. The location fields (`url` and\n * `params`) are computed on the server and travel in the flight payload, so they\n * are correct during SSR — no hydration flicker — and update automatically on\n * every navigation. The `router` sub-object holds the imperative actions plus a\n * `pending` flag that is `true` while a client navigation is in flight.\n *\n * Hooks can't run in a server component; read the same URL data there from\n * `getRequestContext()` (`@rshono/core/server`) instead.\n *\n * @example\n * ```tsx\n * 'use client';\n * import { useNavigation } from '@rshono/core/client';\n *\n * export function NextPage() {\n * const { url, router } = useNavigation();\n * const page = Number(url.searchParams.get('page') ?? '1');\n * return (\n * <button disabled={router.pending} onClick={() => router.push(`${url.pathname}?page=${page + 1}`)}>\n * Next {router.pending ? '…' : ''}\n * </button>\n * );\n * }\n * ```\n *\n * @returns The current {@link NavigationState}: `url` and `params`, plus `router`\n * ({@link NavigationRouter}) with `push` / `replace` / `refresh` / `pending`.\n * @throws If called outside a page's React tree, where there is no navigation\n * context to read.\n *\n * @see {@link https://www.rshono.com/docs/api#rshonocoreclient | Docs — `@rshono/core/client`}\n * @see {@link https://www.rshono.com/docs/pages#client-components | Docs — client components}\n */\nexport function useNavigation(): NavigationState {\n const value = useContext(NavigationContext);\n if (!value) {\n throw new Error(\n \"[rshono] useNavigation() must be called inside a 'use client' component rendered by a page. In a server component, read the URL from getRequestContext() instead.\",\n );\n }\n return value;\n}\n"]}
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@rshono/core/server` — the request-scoped surface, for use inside server components
|
|
3
|
-
* and `'use server'` action modules:
|
|
4
|
-
* params, env and middleware variables, the
|
|
5
|
-
* control-flow helpers, and
|
|
3
|
+
* and `'use server'` action modules: `getRequestContext()` for the URL, cookies,
|
|
4
|
+
* params, env and middleware variables, the `redirect()` and `notFound()`
|
|
5
|
+
* control-flow helpers, and `onServerError()` for reporting the errors the
|
|
6
6
|
* framework catches.
|
|
7
7
|
*
|
|
8
8
|
* Server-only. Importing this from a `'use client'` module is a mistake — those
|
|
@@ -10,13 +10,7 @@
|
|
|
10
10
|
* on the server and pass it down as props, or use `useNavigation()` from
|
|
11
11
|
* `@rshono/core/client` for URL data.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* implemented: that module also exports the plumbing the framework's own entry
|
|
15
|
-
* points need (`runWithContext`, `readParams`, `publicUrl`, `reportServerError`),
|
|
16
|
-
* and pointing the `./server` subpath straight at it published every one of them —
|
|
17
|
-
* `@internal` in the docs, but present in a consumer's autocomplete and pinned by
|
|
18
|
-
* semver all the same. They stay reachable by relative import, which is the only
|
|
19
|
-
* way the framework itself ever reaches them.
|
|
13
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreserver | Docs — `@rshono/core/server`}
|
|
20
14
|
*
|
|
21
15
|
* @packageDocumentation
|
|
22
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/runtime/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/runtime/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAQH,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,cAAc,EAGnB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
|
package/dist/runtime/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@rshono/core/server` — the request-scoped surface, for use inside server components
|
|
3
|
-
* and `'use server'` action modules:
|
|
4
|
-
* params, env and middleware variables, the
|
|
5
|
-
* control-flow helpers, and
|
|
3
|
+
* and `'use server'` action modules: `getRequestContext()` for the URL, cookies,
|
|
4
|
+
* params, env and middleware variables, the `redirect()` and `notFound()`
|
|
5
|
+
* control-flow helpers, and `onServerError()` for reporting the errors the
|
|
6
6
|
* framework catches.
|
|
7
7
|
*
|
|
8
8
|
* Server-only. Importing this from a `'use client'` module is a mistake — those
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
* on the server and pass it down as props, or use `useNavigation()` from
|
|
11
11
|
* `@rshono/core/client` for URL data.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* implemented: that module also exports the plumbing the framework's own entry
|
|
15
|
-
* points need (`runWithContext`, `readParams`, `publicUrl`, `reportServerError`),
|
|
16
|
-
* and pointing the `./server` subpath straight at it published every one of them —
|
|
17
|
-
* `@internal` in the docs, but present in a consumer's autocomplete and pinned by
|
|
18
|
-
* semver all the same. They stay reachable by relative import, which is the only
|
|
19
|
-
* way the framework itself ever reaches them.
|
|
13
|
+
* @see {@link https://www.rshono.com/docs/api#rshonocoreserver | Docs — `@rshono/core/server`}
|
|
20
14
|
*
|
|
21
15
|
* @packageDocumentation
|
|
22
16
|
*/
|
|
17
|
+
// A barrel rather than `./context.js` itself, which is where all of this is implemented: that module
|
|
18
|
+
// also exports the plumbing the framework's own entry points need (`runWithContext`, `readParams`,
|
|
19
|
+
// `publicUrl`, `reportServerError`), and pointing the `./server` subpath straight at it published
|
|
20
|
+
// every one of them — `@internal` in the docs, but present in a consumer's autocomplete and pinned
|
|
21
|
+
// by semver all the same. They stay reachable by relative import, which is the only way the
|
|
22
|
+
// framework itself ever reaches them.
|
|
23
23
|
export { getRequestContext, notFound, onServerError, redirect, } from './context.js';
|
|
24
24
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/runtime/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/runtime/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,qGAAqG;AACrG,mGAAmG;AACnG,kGAAkG;AAClG,mGAAmG;AACnG,4FAA4F;AAC5F,sCAAsC;AACtC,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,QAAQ,GAST,MAAM,cAAc,CAAC","sourcesContent":["/**\n * `@rshono/core/server` — the request-scoped surface, for use inside server components\n * and `'use server'` action modules: `getRequestContext()` for the URL, cookies,\n * params, env and middleware variables, the `redirect()` and `notFound()`\n * control-flow helpers, and `onServerError()` for reporting the errors the\n * framework catches.\n *\n * Server-only. Importing this from a `'use client'` module is a mistake — those\n * run in the browser (and are SSR'd without a bound context). Read what you need\n * on the server and pass it down as props, or use `useNavigation()` from\n * `@rshono/core/client` for URL data.\n *\n * @see {@link https://www.rshono.com/docs/api#rshonocoreserver | Docs — `@rshono/core/server`}\n *\n * @packageDocumentation\n */\n\n// A barrel rather than `./context.js` itself, which is where all of this is implemented: that module\n// also exports the plumbing the framework's own entry points need (`runWithContext`, `readParams`,\n// `publicUrl`, `reportServerError`), and pointing the `./server` subpath straight at it published\n// every one of them — `@internal` in the docs, but present in a consumer's autocomplete and pinned\n// by semver all the same. They stay reachable by relative import, which is the only way the\n// framework itself ever reaches them.\nexport {\n getRequestContext,\n notFound,\n onServerError,\n redirect,\n type EnvVars,\n type RedirectStatus,\n // A type, not a value: `RequestContext` is handed to you by `getRequestContext()` or the `ctx` page\n // prop — one instance per request — and is never constructed by application code.\n type RequestContext,\n type ServerErrorContext,\n type ServerErrorHandler,\n type ServerErrorSource,\n} from './context.js';\n"]}
|
package/package.json
CHANGED