-
-
Notifications
You must be signed in to change notification settings - Fork 219
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
in #2807 (@jasonlyu123) (specifically, in refactor(check): clarify snapshot callback and simplify directory watching; ignore .crush), @aewing introduced a regression that can cause svelte-check
's watch mode to inadvertently ignore directories.
In that commit, this code was added:
// If new dir is a parent of existing ones, unwatch children
const toRemove: string[] = [];
for (const existing of this.currentWatchedDirs) {
if (this.isSubdir(existing, dir)) {
toRemove.push(existing);
}
}
if (toRemove.length) {
this.watcher.unwatch(toRemove);
this.watcher
refers to a chokidar
watcher instance.
It's not explicitly documented in Chokidar's documentation, but unwatch
ing a child absolute path, followed by add
ing a parent absolute path, causes the child paths to remain ignored.
Reproduction
import { watch } from 'chokidar';
const { dirname } = import.meta;
const a = `${dirname}/a`;
const b = `${a}/b`;
watch(b).unwatch(b).add(a).on(`change`, () => console.log(`change!`));
Note that the change
handler runs for everything in the a
directory, except for changes that happen in the b
subdirectory.
Expected behaviour
svelte-check
should properly handle parent and child directories when passing to chokidar
.
System Info
- OS: macOS
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working