feat(core): Migrate to chokidar 5.x, add picomatch filtering and update test/dev dependencies

This commit is contained in:
2025-11-29 21:05:51 +00:00
parent 21827f06e9
commit 6d02ef3ddc
7 changed files with 2832 additions and 2510 deletions

View File

@@ -1,15 +1,15 @@
# smartchok - Technical Hints
## Chokidar 4.x Migration (2024)
## Chokidar 5.x Migration (2024)
The module has been migrated from `@tempfix/watcher` to `chokidar` 4.x. Key changes:
The module has been migrated to `chokidar` 5.x (from 4.x). Key changes:
### Dependencies
- **Removed**: `@tempfix/watcher` (a fork of fabiospampinato/watcher)
- **Added**: `chokidar` 4.x and `picomatch`
- **Current**: `chokidar` 5.x and `picomatch`
- **Historical**: Was previously using `@tempfix/watcher` before chokidar 4.x
### Why picomatch?
Chokidar 4.x removed built-in glob pattern support. We use `picomatch` to maintain backward compatibility and provide glob pattern matching functionality.
Chokidar 4.x+ removed built-in glob pattern support. We use `picomatch` to maintain backward compatibility and provide glob pattern matching functionality.
### Implementation Details
1. **Glob pattern extraction**: The `getGlobBase()` method extracts base directories from glob patterns
@@ -18,12 +18,16 @@ Chokidar 4.x removed built-in glob pattern support. We use `picomatch` to mainta
4. **Path normalization**: Paths are normalized to handle different formats (with/without leading ./)
### Event Handling
Chokidar 4.x events are mapped 1:1 with smartchok events:
Chokidar 5.x events are mapped 1:1 with smartchok events:
- `add`, `change`, `unlink`: File events
- `addDir`, `unlinkDir`: Directory events
- `addDir`, `unlinkDir`: Directory events
- `error`: Error events
- `raw`: Raw events from underlying watchers
- `ready`: Emitted when initial scan is complete
### Testing
All existing tests pass without modification, confirming backward compatibility is maintained.
All existing tests pass without modification, confirming backward compatibility is maintained.
## Dev Dependencies (2024)
- Using `@git.zone/tstest` v3.x with tapbundle (`import { tap, expect } from '@git.zone/tstest/tapbundle'`)
- Removed deprecated `@push.rocks/tapbundle`