@visulima/fs 5.0.0-alpha.12 → 5.0.0-alpha.14

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 (195) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE.md +52 -4
  3. package/dist/eol.d.ts +30 -0
  4. package/dist/eol.js +3 -26
  5. package/dist/error.d.ts +243 -13
  6. package/dist/error.js +1 -7
  7. package/dist/glob-parent.d.ts +30 -0
  8. package/dist/glob-parent.js +1 -90
  9. package/dist/glob.d.ts +2 -3
  10. package/dist/glob.js +1 -2
  11. package/dist/index.d.ts +784 -7
  12. package/dist/index.js +1 -38
  13. package/dist/ini.d.ts +63 -3
  14. package/dist/ini.js +1 -4
  15. package/dist/is-glob.d.ts +29 -0
  16. package/dist/is-glob.js +1 -9
  17. package/dist/json5.d.ts +27 -3
  18. package/dist/json5.js +1 -4
  19. package/dist/jsonc.d.ts +58 -3
  20. package/dist/jsonc.js +1 -4
  21. package/dist/match.d.ts +44 -3
  22. package/dist/match.js +1 -15
  23. package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +1 -0
  24. package/dist/packem_shared/DirectoryError-ddlbUV8C.js +1 -0
  25. package/dist/packem_shared/F_OK-CAwY1qU7.js +1 -0
  26. package/dist/packem_shared/JSONError-D7h6PNWc.js +4 -0
  27. package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +1 -0
  28. package/dist/packem_shared/NotFoundError-BPiW0icm.js +1 -0
  29. package/dist/packem_shared/PermissionError-B1Emi5a9.js +1 -0
  30. package/dist/packem_shared/WalkError-Olmh4908.js +1 -0
  31. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  32. package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +1 -0
  33. package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +1 -0
  34. package/dist/packem_shared/build-rm-options-C1R4reBu.js +1 -0
  35. package/dist/packem_shared/collect-2KPTpCdX.js +1 -0
  36. package/dist/packem_shared/collectSync-BX55r_BH.js +1 -0
  37. package/dist/packem_shared/emptyDir-8utO028L.js +1 -0
  38. package/dist/packem_shared/emptyDirSync-Bk5fUX73.js +1 -0
  39. package/dist/packem_shared/ensureDir-CZ4oUFuo.js +1 -0
  40. package/dist/packem_shared/ensureDirSync-CoPWhbjM.js +1 -0
  41. package/dist/packem_shared/ensureFile-CF1cAAyh.js +1 -0
  42. package/dist/packem_shared/ensureFileSync-C3qR6naU.js +1 -0
  43. package/dist/packem_shared/ensureLink-LLLxlGHn.js +1 -0
  44. package/dist/packem_shared/ensureLinkSync-Dh_GtT8F.js +1 -0
  45. package/dist/packem_shared/ensureSymlink-D50kj2zl.js +1 -0
  46. package/dist/packem_shared/ensureSymlinkSync-BbVDPvI4.js +1 -0
  47. package/dist/packem_shared/findUp-BT07y_Me.js +1 -0
  48. package/dist/packem_shared/findUpSync-BvZiYsKJ.js +1 -0
  49. package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +1 -0
  50. package/dist/packem_shared/glob-MHJQjR39.js +1 -0
  51. package/dist/packem_shared/glob-sync.d-p6lOZXnE.d.ts +54 -0
  52. package/dist/packem_shared/globSync-CwzlELgS.js +1 -0
  53. package/dist/packem_shared/index-CYIVJA0W.js +1 -0
  54. package/dist/packem_shared/index-DrapuBsB.js +1 -0
  55. package/dist/packem_shared/index-K-NNTkpb.js +11 -0
  56. package/dist/packem_shared/index-yGx8uzZs.js +1 -0
  57. package/dist/packem_shared/indexToLineColumn-BRSZFC6I-BKj3uzZt.js +6 -0
  58. package/dist/packem_shared/ini-preserve-CXc_xkpG.js +4 -0
  59. package/dist/packem_shared/is-stats-identical-CohsLtWy.js +1 -0
  60. package/dist/packem_shared/isAccessible-CDFxsAAo.js +1 -0
  61. package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +1 -0
  62. package/dist/packem_shared/isFsCaseSensitive-CMZVY1A2.js +1 -0
  63. package/dist/packem_shared/json-error.d-DVILOyHc.d.ts +52 -0
  64. package/dist/packem_shared/jsonc-merge-CQMjx3Vw.js +2 -0
  65. package/dist/packem_shared/move-LmP6P9sn.js +1 -0
  66. package/dist/packem_shared/parseJson-Xx6vHYbv.js +1 -0
  67. package/dist/packem_shared/readFile-BAVMZg5e.js +1 -0
  68. package/dist/packem_shared/readFileSync-CGmzMUF2.js +1 -0
  69. package/dist/packem_shared/readIni-Cfl6HmTS.js +1 -0
  70. package/dist/packem_shared/readIniSync-DPg4UD0P.js +1 -0
  71. package/dist/packem_shared/readJson-kPx68Wv1.js +1 -0
  72. package/dist/packem_shared/readJson5-pXTL9nUE.js +1 -0
  73. package/dist/packem_shared/readJson5Sync-BedQc292.js +1 -0
  74. package/dist/packem_shared/readJsonSync-_HXNI3Se.js +1 -0
  75. package/dist/packem_shared/readJsonc-BzvuAXbT.js +1 -0
  76. package/dist/packem_shared/readJsoncSync-CVG1_QnX.js +1 -0
  77. package/dist/packem_shared/readToml-BO5CZK2P.js +1 -0
  78. package/dist/packem_shared/readTomlSync-1fKo0R52.js +1 -0
  79. package/dist/packem_shared/readYaml-DjK_Vqj1.js +1 -0
  80. package/dist/packem_shared/readYamlSync-C3h6KA2c.js +1 -0
  81. package/dist/packem_shared/remove-DH41Ov_c.js +1 -0
  82. package/dist/packem_shared/removeSync-50OEdnHd.js +1 -0
  83. package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +1 -0
  84. package/dist/packem_shared/sanitize-CU1xmyrg.js +1 -0
  85. package/dist/packem_shared/stripJsonComments-CzNR77MF.js +1 -0
  86. package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +1 -0
  87. package/dist/packem_shared/types.d-BsmmADqx.d.ts +1660 -0
  88. package/dist/packem_shared/walk-D01Qmmvz.js +1 -0
  89. package/dist/packem_shared/walk-include-DCiVAwMP.js +1 -0
  90. package/dist/packem_shared/walkSync-BknSdmKD.js +1 -0
  91. package/dist/packem_shared/writeFile-DNGaDOMX.js +1 -0
  92. package/dist/packem_shared/writeFileSync-CE1i-eMA.js +1 -0
  93. package/dist/packem_shared/writeIni-DG7U4ji0.js +4 -0
  94. package/dist/packem_shared/writeIniSync-Ldt6HFLb.js +4 -0
  95. package/dist/packem_shared/writeJson-BkGlq1Kv.js +4 -0
  96. package/dist/packem_shared/writeJson5-Btud4sQh.js +4 -0
  97. package/dist/packem_shared/writeJson5Sync-Iln3i1IV.js +4 -0
  98. package/dist/packem_shared/writeJsonSync-HndmyvEK.js +4 -0
  99. package/dist/packem_shared/writeJsonc-9oiamG16.js +4 -0
  100. package/dist/packem_shared/writeJsoncSync-BHBziPiK.js +4 -0
  101. package/dist/packem_shared/writeToml-Cj57wZ8B.js +1 -0
  102. package/dist/packem_shared/writeTomlSync-B34ZZp0e.js +1 -0
  103. package/dist/packem_shared/writeYaml-BhQX2yN9.js +1 -0
  104. package/dist/packem_shared/writeYamlSync-DG01FBeC.js +1 -0
  105. package/dist/size.d.ts +244 -0
  106. package/dist/size.js +1 -146
  107. package/dist/toml.d.ts +56 -2
  108. package/dist/toml.js +1 -4
  109. package/dist/utils.d.ts +91 -3
  110. package/dist/utils.js +1 -6
  111. package/dist/yaml.d.ts +2 -3
  112. package/dist/yaml.js +1 -4
  113. package/package.json +39 -40
  114. package/dist/packem_shared/AlreadyExistsError-6Y9hjgMn.js +0 -27
  115. package/dist/packem_shared/DirectoryError-BfYPkIYP.js +0 -27
  116. package/dist/packem_shared/F_OK-MldBaGxb.js +0 -8
  117. package/dist/packem_shared/JSONError-BkHRnInH.js +0 -26
  118. package/dist/packem_shared/NotEmptyError-B21RUlVr.js +0 -27
  119. package/dist/packem_shared/NotFoundError-BIp61X6k.js +0 -27
  120. package/dist/packem_shared/PermissionError-CjoiJgip.js +0 -27
  121. package/dist/packem_shared/WalkError-DER5A43G.js +0 -24
  122. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  123. package/dist/packem_shared/assertValidFileContents-BmcLtsGd.js +0 -7
  124. package/dist/packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js +0 -7
  125. package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +0 -12
  126. package/dist/packem_shared/collect-CqQ3eVab.js +0 -14
  127. package/dist/packem_shared/collectSync-noE08NNv.js +0 -14
  128. package/dist/packem_shared/emptyDir-DnwENOaV.js +0 -46
  129. package/dist/packem_shared/emptyDirSync-6WiHBo8a.js +0 -43
  130. package/dist/packem_shared/ensureDir-DNlPftys.js +0 -53
  131. package/dist/packem_shared/ensureDirSync-DcPZFMy5.js +0 -53
  132. package/dist/packem_shared/ensureFile-BRQpUOUM.js +0 -47
  133. package/dist/packem_shared/ensureFileSync-SBY7A9-C.js +0 -47
  134. package/dist/packem_shared/ensureLink-DJQeauEn.js +0 -55
  135. package/dist/packem_shared/ensureLinkSync-D9RVAglV.js +0 -55
  136. package/dist/packem_shared/ensureSymlink-CoRYDRwr.js +0 -80
  137. package/dist/packem_shared/ensureSymlinkSync-CFimFlgh.js +0 -81
  138. package/dist/packem_shared/findUp-YcNLKdfV.js +0 -84
  139. package/dist/packem_shared/findUpSync-BfA5fheN.js +0 -83
  140. package/dist/packem_shared/get-file-info-type-FD4-jsyg.js +0 -14
  141. package/dist/packem_shared/glob-DY8l7izD.js +0 -5
  142. package/dist/packem_shared/glob-sync.d-BlGjS68e.d.ts +0 -4
  143. package/dist/packem_shared/globSync-5P2KJf_g.js +0 -5
  144. package/dist/packem_shared/index-C8W8sfzP.js +0 -830
  145. package/dist/packem_shared/index-CHM-in-V.js +0 -100
  146. package/dist/packem_shared/index-bhgnhm4u.js +0 -167
  147. package/dist/packem_shared/index-xe4o3cYi.js +0 -1784
  148. package/dist/packem_shared/indexToLineColumn-BUb0GPKl-BF770uX7.js +0 -171
  149. package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +0 -251
  150. package/dist/packem_shared/is-stats-identical-D8FxpvQU.js +0 -3
  151. package/dist/packem_shared/isAccessible-DuVrTNFV.js +0 -38
  152. package/dist/packem_shared/isAccessibleSync-DI8mM0fA.js +0 -38
  153. package/dist/packem_shared/isFsCaseSensitive-DunL7Iry.js +0 -62
  154. package/dist/packem_shared/json-error.d-DgKaeuIf.d.ts +0 -10
  155. package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +0 -72
  156. package/dist/packem_shared/move-DbpW5_vA.js +0 -134
  157. package/dist/packem_shared/parseJson-BIp89Xjo.js +0 -63
  158. package/dist/packem_shared/readFile-Iz7kvCCk.js +0 -65
  159. package/dist/packem_shared/readFileSync-gm9yfIhh.js +0 -54
  160. package/dist/packem_shared/readIni-CJ2xfpjB.js +0 -10
  161. package/dist/packem_shared/readIniSync-9LUjaSSp.js +0 -10
  162. package/dist/packem_shared/readJson-C_rwm-wq.js +0 -22
  163. package/dist/packem_shared/readJson5-mBoTZppy.js +0 -15
  164. package/dist/packem_shared/readJson5Sync-8WS2yUok.js +0 -15
  165. package/dist/packem_shared/readJsonSync-BMEmCcJ6.js +0 -22
  166. package/dist/packem_shared/readJsonc-j-OS-APg.js +0 -28
  167. package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +0 -16
  168. package/dist/packem_shared/readToml-B2MHaSes.js +0 -9
  169. package/dist/packem_shared/readTomlSync-DNbK8NEb.js +0 -9
  170. package/dist/packem_shared/readYaml-D5q2a0e1.js +0 -10
  171. package/dist/packem_shared/readYamlSync-BKX-PAfq.js +0 -10
  172. package/dist/packem_shared/remove-C8_gl3jF.js +0 -39
  173. package/dist/packem_shared/removeSync-BJR_wTwN.js +0 -39
  174. package/dist/packem_shared/resolve-symlink-target-Kh4GovFf.js +0 -16
  175. package/dist/packem_shared/sanitize-BZoLN9Fg.js +0 -205
  176. package/dist/packem_shared/stripJsonComments-vo4k0mpF.js +0 -19
  177. package/dist/packem_shared/to-uint-8-array-Dz2nF1y1.js +0 -19
  178. package/dist/packem_shared/types.d-CYpAhWov.d.ts +0 -145
  179. package/dist/packem_shared/walk-CSZgCuDx.js +0 -124
  180. package/dist/packem_shared/walk-include-CZco7BvN.js +0 -16
  181. package/dist/packem_shared/walkSync-C4Cy28xb.js +0 -123
  182. package/dist/packem_shared/writeFile-B8HX0JIQ.js +0 -81
  183. package/dist/packem_shared/writeFileSync-DB8vv8xR.js +0 -81
  184. package/dist/packem_shared/writeIni-i55QrL8y.js +0 -65
  185. package/dist/packem_shared/writeIniSync-CLqJE5t3.js +0 -64
  186. package/dist/packem_shared/writeJson-Bo7C2UHw.js +0 -50
  187. package/dist/packem_shared/writeJson5-vVmHUQOd.js +0 -53
  188. package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +0 -53
  189. package/dist/packem_shared/writeJsonSync-BKZ_9Acr.js +0 -50
  190. package/dist/packem_shared/writeJsonc-BufH_oC5.js +0 -60
  191. package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +0 -59
  192. package/dist/packem_shared/writeToml-DgTW_-7F.js +0 -8
  193. package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +0 -8
  194. package/dist/packem_shared/writeYaml-BWCOome-.js +0 -24
  195. package/dist/packem_shared/writeYamlSync-DBVnXmuY.js +0 -24
