Home / Class/ Clients Class — vite Architecture

Clients Class — vite Architecture

Architecture documentation for the Clients class in fullBundleEnvironment.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  caa9598d_104d_5348_d8f9_91ed5a308516["Clients"]
  f070fb78_2f2a_ef11_0530_d34862fa95ca["fullBundleEnvironment.ts"]
  caa9598d_104d_5348_d8f9_91ed5a308516 -->|defined in| f070fb78_2f2a_ef11_0530_d34862fa95ca
  20693f43_58cf_ecea_9bd8_cc1c093c10f5["setupIfNeeded()"]
  caa9598d_104d_5348_d8f9_91ed5a308516 -->|method| 20693f43_58cf_ecea_9bd8_cc1c093c10f5
  4e748f4a_42c0_e310_88f6_d950ac923c8d["get()"]
  caa9598d_104d_5348_d8f9_91ed5a308516 -->|method| 4e748f4a_42c0_e310_88f6_d950ac923c8d
  66f69099_a55f_0956_bd23_5711ae0c0f21["getAll()"]
  caa9598d_104d_5348_d8f9_91ed5a308516 -->|method| 66f69099_a55f_0956_bd23_5711ae0c0f21
  bbf95bc7_e3ff_942a_e835_fd36a668d237["delete()"]
  caa9598d_104d_5348_d8f9_91ed5a308516 -->|method| bbf95bc7_e3ff_942a_e835_fd36a668d237

Relationship Graph

Source Code

packages/vite/src/node/server/environments/fullBundleEnvironment.ts lines 370–400

class Clients {
  private clientToId = new Map<NormalizedHotChannelClient, string>()
  private idToClient = new Map<string, NormalizedHotChannelClient>()

  setupIfNeeded(client: NormalizedHotChannelClient): string {
    const id = this.clientToId.get(client)
    if (id) return id

    const newId = randomUUID()
    this.clientToId.set(client, newId)
    this.idToClient.set(newId, client)
    return newId
  }

  get(id: string): NormalizedHotChannelClient | undefined {
    return this.idToClient.get(id)
  }

  getAll(): NormalizedHotChannelClient[] {
    return Array.from(this.idToClient.values())
  }

  delete(client: NormalizedHotChannelClient): string | undefined {
    const id = this.clientToId.get(client)
    if (id) {
      this.clientToId.delete(client)
      this.idToClient.delete(id)
      return id
    }
  }
}

Domain

Frequently Asked Questions

What is the Clients class?
Clients is a class in the vite codebase, defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts.
Where is Clients defined?
Clients is defined in packages/vite/src/node/server/environments/fullBundleEnvironment.ts at line 370.

Analyze Your Own Codebase

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

Try Supermodel Free