@visulima/fs 5.0.0-alpha.1 → 5.0.0-alpha.11

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 (148) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/LICENSE.md +157 -128
  3. package/dist/eol.d.ts +6 -35
  4. package/dist/error.d.ts +43 -7
  5. package/dist/error.js +1 -1
  6. package/dist/glob-parent.d.ts +5 -0
  7. package/dist/glob-parent.js +90 -0
  8. package/dist/glob.d.ts +5 -0
  9. package/dist/glob.js +2 -0
  10. package/dist/index.d.ts +81 -36
  11. package/dist/index.js +32 -27
  12. package/dist/ini.d.ts +10 -0
  13. package/dist/ini.js +4 -0
  14. package/dist/is-glob.d.ts +5 -0
  15. package/dist/is-glob.js +9 -0
  16. package/dist/json5.d.ts +12 -0
  17. package/dist/json5.js +4 -0
  18. package/dist/jsonc.d.ts +10 -0
  19. package/dist/jsonc.js +4 -0
  20. package/dist/match.d.ts +5 -0
  21. package/dist/match.js +15 -0
  22. package/dist/packem_shared/{WalkError-DUdQd6FT.js → WalkError-DER5A43G.js} +1 -1
  23. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
  24. package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +12 -0
  25. package/dist/packem_shared/{collect-DcBwsYYd.js → collect-CqQ3eVab.js} +1 -1
  26. package/dist/packem_shared/{collectSync-Bkjf9Dbm.js → collectSync-noE08NNv.js} +1 -1
  27. package/dist/packem_shared/{emptyDir-CYB5Tict.js → emptyDir-DnwENOaV.js} +5 -2
  28. package/dist/packem_shared/{emptyDirSync-BD8-1Ytl.js → emptyDirSync-6WiHBo8a.js} +3 -1
  29. package/dist/packem_shared/{ensureDir-C_kuQ5Ik.js → ensureDir-DNlPftys.js} +2 -2
  30. package/dist/packem_shared/{ensureDirSync-CI5g-uBI.js → ensureDirSync-DcPZFMy5.js} +2 -2
  31. package/dist/packem_shared/{ensureFile-BUtXGlGT.js → ensureFile-BRQpUOUM.js} +2 -2
  32. package/dist/packem_shared/{ensureFileSync-C8hASR-1.js → ensureFileSync-SBY7A9-C.js} +2 -2
  33. package/dist/packem_shared/{ensureLink-BPnAG5-P.js → ensureLink-DJQeauEn.js} +4 -3
  34. package/dist/packem_shared/{ensureLinkSync-B-Z7X0ub.js → ensureLinkSync-D9RVAglV.js} +4 -3
  35. package/dist/packem_shared/{ensureSymlink-U5B6J0BN.js → ensureSymlink-CoRYDRwr.js} +10 -3
  36. package/dist/packem_shared/{ensureSymlinkSync-DHnZj-9F.js → ensureSymlinkSync-CFimFlgh.js} +10 -3
  37. package/dist/packem_shared/{findUp-BSnyGqer.js → findUp-YcNLKdfV.js} +3 -4
  38. package/dist/packem_shared/{findUpSync-jRHbSCMV.js → findUpSync-BfA5fheN.js} +1 -3
  39. package/dist/packem_shared/glob-DY8l7izD.js +5 -0
  40. package/dist/packem_shared/glob-sync.d-BlGjS68e.d.ts +4 -0
  41. package/dist/packem_shared/globSync-5P2KJf_g.js +5 -0
  42. package/dist/packem_shared/index-C8W8sfzP.js +830 -0
  43. package/dist/packem_shared/index-bhgnhm4u.js +167 -0
  44. package/dist/packem_shared/index-xe4o3cYi.js +1784 -0
  45. package/dist/packem_shared/{parseJson-C8xb-3LR.js → indexToLineColumn-BUb0GPKl-BF770uX7.js} +8 -68
  46. package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +251 -0
  47. package/dist/packem_shared/{isFsCaseSensitive-D-ayleCy.js → isFsCaseSensitive-DunL7Iry.js} +6 -6
  48. package/dist/packem_shared/json-error.d-DgKaeuIf.d.ts +10 -0
  49. package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +72 -0
  50. package/dist/packem_shared/parseJson-BIp89Xjo.js +63 -0
  51. package/dist/packem_shared/{readFileSync-6GEIrOnl.js → readFileSync-gm9yfIhh.js} +2 -1
  52. package/dist/packem_shared/readIni-CJ2xfpjB.js +10 -0
  53. package/dist/packem_shared/readIniSync-9LUjaSSp.js +10 -0
  54. package/dist/packem_shared/{readJson-vddQ97Ll.js → readJson-C_rwm-wq.js} +1 -1
  55. package/dist/packem_shared/readJson5-mBoTZppy.js +15 -0
  56. package/dist/packem_shared/readJson5Sync-8WS2yUok.js +15 -0
  57. package/dist/packem_shared/{readJsonSync-DzeAdYZl.js → readJsonSync-BMEmCcJ6.js} +2 -2
  58. package/dist/packem_shared/readJsonc-j-OS-APg.js +28 -0
  59. package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +16 -0
  60. package/dist/packem_shared/readToml-B2MHaSes.js +9 -0
  61. package/dist/packem_shared/readTomlSync-DNbK8NEb.js +9 -0
  62. package/dist/packem_shared/{readYamlSync-DMV4U-gi.js → readYamlSync-BKX-PAfq.js} +1 -1
  63. package/dist/packem_shared/{remove-_oDY3uKo.js → remove-C8_gl3jF.js} +2 -1
  64. package/dist/packem_shared/{removeSync-DETRj7Qn.js → removeSync-BJR_wTwN.js} +2 -1
  65. package/dist/packem_shared/{sanitize-lOzE6k2A.js → sanitize-BZoLN9Fg.js} +3 -3
  66. package/dist/packem_shared/types.d-CYpAhWov.d.ts +145 -0
  67. package/dist/packem_shared/{walk-BhTbpr3y.js → walk-CSZgCuDx.js} +19 -10
  68. package/dist/packem_shared/{walkSync-DDBq95s8.js → walkSync-C4Cy28xb.js} +25 -16
  69. package/dist/packem_shared/{writeFile-DSHERs0Z.js → writeFile-B8HX0JIQ.js} +1 -3
  70. package/dist/packem_shared/{writeFileSync-CJp1kXQR.js → writeFileSync-DB8vv8xR.js} +1 -3
  71. package/dist/packem_shared/writeIni-i55QrL8y.js +65 -0
  72. package/dist/packem_shared/writeIniSync-CLqJE5t3.js +64 -0
  73. package/dist/packem_shared/{writeJson-C0OfLDbe.js → writeJson-Bo7C2UHw.js} +1 -1
  74. package/dist/packem_shared/writeJson5-vVmHUQOd.js +53 -0
  75. package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +53 -0
  76. package/dist/packem_shared/{writeJsonSync-Cs21FE7v.js → writeJsonSync-BKZ_9Acr.js} +1 -1
  77. package/dist/packem_shared/writeJsonc-BufH_oC5.js +60 -0
  78. package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +59 -0
  79. package/dist/packem_shared/writeToml-DgTW_-7F.js +8 -0
  80. package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +8 -0
  81. package/dist/packem_shared/{writeYaml-n4xzYN9a.js → writeYaml-BWCOome-.js} +3 -3
  82. package/dist/packem_shared/{writeYamlSync-DnOEnP10.js → writeYamlSync-DBVnXmuY.js} +3 -3
  83. package/dist/size.d.ts +10 -254
  84. package/dist/size.js +6 -4
  85. package/dist/toml.d.ts +9 -0
  86. package/dist/toml.js +4 -0
  87. package/dist/utils.d.ts +15 -6
  88. package/dist/utils.js +1 -1
  89. package/dist/yaml.d.ts +14 -5
  90. package/dist/yaml.js +3 -3
  91. package/package.json +60 -6
  92. package/dist/constants.d.ts +0 -42
  93. package/dist/ensure/ensure-dir-sync.d.ts +0 -14
  94. package/dist/ensure/ensure-dir.d.ts +0 -14
  95. package/dist/ensure/ensure-file-sync.d.ts +0 -15
  96. package/dist/ensure/ensure-file.d.ts +0 -27
  97. package/dist/ensure/ensure-link-sync.d.ts +0 -16
  98. package/dist/ensure/ensure-link.d.ts +0 -16
  99. package/dist/ensure/ensure-symlink-sync.d.ts +0 -23
  100. package/dist/ensure/ensure-symlink.d.ts +0 -23
  101. package/dist/ensure/utils/get-file-info-type.d.ts +0 -7
  102. package/dist/ensure/utils/is-stats-identical.d.ts +0 -3
  103. package/dist/ensure/utils/resolve-symlink-target.d.ts +0 -2
  104. package/dist/error/already-exists-error.d.ts +0 -39
  105. package/dist/error/directory-error.d.ts +0 -47
  106. package/dist/error/json-error.d.ts +0 -52
  107. package/dist/error/not-empty-error.d.ts +0 -51
  108. package/dist/error/not-found-error.d.ts +0 -44
  109. package/dist/error/permission-error.d.ts +0 -45
  110. package/dist/error/walk-error.d.ts +0 -51
  111. package/dist/find/collect-sync.d.ts +0 -31
  112. package/dist/find/collect.d.ts +0 -35
  113. package/dist/find/find-up-sync.d.ts +0 -42
  114. package/dist/find/find-up.d.ts +0 -46
  115. package/dist/find/utils/glob-to-regexp.d.ts +0 -2
  116. package/dist/find/utils/walk-include.d.ts +0 -2
  117. package/dist/find/walk-sync.d.ts +0 -34
  118. package/dist/find/walk.d.ts +0 -37
  119. package/dist/is-accessible-sync.d.ts +0 -3
  120. package/dist/is-accessible.d.ts +0 -29
  121. package/dist/move/index.d.ts +0 -68
  122. package/dist/move/types.d.ts +0 -36
  123. package/dist/move/utils/internal-move-file-sync.d.ts +0 -3
  124. package/dist/move/utils/internal-move-file.d.ts +0 -3
  125. package/dist/move/utils/validate-same-directory.d.ts +0 -2
  126. package/dist/read/read-file-sync.d.ts +0 -37
  127. package/dist/read/read-file.d.ts +0 -41
  128. package/dist/read/read-json-sync.d.ts +0 -5
  129. package/dist/read/read-json.d.ts +0 -5
  130. package/dist/read/read-yaml-sync.d.ts +0 -4
  131. package/dist/read/read-yaml.d.ts +0 -4
  132. package/dist/remove/empty-dir-sync.d.ts +0 -23
  133. package/dist/remove/empty-dir.d.ts +0 -28
  134. package/dist/remove/remove-sync.d.ts +0 -27
  135. package/dist/remove/remove.d.ts +0 -32
  136. package/dist/sanitize.d.ts +0 -31
  137. package/dist/types.d.ts +0 -304
  138. package/dist/utils/assert-valid-file-contents.d.ts +0 -27
  139. package/dist/utils/assert-valid-file-or-directory-path.d.ts +0 -26
  140. package/dist/utils/parse-json.d.ts +0 -5
  141. package/dist/utils/strip-json-comments.d.ts +0 -44
  142. package/dist/write/utils/to-uint-8-array.d.ts +0 -2
  143. package/dist/write/write-file-sync.d.ts +0 -30
  144. package/dist/write/write-file.d.ts +0 -30
  145. package/dist/write/write-json-sync.d.ts +0 -29
  146. package/dist/write/write-json.d.ts +0 -30
  147. package/dist/write/write-yaml-sync.d.ts +0 -4
  148. package/dist/write/write-yaml.d.ts +0 -4