package/dist/utils.d.ts CHANGED
@@ -1,14 +1,102 @@
1
- export { J as JSONError } from "./packem_shared/json-error.d-DgKaeuIf.js";
1
+ export { J as JSONError } from "./packem_shared/json-error.d-DVILOyHc.js";
2
2
  import { JsonValue } from 'type-fest';
3
- import { C as CodeFrameOptions, J as JsonReviver } from "./packem_shared/types.d-CYpAhWov.js";
3
+ import { b as CodeFrameOptions, c as JsonReviver } from "./packem_shared/types.d-BsmmADqx.js";
4
4
  export { toPath } from '@visulima/path/utils';
5
5
  import 'node:fs';
6
6
  import 'tinyglobby';
7
- import './options';
7
+ /**
8
+ * Asserts that the provided contents are valid for writing to a file.
9
+ * Valid contents can be a string, an ArrayBuffer, or an ArrayBuffer view (e.g., Uint8Array).
10
+ * @param contents The file contents to validate.
11
+ * @throws {TypeError} If the contents are not a string, ArrayBuffer, or ArrayBuffer view.
12
+ * @example
13
+ * ```javascript
14
+ * import { assertValidFileContents } from "@visulima/fs"; // Assuming this util is exported
15
+ *
16
+ * try {
17
+ * assertValidFileContents("Hello, world!");
18
+ * assertValidFileContents(new Uint8Array([72, 101, 108, 108, 111])); // "Hello"
19
+ * assertValidFileContents(new ArrayBuffer(8));
20
+ * console.log("File contents are valid.");
21
+ * } catch (error) {
22
+ * console.error(error.message); // File contents must be a string, ArrayBuffer, or ArrayBuffer view.
23
+ * }
24
+ *
25
+ * try {
26
+ * assertValidFileContents(123); // Invalid content type
27
+ * } catch (error) {
28
+ * console.error(error.message); // File contents must be a string, ArrayBuffer, or ArrayBuffer view.
29
+ * }
30
+ * ```
31
+ */
8
32
  declare const assertValidFileContents: (contents: any) => void;
