UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

38 lines • 1.92 kB
import { AppRouterFactory, CreateRouterOptions, HeadData, RenderOptionsWithApi, RenderResult, RouterContextWithApi } from "./types.cjs"; import { LocaleOptions } from "./locale.cjs"; import { QueryClient } from "@tanstack/react-query"; import { AnyRoute, AnyRouter } from "@tanstack/react-router"; //#region src/ui/router-server.d.ts interface ServerRouterModuleOptions<TRouteTree extends AnyRoute = AnyRoute> { /** The app's generated route tree — the core-only fallback when no composed tree is passed. */ defaultRouteTree?: TRouteTree; /** * The app's authored router factory — SSR parity: each request's router is * minted through the same factory the client hydrates with, so notFound/ * pending/error options match. Absent, the framework's own factory runs. */ createRouter?: AppRouterFactory; /** The app's query client factory (staleTime, gcTime, …) — SSR parity with the client hydrator. Absent, the framework default. */ createQueryClient?: () => QueryClient; /** Locale negotiation for SSR — resolves the request-scoped locale into router context. */ locale?: LocaleOptions; } type ServerRouterOptions<TRouteTree extends AnyRoute> = CreateRouterOptions & { context?: Partial<RouterContextWithApi> & { pluginNav?: unknown; }; routeTree?: TRouteTree; }; declare function createServerRouterModule<TRouteTree extends AnyRoute = AnyRoute>(options?: ServerRouterModuleOptions<TRouteTree>): { createRouter: (opts?: ServerRouterOptions<TRouteTree>) => { router: AnyRouter; queryClient: QueryClient; }; getRouteHead: (pathname: string, context?: Partial<RouterContextWithApi> & { routeTree?: TRouteTree; }) => Promise<HeadData>; renderToStream: (request: Request, renderOptions: RenderOptionsWithApi) => Promise<RenderResult>; }; //#endregion export { ServerRouterModuleOptions, createServerRouterModule }; //# sourceMappingURL=router-server.d.cts.map