/** * Shared adapter helpers for webdev framework adapters. * Extracted from duplicated code in Vite and Next.js adapters. * * Exported as '@winstonfassett/webdev-gateway/helpers' */ export { makeServerId, makeProjectId } from './registry.js'; export declare function setInternalLogging(value: boolean): void; export interface RegistrationPayload { serverId: string; type: string; port: number; pid: number; directory: string; key?: string; } export interface RegistrationResult { serverId: string; logDir: string; } /** * Register a dev server with the gateway. Returns result on success, null on failure. */ export declare function registerWithGateway(gatewayUrl: string, payload: RegistrationPayload): Promise; /** * Register with gateway, retrying every 5s until successful. * Calls onRegistered callback once registered. */ export declare function registerWithRetry(gatewayUrl: string, payload: RegistrationPayload, onRegistered?: (result: RegistrationResult) => void): { cancel: () => void; }; /** * Patch console.log/warn/error/info/debug to forward to the gateway via WebSocket. */ export declare function patchConsole(gatewayUrl: string, serverId: string): Promise; export interface DevEventsHandle { send: (payload: any) => void; close: () => void; } export interface ConnectDevEventsOptions { /** Registration payload to re-send on reconnect (gateway restart recovery) */ registrationPayload?: RegistrationPayload; /** Callback when re-registration succeeds after reconnect */ onReregistered?: (result: RegistrationResult) => void; } /** * Connect to the gateway's dev-events WebSocket for build/HMR events. * Returns a handle to send events and close the connection. * * When `registrationPayload` is provided, the adapter will re-register * with the gateway on every WebSocket reconnect. This handles the case * where the gateway restarts and loses its in-memory server registry. */ export declare function connectDevEvents(gatewayUrl: string, serverId: string, options?: ConnectDevEventsOptions): Promise; /** * Ensure the gateway is running. If not, spawn it as a detached process. * Returns once the gateway is reachable. */ export declare function ensureGateway(gatewayUrl: string): Promise; /** * Stop a previously auto-started gateway. */ export declare function stopGateway(gatewayUrl: string): boolean; //# sourceMappingURL=adapter-helpers.d.ts.map