@visulima/fs 2.3.4 → 2.3.6

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 (217) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +318 -362
  3. package/dist/error.cjs +21 -1
  4. package/dist/error.mjs +7 -1
  5. package/dist/index.cjs +88 -1
  6. package/dist/index.mjs +35 -1
  7. package/dist/packem_shared/AlreadyExistsError-DpxtwQot.cjs +34 -0
  8. package/dist/packem_shared/AlreadyExistsError-GK7J9fVA.mjs +32 -0
  9. package/dist/packem_shared/DirectoryError-D8FHcAqu.cjs +34 -0
  10. package/dist/packem_shared/DirectoryError-DByTWE7t.mjs +32 -0
  11. package/dist/packem_shared/F_OK-CWSqQIdF.cjs +17 -0
  12. package/dist/packem_shared/F_OK-JER1LjUr.mjs +8 -0
  13. package/dist/packem_shared/JSONError-BCIIHvzq.mjs +28 -0
  14. package/dist/packem_shared/JSONError-gkXvBSar.cjs +30 -0
  15. package/dist/packem_shared/LF-CU3KsvZC.mjs +20 -0
  16. package/dist/packem_shared/LF-bB2qO80j.cjs +28 -0
  17. package/dist/packem_shared/NotEmptyError-BCS_5pPt.cjs +34 -0
  18. package/dist/packem_shared/NotEmptyError-DCXooh5l.mjs +32 -0
  19. package/dist/packem_shared/NotFoundError-B_1nPl3K.cjs +34 -0
  20. package/dist/packem_shared/NotFoundError-CUdcC61I.mjs +32 -0
  21. package/dist/packem_shared/PermissionError-CqGMI9qC.mjs +32 -0
  22. package/dist/packem_shared/PermissionError-QFMKgk2l.cjs +34 -0
  23. package/dist/packem_shared/WalkError-B7_AVs7d.cjs +27 -0
  24. package/dist/packem_shared/WalkError-H9EuRv7O.mjs +25 -0
  25. package/dist/packem_shared/assertValidFileContents-CRVvyM6b.cjs +11 -0
  26. package/dist/packem_shared/assertValidFileContents-Ox-ScfeK.mjs +9 -0
  27. package/dist/packem_shared/assertValidFileOrDirectoryPath-BMbgA-eI.cjs +11 -0
  28. package/dist/packem_shared/assertValidFileOrDirectoryPath-BWWgA1wj.mjs +9 -0
  29. package/dist/packem_shared/collect-BtDVJEOm.mjs +16 -0
  30. package/dist/packem_shared/collect-DxUriHCH.cjs +18 -0
  31. package/dist/packem_shared/collectSync-BaA0s001.cjs +18 -0
  32. package/dist/packem_shared/collectSync-CGjdb50I.mjs +16 -0
  33. package/dist/packem_shared/emptyDir-DcCfiNcf.cjs +22 -0
  34. package/dist/packem_shared/emptyDir-Dw5xSBox.mjs +20 -0
  35. package/dist/packem_shared/emptyDirSync-BoknkGUe.cjs +21 -0
  36. package/dist/packem_shared/emptyDirSync-DTGPXQ3v.mjs +19 -0
  37. package/dist/packem_shared/ensureDir-XiBlkOLR.mjs +33 -0
  38. package/dist/packem_shared/ensureDir-iUK2ga5M.cjs +35 -0
  39. package/dist/packem_shared/ensureDirSync-2IFUHFK2.mjs +33 -0
  40. package/dist/packem_shared/ensureDirSync-CXdMkg0Y.cjs +35 -0
  41. package/dist/packem_shared/ensureFile-Br8tFUJ7.cjs +29 -0
  42. package/dist/packem_shared/ensureFile-C2bWlBEa.mjs +27 -0
  43. package/dist/packem_shared/ensureFileSync-CZzSkNGC.cjs +29 -0
  44. package/dist/packem_shared/ensureFileSync-DkFfhOEs.mjs +27 -0
  45. package/dist/packem_shared/ensureLink-CFiabAD3.mjs +34 -0
  46. package/dist/packem_shared/ensureLink-Dqw5GBDq.cjs +36 -0
  47. package/dist/packem_shared/ensureLinkSync-BVw3h6sK.cjs +36 -0
  48. package/dist/packem_shared/ensureLinkSync-Dk-YeRg6.mjs +34 -0
  49. package/dist/packem_shared/ensureSymlink-CFSfreco.cjs +54 -0
  50. package/dist/packem_shared/ensureSymlink-CSqngPoI.mjs +52 -0
  51. package/dist/packem_shared/ensureSymlinkSync-BCd9bzsx.cjs +58 -0
  52. package/dist/packem_shared/ensureSymlinkSync-QRaNZX2E.mjs +56 -0
  53. package/dist/packem_shared/findUp-C8_QpAtD.mjs +63 -0
  54. package/dist/packem_shared/findUp-DA511Swp.cjs +65 -0
  55. package/dist/packem_shared/findUpSync-DVOd3V-q.mjs +63 -0
  56. package/dist/packem_shared/findUpSync-u1rGibzw.cjs +65 -0
  57. package/dist/packem_shared/get-file-info-type-BpRzQHvd.cjs +18 -0
  58. package/dist/packem_shared/get-file-info-type-CeiZ6n6g.mjs +16 -0
  59. package/dist/packem_shared/index-ajT9ecry.mjs +108 -0
  60. package/dist/packem_shared/index-ngvEMjBI.cjs +110 -0
  61. package/dist/packem_shared/is-stats-identical-BfdEfO6i.cjs +7 -0
  62. package/dist/packem_shared/is-stats-identical-ByTYZ2Aw.mjs +5 -0
  63. package/dist/packem_shared/isAccessible-Bonsm1Ez.mjs +20 -0
  64. package/dist/packem_shared/isAccessible-ZNVGsSb7.cjs +22 -0
  65. package/dist/packem_shared/isAccessibleSync-3gnUWUwX.mjs +20 -0
  66. package/dist/packem_shared/isAccessibleSync-VWjQa-US.cjs +22 -0
  67. package/dist/packem_shared/move-DgF7Ul9L.mjs +114 -0
  68. package/dist/packem_shared/move-Dh925GL9.cjs +121 -0
  69. package/dist/packem_shared/parseJson-B_q4905N.mjs +160 -0
  70. package/dist/packem_shared/parseJson-P3C7DMaS.cjs +162 -0
  71. package/dist/packem_shared/readFile-DUM-xNoB.mjs +46 -0
  72. package/dist/packem_shared/readFile-iFUhZHnh.cjs +48 -0
  73. package/dist/packem_shared/readFileSync-B3NTOR-W.cjs +33 -0
  74. package/dist/packem_shared/readFileSync-Cck96_o0.mjs +31 -0
  75. package/dist/packem_shared/readJson-Bqr9Oi3I.mjs +25 -0
  76. package/dist/packem_shared/readJson-D7rMdkkq.cjs +27 -0
  77. package/dist/packem_shared/readJsonSync-D3s2y651.cjs +27 -0
  78. package/dist/packem_shared/readJsonSync-Don8Jw5D.mjs +25 -0
  79. package/dist/packem_shared/readYaml-sR4bqUel.cjs +15 -0
  80. package/dist/packem_shared/readYaml-vVKK8ZzY.mjs +13 -0
  81. package/dist/packem_shared/readYamlSync-C3oOzxiN.cjs +15 -0
  82. package/dist/packem_shared/readYamlSync-MOLH4gXB.mjs +13 -0
  83. package/dist/packem_shared/remove-B2nxUObP.mjs +18 -0
  84. package/dist/packem_shared/remove-BpDiVPns.cjs +20 -0
  85. package/dist/packem_shared/removeSync-BosXW624.cjs +20 -0
  86. package/dist/packem_shared/removeSync-C87yepDI.mjs +18 -0
  87. package/dist/packem_shared/resolve-symlink-target-BbpEHdU2.mjs +18 -0
  88. package/dist/packem_shared/resolve-symlink-target-DImIddt6.cjs +20 -0
  89. package/dist/packem_shared/stripJsonComments-B66nRaTZ.mjs +21 -0
  90. package/dist/packem_shared/stripJsonComments-eDrcJvBT.cjs +23 -0
  91. package/dist/packem_shared/to-uint-8-array-B4CjMOD3.mjs +21 -0
  92. package/dist/packem_shared/to-uint-8-array-BaTEyX3D.cjs +23 -0
  93. package/dist/packem_shared/walk-BW7b4GXI.cjs +106 -0
  94. package/dist/packem_shared/walk-CNcSYQVq.mjs +104 -0
  95. package/dist/packem_shared/walk-include-CMUSRa86.mjs +20 -0
  96. package/dist/packem_shared/walk-include-yUdRrF16.cjs +23 -0
  97. package/dist/packem_shared/walkSync-BzxdFWLU.mjs +103 -0
  98. package/dist/packem_shared/walkSync-DgPj93NL.cjs +105 -0
  99. package/dist/packem_shared/writeFile-B7dhfseN.mjs +58 -0
  100. package/dist/packem_shared/writeFile-DKu5-M8x.cjs +60 -0
  101. package/dist/packem_shared/writeFileSync-Db6pmY0q.cjs +60 -0
  102. package/dist/packem_shared/writeFileSync-mMGYqOc8.mjs +58 -0
  103. package/dist/packem_shared/writeJson-BSQE2uFN.mjs +31 -0
  104. package/dist/packem_shared/writeJson-DtnnjTix.cjs +33 -0
  105. package/dist/packem_shared/writeJsonSync-C_i6LsGT.mjs +31 -0
  106. package/dist/packem_shared/writeJsonSync-Dz5-B2PD.cjs +33 -0
  107. package/dist/packem_shared/writeYaml-B-KoZN0E.cjs +14 -0
  108. package/dist/packem_shared/writeYaml-DSTzKc0_.mjs +12 -0
  109. package/dist/packem_shared/writeYamlSync-D6borSP1.cjs +14 -0
  110. package/dist/packem_shared/writeYamlSync-agxYIea0.mjs +12 -0
  111. package/dist/utils.cjs +19 -1
  112. package/dist/utils.mjs +6 -1
  113. package/package.json +15 -16
  114. package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.mjs +0 -1
  115. package/dist/packem_shared/AlreadyExistsError-GC2XUgzJ.cjs +0 -1
  116. package/dist/packem_shared/DirectoryError-B8wqer68.cjs +0 -1
  117. package/dist/packem_shared/DirectoryError-ddlbUV8C.mjs +0 -1
  118. package/dist/packem_shared/F_OK-6WAweffB.cjs +0 -1
  119. package/dist/packem_shared/F_OK-B71i3mUa.mjs +0 -1
  120. package/dist/packem_shared/JSONError-CVkb3xZ3.mjs +0 -4
  121. package/dist/packem_shared/JSONError-CWuiGmNc.cjs +0 -4
  122. package/dist/packem_shared/LF-D4BqIfQm.cjs +0 -3
  123. package/dist/packem_shared/LF-Dbx0i6a7.mjs +0 -3
  124. package/dist/packem_shared/NotEmptyError-BWGfec5K.cjs +0 -1
  125. package/dist/packem_shared/NotEmptyError-DMh1o7UL.mjs +0 -1
  126. package/dist/packem_shared/NotFoundError-Diij7oqe.cjs +0 -1
  127. package/dist/packem_shared/NotFoundError-T95YsWYl.mjs +0 -1
  128. package/dist/packem_shared/PermissionError-B8oi38Bx.mjs +0 -1
  129. package/dist/packem_shared/PermissionError-Ck1Es7al.cjs +0 -1
  130. package/dist/packem_shared/WalkError-BsngoIKJ.mjs +0 -1
  131. package/dist/packem_shared/WalkError-gKgp0TWD.cjs +0 -1
  132. package/dist/packem_shared/assertValidFileContents-BLhwm7u2.mjs +0 -1
  133. package/dist/packem_shared/assertValidFileContents-CrbDz09d.cjs +0 -1
  134. package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.mjs +0 -1
  135. package/dist/packem_shared/assertValidFileOrDirectoryPath-HOUs73Jk.cjs +0 -1
  136. package/dist/packem_shared/collect-4au76gDu.cjs +0 -1
  137. package/dist/packem_shared/collect-CRzGiRGg.mjs +0 -1
  138. package/dist/packem_shared/collectSync-BE8DAOke.mjs +0 -1
  139. package/dist/packem_shared/collectSync-CbKwt8rz.cjs +0 -1
  140. package/dist/packem_shared/emptyDir-D2m8OP8u.mjs +0 -1
  141. package/dist/packem_shared/emptyDir-DKxQHQQb.cjs +0 -1
  142. package/dist/packem_shared/emptyDirSync-CLM_zyIb.cjs +0 -1
  143. package/dist/packem_shared/emptyDirSync-CZNcW4wc.mjs +0 -1
  144. package/dist/packem_shared/ensureDir-BtvxsJiS.mjs +0 -1
  145. package/dist/packem_shared/ensureDir-DVHj-_yp.cjs +0 -1
  146. package/dist/packem_shared/ensureDirSync-CvjJ3bGq.cjs +0 -1
  147. package/dist/packem_shared/ensureDirSync-bGe0QB7d.mjs +0 -1
  148. package/dist/packem_shared/ensureFile-C46R6-4l.mjs +0 -1
  149. package/dist/packem_shared/ensureFile-CcJ5XIZm.cjs +0 -1
  150. package/dist/packem_shared/ensureFileSync-CwYTIP4G.mjs +0 -1
  151. package/dist/packem_shared/ensureFileSync-v-PhMLTr.cjs +0 -1
  152. package/dist/packem_shared/ensureLink-63XWiA3I.mjs +0 -1
  153. package/dist/packem_shared/ensureLink-C-v4AxzH.cjs +0 -1
  154. package/dist/packem_shared/ensureLinkSync-C4S-zdVb.cjs +0 -1
  155. package/dist/packem_shared/ensureLinkSync-D2LVObKd.mjs +0 -1
  156. package/dist/packem_shared/ensureSymlink-C5cy9585.cjs +0 -1
  157. package/dist/packem_shared/ensureSymlink-D36fS4KE.mjs +0 -1
  158. package/dist/packem_shared/ensureSymlinkSync-PvWVgeXc.mjs +0 -1
  159. package/dist/packem_shared/ensureSymlinkSync-YDRbg9hX.cjs +0 -1
  160. package/dist/packem_shared/findUp-CMGMYNty.mjs +0 -1
  161. package/dist/packem_shared/findUp-VKPTLmQQ.cjs +0 -1
  162. package/dist/packem_shared/findUpSync-BFwDGxkV.cjs +0 -1
  163. package/dist/packem_shared/findUpSync-QP_ZEsJN.mjs +0 -1
  164. package/dist/packem_shared/get-file-info-type-BXcpoWEM.cjs +0 -1
  165. package/dist/packem_shared/get-file-info-type-CaWGXRjY.mjs +0 -1
  166. package/dist/packem_shared/index-Cms6lU4T.cjs +0 -1
  167. package/dist/packem_shared/index-VcQXVcaq.mjs +0 -1
  168. package/dist/packem_shared/is-stats-identical-CPCumzsC.cjs +0 -1
  169. package/dist/packem_shared/is-stats-identical-CS5Y91zW.mjs +0 -1
  170. package/dist/packem_shared/isAccessible-Be3NKjOk.cjs +0 -1
  171. package/dist/packem_shared/isAccessible-cO53WedI.mjs +0 -1
  172. package/dist/packem_shared/isAccessibleSync-D5Vc2GTD.mjs +0 -1
  173. package/dist/packem_shared/isAccessibleSync-WOSgkAy2.cjs +0 -1
  174. package/dist/packem_shared/move-MZ9F6paN.mjs +0 -1
  175. package/dist/packem_shared/move-j3mzcWrG.cjs +0 -1
  176. package/dist/packem_shared/parseJson-BIYrZWHm.mjs +0 -6
  177. package/dist/packem_shared/parseJson-CXe73j5t.cjs +0 -6
  178. package/dist/packem_shared/readFile-CFus1Rym.mjs +0 -1
  179. package/dist/packem_shared/readFile-fzYtUKuW.cjs +0 -1
  180. package/dist/packem_shared/readFileSync-Dz4jLcWc.cjs +0 -1
  181. package/dist/packem_shared/readFileSync-Ulz6QzOz.mjs +0 -1
  182. package/dist/packem_shared/readJson-C6RN16Rf.mjs +0 -1
  183. package/dist/packem_shared/readJson-D7_CYUJX.cjs +0 -1
  184. package/dist/packem_shared/readJsonSync-QziPGqW_.cjs +0 -1
  185. package/dist/packem_shared/readJsonSync-ztZXpE8z.mjs +0 -1
  186. package/dist/packem_shared/readYaml-C-ui8qXw.cjs +0 -1
  187. package/dist/packem_shared/readYaml-aFHfT-4e.mjs +0 -1
  188. package/dist/packem_shared/readYamlSync-CeJ6RnoJ.mjs +0 -1
  189. package/dist/packem_shared/readYamlSync-DUYMSemC.cjs +0 -1
  190. package/dist/packem_shared/remove-B-9MI2l5.cjs +0 -1
  191. package/dist/packem_shared/remove-DzfvbZOm.mjs +0 -1
  192. package/dist/packem_shared/removeSync-CJPR6M7V.cjs +0 -1
  193. package/dist/packem_shared/removeSync-D165rXSn.mjs +0 -1
  194. package/dist/packem_shared/resolve-symlink-target-BofZSDIc.mjs +0 -1
  195. package/dist/packem_shared/resolve-symlink-target-HnbdXA1S.cjs +0 -1
  196. package/dist/packem_shared/stripJsonComments-CKgR4nW4.mjs +0 -1
  197. package/dist/packem_shared/stripJsonComments-Cw7UCxI3.cjs +0 -1
  198. package/dist/packem_shared/to-uint-8-array-2-3EvGd7.cjs +0 -1
  199. package/dist/packem_shared/to-uint-8-array-DwgaTasY.mjs +0 -1
  200. package/dist/packem_shared/walk-BJgnJy5d.cjs +0 -1
  201. package/dist/packem_shared/walk-DH-95i_B.mjs +0 -1
  202. package/dist/packem_shared/walk-include-B-MbUqMt.mjs +0 -1
  203. package/dist/packem_shared/walk-include-CFIYniQi.cjs +0 -1
  204. package/dist/packem_shared/walkSync-D4zvt_kM.mjs +0 -1
  205. package/dist/packem_shared/walkSync-DYawhxUA.cjs +0 -1
  206. package/dist/packem_shared/writeFile-DaHzc_FW.mjs +0 -1
  207. package/dist/packem_shared/writeFile-WCuWZNRy.cjs +0 -1
  208. package/dist/packem_shared/writeFileSync-D9HGh6J-.mjs +0 -1
  209. package/dist/packem_shared/writeFileSync-Ds49_ORi.cjs +0 -1
  210. package/dist/packem_shared/writeJson-BdjtBy1t.cjs +0 -4
  211. package/dist/packem_shared/writeJson-Bu7Dw4Uu.mjs +0 -4
  212. package/dist/packem_shared/writeJsonSync-7CjNn7oo.mjs +0 -4
  213. package/dist/packem_shared/writeJsonSync-CdC3ahaO.cjs +0 -4
  214. package/dist/packem_shared/writeYaml-COWffUNm.cjs +0 -1
  215. package/dist/packem_shared/writeYaml-bi1dx696.mjs +0 -1
  216. package/dist/packem_shared/writeYamlSync-BpIN1tTP.cjs +0 -1
  217. package/dist/packem_shared/writeYamlSync-D2VPlEws.mjs +0 -1
