@visulima/fs 3.1.7 → 3.1.8

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 (219) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +153 -153
  3. package/dist/eol.cjs +3 -28
  4. package/dist/eol.mjs +3 -20
  5. package/dist/error.cjs +1 -21
  6. package/dist/error.mjs +1 -7
  7. package/dist/index.cjs +1 -80
  8. package/dist/index.mjs +1 -31
  9. package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.mjs +1 -0
  10. package/dist/packem_shared/AlreadyExistsError-GC2XUgzJ.cjs +1 -0
  11. package/dist/packem_shared/DirectoryError-aGtmQVph.cjs +1 -0
  12. package/dist/packem_shared/DirectoryError-ddlbUV8C.mjs +1 -0
  13. package/dist/packem_shared/F_OK-7T91O6Oz.cjs +1 -0
  14. package/dist/packem_shared/F_OK-B71i3mUa.mjs +1 -0
  15. package/dist/packem_shared/JSONError-CVkb3xZ3.mjs +4 -0
  16. package/dist/packem_shared/JSONError-CWuiGmNc.cjs +4 -0
  17. package/dist/packem_shared/NotEmptyError-BWGfec5K.cjs +1 -0
  18. package/dist/packem_shared/NotEmptyError-DMh1o7UL.mjs +1 -0
  19. package/dist/packem_shared/NotFoundError-BPiW0icm.mjs +1 -0
  20. package/dist/packem_shared/NotFoundError-Diij7oqe.cjs +1 -0
  21. package/dist/packem_shared/PermissionError-B1Emi5a9.mjs +1 -0
  22. package/dist/packem_shared/PermissionError-Ck1Es7al.cjs +1 -0
  23. package/dist/packem_shared/WalkError-BsngoIKJ.mjs +1 -0
  24. package/dist/packem_shared/WalkError-gKgp0TWD.cjs +1 -0
  25. package/dist/packem_shared/assertValidFileContents-BZFnXa7K.mjs +1 -0
  26. package/dist/packem_shared/assertValidFileContents-CrbDz09d.cjs +1 -0
  27. package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.mjs +1 -0
  28. package/dist/packem_shared/assertValidFileOrDirectoryPath-HOUs73Jk.cjs +1 -0
  29. package/dist/packem_shared/collect-Bl2Oc1qs.cjs +1 -0
  30. package/dist/packem_shared/collect-CyYPQFMs.mjs +1 -0
  31. package/dist/packem_shared/collectSync-BHjyXWq4.cjs +1 -0
  32. package/dist/packem_shared/collectSync-CD9cXw2g.mjs +1 -0
  33. package/dist/packem_shared/emptyDir-BdjO-6Gu.mjs +1 -0
  34. package/dist/packem_shared/emptyDir-DGRw4yE9.cjs +1 -0
  35. package/dist/packem_shared/emptyDirSync-C1vsMEp-.mjs +1 -0
  36. package/dist/packem_shared/emptyDirSync-DzjDZxOx.cjs +1 -0
  37. package/dist/packem_shared/ensureDir-BuIFF_6B.mjs +1 -0
  38. package/dist/packem_shared/ensureDir-DtQzyA70.cjs +1 -0
  39. package/dist/packem_shared/ensureDirSync-BuPHxdP4.mjs +1 -0
  40. package/dist/packem_shared/ensureDirSync-C8hIoS3o.cjs +1 -0
  41. package/dist/packem_shared/ensureFile-DcAODM6a.mjs +1 -0
  42. package/dist/packem_shared/ensureFile-wR8zBfXh.cjs +1 -0
  43. package/dist/packem_shared/ensureFileSync-BI1fIdNf.cjs +1 -0
  44. package/dist/packem_shared/ensureFileSync-CzPN6ucX.mjs +1 -0
  45. package/dist/packem_shared/ensureLink-BaZLXxgx.mjs +1 -0
  46. package/dist/packem_shared/ensureLink-DCPuU0Za.cjs +1 -0
  47. package/dist/packem_shared/ensureLinkSync-9C2JL-Sl.mjs +1 -0
  48. package/dist/packem_shared/ensureLinkSync-CuRZmQlV.cjs +1 -0
  49. package/dist/packem_shared/ensureSymlink-BH6wbylb.mjs +1 -0
  50. package/dist/packem_shared/ensureSymlink-J83jhdfA.cjs +1 -0
  51. package/dist/packem_shared/ensureSymlinkSync-CZSPodAm.mjs +1 -0
  52. package/dist/packem_shared/ensureSymlinkSync-VNtMTaV8.cjs +1 -0
  53. package/dist/packem_shared/findUp-C5aWsLuD.cjs +1 -0
  54. package/dist/packem_shared/findUp-CMGMYNty.mjs +1 -0
  55. package/dist/packem_shared/findUpSync-QP_ZEsJN.mjs +1 -0
  56. package/dist/packem_shared/findUpSync-U1lTgv4y.cjs +1 -0
  57. package/dist/packem_shared/get-file-info-type-CaWGXRjY.mjs +1 -0
  58. package/dist/packem_shared/get-file-info-type-DDbpRlDl.cjs +1 -0
  59. package/dist/packem_shared/index-BSjF-5vj.mjs +1 -0
  60. package/dist/packem_shared/index-DPla58ce.cjs +1 -0
  61. package/dist/packem_shared/is-stats-identical-Bti7K05l.cjs +1 -0
  62. package/dist/packem_shared/is-stats-identical-CohsLtWy.mjs +1 -0
  63. package/dist/packem_shared/isAccessible-BQZd1_xn.cjs +1 -0
  64. package/dist/packem_shared/isAccessible-CL4eE5VL.mjs +1 -0
  65. package/dist/packem_shared/isAccessibleSync-BP5N8k_-.cjs +1 -0
  66. package/dist/packem_shared/isAccessibleSync-_HU_ppdG.mjs +1 -0
  67. package/dist/packem_shared/move--o4NZLpD.mjs +1 -0
  68. package/dist/packem_shared/move-DwG6APiG.cjs +1 -0
  69. package/dist/packem_shared/parseJson-B_GwHpKj.cjs +6 -0
  70. package/dist/packem_shared/parseJson-Bqic0nN8.mjs +6 -0
  71. package/dist/packem_shared/readFile-BvefDyr_.cjs +1 -0
  72. package/dist/packem_shared/readFile-Cix_ijtX.mjs +1 -0
  73. package/dist/packem_shared/readFileSync-B0O-8BH0.mjs +1 -0
  74. package/dist/packem_shared/readFileSync-Ct8Ql4Vs.cjs +1 -0
  75. package/dist/packem_shared/readJson-BLvd2Bsj.mjs +1 -0
  76. package/dist/packem_shared/readJson-cP5ArpPg.cjs +1 -0
  77. package/dist/packem_shared/readJsonSync-B6h6A3Un.cjs +1 -0
  78. package/dist/packem_shared/readJsonSync-Br5dHGAI.mjs +1 -0
  79. package/dist/packem_shared/readYaml-BOYTR5D1.mjs +1 -0
  80. package/dist/packem_shared/readYaml-BzMFDsYe.cjs +1 -0
  81. package/dist/packem_shared/readYamlSync-BbK0khJu.cjs +1 -0
  82. package/dist/packem_shared/readYamlSync-md9g88k7.mjs +1 -0
  83. package/dist/packem_shared/remove-CtnFqEpd.mjs +1 -0
  84. package/dist/packem_shared/remove-DPCf2Qdb.cjs +1 -0
  85. package/dist/packem_shared/removeSync-Cyriz7r8.cjs +1 -0
  86. package/dist/packem_shared/removeSync-DI-IjqVp.mjs +1 -0
  87. package/dist/packem_shared/resolve-symlink-target-BofZSDIc.mjs +1 -0
  88. package/dist/packem_shared/resolve-symlink-target-zilkQ_AU.cjs +1 -0
  89. package/dist/packem_shared/stripJsonComments-Cp5SNAB7.mjs +1 -0
  90. package/dist/packem_shared/stripJsonComments-CvZSDnYT.cjs +1 -0
  91. package/dist/packem_shared/to-uint-8-array-2-3EvGd7.cjs +1 -0
  92. package/dist/packem_shared/to-uint-8-array-DwgaTasY.mjs +1 -0
  93. package/dist/packem_shared/walk-BZTXbT87.mjs +1 -0
  94. package/dist/packem_shared/walk-DyN_HVFW.cjs +1 -0
  95. package/dist/packem_shared/walk-include-C9pVST87.mjs +1 -0
  96. package/dist/packem_shared/walk-include-DkK-WJl4.cjs +1 -0
  97. package/dist/packem_shared/walkSync-BHlEzV_m.mjs +1 -0
  98. package/dist/packem_shared/walkSync-Bqi7L2yG.cjs +1 -0
  99. package/dist/packem_shared/writeFile-COOAkvOE.mjs +1 -0
  100. package/dist/packem_shared/writeFile-CjgQEfur.cjs +1 -0
  101. package/dist/packem_shared/writeFileSync-CQuRHo9n.cjs +1 -0
  102. package/dist/packem_shared/writeFileSync-rhu-y_zx.mjs +1 -0
  103. package/dist/packem_shared/writeJson-BYT4WInm.mjs +4 -0
  104. package/dist/packem_shared/writeJson-CJIciZ_Q.cjs +4 -0
  105. package/dist/packem_shared/writeJsonSync-BIsrhRbV.cjs +4 -0
  106. package/dist/packem_shared/writeJsonSync-CLlXOFDm.mjs +4 -0
  107. package/dist/packem_shared/writeYaml-CjzVd0K-.mjs +1 -0
  108. package/dist/packem_shared/writeYaml-VmX1VKhN.cjs +1 -0
  109. package/dist/packem_shared/writeYamlSync-D9A9Ixe1.mjs +1 -0
  110. package/dist/packem_shared/writeYamlSync-DYsM6XBi.cjs +1 -0
  111. package/dist/size.cjs +1 -118
  112. package/dist/size.mjs +1 -109
  113. package/dist/utils.cjs +1 -19
  114. package/dist/utils.mjs +1 -6
  115. package/dist/yaml.cjs +1 -15
  116. package/dist/yaml.mjs +1 -4
  117. package/package.json +1 -1
  118. package/dist/packem_shared/AlreadyExistsError-DpxtwQot.cjs +0 -34
  119. package/dist/packem_shared/AlreadyExistsError-GK7J9fVA.mjs +0 -32
  120. package/dist/packem_shared/DirectoryError-D8FHcAqu.cjs +0 -34
  121. package/dist/packem_shared/DirectoryError-DByTWE7t.mjs +0 -32
  122. package/dist/packem_shared/F_OK-CWSqQIdF.cjs +0 -17
  123. package/dist/packem_shared/F_OK-JER1LjUr.mjs +0 -8
  124. package/dist/packem_shared/JSONError-5-wHnrxX.cjs +0 -34
  125. package/dist/packem_shared/JSONError-CaKt7MhC.mjs +0 -32
  126. package/dist/packem_shared/NotEmptyError-BCS_5pPt.cjs +0 -34
  127. package/dist/packem_shared/NotEmptyError-DCXooh5l.mjs +0 -32
  128. package/dist/packem_shared/NotFoundError-B_1nPl3K.cjs +0 -34
  129. package/dist/packem_shared/NotFoundError-CUdcC61I.mjs +0 -32
  130. package/dist/packem_shared/PermissionError-CqGMI9qC.mjs +0 -32
  131. package/dist/packem_shared/PermissionError-QFMKgk2l.cjs +0 -34
  132. package/dist/packem_shared/WalkError-B4-yr8Kk.cjs +0 -31
  133. package/dist/packem_shared/WalkError-DvEBTTaj.mjs +0 -29
  134. package/dist/packem_shared/assertValidFileContents-CRVvyM6b.cjs +0 -11
  135. package/dist/packem_shared/assertValidFileContents-Ox-ScfeK.mjs +0 -9
  136. package/dist/packem_shared/assertValidFileOrDirectoryPath-BMbgA-eI.cjs +0 -11
  137. package/dist/packem_shared/assertValidFileOrDirectoryPath-BWWgA1wj.mjs +0 -9
  138. package/dist/packem_shared/collect-3Paj1Vqw.mjs +0 -16
  139. package/dist/packem_shared/collect-DnfQeSOL.cjs +0 -18
  140. package/dist/packem_shared/collectSync-D4vym4QD.cjs +0 -18
  141. package/dist/packem_shared/collectSync-DwJLL8SD.mjs +0 -16
  142. package/dist/packem_shared/emptyDir-DcCfiNcf.cjs +0 -22
  143. package/dist/packem_shared/emptyDir-Dw5xSBox.mjs +0 -20
  144. package/dist/packem_shared/emptyDirSync-BWA4n6TB.cjs +0 -21
  145. package/dist/packem_shared/emptyDirSync-DMAaCiC_.mjs +0 -19
  146. package/dist/packem_shared/ensureDir-BOfUZlxG.cjs +0 -35
  147. package/dist/packem_shared/ensureDir-BnA_fY1A.mjs +0 -33
  148. package/dist/packem_shared/ensureDirSync-DHmWi3CF.cjs +0 -35
  149. package/dist/packem_shared/ensureDirSync-Dm4az3YF.mjs +0 -33
  150. package/dist/packem_shared/ensureFile-BKrJMHfr.mjs +0 -27
  151. package/dist/packem_shared/ensureFile-CeGryLJI.cjs +0 -29
  152. package/dist/packem_shared/ensureFileSync-B7THM1sN.cjs +0 -29
  153. package/dist/packem_shared/ensureFileSync-BnhFBXaR.mjs +0 -27
  154. package/dist/packem_shared/ensureLink-ChsWDTK5.mjs +0 -34
  155. package/dist/packem_shared/ensureLink-CrxLNmHE.cjs +0 -36
  156. package/dist/packem_shared/ensureLinkSync-CG-DTUoV.mjs +0 -34
  157. package/dist/packem_shared/ensureLinkSync-D8uMqLh4.cjs +0 -36
  158. package/dist/packem_shared/ensureSymlink-BwJ_QhzJ.mjs +0 -52
  159. package/dist/packem_shared/ensureSymlink-D_ieOVYa.cjs +0 -54
  160. package/dist/packem_shared/ensureSymlinkSync-BamG29QK.mjs +0 -56
  161. package/dist/packem_shared/ensureSymlinkSync-DTMvUYZD.cjs +0 -58
  162. package/dist/packem_shared/findUp-D5W-MTpT.mjs +0 -63
  163. package/dist/packem_shared/findUp-DVIYN2wV.cjs +0 -65
  164. package/dist/packem_shared/findUpSync-BOiVyUOx.cjs +0 -65
  165. package/dist/packem_shared/findUpSync-DL3NPCYg.mjs +0 -63
  166. package/dist/packem_shared/get-file-info-type-BlryFnpp.cjs +0 -18
  167. package/dist/packem_shared/get-file-info-type-ButUVD6d.mjs +0 -16
  168. package/dist/packem_shared/index-BVZL6YMm.cjs +0 -110
  169. package/dist/packem_shared/index-r9Pk9gBe.mjs +0 -108
  170. package/dist/packem_shared/is-stats-identical-BfdEfO6i.cjs +0 -7
  171. package/dist/packem_shared/is-stats-identical-ByTYZ2Aw.mjs +0 -5
  172. package/dist/packem_shared/isAccessible-Bonsm1Ez.mjs +0 -20
  173. package/dist/packem_shared/isAccessible-ZNVGsSb7.cjs +0 -22
  174. package/dist/packem_shared/isAccessibleSync-3gnUWUwX.mjs +0 -20
  175. package/dist/packem_shared/isAccessibleSync-VWjQa-US.cjs +0 -22
  176. package/dist/packem_shared/move-DgF7Ul9L.mjs +0 -114
  177. package/dist/packem_shared/move-Dh925GL9.cjs +0 -121
  178. package/dist/packem_shared/parseJson-BA7Xrggq.mjs +0 -248
  179. package/dist/packem_shared/parseJson-LgPGI5ic.cjs +0 -250
  180. package/dist/packem_shared/readFile-b7UBVv17.mjs +0 -46
  181. package/dist/packem_shared/readFile-iFUhZHnh.cjs +0 -48
  182. package/dist/packem_shared/readFileSync-B3NTOR-W.cjs +0 -33
  183. package/dist/packem_shared/readFileSync-CkEJBqZB.mjs +0 -31
  184. package/dist/packem_shared/readJson-CEBHyuYq.cjs +0 -27
  185. package/dist/packem_shared/readJson-Ce9b06cu.mjs +0 -25
  186. package/dist/packem_shared/readJsonSync-B22hej0y.cjs +0 -27
  187. package/dist/packem_shared/readJsonSync-CkUI9_z5.mjs +0 -25
  188. package/dist/packem_shared/readYaml-C5MSs2GE.mjs +0 -13
  189. package/dist/packem_shared/readYaml-sR4bqUel.cjs +0 -15
  190. package/dist/packem_shared/readYamlSync-C3oOzxiN.cjs +0 -15
  191. package/dist/packem_shared/readYamlSync-CPjA-DLv.mjs +0 -13
  192. package/dist/packem_shared/remove-B2nxUObP.mjs +0 -18
  193. package/dist/packem_shared/remove-BpDiVPns.cjs +0 -20
  194. package/dist/packem_shared/removeSync-BosXW624.cjs +0 -20
  195. package/dist/packem_shared/removeSync-C87yepDI.mjs +0 -18
  196. package/dist/packem_shared/resolve-symlink-target-BbpEHdU2.mjs +0 -18
  197. package/dist/packem_shared/resolve-symlink-target-DImIddt6.cjs +0 -20
  198. package/dist/packem_shared/stripJsonComments-B66nRaTZ.mjs +0 -21
  199. package/dist/packem_shared/stripJsonComments-eDrcJvBT.cjs +0 -23
  200. package/dist/packem_shared/to-uint-8-array-B4CjMOD3.mjs +0 -21
  201. package/dist/packem_shared/to-uint-8-array-BaTEyX3D.cjs +0 -23
  202. package/dist/packem_shared/walk-CI3ygmrw.cjs +0 -100
  203. package/dist/packem_shared/walk-D7YA43g8.mjs +0 -98
  204. package/dist/packem_shared/walk-include-CMUSRa86.mjs +0 -20
  205. package/dist/packem_shared/walk-include-yUdRrF16.cjs +0 -23
  206. package/dist/packem_shared/walkSync-DLTsnwuJ.mjs +0 -103
  207. package/dist/packem_shared/walkSync-oXkmn9ZA.cjs +0 -105
  208. package/dist/packem_shared/writeFile-BZ4JBQxc.mjs +0 -58
  209. package/dist/packem_shared/writeFile-DgCFRCe5.cjs +0 -60
  210. package/dist/packem_shared/writeFileSync-Ctw5pNQH.mjs +0 -58
  211. package/dist/packem_shared/writeFileSync-DzXhx1pF.cjs +0 -60
  212. package/dist/packem_shared/writeJson-Bh4sU1Ly.cjs +0 -33
  213. package/dist/packem_shared/writeJson-axO_14yL.mjs +0 -31
  214. package/dist/packem_shared/writeJsonSync-CzngmuKb.mjs +0 -31
  215. package/dist/packem_shared/writeJsonSync-HFdHjunl.cjs +0 -33
  216. package/dist/packem_shared/writeYaml-3XQT2qtb.cjs +0 -29
  217. package/dist/packem_shared/writeYaml-BSFEuWp2.mjs +0 -27
  218. package/dist/packem_shared/writeYamlSync-B6VcXXIb.mjs +0 -27
  219. package/dist/packem_shared/writeYamlSync-BZR3If9v.cjs +0 -29
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- const promises = require('node:fs/promises');
4
- const node_zlib = require('node:zlib');
5
- const utils = require('@visulima/path/utils');
6
- const F_OK = require('./F_OK-CWSqQIdF.cjs');
7
- const PermissionError = require('./PermissionError-QFMKgk2l.cjs');
8
- const isAccessible = require('./isAccessible-ZNVGsSb7.cjs');
9
- const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
10
-
11
- var __defProp = Object.defineProperty;
12
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
- const decompressionMethods = {
14
- brotli: node_zlib.brotliDecompress,
15
- gzip: node_zlib.unzip,
16
- none: /* @__PURE__ */ __name((buffer, callback) => {
17
- callback(null, buffer);
18
- }, "none")
19
- };
20
- const readFile = /* @__PURE__ */ __name(async (path, options) => {
21
- assertValidFileOrDirectoryPath(path);
22
- path = utils.toPath(path);
23
- if (!await isAccessible(path)) {
24
- throw new PermissionError(`unable to read the non-accessible file: ${path}`);
25
- }
26
- if (!await isAccessible(path, F_OK.R_OK)) {
27
- throw new Error(`Unable to read the non-readable file: ${path}`);
28
- }
29
- const { buffer, compression, encoding, flag } = options ?? {};
30
- return await promises.readFile(path, flag ? { encoding, flag } : { encoding }).then(
31
- async (content) => (
32
- // eslint-disable-next-line compat/compat
33
- await new Promise((resolve, reject) => {
34
- decompressionMethods[compression ?? "none"](content, (error, result) => {
35
- if (error) {
36
- reject(error);
37
- } else {
38
- resolve(buffer ? result : result.toString());
39
- }
40
- });
41
- })
42
- )
43
- ).catch((error) => {
44
- throw error;
45
- });
46
- }, "readFile");
47
-
48
- module.exports = readFile;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- const node_fs = require('node:fs');
4
- const node_zlib = require('node:zlib');
5
- const utils = require('@visulima/path/utils');
6
- const F_OK = require('./F_OK-CWSqQIdF.cjs');
7
- const PermissionError = require('./PermissionError-QFMKgk2l.cjs');
8
- const isAccessibleSync = require('./isAccessibleSync-VWjQa-US.cjs');
9
- const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
10
-
11
- var __defProp = Object.defineProperty;
12
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
- const decompressionMethods = {
14
- brotli: node_zlib.brotliDecompressSync,
15
- gzip: node_zlib.unzipSync,
16
- none: /* @__PURE__ */ __name((buffer) => buffer, "none")
17
- };
18
- const readFileSync = /* @__PURE__ */ __name((path, options) => {
19
- assertValidFileOrDirectoryPath(path);
20
- path = utils.toPath(path);
21
- if (!isAccessibleSync(path)) {
22
- throw new PermissionError(`unable to read the non-accessible file: ${path}`);
23
- }
24
- if (!isAccessibleSync(path, F_OK.R_OK)) {
25
- throw new PermissionError(`invalid access to read file at: ${path}`);
26
- }
27
- const { buffer, compression, encoding, flag } = options ?? {};
28
- const content = node_fs.readFileSync(path, flag ? { encoding, flag } : { encoding });
29
- const decompressed = decompressionMethods[compression ?? "none"](content);
30
- return buffer ? decompressed : decompressed.toString();
31
- }, "readFileSync");
32
-
33
- module.exports = readFileSync;
@@ -1,31 +0,0 @@
1
- import { readFileSync as readFileSync$1 } from 'node:fs';
2
- import { unzipSync, brotliDecompressSync } from 'node:zlib';
3
- import { toPath } from '@visulima/path/utils';
4
- import { R_OK } from './F_OK-JER1LjUr.mjs';
5
- import PermissionError from './PermissionError-CqGMI9qC.mjs';
6
- import isAccessibleSync from './isAccessibleSync-3gnUWUwX.mjs';
7
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
8
-
9
- var __defProp = Object.defineProperty;
10
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
- const decompressionMethods = {
12
- brotli: brotliDecompressSync,
13
- gzip: unzipSync,
14
- none: /* @__PURE__ */ __name((buffer) => buffer, "none")
15
- };
16
- const readFileSync = /* @__PURE__ */ __name((path, options) => {
17
- assertValidFileOrDirectoryPath(path);
18
- path = toPath(path);
19
- if (!isAccessibleSync(path)) {
20
- throw new PermissionError(`unable to read the non-accessible file: ${path}`);
21
- }
22
- if (!isAccessibleSync(path, R_OK)) {
23
- throw new PermissionError(`invalid access to read file at: ${path}`);
24
- }
25
- const { buffer, compression, encoding, flag } = options ?? {};
26
- const content = readFileSync$1(path, flag ? { encoding, flag } : { encoding });
27
- const decompressed = decompressionMethods[compression ?? "none"](content);
28
- return buffer ? decompressed : decompressed.toString();
29
- }, "readFileSync");
30
-
31
- export { readFileSync as default };
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- const utils = require('@visulima/path/utils');
4
- const parseJson = require('./parseJson-LgPGI5ic.cjs');
5
- const readFile = require('./readFile-iFUhZHnh.cjs');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- async function readJson(path, reviver, options) {
10
- if (typeof reviver === "object") {
11
- options = reviver;
12
- reviver = void 0;
13
- }
14
- const content = await readFile(path, {
15
- buffer: true,
16
- encoding: void 0
17
- });
18
- let data = new TextDecoder().decode(content);
19
- const { beforeParse, color } = options ?? {};
20
- if (typeof beforeParse === "function") {
21
- data = beforeParse(data);
22
- }
23
- return parseJson(data, reviver, utils.toPath(path), { color });
24
- }
25
- __name(readJson, "readJson");
26
-
27
- module.exports = readJson;
@@ -1,25 +0,0 @@
1
- import { toPath } from '@visulima/path/utils';
2
- import parseJson from './parseJson-BA7Xrggq.mjs';
3
- import readFile from './readFile-b7UBVv17.mjs';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- async function readJson(path, reviver, options) {
8
- if (typeof reviver === "object") {
9
- options = reviver;
10
- reviver = void 0;
11
- }
12
- const content = await readFile(path, {
13
- buffer: true,
14
- encoding: void 0
15
- });
16
- let data = new TextDecoder().decode(content);
17
- const { beforeParse, color } = options ?? {};
18
- if (typeof beforeParse === "function") {
19
- data = beforeParse(data);
20
- }
21
- return parseJson(data, reviver, toPath(path), { color });
22
- }
23
- __name(readJson, "readJson");
24
-
25
- export { readJson as default };
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- const utils = require('@visulima/path/utils');
4
- const parseJson = require('./parseJson-LgPGI5ic.cjs');
5
- const readFileSync = require('./readFileSync-B3NTOR-W.cjs');
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- function readJsonSync(path, reviver, options) {
10
- if (typeof reviver === "object") {
11
- options = reviver;
12
- reviver = void 0;
13
- }
14
- const content = readFileSync(path, {
15
- buffer: true,
16
- encoding: void 0
17
- });
18
- let data = new TextDecoder().decode(content);
19
- const { beforeParse, color } = options ?? {};
20
- if (typeof beforeParse === "function") {
21
- data = beforeParse(data);
22
- }
23
- return parseJson(data, reviver, utils.toPath(path), { color });
24
- }
25
- __name(readJsonSync, "readJsonSync");
26
-
27
- module.exports = readJsonSync;
@@ -1,25 +0,0 @@
1
- import { toPath } from '@visulima/path/utils';
2
- import parseJson from './parseJson-BA7Xrggq.mjs';
3
- import readFileSync from './readFileSync-CkEJBqZB.mjs';
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- function readJsonSync(path, reviver, options) {
8
- if (typeof reviver === "object") {
9
- options = reviver;
10
- reviver = void 0;
11
- }
12
- const content = readFileSync(path, {
13
- buffer: true,
14
- encoding: void 0
15
- });
16
- let data = new TextDecoder().decode(content);
17
- const { beforeParse, color } = options ?? {};
18
- if (typeof beforeParse === "function") {
19
- data = beforeParse(data);
20
- }
21
- return parseJson(data, reviver, toPath(path), { color });
22
- }
23
- __name(readJsonSync, "readJsonSync");
24
-
25
- export { readJsonSync as default };
@@ -1,13 +0,0 @@
1
- import { parse } from 'yaml';
2
- import readFile from './readFile-b7UBVv17.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- async function readYaml(path, reviver, options) {
7
- const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
8
- const content = await readFile(path, { buffer, compression, encoding, flag });
9
- return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
10
- }
11
- __name(readYaml, "readYaml");
12
-
13
- export { readYaml as default };
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- const yaml = require('yaml');
4
- const readFile = require('./readFile-iFUhZHnh.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- async function readYaml(path, reviver, options) {
9
- const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
10
- const content = await readFile(path, { buffer, compression, encoding, flag });
11
- return typeof reviver === "function" ? yaml.parse(content, reviver, parseOptions) : yaml.parse(content, parseOptions);
12
- }
13
- __name(readYaml, "readYaml");
14
-
15
- module.exports = readYaml;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- const yaml = require('yaml');
4
- const readFileSync = require('./readFileSync-B3NTOR-W.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- function readYamlSync(path, reviver, options) {
9
- const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
10
- const content = readFileSync(path, { buffer, compression, encoding, flag });
11
- return typeof reviver === "function" ? yaml.parse(content, reviver, parseOptions) : yaml.parse(content, parseOptions);
12
- }
13
- __name(readYamlSync, "readYamlSync");
14
-
15
- module.exports = readYamlSync;
@@ -1,13 +0,0 @@
1
- import { parse } from 'yaml';
2
- import readFileSync from './readFileSync-CkEJBqZB.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- function readYamlSync(path, reviver, options) {
7
- const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
8
- const content = readFileSync(path, { buffer, compression, encoding, flag });
9
- return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
10
- }
11
- __name(readYamlSync, "readYamlSync");
12
-
13
- export { readYamlSync as default };
@@ -1,18 +0,0 @@
1
- import { unlink, rm } from 'node:fs/promises';
2
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const remove = /* @__PURE__ */ __name(async (path, options = {}) => {
7
- assertValidFileOrDirectoryPath(path);
8
- try {
9
- await unlink(path);
10
- } catch {
11
- }
12
- try {
13
- await rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
14
- } catch {
15
- }
16
- }, "remove");
17
-
18
- export { remove as default };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const promises = require('node:fs/promises');
4
- const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const remove = /* @__PURE__ */ __name(async (path, options = {}) => {
9
- assertValidFileOrDirectoryPath(path);
10
- try {
11
- await promises.unlink(path);
12
- } catch {
13
- }
14
- try {
15
- await promises.rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
16
- } catch {
17
- }
18
- }, "remove");
19
-
20
- module.exports = remove;
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const node_fs = require('node:fs');
4
- const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const removeSync = /* @__PURE__ */ __name((path, options = {}) => {
9
- assertValidFileOrDirectoryPath(path);
10
- try {
11
- node_fs.unlinkSync(path);
12
- } catch {
13
- }
14
- try {
15
- node_fs.rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
16
- } catch {
17
- }
18
- }, "removeSync");
19
-
20
- module.exports = removeSync;
@@ -1,18 +0,0 @@
1
- import { unlinkSync, rmSync } from 'node:fs';
2
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const removeSync = /* @__PURE__ */ __name((path, options = {}) => {
7
- assertValidFileOrDirectoryPath(path);
8
- try {
9
- unlinkSync(path);
10
- } catch {
11
- }
12
- try {
13
- rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
14
- } catch {
15
- }
16
- }, "removeSync");
17
-
18
- export { removeSync as default };
@@ -1,18 +0,0 @@
1
- import { resolve, dirname } from '@visulima/path';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const resolveSymlinkTarget = /* @__PURE__ */ __name((target, linkName) => {
6
- if (typeof target !== "string") {
7
- return target;
8
- }
9
- if (target.startsWith("./")) {
10
- return resolve(target);
11
- }
12
- if (typeof linkName === "string") {
13
- return resolve(dirname(linkName), target);
14
- }
15
- return new URL(target, linkName);
16
- }, "resolveSymlinkTarget");
17
-
18
- export { resolveSymlinkTarget as r };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('@visulima/path');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const resolveSymlinkTarget = /* @__PURE__ */ __name((target, linkName) => {
8
- if (typeof target !== "string") {
9
- return target;
10
- }
11
- if (target.startsWith("./")) {
12
- return path.resolve(target);
13
- }
14
- if (typeof linkName === "string") {
15
- return path.resolve(path.dirname(linkName), target);
16
- }
17
- return new URL(target, linkName);
18
- }, "resolveSymlinkTarget");
19
-
20
- exports.resolveSymlinkTarget = resolveSymlinkTarget;
@@ -1,21 +0,0 @@
1
- import { INTERNAL_STRIP_JSON_REGEX } from './F_OK-JER1LjUr.mjs';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const stripJsonComments = /* @__PURE__ */ __name((jsonString, { whitespace = true } = {}) => (
6
- // This regular expression translates to:
7
- //
8
- // /quoted-string|line-comment|block-comment/g
9
- //
10
- // This means that comment characters inside of strings will match
11
- // as strings, not comments, so we can just skip the whole string
12
- // in the replacer function.
13
- jsonString.replace(INTERNAL_STRIP_JSON_REGEX, (match) => {
14
- if (match.startsWith('"') || match[1] === "*" && !match.endsWith("*/")) {
15
- return match;
16
- }
17
- return whitespace ? match.replaceAll(/\S/g, " ") : "";
18
- })
19
- ), "stripJsonComments");
20
-
21
- export { stripJsonComments as default };
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- const F_OK = require('./F_OK-CWSqQIdF.cjs');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const stripJsonComments = /* @__PURE__ */ __name((jsonString, { whitespace = true } = {}) => (
8
- // This regular expression translates to:
9
- //
10
- // /quoted-string|line-comment|block-comment/g
11
- //
12
- // This means that comment characters inside of strings will match
13
- // as strings, not comments, so we can just skip the whole string
14
- // in the replacer function.
15
- jsonString.replace(F_OK.INTERNAL_STRIP_JSON_REGEX, (match) => {
16
- if (match.startsWith('"') || match[1] === "*" && !match.endsWith("*/")) {
17
- return match;
18
- }
19
- return whitespace ? match.replaceAll(/\S/g, " ") : "";
20
- })
21
- ), "stripJsonComments");
22
-
23
- module.exports = stripJsonComments;
@@ -1,21 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const encoder = new TextEncoder();
4
- const toUint8Array = /* @__PURE__ */ __name((contents) => {
5
- if (contents instanceof Uint8Array) {
6
- return contents;
7
- }
8
- if (typeof contents === "string") {
9
- return encoder.encode(contents);
10
- }
11
- if (contents instanceof ArrayBuffer) {
12
- return new Uint8Array(contents);
13
- }
14
- if (ArrayBuffer.isView(contents)) {
15
- const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);
16
- return new Uint8Array(bytes);
17
- }
18
- throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
19
- }, "toUint8Array");
20
-
21
- export { toUint8Array as t };
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const encoder = new TextEncoder();
6
- const toUint8Array = /* @__PURE__ */ __name((contents) => {
7
- if (contents instanceof Uint8Array) {
8
- return contents;
9
- }
10
- if (typeof contents === "string") {
11
- return encoder.encode(contents);
12
- }
13
- if (contents instanceof ArrayBuffer) {
14
- return new Uint8Array(contents);
15
- }
16
- if (ArrayBuffer.isView(contents)) {
17
- const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);
18
- return new Uint8Array(bytes);
19
- }
20
- throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
21
- }, "toUint8Array");
22
-
23
- exports.toUint8Array = toUint8Array;
@@ -1,100 +0,0 @@
1
- 'use strict';
2
-
3
- const promises = require('node:fs/promises');
4
- const path = require('@visulima/path');
5
- const utils = require('@visulima/path/utils');
6
- const WalkError = require('./WalkError-B4-yr8Kk.cjs');
7
- const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
8
- const walkInclude = require('./walk-include-yUdRrF16.cjs');
9
-
10
- var __defProp = Object.defineProperty;
11
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
- const _createWalkEntry = /* @__PURE__ */ __name(async (path$1) => {
13
- const normalizePath = path.normalize(path$1);
14
- const name = path.basename(normalizePath);
15
- const info = await promises.stat(normalizePath);
16
- return {
17
- isDirectory: /* @__PURE__ */ __name(() => info.isDirectory(), "isDirectory"),
18
- isFile: /* @__PURE__ */ __name(() => info.isFile(), "isFile"),
19
- isSymbolicLink: /* @__PURE__ */ __name(() => info.isSymbolicLink(), "isSymbolicLink"),
20
- name,
21
- path: normalizePath
22
- };
23
- }, "_createWalkEntry");
24
- async function* walk(directory, {
25
- extensions,
26
- followSymlinks = false,
27
- includeDirs: includeDirectories = true,
28
- includeFiles = true,
29
- includeSymlinks = true,
30
- match,
31
- maxDepth = Number.POSITIVE_INFINITY,
32
- skip
33
- } = {}) {
34
- assertValidFileOrDirectoryPath(directory);
35
- if (maxDepth < 0) {
36
- return;
37
- }
38
- const mappedMatch = match ? match.map((pattern) => typeof pattern === "string" ? walkInclude.globToRegExp(pattern) : pattern) : void 0;
39
- const mappedSkip = skip ? skip.map((pattern) => typeof pattern === "string" ? walkInclude.globToRegExp(pattern) : pattern) : void 0;
40
- directory = path.resolve(utils.toPath(directory));
41
- if (includeDirectories && walkInclude.walkInclude(directory, extensions, mappedMatch, mappedSkip)) {
42
- yield await _createWalkEntry(directory);
43
- }
44
- if (maxDepth < 1 || !walkInclude.walkInclude(directory, void 0, void 0, mappedSkip)) {
45
- return;
46
- }
47
- try {
48
- for await (const entry of await promises.readdir(directory, {
49
- withFileTypes: true
50
- })) {
51
- let path$1 = path.join(directory, entry.name);
52
- if (entry.isSymbolicLink()) {
53
- if (followSymlinks) {
54
- path$1 = await promises.realpath(path$1);
55
- } else if (includeSymlinks && walkInclude.walkInclude(path$1, extensions, mappedMatch, mappedSkip)) {
56
- yield {
57
- // eslint-disable-next-line @typescript-eslint/unbound-method
58
- isDirectory: entry.isDirectory,
59
- // eslint-disable-next-line @typescript-eslint/unbound-method
60
- isFile: entry.isFile,
61
- // eslint-disable-next-line @typescript-eslint/unbound-method
62
- isSymbolicLink: entry.isSymbolicLink,
63
- name: entry.name,
64
- path: path$1
65
- };
66
- } else {
67
- continue;
68
- }
69
- }
70
- if (entry.isSymbolicLink() || entry.isDirectory()) {
71
- yield* walk(path$1, {
72
- extensions,
73
- followSymlinks,
74
- includeDirs: includeDirectories,
75
- includeFiles,
76
- includeSymlinks,
77
- match: mappedMatch,
78
- maxDepth: maxDepth - 1,
79
- skip: mappedSkip
80
- });
81
- } else if (entry.isFile() && includeFiles && walkInclude.walkInclude(path$1, extensions, mappedMatch, mappedSkip)) {
82
- yield {
83
- isDirectory: /* @__PURE__ */ __name(() => entry.isDirectory(), "isDirectory"),
84
- isFile: /* @__PURE__ */ __name(() => entry.isFile(), "isFile"),
85
- isSymbolicLink: /* @__PURE__ */ __name(() => entry.isSymbolicLink(), "isSymbolicLink"),
86
- name: entry.name,
87
- path: path$1
88
- };
89
- }
90
- }
91
- } catch (error) {
92
- if (error instanceof WalkError) {
93
- throw error;
94
- }
95
- throw new WalkError(error, directory);
96
- }
97
- }
98
- __name(walk, "walk");
99
-
100
- module.exports = walk;