Home / Function/ isPortAvailable() — vite Function Reference

isPortAvailable() — vite Function Reference

Architecture documentation for the isPortAvailable() function in http.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  985bbb1d_5299_33eb_c131_28499ef4678b["isPortAvailable()"]
  695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"]
  985bbb1d_5299_33eb_c131_28499ef4678b -->|defined in| 695bc011_d16d_4322_2fef_1a59a092ee32
  de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f["httpServerStart()"]
  de8a40a8_9bd5_6c8d_7e7e_82549c3ddf5f -->|calls| 985bbb1d_5299_33eb_c131_28499ef4678b
  42db6b86_156c_c702_dc0d_98ceb7dfb6c1["tryListen()"]
  985bbb1d_5299_33eb_c131_28499ef4678b -->|calls| 42db6b86_156c_c702_dc0d_98ceb7dfb6c1
  style 985bbb1d_5299_33eb_c131_28499ef4678b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/http.ts lines 168–175

async function isPortAvailable(port: number): Promise<boolean> {
  for (const host of wildcardHosts) {
    // Gracefully handle errors (e.g., IPv6 disabled on the system)
    const available = await tryListen(port, host).catch(() => true)
    if (!available) return false
  }
  return true
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does isPortAvailable() do?
isPortAvailable() is a function in the vite codebase, defined in packages/vite/src/node/http.ts.
Where is isPortAvailable() defined?
isPortAvailable() is defined in packages/vite/src/node/http.ts at line 168.
What does isPortAvailable() call?
isPortAvailable() calls 1 function(s): tryListen.
What calls isPortAvailable()?
isPortAvailable() is called by 1 function(s): httpServerStart.

Analyze Your Own Codebase

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

Try Supermodel Free