Home / Type/ PreviewServer Type — vite Architecture

PreviewServer Type — vite Architecture

Architecture documentation for the PreviewServer type/interface in preview.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  5269a4be_cbb4_c413_4eb9_9ea227ac8b76["PreviewServer"]
  e49f0ff7_5101_3a1d_5a1f_33fae58eea2d["preview.ts"]
  5269a4be_cbb4_c413_4eb9_9ea227ac8b76 -->|defined in| e49f0ff7_5101_3a1d_5a1f_33fae58eea2d
  style 5269a4be_cbb4_c413_4eb9_9ea227ac8b76 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/preview.ts lines 77–116

export interface PreviewServer {
  /**
   * The resolved vite config object
   */
  config: ResolvedConfig
  /**
   * Stop the server.
   */
  close(): Promise<void>
  /**
   * A connect app instance.
   * - Can be used to attach custom middlewares to the preview server.
   * - Can also be used as the handler function of a custom http server
   *   or as a middleware in any connect-style Node.js frameworks
   *
   * https://github.com/senchalabs/connect#use-middleware
   */
  middlewares: Connect.Server
  /**
   * native Node http server instance
   */
  httpServer: HttpServer
  /**
   * The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
   * if the server is not listening on any port.
   */
  resolvedUrls: ResolvedServerUrls | null
  /**
   * Print server urls
   */
  printUrls(): void
  /**
   * Bind CLI shortcuts
   */
  bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void
  /**
   * @internal
   */
  _shortcutsState?: ShortcutsState<PreviewServer>
}

Frequently Asked Questions

What is the PreviewServer type?
PreviewServer is a type/interface in the vite codebase, defined in packages/vite/src/node/preview.ts.
Where is PreviewServer defined?
PreviewServer is defined in packages/vite/src/node/preview.ts at line 77.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free