import type { RequestContext } from '@modern-js/runtime-utils/node'; import type { Params, RouteObject, RouteProps } from '@modern-js/runtime-utils/router'; import type { NestedRoute, PageRoute } from '@modern-js/types'; export type SingleRouteConfig = RouteProps & { redirect?: string; routes?: SingleRouteConfig[]; key?: string; /** * layout component */ layout?: React.ComponentType; /** * component would be rendered when route macthed. */ component?: React.ComponentType; }; export type RouterConfig = { routesConfig: { globalApp?: React.ComponentType; routes?: (NestedRoute | PageRoute)[]; }; /** * You should not use it */ oldVersion?: boolean; serverBase?: string[]; supportHtml5History?: boolean; basename?: string; createRoutes?: () => RouteObject[]; /** * Whether to wrap router state updates in `React.startTransition`. * Passed to ``. Defaults to React Router's behavior (enabled). * Set to `false` to render route updates synchronously. */ useTransitions?: boolean; /** * @deprecated Use `useTransitions` instead. */ future?: Partial<{ v7_startTransition: boolean; }>; /** * An unstable feature, which will reload the page when the current browser URL and the SSR Context URL do not match. */ unstable_reloadOnURLMismatch?: boolean; }; export type Routes = RouterConfig['routesConfig']['routes']; export interface RouteManifest { routeAssets: RouteAssets; } export interface RouteAssets { [routeId: string]: { chunkIds?: (string | number)[]; assets?: string[]; referenceCssAssets?: string[]; }; } export interface LazyComponentDescriptor { _init: unknown; _payload: unknown; } export type ModernRouteObject = RouteObject & { isClientComponent?: boolean; hasClientLoader?: boolean; hasLoader?: boolean; hasAction?: boolean; parentId?: string; lazyImport?: () => Promise<{ default: React.ComponentType; }>; component?: React.ComponentType | LazyComponentDescriptor; entryCssFiles?: string[]; }; interface DataFunctionArgs { request: Request; params: Params; context?: D; } export type LoaderFunctionArgs

= Record> = DataFunctionArgs>; declare type DataFunctionValue = Response | NonNullable | null; export type LoaderFunction =

= Record>(args: LoaderFunctionArgs

) => Promise | DataFunctionValue; export {};