33
+ /**
34
+ * Asserts that the provided path is a valid file or directory path.
35
+ * A valid path must be a non-empty string or a URL instance.
36
+ * @param fileOrDirectoryPath The path to validate.
37
+ * @throws {TypeError} If the path is not a non-empty string or a URL.
38
+ * @example
39
+ * ```javascript
40
+ * import { assertValidFileOrDirectoryPath } from "@visulima/fs"; // Assuming this util is exported
41
+ *
42
+ * try {
43
+ * assertValidFileOrDirectoryPath("/path/to/file.txt");
44
+ * assertValidFileOrDirectoryPath(new URL("file:///path/to/file.txt"));
45
+ * console.log("Path is valid.");
46
+ * } catch (error) {
47
+ * console.error(error.message); // Path must be a non-empty string or URL.
48
+ * }
49
+ *
50
+ * try {
51
+ * assertValidFileOrDirectoryPath(""); // Invalid path
52
+ * } catch (error) {
53
+ * console.error(error.message); // Path must be a non-empty string or URL.
54
+ * }
55
+ * ```
56
+ */
9
57
  declare const assertValidFileOrDirectoryPath: (fileOrDirectoryPath: any) => void;
10
58
  declare function parseJson(string: string, filename?: string, options?: CodeFrameOptions): JsonValue;
