@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/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## @visulima/fs [5.0.0-alpha.14](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.13...@visulima/fs@5.0.0-alpha.14) (2026-05-06)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **fs:** apply prettier and eslint quote-style auto-fix ([cc5525e](https://github.com/visulima/visulima/commit/cc5525e0d5fe37f689ca7357cf274b88b604aba0))
6
+ * **fs:** housekeeping cleanup ([95e8643](https://github.com/visulima/visulima/commit/95e8643922856fa21bd7b6830ff0e94e29c1b783))
7
+
8
+ ### Continuous Integration
9
+
10
+ * integrate codspeed for benchmark tracking ([e758f3d](https://github.com/visulima/visulima/commit/e758f3da491cc00d3f8bbf10d7ba3fdf8deb5325))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * **@visulima/error:** upgraded to 6.0.0-alpha.16
16
+
17
+ ## @visulima/fs [5.0.0-alpha.13](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.12...@visulima/fs@5.0.0-alpha.13) (2026-05-04)
18
+
19
+ ### Miscellaneous Chores
20
+
21
+ * **fs:** upgrade packem to 2.0.0-alpha.76 ([3dfa709](https://github.com/visulima/visulima/commit/3dfa709d723dd74576ce7003c63c11858c1e72e3))
22
+ * re-sort workspace package.json files via vis sort-package-json ([f625696](https://github.com/visulima/visulima/commit/f625696cfac974325774b3243e1a83c3d23acbd7))
23
+ * simplify pnpm-workspace packages list ([7cab221](https://github.com/visulima/visulima/commit/7cab221163632d9b7aa044a6f88c49083103a869))
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * **@visulima/error:** upgraded to 6.0.0-alpha.15
29
+
1
30
  ## @visulima/fs [5.0.0-alpha.12](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.11...@visulima/fs@5.0.0-alpha.12) (2026-04-22)
2
31
 
3
32
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -57,11 +57,14 @@ Repository: git+https://github.com/visulima/visulima.git
57
57
  >
58
58
  >
59
59
  > # Licenses of bundled dependencies
60
+ >
60
61
  > The published @visulima/error artifact additionally contains code with the following licenses:
61
62
  > MIT
62
63
  >
63
64
  > # Bundled dependencies:
65
+ >
64
66
  > ## is-plain-obj
67
+ >
65
68
  > License: MIT
66
69
  > By: Sindre Sorhus
67
70
  > Repository: sindresorhus/is-plain-obj
@@ -75,6 +78,33 @@ Repository: git+https://github.com/visulima/visulima.git
75
78
  > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
76
79
  > >
77
80
  > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
81
+ >
82
+ >
83
+ >
84
+ >
85
+ >
86
+ > # Licenses of bundled types
87
+ > The published @visulima/error artifact additionally contains code with the following licenses:
88
+ > Apache-2.0
89
+ >
90
+ > # Bundled types:
91
+ > ## ai
92
+ > License: Apache-2.0
93
+ > Repository: https://github.com/vercel/ai
94
+ >
95
+ > > Copyright 2023 Vercel, Inc.
96
+ > >
97
+ > > Licensed under the Apache License, Version 2.0 (the "License");
98
+ > > you may not use this file except in compliance with the License.
99
+ > > You may obtain a copy of the License at
100
+ > >
101
+ > > http://www.apache.org/licenses/LICENSE-2.0
102
+ > >
103
+ > > Unless required by applicable law or agreed to in writing, software
104
+ > > distributed under the License is distributed on an "AS IS" BASIS,
105
+ > > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
+ > > See the License for the specific language governing permissions and
107
+ > > limitations under the License.
78
108
 
79
109
  ---------------------------------------
80
110
 
@@ -281,14 +311,11 @@ Repository: git+https://github.com/SuperchupuDev/tinyglobby.git
281
311
  <!-- TYPE_DEPENDENCIES -->
282
312
 
283
313
  # Licenses of bundled types
284
-
285
314
  The published @visulima/fs artifact additionally contains code with the following licenses:
286
- MIT
315
+ ISC, MIT
287
316
 
288
317
  # Bundled types:
289
-
290
318
  ## is-fs-case-sensitive
291
-
292
319
  License: MIT
293
320
  By: Hiroki Osame
294
321
  Repository: privatenumber/is-fs-case-sensitive
@@ -315,4 +342,25 @@ Repository: privatenumber/is-fs-case-sensitive
315
342
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
316
343
  > SOFTWARE.
317
344
 
345
+ ---------------------------------------
346
+
347
+ ## yaml
348
+ License: ISC
349
+ By: Eemeli Aro
350
+ Repository: github:eemeli/yaml
351
+
352
+ > Copyright Eemeli Aro <eemeli@gmail.com>
353
+ >
354
+ > Permission to use, copy, modify, and/or distribute this software for any purpose
355
+ > with or without fee is hereby granted, provided that the above copyright notice
356
+ > and this permission notice appear in all copies.
357
+ >
358
+ > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
359
+ > REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
360
+ > FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
361
+ > INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
362
+ > OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
363
+ > TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
364
+ > THIS SOFTWARE.
365
+
318
366
  <!-- /TYPE_DEPENDENCIES -->
package/dist/eol.d.ts CHANGED
@@ -1,6 +1,36 @@
1
+ /** End-of-line character for POSIX platforms such as macOS and Linux. */
1
2
  declare const LF: "\n";
3
+ /** End-of-line character for Windows platforms. */
2
4
  declare const CRLF: "\r\n";
5
+ /**
6
+ * End-of-line character evaluated for the current platform.
7
+ */
3
8
  declare const EOL: "\n" | "\r\n";
9
+ /**
10
+ * Detect the EOL character for string input.
11
+ * Returns null if no newline.
12
+ * @param content The string content to detect the EOL from.
13
+ * @example
14
+ * ```javascript
15
+ * import { detect } from "@visulima/fs/eol";
16
+ *
17
+ * detect("Hello\r\nWorld"); // "\r\n"
18
+ * detect("Hello\nWorld"); // "\n"
19
+ * detect("HelloWorld"); // null
20
+ * ```
21
+ */
4
22
  declare const detect: (content: string) => typeof EOL | null;
23
+ /**
24
+ * Format the file to the targeted EOL.
25
+ * @param content The string content to format.
26
+ * @param eol The target EOL character.
27
+ * @example
28
+ * ```javascript
29
+ * import { format, LF, CRLF } from "@visulima/fs/eol";
30
+ *
31
+ * format("Hello\r\nWorld\nUnix", LF); // "Hello\nWorld\nUnix"
32
+ * format("Hello\nWorld\r\nWindows", CRLF); // "Hello\r\nWorld\r\nWindows"
33
+ * ```
34
+ */
5
35
  declare const format: (content: string, eol: typeof EOL) => string;
6
36
  export { CRLF, EOL, LF, detect, format };
package/dist/eol.js CHANGED
@@ -1,26 +1,3 @@
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 {
8
- platform
9
- } = __cjs_getProcess;
10
-
11
- const regDetect = /\r?\n/g;
12
- const LF = "\n";
13
- const CRLF = "\r\n";
14
- const EOL = platform === "win32" ? CRLF : LF;
15
- const detect = (content) => {
16
- const matched = content.match(regDetect);
17
- if (!matched || matched.length === 0) {
18
- return null;
19
- }
20
- const crlf = matched.filter((newline) => newline === CRLF).length;
21
- const lf = matched.length - crlf;
22
- return crlf > lf ? CRLF : LF;
23
- };
24
- const format = (content, eol) => content.replaceAll(regDetect, eol);
25
-
26
- export { CRLF, EOL, LF, detect, format };
1
+ var f=Object.defineProperty;var c=(t,e)=>f(t,"name",{value:e,configurable:!0});import{createRequire as u}from"node:module";const h=u(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:g}=p;var m=Object.defineProperty,n=c((t,e)=>m(t,"name",{value:e,configurable:!0}),"r");const s=/\r?\n/g,l=`
2
+ `,r=`\r
3
+ `,b=g==="win32"?r:l,j=n(t=>{const e=t.match(s);if(!e||e.length===0)return null;const o=e.filter(i=>i===r).length,a=e.length-o;return o>a?r:l},"detect"),q=n((t,e)=>t.replaceAll(s,e),"format");export{r as CRLF,b as EOL,l as LF,j as detect,q as format};
package/dist/error.d.ts CHANGED
@@ -1,43 +1,273 @@
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
+ /**
3
+ * Error thrown when a file or directory already exists at a specified path, and an operation was expecting it not to.
4
+ * @example
5
+ * ```javascript
6
+ * import { AlreadyExistsError } from "@visulima/fs/error"; // Assuming it's exported from an index or directly
7
+ * import { ensureSymlinkSync } from "@visulima/fs"; // Or any function that might throw this
8
+ * import { join } from "node:path";
9
+ *
10
+ * try {
11
+ * // Example: ensureSymlinkSync might throw this if a file (not a symlink) already exists at linkName
12
+ * // For demonstration, let's assume someFunction internally throws it:
13
+ * const someFunctionThatMightThrow = (path) => {
14
+ * if (path === "/tmp/existing-file.txt") { // Simulate a check
15
+ * throw new AlreadyExistsError(`file already exists at '/tmp/existing-file.txt'`);
16
+ * }
17
+ * }
18
+ * someFunctionThatMightThrow("/tmp/existing-file.txt");
19
+ * } catch (error) {
20
+ * if (error instanceof AlreadyExistsError) {
21
+ * console.error(`Operation failed because path exists: ${error.message}`);
22
+ * console.error(`Error code: ${error.code}`); // EEXIST
23
+ * } else {
24
+ * console.error("An unexpected error occurred:", error);
25
+ * }
26
+ * }
27
+ * ```
28
+ */
2
29
  declare class AlreadyExistsError extends Error {
30
+ /**
31
+ * Creates a new instance.
32
+ * @param message
33
+ */
3
34
  constructor(message: string);
4
35
  get code(): string;
5
36
  set code(_name: string);
6
- get name(): string;
7
- set name(_name: string);
37
+ override get name(): string;
38
+ override set name(_name: string);
8
39
  }
40
+ /**
41
+ * Error thrown when an operation that is not allowed on a directory is attempted.
42
+ * This typically occurs when a file-specific operation is used on a directory path.
43
+ * @example
44
+ * ```javascript
45
+ * import { DirectoryError } from "@visulima/fs/error";
46
+ * import { readFile } from "@visulima/fs"; // Or any function that might throw this
47
+ * import { join } from "node:path";
48
+ *
49
+ * const attemptToReadFileFromDir = async () => {
50
+ * try {
51
+ * // Attempting to read a directory as if it were a file
52
+ * // This is a conceptual example; readFile might throw a different error first
53
+ * // depending on its internal checks, but EISDIR is the underlying system error.
54
+ * // Forcing the scenario:
55
+ * const pretendReadFileOnDir = (path) => {
56
+ * if (path === "/tmp/my-directory") { // Simulate a directory path
57
+ * throw new DirectoryError(`read '/tmp/my-directory'`);
58
+ * }
59
+ * }
60
+ * pretendReadFileOnDir("/tmp/my-directory");
61
+ * // await readFile(join("/tmp", "my-directory"));
62
+ * } catch (error) {
63
+ * if (error instanceof DirectoryError) {
64
+ * console.error(`Operation failed, path is a directory: ${error.message}`);
65
+ * console.error(`Error code: ${error.code}`); // EISDIR
66
+ * } else {
67
+ * console.error("An unexpected error occurred:", error);
68
+ * }
69
+ * }
70
+ * };
71
+ *
72
+ * attemptToReadFileFromDir();
73
+ * ```
74
+ */
9
75
  declare class DirectoryError extends Error {
76
+ /**
77
+ * Creates a new instance.
78
+ * @param message
79
+ */
10
80
  constructor(message: string);
11
81
  get code(): string;
12
82
  set code(_name: string);
13
- get name(): string;
14
- set name(_name: string);
83
+ override get name(): string;
84
+ override set name(_name: string);
15
85
  }
86
+ /**
87
+ * Error thrown when a directory is not empty.
88
+ * @example
89
+ * ```javascript
90
+ * import { NotEmptyError } from "@visulima/fs/error";
91
+ * import { rmdir } from "node:fs/promises"; // Or any fs function that might throw this system error
92
+ * import { join } from "node:path";
93
+ *
94
+ * const attemptToRemoveNonEmptyDir = async () => {
95
+ * const dirPath = join("/tmp", "my-non-empty-dir"); // Assume this directory exists and has files
96
+ * try {
97
+ * // Forcing the scenario for demonstration, as rmdir might throw its own specific error.
98
+ * // Node.js fs operations that encounter a non-empty directory when expecting an empty one
99
+ * // typically throw an error with code ENOTEMPTY.
100
+ * const simulateNotEmpty = (path) => {
101
+ * if (path === dirPath) { // Simulate check for non-empty
102
+ * throw new NotEmptyError(`rmdir '${dirPath}'`);
103
+ * }
104
+ * }
105
+ * simulateNotEmpty(dirPath);
106
+ * // await rmdir(dirPath); // This would likely throw an error with code ENOTEMPTY
107
+ * } catch (error) {
108
+ * if (error instanceof NotEmptyError) {
109
+ * console.error(`Operation failed, directory is not empty: ${error.message}`);
110
+ * console.error(`Error code: ${error.code}`); // ENOTEMPTY
111
+ * } else {
112
+ * console.error("An unexpected error occurred:", error);
113
+ * }
114
+ * }
115
+ * };
116
+ *
117
+ * // You would need to set up a non-empty directory at /tmp/my-non-empty-dir for a real test
118
+ * // import { ensureDirSync, writeFileSync } from "@visulima/fs";
119
+ * // ensureDirSync(dirPath);
120
+ * // writeFileSync(join(dirPath, "somefile.txt"), "content");
121
+ *
122
+ * attemptToRemoveNonEmptyDir();
123
+ * ```
124
+ */
16
125
  declare class NotEmptyError extends Error {
126
+ /**
127
+ * Creates a new instance.
128
+ * @param message
129
+ */
17
130
  constructor(message: string);
18
131
  get code(): string;
19
132
  set code(_name: string);
20
- get name(): string;
21
- set name(_name: string);
133
+ override get name(): string;
134
+ override set name(_name: string);
22
135
  }
136
+ /**
137
+ * Error thrown when a file or directory is not found at a specified path.
138
+ * @example
139
+ * ```javascript
140
+ * import { NotFoundError } from "@visulima/fs/error";
141
+ * import { readFile } from "@visulima/fs"; // Or any function that might throw this
142
+ * import { join } from "node:path";
143
+ *
144
+ * const tryReadingNonExistentFile = async () => {
145
+ * const filePath = join("/tmp", "this-file-does-not-exist.txt");
146
+ * try {
147
+ * // Forcing the scenario for demonstration, as readFile itself would throw this.
148
+ * const simulateNotFound = (path) => {
149
+ * if (path === filePath) {
150
+ * throw new NotFoundError(`no such file or directory, open '${filePath}'`);
151
+ * }
152
+ * }
153
+ * simulateNotFound(filePath);
154
+ * // await readFile(filePath);
155
+ * } catch (error) {
156
+ * if (error instanceof NotFoundError) {
157
+ * console.error(`Operation failed, path not found: ${error.message}`);
158
+ * console.error(`Error code: ${error.code}`); // ENOENT
159
+ * } else {
160
+ * console.error("An unexpected error occurred:", error);
161
+ * }
162
+ * }
163
+ * };
164
+ *
165
+ * tryReadingNonExistentFile();
166
+ * ```
167
+ */
23
168
  declare class NotFoundError extends Error {
169
+ /**
170
+ * Creates a new instance.
171
+ * @param message
172
+ */
24
173
  constructor(message: string);
25
174
  get code(): string;
26
175
  set code(_name: string);
27
- get name(): string;
28
- set name(_name: string);
176
+ override get name(): string;
177
+ override set name(_name: string);
29
178
  }
179
+ /**
180
+ * Error thrown when an operation is not permitted due to insufficient privileges
181
+ * or other access control restrictions.
182
+ * @example
183
+ * ```javascript
184
+ * import { PermissionError } from "@visulima/fs/error";
185
+ * import { writeFile } from "@visulima/fs"; // Or any function that might throw this
186
+ * import { join } from "node:path";
187
+ *
188
+ * const tryWritingToProtectedFile = async () => {
189
+ * const filePath = join("/root", "protected-file.txt"); // A path that typically requires root privileges
190
+ * try {
191
+ * // Forcing the scenario for demonstration, as writeFile itself would throw this.
192
+ * const simulatePermissionError = (path) => {
193
+ * if (path === filePath) {
194
+ * throw new PermissionError(`open '${filePath}'`);
195
+ * }
196
+ * }
197
+ * simulatePermissionError(filePath);
198
+ * // await writeFile(filePath, "test content");
199
+ * } catch (error) {
200
+ * if (error instanceof PermissionError) {
201
+ * console.error(`Operation not permitted: ${error.message}`);
202
+ * console.error(`Error code: ${error.code}`); // EPERM
203
+ * } else {
204
+ * console.error("An unexpected error occurred:", error);
205
+ * }
206
+ * }
207
+ * };
208
+ *
209
+ * tryWritingToProtectedFile();
210
+ * ```
211
+ */
30
212
  declare class PermissionError extends Error {
213
+ /**
214
+ * Creates a new instance.
215
+ * @param message
216
+ */
31
217
  constructor(message: string);
32
218
  get code(): string;
33
219
  set code(_name: string);
34
- get name(): string;
35
- set name(_name: string);
220
+ override get name(): string;
221
+ override set name(_name: string);
36
222
  }
223
+ /**
224
+ * Error thrown in walk or walkSync during iteration.
225
+ * @example
226
+ * ```javascript
227
+ * import { WalkError } from "@visulima/fs/error";
228
+ * import { walk } from "@visulima/fs";
229
+ * import { join } from "node:path";
230
+ *
231
+ * const processDirectory = async () => {
232
+ * const dirToWalk = join("/tmp", "non-existent-or-permission-denied-dir");
233
+ * try {
234
+ * // Forcing the scenario: walk might throw a WalkError if it encounters an issue
235
+ * // like a directory it cannot read during the walk process.
236
+ * const simulateWalkError = async (rootDir) => {
237
+ * // Let's say readdir inside walk fails for a subdirectory.
238
+ * const underlyingError = new Error("Permission denied reading subdirectory");
239
+ * throw new WalkError(underlyingError, rootDir);
240
+ * }
241
+ * // This is conceptual. In a real scenario, 'walk' itself would throw.
242
+ * // for await (const entry of walk(dirToWalk)) {
243
+ * // console.log(entry.path);
244
+ * // }
245
+ * await simulateWalkError(dirToWalk);
246
+ * } catch (error) {
247
+ * if (error instanceof WalkError) {
248
+ * console.error(`Error during directory walk of "${error.root}": ${error.message}`);
249
+ * if (error.cause) {
250
+ * console.error(`Underlying cause: ${error.cause}`);
251
+ * }
252
+ * } else {
253
+ * console.error("An unexpected error occurred:", error);
254
+ * }
255
+ * }
256
+ * };
257
+ *
258
+ * processDirectory();
259
+ * ```
260
+ */
37
261
  declare class WalkError extends Error {
262
+ /** File path of the root that's being walked. */
38
263
  root: string;
264
+ /**
265
+ * Constructs a new instance.
266
+ * @param cause The underlying error or reason for the walk failure.
267
+ * @param root The root directory path where the walk operation started or encountered the error.
268
+ */
39
269
  constructor(cause: unknown, root: string);
40
- get name(): string;
41
- set name(_name: string);
270
+ override get name(): string;
271
+ override set name(_name: string);
42
272
  }
43
273
  export { AlreadyExistsError, DirectoryError, NotEmptyError, NotFoundError, PermissionError, WalkError };
package/dist/error.js CHANGED
@@ -1,7 +1 @@
1
- export { default as AlreadyExistsError } from './packem_shared/AlreadyExistsError-6Y9hjgMn.js';
2
- export { default as DirectoryError } from './packem_shared/DirectoryError-BfYPkIYP.js';
3
- export { default as JSONError } from './packem_shared/JSONError-BkHRnInH.js';
4
- export { default as NotEmptyError } from './packem_shared/NotEmptyError-B21RUlVr.js';
5
- export { default as NotFoundError } from './packem_shared/NotFoundError-BIp61X6k.js';
6
- export { default as PermissionError } from './packem_shared/PermissionError-CjoiJgip.js';
7
- export { default as WalkError } from './packem_shared/WalkError-DER5A43G.js';
1
+ import{default as t}from"./packem_shared/AlreadyExistsError-CEu6_Tjb.js";import{default as a}from"./packem_shared/DirectoryError-ddlbUV8C.js";import{default as s}from"./packem_shared/JSONError-D7h6PNWc.js";import{default as l}from"./packem_shared/NotEmptyError-DMh1o7UL.js";import{default as E}from"./packem_shared/NotFoundError-BPiW0icm.js";import{default as u}from"./packem_shared/PermissionError-B1Emi5a9.js";import{default as i}from"./packem_shared/WalkError-Olmh4908.js";export{t as AlreadyExistsError,a as DirectoryError,s as JSONError,l as NotEmptyError,E as NotFoundError,u as PermissionError,i as WalkError};
@@ -1,5 +1,35 @@
1
+ /**
2
+ * Options accepted by {@link globParent}.
3
+ */
1
4
  interface GlobParentOptions {
5
+ /**
6
+ * On Windows, flip backslashes to forward slashes before analysing the pattern.
7
+ *
8
+ * Disable when the input contains backslash escape sequences you want to preserve.
9
+ * @default true
10
+ */
2
11
  flipBackslashes?: boolean;
3
12
  }
13
+ /**
14
+ * Extracts the non-glob parent directory from a glob pattern.
15
+ *
16
+ * Useful when you need to know which directory to watch or walk for a given pattern — for example
17
+ * `src/**\/*.ts` → `src`, `foo/{a,b}/*.js` → `foo`. Patterns without glob characters are returned
18
+ * unchanged.
19
+ *
20
+ * Powered by [`glob-parent`](https://github.com/gulpjs/glob-parent) which is bundled into the built output so
21
+ * it does not appear as a runtime dependency of `@visulima/fs`.
22
+ * @param pattern The glob pattern to inspect.
23
+ * @param options Optional configuration. See {@link GlobParentOptions}.
24
+ * @returns The static parent path of the glob.
25
+ * @example
26
+ * ```javascript
27
+ * import { globParent } from "@visulima/fs";
28
+ *
29
+ * globParent("src/**\/*.ts"); // "src"
30
+ * globParent("foo/{a,b}/*.js"); // "foo"
31
+ * globParent("foo/bar.js"); // "foo/bar.js"
32
+ * ```
33
+ */
4
34
  declare const globParent: (pattern: string, options?: GlobParentOptions) => string;
5
35
  export { type GlobParentOptions, globParent as default };
@@ -1,90 +1 @@
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
- import { g as getDefaultExportFromCjs } from './packem_shared/_commonjsHelpers-BqLXS_qQ.js';
21
- import { r as requireIsGlob } from './packem_shared/index-bhgnhm4u.js';
22
- const require$$1 = __cjs_getBuiltinModule("path");
23
- const require$$2 = __cjs_getBuiltinModule("os");
24
-
25
- var globParent$1;
26
- var hasRequiredGlobParent;
27
-
28
- function requireGlobParent () {
29
- if (hasRequiredGlobParent) return globParent$1;
30
- hasRequiredGlobParent = 1;
31
- var isGlob = requireIsGlob();
32
- var pathPosixDirname = require$$1.posix.dirname;
33
- var isWin32 = require$$2.platform() === "win32";
34
- var slash = "/";
35
- var backslash = /\\/g;
36
- var escaped = /\\([!*?|[\](){}])/g;
37
- globParent$1 = function globParent(str, opts) {
38
- var options = Object.assign({ flipBackslashes: true }, opts);
39
- if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
40
- str = str.replace(backslash, slash);
41
- }
42
- if (isEnclosure(str)) {
43
- str += slash;
44
- }
45
- str += "a";
46
- do {
47
- str = pathPosixDirname(str);
48
- } while (isGlobby(str));
49
- return str.replace(escaped, "$1");
50
- };
51
- function isEnclosure(str) {
52
- var lastChar = str.slice(-1);
53
- var enclosureStart;
54
- switch (lastChar) {
55
- case "}":
56
- enclosureStart = "{";
57
- break;
58
- case "]":
59
- enclosureStart = "[";
60
- break;
61
- default:
62
- return false;
63
- }
64
- var foundIndex = str.indexOf(enclosureStart);
65
- if (foundIndex < 0) {
66
- return false;
67
- }
68
- return str.slice(foundIndex + 1, -1).includes(slash);
69
- }
70
- function isGlobby(str) {
71
- if (/\([^()]+$/.test(str)) {
72
- return true;
73
- }
74
- if (str[0] === "{" || str[0] === "[") {
75
- return true;
76
- }
77
- if (/[^\\][{[]/.test(str)) {
78
- return true;
79
- }
80
- return isGlob(str);
81
- }
82
- return globParent$1;
83
- }
84
-
85
- var globParentExports = requireGlobParent();
86
- const globParentImpl = /*@__PURE__*/getDefaultExportFromCjs(globParentExports);
87
-
88
- const globParent = (pattern, options) => globParentImpl(pattern, options);
89
-
90
- export { globParent as default };
1
+ var _=Object.defineProperty;var t=(s,r)=>_(s,"name",{value:r,configurable:!0});import{createRequire as P}from"node:module";import{g as q}from"./packem_shared/_commonjsHelpers-D6W6KoPK.js";import{r as x}from"./packem_shared/index-K-NNTkpb.js";const j=P(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=t(s=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,a]=i.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return i.getBuiltinModule(s)}return j(s)},"__cjs_getBuiltinModule"),y=d("path"),G=d("os");var u,b;function $(){if(b)return u;b=1;var s=Object.defineProperty,r=t((e,n)=>s(e,"name",{value:n,configurable:!0}),"n"),a=x(),g=y.posix.dirname,m=G.platform()==="win32",l="/",v=/\\/g,h=/\\([!*?|[\](){}])/g;u=r(function(e,n){var o=Object.assign({flipBackslashes:!0},n);o.flipBackslashes&&m&&e.indexOf(l)<0&&(e=e.replace(v,l)),c(e)&&(e+=l),e+="a";do e=g(e);while(f(e));return e.replace(h,"$1")},"globParent");function c(e){var n=e.slice(-1),o;switch(n){case"}":o="{";break;case"]":o="[";break;default:return!1}var p=e.indexOf(o);return p<0?!1:e.slice(p+1,-1).includes(l)}t(c,"isEnclosure"),r(c,"isEnclosure");function f(e){return/\([^()]+$/.test(e)||e[0]==="{"||e[0]==="["||/[^\\][{[]/.test(e)?!0:a(e)}return t(f,"isGlobby"),r(f,"isGlobby"),u}t($,"requireGlobParent");var k=$();const O=q(k);var B=Object.defineProperty,E=t((s,r)=>B(s,"name",{value:r,configurable:!0}),"e");const M=E((s,r)=>O(s,r),"globParent");export{M as default};
package/dist/glob.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-BlGjS68e.js";
2
- export { type G as GlobOptions } from "./packem_shared/types.d-CYpAhWov.js";
1
+ export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-p6lOZXnE.js";
2
+ export { type G as GlobOptions } from "./packem_shared/types.d-BsmmADqx.js";
3
3
  import 'node:fs';
4
4
  import 'tinyglobby';
5
- import './options';
package/dist/glob.js CHANGED
@@ -1,2 +1 @@
1
- export { default as glob } from './packem_shared/glob-DY8l7izD.js';
2
- export { default as globSync } from './packem_shared/globSync-5P2KJf_g.js';
1
+ import{default as e}from"./packem_shared/glob-MHJQjR39.js";import{default as l}from"./packem_shared/globSync-CwzlELgS.js";export{e as glob,l as globSync};