@@ -0,0 +1,162 @@
1
+ 'use strict';
2
+
3
+ const JSONError = require('./JSONError-gkXvBSar.cjs');
4
+
5
+ var __defProp$2 = Object.defineProperty;
6
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
7
+ var P = Object.defineProperty;
8
+ var v = /* @__PURE__ */ __name$2((t, e) => P(t, "name", { value: e, configurable: true }), "v");
9
+ var E = Object.defineProperty;
10
+ var F = v((t, e) => E(t, "name", { value: e, configurable: true }), "r$1");
11
+ const N = F((t) => t.replaceAll(/\r\n|\r(?!\n)|\n/gu, `
12
+ `), "normalizeLF");
13
+ const S = globalThis.process || /* @__PURE__ */ Object.create(null);
14
+ const j = { versions: {} };
15
+ const k = new Proxy(S, { get(t, e) {
16
+ if (e in t) return t[e];
17
+ if (e in j) return j[e];
18
+ } });
19
+ var W = Object.defineProperty;
20
+ var C = v((t, e) => W(t, "name", { value: e, configurable: true }), "b");
21
+ const T = C((t, e, h, n) => {
22
+ const f = { column: 0, line: -1, ...t.start }, i = { ...f, ...t.end }, o = f.line, l = f.column, m = i.line, u = i.column;
23
+ let g = Math.max(o - (h + 1), 0), p = Math.min(e.length, m + n);
24
+ o === -1 && (g = 0), m === -1 && (p = e.length);
25
+ const b = m - o, a = {};
26
+ if (b) for (let r = 0; r <= b; r++) {
27
+ const s = r + o;
28
+ if (!l) a[s] = true;
29
+ else if (r === 0) {
30
+ const c = e[s - 1]?.length;
31
+ a[s] = [l, (c ?? 0) - l + 1];
32
+ } else if (r === b) a[s] = [0, u];
33
+ else {
34
+ const c = e[s - r]?.length;
35
+ a[s] = [0, c];
36
+ }
37
+ }
38
+ else l === u ? a[o] = l ? [l, 0] : true : a[o] = [l, (u ?? 0) - (l ?? 0)];
39
+ return { end: p, markerLines: a, start: g };
40
+ }, "getMarkerLines");
41
+ var _ = Object.defineProperty;
42
+ var x = v((t, e) => _(t, "name", { value: e, configurable: true }), "o");
43
+ const B = k.platform === "win32" && !k.env?.WT_SESSION ? ">" : "❯";
44
+ const I = x((t, e, h) => {
45
+ const n = { linesAbove: 2, linesBelow: 3, prefix: "", showGutter: true, showLineNumbers: true, tabWidth: 4, ...h, color: { gutter: x((r) => r, "gutter"), marker: x((r) => r, "marker"), message: x((r) => r, "message"), ...h?.color } }, f = e.start && typeof e.start.column == "number";
46
+ let i = N(t).split(`
47
+ `);
48
+ typeof n?.tabWidth == "number" && (i = i.map((r) => r.replaceAll(" ", " ".repeat(n.tabWidth))));
49
+ const { end: o, markerLines: l, start: m } = T(e, i, n.linesAbove, n.linesBelow), u = String(o).length, { gutter: g, marker: p, message: b } = n.color;
50
+ let a = i.slice(m, o).map((r, s) => {
51
+ const c = m + 1 + s, d = l[c], w = (" " + c).slice(-u), L = !l[c + 1], A = " " + w + (n.showGutter ? " |" : "");
52
+ if (d) {
53
+ let y = "";
54
+ if (Array.isArray(d)) {
55
+ const O = r.replaceAll(/[^\t]/g, " ").slice(0, Math.max(d[0] - 1, 0)), M = d[1] || 1;
56
+ y = [`
57
+ `, n.prefix + g(A.replaceAll(/\d/g, " ")), " ", O, p("^").repeat(M)].join(""), L && n.message && (y += ` ${b(n.message)}`);
58
+ }
59
+ return [n.prefix + p(B), g(A), r.length > 0 ? " " + r : "", y].join("");
60
+ }
61
+ return n.prefix + " " + g(A) + (r.length > 0 ? " " + r : "");
62
+ }).join(`
63
+ `);
64
+ return n.message && !f && (a = n.prefix + " ".repeat(u + 1) + n.message + `
65
+ ` + a), a;
66
+ }, "codeFrame");
67
+
68
+ var __defProp$1 = Object.defineProperty;
69
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
70
+ var c = Object.defineProperty;
71
+ var a = /* @__PURE__ */ __name$1((n, t) => c(n, "name", { value: t, configurable: true }), "a");
72
+ var f = Object.defineProperty;
73
+ var s = a((n, t) => f(n, "name", { value: t, configurable: true }), "l");
74
+ const u = s((n, t) => {
75
+ let e = 0, i = t.length - 2;
76
+ for (; e < i; ) {
77
+ const r = e + (i - e >> 1);
78
+ if (n < t[r]) i = r - 1;
79
+ else if (n >= t[r + 1]) e = r + 1;
80
+ else {
81
+ e = r;
82
+ break;
83
+ }
84
+ }
85
+ return e;
86
+ }, "binarySearch");
87
+ const y = s((n) => n.split(/\n|\r(?!\n)/).reduce((t, e) => (t.push(t.at(-1) + e.length + 1), t), [0]), "getLineStartIndexes");
88
+ const p = s((n, t, e) => {
89
+ const i = e?.skipChecks ?? false;
90
+ if (!i && (!Array.isArray(n) && typeof n != "string" || (typeof n == "string" || Array.isArray(n)) && n.length === 0)) return { column: 0, line: 0 };
91
+ if (!i && (typeof t != "number" || typeof n == "string" && t >= n.length || Array.isArray(n) && t + 1 >= n.at(-1))) return { column: 0, line: 0 };
92
+ if (typeof n == "string") {
93
+ const l = y(n), o = u(t, l);
94
+ return { column: t - l[o] + 1, line: o + 1 };
95
+ }
96
+ const r = u(t, n);
97
+ return { column: t - n[r] + 1, line: r + 1 };
98
+ }, "indexToLineColumn");
99
+
100
+ var __defProp = Object.defineProperty;
101
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
102
+ const getCodePoint = /* @__PURE__ */ __name((character) => `\\u{${character.codePointAt(0).toString(16)}}`, "getCodePoint");
103
+ const generateCodeFrame = /* @__PURE__ */ __name((source, location, options) => I(
104
+ source,
105
+ { start: location },
106
+ {
107
+ tabWidth: false,
108
+ ...options
109
+ }
110
+ ), "generateCodeFrame");
111
+ const getErrorLocation = /* @__PURE__ */ __name((source, message) => {
112
+ const match = /in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(message);
113
+ if (!match) {
114
+ return undefined;
115
+ }
116
+ let { column, index, line } = match.groups;
117
+ if (line && column) {
118
+ return { column: Number(column), line: Number(line) };
119
+ }
120
+ index = Number(index);
121
+ if (index === source.length) {
122
+ index = source.length - 1;
123
+ }
124
+ return p(source, index);
125
+ }, "getErrorLocation");
126
+ const addCodePointToUnexpectedToken = /* @__PURE__ */ __name((message) => message.replace(
127
+ // TODO[engine:node@>=20]: The token always quoted after Node.js 20
128
+ // eslint-disable-next-line regexp/no-potentially-useless-backreference
129
+ /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,
130
+ (_, _quote, token) => `"${token}"(${getCodePoint(token)})`
131
+ ), "addCodePointToUnexpectedToken");
132
+ function parseJson(string, reviver, fileName, options) {
133
+ if (typeof reviver === "string") {
134
+ if (typeof fileName === "object") {
135
+ options = fileName;
136
+ }
137
+ fileName = reviver;
138
+ reviver = undefined;
139
+ }
140
+ let message;
141
+ try {
142
+ return JSON.parse(string, reviver);
143
+ } catch (error) {
144
+ message = error.message;
145
+ }
146
+ let location;
147
+ if (string) {
148
+ location = getErrorLocation(string, message);
149
+ message = addCodePointToUnexpectedToken(message);
150
+ } else {
151
+ message += " while parsing empty string";
152
+ }
153
+ const jsonError = new JSONError(message);
154
+ jsonError.fileName = fileName;
155
+ if (location) {
156
+ jsonError.codeFrame = generateCodeFrame(string, location, options);
157
+ }
158
+ throw jsonError;
159
+ }
160
+ __name(parseJson, "parseJson");
161
+
162
+ module.exports = parseJson;
@@ -0,0 +1,46 @@
1
+ import { readFile as readFile$1 } from 'node:fs/promises';
2
+ import { brotliDecompress, unzip } 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 isAccessible from './isAccessible-Bonsm1Ez.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: brotliDecompress,
13
+ gzip: unzip,
14
+ none: /* @__PURE__ */ __name((buffer, callback) => {
15
+ callback(null, buffer);
16
+ }, "none")
17
+ };
18
+ const readFile = /* @__PURE__ */ __name(async (path, options) => {
19
+ assertValidFileOrDirectoryPath(path);
20
+ path = toPath(path);
21
+ if (!await isAccessible(path)) {
22
+ throw new PermissionError(`unable to read the non-accessible file: ${path}`);
23
+ }
24
+ if (!await isAccessible(path, R_OK)) {
25
+ throw new Error(`Unable to read the non-readable file: ${path}`);
26
+ }
27
+ const { buffer, compression, encoding, flag } = options ?? {};
28
+ return await readFile$1(path, flag ? { encoding, flag } : { encoding }).then(
29
+ async (content) => (
30
+ // eslint-disable-next-line compat/compat
31
+ await new Promise((resolve, reject) => {
32
+ decompressionMethods[compression ?? "none"](content, (error, result) => {
33
+ if (error) {
34
+ reject(error);
35
+ } else {
36
+ resolve(buffer ? result : result.toString());
37
+ }
38
+ });
39
+ })
40
+ )
41
+ ).catch((error) => {
42
+ throw error;
43
+ });
44
+ }, "readFile");
45
+
46
+ export { readFile as default };
@@ -0,0 +1,48 @@
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;
@@ -0,0 +1,33 @@
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;
@@ -0,0 +1,31 @@
1
+ import { readFileSync as readFileSync$1 } from 'node:fs';
2
+ import { brotliDecompressSync, unzipSync } 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 };
@@ -0,0 +1,25 @@
1
+ import { toPath } from '@visulima/path/utils';
2
+ import parseJson from './parseJson-B_q4905N.mjs';
3
+ import readFile from './readFile-DUM-xNoB.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 = undefined;
11
+ }
12
+ const content = await readFile(path, {
13
+ buffer: true,
14
+ encoding: undefined
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 };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ const utils = require('@visulima/path/utils');
4
+ const parseJson = require('./parseJson-P3C7DMaS.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 = undefined;
13
+ }
14
+ const content = await readFile(path, {
15
+ buffer: true,
16
+ encoding: undefined
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;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ const utils = require('@visulima/path/utils');
4
+ const parseJson = require('./parseJson-P3C7DMaS.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 = undefined;
13
+ }
14
+ const content = readFileSync(path, {
15
+ buffer: true,
16
+ encoding: undefined
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;
@@ -0,0 +1,25 @@
1
+ import { toPath } from '@visulima/path/utils';
2
+ import parseJson from './parseJson-B_q4905N.mjs';
3
+ import readFileSync from './readFileSync-Cck96_o0.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 = undefined;
11
+ }
12
+ const content = readFileSync(path, {
13
+ buffer: true,
14
+ encoding: undefined
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 };
@@ -0,0 +1,15 @@
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;
@@ -0,0 +1,13 @@
1
+ import { parse } from 'yaml';
2
+ import readFile from './readFile-DUM-xNoB.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 };
@@ -0,0 +1,15 @@
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;
@@ -0,0 +1,13 @@
1
+ import { parse } from 'yaml';
2
+ import readFileSync from './readFileSync-Cck96_o0.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 };
@@ -0,0 +1,18 @@
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 };
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,18 @@
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 };
@@ -0,0 +1,18 @@
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 };
@@ -0,0 +1,20 @@
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;
@@ -0,0 +1,21 @@
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 };
@@ -0,0 +1,23 @@
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;