Repository navigation
refactor(@angular/build): guard closed chokidar operations and remove v5 unlink workaround - #34471
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies the Chokidar file watcher implementation by removing complex baseline and unlink logic, and adds safety checks to prevent errors when adding or removing paths after the watcher is closed. The review feedback correctly points out that 'auto' is not a supported value for Chokidar's backend option and suggests using undefined instead to let Chokidar automatically select the appropriate backend.
… v5 unlink workaround Chokidar 6 makes `FSWatcher.close()` terminal, throwing synchronously if `watcher.add()` is called once closing has started. Guard `add()`, `remove()`, `scheduleBaselineCheck()`, and `checkChokidarBaselines()` against `watcher.closed`, and clear tracked file state when the watcher is closed. Additionally, replace the deprecated `usePolling` and `interval` Chokidar options with `backend` and `pollingInterval`. Remove the Chokidar 5 `unlink` re-watch workaround and its corresponding baseline check branch, as Chokidar 6 natively awaits recreated paths from their nearest existing ancestor across all watched directories.
1b2ac1d to
a929bea
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Chokidar 6 makes
FSWatcher.close()terminal, throwing synchronously ifwatcher.add()is called once closing has started. Guardadd(),remove(),scheduleBaselineCheck(), andcheckChokidarBaselines()againstwatcher.closed, and clear tracked file state when the watcher is closed.Additionally, replace the deprecated
usePollingandintervalChokidar options withbackendandpollingInterval. Remove the Chokidar 5unlinkre-watch workaround and its corresponding baseline check branch, as Chokidar 6 natively awaits recreated paths from their nearest existing ancestor across all watched directories.