@visulima/fs 2.1.6 → 2.1.8
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 +22 -0
- package/LICENSE.md +67 -0
- package/dist/error.cjs +1 -37
- package/dist/error.d.cts +1 -1
- package/dist/error.d.mts +50 -0
- package/dist/error.d.ts +1 -1
- package/dist/error.mjs +1 -0
- package/dist/index.cjs +7 -65
- package/dist/index.d.cts +2 -3
- package/dist/index.d.mts +90 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.mjs +9 -0
- package/dist/shared/fs.BLXmkvbT.cjs +4 -0
- package/dist/shared/fs.BMHe7vX1.mjs +1 -0
- package/dist/shared/fs.BMslWC0T.cjs +6 -0
- package/dist/shared/fs.BRjynomN.mjs +6 -0
- package/dist/shared/fs.BXbumRuI.mjs +4 -0
- package/dist/shared/fs.CjglVHda.cjs +1 -0
- package/dist/{types-CtYA064B.d.cts → shared/fs.CpT5ICZl.d.cts} +40 -1
- package/dist/{types-CtYA064B.d.ts → shared/fs.CpT5ICZl.d.mts} +40 -1
- package/dist/shared/fs.CpT5ICZl.d.ts +120 -0
- package/dist/shared/fs.ZPgZIXcg.d.ts +11 -0
- package/dist/utils.cjs +1 -31
- package/dist/utils.d.cts +2 -3
- package/dist/utils.d.mts +18 -0
- package/dist/utils.d.ts +2 -3
- package/dist/utils.mjs +1 -0
- package/package.json +15 -14
- package/dist/chunk-BZXQ545V.cjs +0 -12
- package/dist/chunk-BZXQ545V.cjs.map +0 -1
- package/dist/chunk-ELTI4L4F.js +0 -12
- package/dist/chunk-ELTI4L4F.js.map +0 -1
- package/dist/chunk-N5NZURYL.cjs +0 -10
- package/dist/chunk-N5NZURYL.cjs.map +0 -1
- package/dist/chunk-NEXEUEQV.cjs +0 -16
- package/dist/chunk-NEXEUEQV.cjs.map +0 -1
- package/dist/chunk-P3KZLWQC.js +0 -5
- package/dist/chunk-P3KZLWQC.js.map +0 -1
- package/dist/chunk-UPN3Y5W3.js +0 -8
- package/dist/chunk-UPN3Y5W3.js.map +0 -1
- package/dist/error.cjs.map +0 -1
- package/dist/error.js +0 -4
- package/dist/error.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.js +0 -9
- package/dist/utils.js.map +0 -1
- /package/dist/{json-error-ZPgZIXcg.d.cts → shared/fs.ZPgZIXcg.d.cts} +0 -0
- /package/dist/{json-error-ZPgZIXcg.d.ts → shared/fs.ZPgZIXcg.d.mts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## @visulima/fs [2.1.8](https://github.com/visulima/visulima/compare/@visulima/fs@2.1.7...@visulima/fs@2.1.8) (2024-07-01)
|
|
2
|
+
|
|
3
|
+
### Styles
|
|
4
|
+
|
|
5
|
+
* cs fixes ([cf19938](https://github.com/visulima/visulima/commit/cf199384f25cd6e97d4041317b35b6a3cc586f88))
|
|
6
|
+
* cs fixes found by eslint and prettier ([69ef744](https://github.com/visulima/visulima/commit/69ef7444c0bfbf1c94763623332e06b7fffc0039))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* **@visulima/error:** upgraded to 4.1.0
|
|
12
|
+
|
|
13
|
+
## @visulima/fs [2.1.7](https://github.com/visulima/visulima/compare/@visulima/fs@2.1.6...@visulima/fs@2.1.7) (2024-06-17)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **fs:** changed from tsup to packem ([#426](https://github.com/visulima/visulima/issues/426)) ([e74adad](https://github.com/visulima/visulima/commit/e74adaded8d0f5298fb755afe4536a1ec3f88f1c))
|
|
18
|
+
|
|
19
|
+
### Miscellaneous Chores
|
|
20
|
+
|
|
21
|
+
* updated dev dependencies ([c889486](https://github.com/visulima/visulima/commit/c889486f8980741f459b993648c1b6d0815e3d66))
|
|
22
|
+
|
|
1
23
|
## @visulima/fs [2.1.6](https://github.com/visulima/visulima/compare/@visulima/fs@2.1.5...@visulima/fs@2.1.6) (2024-06-16)
|
|
2
24
|
|
|
3
25
|
|
package/LICENSE.md
CHANGED
|
@@ -19,3 +19,70 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
<!-- DEPENDENCIES -->
|
|
24
|
+
|
|
25
|
+
# Licenses of bundled dependencies
|
|
26
|
+
The published @visulima/fs artifact additionally contains code with the following licenses:
|
|
27
|
+
MIT
|
|
28
|
+
|
|
29
|
+
# Bundled dependencies:
|
|
30
|
+
## @visulima/error
|
|
31
|
+
License: MIT
|
|
32
|
+
By: Daniel Bannert
|
|
33
|
+
Repository: https://github.com/visulima/visulima.git
|
|
34
|
+
|
|
35
|
+
> MIT License
|
|
36
|
+
>
|
|
37
|
+
> Copyright (c) 2024 visulima
|
|
38
|
+
>
|
|
39
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
> in the Software without restriction, including without limitation the rights
|
|
42
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
> furnished to do so, subject to the following conditions:
|
|
45
|
+
>
|
|
46
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
47
|
+
> copies or substantial portions of the Software.
|
|
48
|
+
>
|
|
49
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
51
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
52
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
53
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
54
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
55
|
+
> SOFTWARE.
|
|
56
|
+
|
|
57
|
+
---------------------------------------
|
|
58
|
+
|
|
59
|
+
## detect-indent
|
|
60
|
+
License: MIT
|
|
61
|
+
By: Sindre Sorhus
|
|
62
|
+
Repository: sindresorhus/detect-indent
|
|
63
|
+
|
|
64
|
+
> MIT License
|
|
65
|
+
>
|
|
66
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
67
|
+
>
|
|
68
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
69
|
+
>
|
|
70
|
+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
71
|
+
>
|
|
72
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
|
+
|
|
74
|
+
<!-- DEPENDENCIES -->
|
|
75
|
+
|
|
76
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
77
|
+
|
|
78
|
+
# Licenses of bundled types
|
|
79
|
+
The published @visulima/fs artifact additionally contains code with the following licenses:
|
|
80
|
+
(MIT OR CC0-1.0)
|
|
81
|
+
|
|
82
|
+
# Bundled types:
|
|
83
|
+
## type-fest
|
|
84
|
+
License: (MIT OR CC0-1.0)
|
|
85
|
+
By: Sindre Sorhus
|
|
86
|
+
Repository: sindresorhus/type-fest
|
|
87
|
+
|
|
88
|
+
<!-- TYPE_DEPENDENCIES -->
|
package/dist/error.cjs
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkBZXQ545V_cjs = require('./chunk-BZXQ545V.cjs');
|
|
4
|
-
var chunkN5NZURYL_cjs = require('./chunk-N5NZURYL.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "AlreadyExistsError", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkBZXQ545V_cjs.a; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "DirectoryError", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunkBZXQ545V_cjs.b; }
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "NotEmptyError", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return chunkBZXQ545V_cjs.c; }
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "NotFoundError", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return chunkBZXQ545V_cjs.d; }
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PermissionError", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return chunkBZXQ545V_cjs.e; }
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports, "WalkError", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () { return chunkBZXQ545V_cjs.f; }
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, "JSONError", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return chunkN5NZURYL_cjs.a; }
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=out.js.map
|
|
37
|
-
//# sourceMappingURL=error.cjs.map
|
|
1
|
+
"use strict";var n=Object.defineProperty;var o=(e,r)=>n(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./shared/fs.CjglVHda.cjs"),E=require("./shared/fs.BLXmkvbT.cjs");var a=Object.defineProperty,c=o((e,r)=>a(e,"name",{value:r,configurable:!0}),"o$2");let s=class extends Error{static{o(this,"n")}static{c(this,"DirectoryError")}constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`)}get code(){return"EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}};const i=s;var u=Object.defineProperty,d=o((e,r)=>u(e,"name",{value:r,configurable:!0}),"t$1");let l=class extends Error{static{o(this,"n")}static{d(this,"NotEmptyError")}constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`)}get code(){return"ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}};const m=l;var w=Object.defineProperty,N=o((e,r)=>w(e,"name",{value:r,configurable:!0}),"o");class y extends Error{static{o(this,"n")}static{N(this,"NotFoundError")}constructor(r){super(`ENOENT: ${r}`)}get code(){return"ENOENT"}set code(r){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(r){throw new Error("Cannot overwrite name of NotFoundError")}}const v=y;exports.AlreadyExistsError=t.l;exports.PermissionError=t.s;exports.WalkError=t.i;exports.JSONError=E.c;exports.DirectoryError=i;exports.NotEmptyError=m;exports.NotFoundError=v;
|
package/dist/error.d.cts
CHANGED
package/dist/error.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { J as JSONError } from './shared/fs.ZPgZIXcg.mjs';
|
|
2
|
+
|
|
3
|
+
declare class AlreadyExistsError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
get code(): string;
|
|
6
|
+
set code(_name: string);
|
|
7
|
+
get name(): string;
|
|
8
|
+
set name(_name: string);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class DirectoryError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
get code(): string;
|
|
14
|
+
set code(_name: string);
|
|
15
|
+
get name(): string;
|
|
16
|
+
set name(_name: string);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare class NotEmptyError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
get code(): string;
|
|
22
|
+
set code(_name: string);
|
|
23
|
+
get name(): string;
|
|
24
|
+
set name(_name: string);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare class NotFoundError extends Error {
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
get code(): string;
|
|
30
|
+
set code(_name: string);
|
|
31
|
+
get name(): string;
|
|
32
|
+
set name(_name: string);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class PermissionError extends Error {
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
get code(): string;
|
|
38
|
+
set code(_name: string);
|
|
39
|
+
get name(): string;
|
|
40
|
+
set name(_name: string);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class WalkError extends Error {
|
|
44
|
+
root: string;
|
|
45
|
+
constructor(cause: unknown, root: string);
|
|
46
|
+
get name(): string;
|
|
47
|
+
set name(_name: string);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { AlreadyExistsError, DirectoryError, NotEmptyError, NotFoundError, PermissionError, WalkError };
|
package/dist/error.d.ts
CHANGED
package/dist/error.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var e=(o,r)=>t(o,"name",{value:r,configurable:!0});import{l as g,s as O,i as h}from"./shared/fs.BMHe7vX1.mjs";import{c as D}from"./shared/fs.BXbumRuI.mjs";var n=Object.defineProperty,a=e((o,r)=>n(o,"name",{value:r,configurable:!0}),"o$2");let E=class extends Error{static{e(this,"n")}static{a(this,"DirectoryError")}constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`)}get code(){return"EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}};const l=E;var s=Object.defineProperty,c=e((o,r)=>s(o,"name",{value:r,configurable:!0}),"t$1");let i=class extends Error{static{e(this,"n")}static{c(this,"NotEmptyError")}constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`)}get code(){return"ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}};const v=i;var u=Object.defineProperty,d=e((o,r)=>u(o,"name",{value:r,configurable:!0}),"o");class m extends Error{static{e(this,"n")}static{d(this,"NotFoundError")}constructor(r){super(`ENOENT: ${r}`)}get code(){return"ENOENT"}set code(r){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(r){throw new Error("Cannot overwrite name of NotFoundError")}}const y=m;export{g as AlreadyExistsError,l as DirectoryError,D as JSONError,v as NotEmptyError,y as NotFoundError,O as PermissionError,h as WalkError};
|
package/dist/index.cjs
CHANGED
|
@@ -1,67 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkBZXQ545V_cjs = require('./chunk-BZXQ545V.cjs');
|
|
4
|
-
|
|
5
|
-
require('./chunk-N5NZURYL.cjs');
|
|
6
|
-
var promises = require('fs/promises');
|
|
7
|
-
var fs = require('fs');
|
|
8
|
-
var path = require('@visulima/path');
|
|
9
|
-
var utils = require('@visulima/path/utils');
|
|
10
|
-
var process$1 = require('process');
|
|
11
|
-
var zlib = require('zlib');
|
|
12
|
-
var yaml = require('yaml');
|
|
13
|
-
|
|
14
|
-
var O=0,k=4,xt=2,Ft=1,T=Symbol("findUpStop");var u=t=>{if(t.isFile())return "file";if(t.isDirectory())return "dir";if(t.isSymbolicLink())return "symlink"};var bt=async t=>{chunkNEXEUEQV_cjs.a(t);try{let e=await promises.lstat(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${u(e)}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await promises.mkdir(t,{recursive:!0});}catch(e){if(e.code!=="EEXIST")throw e;let r=await promises.lstat(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${u(r)}'`)}},R=bt;var kt=t=>{chunkNEXEUEQV_cjs.a(t);try{let e=fs.lstatSync(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${u(e)}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{fs.mkdirSync(t,{recursive:!0});}catch(e){if(e.code!=="EEXIST")throw e;let r=fs.lstatSync(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${u(r)}'`)}},x=kt;var Ut=async t=>{chunkNEXEUEQV_cjs.a(t);try{let e=await promises.lstat(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${u(e)}'`)}catch(e){if(e.code==="ENOENT"){await R(path.dirname(utils.toPath(t))),await promises.writeFile(t,new Uint8Array);return}throw e}},It=Ut;var _t=t=>{chunkNEXEUEQV_cjs.a(t);try{let e=fs.lstatSync(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${u(e)}'`)}catch(e){if(e.code==="ENOENT"){x(path.dirname(utils.toPath(t))),fs.writeFileSync(t,new Uint8Array);return}throw e}},Vt=_t;var $t=(t,e)=>!!e.ino&&!!e.dev&&e.ino===t.ino&&e.dev===t.dev,g=$t;var zt=async(t,e)=>{chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.a(e),t=path.toNamespacedPath(utils.toPath(t)),e=path.toNamespacedPath(utils.toPath(e));let r;try{r=await promises.lstat(e);}catch{}let o;try{o=await promises.lstat(t);}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}r&&g(o,r)||(await R(path.dirname(e)),await promises.link(t,e));},Kt=zt;var Bt=(t,e)=>{chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.a(e),t=path.toNamespacedPath(utils.toPath(t)),e=path.toNamespacedPath(utils.toPath(e));let r;try{r=fs.lstatSync(e);}catch{}let o;try{o=fs.lstatSync(t);}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}r&&g(o,r)||(x(path.dirname(e)),fs.linkSync(t,e));},Xt=Bt;var Gt=(t,e)=>typeof t!="string"?t:t.startsWith("./")?path.resolve(t):typeof e=="string"?path.resolve(path.dirname(e),t):new URL(t,e),$=Gt;var ee=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),re=async(t,e,r)=>{chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.a(e);let o=$(t,e);e=path.toNamespacedPath(utils.toPath(e));try{if((await promises.lstat(e)).isSymbolicLink()&&g(await promises.stat(o),await promises.stat(e))){let[l,a]=await Promise.all([promises.stat(o),promises.stat(e)]);if(g(l,a))return}}catch{}let i=await promises.lstat(o),s=u(i);await R(path.dirname(e));let c=r??(ee?"junction":s==="dir"?"dir":"file");try{await promises.symlink(path.toNamespacedPath(utils.toPath(o)),e,c);}catch(m){if(m.code!=="EEXIST")throw m;let l=await promises.lstat(e);if(!l.isSymbolicLink())throw new chunkBZXQ545V_cjs.a("A "+u(l)+" already exists at the path: "+e);let a=await promises.readlink(e),d=path.toNamespacedPath(path.resolve(a));if(d!==o)throw new chunkBZXQ545V_cjs.a("A symlink targeting to an undesired path already exists: "+e+" -> "+d)}},oe=re;var fe=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),ce=(t,e,r)=>{chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.a(e);let o=$(t,e);e=path.toNamespacedPath(utils.toPath(e));try{if(fs.lstatSync(e).isSymbolicLink()&&g(fs.statSync(o),fs.statSync(e))){let l=fs.statSync(o),a=fs.statSync(e);if(g(l,a))return}}catch{}let i=fs.lstatSync(o),s=u(i);x(path.dirname(e));let c=r??(fe?"junction":s==="dir"?"dir":"file");try{fs.symlinkSync(path.toNamespacedPath(utils.toPath(o)),e,c);}catch(m){if(m.code!=="EEXIST")throw m;let l=fs.lstatSync(e);if(!l.isSymbolicLink())throw new chunkBZXQ545V_cjs.a("A "+u(l)+" already exists at the path: "+e);let a=fs.readlinkSync(e),d=path.toNamespacedPath(path.resolve(a));if(d!==o)throw new chunkBZXQ545V_cjs.a("A symlink targeting to an undesired path already exists: "+e+" -> "+d)}},me=ce;var mt=/\r?\n/g,H=`
|
|
15
|
-
`,z=`\r
|
|
16
|
-
`,le=process$1.platform==="win32"?z:H,de=t=>{let e=t.match(mt);if(!e||e.length===0)return null;let r=e.filter(i=>i===z).length,o=e.length-r;return r>o?z:H},ye=(t,e)=>t.replaceAll(mt,e);var ue=t=>{let e=t.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,"\\.").replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${e}$`)},b=ue;var ge=(t,e,r,o)=>Array.isArray(e)&&e.length>0&&!e.some(i=>t.endsWith(i))||r&&!r.some(i=>i.test(t))?!1:!(o&&o.some(i=>i.test(t))),w=ge;var be=async t=>{let e=path.normalize(t),r=path.basename(e),o=await promises.stat(e);return {isDirectory:o.isDirectory,isFile:o.isFile,isSymbolicLink:o.isSymbolicLink,name:r,path:e}};async function*D(t,{extensions:e,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:i=!0,includeSymlinks:s=!0,match:c,maxDepth:m=Number.POSITIVE_INFINITY,skip:l}={}){if(chunkNEXEUEQV_cjs.a(t),m<0)return;let a=c?c.map(n=>typeof n=="string"?b(n):n):void 0,d=l?l.map(n=>typeof n=="string"?b(n):n):void 0;if(t=path.resolve(utils.toPath(t)),o&&w(t,e,a,d)&&(yield await be(t)),!(m<1||!w(t,void 0,void 0,d)))try{for await(let n of await promises.readdir(t,{withFileTypes:!0})){let y=path.join(t,n.name);if(n.isSymbolicLink())if(r)y=await promises.realpath(y);else if(s&&w(y,e,a,d))yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:y};else continue;n.isSymbolicLink()||n.isDirectory()?yield*D(y,{extensions:e,followSymlinks:r,includeDirs:o,includeFiles:i,includeSymlinks:s,match:a,maxDepth:m-1,skip:d}):n.isFile()&&i&&w(y,e,a,d)&&(yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:y});}}catch(n){throw n instanceof chunkBZXQ545V_cjs.f?n:new chunkBZXQ545V_cjs.f(n,t)}}var Ee=async(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);let r=[];for await(let o of D(t,e))r.push(o.path);return r},ke=Ee;var Je=t=>{let e=path.normalize(t),r=fs.statSync(e);return {isDirectory:r.isDirectory,isFile:r.isFile,isSymbolicLink:r.isSymbolicLink,name:path.basename(e),path:e}};function*L(t,{extensions:e,followSymlinks:r=!1,includeDirs:o=!0,includeFiles:i=!0,includeSymlinks:s=!0,match:c,maxDepth:m=Number.POSITIVE_INFINITY,skip:l}={}){if(chunkNEXEUEQV_cjs.a(t),m<0)return;let a=c?c.map(n=>typeof n=="string"?b(n):n):void 0,d=l?l.map(n=>typeof n=="string"?b(n):n):void 0;if(t=path.resolve(utils.toPath(t)),o&&w(t,e,a,d)&&(yield Je(t)),!(m<1||!w(t,void 0,void 0,d)))try{for(let n of fs.readdirSync(t,{withFileTypes:!0})){let y=path.join(t,n.name);if(n.isSymbolicLink())if(r)y=fs.realpathSync(y);else if(s&&w(y,e,a,d))yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:path.normalize(y)};else continue;n.isSymbolicLink()||n.isDirectory()?yield*L(y,{extensions:e,followSymlinks:r,includeDirs:o,includeFiles:i,includeSymlinks:s,match:a,maxDepth:m-1,skip:d}):n.isFile()&&i&&w(y,e,a,d)&&(yield {isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:n.name,path:path.normalize(y)});}}catch(n){throw n instanceof chunkBZXQ545V_cjs.f?n:new chunkBZXQ545V_cjs.f(n,t)}}var Ye=(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);let r=[];for(let o of L(t,e))r.push(o.path);return r},We=Ye;var Ne=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=e.cwd?utils.toPath(e.cwd):process.cwd(),o=path.resolve(r),{root:i}=path.parse(o),s=utils.toPath(e.stopAt??i),c=path.resolve(o,s),m=e.type??"file",l=async function(a){return typeof t=="function"?[await t(a)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};for(;o&&o!==c&&o!==i;){for await(let a of await l(o)){if(a===T)return;if(a===void 0)continue;let d=path.isAbsolute(a)?a:path.resolve(o,a);try{let n=await promises.stat(d);if(m==="file"&&n.isFile()||m==="directory"&&n.isDirectory())return d}catch{}}o=path.dirname(o);}},ze=Ne;var Xe=(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");let r=e.cwd?utils.toPath(e.cwd):process.cwd(),o=path.resolve(r),{root:i}=path.parse(o),s=utils.toPath(e.stopAt??i),c=path.resolve(o,s),m=e.type??"file",l=function(a){return typeof t=="function"?[t(a)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};for(;o&&o!==c&&o!==i;){for(let a of l(o)){if(a===T)return;if(a===void 0)continue;let d=path.isAbsolute(a)?a:path.resolve(o,a);try{let n=fs.statSync(d);if(m==="file"&&n.isFile()||m==="directory"&&n.isDirectory())return d}catch{}}o=path.dirname(o);}},He=Xe;async function Qe(t,e=0){chunkNEXEUEQV_cjs.a(t),t=utils.toPath(t);try{return await promises.access(t,e),!0}catch{return !1}}var S=Qe;function er(t,e=0){chunkNEXEUEQV_cjs.a(t),t=utils.toPath(t);try{return fs.accessSync(t,e),!0}catch{return !1}}var h=er;var sr={brotli:zlib.brotliDecompress,gzip:zlib.unzip,none:(t,e)=>{e(null,t);}},ar=async(t,e)=>{if(chunkNEXEUEQV_cjs.a(t),t=utils.toPath(t),!await S(t))throw new chunkBZXQ545V_cjs.e(`unable to read the non-accessible file: ${t}`);if(!await S(t,4))throw new Error(`Unable to read the non-readable file: ${t}`);let{buffer:r,compression:o,encoding:i,flag:s}=e??{};return await promises.readFile(t,s?{encoding:i,flag:s}:{encoding:i}).then(async c=>await new Promise((m,l)=>{sr[o??"none"](c,(a,d)=>{a?l(a):m(r?d:d.toString());});})).catch(c=>{throw c})},v=ar;var lr={brotli:zlib.brotliDecompressSync,gzip:zlib.unzipSync,none:t=>t},dr=(t,e)=>{if(chunkNEXEUEQV_cjs.a(t),t=utils.toPath(t),!h(t))throw new chunkBZXQ545V_cjs.e(`unable to read the non-accessible file: ${t}`);if(!h(t,4))throw new chunkBZXQ545V_cjs.e(`invalid access to read file at: ${t}`);let{buffer:r,compression:o,encoding:i,flag:s}=e??{},c=fs.readFileSync(t,s?{encoding:i,flag:s}:{encoding:i}),m=lr[o??"none"](c);return r?m:m.toString()},U=dr;async function ur(t,e,r){typeof e=="object"&&(r=e,e=void 0);let o=await v(t,{buffer:!0,encoding:void 0}),i=new TextDecoder().decode(o),{beforeParse:s,color:c}=r??{};return typeof s=="function"&&(i=s(i)),chunkNEXEUEQV_cjs.b(i,e,utils.toPath(t),{color:c})}var gr=ur;function Sr(t,e,r){typeof e=="object"&&(r=e,e=void 0);let o=U(t,{buffer:!0,encoding:void 0}),i=new TextDecoder().decode(o),{beforeParse:s,color:c}=r??{};return typeof s=="function"&&(i=s(i)),chunkNEXEUEQV_cjs.b(i,e,utils.toPath(t),{color:c})}var hr=Sr;async function Or(t,e,r){let{buffer:o,compression:i,encoding:s="utf8",flag:c,...m}=r??{},l=await v(t,{buffer:o,compression:i,encoding:s,flag:c});return typeof e=="function"?yaml.parse(l,e,m):yaml.parse(l,m)}var Rr=Or;function xr(t,e,r){let{buffer:o,compression:i,encoding:s="utf8",flag:c,...m}=r??{},l=U(t,{buffer:o,compression:i,encoding:s,flag:c});return typeof e=="function"?yaml.parse(l,e,m):yaml.parse(l,m)}var Fr=xr;var Lr=async(t,e)=>{if(chunkNEXEUEQV_cjs.a(t),!fs.existsSync(t)){await promises.mkdir(t,{recursive:!0});return}for await(let r of await promises.readdir(t))await promises.rm(path.join(utils.toPath(t),r),{...e,force:!0,recursive:!0});},vr=Lr;var _r=(t,e)=>{if(chunkNEXEUEQV_cjs.a(t),!fs.existsSync(t)){fs.mkdirSync(t,{recursive:!0});return}for(let r of fs.readdirSync(t))fs.rmSync(path.join(utils.toPath(t),r),{...e,force:!0,recursive:!0});},Vr=_r;var Nr=async(t,e={})=>{chunkNEXEUEQV_cjs.a(t);try{await promises.unlink(t);}catch{}try{await promises.rm(t,{force:!0,maxRetries:e?.maxRetries,recursive:!0,retryDelay:e?.retryDelay});}catch{}},zr=Nr;var jr=(t,e={})=>{chunkNEXEUEQV_cjs.a(t);try{fs.unlinkSync(t);}catch{}try{fs.rmSync(t,{force:!0,maxRetries:e?.maxRetries,recursive:!0,retryDelay:e?.retryDelay});}catch{}},Br=jr;var Xr=new TextEncoder,Hr=t=>{if(t instanceof Uint8Array)return t;if(typeof t=="string")return Xr.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t)){let e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(e)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},K=Hr;var io=async(t,e,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.c(e),t=utils.toPath(t);try{let o=await S(t,0);if(!o&&r.recursive){let c=path.dirname(t);await S(c,0)||await promises.mkdir(c,{recursive:!0});}let i;await promises.writeFile(`${t}.tmp`,K(e),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(i=await promises.stat(t),r.chown===void 0&&(r.chown={gid:i.gid,uid:i.uid}),await promises.rename(t,`${t}.bak`));let s=`${t}.tmp`;if(r.chown)try{await promises.chown(s,r.chown.uid,r.chown.gid);}catch{}await promises.chmod(s,i&&!r.mode?i.mode:r.mode??438),await promises.rename(s,t);}catch(o){throw new Error(`Failed to write file at: ${t} - ${o.message}`,{cause:o})}finally{await S(`${t}.tmp`)&&await promises.unlink(`${t}.tmp`);}},I=io;var yo=(t,e,r)=>{r={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},chunkNEXEUEQV_cjs.a(t),chunkNEXEUEQV_cjs.c(e),t=utils.toPath(t);try{let o=h(t,0);if(!o&&r.recursive){let c=path.dirname(t);h(c,0)||fs.mkdirSync(c,{recursive:!0});}let i;fs.writeFileSync(`${t}.tmp`,K(e),{encoding:r.encoding,flag:r.flag}),o&&!r.overwrite&&(i=fs.statSync(t),r.chown===void 0&&(r.chown={gid:i.gid,uid:i.uid}),fs.renameSync(t,`${t}.bak`));let s=`${t}.tmp`;if(r.chown)try{fs.chownSync(s,r.chown.uid,r.chown.gid);}catch{}fs.chmodSync(s,i&&!r.mode?i.mode:r.mode??438),fs.renameSync(s,t);}catch(o){throw new Error(`Failed to write file at: ${t} - ${o.message}`,{cause:o})}finally{h(`${t}.tmp`)&&fs.unlinkSync(`${t}.tmp`);}},A=yo;var uo=/^(?:( )+|\t+)/,J="space",St="tab";function wt(t,e){let r=new Map,o=0,i,s;for(let c of t.split(/\n/g)){if(!c)continue;let m,l,a,d,n,y=c.match(uo);if(y===null)o=0,i="";else {if(m=y[0].length,l=y[1]?J:St,e&&l===J&&m===1)continue;l!==i&&(o=0),i=l,a=1,d=0;let W=m-o;if(o=m,W===0)a=0,d=1;else {let Rt=W>0?W:-W;s=go(l,Rt);}n=r.get(s),n=n===void 0?[1,0]:[n[0]+a,n[1]+d],r.set(s,n);}}return r}function go(t,e){return (t===J?"s":"t")+String(e)}function wo(t){let r=t[0]==="s"?J:St,o=Number(t.slice(1));return {type:r,amount:o}}function So(t){let e,r=0,o=0;for(let[i,[s,c]]of t)(s>r||s===r&&c>o)&&(r=s,o=c,e=i);return e}function ho(t,e){return (t===J?" ":" ").repeat(e)}function Y(t){if(typeof t!="string")throw new TypeError("Expected a string");let e=wt(t,!0);e.size===0&&(e=wt(t,!1));let r=So(e),o,i=0,s="";return r!==void 0&&({type:o,amount:i}=wo(r),s=ho(o,i)),{amount:i,type:o,indent:s}}var Ro=async(t,e,r={})=>{let{detectIndent:o,indent:i,replacer:s,stringify:c=JSON.stringify,...m}={indent:" ",...r},l=i,a=`
|
|
17
|
-
`;if(await S(t,4))try{let n=await promises.readFile(t,"utf8");if(o){let{indent:y}=Y(n);l=y;}a=n.endsWith(`
|
|
1
|
+
"use strict";var le=Object.defineProperty;var o=(e,t)=>le(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("node:fs/promises"),w=require("./shared/fs.BMslWC0T.cjs"),u=require("node:fs"),s=require("@visulima/path"),h=require("@visulima/path/utils"),g=require("./shared/fs.CjglVHda.cjs"),ye=require("node:process"),x=require("node:zlib"),k=require("yaml"),O=0,j=4,fe=2,de=1,R=Symbol("findUpStop");var ue=Object.defineProperty,me=o((e,t)=>ue(e,"name",{value:t,configurable:!0}),"i$b");const $=me(e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},"getFileInfoType");var pe=Object.defineProperty,we=o((e,t)=>pe(e,"name",{value:t,configurable:!0}),"i$a");const he=we(async e=>{w.s(e);try{const t=await m.lstat(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(t)}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{await m.mkdir(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const n=await m.lstat(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(n)}'`)}},"ensureDir"),N=he;var ve=Object.defineProperty,ge=o((e,t)=>ve(e,"name",{value:t,configurable:!0}),"o$9");const $e=ge(e=>{w.s(e);try{const t=u.lstatSync(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(t)}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{u.mkdirSync(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const n=u.lstatSync(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(n)}'`)}},"ensureDirSync"),L=$e;var be=Object.defineProperty,Se=o((e,t)=>be(e,"name",{value:t,configurable:!0}),"e$5");const Pe=Se(async e=>{w.s(e);try{const t=await m.lstat(e);if(!t.isFile())throw new Error(`Ensure path exists, expected 'file', got '${$(t)}'`)}catch(t){if(t.code==="ENOENT"){await N(s.dirname(h.toPath(e))),await m.writeFile(e,new Uint8Array);return}throw t}},"ensureFile"),ke=Pe;var Oe=Object.defineProperty,Fe=o((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"e$4");const Ee=Fe(e=>{w.s(e);try{const t=u.lstatSync(e);if(!t.isFile())throw new Error(`Ensure path exists, expected 'file', got '${$(t)}'`)}catch(t){if(t.code==="ENOENT"){L(s.dirname(h.toPath(e))),u.writeFileSync(e,new Uint8Array);return}throw t}},"ensureFileSync"),je=Ee;var De=Object.defineProperty,xe=o((e,t)=>De(e,"name",{value:t,configurable:!0}),"d$6");const F=xe((e,t)=>!!t.ino&&!!t.dev&&t.ino===e.ino&&t.dev===e.dev,"isStatsIdentical");var Te=Object.defineProperty,Ae=o((e,t)=>Te(e,"name",{value:t,configurable:!0}),"m$8");const Ne=Ae(async(e,t)=>{w.s(e),w.s(t),e=s.toNamespacedPath(h.toPath(e)),t=s.toNamespacedPath(h.toPath(t));let n;try{n=await m.lstat(t)}catch{}let r;try{r=await m.lstat(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}n&&F(r,n)||(await N(s.dirname(t)),await m.link(e,t))},"ensureLink"),Le=Ne;var Ie=Object.defineProperty,_e=o((e,t)=>Ie(e,"name",{value:t,configurable:!0}),"o$6");const Re=_e((e,t)=>{w.s(e),w.s(t),e=s.toNamespacedPath(h.toPath(e)),t=s.toNamespacedPath(h.toPath(t));let n;try{n=u.lstatSync(t)}catch{}let r;try{r=u.lstatSync(e)}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}n&&F(r,n)||(L(s.dirname(t)),u.linkSync(e,t))},"ensureLinkSync"),Ue=Re;var Ye=Object.defineProperty,ze=o((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"i$9");const M=ze((e,t)=>typeof e!="string"?e:e.startsWith("./")?s.resolve(e):typeof t=="string"?s.resolve(s.dirname(t),e):new URL(e,t),"resolveSymlinkTarget");var Je=Object.defineProperty,Ke=o((e,t)=>Je(e,"name",{value:t,configurable:!0}),"f$4");const qe=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Ce=Ke(async(e,t,n)=>{w.s(e),w.s(t);const r=M(e,t);t=s.toNamespacedPath(h.toPath(t));try{if((await m.lstat(t)).isSymbolicLink()&&F(await m.stat(r),await m.stat(t))){const[y,d]=await Promise.all([m.stat(r),m.stat(t)]);if(F(y,d))return}}catch{}const i=await m.lstat(r),c=$(i);await N(s.dirname(t));const l=n??(qe?"junction":c==="dir"?"dir":"file");try{await m.symlink(s.toNamespacedPath(h.toPath(r)),t,l)}catch(y){if(y.code!=="EEXIST")throw y;const d=await m.lstat(t);if(!d.isSymbolicLink())throw new g.l("A "+$(d)+" already exists at the path: "+t);const f=await m.readlink(t),p=s.toNamespacedPath(s.resolve(f));if(p!==r)throw new g.l("A symlink targeting to an undesired path already exists: "+t+" -> "+p)}},"ensureSymlink"),We=Ce;var Me=Object.defineProperty,Xe=o((e,t)=>Me(e,"name",{value:t,configurable:!0}),"f$3");const Be=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Ve=Xe((e,t,n)=>{w.s(e),w.s(t);const r=M(e,t);t=s.toNamespacedPath(h.toPath(t));try{if(u.lstatSync(t).isSymbolicLink()&&F(u.statSync(r),u.statSync(t))){const y=u.statSync(r),d=u.statSync(t);if(F(y,d))return}}catch{}const i=u.lstatSync(r),c=$(i);L(s.dirname(t));const l=n??(Be?"junction":c==="dir"?"dir":"file");try{u.symlinkSync(s.toNamespacedPath(h.toPath(r)),t,l)}catch(y){if(y.code!=="EEXIST")throw y;const d=u.lstatSync(t);if(!d.isSymbolicLink())throw new g.l("A "+$(d)+" already exists at the path: "+t);const f=u.readlinkSync(t),p=s.toNamespacedPath(s.resolve(f));if(p!==r)throw new g.l("A symlink targeting to an undesired path already exists: "+t+" -> "+p)}},"ensureSymlinkSync"),He=Ve;var Ge=Object.defineProperty,X=o((e,t)=>Ge(e,"name",{value:t,configurable:!0}),"r$4");const B=/\r?\n/g,U=`
|
|
2
|
+
`,T=`\r
|
|
3
|
+
`,Qe=ye.platform==="win32"?T:U,Ze=X(e=>{const t=e.match(B);if(!t||t.length===0)return null;const n=t.filter(i=>i===T).length,r=t.length-n;return n>r?T:U},"detect"),et=X((e,t)=>e.replaceAll(B,t),"format");var tt=Object.defineProperty,nt=o((e,t)=>tt(e,"name",{value:t,configurable:!0}),"r$3");const A=nt(e=>{const t=e.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,"\\.").replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${t}$`)},"globToRegExp");var rt=Object.defineProperty,it=o((e,t)=>rt(e,"name",{value:t,configurable:!0}),"t$4");const b=it((e,t,n,r)=>Array.isArray(t)&&t.length>0&&!t.some(i=>e.endsWith(i))||n&&!n.some(i=>i.test(e))?!1:!(r&&r.some(i=>i.test(e))),"walkInclude");var at=Object.defineProperty,V=o((e,t)=>at(e,"name",{value:t,configurable:!0}),"f$2");const ot=V(async e=>{const t=s.normalize(e),n=s.basename(t),r=await m.stat(t);return{isDirectory:r.isDirectory,isFile:r.isFile,isSymbolicLink:r.isSymbolicLink,name:n,path:t}},"_createWalkEntry");async function*I(e,{extensions:t,followSymlinks:n=!1,includeDirs:r=!0,includeFiles:i=!0,includeSymlinks:c=!0,match:l,maxDepth:y=Number.POSITIVE_INFINITY,skip:d}={}){if(w.s(e),y<0)return;const f=l?l.map(a=>typeof a=="string"?A(a):a):void 0,p=d?d.map(a=>typeof a=="string"?A(a):a):void 0;if(e=s.resolve(h.toPath(e)),r&&b(e,t,f,p)&&(yield await ot(e)),!(y<1||!b(e,void 0,void 0,p)))try{for await(const a of await m.readdir(e,{withFileTypes:!0})){let v=s.join(e,a.name);if(a.isSymbolicLink())if(n)v=await m.realpath(v);else if(c&&b(v,t,f,p))yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:v};else continue;a.isSymbolicLink()||a.isDirectory()?yield*I(v,{extensions:t,followSymlinks:n,includeDirs:r,includeFiles:i,includeSymlinks:c,match:f,maxDepth:y-1,skip:p}):a.isFile()&&i&&b(v,t,f,p)&&(yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:v})}}catch(a){throw a instanceof g.i?a:new g.i(a,e)}}o(I,"d$5");V(I,"walk");var ct=Object.defineProperty,st=o((e,t)=>ct(e,"name",{value:t,configurable:!0}),"e$2");const lt=st(async(e,t={})=>{Array.isArray(t.extensions)||(t.extensions=["js","mjs","cjs","ts"]);const n=[];for await(const r of I(e,t))n.push(r.path);return n},"collect"),yt=lt;var ft=Object.defineProperty,H=o((e,t)=>ft(e,"name",{value:t,configurable:!0}),"m$7");const dt=H(e=>{const t=s.normalize(e),n=u.statSync(t);return{isDirectory:n.isDirectory,isFile:n.isFile,isSymbolicLink:n.isSymbolicLink,name:s.basename(t),path:t}},"_createWalkEntry");function*_(e,{extensions:t,followSymlinks:n=!1,includeDirs:r=!0,includeFiles:i=!0,includeSymlinks:c=!0,match:l,maxDepth:y=Number.POSITIVE_INFINITY,skip:d}={}){if(w.s(e),y<0)return;const f=l?l.map(a=>typeof a=="string"?A(a):a):void 0,p=d?d.map(a=>typeof a=="string"?A(a):a):void 0;if(e=s.resolve(h.toPath(e)),r&&b(e,t,f,p)&&(yield dt(e)),!(y<1||!b(e,void 0,void 0,p)))try{for(const a of u.readdirSync(e,{withFileTypes:!0})){let v=s.join(e,a.name);if(a.isSymbolicLink())if(n)v=u.realpathSync(v);else if(c&&b(v,t,f,p))yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:s.normalize(v)};else continue;a.isSymbolicLink()||a.isDirectory()?yield*_(v,{extensions:t,followSymlinks:n,includeDirs:r,includeFiles:i,includeSymlinks:c,match:f,maxDepth:y-1,skip:p}):a.isFile()&&i&&b(v,t,f,p)&&(yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:s.normalize(v)})}}catch(a){throw a instanceof g.i?a:new g.i(a,e)}}o(_,"h$2");H(_,"walkSync");var ut=Object.defineProperty,mt=o((e,t)=>ut(e,"name",{value:t,configurable:!0}),"n$5");const pt=mt((e,t={})=>{Array.isArray(t.extensions)||(t.extensions=["js","mjs","cjs","ts"]);const n=[];for(const r of _(e,t))n.push(r.path);return n},"collectSync"),wt=pt;var ht=Object.defineProperty,q=o((e,t)=>ht(e,"name",{value:t,configurable:!0}),"n$4");const vt=q(async(e,t={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=t.cwd?h.toPath(t.cwd):process.cwd();let r=s.resolve(n);const{root:i}=s.parse(r),c=h.toPath(t.stopAt??i),l=s.resolve(r,c),y=t.type??"file",d=q(async function(f){return typeof e=="function"?[await e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]},"getMatchers");for(;r&&r!==l&&r!==i;){for await(const f of await d(r)){if(f===R)return;if(f===void 0)continue;const p=s.isAbsolute(f)?f:s.resolve(r,f);try{const a=await m.stat(p);if(y==="file"&&a.isFile()||y==="directory"&&a.isDirectory())return p}catch{}}r=s.dirname(r)}},"findUp"),gt=vt;var $t=Object.defineProperty,C=o((e,t)=>$t(e,"name",{value:t,configurable:!0}),"o$3");const bt=C((e,t={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const n=t.cwd?h.toPath(t.cwd):process.cwd();let r=s.resolve(n);const{root:i}=s.parse(r),c=h.toPath(t.stopAt??i),l=s.resolve(r,c),y=t.type??"file",d=C(function(f){return typeof e=="function"?[e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]},"getMatchers");for(;r&&r!==l&&r!==i;){for(const f of d(r)){if(f===R)return;if(f===void 0)continue;const p=s.isAbsolute(f)?f:s.resolve(r,f);try{const a=u.statSync(p);if(y==="file"&&a.isFile()||y==="directory"&&a.isDirectory())return p}catch{}}r=s.dirname(r)}},"findUpSync"),St=bt;var Pt=Object.defineProperty,kt=o((e,t)=>Pt(e,"name",{value:t,configurable:!0}),"o$2");async function S(e,t=O){w.s(e),e=h.toPath(e);try{return await m.access(e,t),!0}catch{return!1}}o(S,"m$6");kt(S,"isAccessible");var Ot=Object.defineProperty,Ft=o((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"o$1");function P(e,t=O){w.s(e),e=h.toPath(e);try{return u.accessSync(e,t),!0}catch{return!1}}o(P,"m$5");Ft(P,"isAccessibleSync");var Et=Object.defineProperty,G=o((e,t)=>Et(e,"name",{value:t,configurable:!0}),"n$3");const jt={brotli:x.brotliDecompress,gzip:x.unzip,none:G((e,t)=>{t(null,e)},"none")},Dt=G(async(e,t)=>{if(w.s(e),e=h.toPath(e),!await S(e))throw new g.s(`unable to read the non-accessible file: ${e}`);if(!await S(e,j))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:n,compression:r,encoding:i,flag:c}=t??{};return await m.readFile(e,c?{encoding:i,flag:c}:{encoding:i}).then(async l=>await new Promise((y,d)=>{jt[r??"none"](l,(f,p)=>{f?d(f):y(n?p:p.toString())})})).catch(l=>{throw l})},"readFile"),Y=Dt;var xt=Object.defineProperty,Q=o((e,t)=>xt(e,"name",{value:t,configurable:!0}),"n$2");const Tt={brotli:x.brotliDecompressSync,gzip:x.unzipSync,none:Q(e=>e,"none")},At=Q((e,t)=>{if(w.s(e),e=h.toPath(e),!P(e))throw new g.s(`unable to read the non-accessible file: ${e}`);if(!P(e,j))throw new g.s(`invalid access to read file at: ${e}`);const{buffer:n,compression:r,encoding:i,flag:c}=t??{},l=u.readFileSync(e,c?{encoding:i,flag:c}:{encoding:i}),y=Tt[r??"none"](l);return n?y:y.toString()},"readFileSync"),z=At;var Nt=Object.defineProperty,Lt=o((e,t)=>Nt(e,"name",{value:t,configurable:!0}),"i$7");async function Z(e,t,n){typeof t=="object"&&(n=t,t=void 0);const r=await Y(e,{buffer:!0,encoding:void 0});let i=new TextDecoder().decode(r);const{beforeParse:c,color:l}=n??{};return typeof c=="function"&&(i=c(i)),w.F(i,t,h.toPath(e),{color:l})}o(Z,"c");Lt(Z,"readJson");var It=Object.defineProperty,_t=o((e,t)=>It(e,"name",{value:t,configurable:!0}),"r$2");function ee(e,t,n){typeof t=="object"&&(n=t,t=void 0);const r=z(e,{buffer:!0,encoding:void 0});let i=new TextDecoder().decode(r);const{beforeParse:c,color:l}=n??{};return typeof c=="function"&&(i=c(i)),w.F(i,t,h.toPath(e),{color:l})}o(ee,"J");_t(ee,"readJsonSync");var Rt=Object.defineProperty,Ut=o((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"e$1");async function te(e,t,n){const{buffer:r,compression:i,encoding:c="utf8",flag:l,...y}=n??{},d=await Y(e,{buffer:r,compression:i,encoding:c,flag:l});return typeof t=="function"?k.parse(d,t,y):k.parse(d,y)}o(te,"d$2");Ut(te,"readYaml");var Yt=Object.defineProperty,zt=o((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"i$6");function ne(e,t,n){const{buffer:r,compression:i,encoding:c="utf8",flag:l,...y}=n??{},d=z(e,{buffer:r,compression:i,encoding:c,flag:l});return typeof t=="function"?k.parse(d,t,y):k.parse(d,y)}o(ne,"d$1");zt(ne,"readYamlSync");var Jt=Object.defineProperty,Kt=o((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"i$5");const qt=Kt(async(e,t)=>{if(w.s(e),!u.existsSync(e)){await m.mkdir(e,{recursive:!0});return}for await(const n of await m.readdir(e))await m.rm(s.join(h.toPath(e),n),{...t,force:!0,recursive:!0})},"emptyDir"),Ct=qt;var Wt=Object.defineProperty,Mt=o((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"o");const Xt=Mt((e,t)=>{if(w.s(e),!u.existsSync(e)){u.mkdirSync(e,{recursive:!0});return}for(const n of u.readdirSync(e))u.rmSync(s.join(h.toPath(e),n),{...t,force:!0,recursive:!0})},"emptyDir"),Bt=Xt;var Vt=Object.defineProperty,Ht=o((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"t$1");const Gt=Ht(async(e,t={})=>{w.s(e);try{await m.unlink(e)}catch{}try{await m.rm(e,{force:!0,maxRetries:t?.maxRetries,recursive:!0,retryDelay:t?.retryDelay})}catch{}},"remove"),Qt=Gt;var Zt=Object.defineProperty,en=o((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"t");const tn=en((e,t={})=>{w.s(e);try{u.unlinkSync(e)}catch{}try{u.rmSync(e,{force:!0,maxRetries:t?.maxRetries,recursive:!0,retryDelay:t?.retryDelay})}catch{}},"removeSync"),nn=tn;var rn=Object.defineProperty,an=o((e,t)=>rn(e,"name",{value:t,configurable:!0}),"f$1");const on=new TextEncoder,re=an(e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return on.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},"toUint8Array");var cn=Object.defineProperty,sn=o((e,t)=>cn(e,"name",{value:t,configurable:!0}),"d");const ln=sn(async(e,t,n)=>{n={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...n},w.s(e),w.v(t),e=h.toPath(e);try{const r=await S(e,O);if(!r&&n.recursive){const l=s.dirname(e);await S(l,O)||await m.mkdir(l,{recursive:!0})}let i;await m.writeFile(`${e}.tmp`,re(t),{encoding:n.encoding,flag:n.flag}),r&&!n.overwrite&&(i=await m.stat(e),n.chown===void 0&&(n.chown={gid:i.gid,uid:i.uid}),await m.rename(e,`${e}.bak`));const c=`${e}.tmp`;if(n.chown)try{await m.chown(c,n.chown.uid,n.chown.gid)}catch{}await m.chmod(c,i&&!n.mode?i.mode:n.mode??438),await m.rename(c,e)}catch(r){throw new Error(`Failed to write file at: ${e} - ${r.message}`,{cause:r})}finally{await S(`${e}.tmp`)&&await m.unlink(`${e}.tmp`)}},"writeFile"),J=ln;var yn=Object.defineProperty,fn=o((e,t)=>yn(e,"name",{value:t,configurable:!0}),"f");const dn=fn((e,t,n)=>{n={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...n},w.s(e),w.v(t),e=h.toPath(e);try{const r=P(e,O);if(!r&&n.recursive){const l=s.dirname(e);P(l,O)||u.mkdirSync(l,{recursive:!0})}let i;u.writeFileSync(`${e}.tmp`,re(t),{encoding:n.encoding,flag:n.flag}),r&&!n.overwrite&&(i=u.statSync(e),n.chown===void 0&&(n.chown={gid:i.gid,uid:i.uid}),u.renameSync(e,`${e}.bak`));const c=`${e}.tmp`;if(n.chown)try{u.chownSync(c,n.chown.uid,n.chown.gid)}catch{}u.chmodSync(c,i&&!n.mode?i.mode:n.mode??438),u.renameSync(c,e)}catch(r){throw new Error(`Failed to write file at: ${e} - ${r.message}`,{cause:r})}finally{P(`${e}.tmp`)&&u.unlinkSync(`${e}.tmp`)}},"writeFileSync"),K=dn,un=/^(?:( )+|\t+)/,E="space",ie="tab";function W(e,t){const n=new Map;let r=0,i,c;for(const l of e.split(/\n/g)){if(!l)continue;let y,d,f,p,a;const v=l.match(un);if(v===null)r=0,i="";else{if(y=v[0].length,d=v[1]?E:ie,t&&d===E&&y===1)continue;d!==i&&(r=0),i=d,f=1,p=0;const D=y-r;if(r=y,D===0)f=0,p=1;else{const se=D>0?D:-D;c=mn(d,se)}a=n.get(c),a=a===void 0?[1,0]:[a[0]+f,a[1]+p],n.set(c,a)}}return n}o(W,"makeIndentsMap");function mn(e,t){return(e===E?"s":"t")+String(t)}o(mn,"encodeIndentsKey");function pn(e){const n=e[0]==="s"?E:ie,r=Number(e.slice(1));return{type:n,amount:r}}o(pn,"decodeIndentsKey");function wn(e){let t,n=0,r=0;for(const[i,[c,l]]of e)(c>n||c===n&&l>r)&&(n=c,r=l,t=i);return t}o(wn,"getMostUsedKey");function hn(e,t){return(e===E?" ":" ").repeat(t)}o(hn,"makeIndentString");function ae(e){if(typeof e!="string")throw new TypeError("Expected a string");let t=W(e,!0);t.size===0&&(t=W(e,!1));const n=wn(t);let r,i=0,c="";return n!==void 0&&({type:r,amount:i}=pn(n),c=hn(r,i)),{amount:i,type:r,indent:c}}o(ae,"detectIndent");var vn=Object.defineProperty,gn=o((e,t)=>vn(e,"name",{value:t,configurable:!0}),"r$1");const $n=gn(async(e,t,n={})=>{const{detectIndent:r,indent:i,replacer:c,stringify:l=JSON.stringify,...y}={indent:" ",...n};let d=i,f=`
|
|
4
|
+
`;if(await S(e,j))try{const a=await m.readFile(e,"utf8");if(r){const{indent:v}=ae(a);d=v}f=a.endsWith(`
|
|
18
5
|
`)?`
|
|
19
|
-
`:""
|
|
20
|
-
`;if(
|
|
6
|
+
`:""}catch(a){if(a.code!=="ENOENT")throw a}const p=l(t,c,d);await J(e,`${p}${f}`,y)},"writeJson"),bn=$n;var Sn=Object.defineProperty,Pn=o((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"r");const kn=Pn((e,t,n={})=>{const{detectIndent:r,indent:i,replacer:c,stringify:l=JSON.stringify,...y}={indent:" ",...n};let d=i,f=`
|
|
7
|
+
`;if(P(e,j))try{const a=u.readFileSync(e,"utf8");if(r){const{indent:v}=ae(a);d=v}f=a.endsWith(`
|
|
21
8
|
`)?`
|
|
22
|
-
`:""
|
|
23
|
-
|
|
24
|
-
exports.CRLF = z;
|
|
25
|
-
exports.EOL = le;
|
|
26
|
-
exports.FIND_UP_STOP = T;
|
|
27
|
-
exports.F_OK = O;
|
|
28
|
-
exports.LF = H;
|
|
29
|
-
exports.R_OK = k;
|
|
30
|
-
exports.W_OK = xt;
|
|
31
|
-
exports.X_OK = Ft;
|
|
32
|
-
exports.collect = ke;
|
|
33
|
-
exports.collectSync = We;
|
|
34
|
-
exports.detect = de;
|
|
35
|
-
exports.emptyDir = vr;
|
|
36
|
-
exports.emptyDirSync = Vr;
|
|
37
|
-
exports.ensureDir = R;
|
|
38
|
-
exports.ensureDirSync = x;
|
|
39
|
-
exports.ensureFile = It;
|
|
40
|
-
exports.ensureFileSync = Vt;
|
|
41
|
-
exports.ensureLink = Kt;
|
|
42
|
-
exports.ensureLinkSync = Xt;
|
|
43
|
-
exports.ensureSymlink = oe;
|
|
44
|
-
exports.ensureSymlinkSync = me;
|
|
45
|
-
exports.findUp = ze;
|
|
46
|
-
exports.findUpSync = He;
|
|
47
|
-
exports.format = ye;
|
|
48
|
-
exports.isAccessible = S;
|
|
49
|
-
exports.isAccessibleSync = h;
|
|
50
|
-
exports.readFile = v;
|
|
51
|
-
exports.readFileSync = U;
|
|
52
|
-
exports.readJson = gr;
|
|
53
|
-
exports.readJsonSync = hr;
|
|
54
|
-
exports.readYaml = Rr;
|
|
55
|
-
exports.readYamlSync = Fr;
|
|
56
|
-
exports.remove = zr;
|
|
57
|
-
exports.removeSync = Br;
|
|
58
|
-
exports.walk = D;
|
|
59
|
-
exports.walkSync = L;
|
|
60
|
-
exports.writeFile = I;
|
|
61
|
-
exports.writeFileSync = A;
|
|
62
|
-
exports.writeJson = xo;
|
|
63
|
-
exports.writeJsonSync = bo;
|
|
64
|
-
exports.writeYaml = ko;
|
|
65
|
-
exports.writeYamlSync = Do;
|
|
66
|
-
//# sourceMappingURL=out.js.map
|
|
67
|
-
//# sourceMappingURL=index.cjs.map
|
|
9
|
+
`:""}catch(a){if(a.code!=="ENOENT")throw a}const p=l(t,c,d);K(e,`${p}${f}`,y)},"writeJsonSync"),On=kn;var Fn=Object.defineProperty,En=o((e,t)=>Fn(e,"name",{value:t,configurable:!0}),"n");async function oe(e,t,n,r){const i=typeof n=="function"||Array.isArray(n)?k.stringify(t,n,r):k.stringify(t,n);await J(e,i)}o(oe,"m$1");En(oe,"writeYaml");var jn=Object.defineProperty,Dn=o((e,t)=>jn(e,"name",{value:t,configurable:!0}),"i");function ce(e,t,n,r){const i=typeof n=="function"||Array.isArray(n)?k.stringify(t,n,r):k.stringify(t,n);K(e,i)}o(ce,"m");Dn(ce,"writeYamlSync");exports.CRLF=T;exports.EOL=Qe;exports.FIND_UP_STOP=R;exports.F_OK=O;exports.LF=U;exports.R_OK=j;exports.W_OK=fe;exports.X_OK=de;exports.collect=yt;exports.collectSync=wt;exports.detect=Ze;exports.emptyDir=Ct;exports.emptyDirSync=Bt;exports.ensureDir=N;exports.ensureDirSync=L;exports.ensureFile=ke;exports.ensureFileSync=je;exports.ensureLink=Le;exports.ensureLinkSync=Ue;exports.ensureSymlink=We;exports.ensureSymlinkSync=He;exports.findUp=gt;exports.findUpSync=St;exports.format=et;exports.isAccessible=S;exports.isAccessibleSync=P;exports.readFile=Y;exports.readFileSync=z;exports.readJson=Z;exports.readJsonSync=ee;exports.readYaml=te;exports.readYamlSync=ne;exports.remove=Qt;exports.removeSync=nn;exports.walk=I;exports.walkSync=_;exports.writeFile=J;exports.writeFileSync=K;exports.writeJson=bn;exports.writeJsonSync=On;exports.writeYaml=oe;exports.writeYamlSync=ce;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, b as ReadJsonOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, J as JsonValue, b as ReadJsonOptions, c as JsonReviver, d as ReadYamlOptions, Y as YamlReviver, E as EmptyDirOptions, e as WriteFileOptions, f as WriteJsonOptions, g as YamlReplacer } from './shared/fs.CpT5ICZl.cjs';
|
|
2
|
+
export { l as CodeFrameLocation, i as FIND_UP_STOP, h as F_OK, m as JsonReplacer, j as R_OK, n as ReadFileEncoding, k as W_OK, X as X_OK } from './shared/fs.CpT5ICZl.cjs';
|
|
3
3
|
import { symlink } from 'node:fs';
|
|
4
|
-
import { JsonValue } from 'type-fest';
|
|
5
4
|
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
6
5
|
|
|
7
6
|
declare const ensureDir: (directory: URL | string) => Promise<void>;
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, J as JsonValue, b as ReadJsonOptions, c as JsonReviver, d as ReadYamlOptions, Y as YamlReviver, E as EmptyDirOptions, e as WriteFileOptions, f as WriteJsonOptions, g as YamlReplacer } from './shared/fs.CpT5ICZl.mjs';
|
|
2
|
+
export { l as CodeFrameLocation, i as FIND_UP_STOP, h as F_OK, m as JsonReplacer, j as R_OK, n as ReadFileEncoding, k as W_OK, X as X_OK } from './shared/fs.CpT5ICZl.mjs';
|
|
3
|
+
import { symlink } from 'node:fs';
|
|
4
|
+
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
5
|
+
|
|
6
|
+
declare const ensureDir: (directory: URL | string) => Promise<void>;
|
|
7
|
+
|
|
8
|
+
declare const ensureDirSync: (directory: URL | string) => void;
|
|
9
|
+
|
|
10
|
+
declare const ensureFile: (filePath: URL | string) => Promise<void>;
|
|
11
|
+
|
|
12
|
+
declare const ensureFileSync: (filePath: URL | string) => void;
|
|
13
|
+
|
|
14
|
+
declare const ensureLink: (source: URL | string, destination: URL | string) => Promise<void>;
|
|
15
|
+
|
|
16
|
+
declare const ensureLinkSync: (source: URL | string, destination: URL | string) => void;
|
|
17
|
+
|
|
18
|
+
declare const ensureSymlink: (target: URL | string, linkName: URL | string, type?: symlink.Type) => Promise<void>;
|
|
19
|
+
|
|
20
|
+
declare const ensureSymlinkSync: (target: URL | string, linkName: URL | string, type?: symlink.Type) => void;
|
|
21
|
+
|
|
22
|
+
declare const LF: "\n";
|
|
23
|
+
declare const CRLF: "\r\n";
|
|
24
|
+
declare const EOL: "\n" | "\r\n";
|
|
25
|
+
declare const detect: (content: string) => typeof EOL | null;
|
|
26
|
+
declare const format: (content: string, eol: typeof EOL) => string;
|
|
27
|
+
|
|
28
|
+
declare const collect: (directory: string, options?: WalkOptions) => Promise<string[]>;
|
|
29
|
+
|
|
30
|
+
declare const collectSync: (directory: string, options?: WalkOptions) => string[];
|
|
31
|
+
|
|
32
|
+
declare const findUp: (name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match | Promise<Match>), options?: FindUpOptions) => Promise<string | undefined>;
|
|
33
|
+
|
|
34
|
+
declare const findUpSync: (name: ReadonlyArray<string> | string[] | string | ((directory: string) => Match), options?: FindUpOptions) => string | undefined;
|
|
35
|
+
|
|
36
|
+
declare function walk(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): AsyncIterableIterator<WalkEntry>;
|
|
37
|
+
|
|
38
|
+
declare function walkSync(directory: URL | string, { extensions, followSymlinks, includeDirs: includeDirectories, includeFiles, includeSymlinks, match, maxDepth, skip, }?: WalkOptions): IterableIterator<WalkEntry>;
|
|
39
|
+
|
|
40
|
+
declare function isAccessible(path: URL | string, mode?: number): Promise<boolean>;
|
|
41
|
+
|
|
42
|
+
declare function isAccessibleSync(path: URL | string, mode?: number): boolean;
|
|
43
|
+
|
|
44
|
+
declare const readFile: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => Promise<ContentType<O>>;
|
|
45
|
+
|
|
46
|
+
declare const readFileSync: <O extends ReadFileOptions<"brotli" | "gzip" | "none"> | undefined = undefined>(path: URL | string, options?: O) => ContentType<O>;
|
|
47
|
+
|
|
48
|
+
declare function readJson<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): Promise<T>;
|
|
49
|
+
declare function readJson<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): Promise<T>;
|
|
50
|
+
|
|
51
|
+
declare function readJsonSync<T extends JsonValue>(path: URL | string, options?: ReadJsonOptions): T;
|
|
52
|
+
declare function readJsonSync<T extends JsonValue>(path: URL | string, reviver: JsonReviver, options?: ReadJsonOptions): T;
|
|
53
|
+
|
|
54
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
55
|
+
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
56
|
+
|
|
57
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
58
|
+
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
59
|
+
|
|
60
|
+
declare const emptyDir$1: (dir: URL | string, options?: EmptyDirOptions) => Promise<void>;
|
|
61
|
+
|
|
62
|
+
declare const emptyDir: (dir: URL | string, options?: EmptyDirOptions) => void;
|
|
63
|
+
|
|
64
|
+
declare const remove: (path: URL | string, options?: {
|
|
65
|
+
maxRetries?: number | undefined;
|
|
66
|
+
retryDelay?: number | undefined;
|
|
67
|
+
}) => Promise<void>;
|
|
68
|
+
|
|
69
|
+
declare const removeSync: (path: URL | string, options?: {
|
|
70
|
+
maxRetries?: number | undefined;
|
|
71
|
+
retryDelay?: number | undefined;
|
|
72
|
+
}) => void;
|
|
73
|
+
|
|
74
|
+
declare const writeFile: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => Promise<void>;
|
|
75
|
+
|
|
76
|
+
declare const writeFileSync: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => void;
|
|
77
|
+
|
|
78
|
+
declare const writeJson: (path: URL | string, data: unknown, options?: WriteJsonOptions) => Promise<void>;
|
|
79
|
+
|
|
80
|
+
declare const writeJsonSync: (path: URL | string, data: unknown, options?: WriteJsonOptions) => void;
|
|
81
|
+
|
|
82
|
+
type Options$1 = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
83
|
+
declare function writeYaml(path: URL | string, data: any, options?: Options$1): Promise<void>;
|
|
84
|
+
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options$1 | number | string): Promise<void>;
|
|
85
|
+
|
|
86
|
+
type Options = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions;
|
|
87
|
+
declare function writeYamlSync(path: URL | string, data: any, options?: Options): void;
|
|
88
|
+
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: Options | number | string): void;
|
|
89
|
+
|
|
90
|
+
export { CRLF, EOL, EmptyDirOptions, FindUpOptions, JsonReviver, LF, ReadFileOptions, ReadJsonOptions, WalkEntry, WalkOptions, WriteFileOptions, WriteJsonOptions, YamlReplacer, collect, collectSync, detect, emptyDir$1 as emptyDir, emptyDir as emptyDirSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, ensureLink, ensureLinkSync, ensureSymlink, ensureSymlinkSync, findUp, findUpSync, format, isAccessible, isAccessibleSync, readFile, readFileSync, readJson, readJsonSync, readYaml, readYamlSync, remove, removeSync, walk, walkSync, writeFile, writeFileSync, writeJson, writeJsonSync, writeYaml, writeYamlSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, b as ReadJsonOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { W as WalkOptions, M as Match, F as FindUpOptions, a as WalkEntry, R as ReadFileOptions, C as ContentType, J as JsonValue, b as ReadJsonOptions, c as JsonReviver, d as ReadYamlOptions, Y as YamlReviver, E as EmptyDirOptions, e as WriteFileOptions, f as WriteJsonOptions, g as YamlReplacer } from './shared/fs.CpT5ICZl.js';
|
|
2
|
+
export { l as CodeFrameLocation, i as FIND_UP_STOP, h as F_OK, m as JsonReplacer, j as R_OK, n as ReadFileEncoding, k as W_OK, X as X_OK } from './shared/fs.CpT5ICZl.js';
|
|
3
3
|
import { symlink } from 'node:fs';
|
|
4
|
-
import { JsonValue } from 'type-fest';
|
|
5
4
|
import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToStringOptions } from 'yaml';
|
|
6
5
|
|
|
7
6
|
declare const ensureDir: (directory: URL | string) => Promise<void>;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var Te=Object.defineProperty;var o=(e,n)=>Te(e,"name",{value:n,configurable:!0});import{lstat as b,mkdir as W,writeFile as Q,link as Ae,stat as k,symlink as Le,readlink as Ie,readdir as Z,realpath as Ne,access as Re,readFile as ee,rm as ne,unlink as te,rename as B,chown as Ue,chmod as _e}from"node:fs/promises";import{s as m,F as ie,v as re}from"./shared/fs.BRjynomN.mjs";import{lstatSync as S,mkdirSync as z,writeFileSync as ae,linkSync as Ye,statSync as O,symlinkSync as Je,readlinkSync as We,readdirSync as oe,realpathSync as ze,accessSync as Ce,readFileSync as ce,existsSync as se,rmSync as le,unlinkSync as fe,renameSync as V,chownSync as Ke,chmodSync as Me}from"node:fs";import{dirname as v,toNamespacedPath as g,resolve as w,join as U,normalize as T,basename as ye,parse as ue,isAbsolute as de}from"@visulima/path";import{toPath as d}from"@visulima/path/utils";import{l as A,i as L,s as Y}from"./shared/fs.BMHe7vX1.mjs";import{platform as Xe}from"node:process";import{brotliDecompress as Be,unzip as Ve,brotliDecompressSync as He,unzipSync as Ge}from"node:zlib";import{parse as I,stringify as N}from"yaml";const P=0,_=4,yi=2,ui=1,me=Symbol("findUpStop");var qe=Object.defineProperty,Qe=o((e,n)=>qe(e,"name",{value:n,configurable:!0}),"i$b");const $=Qe(e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},"getFileInfoType");var Ze=Object.defineProperty,en=o((e,n)=>Ze(e,"name",{value:n,configurable:!0}),"i$a");const nn=en(async e=>{m(e);try{const n=await b(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(n)}'`);return}catch(n){if(n.code!=="ENOENT")throw n}try{await W(e,{recursive:!0})}catch(n){if(n.code!=="EEXIST")throw n;const t=await b(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(t)}'`)}},"ensureDir"),C=nn;var tn=Object.defineProperty,rn=o((e,n)=>tn(e,"name",{value:n,configurable:!0}),"o$9");const an=rn(e=>{m(e);try{const n=S(e);if(!n.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(n)}'`);return}catch(n){if(n.code!=="ENOENT")throw n}try{z(e,{recursive:!0})}catch(n){if(n.code!=="EEXIST")throw n;const t=S(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${$(t)}'`)}},"ensureDirSync"),K=an;var on=Object.defineProperty,cn=o((e,n)=>on(e,"name",{value:n,configurable:!0}),"e$5");const sn=cn(async e=>{m(e);try{const n=await b(e);if(!n.isFile())throw new Error(`Ensure path exists, expected 'file', got '${$(n)}'`)}catch(n){if(n.code==="ENOENT"){await C(v(d(e))),await Q(e,new Uint8Array);return}throw n}},"ensureFile"),di=sn;var ln=Object.defineProperty,fn=o((e,n)=>ln(e,"name",{value:n,configurable:!0}),"e$4");const yn=fn(e=>{m(e);try{const n=S(e);if(!n.isFile())throw new Error(`Ensure path exists, expected 'file', got '${$(n)}'`)}catch(n){if(n.code==="ENOENT"){K(v(d(e))),ae(e,new Uint8Array);return}throw n}},"ensureFileSync"),mi=yn;var un=Object.defineProperty,dn=o((e,n)=>un(e,"name",{value:n,configurable:!0}),"d$6");const D=dn((e,n)=>!!n.ino&&!!n.dev&&n.ino===e.ino&&n.dev===e.dev,"isStatsIdentical");var mn=Object.defineProperty,pn=o((e,n)=>mn(e,"name",{value:n,configurable:!0}),"m$8");const wn=pn(async(e,n)=>{m(e),m(n),e=g(d(e)),n=g(d(n));let t;try{t=await b(n)}catch{}let i;try{i=await b(e)}catch(r){throw r.message=r.message.replace("lstat","ensureLink"),r}t&&D(i,t)||(await C(v(n)),await Ae(e,n))},"ensureLink"),pi=wn;var vn=Object.defineProperty,gn=o((e,n)=>vn(e,"name",{value:n,configurable:!0}),"o$6");const $n=gn((e,n)=>{m(e),m(n),e=g(d(e)),n=g(d(n));let t;try{t=S(n)}catch{}let i;try{i=S(e)}catch(r){throw r.message=r.message.replace("lstat","ensureLink"),r}t&&D(i,t)||(K(v(n)),Ye(e,n))},"ensureLinkSync"),wi=$n;var hn=Object.defineProperty,bn=o((e,n)=>hn(e,"name",{value:n,configurable:!0}),"i$9");const pe=bn((e,n)=>typeof e!="string"?e:e.startsWith("./")?w(e):typeof n=="string"?w(v(n),e):new URL(e,n),"resolveSymlinkTarget");var Sn=Object.defineProperty,kn=o((e,n)=>Sn(e,"name",{value:n,configurable:!0}),"f$4");const On=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),En=kn(async(e,n,t)=>{m(e),m(n);const i=pe(e,n);n=g(d(n));try{if((await b(n)).isSymbolicLink()&&D(await k(i),await k(n))){const[l,y]=await Promise.all([k(i),k(n)]);if(D(l,y))return}}catch{}const r=await b(i),c=$(r);await C(v(n));const s=t??(On?"junction":c==="dir"?"dir":"file");try{await Le(g(d(i)),n,s)}catch(l){if(l.code!=="EEXIST")throw l;const y=await b(n);if(!y.isSymbolicLink())throw new A("A "+$(y)+" already exists at the path: "+n);const f=await Ie(n),u=g(w(f));if(u!==i)throw new A("A symlink targeting to an undesired path already exists: "+n+" -> "+u)}},"ensureSymlink"),vi=En;var Fn=Object.defineProperty,Pn=o((e,n)=>Fn(e,"name",{value:n,configurable:!0}),"f$3");const Dn=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),jn=Pn((e,n,t)=>{m(e),m(n);const i=pe(e,n);n=g(d(n));try{if(S(n).isSymbolicLink()&&D(O(i),O(n))){const l=O(i),y=O(n);if(D(l,y))return}}catch{}const r=S(i),c=$(r);K(v(n));const s=t??(Dn?"junction":c==="dir"?"dir":"file");try{Je(g(d(i)),n,s)}catch(l){if(l.code!=="EEXIST")throw l;const y=S(n);if(!y.isSymbolicLink())throw new A("A "+$(y)+" already exists at the path: "+n);const f=We(n),u=g(w(f));if(u!==i)throw new A("A symlink targeting to an undesired path already exists: "+n+" -> "+u)}},"ensureSymlinkSync"),gi=jn;var xn=Object.defineProperty,we=o((e,n)=>xn(e,"name",{value:n,configurable:!0}),"r$4");const ve=/\r?\n/g,ge=`
|
|
2
|
+
`,J=`\r
|
|
3
|
+
`,$i=Xe==="win32"?J:ge,hi=we(e=>{const n=e.match(ve);if(!n||n.length===0)return null;const t=n.filter(r=>r===J).length,i=n.length-t;return t>i?J:ge},"detect"),bi=we((e,n)=>e.replaceAll(ve,n),"format");var Tn=Object.defineProperty,An=o((e,n)=>Tn(e,"name",{value:n,configurable:!0}),"r$3");const R=An(e=>{const n=e.replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,"\\.").replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");return new RegExp(`^${n}$`)},"globToRegExp");var Ln=Object.defineProperty,In=o((e,n)=>Ln(e,"name",{value:n,configurable:!0}),"t$4");const h=In((e,n,t,i)=>Array.isArray(n)&&n.length>0&&!n.some(r=>e.endsWith(r))||t&&!t.some(r=>r.test(e))?!1:!(i&&i.some(r=>r.test(e))),"walkInclude");var Nn=Object.defineProperty,$e=o((e,n)=>Nn(e,"name",{value:n,configurable:!0}),"f$2");const Rn=$e(async e=>{const n=T(e),t=ye(n),i=await k(n);return{isDirectory:i.isDirectory,isFile:i.isFile,isSymbolicLink:i.isSymbolicLink,name:t,path:n}},"_createWalkEntry");async function*M(e,{extensions:n,followSymlinks:t=!1,includeDirs:i=!0,includeFiles:r=!0,includeSymlinks:c=!0,match:s,maxDepth:l=Number.POSITIVE_INFINITY,skip:y}={}){if(m(e),l<0)return;const f=s?s.map(a=>typeof a=="string"?R(a):a):void 0,u=y?y.map(a=>typeof a=="string"?R(a):a):void 0;if(e=w(d(e)),i&&h(e,n,f,u)&&(yield await Rn(e)),!(l<1||!h(e,void 0,void 0,u)))try{for await(const a of await Z(e,{withFileTypes:!0})){let p=U(e,a.name);if(a.isSymbolicLink())if(t)p=await Ne(p);else if(c&&h(p,n,f,u))yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:p};else continue;a.isSymbolicLink()||a.isDirectory()?yield*M(p,{extensions:n,followSymlinks:t,includeDirs:i,includeFiles:r,includeSymlinks:c,match:f,maxDepth:l-1,skip:u}):a.isFile()&&r&&h(p,n,f,u)&&(yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:p})}}catch(a){throw a instanceof L?a:new L(a,e)}}o(M,"d$5");$e(M,"walk");var Un=Object.defineProperty,_n=o((e,n)=>Un(e,"name",{value:n,configurable:!0}),"e$2");const Yn=_n(async(e,n={})=>{Array.isArray(n.extensions)||(n.extensions=["js","mjs","cjs","ts"]);const t=[];for await(const i of M(e,n))t.push(i.path);return t},"collect"),Si=Yn;var Jn=Object.defineProperty,he=o((e,n)=>Jn(e,"name",{value:n,configurable:!0}),"m$7");const Wn=he(e=>{const n=T(e),t=O(n);return{isDirectory:t.isDirectory,isFile:t.isFile,isSymbolicLink:t.isSymbolicLink,name:ye(n),path:n}},"_createWalkEntry");function*X(e,{extensions:n,followSymlinks:t=!1,includeDirs:i=!0,includeFiles:r=!0,includeSymlinks:c=!0,match:s,maxDepth:l=Number.POSITIVE_INFINITY,skip:y}={}){if(m(e),l<0)return;const f=s?s.map(a=>typeof a=="string"?R(a):a):void 0,u=y?y.map(a=>typeof a=="string"?R(a):a):void 0;if(e=w(d(e)),i&&h(e,n,f,u)&&(yield Wn(e)),!(l<1||!h(e,void 0,void 0,u)))try{for(const a of oe(e,{withFileTypes:!0})){let p=U(e,a.name);if(a.isSymbolicLink())if(t)p=ze(p);else if(c&&h(p,n,f,u))yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:T(p)};else continue;a.isSymbolicLink()||a.isDirectory()?yield*X(p,{extensions:n,followSymlinks:t,includeDirs:i,includeFiles:r,includeSymlinks:c,match:f,maxDepth:l-1,skip:u}):a.isFile()&&r&&h(p,n,f,u)&&(yield{isDirectory:a.isDirectory,isFile:a.isFile,isSymbolicLink:a.isSymbolicLink,name:a.name,path:T(p)})}}catch(a){throw a instanceof L?a:new L(a,e)}}o(X,"h$2");he(X,"walkSync");var zn=Object.defineProperty,Cn=o((e,n)=>zn(e,"name",{value:n,configurable:!0}),"n$5");const Kn=Cn((e,n={})=>{Array.isArray(n.extensions)||(n.extensions=["js","mjs","cjs","ts"]);const t=[];for(const i of X(e,n))t.push(i.path);return t},"collectSync"),ki=Kn;var Mn=Object.defineProperty,H=o((e,n)=>Mn(e,"name",{value:n,configurable:!0}),"n$4");const Xn=H(async(e,n={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const t=n.cwd?d(n.cwd):process.cwd();let i=w(t);const{root:r}=ue(i),c=d(n.stopAt??r),s=w(i,c),l=n.type??"file",y=H(async function(f){return typeof e=="function"?[await e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]},"getMatchers");for(;i&&i!==s&&i!==r;){for await(const f of await y(i)){if(f===me)return;if(f===void 0)continue;const u=de(f)?f:w(i,f);try{const a=await k(u);if(l==="file"&&a.isFile()||l==="directory"&&a.isDirectory())return u}catch{}}i=v(i)}},"findUp"),Oi=Xn;var Bn=Object.defineProperty,G=o((e,n)=>Bn(e,"name",{value:n,configurable:!0}),"o$3");const Vn=G((e,n={})=>{if(typeof e!="string"&&!Array.isArray(e)&&typeof e!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const t=n.cwd?d(n.cwd):process.cwd();let i=w(t);const{root:r}=ue(i),c=d(n.stopAt??r),s=w(i,c),l=n.type??"file",y=G(function(f){return typeof e=="function"?[e(f)]:typeof e=="string"?[e]:Array.isArray(e)?e:[e]},"getMatchers");for(;i&&i!==s&&i!==r;){for(const f of y(i)){if(f===me)return;if(f===void 0)continue;const u=de(f)?f:w(i,f);try{const a=O(u);if(l==="file"&&a.isFile()||l==="directory"&&a.isDirectory())return u}catch{}}i=v(i)}},"findUpSync"),Ei=Vn;var Hn=Object.defineProperty,Gn=o((e,n)=>Hn(e,"name",{value:n,configurable:!0}),"o$2");async function E(e,n=P){m(e),e=d(e);try{return await Re(e,n),!0}catch{return!1}}o(E,"m$6");Gn(E,"isAccessible");var qn=Object.defineProperty,Qn=o((e,n)=>qn(e,"name",{value:n,configurable:!0}),"o$1");function F(e,n=P){m(e),e=d(e);try{return Ce(e,n),!0}catch{return!1}}o(F,"m$5");Qn(F,"isAccessibleSync");var Zn=Object.defineProperty,be=o((e,n)=>Zn(e,"name",{value:n,configurable:!0}),"n$3");const et={brotli:Be,gzip:Ve,none:be((e,n)=>{n(null,e)},"none")},nt=be(async(e,n)=>{if(m(e),e=d(e),!await E(e))throw new Y(`unable to read the non-accessible file: ${e}`);if(!await E(e,_))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:t,compression:i,encoding:r,flag:c}=n??{};return await ee(e,c?{encoding:r,flag:c}:{encoding:r}).then(async s=>await new Promise((l,y)=>{et[i??"none"](s,(f,u)=>{f?y(f):l(t?u:u.toString())})})).catch(s=>{throw s})},"readFile"),Se=nt;var tt=Object.defineProperty,ke=o((e,n)=>tt(e,"name",{value:n,configurable:!0}),"n$2");const it={brotli:He,gzip:Ge,none:ke(e=>e,"none")},rt=ke((e,n)=>{if(m(e),e=d(e),!F(e))throw new Y(`unable to read the non-accessible file: ${e}`);if(!F(e,_))throw new Y(`invalid access to read file at: ${e}`);const{buffer:t,compression:i,encoding:r,flag:c}=n??{},s=ce(e,c?{encoding:r,flag:c}:{encoding:r}),l=it[i??"none"](s);return t?l:l.toString()},"readFileSync"),Oe=rt;var at=Object.defineProperty,ot=o((e,n)=>at(e,"name",{value:n,configurable:!0}),"i$7");async function ct(e,n,t){typeof n=="object"&&(t=n,n=void 0);const i=await Se(e,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(i);const{beforeParse:c,color:s}=t??{};return typeof c=="function"&&(r=c(r)),ie(r,n,d(e),{color:s})}o(ct,"c");ot(ct,"readJson");var st=Object.defineProperty,lt=o((e,n)=>st(e,"name",{value:n,configurable:!0}),"r$2");function ft(e,n,t){typeof n=="object"&&(t=n,n=void 0);const i=Oe(e,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(i);const{beforeParse:c,color:s}=t??{};return typeof c=="function"&&(r=c(r)),ie(r,n,d(e),{color:s})}o(ft,"J");lt(ft,"readJsonSync");var yt=Object.defineProperty,ut=o((e,n)=>yt(e,"name",{value:n,configurable:!0}),"e$1");async function dt(e,n,t){const{buffer:i,compression:r,encoding:c="utf8",flag:s,...l}=t??{},y=await Se(e,{buffer:i,compression:r,encoding:c,flag:s});return typeof n=="function"?I(y,n,l):I(y,l)}o(dt,"d$2");ut(dt,"readYaml");var mt=Object.defineProperty,pt=o((e,n)=>mt(e,"name",{value:n,configurable:!0}),"i$6");function wt(e,n,t){const{buffer:i,compression:r,encoding:c="utf8",flag:s,...l}=t??{},y=Oe(e,{buffer:i,compression:r,encoding:c,flag:s});return typeof n=="function"?I(y,n,l):I(y,l)}o(wt,"d$1");pt(wt,"readYamlSync");var vt=Object.defineProperty,gt=o((e,n)=>vt(e,"name",{value:n,configurable:!0}),"i$5");const $t=gt(async(e,n)=>{if(m(e),!se(e)){await W(e,{recursive:!0});return}for await(const t of await Z(e))await ne(U(d(e),t),{...n,force:!0,recursive:!0})},"emptyDir"),Fi=$t;var ht=Object.defineProperty,bt=o((e,n)=>ht(e,"name",{value:n,configurable:!0}),"o");const St=bt((e,n)=>{if(m(e),!se(e)){z(e,{recursive:!0});return}for(const t of oe(e))le(U(d(e),t),{...n,force:!0,recursive:!0})},"emptyDir"),Pi=St;var kt=Object.defineProperty,Ot=o((e,n)=>kt(e,"name",{value:n,configurable:!0}),"t$1");const Et=Ot(async(e,n={})=>{m(e);try{await te(e)}catch{}try{await ne(e,{force:!0,maxRetries:n?.maxRetries,recursive:!0,retryDelay:n?.retryDelay})}catch{}},"remove"),Di=Et;var Ft=Object.defineProperty,Pt=o((e,n)=>Ft(e,"name",{value:n,configurable:!0}),"t");const Dt=Pt((e,n={})=>{m(e);try{fe(e)}catch{}try{le(e,{force:!0,maxRetries:n?.maxRetries,recursive:!0,retryDelay:n?.retryDelay})}catch{}},"removeSync"),ji=Dt;var jt=Object.defineProperty,xt=o((e,n)=>jt(e,"name",{value:n,configurable:!0}),"f$1");const Tt=new TextEncoder,Ee=xt(e=>{if(e instanceof Uint8Array)return e;if(typeof e=="string")return Tt.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e)){const n=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(n)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},"toUint8Array");var At=Object.defineProperty,Lt=o((e,n)=>At(e,"name",{value:n,configurable:!0}),"d");const It=Lt(async(e,n,t)=>{t={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...t},m(e),re(n),e=d(e);try{const i=await E(e,P);if(!i&&t.recursive){const s=v(e);await E(s,P)||await W(s,{recursive:!0})}let r;await Q(`${e}.tmp`,Ee(n),{encoding:t.encoding,flag:t.flag}),i&&!t.overwrite&&(r=await k(e),t.chown===void 0&&(t.chown={gid:r.gid,uid:r.uid}),await B(e,`${e}.bak`));const c=`${e}.tmp`;if(t.chown)try{await Ue(c,t.chown.uid,t.chown.gid)}catch{}await _e(c,r&&!t.mode?r.mode:t.mode??438),await B(c,e)}catch(i){throw new Error(`Failed to write file at: ${e} - ${i.message}`,{cause:i})}finally{await E(`${e}.tmp`)&&await te(`${e}.tmp`)}},"writeFile"),Fe=It;var Nt=Object.defineProperty,Rt=o((e,n)=>Nt(e,"name",{value:n,configurable:!0}),"f");const Ut=Rt((e,n,t)=>{t={encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...t},m(e),re(n),e=d(e);try{const i=F(e,P);if(!i&&t.recursive){const s=v(e);F(s,P)||z(s,{recursive:!0})}let r;ae(`${e}.tmp`,Ee(n),{encoding:t.encoding,flag:t.flag}),i&&!t.overwrite&&(r=O(e),t.chown===void 0&&(t.chown={gid:r.gid,uid:r.uid}),V(e,`${e}.bak`));const c=`${e}.tmp`;if(t.chown)try{Ke(c,t.chown.uid,t.chown.gid)}catch{}Me(c,r&&!t.mode?r.mode:t.mode??438),V(c,e)}catch(i){throw new Error(`Failed to write file at: ${e} - ${i.message}`,{cause:i})}finally{F(`${e}.tmp`)&&fe(`${e}.tmp`)}},"writeFileSync"),Pe=Ut,_t=/^(?:( )+|\t+)/,j="space",De="tab";function q(e,n){const t=new Map;let i=0,r,c;for(const s of e.split(/\n/g)){if(!s)continue;let l,y,f,u,a;const p=s.match(_t);if(p===null)i=0,r="";else{if(l=p[0].length,y=p[1]?j:De,n&&y===j&&l===1)continue;y!==r&&(i=0),r=y,f=1,u=0;const x=l-i;if(i=l,x===0)f=0,u=1;else{const xe=x>0?x:-x;c=Yt(y,xe)}a=t.get(c),a=a===void 0?[1,0]:[a[0]+f,a[1]+u],t.set(c,a)}}return t}o(q,"makeIndentsMap");function Yt(e,n){return(e===j?"s":"t")+String(n)}o(Yt,"encodeIndentsKey");function Jt(e){const t=e[0]==="s"?j:De,i=Number(e.slice(1));return{type:t,amount:i}}o(Jt,"decodeIndentsKey");function Wt(e){let n,t=0,i=0;for(const[r,[c,s]]of e)(c>t||c===t&&s>i)&&(t=c,i=s,n=r);return n}o(Wt,"getMostUsedKey");function zt(e,n){return(e===j?" ":" ").repeat(n)}o(zt,"makeIndentString");function je(e){if(typeof e!="string")throw new TypeError("Expected a string");let n=q(e,!0);n.size===0&&(n=q(e,!1));const t=Wt(n);let i,r=0,c="";return t!==void 0&&({type:i,amount:r}=Jt(t),c=zt(i,r)),{amount:r,type:i,indent:c}}o(je,"detectIndent");var Ct=Object.defineProperty,Kt=o((e,n)=>Ct(e,"name",{value:n,configurable:!0}),"r$1");const Mt=Kt(async(e,n,t={})=>{const{detectIndent:i,indent:r,replacer:c,stringify:s=JSON.stringify,...l}={indent:" ",...t};let y=r,f=`
|
|
4
|
+
`;if(await E(e,_))try{const a=await ee(e,"utf8");if(i){const{indent:p}=je(a);y=p}f=a.endsWith(`
|
|
5
|
+
`)?`
|
|
6
|
+
`:""}catch(a){if(a.code!=="ENOENT")throw a}const u=s(n,c,y);await Fe(e,`${u}${f}`,l)},"writeJson"),xi=Mt;var Xt=Object.defineProperty,Bt=o((e,n)=>Xt(e,"name",{value:n,configurable:!0}),"r");const Vt=Bt((e,n,t={})=>{const{detectIndent:i,indent:r,replacer:c,stringify:s=JSON.stringify,...l}={indent:" ",...t};let y=r,f=`
|
|
7
|
+
`;if(F(e,_))try{const a=ce(e,"utf8");if(i){const{indent:p}=je(a);y=p}f=a.endsWith(`
|
|
8
|
+
`)?`
|
|
9
|
+
`:""}catch(a){if(a.code!=="ENOENT")throw a}const u=s(n,c,y);Pe(e,`${u}${f}`,l)},"writeJsonSync"),Ti=Vt;var Ht=Object.defineProperty,Gt=o((e,n)=>Ht(e,"name",{value:n,configurable:!0}),"n");async function qt(e,n,t,i){const r=typeof t=="function"||Array.isArray(t)?N(n,t,i):N(n,t);await Fe(e,r)}o(qt,"m$1");Gt(qt,"writeYaml");var Qt=Object.defineProperty,Zt=o((e,n)=>Qt(e,"name",{value:n,configurable:!0}),"i");function ei(e,n,t,i){const r=typeof t=="function"||Array.isArray(t)?N(n,t,i):N(n,t);Pe(e,r)}o(ei,"m");Zt(ei,"writeYamlSync");export{J as CRLF,$i as EOL,me as FIND_UP_STOP,P as F_OK,ge as LF,_ as R_OK,yi as W_OK,ui as X_OK,Si as collect,ki as collectSync,hi as detect,Fi as emptyDir,Pi as emptyDirSync,C as ensureDir,K as ensureDirSync,di as ensureFile,mi as ensureFileSync,pi as ensureLink,wi as ensureLinkSync,vi as ensureSymlink,gi as ensureSymlinkSync,Oi as findUp,Ei as findUpSync,bi as format,E as isAccessible,F as isAccessibleSync,Se as readFile,Oe as readFileSync,ct as readJson,ft as readJsonSync,dt as readYaml,wt as readYamlSync,Di as remove,ji as removeSync,M as walk,X as walkSync,Fe as writeFile,Pe as writeFileSync,xi as writeJson,Ti as writeJsonSync,qt as writeYaml,ei as writeYamlSync};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});var i=Object.defineProperty,c=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"i");class s extends Error{static{t(this,"r")}static{c(this,"JSONError")}fileName;codeFrame;name="JSONError";#e;constructor(e){super(),this.#e=e,Error.captureStackTrace(this,s)}get message(){return`${this.#e}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
|
|
2
|
+
|
|
3
|
+
${this.codeFrame}
|
|
4
|
+
`:""}`}set message(e){this.#e=e}}const o=s;exports.c=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var t=(e,r)=>n(e,"name",{value:r,configurable:!0});var s=Object.defineProperty,a=t((e,r)=>s(e,"name",{value:r,configurable:!0}),"t$2");let E=class extends Error{static{t(this,"n")}static{a(this,"AlreadyExistsError")}constructor(r){super(`EEXIST: ${r}`)}get code(){return"EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}};const v=E;var i=Object.defineProperty,c=t((e,r)=>i(e,"name",{value:r,configurable:!0}),"o");let l=class extends Error{static{t(this,"n")}static{c(this,"PermissionError")}constructor(r){super(`EPERM: Operation not permitted, ${r}`)}get code(){return"EPERM"}set code(r){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(r){throw new Error("Cannot overwrite name of PermissionError")}};const h=l;var u=Object.defineProperty,m=t((e,r)=>u(e,"name",{value:r,configurable:!0}),"t");class p extends Error{static{t(this,"i")}static{m(this,"WalkError")}root;constructor(r,o){super(`${r instanceof Error?r.message:r} for path "${o}"`),this.cause=r,this.root=o}get name(){return"WalkError"}set name(r){throw new Error("Cannot overwrite name of WalkError")}}export{p as i,v as l,h as s};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var s=(e,t)=>S(e,"name",{value:t,configurable:!0});require("node:util");const C=require("./fs.BLXmkvbT.cjs");var B=Object.defineProperty,T=s((e,t)=>B(e,"name",{value:t,configurable:!0}),"n");const W=T(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var q=s(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"w"),E=q,L=globalThis.process||Object.create(null),w={versions:{}},M=new Proxy(L,{get(e,t){if(t in e)return e[t];if(t in w)return w[t]}}),k=M,U=s((e,t,l,r)=>{let n={column:0,line:-1,...e.start},a={...n,...e.end},o=n.line,u=n.column,g=a.line,p=a.column,h=Math.max(o-(l+1),0),y=Math.min(t.length,g+r);o===-1&&(h=0),g===-1&&(y=t.length);let d=g-o,c={};if(d)for(let i=0;i<=d;i++){let f=i+o;if(!u)c[f]=!0;else if(i===0){let m=t[f-1]?.length;c[f]=[u,(m??0)-u+1]}else if(i===d)c[f]=[0,p];else{let m=t[f-i]?.length;c[f]=[0,m]}}else u===p?c[o]=u?[u,0]:!0:c[o]=[u,(p??0)-(u??0)];return{end:y,markerLines:c,start:h}},"S"),J=U,V=k.platform==="win32"&&!k.env?.WT_SESSION?">":"❯",G=s((e,t,l)=>{let r={linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...l,color:{gutter:s(i=>i,"gutter"),marker:s(i=>i,"marker"),message:s(i=>i,"message"),...l?.color}},n=t.start&&typeof t.start.column=="number",a=E(e).split(`
|
|
3
|
+
`);typeof r?.tabWidth=="number"&&(a=a.map(i=>i.replaceAll(" "," ".repeat(r.tabWidth))));let{end:o,markerLines:u,start:g}=J(t,a,r.linesAbove,r.linesBelow),p=String(o).length,{gutter:h,marker:y,message:d}=r.color,c=a.slice(g,o).map((i,f)=>{let m=g+1+f,v=u[m],x=` ${m}`.slice(-p),N=!u[m+1],$=` ${x}${r.showGutter?" |":""}`;if(v){let A="";if(Array.isArray(v)){let O=i.replaceAll(/[^\t]/g," ").slice(0,Math.max(v[0]-1,0)),F=v[1]||1;A=[`
|
|
4
|
+
`,h($.replaceAll(/\d/g," "))," ",O,y("^").repeat(F)].join(""),N&&r.message&&(A+=` ${d(r.message)}`)}return[y(V),h($),i.length>0?` ${i}`:"",A].join("")}return` ${h($)}${i.length>0?` ${i}`:""}`}).join(`
|
|
5
|
+
`);return r.message&&!n&&(c=`${" ".repeat(p+1)}${r.message}
|
|
6
|
+
${c}`),c},"q"),P=s((e,t)=>{let l=0,r=t.length-2;for(;l<r;){let n=l+(r-l>>1);if(e<t[n])r=n-1;else if(e>=t[n+1])l=n+1;else{l=n;break}}return l},"m$1"),R=s(e=>e.split(/\n|\r(?!\n)/).reduce((t,l)=>(t.push(t.at(-1)+l.length+1),t),[0]),"g"),z=s((e,t,l)=>{let r=l?.skipChecks??!1;if(!r&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!r&&(typeof t!="number"||typeof e=="string"&&t>=e.length||Array.isArray(e)&&t+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){let a=R(e),o=P(t,a);return{column:t-a[o]+1,line:o+1}}let n=P(t,e);return{column:t-e[n]+1,line:n+1}},"h"),D=z,I=Object.defineProperty,b=s((e,t)=>I(e,"name",{value:t,configurable:!0}),"s");const _=b(e=>`\\u{${e.codePointAt(0).toString(16)}}`,"getCodePoint"),H=b((e,t,l)=>G(e,{start:t},{tabWidth:!1,...l}),"generateCodeFrame"),K=b((e,t)=>{const l=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(t);if(!l)return;let{column:r,index:n,line:a}=l.groups;return a&&r?{column:Number(r),line:Number(a)}:(n=Number(n),n===e.length&&(n=e.length-1),D(e,n))},"getErrorLocation"),Q=b(e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,l,r)=>`"${r}"(${_(r)})`),"addCodePointToUnexpectedToken");function j(e,t,l,r){typeof t=="string"&&(typeof l=="object"&&(r=l),l=t,t=void 0);let n;try{return JSON.parse(e,t)}catch(u){n=u.message}let a;e?(a=K(e,n),n=Q(n)):n+=" while parsing empty string";const o=new C.c(n);throw o.fileName=l,a&&(o.codeFrame=H(e,a,r)),o}s(j,"F");b(j,"parseJson");var X=Object.defineProperty,Y=s((e,t)=>X(e,"name",{value:t,configurable:!0}),"e");const Z=Y(e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},"assertValidFileContents"),ee=Z;exports.F=j;exports.s=W;exports.v=ee;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var S=Object.defineProperty;var s=(e,t)=>S(e,"name",{value:t,configurable:!0});import"node:util";import{c as C}from"./fs.BXbumRuI.mjs";var F=Object.defineProperty,B=s((e,t)=>F(e,"name",{value:t,configurable:!0}),"n");const ne=B(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var T=s(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"w"),W=T,L=globalThis.process||Object.create(null),w={versions:{}},E=new Proxy(L,{get(e,t){if(t in e)return e[t];if(t in w)return w[t]}}),k=E,M=s((e,t,l,n)=>{let r={column:0,line:-1,...e.start},a={...r,...e.end},o=r.line,u=r.column,g=a.line,p=a.column,h=Math.max(o-(l+1),0),y=Math.min(t.length,g+n);o===-1&&(h=0),g===-1&&(y=t.length);let d=g-o,c={};if(d)for(let i=0;i<=d;i++){let m=i+o;if(!u)c[m]=!0;else if(i===0){let f=t[m-1]?.length;c[m]=[u,(f??0)-u+1]}else if(i===d)c[m]=[0,p];else{let f=t[m-i]?.length;c[m]=[0,f]}}else u===p?c[o]=u?[u,0]:!0:c[o]=[u,(p??0)-(u??0)];return{end:y,markerLines:c,start:h}},"S"),U=M,q=k.platform==="win32"&&!k.env?.WT_SESSION?">":"❯",J=s((e,t,l)=>{let n={linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...l,color:{gutter:s(i=>i,"gutter"),marker:s(i=>i,"marker"),message:s(i=>i,"message"),...l?.color}},r=t.start&&typeof t.start.column=="number",a=W(e).split(`
|
|
3
|
+
`);typeof n?.tabWidth=="number"&&(a=a.map(i=>i.replaceAll(" "," ".repeat(n.tabWidth))));let{end:o,markerLines:u,start:g}=U(t,a,n.linesAbove,n.linesBelow),p=String(o).length,{gutter:h,marker:y,message:d}=n.color,c=a.slice(g,o).map((i,m)=>{let f=g+1+m,v=u[f],P=` ${f}`.slice(-p),N=!u[f+1],$=` ${P}${n.showGutter?" |":""}`;if(v){let A="";if(Array.isArray(v)){let O=i.replaceAll(/[^\t]/g," ").slice(0,Math.max(v[0]-1,0)),j=v[1]||1;A=[`
|
|
4
|
+
`,h($.replaceAll(/\d/g," "))," ",O,y("^").repeat(j)].join(""),N&&n.message&&(A+=` ${d(n.message)}`)}return[y(q),h($),i.length>0?` ${i}`:"",A].join("")}return` ${h($)}${i.length>0?` ${i}`:""}`}).join(`
|
|
5
|
+
`);return n.message&&!r&&(c=`${" ".repeat(p+1)}${n.message}
|
|
6
|
+
${c}`),c},"q"),x=s((e,t)=>{let l=0,n=t.length-2;for(;l<n;){let r=l+(n-l>>1);if(e<t[r])n=r-1;else if(e>=t[r+1])l=r+1;else{l=r;break}}return l},"m$1"),V=s(e=>e.split(/\n|\r(?!\n)/).reduce((t,l)=>(t.push(t.at(-1)+l.length+1),t),[0]),"g"),G=s((e,t,l)=>{let n=l?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof t!="number"||typeof e=="string"&&t>=e.length||Array.isArray(e)&&t+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){let a=V(e),o=x(t,a);return{column:t-a[o]+1,line:o+1}}let r=x(t,e);return{column:t-e[r]+1,line:r+1}},"h"),R=G,z=Object.defineProperty,b=s((e,t)=>z(e,"name",{value:t,configurable:!0}),"s");const D=b(e=>`\\u{${e.codePointAt(0).toString(16)}}`,"getCodePoint"),I=b((e,t,l)=>J(e,{start:t},{tabWidth:!1,...l}),"generateCodeFrame"),_=b((e,t)=>{const l=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(t);if(!l)return;let{column:n,index:r,line:a}=l.groups;return a&&n?{column:Number(n),line:Number(a)}:(r=Number(r),r===e.length&&(r=e.length-1),R(e,r))},"getErrorLocation"),H=b(e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,l,n)=>`"${n}"(${D(n)})`),"addCodePointToUnexpectedToken");function K(e,t,l,n){typeof t=="string"&&(typeof l=="object"&&(n=l),l=t,t=void 0);let r;try{return JSON.parse(e,t)}catch(u){r=u.message}let a;e?(a=_(e,r),r=H(r)):r+=" while parsing empty string";const o=new C(r);throw o.fileName=l,a&&(o.codeFrame=I(e,a,n)),o}s(K,"F");b(K,"parseJson");var Q=Object.defineProperty,X=s((e,t)=>Q(e,"name",{value:t,configurable:!0}),"e");const Y=X(e=>{if(typeof e!="string"&&!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},"assertValidFileContents"),re=Y;export{K as F,ne as s,re as v};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});var i=Object.defineProperty,c=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"i");class s extends Error{static{t(this,"r")}static{c(this,"JSONError")}fileName;codeFrame;name="JSONError";#e;constructor(e){super(),this.#e=e,Error.captureStackTrace(this,s)}get message(){return`${this.#e}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
|
|
2
|
+
|
|
3
|
+
${this.codeFrame}
|
|
4
|
+
`:""}`}set message(e){this.#e=e}}const m=s;export{m as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var t=(e,r)=>n(e,"name",{value:r,configurable:!0});var s=Object.defineProperty,a=t((e,r)=>s(e,"name",{value:r,configurable:!0}),"t$2");let i=class extends Error{static{t(this,"n")}static{a(this,"AlreadyExistsError")}constructor(r){super(`EEXIST: ${r}`)}get code(){return"EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}};const E=i;var c=Object.defineProperty,l=t((e,r)=>c(e,"name",{value:r,configurable:!0}),"o");let u=class extends Error{static{t(this,"n")}static{l(this,"PermissionError")}constructor(r){super(`EPERM: Operation not permitted, ${r}`)}get code(){return"EPERM"}set code(r){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(r){throw new Error("Cannot overwrite name of PermissionError")}};const m=u;var d=Object.defineProperty,w=t((e,r)=>d(e,"name",{value:r,configurable:!0}),"t");class v extends Error{static{t(this,"i")}static{w(this,"WalkError")}root;constructor(r,o){super(`${r instanceof Error?r.message:r} for path "${o}"`),this.cause=r,this.root=o}get name(){return"WalkError"}set name(r){throw new Error("Cannot overwrite name of WalkError")}}exports.i=v;exports.l=E;exports.s=m;
|