* 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)
| 571 | * — it drops node_modules/dist/.git churn before any sync is scheduled. |
| 572 | */ |
| 573 | private handleChange(rel: string): void { |
| 574 | if (!rel || rel === '.' || rel.startsWith('..')) return; |
| 575 | if (this.isAlwaysIgnored(rel)) return; |
| 576 | if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel)) return; |
| 577 | if (!isSourceFile(rel, loadExtensionOverrides(this.projectRoot))) { |
| 578 | this.maybeScheduleForRemovedDir(rel); |
| 579 | return; |
| 580 | } |
| 581 | |
| 582 | logDebug('File change detected', { file: rel }); |
| 583 | if (this.ready) { |
| 584 | const now = Date.now(); |
| 585 | const existing = this.pendingFiles.get(rel); |
| 586 | this.pendingFiles.set(rel, { |
| 587 | firstSeenMs: existing?.firstSeenMs ?? now, |
| 588 | lastSeenMs: now, |
| 589 | }); |
| 590 | } |
| 591 | this.scheduleSync(); |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * A deleted DIRECTORY arrives as one event on the directory's own path — |
no test coverage detected