import type { ComponentType } from 'react'; import type { GenerateMetadata, Metadata } from './metadata.js'; import type { Middleware } from './middleware.js'; /** * Shape of a namespace import (`import * as mod from '...'`) for a page, * layout, loading, error, or not-found file — matches what the * `virtual:murasaki/routes` module emits. */ export interface RouteModule { default: ComponentType; metadata?: Metadata; generateMetadata?: GenerateMetadata; } /** Matches the entries emitted by `virtual:murasaki/routes`. */ export interface RouteEntry { urlPath: string; isDynamic: boolean; page?: RouteModule; layout?: RouteModule; loading?: RouteModule; error?: RouteModule; notFound?: RouteModule; } export interface RouteMatch { route: RouteEntry; params: Record; } /** * Pure route matcher — exported for unit testing. * * Static segments win over dynamic ones, dynamic over catch-all, and * catch-all over optional catch-all; among same-kind matches, more static * segments win over fewer (more-specific over less). Only entries with a * `page` are matchable. */ export declare function matchRoute(routes: RouteEntry[], pathname: string): RouteMatch | null; /** * Client-side file-based routing dispatch. * * Consumes the routes emitted by the `murasaki:routing` Vite plugin * (`virtual:murasaki/routes`) — murasaki itself stays routes-agnostic, so * the caller imports the virtual module and passes it in: * * ```tsx * import { routes, middleware } from 'virtual:murasaki/routes' * import { AppRouter } from 'murasaki' * * createRoot(el).render() * ``` * * `middleware`, if given, runs before every navigation (initial mount, * `push`/`replace`, and browser back/forward) and can redirect it — see * `Middleware`. */ export declare function AppRouter({ routes, middleware, }: { routes: RouteEntry[]; middleware?: Middleware; }): import("react").JSX.Element; //# sourceMappingURL=app-router.d.ts.map