@simplysm/core-node 13.0.95 → 13.0.96
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.
- package/README.md +16 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ fsx.rmSync("/path/to/target");
|
|
|
50
50
|
// 복사 (필터 지원)
|
|
51
51
|
// 필터는 자식 경로에만 적용, 최상위 sourcePath는 필터링 대상이 아님
|
|
52
52
|
// 디렉토리에 false를 반환하면 해당 디렉토리와 모든 하위 내용을 건너뜀
|
|
53
|
+
// sourcePath가 존재하지 않으면 아무 동작 없이 반환
|
|
53
54
|
await fsx.copy(src, dst, (absPath) => !absPath.includes("node_modules"));
|
|
54
55
|
fsx.copySync(src, dst);
|
|
55
56
|
|
|
@@ -61,6 +62,7 @@ const config = await fsx.readJson<Config>("/path/config.json"); // JSON 파싱 (
|
|
|
61
62
|
// 쓰기 (부모 디렉토리 자동 생성)
|
|
62
63
|
await fsx.write("/path/to/file.txt", content); // string | Uint8Array
|
|
63
64
|
await fsx.writeJson("/path/to/config.json", data, { space: 2 });
|
|
65
|
+
// writeJson의 options: { replacer?, space? }
|
|
64
66
|
|
|
65
67
|
// 디렉토리 읽기
|
|
66
68
|
const entries = await fsx.readdir("/path/to/dir"); // string[]
|
|
@@ -132,6 +134,12 @@ const watcher = await FsWatcher.watch([
|
|
|
132
134
|
"/project/lib/**/*.js", // glob 패턴
|
|
133
135
|
]);
|
|
134
136
|
|
|
137
|
+
// chokidar 옵션 전달 가능 (ignoreInitial은 내부적으로 항상 true로 설정됨)
|
|
138
|
+
const watcher2 = await FsWatcher.watch(["/project/src"], {
|
|
139
|
+
depth: 2,
|
|
140
|
+
ignored: /node_modules/,
|
|
141
|
+
});
|
|
142
|
+
|
|
135
143
|
// 변경 이벤트 핸들러 등록
|
|
136
144
|
// delay ms 동안 이벤트를 모아 한 번에 콜백 호출
|
|
137
145
|
watcher.onChange({ delay: 300 }, (changes: FsWatcherChangeInfo[]) => {
|
|
@@ -149,6 +157,7 @@ await watcher.close();
|
|
|
149
157
|
- `add` + `change` -> `add` (생성 직후 수정은 생성으로 처리)
|
|
150
158
|
- `add` + `unlink` -> 제거 (생성 후 즉시 삭제는 무변경)
|
|
151
159
|
- `unlink` + `add` -> `add` (삭제 후 재생성은 생성으로 처리)
|
|
160
|
+
- `unlink` + `change` -> `add` (삭제 후 변경은 생성으로 처리)
|
|
152
161
|
- `unlinkDir` + `addDir` -> `addDir`
|
|
153
162
|
- 그 외 -> 마지막 이벤트로 덮어쓰기
|
|
154
163
|
|
|
@@ -209,11 +218,12 @@ await worker.terminate();
|
|
|
209
218
|
```
|
|
210
219
|
|
|
211
220
|
**특징:**
|
|
212
|
-
- `.ts` 파일은 tsx를 통해 자동 실행 (개발 환경)
|
|
221
|
+
- `.ts` 파일은 tsx를 통해 자동 실행 (개발 환경), `.js` 파일은 직접 Worker 생성 (프로덕션)
|
|
213
222
|
- UUID 기반 요청 추적으로 동시 요청 지원
|
|
214
223
|
- Worker 크래시 시 대기 중인 모든 요청 자동 reject
|
|
215
224
|
- Worker 내 `process.stdout.write`는 메인 스레드로 자동 전달
|
|
216
225
|
- `@simplysm/core-common`의 `transfer`를 사용하여 메시지 직렬화
|
|
226
|
+
- `file://` URL 경로와 절대 경로 모두 지원
|
|
217
227
|
|
|
218
228
|
---
|
|
219
229
|
|
|
@@ -227,9 +237,9 @@ await worker.terminate();
|
|
|
227
237
|
| `existsSync` | `(targetPath: string) => boolean` | 동기 버전 |
|
|
228
238
|
| `mkdir` | `(targetPath: string) => Promise<void>` | 디렉토리 재귀 생성 |
|
|
229
239
|
| `mkdirSync` | `(targetPath: string) => void` | 동기 버전 |
|
|
230
|
-
| `rm` | `(targetPath: string) => Promise<void>` | 삭제 (
|
|
240
|
+
| `rm` | `(targetPath: string) => Promise<void>` | 삭제 (6회 재시도, 500ms 간격) |
|
|
231
241
|
| `rmSync` | `(targetPath: string) => void` | 동기 버전 (재시도 없음) |
|
|
232
|
-
| `copy` | `(src, dst, filter?) => Promise<void>` | 파일/디렉토리 복사 |
|
|
242
|
+
| `copy` | `(src, dst, filter?) => Promise<void>` | 파일/디렉토리 복사 (async 시 병렬 처리) |
|
|
233
243
|
| `copySync` | `(src, dst, filter?) => void` | 동기 버전 |
|
|
234
244
|
| `read` | `(targetPath: string) => Promise<string>` | UTF-8 텍스트 읽기 |
|
|
235
245
|
| `readSync` | `(targetPath: string) => string` | 동기 버전 |
|
|
@@ -247,8 +257,8 @@ await worker.terminate();
|
|
|
247
257
|
| `statSync` | `(targetPath: string) => fs.Stats` | 동기 버전 |
|
|
248
258
|
| `lstat` | `(targetPath: string) => Promise<fs.Stats>` | 파일 정보 (심링크 자체) |
|
|
249
259
|
| `lstatSync` | `(targetPath: string) => fs.Stats` | 동기 버전 |
|
|
250
|
-
| `glob` | `(pattern, options
|
|
251
|
-
| `globSync` | `(pattern, options
|
|
260
|
+
| `glob` | `(pattern, options?: GlobOptions) => Promise<string[]>` | Glob 패턴 검색 (절대 경로 반환) |
|
|
261
|
+
| `globSync` | `(pattern, options?: GlobOptions) => string[]` | 동기 버전 |
|
|
252
262
|
| `clearEmptyDirectory` | `(dirPath: string) => Promise<void>` | 빈 디렉토리 재귀 삭제 |
|
|
253
263
|
| `findAllParentChildPaths` | `(childGlob, fromPath, rootPath?) => Promise<string[]>` | 상위 디렉토리 탐색 |
|
|
254
264
|
| `findAllParentChildPathsSync` | `(childGlob, fromPath, rootPath?) => string[]` | 동기 버전 |
|
|
@@ -268,7 +278,7 @@ await worker.terminate();
|
|
|
268
278
|
|
|
269
279
|
| 멤버 | 시그니처 | 설명 |
|
|
270
280
|
|------|----------|------|
|
|
271
|
-
| `static watch` | `(paths: string[], options
|
|
281
|
+
| `static watch` | `(paths: string[], options?: ChokidarOptions) => Promise<FsWatcher>` | 감시 시작 (ready까지 대기) |
|
|
272
282
|
| `onChange` | `(opt: { delay?: number }, cb) => this` | 변경 이벤트 핸들러 등록 (체이닝 가능) |
|
|
273
283
|
| `close` | `() => Promise<void>` | 감시 종료 |
|
|
274
284
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/core-node",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.96",
|
|
4
4
|
"description": "Simplysm package - Core module (node)",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"glob": "^13.0.6",
|
|
26
26
|
"minimatch": "^10.2.4",
|
|
27
27
|
"tsx": "^4.21.0",
|
|
28
|
-
"@simplysm/core-common": "13.0.
|
|
28
|
+
"@simplysm/core-common": "13.0.96"
|
|
29
29
|
}
|
|
30
30
|
}
|