rsbuild-plugin-react-router
Version:
React Router plugin for Rsbuild
41 lines (40 loc) • 2.63 kB
TypeScript
export type RouteChunkExportName = 'clientAction' | 'clientLoader' | 'clientMiddleware' | 'HydrateFallback';
export type RouteChunkName = 'main' | RouteChunkExportName;
export type RouteChunkConfig = {
splitRouteModules?: boolean | 'enforce';
appDirectory: string;
rootRouteFile: string;
};
type RouteChunkCacheEntry<T> = {
value: T;
version: string;
};
export type RouteChunkCache = Map<string, RouteChunkCacheEntry<unknown>>;
export type RouteChunkInfo = {
exportNames: string[];
hasRouteChunks: boolean;
hasRouteChunkByExportName: Record<RouteChunkExportName, boolean>;
chunkedExports: RouteChunkExportName[];
};
export declare const routeChunkExportNames: RouteChunkExportName[];
export declare const routeChunkNames: RouteChunkName[];
export declare const mightContainRouteChunkExportName: (source: string) => boolean;
export declare const emptyRouteChunkSnippet: () => string;
export declare const detectRouteChunks: (code: string, cache: RouteChunkCache | undefined, cacheKey: string) => RouteChunkInfo;
export declare const getRouteChunkCode: (code: string, chunkName: RouteChunkName, cache: RouteChunkCache | undefined, cacheKey: string) => string | undefined;
export declare const getRouteChunkModuleId: (filePath: string, chunkName: RouteChunkName) => string;
export declare const isRouteChunkModuleId: (id: string) => boolean;
export declare const getRouteChunkNameFromModuleId: (id: string) => RouteChunkName | null;
export declare const shouldAnalyzeRouteChunks: (config: RouteChunkConfig, id: string, code: string) => boolean;
export declare const createEmptyRouteChunkByExportName: () => Record<RouteChunkExportName, boolean>;
export declare const buildEnforceChunkValidity: (exportNames: readonly string[]) => Record<RouteChunkExportName, boolean>;
export declare const buildManifestChunkValidity: (exportNames: ReadonlySet<string>, hasRouteChunkByExportName: Readonly<Record<RouteChunkExportName, boolean>>) => Record<RouteChunkExportName, boolean>;
export declare const detectRouteChunksIfEnabled: (cache: RouteChunkCache | undefined, config: RouteChunkConfig, id: string, code: string) => Promise<RouteChunkInfo>;
export declare const getRouteChunkIfEnabled: (cache: RouteChunkCache | undefined, config: RouteChunkConfig, id: string, chunkName: RouteChunkName, code: string) => Promise<string | null>;
export declare const validateRouteChunks: (args: {
config: RouteChunkConfig;
id: string;
valid: Record<RouteChunkExportName, boolean>;
}) => void;
export declare const getRouteChunkEntryName: (routeId: string, chunkName: RouteChunkExportName) => string;
export {};