@visulima/fs 5.0.0-alpha.13 → 5.0.0-alpha.15
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 +23 -0
- package/LICENSE.md +30 -0
- package/dist/eol.js +3 -26
- package/dist/error.js +1 -7
- package/dist/glob-parent.js +1 -90
- package/dist/glob.d.ts +2 -2
- package/dist/glob.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -38
- package/dist/ini.d.ts +2 -2
- package/dist/ini.js +1 -4
- package/dist/is-glob.js +1 -9
- package/dist/json5.d.ts +2 -2
- package/dist/json5.js +1 -4
- package/dist/jsonc.d.ts +2 -2
- package/dist/jsonc.js +1 -4
- package/dist/match.d.ts +1 -1
- package/dist/match.js +1 -15
- package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +1 -0
- package/dist/packem_shared/DirectoryError-ddlbUV8C.js +1 -0
- package/dist/packem_shared/F_OK-CAwY1qU7.js +1 -0
- package/dist/packem_shared/JSONError-D7h6PNWc.js +4 -0
- package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +1 -0
- package/dist/packem_shared/NotFoundError-BPiW0icm.js +1 -0
- package/dist/packem_shared/PermissionError-B1Emi5a9.js +1 -0
- package/dist/packem_shared/WalkError-Olmh4908.js +1 -0
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +1 -0
- package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +1 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +1 -0
- package/dist/packem_shared/build-rm-options-C1R4reBu.js +1 -0
- package/dist/packem_shared/collect-2KPTpCdX.js +1 -0
- package/dist/packem_shared/collectSync-BX55r_BH.js +1 -0
- package/dist/packem_shared/emptyDir-8utO028L.js +1 -0
- package/dist/packem_shared/emptyDirSync-Bk5fUX73.js +1 -0
- package/dist/packem_shared/ensureDir-CZ4oUFuo.js +1 -0
- package/dist/packem_shared/ensureDirSync-CoPWhbjM.js +1 -0
- package/dist/packem_shared/ensureFile-CF1cAAyh.js +1 -0
- package/dist/packem_shared/ensureFileSync-C3qR6naU.js +1 -0
- package/dist/packem_shared/ensureLink-LLLxlGHn.js +1 -0
- package/dist/packem_shared/ensureLinkSync-Dh_GtT8F.js +1 -0
- package/dist/packem_shared/ensureSymlink-D50kj2zl.js +1 -0
- package/dist/packem_shared/ensureSymlinkSync-BbVDPvI4.js +1 -0
- package/dist/packem_shared/findUp-BT07y_Me.js +1 -0
- package/dist/packem_shared/findUpSync-BvZiYsKJ.js +1 -0
- package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +1 -0
- package/dist/packem_shared/glob-MHJQjR39.js +1 -0
- package/dist/packem_shared/{glob-sync.d-Dsxhj3BW.d.ts → glob-sync.d-D2sDeSpa.d.ts} +1 -1
- package/dist/packem_shared/globSync-CwzlELgS.js +1 -0
- package/dist/packem_shared/index-CYIVJA0W.js +1 -0
- package/dist/packem_shared/index-DrapuBsB.js +1 -0
- package/dist/packem_shared/index-K-NNTkpb.js +11 -0
- package/dist/packem_shared/index-yGx8uzZs.js +1 -0
- package/dist/packem_shared/indexToLineColumn-BRSZFC6I-BKj3uzZt.js +6 -0
- package/dist/packem_shared/ini-preserve-CXc_xkpG.js +4 -0
- package/dist/packem_shared/is-stats-identical-CohsLtWy.js +1 -0
- package/dist/packem_shared/isAccessible-CDFxsAAo.js +1 -0
- package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +1 -0
- package/dist/packem_shared/isFsCaseSensitive-CMZVY1A2.js +1 -0
- package/dist/packem_shared/jsonc-merge-CQMjx3Vw.js +2 -0
- package/dist/packem_shared/move-LmP6P9sn.js +1 -0
- package/dist/packem_shared/parseJson-Xx6vHYbv.js +1 -0
- package/dist/packem_shared/readFile-BAVMZg5e.js +1 -0
- package/dist/packem_shared/readFileSync-CGmzMUF2.js +1 -0
- package/dist/packem_shared/readIni-Cfl6HmTS.js +1 -0
- package/dist/packem_shared/readIniSync-DPg4UD0P.js +1 -0
- package/dist/packem_shared/readJson-kPx68Wv1.js +1 -0
- package/dist/packem_shared/readJson5-pXTL9nUE.js +1 -0
- package/dist/packem_shared/readJson5Sync-BedQc292.js +1 -0
- package/dist/packem_shared/readJsonSync-_HXNI3Se.js +1 -0
- package/dist/packem_shared/readJsonc-BzvuAXbT.js +1 -0
- package/dist/packem_shared/readJsoncSync-CVG1_QnX.js +1 -0
- package/dist/packem_shared/readToml-BO5CZK2P.js +1 -0
- package/dist/packem_shared/readTomlSync-1fKo0R52.js +1 -0
- package/dist/packem_shared/readYaml-DjK_Vqj1.js +1 -0
- package/dist/packem_shared/readYamlSync-C3h6KA2c.js +1 -0
- package/dist/packem_shared/remove-DH41Ov_c.js +1 -0
- package/dist/packem_shared/removeSync-50OEdnHd.js +1 -0
- package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +1 -0
- package/dist/packem_shared/sanitize-CU1xmyrg.js +1 -0
- package/dist/packem_shared/stripJsonComments-CzNR77MF.js +1 -0
- package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +1 -0
- package/dist/packem_shared/{types.d-CixEXeyM.d.ts → types.d-DjZtAjkJ.d.ts} +26 -26
- package/dist/packem_shared/walk-D01Qmmvz.js +1 -0
- package/dist/packem_shared/walk-include-DCiVAwMP.js +1 -0
- package/dist/packem_shared/walkSync-BknSdmKD.js +1 -0
- package/dist/packem_shared/writeFile-DNGaDOMX.js +1 -0
- package/dist/packem_shared/writeFileSync-CE1i-eMA.js +1 -0
- package/dist/packem_shared/writeIni-DG7U4ji0.js +4 -0
- package/dist/packem_shared/writeIniSync-Ldt6HFLb.js +4 -0
- package/dist/packem_shared/writeJson-BkGlq1Kv.js +4 -0
- package/dist/packem_shared/writeJson5-Btud4sQh.js +4 -0
- package/dist/packem_shared/writeJson5Sync-Iln3i1IV.js +4 -0
- package/dist/packem_shared/writeJsonSync-HndmyvEK.js +4 -0
- package/dist/packem_shared/writeJsonc-9oiamG16.js +4 -0
- package/dist/packem_shared/writeJsoncSync-BHBziPiK.js +4 -0
- package/dist/packem_shared/writeToml-Cj57wZ8B.js +1 -0
- package/dist/packem_shared/writeTomlSync-B34ZZp0e.js +1 -0
- package/dist/packem_shared/writeYaml-BhQX2yN9.js +1 -0
- package/dist/packem_shared/writeYamlSync-DG01FBeC.js +1 -0
- package/dist/size.js +1 -146
- package/dist/toml.d.ts +1 -1
- package/dist/toml.js +1 -4
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -6
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +1 -4
- package/package.json +22 -22
- package/dist/packem_shared/AlreadyExistsError-6Y9hjgMn.js +0 -27
- package/dist/packem_shared/DirectoryError-BfYPkIYP.js +0 -27
- package/dist/packem_shared/F_OK-MldBaGxb.js +0 -8
- package/dist/packem_shared/JSONError-BkHRnInH.js +0 -26
- package/dist/packem_shared/NotEmptyError-B21RUlVr.js +0 -27
- package/dist/packem_shared/NotFoundError-BIp61X6k.js +0 -27
- package/dist/packem_shared/PermissionError-CjoiJgip.js +0 -27
- package/dist/packem_shared/WalkError-DER5A43G.js +0 -24
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
- package/dist/packem_shared/assertValidFileContents-BmcLtsGd.js +0 -7
- package/dist/packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js +0 -7
- package/dist/packem_shared/build-rm-options-Cl3VDY4O.js +0 -12
- package/dist/packem_shared/collect-CqQ3eVab.js +0 -14
- package/dist/packem_shared/collectSync-noE08NNv.js +0 -14
- package/dist/packem_shared/emptyDir-DnwENOaV.js +0 -46
- package/dist/packem_shared/emptyDirSync-6WiHBo8a.js +0 -43
- package/dist/packem_shared/ensureDir-DNlPftys.js +0 -53
- package/dist/packem_shared/ensureDirSync-DcPZFMy5.js +0 -53
- package/dist/packem_shared/ensureFile-BRQpUOUM.js +0 -47
- package/dist/packem_shared/ensureFileSync-SBY7A9-C.js +0 -47
- package/dist/packem_shared/ensureLink-DJQeauEn.js +0 -55
- package/dist/packem_shared/ensureLinkSync-D9RVAglV.js +0 -55
- package/dist/packem_shared/ensureSymlink-CoRYDRwr.js +0 -80
- package/dist/packem_shared/ensureSymlinkSync-CFimFlgh.js +0 -81
- package/dist/packem_shared/findUp-YcNLKdfV.js +0 -84
- package/dist/packem_shared/findUpSync-BfA5fheN.js +0 -83
- package/dist/packem_shared/get-file-info-type-FD4-jsyg.js +0 -14
- package/dist/packem_shared/glob-DY8l7izD.js +0 -5
- package/dist/packem_shared/globSync-5P2KJf_g.js +0 -5
- package/dist/packem_shared/index-C8W8sfzP.js +0 -830
- package/dist/packem_shared/index-CHM-in-V.js +0 -100
- package/dist/packem_shared/index-bhgnhm4u.js +0 -167
- package/dist/packem_shared/index-xe4o3cYi.js +0 -1784
- package/dist/packem_shared/indexToLineColumn-BUb0GPKl-BF770uX7.js +0 -171
- package/dist/packem_shared/ini-preserve-Dq_Q_Jgb.js +0 -251
- package/dist/packem_shared/is-stats-identical-D8FxpvQU.js +0 -3
- package/dist/packem_shared/isAccessible-DuVrTNFV.js +0 -38
- package/dist/packem_shared/isAccessibleSync-DI8mM0fA.js +0 -38
- package/dist/packem_shared/isFsCaseSensitive-DunL7Iry.js +0 -62
- package/dist/packem_shared/jsonc-merge-C6jWcfWh.js +0 -72
- package/dist/packem_shared/move-DbpW5_vA.js +0 -134
- package/dist/packem_shared/parseJson-BIp89Xjo.js +0 -63
- package/dist/packem_shared/readFile-Iz7kvCCk.js +0 -65
- package/dist/packem_shared/readFileSync-gm9yfIhh.js +0 -54
- package/dist/packem_shared/readIni-CJ2xfpjB.js +0 -10
- package/dist/packem_shared/readIniSync-9LUjaSSp.js +0 -10
- package/dist/packem_shared/readJson-C_rwm-wq.js +0 -22
- package/dist/packem_shared/readJson5-mBoTZppy.js +0 -15
- package/dist/packem_shared/readJson5Sync-8WS2yUok.js +0 -15
- package/dist/packem_shared/readJsonSync-BMEmCcJ6.js +0 -22
- package/dist/packem_shared/readJsonc-j-OS-APg.js +0 -28
- package/dist/packem_shared/readJsoncSync-Aw6EMlWO.js +0 -16
- package/dist/packem_shared/readToml-B2MHaSes.js +0 -9
- package/dist/packem_shared/readTomlSync-DNbK8NEb.js +0 -9
- package/dist/packem_shared/readYaml-D5q2a0e1.js +0 -10
- package/dist/packem_shared/readYamlSync-BKX-PAfq.js +0 -10
- package/dist/packem_shared/remove-C8_gl3jF.js +0 -39
- package/dist/packem_shared/removeSync-BJR_wTwN.js +0 -39
- package/dist/packem_shared/resolve-symlink-target-Kh4GovFf.js +0 -16
- package/dist/packem_shared/sanitize-BZoLN9Fg.js +0 -205
- package/dist/packem_shared/stripJsonComments-vo4k0mpF.js +0 -19
- package/dist/packem_shared/to-uint-8-array-Dz2nF1y1.js +0 -19
- package/dist/packem_shared/walk-CSZgCuDx.js +0 -124
- package/dist/packem_shared/walk-include-CZco7BvN.js +0 -16
- package/dist/packem_shared/walkSync-C4Cy28xb.js +0 -123
- package/dist/packem_shared/writeFile-B8HX0JIQ.js +0 -81
- package/dist/packem_shared/writeFileSync-DB8vv8xR.js +0 -81
- package/dist/packem_shared/writeIni-i55QrL8y.js +0 -65
- package/dist/packem_shared/writeIniSync-CLqJE5t3.js +0 -64
- package/dist/packem_shared/writeJson-Bo7C2UHw.js +0 -50
- package/dist/packem_shared/writeJson5-vVmHUQOd.js +0 -53
- package/dist/packem_shared/writeJson5Sync-oJ546h5k.js +0 -53
- package/dist/packem_shared/writeJsonSync-BKZ_9Acr.js +0 -50
- package/dist/packem_shared/writeJsonc-BufH_oC5.js +0 -60
- package/dist/packem_shared/writeJsoncSync-DB9be1YL.js +0 -59
- package/dist/packem_shared/writeToml-DgTW_-7F.js +0 -8
- package/dist/packem_shared/writeTomlSync-DiBiE9ja.js +0 -8
- package/dist/packem_shared/writeYaml-BWCOome-.js +0 -24
- package/dist/packem_shared/writeYamlSync-DBVnXmuY.js +0 -24
|
@@ -1,134 +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
|
-
cwd
|
|
22
|
-
} = __cjs_getProcess;
|
|
23
|
-
import { toPath } from '@visulima/path/utils';
|
|
24
|
-
const {
|
|
25
|
-
mkdir,
|
|
26
|
-
rename: rename$1,
|
|
27
|
-
copyFile,
|
|
28
|
-
unlink
|
|
29
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
30
|
-
import { dirname, resolve } from '@visulima/path';
|
|
31
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
32
|
-
const {
|
|
33
|
-
mkdirSync,
|
|
34
|
-
renameSync: renameSync$1,
|
|
35
|
-
copyFileSync,
|
|
36
|
-
unlinkSync
|
|
37
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
38
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
39
|
-
|
|
40
|
-
class SameDirectoryError extends Error {
|
|
41
|
-
constructor(source, destination) {
|
|
42
|
-
super(`Source directory "${dirname(source)}" does not match destination directory "${dirname(destination)}"`);
|
|
43
|
-
this.name = "SameDirectoryError";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const validateSameDirectory = (source, destination) => {
|
|
47
|
-
if (!source || !destination) {
|
|
48
|
-
throw new Error("Source and destination paths must not be empty");
|
|
49
|
-
}
|
|
50
|
-
if (dirname(source) !== dirname(destination)) {
|
|
51
|
-
throw new SameDirectoryError(source, destination);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const internalMoveFile = async (sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
|
|
56
|
-
if (cwd) {
|
|
57
|
-
sourcePath = resolve(cwd, sourcePath);
|
|
58
|
-
destinationPath = resolve(cwd, destinationPath);
|
|
59
|
-
}
|
|
60
|
-
if (validateDirectory) {
|
|
61
|
-
validateSameDirectory(sourcePath, destinationPath);
|
|
62
|
-
}
|
|
63
|
-
if (!overwrite && await isAccessible(destinationPath)) {
|
|
64
|
-
throw new Error(`The destination file exists: ${destinationPath}`);
|
|
65
|
-
}
|
|
66
|
-
await mkdir(dirname(destinationPath), {
|
|
67
|
-
mode: directoryMode,
|
|
68
|
-
recursive: true
|
|
69
|
-
});
|
|
70
|
-
try {
|
|
71
|
-
await rename$1(sourcePath, destinationPath);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
if (error.code === "EXDEV") {
|
|
74
|
-
await copyFile(sourcePath, destinationPath);
|
|
75
|
-
await unlink(sourcePath);
|
|
76
|
-
} else {
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const internalMoveFileSync = (sourcePath, destinationPath, { cwd, directoryMode, overwrite, validateDirectory }) => {
|
|
83
|
-
if (cwd) {
|
|
84
|
-
sourcePath = resolve(cwd, sourcePath);
|
|
85
|
-
destinationPath = resolve(cwd, destinationPath);
|
|
86
|
-
}
|
|
87
|
-
if (validateDirectory) {
|
|
88
|
-
validateSameDirectory(sourcePath, destinationPath);
|
|
89
|
-
}
|
|
90
|
-
if (!overwrite && isAccessibleSync(destinationPath)) {
|
|
91
|
-
throw new Error(`The destination file exists: ${destinationPath}`);
|
|
92
|
-
}
|
|
93
|
-
mkdirSync(dirname(destinationPath), {
|
|
94
|
-
mode: directoryMode,
|
|
95
|
-
recursive: true
|
|
96
|
-
});
|
|
97
|
-
try {
|
|
98
|
-
renameSync$1(sourcePath, destinationPath);
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if (error.code === "EXDEV") {
|
|
101
|
-
copyFileSync(sourcePath, destinationPath);
|
|
102
|
-
unlinkSync(sourcePath);
|
|
103
|
-
} else {
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const move = async (sourcePath, destinationPath, options = {}) => {
|
|
110
|
-
const internalOptions = {
|
|
111
|
-
overwrite: true,
|
|
112
|
-
validateDirectory: false,
|
|
113
|
-
...options,
|
|
114
|
-
cwd: options.cwd ? toPath(options.cwd) : cwd()
|
|
115
|
-
};
|
|
116
|
-
await internalMoveFile(sourcePath, destinationPath, internalOptions);
|
|
117
|
-
};
|
|
118
|
-
const moveSync = (sourcePath, destinationPath, options) => {
|
|
119
|
-
const internalOptions = { overwrite: true, validateDirectory: false, ...options };
|
|
120
|
-
internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
|
|
121
|
-
internalMoveFileSync(sourcePath, destinationPath, internalOptions);
|
|
122
|
-
};
|
|
123
|
-
const rename = async (source, destination, options) => {
|
|
124
|
-
const internalOptions = { overwrite: true, ...options, validateDirectory: true };
|
|
125
|
-
internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
|
|
126
|
-
await internalMoveFile(source, destination, internalOptions);
|
|
127
|
-
};
|
|
128
|
-
const renameSync = (source, destination, options) => {
|
|
129
|
-
const internalOptions = { overwrite: true, ...options, validateDirectory: true };
|
|
130
|
-
internalOptions.cwd = internalOptions.cwd ? toPath(internalOptions.cwd) : cwd();
|
|
131
|
-
internalMoveFileSync(source, destination, internalOptions);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export { move, moveSync, rename, renameSync };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import JSONError from './JSONError-BkHRnInH.js';
|
|
2
|
-
import { i as indexToLineColumn, c as codeFrame } from './indexToLineColumn-BUb0GPKl-BF770uX7.js';
|
|
3
|
-
|
|
4
|
-
const getCodePoint = (character) => String.raw`\u{${character.codePointAt(0).toString(16)}}`;
|
|
5
|
-
const generateCodeFrame = (source, location, options) => codeFrame(
|
|
6
|
-
source,
|
|
7
|
-
{ start: location },
|
|
8
|
-
{
|
|
9
|
-
tabWidth: false,
|
|
10
|
-
...options
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
const JSON_POSITION_REGEX = /in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/;
|
|
14
|
-
const getErrorLocation = (source, message) => {
|
|
15
|
-
const match = JSON_POSITION_REGEX.exec(message);
|
|
16
|
-
if (!match) {
|
|
17
|
-
return void 0;
|
|
18
|
-
}
|
|
19
|
-
const [, indexString, lineString, columnString] = match;
|
|
20
|
-
if (lineString && columnString) {
|
|
21
|
-
return { column: Number(columnString), line: Number(lineString) };
|
|
22
|
-
}
|
|
23
|
-
let index = Number(indexString);
|
|
24
|
-
if (index === source.length) {
|
|
25
|
-
index = source.length - 1;
|
|
26
|
-
}
|
|
27
|
-
return indexToLineColumn(source, index);
|
|
28
|
-
};
|
|
29
|
-
const UNEXPECTED_TOKEN_REGEX = /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/;
|
|
30
|
-
const addCodePointToUnexpectedToken = (message) => message.replace(
|
|
31
|
-
UNEXPECTED_TOKEN_REGEX,
|
|
32
|
-
(_, _quote, token) => `"${token}"(${getCodePoint(token)})`
|
|
33
|
-
);
|
|
34
|
-
function parseJson(string, reviver, fileName, options) {
|
|
35
|
-
if (typeof reviver === "string") {
|
|
36
|
-
if (typeof fileName === "object") {
|
|
37
|
-
options = fileName;
|
|
38
|
-
}
|
|
39
|
-
fileName = reviver;
|
|
40
|
-
reviver = void 0;
|
|
41
|
-
}
|
|
42
|
-
let message;
|
|
43
|
-
try {
|
|
44
|
-
return JSON.parse(string, reviver);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
message = error.message;
|
|
47
|
-
}
|
|
48
|
-
let location;
|
|
49
|
-
if (string) {
|
|
50
|
-
location = getErrorLocation(string, message);
|
|
51
|
-
message = addCodePointToUnexpectedToken(message);
|
|
52
|
-
} else {
|
|
53
|
-
message += " while parsing empty string";
|
|
54
|
-
}
|
|
55
|
-
const jsonError = new JSONError(message);
|
|
56
|
-
jsonError.fileName = fileName;
|
|
57
|
-
if (location) {
|
|
58
|
-
jsonError.codeFrame = generateCodeFrame(string, location, options);
|
|
59
|
-
}
|
|
60
|
-
throw jsonError;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { parseJson as default };
|
|
@@ -1,65 +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
|
-
readFile: readFile$1
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
23
|
-
const {
|
|
24
|
-
unzip,
|
|
25
|
-
brotliDecompress
|
|
26
|
-
} = __cjs_getBuiltinModule("node:zlib");
|
|
27
|
-
import { toPath } from '@visulima/path/utils';
|
|
28
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
29
|
-
import PermissionError from './PermissionError-CjoiJgip.js';
|
|
30
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
31
|
-
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
|
|
32
|
-
|
|
33
|
-
const decompressionMethods = {
|
|
34
|
-
brotli: brotliDecompress,
|
|
35
|
-
gzip: unzip,
|
|
36
|
-
none: (buffer, callback) => {
|
|
37
|
-
callback(null, buffer);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const readFile = async (path, options) => {
|
|
41
|
-
assertValidFileOrDirectoryPath(path);
|
|
42
|
-
path = toPath(path);
|
|
43
|
-
if (!await isAccessible(path)) {
|
|
44
|
-
throw new PermissionError(`unable to read the non-accessible file: ${path}`);
|
|
45
|
-
}
|
|
46
|
-
if (!await isAccessible(path, R_OK)) {
|
|
47
|
-
throw new Error(`Unable to read the non-readable file: ${path}`);
|
|
48
|
-
}
|
|
49
|
-
const { buffer, compression, encoding, flag } = options ?? {};
|
|
50
|
-
return await readFile$1(path, flag ? { encoding, flag } : { encoding }).then(
|
|
51
|
-
async (content) => await new Promise((resolve, reject) => {
|
|
52
|
-
decompressionMethods[compression ?? "none"](content, (error, result) => {
|
|
53
|
-
if (error) {
|
|
54
|
-
reject(error);
|
|
55
|
-
} else {
|
|
56
|
-
resolve(buffer ? result : result.toString());
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
})
|
|
60
|
-
).catch((error) => {
|
|
61
|
-
throw error;
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { readFile as default };
|
|
@@ -1,54 +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
|
-
readFileSync: readFileSync$1
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
const {
|
|
24
|
-
unzipSync,
|
|
25
|
-
brotliDecompressSync
|
|
26
|
-
} = __cjs_getBuiltinModule("node:zlib");
|
|
27
|
-
import { toPath } from '@visulima/path/utils';
|
|
28
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
29
|
-
import PermissionError from './PermissionError-CjoiJgip.js';
|
|
30
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
31
|
-
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
|
|
32
|
-
|
|
33
|
-
const decompressionMethods = {
|
|
34
|
-
brotli: brotliDecompressSync,
|
|
35
|
-
gzip: unzipSync,
|
|
36
|
-
none: (buffer) => buffer
|
|
37
|
-
};
|
|
38
|
-
const readFileSync = (path, options) => {
|
|
39
|
-
assertValidFileOrDirectoryPath(path);
|
|
40
|
-
path = toPath(path);
|
|
41
|
-
if (!isAccessibleSync(path)) {
|
|
42
|
-
throw new PermissionError(`unable to read the non-accessible file: ${path}`);
|
|
43
|
-
}
|
|
44
|
-
if (!isAccessibleSync(path, R_OK)) {
|
|
45
|
-
throw new PermissionError(`invalid access to read file at: ${path}`);
|
|
46
|
-
}
|
|
47
|
-
const { buffer, compression, encoding, flag } = options ?? {};
|
|
48
|
-
const content = readFileSync$1(path, flag ? { encoding, flag } : { encoding });
|
|
49
|
-
const decompress = decompressionMethods[compression ?? "none"];
|
|
50
|
-
const decompressed = decompress(content);
|
|
51
|
-
return buffer ? decompressed : decompressed.toString();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { readFileSync as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { parse } from 'ini';
|
|
2
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
3
|
-
|
|
4
|
-
const readIni = async (path, options) => {
|
|
5
|
-
const { bracketedArray = true, ...readOptions } = options ?? {};
|
|
6
|
-
const content = await readFile(path, { encoding: "utf8", ...readOptions });
|
|
7
|
-
return parse(content, { bracketedArray });
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { readIni as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { parse } from 'ini';
|
|
2
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
3
|
-
|
|
4
|
-
const readIniSync = (path, options) => {
|
|
5
|
-
const { bracketedArray = true, ...readOptions } = options ?? {};
|
|
6
|
-
const content = readFileSync(path, { encoding: "utf8", ...readOptions });
|
|
7
|
-
return parse(content, { bracketedArray });
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { readIniSync as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { toPath } from '@visulima/path/utils';
|
|
2
|
-
import parseJson from './parseJson-BIp89Xjo.js';
|
|
3
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
4
|
-
|
|
5
|
-
async function readJson(path, reviver, options) {
|
|
6
|
-
if (typeof reviver === "object") {
|
|
7
|
-
options = reviver;
|
|
8
|
-
reviver = void 0;
|
|
9
|
-
}
|
|
10
|
-
const content = await readFile(path, {
|
|
11
|
-
buffer: true,
|
|
12
|
-
encoding: void 0
|
|
13
|
-
});
|
|
14
|
-
let data = new TextDecoder().decode(content);
|
|
15
|
-
const { beforeParse, color } = options ?? {};
|
|
16
|
-
if (typeof beforeParse === "function") {
|
|
17
|
-
data = beforeParse(data);
|
|
18
|
-
}
|
|
19
|
-
return parseJson(data, reviver, toPath(path), { color });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { readJson as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import JSON5 from 'json5';
|
|
2
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
3
|
-
|
|
4
|
-
async function readJson5(path, reviver, options) {
|
|
5
|
-
if (reviver && typeof reviver === "object") {
|
|
6
|
-
options = reviver;
|
|
7
|
-
reviver = void 0;
|
|
8
|
-
}
|
|
9
|
-
const { beforeParse, buffer, compression, encoding = "utf8", flag } = options ?? {};
|
|
10
|
-
const content = await readFile(path, { buffer, compression, encoding, flag });
|
|
11
|
-
const input = typeof beforeParse === "function" ? beforeParse(content) : content;
|
|
12
|
-
return JSON5.parse(input, reviver);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { readJson5 as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import JSON5 from 'json5';
|
|
2
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
3
|
-
|
|
4
|
-
function readJson5Sync(path, reviver, options) {
|
|
5
|
-
if (reviver && typeof reviver === "object") {
|
|
6
|
-
options = reviver;
|
|
7
|
-
reviver = void 0;
|
|
8
|
-
}
|
|
9
|
-
const { beforeParse, buffer, compression, encoding = "utf8", flag } = options ?? {};
|
|
10
|
-
const content = readFileSync(path, { buffer, compression, encoding, flag });
|
|
11
|
-
const input = typeof beforeParse === "function" ? beforeParse(content) : content;
|
|
12
|
-
return JSON5.parse(input, reviver);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { readJson5Sync as default };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { toPath } from '@visulima/path/utils';
|
|
2
|
-
import parseJson from './parseJson-BIp89Xjo.js';
|
|
3
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
4
|
-
|
|
5
|
-
function readJsonSync(path, reviver, options) {
|
|
6
|
-
if (typeof reviver === "object") {
|
|
7
|
-
options = reviver;
|
|
8
|
-
reviver = void 0;
|
|
9
|
-
}
|
|
10
|
-
const content = readFileSync(path, {
|
|
11
|
-
buffer: true,
|
|
12
|
-
encoding: void 0
|
|
13
|
-
});
|
|
14
|
-
let data = new TextDecoder().decode(content);
|
|
15
|
-
const { beforeParse, color } = options ?? {};
|
|
16
|
-
if (typeof beforeParse === "function") {
|
|
17
|
-
data = beforeParse(data);
|
|
18
|
-
}
|
|
19
|
-
return parseJson(data, reviver, toPath(path), { color });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { readJsonSync as default };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { toPath } from '@visulima/path/utils';
|
|
2
|
-
import { parse, printParseErrorCode } from 'jsonc-parser';
|
|
3
|
-
import JSONError from './JSONError-BkHRnInH.js';
|
|
4
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
5
|
-
import { i as indexToLineColumn, c as codeFrame } from './indexToLineColumn-BUb0GPKl-BF770uX7.js';
|
|
6
|
-
|
|
7
|
-
const throwIfJsoncErrors = (errors, input, filePath, codeFrameOptions) => {
|
|
8
|
-
if (errors.length === 0) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const first = errors[0];
|
|
12
|
-
const location = indexToLineColumn(input, first.offset);
|
|
13
|
-
const jsonError = new JSONError(`${printParseErrorCode(first.error)} at offset ${first.offset}`);
|
|
14
|
-
jsonError.fileName = filePath;
|
|
15
|
-
jsonError.codeFrame = codeFrame(input, { start: location }, { tabWidth: false, ...codeFrameOptions });
|
|
16
|
-
throw jsonError;
|
|
17
|
-
};
|
|
18
|
-
const readJsonc = async (path, options) => {
|
|
19
|
-
const { allowEmptyContent, allowTrailingComma = true, beforeParse, buffer, color, compression, disallowComments, encoding = "utf8", flag } = options ?? {};
|
|
20
|
-
const content = await readFile(path, { buffer, compression, encoding, flag });
|
|
21
|
-
const input = typeof beforeParse === "function" ? beforeParse(content) : content;
|
|
22
|
-
const errors = [];
|
|
23
|
-
const result = parse(input, errors, { allowEmptyContent, allowTrailingComma, disallowComments });
|
|
24
|
-
throwIfJsoncErrors(errors, input, toPath(path), { color });
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { readJsonc as default, throwIfJsoncErrors };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { toPath } from '@visulima/path/utils';
|
|
2
|
-
import { parse } from 'jsonc-parser';
|
|
3
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
4
|
-
import { throwIfJsoncErrors } from './readJsonc-j-OS-APg.js';
|
|
5
|
-
|
|
6
|
-
const readJsoncSync = (path, options) => {
|
|
7
|
-
const { allowEmptyContent, allowTrailingComma = true, beforeParse, buffer, color, compression, disallowComments, encoding = "utf8", flag } = options ?? {};
|
|
8
|
-
const content = readFileSync(path, { buffer, compression, encoding, flag });
|
|
9
|
-
const input = typeof beforeParse === "function" ? beforeParse(content) : content;
|
|
10
|
-
const errors = [];
|
|
11
|
-
const result = parse(input, errors, { allowEmptyContent, allowTrailingComma, disallowComments });
|
|
12
|
-
throwIfJsoncErrors(errors, input, toPath(path), { color });
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { readJsoncSync as default };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { parse } from 'smol-toml';
|
|
2
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
3
|
-
|
|
4
|
-
const readToml = async (path, options) => {
|
|
5
|
-
const content = await readFile(path, { encoding: "utf8", ...options });
|
|
6
|
-
return parse(content);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { readToml as default };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { parse } from 'smol-toml';
|
|
2
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
3
|
-
|
|
4
|
-
const readTomlSync = (path, options) => {
|
|
5
|
-
const content = readFileSync(path, { encoding: "utf8", ...options });
|
|
6
|
-
return parse(content);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { readTomlSync as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { parse } from 'yaml';
|
|
2
|
-
import readFile from './readFile-Iz7kvCCk.js';
|
|
3
|
-
|
|
4
|
-
async function readYaml(path, reviver, options) {
|
|
5
|
-
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
6
|
-
const content = await readFile(path, { buffer, compression, encoding, flag });
|
|
7
|
-
return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { readYaml as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { parse } from 'yaml';
|
|
2
|
-
import readFileSync from './readFileSync-gm9yfIhh.js';
|
|
3
|
-
|
|
4
|
-
function readYamlSync(path, reviver, options) {
|
|
5
|
-
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
6
|
-
const content = readFileSync(path, { buffer, compression, encoding, flag });
|
|
7
|
-
return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { readYamlSync as default };
|
|
@@ -1,39 +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
|
-
unlink,
|
|
22
|
-
rm
|
|
23
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
24
|
-
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
|
|
25
|
-
import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
|
|
26
|
-
|
|
27
|
-
const remove = async (path, options = {}) => {
|
|
28
|
-
assertValidFileOrDirectoryPath(path);
|
|
29
|
-
try {
|
|
30
|
-
await unlink(path);
|
|
31
|
-
} catch {
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
await rm(path, buildRmOptions(options));
|
|
35
|
-
} catch {
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { remove as default };
|
|
@@ -1,39 +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
|
-
unlinkSync,
|
|
22
|
-
rmSync
|
|
23
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
24
|
-
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-8HANmVjk.js';
|
|
25
|
-
import { b as buildRmOptions } from './build-rm-options-Cl3VDY4O.js';
|
|
26
|
-
|
|
27
|
-
const removeSync = (path, options = {}) => {
|
|
28
|
-
assertValidFileOrDirectoryPath(path);
|
|
29
|
-
try {
|
|
30
|
-
unlinkSync(path);
|
|
31
|
-
} catch {
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
rmSync(path, buildRmOptions(options));
|
|
35
|
-
} catch {
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export { removeSync as default };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { resolve, dirname } from '@visulima/path';
|
|
2
|
-
|
|
3
|
-
const resolveSymlinkTarget = (target, linkName) => {
|
|
4
|
-
if (typeof target !== "string") {
|
|
5
|
-
return target;
|
|
6
|
-
}
|
|
7
|
-
if (target.startsWith("./")) {
|
|
8
|
-
return resolve(target);
|
|
9
|
-
}
|
|
10
|
-
if (typeof linkName === "string") {
|
|
11
|
-
return resolve(dirname(linkName), target);
|
|
12
|
-
}
|
|
13
|
-
return new URL(target, linkName);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { resolveSymlinkTarget as r };
|