@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,110 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ const INDENT_REGEX = /^(?:( )+|\t+)/;
6
+ const INDENT_TYPE_SPACE = "space";
7
+ const INDENT_TYPE_TAB = "tab";
8
+ function makeIndentsMap(string, ignoreSingleSpaces) {
9
+ const indents = /* @__PURE__ */ new Map();
10
+ let previousSize = 0;
11
+ let previousIndentType;
12
+ let key;
13
+ for (const line of string.split(/\n/g)) {
14
+ if (!line) {
15
+ continue;
16
+ }
17
+ let indent;
18
+ let indentType;
19
+ let use;
20
+ let weight;
21
+ let entry;
22
+ const matches = line.match(INDENT_REGEX);
23
+ if (matches === null) {
24
+ previousSize = 0;
25
+ previousIndentType = "";
26
+ } else {
27
+ indent = matches[0].length;
28
+ indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
29
+ if (ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && indent === 1) {
30
+ continue;
31
+ }
32
+ if (indentType !== previousIndentType) {
33
+ previousSize = 0;
34
+ }
35
+ previousIndentType = indentType;
36
+ use = 1;
37
+ weight = 0;
38
+ const indentDifference = indent - previousSize;
39
+ previousSize = indent;
40
+ if (indentDifference === 0) {
41
+ use = 0;
42
+ weight = 1;
43
+ } else {
44
+ const absoluteIndentDifference = indentDifference > 0 ? indentDifference : -indentDifference;
45
+ key = encodeIndentsKey(indentType, absoluteIndentDifference);
46
+ }
47
+ entry = indents.get(key);
48
+ entry = entry === undefined ? [1, 0] : [entry[0] + use, entry[1] + weight];
49
+ indents.set(key, entry);
50
+ }
51
+ }
52
+ return indents;
53
+ }
54
+ __name(makeIndentsMap, "makeIndentsMap");
55
+ function encodeIndentsKey(indentType, indentAmount) {
56
+ const typeCharacter = indentType === INDENT_TYPE_SPACE ? "s" : "t";
57
+ return typeCharacter + String(indentAmount);
58
+ }
59
+ __name(encodeIndentsKey, "encodeIndentsKey");
60
+ function decodeIndentsKey(indentsKey) {
61
+ const keyHasTypeSpace = indentsKey[0] === "s";
62
+ const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
63
+ const amount = Number(indentsKey.slice(1));
64
+ return { type, amount };
65
+ }
66
+ __name(decodeIndentsKey, "decodeIndentsKey");
67
+ function getMostUsedKey(indents) {
68
+ let result;
69
+ let maxUsed = 0;
70
+ let maxWeight = 0;
71
+ for (const [key, [usedCount, weight]] of indents) {
72
+ if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
73
+ maxUsed = usedCount;
74
+ maxWeight = weight;
75
+ result = key;
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+ __name(getMostUsedKey, "getMostUsedKey");
81
+ function makeIndentString(type, amount) {
82
+ const indentCharacter = type === INDENT_TYPE_SPACE ? " " : " ";
83
+ return indentCharacter.repeat(amount);
84
+ }
85
+ __name(makeIndentString, "makeIndentString");
86
+ function detectIndent(string) {
87
+ if (typeof string !== "string") {
88
+ throw new TypeError("Expected a string");
89
+ }
90
+ let indents = makeIndentsMap(string, true);
91
+ if (indents.size === 0) {
92
+ indents = makeIndentsMap(string, false);
93
+ }
94
+ const keyOfMostUsedIndent = getMostUsedKey(indents);
95
+ let type;
96
+ let amount = 0;
97
+ let indent = "";
98
+ if (keyOfMostUsedIndent !== undefined) {
99
+ ({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
100
+ indent = makeIndentString(type, amount);
101
+ }
102
+ return {
103
+ amount,
104
+ type,
105
+ indent
106
+ };
107
+ }
108
+ __name(detectIndent, "detectIndent");
109
+
110
+ exports.detectIndent = detectIndent;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+ const isStatsIdentical = /* @__PURE__ */ __name((sourceStat, destinationStat) => !!destinationStat.ino && !!destinationStat.dev && destinationStat.ino === sourceStat.ino && destinationStat.dev === sourceStat.dev, "isStatsIdentical");
6
+
7
+ exports.isStatsIdentical = isStatsIdentical;
@@ -0,0 +1,5 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ const isStatsIdentical = /* @__PURE__ */ __name((sourceStat, destinationStat) => !!destinationStat.ino && !!destinationStat.dev && destinationStat.ino === sourceStat.ino && destinationStat.dev === sourceStat.dev, "isStatsIdentical");
4
+
5
+ export { isStatsIdentical as i };
@@ -0,0 +1,20 @@
1
+ import { access } from 'node:fs/promises';
2
+ import { toPath } from '@visulima/path/utils';
3
+ import { F_OK } from './F_OK-JER1LjUr.mjs';
4
+ import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ async function isAccessible(path, mode = F_OK) {
9
+ assertValidFileOrDirectoryPath(path);
10
+ path = toPath(path);
11
+ try {
12
+ await access(path, mode);
13
+ return true;
14
+ } catch {
15
+ return false;
16
+ }
17
+ }
18
+ __name(isAccessible, "isAccessible");
19
+
20
+ export { isAccessible as default };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const promises = require('node:fs/promises');
4
+ const utils = require('@visulima/path/utils');
5
+ const F_OK = require('./F_OK-CWSqQIdF.cjs');
6
+ const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ async function isAccessible(path, mode = F_OK.F_OK) {
11
+ assertValidFileOrDirectoryPath(path);
12
+ path = utils.toPath(path);
13
+ try {
14
+ await promises.access(path, mode);
15
+ return true;
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ __name(isAccessible, "isAccessible");
21
+
22
+ module.exports = isAccessible;
@@ -0,0 +1,20 @@
1
+ import { accessSync } from 'node:fs';
2
+ import { toPath } from '@visulima/path/utils';
3
+ import { F_OK } from './F_OK-JER1LjUr.mjs';
4
+ import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ function isAccessibleSync(path, mode = F_OK) {
9
+ assertValidFileOrDirectoryPath(path);
10
+ path = toPath(path);
11
+ try {
12
+ accessSync(path, mode);
13
+ return true;
14
+ } catch {
15
+ return false;
16
+ }
17
+ }
18
+ __name(isAccessibleSync, "isAccessibleSync");
19
+
20
+ export { isAccessibleSync as default };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const node_fs = require('node:fs');
4
+ const utils = require('@visulima/path/utils');
5
+ const F_OK = require('./F_OK-CWSqQIdF.cjs');
6
+ const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ function isAccessibleSync(path, mode = F_OK.F_OK) {
11
+ assertValidFileOrDirectoryPath(path);
12
+ path = utils.toPath(path);
13
+ try {
14
+ node_fs.accessSync(path, mode);
15
+ return true;
16
+ } catch {
17
+ return false;
18
+ }
19
+ }
20
+ __name(isAccessibleSync, "isAccessibleSync");
21
+
22
+ module.exports = isAccessibleSync;
@@ -0,0 +1,114 @@
1
+ import { cwd } from 'node:process';
2
+ import { toPath } from '@visulima/path/utils';
3
+ import { mkdir, rename as rename$1, copyFile, unlink } from 'node:fs/promises';
4
+ import { dirname, resolve } from '@visulima/path';
5
+ import isAccessible from './isAccessible-Bonsm1Ez.mjs';
6
+ import { mkdirSync, renameSync as renameSync$1, copyFileSync, unlinkSync } from 'node:fs';
7
+ import isAccessibleSync from './isAccessibleSync-3gnUWUwX.mjs';
8
+
9
+ var __defProp$3 = Object.defineProperty;
10
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
11
+ class SameDirectoryError extends Error {
12
+ static {
13
+ __name$3(this, "SameDirectoryError");
14
+ }
15
+ constructor(source, destination) {
16
+ super(`Source directory "${dirname(source)}" does not match destination directory "${dirname(destination)}"`);
17
+ this.name = "SameDirectoryError";
18
+ }
19
+ }
20
+ const validateSameDirectory = /* @__PURE__ */ __name$3((source, destination) => {
21
+ if (!source || !destination) {
22
+ throw new Error("Source and destination paths must not be empty");
23
+ }
24
+ if (dirname(source) !== dirname(destination)) {
25
+ throw new SameDirectoryError(source, destination);
26
+ }
27
+ }, "validateSameDirectory");
28
+
29
+ var __defProp$2 = Object.defineProperty;
30
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
31
+ const internalMoveFile = /* @__PURE__ */ __name$2(async (sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
32
+ if (cwd) {
33
+ sourcePath = resolve(cwd, sourcePath);
34
+ destinationPath = resolve(cwd, destinationPath);
35
+ }
36
+ if (validateDirectory) {
37
+ validateSameDirectory(sourcePath, destinationPath);
38
+ }
39
+ if (!overwrite && await isAccessible(destinationPath)) {
40
+ throw new Error(`The destination file exists: ${destinationPath}`);
41
+ }
42
+ await mkdir(dirname(destinationPath), {
43
+ mode: directoryMode,
44
+ recursive: true
45
+ });
46
+ try {
47
+ await rename$1(sourcePath, destinationPath);
48
+ } catch (error) {
49
+ if (error.code === "EXDEV") {
50
+ await copyFile(sourcePath, destinationPath);
51
+ await unlink(sourcePath);
52
+ } else {
53
+ throw error;
54
+ }
55
+ }
56
+ }, "internalMoveFile");
57
+
58
+ var __defProp$1 = Object.defineProperty;
59
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
60
+ const internalMoveFileSync = /* @__PURE__ */ __name$1((sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
61
+ if (cwd) {
62
+ sourcePath = resolve(cwd, sourcePath);
63
+ destinationPath = resolve(cwd, destinationPath);
64
+ }
65
+ if (validateDirectory) {
66
+ validateSameDirectory(sourcePath, destinationPath);
67
+ }
68
+ if (!overwrite && isAccessibleSync(destinationPath)) {
69
+ throw new Error(`The destination file exists: ${destinationPath}`);
70
+ }
71
+ mkdirSync(dirname(destinationPath), {
72
+ mode: directoryMode,
73
+ recursive: true
74
+ });
75
+ try {
76
+ renameSync$1(sourcePath, destinationPath);
77
+ } catch (error) {
78
+ if (error.code === "EXDEV") {
79
+ copyFileSync(sourcePath, destinationPath);
80
+ unlinkSync(sourcePath);
81
+ } else {
82
+ throw error;
83
+ }
84
+ }
85
+ }, "internalMoveFileSync");
86
+
87
+ var __defProp = Object.defineProperty;
88
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
89
+ const move = /* @__PURE__ */ __name(async (sourcePath, destinationPath, options = {}) => {
90
+ const internalOptions = {
91
+ overwrite: true,
92
+ validateDirectory: false,
93
+ ...options,
94
+ cwd: options.cwd ? toPath(options.cwd) : cwd()
95
+ };
96
+ await internalMoveFile(sourcePath, destinationPath, internalOptions);
97
+ }, "move");
98
+ const moveSync = /* @__PURE__ */ __name((sourcePath, destinationPath, options) => {
99
+ const internalOptions = { overwrite: true, validateDirectory: false, ...options };
100
+ internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
101
+ internalMoveFileSync(sourcePath, destinationPath, internalOptions);
102
+ }, "moveSync");
103
+ const rename = /* @__PURE__ */ __name(async (source, destination, options) => {
104
+ const internalOptions = { overwrite: true, ...options, validateDirectory: true };
105
+ internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
106
+ await internalMoveFile(source, destination, internalOptions);
107
+ }, "rename");
108
+ const renameSync = /* @__PURE__ */ __name((source, destination, options) => {
109
+ const internalOptions = { overwrite: true, ...options, validateDirectory: true };
110
+ internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
111
+ internalMoveFileSync(source, destination, internalOptions);
112
+ }, "renameSync");
113
+
114
+ export { move, moveSync, rename, renameSync };
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const node_process = require('node:process');
6
+ const utils = require('@visulima/path/utils');
7
+ const promises = require('node:fs/promises');
8
+ const path = require('@visulima/path');
9
+ const isAccessible = require('./isAccessible-ZNVGsSb7.cjs');
10
+ const node_fs = require('node:fs');
11
+ const isAccessibleSync = require('./isAccessibleSync-VWjQa-US.cjs');
12
+
13
+ var __defProp$3 = Object.defineProperty;
14
+ var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
15
+ class SameDirectoryError extends Error {
16
+ static {
17
+ __name$3(this, "SameDirectoryError");
18
+ }
19
+ constructor(source, destination) {
20
+ super(`Source directory "${path.dirname(source)}" does not match destination directory "${path.dirname(destination)}"`);
21
+ this.name = "SameDirectoryError";
22
+ }
23
+ }
24
+ const validateSameDirectory = /* @__PURE__ */ __name$3((source, destination) => {
25
+ if (!source || !destination) {
26
+ throw new Error("Source and destination paths must not be empty");
27
+ }
28
+ if (path.dirname(source) !== path.dirname(destination)) {
29
+ throw new SameDirectoryError(source, destination);
30
+ }
31
+ }, "validateSameDirectory");
32
+
33
+ var __defProp$2 = Object.defineProperty;
34
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
35
+ const internalMoveFile = /* @__PURE__ */ __name$2(async (sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
36
+ if (cwd) {
37
+ sourcePath = path.resolve(cwd, sourcePath);
38
+ destinationPath = path.resolve(cwd, destinationPath);
39
+ }
40
+ if (validateDirectory) {
41
+ validateSameDirectory(sourcePath, destinationPath);
42
+ }
43
+ if (!overwrite && await isAccessible(destinationPath)) {
44
+ throw new Error(`The destination file exists: ${destinationPath}`);
45
+ }
46
+ await promises.mkdir(path.dirname(destinationPath), {
47
+ mode: directoryMode,
48
+ recursive: true
49
+ });
50
+ try {
51
+ await promises.rename(sourcePath, destinationPath);
52
+ } catch (error) {
53
+ if (error.code === "EXDEV") {
54
+ await promises.copyFile(sourcePath, destinationPath);
55
+ await promises.unlink(sourcePath);
56
+ } else {
57
+ throw error;
58
+ }
59
+ }
60
+ }, "internalMoveFile");
61
+
62
+ var __defProp$1 = Object.defineProperty;
63
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
64
+ const internalMoveFileSync = /* @__PURE__ */ __name$1((sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
65
+ if (cwd) {
66
+ sourcePath = path.resolve(cwd, sourcePath);
67
+ destinationPath = path.resolve(cwd, destinationPath);
68
+ }
69
+ if (validateDirectory) {
70
+ validateSameDirectory(sourcePath, destinationPath);
71
+ }
72
+ if (!overwrite && isAccessibleSync(destinationPath)) {
73
+ throw new Error(`The destination file exists: ${destinationPath}`);
74
+ }
75
+ node_fs.mkdirSync(path.dirname(destinationPath), {
76
+ mode: directoryMode,
77
+ recursive: true
78
+ });
79
+ try {
80
+ node_fs.renameSync(sourcePath, destinationPath);
81
+ } catch (error) {
82
+ if (error.code === "EXDEV") {
83
+ node_fs.copyFileSync(sourcePath, destinationPath);
84
+ node_fs.unlinkSync(sourcePath);
85
+ } else {
86
+ throw error;
87
+ }
88
+ }
89
+ }, "internalMoveFileSync");
90
+
91
+ var __defProp = Object.defineProperty;
92
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
93
+ const move = /* @__PURE__ */ __name(async (sourcePath, destinationPath, options = {}) => {
94
+ const internalOptions = {
95
+ overwrite: true,
96
+ validateDirectory: false,
97
+ ...options,
98
+ cwd: options.cwd ? utils.toPath(options.cwd) : node_process.cwd()
99
+ };
100
+ await internalMoveFile(sourcePath, destinationPath, internalOptions);
101
+ }, "move");
102
+ const moveSync = /* @__PURE__ */ __name((sourcePath, destinationPath, options) => {
103
+ const internalOptions = { overwrite: true, validateDirectory: false, ...options };
104
+ internalOptions.cwd = internalOptions.cwd ? utils.toPath(internalOptions.cwd) : node_process.cwd();
105
+ internalMoveFileSync(sourcePath, destinationPath, internalOptions);
106
+ }, "moveSync");
107
+ const rename = /* @__PURE__ */ __name(async (source, destination, options) => {
108
+ const internalOptions = { overwrite: true, ...options, validateDirectory: true };
109
+ internalOptions.cwd = internalOptions.cwd ? utils.toPath(internalOptions.cwd) : node_process.cwd();
110
+ await internalMoveFile(source, destination, internalOptions);
111
+ }, "rename");
112
+ const renameSync = /* @__PURE__ */ __name((source, destination, options) => {
113
+ const internalOptions = { overwrite: true, ...options, validateDirectory: true };
114
+ internalOptions.cwd = internalOptions.cwd ? utils.toPath(internalOptions.cwd) : node_process.cwd();
115
+ internalMoveFileSync(source, destination, internalOptions);
116
+ }, "renameSync");
117
+
118
+ exports.move = move;
119
+ exports.moveSync = moveSync;
120
+ exports.rename = rename;
121
+ exports.renameSync = renameSync;
@@ -0,0 +1,160 @@
1
+ import JSONError from './JSONError-BCIIHvzq.mjs';
2
+
3
+ var __defProp$2 = Object.defineProperty;
4
+ var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
5
+ var P = Object.defineProperty;
6
+ var v = /* @__PURE__ */ __name$2((t, e) => P(t, "name", { value: e, configurable: true }), "v");
7
+ var E = Object.defineProperty;
8
+ var F = v((t, e) => E(t, "name", { value: e, configurable: true }), "r$1");
9
+ const N = F((t) => t.replaceAll(/\r\n|\r(?!\n)|\n/gu, `
10
+ `), "normalizeLF");
11
+ const S = globalThis.process || /* @__PURE__ */ Object.create(null);
12
+ const j = { versions: {} };
13
+ const k = new Proxy(S, { get(t, e) {
14
+ if (e in t) return t[e];
15
+ if (e in j) return j[e];
16
+ } });
17
+ var W = Object.defineProperty;
18
+ var C = v((t, e) => W(t, "name", { value: e, configurable: true }), "b");
19
+ const T = C((t, e, h, n) => {
20
+ const f = { column: 0, line: -1, ...t.start }, i = { ...f, ...t.end }, o = f.line, l = f.column, m = i.line, u = i.column;
21
+ let g = Math.max(o - (h + 1), 0), p = Math.min(e.length, m + n);
22
+ o === -1 && (g = 0), m === -1 && (p = e.length);
23
+ const b = m - o, a = {};
24
+ if (b) for (let r = 0; r <= b; r++) {
25
+ const s = r + o;
26
+ if (!l) a[s] = true;
27
+ else if (r === 0) {
28
+ const c = e[s - 1]?.length;
29
+ a[s] = [l, (c ?? 0) - l + 1];
30
+ } else if (r === b) a[s] = [0, u];
31
+ else {
32
+ const c = e[s - r]?.length;
33
+ a[s] = [0, c];
34
+ }
35
+ }
36
+ else l === u ? a[o] = l ? [l, 0] : true : a[o] = [l, (u ?? 0) - (l ?? 0)];
37
+ return { end: p, markerLines: a, start: g };
38
+ }, "getMarkerLines");
39
+ var _ = Object.defineProperty;
40
+ var x = v((t, e) => _(t, "name", { value: e, configurable: true }), "o");
41
+ const B = k.platform === "win32" && !k.env?.WT_SESSION ? ">" : "❯";
42
+ const I = x((t, e, h) => {
43
+ 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";
44
+ let i = N(t).split(`
45
+ `);
46
+ typeof n?.tabWidth == "number" && (i = i.map((r) => r.replaceAll(" ", " ".repeat(n.tabWidth))));
47
+ 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;
48
+ let a = i.slice(m, o).map((r, s) => {
49
+ const c = m + 1 + s, d = l[c], w = (" " + c).slice(-u), L = !l[c + 1], A = " " + w + (n.showGutter ? " |" : "");
50
+ if (d) {
51
+ let y = "";
52
+ if (Array.isArray(d)) {
53
+ const O = r.replaceAll(/[^\t]/g, " ").slice(0, Math.max(d[0] - 1, 0)), M = d[1] || 1;
54
+ y = [`
55
+ `, n.prefix + g(A.replaceAll(/\d/g, " ")), " ", O, p("^").repeat(M)].join(""), L && n.message && (y += ` ${b(n.message)}`);
56
+ }
57
+ return [n.prefix + p(B), g(A), r.length > 0 ? " " + r : "", y].join("");
58
+ }
59
+ return n.prefix + " " + g(A) + (r.length > 0 ? " " + r : "");
60
+ }).join(`
61
+ `);
62
+ return n.message && !f && (a = n.prefix + " ".repeat(u + 1) + n.message + `
63
+ ` + a), a;
64
+ }, "codeFrame");
65
+
66
+ var __defProp$1 = Object.defineProperty;
67
+ var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
68
+ var c = Object.defineProperty;
69
+ var a = /* @__PURE__ */ __name$1((n, t) => c(n, "name", { value: t, configurable: true }), "a");
70
+ var f = Object.defineProperty;
71
+ var s = a((n, t) => f(n, "name", { value: t, configurable: true }), "l");
72
+ const u = s((n, t) => {
73
+ let e = 0, i = t.length - 2;
74
+ for (; e < i; ) {
75
+ const r = e + (i - e >> 1);
76
+ if (n < t[r]) i = r - 1;
77
+ else if (n >= t[r + 1]) e = r + 1;
78
+ else {
79
+ e = r;
80
+ break;
81
+ }
82
+ }
83
+ return e;
84
+ }, "binarySearch");
85
+ const y = s((n) => n.split(/\n|\r(?!\n)/).reduce((t, e) => (t.push(t.at(-1) + e.length + 1), t), [0]), "getLineStartIndexes");
86
+ const p = s((n, t, e) => {
87
+ const i = e?.skipChecks ?? false;
88
+ if (!i && (!Array.isArray(n) && typeof n != "string" || (typeof n == "string" || Array.isArray(n)) && n.length === 0)) return { column: 0, line: 0 };
89
+ if (!i && (typeof t != "number" || typeof n == "string" && t >= n.length || Array.isArray(n) && t + 1 >= n.at(-1))) return { column: 0, line: 0 };
90
+ if (typeof n == "string") {
91
+ const l = y(n), o = u(t, l);
92
+ return { column: t - l[o] + 1, line: o + 1 };
93
+ }
94
+ const r = u(t, n);
95
+ return { column: t - n[r] + 1, line: r + 1 };
96
+ }, "indexToLineColumn");
97
+
98
+ var __defProp = Object.defineProperty;
99
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
100
+ const getCodePoint = /* @__PURE__ */ __name((character) => `\\u{${character.codePointAt(0).toString(16)}}`, "getCodePoint");
101
+ const generateCodeFrame = /* @__PURE__ */ __name((source, location, options) => I(
102
+ source,
103
+ { start: location },
104
+ {
105
+ tabWidth: false,
106
+ ...options
107
+ }
108
+ ), "generateCodeFrame");
109
+ const getErrorLocation = /* @__PURE__ */ __name((source, message) => {
110
+ const match = /in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(message);
111
+ if (!match) {
112
+ return undefined;
113
+ }
114
+ let { column, index, line } = match.groups;
115
+ if (line && column) {
116
+ return { column: Number(column), line: Number(line) };
117
+ }
118
+ index = Number(index);
119
+ if (index === source.length) {
120
+ index = source.length - 1;
121
+ }
122
+ return p(source, index);
123
+ }, "getErrorLocation");
124
+ const addCodePointToUnexpectedToken = /* @__PURE__ */ __name((message) => message.replace(
125
+ // TODO[engine:node@>=20]: The token always quoted after Node.js 20
126
+ // eslint-disable-next-line regexp/no-potentially-useless-backreference
127
+ /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,
128
+ (_, _quote, token) => `"${token}"(${getCodePoint(token)})`
129
+ ), "addCodePointToUnexpectedToken");
130
+ function parseJson(string, reviver, fileName, options) {
131
+ if (typeof reviver === "string") {
132
+ if (typeof fileName === "object") {
133
+ options = fileName;
134
+ }
135
+ fileName = reviver;
136
+ reviver = undefined;
137
+ }
138
+ let message;
139
+ try {
140
+ return JSON.parse(string, reviver);
141
+ } catch (error) {
142
+ message = error.message;
143
+ }
144
+ let location;
145
+ if (string) {
146
+ location = getErrorLocation(string, message);
147
+ message = addCodePointToUnexpectedToken(message);
148
+ } else {
149
+ message += " while parsing empty string";
150
+ }
151
+ const jsonError = new JSONError(message);
152
+ jsonError.fileName = fileName;
153
+ if (location) {
154
+ jsonError.codeFrame = generateCodeFrame(string, location, options);
155
+ }
156
+ throw jsonError;
157
+ }
158
+ __name(parseJson, "parseJson");
159
+
160
+ export { parseJson as default };