feat(watchers): add Rust-powered watcher backend with runtime fallback and cross-platform test coverage

This commit is contained in:
2026-03-23 14:15:31 +00:00
parent ca9a66e03e
commit 7def7020c6
26 changed files with 10383 additions and 2870 deletions

View File

@@ -218,6 +218,30 @@ export class DenoWatcher implements IWatcher {
type: wasDirectory ? 'unlinkDir' : 'unlink',
path: filePath
});
} else if (kind === 'any' || kind === 'other') {
// Deno may emit 'any' for various operations — determine the actual type
const stats = await this.statSafe(filePath);
if (stats) {
if (this.watchedFiles.has(filePath)) {
// Known file → treat as change
if (!stats.isDirectory()) {
this.events$.next({ type: 'change', path: filePath, stats });
}
} else {
// New file → treat as add
this.watchedFiles.add(filePath);
const eventType: TWatchEventType = stats.isDirectory() ? 'addDir' : 'add';
this.events$.next({ type: eventType, path: filePath, stats });
}
} else {
// File no longer exists → treat as remove
const wasDirectory = this.isKnownDirectory(filePath);
this.watchedFiles.delete(filePath);
this.events$.next({
type: wasDirectory ? 'unlinkDir' : 'unlink',
path: filePath
});
}
}
} catch (error: any) {
this.events$.next({ type: 'error', path: filePath, error });