(dir)
| 65 | const seen = new Set(); |
| 66 | |
| 67 | function addDirectory(dir) { |
| 68 | if (seen.has(dir)) return; |
| 69 | seen.add(dir); |
| 70 | |
| 71 | const watcher = watch(dir, (event, filename) => { |
| 72 | if (!filename) { |
| 73 | scheduleRestart(); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | const path = join(dir, filename.toString()); |
| 78 | if (event === "rename") maybeAddDirectory(path); |
| 79 | scheduleRestart(); |
| 80 | }); |
| 81 | watchers.push(watcher); |
| 82 | |
| 83 | for (const entry of readdirSync(dir)) { |
| 84 | maybeAddDirectory(join(dir, entry)); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | function maybeAddDirectory(path) { |
| 89 | try { |
no test coverage detected