@visulima/fs 5.0.0-alpha.13 → 5.0.0-alpha.14
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 +16 -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-p6lOZXnE.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-BsmmADqx.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,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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
23
|
-
import { parse, stringify } from 'ini';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
26
|
-
import { d as detectIniStyle, m as mergeIniPreservingLines } from './ini-preserve-Dq_Q_Jgb.js';
|
|
27
|
-
import writeFile from './writeFile-B8HX0JIQ.js';
|
|
28
|
-
|
|
29
|
-
const writeIni = async (path, data, options = {}) => {
|
|
30
|
-
const { eol, preserveStyle = true, whitespace, ...rest } = options;
|
|
31
|
-
const { align, bracketedArray, newline, platform, section, sort, ...writeOptions } = rest;
|
|
32
|
-
let resolvedEol = eol;
|
|
33
|
-
let resolvedWhitespace = whitespace;
|
|
34
|
-
let existingText;
|
|
35
|
-
let oldData;
|
|
36
|
-
const accessible = preserveStyle ? await isAccessible(path, R_OK) : false;
|
|
37
|
-
if (accessible) {
|
|
38
|
-
try {
|
|
39
|
-
existingText = await readFile(path, "utf8");
|
|
40
|
-
oldData = parse(existingText, { bracketedArray: bracketedArray ?? true });
|
|
41
|
-
const detected = detectIniStyle(existingText);
|
|
42
|
-
resolvedEol ??= detected.eol;
|
|
43
|
-
resolvedWhitespace ??= detected.whitespace;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
if (error.code !== "ENOENT") {
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const encodeOptions = { align, bracketedArray, newline, platform, section, sort, whitespace: resolvedWhitespace };
|
|
51
|
-
const freshStringify = (value, sectionName) => stringify(value, sectionName === void 0 ? encodeOptions : { ...encodeOptions, section: sectionName });
|
|
52
|
-
let output;
|
|
53
|
-
if (existingText !== void 0 && oldData) {
|
|
54
|
-
output = mergeIniPreservingLines(existingText, oldData, data, freshStringify, {
|
|
55
|
-
eol: resolvedEol ?? "\n"});
|
|
56
|
-
} else {
|
|
57
|
-
output = freshStringify(data, section);
|
|
58
|
-
if (resolvedEol === "\r\n") {
|
|
59
|
-
output = output.replaceAll(/\r?\n/g, "\r\n");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
await writeFile(path, output, writeOptions);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { writeIni as default };
|
|
@@ -1,64 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
import { parse, stringify } from 'ini';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
26
|
-
import { d as detectIniStyle, m as mergeIniPreservingLines } from './ini-preserve-Dq_Q_Jgb.js';
|
|
27
|
-
import writeFileSync from './writeFileSync-DB8vv8xR.js';
|
|
28
|
-
|
|
29
|
-
const writeIniSync = (path, data, options = {}) => {
|
|
30
|
-
const { eol, preserveStyle = true, whitespace, ...rest } = options;
|
|
31
|
-
const { align, bracketedArray, newline, platform, section, sort, ...writeOptions } = rest;
|
|
32
|
-
let resolvedEol = eol;
|
|
33
|
-
let resolvedWhitespace = whitespace;
|
|
34
|
-
let existingText;
|
|
35
|
-
let oldData;
|
|
36
|
-
if (preserveStyle && isAccessibleSync(path, R_OK)) {
|
|
37
|
-
try {
|
|
38
|
-
existingText = readFileSync(path, "utf8");
|
|
39
|
-
oldData = parse(existingText, { bracketedArray: bracketedArray ?? true });
|
|
40
|
-
const detected = detectIniStyle(existingText);
|
|
41
|
-
resolvedEol ??= detected.eol;
|
|
42
|
-
resolvedWhitespace ??= detected.whitespace;
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (error.code !== "ENOENT") {
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const encodeOptions = { align, bracketedArray, newline, platform, section, sort, whitespace: resolvedWhitespace };
|
|
50
|
-
const freshStringify = (value, sectionName) => stringify(value, sectionName === void 0 ? encodeOptions : { ...encodeOptions, section: sectionName });
|
|
51
|
-
let output;
|
|
52
|
-
if (existingText !== void 0 && oldData) {
|
|
53
|
-
output = mergeIniPreservingLines(existingText, oldData, data, freshStringify, {
|
|
54
|
-
eol: resolvedEol ?? "\n"});
|
|
55
|
-
} else {
|
|
56
|
-
output = freshStringify(data, section);
|
|
57
|
-
if (resolvedEol === "\r\n") {
|
|
58
|
-
output = output.replaceAll(/\r?\n/g, "\r\n");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
writeFileSync(path, output, writeOptions);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export { writeIniSync as default };
|
|
@@ -1,50 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
26
|
-
import writeFile from './writeFile-B8HX0JIQ.js';
|
|
27
|
-
|
|
28
|
-
const writeJson = async (path, data, options = {}) => {
|
|
29
|
-
const { detectIndent: detectIndent$1, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: " ", ...options };
|
|
30
|
-
let indent = indentOption;
|
|
31
|
-
let trailingNewline = "\n";
|
|
32
|
-
if (await isAccessible(path, R_OK)) {
|
|
33
|
-
try {
|
|
34
|
-
const file = await readFile(path, "utf8");
|
|
35
|
-
if (detectIndent$1) {
|
|
36
|
-
const { indent: dIndent } = detectIndent(file);
|
|
37
|
-
indent = dIndent;
|
|
38
|
-
}
|
|
39
|
-
trailingNewline = file.endsWith("\n") ? "\n" : "";
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error.code !== "ENOENT") {
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const json = stringify(data, replacer, indent);
|
|
47
|
-
await writeFile(path, `${json}${trailingNewline}`, writeOptions);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { writeJson as default };
|
|
@@ -1,53 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import JSON5 from 'json5';
|
|
25
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
26
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
27
|
-
import writeFile from './writeFile-B8HX0JIQ.js';
|
|
28
|
-
|
|
29
|
-
const writeJson5 = async (path, data, options = {}) => {
|
|
30
|
-
const { detectIndent: detectIndent$1, indent: indentOption, quote, replacer, ...writeOptions } = { indent: " ", ...options };
|
|
31
|
-
let indent = indentOption;
|
|
32
|
-
let trailingNewline = "\n";
|
|
33
|
-
if (await isAccessible(path, R_OK)) {
|
|
34
|
-
try {
|
|
35
|
-
const file = await readFile(path, "utf8");
|
|
36
|
-
if (detectIndent$1) {
|
|
37
|
-
const { indent: detectedIndent } = detectIndent(file);
|
|
38
|
-
if (detectedIndent) {
|
|
39
|
-
indent = detectedIndent;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
trailingNewline = file.endsWith("\n") ? "\n" : "";
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (error.code !== "ENOENT") {
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const output = JSON5.stringify(data, { quote, replacer, space: indent });
|
|
50
|
-
await writeFile(path, `${output}${trailingNewline}`, writeOptions);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { writeJson5 as default };
|
|
@@ -1,53 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import JSON5 from 'json5';
|
|
25
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
26
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
27
|
-
import writeFileSync from './writeFileSync-DB8vv8xR.js';
|
|
28
|
-
|
|
29
|
-
const writeJson5Sync = (path, data, options = {}) => {
|
|
30
|
-
const { detectIndent: detectIndent$1, indent: indentOption, quote, replacer, ...writeOptions } = { indent: " ", ...options };
|
|
31
|
-
let indent = indentOption;
|
|
32
|
-
let trailingNewline = "\n";
|
|
33
|
-
if (isAccessibleSync(path, R_OK)) {
|
|
34
|
-
try {
|
|
35
|
-
const file = readFileSync(path, "utf8");
|
|
36
|
-
if (detectIndent$1) {
|
|
37
|
-
const { indent: detectedIndent } = detectIndent(file);
|
|
38
|
-
if (detectedIndent) {
|
|
39
|
-
indent = detectedIndent;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
trailingNewline = file.endsWith("\n") ? "\n" : "";
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (error.code !== "ENOENT") {
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const output = JSON5.stringify(data, { quote, replacer, space: indent });
|
|
50
|
-
writeFileSync(path, `${output}${trailingNewline}`, writeOptions);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { writeJson5Sync as default };
|
|
@@ -1,50 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
26
|
-
import writeFileSync from './writeFileSync-DB8vv8xR.js';
|
|
27
|
-
|
|
28
|
-
const writeJsonSync = (path, data, options = {}) => {
|
|
29
|
-
const { detectIndent: detectIndent$1, indent: indentOption, replacer, stringify = JSON.stringify, ...writeOptions } = { indent: " ", ...options };
|
|
30
|
-
let indent = indentOption;
|
|
31
|
-
let trailingNewline = "\n";
|
|
32
|
-
if (isAccessibleSync(path, R_OK)) {
|
|
33
|
-
try {
|
|
34
|
-
const file = readFileSync(path, "utf8");
|
|
35
|
-
if (detectIndent$1) {
|
|
36
|
-
const { indent: dIndent } = detectIndent(file);
|
|
37
|
-
indent = dIndent;
|
|
38
|
-
}
|
|
39
|
-
trailingNewline = file.endsWith("\n") ? "\n" : "";
|
|
40
|
-
} catch (error) {
|
|
41
|
-
if (error.code !== "ENOENT") {
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const json = stringify(data, replacer, indent);
|
|
47
|
-
writeFileSync(path, `${json}${trailingNewline}`, writeOptions);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { writeJsonSync as default };
|
|
@@ -1,60 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs/promises");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessible from './isAccessible-DuVrTNFV.js';
|
|
26
|
-
import { b as buildJsoncOutput } from './jsonc-merge-C6jWcfWh.js';
|
|
27
|
-
import writeFile from './writeFile-B8HX0JIQ.js';
|
|
28
|
-
|
|
29
|
-
const readExisting = async (path, detectIndent$1, fallbackIndent) => {
|
|
30
|
-
let existingText;
|
|
31
|
-
let indent = fallbackIndent;
|
|
32
|
-
let trailingNewline = "\n";
|
|
33
|
-
const accessible = await isAccessible(path, R_OK);
|
|
34
|
-
if (!accessible) {
|
|
35
|
-
return { indent, trailingNewline };
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
existingText = await readFile(path, "utf8");
|
|
39
|
-
if (detectIndent$1) {
|
|
40
|
-
const { indent: detectedIndent } = detectIndent(existingText);
|
|
41
|
-
if (detectedIndent) {
|
|
42
|
-
indent = detectedIndent;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
trailingNewline = existingText.endsWith("\n") ? "\n" : "";
|
|
46
|
-
} catch (error) {
|
|
47
|
-
if (error.code !== "ENOENT") {
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return { existingText, indent, trailingNewline };
|
|
52
|
-
};
|
|
53
|
-
const writeJsonc = async (path, data, options = {}) => {
|
|
54
|
-
const { detectIndent, formattingOptions, indent: indentOption, preserveComments = true, replacer, ...writeOptions } = { indent: " ", ...options };
|
|
55
|
-
const { existingText, indent, trailingNewline } = await readExisting(path, detectIndent, indentOption);
|
|
56
|
-
const output = buildJsoncOutput(existingText, data, preserveComments, indent, trailingNewline, formattingOptions, replacer);
|
|
57
|
-
await writeFile(path, output, writeOptions);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { writeJsonc as default };
|
|
@@ -1,59 +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
|
|
22
|
-
} = __cjs_getBuiltinModule("node:fs");
|
|
23
|
-
import { d as detectIndent } from './index-CHM-in-V.js';
|
|
24
|
-
import { R_OK } from './F_OK-MldBaGxb.js';
|
|
25
|
-
import isAccessibleSync from './isAccessibleSync-DI8mM0fA.js';
|
|
26
|
-
import { b as buildJsoncOutput } from './jsonc-merge-C6jWcfWh.js';
|
|
27
|
-
import writeFileSync from './writeFileSync-DB8vv8xR.js';
|
|
28
|
-
|
|
29
|
-
const readExistingSync = (path, detectIndent$1, fallbackIndent) => {
|
|
30
|
-
let existingText;
|
|
31
|
-
let indent = fallbackIndent;
|
|
32
|
-
let trailingNewline = "\n";
|
|
33
|
-
if (!isAccessibleSync(path, R_OK)) {
|
|
34
|
-
return { indent, trailingNewline };
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
existingText = readFileSync(path, "utf8");
|
|
38
|
-
if (detectIndent$1) {
|
|
39
|
-
const { indent: detectedIndent } = detectIndent(existingText);
|
|
40
|
-
if (detectedIndent) {
|
|
41
|
-
indent = detectedIndent;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
trailingNewline = existingText.endsWith("\n") ? "\n" : "";
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (error.code !== "ENOENT") {
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return { existingText, indent, trailingNewline };
|
|
51
|
-
};
|
|
52
|
-
const writeJsoncSync = (path, data, options = {}) => {
|
|
53
|
-
const { detectIndent, formattingOptions, indent: indentOption, preserveComments = true, replacer, ...writeOptions } = { indent: " ", ...options };
|
|
54
|
-
const { existingText, indent, trailingNewline } = readExistingSync(path, detectIndent, indentOption);
|
|
55
|
-
const output = buildJsoncOutput(existingText, data, preserveComments, indent, trailingNewline, formattingOptions, replacer);
|
|
56
|
-
writeFileSync(path, output, writeOptions);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export { writeJsoncSync as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { stringify } from 'yaml';
|
|
2
|
-
import writeFile from './writeFile-B8HX0JIQ.js';
|
|
3
|
-
|
|
4
|
-
async function writeYaml(path, data, replacer, options) {
|
|
5
|
-
let stringifyOptions;
|
|
6
|
-
let effectiveReplacer;
|
|
7
|
-
let space;
|
|
8
|
-
if (typeof replacer === "object" && replacer !== null && !Array.isArray(replacer) && typeof replacer !== "function") {
|
|
9
|
-
stringifyOptions = replacer;
|
|
10
|
-
effectiveReplacer = stringifyOptions.replacer;
|
|
11
|
-
space = stringifyOptions.space;
|
|
12
|
-
} else if (typeof options === "object") {
|
|
13
|
-
stringifyOptions = options;
|
|
14
|
-
effectiveReplacer = replacer;
|
|
15
|
-
space = stringifyOptions.space;
|
|
16
|
-
} else {
|
|
17
|
-
effectiveReplacer = replacer;
|
|
18
|
-
space = options;
|
|
19
|
-
}
|
|
20
|
-
const content = stringify(data, effectiveReplacer, space ?? stringifyOptions);
|
|
21
|
-
await writeFile(path, content, stringifyOptions);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { writeYaml as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { stringify } from 'yaml';
|
|
2
|
-
import writeFileSync from './writeFileSync-DB8vv8xR.js';
|
|
3
|
-
|
|
4
|
-
function writeYamlSync(path, data, replacer, options) {
|
|
5
|
-
let stringifyOptions;
|
|
6
|
-
let effectiveReplacer;
|
|
7
|
-
let space;
|
|
8
|
-
if (typeof replacer === "object" && replacer !== null && !Array.isArray(replacer) && typeof replacer !== "function") {
|
|
9
|
-
stringifyOptions = replacer;
|
|
10
|
-
effectiveReplacer = stringifyOptions.replacer;
|
|
11
|
-
space = stringifyOptions.space;
|
|
12
|
-
} else if (typeof options === "object") {
|
|
13
|
-
stringifyOptions = options;
|
|
14
|
-
effectiveReplacer = replacer;
|
|
15
|
-
space = stringifyOptions.space;
|
|
16
|
-
} else {
|
|
17
|
-
effectiveReplacer = replacer;
|
|
18
|
-
space = options;
|
|
19
|
-
}
|
|
20
|
-
const content = stringify(data, effectiveReplacer, space ?? stringifyOptions);
|
|
21
|
-
writeFileSync(path, content, stringifyOptions);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { writeYamlSync as default };
|