(dir)
| 88 | }, 150); |
| 89 | } |
| 90 | |
| 91 | function addWatcher(dir) { |
| 92 | const watcher = watch(dir, (eventType, filename) => { |
| 93 | const changedPath = filename ? path.join(dir, filename.toString()) : dir; |
| 94 | |
| 95 | if (eventType === 'rename') { |
| 96 | scheduleRescan(); |
| 97 | } |
| 98 | |
| 99 | scheduleRestart(changedPath); |
| 100 | }); |
| 101 | |
| 102 | watcher.on('error', (error) => { |
| 103 | log(`watch error in ${path.relative(packageRoot, dir) || '.'}: ${error.message}`); |
| 104 | scheduleRescan(); |
| 105 | scheduleRestart(dir); |
| 106 | }); |
| 107 | |
| 108 | watchedDirs.set(dir, watcher); |
| 109 | } |
| 110 | |
| 111 | function syncWatchers() { |
no test coverage detected