11
59
  declare function parseJson(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): JsonValue;
60
+ /**
61
+ * Strips comments from a JSON string.
62
+ * Handles both single-line (//) and multi-line (/* ... */) comments.
63
+ * @param jsonString The JSON string possibly containing comments.
64
+ * @param [options] Optional configuration for stripping comments.
65
+ * @param [options.whitespace] If `true` (default), comments are replaced with whitespace to preserve line numbers and character positions. If `false`, comments are removed entirely.
66
+ * @returns The JSON string with comments stripped.
67
+ * @example
68
+ * ```javascript
69
+ * import { stripJsonComments } from "@visulima/fs"; // Assuming this util is exported
70
+ *
71
+ * const jsonWithComments = `{
72
+ * // This is a single-line comment
73
+ * "name": "John Doe",
74
+ * "age": 30, /* This is a
75
+ * multi-line comment */
76
+ * "city": "New York"
77
+ * }`;
78
+ *
79
+ * const stripped = stripJsonComments(jsonWithComments);
80
+ * console.log(stripped);
81
+ * // Output (with whitespace=true):
82
+ * // {
83
+ * //
84
+ * // "name": "John Doe",
85
+ * // "age": 30, /*
86
+ * //
87
+ * // "city": "New York"
88
+ * // }
89
+ *
90
+ * const strippedWithoutWhitespace = stripJsonComments(jsonWithComments, { whitespace: false });
91
+ * console.log(strippedWithoutWhitespace);
92
+ * // Output (with whitespace=false):
93
+ * // {
94
+ * // "name": "John Doe",
95
+ * // "age": 30,
96
+ * // "city": "New York"
97
+ * // }
98
+ * ```
99
+ */
12
100
  declare const stripJsonComments: (jsonString: string, options?: {
13
101
  whitespace?: boolean;
14
102
  }) => string;
