UNPKG

colyseus

Version:

Multiplayer Framework for Node.js

40 lines (39 loc) 1.42 kB
import { type RoomDefinitions, type ServerOptions, type Transport, type Router } from '@colyseus/core'; import type { Plugin } from 'vite'; export interface ColyseusViteOptions { serverEntry: string; port?: number; quiet?: boolean; /** * Serve the built client files via express.static() in the production * server entry. Adds a SPA fallback that serves index.html for * unmatched GET requests. * * Has no effect in dev mode (Vite serves the frontend). */ serveClient?: boolean; loadWsTransport?: () => Promise<{ WebSocketTransport: new (options?: any) => Transport & { attachToServer(server: any, options?: { filter?: (req: any) => boolean; }): any; }; }>; } type ServerConfig = { options?: ServerOptions; router?: Router; '~rooms'?: RoomDefinitions; }; /** * Production build entry — standalone server that imports the user's * server entry and calls `server.listen()`. */ export declare function createColyseusViteServerEntry(options: ColyseusViteOptions): string; export declare function reloadColyseusViteRooms(importModule: (specifier: string) => Promise<any>, serverEntry: string, currentRoomNames?: string[]): Promise<{ roomNames: string[]; hasRooms: boolean; server: ServerConfig; }>; export declare function colyseus(options: ColyseusViteOptions): Plugin[]; export {};