UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

52 lines 1.61 kB
/** * Socket server for the first TypeScript language service worker * * The first worker to start creates a socket server that other workers can connect to. * This allows sharing a single TypeScript language service across all Next.js worker processes. * * On Unix systems, this uses Unix domain sockets. * On Windows, this uses named pipes (which Node.js net module supports transparently). */ import type { WorkerRequest, WorkerResponse } from "./worker.mjs"; /** * Socket server that handles requests from other workers */ export declare class SocketServer { private server; private socketPath; private connections; private requestHandler; /** * Request queue to serialize processTypes calls. * The TypeScript language service is a singleton that uses setRootFiles() * on each call — concurrent requests would thrash the program cache. */ private requestQueue; private constructor(); /** * Create and initialize a socket server */ static create(requestHandler: (request: WorkerRequest) => Promise<WorkerResponse>, socketDir?: string): Promise<SocketServer>; /** * Start the socket server */ start(): Promise<void>; /** * Handle incoming client connection */ private handleConnection; /** * Handle incoming message from client. * Requests are serialized through a queue to prevent concurrent processTypes * calls from thrashing the singleton TypeScript language service. */ private handleMessage; /** * Send response to client */ private sendResponse; /** * Shutdown the server */ shutdown(): void; }