client.ts — vite Source File
Architecture documentation for client.ts, a typescript file in the vite codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 85908ff5_4d12_826d_8235_531f91538758["client.ts"] 56154347_d0e1_1403_ce0e_25508620362c["hmr.ts"] 85908ff5_4d12_826d_8235_531f91538758 --> 56154347_d0e1_1403_ce0e_25508620362c 59034bde_6f4e_fe6a_b2ce_a002a0aa10b4["HMRClient"] 85908ff5_4d12_826d_8235_531f91538758 --> 59034bde_6f4e_fe6a_b2ce_a002a0aa10b4 d86a8333_3c9a_922b_57b2_926575326289["HMRContext"] 85908ff5_4d12_826d_8235_531f91538758 --> d86a8333_3c9a_922b_57b2_926575326289 a469d907_868c_e1c2_3f7a_7aaf42cc6a7a["moduleRunnerTransport.ts"] 85908ff5_4d12_826d_8235_531f91538758 --> a469d907_868c_e1c2_3f7a_7aaf42cc6a7a 0dc29000_7d3b_f918_1785_133ec8e42b03["createWebSocketModuleRunnerTransport"] 85908ff5_4d12_826d_8235_531f91538758 --> 0dc29000_7d3b_f918_1785_133ec8e42b03 f9bbebfe_9cba_07d9_a804_95e8776eaea9["normalizeModuleRunnerTransport"] 85908ff5_4d12_826d_8235_531f91538758 --> f9bbebfe_9cba_07d9_a804_95e8776eaea9 028d7bbe_154e_0f3f_836a_0c92f8021168["hmrHandler.ts"] 85908ff5_4d12_826d_8235_531f91538758 --> 028d7bbe_154e_0f3f_836a_0c92f8021168 78565810_c101_62d5_659a_9f46c4ad9d97["createHMRHandler"] 85908ff5_4d12_826d_8235_531f91538758 --> 78565810_c101_62d5_659a_9f46c4ad9d97 e11865a0_84fe_cc5a_9b23_3f69f2300ca4["overlay.ts"] 85908ff5_4d12_826d_8235_531f91538758 --> e11865a0_84fe_cc5a_9b23_3f69f2300ca4 033d9b63_5269_212a_e5d9_bd61baab6243["ErrorOverlay"] 85908ff5_4d12_826d_8235_531f91538758 --> 033d9b63_5269_212a_e5d9_bd61baab6243 77c85b6c_bf49_d2f4_491a_9a26696af6e5["runtime-types"] 85908ff5_4d12_826d_8235_531f91538758 --> 77c85b6c_bf49_d2f4_491a_9a26696af6e5 ccb8a028_b1ec_3743_cfbe_0ac5315bc7c3["hmrPayload"] 85908ff5_4d12_826d_8235_531f91538758 --> ccb8a028_b1ec_3743_cfbe_0ac5315bc7c3 2afeac62_c9af_73a3_ec8c_6b0d5e385665["hot"] 85908ff5_4d12_826d_8235_531f91538758 --> 2afeac62_c9af_73a3_ec8c_6b0d5e385665 388f93e3_4362_57a0_e23b_020cc8b703b2["env"] 85908ff5_4d12_826d_8235_531f91538758 --> 388f93e3_4362_57a0_e23b_020cc8b703b2 style 85908ff5_4d12_826d_8235_531f91538758 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type {
DevRuntime as DevRuntimeType,
Messenger,
} from 'rolldown/experimental/runtime-types'
import type { ErrorPayload, HotPayload } from '#types/hmrPayload'
import type { ViteHotContext } from '#types/hot'
import { HMRClient, HMRContext } from '../shared/hmr'
import {
createWebSocketModuleRunnerTransport,
normalizeModuleRunnerTransport,
} from '../shared/moduleRunnerTransport'
import { createHMRHandler } from '../shared/hmrHandler'
import { ErrorOverlay, cspNonce, overlayId } from './overlay'
import '@vite/env'
// injected by the hmr plugin when served
declare const __BASE__: string
declare const __SERVER_HOST__: string
declare const __HMR_PROTOCOL__: string | null
declare const __HMR_HOSTNAME__: string | null
declare const __HMR_PORT__: number | null
declare const __HMR_DIRECT_TARGET__: string
declare const __HMR_BASE__: string
declare const __HMR_TIMEOUT__: number
declare const __HMR_ENABLE_OVERLAY__: boolean
declare const __WS_TOKEN__: string
declare const __BUNDLED_DEV__: boolean
console.debug('[vite] connecting...')
const importMetaUrl = new URL(import.meta.url)
// use server configuration, then fallback to inference
const serverHost = __SERVER_HOST__
const socketProtocol =
__HMR_PROTOCOL__ || (importMetaUrl.protocol === 'https:' ? 'wss' : 'ws')
const hmrPort = __HMR_PORT__
const socketHost = `${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${
hmrPort || importMetaUrl.port
}${__HMR_BASE__}`
const directSocketHost = __HMR_DIRECT_TARGET__
const base = __BASE__ || '/'
const hmrTimeout = __HMR_TIMEOUT__
const wsToken = __WS_TOKEN__
const isBundleMode = __BUNDLED_DEV__
const transport = normalizeModuleRunnerTransport(
(() => {
let wsTransport = createWebSocketModuleRunnerTransport({
createConnection: () =>
new WebSocket(
`${socketProtocol}://${socketHost}?token=${wsToken}`,
'vite-hmr',
),
pingInterval: hmrTimeout,
})
return {
async connect(handlers) {
try {
// ... (601 more lines)
Domain
Subdomains
Functions
- cleanUrl()
- clearErrorOverlay()
- createErrorOverlay()
- createHotContext()
- debounceReload()
- handleMessage()
- hasErrorOverlay()
- hmrClient()
- hmrClient.debug()
- hmrClient.error()
- injectQuery()
- newVisibility()
- pingWorkerContentMain()
- removeStyle()
- transport()
- updateStyle()
- waitForSuccessfulPing()
- waitForSuccessfulPingInternal()
- wrappedSocket.send()
Classes
Types
Dependencies
Source
Frequently Asked Questions
What does client.ts do?
client.ts is a source file in the vite codebase, written in typescript. It belongs to the HMRClient domain, WebSocketTransport subdomain.
What functions are defined in client.ts?
client.ts defines 19 function(s): cleanUrl, clearErrorOverlay, createErrorOverlay, createHotContext, debounceReload, handleMessage, hasErrorOverlay, hmrClient, hmrClient.debug, hmrClient.error, and 9 more.
What does client.ts depend on?
client.ts imports 14 module(s): ErrorOverlay, HMRClient, HMRContext, createHMRHandler, createWebSocketModuleRunnerTransport, env, hmr.ts, hmrHandler.ts, and 6 more.
Where is client.ts in the architecture?
client.ts is located at packages/vite/src/client/client.ts (domain: HMRClient, subdomain: WebSocketTransport, directory: packages/vite/src/client).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free