ensureWatchedFile() — vite Function Reference
Architecture documentation for the ensureWatchedFile() function in utils.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 0a6fbb70_77d3_9873_8417_b1e4ffba2651["ensureWatchedFile()"] 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] 0a6fbb70_77d3_9873_8417_b1e4ffba2651 -->|defined in| 031bc221_67a8_c579_f2bf_bb30a08beeb2 bf4a41be_9dbf_35be_2072_4283cd478ae7["transformWithEsbuild()"] bf4a41be_9dbf_35be_2072_4283cd478ae7 -->|calls| 0a6fbb70_77d3_9873_8417_b1e4ffba2651 047aa0d5_25bc_9eb0_8c41_99a2be202642["transformWithOxc()"] 047aa0d5_25bc_9eb0_8c41_99a2be202642 -->|calls| 0a6fbb70_77d3_9873_8417_b1e4ffba2651 c7929a5b_9791_180a_9c0b_4f479fb4cf3f["devHtmlHook()"] c7929a5b_9791_180a_9c0b_4f479fb4cf3f -->|calls| 0a6fbb70_77d3_9873_8417_b1e4ffba2651 31d5b2c5_2267_3dde_fc85_e309cf15eb0d["addWatchFile()"] 31d5b2c5_2267_3dde_fc85_e309cf15eb0d -->|calls| 0a6fbb70_77d3_9873_8417_b1e4ffba2651 bdac5327_5085_933f_41df_0fc270134a38["loadAndTransform()"] bdac5327_5085_933f_41df_0fc270134a38 -->|calls| 0a6fbb70_77d3_9873_8417_b1e4ffba2651 1a3bec7b_1a11_316f_5831_a0535b829bbf["withTrailingSlash()"] 0a6fbb70_77d3_9873_8417_b1e4ffba2651 -->|calls| 1a3bec7b_1a11_316f_5831_a0535b829bbf style 0a6fbb70_77d3_9873_8417_b1e4ffba2651 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/utils.ts lines 737–753
export function ensureWatchedFile(
watcher: FSWatcher,
file: string | null,
root: string,
): void {
if (
file &&
// only need to watch if out of root
!file.startsWith(withTrailingSlash(root)) &&
// some rollup plugins use null bytes for private resolved Ids
!file.includes('\0') &&
fs.existsSync(file)
) {
// resolve file to normalized system path
watcher.add(path.resolve(file))
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does ensureWatchedFile() do?
ensureWatchedFile() is a function in the vite codebase, defined in packages/vite/src/node/utils.ts.
Where is ensureWatchedFile() defined?
ensureWatchedFile() is defined in packages/vite/src/node/utils.ts at line 737.
What does ensureWatchedFile() call?
ensureWatchedFile() calls 1 function(s): withTrailingSlash.
What calls ensureWatchedFile()?
ensureWatchedFile() is called by 5 function(s): addWatchFile, devHtmlHook, loadAndTransform, transformWithEsbuild, transformWithOxc.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free