fs-realpath-native 1.0.3 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.5](https://github.com/bluelovers/ws-iconv/compare/fs-realpath-native@1.0.4...fs-realpath-native@1.0.5) (2026-03-01)
7
+
8
+ **Note:** Version bump only for package fs-realpath-native
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.4](https://github.com/bluelovers/ws-iconv/compare/fs-realpath-native@1.0.3...fs-realpath-native@1.0.4) (2026-03-01)
15
+
16
+
17
+
18
+ ### 📚 Documentation
19
+
20
+ * 为多个包添加全面的 JSDoc 文档和 README 更新 ([0d149e8](https://github.com/bluelovers/ws-iconv/commit/0d149e856aa9b274aca7fd7562776860c9d00473))
21
+
22
+
23
+ ### ♻️ Chores
24
+
25
+ * Update jest config and add new files for testing ([f370583](https://github.com/bluelovers/ws-iconv/commit/f37058385c7bf24d3d0bc975c752f2f35cfe8356))
26
+
27
+
28
+
6
29
  ## [1.0.3](https://github.com/bluelovers/ws-iconv/compare/fs-realpath-native@1.0.2...fs-realpath-native@1.0.3) (2024-08-29)
7
30
 
8
31
 
package/README.md CHANGED
@@ -1,12 +1,64 @@
1
- # README.md
1
+ # fs-realpath-native
2
2
 
3
-
3
+ File system real path resolution with sync/async operations and error handling.
4
+ 檔案系統實體路徑處理,支援同步/異步操作和錯誤處理。
4
5
 
5
- ## install
6
+ ## Features / 主要功能
7
+
8
+ - Real path resolution / 實體路徑解析
9
+ - Sync and async operations / 同步和異步操作
10
+ - Error handling (ENOENT safe) / 錯誤處理(安全處理路徑不存在)
11
+ - Encoding options support / 支援不同編碼選項
12
+ - Compatible with Node.js fs module / 完全相容於 Node.js fs 模組
13
+
14
+ ## Install / 安裝
6
15
 
7
16
  ```bash
8
- yarn add fs-realpath
9
- yarn-tool add fs-realpath
10
- yt add fs-realpath
17
+ yarn add fs-realpath-native
18
+ yarn-tool add fs-realpath-native
19
+ yt add fs-realpath-native
20
+ pnpm add fs-realpath-native
21
+ npm install fs-realpath-native
11
22
  ```
12
23
 
24
+ ## Quick Start / 快速開始
25
+
26
+ ```typescript
27
+ import {
28
+ fsRealpathNativeSync,
29
+ fsRealpathNativeAsync,
30
+ tryFsRealpathNativeSync,
31
+ tryFsRealpathNativeAsync
32
+ } from 'fs-realpath-native';
33
+
34
+ // Synchronous / 同步
35
+ const realPath = fsRealpathNativeSync('./symlink-to-file');
36
+ console.log(realPath);
37
+
38
+ // Asynchronous / 異步
39
+ const realPathAsync = await fsRealpathNativeAsync('./symlink-to-file');
40
+ console.log(realPathAsync);
41
+
42
+ // Safe version (returns original path if not exists) / 安全版本(路徑不存在時返回原路徑)
43
+ const safePath = tryFsRealpathNativeSync('./maybe-not-exists');
44
+ console.log(safePath);
45
+ ```
46
+
47
+ ## API
48
+
49
+ ### `fsRealpathNativeSync(path, options?)`
50
+ Resolves the real path synchronously using native OS methods.
51
+ 使用原生作業系統方法同步解析實體路徑。
52
+
53
+ ### `fsRealpathNativeAsync(path, options?)`
54
+ Resolves the real path asynchronously using native OS methods.
55
+ 使用原生作業系統方法異步解析實體路徑。
56
+
57
+ ### `tryFsRealpathNativeSync(path, options?)`
58
+ Safely resolves the real path synchronously. Returns original path if not exists.
59
+ 安全地同步解析實體路徑。如果路徑不存在則返回原路徑。
60
+
61
+ ### `tryFsRealpathNativeAsync(path, options?)`
62
+ Safely resolves the real path asynchronously. Returns original path if not exists.
63
+ 安全地異步解析實體路徑。如果路徑不存在則返回原路徑。
64
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fs-realpath-native",
3
- "version": "1.0.3",
4
- "description": "",
3
+ "version": "1.0.5",
4
+ "description": "File system real path resolution with sync/async operations and error handling / 檔案系統實體路徑處理,支援同步/異步操作和錯誤處理",
5
5
  "keywords": [
6
6
  "create-by-yarn-tool"
7
7
  ],
@@ -31,6 +31,7 @@
31
31
  "pretest": "echo pretest",
32
32
  "test": "jest --passWithNoTests",
33
33
  "test:jest": "jest --passWithNoTests",
34
+ "test:jest:coverage": "yarn run test:jest -- --coverage",
34
35
  "test:jest:snapshot": "yarn run test:jest -- -u",
35
36
  "test:mocha": "ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"",
36
37
  "test:snapshot": "yarn run test -- -u",
@@ -61,6 +62,5 @@
61
62
  "sort-package-json": "yarn-tool sort",
62
63
  "tsc:showConfig": "ynpx get-current-tsconfig -p"
63
64
  },
64
- "packageManager": "yarn@1.22.19",
65
- "gitHead": "43bcf89adcf481e321b509f7510de10206e8030a"
65
+ "gitHead": "6bcfe6a585ad7e5657a40a5b0727c6281b564b60"
66
66
  }
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAOA,sDAKC;AAQD,0DAeC;AAKD,4DAGC;AA3CD,2BAAkF;AAErE,QAAA,oBAAoB,GAAG,iBAAY,CAAC,MAAM,CAAC;AAKjD,KAAK,UAAU,qBAAqB,CAAC,IAAc,EACzD,OAA+C;IAG/C,OAAO,IAAA,4BAAoB,EAAC,IAAI,EAAE,OAAc,CAAC,CAAA;AAClD,CAAC;AAQD,SAAgB,uBAAuB,CAAC,IAAc,EAAE,OAA+C;IAEtG,IACA,CAAC;QACA,IAAI,GAAG,iBAAY,CAAC,MAAM,CAAC,IAAI,EAAE,OAAc,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAU,EACjB,CAAC;QACA,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC3B,CAAC;YACA,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,OAAO,IAAW,CAAC;AACpB,CAAC;AAKM,KAAK,UAAU,wBAAwB,CAAC,IAAc,EAAE,OAA+C;IAE7G,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAc,CAAC,CAAA;AACrD,CAAC;AAED,kBAAe,uBAAuB,CAAA","sourcesContent":["import { BufferEncodingOption, EncodingOption, PathLike, realpathSync } from 'fs';\n\nexport const fsRealpathNativeSync = realpathSync.native;\n\nexport async function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;\nexport async function fsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;\nexport async function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;\nexport async function fsRealpathNativeAsync(path: PathLike,\n\toptions?: BufferEncodingOption | EncodingOption\n): Promise<string | Buffer>\n{\n\treturn fsRealpathNativeSync(path, options as any)\n}\n\n/**\n * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts\n */\nexport function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string;\nexport function tryFsRealpathNativeSync(path: PathLike, options: BufferEncodingOption): Buffer;\nexport function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string | Buffer;\nexport function tryFsRealpathNativeSync(path: PathLike, options?: BufferEncodingOption | EncodingOption): string | Buffer\n{\n\ttry\n\t{\n\t\tpath = realpathSync.native(path, options as any);\n\t}\n\tcatch (error: any)\n\t{\n\t\tif (error.code !== 'ENOENT')\n\t\t{\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\treturn path as any;\n}\n\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;\nexport async function tryFsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: BufferEncodingOption | EncodingOption): Promise<string | Buffer>\n{\n\treturn tryFsRealpathNativeSync(path, options as any)\n}\n\nexport default tryFsRealpathNativeSync\n"]}