import { useFetchRsc_UNSTABLE as useFetchRsc } from 'waku/minimal/client'; import type { RouteProps } from '../isomorphic-utils/route-path.js'; import type { LoadOptions, LoadOutcome } from './load.js'; import { type PrefetchEntry, type PrefetchOptions } from './prefetch-cache.js'; type Elements = Readonly>; type RouteIntentObserver = (signal: AbortSignal | undefined) => (elements: Elements) => Elements; type CachedLoadOptions = LoadOptions & { /** `false` reuses the initial attempt without fetching. */ refetch?: boolean; /** Supplies the first attempt's response; follows use normal fetching. */ adopt?: Promise; /** Retained elements used for etags and static-route reuse. */ base: Elements; /** * Receives the attempt's browser URL when its response comes from a * different build. * @deprecated Will be removed in a future release. Without it, the load * fails; recognize the error with `unstable_isBuildIdMismatch`. */ onBuildIdMismatch?: (url: URL) => void; /** * Observes prefetch invalidation with the affected attempt's browser URL. * @deprecated Will be removed in a future release. A prefetch from a * different build rejects, failing the load that adopts it; recognize the * error with `unstable_isBuildIdMismatch`. */ onInvalidate?: (url: URL) => void; }; export type FetchRsc = ReturnType; export type { PrefetchOptions } from './prefetch-cache.js'; export type PrefetchHandle = Pick; export declare function createRscParams(query: string): URLSearchParams; declare const createRouterCache: (fetchRsc: FetchRsc) => { fetchRsc: import("../../minimal/client-utils/root-store.js").FetchRsc; slices: { registerLazySlice: (id: string) => void; forEachRegisteredLazySlice: (fn: (id: string) => void) => void; fetchSlice: (id: string, mergeElements: ReturnType, replace?: boolean) => void; getInFlightSliceCount: () => number; }; captureRouteIntentScope: (signal?: AbortSignal) => ((elements: Elements) => Elements) | undefined; connectRouteIntentObserver(observer: RouteIntentObserver): () => void; prefetchRoute: (route: RouteProps, options?: PrefetchOptions) => void; hasCachedShell: (route: RouteProps, currentElements: Record) => boolean; getPrefetchedElements: (route: RouteProps) => Elements | undefined; getPrefetch: (route: RouteProps) => PrefetchHandle | undefined; canReuseStaticRoute: (route: RouteProps, elements: Elements) => boolean; /** * Loads an optional initial response before static reuse, prefetch, or the * network, using `unstable_load`'s follow and cancellation rules. * Network results are response patches; cached prefetches return stored * maps. Combine patches with the retained base when reading a full snapshot. * Cached synchronous commits belong to the binding. */ load: (requested: RouteProps, opts: CachedLoadOptions) => Promise; learnStaticFromElements: (elements: Elements) => void; clearCaches: () => void; }; export type RouterCache = ReturnType; export declare const getRouterCacheForTest: (fetchRsc: FetchRsc) => RouterCache; /** * Returns the Router cache of the enclosing Root. Outside a Root every caller * shares one cache, as they share one fetch. */ export declare function useRouterCache(): RouterCache;