UNPKG

vite-plugin-react-server

Version:
33 lines 1.69 kB
import type { PageName, PropsName, ResolvedBuildPages, ResolvedUserOptions } from "../../types.js"; import type { Logger } from "vite"; import type { Manifest } from "vite"; /** * Resolves build pages by calling resolveUrlOption for each page in build.pages. * * ## BUILD-TIME STATIC DISCOVERY * This function is called during build/startup to: * 1. Take the explicit `build.pages` array (e.g., ["/", "/about", "/products"]) * 2. Call `resolveUrlOption` for each page to get file paths * 3. Build static maps (urlMap, pageMap, propsMap, routeMap) for fast runtime lookup * 4. Validate that resolved file paths actually exist on filesystem * * ## Cache Strategy: * Results are cached (stashedBuildPages) to avoid re-resolving on every build. * Cache is invalidated only when the pages array changes. * * ## Usage Flow: * - Called by build process and plugin initialization * - Feeds into auto-discovery system to populate urlMap cache * - Enables fast runtime lookup in getRouteFiles.ts without dynamic resolution * * ## Limitation: * Only works when build.pages is explicitly provided. Without it, the system * falls back to filesystem scanning + dynamic resolution in getRouteFiles.ts. */ export declare function resolveBuildPages({ pages, userOptions, logger, manifest, }: { pages: string[]; userOptions: Pick<ResolvedUserOptions, PageName | PropsName | "Root" | "Html" | "build" | "moduleBase" | "projectRoot" | "normalizer" | "moduleBasePath" | "pageExportName" | "propsExportName" | "rootExportName" | "htmlExportName" | "verbose">; logger: Logger; manifest?: Manifest; }): Promise<ResolvedBuildPages>; //# sourceMappingURL=resolveBuildPages.d.ts.map