import { WebSocket as NodeWebSocket } from 'ws'; import http from 'http'; /** * Base broadcast message that plugins may extend. * Includes an index signature so plugin-defined keys are allowed. */ export interface BroadcastMessage { /** At minimum every message must have a type string */ type: string; [key: string]: unknown; } /** * Core HMR message shape — narrows `type` to known HMR events * and adds optional fields. It extends BroadcastMessage so it's * assignable to the generic constraint. */ export interface HMRMessage extends BroadcastMessage { type: 'update' | 'error' | 'reload'; path?: string; message?: string; stack?: string; } /** * BroadcastManager — Shared WebSocket utility for dev, preview, and SSR servers. * Generic over message type T which defaults to HMRMessage. */ export declare class BroadcastManager { private wss; private clients; constructor(server: http.Server); broadcast(msg: T): void; send(ws: NodeWebSocket, msg: T): void; getClientCount(): number; close(): void; }