@visulima/fs 5.0.0-alpha.8 → 5.0.0-alpha.9

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 (121) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +155 -1
  3. package/dist/eol.d.ts +6 -35
  4. package/dist/error.d.ts +43 -7
  5. package/dist/glob-parent.d.ts +5 -0
  6. package/dist/glob-parent.js +90 -0
  7. package/dist/glob.d.ts +5 -0
  8. package/dist/glob.js +2 -0
  9. package/dist/index.d.ts +81 -36
  10. package/dist/index.js +12 -7
  11. package/dist/ini.d.ts +10 -0
  12. package/dist/ini.js +4 -0
  13. package/dist/is-glob.d.ts +5 -0
  14. package/dist/is-glob.js +9 -0
  15. package/dist/json5.d.ts +12 -0
  16. package/dist/json5.js +4 -0
  17. package/dist/jsonc.d.ts +10 -0
  18. package/dist/jsonc.js +4 -0
  19. package/dist/match.d.ts +5 -0
  20. package/dist/match.js +15 -0
  21. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
  22. package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +12 -0
  23. package/dist/packem_shared/{emptyDir-Df4Tfjtk.js → emptyDir-DnwENOaV.js} +3 -1
  24. package/dist/packem_shared/{emptyDirSync-BD8-1Ytl.js → emptyDirSync-6WiHBo8a.js} +3 -1
  25. package/dist/packem_shared/glob-DY8l7izD.js +5 -0
  26. package/dist/packem_shared/glob-sync.d-B83kqwUd.d.ts +4 -0
  27. package/dist/packem_shared/globSync-5P2KJf_g.js +5 -0
  28. package/dist/packem_shared/index-C8W8sfzP.js +830 -0
  29. package/dist/packem_shared/index-bhgnhm4u.js +167 -0
  30. package/dist/packem_shared/index-xe4o3cYi.js +1784 -0
  31. package/dist/packem_shared/{parseJson-BedVi91S.js → indexToLineColumn-BUb0GPKl-BF770uX7.js} +1 -62
  32. package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +251 -0
  33. package/dist/packem_shared/{isFsCaseSensitive-D-ayleCy.js → isFsCaseSensitive-DunL7Iry.js} +6 -6
  34. package/dist/packem_shared/json-error.d-DgKaeuIf.d.ts +10 -0
  35. package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +72 -0
  36. package/dist/packem_shared/parseJson-BIp89Xjo.js +63 -0
  37. package/dist/packem_shared/readIni-CJ2xfpjB.js +10 -0
  38. package/dist/packem_shared/readIniSync-9LUjaSSp.js +10 -0
  39. package/dist/packem_shared/{readJson-D0G0ndHL.js → readJson-C_rwm-wq.js} +1 -1
  40. package/dist/packem_shared/readJson5-mBoTZppy.js +15 -0
  41. package/dist/packem_shared/readJson5Sync-8WS2yUok.js +15 -0
  42. package/dist/packem_shared/{readJsonSync-B7oicPaL.js → readJsonSync-BMEmCcJ6.js} +1 -1
  43. package/dist/packem_shared/readJsonc-j-OS-APg.js +28 -0
  44. package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +16 -0
  45. package/dist/packem_shared/readToml-B2MHaSes.js +9 -0
  46. package/dist/packem_shared/readTomlSync-DNbK8NEb.js +9 -0
  47. package/dist/packem_shared/{remove-CNkjFFkQ.js → remove-C8_gl3jF.js} +2 -1
  48. package/dist/packem_shared/{removeSync-AnawYpPv.js → removeSync-BJR_wTwN.js} +2 -1
  49. package/dist/packem_shared/types.d-dP-lAGNn.d.ts +145 -0
  50. package/dist/packem_shared/writeIni-i55QrL8y.js +65 -0
  51. package/dist/packem_shared/writeIniSync-CLqJE5t3.js +64 -0
  52. package/dist/packem_shared/writeJson5-vVmHUQOd.js +53 -0
  53. package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +53 -0
  54. package/dist/packem_shared/writeJsonc-BufH_oC5.js +60 -0
  55. package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +59 -0
  56. package/dist/packem_shared/writeToml-DgTW_-7F.js +8 -0
  57. package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +8 -0
  58. package/dist/size.d.ts +10 -254
  59. package/dist/toml.d.ts +9 -0
  60. package/dist/toml.js +4 -0
  61. package/dist/utils.d.ts +15 -6
  62. package/dist/utils.js +1 -1
  63. package/dist/yaml.d.ts +14 -5
  64. package/package.json +57 -3
  65. package/dist/constants.d.ts +0 -42
  66. package/dist/ensure/ensure-dir-sync.d.ts +0 -14
  67. package/dist/ensure/ensure-dir.d.ts +0 -14
  68. package/dist/ensure/ensure-file-sync.d.ts +0 -15
  69. package/dist/ensure/ensure-file.d.ts +0 -27
  70. package/dist/ensure/ensure-link-sync.d.ts +0 -16
  71. package/dist/ensure/ensure-link.d.ts +0 -16
  72. package/dist/ensure/ensure-symlink-sync.d.ts +0 -23
  73. package/dist/ensure/ensure-symlink.d.ts +0 -23
  74. package/dist/ensure/utils/get-file-info-type.d.ts +0 -7
  75. package/dist/ensure/utils/is-stats-identical.d.ts +0 -3
  76. package/dist/ensure/utils/resolve-symlink-target.d.ts +0 -2
  77. package/dist/error/already-exists-error.d.ts +0 -39
  78. package/dist/error/directory-error.d.ts +0 -47
  79. package/dist/error/json-error.d.ts +0 -52
  80. package/dist/error/not-empty-error.d.ts +0 -51
  81. package/dist/error/not-found-error.d.ts +0 -44
  82. package/dist/error/permission-error.d.ts +0 -45
  83. package/dist/error/walk-error.d.ts +0 -51
  84. package/dist/find/collect-sync.d.ts +0 -31
  85. package/dist/find/collect.d.ts +0 -35
  86. package/dist/find/find-up-sync.d.ts +0 -42
  87. package/dist/find/find-up.d.ts +0 -46
  88. package/dist/find/utils/glob-to-regexp.d.ts +0 -2
  89. package/dist/find/utils/walk-include.d.ts +0 -2
  90. package/dist/find/walk-sync.d.ts +0 -34
  91. package/dist/find/walk.d.ts +0 -37
  92. package/dist/is-accessible-sync.d.ts +0 -3
  93. package/dist/is-accessible.d.ts +0 -29
  94. package/dist/move/index.d.ts +0 -68
  95. package/dist/move/types.d.ts +0 -36
  96. package/dist/move/utils/internal-move-file-sync.d.ts +0 -3
  97. package/dist/move/utils/internal-move-file.d.ts +0 -3
  98. package/dist/move/utils/validate-same-directory.d.ts +0 -2
  99. package/dist/read/read-file-sync.d.ts +0 -37
  100. package/dist/read/read-file.d.ts +0 -41
  101. package/dist/read/read-json-sync.d.ts +0 -5
  102. package/dist/read/read-json.d.ts +0 -5
  103. package/dist/read/read-yaml-sync.d.ts +0 -4
  104. package/dist/read/read-yaml.d.ts +0 -4
  105. package/dist/remove/empty-dir-sync.d.ts +0 -23
  106. package/dist/remove/empty-dir.d.ts +0 -28
  107. package/dist/remove/remove-sync.d.ts +0 -27
  108. package/dist/remove/remove.d.ts +0 -32
  109. package/dist/sanitize.d.ts +0 -31
  110. package/dist/types.d.ts +0 -304
  111. package/dist/utils/assert-valid-file-contents.d.ts +0 -27
  112. package/dist/utils/assert-valid-file-or-directory-path.d.ts +0 -26
  113. package/dist/utils/parse-json.d.ts +0 -5
  114. package/dist/utils/strip-json-comments.d.ts +0 -44
  115. package/dist/write/utils/to-uint-8-array.d.ts +0 -2
  116. package/dist/write/write-file-sync.d.ts +0 -30
  117. package/dist/write/write-file.d.ts +0 -30
  118. package/dist/write/write-json-sync.d.ts +0 -29
  119. package/dist/write/write-json.d.ts +0 -30
  120. package/dist/write/write-yaml-sync.d.ts +0 -4
  121. package/dist/write/write-yaml.d.ts +0 -4
