import type { RuntimePluginFuture } from '@modern-js/runtime'; import { type BrowserHistoryBuildOptions, type HashHistoryBuildOptions, type History } from 'history'; import type React from 'react'; import { type RouteProps } from 'react-router-dom'; import { modifyRoutesHook } from './hooks'; export type RouterExtendsHooks = { modifyRoutes: typeof modifyRoutesHook; }; 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 HistoryConfig = { supportHtml5History: true; historyOptions: BrowserHistoryBuildOptions; } | { supportHtml5History: false; historyOptions: HashHistoryBuildOptions; }; export type RouterConfig = Partial & { mode?: 'react-router-5'; routesConfig?: { globalApp?: React.ComponentType; routes?: SingleRouteConfig[]; }; createRoutes?: () => React.ComponentType | null; history?: History; serverBase?: string[]; }; export declare const routerPlugin: (userConfig?: RouterConfig) => RuntimePluginFuture<{ extendHooks: RouterExtendsHooks; }>;