@visulima/fs 2.1.8 → 2.1.10

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 CHANGED
@@ -1,3 +1,25 @@
1
+ ## @visulima/fs [2.1.10](https://github.com/visulima/visulima/compare/@visulima/fs@2.1.9...@visulima/fs@2.1.10) (2024-07-02)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * changed typescript version back to 5.4.5 ([55d28bb](https://github.com/visulima/visulima/commit/55d28bbdc103718d19f844034b38a0e8e5af798a))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/error:** upgraded to 4.3.0
11
+
12
+ ## @visulima/fs [2.1.9](https://github.com/visulima/visulima/compare/@visulima/fs@2.1.8...@visulima/fs@2.1.9) (2024-07-02)
13
+
14
+ ### Miscellaneous Chores
15
+
16
+ * updated dev dependencies ([34df456](https://github.com/visulima/visulima/commit/34df4569f2fc074823a406c44a131c8fbae2b147))
17
+
18
+
19
+ ### Dependencies
20
+
21
+ * **@visulima/error:** upgraded to 4.2.0
22
+
1
23
  ## @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
24
 
3
25
  ### Styles
package/LICENSE.md CHANGED
@@ -53,6 +53,155 @@ Repository: https://github.com/visulima/visulima.git
53
53
  > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
54
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
55
  > SOFTWARE.
56
+ >
57
+ > <!-- DEPENDENCIES -->
58
+ >
59
+ > # Licenses of bundled dependencies
60
+ > The published @visulima/error artifact additionally contains code with the following licenses:
61
+ > MIT
62
+ >
63
+ > # Bundled dependencies:
64
+ > ## is-plain-obj
65
+ > License: MIT
66
+ > By: Sindre Sorhus
67
+ > Repository: sindresorhus/is-plain-obj
68
+ >
69
+ > > MIT License
70
+ > >
71
+ > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
72
+ > >
73
+ > > 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:
74
+ > >
75
+ > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
76
+ > >
77
+ > > 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.
78
+ >
79
+ > <!-- DEPENDENCIES -->
80
+ >
81
+ > <!-- TYPE_DEPENDENCIES -->
82
+
83
+ # Licenses of bundled types
84
+ The published @visulima/fs artifact additionally contains code with the following licenses:
85
+ (MIT OR CC0-1.0)
86
+
87
+ # Bundled types:
88
+ ## type-fest
89
+ License: (MIT OR CC0-1.0)
90
+ By: Sindre Sorhus
91
+ Repository: sindresorhus/type-fest
92
+
93
+ <!-- TYPE_DEPENDENCIES -->
94
+
95
+ ---------------------------------------
96
+
97
+ ## detect-indent
98
+ License: MIT
99
+ By: Sindre Sorhus
100
+ Repository: sindresorhus/detect-indent
101
+
102
+ > MIT License
103
+ >
104
+ > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
105
+ >
106
+ > 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:
107
+ >
108
+ > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
109
+ >
110
+ > 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.
111
+
112
+ <!-- DEPENDENCIES -->
113
+ >
114
+ > # Licenses of bundled dependencies
115
+ > The published @visulima/error artifact additionally contains code with the following licenses:
116
+ > MIT
117
+ >
118
+ > # Bundled dependencies:
119
+ > ## is-plain-obj
120
+ > License: MIT
121
+ > By: Sindre Sorhus
122
+ > Repository: sindresorhus/is-plain-obj
123
+ >
124
+ > > MIT License
125
+ > >
126
+ > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
127
+ > >
128
+ > > 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:
129
+ > >
130
+ > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
131
+ > >
132
+ > > 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.
133
+ >
134
+ > <!-- DEPENDENCIES -->
135
+
136
+ # Licenses of bundled dependencies
137
+ The published @visulima/fs artifact additionally contains code with the following licenses:
138
+ MIT
139
+
140
+ # Bundled dependencies:
141
+ ## @visulima/error
142
+ License: MIT
143
+ By: Daniel Bannert
144
+ Repository: https://github.com/visulima/visulima.git
145
+
146
+ > MIT License
147
+ >
148
+ > Copyright (c) 2024 visulima
149
+ >
150
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
151
+ > of this software and associated documentation files (the "Software"), to deal
152
+ > in the Software without restriction, including without limitation the rights
153
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
154
+ > copies of the Software, and to permit persons to whom the Software is
155
+ > furnished to do so, subject to the following conditions:
156
+ >
157
+ > The above copyright notice and this permission notice shall be included in all
158
+ > copies or substantial portions of the Software.
159
+ >
160
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
162
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
163
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
164
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
165
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
166
+ > SOFTWARE.
167
+ >
168
+ > <!-- DEPENDENCIES -->
169
+ >
170
+ > # Licenses of bundled dependencies
171
+ > The published @visulima/error artifact additionally contains code with the following licenses:
172
+ > MIT
173
+ >
174
+ > # Bundled dependencies:
175
+ > ## is-plain-obj
176
+ > License: MIT
177
+ > By: Sindre Sorhus
178
+ > Repository: sindresorhus/is-plain-obj
179
+ >
180
+ > > MIT License
181
+ > >
182
+ > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
183
+ > >
184
+ > > 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:
185
+ > >
186
+ > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
187
+ > >
188
+ > > 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.
189
+ >
190
+ > <!-- DEPENDENCIES -->
191
+ >
192
+ > <!-- TYPE_DEPENDENCIES -->
193
+
194
+ # Licenses of bundled types
195
+ The published @visulima/fs artifact additionally contains code with the following licenses:
196
+ (MIT OR CC0-1.0)
197
+
198
+ # Bundled types:
199
+ ## type-fest
200
+ License: (MIT OR CC0-1.0)
201
+ By: Sindre Sorhus
202
+ Repository: sindresorhus/type-fest
203
+
204
+ <!-- TYPE_DEPENDENCIES -->
56
205
 
57
206
  ---------------------------------------
58
207
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
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=`
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.DpFCX-WT.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
2
  `,T=`\r
3
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
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(`
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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=`
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.CRRGdXGG.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
2
  `,J=`\r
3
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
4
  `;if(await E(e,_))try{const a=await ee(e,"utf8");if(i){const{indent:p}=je(a);y=p}f=a.endsWith(`
@@ -0,0 +1,6 @@
1
+ var C=Object.defineProperty;var m=(e,t)=>C(e,"name",{value:t,configurable:!0});import{c as T}from"./fs.BXbumRuI.mjs";var B=Object.defineProperty,W=m((e,t)=>B(e,"name",{value:t,configurable:!0}),"n");const ue=W(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var E=Object.defineProperty,$=m((e,t)=>E(e,"name",{value:t,configurable:!0}),"v$1"),M=Object.defineProperty,U=$((e,t)=>M(e,"name",{value:t,configurable:!0}),"r$1");const I=U(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
+ `),"normalizeLF"),J=globalThis.process||Object.create(null),j={versions:{}},O=new Proxy(J,{get(e,t){if(t in e)return e[t];if(t in j)return j[t]}});var V=Object.defineProperty,q=$((e,t)=>V(e,"name",{value:t,configurable:!0}),"b");const G=q((e,t,o,n)=>{const r={column:0,line:-1,...e.start},i={...r,...e.end},l=r.line,s=r.column,g=i.line,p=i.column;let b=Math.max(l-(o+1),0),y=Math.min(t.length,g+n);l===-1&&(b=0),g===-1&&(y=t.length);const d=g-l,c={};if(d)for(let a=0;a<=d;a++){const u=a+l;if(!s)c[u]=!0;else if(a===0){const f=t[u-1]?.length;c[u]=[s,(f??0)-s+1]}else if(a===d)c[u]=[0,p];else{const f=t[u-a]?.length;c[u]=[0,f]}}else s===p?c[l]=s?[s,0]:!0:c[l]=[s,(p??0)-(s??0)];return{end:y,markerLines:c,start:b}},"getMarkerLines");var R=Object.defineProperty,A=$((e,t)=>R(e,"name",{value:t,configurable:!0}),"o");const _=O.platform==="win32"&&!O.env?.WT_SESSION?">":"❯",z=A((e,t,o)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...o,color:{gutter:A(a=>a,"gutter"),marker:A(a=>a,"marker"),message:A(a=>a,"message"),...o?.color}},r=t.start&&typeof t.start.column=="number";let i=I(e).split(`
3
+ `);typeof n?.tabWidth=="number"&&(i=i.map(a=>a.replaceAll(" "," ".repeat(n.tabWidth))));const{end:l,markerLines:s,start:g}=G(t,i,n.linesAbove,n.linesBelow),p=String(l).length,{gutter:b,marker:y,message:d}=n.color;let c=i.slice(g,l).map((a,u)=>{const f=g+1+u,v=s[f],L=(" "+f).slice(-p),S=!s[f+1],w=" "+L+(n.showGutter?" |":"");if(v){let x="";if(Array.isArray(v)){const F=a.replaceAll(/[^\t]/g," ").slice(0,Math.max(v[0]-1,0)),N=v[1]||1;x=[`
4
+ `,n.prefix+b(w.replaceAll(/\d/g," "))," ",F,y("^").repeat(N)].join(""),S&&n.message&&(x+=` ${d(n.message)}`)}return[n.prefix+y(_),b(w),a.length>0?" "+a:"",x].join("")}return n.prefix+" "+b(w)+(a.length>0?" "+a:"")}).join(`
5
+ `);return n.message&&!r&&(c=n.prefix+" ".repeat(p+1)+n.message+`
6
+ `+c),c},"codeFrame");var D=Object.defineProperty,H=m((e,t)=>D(e,"name",{value:t,configurable:!0}),"l$1"),K=Object.defineProperty,P=H((e,t)=>K(e,"name",{value:t,configurable:!0}),"l");const k=P((e,t)=>{let o=0,n=t.length-2;for(;o<n;){const r=o+(n-o>>1);if(e<t[r])n=r-1;else if(e>=t[r+1])o=r+1;else{o=r;break}}return o},"binarySearch"),Q=P(e=>e.split(/\n|\r(?!\n)/).reduce((t,o)=>(t.push(t.at(-1)+o.length+1),t),[0]),"getLineStartIndexes"),X=P((e,t,o)=>{const n=o?.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"){const i=Q(e),l=k(t,i);return{column:t-i[l]+1,line:l+1}}const r=k(t,e);return{column:t-e[r]+1,line:r+1}},"indexToLineColumn"),Y=X;var Z=Object.defineProperty,h=m((e,t)=>Z(e,"name",{value:t,configurable:!0}),"s");const ee=h(e=>`\\u{${e.codePointAt(0).toString(16)}}`,"getCodePoint"),te=h((e,t,o)=>z(e,{start:t},{tabWidth:!1,...o}),"generateCodeFrame"),ne=h((e,t)=>{const o=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(t);if(!o)return;let{column:n,index:r,line:i}=o.groups;return i&&n?{column:Number(n),line:Number(i)}:(r=Number(r),r===e.length&&(r=e.length-1),Y(e,r))},"getErrorLocation"),re=h(e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(t,o,n)=>`"${n}"(${ee(n)})`),"addCodePointToUnexpectedToken");function oe(e,t,o,n){typeof t=="string"&&(typeof o=="object"&&(n=o),o=t,t=void 0);let r;try{return JSON.parse(e,t)}catch(s){r=s.message}let i;e?(i=ne(e,r),r=re(r)):r+=" while parsing empty string";const l=new T(r);throw l.fileName=o,i&&(l.codeFrame=te(e,i,n)),l}m(oe,"F");h(oe,"parseJson");var ae=Object.defineProperty,ie=m((e,t)=>ae(e,"name",{value:t,configurable:!0}),"e");const le=ie(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"),fe=le;export{oe as F,ue as s,fe as v};
@@ -0,0 +1,6 @@
1
+ "use strict";var T=Object.defineProperty;var m=(e,r)=>T(e,"name",{value:r,configurable:!0});const B=require("./fs.BLXmkvbT.cjs");var E=Object.defineProperty,W=m((e,r)=>E(e,"name",{value:r,configurable:!0}),"n");const M=W(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var U=Object.defineProperty,x=m((e,r)=>U(e,"name",{value:r,configurable:!0}),"v$1"),q=Object.defineProperty,I=x((e,r)=>q(e,"name",{value:r,configurable:!0}),"r$1");const J=I(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
+ `),"normalizeLF"),V=globalThis.process||Object.create(null),$={versions:{}},O=new Proxy(V,{get(e,r){if(r in e)return e[r];if(r in $)return $[r]}});var G=Object.defineProperty,R=x((e,r)=>G(e,"name",{value:r,configurable:!0}),"b");const _=R((e,r,o,t)=>{const n={column:0,line:-1,...e.start},a={...n,...e.end},s=n.line,l=n.column,g=a.line,p=a.column;let b=Math.max(s-(o+1),0),y=Math.min(r.length,g+t);s===-1&&(b=0),g===-1&&(y=r.length);const d=g-s,c={};if(d)for(let i=0;i<=d;i++){const u=i+s;if(!l)c[u]=!0;else if(i===0){const f=r[u-1]?.length;c[u]=[l,(f??0)-l+1]}else if(i===d)c[u]=[0,p];else{const f=r[u-i]?.length;c[u]=[0,f]}}else l===p?c[s]=l?[l,0]:!0:c[s]=[l,(p??0)-(l??0)];return{end:y,markerLines:c,start:b}},"getMarkerLines");var z=Object.defineProperty,A=x((e,r)=>z(e,"name",{value:r,configurable:!0}),"o");const D=O.platform==="win32"&&!O.env?.WT_SESSION?">":"❯",H=A((e,r,o)=>{const t={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...o,color:{gutter:A(i=>i,"gutter"),marker:A(i=>i,"marker"),message:A(i=>i,"message"),...o?.color}},n=r.start&&typeof r.start.column=="number";let a=J(e).split(`
3
+ `);typeof t?.tabWidth=="number"&&(a=a.map(i=>i.replaceAll(" "," ".repeat(t.tabWidth))));const{end:s,markerLines:l,start:g}=_(r,a,t.linesAbove,t.linesBelow),p=String(s).length,{gutter:b,marker:y,message:d}=t.color;let c=a.slice(g,s).map((i,u)=>{const f=g+1+u,v=l[f],F=(" "+f).slice(-p),S=!l[f+1],w=" "+F+(t.showGutter?" |":"");if(v){let j="";if(Array.isArray(v)){const N=i.replaceAll(/[^\t]/g," ").slice(0,Math.max(v[0]-1,0)),C=v[1]||1;j=[`
4
+ `,t.prefix+b(w.replaceAll(/\d/g," "))," ",N,y("^").repeat(C)].join(""),S&&t.message&&(j+=` ${d(t.message)}`)}return[t.prefix+y(D),b(w),i.length>0?" "+i:"",j].join("")}return t.prefix+" "+b(w)+(i.length>0?" "+i:"")}).join(`
5
+ `);return t.message&&!n&&(c=t.prefix+" ".repeat(p+1)+t.message+`
6
+ `+c),c},"codeFrame");var K=Object.defineProperty,Q=m((e,r)=>K(e,"name",{value:r,configurable:!0}),"l$1"),X=Object.defineProperty,P=Q((e,r)=>X(e,"name",{value:r,configurable:!0}),"l");const k=P((e,r)=>{let o=0,t=r.length-2;for(;o<t;){const n=o+(t-o>>1);if(e<r[n])t=n-1;else if(e>=r[n+1])o=n+1;else{o=n;break}}return o},"binarySearch"),Y=P(e=>e.split(/\n|\r(?!\n)/).reduce((r,o)=>(r.push(r.at(-1)+o.length+1),r),[0]),"getLineStartIndexes"),Z=P((e,r,o)=>{const t=o?.skipChecks??!1;if(!t&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!t&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=Y(e),s=k(r,a);return{column:r-a[s]+1,line:s+1}}const n=k(r,e);return{column:r-e[n]+1,line:n+1}},"indexToLineColumn"),ee=Z;var re=Object.defineProperty,h=m((e,r)=>re(e,"name",{value:r,configurable:!0}),"s");const te=h(e=>`\\u{${e.codePointAt(0).toString(16)}}`,"getCodePoint"),ne=h((e,r,o)=>H(e,{start:r},{tabWidth:!1,...o}),"generateCodeFrame"),oe=h((e,r)=>{const o=/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/.exec(r);if(!o)return;let{column:t,index:n,line:a}=o.groups;return a&&t?{column:Number(t),line:Number(a)}:(n=Number(n),n===e.length&&(n=e.length-1),ee(e,n))},"getErrorLocation"),ie=h(e=>e.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(r,o,t)=>`"${t}"(${te(t)})`),"addCodePointToUnexpectedToken");function L(e,r,o,t){typeof r=="string"&&(typeof o=="object"&&(t=o),o=r,r=void 0);let n;try{return JSON.parse(e,r)}catch(l){n=l.message}let a;e?(a=oe(e,n),n=ie(n)):n+=" while parsing empty string";const s=new B.c(n);throw s.fileName=o,a&&(s.codeFrame=ne(e,a,t)),s}m(L,"F");h(L,"parseJson");var ae=Object.defineProperty,se=m((e,r)=>ae(e,"name",{value:r,configurable:!0}),"e");const le=se(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"),ce=le;exports.F=L;exports.s=M;exports.v=ce;
package/dist/utils.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var o=(e,t)=>n(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/fs.BLXmkvbT.cjs"),r=require("./shared/fs.BMslWC0T.cjs"),a=require("@visulima/path/utils");var l=Object.defineProperty,c=o((e,t)=>l(e,"name",{value:t,configurable:!0}),"n");const u=c((e,{whitespace:t=!0}={})=>e.replace(p,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:t?s.replaceAll(/\S/g," "):""),"stripJsonComments"),p=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,d=u;exports.JSONError=i.c;exports.assertValidFileContents=r.v;exports.assertValidFileOrDirectoryPath=r.s;exports.parseJson=r.F;exports.toPath=a.toPath;exports.stripJsonComments=d;
1
+ "use strict";var n=Object.defineProperty;var o=(e,t)=>n(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/fs.BLXmkvbT.cjs"),r=require("./shared/fs.DpFCX-WT.cjs"),a=require("@visulima/path/utils");var l=Object.defineProperty,c=o((e,t)=>l(e,"name",{value:t,configurable:!0}),"n");const u=c((e,{whitespace:t=!0}={})=>e.replace(p,s=>s.startsWith('"')||s[1]==="*"&&!s.endsWith("*/")?s:t?s.replaceAll(/\S/g," "):""),"stripJsonComments"),p=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,d=u;exports.JSONError=i.c;exports.assertValidFileContents=r.v;exports.assertValidFileOrDirectoryPath=r.s;exports.parseJson=r.F;exports.toPath=a.toPath;exports.stripJsonComments=d;
package/dist/utils.mjs CHANGED
@@ -1 +1 @@
1
- var a=Object.defineProperty;var r=(e,s)=>a(e,"name",{value:s,configurable:!0});import{c as h}from"./shared/fs.BXbumRuI.mjs";import{v as d,s as v,F as x}from"./shared/fs.BRjynomN.mjs";import{toPath as N}from"@visulima/path/utils";var o=Object.defineProperty,n=r((e,s)=>o(e,"name",{value:s,configurable:!0}),"n");const i=n((e,{whitespace:s=!0}={})=>e.replace(p,t=>t.startsWith('"')||t[1]==="*"&&!t.endsWith("*/")?t:s?t.replaceAll(/\S/g," "):""),"stripJsonComments"),p=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,l=i;export{h as JSONError,d as assertValidFileContents,v as assertValidFileOrDirectoryPath,x as parseJson,l as stripJsonComments,N as toPath};
1
+ var a=Object.defineProperty;var r=(e,s)=>a(e,"name",{value:s,configurable:!0});import{c as h}from"./shared/fs.BXbumRuI.mjs";import{v as d,s as v,F as x}from"./shared/fs.CRRGdXGG.mjs";import{toPath as N}from"@visulima/path/utils";var o=Object.defineProperty,n=r((e,s)=>o(e,"name",{value:s,configurable:!0}),"n");const i=n((e,{whitespace:s=!0}={})=>e.replace(p,t=>t.startsWith('"')||t[1]==="*"&&!t.endsWith("*/")?t:s?t.replaceAll(/\S/g," "):""),"stripJsonComments"),p=/"(?:[^"\\]|\\.)*"?|\/\/[^\r\n]*|\/\*(?:[^*]|\*[^/])*(?:\*\/)?/g,l=i;export{h as JSONError,d as assertValidFileContents,v as assertValidFileOrDirectoryPath,x as parseJson,l as stripJsonComments,N as toPath};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/fs",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "description": "Human friendly file system utilities for Node.js",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -126,14 +126,14 @@
126
126
  "@babel/core": "^7.24.7",
127
127
  "@rushstack/eslint-plugin-security": "^0.8.1",
128
128
  "@types/node": "18.19.15",
129
- "@visulima/error": "4.1.0",
129
+ "@visulima/error": "4.3.0",
130
130
  "@visulima/packem": "^1.0.0-alpha.42",
131
131
  "@vitest/coverage-v8": "^1.6.0",
132
132
  "@vitest/ui": "^1.6.0",
133
133
  "conventional-changelog-conventionalcommits": "8.0.0",
134
134
  "cross-env": "^7.0.3",
135
135
  "detect-indent": "^7.0.1",
136
- "esbuild": "^0.21.5",
136
+ "esbuild": "0.22.0",
137
137
  "eslint": "^8.57.0",
138
138
  "eslint-plugin-deprecation": "^3.0.0",
139
139
  "eslint-plugin-etc": "^2.0.3",
@@ -149,7 +149,7 @@
149
149
  "semantic-release": "24.0.0",
150
150
  "tempy": "^3.1.0",
151
151
  "type-fest": "^4.20.1",
152
- "typescript": "^5.4.5",
152
+ "typescript": "5.4.5",
153
153
  "vitest": "^1.6.0",
154
154
  "yaml": "^2.4.5"
155
155
  },
@@ -1,6 +0,0 @@
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;
@@ -1,6 +0,0 @@
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};