feat(server)!: use parcel watcher
Description
Decided to give https://github.com/vitejs/vite/issues/13593 another shot before deciding if we should fit it into Vite 5. But with the state of the implementation, I don't think it's feasible (for now).
This PR implements a hybrid @parcel/watcher + fs.watch approach, where the former is used for root recursive watching, and the latter for non-recursive watching. https://github.com/parcel-bundler/watcher/issues/92
It also implements chokidar's watcher interface for better compatibility. Ultimately it feels like I'm re-implementing chokidar and would be better as a standalone library, but it's easier to test this way for now.
Additional context
WIP TODO:
- Implement unfinished API
- Make sure it's compatible with chokidar
getWatchedcompatibleunwatchandaddon the same path should continue watchingunlinkDirnot correctly detected
- Make tests pass
- Update docs
What is the purpose of this pull request?
- [ ] Bug fix
- [x] New Feature
- [ ] Documentation update
- [ ] Other
Run & review this pull request in StackBlitz Codeflow.
Short FYI that also a polling solution is important (what Chokidar does with CHOKIDAR_USEPOLLING=1). I faced this again this week, running development under a VM with mounts to my desktop account. Such mounts don't usually pass change notifications, but the said env.var. has worked nice.
Closing this for now as I haven't got to finishing this and requires a large rebase. It would still be helpful for others who like to bring this across the line though. My notes about parcel watcher at https://github.com/vitejs/vite/issues/13593#issuecomment-1776906216 still remain.