All files / src/dev dev-server.d.ts

0% Statements 0/3
100% Branches 1/1
100% Functions 1/1
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121                                                                                                                                                                                                                                                 
// Type definitions for Coherent.js Development Server
 
export interface DevServerOptions {
  /**
   * Port to run the development server on
   * @default 3000
   */
  port?: number;
  
  /**
   * Host to bind the development server to
   * @default 'localhost'
   */
  host?: string;
  
  /**
   * Glob patterns to watch for file changes
   */
  watchPaths?: string[];
  
  /**
   * Paths to serve static files from
   * @default ['public']
   */
  staticPaths?: string[];
  
  /**
   * Enable or disable WebSocket for hot reload
   * @default true
   */
  enableWebSocket?: boolean;
  
  /**
   * Enable or disable file watching
   * @default true
   */
  enableWatching?: boolean;
  
  /**
   * Open browser automatically when server starts
   * @default true
   */
  openBrowser?: boolean;
}
 
export interface DevServerStats {
  /** Server start time */
  startTime: Date;
  
  /** Number of connected WebSocket clients */
  clients: number;
  
  /** Watched file patterns */
  watchPaths: string[];
  
  /** Static file paths */
  staticPaths: string[];
}
 
export class DevServer {
  /**
   * Create a new development server instance
   * @param options Configuration options
   */
  constructor(options?: DevServerOptions);
  
  /**
   * Setup Express middleware
   */
  setupMiddleware(): void;
  
  /**
   * Setup WebSocket server for hot reload
   */
  setupWebSocket(): void;
  
  /**
   * Setup Express routes
   */
  setupRoutes(): void;
  
  /**
   * Start watching files for changes
   */
  startWatching(): void;
  
  /**
   * Broadcast reload message to all connected clients
   */
  broadcastReload(): void;
  
  /**
   * Start the development server
   */
  start(): Promise<void>;
  
  /**
   * Stop the development server
   */
  stop(): Promise<void>;
  
  /**
   * Get server statistics
   */
  getStats(): DevServerStats;
  
  /**
   * Add a path to watch
   * @param path Glob pattern to watch
   */
  addWatchPath(path: string): void;
  
  /**
   * Remove a path from watching
   * @param path Glob pattern to remove
   */
  removeWatchPath(path: string): void;
}
 
export default DevServer;