@visulima/fs 4.0.3 → 4.0.5
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 +35 -0
- package/LICENSE.md +4 -1
- package/dist/constants.d.ts +42 -0
- package/dist/ensure/ensure-dir-sync.d.ts +14 -0
- package/dist/ensure/ensure-dir.d.ts +14 -0
- package/dist/ensure/ensure-file-sync.d.ts +15 -0
- package/dist/ensure/ensure-file.d.ts +27 -0
- package/dist/ensure/ensure-link-sync.d.ts +16 -0
- package/dist/ensure/ensure-link.d.ts +16 -0
- package/dist/ensure/ensure-symlink-sync.d.ts +23 -0
- package/dist/ensure/ensure-symlink.d.ts +23 -0
- package/dist/ensure/utils/get-file-info-type.d.ts +7 -0
- package/dist/ensure/utils/is-stats-identical.d.ts +3 -0
- package/dist/ensure/utils/resolve-symlink-target.d.ts +2 -0
- package/dist/eol.d.ts +35 -7
- package/dist/eol.js +26 -3
- package/dist/error/already-exists-error.d.ts +39 -0
- package/dist/error/directory-error.d.ts +47 -0
- package/dist/error/json-error.d.ts +52 -0
- package/dist/error/not-empty-error.d.ts +51 -0
- package/dist/error/not-found-error.d.ts +44 -0
- package/dist/error/permission-error.d.ts +45 -0
- package/dist/error/walk-error.d.ts +51 -0
- package/dist/error.d.ts +7 -50
- package/dist/error.js +7 -1
- package/dist/find/collect-sync.d.ts +31 -0
- package/dist/find/collect.d.ts +35 -0
- package/dist/find/find-up-sync.d.ts +42 -0
- package/dist/find/find-up.d.ts +46 -0
- package/dist/find/utils/glob-to-regex.d.ts +2 -0
- package/dist/find/utils/walk-include.d.ts +2 -0
- package/dist/find/walk-sync.d.ts +26 -0
- package/dist/find/walk.d.ts +29 -0
- package/dist/index.d.ts +34 -136
- package/dist/index.js +32 -1
- package/dist/is-accessible-sync.d.ts +3 -0
- package/dist/is-accessible.d.ts +29 -0
- package/dist/move/index.d.ts +70 -0
- package/dist/move/types.d.ts +38 -0
- package/dist/move/utils/internal-move-file-sync.d.ts +3 -0
- package/dist/move/utils/internal-move-file.d.ts +3 -0
- package/dist/move/utils/validate-same-directory.d.ts +2 -0
- package/dist/packem_shared/AlreadyExistsError-D5BGeeNR.js +27 -0
- package/dist/packem_shared/DirectoryError-CaUV2Pbk.js +27 -0
- package/dist/packem_shared/F_OK-BalxCn9n.js +8 -0
- package/dist/packem_shared/JSONError-BkHRnInH.js +26 -0
- package/dist/packem_shared/NotEmptyError-mOHWXE0m.js +27 -0
- package/dist/packem_shared/NotFoundError-D4llRgRs.js +27 -0
- package/dist/packem_shared/PermissionError-1qs0skfo.js +27 -0
- package/dist/packem_shared/WalkError-DUdQd6FT.js +24 -0
- package/dist/packem_shared/assertValidFileContents-BmcLtsGd.js +7 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js +7 -0
- package/dist/packem_shared/collect-DcBwsYYd.js +14 -0
- package/dist/packem_shared/collectSync-Bkjf9Dbm.js +14 -0
- package/dist/packem_shared/emptyDir-CYB5Tict.js +43 -0
- package/dist/packem_shared/emptyDirSync-BD8-1Ytl.js +41 -0
- package/dist/packem_shared/ensureDir-C_kuQ5Ik.js +53 -0
- package/dist/packem_shared/ensureDirSync-CI5g-uBI.js +53 -0
- package/dist/packem_shared/ensureFile-BUtXGlGT.js +47 -0
- package/dist/packem_shared/ensureFileSync-C8hASR-1.js +47 -0
- package/dist/packem_shared/ensureLink-BPnAG5-P.js +54 -0
- package/dist/packem_shared/ensureLinkSync-B-Z7X0ub.js +54 -0
- package/dist/packem_shared/ensureSymlink-BGz6W-Wa.js +73 -0
- package/dist/packem_shared/ensureSymlinkSync-C5Gk8QYi.js +74 -0
- package/dist/packem_shared/findUp-Lv9mZCIQ.js +85 -0
- package/dist/packem_shared/findUpSync-BsK4Nrrq.js +85 -0
- package/dist/packem_shared/get-file-info-type-FD4-jsyg.js +14 -0
- package/dist/packem_shared/index-CHM-in-V.js +100 -0
- package/dist/packem_shared/is-stats-identical-D8FxpvQU.js +3 -0
- package/dist/packem_shared/isAccessible-iOp0Bou6.js +38 -0
- package/dist/packem_shared/isAccessibleSync-38BmiIcx.js +38 -0
- package/dist/packem_shared/isFsCaseSensitive-D-ayleCy.js +62 -0
- package/dist/packem_shared/move-BD6JbYSu.js +134 -0
- package/dist/packem_shared/parseJson-CqUuRguZ.js +231 -0
- package/dist/packem_shared/readFile-XVOjAw8r.js +65 -0
- package/dist/packem_shared/readFileSync-B9Zg5PSF.js +53 -0
- package/dist/packem_shared/readJson-Dra2m6s-.js +22 -0
- package/dist/packem_shared/readJsonSync-B6Dl1I_6.js +22 -0
- package/dist/packem_shared/readYaml-Bu1nsexB.js +10 -0
- package/dist/packem_shared/readYamlSync-Di88aMME.js +10 -0
- package/dist/packem_shared/remove-_oDY3uKo.js +38 -0
- package/dist/packem_shared/removeSync-DETRj7Qn.js +38 -0
- package/dist/packem_shared/resolve-symlink-target-Kh4GovFf.js +16 -0
- package/dist/packem_shared/stripJsonComments-21XWVDwP.js +19 -0
- package/dist/packem_shared/to-uint-8-array-Dz2nF1y1.js +19 -0
- package/dist/packem_shared/walk-BhTbpr3y.js +115 -0
- package/dist/packem_shared/walk-include-CZco7BvN.js +16 -0
- package/dist/packem_shared/walkSync-DDBq95s8.js +114 -0
- package/dist/packem_shared/writeFile-NT1fLEEe.js +83 -0
- package/dist/packem_shared/writeFileSync-Bj5UDSf0.js +83 -0
- package/dist/packem_shared/writeJson-DQLdAi0d.js +50 -0
- package/dist/packem_shared/writeJsonSync-DvTCjVUi.js +50 -0
- package/dist/packem_shared/writeYaml-BMY0kOPf.js +24 -0
- package/dist/packem_shared/writeYamlSync-DqPu8cCd.js +24 -0
- package/dist/read/read-file-sync.d.ts +37 -0
- package/dist/read/read-file.d.ts +41 -0
- package/dist/read/read-json-sync.d.ts +5 -0
- package/dist/read/read-json.d.ts +5 -0
- package/dist/read/read-yaml-sync.d.ts +4 -0
- package/dist/read/read-yaml.d.ts +4 -0
- package/dist/remove/empty-dir-sync.d.ts +24 -0
- package/dist/remove/empty-dir.d.ts +28 -0
- package/dist/remove/remove-sync.d.ts +28 -0
- package/dist/remove/remove.d.ts +32 -0
- package/dist/size.d.ts +245 -12
- package/dist/size.js +144 -1
- package/dist/types.d.ts +299 -0
- package/dist/utils/assert-valid-file-contents.d.ts +27 -0
- package/dist/utils/assert-valid-file-or-directory-path.d.ts +26 -0
- package/dist/utils/parse-json.d.ts +5 -0
- package/dist/utils/strip-json-comments.d.ts +44 -0
- package/dist/utils.d.ts +6 -19
- package/dist/utils.js +6 -1
- package/dist/write/utils/to-uint-8-array.d.ts +2 -0
- package/dist/write/write-file-sync.d.ts +30 -0
- package/dist/write/write-file.d.ts +30 -0
- package/dist/write/write-json-sync.d.ts +30 -0
- package/dist/write/write-json.d.ts +30 -0
- package/dist/write/write-yaml-sync.d.ts +4 -0
- package/dist/write/write-yaml.d.ts +4 -0
- package/dist/yaml.d.ts +5 -17
- package/dist/yaml.js +4 -1
- package/package.json +2 -3
- package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +0 -1
- package/dist/packem_shared/DirectoryError-ddlbUV8C.js +0 -1
- package/dist/packem_shared/F_OK-CAwY1qU7.js +0 -1
- package/dist/packem_shared/JSONError-D7h6PNWc.js +0 -4
- package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +0 -1
- package/dist/packem_shared/NotFoundError-BPiW0icm.js +0 -1
- package/dist/packem_shared/PermissionError-B1Emi5a9.js +0 -1
- package/dist/packem_shared/WalkError-BsngoIKJ.js +0 -1
- package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +0 -1
- package/dist/packem_shared/collect-DO31RsLs.js +0 -1
- package/dist/packem_shared/collectSync-Cy7ULmjZ.js +0 -1
- package/dist/packem_shared/emptyDir-zBLHyPsJ.js +0 -1
- package/dist/packem_shared/emptyDirSync-DZ8nTo6g.js +0 -1
- package/dist/packem_shared/ensureDir-CwcwvbZ0.js +0 -1
- package/dist/packem_shared/ensureDirSync-DsFhH5oQ.js +0 -1
- package/dist/packem_shared/ensureFile-DwcEQVDX.js +0 -1
- package/dist/packem_shared/ensureFileSync-KnrH51Ox.js +0 -1
- package/dist/packem_shared/ensureLink-5rjQGEBb.js +0 -1
- package/dist/packem_shared/ensureLinkSync-CYXpscf2.js +0 -1
- package/dist/packem_shared/ensureSymlink-GATTbE5c.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-CvXgTFrl.js +0 -1
- package/dist/packem_shared/findUp-Di7Az07S.js +0 -1
- package/dist/packem_shared/findUpSync-iV97v14Q.js +0 -1
- package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +0 -1
- package/dist/packem_shared/index-CYIVJA0W.js +0 -1
- package/dist/packem_shared/is-stats-identical-CohsLtWy.js +0 -1
- package/dist/packem_shared/isAccessible-CDFxsAAo.js +0 -1
- package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +0 -1
- package/dist/packem_shared/isFsCaseSensitive-Drl8fHLV.js +0 -1
- package/dist/packem_shared/json-error-ZPgZIXcg.d.ts +0 -11
- package/dist/packem_shared/move-Bz4gSIjp.js +0 -1
- package/dist/packem_shared/parseJson-Cj4v3qzl.js +0 -6
- package/dist/packem_shared/readFile-CbxFM_zp.js +0 -1
- package/dist/packem_shared/readFileSync-B9iv2Sb8.js +0 -1
- package/dist/packem_shared/readJson-BgC3msx-.js +0 -1
- package/dist/packem_shared/readJsonSync-DHO1vjAG.js +0 -1
- package/dist/packem_shared/readYaml-D5mtfANg.js +0 -1
- package/dist/packem_shared/readYamlSync-D0igCVDE.js +0 -1
- package/dist/packem_shared/remove-BUqZUj1W.js +0 -1
- package/dist/packem_shared/removeSync-BbT4vmDi.js +0 -1
- package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +0 -1
- package/dist/packem_shared/stripJsonComments-DbMjL4qv.js +0 -1
- package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +0 -1
- package/dist/packem_shared/types-T308NKwz.d.ts +0 -90
- package/dist/packem_shared/walk-ZrZngpc4.js +0 -1
- package/dist/packem_shared/walk-include-DCiVAwMP.js +0 -1
- package/dist/packem_shared/walkSync-BQa4NKSG.js +0 -1
- package/dist/packem_shared/writeFile-D5OYEMHu.js +0 -1
- package/dist/packem_shared/writeFileSync-CO4ySqUn.js +0 -1
- package/dist/packem_shared/writeJson-DfmgiY_s.js +0 -4
- package/dist/packem_shared/writeJsonSync-Ck1pmmj_.js +0 -4
- package/dist/packem_shared/writeYaml-BJeyUpyY.js +0 -1
- package/dist/packem_shared/writeYamlSync-D87XCS7Y.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## @visulima/fs [4.0.5](https://github.com/visulima/visulima/compare/@visulima/fs@4.0.4...@visulima/fs@4.0.5) (2025-11-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deps:** update type-fest dependency across multiple packages ([93e13be](https://github.com/visulima/visulima/commit/93e13be5248207968a96303710db2a0604d16b9b))
|
|
6
|
+
* update package configurations and TypeScript definitions ([b59aa59](https://github.com/visulima/visulima/commit/b59aa59dac1508216b944f4b917fb4a7ab1f70a4))
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* Add jsr file to all packages for release ([#565](https://github.com/visulima/visulima/issues/565)) ([ec91652](https://github.com/visulima/visulima/commit/ec91652b4e4112adf14ba152c1239a7703ba425a))
|
|
11
|
+
* update license files and clean up TypeScript definitions ([fe668cc](https://github.com/visulima/visulima/commit/fe668cc26de23591d4df54a0954455ebbe31b22d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* **@visulima/path:** upgraded to 2.0.4
|
|
17
|
+
* **@visulima/error:** upgraded to 5.0.5
|
|
18
|
+
|
|
19
|
+
## @visulima/fs [4.0.4](https://github.com/visulima/visulima/compare/@visulima/fs@4.0.3...@visulima/fs@4.0.4) (2025-11-07)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* update TypeScript configurations and improve linting across multiple packages ([6f25ec7](https://github.com/visulima/visulima/commit/6f25ec7841da7246f8f9166efc5292a7089d37ee))
|
|
24
|
+
|
|
25
|
+
### Miscellaneous Chores
|
|
26
|
+
|
|
27
|
+
* update npm and pnpm configurations for monorepo optimization ([#564](https://github.com/visulima/visulima/issues/564)) ([5512b42](https://github.com/visulima/visulima/commit/5512b42f672c216b6a3c9e39035199a4ebd9a4b8))
|
|
28
|
+
* update package.json files and pnpm-lock.yaml ([95d9f5b](https://github.com/visulima/visulima/commit/95d9f5b607105d05a006deadb4379e89f06dfe99))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
* **@visulima/path:** upgraded to 2.0.3
|
|
34
|
+
* **@visulima/error:** upgraded to 5.0.4
|
|
35
|
+
|
|
1
36
|
## @visulima/fs [4.0.3](https://github.com/visulima/visulima/compare/@visulima/fs@4.0.2...@visulima/fs@4.0.3) (2025-11-05)
|
|
2
37
|
|
|
3
38
|
### Bug Fixes
|
package/LICENSE.md
CHANGED
|
@@ -68,7 +68,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
68
68
|
>
|
|
69
69
|
> > MIT License
|
|
70
70
|
> >
|
|
71
|
-
> > Copyright (c)
|
|
71
|
+
> > Copyright (c) 2025 visulima
|
|
72
72
|
> >
|
|
73
73
|
> > Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
74
74
|
> > of this software and associated documentation files (the "Software"), to deal
|
|
@@ -252,11 +252,14 @@ Repository: privatenumber/is-fs-case-sensitive
|
|
|
252
252
|
<!-- TYPE_DEPENDENCIES -->
|
|
253
253
|
|
|
254
254
|
# Licenses of bundled types
|
|
255
|
+
|
|
255
256
|
The published @visulima/fs artifact additionally contains code with the following licenses:
|
|
256
257
|
MIT
|
|
257
258
|
|
|
258
259
|
# Bundled types:
|
|
260
|
+
|
|
259
261
|
## is-fs-case-sensitive
|
|
262
|
+
|
|
260
263
|
License: MIT
|
|
261
264
|
By: Hiroki Osame
|
|
262
265
|
Repository: privatenumber/is-fs-case-sensitive
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constant to check if the path is visible to the calling process.
|
|
3
|
+
* Corresponds to `node:fs.constants.F_OK`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const F_OK: number;
|
|
6
|
+
/**
|
|
7
|
+
* Constant to check if the path is readable to the calling process.
|
|
8
|
+
* Corresponds to `node:fs.constants.R_OK`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const R_OK: number;
|
|
11
|
+
/**
|
|
12
|
+
* Constant to check if the path is writable to the calling process.
|
|
13
|
+
* Corresponds to `node:fs.constants.W_OK`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const W_OK: number;
|
|
16
|
+
/**
|
|
17
|
+
* Constant to check if the path is executable by the calling process.
|
|
18
|
+
* Corresponds to `node:fs.constants.X_OK`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const X_OK: number;
|
|
21
|
+
/**
|
|
22
|
+
* A special symbol that can be returned by the matcher function in `findUp` or `findUpSync`
|
|
23
|
+
* to stop the search process prematurely.
|
|
24
|
+
*/
|
|
25
|
+
export declare const FIND_UP_STOP: symbol;
|
|
26
|
+
/**
|
|
27
|
+
* Regular expression for stripping comments from JSON.
|
|
28
|
+
* Matches:
|
|
29
|
+
* 1. Quoted strings: "example \"escaped\" string"
|
|
30
|
+
* 2. Single-line comments: // comment
|
|
31
|
+
* 3. Multi-line comments: /* comment *\/
|
|
32
|
+
* @example
|
|
33
|
+
* const json = `{
|
|
34
|
+
* // comment
|
|
35
|
+
* "key": "value" // comment
|
|
36
|
+
* }`;
|
|
37
|
+
* json.replace(INTERNAL_STRIP_JSON_REGEX, (match) =>
|
|
38
|
+
* /^"/.test(match) ? match : ''
|
|
39
|
+
* );
|
|
40
|
+
* // Result: { "key": "value" }
|
|
41
|
+
*/
|
|
42
|
+
export declare const INTERNAL_STRIP_JSON_REGEX: RegExp;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the directory exists.
|
|
3
|
+
* If the directory structure does not exist, it is created. Like mkdir -p.
|
|
4
|
+
* @param directory The path to the directory to ensure exists.
|
|
5
|
+
* @example
|
|
6
|
+
* ```javascript
|
|
7
|
+
* import ensureDirSync from "@visulima/fs/ensure/ensure-dir-sync";
|
|
8
|
+
*
|
|
9
|
+
* ensureDirSync("/tmp/foo/bar/baz");
|
|
10
|
+
* // Creates the directory structure /tmp/foo/bar/baz if it doesn't exist
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const ensureDirSync: (directory: URL | string) => void;
|
|
14
|
+
export default ensureDirSync;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the directory exists.
|
|
3
|
+
* If the directory structure does not exist, it is created. Like mkdir -p.
|
|
4
|
+
* @param directory The path to the directory to ensure exists.
|
|
5
|
+
* @example
|
|
6
|
+
* ```javascript
|
|
7
|
+
* import ensureDir from "@visulima/fs/ensure/ensure-dir";
|
|
8
|
+
*
|
|
9
|
+
* await ensureDir("/tmp/foo/bar/baz");
|
|
10
|
+
* // Creates the directory structure /tmp/foo/bar/baz if it doesn't exist
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const ensureDir: (directory: URL | string) => Promise<void>;
|
|
14
|
+
export default ensureDir;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the file exists.
|
|
3
|
+
* If the file that is requested to be created is in directories that do not exist,
|
|
4
|
+
* these directories are created. If the file already exists, it is NOT MODIFIED.
|
|
5
|
+
* @param filePath The path to the file to ensure exists.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { ensureFileSync } from "@visulima/fs";
|
|
9
|
+
*
|
|
10
|
+
* ensureFileSync("/tmp/foo/bar/baz.txt");
|
|
11
|
+
* // Creates the file /tmp/foo/bar/baz.txt and any missing parent directories if they don't exist
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare const ensureFileSync: (filePath: URL | string) => void;
|
|
15
|
+
export default ensureFileSync;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asynchronously ensures that a file exists.
|
|
3
|
+
* If the directory structure for the file does not exist, it is created.
|
|
4
|
+
* If the file already exists, it is not modified.
|
|
5
|
+
* @param filePath The path to the file. Can be a string or a URL object.
|
|
6
|
+
* @returns A Promise that resolves when the file has been created or confirmed to exist.
|
|
7
|
+
* @throws Will throw an error if the path exists and is not a file.
|
|
8
|
+
* @throws Will throw an error if directory or file creation fails for reasons other than the path not existing initially.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { ensureFile } from "@visulima/fs";
|
|
12
|
+
*
|
|
13
|
+
* (async () => {
|
|
14
|
+
* try {
|
|
15
|
+
* await ensureFile("path/to/my/file.txt");
|
|
16
|
+
* console.log("File ensured!");
|
|
17
|
+
*
|
|
18
|
+
* await ensureFile(new URL("file:///path/to/another/file.log"));
|
|
19
|
+
* console.log("Another file ensured!");
|
|
20
|
+
* } catch (error) {
|
|
21
|
+
* console.error("Failed to ensure file:", error);
|
|
22
|
+
* }
|
|
23
|
+
* })();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare const ensureFile: (filePath: URL | string) => Promise<void>;
|
|
27
|
+
export default ensureFile;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the hard link exists.
|
|
3
|
+
* If the directory structure does not exist, it is created.
|
|
4
|
+
* @param source The path to the source file or directory.
|
|
5
|
+
* @param destination The path to the destination link.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { ensureLinkSync } from "@visulima/fs";
|
|
9
|
+
* import { join } from "node:path";
|
|
10
|
+
*
|
|
11
|
+
* // ensure the link /tmp/foo/bar-link.txt points to /tmp/foo/bar.txt
|
|
12
|
+
* ensureLinkSync(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "bar-link.txt"));
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare const ensureLinkSync: (source: URL | string, destination: URL | string) => void;
|
|
16
|
+
export default ensureLinkSync;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures that the hard link exists.
|
|
3
|
+
* If the directory structure does not exist, it is created.
|
|
4
|
+
* @param source The path to the source file or directory.
|
|
5
|
+
* @param destination The path to the destination link.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { ensureLink } from "@visulima/fs";
|
|
9
|
+
* import { join } from "node:path";
|
|
10
|
+
*
|
|
11
|
+
* // ensure the link /tmp/foo/bar-link.txt points to /tmp/foo/bar.txt
|
|
12
|
+
* await ensureLink(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "bar-link.txt"));
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
declare const ensureLink: (source: URL | string, destination: URL | string) => Promise<void>;
|
|
16
|
+
export default ensureLink;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { symlink } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that the link exists, and points to a valid file.
|
|
4
|
+
* If the directory structure does not exist, it is created.
|
|
5
|
+
* If the link already exists, it is not modified but error is thrown if it is not point to the given target.
|
|
6
|
+
* @param target the source file path
|
|
7
|
+
* @param linkName the destination link path
|
|
8
|
+
* @param type the type of the symlink, or null to use automatic detection
|
|
9
|
+
* @returns A void.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* import { ensureSymlinkSync } from "@visulima/fs";
|
|
13
|
+
* import { join } from "node:path";
|
|
14
|
+
*
|
|
15
|
+
* // Ensure a symlink /tmp/foo/link-to-bar.txt points to /tmp/foo/bar.txt
|
|
16
|
+
* ensureSymlinkSync(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "link-to-bar.txt"));
|
|
17
|
+
*
|
|
18
|
+
* // Ensure a directory symlink /tmp/foo/link-to-baz-dir points to /tmp/foo/baz-dir
|
|
19
|
+
* ensureSymlinkSync(join("/tmp", "foo", "baz-dir"), join("/tmp", "foo", "link-to-baz-dir"), "dir");
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const ensureSymlinkSync: (target: URL | string, linkName: URL | string, type?: symlink.Type) => void;
|
|
23
|
+
export default ensureSymlinkSync;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { symlink as symlinkSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Ensures that the link exists, and points to a valid file.
|
|
4
|
+
* If the directory structure does not exist, it is created.
|
|
5
|
+
* If the link already exists, it is not modified but error is thrown if it is not point to the given target.
|
|
6
|
+
* @param target the source file path
|
|
7
|
+
* @param linkName the destination link path
|
|
8
|
+
* @param type the type of the symlink, or null to use automatic detection
|
|
9
|
+
* @returns A void promise that resolves once the link exists.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* import { ensureSymlink } from "@visulima/fs";
|
|
13
|
+
* import { join } from "node:path";
|
|
14
|
+
*
|
|
15
|
+
* // Ensure a symlink /tmp/foo/link-to-bar.txt points to /tmp/foo/bar.txt
|
|
16
|
+
* await ensureSymlink(join("/tmp", "foo", "bar.txt"), join("/tmp", "foo", "link-to-bar.txt"));
|
|
17
|
+
*
|
|
18
|
+
* // Ensure a directory symlink /tmp/foo/link-to-baz-dir points to /tmp/foo/baz-dir
|
|
19
|
+
* await ensureSymlink(join("/tmp", "foo", "baz-dir"), join("/tmp", "foo", "link-to-baz-dir"), "dir");
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const ensureSymlink: (target: URL | string, linkName: URL | string, type?: symlinkSync.Type) => Promise<void>;
|
|
23
|
+
export default ensureSymlink;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Stats } from "node:fs";
|
|
2
|
+
export type PathType = "dir" | "file" | "symlink";
|
|
3
|
+
/**
|
|
4
|
+
* Get a human-readable file type string.
|
|
5
|
+
* @param fileInfo A FileInfo describes a file and is returned by `stat`, `lstat`
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFileInfoType: (fileInfo: Stats) => PathType | undefined;
|
package/dist/eol.d.ts
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/** End-of-line character for POSIX platforms such as macOS and Linux. */
|
|
2
|
+
export declare const LF: "\n";
|
|
3
|
+
/** End-of-line character for Windows platforms. */
|
|
4
|
+
export declare const CRLF: "\r\n";
|
|
5
|
+
/**
|
|
6
|
+
* End-of-line character evaluated for the current platform.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EOL: "\n" | "\r\n";
|
|
9
|
+
/**
|
|
10
|
+
* Detect the EOL character for string input.
|
|
11
|
+
* Returns null if no newline.
|
|
12
|
+
* @param content The string content to detect the EOL from.
|
|
13
|
+
* @example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* import { detect } from "@visulima/fs/eol";
|
|
16
|
+
*
|
|
17
|
+
* detect("Hello\r\nWorld"); // "\r\n"
|
|
18
|
+
* detect("Hello\nWorld"); // "\n"
|
|
19
|
+
* detect("HelloWorld"); // null
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const detect: (content: string) => typeof EOL | null;
|
|
23
|
+
/**
|
|
24
|
+
* Format the file to the targeted EOL.
|
|
25
|
+
* @param content The string content to format.
|
|
26
|
+
* @param eol The target EOL character.
|
|
27
|
+
* @example
|
|
28
|
+
* ```javascript
|
|
29
|
+
* import { format, LF, CRLF } from "@visulima/fs/eol";
|
|
30
|
+
*
|
|
31
|
+
* format("Hello\r\nWorld\nUnix", LF); // "Hello\nWorld\nUnix"
|
|
32
|
+
* format("Hello\nWorld\r\nWindows", CRLF); // "Hello\r\nWorld\r\nWindows"
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const format: (content: string, eol: typeof EOL) => string;
|
package/dist/eol.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 {
|
|
8
|
+
platform
|
|
9
|
+
} = __cjs_getProcess;
|
|
10
|
+
|
|
11
|
+
const regDetect = /\r?\n/g;
|
|
12
|
+
const LF = "\n";
|
|
13
|
+
const CRLF = "\r\n";
|
|
14
|
+
const EOL = platform === "win32" ? CRLF : LF;
|
|
15
|
+
const detect = (content) => {
|
|
16
|
+
const matched = content.match(regDetect);
|
|
17
|
+
if (!matched || matched.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const crlf = matched.filter((newline) => newline === CRLF).length;
|
|
21
|
+
const lf = matched.length - crlf;
|
|
22
|
+
return crlf > lf ? CRLF : LF;
|
|
23
|
+
};
|
|
24
|
+
const format = (content, eol) => content.replaceAll(regDetect, eol);
|
|
25
|
+
|
|
26
|
+
export { CRLF, EOL, LF, detect, format };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a file or directory already exists at a specified path, and an operation was expecting it not to.
|
|
3
|
+
* @example
|
|
4
|
+
* ```javascript
|
|
5
|
+
* import { AlreadyExistsError } from "@visulima/fs/error"; // Assuming it's exported from an index or directly
|
|
6
|
+
* import { ensureSymlinkSync } from "@visulima/fs"; // Or any function that might throw this
|
|
7
|
+
* import { join } from "node:path";
|
|
8
|
+
*
|
|
9
|
+
* try {
|
|
10
|
+
* // Example: ensureSymlinkSync might throw this if a file (not a symlink) already exists at linkName
|
|
11
|
+
* // For demonstration, let's assume someFunction internally throws it:
|
|
12
|
+
* const someFunctionThatMightThrow = (path) => {
|
|
13
|
+
* if (path === "/tmp/existing-file.txt") { // Simulate a check
|
|
14
|
+
* throw new AlreadyExistsError(`file already exists at '/tmp/existing-file.txt'`);
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* someFunctionThatMightThrow("/tmp/existing-file.txt");
|
|
18
|
+
* } catch (error) {
|
|
19
|
+
* if (error instanceof AlreadyExistsError) {
|
|
20
|
+
* console.error(`Operation failed because path exists: ${error.message}`);
|
|
21
|
+
* console.error(`Error code: ${error.code}`); // EEXIST
|
|
22
|
+
* } else {
|
|
23
|
+
* console.error("An unexpected error occurred:", error);
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare class AlreadyExistsError extends Error {
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new instance.
|
|
31
|
+
* @param message The error message.
|
|
32
|
+
*/
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
get code(): string;
|
|
35
|
+
set code(_name: string);
|
|
36
|
+
get name(): string;
|
|
37
|
+
set name(_name: string);
|
|
38
|
+
}
|
|
39
|
+
export default AlreadyExistsError;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when an operation that is not allowed on a directory is attempted.
|
|
3
|
+
* This typically occurs when a file-specific operation is used on a directory path.
|
|
4
|
+
* @example
|
|
5
|
+
* ```javascript
|
|
6
|
+
* import { DirectoryError } from "@visulima/fs/error";
|
|
7
|
+
* import { readFile } from "@visulima/fs"; // Or any function that might throw this
|
|
8
|
+
* import { join } from "node:path";
|
|
9
|
+
*
|
|
10
|
+
* const attemptToReadFileFromDir = async () => {
|
|
11
|
+
* try {
|
|
12
|
+
* // Attempting to read a directory as if it were a file
|
|
13
|
+
* // This is a conceptual example; readFile might throw a different error first
|
|
14
|
+
* // depending on its internal checks, but EISDIR is the underlying system error.
|
|
15
|
+
* // Forcing the scenario:
|
|
16
|
+
* const pretendReadFileOnDir = (path) => {
|
|
17
|
+
* if (path === "/tmp/my-directory") { // Simulate a directory path
|
|
18
|
+
* throw new DirectoryError(`read '/tmp/my-directory'`);
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* pretendReadFileOnDir("/tmp/my-directory");
|
|
22
|
+
* // await readFile(join("/tmp", "my-directory"));
|
|
23
|
+
* } catch (error) {
|
|
24
|
+
* if (error instanceof DirectoryError) {
|
|
25
|
+
* console.error(`Operation failed, path is a directory: ${error.message}`);
|
|
26
|
+
* console.error(`Error code: ${error.code}`); // EISDIR
|
|
27
|
+
* } else {
|
|
28
|
+
* console.error("An unexpected error occurred:", error);
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* attemptToReadFileFromDir();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare class DirectoryError extends Error {
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new instance.
|
|
39
|
+
* @param message The error message.
|
|
40
|
+
*/
|
|
41
|
+
constructor(message: string);
|
|
42
|
+
get code(): string;
|
|
43
|
+
set code(_name: string);
|
|
44
|
+
get name(): string;
|
|
45
|
+
set name(_name: string);
|
|
46
|
+
}
|
|
47
|
+
export default DirectoryError;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error class for handling JSON parsing or related errors.
|
|
3
|
+
* It can optionally include a file name and a code frame for better debugging.
|
|
4
|
+
* @example
|
|
5
|
+
* ```javascript
|
|
6
|
+
* import { JSONError } from "@visulima/fs/error";
|
|
7
|
+
* import { readJsonSync } from "@visulima/fs"; // Or any function that might throw this
|
|
8
|
+
* import { join } from "node:path";
|
|
9
|
+
*
|
|
10
|
+
* try {
|
|
11
|
+
* // Imagine readJsonSync encounters a malformed JSON file and throws JSONError
|
|
12
|
+
* // Forcing the scenario for demonstration:
|
|
13
|
+
* const simulateJsonError = (filePath, content) => {
|
|
14
|
+
* const err = new JSONError(`Unexpected token '}' at position 15`);
|
|
15
|
+
* err.fileName = filePath;
|
|
16
|
+
* // A real implementation might generate a code frame using a library
|
|
17
|
+
* err.codeFrame = ` 13 | "key": "value",
|
|
18
|
+
* > 14 | "anotherKey": "anotherValue",}
|
|
19
|
+
* | ^
|
|
20
|
+
* 15 | "lastKey": "end"
|
|
21
|
+
* `;
|
|
22
|
+
* throw err;
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* simulateJsonError(join("path", "to", "corrupted.json"), '{ "key": "value", "anotherKey": "anotherValue",} ');
|
|
26
|
+
* // const jsonData = readJsonSync(join("path", "to", "corrupted.json"));
|
|
27
|
+
* } catch (error) {
|
|
28
|
+
* if (error instanceof JSONError) {
|
|
29
|
+
* console.error(`JSON Error: ${error.message}`);
|
|
30
|
+
* // message property will include fileName and codeFrame if they were set.
|
|
31
|
+
* // console.error(`File: ${error.fileName}`);
|
|
32
|
+
* // console.error(`Code Frame:\n${error.codeFrame}`);
|
|
33
|
+
* } else {
|
|
34
|
+
* console.error("An unexpected error occurred:", error);
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare class JSONError extends Error {
|
|
40
|
+
#private;
|
|
41
|
+
fileName: string | undefined;
|
|
42
|
+
codeFrame: string | undefined;
|
|
43
|
+
readonly name = "JSONError";
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new JSONError instance.
|
|
46
|
+
* @param message The primary error message.
|
|
47
|
+
*/
|
|
48
|
+
constructor(message: string);
|
|
49
|
+
get message(): string;
|
|
50
|
+
set message(message: string);
|
|
51
|
+
}
|
|
52
|
+
export default JSONError;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a directory is not empty.
|
|
3
|
+
* @example
|
|
4
|
+
* ```javascript
|
|
5
|
+
* import { NotEmptyError } from "@visulima/fs/error";
|
|
6
|
+
* import { rmdir } from "node:fs/promises"; // Or any fs function that might throw this system error
|
|
7
|
+
* import { join } from "node:path";
|
|
8
|
+
*
|
|
9
|
+
* const attemptToRemoveNonEmptyDir = async () => {
|
|
10
|
+
* const dirPath = join("/tmp", "my-non-empty-dir"); // Assume this directory exists and has files
|
|
11
|
+
* try {
|
|
12
|
+
* // Forcing the scenario for demonstration, as rmdir might throw its own specific error.
|
|
13
|
+
* // Node.js fs operations that encounter a non-empty directory when expecting an empty one
|
|
14
|
+
* // typically throw an error with code ENOTEMPTY.
|
|
15
|
+
* const simulateNotEmpty = (path) => {
|
|
16
|
+
* if (path === dirPath) { // Simulate check for non-empty
|
|
17
|
+
* throw new NotEmptyError(`rmdir '${dirPath}'`);
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* simulateNotEmpty(dirPath);
|
|
21
|
+
* // await rmdir(dirPath); // This would likely throw an error with code ENOTEMPTY
|
|
22
|
+
* } catch (error) {
|
|
23
|
+
* if (error instanceof NotEmptyError) {
|
|
24
|
+
* console.error(`Operation failed, directory is not empty: ${error.message}`);
|
|
25
|
+
* console.error(`Error code: ${error.code}`); // ENOTEMPTY
|
|
26
|
+
* } else {
|
|
27
|
+
* console.error("An unexpected error occurred:", error);
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* };
|
|
31
|
+
*
|
|
32
|
+
* // You would need to set up a non-empty directory at /tmp/my-non-empty-dir for a real test
|
|
33
|
+
* // import { ensureDirSync, writeFileSync } from "@visulima/fs";
|
|
34
|
+
* // ensureDirSync(dirPath);
|
|
35
|
+
* // writeFileSync(join(dirPath, "somefile.txt"), "content");
|
|
36
|
+
*
|
|
37
|
+
* attemptToRemoveNonEmptyDir();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare class NotEmptyError extends Error {
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new instance.
|
|
43
|
+
* @param message The error message.
|
|
44
|
+
*/
|
|
45
|
+
constructor(message: string);
|
|
46
|
+
get code(): string;
|
|
47
|
+
set code(_name: string);
|
|
48
|
+
get name(): string;
|
|
49
|
+
set name(_name: string);
|
|
50
|
+
}
|
|
51
|
+
export default NotEmptyError;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a file or directory is not found at a specified path.
|
|
3
|
+
* @example
|
|
4
|
+
* ```javascript
|
|
5
|
+
* import { NotFoundError } from "@visulima/fs/error";
|
|
6
|
+
* import { readFile } from "@visulima/fs"; // Or any function that might throw this
|
|
7
|
+
* import { join } from "node:path";
|
|
8
|
+
*
|
|
9
|
+
* const tryReadingNonExistentFile = async () => {
|
|
10
|
+
* const filePath = join("/tmp", "this-file-does-not-exist.txt");
|
|
11
|
+
* try {
|
|
12
|
+
* // Forcing the scenario for demonstration, as readFile itself would throw this.
|
|
13
|
+
* const simulateNotFound = (path) => {
|
|
14
|
+
* if (path === filePath) {
|
|
15
|
+
* throw new NotFoundError(`no such file or directory, open '${filePath}'`);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* simulateNotFound(filePath);
|
|
19
|
+
* // await readFile(filePath);
|
|
20
|
+
* } catch (error) {
|
|
21
|
+
* if (error instanceof NotFoundError) {
|
|
22
|
+
* console.error(`Operation failed, path not found: ${error.message}`);
|
|
23
|
+
* console.error(`Error code: ${error.code}`); // ENOENT
|
|
24
|
+
* } else {
|
|
25
|
+
* console.error("An unexpected error occurred:", error);
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* tryReadingNonExistentFile();
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare class NotFoundError extends Error {
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new instance.
|
|
36
|
+
* @param message The error message.
|
|
37
|
+
*/
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
get code(): string;
|
|
40
|
+
set code(_name: string);
|
|
41
|
+
get name(): string;
|
|
42
|
+
set name(_name: string);
|
|
43
|
+
}
|
|
44
|
+
export default NotFoundError;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when an operation is not permitted due to insufficient privileges
|
|
3
|
+
* or other access control restrictions.
|
|
4
|
+
* @example
|
|
5
|
+
* ```javascript
|
|
6
|
+
* import { PermissionError } from "@visulima/fs/error";
|
|
7
|
+
* import { writeFile } from "@visulima/fs"; // Or any function that might throw this
|
|
8
|
+
* import { join } from "node:path";
|
|
9
|
+
*
|
|
10
|
+
* const tryWritingToProtectedFile = async () => {
|
|
11
|
+
* const filePath = join("/root", "protected-file.txt"); // A path that typically requires root privileges
|
|
12
|
+
* try {
|
|
13
|
+
* // Forcing the scenario for demonstration, as writeFile itself would throw this.
|
|
14
|
+
* const simulatePermissionError = (path) => {
|
|
15
|
+
* if (path === filePath) {
|
|
16
|
+
* throw new PermissionError(`open '${filePath}'`);
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* simulatePermissionError(filePath);
|
|
20
|
+
* // await writeFile(filePath, "test content");
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* if (error instanceof PermissionError) {
|
|
23
|
+
* console.error(`Operation not permitted: ${error.message}`);
|
|
24
|
+
* console.error(`Error code: ${error.code}`); // EPERM
|
|
25
|
+
* } else {
|
|
26
|
+
* console.error("An unexpected error occurred:", error);
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* tryWritingToProtectedFile();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare class PermissionError extends Error {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new instance.
|
|
37
|
+
* @param message The error message.
|
|
38
|
+
*/
|
|
39
|
+
constructor(message: string);
|
|
40
|
+
get code(): string;
|
|
41
|
+
set code(_name: string);
|
|
42
|
+
get name(): string;
|
|
43
|
+
set name(_name: string);
|
|
44
|
+
}
|
|
45
|
+
export default PermissionError;
|