(cwd: string)
| 26 | } |
| 27 | |
| 28 | export function initializeFileChangedWatcher(cwd: string): void { |
| 29 | if (initialized) return |
| 30 | initialized = true |
| 31 | currentCwd = cwd |
| 32 | |
| 33 | const config = getHooksConfigFromSnapshot() |
| 34 | hasEnvHooks = |
| 35 | (config?.CwdChanged?.length ?? 0) > 0 || |
| 36 | (config?.FileChanged?.length ?? 0) > 0 |
| 37 | |
| 38 | if (hasEnvHooks) { |
| 39 | registerCleanup(async () => dispose()) |
| 40 | } |
| 41 | |
| 42 | const paths = resolveWatchPaths(config) |
| 43 | if (paths.length === 0) return |
| 44 | |
| 45 | startWatching(paths) |
| 46 | } |
| 47 | |
| 48 | function resolveWatchPaths( |
| 49 | config?: ReturnType<typeof getHooksConfigFromSnapshot>, |
no test coverage detected