@@ -0,0 +1,10 @@
1
+ import { C as CompressionType, f as ReadJsoncOptions, g as WriteJsoncOptions } from "./packem_shared/types.d-dP-lAGNn.js";
2
+ export { type h as JsoncFormattingOptions, type i as JsoncParseOptions } from "./packem_shared/types.d-dP-lAGNn.js";
3
+ import 'node:fs';
4
+ import 'tinyglobby';
5
+ import './options';
6
+ declare const readJsonc: (path: URL | string, options?: ReadJsoncOptions<CompressionType>) => Promise<unknown>;
7
+ declare const readJsoncSync: (path: URL | string, options?: ReadJsoncOptions<CompressionType>) => unknown;
8
+ declare const writeJsonc: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => Promise<void>;
9
+ declare const writeJsoncSync: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => void;
10
+ export { type ReadJsoncOptions, type WriteJsoncOptions, readJsonc, readJsoncSync, writeJsonc, writeJsoncSync };
package/dist/jsonc.js ADDED
@@ -0,0 +1,4 @@
1
+ export { default as readJsonc } from './packem_shared/readJsonc-j-OS-APg.js';
2
+ export { default as readJsoncSync } from './packem_shared/readJsoncSync-Aw6EMlWO.js';
3
+ export { default as writeJsonc } from './packem_shared/writeJsonc-BufH_oC5.js';
4
+ export { default as writeJsoncSync } from './packem_shared/writeJsoncSync-DB9be1YL.js';
@@ -0,0 +1,5 @@
1
+ import { PicomatchOptions } from 'picomatch';
2
+ type MatchOptions = PicomatchOptions;
3
+ declare const match: (value: string | string[], pattern: string | string[], options?: MatchOptions) => boolean;
4
+ declare const matcher: (pattern: string | string[], options?: MatchOptions) => (value: string) => boolean;
5
+ export { MatchOptions, match, matcher };
package/dist/match.js ADDED
@@ -0,0 +1,15 @@
1
+ import { p as picomatch } from './packem_shared/index-xe4o3cYi.js';
2
+
3
+ const match = (value, pattern, options) => {
4
+ const isMatch = picomatch(pattern, options);
5
+ if (Array.isArray(value)) {
6
+ return value.some((entry) => isMatch(entry));
7
+ }
8
+ return isMatch(value);
9
+ };
10
+ const matcher = (pattern, options) => {
11
+ const isMatch = picomatch(pattern, options);
12
+ return (value) => isMatch(value);
13
+ };
14
+
15
+ export { match, matcher };
@@ -0,0 +1,5 @@
1
+ function getDefaultExportFromCjs(x) {
2
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
3
+ }
4
+
5
+ export { getDefaultExportFromCjs as g };
@@ -0,0 +1,12 @@
1
+ const buildRmOptions = (options) => {
2
+ const rmOptions = { force: true, recursive: true };
3
+ if (options?.maxRetries !== void 0) {
4
+ rmOptions.maxRetries = options.maxRetries;
5
+ }
6
+ if (options?.retryDelay !== void 0) {
7
+ rmOptions.retryDelay = options.retryDelay;
8
+ }
9
+ return rmOptions;
10
+ };
11
+
12
+ export { buildRmOptions as b };
@@ -28,6 +28,7 @@ const {
28
28
  import { join } from '@visulima/path';
29
29
  import { toPath } from '@visulima/path/utils';
30
30
  import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
31
+ import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
31
32
 
32
33
  const emptyDir = async (dir, options) => {
33
34
  assertValidFileOrDirectoryPath(dir);
@@ -36,8 +37,9 @@ const emptyDir = async (dir, options) => {
36
37
  return;
37
38
  }
38
39
  const items = await readdir(dir);
40
+ const rmOptions = buildRmOptions(options);
39
41
  for (const item of items) {
40
- await rm(join(toPath(dir), item), { ...options, force: true, recursive: true });
42
+ await rm(join(toPath(dir), item), rmOptions);
41
43
  }
42
44
  };
43
45
 
@@ -26,6 +26,7 @@ const {
26
26
  import { join } from '@visulima/path';
27
27
  import { toPath } from '@visulima/path/utils';
28
28
  import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
29
+ import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
29
30
 
30
31
  const emptyDirSync = (dir, options) => {
31
32
  assertValidFileOrDirectoryPath(dir);
@@ -33,8 +34,9 @@ const emptyDirSync = (dir, options) => {
33
34
  mkdirSync(dir, { recursive: true });
34
35
  return;
35
36
  }
37
+ const rmOptions = buildRmOptions(options);
36
38
  for (const item of readdirSync(dir)) {
37
- rmSync(join(toPath(dir), item), { ...options, force: true, recursive: true });
39
+ rmSync(join(toPath(dir), item), rmOptions);
38
40
  }
39
41
  };
40
42
 
@@ -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-dP-lAGNn.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 };