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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE.md +30 -0
  3. package/dist/eol.js +3 -26
  4. package/dist/error.js +1 -7
  5. package/dist/glob-parent.js +1 -90
  6. package/dist/glob.d.ts +2 -2
  7. package/dist/glob.js +1 -2
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +1 -38
  10. package/dist/ini.d.ts +2 -2
  11. package/dist/ini.js +1 -4
  12. package/dist/is-glob.js +1 -9
  13. package/dist/json5.d.ts +2 -2
  14. package/dist/json5.js +1 -4
  15. package/dist/jsonc.d.ts +2 -2
  16. package/dist/jsonc.js +1 -4
  17. package/dist/match.d.ts +1 -1
  18. package/dist/match.js +1 -15
  19. package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +1 -0
  20. package/dist/packem_shared/DirectoryError-ddlbUV8C.js +1 -0
  21. package/dist/packem_shared/F_OK-CAwY1qU7.js +1 -0
  22. package/dist/packem_shared/JSONError-D7h6PNWc.js +4 -0
  23. package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +1 -0
  24. package/dist/packem_shared/NotFoundError-BPiW0icm.js +1 -0
  25. package/dist/packem_shared/PermissionError-B1Emi5a9.js +1 -0
  26. package/dist/packem_shared/WalkError-Olmh4908.js +1 -0
  27. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
  28. package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +1 -0
  29. package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +1 -0
  30. package/dist/packem_shared/build-rm-options-C1R4reBu.js +1 -0
  31. package/dist/packem_shared/collect-2KPTpCdX.js +1 -0
  32. package/dist/packem_shared/collectSync-BX55r_BH.js +1 -0
  33. package/dist/packem_shared/emptyDir-8utO028L.js +1 -0
  34. package/dist/packem_shared/emptyDirSync-Bk5fUX73.js +1 -0
  35. package/dist/packem_shared/ensureDir-CZ4oUFuo.js +1 -0
  36. package/dist/packem_shared/ensureDirSync-CoPWhbjM.js +1 -0
  37. package/dist/packem_shared/ensureFile-CF1cAAyh.js +1 -0
  38. package/dist/packem_shared/ensureFileSync-C3qR6naU.js +1 -0
  39. package/dist/packem_shared/ensureLink-LLLxlGHn.js +1 -0
  40. package/dist/packem_shared/ensureLinkSync-Dh_GtT8F.js +1 -0
  41. package/dist/packem_shared/ensureSymlink-D50kj2zl.js +1 -0
  42. package/dist/packem_shared/ensureSymlinkSync-BbVDPvI4.js +1 -0
  43. package/dist/packem_shared/findUp-BT07y_Me.js +1 -0
  44. package/dist/packem_shared/findUpSync-BvZiYsKJ.js +1 -0
  45. package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +1 -0
  46. package/dist/packem_shared/glob-MHJQjR39.js +1 -0
  47. package/dist/packem_shared/{glob-sync.d-Dsxhj3BW.d.ts → glob-sync.d-p6lOZXnE.d.ts} +1 -1
  48. package/dist/packem_shared/globSync-CwzlELgS.js +1 -0
  49. package/dist/packem_shared/index-CYIVJA0W.js +1 -0
  50. package/dist/packem_shared/index-DrapuBsB.js +1 -0
  51. package/dist/packem_shared/index-K-NNTkpb.js +11 -0
  52. package/dist/packem_shared/index-yGx8uzZs.js +1 -0
  53. package/dist/packem_shared/indexToLineColumn-BRSZFC6I-BKj3uzZt.js +6 -0
  54. package/dist/packem_shared/ini-preserve-CXc_xkpG.js +4 -0
  55. package/dist/packem_shared/is-stats-identical-CohsLtWy.js +1 -0
  56. package/dist/packem_shared/isAccessible-CDFxsAAo.js +1 -0
  57. package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +1 -0
  58. package/dist/packem_shared/isFsCaseSensitive-CMZVY1A2.js +1 -0
  59. package/dist/packem_shared/jsonc-merge-CQMjx3Vw.js +2 -0
  60. package/dist/packem_shared/move-LmP6P9sn.js +1 -0
  61. package/dist/packem_shared/parseJson-Xx6vHYbv.js +1 -0
  62. package/dist/packem_shared/readFile-BAVMZg5e.js +1 -0
  63. package/dist/packem_shared/readFileSync-CGmzMUF2.js +1 -0
  64. package/dist/packem_shared/readIni-Cfl6HmTS.js +1 -0
  65. package/dist/packem_shared/readIniSync-DPg4UD0P.js +1 -0
  66. package/dist/packem_shared/readJson-kPx68Wv1.js +1 -0
  67. package/dist/packem_shared/readJson5-pXTL9nUE.js +1 -0
  68. package/dist/packem_shared/readJson5Sync-BedQc292.js +1 -0
  69. package/dist/packem_shared/readJsonSync-_HXNI3Se.js +1 -0
  70. package/dist/packem_shared/readJsonc-BzvuAXbT.js +1 -0
  71. package/dist/packem_shared/readJsoncSync-CVG1_QnX.js +1 -0
  72. package/dist/packem_shared/readToml-BO5CZK2P.js +1 -0
  73. package/dist/packem_shared/readTomlSync-1fKo0R52.js +1 -0
  74. package/dist/packem_shared/readYaml-DjK_Vqj1.js +1 -0
  75. package/dist/packem_shared/readYamlSync-C3h6KA2c.js +1 -0
  76. package/dist/packem_shared/remove-DH41Ov_c.js +1 -0
  77. package/dist/packem_shared/removeSync-50OEdnHd.js +1 -0
  78. package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +1 -0
  79. package/dist/packem_shared/sanitize-CU1xmyrg.js +1 -0
  80. package/dist/packem_shared/stripJsonComments-CzNR77MF.js +1 -0
  81. package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +1 -0
  82. package/dist/packem_shared/{types.d-CixEXeyM.d.ts → types.d-BsmmADqx.d.ts} +26 -26
  83. package/dist/packem_shared/walk-D01Qmmvz.js +1 -0
  84. package/dist/packem_shared/walk-include-DCiVAwMP.js +1 -0
  85. package/dist/packem_shared/walkSync-BknSdmKD.js +1 -0
  86. package/dist/packem_shared/writeFile-DNGaDOMX.js +1 -0
  87. package/dist/packem_shared/writeFileSync-CE1i-eMA.js +1 -0
  88. package/dist/packem_shared/writeIni-DG7U4ji0.js +4 -0
  89. package/dist/packem_shared/writeIniSync-Ldt6HFLb.js +4 -0
  90. package/dist/packem_shared/writeJson-BkGlq1Kv.js +4 -0
  91. package/dist/packem_shared/writeJson5-Btud4sQh.js +4 -0
  92. package/dist/packem_shared/writeJson5Sync-Iln3i1IV.js +4 -0
  93. package/dist/packem_shared/writeJsonSync-HndmyvEK.js +4 -0
  94. package/dist/packem_shared/writeJsonc-9oiamG16.js +4 -0
  95. package/dist/packem_shared/writeJsoncSync-BHBziPiK.js +4 -0
  96. package/dist/packem_shared/writeToml-Cj57wZ8B.js +1 -0
  97. package/dist/packem_shared/writeTomlSync-B34ZZp0e.js +1 -0
  98. package/dist/packem_shared/writeYaml-BhQX2yN9.js +1 -0
  99. package/dist/packem_shared/writeYamlSync-DG01FBeC.js +1 -0
  100. package/dist/size.js +1 -146
  101. package/dist/toml.d.ts +1 -1
  102. package/dist/toml.js +1 -4
  103. package/dist/utils.d.ts +1 -1
  104. package/dist/utils.js +1 -6
  105. package/dist/yaml.d.ts +2 -2
  106. package/dist/yaml.js +1 -4
  107. package/package.json +22 -22
  108. package/dist/packem_shared/AlreadyExistsError-6Y9hjgMn.js +0 -27
  109. package/dist/packem_shared/DirectoryError-BfYPkIYP.js +0 -27
  110. package/dist/packem_shared/F_OK-MldBaGxb.js +0 -8
  111. package/dist/packem_shared/JSONError-BkHRnInH.js +0 -26
  112. package/dist/packem_shared/NotEmptyError-B21RUlVr.js +0 -27
  113. package/dist/packem_shared/NotFoundError-BIp61X6k.js +0 -27
  114. package/dist/packem_shared/PermissionError-CjoiJgip.js +0 -27
  115. package/dist/packem_shared/WalkError-DER5A43G.js +0 -24
  116. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  117. package/dist/packem_shared/assertValidFileContents-BmcLtsGd.js +0 -7
  118. package/dist/packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js +0 -7
  119. package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +0 -12
  120. package/dist/packem_shared/collect-CqQ3eVab.js +0 -14
  121. package/dist/packem_shared/collectSync-noE08NNv.js +0 -14
  122. package/dist/packem_shared/emptyDir-DnwENOaV.js +0 -46
  123. package/dist/packem_shared/emptyDirSync-6WiHBo8a.js +0 -43
  124. package/dist/packem_shared/ensureDir-DNlPftys.js +0 -53
  125. package/dist/packem_shared/ensureDirSync-DcPZFMy5.js +0 -53
  126. package/dist/packem_shared/ensureFile-BRQpUOUM.js +0 -47
  127. package/dist/packem_shared/ensureFileSync-SBY7A9-C.js +0 -47
  128. package/dist/packem_shared/ensureLink-DJQeauEn.js +0 -55
  129. package/dist/packem_shared/ensureLinkSync-D9RVAglV.js +0 -55
  130. package/dist/packem_shared/ensureSymlink-CoRYDRwr.js +0 -80
  131. package/dist/packem_shared/ensureSymlinkSync-CFimFlgh.js +0 -81
  132. package/dist/packem_shared/findUp-YcNLKdfV.js +0 -84
  133. package/dist/packem_shared/findUpSync-BfA5fheN.js +0 -83
  134. package/dist/packem_shared/get-file-info-type-FD4-jsyg.js +0 -14
  135. package/dist/packem_shared/glob-DY8l7izD.js +0 -5
  136. package/dist/packem_shared/globSync-5P2KJf_g.js +0 -5
  137. package/dist/packem_shared/index-C8W8sfzP.js +0 -830
  138. package/dist/packem_shared/index-CHM-in-V.js +0 -100
  139. package/dist/packem_shared/index-bhgnhm4u.js +0 -167
  140. package/dist/packem_shared/index-xe4o3cYi.js +0 -1784
  141. package/dist/packem_shared/indexToLineColumn-BUb0GPKl-BF770uX7.js +0 -171
  142. package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +0 -251
  143. package/dist/packem_shared/is-stats-identical-D8FxpvQU.js +0 -3
  144. package/dist/packem_shared/isAccessible-DuVrTNFV.js +0 -38
  145. package/dist/packem_shared/isAccessibleSync-DI8mM0fA.js +0 -38
  146. package/dist/packem_shared/isFsCaseSensitive-DunL7Iry.js +0 -62
  147. package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +0 -72
  148. package/dist/packem_shared/move-DbpW5_vA.js +0 -134
  149. package/dist/packem_shared/parseJson-BIp89Xjo.js +0 -63
  150. package/dist/packem_shared/readFile-Iz7kvCCk.js +0 -65
  151. package/dist/packem_shared/readFileSync-gm9yfIhh.js +0 -54
  152. package/dist/packem_shared/readIni-CJ2xfpjB.js +0 -10
  153. package/dist/packem_shared/readIniSync-9LUjaSSp.js +0 -10
  154. package/dist/packem_shared/readJson-C_rwm-wq.js +0 -22
  155. package/dist/packem_shared/readJson5-mBoTZppy.js +0 -15
  156. package/dist/packem_shared/readJson5Sync-8WS2yUok.js +0 -15
  157. package/dist/packem_shared/readJsonSync-BMEmCcJ6.js +0 -22
  158. package/dist/packem_shared/readJsonc-j-OS-APg.js +0 -28
  159. package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +0 -16
  160. package/dist/packem_shared/readToml-B2MHaSes.js +0 -9
  161. package/dist/packem_shared/readTomlSync-DNbK8NEb.js +0 -9
  162. package/dist/packem_shared/readYaml-D5q2a0e1.js +0 -10
  163. package/dist/packem_shared/readYamlSync-BKX-PAfq.js +0 -10
  164. package/dist/packem_shared/remove-C8_gl3jF.js +0 -39
  165. package/dist/packem_shared/removeSync-BJR_wTwN.js +0 -39
  166. package/dist/packem_shared/resolve-symlink-target-Kh4GovFf.js +0 -16
  167. package/dist/packem_shared/sanitize-BZoLN9Fg.js +0 -205
  168. package/dist/packem_shared/stripJsonComments-vo4k0mpF.js +0 -19
  169. package/dist/packem_shared/to-uint-8-array-Dz2nF1y1.js +0 -19
  170. package/dist/packem_shared/walk-CSZgCuDx.js +0 -124
  171. package/dist/packem_shared/walk-include-CZco7BvN.js +0 -16
  172. package/dist/packem_shared/walkSync-C4Cy28xb.js +0 -123
  173. package/dist/packem_shared/writeFile-B8HX0JIQ.js +0 -81
  174. package/dist/packem_shared/writeFileSync-DB8vv8xR.js +0 -81
  175. package/dist/packem_shared/writeIni-i55QrL8y.js +0 -65
  176. package/dist/packem_shared/writeIniSync-CLqJE5t3.js +0 -64
  177. package/dist/packem_shared/writeJson-Bo7C2UHw.js +0 -50
  178. package/dist/packem_shared/writeJson5-vVmHUQOd.js +0 -53
  179. package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +0 -53
  180. package/dist/packem_shared/writeJsonSync-BKZ_9Acr.js +0 -50
  181. package/dist/packem_shared/writeJsonc-BufH_oC5.js +0 -60
  182. package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +0 -59
  183. package/dist/packem_shared/writeToml-DgTW_-7F.js +0 -8
  184. package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +0 -8
  185. package/dist/packem_shared/writeYaml-BWCOome-.js +0 -24
  186. package/dist/packem_shared/writeYamlSync-DBVnXmuY.js +0 -24
