@visulima/fs 5.0.0-alpha.30 → 5.0.0-alpha.32

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 (187) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +29 -0
  3. package/README.md +65 -0
  4. package/dist/eol.js +2 -2
  5. package/dist/error.js +1 -1
  6. package/dist/glob-parent.js +1 -1
  7. package/dist/glob.d.ts +3 -3
  8. package/dist/glob.js +1 -1
  9. package/dist/index.d.ts +98 -25
  10. package/dist/index.js +1 -1
  11. package/dist/ini.d.ts +3 -3
  12. package/dist/ini.js +1 -1
  13. package/dist/is-glob.js +1 -1
  14. package/dist/json5.d.ts +3 -3
  15. package/dist/json5.js +1 -1
  16. package/dist/jsonc.d.ts +3 -3
  17. package/dist/jsonc.js +1 -1
  18. package/dist/match.js +1 -1
  19. package/dist/packem_shared/AlreadyExistsError-DEb3UWja.js +1 -0
  20. package/dist/packem_shared/DirectoryError-BtwSTLmT.js +1 -0
  21. package/dist/packem_shared/JSONError-Cvp9ycba.js +4 -0
  22. package/dist/packem_shared/NotEmptyError-DZ1Ix089.js +1 -0
  23. package/dist/packem_shared/NotFoundError-CnRY6lVp.js +1 -0
  24. package/dist/packem_shared/PermissionError-DJ_2VWEj.js +1 -0
  25. package/dist/packem_shared/WalkError-B8qTd-v-.js +1 -0
  26. package/dist/packem_shared/_commonjsHelpers-CWAkuNXM.js +1 -0
  27. package/dist/packem_shared/assertValidFileContents-CbIN7sy7.js +1 -0
  28. package/dist/packem_shared/assertValidFileOrDirectoryPath-BTlt945W.js +1 -0
  29. package/dist/packem_shared/build-rm-options-avnusYx-.js +1 -0
  30. package/dist/packem_shared/collect-CIKDOMiD.js +1 -0
  31. package/dist/packem_shared/collectSync-D0FRLLqg.js +1 -0
  32. package/dist/packem_shared/copy-Beb64BYG.js +1 -0
  33. package/dist/packem_shared/copySync-CagcIEBi.js +1 -0
  34. package/dist/packem_shared/emptyDir-C7lyd1lW.js +1 -0
  35. package/dist/packem_shared/emptyDirSync-B8EYpmO9.js +1 -0
  36. package/dist/packem_shared/ensureDir-DGarVZw8.js +1 -0
  37. package/dist/packem_shared/ensureDirSync-CsgPrsDH.js +1 -0
  38. package/dist/packem_shared/ensureFile-CMugWljp.js +1 -0
  39. package/dist/packem_shared/ensureFileSync-CJYTEx2r.js +1 -0
  40. package/dist/packem_shared/ensureLink-ChShf3lf.js +1 -0
  41. package/dist/packem_shared/ensureLinkSync-DPpq0I2Z.js +1 -0
  42. package/dist/packem_shared/ensureSymlink-y4FZjfxA.js +1 -0
  43. package/dist/packem_shared/ensureSymlinkSync-TcHssCH7.js +1 -0
  44. package/dist/packem_shared/findUp-Cii5ATt5.js +1 -0
  45. package/dist/packem_shared/findUpSync-C9Lkh7-v.js +1 -0
  46. package/dist/packem_shared/get-file-info-type-DzWpohDB.js +1 -0
  47. package/dist/packem_shared/glob-fqg4KepW.js +1 -0
  48. package/dist/packem_shared/{glob-sync.d-BgJM6l8W.d.ts → glob-sync.d-hXe38TnZ.d.ts} +1 -1
  49. package/dist/packem_shared/globSync-B8_ne93E.js +1 -0
  50. package/dist/packem_shared/index-B2MhYg3r.js +1 -0
  51. package/dist/packem_shared/index-BHy3Kcr7.js +11 -0
  52. package/dist/packem_shared/index-BLg3XWiD.js +1 -0
  53. package/dist/packem_shared/index-D8MDd0tv.js +1 -0
  54. package/dist/packem_shared/ini-preserve-D1DopDLd.js +4 -0
  55. package/dist/packem_shared/is-stats-identical-l1GRN4Qu.js +1 -0
  56. package/dist/packem_shared/isAccessible-PmWJhV6I.js +1 -0
  57. package/dist/packem_shared/isAccessibleSync-BrbOtwdr.js +1 -0
  58. package/dist/packem_shared/jsonc-merge-Bkw73TLW.js +2 -0
  59. package/dist/packem_shared/map-read-error-CR3rQUxx.js +1 -0
  60. package/dist/packem_shared/move-DopmzT-2.js +1 -0
  61. package/dist/packem_shared/parseJson-kxKotn69.js +1 -0
  62. package/dist/packem_shared/readFile-BswaBgM0.js +1 -0
  63. package/dist/packem_shared/readFileSync-_fDF6Oj1.js +1 -0
  64. package/dist/packem_shared/readIni-BsXudu2r.js +1 -0
  65. package/dist/packem_shared/readIniSync-DKwRbbs9.js +1 -0
  66. package/dist/packem_shared/readJson-BCdoReQ-.js +1 -0
  67. package/dist/packem_shared/readJson5-CM1TIiHd.js +1 -0
  68. package/dist/packem_shared/readJson5Sync-Bc26c3Fy.js +1 -0
  69. package/dist/packem_shared/readJsonSync-CvkZyKmL.js +1 -0
  70. package/dist/packem_shared/readJsonc-BabpyMMh.js +1 -0
  71. package/dist/packem_shared/readJsoncSync-CCvRcAP-.js +1 -0
  72. package/dist/packem_shared/readToml-D4jpe9q_.js +1 -0
  73. package/dist/packem_shared/readTomlSync-B5PIYT9z.js +1 -0
  74. package/dist/packem_shared/readYaml-DvPxndW_.js +1 -0
  75. package/dist/packem_shared/readYamlSync-DZ-0hSbZ.js +1 -0
  76. package/dist/packem_shared/remove-CSbrd0dl.js +1 -0
  77. package/dist/packem_shared/removeSync-BoLAzRQE.js +1 -0
  78. package/dist/packem_shared/renderError-Dqej8k13-Bi9WKMjv.js +6 -0
  79. package/dist/packem_shared/resolve-symlink-target-CWrn0v4P.js +1 -0
  80. package/dist/packem_shared/sanitize-DGZ3w-_w.js +1 -0
  81. package/dist/packem_shared/stripJsonComments-Bfcn2PKv.js +1 -0
  82. package/dist/packem_shared/to-uint-8-array-BImOQNXm.js +1 -0
  83. package/dist/packem_shared/{types.d-C1ygRkw1.d.ts → types.d-BMdL_ygj.d.ts} +139 -26
  84. package/dist/packem_shared/walk-OX4-6oCP.js +1 -0
  85. package/dist/packem_shared/walk-include-BXhGSn6t.js +1 -0
  86. package/dist/packem_shared/walkSync-BPs6czIM.js +1 -0
  87. package/dist/packem_shared/writeFile-BrMtsJY7.js +1 -0
  88. package/dist/packem_shared/writeFileSync-W7Mf4BNy.js +1 -0
  89. package/dist/packem_shared/writeIni-BWX3cP1K.js +4 -0
  90. package/dist/packem_shared/writeIniSync-fOdgPFfL.js +4 -0
  91. package/dist/packem_shared/writeJson-bEVi25gX.js +4 -0
  92. package/dist/packem_shared/writeJson5-Ch8TpNPI.js +4 -0
  93. package/dist/packem_shared/writeJson5Sync-BrctV_Mk.js +4 -0
  94. package/dist/packem_shared/writeJsonSync-DkGnd416.js +4 -0
  95. package/dist/packem_shared/writeJsonc-CefrwsOc.js +4 -0
  96. package/dist/packem_shared/writeJsoncSync-BskDjn8o.js +4 -0
  97. package/dist/packem_shared/writeToml-IuMO-yDu.js +1 -0
  98. package/dist/packem_shared/writeTomlSync-DhL7hHzB.js +1 -0
  99. package/dist/packem_shared/writeYaml-ClQgvQID.js +1 -0
  100. package/dist/packem_shared/writeYamlSync-DrXtHQQq.js +1 -0
  101. package/dist/size.js +1 -1
  102. package/dist/toml.d.ts +2 -2
  103. package/dist/toml.js +1 -1
  104. package/dist/utils.d.ts +2 -2
  105. package/dist/utils.js +1 -1
  106. package/dist/yaml.d.ts +3 -3
  107. package/dist/yaml.js +1 -1
  108. package/package.json +2 -2
  109. package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +0 -1
  110. package/dist/packem_shared/DirectoryError-ddlbUV8C.js +0 -1
  111. package/dist/packem_shared/JSONError-D7h6PNWc.js +0 -4
  112. package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +0 -1
  113. package/dist/packem_shared/NotFoundError-BPiW0icm.js +0 -1
  114. package/dist/packem_shared/PermissionError-B1Emi5a9.js +0 -1
  115. package/dist/packem_shared/WalkError-Olmh4908.js +0 -1
  116. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  117. package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +0 -1
  118. package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +0 -1
  119. package/dist/packem_shared/build-rm-options-C1R4reBu.js +0 -1
  120. package/dist/packem_shared/collect-BuI4N8Cb.js +0 -1
  121. package/dist/packem_shared/collectSync-xeb7vY2J.js +0 -1
  122. package/dist/packem_shared/emptyDir-8utO028L.js +0 -1
  123. package/dist/packem_shared/emptyDirSync-Bk5fUX73.js +0 -1
  124. package/dist/packem_shared/ensureDir-CZ4oUFuo.js +0 -1
  125. package/dist/packem_shared/ensureDirSync-CoPWhbjM.js +0 -1
  126. package/dist/packem_shared/ensureFile-CF1cAAyh.js +0 -1
  127. package/dist/packem_shared/ensureFileSync-C3qR6naU.js +0 -1
  128. package/dist/packem_shared/ensureLink-LLLxlGHn.js +0 -1
  129. package/dist/packem_shared/ensureLinkSync-Dh_GtT8F.js +0 -1
  130. package/dist/packem_shared/ensureSymlink-bcGk7tvJ.js +0 -1
  131. package/dist/packem_shared/ensureSymlinkSync-BbVDPvI4.js +0 -1
  132. package/dist/packem_shared/findUp-CZow0UvS.js +0 -1
  133. package/dist/packem_shared/findUpSync-BOMeyfWY.js +0 -1
  134. package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +0 -1
  135. package/dist/packem_shared/glob-MHJQjR39.js +0 -1
  136. package/dist/packem_shared/globSync-CwzlELgS.js +0 -1
  137. package/dist/packem_shared/index-CYIVJA0W.js +0 -1
  138. package/dist/packem_shared/index-DrapuBsB.js +0 -1
  139. package/dist/packem_shared/index-K-NNTkpb.js +0 -11
  140. package/dist/packem_shared/index-yGx8uzZs.js +0 -1
  141. package/dist/packem_shared/indexToLineColumn-BRSZFC6I-zN_sCTx7.js +0 -6
  142. package/dist/packem_shared/ini-preserve-CXc_xkpG.js +0 -4
  143. package/dist/packem_shared/is-stats-identical-CohsLtWy.js +0 -1
  144. package/dist/packem_shared/isAccessible-CDFxsAAo.js +0 -1
  145. package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +0 -1
  146. package/dist/packem_shared/isFsCaseSensitive-CMZVY1A2.js +0 -1
  147. package/dist/packem_shared/jsonc-merge-CQMjx3Vw.js +0 -2
  148. package/dist/packem_shared/move-LmP6P9sn.js +0 -1
  149. package/dist/packem_shared/parseJson-DTdEDJwS.js +0 -1
  150. package/dist/packem_shared/readFile-BkNfutxp.js +0 -1
  151. package/dist/packem_shared/readFileSync-4c_c6Qey.js +0 -1
  152. package/dist/packem_shared/readIni-DlyyIBHq.js +0 -1
  153. package/dist/packem_shared/readIniSync-DwomjPMj.js +0 -1
  154. package/dist/packem_shared/readJson-BiskeuNZ.js +0 -1
  155. package/dist/packem_shared/readJson5-ffmra5zp.js +0 -1
  156. package/dist/packem_shared/readJson5Sync-oAo0gBuU.js +0 -1
  157. package/dist/packem_shared/readJsonSync-cmV1NjAI.js +0 -1
  158. package/dist/packem_shared/readJsonc-Bd6QH-bH.js +0 -1
  159. package/dist/packem_shared/readJsoncSync-rcXoQB_7.js +0 -1
  160. package/dist/packem_shared/readToml-4S8Io3SQ.js +0 -1
  161. package/dist/packem_shared/readTomlSync-CcZKONFn.js +0 -1
  162. package/dist/packem_shared/readYaml-D71jaFaB.js +0 -1
  163. package/dist/packem_shared/readYamlSync-B0UyP0rk.js +0 -1
  164. package/dist/packem_shared/remove-DH41Ov_c.js +0 -1
  165. package/dist/packem_shared/removeSync-50OEdnHd.js +0 -1
  166. package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +0 -1
  167. package/dist/packem_shared/sanitize-CU1xmyrg.js +0 -1
  168. package/dist/packem_shared/stripJsonComments-CzNR77MF.js +0 -1
  169. package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +0 -1
  170. package/dist/packem_shared/walk-CFHn3Kig.js +0 -1
  171. package/dist/packem_shared/walk-include-D2widdUw.js +0 -1
  172. package/dist/packem_shared/walkSync-D9PxD1XJ.js +0 -1
  173. package/dist/packem_shared/writeFile-DUmg8P4m.js +0 -1
  174. package/dist/packem_shared/writeFileSync-Cboe5Z4V.js +0 -1
  175. package/dist/packem_shared/writeIni-DioeLq2k.js +0 -4
  176. package/dist/packem_shared/writeIniSync-yk0js2T2.js +0 -4
  177. package/dist/packem_shared/writeJson-D5-N8O0Q.js +0 -4
  178. package/dist/packem_shared/writeJson5-RIZyw1vX.js +0 -4
  179. package/dist/packem_shared/writeJson5Sync-Cnxh1THk.js +0 -4
  180. package/dist/packem_shared/writeJsonSync-BrXiOras.js +0 -4
  181. package/dist/packem_shared/writeJsonc-lGAmFl9u.js +0 -4
  182. package/dist/packem_shared/writeJsoncSync-BFuqkLDq.js +0 -4
  183. package/dist/packem_shared/writeToml-CaXpILHA.js +0 -1
  184. package/dist/packem_shared/writeTomlSync-CQ2mzKjs.js +0 -1
  185. package/dist/packem_shared/writeYaml-DKBXiztZ.js +0 -1
  186. package/dist/packem_shared/writeYamlSync-DVKnrXBl.js +0 -1
  187. /package/dist/packem_shared/{F_OK-CAwY1qU7.js → FIND_UP_STOP-CAwY1qU7.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## @visulima/fs [5.0.0-alpha.32](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.31...@visulima/fs@5.0.0-alpha.32) (2026-06-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **fs:** fix walk symlinks, read/write/remove semantics, add copy ([d3d0070](https://github.com/visulima/visulima/commit/d3d0070a82e50a6fb42ed49fa0179aca2c18ee26))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * apply safe prettier and eslint formatting ([05120af](https://github.com/visulima/visulima/commit/05120af8c898d18c495575680f01134681e29b65))
10
+ * **fs:** apply prettier formatting across src and tests ([03409d7](https://github.com/visulima/visulima/commit/03409d783d96d0ed6358da88a72edea92a8b944b))
11
+
12
+ ### Tests
13
+
14
+ * **fs:** expect ENOENT (not EPERM) for readJson on a missing file ([7ccb840](https://github.com/visulima/visulima/commit/7ccb8404b4144cba2ec1ddcede62845fcfe91eb4))
15
+
16
+ ### Build System
17
+
18
+ * **deps:** update fs dependencies ([f30e540](https://github.com/visulima/visulima/commit/f30e5406813b18c48704761ea23d665a019eeab2))
19
+ * regenerate bundled-license manifests and types ordering ([af26588](https://github.com/visulima/visulima/commit/af26588d75aaa937fd4862800560bd4070a4878c))
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * **@visulima/path:** upgraded to 3.0.0-alpha.13
25
+ * **@visulima/error:** upgraded to 6.0.0-alpha.33
26
+
27
+ ## @visulima/fs [5.0.0-alpha.31](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.30...@visulima/fs@5.0.0-alpha.31) (2026-06-04)
28
+
29
+ ### Performance Improvements
30
+
31
+ * **fs:** share walk entry accessors, disable keepNames ([7fbae0b](https://github.com/visulima/visulima/commit/7fbae0b27c4b7eafef559446ec0dddcf1044151d))
32
+
1
33
  ## @visulima/fs [5.0.0-alpha.30](https://github.com/visulima/visulima/compare/@visulima/fs@5.0.0-alpha.29...@visulima/fs@5.0.0-alpha.30) (2026-06-04)
2
34
 
3
35
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -344,6 +344,35 @@ Repository: privatenumber/is-fs-case-sensitive
344
344
 
345
345
  ---------------------------------------
346
346
 
347
+ ## tinyglobby
348
+ License: MIT
349
+ By: Superchupu
350
+ Repository: git+https://github.com/SuperchupuDev/tinyglobby.git
351
+
352
+ > MIT License
353
+ >
354
+ > Copyright (c) 2024 Madeline Gurriarán
355
+ >
356
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
357
+ > of this software and associated documentation files (the "Software"), to deal
358
+ > in the Software without restriction, including without limitation the rights
359
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
360
+ > copies of the Software, and to permit persons to whom the Software is
361
+ > furnished to do so, subject to the following conditions:
362
+ >
363
+ > The above copyright notice and this permission notice shall be included in all
364
+ > copies or substantial portions of the Software.
365
+ >
366
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
367
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
368
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
369
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
370
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
371
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
372
+ > SOFTWARE.
373
+
374
+ ---------------------------------------
375
+
347
376
  ## yaml
348
377
  License: ISC
349
378
  By: Eemeli Aro
package/README.md CHANGED
@@ -66,6 +66,71 @@ pnpm add yaml
66
66
 
67
67
  ## Usage
68
68
 
69
+ ### Quickstart by subpath
70
+
71
+ `@visulima/fs` ships one entry per concern. Import from the narrowest subpath you
72
+ need so the optional parser peers (`yaml`, `smol-toml`, `jsonc-parser`, `json5`,
73
+ `ini`) stay tree-shaken.
74
+
75
+ ```typescript
76
+ // Core fs surface: walk, glob, findUp, ensure*, read/writeFile, copy, move, remove, emptyDir, isAccessible, sanitize, EOL.
77
+ import { copy, ensureDir, findUp, readFile, walk, writeFile } from "@visulima/fs";
78
+
79
+ // Typed error classes (NotFoundError, AlreadyExistsError, PermissionError, …).
80
+ import { NotFoundError } from "@visulima/fs/error";
81
+
82
+ // Parser-backed helpers — each needs its peer dependency installed.
83
+ import { readYaml, writeYaml } from "@visulima/fs/yaml";
84
+ import { readJsonc, writeJsonc } from "@visulima/fs/jsonc";
85
+
86
+ // Glob primitives and size/eol helpers.
87
+ import { glob } from "@visulima/fs/glob";
88
+ import { gzipSize } from "@visulima/fs/size";
89
+ ```
90
+
91
+ ### Copy a file or directory
92
+
93
+ ```typescript
94
+ import { copy } from "@visulima/fs";
95
+
96
+ // Copy a template directory, skipping node_modules and overwriting existing files.
97
+ await copy("templates/app", "out/app", {
98
+ filter: (source) => !source.includes("node_modules"),
99
+ });
100
+
101
+ // Refuse to overwrite an existing destination.
102
+ import { AlreadyExistsError } from "@visulima/fs/error";
103
+
104
+ try {
105
+ await copy("a.txt", "b.txt", { overwrite: false });
106
+ } catch (error) {
107
+ if (error instanceof AlreadyExistsError) {
108
+ console.error("destination already exists");
109
+ }
110
+ }
111
+ ```
112
+
113
+ ### Coming from `fs-extra`?
114
+
115
+ | `fs-extra` | `@visulima/fs` |
116
+ | ------------------------------ | ----------------------------------------------------------------------- |
117
+ | `copy` / `copySync` | `copy` / `copySync` |
118
+ | `move` / `moveSync` | `move` / `moveSync` |
119
+ | `remove` / `removeSync` | `remove` / `removeSync` (real `EACCES`/`EBUSY` errors propagate) |
120
+ | `emptyDir` / `emptyDirSync` | `emptyDir` / `emptyDirSync` |
121
+ | `ensureFile` / `ensureDir` / … | `ensureFile` / `ensureDir` / `ensureLink` / `ensureSymlink` (+ `*Sync`) |
122
+ | `readJson` / `writeJson` | `readJson` / `writeJson` (+ `*Sync`) |
123
+ | `pathExists` | `isAccessible` / `isAccessibleSync` |
124
+
125
+ > **`writeFile` notes:** `overwrite` defaults to `true`. With `overwrite: false`,
126
+ > `writeFile` throws `AlreadyExistsError` if the target exists instead of
127
+ > overwriting it. To keep a copy of the previous file before overwriting, pass
128
+ > `{ backup: true }` — the old contents are renamed to `${path}.bak`.
129
+ >
130
+ > **`readFile` errors:** a missing file throws `NotFoundError` (`ENOENT`); a file
131
+ > that cannot be read for permission reasons throws `PermissionError`
132
+ > (`EACCES`/`EPERM`).
133
+
69
134
  ## walk
70
135
 
71
136
  ```typescript
package/dist/eol.js CHANGED
@@ -1,3 +1,3 @@
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=`
1
+ import{createRequire as i}from"node:module";const u=i(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:p}=a,s=/\r?\n/g,c=`
2
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};
3
+ `,_=p==="win32"?r:c,g=t=>{const e=t.match(s);if(!e||e.length===0)return null;const o=e.filter(l=>l===r).length,n=e.length-o;return o>n?r:c},h=(t,e)=>t.replaceAll(s,e);export{r as CRLF,_ as EOL,c as LF,g as detect,h as format};
package/dist/error.js CHANGED
@@ -1 +1 @@
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
+ import{default as t}from"./packem_shared/AlreadyExistsError-DEb3UWja.js";import{default as a}from"./packem_shared/DirectoryError-BtwSTLmT.js";import{default as s}from"./packem_shared/JSONError-Cvp9ycba.js";import{default as l}from"./packem_shared/NotEmptyError-DZ1Ix089.js";import{default as E}from"./packem_shared/NotFoundError-CnRY6lVp.js";import{default as u}from"./packem_shared/PermissionError-DJ_2VWEj.js";import{default as i}from"./packem_shared/WalkError-B8qTd-v-.js";export{t as AlreadyExistsError,a as DirectoryError,s as JSONError,l as NotEmptyError,E as NotFoundError,u as PermissionError,i as WalkError};
@@ -1 +1 @@
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};
1
+ import{createRequire as g}from"node:module";import{g as _}from"./packem_shared/_commonjsHelpers-CWAkuNXM.js";import{r as v}from"./packem_shared/index-BHy3Kcr7.js";const h=g(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=s=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,o]=i.versions.node.split(".").map(Number);if(r>22||r===22&&o>=3||r===20&&o>=16)return i.getBuiltinModule(s)}return h(s)},q=f("path"),j=f("os");var l,u;function x(){if(u)return l;u=1;var s=v(),r=q.posix.dirname,o=j.platform()==="win32",n="/",p=/\\/g,d=/\\([!*?|[\](){}])/g;l=function(e,a){var t=Object.assign({flipBackslashes:!0},a);t.flipBackslashes&&o&&e.indexOf(n)<0&&(e=e.replace(p,n)),b(e)&&(e+=n),e+="a";do e=r(e);while(m(e));return e.replace(d,"$1")};function b(e){var a=e.slice(-1),t;switch(a){case"}":t="{";break;case"]":t="[";break;default:return!1}var c=e.indexOf(t);return c<0?!1:e.slice(c+1,-1).includes(n)}function m(e){return/\([^()]+$/.test(e)||e[0]==="{"||e[0]==="["||/[^\\][{[]/.test(e)?!0:s(e)}return l}var P=x();const $=_(P),B=(s,r)=>$(s,r);export{B as default};
package/dist/glob.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-BgJM6l8W.js";
2
- export { type G as GlobOptions } from "./packem_shared/types.d-C1ygRkw1.js";
1
+ export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-hXe38TnZ.js";
2
+ export type { G as GlobOptions } from "./packem_shared/types.d-BMdL_ygj.js";
3
3
  import 'node:fs';
4
- import 'tinyglobby';
4
+ import 'fdir';
package/dist/glob.js CHANGED
@@ -1 +1 @@
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};
1
+ import{default as e}from"./packem_shared/glob-fqg4KepW.js";import{default as l}from"./packem_shared/globSync-B8_ne93E.js";export{e as glob,l as globSync};
package/dist/index.d.ts CHANGED
@@ -1,14 +1,105 @@
1
- import { q as WalkOptions, F as FindUpName, r as FindUpOptions, s as FindUpNameSync, t as WalkEntry, u as ReadFileOptions, v as ContentType, w as ReadJsonOptions, J as JsonReviver, x as RetryOptions, y as WriteFileOptions, z as WriteJsonOptions } from "./packem_shared/types.d-C1ygRkw1.js";
2
- export { type A as CodeFrameLocation, type C as CodeFrameOptions, B as FIND_UP_STOP, D as F_OK, type E as FindUpNameFnResult, type H as FindUpNameSyncFnResult, type G as GlobOptions, type b as JsonReplacer, K as R_OK, type L as ReadFileEncoding, M as W_OK, X as X_OK } from "./packem_shared/types.d-C1ygRkw1.js";
1
+ import { q as WalkOptions, F as FindUpName, r as FindUpOptions, s as FindUpNameSync, t as WalkEntry, u as ReadFileOptions, v as ContentType, w as ReadJsonOptions, l as JsonReviver, x as RetryOptions, y as WriteFileOptions, z as WriteJsonOptions } from "./packem_shared/types.d-BMdL_ygj.js";
2
+ export { type A as CodeFrameLocation, type k as CodeFrameOptions, B as FIND_UP_STOP, D as F_OK, type E as FindUpNameFnResult, type H as FindUpNameSyncFnResult, type G as GlobOptions, type o as JsonReplacer, K as R_OK, type L as ReadFileEncoding, M as W_OK, X as X_OK } from "./packem_shared/types.d-BMdL_ygj.js";
3
3
  import { symlink } from 'node:fs';
4
4
  export { CRLF, EOL, LF, detect, format } from "./eol.js";
5
- export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-BgJM6l8W.js";
5
+ export { g as glob, a as globSync } from "./packem_shared/glob-sync.d-hXe38TnZ.js";
6
6
  export { type GlobParentOptions, default as globParent } from "./glob-parent.js";
7
7
  export { type IsGlobOptions, default as isGlob } from "./is-glob.js";
8
8
  export { type MatchOptions, match, matcher } from "./match.js";
9
9
  import { JsonValue } from 'type-fest';
10
10
  import fs from 'fs';
11
- import 'tinyglobby';
11
+ import 'fdir';
12
+ /**
13
+ * Options for `copy` and `copySync`.
14
+ */
15
+ type CopyOptions = {
16
+ /**
17
+ * Dereference symlinks, copying the files they point to instead of the
18
+ * links themselves.
19
+ * @default false
20
+ */
21
+ dereference?: boolean;
22
+ /**
23
+ * When `true`, throw an error if the destination already exists and
24
+ * {@link CopyOptions.overwrite} is `false`. When `false`, existing files
25
+ * are silently skipped.
26
+ * @default true
27
+ */
28
+ errorOnExist?: boolean;
29
+ /**
30
+ * Function to filter which files/directories are copied. Return `true` to
31
+ * copy the item, `false` to skip it (and, for directories, their contents).
32
+ * @param source The source path being considered.
33
+ * @param destination The destination path it would be copied to.
34
+ * @returns Whether to copy the item.
35
+ */
36
+ filter?: (source: string, destination: string) => boolean | Promise<boolean>;
37
+ /**
38
+ * Overwrite existing files/directories at the destination.
39
+ * @default true
40
+ */
41
+ overwrite?: boolean;
42
+ /**
43
+ * Preserve timestamps (`atime`/`mtime`) from the source.
44
+ * @default false
45
+ */
46
+ preserveTimestamps?: boolean;
47
+ /**
48
+ * When `true`, copy directories recursively.
49
+ * @default true
50
+ */
51
+ recursive?: boolean;
52
+ /**
53
+ * When `overwrite` is `false`, this controls whether copying over an
54
+ * existing file throws. Mirrors `node:fs.cp`'s `verbatimSymlinks`.
55
+ * @default false
56
+ */
57
+ verbatimSymlinks?: boolean;
58
+ };
59
+ /**
60
+ * Synchronous variant of {@link CopyOptions.filter}.
61
+ */
62
+ type CopyFilterSync = (source: string, destination: string) => boolean;
63
+ /**
64
+ * Asynchronously copies a file or directory (recursively) from `source` to `destination`.
65
+ *
66
+ * Built on `node:fs.cp`, this completes the fs-extra parity story alongside
67
+ * `move`, `remove` and `emptyDir`.
68
+ * @param source The file or directory to copy. Can be a file URL or a string path.
69
+ * @param destination The target path. Can be a file URL or a string path.
70
+ * @param options Optional configuration. See {@link CopyOptions}.
71
+ * @returns A promise that resolves when the copy completes.
72
+ * @throws {AlreadyExistsError} When `overwrite` is `false`, `errorOnExist` is `true`, and the destination exists.
73
+ * @example
74
+ * ```javascript
75
+ * import { copy } from "@visulima/fs";
76
+ *
77
+ * // Copy a template directory, skipping node_modules and overwriting existing files
78
+ * await copy("templates/app", "out/app", {
79
+ * filter: (src) => !src.includes("node_modules"),
80
+ * });
81
+ * ```
82
+ */
83
+ declare const copy: (source: URL | string, destination: URL | string, options?: CopyOptions) => Promise<void>;
84
+ /**
85
+ * Synchronously copies a file or directory (recursively) from `source` to `destination`.
86
+ *
87
+ * The synchronous counterpart of `copy`. Note that `cpSync` only accepts a
88
+ * synchronous `filter`.
89
+ * @param source The file or directory to copy. Can be a file URL or a string path.
90
+ * @param destination The target path. Can be a file URL or a string path.
91
+ * @param options Optional configuration. See {@link CopyOptions} (the `filter` must be synchronous).
92
+ * @throws {AlreadyExistsError} When `overwrite` is `false`, `errorOnExist` is `true`, and the destination exists.
93
+ * @example
94
+ * ```javascript
95
+ * import { copySync } from "@visulima/fs";
96
+ *
97
+ * copySync("templates/app", "out/app", { overwrite: false, errorOnExist: false });
98
+ * ```
99
+ */
100
+ declare const copySync: (source: URL | string, destination: URL | string, options?: Omit<CopyOptions, "filter"> & {
101
+ filter?: CopyFilterSync;
102
+ }) => void;
12
103
  /**
13
104
  * Ensures that the directory exists.
14
105
  * If the directory structure does not exist, it is created. Like mkdir -p.
@@ -328,16 +419,7 @@ declare const findUpSync: (name: FindUpNameSync, options?: FindUpOptions) => str
328
419
  * printEntries();
329
420
  * ```
330
421
  */
331
- declare function walk(directory: URL | string, {
332
- extensions,
333
- followSymlinks,
334
- includeDirs: includeDirectories,
335
- includeFiles,
336
- includeSymlinks,
337
- match,
338
- maxDepth,
339
- skip
340
- }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
422
+ declare function walk(directory: URL | string, options?: WalkOptions): AsyncIterableIterator<WalkEntry>;
341
423
  /**
342
424
  * Synchronously walks the file tree rooted at `directory`, yielding each file or directory that matches the criteria specified in `options`.
343
425
  * This is the synchronous version of the async walk function.
@@ -370,16 +452,7 @@ declare function walk(directory: URL | string, {
370
452
  * }
371
453
  * ```
372
454
  */
373
- declare function walkSync(directory: URL | string, {
374
- extensions,
375
- followSymlinks,
376
- includeDirs: includeDirectories,
377
- includeFiles,
378
- includeSymlinks,
379
- match,
380
- maxDepth,
381
- skip
382
- }?: WalkOptions): IterableIterator<WalkEntry>;
455
+ declare function walkSync(directory: URL | string, options?: WalkOptions): IterableIterator<WalkEntry>;
383
456
  /**
384
457
  * Asynchronously tests a user's permissions for the file or directory specified by path.
385
458
  * Returns a Promise that resolves to `true` if the accessibility check is successful, `false` otherwise.
@@ -854,4 +927,4 @@ type FsSubset = {
854
927
  * ```
855
928
  */
856
929
  declare const isFsCaseSensitive: (directoryPath?: string, fsInstance?: FsSubset, useCache?: boolean) => boolean;
857
- export { type ContentType, type FindUpName, type FindUpNameSync, type FindUpOptions, type JsonReviver, type Options as MoveOptions, type ReadFileOptions, type ReadJsonOptions, type SanitizeOptions, type WalkEntry, type WalkOptions, type WriteFileOptions, type WriteJsonOptions, collect, collectSync, emptyDir, emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, isAccessible, isAccessibleSync, isFsCaseSensitive, move, moveSync, readFile, readFileSync, readJson, readJsonSync, remove, removeSync, rename, renameSync, sanitize, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync };
930
+ export { type ContentType, type CopyFilterSync, type CopyOptions, type FindUpName, type FindUpNameSync, type FindUpOptions, type JsonReviver, type Options as MoveOptions, type ReadFileOptions, type ReadJsonOptions, type SanitizeOptions, type WalkEntry, type WalkOptions, type WriteFileOptions, type WriteJsonOptions, collect, collectSync, copy, copySync, emptyDir, emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, isAccessible, isAccessibleSync, isFsCaseSensitive, move, moveSync, readFile, readFileSync, readJson, readJsonSync, remove, removeSync, rename, renameSync, sanitize, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{FIND_UP_STOP as o,F_OK as t,R_OK as a,W_OK as f,X_OK as s}from"./packem_shared/F_OK-CAwY1qU7.js";import{default as m}from"./packem_shared/ensureDir-CZ4oUFuo.js";import{default as n}from"./packem_shared/ensureDirSync-CoPWhbjM.js";import{default as d}from"./packem_shared/ensureFile-CF1cAAyh.js";import{default as i}from"./packem_shared/ensureFileSync-C3qR6naU.js";import{default as y}from"./packem_shared/ensureLink-LLLxlGHn.js";import{default as F}from"./packem_shared/ensureLinkSync-Dh_GtT8F.js";import{default as k}from"./packem_shared/ensureSymlink-bcGk7tvJ.js";import{default as O}from"./packem_shared/ensureSymlinkSync-BbVDPvI4.js";import{CRLF as v,EOL as D,LF as L,detect as J,format as K}from"./eol.js";import{default as P}from"./packem_shared/collect-BuI4N8Cb.js";import{default as h}from"./packem_shared/collectSync-xeb7vY2J.js";import{default as C}from"./packem_shared/findUp-CZow0UvS.js";import{default as z}from"./packem_shared/findUpSync-BOMeyfWY.js";import{default as G}from"./packem_shared/glob-MHJQjR39.js";import{default as N}from"./packem_shared/globSync-CwzlELgS.js";import{default as W}from"./packem_shared/walk-CFHn3Kig.js";import{default as j}from"./packem_shared/walkSync-D9PxD1XJ.js";import{default as B}from"./glob-parent.js";import{default as M}from"./packem_shared/isAccessible-CDFxsAAo.js";import{default as V}from"./packem_shared/isAccessibleSync-5nzZWgin.js";import{default as Z}from"./is-glob.js";import{match as ee,matcher as re}from"./match.js";import{move as te,moveSync as ae,rename as fe,renameSync as se}from"./packem_shared/move-LmP6P9sn.js";import{default as me}from"./packem_shared/readFile-BkNfutxp.js";import{default as ne}from"./packem_shared/readFileSync-4c_c6Qey.js";import{default as de}from"./packem_shared/readJson-BiskeuNZ.js";import{default as ie}from"./packem_shared/readJsonSync-cmV1NjAI.js";import{default as ye}from"./packem_shared/emptyDir-8utO028L.js";import{default as Fe}from"./packem_shared/emptyDirSync-Bk5fUX73.js";import{default as ke}from"./packem_shared/remove-DH41Ov_c.js";import{default as Oe}from"./packem_shared/removeSync-50OEdnHd.js";import{sanitize as ve}from"./packem_shared/sanitize-CU1xmyrg.js";import{default as Le}from"./packem_shared/writeFile-DUmg8P4m.js";import{default as Ke}from"./packem_shared/writeFileSync-Cboe5Z4V.js";import{default as Pe}from"./packem_shared/writeJson-D5-N8O0Q.js";import{default as he}from"./packem_shared/writeJsonSync-BrXiOras.js";import{isFsCaseSensitive as Ce}from"./packem_shared/isFsCaseSensitive-CMZVY1A2.js";export{v as CRLF,D as EOL,o as FIND_UP_STOP,t as F_OK,L as LF,a as R_OK,f as W_OK,s as X_OK,P as collect,h as collectSync,J as detect,ye as emptyDir,Fe as emptyDirSync,m as ensureDir,n as ensureDirSync,d as ensureFile,i as ensureFileSync,y as ensureLink,F as ensureLinkSync,k as ensureSymlink,O as ensureSymlinkSync,C as findUp,z as findUpSync,K as format,G as glob,B as globParent,N as globSync,M as isAccessible,V as isAccessibleSync,Ce as isFsCaseSensitive,Z as isGlob,ee as match,re as matcher,te as move,ae as moveSync,me as readFile,ne as readFileSync,de as readJson,ie as readJsonSync,ke as remove,Oe as removeSync,fe as rename,se as renameSync,ve as sanitize,W as walk,j as walkSync,Le as writeFile,Ke as writeFileSync,Pe as writeJson,he as writeJsonSync};
1
+ import{createRequire as h}from"node:module";import{FIND_UP_STOP as L,F_OK as P,R_OK as R,W_OK as $,X_OK as J}from"./packem_shared/FIND_UP_STOP-CAwY1qU7.js";import{default as T}from"./packem_shared/copy-Beb64BYG.js";import{default as W}from"./packem_shared/copySync-CagcIEBi.js";import{default as M}from"./packem_shared/ensureDir-DGarVZw8.js";import{default as E}from"./packem_shared/ensureDirSync-CsgPrsDH.js";import{default as z}from"./packem_shared/ensureFile-CMugWljp.js";import{default as I}from"./packem_shared/ensureFileSync-CJYTEx2r.js";import{default as H}from"./packem_shared/ensureLink-ChShf3lf.js";import{default as V}from"./packem_shared/ensureLinkSync-DPpq0I2Z.js";import{default as Z}from"./packem_shared/ensureSymlink-y4FZjfxA.js";import{default as re}from"./packem_shared/ensureSymlinkSync-TcHssCH7.js";import{CRLF as oe,EOL as se,LF as ae,detect as ne,format as ie}from"./eol.js";import{default as le}from"./packem_shared/collect-CIKDOMiD.js";import{default as ue}from"./packem_shared/collectSync-D0FRLLqg.js";import{default as me}from"./packem_shared/findUp-Cii5ATt5.js";import{default as xe}from"./packem_shared/findUpSync-C9Lkh7-v.js";import{default as Se}from"./packem_shared/glob-fqg4KepW.js";import{default as _e}from"./packem_shared/globSync-B8_ne93E.js";import{default as Fe}from"./packem_shared/walk-OX4-6oCP.js";import{default as ge}from"./packem_shared/walkSync-BPs6czIM.js";import{default as ke}from"./glob-parent.js";import{default as De}from"./packem_shared/isAccessible-PmWJhV6I.js";import{default as qe}from"./packem_shared/isAccessibleSync-BrbOtwdr.js";import{default as Le}from"./is-glob.js";import{match as Re,matcher as $e}from"./match.js";import{move as Ke,moveSync as Te,rename as Ue,renameSync as We}from"./packem_shared/move-DopmzT-2.js";import{default as Me}from"./packem_shared/readFile-BswaBgM0.js";import{default as Ee}from"./packem_shared/readFileSync-_fDF6Oj1.js";import{default as ze}from"./packem_shared/readJson-BCdoReQ-.js";import{default as Ie}from"./packem_shared/readJsonSync-CvkZyKmL.js";import{default as He}from"./packem_shared/emptyDir-C7lyd1lW.js";import{default as Ve}from"./packem_shared/emptyDirSync-B8EYpmO9.js";import{default as Ze}from"./packem_shared/remove-CSbrd0dl.js";import{default as rr}from"./packem_shared/removeSync-BoLAzRQE.js";import{sanitize as or}from"./packem_shared/sanitize-DGZ3w-_w.js";import{default as ar}from"./packem_shared/writeFile-BrMtsJY7.js";import{default as ir}from"./packem_shared/writeFileSync-W7Mf4BNy.js";import{default as lr}from"./packem_shared/writeJson-bEVi25gX.js";import{default as ur}from"./packem_shared/writeJsonSync-DkGnd416.js";const F=h(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=i=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[s,f]=n.versions.node.split(".").map(Number);if(s>22||s===22&&f>=3||s===20&&f>=16)return n.getBuiltinModule(i)}return F(i)},b=u("fs"),g=u("os"),w=u("path");var c={},x;function k(){if(x)return c;x=1;var i=Object.defineProperty,s=(o,e)=>i(o,"name",{value:e,configurable:!0}),f=b,y=g,S=w;const p=s(o=>{let e="";for(let r=0;r<o.length;r+=1){const t=o[r],a=t.toUpperCase();e+=t===a?t.toLowerCase():a}return e},"invertCase"),l=new Map,m=s((o,e)=>{const r=S.join(o,`.is-fs-case-sensitive-test-${process.pid}`);try{return e.writeFileSync(r,""),!e.existsSync(p(r))}finally{try{e.unlinkSync(r)}catch{}}},"checkDirectoryCaseWithWrite"),v=s((o,e,r)=>{try{return m(o,r)}catch(t){if(e===void 0)return m(y.tmpdir(),r);throw t}},"checkDirectoryCaseWithFallback"),_=s((o,e=f,r=!0)=>{const t=o??process.cwd();if(r&&l.has(t))return l.get(t);let a;const d=p(t);return d!==t&&e.existsSync(t)?a=!e.existsSync(d):a=v(t,o,e),r&&l.set(t,a),a},"isFsCaseSensitive");return c.isFsCaseSensitive=_,c}var C=k();const j=C.isFsCaseSensitive;export{oe as CRLF,se as EOL,L as FIND_UP_STOP,P as F_OK,ae as LF,R as R_OK,$ as W_OK,J as X_OK,le as collect,ue as collectSync,T as copy,W as copySync,ne as detect,He as emptyDir,Ve as emptyDirSync,M as ensureDir,E as ensureDirSync,z as ensureFile,I as ensureFileSync,H as ensureLink,V as ensureLinkSync,Z as ensureSymlink,re as ensureSymlinkSync,me as findUp,xe as findUpSync,ie as format,Se as glob,ke as globParent,_e as globSync,De as isAccessible,qe as isAccessibleSync,j as isFsCaseSensitive,Le as isGlob,Re as match,$e as matcher,Ke as move,Te as moveSync,Me as readFile,Ee as readFileSync,ze as readJson,Ie as readJsonSync,Ze as remove,rr as removeSync,Ue as rename,We as renameSync,or as sanitize,Fe as walk,ge as walkSync,ar as writeFile,ir as writeFileSync,lr as writeJson,ur as writeJsonSync};
package/dist/ini.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as CompressionType, n as ReadIniOptions, o as WriteIniOptions } from "./packem_shared/types.d-C1ygRkw1.js";
2
- export { type I as IniEncodeOptions, type p as IniLineEnding } from "./packem_shared/types.d-C1ygRkw1.js";
1
+ import { C as CompressionType, R as ReadIniOptions, W as WriteIniOptions } from "./packem_shared/types.d-BMdL_ygj.js";
2
+ export type { I as IniEncodeOptions, a as IniLineEnding } from "./packem_shared/types.d-BMdL_ygj.js";
3
3
  import 'node:fs';
4
- import 'tinyglobby';
4
+ import 'fdir';
5
5
  /**
6
6
  * Asynchronously reads an INI file and parses it into an object.
7
7
  * @template R The expected type of the parsed object. Defaults to `Record&lt;string, unknown>`.
package/dist/ini.js CHANGED
@@ -1 +1 @@
1
- import{default as a}from"./packem_shared/readIni-DlyyIBHq.js";import{default as f}from"./packem_shared/readIniSync-DwomjPMj.js";import{default as d}from"./packem_shared/writeIni-DioeLq2k.js";import{default as n}from"./packem_shared/writeIniSync-yk0js2T2.js";export{a as readIni,f as readIniSync,d as writeIni,n as writeIniSync};
1
+ import{default as a}from"./packem_shared/readIni-BsXudu2r.js";import{default as f}from"./packem_shared/readIniSync-DKwRbbs9.js";import{default as d}from"./packem_shared/writeIni-BWX3cP1K.js";import{default as n}from"./packem_shared/writeIniSync-fOdgPFfL.js";export{a as readIni,f as readIniSync,d as writeIni,n as writeIniSync};
package/dist/is-glob.js CHANGED
@@ -1 +1 @@
1
- var t=Object.defineProperty;var e=(r,o)=>t(r,"name",{value:o,configurable:!0});import{g as a}from"./packem_shared/_commonjsHelpers-D6W6KoPK.js";import{r as s}from"./packem_shared/index-K-NNTkpb.js";var i=s();const l=a(i);var f=Object.defineProperty,m=e((r,o)=>f(r,"name",{value:o,configurable:!0}),"s");const b=m((r,o)=>l(r,o),"isGlob");export{b as default};
1
+ import{g as s}from"./packem_shared/_commonjsHelpers-CWAkuNXM.js";import{r as t}from"./packem_shared/index-BHy3Kcr7.js";var a=t();const e=s(a),f=(o,r)=>e(o,r);export{f as default};
package/dist/json5.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as CompressionType, j as ReadJson5Options, k as Json5Reviver, l as WriteJson5Options } from "./packem_shared/types.d-C1ygRkw1.js";
2
- export { type m as Json5Replacer } from "./packem_shared/types.d-C1ygRkw1.js";
1
+ import { C as CompressionType, b as ReadJson5Options, J as Json5Reviver, c as WriteJson5Options } from "./packem_shared/types.d-BMdL_ygj.js";
2
+ export type { d as Json5Replacer } from "./packem_shared/types.d-BMdL_ygj.js";
3
3
  import 'node:fs';
4
- import 'tinyglobby';
4
+ import 'fdir';
5
5
  declare function readJson5<R = unknown>(path: URL | string, options?: ReadJson5Options<CompressionType>): Promise<R>;
6
6
  declare function readJson5<R = unknown>(path: URL | string, reviver: Json5Reviver, options?: ReadJson5Options<CompressionType>): Promise<R>;
7
7
  declare function readJson5Sync(path: URL | string, options?: ReadJson5Options<CompressionType>): unknown;
package/dist/json5.js CHANGED
@@ -1 +1 @@
1
- import{default as r}from"./packem_shared/readJson5-ffmra5zp.js";import{default as t}from"./packem_shared/readJson5Sync-oAo0gBuU.js";import{default as s}from"./packem_shared/writeJson5-RIZyw1vX.js";import{default as n}from"./packem_shared/writeJson5Sync-Cnxh1THk.js";export{r as readJson5,t as readJson5Sync,s as writeJson5,n as writeJson5Sync};
1
+ import{default as r}from"./packem_shared/readJson5-CM1TIiHd.js";import{default as t}from"./packem_shared/readJson5Sync-Bc26c3Fy.js";import{default as s}from"./packem_shared/writeJson5-Ch8TpNPI.js";import{default as n}from"./packem_shared/writeJson5Sync-BrctV_Mk.js";export{r as readJson5,t as readJson5Sync,s as writeJson5,n as writeJson5Sync};
package/dist/jsonc.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a as CompressionType, f as ReadJsoncOptions, g as WriteJsoncOptions } from "./packem_shared/types.d-C1ygRkw1.js";
2
- export { type h as JsoncFormattingOptions, type i as JsoncParseOptions } from "./packem_shared/types.d-C1ygRkw1.js";
1
+ import { C as CompressionType, e as ReadJsoncOptions, f as WriteJsoncOptions } from "./packem_shared/types.d-BMdL_ygj.js";
2
+ export type { g as JsoncFormattingOptions, h as JsoncParseOptions } from "./packem_shared/types.d-BMdL_ygj.js";
3
3
  import 'node:fs';
4
- import 'tinyglobby';
4
+ import 'fdir';
5
5
  /**
6
6
  * Asynchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value.
7
7
  * Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`.
package/dist/jsonc.js CHANGED
@@ -1 +1 @@
1
- import{default as r}from"./packem_shared/readJsonc-Bd6QH-bH.js";import{default as t}from"./packem_shared/readJsoncSync-rcXoQB_7.js";import{default as s}from"./packem_shared/writeJsonc-lGAmFl9u.js";import{default as d}from"./packem_shared/writeJsoncSync-BFuqkLDq.js";export{r as readJsonc,t as readJsoncSync,s as writeJsonc,d as writeJsoncSync};
1
+ import{default as r}from"./packem_shared/readJsonc-BabpyMMh.js";import{default as t}from"./packem_shared/readJsoncSync-CCvRcAP-.js";import{default as s}from"./packem_shared/writeJsonc-CefrwsOc.js";import{default as d}from"./packem_shared/writeJsoncSync-BskDjn8o.js";export{r as readJsonc,t as readJsoncSync,s as writeJsonc,d as writeJsoncSync};
package/dist/match.js CHANGED
@@ -1 +1 @@
1
- var s=Object.defineProperty;var c=(r,e)=>s(r,"name",{value:e,configurable:!0});import{s as m}from"./packem_shared/index-DrapuBsB.js";var i=Object.defineProperty,n=c((r,e)=>i(r,"name",{value:e,configurable:!0}),"a");const f=n((r,e,a)=>{const t=m(e,a);return Array.isArray(r)?r.some(o=>t(o)):t(r)},"match"),p=n((r,e)=>{const a=m(r,e);return t=>a(t)},"matcher");export{f as match,p as matcher};
1
+ import{a}from"./packem_shared/index-D8MDd0tv.js";const o=(r,e,n)=>{const t=a(e,n);return Array.isArray(r)?r.some(c=>t(c)):t(r)},s=(r,e)=>{const n=a(r,e);return t=>n(t)};export{o as match,s as matcher};
@@ -0,0 +1 @@
1
+ class t extends Error{constructor(r){super(`EEXIST: ${r}`)}get code(){return"EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}}export{t as default};
@@ -0,0 +1 @@
1
+ class o extends Error{constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`)}get code(){return"EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}}export{o as default};
@@ -0,0 +1,4 @@
1
+ class r extends Error{fileName;codeFrame;name="JSONError";#e;constructor(e){super(),this.#e=e}get message(){return`${this.#e}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
2
+
3
+ ${this.codeFrame}
4
+ `:""}`}set message(e){this.#e=e}}export{r as default};
@@ -0,0 +1 @@
1
+ class t extends Error{constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`)}get code(){return"ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}}export{t as default};
@@ -0,0 +1 @@
1
+ class o extends Error{constructor(r){super(`ENOENT: ${r}`)}get code(){return"ENOENT"}set code(r){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(r){throw new Error("Cannot overwrite name of NotFoundError")}}export{o as default};
@@ -0,0 +1 @@
1
+ class o extends Error{constructor(r){super(`EPERM: Operation not permitted, ${r}`)}get code(){return"EPERM"}set code(r){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(r){throw new Error("Cannot overwrite name of PermissionError")}}export{o as default};
@@ -0,0 +1 @@
1
+ class e extends Error{root;constructor(r,o){super(`${r instanceof Error?r.message:String(r)} for path "${o}"`),this.cause=r,this.root=o}get name(){return"WalkError"}set name(r){throw new Error("Cannot overwrite name of WalkError")}}export{e as default};
@@ -0,0 +1 @@
1
+ function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}export{o as g};
@@ -0,0 +1 @@
1
+ const e=r=>{if(typeof r!="string"&&!(r instanceof ArrayBuffer)&&!ArrayBuffer.isView(r))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")};export{e as default};
@@ -0,0 +1 @@
1
+ const t=n=>{if(!n||!(n instanceof URL)&&typeof n!="string")throw new TypeError("Path must be a non-empty string or URL.")};export{t as default};
@@ -0,0 +1 @@
1
+ const t=r=>{const e={force:!0,recursive:!0};return r?.maxRetries!==void 0&&(e.maxRetries=r.maxRetries),r?.retryDelay!==void 0&&(e.retryDelay=r.retryDelay),e};export{t};
@@ -0,0 +1 @@
1
+ import n from"./walk-OX4-6oCP.js";const e=async(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for await(const t of n(r,s))o.push(t.path);return o};export{e as default};
@@ -0,0 +1 @@
1
+ import t from"./walkSync-BPs6czIM.js";const a=(r,s={})=>{Array.isArray(s.extensions)||(s.extensions=["js","mjs","cjs","ts"]);const o=[];for(const n of t(r,s))o.push(n.path);return o};export{a as default};
@@ -0,0 +1 @@
1
+ import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import h from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";const y=v(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=r=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(r)}return y(r)},{cp:g}=b("node:fs/promises"),x=async(r,e,t={})=>{c(r),c(e);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:p=!0,preserveTimestamps:l=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(r),o=n(e);try{await g(_,o,{dereference:a,errorOnExist:f,filter:m,force:p,preserveTimestamps:l,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new h(`destination already exists, copy '${o}'`):i}};export{x as default};
@@ -0,0 +1 @@
1
+ import{createRequire as v}from"node:module";import{toPath as n}from"@visulima/path/utils";import g from"./AlreadyExistsError-DEb3UWja.js";import c from"./assertValidFileOrDirectoryPath-BTlt945W.js";const y=v(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=r=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(r)}return y(r)},{cpSync:b}=h("node:fs"),x=(r,e,t={})=>{c(r),c(e);const{dereference:a=!1,errorOnExist:f=!0,filter:m,overwrite:l=!0,preserveTimestamps:p=!1,recursive:u=!0,verbatimSymlinks:d=!1}=t,_=n(r),o=n(e);try{b(_,o,{dereference:a,errorOnExist:f,filter:m,force:l,preserveTimestamps:p,recursive:u,verbatimSymlinks:d})}catch(i){throw i?.code==="ERR_FS_CP_EEXIST"?new g(`destination already exists, copy '${o}'`):i}};export{x as default};
@@ -0,0 +1 @@
1
+ import{createRequire as c}from"node:module";import{join as d}from"@visulima/path";import{toPath as l}from"@visulima/path/utils";import _ from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as g}from"./build-rm-options-avnusYx-.js";const a=c(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return a(e)},{existsSync:f}=i("node:fs"),{mkdir:m,readdir:u,rm:p}=i("node:fs/promises"),q=async(e,o)=>{if(_(e),!f(e)){await m(e,{recursive:!0});return}const s=await u(e),t=g(o);for(const n of s)await p(d(l(e),n),t)};export{q as default};
@@ -0,0 +1 @@
1
+ import{createRequire as n}from"node:module";import{join as a}from"@visulima/path";import{toPath as d}from"@visulima/path/utils";import l from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{t as _}from"./build-rm-options-avnusYx-.js";const t=n(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return t(e)},{existsSync:f,mkdirSync:m,readdirSync:u,rmSync:p}=c("node:fs"),v=(e,o)=>{if(l(e),!f(e)){m(e,{recursive:!0});return}const s=_(o);for(const i of u(e))p(a(d(e),i),s)};export{v as default};
@@ -0,0 +1 @@
1
+ import{createRequire as n}from"node:module";import p from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as i}from"./get-file-info-type-DzWpohDB.js";const c=n(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,a=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return c(r)},{lstat:s,mkdir:u}=a("node:fs/promises"),m=async r=>{p(r);try{const e=await s(r);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await u(r,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const t=await s(r);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(t))}'`,{cause:e})}};export{m as default};
@@ -0,0 +1 @@
1
+ import{createRequire as n}from"node:module";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import{g as i}from"./get-file-info-type-DzWpohDB.js";const c=n(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return c(r)},{lstatSync:s,mkdirSync:a}=u("node:fs"),g=r=>{d(r);try{const e=s(r);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{a(r,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const t=s(r);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(i(t))}'`,{cause:e})}};export{g as default};
@@ -0,0 +1 @@
1
+ import{createRequire as i}from"node:module";import{dirname as p}from"@visulima/path";import{toPath as f}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import l from"./ensureDir-DGarVZw8.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";const s=i(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,n=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return s(r)},{lstat:a,writeFile:c}=n("node:fs/promises"),j=async r=>{m(r);try{const e=await a(r);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(u(e))}'`)}catch(e){if(e.code==="ENOENT"){await l(p(f(r))),await c(r,new Uint8Array);return}throw e}};export{j as default};
@@ -0,0 +1 @@
1
+ import{createRequire as i}from"node:module";import{dirname as p}from"@visulima/path";import{toPath as a}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import l from"./ensureDirSync-CsgPrsDH.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";const s=i(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,n=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[e,t]=o.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return o.getBuiltinModule(r)}return s(r)},{lstatSync:c,writeFileSync:f}=n("node:fs"),w=r=>{m(r);try{const e=c(r);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(u(e))}'`)}catch(e){if(e.code==="ENOENT"){l(p(a(r))),f(r,new Uint8Array);return}throw e}};export{w as default};
@@ -0,0 +1 @@
1
+ import{createRequire as p}from"node:module";import{toNamespacedPath as n,dirname as _}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDir-DGarVZw8.js";import{d as h}from"./is-stats-identical-l1GRN4Qu.js";const f=p(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,t]=s.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return s.getBuiltinModule(o)}return f(o)},{lstat:a,link:d}=u("node:fs/promises"),P=async(o,e)=>{m(o),m(e),o=n(c(o)),e=n(c(e));let t;try{t=await a(e)}catch{}let i;try{i=await a(o)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}t&&h(i,t)||(await g(_(e)),await d(o,e))};export{P as default};
@@ -0,0 +1 @@
1
+ import{createRequire as p}from"node:module";import{toNamespacedPath as c,dirname as _}from"@visulima/path";import{toPath as a}from"@visulima/path/utils";import m from"./assertValidFileOrDirectoryPath-BTlt945W.js";import g from"./ensureDirSync-CsgPrsDH.js";import{d as h}from"./is-stats-identical-l1GRN4Qu.js";const f=p(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=o=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,s]=t.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return t.getBuiltinModule(o)}return f(o)},{lstatSync:i,linkSync:d}=u("node:fs"),T=(o,e)=>{m(o),m(e),o=c(a(o)),e=c(a(e));let s;try{s=i(e)}catch{}let n;try{n=i(o)}catch(l){const r=l;throw r.message=r.message.replace("lstat","ensureLink"),r}s&&h(n,s)||(g(_(e)),d(o,e))};export{T as default};
@@ -0,0 +1 @@
1
+ import{createRequire as _}from"node:module";import{toNamespacedPath as m,dirname as v,resolve as P}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import S from"./ensureDir-DGarVZw8.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as x}from"./is-stats-identical-l1GRN4Qu.js";import{t as q}from"./resolve-symlink-target-CWrn0v4P.js";import w from"./AlreadyExistsError-DEb3UWja.js";const b=_(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=i=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(i)}return b(i)},{lstat:c,stat:f,symlink:T,readlink:k}=j("node:fs/promises"),E=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),X=async(i,e,o)=>{d(i),d(e);const r=q(i,e);e=m(p(e));try{if((await c(e)).isSymbolicLink()){const[s,n]=await Promise.all([f(r),f(e)]);if(x(s,n))return}}catch{}const y=await c(r),h=u(y);await S(v(e));let a=o??"file";o||(E?a="junction":a=h==="dir"?"dir":"file");try{await T(m(p(r)),e,a)}catch(s){if(s.code!=="EEXIST")throw s;const n=await c(e);if(!n.isSymbolicLink())throw new w(`A ${String(u(n))} already exists at the path: ${e}`);const g=await k(e),l=m(P(g));if(l!==r)throw new w(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};export{X as default};
@@ -0,0 +1 @@
1
+ import{createRequire as w}from"node:module";import{toNamespacedPath as f,dirname as v,resolve as x}from"@visulima/path";import{toPath as p}from"@visulima/path/utils";import d from"./assertValidFileOrDirectoryPath-BTlt945W.js";import P from"./ensureDirSync-CsgPrsDH.js";import{g as u}from"./get-file-info-type-DzWpohDB.js";import{d as y}from"./is-stats-identical-l1GRN4Qu.js";import{t as q}from"./resolve-symlink-target-CWrn0v4P.js";import g from"./AlreadyExistsError-DEb3UWja.js";const b=w(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=o=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(o)}return b(o)},{lstatSync:m,statSync:c,symlinkSync:T,readlinkSync:k}=j("node:fs"),E=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),X=(o,e,r)=>{d(o),d(e);const i=q(o,e);e=f(p(e));try{if(m(e).isSymbolicLink()&&y(c(i),c(e))){const t=c(i),n=c(e);if(y(t,n))return}}catch{}const h=m(i),_=u(h);P(v(e));let a=r??"file";r||(E?a="junction":a=_==="dir"?"dir":"file");try{T(f(p(i)),e,a)}catch(t){if(t.code!=="EEXIST")throw t;const n=m(e);if(!n.isSymbolicLink())throw new g(`A ${String(u(n))} already exists at the path: ${e}`);const S=k(e),l=f(x(S));if(l!==i)throw new g(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};export{X as default};
@@ -0,0 +1 @@
1
+ import{createRequire as g}from"node:module";import{resolve as c,parse as T,isAbsolute as j,dirname as v}from"@visulima/path";import{toPath as f}from"@visulima/path/utils";import{FIND_UP_STOP as B}from"./FIND_UP_STOP-CAwY1qU7.js";const w=g(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,i]=s.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return s.getBuiltinModule(t)}return w(t)},{stat:A,lstat:b}=h("node:fs/promises"),k=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const i=e.cwd?f(e.cwd):process.cwd();let r=c(i);const{root:a}=T(r),y=f(e.stopAt??a),m=c(r,y),u=e.type??"file",d=async function(n){return typeof t=="function"?[await t(n)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const _=e.allowSymlinks?A:b;for(;r&&r!==m&&r!==a;){const n=await d(r);for(let o of n){if(o===B)return;if(o===void 0)continue;Buffer.isBuffer(o)?o=o.toString():o instanceof URL&&(o=f(o));const l=j(o)?o:c(r,o);try{const p=await _(l);if(u==="file"&&p.isFile()||u==="directory"&&p.isDirectory())return l}catch{}}r=v(r)}};export{k as default};
@@ -0,0 +1 @@
1
+ import{createRequire as _}from"node:module";import{resolve as i,parse as A,isAbsolute as S,dirname as T}from"@visulima/path";import{toPath as c}from"@visulima/path/utils";import{FIND_UP_STOP as j}from"./FIND_UP_STOP-CAwY1qU7.js";const g=_(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[o,n]=s.versions.node.split(".").map(Number);if(o>22||o===22&&n>=3||o===20&&n>=16)return s.getBuiltinModule(e)}return g(e)},{statSync:w,lstatSync:b}=h("node:fs"),F=(e,o={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=o.cwd?c(o.cwd):process.cwd();let r=i(n);const{root:f}=A(r),p=c(o.stopAt??f),y=i(r,p),u=o.type??"file",m=function(t){return typeof e=="function"?[e(t)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]};o.allowSymlinks??=!0;const d=o.allowSymlinks?w:b;for(;r&&r!==y&&r!==f;){for(let t of m(r)){if(t===j)return;if(t===void 0)continue;Buffer.isBuffer(t)?t=t.toString():t instanceof URL&&(t=c(t));const a=S(t)?t:i(r,t);try{const l=d(a);if(u==="file"&&l.isFile()||u==="directory"&&l.isDirectory())return a}catch{}}r=T(r)}};export{F as default};
@@ -0,0 +1 @@
1
+ const r=i=>{if(i.isFile())return"file";if(i.isDirectory())return"dir";if(i.isSymbolicLink())return"symlink"};export{r as g};
@@ -0,0 +1 @@
1
+ import{b as o}from"./index-BLg3XWiD.js";const i=async(a,t)=>await o(a,t);export{i as default};
@@ -1,4 +1,4 @@
1
- import { G as GlobOptions } from "./types.d-C1ygRkw1.js";
1
+ import { G as GlobOptions } from "./types.d-BMdL_ygj.js";
2
2
  /**
3
3
  * Asynchronously matches files on disk using one or more glob patterns.
4
4
  *
@@ -0,0 +1 @@
1
+ import{E as r}from"./index-BLg3XWiD.js";const s=(t,o)=>r(t,o);export{s as default};
@@ -0,0 +1 @@
1
+ const b=/^(?:( )+|\t+)/,u="space";function d(n,t,e){return n&&t===u&&e===1}function h(n,t){const e=new Map;let o=0,r,c;for(const i of n.split(/\n/g)){if(!i)continue;const f=i.match(b);if(f===null)o=0,r="";else{const a=f[0].length,s=f[1]?u:"tab";if(d(t,s,a))continue;s!==r&&(o=0),r=s;let p=1,g=0;const m=a-o;if(o=a,m===0)p=0,g=1;else{const y=Math.abs(m);if(d(t,s,y))continue;c=w(s,y)}const l=e.get(c);e.set(c,l===void 0?[1,0]:[l[0]+p,l[1]+g])}}return e}function w(n,t){return(n===u?"s":"t")+String(t)}function E(n){const t=n[0]==="s"?u:"tab",e=Number(n.slice(1));return{type:t,amount:e}}function v(n){let t,e=0,o=0;for(const[r,[c,i]]of n)(c>e||c===e&&i>o)&&(e=c,o=i,t=r);return t}function x(n,t){return(n===u?" ":" ").repeat(t)}function M(n){if(typeof n!="string")throw new TypeError("Expected a string");let t=h(n,!0);t.size===0&&(t=h(n,!1));const e=v(t);let o,r=0,c="";return e!==void 0&&({type:o,amount:r}=E(e),c=x(o,r)),{amount:r,type:o,indent:c}}export{M as k};