MCPcopy
hub / github.com/vitejs/vite / isWatched

Function isWatched

playground/hmr-ssr/__tests__/hmr-ssr.spec.ts:1076–1088  ·  view source on GitHub ↗
(server: ViteDevServer, watchedFile: string)

Source from the content-addressed store, hash-verified

1074}
1075
1076function isWatched(server: ViteDevServer, watchedFile: string) {
1077 const watched = server.watcher.getWatched()
1078 for (const [dir, files] of Object.entries(watched)) {
1079 const unixDir = slash(dir)
1080 for (const file of files) {
1081 const filePath = posix.join(unixDir, file)
1082 if (filePath.includes(watchedFile)) {
1083 return true
1084 }
1085 }
1086 }
1087 return false
1088}
1089
1090function waitForWatcher(server: ViteDevServer, watched: string) {
1091 return new Promise<void>((resolve) => {

Callers 1

checkWatchedFunction · 0.85

Calls 2

getWatchedMethod · 0.80
slashFunction · 0.50

Tested by

no test coverage detected