rsbuild-plugin-react-router
Version:
React Router plugin for Rsbuild
26 lines (25 loc) • 1.9 kB
TypeScript
import type { RsbuildDevServer, Rspack } from '@rsbuild/core';
import type { ServerBuild } from 'react-router';
import { type DevGraphChanges, type DevGraphIdentity, type DevRuntimeStats, type ReactRouterDevBuildPlan, type ReactRouterDevManifestSet } from './dev-runtime-artifacts.js';
export { snapshotDevChangedFiles } from './dev-runtime-artifacts.js';
export type { DevChangedFiles, DevGraphChanges, DevGraphIdentity, ReactRouterDevBuildPlan, ReactRouterDevManifest, ReactRouterDevManifestSet, } from './dev-runtime-artifacts.js';
export type ReactRouterDevRuntime = {
beginAttempt: () => void;
captureWeb: (compilation: Rspack.Compilation, manifestsByEntryName: ReactRouterDevManifestSet) => void;
finishAttempt: (stats: DevRuntimeStats, changes: DevGraphChanges, identity: DevGraphIdentity) => Promise<'committed' | 'ignored' | 'retry-node'>;
failAttempt: (error: Error) => void;
load: (entryName?: string) => Promise<ServerBuild>;
close: (error?: Error) => void;
};
type CreateReactRouterDevRuntimeOptions = {
server: RsbuildDevServer;
buildPlan: ReactRouterDevBuildPlan;
onEvaluationError: (error: Error) => void;
onCssAssetOwnershipChanged?: (change: 'removed' | 'restored') => void;
onRouteManifestChanged?: () => void;
onWarning?: (message: string) => void;
};
export declare const createReactRouterDevRuntime: ({ server, buildPlan, onEvaluationError, onCssAssetOwnershipChanged, onRouteManifestChanged, onWarning, }: CreateReactRouterDevRuntimeOptions) => ReactRouterDevRuntime;
export declare const registerReactRouterDevRuntime: (server: RsbuildDevServer, runtime: ReactRouterDevRuntime) => void;
export declare const unregisterReactRouterDevRuntime: (server: RsbuildDevServer, runtime: ReactRouterDevRuntime) => void;
export declare const loadReactRouterServerBuild: (server: RsbuildDevServer, entryName?: string) => Promise<ServerBuild>;