package/dist/utils.js CHANGED
@@ -1,6 +1 @@
1
- export { default as JSONError } from './packem_shared/JSONError-BkHRnInH.js';
2
- export { default as assertValidFileContents } from './packem_shared/assertValidFileContents-BmcLtsGd.js';
3
- export { default as assertValidFileOrDirectoryPath } from './packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js';
4
- export { default as parseJson } from './packem_shared/parseJson-BIp89Xjo.js';
5
- export { default as stripJsonComments } from './packem_shared/stripJsonComments-vo4k0mpF.js';
6
- export { toPath } from '@visulima/path/utils';
1
+ import{default as e}from"./packem_shared/JSONError-D7h6PNWc.js";import{default as a}from"./packem_shared/assertValidFileContents-BZFnXa7K.js";import{default as f}from"./packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js";import{default as m}from"./packem_shared/parseJson-Xx6vHYbv.js";import{default as d}from"./packem_shared/stripJsonComments-CzNR77MF.js";import{toPath as x}from"@visulima/path/utils";export{e as JSONError,a as assertValidFileContents,f as assertValidFileOrDirectoryPath,m as parseJson,d as stripJsonComments,x as toPath};
package/dist/yaml.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { a as CompressionType, R as ReadYamlOptions, Y as YamlReviver, W as WriteYamlOptions, b as JsonReplacer } from "./packem_shared/types.d-CYpAhWov.js";
2
- export { type c as YamlReplacer } from "./packem_shared/types.d-CYpAhWov.js";
1
+ import { C as CompressionType, m as ReadYamlOptions, Y as YamlReviver, n as WriteYamlOptions, o as JsonReplacer } from "./packem_shared/types.d-BsmmADqx.js";
2
+ export { type p as YamlReplacer } from "./packem_shared/types.d-BsmmADqx.js";
3
3
  import 'node:fs';
4
4
  import 'tinyglobby';
5
- import './options';
6
5
  declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<CompressionType>): Promise<R>;
7
6
  declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<CompressionType>): Promise<R>;
8
7
  declare function readYamlSync(path: URL | string, options?: ReadYamlOptions<CompressionType>): Record<string, unknown>;
package/dist/yaml.js CHANGED
@@ -1,4 +1 @@
1
- export { default as readYaml } from './packem_shared/readYaml-D5q2a0e1.js';
2
- export { default as readYamlSync } from './packem_shared/readYamlSync-BKX-PAfq.js';
3
- export { default as writeYaml } from './packem_shared/writeYaml-BWCOome-.js';
4
- export { default as writeYamlSync } from './packem_shared/writeYamlSync-DBVnXmuY.js';
1
+ import{default as r}from"./packem_shared/readYaml-DjK_Vqj1.js";import{default as f}from"./packem_shared/readYamlSync-C3h6KA2c.js";import{default as m}from"./packem_shared/writeYaml-BhQX2yN9.js";import{default as d}from"./packem_shared/writeYamlSync-DG01FBeC.js";export{r as readYaml,f as readYamlSync,m as writeYaml,d as writeYamlSync};
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@visulima/fs",
3
- "version": "5.0.0-alpha.12",
3
+ "version": "5.0.0-alpha.14",
4
4
  "description": "Human friendly file system utilities for Node.js",
