@rsc-kit/core 0.20.0 → 0.20.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/dist/bytecodeCheck.d.ts +15 -0
- package/dist/bytecodeCheck.js +65 -0
- package/dist/bytecodeCheck.js.map +1 -0
- package/dist/clientPackages.d.ts +25 -0
- package/dist/clientPackages.js +31 -0
- package/dist/clientPackages.js.map +1 -1
- package/dist/files.d.ts +9 -3
- package/dist/files.js +20 -10
- package/dist/files.js.map +1 -1
- package/dist/js/DefaultRouteError.js +7 -2
- package/dist/js/DefaultRouteError.js.map +1 -1
- package/dist/js/Link.js +8 -0
- package/dist/js/Link.js.map +1 -1
- package/dist/js/RedirectBoundary.d.ts +11 -1
- package/dist/js/RedirectBoundary.js +10 -1
- package/dist/js/RedirectBoundary.js.map +1 -1
- package/dist/js/SegmentBoundary.js +11 -4
- package/dist/js/SegmentBoundary.js.map +1 -1
- package/dist/js/navigate.js +22 -1
- package/dist/js/navigate.js.map +1 -1
- package/dist/metadata.d.ts +24 -0
- package/dist/metadata.js.map +1 -1
- package/dist/request.js +36 -8
- package/dist/request.js.map +1 -1
- package/dist/useSsr.js +10 -3
- package/dist/useSsr.js.map +1 -1
- package/dist/vite.js +136 -10
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectBoundary.js","sourceRoot":"","sources":["../../src/js/RedirectBoundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAqBb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"RedirectBoundary.js","sourceRoot":"","sources":["../../src/js/RedirectBoundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAqBb,OAAO,EAAE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AAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC;QAE/D,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["\"use client\";\n\n/**\n * Performs a redirect that was decided too late to be a status code.\n *\n * A redirect thrown above every Suspense boundary is answered by the host\n * before anything is written — the browser never sees this page, and this\n * component is never involved. One thrown inside a boundary arrives after the\n * shell, as an error carrying the destination in its digest, and this is what\n * turns that back into a navigation.\n *\n * An error boundary rather than a hook because that is the only thing React\n * offers for \"a child threw\": the throw happens in a server component whose\n * error is serialised into the payload, and it surfaces here when the client\n * renders it.\n *\n * Anything that is not a redirect is rethrown untouched, so an app's own error\n * boundaries still see the errors they exist for.\n */\n\nimport type { Route } from \"../routes.js\";\nimport { Component } from \"react\";\nimport type { ErrorInfo, ReactNode } from \"react\";\nimport { parseRedirectDigest } from \"../redirectDigest.js\";\nimport { visit } from \"./router\";\n\ninterface Props {\n children: ReactNode;\n /** Shown while the navigation is in flight. Null keeps the space empty. */\n fallback?: ReactNode;\n /**\n * Whether what this boundary wraps is the page on screen. A segment keeps\n * pages alive behind the active one, each under its own boundary, and a\n * redirect caught on a page that is not showing is not performed — it was\n * already performed when it was. Shown again, the boundary renders the\n * page afresh, and a refusal that still stands redirects again.\n */\n active?: boolean;\n}\n\ninterface State {\n redirecting: boolean;\n wasActive: boolean;\n}\n\nexport class RedirectBoundary extends Component<Props, State> {\n state: State = { redirecting: false, wasActive: this.props.active !== false };\n\n static getDerivedStateFromError(error: unknown): Partial<State> | null {\n // Reading `digest` rather than the message: React replaces a server\n // error's message in production and transmits the digest either way.\n return parseRedirectDigest((error as { digest?: unknown })?.digest)\n ? { redirecting: true }\n : null;\n }\n\n static getDerivedStateFromProps(props: Props, state: State): Partial<State> | null {\n const active = props.active !== false;\n\n if (active === state.wasActive) return null;\n\n // Revealed again: render the page, not the space left by its redirect.\n return { wasActive: active, redirecting: active ? false : state.redirecting };\n }\n\n componentDidCatch(error: unknown, _info: ErrorInfo): void {\n const target = parseRedirectDigest((error as { digest?: unknown })?.digest);\n\n if (!target) throw error;\n if (this.props.active === false) return;\n\n // An SPA navigation, not a location assignment: the layouts above this\n // boundary are already mounted and correct, so replacing the document\n // would throw away state the user can see — including whatever they had\n // typed into a page that is only being redirected past.\n //\n // replace, because the url being left never became a page the user was\n // on; leaving a history entry for it means Back returns to a redirect.\n // The server chose this, so it is not one of the app's authored hrefs.\n void visit(target.location as Route, { replace: true });\n }\n\n render(): ReactNode {\n if (this.state.redirecting) return this.props.fallback ?? null;\n\n return this.props.children;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* The point in the tree a navigation can replace on its own.
|
|
5
5
|
*
|
|
@@ -69,15 +69,22 @@ export function SegmentBoundary({ depth, pageKey, children, }) {
|
|
|
69
69
|
// Wrapped here rather than around the whole app because this is the closest
|
|
70
70
|
// client component above a page: a redirect thrown inside the page's own
|
|
71
71
|
// Suspense boundary surfaces at the nearest error boundary, and catching it
|
|
72
|
-
// here leaves the layouts above mounted while the navigation runs.
|
|
72
|
+
// here leaves the layouts above mounted while the navigation runs. One
|
|
73
|
+
// boundary per page, inside its Activity, not one around them all: a
|
|
74
|
+
// boundary that catches renders its fallback in place of everything it
|
|
75
|
+
// wraps, and one around them all unmounted every page being kept alive
|
|
76
|
+
// behind the one redirecting - the destination among them, when it was
|
|
77
|
+
// held - and then kept showing the fallback over the destination once it
|
|
78
|
+
// arrived. The port's report was a sidebar and a breadcrumb over an empty
|
|
79
|
+
// main.
|
|
73
80
|
// The same shape before and after the seed. The server's render and the
|
|
74
81
|
// first client render already place the children inside the retention
|
|
75
82
|
// wrapper, keyed by the page, so when the store takes over after hydration
|
|
76
83
|
// the tree changes state but not shape - and React keeps the DOM instead of
|
|
77
84
|
// remounting the page, which was blank, then content, on every load.
|
|
78
85
|
if (!state) {
|
|
79
|
-
return
|
|
86
|
+
return pageKey ? (_jsx(Activity, { mode: "visible", children: _jsx(RedirectBoundary, { children: children }) }, pageKey)) : (_jsx(RedirectBoundary, { children: children }));
|
|
80
87
|
}
|
|
81
|
-
return (_jsx(
|
|
88
|
+
return (_jsx(_Fragment, { children: state.entries.map((entry) => (_jsx(Activity, { mode: entry.key === state.activeKey ? "visible" : "hidden", children: _jsx(RedirectBoundary, { active: entry.key === state.activeKey, children: entry.tree }) }, entry.key))) }));
|
|
82
89
|
}
|
|
83
90
|
//# sourceMappingURL=SegmentBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentBoundary.js","sourceRoot":"","sources":["../../src/js/SegmentBoundary.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D,4EAA4E;AAC5E,yEAAyE;AACzE,uDAAuD;AACvD,MAAM,iBAAiB,GACpB,KAAwD,CAAC,iBAAiB;IAC1E,KAAiE;SAC/D,0BAA0B,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,UAAU,eAAe,CAAC,EAC9B,KAAK,EACL,OAAO,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vE,uEAAuE;IACvE,yEAAyE;IACzE,0EAA0E;IAC1E,QAAQ;IACR,wEAAwE;IACxE,sEAAsE;IACtE,2EAA2E;IAC3E,4EAA4E;IAC5E,qEAAqE;IACrE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,KAAC,QAAQ,IAAe,IAAI,EAAC,SAAS,YACpC,KAAC,gBAAgB,cAAE,QAAQ,GAAoB,IADlC,OAAO,CAEX,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,cAAE,QAAQ,GAAoB,CAChD,CAAC;IACJ,CAAC;IAED,OAAO,CACL,4BACG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,QAAQ,IAEP,IAAI,EAAE,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,YAE1D,KAAC,gBAAgB,IAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,SAAS,YACpD,KAAK,CAAC,IAAiB,GACP,IALd,KAAK,CAAC,GAAG,CAML,CACZ,CAAC,GACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\n/**\n * The point in the tree a navigation can replace on its own.\n *\n * Sits between a layout and its children, so showing a different segment\n * re-renders from here down and leaves the layouts above it mounted. Server\n * components cannot be re-rendered on the client, which is why the seam has to\n * be a client component reading from a store rather than the layout itself.\n *\n * Pages it has already shown stay mounted behind <Activity mode=\"hidden\">.\n * Hidden is not unmounted: effects are torn down but state survives, so\n * returning to a page brings back the form you were filling in. Rendering only\n * the current one would throw that away, which is what replacing the root did.\n */\n\nimport * as React from \"react\";\nimport { Activity, startTransition, useEffect, useState } from \"react\";\n\n/**\n * The transition type a navigation carries.\n *\n * The engine does not animate a navigation itself; React's own\n * <ViewTransition> does, wherever an app puts one. What the app cannot do\n * from outside is tell a navigation from the seed after hydration - the\n * boundary taking over its own server-rendered children, which animated\n * would be the page fading into itself on every load. So a navigation's\n * update carries this type, and the seed's does not: a boundary keyed on it,\n * `default={{ \"rsc-navigation\": \"page\", default: \"none\" }}`, animates\n * navigations and nothing else.\n *\n * An earlier shape wrapped the segment in a boundary of the engine's own,\n * behind a flag. React names every top-level element under a boundary and\n * morphs each from where it was to where it is, so the stylesheet pulled\n * them back into one root fade - and fought React over the root, which it\n * cancels when nothing outside a boundary changed: a captured root with a\n * hidden group, a dark viewport on the first navigation. One wrapper element\n * under the app's own boundary is one snapshot pair, which is the dissolve\n * wanted, with nothing to fight.\n */\nexport const NAVIGATION_TRANSITION_TYPE = \"rsc-navigation\";\n\n// Exported by React 19.3; `unstable_` before it. Read at call time from the\n// namespace rather than imported by name, so a React that lacks it still\n// loads this module and simply does not mark the type.\nconst addTransitionType: ((type: string) => void) | undefined =\n (React as { addTransitionType?: (type: string) => void }).addTransitionType ??\n (React as { unstable_addTransitionType?: (type: string) => void })\n .unstable_addTransitionType;\nimport type { ReactNode } from \"react\";\nimport { RedirectBoundary } from \"./RedirectBoundary\";\nimport {\n getSegmentState,\n navigatedOnce,\n seedSegment,\n subscribeToSegment,\n} from \"./segmentStore\";\n\nexport function SegmentBoundary({\n depth,\n pageKey,\n children,\n}: {\n depth: number;\n /** The page these server-rendered children belong to. */\n pageKey?: string;\n children: ReactNode;\n}) {\n // The store still addresses the boundary; the render reads React state, so\n // the update can be a transition. Initialised from the store on the client\n // and null on the server — exactly what getServerSnapshot did.\n const [state, setState] = useState<ReturnType<typeof getSegmentState>>(() =>\n typeof window === \"undefined\" ? null : getSegmentState(depth),\n );\n\n useEffect(\n () =>\n subscribeToSegment(depth, () => {\n startTransition(() => {\n // A navigation, not the seed: the seed is the page taking over\n // its own server-rendered children, and fading that is the page\n // fading into itself.\n if (navigatedOnce()) addTransitionType?.(NAVIGATION_TRANSITION_TYPE);\n\n setState(getSegmentState(depth));\n });\n }),\n [depth],\n );\n\n // Record the page we arrived on, so a later navigation away and back can\n // return to it. Without this the first page is the one page you cannot keep.\n useEffect(() => {\n if (pageKey) seedSegment(depth, pageKey, children);\n }, [depth, pageKey, children]);\n\n // Wrapped here rather than around the whole app because this is the closest\n // client component above a page: a redirect thrown inside the page's own\n // Suspense boundary surfaces at the nearest error boundary, and catching it\n // here leaves the layouts above mounted while the navigation runs. One\n // boundary per page, inside its Activity, not one around them all: a\n // boundary that catches renders its fallback in place of everything it\n // wraps, and one around them all unmounted every page being kept alive\n // behind the one redirecting - the destination among them, when it was\n // held - and then kept showing the fallback over the destination once it\n // arrived. The port's report was a sidebar and a breadcrumb over an empty\n // main.\n // The same shape before and after the seed. The server's render and the\n // first client render already place the children inside the retention\n // wrapper, keyed by the page, so when the store takes over after hydration\n // the tree changes state but not shape - and React keeps the DOM instead of\n // remounting the page, which was blank, then content, on every load.\n if (!state) {\n return pageKey ? (\n <Activity key={pageKey} mode=\"visible\">\n <RedirectBoundary>{children}</RedirectBoundary>\n </Activity>\n ) : (\n <RedirectBoundary>{children}</RedirectBoundary>\n );\n }\n\n return (\n <>\n {state.entries.map((entry) => (\n <Activity\n key={entry.key}\n mode={entry.key === state.activeKey ? \"visible\" : \"hidden\"}\n >\n <RedirectBoundary active={entry.key === state.activeKey}>\n {entry.tree as ReactNode}\n </RedirectBoundary>\n </Activity>\n ))}\n </>\n );\n}\n"]}
|
package/dist/js/navigate.js
CHANGED
|
@@ -614,6 +614,22 @@ export async function navigate(url, opts) {
|
|
|
614
614
|
throw error;
|
|
615
615
|
}
|
|
616
616
|
if (reused) {
|
|
617
|
+
if (controller.signal.aborted)
|
|
618
|
+
return;
|
|
619
|
+
// The prefetch this navigation took did not come back as a page. A
|
|
620
|
+
// redirect is followed as one on this request would be; a failure is
|
|
621
|
+
// asked again, from a cache that no longer holds the entry.
|
|
622
|
+
if (reused.redirectTo) {
|
|
623
|
+
await navigate(reused.redirectTo, {
|
|
624
|
+
replace: true,
|
|
625
|
+
redirectsFollowed: redirectsFollowed + 1,
|
|
626
|
+
});
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (reused.failed) {
|
|
630
|
+
await navigate(url, opts);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
617
633
|
segmentDepth = reused.segmentDepth;
|
|
618
634
|
nextLayouts = reused.layouts;
|
|
619
635
|
slotPayload = reused.slot;
|
|
@@ -852,6 +868,8 @@ function prefetchUrl(cacheKey, url, ttl, interceptSlot, refererUrl) {
|
|
|
852
868
|
layouts: null,
|
|
853
869
|
slot: null,
|
|
854
870
|
heldWhenFetched: chain.join(","),
|
|
871
|
+
redirectTo: null,
|
|
872
|
+
failed: false,
|
|
855
873
|
};
|
|
856
874
|
// Low priority: the browser then lets a real navigation overtake a queue of
|
|
857
875
|
// speculative requests instead of serving them in the order they were made.
|
|
@@ -864,7 +882,9 @@ function prefetchUrl(cacheKey, url, ttl, interceptSlot, refererUrl) {
|
|
|
864
882
|
// A prefetch that lands on a redirect is not cached. Following it would
|
|
865
883
|
// navigate on hover, and storing it would hand the click a 204 with no
|
|
866
884
|
// body to deserialize. The click re-requests and redirects properly.
|
|
867
|
-
|
|
885
|
+
const redirectTo = response.headers.get("X-RSC-Redirect");
|
|
886
|
+
if (redirectTo) {
|
|
887
|
+
entry.redirectTo = redirectTo;
|
|
868
888
|
cache.delete(cacheKey);
|
|
869
889
|
return null;
|
|
870
890
|
}
|
|
@@ -882,6 +902,7 @@ function prefetchUrl(cacheKey, url, ttl, interceptSlot, refererUrl) {
|
|
|
882
902
|
return deserializeResponse(response);
|
|
883
903
|
})
|
|
884
904
|
.catch(() => {
|
|
905
|
+
entry.failed = true;
|
|
885
906
|
cache.delete(cacheKey);
|
|
886
907
|
return null;
|
|
887
908
|
})
|
package/dist/js/navigate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/js/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAA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AC,CAAC;IACvB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Core SPA navigation engine for RSC.\n *\n * Uses module-level state (singleton in the browser bundle).\n * The Flight deserializer is injected by createViteRscApp to avoid\n * duplicate bundling of react-server-dom-webpack.\n */\n\nimport { isStaleAssetError } from \"./staleAssets\";\nimport { isSafeRedirect } from \"../safeUrl.js\";\nimport type { Route } from \"../routes.js\";\nimport { reportReachable } from \"./onlineStore\";\nimport { clearSlots, setSlot } from \"./slotStore\";\n// Shared with the host: it stores a page under this key and the client looks\n// under it, so the format cannot live in two places.\nimport {\n matchRoute,\n retentionKey as retentionKeyFor,\n sharedDepth,\n} from \"../routing\";\nimport type { ManifestRoute } from \"../manifest\";\n\ntype ReactNode = unknown;\ntype Deserializer = (\n stream: ReadableStream,\n options: Record<string, unknown>,\n) => Promise<ReactNode>;\ntype CallServerFn = (id: string, args: unknown[]) => Promise<unknown>;\n\ninterface CacheEntry {\n tree: Promise<ReactNode>;\n expiresAt: number;\n /**\n * What the server said about the payload. A prefetch is a real request, so\n * it comes back partial like any other — losing that and treating it as a\n * whole document replaces the root with a page that has no layouts.\n */\n segmentDepth: number;\n layouts: string[] | null;\n /**\n * The slot this payload fills, when it is one region rather than a segment.\n *\n * A prefetch is a real request and comes back as whatever the host answers.\n * An interception answers with the interceptor alone, and an entry that\n * forgets that is applied as a whole document — so a hovered modal link\n * renders the modal *as* the page, with nothing around it. Only after a\n * hover, which is why a scripted click never finds it.\n */\n slot: string | null;\n /**\n * The chain held when this was prefetched. A partial payload is only valid\n * against the chain it was rendered for; navigate somewhere else first and\n * it no longer composes.\n */\n heldWhenFetched: string;\n}\n\ninterface InterceptEntry {\n urlPattern: string;\n slot: string;\n}\n\nlet version = \"\";\nlet onNavigate:\n ((tree: ReactNode, key: string, segmentDepth: number) => void) | null = null;\nlet onRestore: ((key: string, maxAge?: number) => boolean) | null = null;\n\n/**\n * How stale a held page may be and still be revealed by a link.\n *\n * The back button ignores this: it names a moment, and the page from that\n * moment is the right answer however old. A link says \"go here\", so there is a\n * point past which answering with what you saw before is stale data presented\n * as fresh. Thirty seconds covers leaving a form to check something and coming\n * straight back, which is the case this exists for.\n */\nlet revealWithin = 30_000;\n\nexport function setRevealWindow(ms: number): void {\n revealWithin = ms;\n}\nlet flightDeserializer: Deserializer | null = null;\nlet callServerFn: CallServerFn | null = null;\nlet activeController: AbortController | null = null;\nconst cache = new Map<string, CacheEntry>();\n/** In-flight prefetches, so one the pointer moved away from can be dropped. */\nconst prefetchControllers = new Map<string, AbortController>();\nlet interceptManifest: InterceptEntry[] = [];\n\n// The layout chain currently mounted, outermost first. Sent so the server can\n// skip re-rendering the layouts still on screen.\nlet heldLayouts: string[] = [];\n\n/**\n * The boundary depth an interception was rendered at, while one is showing.\n *\n * An interceptor replaces a slot on the layout that declares it, so leaving the\n * intercepted view has to re-render that layout for the slot to go back to its\n * default. Left to itself the next navigation shares the whole chain, replaces\n * only the page below it, and the modal stays open over the new one.\n */\nlet interceptedAtDepth: number | null = null;\n\n/**\n * The url showing underneath an open interception.\n *\n * An interception puts something in a slot on a page that stays where it is,\n * so closing it is not a navigation at all — the page beneath was never\n * replaced. Remembering which url that is means going back to it costs\n * nothing, rather than fetching and rebuilding a page that is already on\n * screen with everything the user typed into it.\n */\nlet interceptedOver: string | null = null;\n\nconst DEFAULT_PREFETCH_TTL = 30_000;\n\n/**\n * How many prefetched payloads are kept. Entries carry a TTL but were only\n * dropped when read again, so a long session hovering its way through a big\n * nav held every payload it had ever fetched. On insert, anything expired\n * goes, and past the cap the oldest goes - insertion order is age.\n */\nconst MAX_CACHED = 50;\n\nfunction makeRoom(): void {\n const now = Date.now();\n\n for (const [key, entry] of cache) {\n if (entry.expiresAt <= now && !prefetchControllers.has(key))\n cache.delete(key);\n }\n\n while (cache.size >= MAX_CACHED) {\n const oldest = cache.keys().next().value as string | undefined;\n\n if (oldest === undefined) break;\n\n prefetchControllers.get(oldest)?.abort();\n prefetchControllers.delete(oldest);\n cache.delete(oldest);\n }\n}\n\n/**\n * Where a payload lives when there is no server to negotiate with.\n *\n * Normally the payload and the page share a url and are told apart by the\n * X-RSC header. A static host cannot vary by header — it serves one file per\n * url — so an exported build gives payloads their own addresses and the client\n * asks for those instead.\n */\nlet staticPayloadSuffix: string | null = null;\n\n/**\n * The route table, on a static host only.\n *\n * A server works out how much of the page to send by comparing the chain the\n * client sent with the route's own, and says so in a header. A file server\n * does neither — so on an exported site the client has to know the target's\n * layout chain before it asks, or every navigation takes the whole document\n * and replaces the root, which unmounts everything retained behind it.\n *\n * Inlined into the browser entry by the build, so it costs no request.\n */\nlet staticRoutes: ManifestRoute[] | null = null;\n\nexport function setStaticRoutes(routes: ManifestRoute[]): void {\n staticRoutes = routes;\n}\n\n/**\n * The layout chain of the page loaded from a file, since no header said.\n *\n * Without this the client believes it holds nothing, every navigation asks\n * for a whole document, and the depth variants sitting beside it are never\n * requested — the export looks correct and retention silently never happens.\n */\nexport function seedStaticChain(url: string): boolean {\n const segments = staticSegments(url);\n\n if (!segments) return false;\n\n heldLayouts = segments.chain;\n\n return true;\n}\n\n/**\n * The depth an exported payload should be asked for, and the chain it leaves\n * mounted — the two things a header would otherwise have carried.\n */\nfunction staticSegments(\n url: string,\n held: string[] = heldLayouts,\n): { depth: number; chain: string[] } | null {\n if (staticRoutes === null) return null;\n\n const path = new URL(url, window.location.origin).pathname;\n const match = matchRoute({ routes: staticRoutes } as never, path);\n\n if (!match) return null;\n\n return {\n // Against the chain the request is made with, never against whatever is\n // mounted by the time the answer arrives. A prefetch is fetched against\n // one chain and applied later, and reading live state here labels its\n // payload with a depth it was not rendered for.\n depth: sharedDepth(held.join(\",\"), match.route.layouts),\n // Copied: this is the build's table, and the caller assigns it to the\n // chain it holds — handing out the array itself makes the two the same\n // object.\n chain: [...match.route.layouts],\n };\n}\n\nexport function setStaticPayloads(suffix: string | null): void {\n staticPayloadSuffix = suffix;\n}\n\n/** The url to request a payload from, which is the page's own unless exported. */\nexport function payloadUrl(url: string, held: string[] = heldLayouts): string {\n if (staticPayloadSuffix === null) return url;\n\n const parsed = new URL(url, window.location.origin);\n const path = parsed.pathname.replace(/\\/+$/, \"\");\n const segments = staticSegments(url, held);\n\n // The variant for exactly the depth this client shares. Asking for the whole\n // document when a segment would do is not merely wasteful: it replaces the\n // root, and replacing the root throws away every page retained behind it.\n const name =\n segments && segments.depth > 0\n ? staticPayloadSuffix.replace(/^index\\./, `index.seg${segments.depth}.`)\n : staticPayloadSuffix;\n\n return `${path}/${name}${parsed.search}`;\n}\n\n/**\n * What a static payload was fetched as, recorded against its own response.\n *\n * The depth asked for and the depth applied have to be the same number. Worked\n * out separately at the two call sites they can disagree — and a payload\n * rendered whole but applied as a segment nests a boundary inside itself,\n * which does not error, it recurses until the renderer stops responding.\n */\nconst staticFetches = new WeakMap<\n Response,\n { depth: number; chain: string[] }\n>();\n\nexport function setVersion(v: string): void {\n version = v;\n}\n\n/**\n * The layout chain the client is holding.\n *\n * Seeded from the initial page's response and updated on every navigation, so\n * the next request can say what is already mounted.\n */\nexport function setHeldLayouts(chain: string[]): void {\n heldLayouts = chain;\n}\n\nexport function getHeldLayouts(): string[] {\n return heldLayouts;\n}\n\nexport function setNavigateHandler(\n fn: (tree: ReactNode, key: string, segmentDepth: number) => void,\n): void {\n onNavigate = fn;\n}\n\n/**\n * How the router reveals a page that is still mounted behind the current one.\n *\n * Returning true means the page was restored with its client state intact and\n * no request was made.\n */\nexport function setRestoreHandler(\n fn: (key: string, maxAge?: number) => boolean,\n): void {\n onRestore = fn;\n}\n\nexport function setDeserializer(fn: Deserializer): void {\n flightDeserializer = fn;\n}\n\nexport function setCallServer(fn: CallServerFn): void {\n callServerFn = fn;\n}\n\n/**\n * The urls a route.ts answers, so a link to one is treated as the anchor it\n * is: no prefetch - a hover must not run a route - and a full navigation\n * rather than a payload fetch, since the answer is a Response, not a page.\n * Baked into the generated browser entry from the route tree.\n */\nlet apiRoutePatterns: RegExp[] = [];\n\nexport function setApiRoutes(patterns: string[]): void {\n apiRoutePatterns = patterns.map(\n (pattern) =>\n new RegExp(\n \"^\" +\n pattern\n .split(\"/\")\n .map((part) =>\n part.startsWith(\"[...\") ? \".+\" : part.startsWith(\"[\") ? \"[^/]+\" : part.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"),\n )\n .join(\"/\") +\n \"/?$\",\n ),\n );\n}\n\n/** Whether a url is one a route.ts answers. */\nexport function isApiRoute(url: string): boolean {\n if (apiRoutePatterns.length === 0) return false;\n\n try {\n const { pathname } = new URL(url, window.location.origin);\n\n return apiRoutePatterns.some((pattern) => pattern.test(pathname));\n } catch {\n return false;\n }\n}\n\nexport function setInterceptManifest(entries: InterceptEntry[]): void {\n interceptManifest = entries;\n}\n\n/**\n * Check if a URL matches any intercept pattern.\n * Returns the matching slot name, or null if no match.\n */\nfunction matchIntercept(url: string): string | null {\n if (interceptManifest.length === 0) return null;\n\n let pathname: string;\n try {\n pathname = new URL(url, window.location.origin).pathname;\n } catch {\n pathname = url.split(\"?\")[0];\n }\n\n for (const entry of interceptManifest) {\n // urlPattern already has a leading slash (e.g. \"/docs/item/[id]\")\n const regex = new RegExp(\n \"^\" +\n entry.urlPattern\n .replace(/\\[\\.\\.\\.(\\w+)\\]/g, \"(.+)\")\n .replace(/\\[(\\w+)\\]/g, \"([^/]+)\") +\n \"$\",\n );\n\n if (regex.test(pathname)) {\n return entry.slot;\n }\n }\n\n return null;\n}\n\nexport function renderTree(tree: ReactNode): void {\n onNavigate?.(tree, retentionKey(window.location.href, null), 0);\n}\n\n/**\n * Identity of a page for retention purposes.\n *\n * Path and query only: a hash is a position within the same page, and an\n * intercepted route is a different rendering of the same URL, so it retains\n * separately from the full page.\n */\nexport function retentionKey(\n url: string,\n interceptSlot: string | null,\n): string {\n let path: string;\n\n try {\n const parsed = new URL(url, window.location.origin);\n path = parsed.pathname + parsed.search;\n } catch {\n path = url.split(\"#\")[0];\n }\n\n return retentionKeyFor(path, interceptSlot);\n}\n\nexport function getCallServer(): CallServerFn {\n if (!callServerFn) {\n throw new Error(\n \"callServer not initialized. Ensure createViteRscApp() has been called.\",\n );\n }\n return callServerFn;\n}\n\nfunction fetchRscPayload(\n url: string,\n signal?: AbortSignal,\n interceptSlot?: string,\n refererUrl?: string,\n chain: string[] = heldLayouts,\n // A prefetch is speculative and a navigation is not, but on the wire they\n // were identical — so a click could queue behind several prefetches the user\n // had already moved past. Over HTTP/1.1 a browser opens ~6 connections per\n // origin, which a sweep across a nav bar fills on its own.\n priority: \"high\" | \"low\" = \"high\",\n): Promise<Response> {\n const headers: Record<string, string> = {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n };\n\n if (chain.length) {\n headers[\"X-RSC-Segments\"] = chain.join(\",\");\n }\n\n if (interceptSlot) {\n headers[\"X-RSC-Intercept\"] = interceptSlot;\n }\n\n if (refererUrl) {\n headers[\"X-RSC-Referer\"] = refererUrl;\n }\n\n // `priority` is not in every lib.dom yet; browsers without it ignore it.\n const asked = staticSegments(url, chain);\n const request = fetch(payloadUrl(url, chain), {\n headers,\n signal,\n priority,\n } as RequestInit).catch((err: unknown) => {\n // Nothing answered at all. An abort is our own doing, not the network's —\n // leaving a link cancels its prefetch, and that must not read as offline.\n if (!(err instanceof DOMException && err.name === \"AbortError\")) {\n reportReachable(false);\n }\n\n throw err;\n });\n\n return request.then(async (response) => {\n // What this payload was asked for, so the apply side cannot work out a\n // different answer from state that has moved on since.\n if (asked) staticFetches.set(response, asked);\n\n // Something answered, whatever it said. A 500 is a reachable server.\n reportReachable(true);\n // Adopt the server's build version from the first response that carries\n // one. Until we know it we send an empty version, which the middleware\n // treats as \"no opinion\"; afterwards a redeploy mid-session answers 409.\n const served = response.headers.get(\"X-RSC-Version\");\n\n if (served && version === \"\") {\n version = served;\n }\n\n if (response.status === 409) {\n const location = response.headers.get(\"X-RSC-Location\");\n // Server-chosen, so checked again here: the engine refuses these at the\n // source, but a host in front of it can put anything on the header.\n window.location.href = isSafeRedirect(location ?? url)\n ? (location ?? url)\n : url;\n throw new Error(\"Version mismatch — full reload triggered\");\n }\n\n return response;\n });\n}\n\n/**\n * Deserialize a Flight response into a React tree.\n *\n * Client modules, CSS <link>s and <title>/<meta> all travel inside the Flight\n * payload — @vitejs/plugin-rsc emits stylesheet links as tree elements and\n * resolves client references through its own browser runtime, and React 19\n * hoists document metadata into <head>. Nothing needs injecting from headers.\n */\nfunction deserializeResponse(response: Response): Promise<ReactNode> {\n return flightDeserializer!(response.body!, {\n callServer:\n callServerFn ??\n (async () => {\n throw new Error(\"Server actions not initialized\");\n }),\n });\n}\n\nfunction isExternalUrl(url: string): boolean {\n try {\n return (\n new URL(url, window.location.origin).origin !== window.location.origin\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a cached payload can be used for a navigation claiming this chain.\n *\n * A partial payload only composes against the chain it was rendered for, so\n * the chain it was fetched against has to be the one the navigation is about\n * to claim — not whatever happens to be mounted.\n */\nfunction isUsable(cached: CacheEntry | undefined, chain: string[]): boolean {\n return (\n cached !== undefined &&\n cached.expiresAt > Date.now() &&\n cached.heldWhenFetched === chain.join(\",\")\n );\n}\n\n/**\n * Whether a navigation to this url would be served from the prefetch cache.\n *\n * Lets a caller decide whether showing an already-fetched page is free. A form\n * uses it to put its target route's shell on screen while the real query runs:\n * worth doing when the shell is in hand, never worth an extra request.\n */\nexport function isPrefetched(url: string): boolean {\n if (isExternalUrl(url)) return false;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n return isUsable(cache.get(cacheKey), claimedChain(interceptSlot));\n}\n\n/**\n * The layout chain a navigation to a url will claim.\n *\n * Leaving an interception claims fewer layouts than are held, which is what\n * forces the layout owning the slot to render again so the slot can empty.\n * Both sides have to agree on it: a prefetch recorded against a different\n * chain can never be used, so the close of every modal refetched a payload it\n * had already fetched.\n */\nfunction claimedChain(interceptSlot: string | null): string[] {\n return !interceptSlot && interceptedAtDepth !== null\n ? heldLayouts.slice(0, interceptedAtDepth)\n : heldLayouts;\n}\n\n/**\n * How many redirects a single navigation will follow before giving up.\n *\n * A page that redirects to itself is a mistake someone will make, and without\n * a ceiling it is an unbounded loop of requests rather than an error. The\n * browser's own limit for HTTP redirects is 20; this is smaller because these\n * are full renders, not header exchanges.\n */\nconst MAX_REDIRECTS = 8;\n\n/**\n * Go to a url, the way a Link does.\n *\n * `url` is typed to the routes the build found; cast with `as Route` when the\n * destination is computed rather than written.\n */\nexport async function navigate(\n url: Route,\n opts?: {\n replace?: boolean;\n preserveScroll?: boolean;\n restore?: boolean;\n /** Internal: how many redirects led here. */\n redirectsFollowed?: number;\n },\n): Promise<void> {\n const redirectsFollowed = opts?.redirectsFollowed ?? 0;\n\n if (redirectsFollowed > MAX_REDIRECTS) {\n throw new Error(\n `Too many redirects following a navigation (${MAX_REDIRECTS}); last was ${url}`,\n );\n }\n\n // External URLs can't be fetched (CORS) — go directly to full page navigation\n if (isExternalUrl(url)) {\n window.location.href = url;\n return;\n }\n\n // A route.ts answers with a Response, not a page: a download, a redirect\n // that decides where someone belongs, a sign-out. The browser goes there.\n if (isApiRoute(url)) {\n window.location.href = url;\n return;\n }\n\n // Hash-only URLs — let the browser handle scrolling natively\n if (url.startsWith(\"#\")) {\n window.location.hash = url;\n return;\n }\n\n // Abort any in-flight navigation\n activeController?.abort();\n\n // Not window.stop(). It used to be called here while the document was\n // still loading, to free a single-threaded server for the new request -\n // and it cancels every load the page has in flight: the client chunks a\n // just-decoded tree still needs, the stylesheet, the boundaries still\n // streaming. A navigation that left the page before the runtime had\n // finished arriving rendered a document with nothing in it. The server\n // has workers; the page keeps loading.\n\n const controller = new AbortController();\n activeController = controller;\n\n // Check if this URL matches an intercept pattern.\n // If so, send the intercept slot + current URL as referer so the server\n // renders the full tree with the interceptor in the right slot.\n const interceptSlot = matchIntercept(url);\n const currentUrl = interceptSlot\n ? window.location.pathname + window.location.search\n : undefined;\n\n const activityKey = retentionKey(url, interceptSlot);\n\n // A page still being held is revealed rather than refetched, whichever\n // gesture asked for it — the back button or a link. Both mean \"the page I\n // was just on\", and having the form you were filling in survive one and not\n // the other is a distinction nobody makes while using the app.\n //\n // The cost is honest: what comes back is the tree from when you left, so its\n // data is from then. Retention is four pages deep, so this reaches only\n // somewhere you were moments ago, and `revalidate()` is how a page says its\n // data has moved on.\n // Closing an interception. The page underneath was never replaced, so this\n // is a matter of emptying the slot — no request, and nothing rebuilt. The\n // form behind the modal is still the one the user was filling in.\n if (\n !interceptSlot &&\n interceptedOver !== null &&\n retentionKey(url, null) === retentionKey(interceptedOver, null)\n ) {\n clearSlots();\n interceptedOver = null;\n interceptedAtDepth = null;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // Not when the target is the page already showing: asking for this page\n // again means asking the server again, and revealing what is already there\n // would make refresh a no-op. Not while an interception is opening or\n // closing either — those rebuild the chain deliberately.\n const askingForThisPage =\n retentionKey(window.location.href, null) === retentionKey(url, null);\n //\n // And not while an interception is on screen. Leaving a modal has to\n // re-render the layout that owns the slot, because that is what empties it;\n // revealing the page underneath instead leaves the modal sitting over a page\n // whose url has already changed.\n const mayReveal =\n opts?.restore === true ||\n (!askingForThisPage &&\n !interceptSlot &&\n interceptedOver === null &&\n interceptedAtDepth === null);\n\n // Unbounded for the back button, bounded for a link.\n if (\n mayReveal &&\n onRestore?.(activityKey, opts?.restore ? undefined : revealWithin)\n ) {\n // A restored tree carries its own slot contents, so the flag only has to\n // reflect whether what is now showing is an intercepted view.\n if (!interceptSlot) interceptedAtDepth = null;\n\n // opts?.replace, not opts.replace: this branch used to be reachable only\n // with opts.restore set, so opts was always there. A link reaches it now\n // with nothing passed at all.\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // A prefetched payload was rendered against the chain held at prefetch time.\n let segmentDepth = 0;\n let nextLayouts: string[] | null = null;\n /** The slot this answer fills, when it is one region rather than a segment. */\n let slotPayload: string | null = null;\n /** The cache entry this navigation is using, whose metadata settles with it. */\n let reused: CacheEntry | null = null;\n const previousUrl = window.location.pathname + window.location.search;\n\n try {\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const cached = cache.get(cacheKey);\n let treePromise: Promise<ReactNode>;\n\n const chain = claimedChain(interceptSlot);\n\n // A partial payload only composes against the chain it was rendered for —\n // the one this navigation is about to claim, not whatever is mounted.\n // Hovering a link inside a modal prefetches it against the full chain, so\n // reusing that here would skip the layout holding the modal and leave it\n // open over the page behind it.\n const usable = isUsable(cached, chain);\n\n if (usable) {\n treePromise = cached!.tree;\n // Read after the tree resolves, not now. A prefetch fills these in when\n // its response lands, and a click can land first — hover a modal link\n // and click it quickly and the entry still says depth 0, so the\n // interceptor is applied as a whole document and the modal renders *as*\n // the page. The fields are set before the tree promise resolves, so\n // waiting for it is what makes them true.\n reused = cached!;\n cache.delete(cacheKey);\n } else {\n cache.delete(cacheKey);\n\n const response = await fetchRscPayload(\n url,\n controller.signal,\n interceptSlot ?? undefined,\n currentUrl,\n chain,\n );\n\n // The check is for a host that answered the page instead of the\n // payload, which is what a server does when it does not recognise the\n // header. An exported build asks a url that only ever holds a payload,\n // and a file server labels it by extension — commonly\n // application/octet-stream — so the check would reject every navigation\n // and send the browser on a full page load instead.\n // The render asked to go somewhere else, and said so before writing\n // anything — so this is still a navigation, not a page load. A redirect\n // decided later than that cannot travel here; it arrives in the payload\n // as an error digest and RedirectBoundary performs it.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n // replace: the url that redirected never became a page the user was\n // on, so Back must not return to it and redirect again.\n // Chosen by the server, not written here.\n await navigate(redirectTo as Route, {\n replace: true,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n const contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\n if (\n staticPayloadSuffix === null &&\n !contentType.includes(\"text/x-component\")\n ) {\n window.location.href = url;\n return;\n }\n\n // Headers on a server; worked out locally on a static host, where there\n // is nothing to send them.\n const served = staticFetches.get(response) ?? null;\n\n segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? served?.depth ?? 0,\n ) || 0;\n\n // Named region rather than a segment — see the apply below.\n slotPayload = response.headers.get(\"X-RSC-Revalidate\");\n\n const servedLayouts = response.headers.get(\"X-RSC-Layouts\");\n\n if (servedLayouts !== null) {\n nextLayouts = servedLayouts === \"\" ? [] : servedLayouts.split(\",\");\n } else if (served) {\n nextLayouts = served.chain;\n }\n\n treePromise = deserializeResponse(response);\n }\n\n let tree: ReactNode;\n\n try {\n tree = await treePromise;\n } catch (error) {\n // A navigation another one overtook: its request was aborted, and\n // the decoder reports that as a failure of the payload. It is not one\n // - nothing of it was going to be shown - so it ends here, quietly,\n // rather than as a rejection nobody is waiting on.\n if (controller.signal.aborted) return;\n\n throw error;\n }\n\n if (reused) {\n segmentDepth = reused.segmentDepth;\n nextLayouts = reused.layouts;\n slotPayload = reused.slot;\n }\n\n if (controller.signal.aborted) return;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n if (nextLayouts !== null) heldLayouts = nextLayouts;\n\n // The answer is one region, not a piece of the page: the host rendered\n // only the interceptor because the page underneath is already mounted and\n // still correct. Putting it in the slot leaves that page — and everything\n // typed into it — exactly as it was.\n if (slotPayload !== null) {\n setSlot(slotPayload, tree as ReactNode);\n interceptedOver = interceptedOver ?? previousUrl;\n interceptedAtDepth = null;\n\n return;\n }\n\n // A slot rendered for the page being left has no claim on the one being\n // arrived at.\n clearSlots();\n\n interceptedOver = null;\n interceptedAtDepth = interceptSlot ? segmentDepth : null;\n\n onNavigate?.(tree, activityKey, segmentDepth);\n\n if (!opts?.preserveScroll && !interceptSlot) {\n // Wait for React to commit the DOM update before scrolling.\n // Intercepted navigations preserve scroll (e.g. modal over current page).\n requestAnimationFrame(() => {\n window.scrollTo(0, 0);\n });\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n } catch (err) {\n if (err instanceof DOMException && err.name === \"AbortError\") return;\n\n // A chunk the deploy no longer serves: the browser would have loaded the\n // document, and the new names with it. Do what it would have done.\n if (isStaleAssetError(err)) {\n window.location.href = url;\n\n return;\n }\n\n // Without this a navigation that fails does nothing observable: the click\n // clears its own pending state and the page stays as it was, with no\n // error, no fallback and nothing for an app to react to. Dispatched before\n // rethrowing, so a programmatic caller still sees the failure.\n window.dispatchEvent(\n new CustomEvent(\"rsc-navigate-error\", { detail: { url, error: err } }),\n );\n\n throw err;\n } finally {\n if (activeController === controller) {\n activeController = null;\n }\n }\n}\n\n/**\n * Put something the server re-rendered on screen.\n *\n * The trees arrive with an action's answer rather than being fetched, so this\n * is the same apply path a navigation uses — without a request, a url change\n * or a history entry.\n */\nexport function applyRevalidated(target: string, tree: ReactNode): void {\n const url = window.location.pathname + window.location.search;\n const key = retentionKey(url, null);\n\n if (target === \"all\") {\n // Depth 0 replaces the root, which is what re-rendering the layouts means.\n onNavigate?.(tree, key, 0);\n\n return;\n }\n\n if (target === \"page\") {\n onNavigate?.(tree, key, heldLayouts.length);\n\n return;\n }\n\n setSlot(target, tree);\n}\n\n/**\n * Ask the server for part of this page again.\n *\n * refresh() the page, leaving the layouts mounted\n * refresh('all') the whole document, layouts included\n * refresh('orders') one parallel slot, by the name its directory gave it\n *\n * The same words an action uses, so a thing can be invalidated from either\n * side. This is the path for a refresh nobody mutated anything to earn — a\n * button, a poll, a message saying that table has moved; what an action\n * invalidated travels back inside the action's own answer instead.\n *\n * A slot is the only region smaller than a page the server can name, so two\n * tables refresh apart from each other only if they are two slots. The page\n * form leaves the layouts alone, which is what makes it cheap and also why a\n * count living in a layout will not move until you ask for 'all'.\n */\nexport async function refresh(target = \"page\"): Promise<void> {\n const url = window.location.pathname + window.location.search;\n\n if (target !== \"page\" && target !== \"all\") {\n const response = await fetch(payloadUrl(url), {\n headers: {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n \"X-RSC-Revalidate\": target,\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Could not revalidate ${target}: the server answered ${response.status}`,\n );\n }\n\n setSlot(target, await deserializeResponse(response));\n\n return;\n }\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n // Never from the cache: refreshing asks what the server says now, not what\n // it said a moment ago.\n cache.delete(cacheKey);\n\n if (target === \"all\") {\n heldLayouts = [];\n }\n\n // A refresh is not a navigation: the same page stays under the reader, so\n // where they were reading has to survive the tree being replaced.\n //\n // `preserveScroll` is not enough on its own. It stops navigate() scrolling\n // to the top deliberately, and says nothing about the scroll positions\n // *inside* the page. Refreshing everything replaces the root, so every\n // element that scrolls is a new node and starts at zero — a sidebar,\n // a code block, any pane with its own overflow. The window survives because\n // the document element is not the thing being replaced, which is why this\n // looks fine until a page has a second scroller in it.\n const positions = scrollPositions();\n\n await navigate(url as Route, { replace: true, preserveScroll: true });\n\n restoreScroll(positions);\n}\n\ninterface ScrollPosition {\n tag: string;\n top: number;\n left: number;\n}\n\n/** Every element that can scroll, whether or not it currently is. */\nfunction scrollables(): HTMLElement[] {\n return [...document.querySelectorAll<HTMLElement>(\"*\")].filter(\n (el) =>\n el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth,\n );\n}\n\n/**\n * Where everything on the page is scrolled to, in document order.\n *\n * Identified by position in the list rather than by a selector: a refresh\n * re-renders the same page, so the nth scrollable element is the same one, and\n * a selector would have to survive whatever classes the markup happens to use.\n * The tag is carried only to notice when that assumption has broken.\n *\n * Everything that *can* scroll, not everything that *is* scrolled — the two\n * lists have to be built the same way or they do not line up. Recording only\n * the scrolled ones and restoring over the scrollable ones puts a sidebar's\n * position onto whatever element happens to come first, which on any page long\n * enough to scroll is <html>.\n */\nfunction scrollPositions(): ScrollPosition[] {\n return [\n { tag: \"window\", top: window.scrollY, left: window.scrollX },\n ...scrollables().map((el) => ({\n tag: el.tagName,\n top: el.scrollTop,\n left: el.scrollLeft,\n })),\n ];\n}\n\n/**\n * Put the page back where it was, once React has finished replacing it.\n *\n * Applied over several ticks rather than once, because `root.render()`\n * schedules the update instead of performing it: a single pass writes the\n * position onto the nodes that are about to be thrown away, and the ones that\n * replace them start at zero. There is nothing to await — the navigation\n * resolves when the tree is handed to React, not when React has committed it.\n *\n * `setTimeout`, not `requestAnimationFrame`. A hidden tab never runs an\n * animation frame, so a refresh in a background tab — an HMR update, a poll —\n * would leave the scroll state wrong the moment it came back into view. It\n * also makes this untestable in an automated browser, where the tab under test\n * is usually not the visible one.\n */\nconst RESTORE_ATTEMPTS = 5;\n\nfunction restoreScroll(positions: ScrollPosition[]): void {\n const [win, ...inner] = positions;\n\n const apply = (attempt: number) => {\n if (window.scrollY !== win.top || window.scrollX !== win.left) {\n window.scrollTo(win.left, win.top);\n }\n\n const now = scrollables();\n\n for (let i = 0; i < inner.length && i < now.length; i++) {\n // A different element here means the page came back a different shape,\n // and guessing further would scroll something nobody touched.\n if (now[i].tagName !== inner[i].tag) break;\n\n if (inner[i].top !== 0 && now[i].scrollTop !== inner[i].top)\n now[i].scrollTop = inner[i].top;\n if (inner[i].left !== 0 && now[i].scrollLeft !== inner[i].left)\n now[i].scrollLeft = inner[i].left;\n }\n\n if (attempt < RESTORE_ATTEMPTS) setTimeout(() => apply(attempt + 1), 16);\n };\n\n apply(1);\n}\n\nexport function prefetch(url: string, cacheForMs?: number): void {\n // Never a route.ts: fetching one runs it, and a hover is not a click.\n if (isApiRoute(url)) return;\n\n if (isExternalUrl(url)) return;\n\n const ttl = cacheForMs ?? DEFAULT_PREFETCH_TTL;\n const interceptSlot = matchIntercept(url);\n\n if (interceptSlot) {\n // Intercepted route — only prefetch the intercepted variant\n const currentUrl = window.location.pathname + window.location.search;\n const cacheKey = retentionKeyFor(url, interceptSlot);\n prefetchUrl(cacheKey, url, ttl, interceptSlot, currentUrl);\n } else {\n prefetchUrl(url, url, ttl);\n }\n}\n\nfunction prefetchUrl(\n cacheKey: string,\n url: string,\n ttl: number,\n interceptSlot?: string,\n refererUrl?: string,\n): void {\n const chain = claimedChain(interceptSlot ?? null);\n const existing = cache.get(cacheKey);\n\n if (existing && existing.expiresAt > Date.now()) {\n return;\n }\n\n cache.delete(cacheKey);\n makeRoom();\n\n const controller = new AbortController();\n prefetchControllers.set(cacheKey, controller);\n\n const entry: CacheEntry = {\n tree: Promise.resolve(null),\n expiresAt: Date.now() + ttl,\n segmentDepth: 0,\n layouts: null,\n slot: null,\n heldWhenFetched: chain.join(\",\"),\n };\n\n // Low priority: the browser then lets a real navigation overtake a queue of\n // speculative requests instead of serving them in the order they were made.\n entry.tree = fetchRscPayload(\n url,\n controller.signal,\n interceptSlot,\n refererUrl,\n chain,\n \"low\",\n )\n .then((response) => {\n // On a static host there are no headers to read, and dropping the depth\n // is not a small loss: the entry then claims a segment is a whole\n // document, and rendering a layout-less page as the document root does\n // not warn — it hangs the renderer.\n // A prefetch that lands on a redirect is not cached. Following it would\n // navigate on hover, and storing it would hand the click a 204 with no\n // body to deserialize. The click re-requests and redirects properly.\n if (response.headers.get(\"X-RSC-Redirect\")) {\n cache.delete(cacheKey);\n\n return null;\n }\n\n entry.slot = response.headers.get(\"X-RSC-Revalidate\");\n\n const local = staticFetches.get(response) ?? null;\n\n entry.segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? local?.depth ?? 0,\n ) || 0;\n\n const served = response.headers.get(\"X-RSC-Layouts\");\n\n if (served !== null) {\n entry.layouts = served === \"\" ? [] : served.split(\",\");\n } else if (local) {\n entry.layouts = local.chain;\n }\n\n return deserializeResponse(response);\n })\n .catch(() => {\n cache.delete(cacheKey);\n return null;\n })\n .finally(() => {\n // Settled, so there is nothing left to abort. A completed prefetch stays\n // in the cache — only an in-flight one is ever dropped.\n if (prefetchControllers.get(cacheKey) === controller) {\n prefetchControllers.delete(cacheKey);\n }\n });\n\n cache.set(cacheKey, entry);\n}\n\n/**\n * Drop a prefetch that is still in flight — the pointer left the link.\n *\n * The cache entry goes synchronously rather than in the abort's catch: the\n * rejection lands a tick later, and a click in between would find an entry\n * whose tree resolves to null and navigate to a blank page. A prefetch that\n * has already completed is kept; there is no request left to cancel and the\n * payload is still good.\n */\nexport function cancelPrefetch(url: string): void {\n if (isExternalUrl(url)) return;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const controller = prefetchControllers.get(cacheKey);\n\n if (!controller) return;\n\n prefetchControllers.delete(cacheKey);\n cache.delete(cacheKey);\n controller.abort();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigate.js","sourceRoot":"","sources":["../../src/js/navigate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAClD,6EAA6E;AAC7E,qDAAqD;AACrD,OAAO,EACL,UAAU,EACV,YAAY,IAAI,eAAe,EAC/B,WAAW,GACZ,MAAM,YAAY,CAAC;AAyDpB,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,IAAI,UAAU,GAC4D,IAAI,CAAC;AAC/E,IAAI,SAAS,GAAuD,IAAI,CAAC;AAEzE;;;;;;;;GAQG;AACH,IAAI,YAAY,GAAG,MAAM,CAAC;AAE1B,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,YAAY,GAAG,EAAE,CAAC;AACpB,CAAC;AACD,IAAI,kBAAkB,GAAwB,IAAI,CAAC;AACnD,IAAI,YAAY,GAAwB,IAAI,CAAC;AAC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rB,CAAC","sourcesContent":["/**\n * Core SPA navigation engine for RSC.\n *\n * Uses module-level state (singleton in the browser bundle).\n * The Flight deserializer is injected by createViteRscApp to avoid\n * duplicate bundling of react-server-dom-webpack.\n */\n\nimport { isStaleAssetError } from \"./staleAssets\";\nimport { isSafeRedirect } from \"../safeUrl.js\";\nimport type { Route } from \"../routes.js\";\nimport { reportReachable } from \"./onlineStore\";\nimport { clearSlots, setSlot } from \"./slotStore\";\n// Shared with the host: it stores a page under this key and the client looks\n// under it, so the format cannot live in two places.\nimport {\n matchRoute,\n retentionKey as retentionKeyFor,\n sharedDepth,\n} from \"../routing\";\nimport type { ManifestRoute } from \"../manifest\";\n\ntype ReactNode = unknown;\ntype Deserializer = (\n stream: ReadableStream,\n options: Record<string, unknown>,\n) => Promise<ReactNode>;\ntype CallServerFn = (id: string, args: unknown[]) => Promise<unknown>;\n\ninterface CacheEntry {\n tree: Promise<ReactNode>;\n expiresAt: number;\n /**\n * What the server said about the payload. A prefetch is a real request, so\n * it comes back partial like any other — losing that and treating it as a\n * whole document replaces the root with a page that has no layouts.\n */\n segmentDepth: number;\n layouts: string[] | null;\n /**\n * The slot this payload fills, when it is one region rather than a segment.\n *\n * A prefetch is a real request and comes back as whatever the host answers.\n * An interception answers with the interceptor alone, and an entry that\n * forgets that is applied as a whole document — so a hovered modal link\n * renders the modal *as* the page, with nothing around it. Only after a\n * hover, which is why a scripted click never finds it.\n */\n slot: string | null;\n /**\n * The chain held when this was prefetched. A partial payload is only valid\n * against the chain it was rendered for; navigate somewhere else first and\n * it no longer composes.\n */\n heldWhenFetched: string;\n /**\n * Where the prefetch was sent instead, when the host answered a redirect.\n * The entry leaves the cache - a hover must not navigate - but a click\n * that took the entry while the request was in flight awaits its tree, and\n * a tree of null committed as the page was the whole document gone: url\n * changed, root unmounted, nothing in the console. On a phone the tap's\n * touchstart prefetches with no delay and the click lands 100-300 ms\n * later, the length of a round trip, so a tapped link to a guarded page\n * blanked the page about half the time. The navigation reads this and\n * follows it, the way it follows a redirect on its own request.\n */\n redirectTo: string | null;\n /** The request failed or was aborted; a navigation that took the entry asks again. */\n failed: boolean;\n}\n\ninterface InterceptEntry {\n urlPattern: string;\n slot: string;\n}\n\nlet version = \"\";\nlet onNavigate:\n ((tree: ReactNode, key: string, segmentDepth: number) => void) | null = null;\nlet onRestore: ((key: string, maxAge?: number) => boolean) | null = null;\n\n/**\n * How stale a held page may be and still be revealed by a link.\n *\n * The back button ignores this: it names a moment, and the page from that\n * moment is the right answer however old. A link says \"go here\", so there is a\n * point past which answering with what you saw before is stale data presented\n * as fresh. Thirty seconds covers leaving a form to check something and coming\n * straight back, which is the case this exists for.\n */\nlet revealWithin = 30_000;\n\nexport function setRevealWindow(ms: number): void {\n revealWithin = ms;\n}\nlet flightDeserializer: Deserializer | null = null;\nlet callServerFn: CallServerFn | null = null;\nlet activeController: AbortController | null = null;\nconst cache = new Map<string, CacheEntry>();\n/** In-flight prefetches, so one the pointer moved away from can be dropped. */\nconst prefetchControllers = new Map<string, AbortController>();\nlet interceptManifest: InterceptEntry[] = [];\n\n// The layout chain currently mounted, outermost first. Sent so the server can\n// skip re-rendering the layouts still on screen.\nlet heldLayouts: string[] = [];\n\n/**\n * The boundary depth an interception was rendered at, while one is showing.\n *\n * An interceptor replaces a slot on the layout that declares it, so leaving the\n * intercepted view has to re-render that layout for the slot to go back to its\n * default. Left to itself the next navigation shares the whole chain, replaces\n * only the page below it, and the modal stays open over the new one.\n */\nlet interceptedAtDepth: number | null = null;\n\n/**\n * The url showing underneath an open interception.\n *\n * An interception puts something in a slot on a page that stays where it is,\n * so closing it is not a navigation at all — the page beneath was never\n * replaced. Remembering which url that is means going back to it costs\n * nothing, rather than fetching and rebuilding a page that is already on\n * screen with everything the user typed into it.\n */\nlet interceptedOver: string | null = null;\n\nconst DEFAULT_PREFETCH_TTL = 30_000;\n\n/**\n * How many prefetched payloads are kept. Entries carry a TTL but were only\n * dropped when read again, so a long session hovering its way through a big\n * nav held every payload it had ever fetched. On insert, anything expired\n * goes, and past the cap the oldest goes - insertion order is age.\n */\nconst MAX_CACHED = 50;\n\nfunction makeRoom(): void {\n const now = Date.now();\n\n for (const [key, entry] of cache) {\n if (entry.expiresAt <= now && !prefetchControllers.has(key))\n cache.delete(key);\n }\n\n while (cache.size >= MAX_CACHED) {\n const oldest = cache.keys().next().value as string | undefined;\n\n if (oldest === undefined) break;\n\n prefetchControllers.get(oldest)?.abort();\n prefetchControllers.delete(oldest);\n cache.delete(oldest);\n }\n}\n\n/**\n * Where a payload lives when there is no server to negotiate with.\n *\n * Normally the payload and the page share a url and are told apart by the\n * X-RSC header. A static host cannot vary by header — it serves one file per\n * url — so an exported build gives payloads their own addresses and the client\n * asks for those instead.\n */\nlet staticPayloadSuffix: string | null = null;\n\n/**\n * The route table, on a static host only.\n *\n * A server works out how much of the page to send by comparing the chain the\n * client sent with the route's own, and says so in a header. A file server\n * does neither — so on an exported site the client has to know the target's\n * layout chain before it asks, or every navigation takes the whole document\n * and replaces the root, which unmounts everything retained behind it.\n *\n * Inlined into the browser entry by the build, so it costs no request.\n */\nlet staticRoutes: ManifestRoute[] | null = null;\n\nexport function setStaticRoutes(routes: ManifestRoute[]): void {\n staticRoutes = routes;\n}\n\n/**\n * The layout chain of the page loaded from a file, since no header said.\n *\n * Without this the client believes it holds nothing, every navigation asks\n * for a whole document, and the depth variants sitting beside it are never\n * requested — the export looks correct and retention silently never happens.\n */\nexport function seedStaticChain(url: string): boolean {\n const segments = staticSegments(url);\n\n if (!segments) return false;\n\n heldLayouts = segments.chain;\n\n return true;\n}\n\n/**\n * The depth an exported payload should be asked for, and the chain it leaves\n * mounted — the two things a header would otherwise have carried.\n */\nfunction staticSegments(\n url: string,\n held: string[] = heldLayouts,\n): { depth: number; chain: string[] } | null {\n if (staticRoutes === null) return null;\n\n const path = new URL(url, window.location.origin).pathname;\n const match = matchRoute({ routes: staticRoutes } as never, path);\n\n if (!match) return null;\n\n return {\n // Against the chain the request is made with, never against whatever is\n // mounted by the time the answer arrives. A prefetch is fetched against\n // one chain and applied later, and reading live state here labels its\n // payload with a depth it was not rendered for.\n depth: sharedDepth(held.join(\",\"), match.route.layouts),\n // Copied: this is the build's table, and the caller assigns it to the\n // chain it holds — handing out the array itself makes the two the same\n // object.\n chain: [...match.route.layouts],\n };\n}\n\nexport function setStaticPayloads(suffix: string | null): void {\n staticPayloadSuffix = suffix;\n}\n\n/** The url to request a payload from, which is the page's own unless exported. */\nexport function payloadUrl(url: string, held: string[] = heldLayouts): string {\n if (staticPayloadSuffix === null) return url;\n\n const parsed = new URL(url, window.location.origin);\n const path = parsed.pathname.replace(/\\/+$/, \"\");\n const segments = staticSegments(url, held);\n\n // The variant for exactly the depth this client shares. Asking for the whole\n // document when a segment would do is not merely wasteful: it replaces the\n // root, and replacing the root throws away every page retained behind it.\n const name =\n segments && segments.depth > 0\n ? staticPayloadSuffix.replace(/^index\\./, `index.seg${segments.depth}.`)\n : staticPayloadSuffix;\n\n return `${path}/${name}${parsed.search}`;\n}\n\n/**\n * What a static payload was fetched as, recorded against its own response.\n *\n * The depth asked for and the depth applied have to be the same number. Worked\n * out separately at the two call sites they can disagree — and a payload\n * rendered whole but applied as a segment nests a boundary inside itself,\n * which does not error, it recurses until the renderer stops responding.\n */\nconst staticFetches = new WeakMap<\n Response,\n { depth: number; chain: string[] }\n>();\n\nexport function setVersion(v: string): void {\n version = v;\n}\n\n/**\n * The layout chain the client is holding.\n *\n * Seeded from the initial page's response and updated on every navigation, so\n * the next request can say what is already mounted.\n */\nexport function setHeldLayouts(chain: string[]): void {\n heldLayouts = chain;\n}\n\nexport function getHeldLayouts(): string[] {\n return heldLayouts;\n}\n\nexport function setNavigateHandler(\n fn: (tree: ReactNode, key: string, segmentDepth: number) => void,\n): void {\n onNavigate = fn;\n}\n\n/**\n * How the router reveals a page that is still mounted behind the current one.\n *\n * Returning true means the page was restored with its client state intact and\n * no request was made.\n */\nexport function setRestoreHandler(\n fn: (key: string, maxAge?: number) => boolean,\n): void {\n onRestore = fn;\n}\n\nexport function setDeserializer(fn: Deserializer): void {\n flightDeserializer = fn;\n}\n\nexport function setCallServer(fn: CallServerFn): void {\n callServerFn = fn;\n}\n\n/**\n * The urls a route.ts answers, so a link to one is treated as the anchor it\n * is: no prefetch - a hover must not run a route - and a full navigation\n * rather than a payload fetch, since the answer is a Response, not a page.\n * Baked into the generated browser entry from the route tree.\n */\nlet apiRoutePatterns: RegExp[] = [];\n\nexport function setApiRoutes(patterns: string[]): void {\n apiRoutePatterns = patterns.map(\n (pattern) =>\n new RegExp(\n \"^\" +\n pattern\n .split(\"/\")\n .map((part) =>\n part.startsWith(\"[...\") ? \".+\" : part.startsWith(\"[\") ? \"[^/]+\" : part.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\"),\n )\n .join(\"/\") +\n \"/?$\",\n ),\n );\n}\n\n/** Whether a url is one a route.ts answers. */\nexport function isApiRoute(url: string): boolean {\n if (apiRoutePatterns.length === 0) return false;\n\n try {\n const { pathname } = new URL(url, window.location.origin);\n\n return apiRoutePatterns.some((pattern) => pattern.test(pathname));\n } catch {\n return false;\n }\n}\n\nexport function setInterceptManifest(entries: InterceptEntry[]): void {\n interceptManifest = entries;\n}\n\n/**\n * Check if a URL matches any intercept pattern.\n * Returns the matching slot name, or null if no match.\n */\nfunction matchIntercept(url: string): string | null {\n if (interceptManifest.length === 0) return null;\n\n let pathname: string;\n try {\n pathname = new URL(url, window.location.origin).pathname;\n } catch {\n pathname = url.split(\"?\")[0];\n }\n\n for (const entry of interceptManifest) {\n // urlPattern already has a leading slash (e.g. \"/docs/item/[id]\")\n const regex = new RegExp(\n \"^\" +\n entry.urlPattern\n .replace(/\\[\\.\\.\\.(\\w+)\\]/g, \"(.+)\")\n .replace(/\\[(\\w+)\\]/g, \"([^/]+)\") +\n \"$\",\n );\n\n if (regex.test(pathname)) {\n return entry.slot;\n }\n }\n\n return null;\n}\n\nexport function renderTree(tree: ReactNode): void {\n onNavigate?.(tree, retentionKey(window.location.href, null), 0);\n}\n\n/**\n * Identity of a page for retention purposes.\n *\n * Path and query only: a hash is a position within the same page, and an\n * intercepted route is a different rendering of the same URL, so it retains\n * separately from the full page.\n */\nexport function retentionKey(\n url: string,\n interceptSlot: string | null,\n): string {\n let path: string;\n\n try {\n const parsed = new URL(url, window.location.origin);\n path = parsed.pathname + parsed.search;\n } catch {\n path = url.split(\"#\")[0];\n }\n\n return retentionKeyFor(path, interceptSlot);\n}\n\nexport function getCallServer(): CallServerFn {\n if (!callServerFn) {\n throw new Error(\n \"callServer not initialized. Ensure createViteRscApp() has been called.\",\n );\n }\n return callServerFn;\n}\n\nfunction fetchRscPayload(\n url: string,\n signal?: AbortSignal,\n interceptSlot?: string,\n refererUrl?: string,\n chain: string[] = heldLayouts,\n // A prefetch is speculative and a navigation is not, but on the wire they\n // were identical — so a click could queue behind several prefetches the user\n // had already moved past. Over HTTP/1.1 a browser opens ~6 connections per\n // origin, which a sweep across a nav bar fills on its own.\n priority: \"high\" | \"low\" = \"high\",\n): Promise<Response> {\n const headers: Record<string, string> = {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n };\n\n if (chain.length) {\n headers[\"X-RSC-Segments\"] = chain.join(\",\");\n }\n\n if (interceptSlot) {\n headers[\"X-RSC-Intercept\"] = interceptSlot;\n }\n\n if (refererUrl) {\n headers[\"X-RSC-Referer\"] = refererUrl;\n }\n\n // `priority` is not in every lib.dom yet; browsers without it ignore it.\n const asked = staticSegments(url, chain);\n const request = fetch(payloadUrl(url, chain), {\n headers,\n signal,\n priority,\n } as RequestInit).catch((err: unknown) => {\n // Nothing answered at all. An abort is our own doing, not the network's —\n // leaving a link cancels its prefetch, and that must not read as offline.\n if (!(err instanceof DOMException && err.name === \"AbortError\")) {\n reportReachable(false);\n }\n\n throw err;\n });\n\n return request.then(async (response) => {\n // What this payload was asked for, so the apply side cannot work out a\n // different answer from state that has moved on since.\n if (asked) staticFetches.set(response, asked);\n\n // Something answered, whatever it said. A 500 is a reachable server.\n reportReachable(true);\n // Adopt the server's build version from the first response that carries\n // one. Until we know it we send an empty version, which the middleware\n // treats as \"no opinion\"; afterwards a redeploy mid-session answers 409.\n const served = response.headers.get(\"X-RSC-Version\");\n\n if (served && version === \"\") {\n version = served;\n }\n\n if (response.status === 409) {\n const location = response.headers.get(\"X-RSC-Location\");\n // Server-chosen, so checked again here: the engine refuses these at the\n // source, but a host in front of it can put anything on the header.\n window.location.href = isSafeRedirect(location ?? url)\n ? (location ?? url)\n : url;\n throw new Error(\"Version mismatch — full reload triggered\");\n }\n\n return response;\n });\n}\n\n/**\n * Deserialize a Flight response into a React tree.\n *\n * Client modules, CSS <link>s and <title>/<meta> all travel inside the Flight\n * payload — @vitejs/plugin-rsc emits stylesheet links as tree elements and\n * resolves client references through its own browser runtime, and React 19\n * hoists document metadata into <head>. Nothing needs injecting from headers.\n */\nfunction deserializeResponse(response: Response): Promise<ReactNode> {\n return flightDeserializer!(response.body!, {\n callServer:\n callServerFn ??\n (async () => {\n throw new Error(\"Server actions not initialized\");\n }),\n });\n}\n\nfunction isExternalUrl(url: string): boolean {\n try {\n return (\n new URL(url, window.location.origin).origin !== window.location.origin\n );\n } catch {\n return false;\n }\n}\n\n/**\n * Whether a cached payload can be used for a navigation claiming this chain.\n *\n * A partial payload only composes against the chain it was rendered for, so\n * the chain it was fetched against has to be the one the navigation is about\n * to claim — not whatever happens to be mounted.\n */\nfunction isUsable(cached: CacheEntry | undefined, chain: string[]): boolean {\n return (\n cached !== undefined &&\n cached.expiresAt > Date.now() &&\n cached.heldWhenFetched === chain.join(\",\")\n );\n}\n\n/**\n * Whether a navigation to this url would be served from the prefetch cache.\n *\n * Lets a caller decide whether showing an already-fetched page is free. A form\n * uses it to put its target route's shell on screen while the real query runs:\n * worth doing when the shell is in hand, never worth an extra request.\n */\nexport function isPrefetched(url: string): boolean {\n if (isExternalUrl(url)) return false;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n return isUsable(cache.get(cacheKey), claimedChain(interceptSlot));\n}\n\n/**\n * The layout chain a navigation to a url will claim.\n *\n * Leaving an interception claims fewer layouts than are held, which is what\n * forces the layout owning the slot to render again so the slot can empty.\n * Both sides have to agree on it: a prefetch recorded against a different\n * chain can never be used, so the close of every modal refetched a payload it\n * had already fetched.\n */\nfunction claimedChain(interceptSlot: string | null): string[] {\n return !interceptSlot && interceptedAtDepth !== null\n ? heldLayouts.slice(0, interceptedAtDepth)\n : heldLayouts;\n}\n\n/**\n * How many redirects a single navigation will follow before giving up.\n *\n * A page that redirects to itself is a mistake someone will make, and without\n * a ceiling it is an unbounded loop of requests rather than an error. The\n * browser's own limit for HTTP redirects is 20; this is smaller because these\n * are full renders, not header exchanges.\n */\nconst MAX_REDIRECTS = 8;\n\n/**\n * Go to a url, the way a Link does.\n *\n * `url` is typed to the routes the build found; cast with `as Route` when the\n * destination is computed rather than written.\n */\nexport async function navigate(\n url: Route,\n opts?: {\n replace?: boolean;\n preserveScroll?: boolean;\n restore?: boolean;\n /** Internal: how many redirects led here. */\n redirectsFollowed?: number;\n },\n): Promise<void> {\n const redirectsFollowed = opts?.redirectsFollowed ?? 0;\n\n if (redirectsFollowed > MAX_REDIRECTS) {\n throw new Error(\n `Too many redirects following a navigation (${MAX_REDIRECTS}); last was ${url}`,\n );\n }\n\n // External URLs can't be fetched (CORS) — go directly to full page navigation\n if (isExternalUrl(url)) {\n window.location.href = url;\n return;\n }\n\n // A route.ts answers with a Response, not a page: a download, a redirect\n // that decides where someone belongs, a sign-out. The browser goes there.\n if (isApiRoute(url)) {\n window.location.href = url;\n return;\n }\n\n // Hash-only URLs — let the browser handle scrolling natively\n if (url.startsWith(\"#\")) {\n window.location.hash = url;\n return;\n }\n\n // Abort any in-flight navigation\n activeController?.abort();\n\n // Not window.stop(). It used to be called here while the document was\n // still loading, to free a single-threaded server for the new request -\n // and it cancels every load the page has in flight: the client chunks a\n // just-decoded tree still needs, the stylesheet, the boundaries still\n // streaming. A navigation that left the page before the runtime had\n // finished arriving rendered a document with nothing in it. The server\n // has workers; the page keeps loading.\n\n const controller = new AbortController();\n activeController = controller;\n\n // Check if this URL matches an intercept pattern.\n // If so, send the intercept slot + current URL as referer so the server\n // renders the full tree with the interceptor in the right slot.\n const interceptSlot = matchIntercept(url);\n const currentUrl = interceptSlot\n ? window.location.pathname + window.location.search\n : undefined;\n\n const activityKey = retentionKey(url, interceptSlot);\n\n // A page still being held is revealed rather than refetched, whichever\n // gesture asked for it — the back button or a link. Both mean \"the page I\n // was just on\", and having the form you were filling in survive one and not\n // the other is a distinction nobody makes while using the app.\n //\n // The cost is honest: what comes back is the tree from when you left, so its\n // data is from then. Retention is four pages deep, so this reaches only\n // somewhere you were moments ago, and `revalidate()` is how a page says its\n // data has moved on.\n // Closing an interception. The page underneath was never replaced, so this\n // is a matter of emptying the slot — no request, and nothing rebuilt. The\n // form behind the modal is still the one the user was filling in.\n if (\n !interceptSlot &&\n interceptedOver !== null &&\n retentionKey(url, null) === retentionKey(interceptedOver, null)\n ) {\n clearSlots();\n interceptedOver = null;\n interceptedAtDepth = null;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // Not when the target is the page already showing: asking for this page\n // again means asking the server again, and revealing what is already there\n // would make refresh a no-op. Not while an interception is opening or\n // closing either — those rebuild the chain deliberately.\n const askingForThisPage =\n retentionKey(window.location.href, null) === retentionKey(url, null);\n //\n // And not while an interception is on screen. Leaving a modal has to\n // re-render the layout that owns the slot, because that is what empties it;\n // revealing the page underneath instead leaves the modal sitting over a page\n // whose url has already changed.\n const mayReveal =\n opts?.restore === true ||\n (!askingForThisPage &&\n !interceptSlot &&\n interceptedOver === null &&\n interceptedAtDepth === null);\n\n // Unbounded for the back button, bounded for a link.\n if (\n mayReveal &&\n onRestore?.(activityKey, opts?.restore ? undefined : revealWithin)\n ) {\n // A restored tree carries its own slot contents, so the flag only has to\n // reflect whether what is now showing is an intercepted view.\n if (!interceptSlot) interceptedAtDepth = null;\n\n // opts?.replace, not opts.replace: this branch used to be reachable only\n // with opts.restore set, so opts was always there. A link reaches it now\n // with nothing passed at all.\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n\n return;\n }\n\n // A prefetched payload was rendered against the chain held at prefetch time.\n let segmentDepth = 0;\n let nextLayouts: string[] | null = null;\n /** The slot this answer fills, when it is one region rather than a segment. */\n let slotPayload: string | null = null;\n /** The cache entry this navigation is using, whose metadata settles with it. */\n let reused: CacheEntry | null = null;\n const previousUrl = window.location.pathname + window.location.search;\n\n try {\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const cached = cache.get(cacheKey);\n let treePromise: Promise<ReactNode>;\n\n const chain = claimedChain(interceptSlot);\n\n // A partial payload only composes against the chain it was rendered for —\n // the one this navigation is about to claim, not whatever is mounted.\n // Hovering a link inside a modal prefetches it against the full chain, so\n // reusing that here would skip the layout holding the modal and leave it\n // open over the page behind it.\n const usable = isUsable(cached, chain);\n\n if (usable) {\n treePromise = cached!.tree;\n // Read after the tree resolves, not now. A prefetch fills these in when\n // its response lands, and a click can land first — hover a modal link\n // and click it quickly and the entry still says depth 0, so the\n // interceptor is applied as a whole document and the modal renders *as*\n // the page. The fields are set before the tree promise resolves, so\n // waiting for it is what makes them true.\n reused = cached!;\n cache.delete(cacheKey);\n } else {\n cache.delete(cacheKey);\n\n const response = await fetchRscPayload(\n url,\n controller.signal,\n interceptSlot ?? undefined,\n currentUrl,\n chain,\n );\n\n // The check is for a host that answered the page instead of the\n // payload, which is what a server does when it does not recognise the\n // header. An exported build asks a url that only ever holds a payload,\n // and a file server labels it by extension — commonly\n // application/octet-stream — so the check would reject every navigation\n // and send the browser on a full page load instead.\n // The render asked to go somewhere else, and said so before writing\n // anything — so this is still a navigation, not a page load. A redirect\n // decided later than that cannot travel here; it arrives in the payload\n // as an error digest and RedirectBoundary performs it.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n // replace: the url that redirected never became a page the user was\n // on, so Back must not return to it and redirect again.\n // Chosen by the server, not written here.\n await navigate(redirectTo as Route, {\n replace: true,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n const contentType = response.headers.get(\"Content-Type\") ?? \"\";\n\n if (\n staticPayloadSuffix === null &&\n !contentType.includes(\"text/x-component\")\n ) {\n window.location.href = url;\n return;\n }\n\n // Headers on a server; worked out locally on a static host, where there\n // is nothing to send them.\n const served = staticFetches.get(response) ?? null;\n\n segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? served?.depth ?? 0,\n ) || 0;\n\n // Named region rather than a segment — see the apply below.\n slotPayload = response.headers.get(\"X-RSC-Revalidate\");\n\n const servedLayouts = response.headers.get(\"X-RSC-Layouts\");\n\n if (servedLayouts !== null) {\n nextLayouts = servedLayouts === \"\" ? [] : servedLayouts.split(\",\");\n } else if (served) {\n nextLayouts = served.chain;\n }\n\n treePromise = deserializeResponse(response);\n }\n\n let tree: ReactNode;\n\n try {\n tree = await treePromise;\n } catch (error) {\n // A navigation another one overtook: its request was aborted, and\n // the decoder reports that as a failure of the payload. It is not one\n // - nothing of it was going to be shown - so it ends here, quietly,\n // rather than as a rejection nobody is waiting on.\n if (controller.signal.aborted) return;\n\n throw error;\n }\n\n if (reused) {\n if (controller.signal.aborted) return;\n\n // The prefetch this navigation took did not come back as a page. A\n // redirect is followed as one on this request would be; a failure is\n // asked again, from a cache that no longer holds the entry.\n if (reused.redirectTo) {\n await navigate(reused.redirectTo as Route, {\n replace: true,\n redirectsFollowed: redirectsFollowed + 1,\n });\n\n return;\n }\n\n if (reused.failed) {\n await navigate(url, opts);\n\n return;\n }\n\n segmentDepth = reused.segmentDepth;\n nextLayouts = reused.layouts;\n slotPayload = reused.slot;\n }\n\n if (controller.signal.aborted) return;\n\n if (opts?.replace) {\n history.replaceState({ rscUrl: url }, \"\", url);\n } else {\n history.pushState({ rscUrl: url }, \"\", url);\n }\n\n if (nextLayouts !== null) heldLayouts = nextLayouts;\n\n // The answer is one region, not a piece of the page: the host rendered\n // only the interceptor because the page underneath is already mounted and\n // still correct. Putting it in the slot leaves that page — and everything\n // typed into it — exactly as it was.\n if (slotPayload !== null) {\n setSlot(slotPayload, tree as ReactNode);\n interceptedOver = interceptedOver ?? previousUrl;\n interceptedAtDepth = null;\n\n return;\n }\n\n // A slot rendered for the page being left has no claim on the one being\n // arrived at.\n clearSlots();\n\n interceptedOver = null;\n interceptedAtDepth = interceptSlot ? segmentDepth : null;\n\n onNavigate?.(tree, activityKey, segmentDepth);\n\n if (!opts?.preserveScroll && !interceptSlot) {\n // Wait for React to commit the DOM update before scrolling.\n // Intercepted navigations preserve scroll (e.g. modal over current page).\n requestAnimationFrame(() => {\n window.scrollTo(0, 0);\n });\n }\n\n window.dispatchEvent(new CustomEvent(\"rsc-navigate\", { detail: url }));\n } catch (err) {\n if (err instanceof DOMException && err.name === \"AbortError\") return;\n\n // A chunk the deploy no longer serves: the browser would have loaded the\n // document, and the new names with it. Do what it would have done.\n if (isStaleAssetError(err)) {\n window.location.href = url;\n\n return;\n }\n\n // Without this a navigation that fails does nothing observable: the click\n // clears its own pending state and the page stays as it was, with no\n // error, no fallback and nothing for an app to react to. Dispatched before\n // rethrowing, so a programmatic caller still sees the failure.\n window.dispatchEvent(\n new CustomEvent(\"rsc-navigate-error\", { detail: { url, error: err } }),\n );\n\n throw err;\n } finally {\n if (activeController === controller) {\n activeController = null;\n }\n }\n}\n\n/**\n * Put something the server re-rendered on screen.\n *\n * The trees arrive with an action's answer rather than being fetched, so this\n * is the same apply path a navigation uses — without a request, a url change\n * or a history entry.\n */\nexport function applyRevalidated(target: string, tree: ReactNode): void {\n const url = window.location.pathname + window.location.search;\n const key = retentionKey(url, null);\n\n if (target === \"all\") {\n // Depth 0 replaces the root, which is what re-rendering the layouts means.\n onNavigate?.(tree, key, 0);\n\n return;\n }\n\n if (target === \"page\") {\n onNavigate?.(tree, key, heldLayouts.length);\n\n return;\n }\n\n setSlot(target, tree);\n}\n\n/**\n * Ask the server for part of this page again.\n *\n * refresh() the page, leaving the layouts mounted\n * refresh('all') the whole document, layouts included\n * refresh('orders') one parallel slot, by the name its directory gave it\n *\n * The same words an action uses, so a thing can be invalidated from either\n * side. This is the path for a refresh nobody mutated anything to earn — a\n * button, a poll, a message saying that table has moved; what an action\n * invalidated travels back inside the action's own answer instead.\n *\n * A slot is the only region smaller than a page the server can name, so two\n * tables refresh apart from each other only if they are two slots. The page\n * form leaves the layouts alone, which is what makes it cheap and also why a\n * count living in a layout will not move until you ask for 'all'.\n */\nexport async function refresh(target = \"page\"): Promise<void> {\n const url = window.location.pathname + window.location.search;\n\n if (target !== \"page\" && target !== \"all\") {\n const response = await fetch(payloadUrl(url), {\n headers: {\n \"X-RSC\": \"true\",\n \"X-RSC-Version\": version,\n \"X-RSC-Revalidate\": target,\n },\n });\n\n if (!response.ok) {\n throw new Error(\n `Could not revalidate ${target}: the server answered ${response.status}`,\n );\n }\n\n setSlot(target, await deserializeResponse(response));\n\n return;\n }\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n\n // Never from the cache: refreshing asks what the server says now, not what\n // it said a moment ago.\n cache.delete(cacheKey);\n\n if (target === \"all\") {\n heldLayouts = [];\n }\n\n // A refresh is not a navigation: the same page stays under the reader, so\n // where they were reading has to survive the tree being replaced.\n //\n // `preserveScroll` is not enough on its own. It stops navigate() scrolling\n // to the top deliberately, and says nothing about the scroll positions\n // *inside* the page. Refreshing everything replaces the root, so every\n // element that scrolls is a new node and starts at zero — a sidebar,\n // a code block, any pane with its own overflow. The window survives because\n // the document element is not the thing being replaced, which is why this\n // looks fine until a page has a second scroller in it.\n const positions = scrollPositions();\n\n await navigate(url as Route, { replace: true, preserveScroll: true });\n\n restoreScroll(positions);\n}\n\ninterface ScrollPosition {\n tag: string;\n top: number;\n left: number;\n}\n\n/** Every element that can scroll, whether or not it currently is. */\nfunction scrollables(): HTMLElement[] {\n return [...document.querySelectorAll<HTMLElement>(\"*\")].filter(\n (el) =>\n el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth,\n );\n}\n\n/**\n * Where everything on the page is scrolled to, in document order.\n *\n * Identified by position in the list rather than by a selector: a refresh\n * re-renders the same page, so the nth scrollable element is the same one, and\n * a selector would have to survive whatever classes the markup happens to use.\n * The tag is carried only to notice when that assumption has broken.\n *\n * Everything that *can* scroll, not everything that *is* scrolled — the two\n * lists have to be built the same way or they do not line up. Recording only\n * the scrolled ones and restoring over the scrollable ones puts a sidebar's\n * position onto whatever element happens to come first, which on any page long\n * enough to scroll is <html>.\n */\nfunction scrollPositions(): ScrollPosition[] {\n return [\n { tag: \"window\", top: window.scrollY, left: window.scrollX },\n ...scrollables().map((el) => ({\n tag: el.tagName,\n top: el.scrollTop,\n left: el.scrollLeft,\n })),\n ];\n}\n\n/**\n * Put the page back where it was, once React has finished replacing it.\n *\n * Applied over several ticks rather than once, because `root.render()`\n * schedules the update instead of performing it: a single pass writes the\n * position onto the nodes that are about to be thrown away, and the ones that\n * replace them start at zero. There is nothing to await — the navigation\n * resolves when the tree is handed to React, not when React has committed it.\n *\n * `setTimeout`, not `requestAnimationFrame`. A hidden tab never runs an\n * animation frame, so a refresh in a background tab — an HMR update, a poll —\n * would leave the scroll state wrong the moment it came back into view. It\n * also makes this untestable in an automated browser, where the tab under test\n * is usually not the visible one.\n */\nconst RESTORE_ATTEMPTS = 5;\n\nfunction restoreScroll(positions: ScrollPosition[]): void {\n const [win, ...inner] = positions;\n\n const apply = (attempt: number) => {\n if (window.scrollY !== win.top || window.scrollX !== win.left) {\n window.scrollTo(win.left, win.top);\n }\n\n const now = scrollables();\n\n for (let i = 0; i < inner.length && i < now.length; i++) {\n // A different element here means the page came back a different shape,\n // and guessing further would scroll something nobody touched.\n if (now[i].tagName !== inner[i].tag) break;\n\n if (inner[i].top !== 0 && now[i].scrollTop !== inner[i].top)\n now[i].scrollTop = inner[i].top;\n if (inner[i].left !== 0 && now[i].scrollLeft !== inner[i].left)\n now[i].scrollLeft = inner[i].left;\n }\n\n if (attempt < RESTORE_ATTEMPTS) setTimeout(() => apply(attempt + 1), 16);\n };\n\n apply(1);\n}\n\nexport function prefetch(url: string, cacheForMs?: number): void {\n // Never a route.ts: fetching one runs it, and a hover is not a click.\n if (isApiRoute(url)) return;\n\n if (isExternalUrl(url)) return;\n\n const ttl = cacheForMs ?? DEFAULT_PREFETCH_TTL;\n const interceptSlot = matchIntercept(url);\n\n if (interceptSlot) {\n // Intercepted route — only prefetch the intercepted variant\n const currentUrl = window.location.pathname + window.location.search;\n const cacheKey = retentionKeyFor(url, interceptSlot);\n prefetchUrl(cacheKey, url, ttl, interceptSlot, currentUrl);\n } else {\n prefetchUrl(url, url, ttl);\n }\n}\n\nfunction prefetchUrl(\n cacheKey: string,\n url: string,\n ttl: number,\n interceptSlot?: string,\n refererUrl?: string,\n): void {\n const chain = claimedChain(interceptSlot ?? null);\n const existing = cache.get(cacheKey);\n\n if (existing && existing.expiresAt > Date.now()) {\n return;\n }\n\n cache.delete(cacheKey);\n makeRoom();\n\n const controller = new AbortController();\n prefetchControllers.set(cacheKey, controller);\n\n const entry: CacheEntry = {\n tree: Promise.resolve(null),\n expiresAt: Date.now() + ttl,\n segmentDepth: 0,\n layouts: null,\n slot: null,\n heldWhenFetched: chain.join(\",\"),\n redirectTo: null,\n failed: false,\n };\n\n // Low priority: the browser then lets a real navigation overtake a queue of\n // speculative requests instead of serving them in the order they were made.\n entry.tree = fetchRscPayload(\n url,\n controller.signal,\n interceptSlot,\n refererUrl,\n chain,\n \"low\",\n )\n .then((response) => {\n // On a static host there are no headers to read, and dropping the depth\n // is not a small loss: the entry then claims a segment is a whole\n // document, and rendering a layout-less page as the document root does\n // not warn — it hangs the renderer.\n // A prefetch that lands on a redirect is not cached. Following it would\n // navigate on hover, and storing it would hand the click a 204 with no\n // body to deserialize. The click re-requests and redirects properly.\n const redirectTo = response.headers.get(\"X-RSC-Redirect\");\n\n if (redirectTo) {\n entry.redirectTo = redirectTo;\n cache.delete(cacheKey);\n\n return null;\n }\n\n entry.slot = response.headers.get(\"X-RSC-Revalidate\");\n\n const local = staticFetches.get(response) ?? null;\n\n entry.segmentDepth =\n Number(\n response.headers.get(\"X-RSC-Segment-Depth\") ?? local?.depth ?? 0,\n ) || 0;\n\n const served = response.headers.get(\"X-RSC-Layouts\");\n\n if (served !== null) {\n entry.layouts = served === \"\" ? [] : served.split(\",\");\n } else if (local) {\n entry.layouts = local.chain;\n }\n\n return deserializeResponse(response);\n })\n .catch(() => {\n entry.failed = true;\n cache.delete(cacheKey);\n return null;\n })\n .finally(() => {\n // Settled, so there is nothing left to abort. A completed prefetch stays\n // in the cache — only an in-flight one is ever dropped.\n if (prefetchControllers.get(cacheKey) === controller) {\n prefetchControllers.delete(cacheKey);\n }\n });\n\n cache.set(cacheKey, entry);\n}\n\n/**\n * Drop a prefetch that is still in flight — the pointer left the link.\n *\n * The cache entry goes synchronously rather than in the abort's catch: the\n * rejection lands a tick later, and a click in between would find an entry\n * whose tree resolves to null and navigate to a blank page. A prefetch that\n * has already completed is kept; there is no request left to cancel and the\n * payload is still good.\n */\nexport function cancelPrefetch(url: string): void {\n if (isExternalUrl(url)) return;\n\n const interceptSlot = matchIntercept(url);\n const cacheKey = retentionKeyFor(url, interceptSlot);\n const controller = prefetchControllers.get(cacheKey);\n\n if (!controller) return;\n\n prefetchControllers.delete(cacheKey);\n cache.delete(cacheKey);\n controller.abort();\n}\n"]}
|
package/dist/metadata.d.ts
CHANGED
|
@@ -204,3 +204,27 @@ export declare namespace MetadataRoute {
|
|
|
204
204
|
sections?: LlmsSection[];
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* `export const viewport`, in Next's shape, on a layout or a page: layouts
|
|
209
|
+
* outer to inner, then the page, merged per key. What is not set is
|
|
210
|
+
* `width=device-width, initial-scale=1`, written into every document the way
|
|
211
|
+
* Next wrote it — a layout ported from Next never wrote the tag, and a page
|
|
212
|
+
* without one is the desktop layout on a phone. A layout that renders
|
|
213
|
+
* `<meta name="viewport">` itself is left alone.
|
|
214
|
+
*/
|
|
215
|
+
export interface Viewport {
|
|
216
|
+
width?: string | number;
|
|
217
|
+
height?: string | number;
|
|
218
|
+
initialScale?: number;
|
|
219
|
+
minimumScale?: number;
|
|
220
|
+
maximumScale?: number;
|
|
221
|
+
userScalable?: boolean;
|
|
222
|
+
viewportFit?: "auto" | "cover" | "contain";
|
|
223
|
+
interactiveWidget?: "resizes-visual" | "resizes-content" | "overlays-content";
|
|
224
|
+
/** One colour, or one per media query. Wins over the web manifest's. */
|
|
225
|
+
themeColor?: string | {
|
|
226
|
+
media?: string;
|
|
227
|
+
color: string;
|
|
228
|
+
}[];
|
|
229
|
+
colorScheme?: "normal" | "light" | "dark" | "light dark" | "dark light" | "only light";
|
|
230
|
+
}
|
package/dist/metadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,4DAA4D;AAC5D,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,MAAM","sourcesContent":["// What a page says about itself, as importable types.\n//\n// import type { Metadata } from '@rsc-kit/core/metadata'\n//\n// export const metadata: Metadata = { title: 'Orders' }\n//\n// Imported rather than ambient, and that is the whole point of the move. An\n// ambient declaration has to be COPIED into the project, which means it is not\n// there until the build has run once — so a freshly cloned app reports \"Cannot\n// find name 'Metadata'\" on every page until someone runs the dev server. An\n// import resolves from node_modules the moment dependencies are installed.\n//\n// The ambient names still work. `.rsc-kit/rsc-types.d.ts` now aliases these\n// rather than restating them, so there is one definition and two ways to reach\n// it.\n\nexport interface IconDescriptor {\n url: string | URL;\n type?: string;\n sizes?: string;\n color?: string;\n rel?: string;\n media?: string;\n fetchPriority?: \"high\" | \"low\" | \"auto\";\n}\n\nexport type IconURL = string | URL;\n\nexport interface Icons {\n icon?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n apple?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n shortcut?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n other?: IconDescriptor | IconDescriptor[];\n}\n\n/** A layout's title, wrapping the titles of the pages beneath it. */\nexport interface TitleTemplate {\n /** `%s` stands in for the page's own title. */\n template?: string;\n /** Used by a page that exports no title of its own. */\n default?: string;\n}\n\n/** One image a share card may show. A string is its url. */\nexport interface OpenGraphImage {\n url: string | URL;\n width?: number;\n height?: number;\n alt?: string;\n type?: string;\n}\n\n/**\n * The card a link to this page unfurls into on Facebook, Slack, LinkedIn and\n * most of the rest. Rendered with `property=`, which is what those scrapers\n * read — a `name=` attribute is ignored by every one of them.\n */\nexport interface OpenGraph {\n title?: string;\n description?: string;\n /** Absolute, or relative to `metadataBase`. */\n url?: string | URL;\n siteName?: string;\n type?: \"website\" | \"article\" | \"profile\" | \"book\" | (string & {});\n locale?: string;\n images?: string | URL | OpenGraphImage | (string | URL | OpenGraphImage)[];\n}\n\n/** The same card for X, which reads `name=` rather than `property=`. */\nexport interface Twitter {\n card?: \"summary\" | \"summary_large_image\" | \"app\" | \"player\";\n title?: string;\n description?: string;\n /** The site's account, `@handle`. */\n site?: string;\n /** The author's account, `@handle`. */\n creator?: string;\n images?: string | URL | OpenGraphImage | (string | URL | OpenGraphImage)[];\n}\n\nexport interface Robots {\n index?: boolean;\n follow?: boolean;\n noarchive?: boolean;\n nosnippet?: boolean;\n noimageindex?: boolean;\n nocache?: boolean;\n notranslate?: boolean;\n indexifembedded?: boolean;\n nositelinkssearchbox?: boolean;\n unavailable_after?: string;\n \"max-video-preview\"?: number | string;\n \"max-image-preview\"?: \"none\" | \"standard\" | \"large\";\n \"max-snippet\"?: number;\n googleBot?: string | Omit<Robots, \"googleBot\">;\n}\n\nexport interface Metadata {\n /** A string on a page; a template on a layout, applied to the pages below it. */\n title?: string | TitleTemplate;\n description?: string;\n keywords?: string | string[];\n author?: string;\n /**\n * A string, or the object Next takes: `{ index: false, follow: false }`\n * becomes `<meta name=\"robots\" content=\"noindex, nofollow\">`, the flags\n * by name, the limits as `name:value`; `googleBot` is the same shape for\n * `<meta name=\"googlebot\">`.\n */\n robots?: string | Robots;\n /**\n * Where the site lives, so a relative image or url can be made absolute.\n *\n * metadataBase: new URL('https://example.com')\n *\n * On the root layout, once. A share-card scraper needs an absolute url and\n * several refuse a relative one; without this, `og:image` for an image in\n * `app/` is emitted relative and works in some places and not others. The\n * same name as Next, so a port carries it across unchanged.\n */\n metadataBase?: string | URL;\n icons?: IconURL | (IconURL | IconDescriptor)[] | Icons | null;\n openGraph?: OpenGraph;\n twitter?: Twitter;\n /** @deprecated Use `openGraph.title`. Still rendered, correctly, as `property=`. */\n \"og:title\"?: string;\n /** @deprecated Use `openGraph.description`. */\n \"og:description\"?: string;\n /** @deprecated Use `openGraph.images`. */\n \"og:image\"?: string;\n /** @deprecated Use `openGraph.url`. */\n \"og:url\"?: string;\n /** @deprecated Use `openGraph.type`. */\n \"og:type\"?: string;\n /** @deprecated Use `openGraph.siteName`. */\n \"og:site_name\"?: string;\n /** @deprecated Use `twitter.card`. */\n \"twitter:card\"?: string;\n /** @deprecated Use `twitter.title`. */\n \"twitter:title\"?: string;\n /** @deprecated Use `twitter.description`. */\n \"twitter:description\"?: string;\n /** @deprecated Use `twitter.images`. */\n \"twitter:image\"?: string;\n /** @deprecated Use `twitter.site`. */\n \"twitter:site\"?: string;\n\n /**\n * Any other meta tag, by name.\n *\n * other: { 'fb:app_id': '123', 'theme-color': '#000' }\n *\n * Here rather than alongside the named keys, and that is what makes the rest\n * of this interface worth annotating. An index signature on the interface\n * itself made every key legal — so `titel` was accepted in silence, and an\n * editor offered no completions at all, because with any identifier valid\n * TypeScript reads an unfinished key as a shorthand property and goes looking\n * for a variable by that name.\n */\n other?: Record<string, string | string[] | null | undefined>;\n}\n\n/**\n * Metadata that depends on the request.\n *\n * Receives the same awaitables a page does, so one shape is learned rather\n * than two:\n *\n * export const generateMetadata: GenerateMetadata<{ slug: string }> =\n * async ({ params }) => ({ title: (await params).slug })\n */\nexport type GenerateMetadata<P = Record<string, string>> = (args: {\n params: Promise<P>;\n searchParams: Promise<URLSearchParams>;\n}) => Metadata | Promise<Metadata>;\n\n/** One rule block of a robots.txt: which agents, what they may and may not fetch. */\nexport interface RobotsRule {\n userAgent?: string | string[];\n allow?: string | string[];\n disallow?: string | string[];\n crawlDelay?: number;\n}\n\n/** One url of a sitemap. `url` may be relative when the root layout has a metadataBase. */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?:\n \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n /** Image urls on this page, for image search. */\n images?: string[];\n /** Translations of this page: language tag to url. */\n alternates?: { languages?: Record<string, string> };\n}\n\n/** A link in an llms.txt section. */\nexport interface LlmsLink {\n title: string;\n url: string;\n description?: string;\n}\n\nexport interface LlmsSection {\n title: string;\n links: LlmsLink[];\n}\n\n/**\n * The files a site describes itself with, each from a file beside the root\n * layout and written the way Next writes them:\n *\n * app/robots.ts -> /robots.txt default export returns MetadataRoute.Robots\n * app/sitemap.ts -> /sitemap.xml default export returns MetadataRoute.Sitemap\n * app/llms.ts -> /llms.txt default export returns MetadataRoute.Llms\n *\n * Each may return a string instead, served as written. A relative url in any\n * of them is made absolute with the root layout's metadataBase.\n */\nexport namespace MetadataRoute {\n export type Robots = {\n rules: RobotsRule | RobotsRule[];\n sitemap?: string | string[];\n host?: string;\n };\n export type Sitemap = SitemapEntry[];\n /** The llms.txt shape at llmstxt.org: a title, a summary, then sections of links. */\n export type Llms = {\n title: string;\n summary?: string;\n /** Paragraphs after the summary, before the sections. */\n details?: string | string[];\n sections?: LlmsSection[];\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,4DAA4D;AAC5D,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,MAAM","sourcesContent":["// What a page says about itself, as importable types.\n//\n// import type { Metadata } from '@rsc-kit/core/metadata'\n//\n// export const metadata: Metadata = { title: 'Orders' }\n//\n// Imported rather than ambient, and that is the whole point of the move. An\n// ambient declaration has to be COPIED into the project, which means it is not\n// there until the build has run once — so a freshly cloned app reports \"Cannot\n// find name 'Metadata'\" on every page until someone runs the dev server. An\n// import resolves from node_modules the moment dependencies are installed.\n//\n// The ambient names still work. `.rsc-kit/rsc-types.d.ts` now aliases these\n// rather than restating them, so there is one definition and two ways to reach\n// it.\n\nexport interface IconDescriptor {\n url: string | URL;\n type?: string;\n sizes?: string;\n color?: string;\n rel?: string;\n media?: string;\n fetchPriority?: \"high\" | \"low\" | \"auto\";\n}\n\nexport type IconURL = string | URL;\n\nexport interface Icons {\n icon?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n apple?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n shortcut?: IconURL | IconDescriptor | (IconURL | IconDescriptor)[];\n other?: IconDescriptor | IconDescriptor[];\n}\n\n/** A layout's title, wrapping the titles of the pages beneath it. */\nexport interface TitleTemplate {\n /** `%s` stands in for the page's own title. */\n template?: string;\n /** Used by a page that exports no title of its own. */\n default?: string;\n}\n\n/** One image a share card may show. A string is its url. */\nexport interface OpenGraphImage {\n url: string | URL;\n width?: number;\n height?: number;\n alt?: string;\n type?: string;\n}\n\n/**\n * The card a link to this page unfurls into on Facebook, Slack, LinkedIn and\n * most of the rest. Rendered with `property=`, which is what those scrapers\n * read — a `name=` attribute is ignored by every one of them.\n */\nexport interface OpenGraph {\n title?: string;\n description?: string;\n /** Absolute, or relative to `metadataBase`. */\n url?: string | URL;\n siteName?: string;\n type?: \"website\" | \"article\" | \"profile\" | \"book\" | (string & {});\n locale?: string;\n images?: string | URL | OpenGraphImage | (string | URL | OpenGraphImage)[];\n}\n\n/** The same card for X, which reads `name=` rather than `property=`. */\nexport interface Twitter {\n card?: \"summary\" | \"summary_large_image\" | \"app\" | \"player\";\n title?: string;\n description?: string;\n /** The site's account, `@handle`. */\n site?: string;\n /** The author's account, `@handle`. */\n creator?: string;\n images?: string | URL | OpenGraphImage | (string | URL | OpenGraphImage)[];\n}\n\nexport interface Robots {\n index?: boolean;\n follow?: boolean;\n noarchive?: boolean;\n nosnippet?: boolean;\n noimageindex?: boolean;\n nocache?: boolean;\n notranslate?: boolean;\n indexifembedded?: boolean;\n nositelinkssearchbox?: boolean;\n unavailable_after?: string;\n \"max-video-preview\"?: number | string;\n \"max-image-preview\"?: \"none\" | \"standard\" | \"large\";\n \"max-snippet\"?: number;\n googleBot?: string | Omit<Robots, \"googleBot\">;\n}\n\nexport interface Metadata {\n /** A string on a page; a template on a layout, applied to the pages below it. */\n title?: string | TitleTemplate;\n description?: string;\n keywords?: string | string[];\n author?: string;\n /**\n * A string, or the object Next takes: `{ index: false, follow: false }`\n * becomes `<meta name=\"robots\" content=\"noindex, nofollow\">`, the flags\n * by name, the limits as `name:value`; `googleBot` is the same shape for\n * `<meta name=\"googlebot\">`.\n */\n robots?: string | Robots;\n /**\n * Where the site lives, so a relative image or url can be made absolute.\n *\n * metadataBase: new URL('https://example.com')\n *\n * On the root layout, once. A share-card scraper needs an absolute url and\n * several refuse a relative one; without this, `og:image` for an image in\n * `app/` is emitted relative and works in some places and not others. The\n * same name as Next, so a port carries it across unchanged.\n */\n metadataBase?: string | URL;\n icons?: IconURL | (IconURL | IconDescriptor)[] | Icons | null;\n openGraph?: OpenGraph;\n twitter?: Twitter;\n /** @deprecated Use `openGraph.title`. Still rendered, correctly, as `property=`. */\n \"og:title\"?: string;\n /** @deprecated Use `openGraph.description`. */\n \"og:description\"?: string;\n /** @deprecated Use `openGraph.images`. */\n \"og:image\"?: string;\n /** @deprecated Use `openGraph.url`. */\n \"og:url\"?: string;\n /** @deprecated Use `openGraph.type`. */\n \"og:type\"?: string;\n /** @deprecated Use `openGraph.siteName`. */\n \"og:site_name\"?: string;\n /** @deprecated Use `twitter.card`. */\n \"twitter:card\"?: string;\n /** @deprecated Use `twitter.title`. */\n \"twitter:title\"?: string;\n /** @deprecated Use `twitter.description`. */\n \"twitter:description\"?: string;\n /** @deprecated Use `twitter.images`. */\n \"twitter:image\"?: string;\n /** @deprecated Use `twitter.site`. */\n \"twitter:site\"?: string;\n\n /**\n * Any other meta tag, by name.\n *\n * other: { 'fb:app_id': '123', 'theme-color': '#000' }\n *\n * Here rather than alongside the named keys, and that is what makes the rest\n * of this interface worth annotating. An index signature on the interface\n * itself made every key legal — so `titel` was accepted in silence, and an\n * editor offered no completions at all, because with any identifier valid\n * TypeScript reads an unfinished key as a shorthand property and goes looking\n * for a variable by that name.\n */\n other?: Record<string, string | string[] | null | undefined>;\n}\n\n/**\n * Metadata that depends on the request.\n *\n * Receives the same awaitables a page does, so one shape is learned rather\n * than two:\n *\n * export const generateMetadata: GenerateMetadata<{ slug: string }> =\n * async ({ params }) => ({ title: (await params).slug })\n */\nexport type GenerateMetadata<P = Record<string, string>> = (args: {\n params: Promise<P>;\n searchParams: Promise<URLSearchParams>;\n}) => Metadata | Promise<Metadata>;\n\n/** One rule block of a robots.txt: which agents, what they may and may not fetch. */\nexport interface RobotsRule {\n userAgent?: string | string[];\n allow?: string | string[];\n disallow?: string | string[];\n crawlDelay?: number;\n}\n\n/** One url of a sitemap. `url` may be relative when the root layout has a metadataBase. */\nexport interface SitemapEntry {\n url: string;\n lastModified?: string | Date;\n changeFrequency?:\n \"always\" | \"hourly\" | \"daily\" | \"weekly\" | \"monthly\" | \"yearly\" | \"never\";\n priority?: number;\n /** Image urls on this page, for image search. */\n images?: string[];\n /** Translations of this page: language tag to url. */\n alternates?: { languages?: Record<string, string> };\n}\n\n/** A link in an llms.txt section. */\nexport interface LlmsLink {\n title: string;\n url: string;\n description?: string;\n}\n\nexport interface LlmsSection {\n title: string;\n links: LlmsLink[];\n}\n\n/**\n * The files a site describes itself with, each from a file beside the root\n * layout and written the way Next writes them:\n *\n * app/robots.ts -> /robots.txt default export returns MetadataRoute.Robots\n * app/sitemap.ts -> /sitemap.xml default export returns MetadataRoute.Sitemap\n * app/llms.ts -> /llms.txt default export returns MetadataRoute.Llms\n *\n * Each may return a string instead, served as written. A relative url in any\n * of them is made absolute with the root layout's metadataBase.\n */\nexport namespace MetadataRoute {\n export type Robots = {\n rules: RobotsRule | RobotsRule[];\n sitemap?: string | string[];\n host?: string;\n };\n export type Sitemap = SitemapEntry[];\n /** The llms.txt shape at llmstxt.org: a title, a summary, then sections of links. */\n export type Llms = {\n title: string;\n summary?: string;\n /** Paragraphs after the summary, before the sections. */\n details?: string | string[];\n sections?: LlmsSection[];\n };\n}\n\n/**\n * `export const viewport`, in Next's shape, on a layout or a page: layouts\n * outer to inner, then the page, merged per key. What is not set is\n * `width=device-width, initial-scale=1`, written into every document the way\n * Next wrote it — a layout ported from Next never wrote the tag, and a page\n * without one is the desktop layout on a phone. A layout that renders\n * `<meta name=\"viewport\">` itself is left alone.\n */\nexport interface Viewport {\n width?: string | number;\n height?: string | number;\n initialScale?: number;\n minimumScale?: number;\n maximumScale?: number;\n userScalable?: boolean;\n viewportFit?: \"auto\" | \"cover\" | \"contain\";\n interactiveWidget?: \"resizes-visual\" | \"resizes-content\" | \"overlays-content\";\n /** One colour, or one per media query. Wins over the web manifest's. */\n themeColor?: string | { media?: string; color: string }[];\n colorScheme?: \"normal\" | \"light\" | \"dark\" | \"light dark\" | \"dark light\" | \"only light\";\n}\n"]}
|