@@ -26,7 +26,7 @@ const {
26
26
  import { toNamespacedPath, dirname, resolve } from '@visulima/path';
27
27
  import { toPath } from '@visulima/path/utils';
28
28
  import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
- import ensureDir from './ensureDir-C_kuQ5Ik.js';
29
+ import ensureDir from './ensureDir-DNlPftys.js';
30
30
  import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
31
31
  import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
32
32
  import { r as resolveSymlinkTarget } from './resolve-symlink-target-Kh4GovFf.js';
@@ -51,7 +51,14 @@ const ensureSymlink = async (target, linkName, type) => {
51
51
  const sourceStatInfo = await lstat(targetRealPath);
52
52
  const sourceFilePathType = getFileInfoType(sourceStatInfo);
53
53
  await ensureDir(dirname(linkName));
54
- const symlinkType = type ?? (isWindows ? "junction" : sourceFilePathType === "dir" ? "dir" : "file");
54
+ let symlinkType = type ?? "file";
55
+ if (!type) {
56
+ if (isWindows) {
57
+ symlinkType = "junction";
58
+ } else {
59
+ symlinkType = sourceFilePathType === "dir" ? "dir" : "file";
60
+ }
61
+ }
55
62
  try {
56
63
  await symlink(toNamespacedPath(toPath(targetRealPath)), linkName, symlinkType);
57
64
  } catch (error) {
@@ -60,7 +67,7 @@ const ensureSymlink = async (target, linkName, type) => {
60
67
  }
61
68
  const linkStatInfo = await lstat(linkName);
62
69
  if (!linkStatInfo.isSymbolicLink()) {
63
- throw new AlreadyExistsError(`A ${getFileInfoType(linkStatInfo)} already exists at the path: ${linkName}`);
70
+ throw new AlreadyExistsError(`A ${String(getFileInfoType(linkStatInfo))} already exists at the path: ${linkName}`);
64
71
  }
65
72
  const linkPath = await readlink(linkName);
66
73
  const linkRealPath = toNamespacedPath(resolve(linkPath));
@@ -26,7 +26,7 @@ const {
26
26
  import { toNamespacedPath, dirname, resolve } from '@visulima/path';
27
27
  import { toPath } from '@visulima/path/utils';
28
28
  import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
- import ensureDirSync from './ensureDirSync-CI5g-uBI.js';
29
+ import ensureDirSync from './ensureDirSync-DcPZFMy5.js';
30
30
  import { g as getFileInfoType } from './get-file-info-type-FD4-jsyg.js';
31
31
  import { i as isStatsIdentical } from './is-stats-identical-D8FxpvQU.js';
32
32
  import { r as resolveSymlinkTarget } from './resolve-symlink-target-Kh4GovFf.js';
@@ -52,7 +52,14 @@ const ensureSymlinkSync = (target, linkName, type) => {
52
52
  const sourceStatInfo = lstatSync(targetRealPath);
53
53
  const sourceFilePathType = getFileInfoType(sourceStatInfo);
54
54
  ensureDirSync(dirname(linkName));
55
- const symlinkType = type ?? (isWindows ? "junction" : sourceFilePathType === "dir" ? "dir" : "file");
55
+ let symlinkType = type ?? "file";
56
+ if (!type) {
57
+ if (isWindows) {
58
+ symlinkType = "junction";
59
+ } else {
60
+ symlinkType = sourceFilePathType === "dir" ? "dir" : "file";
61
+ }
62
+ }
56
63
  try {
57
64
  symlinkSync(toNamespacedPath(toPath(targetRealPath)), linkName, symlinkType);
58
65
  } catch (error) {
@@ -61,7 +68,7 @@ const ensureSymlinkSync = (target, linkName, type) => {
61
68
  }
62
69
  const linkStatInfo = lstatSync(linkName);
63
70
  if (!linkStatInfo.isSymbolicLink()) {
64
- throw new AlreadyExistsError(`A ${getFileInfoType(linkStatInfo)} already exists at the path: ${linkName}`);
71
+ throw new AlreadyExistsError(`A ${String(getFileInfoType(linkStatInfo))} already exists at the path: ${linkName}`);
65
72
  }
66
73
  const linkPath = readlinkSync(linkName);
67
74
  const linkRealPath = toNamespacedPath(resolve(linkPath));
@@ -51,12 +51,11 @@ const findUp = async (name, options = {}) => {
51
51
  }
52
52
  return [name];
53
53
  };
54
- if (options.allowSymlinks === void 0) {
55
- options.allowSymlinks = true;
56
- }
54
+ options.allowSymlinks ??= true;
57
55
  const statFunction = options.allowSymlinks ? stat : lstat;
58
56
  while (directory && directory !== stopAt && directory !== root) {
59
- for await (let fileName of await getMatchers(directory)) {
57
+ const matchers = await getMatchers(directory);
58
+ for (let fileName of matchers) {
60
59
  if (fileName === FIND_UP_STOP) {
61
60
  return void 0;
62
61
  }
@@ -51,9 +51,7 @@ const findUpSync = (name, options = {}) => {
51
51
  }
52
52
  return [name];
53
53
  };
54
- if (options.allowSymlinks === void 0) {
55
- options.allowSymlinks = true;
56
- }
54
+ options.allowSymlinks ??= true;
57
55
  const statFunction = options.allowSymlinks ? statSync : lstatSync;
58
56
  while (directory && directory !== stopAt && directory !== root) {
59
57
  for (let fileName of getMatchers(directory)) {
@@ -0,0 +1,5 @@
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 };
@@ -0,0 +1,4 @@
1
+ import { G as GlobOptions } from "./types.d-CYpAhWov.js";
2
+ declare const glob: (patterns: string | ReadonlyArray<string>, options?: GlobOptions) => Promise<string[]>;
3
+ declare const globSync: (patterns: string | ReadonlyArray<string>, options?: GlobOptions) => string[];
4
+ export { globSync as a, glob as g };
@@ -0,0 +1,5 @@
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 };