@simplysm/core-node 13.0.12 → 13.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -220,11 +220,11 @@ const configs = await fsFindAllParentChildPaths(
220
220
 
221
221
  ### FsWatcher (`features/fs-watcher`)
222
222
 
223
- A chokidar-based file system change detection wrapper. It merges events that occur within a short time and invokes callbacks.
223
+ A chokidar-based file system change detection wrapper with glob pattern support. It merges events that occur within a short time and invokes callbacks.
224
224
 
225
225
  | API | Description |
226
226
  |-----|-------------|
227
- | `FsWatcher.watch(paths, options?)` | Starts file watching (static, async). Waits until chokidar's `ready` event and returns an `FsWatcher` instance. |
227
+ | `FsWatcher.watch(paths, options?)` | Starts file watching (static, async). `paths` can be file paths or glob patterns (e.g., `"src/**/*.ts"`). Waits until chokidar's `ready` event and returns an `FsWatcher` instance. |
228
228
  | `watcher.onChange(opt, cb)` | Registers a file change event handler. Set event merge wait time (ms) with `opt.delay`. Supports chaining. |
229
229
  | `watcher.close()` | Stops file watching. |
230
230
  | `FsWatcherEvent` | Event type: `"add"` \| `"addDir"` \| `"change"` \| `"unlink"` \| `"unlinkDir"` |
@@ -245,8 +245,8 @@ When multiple events occur for the same file within a short time, only the final
245
245
  ```typescript
246
246
  import { FsWatcher } from "@simplysm/core-node";
247
247
 
248
- // Start file watching
249
- const watcher = await FsWatcher.watch(["src/**/*.ts"]);
248
+ // Start file watching with glob patterns
249
+ const watcher = await FsWatcher.watch(["src/**/*.ts", "tests/**/*.spec.ts"]);
250
250
 
251
251
  // Register change event handler (merge events within 300ms)
252
252
  watcher.onChange({ delay: 300 }, (changes) => {
@@ -356,6 +356,7 @@ await worker.terminate();
356
356
  - All functions throw errors wrapped in `SdError` to include path information.
357
357
  - `fsRm` (async) retries up to 6 times (500ms intervals) for transient errors like file locks, but `fsRmSync` (sync) fails immediately without retries.
358
358
  - In `fsCopy`/`fsCopySync`, the `filter` function is not applied to the top-level `sourcePath`, and returning `false` for a directory skips that directory and all its children.
359
+ - `FsWatcher` supports glob patterns (e.g., `"src/**/*.ts"`) by extracting the base directory and filtering matched files. The glob matching is performed using minimatch pattern matching.
359
360
  - `FsWatcher` internally enforces `ignoreInitial: true`. If you pass `ignoreInitial: false`, the callback will be called with an empty array on the first `onChange` call, but the actual initial file list will not be included.
360
361
  - Worker automatically runs TypeScript worker files through `tsx` in development environment (`.ts` files). In production environment (`.js`), it creates Workers directly.
361
362
  - This package depends on `@simplysm/core-common` and uses `jsonParse`/`jsonStringify` for JSON processing.
@@ -368,6 +369,7 @@ await worker.terminate();
368
369
  | `chokidar` | File system change detection (`FsWatcher`) |
369
370
  | `consola` | Logging |
370
371
  | `glob` | Glob pattern file search (`fsGlob`, `fsGlobSync`) |
372
+ | `minimatch` | Glob pattern matching for `FsWatcher` |
371
373
  | `tsx` | Running TypeScript worker files in development environment |
372
374
 
373
375
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/core-node",
3
- "version": "13.0.12",
3
+ "version": "13.0.13",
4
4
  "description": "심플리즘 패키지 - 코어 모듈 (node)",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -23,6 +23,6 @@
23
23
  "glob": "^13.0.3",
24
24
  "minimatch": "^10.2.0",
25
25
  "tsx": "^4.21.0",
26
- "@simplysm/core-common": "13.0.12"
26
+ "@simplysm/core-common": "13.0.13"
27
27
  }
28
28
  }