@simplysm/core-node 13.0.98 → 13.0.100

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 +74 -18
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @simplysm/core-node
2
2
 
3
- Core module (node) -- Node.js utilities for file system, path, watching, and workers.
3
+ Simplysm package - Core module (node). Node.js utilities for file system operations, path manipulation, file watching, and type-safe worker threads.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,20 +8,83 @@ Core module (node) -- Node.js utilities for file system, path, watching, and wor
8
8
  npm install @simplysm/core-node
9
9
  ```
10
10
 
11
- ## Exports
11
+ ## API Overview
12
12
 
13
- All utilities are re-exported from the package entry point:
13
+ ### File System Utils (`fsx` namespace)
14
14
 
15
- ```typescript
16
- import { fsx, pathx, FsWatcher, Worker, createWorker } from "@simplysm/core-node";
17
- ```
15
+ | API | Type | Description |
16
+ |-----|------|-------------|
17
+ | `existsSync` | function | Check if a file or directory exists (sync) |
18
+ | `exists` | function | Check if a file or directory exists (async) |
19
+ | `mkdirSync` | function | Create a directory recursively (sync) |
20
+ | `mkdir` | function | Create a directory recursively (async) |
21
+ | `rmSync` | function | Delete a file or directory (sync) |
22
+ | `rm` | function | Delete a file or directory with retries (async) |
23
+ | `copySync` | function | Copy a file or directory with optional filter (sync) |
24
+ | `copy` | function | Copy a file or directory with optional filter (async) |
25
+ | `readSync` | function | Read a file as UTF-8 string (sync) |
26
+ | `read` | function | Read a file as UTF-8 string (async) |
27
+ | `readBufferSync` | function | Read a file as Buffer (sync) |
28
+ | `readBuffer` | function | Read a file as Buffer (async) |
29
+ | `readJsonSync` | function | Read a JSON file using JsonConvert (sync) |
30
+ | `readJson` | function | Read a JSON file using JsonConvert (async) |
31
+ | `writeSync` | function | Write data to a file, auto-creates parent dirs (sync) |
32
+ | `write` | function | Write data to a file, auto-creates parent dirs (async) |
33
+ | `writeJsonSync` | function | Write data to a JSON file (sync) |
34
+ | `writeJson` | function | Write data to a JSON file (async) |
35
+ | `readdirSync` | function | Read directory contents (sync) |
36
+ | `readdir` | function | Read directory contents (async) |
37
+ | `statSync` | function | Get file info, follows symlinks (sync) |
38
+ | `stat` | function | Get file info, follows symlinks (async) |
39
+ | `lstatSync` | function | Get file info, no symlink follow (sync) |
40
+ | `lstat` | function | Get file info, no symlink follow (async) |
41
+ | `globSync` | function | Search files by glob pattern (sync) |
42
+ | `glob` | function | Search files by glob pattern (async) |
43
+ | `clearEmptyDirectory` | function | Recursively delete empty directories |
44
+ | `findAllParentChildPathsSync` | function | Search for glob matches traversing parent dirs (sync) |
45
+ | `findAllParentChildPaths` | function | Search for glob matches traversing parent dirs (async) |
46
+
47
+ -> See [docs/fs.md](./docs/fs.md) for details.
48
+
49
+ ### Path Utils (`pathx` namespace)
50
+
51
+ | API | Type | Description |
52
+ |-----|------|-------------|
53
+ | `NormPath` | type | Brand type for normalized path |
54
+ | `posix` | function | Convert to POSIX-style path (backslash to forward slash) |
55
+ | `changeFileDirectory` | function | Change the directory of a file path |
56
+ | `basenameWithoutExt` | function | Get filename without extension |
57
+ | `isChildPath` | function | Check if a path is a child of another path |
58
+ | `norm` | function | Normalize path to absolute NormPath |
59
+ | `filterByTargets` | function | Filter files by target path list |
60
+
61
+ -> See [docs/path.md](./docs/path.md) for details.
18
62
 
19
- - **`fsx`** -- File system utilities (namespace). See [docs/fs.md](docs/fs.md)
20
- - **`pathx`** -- Path utilities (namespace). See [docs/path.md](docs/path.md)
21
- - **`FsWatcher`** -- Chokidar-based file system watcher. See [docs/features.md](docs/features.md)
22
- - **Worker / createWorker** -- Type-safe worker_threads wrapper. See [docs/worker.md](docs/worker.md)
63
+ ### Features
23
64
 
24
- ## Quick Start
65
+ | API | Type | Description |
66
+ |-----|------|-------------|
67
+ | `FsWatcherEvent` | type | File change event type (`add`, `addDir`, `change`, `unlink`, `unlinkDir`) |
68
+ | `FsWatcherChangeInfo` | interface | File change information (`event`, `path`) |
69
+ | `FsWatcher` | class | Chokidar-based file watcher with event merging |
70
+
71
+ -> See [docs/features.md](./docs/features.md) for details.
72
+
73
+ ### Worker System
74
+
75
+ | API | Type | Description |
76
+ |-----|------|-------------|
77
+ | `WorkerModule` | interface | Worker module type structure for type inference |
78
+ | `PromisifyMethods` | type | Maps method return values to Promise |
79
+ | `WorkerProxy` | type | Proxy type with promisified methods + on/off/terminate |
80
+ | `WorkerRequest` | interface | Internal worker request message |
81
+ | `WorkerResponse` | type | Internal worker response message |
82
+ | `Worker` | object | Type-safe Worker wrapper with `create()` factory |
83
+ | `createWorker` | function | Worker factory for use in worker threads |
84
+
85
+ -> See [docs/worker.md](./docs/worker.md) for details.
86
+
87
+ ## Usage Examples
25
88
 
26
89
  ```typescript
27
90
  import { fsx, pathx, FsWatcher, Worker, createWorker } from "@simplysm/core-node";
@@ -47,10 +110,3 @@ const worker = Worker.create<typeof import("./worker")>("./worker.ts");
47
110
  const result = await worker.add(10, 20);
48
111
  await worker.terminate();
49
112
  ```
50
-
51
- ## Documentation
52
-
53
- - [File System Utilities](docs/fs.md)
54
- - [Path Utilities](docs/path.md)
55
- - [Features (FsWatcher)](docs/features.md)
56
- - [Worker](docs/worker.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/core-node",
3
- "version": "13.0.98",
3
+ "version": "13.0.100",
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.98"
28
+ "@simplysm/core-common": "13.0.100"
29
29
  }
30
30
  }