/// /// /// /// import type { IncomingMessage, ServerResponse } from 'http'; import type { UrlObject } from 'url'; import type { Duplex } from 'stream'; import type { webpack } from 'next/dist/compiled/webpack/webpack'; import type getBaseWebpackConfig from '../../build/webpack-config'; import type { RouteMatch } from '../future/route-matches/route-match'; import type { Update as TurbopackUpdate } from '../../build/swc'; import type { VersionInfo } from './parse-version-info'; export declare const enum HMR_ACTIONS_SENT_TO_BROWSER { ADDED_PAGE = "addedPage", REMOVED_PAGE = "removedPage", RELOAD_PAGE = "reloadPage", SERVER_COMPONENT_CHANGES = "serverComponentChanges", MIDDLEWARE_CHANGES = "middlewareChanges", SERVER_ONLY_CHANGES = "serverOnlyChanges", SYNC = "sync", BUILT = "built", BUILDING = "building", DEV_PAGES_MANIFEST_UPDATE = "devPagesManifestUpdate", TURBOPACK_MESSAGE = "turbopack-message", SERVER_ERROR = "serverError", TURBOPACK_CONNECTED = "turbopack-connected" } interface ServerErrorAction { action: HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR; errorJSON: string; } export interface TurbopackMessageAction { type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_MESSAGE; data: TurbopackUpdate | TurbopackUpdate[]; } interface BuildingAction { action: HMR_ACTIONS_SENT_TO_BROWSER.BUILDING; } interface SyncAction { action: HMR_ACTIONS_SENT_TO_BROWSER.SYNC; hash: string; errors: ReadonlyArray; warnings: ReadonlyArray; versionInfo: VersionInfo; } interface BuiltAction { action: HMR_ACTIONS_SENT_TO_BROWSER.BUILT; hash: string; errors: ReadonlyArray; warnings: ReadonlyArray; } interface AddedPageAction { action: HMR_ACTIONS_SENT_TO_BROWSER.ADDED_PAGE; data: [page: string | null]; } interface RemovedPageAction { action: HMR_ACTIONS_SENT_TO_BROWSER.REMOVED_PAGE; data: [page: string | null]; } export interface ReloadPageAction { action: HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE; } interface ServerComponentChangesAction { action: HMR_ACTIONS_SENT_TO_BROWSER.SERVER_COMPONENT_CHANGES; } interface MiddlewareChangesAction { event: HMR_ACTIONS_SENT_TO_BROWSER.MIDDLEWARE_CHANGES; } interface ServerOnlyChangesAction { event: HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ONLY_CHANGES; pages: ReadonlyArray; } interface DevPagesManifestUpdateAction { action: HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE; data: [ { devPagesManifest: true; } ]; } export interface TurbopackConnectedAction { type: HMR_ACTIONS_SENT_TO_BROWSER.TURBOPACK_CONNECTED; } export type HMR_ACTION_TYPES = TurbopackMessageAction | TurbopackConnectedAction | BuildingAction | SyncAction | BuiltAction | AddedPageAction | RemovedPageAction | ReloadPageAction | ServerComponentChangesAction | MiddlewareChangesAction | ServerOnlyChangesAction | DevPagesManifestUpdateAction | ServerErrorAction; export interface NextJsHotReloaderInterface { activeWebpackConfigs?: Array>>; serverStats: webpack.Stats | null; edgeServerStats: webpack.Stats | null; run(req: IncomingMessage, res: ServerResponse, parsedUrl: UrlObject): Promise<{ finished?: true; }>; setHmrServerError(error: Error | null): void; clearHmrServerError(): void; start(): Promise; stop(): Promise; send(action: HMR_ACTION_TYPES): void; getCompilationErrors(page: string): Promise; onHMR(req: IncomingMessage, _socket: Duplex, head: Buffer): void; invalidate({ reloadAfterInvalidation, }: { reloadAfterInvalidation: boolean; }): void; buildFallbackError(): Promise; ensurePage({ page, clientOnly, appPaths, match, isApp, }: { page: string; clientOnly: boolean; appPaths?: ReadonlyArray | null; isApp?: boolean; match?: RouteMatch; }): Promise; } export {};