@visulima/fs 5.0.0-alpha.13 → 5.0.0-alpha.15

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