@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.
- package/CHANGELOG.md +177 -0
- package/LICENSE.md +157 -128
- package/dist/eol.d.ts +6 -35
- package/dist/error.d.ts +43 -7
- package/dist/error.js +1 -1
- 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 +32 -27
- 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/{WalkError-DUdQd6FT.js → WalkError-DER5A43G.js} +1 -1
- 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/{collect-DcBwsYYd.js → collect-CqQ3eVab.js} +1 -1
- package/dist/packem_shared/{collectSync-Bkjf9Dbm.js → collectSync-noE08NNv.js} +1 -1
- package/dist/packem_shared/{emptyDir-CYB5Tict.js → emptyDir-DnwENOaV.js} +5 -2
- package/dist/packem_shared/{emptyDirSync-BD8-1Ytl.js → emptyDirSync-6WiHBo8a.js} +3 -1
- package/dist/packem_shared/{ensureDir-C_kuQ5Ik.js → ensureDir-DNlPftys.js} +2 -2
- package/dist/packem_shared/{ensureDirSync-CI5g-uBI.js → ensureDirSync-DcPZFMy5.js} +2 -2
- package/dist/packem_shared/{ensureFile-BUtXGlGT.js → ensureFile-BRQpUOUM.js} +2 -2
- package/dist/packem_shared/{ensureFileSync-C8hASR-1.js → ensureFileSync-SBY7A9-C.js} +2 -2
- package/dist/packem_shared/{ensureLink-BPnAG5-P.js → ensureLink-DJQeauEn.js} +4 -3
- package/dist/packem_shared/{ensureLinkSync-B-Z7X0ub.js → ensureLinkSync-D9RVAglV.js} +4 -3
- package/dist/packem_shared/{ensureSymlink-U5B6J0BN.js → ensureSymlink-CoRYDRwr.js} +10 -3
- package/dist/packem_shared/{ensureSymlinkSync-DHnZj-9F.js → ensureSymlinkSync-CFimFlgh.js} +10 -3
- package/dist/packem_shared/{findUp-BSnyGqer.js → findUp-YcNLKdfV.js} +3 -4
- package/dist/packem_shared/{findUpSync-jRHbSCMV.js → findUpSync-BfA5fheN.js} +1 -3
- package/dist/packem_shared/glob-DY8l7izD.js +5 -0
- package/dist/packem_shared/glob-sync.d-BlGjS68e.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-C8xb-3LR.js → indexToLineColumn-BUb0GPKl-BF770uX7.js} +8 -68
- 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/{readFileSync-6GEIrOnl.js → readFileSync-gm9yfIhh.js} +2 -1
- package/dist/packem_shared/readIni-CJ2xfpjB.js +10 -0
- package/dist/packem_shared/readIniSync-9LUjaSSp.js +10 -0
- package/dist/packem_shared/{readJson-vddQ97Ll.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-DzeAdYZl.js → readJsonSync-BMEmCcJ6.js} +2 -2
- 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/{readYamlSync-DMV4U-gi.js → readYamlSync-BKX-PAfq.js} +1 -1
- package/dist/packem_shared/{remove-_oDY3uKo.js → remove-C8_gl3jF.js} +2 -1
- package/dist/packem_shared/{removeSync-DETRj7Qn.js → removeSync-BJR_wTwN.js} +2 -1
- package/dist/packem_shared/{sanitize-lOzE6k2A.js → sanitize-BZoLN9Fg.js} +3 -3
- package/dist/packem_shared/types.d-CYpAhWov.d.ts +145 -0
- package/dist/packem_shared/{walk-BhTbpr3y.js → walk-CSZgCuDx.js} +19 -10
- package/dist/packem_shared/{walkSync-DDBq95s8.js → walkSync-C4Cy28xb.js} +25 -16
- package/dist/packem_shared/{writeFile-DSHERs0Z.js → writeFile-B8HX0JIQ.js} +1 -3
- package/dist/packem_shared/{writeFileSync-CJp1kXQR.js → writeFileSync-DB8vv8xR.js} +1 -3
- package/dist/packem_shared/writeIni-i55QrL8y.js +65 -0
- package/dist/packem_shared/writeIniSync-CLqJE5t3.js +64 -0
- package/dist/packem_shared/{writeJson-C0OfLDbe.js → writeJson-Bo7C2UHw.js} +1 -1
- package/dist/packem_shared/writeJson5-vVmHUQOd.js +53 -0
- package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +53 -0
- package/dist/packem_shared/{writeJsonSync-Cs21FE7v.js → writeJsonSync-BKZ_9Acr.js} +1 -1
- 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/packem_shared/{writeYaml-n4xzYN9a.js → writeYaml-BWCOome-.js} +3 -3
- package/dist/packem_shared/{writeYamlSync-DnOEnP10.js → writeYamlSync-DBVnXmuY.js} +3 -3
- package/dist/size.d.ts +10 -254
- package/dist/size.js +6 -4
- 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/dist/yaml.js +3 -3
- package/package.json +60 -6
- 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
|
@@ -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-
|
|
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
|
-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,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 };
|