* Shared change handler for both watch strategies. `rel` is a * project-relative POSIX path. Applies the ignore + source-file filters and, * for a real source change, records it as pending (#403) and schedules a * debounced sync. * * The recursive (macOS/Windows) watcher reports event
(rel: string)
| 533 | * — it drops node_modules/dist/.git churn before any sync is scheduled. |
| 534 | */ |
| 535 | private handleChange(rel: string): void { |
| 536 | if (!rel || rel === '.' || rel.startsWith('..')) return; |
| 537 | if (this.isAlwaysIgnored(rel)) return; |
| 538 | if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel)) return; |
| 539 | if (!isSourceFile(rel, loadExtensionOverrides(this.projectRoot))) return; |
| 540 | |
| 541 | logDebug('File change detected', { file: rel }); |
| 542 | if (this.ready) { |
| 543 | const now = Date.now(); |
| 544 | const existing = this.pendingFiles.get(rel); |
| 545 | this.pendingFiles.set(rel, { |
| 546 | firstSeenMs: existing?.firstSeenMs ?? now, |
| 547 | lastSeenMs: now, |
| 548 | }); |
| 549 | } |
| 550 | this.scheduleSync(); |
| 551 | } |
| 552 | |
| 553 | /** Close and forget the watch for a directory that errored/was removed. */ |
| 554 | private unwatchDir(dir: string): void { |
no test coverage detected