fs-realpath-native 1.0.5 → 1.0.6

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,16 @@
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.6](https://github.com/bluelovers/ws-iconv/compare/fs-realpath-native@1.0.5...fs-realpath-native@1.0.6) (2026-03-02)
7
+
8
+
9
+
10
+ ### 📚 Documentation
11
+
12
+ * 為檔案系統相關套件新增雙語 JSDoc 註解與型別標註 ([83f3845](https://github.com/bluelovers/ws-iconv/commit/83f38456ccc0f5eca4f2a6505bee4caf7e634ba6))
13
+
14
+
15
+
6
16
  ## [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
17
 
8
18
  **Note:** Version bump only for package fs-realpath-native
package/index.d.ts CHANGED
@@ -1,15 +1,106 @@
1
+ /**
2
+ * fs-realpath-native - 檔案系統實體路徑處理
3
+ *
4
+ * 這個模組提供了檔案系統實體路徑處理的功能,包括同步和異步操作,以及錯誤處理。
5
+ *
6
+ * @module fs-realpath-native
7
+ * @author bluelovers
8
+ */
1
9
  import { BufferEncodingOption, EncodingOption, PathLike, realpathSync } from 'fs';
10
+ /** 同步解析實體路徑函數 */
2
11
  export declare const fsRealpathNativeSync: typeof realpathSync.native;
12
+ /**
13
+ * 異步解析實體路徑
14
+ *
15
+ * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。
16
+ *
17
+ * @param {PathLike} path 要解析的路徑
18
+ * @param {EncodingOption} [options] 編碼選項
19
+ * @returns {Promise<string>} Promise,解析為字串
20
+ */
3
21
  export declare function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;
22
+ /**
23
+ * 異步解析實體路徑
24
+ *
25
+ * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。
26
+ *
27
+ * @param {PathLike} path 要解析的路徑
28
+ * @param {BufferEncodingOption} options 編碼選項
29
+ * @returns {Promise<Buffer>} Promise,解析為緩衝區
30
+ */
4
31
  export declare function fsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
32
+ /**
33
+ * 異步解析實體路徑
34
+ *
35
+ * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。
36
+ *
37
+ * @param {PathLike} path 要解析的路徑
38
+ * @param {EncodingOption} [options] 編碼選項
39
+ * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區
40
+ */
5
41
  export declare function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
6
42
  /**
43
+ * 嘗試解析實體路徑(同步)
44
+ *
45
+ * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
46
+ *
47
+ * @param {PathLike} path 要解析的路徑
48
+ * @param {EncodingOption} [options] 編碼選項
49
+ * @returns {string} 解析後的路徑或原路徑
7
50
  * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts
8
51
  */
9
52
  export declare function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string;
53
+ /**
54
+ * 嘗試解析實體路徑(同步)
55
+ *
56
+ * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
57
+ *
58
+ * @param {PathLike} path 要解析的路徑
59
+ * @param {BufferEncodingOption} options 編碼選項
60
+ * @returns {Buffer} 解析後的路徑或原路徑
61
+ * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts
62
+ */
10
63
  export declare function tryFsRealpathNativeSync(path: PathLike, options: BufferEncodingOption): Buffer;
64
+ /**
65
+ * 嘗試解析實體路徑(同步)
66
+ *
67
+ * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
68
+ *
69
+ * @param {PathLike} path 要解析的路徑
70
+ * @param {EncodingOption} [options] 編碼選項
71
+ * @returns {string | Buffer} 解析後的路徑或原路徑
72
+ * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts
73
+ */
11
74
  export declare function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string | Buffer;
75
+ /**
76
+ * 嘗試解析實體路徑(異步)
77
+ *
78
+ * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
79
+ *
80
+ * @param {PathLike} path 要解析的路徑
81
+ * @param {EncodingOption} [options] 編碼選項
82
+ * @returns {Promise<string>} Promise,解析為字串
83
+ */
12
84
  export declare function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;
85
+ /**
86
+ * 嘗試解析實體路徑(異步)
87
+ *
88
+ * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
89
+ *
90
+ * @param {PathLike} path 要解析的路徑
91
+ * @param {BufferEncodingOption} options 編碼選項
92
+ * @returns {Promise<Buffer>} Promise,解析為緩衝區
93
+ */
13
94
  export declare function tryFsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
95
+ /**
96
+ * 嘗試解析實體路徑(異步)
97
+ *
98
+ * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
99
+ *
100
+ * @param {PathLike} path 要解析的路徑
101
+ * @param {EncodingOption} [options] 編碼選項
102
+ * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區
103
+ */
14
104
  export declare function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
105
+ /** 預設導出 - 嘗試解析實體路徑(同步)函數 */
15
106
  export default tryFsRealpathNativeSync;
package/index.js CHANGED
@@ -1,27 +1,70 @@
1
1
  "use strict";
2
+ /**
3
+ * fs-realpath-native - 檔案系統實體路徑處理
4
+ *
5
+ * 這個模組提供了檔案系統實體路徑處理的功能,包括同步和異步操作,以及錯誤處理。
6
+ *
7
+ * @module fs-realpath-native
8
+ * @author bluelovers
9
+ */
2
10
  Object.defineProperty(exports, "__esModule", { value: true });
3
11
  exports.fsRealpathNativeSync = void 0;
4
12
  exports.fsRealpathNativeAsync = fsRealpathNativeAsync;
5
13
  exports.tryFsRealpathNativeSync = tryFsRealpathNativeSync;
6
14
  exports.tryFsRealpathNativeAsync = tryFsRealpathNativeAsync;
7
15
  const fs_1 = require("fs");
16
+ /** 同步解析實體路徑函數 */
8
17
  exports.fsRealpathNativeSync = fs_1.realpathSync.native;
18
+ /**
19
+ * 異步解析實體路徑
20
+ *
21
+ * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。
22
+ *
23
+ * @param {PathLike} path 要解析的路徑
24
+ * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項
25
+ * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區
26
+ */
9
27
  async function fsRealpathNativeAsync(path, options) {
28
+ // 使用同步函數來實現異步功能
10
29
  return (0, exports.fsRealpathNativeSync)(path, options);
11
30
  }
31
+ /**
32
+ * 嘗試解析實體路徑(同步)
33
+ *
34
+ * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
35
+ *
36
+ * @param {PathLike} path 要解析的路徑
37
+ * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項
38
+ * @returns {string | Buffer} 解析後的路徑或原路徑
39
+ * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts
40
+ */
12
41
  function tryFsRealpathNativeSync(path, options) {
13
42
  try {
43
+ // 嘗試解析實體路徑
14
44
  path = fs_1.realpathSync.native(path, options);
15
45
  }
16
46
  catch (error) {
47
+ // 如果錯誤不是因為路徑不存在,則重新拋出錯誤
17
48
  if (error.code !== 'ENOENT') {
18
49
  throw error;
19
50
  }
20
51
  }
52
+ // 返回解析後的路徑或原路徑
21
53
  return path;
22
54
  }
55
+ /**
56
+ * 嘗試解析實體路徑(異步)
57
+ *
58
+ * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。
59
+ *
60
+ * @param {PathLike} path 要解析的路徑
61
+ * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項
62
+ * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區
63
+ */
23
64
  async function tryFsRealpathNativeAsync(path, options) {
65
+ // 使用同步函數來實現異步功能
24
66
  return tryFsRealpathNativeSync(path, options);
25
67
  }
68
+ /** 預設導出 - 嘗試解析實體路徑(同步)函數 */
26
69
  exports.default = tryFsRealpathNativeSync;
27
70
  //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA8CH,sDAMC;AA6CD,0DAkBC;AAyCD,4DAIC;AA9JD,2BAAkF;AAElF,iBAAiB;AACJ,QAAA,oBAAoB,GAAG,iBAAY,CAAC,MAAM,CAAC;AAgCxD;;;;;;;;GAQG;AACI,KAAK,UAAU,qBAAqB,CAAC,IAAc,EACzD,OAA+C;IAG/C,gBAAgB;IAChB,OAAO,IAAA,4BAAoB,EAAC,IAAI,EAAE,OAAc,CAAC,CAAA;AAClD,CAAC;AAmCD;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,IAAc,EAAE,OAA+C;IAEtG,IACA,CAAC;QACA,WAAW;QACX,IAAI,GAAG,iBAAY,CAAC,MAAM,CAAC,IAAI,EAAE,OAAc,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAU,EACjB,CAAC;QACA,wBAAwB;QACxB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAC3B,CAAC;YACA,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED,eAAe;IACf,OAAO,IAAW,CAAC;AACpB,CAAC;AAgCD;;;;;;;;GAQG;AACI,KAAK,UAAU,wBAAwB,CAAC,IAAc,EAAE,OAA+C;IAE7G,gBAAgB;IAChB,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAc,CAAC,CAAA;AACrD,CAAC;AAED,4BAA4B;AAC5B,kBAAe,uBAAuB,CAAA","sourcesContent":["/**\n * fs-realpath-native - 檔案系統實體路徑處理\n * \n * 這個模組提供了檔案系統實體路徑處理的功能,包括同步和異步操作,以及錯誤處理。\n * \n * @module fs-realpath-native\n * @author bluelovers\n */\n\nimport { BufferEncodingOption, EncodingOption, PathLike, realpathSync } from 'fs';\n\n/** 同步解析實體路徑函數 */\nexport const fsRealpathNativeSync = realpathSync.native;\n\n/**\n * 異步解析實體路徑\n * \n * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {Promise<string>} Promise,解析為字串\n */\nexport async function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;\n/**\n * 異步解析實體路徑\n * \n * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption} options 編碼選項\n * @returns {Promise<Buffer>} Promise,解析為緩衝區\n */\nexport async function fsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;\n/**\n * 異步解析實體路徑\n * \n * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區\n */\nexport async function fsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;\n/**\n * 異步解析實體路徑\n * \n * 這個函數會異步解析指定路徑的實體路徑,支援不同的編碼選項。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項\n * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區\n */\nexport async function fsRealpathNativeAsync(path: PathLike,\n\toptions?: BufferEncodingOption | EncodingOption\n): Promise<string | Buffer>\n{\n\t// 使用同步函數來實現異步功能\n\treturn fsRealpathNativeSync(path, options as any)\n}\n\n/**\n * 嘗試解析實體路徑(同步)\n * \n * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {string} 解析後的路徑或原路徑\n * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts\n */\nexport function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string;\n/**\n * 嘗試解析實體路徑(同步)\n * \n * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption} options 編碼選項\n * @returns {Buffer} 解析後的路徑或原路徑\n * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts\n */\nexport function tryFsRealpathNativeSync(path: PathLike, options: BufferEncodingOption): Buffer;\n/**\n * 嘗試解析實體路徑(同步)\n * \n * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {string | Buffer} 解析後的路徑或原路徑\n * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts\n */\nexport function tryFsRealpathNativeSync(path: PathLike, options?: EncodingOption): string | Buffer;\n/**\n * 嘗試解析實體路徑(同步)\n * \n * 這個函數會嘗試解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項\n * @returns {string | Buffer} 解析後的路徑或原路徑\n * @see https://github.com/facebook/jest/blob/main/packages/jest-util/src/tryRealpath.ts\n */\nexport function tryFsRealpathNativeSync(path: PathLike, options?: BufferEncodingOption | EncodingOption): string | Buffer\n{\n\ttry\n\t{\n\t\t// 嘗試解析實體路徑\n\t\tpath = realpathSync.native(path, options as any);\n\t}\n\tcatch (error: any)\n\t{\n\t\t// 如果錯誤不是因為路徑不存在,則重新拋出錯誤\n\t\tif (error.code !== 'ENOENT')\n\t\t{\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t// 返回解析後的路徑或原路徑\n\treturn path as any;\n}\n\n/**\n * 嘗試解析實體路徑(異步)\n * \n * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {Promise<string>} Promise,解析為字串\n */\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string>;\n/**\n * 嘗試解析實體路徑(異步)\n * \n * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption} options 編碼選項\n * @returns {Promise<Buffer>} Promise,解析為緩衝區\n */\nexport async function tryFsRealpathNativeAsync(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;\n/**\n * 嘗試解析實體路徑(異步)\n * \n * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {EncodingOption} [options] 編碼選項\n * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區\n */\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;\n/**\n * 嘗試解析實體路徑(異步)\n * \n * 這個函數會嘗試異步解析指定路徑的實體路徑,如果路徑不存在則返回原路徑,不拋出錯誤。\n * \n * @param {PathLike} path 要解析的路徑\n * @param {BufferEncodingOption | EncodingOption} [options] 編碼選項\n * @returns {Promise<string | Buffer>} Promise,解析為字串或緩衝區\n */\nexport async function tryFsRealpathNativeAsync(path: PathLike, options?: BufferEncodingOption | EncodingOption): Promise<string | Buffer>\n{\n\t// 使用同步函數來實現異步功能\n\treturn tryFsRealpathNativeSync(path, options as any)\n}\n\n/** 預設導出 - 嘗試解析實體路徑(同步)函數 */\nexport default tryFsRealpathNativeSync\n\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fs-realpath-native",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "File system real path resolution with sync/async operations and error handling / 檔案系統實體路徑處理,支援同步/異步操作和錯誤處理",
5
5
  "keywords": [
6
6
  "create-by-yarn-tool"
@@ -62,5 +62,5 @@
62
62
  "sort-package-json": "yarn-tool sort",
63
63
  "tsc:showConfig": "ynpx get-current-tsconfig -p"
64
64
  },
65
- "gitHead": "6bcfe6a585ad7e5657a40a5b0727c6281b564b60"
65
+ "gitHead": "6c690c4123ff9db0f807fbc9a05f509a832aee69"
66
66
  }