5
5
  "keywords": [
6
6
  "anolilab",
7
+ "brotli",
7
8
  "detect-newline",
8
9
  "dir",
9
10
  "directory",
10
- "eol",
11
11
  "empty-dir",
12
12
  "ensure",
13
- "ensure-file",
14
13
  "ensure-dir",
14
+ "ensure-file",
15
15
  "ensure-link",
16
16
  "ensure-symlink",
17
+ "eol",
17
18
  "file",
18
19
  "files",
19
20
  "filesystem",
@@ -23,10 +24,14 @@
23
24
  "folder",
24
25
  "fs",
25
26
  "fs-safe",
27
+ "gzip",
28
+ "ini",
29
+ "json",
30
+ "json5",
31
+ "jsonc",
32
+ "jsonc-parser",
26
33
  "look",
27
34
  "look-up",
28
- "json",
29
- "read-json",
30
35
  "match",
31
36
  "package",
32
37
  "parent",
@@ -34,12 +39,16 @@
34
39
  "path",
35
40
  "read",
36
41
  "read-file",
42
+ "read-json",
37
43
  "read-yaml",
38
44
  "resolve",
39
45
  "safe",
40
46
  "search",
41
- "std",
47
+ "size",
48
+ "smol-toml",
42
49
  "standard",
50
+ "std",
51
+ "toml",
43
52
  "up",
44
53
  "visulima",
45
54
  "walk",
@@ -48,21 +57,17 @@
48
57
  "write-dir",
49
58
  "write-file",
50
59
  "write-safe",
51
- "yaml",
52
- "toml",
53
- "jsonc",
54
- "json5",
55
- "ini",
56
- "smol-toml",
57
- "jsonc-parser",
58
- "size",
59
- "brotli",
60
- "gzip"
60
+ "yaml"
61
61
  ],
62
62
  "homepage": "https://visulima.com/packages/fs/",
63
63
  "bugs": {
64
64
  "url": "https://github.com/visulima/visulima/issues"
65
65
  },
66
+ "license": "MIT",
67
+ "author": {
68
+ "name": "Daniel Bannert",
69
+ "email": "d.bannert@anolilab.de"
70
+ },
66
71
  "repository": {
67
72
  "type": "git",
68
73
  "url": "git+https://github.com/visulima/visulima.git",
@@ -78,13 +83,19 @@
78
83
  "url": "https://anolilab.com/support"
79
84
  }
80
85
  ],
81
- "license": "MIT",
82
- "author": {
83
- "name": "Daniel Bannert",
84
- "email": "d.bannert@anolilab.de"
85
- },
86
- "sideEffects": false,
86
+ "files": [
87
+ "dist/**",
88
+ "README.md",
89
+ "CHANGELOG.md",
90
+ "LICENSE.md"
91
+ ],
92
+ "os": [
93
+ "darwin",
94
+ "linux",
95
+ "win32"
96
+ ],
87
97
  "type": "module",
98
+ "sideEffects": false,
88
99
  "exports": {
89
100
  ".": {
90
101
  "types": "./dist/index.d.ts",
@@ -144,22 +155,19 @@
144
155
  },
145
156
  "./package.json": "./package.json"
146
157
  },
147
- "files": [
148
- "dist/**",
149
- "README.md",
150
- "CHANGELOG.md",
151
- "LICENSE.md"
152
- ],
158
+ "publishConfig": {
159
+ "access": "public",
160
+ "provenance": true
161
+ },
153
162
  "dependencies": {
154
- "@visulima/path": "3.0.0-alpha.10",
155
- "type-fest": "5.6.0"
163
+ "@visulima/path": "3.0.0-alpha.10"
156
164
  },
157
165
  "peerDependencies": {
158
166
  "ini": "^6.0.0",
159
167
  "json5": "^2.2.3",
160
168
  "jsonc-parser": "^3.3.1",
161
169
  "smol-toml": "^1.6.1",
162
- "yaml": "2.8.3"
170
+ "yaml": "2.8.4"
163
171
  },
164
172
  "peerDependenciesMeta": {
165
173
  "ini": {
@@ -180,14 +188,5 @@
180
188
  },
181
189
  "engines": {
182
190
  "node": "^22.14.0 || >=24.10.0"
183
- },
184
- "os": [
185
- "darwin",
186
- "linux",
187
- "win32"
188
- ],
189
- "publishConfig": {
190
- "access": "public",
191
- "provenance": true
192
191
  }
193
192
  }
