feat(watchers): add Rust-powered watcher backend with runtime fallback and cross-platform test coverage
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user