hmr.ts — vite Source File
Architecture documentation for hmr.ts, a typescript file in the vite codebase. 43 imports, 9 dependents.
Entity Profile
Dependency Diagram
graph LR 18db4f26_79f1_5b7d_b291_4feeaf95538f["hmr.ts"] e967e251_52a9_6dc8_9c8c_4a18ba126272["invokeMethods.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> e967e251_52a9_6dc8_9c8c_4a18ba126272 d53ca642_087e_0a26_5b0f_e0a3d92124ea["InvokeMethods"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> d53ca642_087e_0a26_5b0f_e0a3d92124ea 2fc97643_e8e5_1e4c_d3b6_86dbedccbf1a["InvokeResponseData"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 2fc97643_e8e5_1e4c_d3b6_86dbedccbf1a 09164238_20c3_8da3_bec2_7caf2e1f3da9["InvokeSendData"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 09164238_20c3_8da3_bec2_7caf2e1f3da9 545df65b_7f67_94d3_e2e8_a592d5e64b8f["constants.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 545df65b_7f67_94d3_e2e8_a592d5e64b8f 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 031bc221_67a8_c579_f2bf_bb30a08beeb2 23a2e685_f919_9578_27ba_bde71c122058["createDebugger"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 23a2e685_f919_9578_27ba_bde71c122058 74ee9886_2456_3964_e90e_5fc67925229d["monotonicDateNow"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 74ee9886_2456_3964_e90e_5fc67925229d a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> a4adb1a7_cf54_091f_eb63_8217e684a8e1 3bf7f0de_2a9f_6f04_cead_0321b3b7af01["index.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 3bf7f0de_2a9f_6f04_cead_0321b3b7af01 58719e23_70bd_67e0_1ed8_f61c19ec725b["getHookHandler"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 58719e23_70bd_67e0_1ed8_f61c19ec725b 5a7b98e4_4eb1_dfca_508b_2d43e2a077e6["importAnalysis.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 5a7b98e4_4eb1_dfca_508b_2d43e2a077e6 d55a610e_3478_7f18_6b7c_e3a26e51e28d["isExplicitImportRequired"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> d55a610e_3478_7f18_6b7c_e3a26e51e28d 7fa76fc1_cb1b_cf98_0900_1217276f6616["env.ts"] 18db4f26_79f1_5b7d_b291_4feeaf95538f --> 7fa76fc1_cb1b_cf98_0900_1217276f6616 style 18db4f26_79f1_5b7d_b291_4feeaf95538f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fsp from 'node:fs/promises'
import path from 'node:path'
import { EventEmitter } from 'node:events'
import colors from 'picocolors'
import type { RollupError } from 'rolldown'
import type { CustomPayload, HotPayload, Update } from '#types/hmrPayload'
import type {
InvokeMethods,
InvokeResponseData,
InvokeSendData,
} from '../../shared/invokeMethods'
import { CLIENT_DIR } from '../constants'
import { createDebugger, monotonicDateNow, normalizePath } from '../utils'
import type { InferCustomEventPayload, ViteDevServer } from '..'
import { getHookHandler } from '../plugins'
import { isExplicitImportRequired } from '../plugins/importAnalysis'
import { getEnvFilesForMode } from '../env'
import type { Environment } from '../environment'
import { withTrailingSlash, wrapId } from '../../shared/utils'
import type { Plugin } from '../plugin'
import {
ignoreDeprecationWarnings,
warnFutureDeprecation,
} from '../deprecations'
import type { EnvironmentModuleNode } from './moduleGraph'
import type { ModuleNode } from './mixedModuleGraph'
import type { DevEnvironment } from './environment'
import { prepareError } from './middlewares/error'
import {
BasicMinimalPluginContext,
basePluginContextMeta,
} from './pluginContainer'
import type { HttpServer } from '.'
import { restartServerWithUrls } from '.'
export const debugHmr: ((...args: any[]) => any) | undefined =
createDebugger('vite:hmr')
const whitespaceRE = /\s/
const normalizedClientDir = normalizePath(CLIENT_DIR)
export interface HmrOptions {
protocol?: string
host?: string
port?: number
clientPort?: number
path?: string
timeout?: number
overlay?: boolean
server?: HttpServer
}
export interface HotUpdateOptions {
type: 'create' | 'update' | 'delete'
file: string
timestamp: number
modules: Array<EnvironmentModuleNode>
read: () => string | Promise<string>
server: ViteDevServer
// ... (1088 more lines)
Domain
Subdomains
Functions
- Promise()
- areAllImportsAccepted()
- args()
- createServerHotChannel()
- data()
- error()
- getShortName()
- getSortedHotUpdatePlugins()
- getSortedPluginsByHotUpdateHook()
- handleHMRUpdate()
- handlePrunedModules()
- isNodeWithinCircularImports()
- lexAcceptedHmrDeps()
- lexAcceptedHmrExports()
- normalizeHmrUrl()
- normalizeHotChannel()
- propagateUpdate()
- readModifiedFile()
- updateModules()
Types
Dependencies
- .
- ..
- BasicMinimalPluginContext
- DevEnvironment
- Environment
- EnvironmentModuleNode
- InvokeMethods
- InvokeResponseData
- InvokeSendData
- ModuleNode
- Plugin
- constants.ts
- createDebugger
- deprecations.ts
- env.ts
- environment.ts
- environment.ts
- error.ts
- getEnvFilesForMode
- getHookHandler
- hmrPayload
- ignoreDeprecationWarnings
- importAnalysis.ts
- index.ts
- invokeMethods.ts
- isExplicitImportRequired
- mixedModuleGraph.ts
- moduleGraph.ts
- monotonicDateNow
- node:events
- node:path
- normalizePath
- picocolors
- plugin.ts
- pluginContainer.ts
- prepareError
- promises
- rolldown
- utils.ts
- utils.ts
- warnFutureDeprecation
- withTrailingSlash
- wrapId
Imported By
- packages/vite/src/node/server/environment.ts
- packages/vite/src/node/server/environments/fullBundleEnvironment.ts
- packages/vite/src/node/plugins/importAnalysis.ts
- packages/vite/src/node/server/index.ts
- packages/vite/src/node/plugin.ts
- packages/vite/src/node/server/environments/runnableEnvironment.ts
- packages/vite/src/node/ssr/runtime/serverModuleRunner.ts
- packages/vite/src/node/ssr/ssrModuleLoader.ts
- packages/vite/src/node/server/ws.ts
Source
Frequently Asked Questions
What does hmr.ts do?
hmr.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in hmr.ts?
hmr.ts defines 19 function(s): Promise, areAllImportsAccepted, args, createServerHotChannel, data, error, getShortName, getSortedHotUpdatePlugins, getSortedPluginsByHotUpdateHook, handleHMRUpdate, and 9 more.
What does hmr.ts depend on?
hmr.ts imports 43 module(s): ., .., BasicMinimalPluginContext, DevEnvironment, Environment, EnvironmentModuleNode, InvokeMethods, InvokeResponseData, and 35 more.
What files import hmr.ts?
hmr.ts is imported by 9 file(s): environment.ts, fullBundleEnvironment.ts, importAnalysis.ts, index.ts, plugin.ts, runnableEnvironment.ts, serverModuleRunner.ts, ssrModuleLoader.ts, and 1 more.
Where is hmr.ts in the architecture?
hmr.ts is located at packages/vite/src/node/server/hmr.ts (domain: ViteCore, subdomain: ConfigEngine, directory: packages/vite/src/node/server).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free