A build that writes several files into a watched directory fired the same rebuild branch once per file — five copy passes and a stack of style recompiles for a single save. Watcher events are now coalesced, so a burst folds into one run.
Watcher events are coalesced — a multi-file burst triggers one rebuild, not
one per file. Chokidar fires one event per written file, but a single build
rarely writes a single file. A styles entry with sourcemaps and minify on
writes three — .css, .css.map, .min.css — and a post-compile exec
step that rewrites the output makes it four. If those land in a directory
another instance watches (a library's dist/ inside a docs site's copy
source, the setup --quiet was added for), every one of those events ran
the full branch: five Copied N paths passes and three or four style
recompiles per save, all doing the same work on the same files.
The copy and style branches now collect events over a trailing 300ms window
— sized to outlive the 150ms awaitWriteFinish settle between files of one
burst — and run once when the burst goes quiet. The window keeps the paths,
so the per-file behavior survives: a css-only burst still hot-swaps each
stylesheet in place, anything else still escalates to one full reload.
Browser refreshes were already folded this way — reload() has debounced
since the livereload server stopped fs-watching. Now the work feeding the
refresh is folded too. One save, one compile, one copy, one refresh.