import type * as originalFs from "fs"; import type { Stats } from "webpack"; export type WebpackStats = Stats; export type BaseRoute = { route: string; }; /** * The value returned by `createDevRouter`. It is an Express router at runtime, * but this structural type keeps Express out of the package entry point, so * build-only TypeScript users do not need Express types. */ export interface DevRouter { (req: any, res: any, next: any): void; use: (...args: any[]) => any; } export type Render = (route: Route) => Promise; export type OnRendererReady = (callback: (render: Render) => Promise) => void; export type Renderer = (...params: any[]) => Promise; export type SourceModules = Record; export type RouteInput = Route | string; export type Trace = (...values: any[]) => void; export type Specifier = string; export type ExtraGlobals = Record; export type RenderConcurrency = "parallel" | "serial"; export type MapStatsToParams = (params: { webpackStats: WebpackStats; } & Route) => Record; export type TransformPath = (route: Route) => string; /** * Build the Express path for a route. Paths are normalized to a leading slash. * Return `undefined` to exclude a route from the dev router. */ export type TransformExpressPath = (route: Route) => string | undefined; export type GetRouteFromRequest = ( /** * An Express request. Typed as `any` so the main entry point does not depend * on Express's types; annotate it with `Request` from `express` if you want * the full type. */ req: any, routes: Route[]) => Route | undefined; export type FileSystem = typeof originalFs;