@rsc-kit/core 0.7.0 → 0.7.2
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 +4 -4
- package/dist/action.d.ts +0 -1
- package/dist/action.js.map +1 -1
- package/dist/build-rsc-vite.d.ts +0 -1
- package/dist/build-rsc-vite.js.map +1 -1
- package/dist/cache.d.ts +0 -1
- package/dist/cache.js.map +1 -1
- package/dist/devServer.d.ts +0 -1
- package/dist/devServer.js.map +1 -1
- package/dist/devUrls.d.ts +0 -1
- package/dist/devUrls.js.map +1 -1
- package/dist/embed.d.ts +0 -1
- package/dist/embed.js.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js.map +1 -1
- package/dist/export.d.ts +0 -1
- package/dist/export.js.map +1 -1
- package/dist/files.d.ts +0 -1
- package/dist/files.js.map +1 -1
- package/dist/headers.d.ts +0 -1
- package/dist/headers.js.map +1 -1
- package/dist/host.d.ts +0 -1
- package/dist/host.js.map +1 -1
- package/dist/hostCalls.d.ts +0 -1
- package/dist/hostCalls.js.map +1 -1
- package/dist/js/ActivityRouter.d.ts +0 -1
- package/dist/js/ActivityRouter.js.map +1 -1
- package/dist/js/DocumentTitle.d.ts +0 -1
- package/dist/js/DocumentTitle.js.map +1 -1
- package/dist/js/Form.d.ts +0 -1
- package/dist/js/Form.js.map +1 -1
- package/dist/js/Link.d.ts +0 -1
- package/dist/js/Link.js.map +1 -1
- package/dist/js/PathnameProvider.d.ts +0 -1
- package/dist/js/PathnameProvider.js.map +1 -1
- package/dist/js/RedirectBoundary.d.ts +0 -1
- package/dist/js/RedirectBoundary.js.map +1 -1
- package/dist/js/SegmentBoundary.d.ts +0 -1
- package/dist/js/SegmentBoundary.js.map +1 -1
- package/dist/js/SlotBoundary.d.ts +0 -1
- package/dist/js/SlotBoundary.js.map +1 -1
- package/dist/js/createViteRscApp.d.ts +0 -1
- package/dist/js/createViteRscApp.js.map +1 -1
- package/dist/js/errors.d.ts +0 -1
- package/dist/js/errors.js.map +1 -1
- package/dist/js/navigate.d.ts +0 -1
- package/dist/js/navigate.js.map +1 -1
- package/dist/js/onlineStore.d.ts +0 -1
- package/dist/js/onlineStore.js.map +1 -1
- package/dist/js/pagePayload.d.ts +0 -1
- package/dist/js/pagePayload.js.map +1 -1
- package/dist/js/router.d.ts +0 -1
- package/dist/js/router.js.map +1 -1
- package/dist/js/section.d.ts +0 -1
- package/dist/js/section.js.map +1 -1
- package/dist/js/segmentStore.d.ts +0 -1
- package/dist/js/segmentStore.js.map +1 -1
- package/dist/js/slotStore.d.ts +0 -1
- package/dist/js/slotStore.js.map +1 -1
- package/dist/js/standardSchema.d.ts +0 -1
- package/dist/js/standardSchema.js.map +1 -1
- package/dist/js/useForm.d.ts +0 -1
- package/dist/js/useForm.js.map +1 -1
- package/dist/js/useLinkStatus.d.ts +0 -1
- package/dist/js/useLinkStatus.js.map +1 -1
- package/dist/js/useOnline.d.ts +0 -1
- package/dist/js/useOnline.js.map +1 -1
- package/dist/js/usePathname.d.ts +0 -1
- package/dist/js/usePathname.js.map +1 -1
- package/dist/js/useSearchParams.d.ts +0 -1
- package/dist/js/useSearchParams.js.map +1 -1
- package/dist/manifest.d.ts +0 -1
- package/dist/manifest.js.map +1 -1
- package/dist/nondeterminism.d.ts +0 -1
- package/dist/nondeterminism.js.map +1 -1
- package/dist/prerender.d.ts +0 -1
- package/dist/prerender.js.map +1 -1
- package/dist/redirect.d.ts +0 -1
- package/dist/redirect.js.map +1 -1
- package/dist/redirectDigest.d.ts +0 -1
- package/dist/redirectDigest.js.map +1 -1
- package/dist/request.d.ts +0 -1
- package/dist/request.js.map +1 -1
- package/dist/revalidate.d.ts +0 -1
- package/dist/revalidate.js.map +1 -1
- package/dist/routes.d.ts +0 -1
- package/dist/routes.js.map +1 -1
- package/dist/routing.d.ts +0 -1
- package/dist/routing.js.map +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js.map +1 -1
- package/dist/safeUrl.d.ts +0 -1
- package/dist/safeUrl.js.map +1 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +73 -9
- package/dist/vite.js.map +1 -1
- package/package.json +1 -5
- package/dist/action.d.ts.map +0 -1
- package/dist/build-rsc-vite.d.ts.map +0 -1
- package/dist/cache.d.ts.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -84
- package/dist/cli.js.map +0 -1
- package/dist/devServer.d.ts.map +0 -1
- package/dist/devUrls.d.ts.map +0 -1
- package/dist/embed.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/export.d.ts.map +0 -1
- package/dist/files.d.ts.map +0 -1
- package/dist/headers.d.ts.map +0 -1
- package/dist/host.d.ts.map +0 -1
- package/dist/hostCalls.d.ts.map +0 -1
- package/dist/js/ActivityRouter.d.ts.map +0 -1
- package/dist/js/DocumentTitle.d.ts.map +0 -1
- package/dist/js/Form.d.ts.map +0 -1
- package/dist/js/Link.d.ts.map +0 -1
- package/dist/js/PathnameProvider.d.ts.map +0 -1
- package/dist/js/RedirectBoundary.d.ts.map +0 -1
- package/dist/js/SegmentBoundary.d.ts.map +0 -1
- package/dist/js/SlotBoundary.d.ts.map +0 -1
- package/dist/js/createViteRscApp.d.ts.map +0 -1
- package/dist/js/errors.d.ts.map +0 -1
- package/dist/js/navigate.d.ts.map +0 -1
- package/dist/js/onlineStore.d.ts.map +0 -1
- package/dist/js/pagePayload.d.ts.map +0 -1
- package/dist/js/router.d.ts.map +0 -1
- package/dist/js/section.d.ts.map +0 -1
- package/dist/js/segmentStore.d.ts.map +0 -1
- package/dist/js/slotStore.d.ts.map +0 -1
- package/dist/js/standardSchema.d.ts.map +0 -1
- package/dist/js/useForm.d.ts.map +0 -1
- package/dist/js/useLinkStatus.d.ts.map +0 -1
- package/dist/js/useOnline.d.ts.map +0 -1
- package/dist/js/usePathname.d.ts.map +0 -1
- package/dist/js/useSearchParams.d.ts.map +0 -1
- package/dist/manifest.d.ts.map +0 -1
- package/dist/nondeterminism.d.ts.map +0 -1
- package/dist/prerender.d.ts.map +0 -1
- package/dist/redirect.d.ts.map +0 -1
- package/dist/redirectDigest.d.ts.map +0 -1
- package/dist/request.d.ts.map +0 -1
- package/dist/revalidate.d.ts.map +0 -1
- package/dist/routes.d.ts.map +0 -1
- package/dist/routing.d.ts.map +0 -1
- package/dist/runtime.d.ts.map +0 -1
- package/dist/safeUrl.d.ts.map +0 -1
- package/dist/vite.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nondeterminism.js","sourceRoot":"","sources":["../src/nondeterminism.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,kEAAkE;AAClE,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,+EAA+E;AAC/E,iFAAiF;AACjF,iFAAiF;AACjF,4EAA4E;AAC5E,iBAAiB;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,+EAA+E;AAC/E,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAe,CAAA;AAEtD,mEAAmE;AACnE,MAAM,OAAO,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,CAAU,CAAA;AAE7F,IAAI,SAAS,GAAG,CAAC,CAAA;AACjB,IAAI,OAAO,GAAwB,IAAI,CAAA;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAA;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;QAC9B,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAEvE,MAAM,IAAI,GAAG,C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AC5E,CAAC,CAAA;IACH,CAAC;IAED,OAAO,GAAG,EAAE;QACV,IAAI,EAAE,SAAS,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,EAAE,CAAA;YACX,OAAO,GAAG,IAAI,CAAA;QAChB,CAAC;IACH,CAAC,CAAA;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAAI,GAAqB;IACrD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAA;IAE/B,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;AACvE,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAA","sourcesContent":["// Catching a value that will not be the same tomorrow.\n//\n// A page frozen at build time keeps whatever it rendered. If that render called\n// `new Date()` or `Math.random()`, the frozen page keeps *that* date and *that*\n// number, and serves them to everyone until the next build — a \"3 minutes ago\"\n// that is three minutes past a moment in the deployment pipeline.\n//\n// Nothing warns, because nothing failed. The page rendered perfectly.\n//\n// This is the same trick the prerenderer already plays on the host call: watch\n// what the render reaches for. The difference is that a host call can be stubbed\n// into a promise that never resolves, so its boundary becomes a hole — and there\n// is nothing to hang on a synchronous `new Date()`. So this can report, and\n// cannot repair.\n\nimport { AsyncLocalStorage } from 'node:async_hooks'\n\n/** Which route is rendering, so a call can be attributed under concurrency. */\nconst rendering = new AsyncLocalStorage<Set<string>>()\n\n/** What each of the watched globals is called, for the message. */\nconst WATCHED = ['new Date()', 'Date.now()', 'Math.random()', 'crypto.randomUUID()'] as const\n\nlet installed = 0\nlet restore: (() => void) | null = null\n\n/**\n * Watch the non-deterministic globals for the duration of a prerender.\n *\n * Patched once around the whole run rather than per route, because the routes\n * render concurrently and a global cannot be swapped per render. Attribution\n * comes from the async context instead, which is exact: React's own render does\n * not call any of these, so a recorded call came from application code.\n */\nexport function watchNondeterminism(): () => void {\n if (installed++ === 0) {\n const realDate = globalThis.Date\n const realRandom = Math.random\n const realUUID = globalThis.crypto?.randomUUID?.bind(globalThis.crypto)\n\n const note = (what: string) => {\n rendering.getStore()?.add(what)\n }\n\n // A subclass rather than a Proxy: `new Date()` has to keep working, and\n // instanceof has to keep answering true for anything the app does with it.\n class WatchedDate extends realDate {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(...args: any[]) {\n // Only a no-argument call reads the clock. `new Date('2020-01-01')` is\n // as deterministic as a string literal.\n if (args.length === 0) note('new Date()')\n\n // @ts-expect-error - forwarding Date's overloads verbatim\n super(...args)\n }\n\n static now(): number {\n note('Date.now()')\n\n return realDate.now()\n }\n }\n\n globalThis.Date = WatchedDate as DateConstructor\n\n Math.random = function random(): number {\n note('Math.random()')\n\n return realRandom.call(Math)\n }\n\n if (realUUID && globalThis.crypto) {\n globalThis.crypto.randomUUID = function randomUUID() {\n note('crypto.randomUUID()')\n\n return realUUID()\n } as Crypto['randomUUID']\n }\n\n restore = () => {\n globalThis.Date = realDate\n Math.random = realRandom\n\n if (realUUID && globalThis.crypto) globalThis.crypto.randomUUID = realUUID\n }\n }\n\n return () => {\n if (--installed === 0) {\n restore?.()\n restore = null\n }\n }\n}\n\n/** Run a route's render, collecting what it reached for. */\nexport function whileRendering<T>(run: () => Promise<T>): Promise<[T, string[]]> {\n const found = new Set<string>()\n\n return rendering.run(found, run).then((value) => [value, [...found]])\n}\n\nexport { WATCHED }\n"]}
|
package/dist/prerender.d.ts
CHANGED
package/dist/prerender.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prerender.js","sourceRoot":"","sources":["../src/prerender.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,8CAA8C;AAC9C,EAAE;AACF,4EAA4E;AAC5E,8EAA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KAAK,CAAC,GAAG,GAAG,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;QACjE,CAAC;QACD,MAAM,KAAK,CACT,GAAG,GAAG,gBAAgB,EACtB,IAAI,CAAC,SAAS,CACZ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,EAC/F,IAAI,EACJ,CAAC,CACF,CACF,CAAA;IACH,CAAC;AAEH,CAAC","sourcesContent":["// Rendering pages at build time, for a JavaScript host.\n//\n// The engine does the rendering; this decides what to render and what to do\n// with the result. Two decisions, and both are easy to get subtly wrong:\n//\n// Which urls exist — a route with no params is one url, a route with params is\n// however many `generateStaticParams` returns, and a route with params that\n// declares none cannot be prerendered at all.\n//\n// Whether a page can be frozen — asked by rendering it, never declared. The\n// shell probe replaces the host global with a promise that never resolves, so\n// a page that reaches for request data suspends and says so by doing it. A\n// page that simply takes too long says so by not finishing.\n//\n// The file layout matches the one Laravel writes, so both hosts serve the same\n// shapes and anything that reads them works for either.\n\nimport type { ManifestRoute, RouteManifest } from './manifest.js'\nimport { withRedirect } from './redirect.js'\nimport { withCache } from './cache.js'\nimport { requestWasRead, withRequest } from './request.js'\nimport { watchNondeterminism, whileRendering } from './nondeterminism.js'\n\n/** What a prerenderer needs from the built bundle, beyond serving a request. */\n/**\n * How long the root-fallback diagnostic waits before answering.\n *\n * Short on purpose: the question is whether anything painted, not what. See\n * the call site.\n */\nconst ROOT_FALLBACK_BUDGET_MS = 200\n\n/**\n * How many routes render at once.\n *\n * Each is a full React render, so this trades memory and CPU for wall time.\n * The gain flattens almost immediately — measured on a twelve-route example:\n * 10.2 s sequential, 4.1 s at four, 4.0 s at six, 4.0 s at twelve, beyond\n * which one route's own serial chain is the floor.\n *\n * Four rather than six because the difference between them is inside the\n * noise, and the smaller number leaves room for whatever else is running.\n * A build is rarely the only thing on a machine — it shares CI with other\n * jobs, and it shares a laptop with the test suite that renders its own\n * fixtures, where six was enough to turn a two-second budget into a timeout.\n */\nconst DEFAULT_PRERENDER_CONCURRENCY = 4\n\nexport interface PrerenderEngine {\n manifest?(): RouteManifest\n getStaticParams?(component: string): Promise<Record<string, string>[] | null>\n handleRscPprShell(\n component: string,\n props?: Record<string, unknown>,\n layouts?: { component: string; props: Record<string, unknown> }[],\n loadings?: string[],\n parallelSlots?: Record<string, string>,\n pageKey?: string,\n /** How long to render before taking what has flushed. Defaults to the full budget. */\n budgetMs?: number,\n ): Promise<{\n shellHtml: string\n timedOut: boolean\n usedDynamicApis: boolean\n error?: string\n /**\n * Where the render stopped, when it stopped — React's own resumable state.\n *\n * Null when the page finished, which is the same thing as `timedOut` being\n * false. An engine built before this existed returns undefined, and the\n * shell is then served the way it always was: holes filled by the client\n * after hydration rather than resumed at the origin.\n */\n postponed?: unknown\n /**\n * Anything that failed while producing the shell, including a rejection a\n * Suspense boundary caught.\n *\n * Such a rejection never reaches the caller: React keeps the fallback and\n * the render finishes, so without this a page whose data source was\n * unreachable looked complete and its loading state was frozen as a\n * finished page.\n */\n renderFailure?: string\n }>\n handleRsc(\n component: string,\n props?: Record<string, unknown>,\n callbackSocket?: string | null,\n layouts?: { component: string; props: Record<string, unknown> }[],\n loadings?: string[],\n parallelSlots?: Record<string, string>,\n from?: number,\n pageKey?: string,\n bootstrap?: boolean,\n /**\n * Whether a host is installed to answer rpc().\n *\n * False during a build, where there is none: every host call then suspends\n * and the page reports that it reached for one, instead of resolving to\n * undefined and being frozen holding it.\n */\n canReachHost?: boolean,\n ): Promise<{\n body: string\n rscPayload: string\n clientComponents: string[]\n usedDynamicApis?: boolean\n }>\n handleRscPayload(\n component: string,\n props?: Record<string, unknown>,\n layouts?: { component: string; props: Record<string, unknown> }[],\n loadings?: string[],\n parallelSlots?: Record<string, string>,\n from?: number,\n pageKey?: string,\n ): Promise<{ rscPayload: string }>\n}\n\nexport interface PrerenderOptions {\n engine: PrerenderEngine\n /**\n * Where the output goes, as a sink rather than a directory.\n *\n * `writeTo` in `@rsc-kit/core/files` is the one for a disk, which is what a\n * build normally wants. A function because the read side is one — a host\n * that supplies a reader should be able to supply the matching writer —\n * and because a test can hand it a Map instead of a temp directory.\n */\n write: (name: string, contents: string) => Promise<void> | void\n /** The route table. Defaults to the one the bundle carries. */\n manifest?: RouteManifest\n /**\n * Props for a page at build time.\n *\n * There is no request here, which is the point: anything a page needs that\n * only a request can supply is exactly what makes it un-freezable. Defaults\n * to the url params alone.\n */\n props?: (route: ManifestRoute, params: Record<string, string>) => Record<string, unknown>\n /**\n * How many routes to render at once. Defaults to 6; 1 renders sequentially.\n *\n * Worth lowering when the pages talk to something that will not enjoy six\n * concurrent callers — a local database, a rate-limited API.\n */\n concurrency?: number\n /** Identifies the build in what gets written, so a stale page can be spotted. */\n version?: string\n /** Called as each url is decided, for build output. */\n onResult?: (result: PrerenderResult) => void\n}\n\n/**\n * The build's refusal to store a route it cannot answer ahead of time.\n *\n * Thrown rather than reported, because the alternative is a category: a bucket\n * of routes that quietly render per request, which is where the slow ones go\n * to be forgotten. Every route is either stored or has said it will not be.\n */\nexport class NotPrerenderable extends Error {\n public readonly routes: PrerenderResult[]\n\n constructor(routes: PrerenderResult[]) {\n // Two different problems arrive here, and the advice for one is useless for\n // the other. A page that reads the request above every boundary needs a\n // boundary; a page whose render threw needs whatever it was reaching for.\n const threw = routes.filter((r) => r.reason?.startsWith('could not be rendered'))\n const unpaintable = routes.filter((r) => !r.reason?.startsWith('could not be rendered'))\n\n const advice: string[] = []\n\n if (unpaintable.length > 0) {\n advice.push(\n 'These read request data — params, headers, cookies, or the host — above\\n' +\n 'every Suspense boundary, so nothing can paint without it:\\n\\n' +\n unpaintable.map((r) => ` ${r.url} — ${r.reason ?? 'nothing to paint'}`).join('\\n') +\n '\\n\\nPut the part that waits inside <Suspense>, or add a loading.tsx beside\\n' +\n 'the page, so there is something to store while the rest arrives.',\n )\n }\n\n if (threw.length > 0) {\n advice.push(\n 'These failed while rendering:\\n\\n' +\n threw.map((r) => ` ${r.url} — ${r.reason}`).join('\\n') +\n '\\n\\nPrerendering runs your application code, so it needs whatever that code\\n' +\n 'needs. If the page is fine and this machine simply cannot reach a\\n' +\n 'database or an API, either give the build access or turn prerendering\\n' +\n 'off with `rscKit({ prerender: false })`.\\n\\n' +\n 'Reaching for data through the host — `await rpc(...)` — avoids this\\n' +\n 'entirely: the build stubs that call, so the page freezes a shell\\n' +\n 'without the data being available.',\n )\n }\n\n super('Some routes could not be prerendered.\\n\\n' + advice.join('\\n\\n') + '\\n')\n this.name = 'NotPrerenderable'\n this.routes = routes\n }\n}\n\nexport interface PrerenderResult {\n url: string\n component: string\n /**\n * frozen — the whole page is on disk.\n * shell — the chrome is on disk and the rest is rendered per request.\n * blocked — nothing could be stored. Fails the build.\n * error — the render itself failed, or the build refused what it produced.\n *\n * There is no outcome for \"rendered per request\". A route that cannot be\n * stored has its boundary in the wrong place, and the fix is to move it —\n * not to declare the problem away, which is how the slow ones get forgotten.\n */\n type: 'frozen' | 'shell' | 'blocked' | 'error'\n reason: string | null\n /**\n * Something worth knowing that is not a failure.\n *\n * The one that matters: a page whose only boundary is the root loading.tsx.\n * It is stored, so the build has nothing to refuse — but the fallback that\n * caught it belongs to the whole app rather than to this page, and every\n * page in the app shows the same thing while this one's data arrives.\n */\n warning?: string\n}\n\n/**\n * The file name a route's shell is stored under, with params standing in for\n * themselves: /posts/[slug] → posts/_slug_.\n *\n * A shell contains nothing that varies by param — everything that does is\n * behind a boundary the client fills — so one shell serves every url the\n * route matches, including the ones the app never listed.\n */\nexport function patternKey(route: ManifestRoute): string {\n const parts = route.segments.map((s) => (s.type === 'static' ? s.value : `_${s.value}_`))\n\n return parts.join('/') || 'index'\n}\n\n/** Close a document the render was aborted in the middle of. */\nexport function closeDocument(html: string): string {\n let out = html\n\n if (!/<\\/body>/i.test(out) && /<body/i.test(out)) out += '</body>'\n if (!/<\\/html>/i.test(out) && /<html/i.test(out)) out += '</html>'\n\n return out\n}\n\n/**\n * The file name a url is stored under: / → index, /a/b → a/b.\n *\n * Refuses a key that could leave the directory it is written into. The input is\n * whatever generateStaticParams() returned — typically slugs from a database or\n * a CMS — so a record named `../../../../etc/cron.d/x` is an arbitrary file\n * write on the build machine with content the same record influences.\n *\n * Checked here rather than in the writer, because the writer is supplied by the\n * host: `writeTo` on disk does the obvious thing, but a KV or edge binding has\n * no notion of a parent directory and no reason to look for one.\n */\n/**\n * The key, showing only the marks that actually appear above it.\n *\n * Wording follows Next's build output deliberately. Most people arriving here\n * have read that legend already, and inventing a second vocabulary for the same\n * three states costs them a translation for nothing.\n */\nexport function legend(results: { type: string }[]): string {\n const has = (type: string) => results.some((r) => r.type === type)\n const lines: string[] = []\n\n if (has('frozen')) {\n lines.push(' \\u25CB (Static) prerendered as static content')\n }\n\n if (has('shell')) {\n lines.push(\n ' \\u25D0 (Partial Prerender) prerendered as static HTML with dynamic server-streamed content',\n )\n }\n\n if (has('blocked')) {\n lines.push(' \\u0192 (Dynamic) server-rendered on demand')\n }\n\n if (has('error')) {\n lines.push(' \\u2717 (Failed) did not render')\n }\n\n return lines.join('\\n')\n}\n\n/**\n * The one-line tally under the legend, in the legend's own words.\n */\nexport function summary(results: { type: string }[]): string {\n const count = (type: string) => results.filter((r) => r.type === type).length\n const parts: string[] = []\n\n if (count('frozen')) parts.push(`${count('frozen')} static`)\n if (count('shell')) parts.push(`${count('shell')} partial prerender`)\n if (count('blocked')) parts.push(`${count('blocked')} dynamic`)\n if (count('error')) parts.push(`${count('error')} failed`)\n\n return parts.join(', ') || 'nothing to store'\n}\n\nexport function pathKey(url: string): string {\n const key = url.replace(/^\\/+|\\/+$/g, '') || 'index'\n\n if (key.split('/').some((segment) => segment === '..' || segment === '.')) {\n throw new Error(\n 'Refusing to store ' + JSON.stringify(url) + ': the path leaves the output directory. ' +\n 'A url segment came from generateStaticParams() or a route param and contains \"..\".',\n )\n }\n\n return key\n}\n\n/**\n * Substitute params into a route's segments to get a concrete url.\n *\n * A param is one segment, so a value carrying a slash is not a deeper url — it\n * is a value that was never a single segment. A catch-all is the exception and\n * is spelled as one in the route.\n */\nexport function urlFor(route: ManifestRoute, params: Record<string, string>): string {\n const parts = route.segments.map((segment) => {\n if (segment.type === 'static') return segment.value\n\n const value = params[segment.value] ?? ''\n\n if (segment.type !== 'catchAll' && /[/\\\\]/.test(value)) {\n throw new Error(\n 'The ' + segment.value + ' param is ' + JSON.stringify(value) + ', which is not one url ' +\n 'segment. A value with a slash in it has to be a catch-all route, or be encoded.',\n )\n }\n\n return value\n })\n\n return '/' + parts.filter((p) => p !== '').join('/')\n}\n\n/**\n * Every url this build should attempt, and the params each was built from.\n *\n * A parameterised route that declares no `generateStaticParams` yields\n * nothing — not an error: rendering on demand is a legitimate answer, and the\n * alternative is guessing at slugs the app never listed.\n */\n/** Stand-in values for a route whose real urls were never listed. */\nfunction placeholders(route: ManifestRoute): Record<string, string> {\n const params: Record<string, string> = {}\n\n for (const segment of route.segments) {\n if (segment.type !== 'static') params[segment.value] = '_'\n }\n\n return params\n}\n\nexport async function urlsToBuild(\n manifest: RouteManifest,\n engine: PrerenderEngine,\n): Promise<{ route: ManifestRoute; params: Record<string, string>; url: string }[]> {\n const entries: { route: ManifestRoute; params: Record<string, string>; url: string }[] = []\n\n for (const route of manifest.routes) {\n const parameterised = route.segments.some((s) => s.type !== 'static')\n\n if (!parameterised) {\n entries.push({ route, params: {}, url: urlFor(route, {}) })\n continue\n }\n\n // A route that lists no urls still gets one attempt, with placeholder\n // params, so it can ship a shell. Nothing in a shell varies by param.\n if (!route.staticParams) {\n entries.push({ route, params: placeholders(route), url: urlFor(route, placeholders(route)) })\n continue\n }\n\n const sets = (await engine.getStaticParams?.(route.component)) ?? null\n\n // Null means the route declares none, so it is rendered on demand. An\n // empty array means the app looked and there is nothing to build — both\n // produce no files, and only one of them is a mistake to warn about.\n if (!sets) continue\n\n for (const params of sets) {\n entries.push({ route, params, url: urlFor(route, params) })\n }\n }\n\n return entries\n}\n\nexport async function prerender(options: PrerenderOptions): Promise<PrerenderResult[]> {\n const { engine, write, version } = options\n const manifest = options.manifest ?? engine.manifest?.()\n\n if (!manifest) {\n throw new Error('No route table. Pass `manifest`, or build with a plugin version that embeds one.')\n }\n\n const entries = await urlsToBuild(manifest, engine)\n const results: PrerenderResult[] = new Array(entries.length)\n\n // Rendered a few at a time rather than one after another.\n //\n // Most of a build is this loop, and most of this loop is waiting: a page\n // whose shell is decided by a two-second budget spends two seconds doing\n // nothing while the next page waits its turn. Nothing here is shared between\n // routes — the probe's stand-in host is held in async context, so concurrent\n // renders cannot see each other's — which is what makes overlapping them\n // safe, and was not true until it was scoped.\n //\n // Bounded, because each one is a full React render: unbounded would turn a\n // large site into as many concurrent renders as it has pages.\n //\n // Results are placed by index, so what a build reports does not depend on\n // which page happened to finish first.\n const concurrency = Math.max(1, options.concurrency ?? DEFAULT_PRERENDER_CONCURRENCY)\n let next = 0\n\n const worker = async () => {\n while (true) {\n const index = next++\n\n if (index >= entries.length) return\n\n const { route, params, url } = entries[index]\n\n results[index] = await prerenderOne(route, params, url)\n options.onResult?.(results[index])\n }\n }\n\n const unwatch = watchNondeterminism()\n\n try {\n await Promise.all(Array.from({ length: Math.min(concurrency, entries.length) }, worker))\n } finally {\n unwatch()\n }\n\n const refused = results.filter((r) => r.type === 'blocked')\n\n if (refused.length > 0) {\n throw new NotPrerenderable(refused)\n }\n\n return results\n\n async function prerenderOne(\n route: ManifestRoute,\n params: Record<string, string>,\n url: string,\n ): Promise<PrerenderResult> {\n const props = options.props ? options.props(route, params) : params\n const layouts = route.layouts.map((component) => ({ component, props: {} }))\n const unlistedNow = route.segments.some((seg) => seg.type !== 'static') && !route.staticParams\n const said = (type: PrerenderResult['type'], reason: string | null): PrerenderResult => ({\n // A route standing in for many urls reports the pattern. Reporting the\n // placeholder url instead prints `/posts/_`, which looks like a page.\n url: unlistedNow ? '/' + patternKey(route) : url,\n component: route.component,\n type,\n reason,\n })\n\n const unlisted = route.segments.some((seg) => seg.type !== 'static') && !route.staticParams\n\n // Classify by rendering, never by asking. The probe is cheap and cannot\n // hang: anything still suspended when its budget expires is the answer.\n //\n // Wrapped so a redirect has somewhere to be recorded. Reading the scope\n // rather than inspecting the thrown error is the only thing that works\n // from out here: React catches what a component throws and re-raises its\n // own, whose message is stripped in production — so a redirect above the\n // boundaries arrives as a generic render failure, and one from inside a\n // boundary never arrives at all.\n // A build renders each url once, and each gets its own table: two routes\n // must not share an answer just because they were built in the same run.\n // No request, deliberately: a page that reads one is caught below rather\n // than frozen holding whatever the build machine happened to send.\n const [{ shell, redirected, readRequest }, nondeterministic] = await whileRendering(() =>\n withRequest(null, () =>\n withCache(() => withRedirect(async (taken) => {\n try {\n return {\n shell: await engine.handleRscPprShell(\n route.component,\n props,\n layouts,\n route.loadings,\n route.slots,\n // Only when this shell serves one url. A parameterised route's\n // shell is shared, so baking a url into it would put the wrong one\n // on every page but the one that happened to be built.\n unlistedNow ? '' : url,\n ),\n redirected: taken(),\n readRequest: requestWasRead(),\n }\n } catch (error) {\n // A guard refusing throws out of the probe rather than being caught\n // inside it: middleware run before the render, so there is no render yet\n // to capture the failure. A refusal is a classification, not a build\n // error — the route is one that cannot be frozen.\n const refused = taken()\n\n if (!refused) throw error\n\n return { shell: null, redirected: refused, readRequest: requestWasRead() }\n }\n })),\n ),\n )\n\n // A page that leaves rather than renders is not a build failure, and it is\n // not something to freeze either: what would be stored is the redirect's\n // own emptiness, served for ever to everyone. Rendered on demand instead,\n // where the redirect can actually happen.\n /**\n * Did this page's own boundary catch the wait, or the app's?\n *\n * A root loading.tsx wraps every page, so a page that blocks — or throws,\n * which is how a client hook says it has no server answer — is caught\n * whatever it does. The route is stored either way and the build has\n * nothing to refuse, which makes a page whose boundary is in the wrong\n * place look exactly like one whose boundary is right.\n *\n * Asked by rendering again without the root fallback, and only for a route\n * that has no closer one.\n *\n * Only for a route that came out as a shell. A frozen one rendered to\n * completion with the root boundary present, and removing a boundary\n * cannot stop a render that already finished — so the second probe\n * finishes too, its markup is the whole document, and the emptiness test\n * cannot fire. It was being paid for anyway: a second full render of every\n * frozen page, which on a site whose pages are mostly frozen is most of\n * the prerender.\n */\n async function withRootFallbackChecked(result: PrerenderResult): Promise<PrerenderResult> {\n if (result.type !== 'shell') return result\n if (route.loadings.length !== 1 || !engine.handleRscPprShell) return result\n\n // A tenth of the shell budget, because this is a different question.\n //\n // Deciding what a page's shell IS means waiting out everything that can\n // resolve. Asking whether anything paints at all without the root\n // fallback is a boolean about the first flush — and a page that paints,\n // paints immediately. Given the full budget it cost two seconds a route\n // to learn what the first millisecond already said, which on this\n // example was 40% of the entire prerender.\n const withoutRoot = await withRequest(null, () =>\n withCache(() =>\n withRedirect(async () =>\n engine.handleRscPprShell(\n route.component,\n props,\n layouts,\n [],\n route.slots,\n url,\n ROOT_FALLBACK_BUDGET_MS,\n ),\n ),\n ),\n ).catch(() => null)\n\n if (withoutRoot && closeDocument(withoutRoot.shellHtml.trim()) === '') {\n result.warning =\n 'nothing painted without the root loading.tsx — the fallback the whole app shares ' +\n 'is standing in for this page. Put a boundary where the waiting is.'\n }\n\n return result\n }\n\n // A route that only redirects still has an answer to freeze — the answer\n // is the redirect, not a page. Rendering it per request re-derives a\n // constant, and on a static host there would be nothing to derive it with.\n if (redirected) {\n await write(\n `${pathKey(url)}.redirect.json`,\n JSON.stringify({ status: redirected.status, location: redirected.location }),\n )\n\n return said('frozen', `redirects to ${redirected.location}`)\n }\n\n if (!shell) return said('error', 'refused before it rendered')\n\n if (shell.error) return said('error', shell.error)\n\n // Something failed while rendering. Not necessarily the page's fault — a\n // build machine that cannot reach the database produces this, and so does a\n // genuinely broken component — so it is not fatal. It is simply not\n // something to freeze: whatever this render produced is a failure state,\n // and freezing it serves that state to everyone until the next build.\n //\n // Rendering per request is the honest answer. It works as soon as whatever\n // was missing is reachable, which at runtime it usually is.\n if (shell.renderFailure) {\n return said('blocked', `could not be rendered at build time: ${shell.renderFailure}`)\n }\n\n // A timeout is the ordinary path for a page that streams, not a failure:\n // the probe hands the page a host global that never resolves, React\n // flushes everything that does not depend on it, and the abort happens\n // once there is nothing left to flush. So the captured markup IS the\n // shell — layouts, static content, and the fallbacks standing in for what\n // has not arrived.\n if (shell.timedOut) {\n const body = closeDocument(shell.shellHtml.trim())\n\n // Nothing was flushed before the page blocked, so there is no shell to\n // ship — a page that blocks above every boundary can only be rendered on\n // demand. `reaches for the host` is the specific reason when both are\n // true; a page that merely ran long says the other thing.\n if (body === '') {\n return said(\n 'blocked',\n (readRequest\n ? 'reads the request'\n : shell.usedDynamicApis\n ? 'reaches for the host'\n : 'blocks') +\n ' before anything can paint. Add a loading.tsx beside it, or put a ' +\n '<Suspense> above the waiting, and it has a skeleton to store.',\n )\n }\n\n await writeShell(route, url, body, shell.postponed)\n\n return await withRootFallbackChecked(said('shell', null))\n }\n\n // Warned, not refused.\n //\n // A frozen `new Date()` may be exactly what the author meant — a build\n // stamp, a copyright year — and the build cannot tell that from a\n // \"3 minutes ago\" that will still say three minutes next month. Refusing\n // would make the honest case unbuildable in order to protect the careless\n // one, and there is no flag to add here without inventing the declaration\n // this design exists to avoid.\n //\n // So it says what happened, names what was called, and gives the repair.\n // The escape hatch is that a warning does not stop the build — which is the\n // right weight for something that is occasionally correct.\n //\n // Only for a page frozen WHOLE. On a shell the call may sit inside a hole,\n // which renders per request, where it is correct.\n const noteNondeterminism = (result: PrerenderResult): PrerenderResult => {\n if (nondeterministic.length === 0) return result\n\n result.warning =\n `froze ${nondeterministic.join(' and ')} — a stored page keeps whatever that ` +\n 'returned at build time. For a value that should differ per visitor, read it ' +\n 'through something the build can suspend on, such as an rpc() call.'\n\n return result\n }\n\n // Rendered whole, with params that were invented because the route listed\n // none. Freezing that stores a page whose id is literally `_`, and a shell\n // is no better: the value is in the markup rather than behind a boundary\n // the client fills. A route reaches this only by rendering its params\n // before it can paint, which is exactly the shape that cannot be shared\n // across urls.\n if (unlisted) {\n return said('blocked', 'renders its params before it can paint, and lists no urls to build')\n }\n\n const shipsJs = route.clientJs !== false\n\n const rendered = await engine.handleRsc(\n route.component,\n props,\n null,\n layouts,\n // Not empty: a page whose layout declares a parallel slot renders without\n // it otherwise, and nothing says so — the page comes out whole apart from\n // the missing region.\n route.loadings,\n route.slots,\n 0,\n url,\n shipsJs,\n // A build has no host to answer rpc(), so every host call must suspend\n // rather than resolve. Without this they found no host at all and the\n // page was frozen holding whatever undefined rendered to — a document\n // that looks right, hydrates against an undefined prop, and blanks.\n false,\n )\n\n // The render reached for the host, so its data is not the same for\n // everyone and there is no build-time answer for it. Not frozen: a shell\n // is shipped instead and the page finishes for whoever asks.\n if (rendered.usedDynamicApis) {\n return said('shell', 'reaches the host for data')\n }\n\n // A client component without a runtime is inert markup — a button that\n // does nothing. Refused rather than shipped, and named, because they are\n // usually inherited from a shared layout rather than written on the page.\n if (!shipsJs && rendered.clientComponents.length > 0) {\n return said(\n 'error',\n `ships no client runtime, but the tree renders ${rendered.clientComponents.join(', ')}. ` +\n 'These usually come from a shared layout rather than the page itself.',\n )\n }\n\n const key = pathKey(url)\n\n await write(`${key}.html`, rendered.body)\n await write(`${key}.flight`, rendered.rscPayload)\n\n // One variant per depth the client might already hold. Without them every\n // navigation to a prerendered route is a whole document, which replaces the\n // root and unmounts the pages retained behind it — so going back does not\n // restore the form you were filling in. Most routes in a real app are\n // prerendered, which makes this the common path rather than an edge case.\n for (let depth = 1; depth <= route.layouts.length; depth++) {\n const { rscPayload } = await engine.handleRscPayload(\n route.component,\n props,\n layouts,\n route.loadings,\n route.slots,\n depth,\n url,\n )\n\n await write(`${key}.seg${depth}.flight`, rscPayload)\n }\n\n await write(\n `${key}.meta.json`,\n JSON.stringify({ layouts: route.layouts, component: route.component, version: version ?? null }, null, 2),\n )\n\n return noteNondeterminism(await withRootFallbackChecked(said('frozen', null)))\n }\n\n /**\n * Freeze a shell, under the url when it is one and under the route's pattern\n * when it stands for many.\n *\n * A route whose urls were never listed still gets a shell: nothing in it\n * varies by param, so the same markup is correct for every url the route\n * matches. That is most of the value — the routes you can enumerate are the\n * ones you could already freeze whole.\n */\n async function writeShell(\n route: ManifestRoute,\n url: string,\n body: string,\n postponed?: unknown,\n ): Promise<void> {\n const parameterised = route.segments.some((s) => s.type !== 'static')\n const key = parameterised && !route.staticParams ? patternKey(route) : pathKey(url)\n\n await write(`${key}.ppr.html`, body)\n\n // Written only when there is something to resume from. Its absence is\n // meaningful rather than incidental: a host that finds no postponed state\n // serves the shell and lets the client fill it, which is what every build\n // before this one did.\n if (postponed != null) {\n await write(`${key}.postponed.json`, JSON.stringify(postponed))\n }\n await write(\n `${key}.ppr-meta.json`,\n JSON.stringify(\n { layouts: route.layouts, component: route.component, parameterised, version: version ?? null },\n null,\n 2,\n ),\n )\n }\n\n}\n"]}
|
package/dist/redirect.d.ts
CHANGED
package/dist/redirect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../src/redirect.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,0DAA0D;AAC1D,8CAA8C;AAC9C,0CAA0C;AAC1C,UAAU;AACV,MAAM;AACN,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,sEAAsE;AACtE,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,sEAAsE;AACtE,+CAA+C;AAC/C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,iDAAiD;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,OAAO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AK,CAAC,KAAK,QAA4B,CAAA;QACjD,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,CAAA;IACb,CAAC;IAED,MAAM,IAAI,GAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;IAErC,OAAO,MAAM,KAAK,EAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["// Redirecting from inside a render.\n//\n// import { redirect } from '@rsc-kit/core/redirect'\n//\n// export default async function ProductPage({ slug }) {\n// const product = await findProduct(slug)\n// if (!product) redirect('/products')\n// ...\n// }\n//\n// The hard part is not throwing — it is that a redirect decided during a\n// render may be decided after the response has already begun. Headers flush\n// early on purpose (see the stream-start invariant), so by the time a\n// component deep in a Suspense boundary changes its mind, the 200 is gone.\n//\n// So there are two windows, and which one a redirect lands in is decided by\n// where it was thrown rather than by anything the caller does:\n//\n// Before the shell resolves — nothing has been written. The host answers\n// with a real 3xx, or for a navigation with X-RSC-Redirect, and the browser\n// never sees the page. This is the window every guard lands in, because a\n// guard runs above the boundaries.\n//\n// After the shell resolves — the shell is already on the wire. It holds\n// layouts and Suspense fallbacks, so no data from the redirecting subtree\n// has been shown. The location travels to the client instead, which\n// performs it as an ordinary SPA navigation.\n//\n// Neither window costs a buffered byte. The first exists because the host\n// already awaits the shell before writing anything; the second because React\n// already carries an error digest to the client.\n\nimport { assertSafeRedirect } from './safeUrl.js'\nimport type { Href } from './routes.js'\nimport { resolveScope } from './revalidate.js'\nimport { RedirectSignal } from './redirectDigest.js'\nimport type { Redirection } from './redirectDigest.js'\n\nexport { RedirectSignal, isRedirectSignal, redirectDigest, parseRedirectDigest } from './redirectDigest.js'\nexport type { Redirection } from './redirectDigest.js'\n\n/** Per-render state, for the same reason revalidation has it: two can be in flight. */\ninterface Slot {\n redirect: Redirection | null\n}\n\ninterface Scope {\n getStore(): Slot | undefined\n run<T>(store: Slot, fn: () => T): T\n}\n\n/**\n * One scope, however many copies of this module exist.\n *\n * The app's components are bundled into the server bundle and the host is\n * not, so this module is loaded twice. Two scopes would mean the component\n * records in one and the host reads the other: the redirect is simply never\n * honoured, and nothing on either side reports a problem.\n */\nconst SCOPE = Symbol.for('@rsc-kit/core.redirect-scope')\n\nconst globals = globalThis as Record<symbol | string, unknown>\n\nlet ready: Promise<void> | null = null\n\nfunction scope(): Scope | null {\n return (globals[SCOPE] as Scope | undefined) ?? null\n}\n\n/**\n * Leave this page for another one.\n *\n * Never returns: it throws, which stops the component that called it. Do not\n * wrap a call in `try`/`catch` without rethrowing what you do not recognise —\n * swallowing this turns a redirect into a blank region.\n *\n * `location` is typed to the routes the build found, so a redirect to a page\n * that no longer exists stops compiling. Cast with `as Href` when the\n * destination is computed — remembering where someone was going and sending\n * them back to it is the usual case.\n *\n * Where it is called decides how it is delivered, and the difference matters\n * for anything that must not be seen. A call above every Suspense boundary is\n * answered with a status code before a byte is written. A call inside one is\n * answered after the shell — which holds no data from inside the boundary,\n * but does hold whatever the layouts above it rendered.\n */\nexport function redirect(location: Href, status = 307): never {\n // Refused here, at the one place every delivery path leads back to. The\n // destination reaches location.href on the client and an inline script in a\n // document, and a javascript: url runs in all of them.\n assertSafeRedirect(location)\n\n // A redirect is a 3xx. Anything else produces a response carrying Location\n // that no browser acts on — the page renders, the redirect silently does not\n // happen, and nothing says why.\n if (status < 300 || status > 399) {\n throw new Error(\n 'Not a redirect status: ' + status + '. A redirect is 3xx; 307 preserves the method.',\n )\n }\n\n const store = scope()?.getStore()\n\n // First wins. A layout that redirects and a page that also redirects should\n // land where the outer one said, not wherever finished last.\n if (store && !store.redirect) {\n store.redirect = { location, status }\n }\n\n throw new RedirectSignal(location, status)\n}\n\n/** The redirect asked for during the current render, if any. */\nexport function currentRedirect(): Redirection | null {\n return scope()?.getStore()?.redirect ?? null\n}\n\n/**\n * Run a render with somewhere for a redirect to be recorded, and report one.\n *\n * `taken()` is read twice by a streaming host: once when the shell resolves,\n * to answer with a status code, and again when the stream ends, for a\n * redirect that arrived too late for one.\n */\nexport async function withRedirect<T>(\n run: (taken: () => Redirection | null) => Promise<T>,\n): Promise<T> {\n if (!globals[SCOPE]) {\n ready ??= resolveScope().then((resolved) => {\n globals[SCOPE] ??= resolved as unknown as Scope\n })\n\n await ready\n }\n\n const slot: Slot = { redirect: null }\n\n return await scope()!.run(slot, () => run(() => slot.redirect))\n}\n"]}
|
package/dist/redirectDigest.d.ts
CHANGED
|
@@ -17,4 +17,3 @@ export declare function isRedirectSignal(error: unknown): error is RedirectSigna
|
|
|
17
17
|
export declare function redirectDigest(error: unknown): string | null;
|
|
18
18
|
/** The redirect a digest describes, or null if it describes something else. */
|
|
19
19
|
export declare function parseRedirectDigest(digest: unknown): Redirection | null;
|
|
20
|
-
//# sourceMappingURL=redirectDigest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirectDigest.js","sourceRoot":"","sources":["../src/redirectDigest.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,2DAA2D;AAW3D;;;;;;;;;;;GAWG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;AAExD,4DAA4D;AAC5D,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvB,QAAQ,CAAQ;IAChB,MAAM,CAAQ;IAE9B,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CACnB;QAAC,IAA2C,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC5D,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,C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MAAM,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAEnC,IAAI,SAAS,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IAEjC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;IAE1C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;AACrE,CAAC","sourcesContent":["// What a redirect is, and how it survives every boundary it has to cross.\n//\n// Its own module because three graphs need it and none of them can import the\n// others' halves: the app bundle (where a component calls redirect()), the\n// engine (which turns it into a digest), and the browser (which performs it).\n// Nothing here imports anything, so all three can have it.\n\nexport interface Redirection {\n location: string\n /**\n * 307 by default rather than 302: it preserves the method, so a redirect out\n * of a POST does not silently become a GET of the target.\n */\n status: number\n}\n\n/**\n * The mark that says an error is a redirect.\n *\n * A property rather than `instanceof`, for the reason this project keeps\n * running into: the app's components are bundled separately from the engine\n * that renders them, so each gets its own copy of this module and its own copy\n * of the class. `instanceof` compares identity across that seam and is simply\n * false — the redirect renders as an unhandled error, and the only clue is\n * that the page went blank instead of moving.\n *\n * Symbol.for, so the two copies agree on the key as well as the value.\n */\nconst MARK = Symbol.for('@rsc-kit/core.redirect-signal')\n\n/** Thrown to stop rendering the subtree that redirected. */\nexport class RedirectSignal extends Error {\n public readonly location: string\n public readonly status: number\n\n constructor(location: string, status: number) {\n super(`Redirect to ${location}`)\n this.name = 'RedirectSignal'\n this.location = location\n this.status = status\n ;(this as unknown as Record<symbol, boolean>)[MARK] = true\n }\n}\n\nexport function isRedirectSignal(error: unknown): error is RedirectSignal {\n return (\n typeof error === 'object' &&\n error !== null &&\n (error as Record<symbol, unknown>)[MARK] === true\n )\n}\n\n/**\n * The prefix that carries a redirect inside React's error digest.\n *\n * React replaces a server error's message with an opaque digest in production,\n * and the digest is the one part it is guaranteed to transmit. A redirect\n * decided after the shell has no header left to travel in — the status line is\n * already sent — so it travels here.\n */\nconst PREFIX = 'RSC_REDIRECT;'\n\n/** The digest for a redirect, or null for any other error. */\nexport function redirectDigest(error: unknown): string | null {\n if (!isRedirectSignal(error)) return null\n\n return `${PREFIX}${error.status};${error.location}`\n}\n\n/** The redirect a digest describes, or null if it describes something else. */\nexport function parseRedirectDigest(digest: unknown): Redirection | null {\n if (typeof digest !== 'string' || !digest.startsWith(PREFIX)) return null\n\n const rest = digest.slice(PREFIX.length)\n const separator = rest.indexOf(';')\n\n if (separator === -1) return null\n\n const status = Number(rest.slice(0, separator))\n const location = rest.slice(separator + 1)\n\n if (!location) return null\n\n return { location, status: Number.isFinite(status) ? status : 307 }\n}\n"]}
|
package/dist/request.d.ts
CHANGED
package/dist/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,iDAAiD;AACjD,4FAA4F;AAC5F,mCAAmC;AACnC,MAAM;AACN,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,iBAAiB;AACjB,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,6EAA6E;AAC7E,qDAAqD;AACrD,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,+EAA+E;AAC/E,4EAA4E;AAC5E,yEAAyE;AACzE,0EAA0E;AAC1E,gDAAgD;AAChD,EAAE;AACF,yEAAyE;AACzE,0CAA0C;AA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@rsc-kit/core/request'\n//\n// export default async function middleware() {\n// const locale = cookies().get('locale') ?? negotiate(headers().get('accept-language'))\n// if (!locale) redirect('/en')\n// }\n//\n// Server components have no arguments beyond their props, and middleware has\n// none at all, so without this an app on a JavaScript host cannot see a header\n// — no locale negotiation, no subdomain, no cookie. The Laravel host escaped\n// that through rpc(), because PHP has the request; this is the same thing for\n// everyone else.\n//\n// Read-only on purpose. Setting a cookie means writing a response header, and\n// by the time a component renders the shell may already have been flushed — an\n// API that appears to set one and silently does not is worse than not having\n// it. Set them in the host, which owns the response.\n//\n// Asynchronous on purpose too, and not for ergonomics. A build has no request,\n// so a read there suspends and never settles — which is the same thing the\n// prerender probe does to a host call. Anything still waiting when the probe's\n// budget expires becomes a fallback in the frozen shell, so a read inside a\n// Suspense boundary leaves the shell frozen and makes only that boundary\n// dynamic. Reading synchronously could only mark the whole route dynamic,\n// because there would be nothing to suspend on.\n//\n// Scoped to the request, on the same store cache() uses. Two requests in\n// flight cannot see each other's headers.\n\nimport { resolveScope } from './revalidate.js'\n\n/** What a host can supply: a real Request, or the parts of one. */\nexport type RequestLike = Request | { url: string; headers: Record<string, string> } | null\n\ninterface Slot {\n /** False during a build: there is nothing to answer with. */\n request: boolean\n url: string | null\n /**\n * Held as Headers rather than as a Request.\n *\n * `new Request(url, { headers })` drops Cookie: a spec-compliant Headers\n * built with the \"request\" guard refuses the forbidden header names, and\n * Cookie is one of them. `new Headers()` has no guard and keeps it. Bun\n * happens to allow both, which is why rebuilding a Request looked fine until\n * it ran anywhere stricter — and what it loses is every cookie, silently.\n */\n headers: Headers\n original: Request | null\n /**\n * Whether anything asked. Only for the build's report — the classification\n * comes from the suspension, not from this.\n */\n read: boolean\n}\n\nconst SCOPE = Symbol.for('@rsc-kit/core.request-scope')\n\nconst globals = globalThis as Record<symbol | string, unknown>\n\nlet ready: Promise<void> | null = null\n\ninterface Scope {\n getStore(): Slot | undefined\n run<T>(store: Slot, fn: () => T): T\n}\n\nfunction scope(): Scope | null {\n return (globals[SCOPE] as Scope | undefined) ?? null\n}\n\nfunction slot(): Slot {\n const store = scope()?.getStore()\n\n if (!store) {\n throw new Error(\n 'No request in scope. headers() and cookies() are for a render — middleware, a layout, ' +\n 'a page — and there is nothing to read outside one.',\n )\n }\n\n store.read = true\n\n return store\n}\n\n/**\n * The request's headers.\n *\n * Empty during a build, where there is no request: the page is marked as\n * needing one instead, and rendered on demand rather than frozen.\n */\nexport async function headers(): Promise<Headers> {\n const store = slot()\n\n return store.request ? store.headers : never()\n}\n\n/** How a cookie should be written. The names browsers use. */\nexport interface CookieOptions {\n path?: string\n domain?: string\n maxAge?: number\n expires?: Date\n httpOnly?: boolean\n secure?: boolean\n sameSite?: 'strict' | 'lax' | 'none'\n partitioned?: boolean\n}\n\nexport interface Cookies {\n get(name: string): string | undefined\n has(name: string): boolean\n getAll(): Record<string, string>\n /**\n * Write one on the response.\n *\n * Only from a server action, which has a response of its own that has not\n * been sent. A render has already flushed its headers by the time a\n * component runs — that is what makes the first paint fast — so this throws\n * there rather than appearing to work.\n */\n set(name: string, value: string, options?: CookieOptions): void\n /** Write one that expires immediately. Same rule about where. */\n delete(name: string, options?: CookieOptions): void\n}\n\n/** Kept for the name it had when it could only read. */\nexport type ReadonlyCookies = Cookies\n\n/**\n * The response being built, while it can still be changed.\n *\n * Open from the moment a request is picked up until the host constructs its\n * Response, and sealed the instant it does. Middleware runs inside that window\n * — before any rendering starts — so a header set there is on the answer. A\n * component runs after it, during streaming, where the status line and headers\n * are already on the wire; setting one there is refused rather than dropped.\n */\ninterface Draft {\n headers: Headers\n sealed: boolean\n}\n\nconst DRAFT = Symbol.for('@rsc-kit/core.response-draft')\n\nlet draftReady: Promise<void> | null = null\n\ninterface DraftScope {\n getStore(): Draft | undefined\n run<T>(store: Draft, fn: () => T): T\n}\n\nfunction draft(): DraftScope | null {\n return (globals[DRAFT] as DraftScope | undefined) ?? null\n}\n\n/** The open draft, or an explanation of why there is not one. */\nfunction writable(what: string): Draft {\n const open = draft()?.getStore()\n\n if (!open) {\n throw new Error(\n `${what} needs a response that has not been sent. Middleware and server actions have one; ` +\n 'a script outside a request does not.',\n )\n }\n\n if (open.sealed) {\n throw new Error(\n `${what} was called after the response had been sent. Headers go out before the render ` +\n 'starts — that is what makes the first paint fast — so set them in middleware, which ' +\n 'runs before it.',\n )\n }\n\n return open\n}\n\n/**\n * Headers to put on the answer.\n *\n * Mutate it as you would any Headers. `append` is the one to reach for when a\n * header may legitimately appear twice; `set` replaces.\n */\n/**\n * The draft's headers, refusing writes once the response has gone.\n *\n * A proxy rather than the Headers itself: returning the live object means code\n * that captured it before the response was built can go on mutating a thing\n * nobody will read. Nothing in this package does that — the host copies the\n * headers onto the response the instant it seals — but \"safe because of the\n * order two other functions happen to run in\" is not a property, and an app\n * holding the object across an await would find writes silently doing nothing.\n */\nfunction sealable(draft: Draft): Headers {\n const guard = (method: 'set' | 'append' | 'delete') =>\n (...args: [string, string]) => {\n writable('responseHeaders()')\n\n return (draft.headers[method] as (...a: string[]) => void)(...args)\n }\n\n const proxy: Headers = new Proxy(draft.headers, {\n get(target, property, receiver) {\n if (property === 'set' || property === 'append' || property === 'delete') {\n return guard(property)\n }\n\n // A maplike forEach passes the object it was called on as the third\n // callback argument, and binding to the target makes that the raw\n // Headers — a live, unguarded reference handed out by the very method\n // meant to be read-only. Substituted for the proxy so there is no way\n // through.\n if (property === 'forEach') {\n return (fn: (value: string, key: string, parent: Headers) => void, thisArg?: unknown) =>\n target.forEach((value, key) => fn.call(thisArg, value, key, proxy))\n }\n\n const value = Reflect.get(target, property, receiver)\n\n return typeof value === 'function' ? value.bind(target) : value\n },\n })\n\n return proxy\n}\n\nexport function responseHeaders(): Headers {\n return sealable(writable('responseHeaders()'))\n}\n\n/**\n * Run a request with a response that can still be changed, and take what was\n * put on it.\n *\n * `seal()` is called by the host the moment it builds the Response, so\n * anything set afterwards is refused instead of silently going nowhere.\n */\nexport async function withResponseDraft<T>(\n run: (draft: { taken: () => Headers; seal: () => void }) => Promise<T>,\n): Promise<T> {\n if (!globals[DRAFT]) {\n draftReady ??= resolveScope().then((resolved) => {\n globals[DRAFT] ??= resolved as unknown as DraftScope\n })\n\n await draftReady\n }\n\n const open: Draft = { headers: new Headers(), sealed: false }\n\n return await draft()!.run(open, () =>\n run({\n taken: () => open.headers,\n seal: () => {\n open.sealed = true\n },\n }),\n )\n}\n\n/**\n * A cookie name, as RFC 6265 defines one: a token, so no separators at all.\n *\n * Checked rather than escaped because there is no escaping — a name is not a\n * quoted string. An app that derives one from user input (`pref_${key}`) would\n * otherwise let that input close the pair and open another: a name of\n * `session=attacker; Path=/; HttpOnly; x` serializes to a header whose *first*\n * pair is a session cookie the caller chose, and the browser reads the first.\n */\nconst COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/\n\n/** No separator may appear in an attribute either, for the same reason. */\nconst COOKIE_ATTRIBUTE = /[;,\\r\\n]/\n\n/** `name=value; Path=/; HttpOnly` — the header a browser expects. */\nexport function serializeCookie(cookie: { name: string; value: string; options: CookieOptions }): string {\n if (!COOKIE_NAME.test(cookie.name)) {\n throw new Error(\n `Not a usable cookie name: ${JSON.stringify(cookie.name)}. ` +\n 'A name is a token — letters, digits and !#$%&\\'*+-.^_`|~ — with no spaces, ' +\n 'semicolons or equals signs. Nothing escapes them, so one cannot be encoded around.',\n )\n }\n\n if (cookie.options.sameSite !== undefined) {\n const value = String(cookie.options.sameSite).toLowerCase()\n\n if (value !== 'strict' && value !== 'lax' && value !== 'none') {\n throw new Error(\n `Not a SameSite value: ${JSON.stringify(cookie.options.sameSite)}. ` +\n 'It is written into the header as given, so anything else becomes further attributes.',\n )\n }\n }\n\n for (const [attribute, value] of [\n ['path', cookie.options.path],\n ['domain', cookie.options.domain],\n // Trusted because it is typed as a Date — but a cast reaches this, and the\n // result lands in the header verbatim like the others.\n ['expires', cookie.options.expires?.toUTCString()],\n ] as const) {\n if (typeof value === 'string' && COOKIE_ATTRIBUTE.test(value)) {\n throw new Error(\n `The cookie ${attribute} ${JSON.stringify(value)} contains a separator. ` +\n 'It would be read as further attributes rather than as part of this one.',\n )\n }\n }\n\n const parts = [`${cookie.name}=${encodeURIComponent(cookie.value)}`]\n const o = cookie.options\n\n if (o.maxAge !== undefined) parts.push(`Max-Age=${Math.floor(o.maxAge)}`)\n if (o.expires) parts.push(`Expires=${o.expires.toUTCString()}`)\n // Defaulted, because a cookie without one is scoped to the path that set it\n // — a session written by POST /_rsc/action would not be sent for any page.\n parts.push(`Path=${o.path ?? '/'}`)\n if (o.domain) parts.push(`Domain=${o.domain}`)\n if (o.sameSite) parts.push(`SameSite=${o.sameSite[0].toUpperCase()}${o.sameSite.slice(1)}`)\n if (o.secure) parts.push('Secure')\n if (o.httpOnly) parts.push('HttpOnly')\n if (o.partitioned) parts.push('Partitioned')\n\n return parts.join('; ')\n}\n\nexport async function cookies(): Promise<Cookies> {\n const parsed = parseCookies((await headers()).get('cookie') ?? '')\n\n const write = (name: string, value: string, options: CookieOptions = {}): void => {\n // Appended, never set: several cookies on one response are several\n // Set-Cookie headers, and replacing would leave only the last.\n writable('cookies().set()').headers.append(\n 'Set-Cookie',\n serializeCookie({ name, value, options }),\n )\n }\n\n return {\n get: (name) => parsed[name],\n has: (name) => name in parsed,\n getAll: () => ({ ...parsed }),\n set: write,\n // Expired rather than removed: a browser drops a cookie when it is told\n // one has already passed, and there is no other way to say it.\n delete: (name, options = {}) => write(name, '', { ...options, maxAge: 0 }),\n }\n}\n\n/**\n * The whole request, for a host-specific need the accessors do not cover.\n *\n * Null on a host that forwards only the parts — the worker behind Laravel has\n * a socket, not a request. Use headers() and cookies(), which work everywhere.\n */\nexport async function request(): Promise<Request | null> {\n const store = slot()\n\n return store.request ? store.original : never()\n}\n\n/**\n * Mark everything below as belonging to the request, not to the build.\n *\n * export default async function Orders() {\n * await connection()\n *\n * const rows = await db.query('select * from orders')\n *\n * return <ul>{rows.map(...)}</ul>\n * }\n *\n * At build time this never resolves, so nothing after it runs: the query is not\n * made, the boundary above becomes a hole, and the rest of the page still\n * freezes. At request time it resolves immediately and the component runs\n * normally.\n *\n * **Once is enough.** It is a barrier, not a wrapper — everything after it in\n * this component belongs to the request, however many calls that is. Repeating\n * it before each query does nothing.\n *\n * It needs a boundary above it. With a <Suspense> or a loading.tsx there is a\n * fallback to store and the page becomes a shell; with neither, nothing can\n * paint and the build refuses the route rather than storing a blank.\n *\n * Reach for it when the build should not run something — a database the build\n * machine cannot see, or a value that must differ per visitor. A query the\n * build CAN run, whose answer is the same for everyone, wants none of this: it\n * should be frozen.\n *\n * The same name and behaviour as Next's `connection()`.\n */\nexport async function connection(): Promise<void> {\n const store = slot()\n\n // No request means a build. Suspend rather than continue, the same way\n // headers() and cookies() do.\n if (!store.request) return never()\n}\n\n/** The url this request was made to, whichever way the host supplied it. */\nexport async function url(): Promise<string | null> {\n const store = slot()\n\n return store.request ? store.url : never()\n}\n\nfunction parseCookies(header: string): Record<string, string> {\n const out: Record<string, string> = {}\n\n for (const part of header.split(';')) {\n const eq = part.indexOf('=')\n\n if (eq === -1) continue\n\n const name = part.slice(0, eq).trim()\n\n if (!name) continue\n\n // Decoded because that is how they were written. A malformed escape is\n // left as it arrived rather than throwing the render away.\n const raw = part.slice(eq + 1).trim()\n\n try {\n out[name] = decodeURIComponent(raw)\n } catch {\n out[name] = raw\n }\n }\n\n return out\n}\n\n/**\n * Run one request with its headers readable.\n *\n * `null` is the build: a scope with nothing in it, so a page that reads is\n * caught rather than silently frozen holding whatever the machine that built\n * it happened to send.\n */\nexport async function withRequest<T>(from: RequestLike, run: () => Promise<T>): Promise<T> {\n if (!globals[SCOPE]) {\n ready ??= resolveScope().then((resolved) => {\n globals[SCOPE] ??= resolved as unknown as Scope\n })\n\n await ready\n }\n\n const isRequest = from instanceof Request\n const store: Slot = {\n request: from !== null,\n url: from ? (isRequest ? from.url : from.url) : null,\n headers: from ? (isRequest ? from.headers : new Headers(from.headers)) : new Headers(),\n original: isRequest ? from : null,\n read: false,\n }\n\n return await scope()!.run(store, run)\n}\n\n/**\n * A promise that never settles, so the caller suspends.\n *\n * What a read does during a build. React treats it exactly as it treats a host\n * call that never answers: the component suspends, its Suspense fallback goes\n * into the shell, and the probe's budget decides the rest.\n */\nfunction never(): Promise<never> {\n slot().read = true\n\n return new Promise(() => {})\n}\n\n/**\n * Whether anything read the request during the scope that is open.\n *\n * For the prerenderer, which opens one with no request and asks afterwards.\n */\nexport function requestWasRead(): boolean {\n return scope()?.getStore()?.read ?? false\n}\n\n/**\n * The query string, as a page receives it.\n *\n * Derived from the request rather than passed down the render, so no host has\n * to forward it separately — and so it suspends during a build for the same\n * reason every other read does. A frozen page cannot know the query it will be\n * asked for.\n */\nexport async function searchParams(): Promise<URLSearchParams> {\n const from = await url()\n\n return from ? new URL(from).searchParams : new URLSearchParams()\n}\n"]}
|
package/dist/revalidate.d.ts
CHANGED
package/dist/revalidate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revalidate.js","sourceRoot":"","sources":["../src/revalidate.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,2EAA2E;AAC3E,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,iBAAiB;AACjB,4CAA4C;AAC5C,iCAAiC;AACjC,qEAAqE;AACrE,0BAA0B;AAC1B,MAAM;AACN,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,uCAAuC;AAQvC;;;;;;;;;;;GAWG;AACH,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;AAE5D,MAAM,OAAO,GAAG,UAA8C,CAAA;AAE9D,IAAI,KAAK,GAAyB,IAAI,CAAA;AACtC,IAAI,MAAM,GAAG,KAAK,CAAA;AAElB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;AAChC,4EAA4E;AAC5E,kCAAkC;AAClC,IAAI,GAA4B,OAAO;IAE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AAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,uEAAuE;QACvE,kEAAkE;QAClE,KAAK,KAAK,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACzC,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,CAAA;QAC7B,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,CAAA;IACb,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAEhC,OAAO,MAAM,KAAK,EAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["// Marking part of a page stale from inside a server action.\n//\n// The point is one round trip. An action that changes an order could tell the\n// browser to go and re-fetch something, but then the answer the user is\n// waiting on arrives before the screen is right, and the fix costs another\n// request. Marking instead lets the action's own answer carry the re-rendered\n// region back with it — the client applies it and never knows it asked.\n//\n// 'use server'\n// export async function addOrder(order) {\n// await orders.insert(order)\n// revalidate('orders') // the section or slot by that name\n// return { ok: true }\n// }\n//\n// Scoped to the action that is running, not global, because two requests can\n// be in flight at once and marking is per-request state. In Laravel this is a\n// `scoped()` binding on the container.\n\n/** What this needs from a runtime: somewhere to keep per-action state. */\ninterface Scope {\n getStore(): Set<string> | undefined\n run<T>(store: Set<string>, fn: () => T): T\n}\n\n/**\n * One store, however many copies of this module exist.\n *\n * The app's actions are bundled into the server bundle; the host that runs\n * them is not. So this module is loaded twice, and two scopes mean the action\n * marks in one and the host reads the other — everything appears to work, the\n * action's answer simply never carries anything back, and no error is raised\n * on either side.\n *\n * The engine installs its host callable on globalThis for exactly this\n * reason. This is the same crossing.\n */\nconst SCOPE = Symbol.for('@rsc-kit/core.revalidation-scope')\n\nconst globals = globalThis as Record<symbol | string, unknown>\n\nlet ready: Promise<void> | null = null\nlet warned = false\n\n/**\n * AsyncLocalStorage, wherever this happens to be running.\n *\n * The global first, because that is where a Worker has it — and where the\n * engine puts it, since @vitejs/plugin-rsc assigns\n * `globalThis.AsyncLocalStorage` for React's edge build. Then the module,\n * which is where Node, Bun and Deno have it.\n *\n * There is no third branch on purpose. The engine bundle imports\n * `node:async_hooks` statically, so async context is a requirement of the\n * whole system rather than of this file: a runtime without it cannot load the\n * engine at all, and a fallback here would be code that can never run.\n */\nexport async function resolveScope(\n // Injectable so the branch a Worker takes can be tested from a runtime that\n // would otherwise never reach it.\n from: Record<string, unknown> = globals,\n): Promise<Scope> {\n const Ambient = from.AsyncLocalStorage as (new () => Scope) | undefined\n\n if (Ambient) return new Ambient()\n\n const { AsyncLocalStorage } = await import('node:async_hooks')\n\n return new AsyncLocalStorage<Set<string>>() as Scope\n}\n\n/** The scope, once resolved. Null before the first action runs. */\nfunction scope(): Scope | null {\n return (globals[SCOPE] as Scope | undefined) ?? null\n}\n\n/**\n * Mark a region of the current page for re-rendering.\n *\n * `'page'` and `'all'` re-render the page or the whole document; any other\n * name is a section or a parallel slot. Unknown names are refused by the\n * renderer with the names it does know, rather than quietly refreshing\n * nothing.\n *\n * Outside an action this does nothing rather than throwing: it is reasonable\n * for shared code to mark, and unreasonable for that to fail when the same\n * function is called during an ordinary render.\n */\nexport function revalidate(target: string): void {\n scope()?.getStore()?.add(target)\n}\n\n/** Whether anything is listening, for a host that wants to warn about the rest. */\nexport function isRevalidating(): boolean {\n return scope()?.getStore() !== undefined\n}\n\n/**\n * Run an action with somewhere for its marks to go, and collect them.\n *\n * The marks are read *after* the action has run, because what it invalidated\n * is only known once its work is done.\n */\nexport async function withRevalidation<T>(\n run: (taken: () => string[]) => Promise<T>,\n): Promise<T> {\n if (!globals[SCOPE]) {\n // Resolved once and shared, for the same reason the scope itself is: a\n // second copy of this module must not end up with a second scope.\n ready ??= resolveScope().then((resolved) => {\n globals[SCOPE] ??= resolved\n })\n\n await ready\n }\n\n const marked = new Set<string>()\n\n return await scope()!.run(marked, () => run(() => [...marked]))\n}\n"]}
|
package/dist/routes.d.ts
CHANGED
|
@@ -34,4 +34,3 @@ type OffRoute = `${string}://${string}` | `mailto:${string}` | `tel:${string}` |
|
|
|
34
34
|
*/
|
|
35
35
|
export type Href = Unregistered extends true ? string : Filled<RoutePattern> | `${Filled<RoutePattern>}?${string}` | `${Filled<RoutePattern>}#${string}` | OffRoute;
|
|
36
36
|
export {};
|
|
37
|
-
//# sourceMappingURL=routes.d.ts.map
|
package/dist/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,kEAAkE;AAClE,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,mCAAmC;AACnC,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,8EAA8E;AAC9E,sCAAsC;AACtC,EAAE;AACF,4CAA4C;AAC5C,2DAA2D;AAC3D,MAAM;AACN,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,kEAAkE;AAClE,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,mCAAmC;AACnC,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,8CAA8C;AAC9C,EAAE;AACF,8EAA8E;AAC9E,sCAAsC;AACtC,EAAE;AACF,4CAA4C;AAC5C,2DAA2D;AAC3D,MAAM;AACN,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,kBAAkB","sourcesContent":["// Typed routes: the urls this app can actually answer, as a type.\n//\n// Laravel needs route() because the url lives in PHP and can move\n// independently of the name it is called by. Here the url *is* the file path,\n// so a name would be indirection that buys nothing. What is worth having is\n// the other half — a link to a page that does not exist should fail at build\n// time rather than in the browser.\n//\n// There is no route() builder to go with this, deliberately. A template\n// literal is checked the same way — `/posts/${slug}` compiles and\n// `/postz/${slug}` does not — so a builder would only wrap what the language\n// already does. Encoding a value that is not url-safe is `encodeURIComponent`\n// in the template, the same as anywhere else.\n//\n// The build already walks app/ and knows every route's segments, so it writes\n// one line into the app's source dir:\n//\n// declare module '@rsc-kit/core/routes' {\n// interface Register { routes: '/' | '/posts/[slug]' }\n// }\n//\n// Everything below is derived from that union. An app that never runs the\n// generator — a generic host, a Laravel app that has not rebuilt — registers\n// nothing, `RoutePattern` stays `string`, and every url-taking API is exactly\n// as permissive as it was before. That fallback is the reason this can ship\n// without a flag.\n\n/**\n * Augmented by the generated `rsc-routes.d.ts`. Empty here on purpose.\n *\n * Declaration merging rather than a generic parameter, because the routes are\n * a property of the project, not of each call site — threading them through\n * every component that renders a Link is not a thing anyone would do twice.\n */\nexport interface Register {}\n\n/** The route patterns this app declared: `'/posts/[slug]'`. */\nexport type RoutePattern = Register extends { routes: infer R extends string } ? R : string\n\n/** Whether anything was registered. `string` means the generator never ran. */\ntype Unregistered = string extends RoutePattern ? true : false\n\n/**\n * A pattern with its dynamic segments opened up: `/posts/[slug]` accepts\n * `/posts/anything`.\n *\n * Catch-all and single params both become `${string}`, which for a catch-all\n * also swallows the slashes — `/docs/[...path]` accepts `/docs/a/b/c`.\n */\ntype Filled<P extends string> = P extends `${infer A}[...${string}]${infer B}`\n ? `${A}${string}${Filled<B>}`\n : P extends `${infer A}[${string}]${infer B}`\n ? `${A}${string}${Filled<B>}`\n : P\n\n/**\n * Not a route, but a legitimate href: another site, a mail client, a phone\n * number, an anchor on this page, a bare query string.\n */\ntype OffRoute = `${string}://${string}` | `mailto:${string}` | `tel:${string}` | `#${string}` | `?${string}`\n\n/**\n * A url this app can answer, or one that deliberately leaves it.\n *\n * Cast when the destination is computed rather than written:\n * `href={path as Href}`.\n */\nexport type Href = Unregistered extends true\n ? string\n : Filled<RoutePattern> | `${Filled<RoutePattern>}?${string}` | `${Filled<RoutePattern>}#${string}` | OffRoute\n"]}
|
package/dist/routing.d.ts
CHANGED
|
@@ -49,4 +49,3 @@ export declare function sharedDepth(held: string | null, chain: string[]): numbe
|
|
|
49
49
|
* that silently rebuilds a page it was holding.
|
|
50
50
|
*/
|
|
51
51
|
export declare function retentionKey(path: string, interceptSlot?: string | null): string;
|
|
52
|
-
//# sourceMappingURL=routing.d.ts.map
|
package/dist/routing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,OAAO;AACP,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,8BAA8B;AAU9B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,QAAuB,EAAE,QAAgB;IAClE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjD,IAAI,IAAI,GAAwB,IAAI,CAAA;IACpC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAA;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QAEjD,IAAI,CAAC,KAAK;YAAE,SAAQ;QAEpB,wEAAwE;QACxE,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CACjC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAA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A;IACV,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,aAA6B;IACtE,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAEtC,OAAO,aAAa,CAAC,CAAC,CAAC,eAAe,aAAa,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAA;AAClF,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,yEAAyE;IACzE,iDAAiD;IACjD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAA;IACvE,MAAM,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,aAAa,CAAC,CAAA;IAEvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAA;AACrD,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAE9B,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AACrE,CAAC","sourcesContent":["// Matching a url to a route, and deciding how much of the page to send.\n//\n// Pure: no Request, no Response, no filesystem. That is what lets the same\n// implementation serve three callers — the request handler, the prerenderer\n// enumerating what to build, and the generated server bundle, which embeds its\n// own route table and answers these without a manifest being passed around at\n// all.\n//\n// Every host would otherwise write this, and would get the same two things\n// wrong: answering /docs/new with [slug], and treating the layout chain as a\n// set rather than a sequence.\n\nimport type { ManifestRoute, RouteManifest, RouteSegment } from './manifest.js'\n\n/** A matched route and the params its url segments bound. */\nexport interface MatchedRoute {\n route: ManifestRoute\n params: Record<string, string>\n}\n\n/**\n * Match a pathname against the manifest's segments.\n *\n * The manifest stores segments rather than a pattern string, because the\n * pattern is the host's dialect — Laravel writes `{slug}`, Hono writes\n * `:slug`, and neither is the build's business. Matching them directly means\n * no dialect at all.\n *\n * Static segments beat dynamic ones at the same position: /docs/new is the\n * page called new, not the page called [slug] with slug=new.\n */\nexport function matchRoute(manifest: RouteManifest, pathname: string): MatchedRoute | null {\n const parts = pathname.split('/').filter(Boolean)\n let best: MatchedRoute | null = null\n let bestScore = -1\n\n for (const route of manifest.routes) {\n const bound = bindSegments(route.segments, parts)\n\n if (!bound) continue\n\n // More static segments wins; a catch-all is the weakest possible match.\n const score = route.segments.reduce(\n (n, s) => n + (s.type === 'static' ? 2 : s.type === 'param' ? 1 : 0),\n 0,\n )\n\n if (score > bestScore) {\n best = { route, params: bound }\n bestScore = score\n }\n }\n\n return best\n}\n\n/**\n * The interceptor registered for a slot, if this url has one.\n *\n * Matched against the url being navigated *to*: `(.)posts/[slug]` intercepts\n * /posts/anything, and the params it binds are the target's, not the page the\n * modal opens over.\n */\nexport function matchIntercept(\n manifest: RouteManifest,\n pathname: string,\n slot: string,\n): { component: string; params: Record<string, string> } | null {\n const parts = pathname.split('/').filter(Boolean)\n let best: { component: string; params: Record<string, string> } | null = null\n let bestScore = -1\n\n for (const intercept of manifest.intercepts) {\n if (intercept.slot !== slot) continue\n\n const params = bindSegments(intercept.segments, parts)\n\n if (!params) continue\n\n // Scored exactly as matchRoute scores, and for the same reason: a static\n // segment beats a dynamic one at the same position. Taking the first match\n // instead made the two disagree about which route a url belongs to — and\n // the guard is chosen by one while the content comes from the other, so a\n // url could be checked against the unguarded route and rendered from the\n // guarded one.\n const score = intercept.segments.reduce(\n (n, segment) => n + (segment.type === 'static' ? 2 : segment.type === 'param' ? 1 : 0),\n 0,\n )\n\n if (score > bestScore) {\n best = { component: intercept.component, params }\n bestScore = score\n }\n }\n\n return best\n}\n\nfunction bindSegments(segments: RouteSegment[], parts: string[]): Record<string, string> | null {\n const params: Record<string, string> = {}\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i]\n\n if (segment.type === 'catchAll') {\n // Swallows the rest, including none of it.\n params[segment.value] = parts.slice(i).join('/')\n\n return params\n }\n\n if (i >= parts.length) return null\n\n if (segment.type === 'static') {\n if (parts[i] !== segment.value) return null\n continue\n }\n\n params[segment.value] = decodeURIComponent(parts[i])\n }\n\n return segments.length === parts.length ? params : null\n}\n\n/**\n * How much of the layout chain the client already holds.\n *\n * It sends the chain outermost-first; the shared prefix is what it can keep.\n * Answering with a whole document instead is not merely wasteful — it replaces\n * the root, and replacing the root unmounts every page retained behind the\n * current one, so a half-typed form does not survive going back.\n */\nexport function sharedDepth(held: string | null, chain: string[]): number {\n if (!held) return 0\n\n const mounted = held.split(',').filter(Boolean)\n let shared = 0\n\n while (shared < mounted.length && shared < chain.length && mounted[shared] === chain[shared]) {\n shared++\n }\n\n return shared\n}\n\n/**\n * What a page is remembered as, for retention and for the prefetch cache.\n *\n * The same url intercepted and not intercepted are two different things to go\n * back to — a modal over the feed, and the post on its own page — so they\n * cannot share a key or restoring one returns the other.\n *\n * Shared because both halves compute it: the host stores under this key and\n * the client looks under it. Written out at each of the seven places that\n * needed it, they only had to disagree once, and the symptom is a navigation\n * that silently rebuilds a page it was holding.\n */\nexport function retentionKey(path: string, interceptSlot?: string | null): string {\n const normalised = normalisePath(path)\n\n return interceptSlot ? `__intercept:${interceptSlot}:${normalised}` : normalised\n}\n\n/**\n * The same page written two ways is one key.\n *\n * A static host serves /orders as a directory, so the browser's url ends in a\n * slash while the build wrote the page down as /orders. Left unequal, the\n * entry retained for a page is never the one looked up on the way back: it\n * stays in the document, hidden, while a second copy is fetched and rendered\n * beside it — so the form you were filling in is there, and not the one you\n * are looking at.\n */\nfunction normalisePath(path: string): string {\n // Absolute urls reach this from the initial page, which is identified by\n // href rather than by the path a link would use.\n const withoutOrigin = path.replace(/^[a-z][a-z0-9+.-]*:\\/\\/[^/]+/i, '')\n const [pathname, rest = ''] = splitQuery(withoutOrigin)\n\n return (pathname.replace(/\\/+$/, '') || '/') + rest\n}\n\nfunction splitQuery(url: string): [string, string] {\n const cut = url.search(/[?#]/)\n\n return cut === -1 ? [url, ''] : [url.slice(0, cut), url.slice(cut)]\n}\n"]}
|
package/dist/runtime.d.ts
CHANGED
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,wEAAwE;AACxE,+EAA+E;AAC/E,mEAAmE;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AA4B1C,oDAAoD;AACpD,MAAM,CAAC,MAAM,KAAK,GAAG,OAAQ,UAAgC,CAAC,GAAG,KAAK,WAAW,CAAA;AAEjF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAA;AAEjD,+EAA+E;AAC/E,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,MAAM,IAAI,GAAG,CAAC,OAAe,EAAQ,EAAE;QACrC,KAAK,MAAM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AA;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/C,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAA;AACvC,CAAC","sourcesContent":["// Runtime shim for the worker.\n//\n// The worker's only runtime-specific surface is the socket server, a yield to\n// the event loop, and a directory walk. Bun and Node both provide all three;\n// this presents them under one shape so worker.ts never branches.\n//\n// The write contract is Bun's: write() returns the number of bytes accepted, so\n// a partial write can be queued and retried on drain. Node never writes\n// partially — it queues internally — so the Node adapter always reports a full\n// write and the caller's pending-buffer path simply never engages.\n\nimport { createServer } from 'node:net'\nimport { readdirSync, statSync } from 'node:fs'\nimport { join, relative } from 'node:path'\n\nexport type SocketLike = {\n write(data: string | Uint8Array): number\n flush(): void\n /**\n * Hang up. Optional only because a caller may hold a stub; every real\n * transport has one, and a frame stream that cannot be parsed has to be\n * ended rather than resynchronised — see the invalid-length branch in\n * worker.ts for what resuming costs.\n */\n end?(): void\n}\n\nexport interface SocketHandlers {\n data(socket: SocketLike, data: Uint8Array): void | Promise<void>\n drain?(socket: SocketLike): void\n open?(socket: SocketLike): void\n close?(socket: SocketLike): void\n error?(socket: SocketLike, error: Error): void\n}\n\nexport interface ListenOptions {\n unix?: string\n hostname?: string\n port?: number\n}\n\n/** True when running under Bun rather than Node. */\nexport const isBun = typeof (globalThis as { Bun?: unknown }).Bun !== 'undefined'\n\nexport const runtimeName = isBun ? 'bun' : 'node'\n\n/** Yield to the event loop so queued socket writes flush before continuing. */\nexport function yieldToEventLoop(): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, 0))\n}\n\n/** Every .ts/.js file under dir, as paths relative to it. */\nexport function scanScripts(dir: string): string[] {\n const found: string[] = []\n\n const walk = (current: string): void => {\n for (const entry of readdirSync(current)) {\n const abs = join(current, entry)\n\n if (statSync(abs).isDirectory()) {\n walk(abs)\n } else if (/\\.(ts|js)$/.test(entry)) {\n found.push(relative(dir, abs))\n }\n }\n }\n\n walk(dir)\n\n return found\n}\n\nexport interface Server {\n stop(): void\n}\n\n/** Listen on a Unix socket or TCP address, dispatching to Bun-shaped handlers. */\nexport function listen(options: ListenOptions, handlers: SocketHandlers): Server {\n if (isBun) {\n const server = (globalThis as unknown as { Bun: { listen: (o: unknown) => { stop(): void } } }).Bun.listen({\n ...(options.unix ? { unix: options.unix } : { hostname: options.hostname, port: options.port }),\n socket: handlers,\n })\n\n return { stop: () => server.stop() }\n }\n\n return listenOnNode(options, handlers)\n}\n\nfunction listenOnNode(options: ListenOptions, handlers: SocketHandlers): Server {\n const server = createServer((connection) => {\n // One adapter per connection: the worker uses the socket object as a Map\n // key, so it has to be stable for the connection's lifetime.\n const socket: SocketLike = {\n write(data) {\n const buffer = typeof data === 'string' ? Buffer.from(data, 'utf-8') : Buffer.from(data)\n\n // Node buffers whatever the kernel would not take, so everything is\n // always accepted. The boolean it returns is a backpressure hint, not\n // a byte count.\n connection.write(buffer)\n\n return buffer.length\n },\n flush() {},\n end() {\n connection.end()\n },\n }\n\n connection.on('data', (chunk) => {\n // Always bytes: the socket is never given an encoding, so node hands\n // back a Buffer rather than a string.\n void handlers.data(socket, chunk as Uint8Array)\n })\n connection.on('drain', () => handlers.drain?.(socket))\n connection.on('close', () => handlers.close?.(socket))\n connection.on('error', (error) => handlers.error?.(socket, error))\n\n handlers.open?.(socket)\n })\n\n server.on('error', (error) => handlers.error?.(null as unknown as SocketLike, error))\n\n if (options.unix) {\n server.listen(options.unix)\n } else {\n server.listen(options.port, options.hostname)\n }\n\n return { stop: () => server.close() }\n}\n"]}
|
package/dist/safeUrl.d.ts
CHANGED
package/dist/safeUrl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safeUrl.js","sourceRoot":"","sources":["../src/safeUrl.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EA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QAC3E,oDAAoD;QACpD,OAAO,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,QAAQ,CAAA;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,IAAI,cAAc,CAAC,KAAK,CAAC;QAAE,OAAM;IAEjC,MAAM,IAAI,KAAK,CACb,kCAAkC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI;QAC/D,yEAAyE;QACzE,wEAAwE,CAC3E,CAAA;AACH,CAAC","sourcesContent":["// Whether a redirect destination is a url a browser should be sent to.\n//\n// A destination is routinely computed rather than written — redirect()'s own\n// documentation describes reading one from a cookie as the usual case — and it\n// reaches location.href, location.replace and an inline script. A scheme other\n// than http(s) in any of those is script execution rather than navigation.\n//\n// Parsed rather than pattern-matched. javascript: can be written with mixed\n// case, with a newline inside it, or behind leading control characters, and\n// each of those is a different regex to get wrong. The URL parser normalises\n// all of it already, so asking it for the protocol is shorter and correct.\n\n/** A base that cannot collide with a real origin, for resolving relative urls. */\nconst NOWHERE = 'https://rsc-kit.invalid/'\n\nexport function isSafeRedirect(value: string): boolean {\n try {\n const { protocol } = new URL(value, NOWHERE)\n\n // http and https only. Not data:, not blob:, not javascript:, and not a\n // custom app scheme — a browser handing one of those to another program is\n // not something a render should be able to trigger.\n return protocol === 'http:' || protocol === 'https:'\n } catch {\n return false\n }\n}\n\n/**\n * The same check, as a refusal.\n *\n * Says the value back, deliberately. A destination that fails this is far more\n * often a bug in what the app computed than an attack, and a message that does\n * not name the value leaves nothing to go on.\n */\nexport function assertSafeRedirect(value: string): void {\n if (isSafeRedirect(value)) return\n\n throw new Error(\n 'Not a url a redirect may go to: ' + JSON.stringify(value) + '. ' +\n 'A destination has to be a path or an http(s) url — any other scheme is ' +\n 'handed to the browser as something to run rather than somewhere to go.',\n )\n}\n"]}
|
package/dist/vite.d.ts
CHANGED