@@ -1,27 +0,0 @@
1
- class AlreadyExistsError extends Error {
2
- /**
3
- * Creates a new instance.
4
- * @param message
5
- */
6
- constructor(message) {
7
- super(`EEXIST: ${message}`);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- get code() {
11
- return "EEXIST";
12
- }
13
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
14
- set code(_name) {
15
- throw new Error("Cannot overwrite code EEXIST");
16
- }
17
- // eslint-disable-next-line class-methods-use-this
18
- get name() {
19
- return "AlreadyExistsError";
20
- }
21
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
22
- set name(_name) {
23
- throw new Error("Cannot overwrite name of AlreadyExistsError");
24
- }
25
- }
26
-
27
- export { AlreadyExistsError as default };
@@ -1,27 +0,0 @@
1
- class DirectoryError extends Error {
2
- /**
3
- * Creates a new instance.
4
- * @param message
5
- */
6
- constructor(message) {
7
- super(`EISDIR: Illegal operation on a directory, ${message}`);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- get code() {
11
- return "EISDIR";
12
- }
13
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
14
- set code(_name) {
15
- throw new Error("Cannot overwrite code EISDIR");
16
- }
17
- // eslint-disable-next-line class-methods-use-this
18
- get name() {
19
- return "DirectoryError";
20
- }
21
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
22
- set name(_name) {
23
- throw new Error("Cannot overwrite name of DirectoryError");
24
- }
25
- }
26
-
27
- export { DirectoryError as default };
@@ -1,8 +0,0 @@
1
- const F_OK = 0;
2
- const R_OK = 4;
3
- const W_OK = 2;
4
- const X_OK = 1;
5
- const FIND_UP_STOP = /* @__PURE__ */ Symbol("findUpStop");
6
- const INTERNAL_STRIP_JSON_REGEX = /"(?:[^"\\]|\\.)*"|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g;
7
-
8
- export { FIND_UP_STOP, F_OK, INTERNAL_STRIP_JSON_REGEX, R_OK, W_OK, X_OK };
@@ -1,26 +0,0 @@
1
- class JSONError extends Error {
2
- fileName;
3
- codeFrame;
4
- // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
5
- name = "JSONError";
6
- #message;
7
- /**
8
- * Creates a new JSONError instance.
9
- * @param message The primary error message.
10
- */
11
- constructor(message) {
12
- super();
13
- this.#message = message;
14
- }
15
- get message() {
16
- return `${this.#message}${this.fileName ? ` in ${this.fileName}` : ""}${this.codeFrame ? `
17
-
18
- ${this.codeFrame}
19
- ` : ""}`;
20
- }
21
- set message(message) {
22
- this.#message = message;
23
- }
24
- }
25
-
26
- export { JSONError as default };
@@ -1,27 +0,0 @@
1
- class NotEmptyError extends Error {
2
- /**
3
- * Creates a new instance.
4
- * @param message
5
- */
6
- constructor(message) {
7
- super(`ENOTEMPTY: Directory not empty, ${message}`);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- get code() {
11
- return "ENOTEMPTY";
12
- }
13
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
14
- set code(_name) {
15
- throw new Error("Cannot overwrite code ENOTEMPTY");
16
- }
17
- // eslint-disable-next-line class-methods-use-this
18
- get name() {
19
- return "NotEmptyError";
20
- }
21
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
22
- set name(_name) {
23
- throw new Error("Cannot overwrite name of NotEmptyError");
24
- }
25
- }
26
-
27
- export { NotEmptyError as default };
@@ -1,27 +0,0 @@
1
- class NotFoundError extends Error {
2
- /**
3
- * Creates a new instance.
4
- * @param message
5
- */
6
- constructor(message) {
7
- super(`ENOENT: ${message}`);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- get code() {
11
- return "ENOENT";
12
- }
13
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
14
- set code(_name) {
15
- throw new Error("Cannot overwrite code ENOENT");
16
- }
17
- // eslint-disable-next-line class-methods-use-this
18
- get name() {
19
- return "NotFoundError";
20
- }
21
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
22
- set name(_name) {
23
- throw new Error("Cannot overwrite name of NotFoundError");
24
- }
25
- }
26
-
27
- export { NotFoundError as default };
@@ -1,27 +0,0 @@
1
- class PermissionError extends Error {
2
- /**
3
- * Creates a new instance.
4
- * @param message
5
- */
6
- constructor(message) {
7
- super(`EPERM: Operation not permitted, ${message}`);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- get code() {
11
- return "EPERM";
12
- }
13
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
14
- set code(_name) {
15
- throw new Error("Cannot overwrite code EPERM");
16
- }
17
- // eslint-disable-next-line class-methods-use-this
18
- get name() {
19
- return "PermissionError";
20
- }
21
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
22
- set name(_name) {
23
- throw new Error("Cannot overwrite name of PermissionError");
24
- }
25
- }
26
-
27
- export { PermissionError as default };
@@ -1,24 +0,0 @@
1
- class WalkError extends Error {
2
- /** File path of the root that's being walked. */
3
- root;
4
- /**
5
- * Constructs a new instance.
6
- * @param cause The underlying error or reason for the walk failure.
7
- * @param root The root directory path where the walk operation started or encountered the error.
8
- */
9
- constructor(cause, root) {
10
- super(`${cause instanceof Error ? cause.message : String(cause)} for path "${root}"`);
11
- this.cause = cause;
12
- this.root = root;
13
- }
14
- // eslint-disable-next-line class-methods-use-this
15
- get name() {
16
- return "WalkError";
17
- }
18
- // eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
19
- set name(_name) {
20
- throw new Error("Cannot overwrite name of WalkError");
21
- }
22
- }
23
-
24
- export { WalkError as default };
@@ -1,5 +0,0 @@
1
- function getDefaultExportFromCjs(x) {
2
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3
- }
4
-
5
- export { getDefaultExportFromCjs as g };
@@ -1,7 +0,0 @@
1
- const assertValidFileContents = (contents) => {
2
- if (typeof contents !== "string" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) {
3
- throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.");
4
- }
5
- };
6
-
7
- export { assertValidFileContents as default };
@@ -1,7 +0,0 @@
1
- const assertValidFileOrDirectoryPath = (fileOrDirectoryPath) => {
2
- if (!fileOrDirectoryPath || !(fileOrDirectoryPath instanceof URL) && typeof fileOrDirectoryPath !== "string") {
3
- throw new TypeError("Path must be a non-empty string or URL.");
4
- }
5
- };
6
-
7
- export { assertValidFileOrDirectoryPath as default };
@@ -1,12 +0,0 @@
1
- const buildRmOptions = (options) => {
2
- const rmOptions = { force: true, recursive: true };
3
- if (options?.maxRetries !== void 0) {
4
- rmOptions.maxRetries = options.maxRetries;
5
- }
6
- if (options?.retryDelay !== void 0) {
7
- rmOptions.retryDelay = options.retryDelay;
8
- }
9
- return rmOptions;
10
- };
11
-
12
- export { buildRmOptions as b };
@@ -1,14 +0,0 @@
1
- import walk from './walk-CSZgCuDx.js';
2
-
3
- const collect = async (directory, options = {}) => {
4
- if (!Array.isArray(options.extensions)) {
5
- options.extensions = ["js", "mjs", "cjs", "ts"];
6
- }
7
- const entries = [];
8
- for await (const entry of walk(directory, options)) {
9
- entries.push(entry.path);
10
- }
11
- return entries;
12
- };
13
-
14
- export { collect as default };
@@ -1,14 +0,0 @@
1
- import walkSync from './walkSync-C4Cy28xb.js';
2
-
3
- const collectSync = (directory, options = {}) => {
4
- if (!Array.isArray(options.extensions)) {
5
- options.extensions = ["js", "mjs", "cjs", "ts"];
6
- }
7
- const entries = [];
8
- for (const entry of walkSync(directory, options)) {
9
- entries.push(entry.path);
10
- }
11
- return entries;
12
- };
13
-
14
- export { collectSync as default };
@@ -1,46 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- existsSync
22
- } = __cjs_getBuiltinModule("node:fs");
23
- const {
24
- mkdir,
25
- readdir,
26
- rm
27
- } = __cjs_getBuiltinModule("node:fs/promises");
28
- import { join } from '@visulima/path';
29
- import { toPath } from '@visulima/path/utils';
30
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
31
- import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
32
-
33
- const emptyDir = async (dir, options) => {
34
- assertValidFileOrDirectoryPath(dir);
35
- if (!existsSync(dir)) {
36
- await mkdir(dir, { recursive: true });
37
- return;
38
- }
39
- const items = await readdir(dir);
40
- const rmOptions = buildRmOptions(options);
41
- for (const item of items) {
42
- await rm(join(toPath(dir), item), rmOptions);
43
- }
44
- };
45
-
46
- export { emptyDir as default };
@@ -1,43 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- existsSync,
22
- mkdirSync,
23
- readdirSync,
24
- rmSync
25
- } = __cjs_getBuiltinModule("node:fs");
26
- import { join } from '@visulima/path';
27
- import { toPath } from '@visulima/path/utils';
28
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
- import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
30
-
31
- const emptyDirSync = (dir, options) => {
32
- assertValidFileOrDirectoryPath(dir);
33
- if (!existsSync(dir)) {
34
- mkdirSync(dir, { recursive: true });
35
- return;
36
- }
37
- const rmOptions = buildRmOptions(options);
38
- for (const item of readdirSync(dir)) {
39
- rmSync(join(toPath(dir), item), rmOptions);
40
- }
41
- };
42
-
43
- export { emptyDirSync as default };