@@ -1,53 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstat,
22
- mkdir
23
- } = __cjs_getBuiltinModule("node:fs/promises");
24
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
25
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
26
-
27
- const ensureDir = async (directory) => {
28
- assertValidFileOrDirectoryPath(directory);
29
- try {
30
- const fileInfo = await lstat(directory);
31
- if (!fileInfo.isDirectory()) {
32
- throw new Error(`Ensure path exists, expected 'dir', got '${String(getFileInfoType(fileInfo))}'`);
33
- }
34
- return;
35
- } catch (error) {
36
- if (error.code !== "ENOENT") {
37
- throw error;
38
- }
39
- }
40
- try {
41
- await mkdir(directory, { recursive: true });
42
- } catch (error) {
43
- if (error.code !== "EEXIST") {
44
- throw error;
45
- }
46
- const fileInfo = await lstat(directory);
47
- if (!fileInfo.isDirectory()) {
48
- throw new Error(`Ensure path exists, expected 'dir', got '${String(getFileInfoType(fileInfo))}'`, { cause: error });
49
- }
50
- }
51
- };
52
-
53
- export { ensureDir as default };
@@ -1,53 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstatSync,
22
- mkdirSync
23
- } = __cjs_getBuiltinModule("node:fs");
24
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
25
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
26
-
27
- const ensureDirSync = (directory) => {
28
- assertValidFileOrDirectoryPath(directory);
29
- try {
30
- const fileInfo = lstatSync(directory);
31
- if (!fileInfo.isDirectory()) {
32
- throw new Error(`Ensure path exists, expected 'dir', got '${String(getFileInfoType(fileInfo))}'`);
33
- }
34
- return;
35
- } catch (error) {
36
- if (error.code !== "ENOENT") {
37
- throw error;
38
- }
39
- }
40
- try {
41
- mkdirSync(directory, { recursive: true });
42
- } catch (error) {
43
- if (error.code !== "EEXIST") {
44
- throw error;
45
- }
46
- const fileInfo = lstatSync(directory);
47
- if (!fileInfo.isDirectory()) {
48
- throw new Error(`Ensure path exists, expected 'dir', got '${String(getFileInfoType(fileInfo))}'`, { cause: error });
49
- }
50
- }
51
- };
52
-
53
- export { ensureDirSync as default };
@@ -1,47 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstat,
22
- writeFile
23
- } = __cjs_getBuiltinModule("node:fs/promises");
24
- import { dirname } from '@visulima/path';
25
- import { toPath } from '@visulima/path/utils';
26
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
27
- import ensureDir from './ensureDir-DNlPftys.js';
28
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
29
-
30
- const ensureFile = async (filePath) => {
31
- assertValidFileOrDirectoryPath(filePath);
32
- try {
33
- const stat = await lstat(filePath);
34
- if (!stat.isFile()) {
35
- throw new Error(`Ensure path exists, expected 'file', got '${String(getFileInfoType(stat))}'`);
36
- }
37
- } catch (error) {
38
- if (error.code === "ENOENT") {
39
- await ensureDir(dirname(toPath(filePath)));
40
- await writeFile(filePath, new Uint8Array());
41
- return;
42
- }
43
- throw error;
44
- }
45
- };
46
-
47
- export { ensureFile as default };
@@ -1,47 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstatSync,
22
- writeFileSync
23
- } = __cjs_getBuiltinModule("node:fs");
24
- import { dirname } from '@visulima/path';
25
- import { toPath } from '@visulima/path/utils';
26
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
27
- import ensureDirSync from './ensureDirSync-DcPZFMy5.js';
28
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
29
-
30
- const ensureFileSync = (filePath) => {
31
- assertValidFileOrDirectoryPath(filePath);
32
- try {
33
- const stat = lstatSync(filePath);
34
- if (!stat.isFile()) {
35
- throw new Error(`Ensure path exists, expected 'file', got '${String(getFileInfoType(stat))}'`);
36
- }
37
- } catch (error) {
38
- if (error.code === "ENOENT") {
39
- ensureDirSync(dirname(toPath(filePath)));
40
- writeFileSync(filePath, new Uint8Array());
41
- return;
42
- }
43
- throw error;
44
- }
45
- };
46
-
47
- export { ensureFileSync as default };
@@ -1,55 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstat,
22
- link
23
- } = __cjs_getBuiltinModule("node:fs/promises");
24
- import { toNamespacedPath, dirname } from '@visulima/path';
25
- import { toPath } from '@visulima/path/utils';
26
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
27
- import ensureDir from './ensureDir-DNlPftys.js';
28
- import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
29
-
30
- const ensureLink = async (source, destination) => {
31
- assertValidFileOrDirectoryPath(source);
32
- assertValidFileOrDirectoryPath(destination);
33
- source = toNamespacedPath(toPath(source));
34
- destination = toNamespacedPath(toPath(destination));
35
- let destinationStat;
36
- try {
37
- destinationStat = await lstat(destination);
38
- } catch {
39
- }
40
- let sourceStat;
41
- try {
42
- sourceStat = await lstat(source);
43
- } catch (error) {
44
- const nodeError = error;
45
- nodeError.message = nodeError.message.replace("lstat", "ensureLink");
46
- throw nodeError;
47
- }
48
- if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {
49
- return;
50
- }
51
- await ensureDir(dirname(destination));
52
- await link(source, destination);
53
- };
54
-
55
- export { ensureLink as default };
@@ -1,55 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstatSync,
22
- linkSync
23
- } = __cjs_getBuiltinModule("node:fs");
24
- import { toNamespacedPath, dirname } from '@visulima/path';
25
- import { toPath } from '@visulima/path/utils';
26
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
27
- import ensureDirSync from './ensureDirSync-DcPZFMy5.js';
28
- import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
29
-
30
- const ensureLinkSync = (source, destination) => {
31
- assertValidFileOrDirectoryPath(source);
32
- assertValidFileOrDirectoryPath(destination);
33
- source = toNamespacedPath(toPath(source));
34
- destination = toNamespacedPath(toPath(destination));
35
- let destinationStat;
36
- try {
37
- destinationStat = lstatSync(destination);
38
- } catch {
39
- }
40
- let sourceStat;
41
- try {
42
- sourceStat = lstatSync(source);
43
- } catch (error) {
44
- const nodeError = error;
45
- nodeError.message = nodeError.message.replace("lstat", "ensureLink");
46
- throw nodeError;
47
- }
48
- if (destinationStat && isStatsIdentical(sourceStat, destinationStat)) {
49
- return;
50
- }
51
- ensureDirSync(dirname(destination));
52
- linkSync(source, destination);
53
- };
54
-
55
- export { ensureLinkSync as default };
@@ -1,80 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstat,
22
- stat,
23
- symlink,
24
- readlink
25
- } = __cjs_getBuiltinModule("node:fs/promises");
26
- import { toNamespacedPath, dirname, resolve } from '@visulima/path';
27
- import { toPath } from '@visulima/path/utils';
28
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
- import ensureDir from './ensureDir-DNlPftys.js';
30
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
31
- import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
32
- import { r as resolveSymlinkTarget } from './resolve-symlink-target-Kh4GovFf.js';
33
- import AlreadyExistsError from './AlreadyExistsError-6Y9hjgMn.js';
34
-
35
- const isWindows = process.platform === "win32" || /^(?:msys|cygwin)$/.test(process.env.OSTYPE);
36
- const ensureSymlink = async (target, linkName, type) => {
37
- assertValidFileOrDirectoryPath(target);
38
- assertValidFileOrDirectoryPath(linkName);
39
- const targetRealPath = resolveSymlinkTarget(target, linkName);
40
- linkName = toNamespacedPath(toPath(linkName));
41
- try {
42
- const linkStatInfo = await lstat(linkName);
43
- if (linkStatInfo.isSymbolicLink() && isStatsIdentical(await stat(targetRealPath), await stat(linkName))) {
44
- const [sourceStat, destinationStat] = await Promise.all([stat(targetRealPath), stat(linkName)]);
45
- if (isStatsIdentical(sourceStat, destinationStat)) {
46
- return;
47
- }
48
- }
49
- } catch {
50
- }
51
- const sourceStatInfo = await lstat(targetRealPath);
52
- const sourceFilePathType = getFileInfoType(sourceStatInfo);
53
- await ensureDir(dirname(linkName));
54
- let symlinkType = type ?? "file";
55
- if (!type) {
56
- if (isWindows) {
57
- symlinkType = "junction";
58
- } else {
59
- symlinkType = sourceFilePathType === "dir" ? "dir" : "file";
60
- }
61
- }
62
- try {
63
- await symlink(toNamespacedPath(toPath(targetRealPath)), linkName, symlinkType);
64
- } catch (error) {
65
- if (error.code !== "EEXIST") {
66
- throw error;
67
- }
68
- const linkStatInfo = await lstat(linkName);
69
- if (!linkStatInfo.isSymbolicLink()) {
70
- throw new AlreadyExistsError(`A ${String(getFileInfoType(linkStatInfo))} already exists at the path: ${linkName}`);
71
- }
72
- const linkPath = await readlink(linkName);
73
- const linkRealPath = toNamespacedPath(resolve(linkPath));
74
- if (linkRealPath !== targetRealPath) {
75
- throw new AlreadyExistsError(`A symlink targeting to an undesired path already exists: ${linkName} -> ${linkRealPath}`);
76
- }
77
- }
78
- };
79
-
80
- export { ensureSymlink as default };
@@ -1,81 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- lstatSync,
22
- statSync,
23
- symlinkSync,
24
- readlinkSync
25
- } = __cjs_getBuiltinModule("node:fs");
26
- import { toNamespacedPath, dirname, resolve } from '@visulima/path';
27
- import { toPath } from '@visulima/path/utils';
28
- import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
- import ensureDirSync from './ensureDirSync-DcPZFMy5.js';
30
- import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
31
- import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
32
- import { r as resolveSymlinkTarget } from './resolve-symlink-target-Kh4GovFf.js';
33
- import AlreadyExistsError from './AlreadyExistsError-6Y9hjgMn.js';
34
-
35
- const isWindows = process.platform === "win32" || /^(?:msys|cygwin)$/.test(process.env.OSTYPE);
36
- const ensureSymlinkSync = (target, linkName, type) => {
37
- assertValidFileOrDirectoryPath(target);
38
- assertValidFileOrDirectoryPath(linkName);
39
- const targetRealPath = resolveSymlinkTarget(target, linkName);
40
- linkName = toNamespacedPath(toPath(linkName));
41
- try {
42
- const linkStatInfo = lstatSync(linkName);
43
- if (linkStatInfo.isSymbolicLink() && isStatsIdentical(statSync(targetRealPath), statSync(linkName))) {
44
- const sourceStat = statSync(targetRealPath);
45
- const destinationStat = statSync(linkName);
46
- if (isStatsIdentical(sourceStat, destinationStat)) {
47
- return;
48
- }
49
- }
50
- } catch {
51
- }
52
- const sourceStatInfo = lstatSync(targetRealPath);
53
- const sourceFilePathType = getFileInfoType(sourceStatInfo);
54
- ensureDirSync(dirname(linkName));
55
- let symlinkType = type ?? "file";
56
- if (!type) {
57
- if (isWindows) {
58
- symlinkType = "junction";
59
- } else {
60
- symlinkType = sourceFilePathType === "dir" ? "dir" : "file";
61
- }
62
- }
63
- try {
64
- symlinkSync(toNamespacedPath(toPath(targetRealPath)), linkName, symlinkType);
65
- } catch (error) {
66
- if (error.code !== "EEXIST") {
67
- throw error;
68
- }
69
- const linkStatInfo = lstatSync(linkName);
70
- if (!linkStatInfo.isSymbolicLink()) {
71
- throw new AlreadyExistsError(`A ${String(getFileInfoType(linkStatInfo))} already exists at the path: ${linkName}`);
72
- }
73
- const linkPath = readlinkSync(linkName);
74
- const linkRealPath = toNamespacedPath(resolve(linkPath));
75
- if (linkRealPath !== targetRealPath) {
76
- throw new AlreadyExistsError(`A symlink targeting to an undesired path already exists: ${linkName} -> ${linkRealPath}`);
77
- }
78
- }
79
- };
80
-
81
- export { ensureSymlinkSync as default };
@@ -1,84 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- stat,
22
- lstat
23
- } = __cjs_getBuiltinModule("node:fs/promises");
24
- const {
25
- fileURLToPath
26
- } = __cjs_getBuiltinModule("node:url");
27
- import { resolve, parse, isAbsolute, dirname } from '@visulima/path';
28
- import { toPath } from '@visulima/path/utils';
29
- import { FIND_UP_STOP } from './F_OK-MldBaGxb.js';
30
-
31
- const findUp = async (name, options = {}) => {
32
- if (typeof name !== "string" && !Array.isArray(name) && typeof name !== "function") {
33
- throw new TypeError("The `name` argument must be of type `string` or `string[]`");
34
- }
35
- const cwd = options.cwd ? toPath(options.cwd) : process.cwd();
36
- let directory = resolve(cwd);
37
- const { root } = parse(directory);
38
- const stopPath = toPath(options.stopAt ?? root);
39
- const stopAt = resolve(directory, stopPath);
40
- const type = options.type ?? "file";
41
- const getMatchers = async function(currentDirectory) {
42
- if (typeof name === "function") {
43
- const match = await name(currentDirectory);
44
- return [match];
45
- }
46
- if (typeof name === "string") {
47
- return [name];
48
- }
49
- if (Array.isArray(name)) {
50
- return name;
51
- }
52
- return [name];
53
- };
54
- options.allowSymlinks ??= true;
55
- const statFunction = options.allowSymlinks ? stat : lstat;
56
- while (directory && directory !== stopAt && directory !== root) {
57
- const matchers = await getMatchers(directory);
58
- for (let fileName of matchers) {
59
- if (fileName === FIND_UP_STOP) {
60
- return void 0;
61
- }
62
- if (fileName === void 0) {
63
- continue;
64
- }
65
- if (Buffer.isBuffer(fileName)) {
66
- fileName = fileName.toString();
67
- } else if (fileName instanceof URL) {
68
- fileName = fileURLToPath(fileName);
69
- }
70
- const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);
71
- try {
72
- const stats = await statFunction(filePath);
73
- if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
74
- return filePath;
75
- }
76
- } catch {
77
- }
78
- }
79
- directory = dirname(directory);
80
- }
81
- return void 0;
82
- };
83
-
84
- export { findUp as default };
@@ -1,83 +0,0 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
2
-
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
4
-
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
-
7
- const __cjs_getBuiltinModule = (module) => {
8
- // Check if we're in Node.js and version supports getBuiltinModule
9
- if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
- const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
- // Node.js 20.16.0+ and 22.3.0+
12
- if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
- return __cjs_getProcess.getBuiltinModule(module);
14
- }
15
- }
16
- // Fallback to createRequire
17
- return __cjs_require(module);
18
- };
19
-
20
- const {
21
- statSync,
22
- lstatSync
23
- } = __cjs_getBuiltinModule("node:fs");
24
- const {
25
- fileURLToPath
26
- } = __cjs_getBuiltinModule("node:url");
27
- import { resolve, parse, isAbsolute, dirname } from '@visulima/path';
28
- import { toPath } from '@visulima/path/utils';
29
- import { FIND_UP_STOP } from './F_OK-MldBaGxb.js';
30
-
31
- const findUpSync = (name, options = {}) => {
32
- if (typeof name !== "string" && !Array.isArray(name) && typeof name !== "function") {
33
- throw new TypeError("The `name` argument must be of type `string` or `string[]`");
34
- }
35
- const cwd = options.cwd ? toPath(options.cwd) : process.cwd();
36
- let directory = resolve(cwd);
37
- const { root } = parse(directory);
38
- const stopPath = toPath(options.stopAt ?? root);
39
- const stopAt = resolve(directory, stopPath);
40
- const type = options.type ?? "file";
41
- const getMatchers = function(currentDirectory) {
42
- if (typeof name === "function") {
43
- const match = name(currentDirectory);
44
- return [match];
45
- }
46
- if (typeof name === "string") {
47
- return [name];
48
- }
49
- if (Array.isArray(name)) {
50
- return name;
51
- }
52
- return [name];
53
- };
54
- options.allowSymlinks ??= true;
55
- const statFunction = options.allowSymlinks ? statSync : lstatSync;
56
- while (directory && directory !== stopAt && directory !== root) {
57
- for (let fileName of getMatchers(directory)) {
58
- if (fileName === FIND_UP_STOP) {
59
- return void 0;
60
- }
61
- if (fileName === void 0) {
62
- continue;
63
- }
64
- if (Buffer.isBuffer(fileName)) {
65
- fileName = fileName.toString();
66
- } else if (fileName instanceof URL) {
67
- fileName = fileURLToPath(fileName);
68
- }
69
- const filePath = isAbsolute(fileName) ? fileName : resolve(directory, fileName);
70
- try {
71
- const stats = statFunction(filePath);
72
- if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
73
- return filePath;
74
- }
75
- } catch {
76
- }
77
- }
78
- directory = dirname(directory);
79
- }
80
- return void 0;
81
- };
82
-
83
- export { findUpSync as default };
@@ -1,14 +0,0 @@
1
- const getFileInfoType = (fileInfo) => {
2
- if (fileInfo.isFile()) {
3
- return "file";
4
- }
5
- if (fileInfo.isDirectory()) {
6
- return "dir";
7
- }
8
- if (fileInfo.isSymbolicLink()) {
9
- return "symlink";
10
- }
11
- return void 0;
12
- };
13
-
14
- export { getFileInfoType as g };
@@ -1,5 +0,0 @@
1
- import { g as glob$1 } from './index-C8W8sfzP.js';
2
-
3
- const glob = async (patterns, options) => await glob$1(patterns, options);
4
-
5
- export { glob as default };
@@ -1,5 +0,0 @@
1
- import { a as globSync$1 } from './index-C8W8sfzP.js';
2
-
3
- const globSync = (patterns, options) => globSync$1(patterns, options);
4
-
5
- export { globSync as default };