@visulima/fs 2.3.5 → 2.3.7
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 +20 -0
- package/README.md +318 -362
- package/dist/error.cjs +21 -1
- package/dist/error.mjs +7 -1
- package/dist/index.cjs +88 -1
- package/dist/index.mjs +35 -1
- package/dist/packem_shared/AlreadyExistsError-DpxtwQot.cjs +34 -0
- package/dist/packem_shared/AlreadyExistsError-GK7J9fVA.mjs +32 -0
- package/dist/packem_shared/DirectoryError-D8FHcAqu.cjs +34 -0
- package/dist/packem_shared/DirectoryError-DByTWE7t.mjs +32 -0
- package/dist/packem_shared/F_OK-CWSqQIdF.cjs +17 -0
- package/dist/packem_shared/F_OK-JER1LjUr.mjs +8 -0
- package/dist/packem_shared/JSONError-BCIIHvzq.mjs +28 -0
- package/dist/packem_shared/JSONError-gkXvBSar.cjs +30 -0
- package/dist/packem_shared/LF-CU3KsvZC.mjs +20 -0
- package/dist/packem_shared/LF-bB2qO80j.cjs +28 -0
- package/dist/packem_shared/NotEmptyError-BCS_5pPt.cjs +34 -0
- package/dist/packem_shared/NotEmptyError-DCXooh5l.mjs +32 -0
- package/dist/packem_shared/NotFoundError-B_1nPl3K.cjs +34 -0
- package/dist/packem_shared/NotFoundError-CUdcC61I.mjs +32 -0
- package/dist/packem_shared/PermissionError-CqGMI9qC.mjs +32 -0
- package/dist/packem_shared/PermissionError-QFMKgk2l.cjs +34 -0
- package/dist/packem_shared/WalkError-B7_AVs7d.cjs +27 -0
- package/dist/packem_shared/WalkError-H9EuRv7O.mjs +25 -0
- package/dist/packem_shared/assertValidFileContents-CRVvyM6b.cjs +11 -0
- package/dist/packem_shared/assertValidFileContents-Ox-ScfeK.mjs +9 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-BMbgA-eI.cjs +11 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-BWWgA1wj.mjs +9 -0
- package/dist/packem_shared/collect-BtDVJEOm.mjs +16 -0
- package/dist/packem_shared/collect-DxUriHCH.cjs +18 -0
- package/dist/packem_shared/collectSync-BaA0s001.cjs +18 -0
- package/dist/packem_shared/collectSync-CGjdb50I.mjs +16 -0
- package/dist/packem_shared/emptyDir-DcCfiNcf.cjs +22 -0
- package/dist/packem_shared/emptyDir-Dw5xSBox.mjs +20 -0
- package/dist/packem_shared/emptyDirSync-BoknkGUe.cjs +21 -0
- package/dist/packem_shared/emptyDirSync-DTGPXQ3v.mjs +19 -0
- package/dist/packem_shared/ensureDir-XiBlkOLR.mjs +33 -0
- package/dist/packem_shared/ensureDir-iUK2ga5M.cjs +35 -0
- package/dist/packem_shared/ensureDirSync-2IFUHFK2.mjs +33 -0
- package/dist/packem_shared/ensureDirSync-CXdMkg0Y.cjs +35 -0
- package/dist/packem_shared/ensureFile-Br8tFUJ7.cjs +29 -0
- package/dist/packem_shared/ensureFile-C2bWlBEa.mjs +27 -0
- package/dist/packem_shared/ensureFileSync-CZzSkNGC.cjs +29 -0
- package/dist/packem_shared/ensureFileSync-DkFfhOEs.mjs +27 -0
- package/dist/packem_shared/ensureLink-CFiabAD3.mjs +34 -0
- package/dist/packem_shared/ensureLink-Dqw5GBDq.cjs +36 -0
- package/dist/packem_shared/ensureLinkSync-BVw3h6sK.cjs +36 -0
- package/dist/packem_shared/ensureLinkSync-Dk-YeRg6.mjs +34 -0
- package/dist/packem_shared/ensureSymlink-CFSfreco.cjs +54 -0
- package/dist/packem_shared/ensureSymlink-CSqngPoI.mjs +52 -0
- package/dist/packem_shared/ensureSymlinkSync-BCd9bzsx.cjs +58 -0
- package/dist/packem_shared/ensureSymlinkSync-QRaNZX2E.mjs +56 -0
- package/dist/packem_shared/findUp-C8_QpAtD.mjs +63 -0
- package/dist/packem_shared/findUp-DA511Swp.cjs +65 -0
- package/dist/packem_shared/findUpSync-DVOd3V-q.mjs +63 -0
- package/dist/packem_shared/findUpSync-u1rGibzw.cjs +65 -0
- package/dist/packem_shared/get-file-info-type-BpRzQHvd.cjs +18 -0
- package/dist/packem_shared/get-file-info-type-CeiZ6n6g.mjs +16 -0
- package/dist/packem_shared/index-ajT9ecry.mjs +108 -0
- package/dist/packem_shared/index-ngvEMjBI.cjs +110 -0
- package/dist/packem_shared/is-stats-identical-BfdEfO6i.cjs +7 -0
- package/dist/packem_shared/is-stats-identical-ByTYZ2Aw.mjs +5 -0
- package/dist/packem_shared/isAccessible-Bonsm1Ez.mjs +20 -0
- package/dist/packem_shared/isAccessible-ZNVGsSb7.cjs +22 -0
- package/dist/packem_shared/isAccessibleSync-3gnUWUwX.mjs +20 -0
- package/dist/packem_shared/isAccessibleSync-VWjQa-US.cjs +22 -0
- package/dist/packem_shared/move-DgF7Ul9L.mjs +114 -0
- package/dist/packem_shared/move-Dh925GL9.cjs +121 -0
- package/dist/packem_shared/parseJson-DcUo4Rpt.cjs +251 -0
- package/dist/packem_shared/parseJson-n9THWOFI.mjs +249 -0
- package/dist/packem_shared/readFile-DUM-xNoB.mjs +46 -0
- package/dist/packem_shared/readFile-iFUhZHnh.cjs +48 -0
- package/dist/packem_shared/readFileSync-B3NTOR-W.cjs +33 -0
- package/dist/packem_shared/readFileSync-Cck96_o0.mjs +31 -0
- package/dist/packem_shared/readJson-DIHRleEE.mjs +25 -0
- package/dist/packem_shared/readJson-JrCHMN3m.cjs +27 -0
- package/dist/packem_shared/readJsonSync-BPfxTuQL.mjs +25 -0
- package/dist/packem_shared/readJsonSync-o_MAOlUv.cjs +27 -0
- package/dist/packem_shared/readYaml-sR4bqUel.cjs +15 -0
- package/dist/packem_shared/readYaml-vVKK8ZzY.mjs +13 -0
- package/dist/packem_shared/readYamlSync-C3oOzxiN.cjs +15 -0
- package/dist/packem_shared/readYamlSync-MOLH4gXB.mjs +13 -0
- package/dist/packem_shared/remove-B2nxUObP.mjs +18 -0
- package/dist/packem_shared/remove-BpDiVPns.cjs +20 -0
- package/dist/packem_shared/removeSync-BosXW624.cjs +20 -0
- package/dist/packem_shared/removeSync-C87yepDI.mjs +18 -0
- package/dist/packem_shared/resolve-symlink-target-BbpEHdU2.mjs +18 -0
- package/dist/packem_shared/resolve-symlink-target-DImIddt6.cjs +20 -0
- package/dist/packem_shared/stripJsonComments-B66nRaTZ.mjs +21 -0
- package/dist/packem_shared/stripJsonComments-eDrcJvBT.cjs +23 -0
- package/dist/packem_shared/to-uint-8-array-B4CjMOD3.mjs +21 -0
- package/dist/packem_shared/to-uint-8-array-BaTEyX3D.cjs +23 -0
- package/dist/packem_shared/walk-BW7b4GXI.cjs +106 -0
- package/dist/packem_shared/walk-CNcSYQVq.mjs +104 -0
- package/dist/packem_shared/walk-include-CMUSRa86.mjs +20 -0
- package/dist/packem_shared/walk-include-yUdRrF16.cjs +23 -0
- package/dist/packem_shared/walkSync-BzxdFWLU.mjs +103 -0
- package/dist/packem_shared/walkSync-DgPj93NL.cjs +105 -0
- package/dist/packem_shared/writeFile-B7dhfseN.mjs +58 -0
- package/dist/packem_shared/writeFile-DKu5-M8x.cjs +60 -0
- package/dist/packem_shared/writeFileSync-Db6pmY0q.cjs +60 -0
- package/dist/packem_shared/writeFileSync-mMGYqOc8.mjs +58 -0
- package/dist/packem_shared/writeJson-BSQE2uFN.mjs +31 -0
- package/dist/packem_shared/writeJson-DtnnjTix.cjs +33 -0
- package/dist/packem_shared/writeJsonSync-C_i6LsGT.mjs +31 -0
- package/dist/packem_shared/writeJsonSync-Dz5-B2PD.cjs +33 -0
- package/dist/packem_shared/writeYaml-B-KoZN0E.cjs +14 -0
- package/dist/packem_shared/writeYaml-DSTzKc0_.mjs +12 -0
- package/dist/packem_shared/writeYamlSync-D6borSP1.cjs +14 -0
- package/dist/packem_shared/writeYamlSync-agxYIea0.mjs +12 -0
- package/dist/utils.cjs +19 -1
- package/dist/utils.mjs +6 -1
- package/package.json +15 -16
- package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.mjs +0 -1
- package/dist/packem_shared/AlreadyExistsError-GC2XUgzJ.cjs +0 -1
- package/dist/packem_shared/DirectoryError-B8wqer68.cjs +0 -1
- package/dist/packem_shared/DirectoryError-ddlbUV8C.mjs +0 -1
- package/dist/packem_shared/F_OK-6WAweffB.cjs +0 -1
- package/dist/packem_shared/F_OK-B71i3mUa.mjs +0 -1
- package/dist/packem_shared/JSONError-CVkb3xZ3.mjs +0 -4
- package/dist/packem_shared/JSONError-CWuiGmNc.cjs +0 -4
- package/dist/packem_shared/LF-D4BqIfQm.cjs +0 -3
- package/dist/packem_shared/LF-Dbx0i6a7.mjs +0 -3
- package/dist/packem_shared/NotEmptyError-BWGfec5K.cjs +0 -1
- package/dist/packem_shared/NotEmptyError-DMh1o7UL.mjs +0 -1
- package/dist/packem_shared/NotFoundError-Diij7oqe.cjs +0 -1
- package/dist/packem_shared/NotFoundError-T95YsWYl.mjs +0 -1
- package/dist/packem_shared/PermissionError-B8oi38Bx.mjs +0 -1
- package/dist/packem_shared/PermissionError-Ck1Es7al.cjs +0 -1
- package/dist/packem_shared/WalkError-BsngoIKJ.mjs +0 -1
- package/dist/packem_shared/WalkError-gKgp0TWD.cjs +0 -1
- package/dist/packem_shared/assertValidFileContents-BLhwm7u2.mjs +0 -1
- package/dist/packem_shared/assertValidFileContents-CrbDz09d.cjs +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.mjs +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-HOUs73Jk.cjs +0 -1
- package/dist/packem_shared/collect-4au76gDu.cjs +0 -1
- package/dist/packem_shared/collect-CRzGiRGg.mjs +0 -1
- package/dist/packem_shared/collectSync-BE8DAOke.mjs +0 -1
- package/dist/packem_shared/collectSync-CbKwt8rz.cjs +0 -1
- package/dist/packem_shared/emptyDir-D2m8OP8u.mjs +0 -1
- package/dist/packem_shared/emptyDir-DKxQHQQb.cjs +0 -1
- package/dist/packem_shared/emptyDirSync-CLM_zyIb.cjs +0 -1
- package/dist/packem_shared/emptyDirSync-CZNcW4wc.mjs +0 -1
- package/dist/packem_shared/ensureDir-BtvxsJiS.mjs +0 -1
- package/dist/packem_shared/ensureDir-DVHj-_yp.cjs +0 -1
- package/dist/packem_shared/ensureDirSync-CvjJ3bGq.cjs +0 -1
- package/dist/packem_shared/ensureDirSync-bGe0QB7d.mjs +0 -1
- package/dist/packem_shared/ensureFile-C46R6-4l.mjs +0 -1
- package/dist/packem_shared/ensureFile-CcJ5XIZm.cjs +0 -1
- package/dist/packem_shared/ensureFileSync-CwYTIP4G.mjs +0 -1
- package/dist/packem_shared/ensureFileSync-v-PhMLTr.cjs +0 -1
- package/dist/packem_shared/ensureLink-63XWiA3I.mjs +0 -1
- package/dist/packem_shared/ensureLink-C-v4AxzH.cjs +0 -1
- package/dist/packem_shared/ensureLinkSync-C4S-zdVb.cjs +0 -1
- package/dist/packem_shared/ensureLinkSync-D2LVObKd.mjs +0 -1
- package/dist/packem_shared/ensureSymlink-C5cy9585.cjs +0 -1
- package/dist/packem_shared/ensureSymlink-D36fS4KE.mjs +0 -1
- package/dist/packem_shared/ensureSymlinkSync-PvWVgeXc.mjs +0 -1
- package/dist/packem_shared/ensureSymlinkSync-YDRbg9hX.cjs +0 -1
- package/dist/packem_shared/findUp-CMGMYNty.mjs +0 -1
- package/dist/packem_shared/findUp-VKPTLmQQ.cjs +0 -1
- package/dist/packem_shared/findUpSync-BFwDGxkV.cjs +0 -1
- package/dist/packem_shared/findUpSync-QP_ZEsJN.mjs +0 -1
- package/dist/packem_shared/get-file-info-type-BXcpoWEM.cjs +0 -1
- package/dist/packem_shared/get-file-info-type-CaWGXRjY.mjs +0 -1
- package/dist/packem_shared/index-Cms6lU4T.cjs +0 -1
- package/dist/packem_shared/index-VcQXVcaq.mjs +0 -1
- package/dist/packem_shared/is-stats-identical-CPCumzsC.cjs +0 -1
- package/dist/packem_shared/is-stats-identical-CS5Y91zW.mjs +0 -1
- package/dist/packem_shared/isAccessible-Be3NKjOk.cjs +0 -1
- package/dist/packem_shared/isAccessible-cO53WedI.mjs +0 -1
- package/dist/packem_shared/isAccessibleSync-D5Vc2GTD.mjs +0 -1
- package/dist/packem_shared/isAccessibleSync-WOSgkAy2.cjs +0 -1
- package/dist/packem_shared/move-MZ9F6paN.mjs +0 -1
- package/dist/packem_shared/move-j3mzcWrG.cjs +0 -1
- package/dist/packem_shared/parseJson-BIYrZWHm.mjs +0 -6
- package/dist/packem_shared/parseJson-CXe73j5t.cjs +0 -6
- package/dist/packem_shared/readFile-CFus1Rym.mjs +0 -1
- package/dist/packem_shared/readFile-fzYtUKuW.cjs +0 -1
- package/dist/packem_shared/readFileSync-Dz4jLcWc.cjs +0 -1
- package/dist/packem_shared/readFileSync-Ulz6QzOz.mjs +0 -1
- package/dist/packem_shared/readJson-C6RN16Rf.mjs +0 -1
- package/dist/packem_shared/readJson-D7_CYUJX.cjs +0 -1
- package/dist/packem_shared/readJsonSync-QziPGqW_.cjs +0 -1
- package/dist/packem_shared/readJsonSync-ztZXpE8z.mjs +0 -1
- package/dist/packem_shared/readYaml-C-ui8qXw.cjs +0 -1
- package/dist/packem_shared/readYaml-aFHfT-4e.mjs +0 -1
- package/dist/packem_shared/readYamlSync-CeJ6RnoJ.mjs +0 -1
- package/dist/packem_shared/readYamlSync-DUYMSemC.cjs +0 -1
- package/dist/packem_shared/remove-B-9MI2l5.cjs +0 -1
- package/dist/packem_shared/remove-DzfvbZOm.mjs +0 -1
- package/dist/packem_shared/removeSync-CJPR6M7V.cjs +0 -1
- package/dist/packem_shared/removeSync-D165rXSn.mjs +0 -1
- package/dist/packem_shared/resolve-symlink-target-BofZSDIc.mjs +0 -1
- package/dist/packem_shared/resolve-symlink-target-HnbdXA1S.cjs +0 -1
- package/dist/packem_shared/stripJsonComments-CKgR4nW4.mjs +0 -1
- package/dist/packem_shared/stripJsonComments-Cw7UCxI3.cjs +0 -1
- package/dist/packem_shared/to-uint-8-array-2-3EvGd7.cjs +0 -1
- package/dist/packem_shared/to-uint-8-array-DwgaTasY.mjs +0 -1
- package/dist/packem_shared/walk-BJgnJy5d.cjs +0 -1
- package/dist/packem_shared/walk-DH-95i_B.mjs +0 -1
- package/dist/packem_shared/walk-include-B-MbUqMt.mjs +0 -1
- package/dist/packem_shared/walk-include-CFIYniQi.cjs +0 -1
- package/dist/packem_shared/walkSync-D4zvt_kM.mjs +0 -1
- package/dist/packem_shared/walkSync-DYawhxUA.cjs +0 -1
- package/dist/packem_shared/writeFile-DaHzc_FW.mjs +0 -1
- package/dist/packem_shared/writeFile-WCuWZNRy.cjs +0 -1
- package/dist/packem_shared/writeFileSync-D9HGh6J-.mjs +0 -1
- package/dist/packem_shared/writeFileSync-Ds49_ORi.cjs +0 -1
- package/dist/packem_shared/writeJson-BdjtBy1t.cjs +0 -4
- package/dist/packem_shared/writeJson-Bu7Dw4Uu.mjs +0 -4
- package/dist/packem_shared/writeJsonSync-7CjNn7oo.mjs +0 -4
- package/dist/packem_shared/writeJsonSync-CdC3ahaO.cjs +0 -4
- package/dist/packem_shared/writeYaml-COWffUNm.cjs +0 -1
- package/dist/packem_shared/writeYaml-bi1dx696.mjs +0 -1
- package/dist/packem_shared/writeYamlSync-BpIN1tTP.cjs +0 -1
- package/dist/packem_shared/writeYamlSync-D2VPlEws.mjs +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const utils = require('@visulima/path/utils');
|
|
4
|
+
const parseJson = require('./parseJson-DcUo4Rpt.cjs');
|
|
5
|
+
const readFile = require('./readFile-iFUhZHnh.cjs');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
async function readJson(path, reviver, options) {
|
|
10
|
+
if (typeof reviver === "object") {
|
|
11
|
+
options = reviver;
|
|
12
|
+
reviver = undefined;
|
|
13
|
+
}
|
|
14
|
+
const content = await readFile(path, {
|
|
15
|
+
buffer: true,
|
|
16
|
+
encoding: undefined
|
|
17
|
+
});
|
|
18
|
+
let data = new TextDecoder().decode(content);
|
|
19
|
+
const { beforeParse, color } = options ?? {};
|
|
20
|
+
if (typeof beforeParse === "function") {
|
|
21
|
+
data = beforeParse(data);
|
|
22
|
+
}
|
|
23
|
+
return parseJson(data, reviver, utils.toPath(path), { color });
|
|
24
|
+
}
|
|
25
|
+
__name(readJson, "readJson");
|
|
26
|
+
|
|
27
|
+
module.exports = readJson;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toPath } from '@visulima/path/utils';
|
|
2
|
+
import parseJson from './parseJson-n9THWOFI.mjs';
|
|
3
|
+
import readFileSync from './readFileSync-Cck96_o0.mjs';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
function readJsonSync(path, reviver, options) {
|
|
8
|
+
if (typeof reviver === "object") {
|
|
9
|
+
options = reviver;
|
|
10
|
+
reviver = undefined;
|
|
11
|
+
}
|
|
12
|
+
const content = readFileSync(path, {
|
|
13
|
+
buffer: true,
|
|
14
|
+
encoding: undefined
|
|
15
|
+
});
|
|
16
|
+
let data = new TextDecoder().decode(content);
|
|
17
|
+
const { beforeParse, color } = options ?? {};
|
|
18
|
+
if (typeof beforeParse === "function") {
|
|
19
|
+
data = beforeParse(data);
|
|
20
|
+
}
|
|
21
|
+
return parseJson(data, reviver, toPath(path), { color });
|
|
22
|
+
}
|
|
23
|
+
__name(readJsonSync, "readJsonSync");
|
|
24
|
+
|
|
25
|
+
export { readJsonSync as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const utils = require('@visulima/path/utils');
|
|
4
|
+
const parseJson = require('./parseJson-DcUo4Rpt.cjs');
|
|
5
|
+
const readFileSync = require('./readFileSync-B3NTOR-W.cjs');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
function readJsonSync(path, reviver, options) {
|
|
10
|
+
if (typeof reviver === "object") {
|
|
11
|
+
options = reviver;
|
|
12
|
+
reviver = undefined;
|
|
13
|
+
}
|
|
14
|
+
const content = readFileSync(path, {
|
|
15
|
+
buffer: true,
|
|
16
|
+
encoding: undefined
|
|
17
|
+
});
|
|
18
|
+
let data = new TextDecoder().decode(content);
|
|
19
|
+
const { beforeParse, color } = options ?? {};
|
|
20
|
+
if (typeof beforeParse === "function") {
|
|
21
|
+
data = beforeParse(data);
|
|
22
|
+
}
|
|
23
|
+
return parseJson(data, reviver, utils.toPath(path), { color });
|
|
24
|
+
}
|
|
25
|
+
__name(readJsonSync, "readJsonSync");
|
|
26
|
+
|
|
27
|
+
module.exports = readJsonSync;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const yaml = require('yaml');
|
|
4
|
+
const readFile = require('./readFile-iFUhZHnh.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
async function readYaml(path, reviver, options) {
|
|
9
|
+
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
10
|
+
const content = await readFile(path, { buffer, compression, encoding, flag });
|
|
11
|
+
return typeof reviver === "function" ? yaml.parse(content, reviver, parseOptions) : yaml.parse(content, parseOptions);
|
|
12
|
+
}
|
|
13
|
+
__name(readYaml, "readYaml");
|
|
14
|
+
|
|
15
|
+
module.exports = readYaml;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { parse } from 'yaml';
|
|
2
|
+
import readFile from './readFile-DUM-xNoB.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
async function readYaml(path, reviver, options) {
|
|
7
|
+
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
8
|
+
const content = await readFile(path, { buffer, compression, encoding, flag });
|
|
9
|
+
return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
|
|
10
|
+
}
|
|
11
|
+
__name(readYaml, "readYaml");
|
|
12
|
+
|
|
13
|
+
export { readYaml as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const yaml = require('yaml');
|
|
4
|
+
const readFileSync = require('./readFileSync-B3NTOR-W.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
function readYamlSync(path, reviver, options) {
|
|
9
|
+
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
10
|
+
const content = readFileSync(path, { buffer, compression, encoding, flag });
|
|
11
|
+
return typeof reviver === "function" ? yaml.parse(content, reviver, parseOptions) : yaml.parse(content, parseOptions);
|
|
12
|
+
}
|
|
13
|
+
__name(readYamlSync, "readYamlSync");
|
|
14
|
+
|
|
15
|
+
module.exports = readYamlSync;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { parse } from 'yaml';
|
|
2
|
+
import readFileSync from './readFileSync-Cck96_o0.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
function readYamlSync(path, reviver, options) {
|
|
7
|
+
const { buffer, compression, encoding = "utf8", flag, ...parseOptions } = options ?? {};
|
|
8
|
+
const content = readFileSync(path, { buffer, compression, encoding, flag });
|
|
9
|
+
return typeof reviver === "function" ? parse(content, reviver, parseOptions) : parse(content, parseOptions);
|
|
10
|
+
}
|
|
11
|
+
__name(readYamlSync, "readYamlSync");
|
|
12
|
+
|
|
13
|
+
export { readYamlSync as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { unlink, rm } from 'node:fs/promises';
|
|
2
|
+
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const remove = /* @__PURE__ */ __name(async (path, options = {}) => {
|
|
7
|
+
assertValidFileOrDirectoryPath(path);
|
|
8
|
+
try {
|
|
9
|
+
await unlink(path);
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
await rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
}, "remove");
|
|
17
|
+
|
|
18
|
+
export { remove as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const promises = require('node:fs/promises');
|
|
4
|
+
const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const remove = /* @__PURE__ */ __name(async (path, options = {}) => {
|
|
9
|
+
assertValidFileOrDirectoryPath(path);
|
|
10
|
+
try {
|
|
11
|
+
await promises.unlink(path);
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
await promises.rm(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
}, "remove");
|
|
19
|
+
|
|
20
|
+
module.exports = remove;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node_fs = require('node:fs');
|
|
4
|
+
const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const removeSync = /* @__PURE__ */ __name((path, options = {}) => {
|
|
9
|
+
assertValidFileOrDirectoryPath(path);
|
|
10
|
+
try {
|
|
11
|
+
node_fs.unlinkSync(path);
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
node_fs.rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
}, "removeSync");
|
|
19
|
+
|
|
20
|
+
module.exports = removeSync;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { unlinkSync, rmSync } from 'node:fs';
|
|
2
|
+
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const removeSync = /* @__PURE__ */ __name((path, options = {}) => {
|
|
7
|
+
assertValidFileOrDirectoryPath(path);
|
|
8
|
+
try {
|
|
9
|
+
unlinkSync(path);
|
|
10
|
+
} catch {
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
rmSync(path, { force: true, maxRetries: options?.maxRetries, recursive: true, retryDelay: options?.retryDelay });
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
}, "removeSync");
|
|
17
|
+
|
|
18
|
+
export { removeSync as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolve, dirname } from '@visulima/path';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const resolveSymlinkTarget = /* @__PURE__ */ __name((target, linkName) => {
|
|
6
|
+
if (typeof target !== "string") {
|
|
7
|
+
return target;
|
|
8
|
+
}
|
|
9
|
+
if (target.startsWith("./")) {
|
|
10
|
+
return resolve(target);
|
|
11
|
+
}
|
|
12
|
+
if (typeof linkName === "string") {
|
|
13
|
+
return resolve(dirname(linkName), target);
|
|
14
|
+
}
|
|
15
|
+
return new URL(target, linkName);
|
|
16
|
+
}, "resolveSymlinkTarget");
|
|
17
|
+
|
|
18
|
+
export { resolveSymlinkTarget as r };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('@visulima/path');
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
const resolveSymlinkTarget = /* @__PURE__ */ __name((target, linkName) => {
|
|
8
|
+
if (typeof target !== "string") {
|
|
9
|
+
return target;
|
|
10
|
+
}
|
|
11
|
+
if (target.startsWith("./")) {
|
|
12
|
+
return path.resolve(target);
|
|
13
|
+
}
|
|
14
|
+
if (typeof linkName === "string") {
|
|
15
|
+
return path.resolve(path.dirname(linkName), target);
|
|
16
|
+
}
|
|
17
|
+
return new URL(target, linkName);
|
|
18
|
+
}, "resolveSymlinkTarget");
|
|
19
|
+
|
|
20
|
+
exports.resolveSymlinkTarget = resolveSymlinkTarget;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { INTERNAL_STRIP_JSON_REGEX } from './F_OK-JER1LjUr.mjs';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const stripJsonComments = /* @__PURE__ */ __name((jsonString, { whitespace = true } = {}) => (
|
|
6
|
+
// This regular expression translates to:
|
|
7
|
+
//
|
|
8
|
+
// /quoted-string|line-comment|block-comment/g
|
|
9
|
+
//
|
|
10
|
+
// This means that comment characters inside of strings will match
|
|
11
|
+
// as strings, not comments, so we can just skip the whole string
|
|
12
|
+
// in the replacer function.
|
|
13
|
+
jsonString.replace(INTERNAL_STRIP_JSON_REGEX, (match) => {
|
|
14
|
+
if (match.startsWith('"') || match[1] === "*" && !match.endsWith("*/")) {
|
|
15
|
+
return match;
|
|
16
|
+
}
|
|
17
|
+
return whitespace ? match.replaceAll(/\S/g, " ") : "";
|
|
18
|
+
})
|
|
19
|
+
), "stripJsonComments");
|
|
20
|
+
|
|
21
|
+
export { stripJsonComments as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const F_OK = require('./F_OK-CWSqQIdF.cjs');
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
const stripJsonComments = /* @__PURE__ */ __name((jsonString, { whitespace = true } = {}) => (
|
|
8
|
+
// This regular expression translates to:
|
|
9
|
+
//
|
|
10
|
+
// /quoted-string|line-comment|block-comment/g
|
|
11
|
+
//
|
|
12
|
+
// This means that comment characters inside of strings will match
|
|
13
|
+
// as strings, not comments, so we can just skip the whole string
|
|
14
|
+
// in the replacer function.
|
|
15
|
+
jsonString.replace(F_OK.INTERNAL_STRIP_JSON_REGEX, (match) => {
|
|
16
|
+
if (match.startsWith('"') || match[1] === "*" && !match.endsWith("*/")) {
|
|
17
|
+
return match;
|
|
18
|
+
}
|
|
19
|
+
return whitespace ? match.replaceAll(/\S/g, " ") : "";
|
|
20
|
+
})
|
|
21
|
+
), "stripJsonComments");
|
|
22
|
+
|
|
23
|
+
module.exports = stripJsonComments;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
const toUint8Array = /* @__PURE__ */ __name((contents) => {
|
|
5
|
+
if (contents instanceof Uint8Array) {
|
|
6
|
+
return contents;
|
|
7
|
+
}
|
|
8
|
+
if (typeof contents === "string") {
|
|
9
|
+
return encoder.encode(contents);
|
|
10
|
+
}
|
|
11
|
+
if (contents instanceof ArrayBuffer) {
|
|
12
|
+
return new Uint8Array(contents);
|
|
13
|
+
}
|
|
14
|
+
if (ArrayBuffer.isView(contents)) {
|
|
15
|
+
const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);
|
|
16
|
+
return new Uint8Array(bytes);
|
|
17
|
+
}
|
|
18
|
+
throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
|
|
19
|
+
}, "toUint8Array");
|
|
20
|
+
|
|
21
|
+
export { toUint8Array as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const encoder = new TextEncoder();
|
|
6
|
+
const toUint8Array = /* @__PURE__ */ __name((contents) => {
|
|
7
|
+
if (contents instanceof Uint8Array) {
|
|
8
|
+
return contents;
|
|
9
|
+
}
|
|
10
|
+
if (typeof contents === "string") {
|
|
11
|
+
return encoder.encode(contents);
|
|
12
|
+
}
|
|
13
|
+
if (contents instanceof ArrayBuffer) {
|
|
14
|
+
return new Uint8Array(contents);
|
|
15
|
+
}
|
|
16
|
+
if (ArrayBuffer.isView(contents)) {
|
|
17
|
+
const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);
|
|
18
|
+
return new Uint8Array(bytes);
|
|
19
|
+
}
|
|
20
|
+
throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
|
|
21
|
+
}, "toUint8Array");
|
|
22
|
+
|
|
23
|
+
exports.toUint8Array = toUint8Array;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const promises = require('node:fs/promises');
|
|
4
|
+
const path = require('@visulima/path');
|
|
5
|
+
const utils = require('@visulima/path/utils');
|
|
6
|
+
const WalkError = require('./WalkError-B7_AVs7d.cjs');
|
|
7
|
+
const assertValidFileOrDirectoryPath = require('./assertValidFileOrDirectoryPath-BMbgA-eI.cjs');
|
|
8
|
+
const walkInclude = require('./walk-include-yUdRrF16.cjs');
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
const _createWalkEntry = /* @__PURE__ */ __name(async (path$1) => {
|
|
13
|
+
const normalizePath = path.normalize(path$1);
|
|
14
|
+
const name = path.basename(normalizePath);
|
|
15
|
+
const info = await promises.stat(normalizePath);
|
|
16
|
+
return {
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
18
|
+
isDirectory: info.isDirectory,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
20
|
+
isFile: info.isFile,
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
22
|
+
isSymbolicLink: info.isSymbolicLink,
|
|
23
|
+
name,
|
|
24
|
+
path: normalizePath
|
|
25
|
+
};
|
|
26
|
+
}, "_createWalkEntry");
|
|
27
|
+
async function* walk(directory, {
|
|
28
|
+
extensions,
|
|
29
|
+
followSymlinks = false,
|
|
30
|
+
includeDirs: includeDirectories = true,
|
|
31
|
+
includeFiles = true,
|
|
32
|
+
includeSymlinks = true,
|
|
33
|
+
match,
|
|
34
|
+
maxDepth = Number.POSITIVE_INFINITY,
|
|
35
|
+
skip
|
|
36
|
+
} = {}) {
|
|
37
|
+
assertValidFileOrDirectoryPath(directory);
|
|
38
|
+
if (maxDepth < 0) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const mappedMatch = match ? match.map((pattern) => typeof pattern === "string" ? walkInclude.globToRegExp(pattern) : pattern) : undefined;
|
|
42
|
+
const mappedSkip = skip ? skip.map((pattern) => typeof pattern === "string" ? walkInclude.globToRegExp(pattern) : pattern) : undefined;
|
|
43
|
+
directory = path.resolve(utils.toPath(directory));
|
|
44
|
+
if (includeDirectories && walkInclude.walkInclude(directory, extensions, mappedMatch, mappedSkip)) {
|
|
45
|
+
yield await _createWalkEntry(directory);
|
|
46
|
+
}
|
|
47
|
+
if (maxDepth < 1 || !walkInclude.walkInclude(directory, undefined, undefined, mappedSkip)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
for await (const entry of await promises.readdir(directory, {
|
|
52
|
+
withFileTypes: true
|
|
53
|
+
})) {
|
|
54
|
+
let path$1 = path.join(directory, entry.name);
|
|
55
|
+
if (entry.isSymbolicLink()) {
|
|
56
|
+
if (followSymlinks) {
|
|
57
|
+
path$1 = await promises.realpath(path$1);
|
|
58
|
+
} else if (includeSymlinks && walkInclude.walkInclude(path$1, extensions, mappedMatch, mappedSkip)) {
|
|
59
|
+
yield {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
61
|
+
isDirectory: entry.isDirectory,
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
63
|
+
isFile: entry.isFile,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
65
|
+
isSymbolicLink: entry.isSymbolicLink,
|
|
66
|
+
name: entry.name,
|
|
67
|
+
path: path$1
|
|
68
|
+
};
|
|
69
|
+
} else {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (entry.isSymbolicLink() || entry.isDirectory()) {
|
|
74
|
+
yield* walk(path$1, {
|
|
75
|
+
extensions,
|
|
76
|
+
followSymlinks,
|
|
77
|
+
includeDirs: includeDirectories,
|
|
78
|
+
includeFiles,
|
|
79
|
+
includeSymlinks,
|
|
80
|
+
match: mappedMatch,
|
|
81
|
+
maxDepth: maxDepth - 1,
|
|
82
|
+
skip: mappedSkip
|
|
83
|
+
});
|
|
84
|
+
} else if (entry.isFile() && includeFiles && walkInclude.walkInclude(path$1, extensions, mappedMatch, mappedSkip)) {
|
|
85
|
+
yield {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
87
|
+
isDirectory: entry.isDirectory,
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
89
|
+
isFile: entry.isFile,
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
91
|
+
isSymbolicLink: entry.isSymbolicLink,
|
|
92
|
+
name: entry.name,
|
|
93
|
+
path: path$1
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (error instanceof WalkError) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
throw new WalkError(error, directory);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
__name(walk, "walk");
|
|
105
|
+
|
|
106
|
+
module.exports = walk;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { readdir, realpath, stat } from 'node:fs/promises';
|
|
2
|
+
import { resolve, join, normalize, basename } from '@visulima/path';
|
|
3
|
+
import { toPath } from '@visulima/path/utils';
|
|
4
|
+
import WalkError from './WalkError-H9EuRv7O.mjs';
|
|
5
|
+
import assertValidFileOrDirectoryPath from './assertValidFileOrDirectoryPath-BWWgA1wj.mjs';
|
|
6
|
+
import { g as globToRegExp, w as walkInclude } from './walk-include-CMUSRa86.mjs';
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
const _createWalkEntry = /* @__PURE__ */ __name(async (path) => {
|
|
11
|
+
const normalizePath = normalize(path);
|
|
12
|
+
const name = basename(normalizePath);
|
|
13
|
+
const info = await stat(normalizePath);
|
|
14
|
+
return {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
16
|
+
isDirectory: info.isDirectory,
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
18
|
+
isFile: info.isFile,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
20
|
+
isSymbolicLink: info.isSymbolicLink,
|
|
21
|
+
name,
|
|
22
|
+
path: normalizePath
|
|
23
|
+
};
|
|
24
|
+
}, "_createWalkEntry");
|
|
25
|
+
async function* walk(directory, {
|
|
26
|
+
extensions,
|
|
27
|
+
followSymlinks = false,
|
|
28
|
+
includeDirs: includeDirectories = true,
|
|
29
|
+
includeFiles = true,
|
|
30
|
+
includeSymlinks = true,
|
|
31
|
+
match,
|
|
32
|
+
maxDepth = Number.POSITIVE_INFINITY,
|
|
33
|
+
skip
|
|
34
|
+
} = {}) {
|
|
35
|
+
assertValidFileOrDirectoryPath(directory);
|
|
36
|
+
if (maxDepth < 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const mappedMatch = match ? match.map((pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern) : undefined;
|
|
40
|
+
const mappedSkip = skip ? skip.map((pattern) => typeof pattern === "string" ? globToRegExp(pattern) : pattern) : undefined;
|
|
41
|
+
directory = resolve(toPath(directory));
|
|
42
|
+
if (includeDirectories && walkInclude(directory, extensions, mappedMatch, mappedSkip)) {
|
|
43
|
+
yield await _createWalkEntry(directory);
|
|
44
|
+
}
|
|
45
|
+
if (maxDepth < 1 || !walkInclude(directory, undefined, undefined, mappedSkip)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
for await (const entry of await readdir(directory, {
|
|
50
|
+
withFileTypes: true
|
|
51
|
+
})) {
|
|
52
|
+
let path = join(directory, entry.name);
|
|
53
|
+
if (entry.isSymbolicLink()) {
|
|
54
|
+
if (followSymlinks) {
|
|
55
|
+
path = await realpath(path);
|
|
56
|
+
} else if (includeSymlinks && walkInclude(path, extensions, mappedMatch, mappedSkip)) {
|
|
57
|
+
yield {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
59
|
+
isDirectory: entry.isDirectory,
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
61
|
+
isFile: entry.isFile,
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
63
|
+
isSymbolicLink: entry.isSymbolicLink,
|
|
64
|
+
name: entry.name,
|
|
65
|
+
path
|
|
66
|
+
};
|
|
67
|
+
} else {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (entry.isSymbolicLink() || entry.isDirectory()) {
|
|
72
|
+
yield* walk(path, {
|
|
73
|
+
extensions,
|
|
74
|
+
followSymlinks,
|
|
75
|
+
includeDirs: includeDirectories,
|
|
76
|
+
includeFiles,
|
|
77
|
+
includeSymlinks,
|
|
78
|
+
match: mappedMatch,
|
|
79
|
+
maxDepth: maxDepth - 1,
|
|
80
|
+
skip: mappedSkip
|
|
81
|
+
});
|
|
82
|
+
} else if (entry.isFile() && includeFiles && walkInclude(path, extensions, mappedMatch, mappedSkip)) {
|
|
83
|
+
yield {
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
85
|
+
isDirectory: entry.isDirectory,
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
87
|
+
isFile: entry.isFile,
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
89
|
+
isSymbolicLink: entry.isSymbolicLink,
|
|
90
|
+
name: entry.name,
|
|
91
|
+
path
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error instanceof WalkError) {
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
throw new WalkError(error, directory);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
__name(walk, "walk");
|
|
103
|
+
|
|
104
|
+
export { walk as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __defProp$1 = Object.defineProperty;
|
|
2
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
3
|
+
const globToRegExp = /* @__PURE__ */ __name$1((glob) => {
|
|
4
|
+
const reString = glob.replace(/\.\*/g, ".([^/]*)").replace(/\*\*/g, "(.*)").replace(/(?<!\.)\*(?!\*)/g, "([^/]*)").replace(/\?/g, "[^/]").replace(/\.(?!\*)/g, "\\.").replace(/\{/g, "(").replace(/\}/g, ")").replace(/,/g, "|").replace(/\[!(.*?)\]/g, "[^$1]");
|
|
5
|
+
return new RegExp(`^${reString}$`);
|
|
6
|
+
}, "globToRegExp");
|
|
7
|
+
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
const walkInclude = /* @__PURE__ */ __name((path, extensions, match, skip) => {
|
|
11
|
+
if (Array.isArray(extensions) && extensions.length > 0 && !extensions.some((extension) => path.endsWith(extension))) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (match && !match.some((pattern) => pattern.test(path))) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return !skip?.some((pattern) => pattern.test(path));
|
|
18
|
+
}, "walkInclude");
|
|
19
|
+
|
|
20
|
+
export { globToRegExp as g, walkInclude as w };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp$1 = Object.defineProperty;
|
|
4
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
5
|
+
const globToRegExp = /* @__PURE__ */ __name$1((glob) => {
|
|
6
|
+
const reString = glob.replace(/\.\*/g, ".([^/]*)").replace(/\*\*/g, "(.*)").replace(/(?<!\.)\*(?!\*)/g, "([^/]*)").replace(/\?/g, "[^/]").replace(/\.(?!\*)/g, "\\.").replace(/\{/g, "(").replace(/\}/g, ")").replace(/,/g, "|").replace(/\[!(.*?)\]/g, "[^$1]");
|
|
7
|
+
return new RegExp(`^${reString}$`);
|
|
8
|
+
}, "globToRegExp");
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
const walkInclude = /* @__PURE__ */ __name((path, extensions, match, skip) => {
|
|
13
|
+
if (Array.isArray(extensions) && extensions.length > 0 && !extensions.some((extension) => path.endsWith(extension))) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (match && !match.some((pattern) => pattern.test(path))) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return !skip?.some((pattern) => pattern.test(path));
|
|
20
|
+
}, "walkInclude");
|
|
21
|
+
|
|
22
|
+
exports.globToRegExp = globToRegExp;
|
|
23
|
+
exports.walkInclude = walkInclude;
|