rsbuild-plugin-react-router
Version:
React Router plugin for Rsbuild
35 lines (34 loc) • 1.21 kB
TypeScript
import type { RsbuildDevServer } from '@rsbuild/core';
import type { ReactRouterDevRuntime } from './dev-generation.js';
import type { DevCompilerPair } from './dev-runtime-compilation.js';
export type RuntimeBinding = {
id: number;
server: RsbuildDevServer;
runtime: ReactRouterDevRuntime;
compilers?: DevCompilerPair;
};
export type ControllerState = {
status: 'idle';
} | {
status: 'active';
binding: RuntimeBinding;
} | {
status: 'closing';
binding: RuntimeBinding;
} | {
status: 'terminal';
error: Error;
};
type CloseBinding = (binding: RuntimeBinding, error?: Error) => void;
export type DevRuntimeSessionManager = {
getState(): ControllerState;
getActiveBinding(): RuntimeBinding | undefined;
observeClose(server: RsbuildDevServer): void;
assertCanStart(): void;
createBinding(server: RsbuildDevServer, runtime: ReactRouterDevRuntime): RuntimeBinding;
bindCloseObservation(binding: RuntimeBinding): void;
markClosing(binding: RuntimeBinding): void;
terminate(binding: RuntimeBinding, error: Error): void;
};
export declare const createDevRuntimeSessionManager: (closeBinding: CloseBinding) => DevRuntimeSessionManager;
export {};