(dir: string)
| 25 | } |
| 26 | |
| 27 | function readDirectorySnapshot(dir: string): Map<string, number> { |
| 28 | const snapshot = new Map<string, number>() |
| 29 | for (const name of fs.readdirSync(dir)) { |
| 30 | try { |
| 31 | snapshot.set(name, fs.statSync(`${dir}/${name}`).mtimeMs) |
| 32 | } catch { |
| 33 | // File changed between readdir and stat; the next poll will see the stable state. |
| 34 | } |
| 35 | } |
| 36 | return snapshot |
| 37 | } |
| 38 | |
| 39 | function emitWatchEvent(server: RuntimeServer, watchId: string, dir: string, eventType: string, filename?: string): void { |
| 40 | server.supervisor.touchByOwner("fs-watch", watchId) |
no test coverage detected