@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.
- package/CHANGELOG.md +32 -0
- package/LICENSE.md +155 -1
- package/dist/eol.d.ts +6 -35
- package/dist/error.d.ts +43 -7
- package/dist/glob-parent.d.ts +5 -0
- package/dist/glob-parent.js +90 -0
- package/dist/glob.d.ts +5 -0
- package/dist/glob.js +2 -0
- package/dist/index.d.ts +81 -36
- package/dist/index.js +12 -7
- package/dist/ini.d.ts +10 -0
- package/dist/ini.js +4 -0
- package/dist/is-glob.d.ts +5 -0
- package/dist/is-glob.js +9 -0
- package/dist/json5.d.ts +12 -0
- package/dist/json5.js +4 -0
- package/dist/jsonc.d.ts +10 -0
- package/dist/jsonc.js +4 -0
- package/dist/match.d.ts +5 -0
- package/dist/match.js +15 -0
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
- package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +12 -0
- package/dist/packem_shared/{emptyDir-Df4Tfjtk.js → emptyDir-DnwENOaV.js} +3 -1
- package/dist/packem_shared/{emptyDirSync-BD8-1Ytl.js → emptyDirSync-6WiHBo8a.js} +3 -1
- package/dist/packem_shared/glob-DY8l7izD.js +5 -0
- package/dist/packem_shared/glob-sync.d-B83kqwUd.d.ts +4 -0
- package/dist/packem_shared/globSync-5P2KJf_g.js +5 -0
- package/dist/packem_shared/index-C8W8sfzP.js +830 -0
- package/dist/packem_shared/index-bhgnhm4u.js +167 -0
- package/dist/packem_shared/index-xe4o3cYi.js +1784 -0
- package/dist/packem_shared/{parseJson-BedVi91S.js → indexToLineColumn-BUb0GPKl-BF770uX7.js} +1 -62
- package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +251 -0
- package/dist/packem_shared/{isFsCaseSensitive-D-ayleCy.js → isFsCaseSensitive-DunL7Iry.js} +6 -6
- package/dist/packem_shared/json-error.d-DgKaeuIf.d.ts +10 -0
- package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +72 -0
- package/dist/packem_shared/parseJson-BIp89Xjo.js +63 -0
- package/dist/packem_shared/readIni-CJ2xfpjB.js +10 -0
- package/dist/packem_shared/readIniSync-9LUjaSSp.js +10 -0
- package/dist/packem_shared/{readJson-D0G0ndHL.js → readJson-C_rwm-wq.js} +1 -1
- package/dist/packem_shared/readJson5-mBoTZppy.js +15 -0
- package/dist/packem_shared/readJson5Sync-8WS2yUok.js +15 -0
- package/dist/packem_shared/{readJsonSync-B7oicPaL.js → readJsonSync-BMEmCcJ6.js} +1 -1
- package/dist/packem_shared/readJsonc-j-OS-APg.js +28 -0
- package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +16 -0
- package/dist/packem_shared/readToml-B2MHaSes.js +9 -0
- package/dist/packem_shared/readTomlSync-DNbK8NEb.js +9 -0
- package/dist/packem_shared/{remove-CNkjFFkQ.js → remove-C8_gl3jF.js} +2 -1
- package/dist/packem_shared/{removeSync-AnawYpPv.js → removeSync-BJR_wTwN.js} +2 -1
- package/dist/packem_shared/types.d-dP-lAGNn.d.ts +145 -0
- package/dist/packem_shared/writeIni-i55QrL8y.js +65 -0
- package/dist/packem_shared/writeIniSync-CLqJE5t3.js +64 -0
- package/dist/packem_shared/writeJson5-vVmHUQOd.js +53 -0
- package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +53 -0
- package/dist/packem_shared/writeJsonc-BufH_oC5.js +60 -0
- package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +59 -0
- package/dist/packem_shared/writeToml-DgTW_-7F.js +8 -0
- package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +8 -0
- package/dist/size.d.ts +10 -254
- package/dist/toml.d.ts +9 -0
- package/dist/toml.js +4 -0
- package/dist/utils.d.ts +15 -6
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +14 -5
- package/package.json +57 -3
- package/dist/constants.d.ts +0 -42
- package/dist/ensure/ensure-dir-sync.d.ts +0 -14
- package/dist/ensure/ensure-dir.d.ts +0 -14
- package/dist/ensure/ensure-file-sync.d.ts +0 -15
- package/dist/ensure/ensure-file.d.ts +0 -27
- package/dist/ensure/ensure-link-sync.d.ts +0 -16
- package/dist/ensure/ensure-link.d.ts +0 -16
- package/dist/ensure/ensure-symlink-sync.d.ts +0 -23
- package/dist/ensure/ensure-symlink.d.ts +0 -23
- package/dist/ensure/utils/get-file-info-type.d.ts +0 -7
- package/dist/ensure/utils/is-stats-identical.d.ts +0 -3
- package/dist/ensure/utils/resolve-symlink-target.d.ts +0 -2
- package/dist/error/already-exists-error.d.ts +0 -39
- package/dist/error/directory-error.d.ts +0 -47
- package/dist/error/json-error.d.ts +0 -52
- package/dist/error/not-empty-error.d.ts +0 -51
- package/dist/error/not-found-error.d.ts +0 -44
- package/dist/error/permission-error.d.ts +0 -45
- package/dist/error/walk-error.d.ts +0 -51
- package/dist/find/collect-sync.d.ts +0 -31
- package/dist/find/collect.d.ts +0 -35
- package/dist/find/find-up-sync.d.ts +0 -42
- package/dist/find/find-up.d.ts +0 -46
- package/dist/find/utils/glob-to-regexp.d.ts +0 -2
- package/dist/find/utils/walk-include.d.ts +0 -2
- package/dist/find/walk-sync.d.ts +0 -34
- package/dist/find/walk.d.ts +0 -37
- package/dist/is-accessible-sync.d.ts +0 -3
- package/dist/is-accessible.d.ts +0 -29
- package/dist/move/index.d.ts +0 -68
- package/dist/move/types.d.ts +0 -36
- package/dist/move/utils/internal-move-file-sync.d.ts +0 -3
- package/dist/move/utils/internal-move-file.d.ts +0 -3
- package/dist/move/utils/validate-same-directory.d.ts +0 -2
- package/dist/read/read-file-sync.d.ts +0 -37
- package/dist/read/read-file.d.ts +0 -41
- package/dist/read/read-json-sync.d.ts +0 -5
- package/dist/read/read-json.d.ts +0 -5
- package/dist/read/read-yaml-sync.d.ts +0 -4
- package/dist/read/read-yaml.d.ts +0 -4
- package/dist/remove/empty-dir-sync.d.ts +0 -23
- package/dist/remove/empty-dir.d.ts +0 -28
- package/dist/remove/remove-sync.d.ts +0 -27
- package/dist/remove/remove.d.ts +0 -32
- package/dist/sanitize.d.ts +0 -31
- package/dist/types.d.ts +0 -304
- package/dist/utils/assert-valid-file-contents.d.ts +0 -27
- package/dist/utils/assert-valid-file-or-directory-path.d.ts +0 -26
- package/dist/utils/parse-json.d.ts +0 -5
- package/dist/utils/strip-json-comments.d.ts +0 -44
- package/dist/write/utils/to-uint-8-array.d.ts +0 -2
- package/dist/write/write-file-sync.d.ts +0 -30
- package/dist/write/write-file.d.ts +0 -30
- package/dist/write/write-json-sync.d.ts +0 -29
- package/dist/write/write-json.d.ts +0 -30
- package/dist/write/write-yaml-sync.d.ts +0 -4
- package/dist/write/write-yaml.d.ts +0 -4
package/dist/jsonc.d.ts
ADDED
|
@@ -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';
|
package/dist/match.d.ts
ADDED
|
@@ -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,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),
|
|
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),
|
|
39
|
+
rmSync(join(toPath(dir), item), rmOptions);
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
|
|
@@ -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 };
|