@likec4/mcp 1.50.0 → 1.51.0

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.
@@ -240,11 +240,11 @@ Repository: https://github.com/honojs/node-server
240
240
 
241
241
  ---------------------------------------
242
242
 
243
- ## @likec4/config, @likec4/core, @likec4/layouts, @likec4/log, @likec4/style-preset
243
+ ## @likec4/config, @likec4/core, @likec4/language-services, @likec4/layouts, @likec4/log, @likec4/style-preset
244
244
 
245
245
  License: MIT
246
246
  By: Denis Davydkov
247
- Repositories: https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4
247
+ Repositories: https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4, https://github.com/likec4/likec4
248
248
 
249
249
  > MIT License
250
250
  >
@@ -1893,6 +1893,84 @@ Repository: https://github.com/litejs/natural-compare-lite
1893
1893
 
1894
1894
  ---------------------------------------
1895
1895
 
1896
+ ## pathe
1897
+
1898
+ License: MIT
1899
+ Repository: https://github.com/unjs/pathe
1900
+
1901
+ > MIT License
1902
+ >
1903
+ > Copyright (c) Pooya Parsa <pooya@pi0.io> - Daniel Roe <daniel@roe.dev>
1904
+ >
1905
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
1906
+ > of this software and associated documentation files (the "Software"), to deal
1907
+ > in the Software without restriction, including without limitation the rights
1908
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1909
+ > copies of the Software, and to permit persons to whom the Software is
1910
+ > furnished to do so, subject to the following conditions:
1911
+ >
1912
+ > The above copyright notice and this permission notice shall be included in all
1913
+ > copies or substantial portions of the Software.
1914
+ >
1915
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1916
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1917
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1918
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1920
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1921
+ > SOFTWARE.
1922
+ >
1923
+ > ---
1924
+ >
1925
+ > Copyright Joyent, Inc. and other Node contributors.
1926
+ >
1927
+ > Permission is hereby granted, free of charge, to any person obtaining a
1928
+ > copy of this software and associated documentation files (the
1929
+ > "Software"), to deal in the Software without restriction, including
1930
+ > without limitation the rights to use, copy, modify, merge, publish,
1931
+ > distribute, sublicense, and/or sell copies of the Software, and to permit
1932
+ > persons to whom the Software is furnished to do so, subject to the
1933
+ > following conditions:
1934
+ >
1935
+ > The above copyright notice and this permission notice shall be included
1936
+ > in all copies or substantial portions of the Software.
1937
+ >
1938
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1939
+ > OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1940
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1941
+ > NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1942
+ > DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1943
+ > OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1944
+ > USE OR OTHER DEALINGS IN THE SOFTWARE.
1945
+ >
1946
+ > ---
1947
+ >
1948
+ > Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch)
1949
+ >
1950
+ > The MIT License (MIT)
1951
+ >
1952
+ > Copyright (c) 2023-present Fabio Spampinato
1953
+ >
1954
+ > Permission is hereby granted, free of charge, to any person obtaining a
1955
+ > copy of this software and associated documentation files (the "Software"),
1956
+ > to deal in the Software without restriction, including without limitation
1957
+ > the rights to use, copy, modify, merge, publish, distribute, sublicense,
1958
+ > and/or sell copies of the Software, and to permit persons to whom the
1959
+ > Software is furnished to do so, subject to the following conditions:
1960
+ >
1961
+ > The above copyright notice and this permission notice shall be included in
1962
+ > all copies or substantial portions of the Software.
1963
+ >
1964
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1965
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1966
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1967
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1968
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1969
+ > FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1970
+ > DEALINGS IN THE SOFTWARE.
1971
+
1972
+ ---------------------------------------
1973
+
1896
1974
  ## picomatch
1897
1975
 
1898
1976
  License: MIT
@@ -2112,6 +2190,35 @@ Repository: https://github.com/remeda/remeda
2112
2190
 
2113
2191
  ---------------------------------------
2114
2192
 
2193
+ ## tinyrainbow
2194
+
2195
+ License: MIT
2196
+ Repository: https://github.com/tinylibs/tinyrainbow
2197
+
2198
+ > MIT License
2199
+ >
2200
+ > Copyright (c) 2022 Tinylibs
2201
+ >
2202
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
2203
+ > of this software and associated documentation files (the "Software"), to deal
2204
+ > in the Software without restriction, including without limitation the rights
2205
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2206
+ > copies of the Software, and to permit persons to whom the Software is
2207
+ > furnished to do so, subject to the following conditions:
2208
+ >
2209
+ > The above copyright notice and this permission notice shall be included in all
2210
+ > copies or substantial portions of the Software.
2211
+ >
2212
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2213
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2214
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2215
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2216
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2217
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2218
+ > SOFTWARE.
2219
+
2220
+ ---------------------------------------
2221
+
2115
2222
  ## trough
2116
2223
 
2117
2224
  License: MIT
@@ -3,4 +3,4 @@ import{r as e}from"../../rolldown-runtime.mjs";import t from"node:util";function
3
3
  `;if(e.message.length===1)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0],logger:e.category.join(`.`),properties:e.properties})+`
4
4
  `;let t=e.message[0];for(let n=1;n<e.message.length;n++)t+=n&1?JSON.stringify(e.message[n]):e.message[n];return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:t,logger:e.category.join(`.`),properties:e.properties})+`
5
5
  `};let t=e.message===`template`,n=e.properties??`nest:properties`,r;if(typeof e.categorySeparator==`function`)r=e.categorySeparator;else{let t=e.categorySeparator??`.`;r=e=>e.join(t)}let i;if(n===`flatten`)i=e=>e;else if(n.startsWith(`prepend:`)){let e=n.substring(8);if(e===``)throw TypeError(`Invalid properties option: ${JSON.stringify(n)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);i=t=>{let n={};for(let r in t)n[`${e}${r}`]=t[r];return n}}else if(n.startsWith(`nest:`)){let e=n.substring(5);i=t=>({[e]:t})}else throw TypeError(`Invalid properties option: ${JSON.stringify(n)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let a;return a=t?e=>{if(typeof e.rawMessage==`string`)return e.rawMessage;let t=``;for(let n=0;n<e.rawMessage.length;n++)t+=n%2<1?e.rawMessage[n]:`{}`;return t}:e=>{let t=e.message.length;if(t===1)return e.message[0];let n=``;for(let r=0;r<t;r++)n+=r%2<1?e.message[r]:JSON.stringify(e.message[r]);return n},e=>JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:a(e),logger:r(e.category),...i(e.properties)})+`
6
- `}F();const I={trace:`background-color: gray; color: white;`,debug:`background-color: gray; color: white;`,info:`background-color: white; color: black;`,warning:`background-color: orange; color: black;`,error:`background-color: red; color: white;`,fatal:`background-color: maroon; color: white;`};function L(e){let t=``,n=[];for(let r=0;r<e.message.length;r++)r%2==0?t+=e.message[r]:(t+=`%o`,n.push(e.message[r]));let r=new Date(e.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(2,`0`)}:${r.getUTCMinutes().toString().padStart(2,`0`)}:${r.getUTCSeconds().toString().padStart(2,`0`)}.${r.getUTCMilliseconds().toString().padStart(3,`0`)}`} %c${C[e.level]}%c %c${e.category.join(`·`)} %c${t}`,`color: gray;`,I[e.level],`background-color: default;`,`color: gray;`,`color: default;`,...n]}function R(e={}){let t=e.formatter??L,n={trace:`debug`,debug:`debug`,info:`info`,warning:`warn`,error:`error`,fatal:`error`,...e.levelMap??{}},r=e.console??globalThis.console,i=e=>{let i=t(e),a=n[e.level];if(a===void 0)throw TypeError(`Invalid log level: ${e.level}.`);if(typeof i==`string`){let e=i.replace(/\r?\n$/,``);r[a](e)}else r[a](...i)};if(!e.nonBlocking)return i;let a=e.nonBlocking===!0?{}:e.nonBlocking,o=a.bufferSize??100,s=a.flushInterval??100,c=[],l=null,u=!1,d=!1,f=o*2;function p(){if(c.length===0)return;let e=c.splice(0);for(let t of e)try{i(t)}catch{}}function m(){d||(d=!0,setTimeout(()=>{d=!1,p()},0))}function h(){l!==null||u||(l=setInterval(()=>{p()},s))}let g=e=>{u||(c.length>=f&&c.shift(),c.push(e),c.length>=o?m():l===null&&h())};return g[Symbol.dispose]=()=>{u=!0,l!==null&&(clearInterval(l),l=null),p()},g}let z=null;const B=new Set,V=new Set,H=new Set;function U(e){return e.category.length===0||e.category.length===1&&e.category[0]===`logtape`||e.category.length===2&&e.category[0]===`logtape`&&e.category[1]===`meta`}function W(e){if(z!=null&&!e.reset)throw new X(`Already configured; if you want to reset, turn on the reset flag.`);if(H.size>0)throw new X(`Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().`);K();try{G(e,!1)}catch(e){throw e instanceof X&&K(),e}}function G(e,t){z=e;let r=!1,i=new Set;for(let t of e.loggers){U(t)&&(r=!0);let a=Array.isArray(t.category)?JSON.stringify(t.category):JSON.stringify([t.category]);if(i.has(a))throw new X(`Duplicate logger configuration for category: ${a}. Each category can only be configured once.`);i.add(a);let o=c.getLogger(t.category);for(let n of t.sinks??[]){let t=e.sinks[n];if(!t)throw new X(`Sink not found: ${n}.`);o.sinks.push(t)}o.parentSinks=t.parentSinks??`inherit`,t.lowestLevel!==void 0&&(o.lowestLevel=t.lowestLevel);for(let r of t.filters??[]){let t=e.filters?.[r];if(t===void 0)throw new X(`Filter not found: ${r}.`);o.filters.push(n(t))}B.add(o)}c.getLogger().contextLocalStorage=e.contextLocalStorage;for(let n of Object.values(e.sinks)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}for(let n of Object.values(e.filters??{}))if(!(n==null||typeof n==`string`)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}if(typeof globalThis.EdgeRuntime!=`string`&&`process`in globalThis&&!(`Deno`in globalThis)){let e=globalThis.process,n=e?.on;typeof n==`function`&&n.call(e,`exit`,t?J:Y)}else addEventListener(`unload`,t?J:Y);let a=c.getLogger([`logtape`,`meta`]);r||a.sinks.push(R()),a.info(`LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is automatically configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.`,{metaLoggerCategory:[`logtape`,`meta`],dismissLevel:`info`})}function K(){Y(),q()}function q(){let e=c.getLogger([]);e.resetDescendants(),delete e.contextLocalStorage,B.clear(),z=null}async function J(){Y();let e=[];for(let t of H)e.push(t[Symbol.asyncDispose]()),H.delete(t);await Promise.all(e)}function Y(){for(let e of V)e[Symbol.dispose]();V.clear()}var X=class extends Error{constructor(e){super(e),this.name=`ConfigureError`}};export{o as i,R as n,P as r,W as t};
6
+ `}F();const I={trace:`background-color: gray; color: white;`,debug:`background-color: gray; color: white;`,info:`background-color: white; color: black;`,warning:`background-color: orange; color: black;`,error:`background-color: red; color: white;`,fatal:`background-color: maroon; color: white;`};function L(e){let t=``,n=[];for(let r=0;r<e.message.length;r++)r%2==0?t+=e.message[r]:(t+=`%o`,n.push(e.message[r]));let r=new Date(e.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(2,`0`)}:${r.getUTCMinutes().toString().padStart(2,`0`)}:${r.getUTCSeconds().toString().padStart(2,`0`)}.${r.getUTCMilliseconds().toString().padStart(3,`0`)}`} %c${C[e.level]}%c %c${e.category.join(`·`)} %c${t}`,`color: gray;`,I[e.level],`background-color: default;`,`color: gray;`,`color: default;`,...n]}function R(e={}){let t=e.formatter??L,n={trace:`debug`,debug:`debug`,info:`info`,warning:`warn`,error:`error`,fatal:`error`,...e.levelMap??{}},r=e.console??globalThis.console,i=e=>{let i=t(e),a=n[e.level];if(a===void 0)throw TypeError(`Invalid log level: ${e.level}.`);if(typeof i==`string`){let e=i.replace(/\r?\n$/,``);r[a](e)}else r[a](...i)};if(!e.nonBlocking)return i;let a=e.nonBlocking===!0?{}:e.nonBlocking,o=a.bufferSize??100,s=a.flushInterval??100,c=[],l=null,u=!1,d=!1,f=o*2;function p(){if(c.length===0)return;let e=c.splice(0);for(let t of e)try{i(t)}catch{}}function m(){d||(d=!0,setTimeout(()=>{d=!1,p()},0))}function h(){l!==null||u||(l=setInterval(()=>{p()},s))}let g=e=>{u||(c.length>=f&&c.shift(),c.push(e),c.length>=o?m():l===null&&h())};return g[Symbol.dispose]=()=>{u=!0,l!==null&&(clearInterval(l),l=null),p()},g}let z=null;const B=new Set,V=new Set,H=new Set;function U(e){return e.category.length===0||e.category.length===1&&e.category[0]===`logtape`||e.category.length===2&&e.category[0]===`logtape`&&e.category[1]===`meta`}function W(e){if(z!=null&&!e.reset)throw new X(`Already configured; if you want to reset, turn on the reset flag.`);if(H.size>0)throw new X(`Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().`);K();try{G(e,!1)}catch(e){throw e instanceof X&&K(),e}}function G(e,t){z=e;let r=!1,i=new Set;for(let t of e.loggers){U(t)&&(r=!0);let a=Array.isArray(t.category)?JSON.stringify(t.category):JSON.stringify([t.category]);if(i.has(a))throw new X(`Duplicate logger configuration for category: ${a}. Each category can only be configured once.`);i.add(a);let o=c.getLogger(t.category);for(let n of t.sinks??[]){let t=e.sinks[n];if(!t)throw new X(`Sink not found: ${n}.`);o.sinks.push(t)}o.parentSinks=t.parentSinks??`inherit`,t.lowestLevel!==void 0&&(o.lowestLevel=t.lowestLevel);for(let r of t.filters??[]){let t=e.filters?.[r];if(t===void 0)throw new X(`Filter not found: ${r}.`);o.filters.push(n(t))}B.add(o)}c.getLogger().contextLocalStorage=e.contextLocalStorage;for(let n of Object.values(e.sinks)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}for(let n of Object.values(e.filters??{}))if(!(n==null||typeof n==`string`)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}if(typeof globalThis.EdgeRuntime!=`string`&&`process`in globalThis&&!(`Deno`in globalThis)){let e=globalThis.process,n=e?.on;typeof n==`function`&&n.call(e,`exit`,t?J:Y)}else addEventListener(`unload`,t?J:Y);let a=c.getLogger([`logtape`,`meta`]);r||a.sinks.push(R()),a.info(`LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is automatically configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.`,{metaLoggerCategory:[`logtape`,`meta`],dismissLevel:`info`})}function K(){Y(),q()}function q(){let e=c.getLogger([]);e.resetDescendants(),delete e.contextLocalStorage,B.clear(),z=null}async function J(){Y();let e=[];for(let t of H)e.push(t[Symbol.asyncDispose]()),H.delete(t);await Promise.all(e)}function Y(){for(let e of V)e[Symbol.dispose]();V.clear()}var X=class extends Error{constructor(e){super(e),this.name=`ConfigureError`}};export{o as a,k as i,R as n,P as r,W as t};
@@ -1,3 +1,3 @@
1
- import*as e from"node:path";import{join as t,relative as n,resolve as r,sep as i}from"node:path";import{lstat as a,open as o,readdir as s,realpath as c,stat as l}from"node:fs/promises";import{stat as u,unwatchFile as d,watch as f,watchFile as p}from"node:fs";import{EventEmitter as ee}from"node:events";import{Readable as te}from"node:stream";import{type as ne}from"node:os";const m={FILE_TYPE:`files`,DIR_TYPE:`directories`,FILE_DIR_TYPE:`files_directories`,EVERYTHING_TYPE:`all`},h={root:`.`,fileFilter:e=>!0,directoryFilter:e=>!0,type:m.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(h);const g=`READDIRP_RECURSIVE_ERROR`,re=new Set([`ENOENT`,`EPERM`,`EACCES`,`ELOOP`,g]),_=[m.DIR_TYPE,m.EVERYTHING_TYPE,m.FILE_DIR_TYPE,m.FILE_TYPE],v=new Set([m.DIR_TYPE,m.EVERYTHING_TYPE,m.FILE_DIR_TYPE]),y=new Set([m.EVERYTHING_TYPE,m.FILE_DIR_TYPE,m.FILE_TYPE]),b=e=>re.has(e.code),x=process.platform===`win32`,S=e=>!0,C=e=>{if(e===void 0)return S;if(typeof e==`function`)return e;if(typeof e==`string`){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return S};var ie=class extends te{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...h,...e},{root:n,type:i}=t;this._fileFilter=C(t.fileFilter),this._directoryFilter=C(t.directoryFilter);let o=t.lstat?a:l;x?this._stat=e=>o(e,{bigint:!0}):this._stat=o,this._maxDepth=t.depth!=null&&Number.isSafeInteger(t.depth)?t.depth:h.depth,this._wantsDir=i?v.has(i):!1,this._wantsFile=i?y.has(i):!1,this._wantsEverything=i===m.EVERYTHING_TYPE,this._root=r(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?`dirent`:`stats`,this._rdOptions={encoding:`utf8`,withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:r,depth:i}=t,a=n.splice(0,e).map(e=>this._formatEntry(e,r)),o=await Promise.all(a);for(let t of o){if(!t)continue;if(this.destroyed)return;let n=await this._getEntryType(t);n===`directory`&&this._directoryFilter(t)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(t.fullPath,i+1)),this._wantsDir&&(this.push(t),e--)):(n===`file`||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}if(this.parent=await e,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let n;try{n=await s(e,this._rdOptions)}catch(e){this._onError(e)}return{files:n,depth:t,path:e}}async _formatEntry(e,i){let a,o=this._isDirent?e.name:e;try{let s=r(t(i,o));a={path:n(this._root,s),fullPath:s,basename:o},a[this._statsProp]=this._isDirent?e:await this._stat(s)}catch(e){this._onError(e);return}return a}_onError(e){b(e)&&!this.destroyed?this.emit(`warn`,e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return``;let t=e[this._statsProp];if(t.isFile())return`file`;if(t.isDirectory())return`directory`;if(t&&t.isSymbolicLink()){let t=e.fullPath;try{let e=await c(t),n=await a(e);if(n.isFile())return`file`;if(n.isDirectory()){let n=e.length;if(t.startsWith(e)&&t.substr(n,1)===i){let n=Error(`Circular symlink detected: "${t}" points to "${e}"`);return n.code=g,this._onError(n)}return`directory`}}catch(e){return this._onError(e),``}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}};function ae(e,t={}){let n=t.entryType||t.type;if(n===`both`&&(n=m.FILE_DIR_TYPE),n&&(t.type=n),!e)throw Error(`readdirp: root argument is required. Usage: readdirp(root, options)`);if(typeof e!=`string`)throw TypeError(`readdirp: root argument must be a string. Usage: readdirp(root, options)`);if(n&&!_.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${_.join(`, `)}`);return t.root=e,new ie(t)}const w=()=>{},T=process.platform,E=T===`win32`,oe=T===`darwin`,se=T===`linux`,D=T===`freebsd`,O=ne()===`OS400`,k={ALL:`all`,READY:`ready`,ADD:`add`,CHANGE:`change`,ADD_DIR:`addDir`,UNLINK:`unlink`,UNLINK_DIR:`unlinkDir`,RAW:`raw`,ERROR:`error`},A=k,ce={lstat:a,stat:l},j=`listeners`,M=`errHandlers`,N=`rawEmitters`,le=[j,M,N],ue=new Set(`3dm.3ds.3g2.3gp.7z.a.aac.adp.afdesign.afphoto.afpub.ai.aif.aiff.alz.ape.apk.appimage.ar.arj.asf.au.avi.bak.baml.bh.bin.bk.bmp.btif.bz2.bzip2.cab.caf.cgm.class.cmx.cpio.cr2.cur.dat.dcm.deb.dex.djvu.dll.dmg.dng.doc.docm.docx.dot.dotm.dra.DS_Store.dsk.dts.dtshd.dvb.dwg.dxf.ecelp4800.ecelp7470.ecelp9600.egg.eol.eot.epub.exe.f4v.fbs.fh.fla.flac.flatpak.fli.flv.fpx.fst.fvt.g3.gh.gif.graffle.gz.gzip.h261.h263.h264.icns.ico.ief.img.ipa.iso.jar.jpeg.jpg.jpgv.jpm.jxr.key.ktx.lha.lib.lvp.lz.lzh.lzma.lzo.m3u.m4a.m4v.mar.mdi.mht.mid.midi.mj2.mka.mkv.mmr.mng.mobi.mov.movie.mp3.mp4.mp4a.mpeg.mpg.mpga.mxu.nef.npx.numbers.nupkg.o.odp.ods.odt.oga.ogg.ogv.otf.ott.pages.pbm.pcx.pdb.pdf.pea.pgm.pic.png.pnm.pot.potm.potx.ppa.ppam.ppm.pps.ppsm.ppsx.ppt.pptm.pptx.psd.pya.pyc.pyo.pyv.qt.rar.ras.raw.resources.rgb.rip.rlc.rmf.rmvb.rpm.rtf.rz.s3m.s7z.scpt.sgi.shar.snap.sil.sketch.slk.smv.snk.so.stl.suo.sub.swf.tar.tbz.tbz2.tga.tgz.thmx.tif.tiff.tlz.ttc.ttf.txz.udf.uvh.uvi.uvm.uvp.uvs.uvu.viv.vob.war.wav.wax.wbmp.wdp.weba.webm.webp.whl.wim.wm.wma.wmv.wmx.woff.woff2.wrm.wvx.xbm.xif.xla.xlam.xls.xlsb.xlsm.xlsx.xlt.xltm.xltx.xm.xmind.xpi.xpm.xwd.xz.z.zip.zipx`.split(`.`)),de=t=>ue.has(e.extname(t).slice(1).toLowerCase()),P=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},F=(e,t,n)=>{let r=e[t];r instanceof Set||(e[t]=r=new Set([r])),r.add(n)},I=e=>t=>{let n=e[t];n instanceof Set?n.clear():delete e[t]},L=(e,t,n)=>{let r=e[t];r instanceof Set?r.delete(n):r===n&&delete e[t]},R=e=>e instanceof Set?e.size===0:!e,z=new Map;function B(t,n,r,i,a){let o=(n,i)=>{r(t),a(n,i,{watchedPath:t}),i&&t!==i&&V(e.resolve(t,i),j,e.join(t,i))};try{return f(t,{persistent:n.persistent},o)}catch(e){i(e);return}}const V=(e,t,n,r,i)=>{let a=z.get(e);a&&P(a[t],e=>{e(n,r,i)})},H=(e,t,n,r)=>{let{listener:i,errHandler:a,rawEmitter:s}=r,c=z.get(t),l;if(!n.persistent)return l=B(e,n,i,a,s),l?l.close.bind(l):void 0;if(c)F(c,j,i),F(c,M,a),F(c,N,s);else{if(l=B(e,n,V.bind(null,t,j),a,V.bind(null,t,N)),!l)return;l.on(A.ERROR,async n=>{let r=V.bind(null,t,M);if(c&&(c.watcherUnusable=!0),E&&n.code===`EPERM`)try{await(await o(e,`r`)).close(),r(n)}catch{}else r(n)}),c={listeners:i,errHandlers:a,rawEmitters:s,watcher:l},z.set(t,c)}return()=>{L(c,j,i),L(c,M,a),L(c,N,s),R(c.listeners)&&(c.watcher.close(),z.delete(t),le.forEach(I(c)),c.watcher=void 0,Object.freeze(c))}},U=new Map,fe=(e,t,n,r)=>{let{listener:i,rawEmitter:a}=r,o=U.get(t),s=o&&o.options;return s&&(s.persistent<n.persistent||s.interval>n.interval)&&(d(t),o=void 0),o?(F(o,j,i),F(o,N,a)):(o={listeners:i,rawEmitters:a,options:n,watcher:p(t,n,(n,r)=>{P(o.rawEmitters,e=>{e(A.CHANGE,t,{curr:n,prev:r})});let i=n.mtimeMs;(n.size!==r.size||i>r.mtimeMs||i===0)&&P(o.listeners,t=>t(e,n))})},U.set(t,o)),()=>{L(o,j,i),L(o,N,a),R(o.listeners)&&(U.delete(t),d(t),o.options=o.watcher=void 0,Object.freeze(o))}};var pe=class{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(t,n){let r=this.fsw.options,i=e.dirname(t),a=e.basename(t);this.fsw._getWatchedDir(i).add(a);let o=e.resolve(t),s={persistent:r.persistent};n||=w;let c;return r.usePolling?(s.interval=r.interval!==r.binaryInterval&&de(a)?r.binaryInterval:r.interval,c=fe(t,o,s,{listener:n,rawEmitter:this.fsw._emitRaw})):c=H(t,o,s,{listener:n,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),c}_handleFile(t,n,r){if(this.fsw.closed)return;let i=e.dirname(t),a=e.basename(t),o=this.fsw._getWatchedDir(i),s=n;if(o.has(a))return;let c=async(e,n)=>{if(this.fsw._throttle(`watch`,t,5)){if(!n||n.mtimeMs===0)try{let n=await l(t);if(this.fsw.closed)return;let r=n.atimeMs,i=n.mtimeMs;if((!r||r<=i||i!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),(oe||se||D)&&s.ino!==n.ino){this.fsw._closeFile(e),s=n;let r=this._watchWithNodeFs(t,c);r&&this.fsw._addPathCloser(e,r)}else s=n}catch{this.fsw._remove(i,a)}else if(o.has(a)){let e=n.atimeMs,r=n.mtimeMs;(!e||e<=r||r!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),s=n}}},u=this._watchWithNodeFs(t,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(A.ADD,t,0))return;this.fsw._emit(A.ADD,t,n)}return u}async _handleSymlink(e,t,n,r){if(this.fsw.closed)return;let i=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let t;try{t=await c(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==t&&(this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.CHANGE,n,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.ADD,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,n,r,i,a,o,s){t=e.join(t,``);let c=i?`${t}:${i}`:t;if(s=this.fsw._throttle(`readdir`,c,1e3),!s)return;let l=this.fsw._getWatchedDir(r.path),u=new Set,d=this.fsw._readdirp(t,{fileFilter:e=>r.filterPath(e),directoryFilter:e=>r.filterDir(e)});if(d)return d.on(`data`,async s=>{if(this.fsw.closed){d=void 0;return}let c=s.path,f=e.join(t,c);if(u.add(c),!(s.stats.isSymbolicLink()&&await this._handleSymlink(s,t,f,c))){if(this.fsw.closed){d=void 0;return}(c===i||!i&&!l.has(c))&&(this.fsw._incrReadyCount(),f=e.join(a,e.relative(a,f)),this._addToNodeFs(f,n,r,o+1))}}).on(A.ERROR,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once(`end`,()=>{if(this.fsw.closed){d=void 0;return}let n=s?s.clear():!1;e(void 0),l.getChildren().filter(e=>e!==t&&!u.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,r,i,a,o,s)})})}async _handleDir(t,n,r,i,a,o,s){let c=this.fsw._getWatchedDir(e.dirname(t)),l=c.has(e.basename(t));!(r&&this.fsw.options.ignoreInitial)&&!a&&!l&&this.fsw._emit(A.ADD_DIR,t,n),c.add(e.basename(t)),this.fsw._getWatchedDir(t);let u,d=this.fsw.options.depth;if((d==null||i<=d)&&!this.fsw._symlinkPaths.has(s)){if(!a&&(await this._handleRead(t,r,o,a,t,i,void 0),this.fsw.closed))return;u=this._watchWithNodeFs(t,(e,n)=>{n&&n.mtimeMs===0||this._handleRead(e,!1,o,a,t,i,void 0)})}return u}async _addToNodeFs(t,n,r,i,a){let o=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(t);r&&(s.filterPath=e=>r.filterPath(e),s.filterDir=e=>r.filterDir(e));try{let r=await ce[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,r))return o(),!1;let l=this.fsw.options.followSymlinks,u;if(r.isDirectory()){let o=e.resolve(t),d=l?await c(t):t;if(this.fsw.closed||(u=await this._handleDir(s.watchPath,r,n,i,a,s,d),this.fsw.closed))return;o!==d&&d!==void 0&&this.fsw._symlinkPaths.set(o,d)}else if(r.isSymbolicLink()){let a=l?await c(t):t;if(this.fsw.closed)return;let o=e.dirname(s.watchPath);if(this.fsw._getWatchedDir(o).add(s.watchPath),this.fsw._emit(A.ADD,s.watchPath,r),u=await this._handleDir(o,r,n,i,t,s,a),this.fsw.closed)return;a!==void 0&&this.fsw._symlinkPaths.set(e.resolve(t),a)}else u=this._handleFile(s.watchPath,r,n);return o(),u&&this.fsw._addPathCloser(t,u),!1}catch(e){if(this.fsw._handleError(e))return o(),t}}};
1
+ import*as e from"node:path";import{join as t,relative as n,resolve as r,sep as i}from"node:path";import{EventEmitter as a}from"node:events";import{lstat as o,open as s,readdir as c,realpath as l,stat as u}from"node:fs/promises";import{type as d}from"node:os";import{stat as f,unwatchFile as p,watch as m,watchFile as ee}from"node:fs";import{Readable as te}from"node:stream";const h={FILE_TYPE:`files`,DIR_TYPE:`directories`,FILE_DIR_TYPE:`files_directories`,EVERYTHING_TYPE:`all`},g={root:`.`,fileFilter:e=>!0,directoryFilter:e=>!0,type:h.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(g);const _=`READDIRP_RECURSIVE_ERROR`,ne=new Set([`ENOENT`,`EPERM`,`EACCES`,`ELOOP`,_]),v=[h.DIR_TYPE,h.EVERYTHING_TYPE,h.FILE_DIR_TYPE,h.FILE_TYPE],re=new Set([h.DIR_TYPE,h.EVERYTHING_TYPE,h.FILE_DIR_TYPE]),y=new Set([h.EVERYTHING_TYPE,h.FILE_DIR_TYPE,h.FILE_TYPE]),b=e=>ne.has(e.code),x=process.platform===`win32`,S=e=>!0,C=e=>{if(e===void 0)return S;if(typeof e==`function`)return e;if(typeof e==`string`){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return S};var ie=class extends te{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...g,...e},{root:n,type:i}=t;this._fileFilter=C(t.fileFilter),this._directoryFilter=C(t.directoryFilter);let a=t.lstat?o:u;x?this._stat=e=>a(e,{bigint:!0}):this._stat=a,this._maxDepth=t.depth!=null&&Number.isSafeInteger(t.depth)?t.depth:g.depth,this._wantsDir=i?re.has(i):!1,this._wantsFile=i?y.has(i):!1,this._wantsEverything=i===h.EVERYTHING_TYPE,this._root=r(n),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?`dirent`:`stats`,this._rdOptions={encoding:`utf8`,withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,n=t&&t.files;if(n&&n.length>0){let{path:r,depth:i}=t,a=n.splice(0,e).map(e=>this._formatEntry(e,r)),o=await Promise.all(a);for(let t of o){if(!t)continue;if(this.destroyed)return;let n=await this._getEntryType(t);n===`directory`&&this._directoryFilter(t)?(i<=this._maxDepth&&this.parents.push(this._exploreDir(t.fullPath,i+1)),this._wantsDir&&(this.push(t),e--)):(n===`file`||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}if(this.parent=await e,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let n;try{n=await c(e,this._rdOptions)}catch(e){this._onError(e)}return{files:n,depth:t,path:e}}async _formatEntry(e,i){let a,o=this._isDirent?e.name:e;try{let s=r(t(i,o));a={path:n(this._root,s),fullPath:s,basename:o},a[this._statsProp]=this._isDirent?e:await this._stat(s)}catch(e){this._onError(e);return}return a}_onError(e){b(e)&&!this.destroyed?this.emit(`warn`,e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return``;let t=e[this._statsProp];if(t.isFile())return`file`;if(t.isDirectory())return`directory`;if(t&&t.isSymbolicLink()){let t=e.fullPath;try{let e=await l(t),n=await o(e);if(n.isFile())return`file`;if(n.isDirectory()){let n=e.length;if(t.startsWith(e)&&t.substr(n,1)===i){let n=Error(`Circular symlink detected: "${t}" points to "${e}"`);return n.code=_,this._onError(n)}return`directory`}}catch(e){return this._onError(e),``}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}};function ae(e,t={}){let n=t.entryType||t.type;if(n===`both`&&(n=h.FILE_DIR_TYPE),n&&(t.type=n),!e)throw Error(`readdirp: root argument is required. Usage: readdirp(root, options)`);if(typeof e!=`string`)throw TypeError(`readdirp: root argument must be a string. Usage: readdirp(root, options)`);if(n&&!v.includes(n))throw Error(`readdirp: Invalid type passed. Use one of ${v.join(`, `)}`);return t.root=e,new ie(t)}const w=()=>{},T=process.platform,E=T===`win32`,D=T===`darwin`,oe=T===`linux`,se=T===`freebsd`,O=d()===`OS400`,k={ALL:`all`,READY:`ready`,ADD:`add`,CHANGE:`change`,ADD_DIR:`addDir`,UNLINK:`unlink`,UNLINK_DIR:`unlinkDir`,RAW:`raw`,ERROR:`error`},A=k,ce={lstat:o,stat:u},j=`listeners`,M=`errHandlers`,N=`rawEmitters`,le=[j,M,N],ue=new Set(`3dm.3ds.3g2.3gp.7z.a.aac.adp.afdesign.afphoto.afpub.ai.aif.aiff.alz.ape.apk.appimage.ar.arj.asf.au.avi.bak.baml.bh.bin.bk.bmp.btif.bz2.bzip2.cab.caf.cgm.class.cmx.cpio.cr2.cur.dat.dcm.deb.dex.djvu.dll.dmg.dng.doc.docm.docx.dot.dotm.dra.DS_Store.dsk.dts.dtshd.dvb.dwg.dxf.ecelp4800.ecelp7470.ecelp9600.egg.eol.eot.epub.exe.f4v.fbs.fh.fla.flac.flatpak.fli.flv.fpx.fst.fvt.g3.gh.gif.graffle.gz.gzip.h261.h263.h264.icns.ico.ief.img.ipa.iso.jar.jpeg.jpg.jpgv.jpm.jxr.key.ktx.lha.lib.lvp.lz.lzh.lzma.lzo.m3u.m4a.m4v.mar.mdi.mht.mid.midi.mj2.mka.mkv.mmr.mng.mobi.mov.movie.mp3.mp4.mp4a.mpeg.mpg.mpga.mxu.nef.npx.numbers.nupkg.o.odp.ods.odt.oga.ogg.ogv.otf.ott.pages.pbm.pcx.pdb.pdf.pea.pgm.pic.png.pnm.pot.potm.potx.ppa.ppam.ppm.pps.ppsm.ppsx.ppt.pptm.pptx.psd.pya.pyc.pyo.pyv.qt.rar.ras.raw.resources.rgb.rip.rlc.rmf.rmvb.rpm.rtf.rz.s3m.s7z.scpt.sgi.shar.snap.sil.sketch.slk.smv.snk.so.stl.suo.sub.swf.tar.tbz.tbz2.tga.tgz.thmx.tif.tiff.tlz.ttc.ttf.txz.udf.uvh.uvi.uvm.uvp.uvs.uvu.viv.vob.war.wav.wax.wbmp.wdp.weba.webm.webp.whl.wim.wm.wma.wmv.wmx.woff.woff2.wrm.wvx.xbm.xif.xla.xlam.xls.xlsb.xlsm.xlsx.xlt.xltm.xltx.xm.xmind.xpi.xpm.xwd.xz.z.zip.zipx`.split(`.`)),de=t=>ue.has(e.extname(t).slice(1).toLowerCase()),P=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},F=(e,t,n)=>{let r=e[t];r instanceof Set||(e[t]=r=new Set([r])),r.add(n)},I=e=>t=>{let n=e[t];n instanceof Set?n.clear():delete e[t]},L=(e,t,n)=>{let r=e[t];r instanceof Set?r.delete(n):r===n&&delete e[t]},R=e=>e instanceof Set?e.size===0:!e,z=new Map;function B(t,n,r,i,a){let o=(n,i)=>{r(t),a(n,i,{watchedPath:t}),i&&t!==i&&V(e.resolve(t,i),j,e.join(t,i))};try{return m(t,{persistent:n.persistent},o)}catch(e){i(e);return}}const V=(e,t,n,r,i)=>{let a=z.get(e);a&&P(a[t],e=>{e(n,r,i)})},H=(e,t,n,r)=>{let{listener:i,errHandler:a,rawEmitter:o}=r,c=z.get(t),l;if(!n.persistent)return l=B(e,n,i,a,o),l?l.close.bind(l):void 0;if(c)F(c,j,i),F(c,M,a),F(c,N,o);else{if(l=B(e,n,V.bind(null,t,j),a,V.bind(null,t,N)),!l)return;l.on(A.ERROR,async n=>{let r=V.bind(null,t,M);if(c&&(c.watcherUnusable=!0),E&&n.code===`EPERM`)try{await(await s(e,`r`)).close(),r(n)}catch{}else r(n)}),c={listeners:i,errHandlers:a,rawEmitters:o,watcher:l},z.set(t,c)}return()=>{L(c,j,i),L(c,M,a),L(c,N,o),R(c.listeners)&&(c.watcher.close(),z.delete(t),le.forEach(I(c)),c.watcher=void 0,Object.freeze(c))}},U=new Map,fe=(e,t,n,r)=>{let{listener:i,rawEmitter:a}=r,o=U.get(t),s=o&&o.options;return s&&(s.persistent<n.persistent||s.interval>n.interval)&&(p(t),o=void 0),o?(F(o,j,i),F(o,N,a)):(o={listeners:i,rawEmitters:a,options:n,watcher:ee(t,n,(n,r)=>{P(o.rawEmitters,e=>{e(A.CHANGE,t,{curr:n,prev:r})});let i=n.mtimeMs;(n.size!==r.size||i>r.mtimeMs||i===0)&&P(o.listeners,t=>t(e,n))})},U.set(t,o)),()=>{L(o,j,i),L(o,N,a),R(o.listeners)&&(U.delete(t),p(t),o.options=o.watcher=void 0,Object.freeze(o))}};var pe=class{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(t,n){let r=this.fsw.options,i=e.dirname(t),a=e.basename(t);this.fsw._getWatchedDir(i).add(a);let o=e.resolve(t),s={persistent:r.persistent};n||=w;let c;return r.usePolling?(s.interval=r.interval!==r.binaryInterval&&de(a)?r.binaryInterval:r.interval,c=fe(t,o,s,{listener:n,rawEmitter:this.fsw._emitRaw})):c=H(t,o,s,{listener:n,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),c}_handleFile(t,n,r){if(this.fsw.closed)return;let i=e.dirname(t),a=e.basename(t),o=this.fsw._getWatchedDir(i),s=n;if(o.has(a))return;let c=async(e,n)=>{if(this.fsw._throttle(`watch`,t,5)){if(!n||n.mtimeMs===0)try{let n=await u(t);if(this.fsw.closed)return;let r=n.atimeMs,i=n.mtimeMs;if((!r||r<=i||i!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),(D||oe||se)&&s.ino!==n.ino){this.fsw._closeFile(e),s=n;let r=this._watchWithNodeFs(t,c);r&&this.fsw._addPathCloser(e,r)}else s=n}catch{this.fsw._remove(i,a)}else if(o.has(a)){let e=n.atimeMs,r=n.mtimeMs;(!e||e<=r||r!==s.mtimeMs)&&this.fsw._emit(A.CHANGE,t,n),s=n}}},l=this._watchWithNodeFs(t,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(t)){if(!this.fsw._throttle(A.ADD,t,0))return;this.fsw._emit(A.ADD,t,n)}return l}async _handleSymlink(e,t,n,r){if(this.fsw.closed)return;let i=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let t;try{t=await l(n)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(i)!==t&&(this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.CHANGE,n,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(i,t),this.fsw._emit(A.ADD,n,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(i))return!0;this.fsw._symlinkPaths.set(i,!0)}_handleRead(t,n,r,i,a,o,s){t=e.join(t,``);let c=i?`${t}:${i}`:t;if(s=this.fsw._throttle(`readdir`,c,1e3),!s)return;let l=this.fsw._getWatchedDir(r.path),u=new Set,d=this.fsw._readdirp(t,{fileFilter:e=>r.filterPath(e),directoryFilter:e=>r.filterDir(e)});if(d)return d.on(`data`,async s=>{if(this.fsw.closed){d=void 0;return}let c=s.path,f=e.join(t,c);if(u.add(c),!(s.stats.isSymbolicLink()&&await this._handleSymlink(s,t,f,c))){if(this.fsw.closed){d=void 0;return}(c===i||!i&&!l.has(c))&&(this.fsw._incrReadyCount(),f=e.join(a,e.relative(a,f)),this._addToNodeFs(f,n,r,o+1))}}).on(A.ERROR,this._boundHandleError),new Promise((e,n)=>{if(!d)return n();d.once(`end`,()=>{if(this.fsw.closed){d=void 0;return}let n=s?s.clear():!1;e(void 0),l.getChildren().filter(e=>e!==t&&!u.has(e)).forEach(e=>{this.fsw._remove(t,e)}),d=void 0,n&&this._handleRead(t,!1,r,i,a,o,s)})})}async _handleDir(t,n,r,i,a,o,s){let c=this.fsw._getWatchedDir(e.dirname(t)),l=c.has(e.basename(t));!(r&&this.fsw.options.ignoreInitial)&&!a&&!l&&this.fsw._emit(A.ADD_DIR,t,n),c.add(e.basename(t)),this.fsw._getWatchedDir(t);let u,d=this.fsw.options.depth;if((d==null||i<=d)&&!this.fsw._symlinkPaths.has(s)){if(!a&&(await this._handleRead(t,r,o,a,t,i,void 0),this.fsw.closed))return;u=this._watchWithNodeFs(t,(e,n)=>{n&&n.mtimeMs===0||this._handleRead(e,!1,o,a,t,i,void 0)})}return u}async _addToNodeFs(t,n,r,i,a){let o=this.fsw._emitReady;if(this.fsw._isIgnored(t)||this.fsw.closed)return o(),!1;let s=this.fsw._getWatchHelpers(t);r&&(s.filterPath=e=>r.filterPath(e),s.filterDir=e=>r.filterDir(e));try{let r=await ce[s.statMethod](s.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(s.watchPath,r))return o(),!1;let c=this.fsw.options.followSymlinks,u;if(r.isDirectory()){let o=e.resolve(t),d=c?await l(t):t;if(this.fsw.closed||(u=await this._handleDir(s.watchPath,r,n,i,a,s,d),this.fsw.closed))return;o!==d&&d!==void 0&&this.fsw._symlinkPaths.set(o,d)}else if(r.isSymbolicLink()){let a=c?await l(t):t;if(this.fsw.closed)return;let o=e.dirname(s.watchPath);if(this.fsw._getWatchedDir(o).add(s.watchPath),this.fsw._emit(A.ADD,s.watchPath,r),u=await this._handleDir(o,r,n,i,t,s,a),this.fsw.closed)return;a!==void 0&&this.fsw._symlinkPaths.set(e.resolve(t),a)}else u=this._handleFile(s.watchPath,r,n);return o(),u&&this.fsw._addPathCloser(t,u),!1}catch(e){if(this.fsw._handleError(e))return o(),t}}};
2
2
  /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
3
- const me=/\\/g,W=/\/\//g,he=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ge=/^\.[/\\]/;function G(e){return Array.isArray(e)?e:[e]}const K=e=>typeof e==`object`&&!!e&&!(e instanceof RegExp);function _e(t){return typeof t==`function`?t:typeof t==`string`?e=>t===e:t instanceof RegExp?e=>t.test(e):typeof t==`object`&&t?n=>{if(t.path===n)return!0;if(t.recursive){let r=e.relative(t.path,n);return r?!r.startsWith(`..`)&&!e.isAbsolute(r):!1}return!1}:()=>!1}function ve(t){if(typeof t!=`string`)throw Error(`string expected`);t=e.normalize(t),t=t.replace(/\\/g,`/`);let n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t}function q(e,t,n){let r=ve(t);for(let t=0;t<e.length;t++){let i=e[t];if(i(r,n))return!0}return!1}function ye(e,t){if(e==null)throw TypeError(`anymatch: specify first argument`);let n=G(e).map(e=>_e(e));return t==null?(e,t)=>q(n,e,t):q(n,t)}const J=e=>{let t=G(e).flat();if(!t.every(e=>typeof e==`string`))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(X)},Y=e=>{let t=e.replace(me,`/`),n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t},X=t=>Y(e.normalize(Y(t))),Z=(t=``)=>n=>typeof n==`string`?X(e.isAbsolute(n)?n:e.join(t,n)):n,be=(t,n)=>e.isAbsolute(t)?t:e.join(n,t),Q=Object.freeze(new Set);var xe=class{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==`.`&&e!==`..`&&t.add(e)}async remove(t){let{items:n}=this;if(!n||(n.delete(t),n.size>0))return;let r=this.path;try{await s(r)}catch{this._removeWatcher&&this._removeWatcher(e.dirname(r),e.basename(r))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path=``,this._removeWatcher=w,this.items=Q,Object.freeze(this)}},Se=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,n,r){this.fsw=r;let i=t;this.path=t=t.replace(ge,``),this.watchPath=i,this.fullWatchPath=e.resolve(i),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=n,this.statMethod=n?`stat`:`lstat`}entryPath(t){return e.join(this.watchPath,e.relative(this.watchPath,t.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},$=class extends ee{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?G(e.ignored):G([]),awaitWriteFinish:t===!0?n:typeof t==`object`?{...n,...t}:!1};O&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let e=i.toLowerCase();e===`false`||e===`0`?r.usePolling=!1:e===`true`||e===`1`?r.usePolling=!0:r.usePolling=!!e}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=w,this._readyEmitted=!0,process.nextTick(()=>this.emit(k.READY)))},this._emitRaw=(...e)=>this.emit(k.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new pe(this),Object.freeze(r)}_addIgnoredPath(e){if(K(e)){for(let t of this._ignoredPaths)if(K(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==`string`)for(let t of this._ignoredPaths)K(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(t,n,r){let{cwd:i}=this.options;this.closed=!1,this._closePromise=void 0;let a=J(t);return i&&(a=a.map(e=>be(e,i))),a.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||=0,this._readyCount+=a.length,Promise.all(a.map(async e=>{let t=await this._nodeFsHandler._addToNodeFs(e,!r,void 0,0,n);return t&&this._emitReady(),t})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(e.dirname(t),e.basename(n||t))})}),this}unwatch(t){if(this.closed)return this;let n=J(t),{cwd:r}=this.options;return n.forEach(t=>{!e.isAbsolute(t)&&!this._closers.has(t)&&(r&&(t=e.join(r,t)),t=e.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let n=t();n instanceof Promise&&e.push(n)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((n,r)=>{let i=(this.options.cwd?e.relative(this.options.cwd,r):r)||`.`;t[i]=n.getChildren().sort()}),t}emitWithAll(e,t){this.emit(e,...t),e!==k.ERROR&&this.emit(k.ALL,e,...t)}async _emit(t,n,r){if(this.closed)return;let i=this.options;E&&(n=e.normalize(n)),i.cwd&&(n=e.relative(i.cwd,n));let a=[n];r!=null&&a.push(r);let o=i.awaitWriteFinish,s;if(o&&(s=this._pendingWrites.get(n)))return s.lastChange=new Date,this;if(i.atomic){if(t===k.UNLINK)return this._pendingUnlinks.set(n,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(k.ALL,...e),this._pendingUnlinks.delete(t)})},typeof i.atomic==`number`?i.atomic:100),this;t===k.ADD&&this._pendingUnlinks.has(n)&&(t=k.CHANGE,this._pendingUnlinks.delete(n))}if(o&&(t===k.ADD||t===k.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(n,o.stabilityThreshold,t,(e,n)=>{e?(t=k.ERROR,a[0]=e,this.emitWithAll(t,a)):n&&(a.length>1?a[1]=n:a.push(n),this.emitWithAll(t,a))}),this;if(t===k.CHANGE&&!this._throttle(k.CHANGE,n,50))return this;if(i.alwaysStat&&r===void 0&&(t===k.ADD||t===k.ADD_DIR||t===k.CHANGE)){let t=i.cwd?e.join(i.cwd,n):n,r;try{r=await l(t)}catch{}if(!r||this.closed)return;a.push(r)}return this.emitWithAll(t,a),this}_handleError(e){let t=e&&e.code;return e&&t!==`ENOENT`&&t!==`ENOTDIR`&&(!this.options.ignorePermissionErrors||t!==`EPERM`&&t!==`EACCES`)&&this.emit(k.ERROR,e),e||this.closed}_throttle(e,t,n){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error(`invalid throttle`);let i=r.get(t);if(i)return i.count++,!1;let a,o=()=>{let e=r.get(t),n=e?e.count:0;return r.delete(t),clearTimeout(a),e&&clearTimeout(e.timeoutObject),n};a=setTimeout(o,n);let s={timeoutObject:a,clear:o,count:0};return r.set(t,s),s}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,n,r,i){let a=this.options.awaitWriteFinish;if(typeof a!=`object`)return;let o=a.pollInterval,s,c=t;this.options.cwd&&!e.isAbsolute(t)&&(c=e.join(this.options.cwd,t));let l=new Date,d=this._pendingWrites;function f(e){u(c,(r,a)=>{if(r||!d.has(t)){r&&r.code!==`ENOENT`&&i(r);return}let c=Number(new Date);e&&a.size!==e.size&&(d.get(t).lastChange=c),c-d.get(t).lastChange>=n?(d.delete(t),i(void 0,a)):s=setTimeout(f,o,a)})}d.has(t)||(d.set(t,{lastChange:l,cancelWait:()=>(d.delete(t),clearTimeout(s),r)}),s=setTimeout(f,o))}_isIgnored(e,t){if(this.options.atomic&&he.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map(Z(e));this._userIgnored=ye([...[...this._ignoredPaths].map(Z(e)),...t],void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Se(e,this.options.followSymlinks,this)}_getWatchedDir(t){let n=e.resolve(t);return this._watched.has(n)||this._watched.set(n,new xe(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(t,n,r){let i=e.join(t,n),a=e.resolve(i);if(r??=this._watched.has(i)||this._watched.has(a),!this._throttle(`remove`,i,100))return;!r&&this._watched.size===1&&this.add(t,n,!0),this._getWatchedDir(i).getChildren().forEach(e=>this._remove(i,e));let o=this._getWatchedDir(t),s=o.has(n);o.remove(n),this._symlinkPaths.has(a)&&this._symlinkPaths.delete(a);let c=i;if(this.options.cwd&&(c=e.relative(this.options.cwd,i)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===k.ADD)return;this._watched.delete(i),this._watched.delete(a);let l=r?k.UNLINK_DIR:k.UNLINK;s&&!this._isIgnored(i)&&this._emit(l,i),this._closePath(i)}_closePath(t){this._closeFile(t);let n=e.dirname(t);this._getWatchedDir(n).remove(e.basename(t))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);n||(n=[],this._closers.set(e,n)),n.push(t)}_readdirp(e,t){if(this.closed)return;let n=ae(e,{type:k.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(n),n.once(`close`,()=>{n=void 0}),n.once(`end`,()=>{n&&=(this._streams.delete(n),void 0)}),n}};function Ce(e,t={}){let n=new $(t);return n.add(e),n}var we={watch:Ce,FSWatcher:$};export{we as t};
3
+ const me=/\\/g,W=/\/\//g,he=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,ge=/^\.[/\\]/;function G(e){return Array.isArray(e)?e:[e]}const K=e=>typeof e==`object`&&!!e&&!(e instanceof RegExp);function _e(t){return typeof t==`function`?t:typeof t==`string`?e=>t===e:t instanceof RegExp?e=>t.test(e):typeof t==`object`&&t?n=>{if(t.path===n)return!0;if(t.recursive){let r=e.relative(t.path,n);return r?!r.startsWith(`..`)&&!e.isAbsolute(r):!1}return!1}:()=>!1}function ve(t){if(typeof t!=`string`)throw Error(`string expected`);t=e.normalize(t),t=t.replace(/\\/g,`/`);let n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t}function q(e,t,n){let r=ve(t);for(let t=0;t<e.length;t++){let i=e[t];if(i(r,n))return!0}return!1}function ye(e,t){if(e==null)throw TypeError(`anymatch: specify first argument`);let n=G(e).map(e=>_e(e));return t==null?(e,t)=>q(n,e,t):q(n,t)}const J=e=>{let t=G(e).flat();if(!t.every(e=>typeof e==`string`))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(X)},Y=e=>{let t=e.replace(me,`/`),n=!1;return t.startsWith(`//`)&&(n=!0),t=t.replace(W,`/`),n&&(t=`/`+t),t},X=t=>Y(e.normalize(Y(t))),Z=(t=``)=>n=>typeof n==`string`?X(e.isAbsolute(n)?n:e.join(t,n)):n,be=(t,n)=>e.isAbsolute(t)?t:e.join(n,t),Q=Object.freeze(new Set);var xe=class{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==`.`&&e!==`..`&&t.add(e)}async remove(t){let{items:n}=this;if(!n||(n.delete(t),n.size>0))return;let r=this.path;try{await c(r)}catch{this._removeWatcher&&this._removeWatcher(e.dirname(r),e.basename(r))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path=``,this._removeWatcher=w,this.items=Q,Object.freeze(this)}},Se=class{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(t,n,r){this.fsw=r;let i=t;this.path=t=t.replace(ge,``),this.watchPath=i,this.fullWatchPath=e.resolve(i),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=n,this.statMethod=n?`stat`:`lstat`}entryPath(t){return e.join(this.watchPath,e.relative(this.watchPath,t.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let n=this.entryPath(e);return this.fsw._isntIgnored(n,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},$=class extends a{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,n={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?G(e.ignored):G([]),awaitWriteFinish:t===!0?n:typeof t==`object`?{...n,...t}:!1};O&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let i=process.env.CHOKIDAR_USEPOLLING;if(i!==void 0){let e=i.toLowerCase();e===`false`||e===`0`?r.usePolling=!1:e===`true`||e===`1`?r.usePolling=!0:r.usePolling=!!e}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let o=0;this._emitReady=()=>{o++,o>=this._readyCount&&(this._emitReady=w,this._readyEmitted=!0,process.nextTick(()=>this.emit(k.READY)))},this._emitRaw=(...e)=>this.emit(k.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new pe(this),Object.freeze(r)}_addIgnoredPath(e){if(K(e)){for(let t of this._ignoredPaths)if(K(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e==`string`)for(let t of this._ignoredPaths)K(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(t,n,r){let{cwd:i}=this.options;this.closed=!1,this._closePromise=void 0;let a=J(t);return i&&(a=a.map(e=>be(e,i))),a.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||=0,this._readyCount+=a.length,Promise.all(a.map(async e=>{let t=await this._nodeFsHandler._addToNodeFs(e,!r,void 0,0,n);return t&&this._emitReady(),t})).then(t=>{this.closed||t.forEach(t=>{t&&this.add(e.dirname(t),e.basename(n||t))})}),this}unwatch(t){if(this.closed)return this;let n=J(t),{cwd:r}=this.options;return n.forEach(t=>{!e.isAbsolute(t)&&!this._closers.has(t)&&(r&&(t=e.join(r,t)),t=e.resolve(t)),this._closePath(t),this._addIgnoredPath(t),this._watched.has(t)&&this._addIgnoredPath({path:t,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let n=t();n instanceof Promise&&e.push(n)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let t={};return this._watched.forEach((n,r)=>{let i=(this.options.cwd?e.relative(this.options.cwd,r):r)||`.`;t[i]=n.getChildren().sort()}),t}emitWithAll(e,t){this.emit(e,...t),e!==k.ERROR&&this.emit(k.ALL,e,...t)}async _emit(t,n,r){if(this.closed)return;let i=this.options;E&&(n=e.normalize(n)),i.cwd&&(n=e.relative(i.cwd,n));let a=[n];r!=null&&a.push(r);let o=i.awaitWriteFinish,s;if(o&&(s=this._pendingWrites.get(n)))return s.lastChange=new Date,this;if(i.atomic){if(t===k.UNLINK)return this._pendingUnlinks.set(n,[t,...a]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(k.ALL,...e),this._pendingUnlinks.delete(t)})},typeof i.atomic==`number`?i.atomic:100),this;t===k.ADD&&this._pendingUnlinks.has(n)&&(t=k.CHANGE,this._pendingUnlinks.delete(n))}if(o&&(t===k.ADD||t===k.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(n,o.stabilityThreshold,t,(e,n)=>{e?(t=k.ERROR,a[0]=e,this.emitWithAll(t,a)):n&&(a.length>1?a[1]=n:a.push(n),this.emitWithAll(t,a))}),this;if(t===k.CHANGE&&!this._throttle(k.CHANGE,n,50))return this;if(i.alwaysStat&&r===void 0&&(t===k.ADD||t===k.ADD_DIR||t===k.CHANGE)){let t=i.cwd?e.join(i.cwd,n):n,r;try{r=await u(t)}catch{}if(!r||this.closed)return;a.push(r)}return this.emitWithAll(t,a),this}_handleError(e){let t=e&&e.code;return e&&t!==`ENOENT`&&t!==`ENOTDIR`&&(!this.options.ignorePermissionErrors||t!==`EPERM`&&t!==`EACCES`)&&this.emit(k.ERROR,e),e||this.closed}_throttle(e,t,n){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error(`invalid throttle`);let i=r.get(t);if(i)return i.count++,!1;let a,o=()=>{let e=r.get(t),n=e?e.count:0;return r.delete(t),clearTimeout(a),e&&clearTimeout(e.timeoutObject),n};a=setTimeout(o,n);let s={timeoutObject:a,clear:o,count:0};return r.set(t,s),s}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(t,n,r,i){let a=this.options.awaitWriteFinish;if(typeof a!=`object`)return;let o=a.pollInterval,s,c=t;this.options.cwd&&!e.isAbsolute(t)&&(c=e.join(this.options.cwd,t));let l=new Date,u=this._pendingWrites;function d(e){f(c,(r,a)=>{if(r||!u.has(t)){r&&r.code!==`ENOENT`&&i(r);return}let c=Number(new Date);e&&a.size!==e.size&&(u.get(t).lastChange=c),c-u.get(t).lastChange>=n?(u.delete(t),i(void 0,a)):s=setTimeout(d,o,a)})}u.has(t)||(u.set(t,{lastChange:l,cancelWait:()=>(u.delete(t),clearTimeout(s),r)}),s=setTimeout(d,o))}_isIgnored(e,t){if(this.options.atomic&&he.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map(Z(e));this._userIgnored=ye([...[...this._ignoredPaths].map(Z(e)),...t],void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Se(e,this.options.followSymlinks,this)}_getWatchedDir(t){let n=e.resolve(t);return this._watched.has(n)||this._watched.set(n,new xe(n,this._boundRemove)),this._watched.get(n)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(t,n,r){let i=e.join(t,n),a=e.resolve(i);if(r??=this._watched.has(i)||this._watched.has(a),!this._throttle(`remove`,i,100))return;!r&&this._watched.size===1&&this.add(t,n,!0),this._getWatchedDir(i).getChildren().forEach(e=>this._remove(i,e));let o=this._getWatchedDir(t),s=o.has(n);o.remove(n),this._symlinkPaths.has(a)&&this._symlinkPaths.delete(a);let c=i;if(this.options.cwd&&(c=e.relative(this.options.cwd,i)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===k.ADD)return;this._watched.delete(i),this._watched.delete(a);let l=r?k.UNLINK_DIR:k.UNLINK;s&&!this._isIgnored(i)&&this._emit(l,i),this._closePath(i)}_closePath(t){this._closeFile(t);let n=e.dirname(t);this._getWatchedDir(n).remove(e.basename(t))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let n=this._closers.get(e);n||(n=[],this._closers.set(e,n)),n.push(t)}_readdirp(e,t){if(this.closed)return;let n=ae(e,{type:k.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(n),n.once(`close`,()=>{n=void 0}),n.once(`end`,()=>{n&&=(this._streams.delete(n),void 0)}),n}};function Ce(e,t={}){let n=new $(t);return n.add(e),n}var we={watch:Ce,FSWatcher:$};export{we as t};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./is-error-instance.mjs";import{t}from"./is-plain-obj.mjs";const n=e=>{r.forEach(t=>{i(e,t)})},r=[`name`,`message`,`stack`,`cause`,`errors`],i=(e,t)=>{let n=a(e,t);if(n!==void 0){if(o(n)){c(e,t,e[t]);return}s(n)&&l(e,t,n)}},a=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:a(r,t)},o=({get:e,set:t})=>e!==void 0&&t===void 0,s=({enumerable:e,writable:t})=>e||!t,c=(e,t,n)=>{l(e,t,{value:n})},l=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},ee=(e,t)=>{Array.isArray(e.errors)?c(e,`errors`,e.errors.filter(te).map(t).filter(Boolean)):ne(e)?c(e,`errors`,[]):e.errors!==void 0&&re(e)},te=e=>e!==void 0,ne=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),re=e=>{delete e.errors,e.errors!==void 0&&c(e,`errors`,[])},u=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:c(e,`cause`,n)},d=e=>!Object.isExtensible(e)||r.some(t=>f(e,t)||p(e,t)),f=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},p=(e,t)=>{try{return e[t],!1}catch{return!0}},m=e=>{c(e,`stack`,ie(e.message,e.name))},ie=(e=``,t=`Error`)=>{let{stack:n}=new(ae(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},ae=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},`name`,t);return Object.defineProperty(n.prototype,`name`,t),n},oe=e=>{let t={};for(let n of se(e))try{let r=e[n],{enumerable:i,configurable:o,writable:s=!0}=a(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:o,writable:s})}catch{}return t},se=e=>{let t=ce(e);for(let n of r)le(e,n)&&t.push(n);return t},ce=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},le=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},h=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...o}=oe(e),s=ue(n,o),c=me(t,s);return n===s&&he(c,o),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{ge(c,e,t)}),r===void 0&&m(c),c},ue=(e,t)=>typeof e==`string`&&e!==``?e:pe(de(t)),de=e=>{try{return JSON.stringify(e)}catch{return fe(e)}},fe=e=>{try{return String(e)}catch{return`Invalid error`}},pe=e=>e.length<g?e:`${e.slice(0,g)}...`,g=1e3,me=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in _?new _[e](t):Error(t),_={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},he=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},ge=(e,t,n)=>{n!==void 0&&c(e,t,n)},_e=e=>{try{let t=Error(String(e));return m(t),t}catch(e){return e}},{toString:ve}=Object.prototype,ye=t=>be(t)?h(t):e(t)?v(t)?h(t):t:_e(t),be=e=>{try{return t(e)}catch{return!1}},v=e=>y(e)||d(e)||b(e),y=e=>{try{return ve.call(e)===`[object Object]`}catch{return!0}},b=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),x=(e,{shallow:t=!1}={})=>S(e,[],t),S=(e,t,n)=>{if(t.includes(e))return;let r=n?C:r=>S(r,[...t,e],n),i=ye(e);return w(i,r),i},C=e=>e,w=(e,t)=>{T(e),E(e),D(e),u(e,t),ee(e,t),n(e)},T=e=>{if(O(e.name))return;let t=Object.getPrototypeOf(e).name;c(e,`name`,O(t)?t:e.constructor.name)},E=e=>{O(e.message)||c(e,`message`,``)},D=e=>{O(e.stack)||m(e)},O=e=>typeof e==`string`&&e!==``,k=(e,t,n=e.name)=>{if(A(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},A=e=>{if(!j(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!M(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!N(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},j=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,M=e=>e!==null&&(e.name===`Error`||M(Object.getPrototypeOf(e))),N=e=>typeof e.prototype.constructor==`function`,P=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},xe=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(Se(e,t),L(e,`constructor`),Ce(e,t))},Se=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},Ce=(e,t)=>{L(e,`name`);let n=F(t.prototype);e.name!==n&&P(e,`name`,n)},F=e=>we(e)??Te(e)??F(Object.getPrototypeOf(e)),we=e=>Object.hasOwn(e,`name`)&&I(e.name)?e.name:void 0,Te=e=>typeof e.constructor==`function`&&I(e.constructor.name)?e.constructor.name:void 0,I=e=>typeof e==`string`&&e!==``,L=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},Ee=(e,t)=>{De(e,t)&&P(e,`stack`,ke(e,t))},De=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&Oe(),Oe=()=>{class e extends Error{}let t={value:R,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(e,`name`,t),Object.defineProperty(e.prototype,`name`,t);let{stack:n}=new e(``);return typeof n==`string`&&n.includes(R)},R=`SetErrorClassError`,ke=({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=Ae(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},Ae=(e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],je=(e,t,n)=>{let r=x(e),i=k(r,t,n);return xe(r,t),Ee(r,i),r},Me=(e,t)=>t.configurable===!1?Ne(e,t):Ie(e,t),Ne=(e,t)=>({...t,...Pe(e,t),...Fe(e,t)}),Pe=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},Fe=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},Ie=(e,t)=>{let n=B(e.enumerable,t.enumerable,!0),r=B(e.writable,t.writable,!0),i=B(e.configurable,t.configurable,!0);return{...Le(e,t,r),enumerable:n,configurable:i}},Le=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!z(e)&&!z(t)?{value:t.value,writable:n}:{get:B(e.get,t.get),set:B(e.set,t.set)},z=({get:e,set:t})=>e!==void 0||t!==void 0,B=(e,t,n)=>e??t??n,Re=(e,t,n)=>{if(!ze(e))throw TypeError(`Argument must be an object: ${e}`);if(!Be(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return Ve(n)},ze=e=>typeof e==`object`&&!!e,Be=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},Ve=e=>{if(!t(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,...c}=e,l=`value`in e;return He({enumerable:n,writable:r,configurable:i,get:o,set:s,unknownProps:c,hasValue:l}),{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,hasValue:l}},He=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{V(o,r,`get`),V(o,i,`set`),H(e,`enumerable`),H(t,`writable`),H(n,`configurable`),We(a)},V=(e,t,n)=>{if(Ue(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},Ue=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},H=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},We=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},Ge=(e,t,n)=>(Ke(e,t,Me(Re(e,t,n),U(e,t))),e),U=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:U(r,t)},Ke=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},qe=(e,t,n)=>{if(n!==void 0)return W(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return W(e,t)},W=(e,t,n)=>{Ge(e,t,{value:n,...Je(t)})},Je=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},Ye=(e,n,r={})=>{if(G(e,`First argument`),G(n,`Second argument`),!t(r))throw TypeError(`Options must be a plain object: ${r}`);let{soft:i=!1}=r;if(typeof i!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${i}`);return{soft:i}},G=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!Xe(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},Xe=n=>t(n)||e(n),Ze=({error:e,props:t,propName:n,soft:r})=>Qe(n)||!tt.call(t,n)||r&&e[n]!==void 0,Qe=e=>e in $e||et.has(e),$e=Error(`check`),et=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:tt}=Object.prototype,nt=(e,t,n)=>{let{soft:r}=Ye(e,t,n);for(let n of Reflect.ownKeys(t))rt({error:e,props:t,propName:n,soft:r});return e},rt=({error:e,props:t,propName:n,soft:r})=>{Ze({error:e,props:t,propName:n,soft:r})||qe(e,n,t[n])},K=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},it=(e,t)=>{e.errors!==void 0&&K(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},at=({target:e,source:t,parent:n,child:r})=>{if(!q(e)){ot(e,t);return}q(t)&&K(e,`errors`,[...r.errors,...n.errors])},ot=(e,t)=>{t.errors!==void 0&&K(e,`errors`,t.errors)},q=e=>e.errors!==void 0&&e.errors.length!==0,st=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},ct=({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?lt({name:e,stack:t,newMessage:n,currentMessage:r}):dt(e,t,n),lt=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=ut(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},ut=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],dt=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},ft=(e,t,n)=>{let r=x(e),i=st(r,t,n);return Y(r,`message`,t),pt(r,t,i),r},pt=(e,t,n)=>{t===n||!mt()||Y(e,`stack`,ct(e,t,n))},mt=()=>{let{stack:e}=Error(J);return typeof e==`string`&&e.includes(J)},J=`set-error-message test message`,Y=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},X=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=x(e);return ft(r,Z(t,r.message),n)},Z=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:ht(n,r,e)},ht=(e,t,n)=>e.endsWith(gt)?n.endsWith(_t)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,gt=`:`,_t=`
1
+ import{t as e}from"./is-plain-obj.mjs";import{t}from"./is-error-instance.mjs";const n=e=>{r.forEach(t=>{i(e,t)})},r=[`name`,`message`,`stack`,`cause`,`errors`],i=(e,t)=>{let n=a(e,t);if(n!==void 0){if(o(n)){c(e,t,e[t]);return}s(n)&&l(e,t,n)}},a=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:a(r,t)},o=({get:e,set:t})=>e!==void 0&&t===void 0,s=({enumerable:e,writable:t})=>e||!t,c=(e,t,n)=>{l(e,t,{value:n})},l=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},ee=(e,t)=>{Array.isArray(e.errors)?c(e,`errors`,e.errors.filter(te).map(t).filter(Boolean)):ne(e)?c(e,`errors`,[]):e.errors!==void 0&&re(e)},te=e=>e!==void 0,ne=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),re=e=>{delete e.errors,e.errors!==void 0&&c(e,`errors`,[])},u=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:c(e,`cause`,n)},d=e=>!Object.isExtensible(e)||r.some(t=>f(e,t)||p(e,t)),f=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},p=(e,t)=>{try{return e[t],!1}catch{return!0}},m=e=>{c(e,`stack`,ie(e.message,e.name))},ie=(e=``,t=`Error`)=>{let{stack:n}=new(ae(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},ae=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},`name`,t);return Object.defineProperty(n.prototype,`name`,t),n},oe=e=>{let t={};for(let n of se(e))try{let r=e[n],{enumerable:i,configurable:o,writable:s=!0}=a(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:o,writable:s})}catch{}return t},se=e=>{let t=ce(e);for(let n of r)le(e,n)&&t.push(n);return t},ce=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},le=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},h=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...o}=oe(e),s=ue(n,o),c=me(t,s);return n===s&&he(c,o),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{ge(c,e,t)}),r===void 0&&m(c),c},ue=(e,t)=>typeof e==`string`&&e!==``?e:pe(de(t)),de=e=>{try{return JSON.stringify(e)}catch{return fe(e)}},fe=e=>{try{return String(e)}catch{return`Invalid error`}},pe=e=>e.length<g?e:`${e.slice(0,g)}...`,g=1e3,me=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in _?new _[e](t):Error(t),_={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},he=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},ge=(e,t,n)=>{n!==void 0&&c(e,t,n)},_e=e=>{try{let t=Error(String(e));return m(t),t}catch(e){return e}},{toString:ve}=Object.prototype,ye=e=>be(e)?h(e):t(e)?v(e)?h(e):e:_e(e),be=t=>{try{return e(t)}catch{return!1}},v=e=>y(e)||d(e)||b(e),y=e=>{try{return ve.call(e)===`[object Object]`}catch{return!0}},b=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),x=(e,{shallow:t=!1}={})=>S(e,[],t),S=(e,t,n)=>{if(t.includes(e))return;let r=n?C:r=>S(r,[...t,e],n),i=ye(e);return w(i,r),i},C=e=>e,w=(e,t)=>{T(e),E(e),D(e),u(e,t),ee(e,t),n(e)},T=e=>{if(O(e.name))return;let t=Object.getPrototypeOf(e).name;c(e,`name`,O(t)?t:e.constructor.name)},E=e=>{O(e.message)||c(e,`message`,``)},D=e=>{O(e.stack)||m(e)},O=e=>typeof e==`string`&&e!==``,k=(e,t,n=e.name)=>{if(A(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},A=e=>{if(!j(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!M(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!N(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},j=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,M=e=>e!==null&&(e.name===`Error`||M(Object.getPrototypeOf(e))),N=e=>typeof e.prototype.constructor==`function`,P=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},xe=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(Se(e,t),L(e,`constructor`),Ce(e,t))},Se=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},Ce=(e,t)=>{L(e,`name`);let n=F(t.prototype);e.name!==n&&P(e,`name`,n)},F=e=>we(e)??Te(e)??F(Object.getPrototypeOf(e)),we=e=>Object.hasOwn(e,`name`)&&I(e.name)?e.name:void 0,Te=e=>typeof e.constructor==`function`&&I(e.constructor.name)?e.constructor.name:void 0,I=e=>typeof e==`string`&&e!==``,L=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},Ee=(e,t)=>{De(e,t)&&P(e,`stack`,ke(e,t))},De=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&Oe(),Oe=()=>{class e extends Error{}let t={value:R,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(e,`name`,t),Object.defineProperty(e.prototype,`name`,t);let{stack:n}=new e(``);return typeof n==`string`&&n.includes(R)},R=`SetErrorClassError`,ke=({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=Ae(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},Ae=(e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],je=(e,t,n)=>{let r=x(e),i=k(r,t,n);return xe(r,t),Ee(r,i),r},Me=(e,t)=>t.configurable===!1?Ne(e,t):Ie(e,t),Ne=(e,t)=>({...t,...Pe(e,t),...Fe(e,t)}),Pe=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},Fe=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},Ie=(e,t)=>{let n=B(e.enumerable,t.enumerable,!0),r=B(e.writable,t.writable,!0),i=B(e.configurable,t.configurable,!0);return{...Le(e,t,r),enumerable:n,configurable:i}},Le=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!z(e)&&!z(t)?{value:t.value,writable:n}:{get:B(e.get,t.get),set:B(e.set,t.set)},z=({get:e,set:t})=>e!==void 0||t!==void 0,B=(e,t,n)=>e??t??n,Re=(e,t,n)=>{if(!ze(e))throw TypeError(`Argument must be an object: ${e}`);if(!Be(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return Ve(n)},ze=e=>typeof e==`object`&&!!e,Be=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},Ve=t=>{if(!e(t))throw TypeError(`Descriptor must be a plain object: ${t}`);let{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,...c}=t,l=`value`in t;return He({enumerable:n,writable:r,configurable:i,get:o,set:s,unknownProps:c,hasValue:l}),{enumerable:n,writable:r,configurable:i,value:a,get:o,set:s,hasValue:l}},He=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{V(o,r,`get`),V(o,i,`set`),H(e,`enumerable`),H(t,`writable`),H(n,`configurable`),We(a)},V=(e,t,n)=>{if(Ue(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},Ue=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},H=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},We=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},Ge=(e,t,n)=>(Ke(e,t,Me(Re(e,t,n),U(e,t))),e),U=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:U(r,t)},Ke=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},qe=(e,t,n)=>{if(n!==void 0)return W(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return W(e,t)},W=(e,t,n)=>{Ge(e,t,{value:n,...Je(t)})},Je=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},Ye=(t,n,r={})=>{if(G(t,`First argument`),G(n,`Second argument`),!e(r))throw TypeError(`Options must be a plain object: ${r}`);let{soft:i=!1}=r;if(typeof i!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${i}`);return{soft:i}},G=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!Xe(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},Xe=n=>e(n)||t(n),Ze=({error:e,props:t,propName:n,soft:r})=>Qe(n)||!tt.call(t,n)||r&&e[n]!==void 0,Qe=e=>e in $e||et.has(e),$e=Error(`check`),et=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:tt}=Object.prototype,nt=(e,t,n)=>{let{soft:r}=Ye(e,t,n);for(let n of Reflect.ownKeys(t))rt({error:e,props:t,propName:n,soft:r});return e},rt=({error:e,props:t,propName:n,soft:r})=>{Ze({error:e,props:t,propName:n,soft:r})||qe(e,n,t[n])},K=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},it=(e,t)=>{e.errors!==void 0&&K(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},at=({target:e,source:t,parent:n,child:r})=>{if(!q(e)){ot(e,t);return}q(t)&&K(e,`errors`,[...r.errors,...n.errors])},ot=(e,t)=>{t.errors!==void 0&&K(e,`errors`,t.errors)},q=e=>e.errors!==void 0&&e.errors.length!==0,st=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},ct=({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?lt({name:e,stack:t,newMessage:n,currentMessage:r}):dt(e,t,n),lt=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=ut(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},ut=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],dt=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},ft=(e,t,n)=>{let r=x(e),i=st(r,t,n);return Y(r,`message`,t),pt(r,t,i),r},pt=(e,t,n)=>{t===n||!mt()||Y(e,`stack`,ct(e,t,n))},mt=()=>{let{stack:e}=Error(J);return typeof e==`string`&&e.includes(J)},J=`set-error-message test message`,Y=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},X=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=x(e);return ft(r,Z(t,r.message),n)},Z=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:ht(n,r,e)},ht=(e,t,n)=>e.endsWith(gt)?n.endsWith(_t)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,gt=`:`,_t=`
2
2
  `,vt=({parent:e,child:t,target:n,stackError:r})=>{let i=e.message,a=r.message;return n.message=t.message,X(n,i,a)},yt=(e,t)=>Q(e)===t,Q=e=>typeof e==`object`&&e?e.stack:void 0,bt=({wrap:e,target:t,source:n,childHasStack:r})=>e===r?t:(K(t,`stack`,n.stack),n),xt=e=>{let{wrap:t,name:n}=e;return typeof t==`boolean`?(Object.hasOwn(e,`wrap`)&&delete e.wrap,t):n===`Error`},St=e=>$(e,[]).error,$=(e,t)=>{if(t.includes(e))return{};let n=n=>$(n,[...t,e]),r=Q(e),i=x(e,{shallow:!0}),a=yt(i,r);it(i,n);let{parent:o,childHasStack:s}=Ct(i,n);return{error:o,errorHasStack:a||s}},Ct=(e,t)=>{let n=xt(e);if(e.cause===void 0)return{parent:e,childHasStack:!1};let{error:r,errorHasStack:i}=t(e.cause);return delete e.cause,{parent:wt({parent:e,child:r,childHasStack:i,wrap:n}),childHasStack:i}},wt=({parent:e,child:t,childHasStack:n,wrap:r})=>{if(t===void 0)return e;let[i,a]=r?[t,e]:[e,t],o=bt({wrap:r,target:i,source:a,childHasStack:n}),s=vt({parent:e,child:t,target:je(i,i.constructor,o.name),stackError:o});return at({target:s,source:a,parent:e,child:t}),nt(s,a,{soft:!r})};export{X as n,St as t};
@@ -1,3 +1,3 @@
1
- import{stripVTControlCharacters as e}from"node:util";import t from"node:path";import n from"node:process";import{fileURLToPath as r}from"node:url";import i from"node:fs/promises";import{on as a,once as o}from"node:events";import{spawn as s}from"node:child_process";import{pipeline as c}from"node:stream/promises";import*as l from"node:readline/promises";const u=t=>({start:n.hrtime.bigint(),command:t.map(t=>d(e(t))).join(` `),state:{stdout:``,stderr:``,output:``,isIterating:{},nonIterable:[!1,!1]}}),d=e=>/[^\w./-]/.test(e)?`'${e.replaceAll(`'`,`'\\''`)}'`:e,f=({stdin:e,stdout:i,stderr:a,stdio:o=[e,i,a],env:s,preferLocal:c,cwd:l=`.`,...u})=>{let d=l instanceof URL?r(l):t.resolve(l),f=s?{...n.env,...s}:void 0,m=o[0]?.string;return{...u,input:m,stdio:m===void 0?o:[`pipe`,...o.slice(1)],env:c?p(f??n.env,d):f,cwd:d}},p=({Path:e=``,PATH:n=e,...r},i)=>{let a=n.split(t.delimiter),o=m([],t.resolve(i)).map(e=>t.join(e,`node_modules/.bin`)).filter(e=>!a.includes(e));return{...r,PATH:[...o,n].filter(Boolean).join(t.delimiter)}},m=(e,n)=>e.at(-1)===n?e:m([...e,n],t.resolve(n,`..`)),h=async(e,t,n)=>await g(e,n)?[w(e),t.map(e=>C(e)),{...n,shell:!0}]:[e,t,n],g=async(e,{shell:t,cwd:r,env:i=n.env})=>n.platform===`win32`&&!t&&!await _(e,r,i),_=(e,t,{Path:n=``,PATH:r=n})=>S.some(t=>e.toLowerCase().endsWith(t))||x(e,t,r),v={},y=e=>(...t)=>v[t.join(`\0`)]??=e(...t),b=y(i.access),x=y(async(e,n,r)=>{let i=r.split(t.delimiter).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{await Promise.any([n,...i].flatMap(n=>S.map(r=>b(`${t.resolve(n,e)}${r}`))))}catch{return!1}return!0}),S=[`.exe`,`.com`],C=e=>w(w(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),w=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),T=async(e,{input:t},n)=>{let r=await e;t!==void 0&&r.stdin.end(t);let i=o(r,`close`);try{return await Promise.race([i,...r.stdio.filter(Boolean).map(e=>E(e))]),D(n,j(r)),M(n)}catch(e){throw await Promise.allSettled([i]),O(e,r,n)}},E=async e=>{for await(let[t]of a(e,`error`))if(![`ERR_STREAM_PREMATURE_CLOSE`,`EPIPE`].includes(t?.code))throw t},D=({command:e},{exitCode:t,signalName:n})=>{if(n!==void 0)throw new A(`Command was terminated with ${n}: ${e}`);if(t!==void 0)throw new A(`Command failed with exit code ${t}: ${e}`)},O=(e,t,n)=>Object.assign(k(e,n),j(t),M(n)),k=(e,{command:t})=>e instanceof A?e:new A(`Command failed: ${t}`,{cause:e});var A=class extends Error{name=`SubprocessError`};const j=({exitCode:e,signalCode:t})=>({...e<1?{}:{exitCode:e},...t===null?{}:{signalName:t}}),M=({state:{stdout:e,stderr:t,output:r},command:i,start:a})=>({stdout:N(e),stderr:N(t),output:N(r),command:i,durationMs:Number(n.hrtime.bigint()-a)/1e6}),N=e=>e.at(-1)===`
2
- `?e.slice(0,e.at(-2)===`\r`?-2:-1):e,P=async(e,t,r,i)=>{try{[`node`,`node.exe`].includes(e.toLowerCase())&&(e=n.execPath,t=[...n.execArgv.filter(e=>!e.startsWith(`--inspect`)),...t]),[e,t,r]=await h(e,t,r),[e,t,r]=F(e,t,r);let a=s(e,t,r);return I(a.stdout,i,`stdout`),I(a.stderr,i,`stderr`),a.once(`error`,()=>{}),await o(a,`spawn`),a}catch(e){throw O(e,{},i)}},F=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n],I=(e,{state:t},n)=>{e&&(e.setEncoding(`utf8`),t.isIterating[n]||(t.isIterating[n]=!1,e.on(`data`,e=>{t[n]+=e,t.output+=e})))},L=async e=>{let[[t,n]]=await Promise.all([Promise.allSettled(e),R(e)]);if(n.reason)throw n.reason.pipedFrom=t.reason??t.value,n.reason;if(t.reason)throw t.reason;return{...n.value,pipedFrom:t.value}},R=async e=>{try{let[{stdout:t},{stdin:n}]=await Promise.all(e.map(({nodeChildProcess:e})=>e));if(n===null)throw Error(`The "stdin" option must be set on the first "spawn()" call in the pipeline.`);if(t===null)throw Error(`The "stdout" option must be set on the last "spawn()" call in the pipeline.`);c(t,n).catch(()=>{})}catch(t){throw await Promise.allSettled(e.map(({nodeChildProcess:e})=>z(e))),t}},z=async e=>{let{stdin:t}=await e;t.end()},B=async function*(e,{state:t},n,r){if(t.isIterating[n]===!1)throw Error(`The subprocess must be iterated right away, for example:
1
+ import e from"node:path";import t from"node:process";import{fileURLToPath as n}from"node:url";import{stripVTControlCharacters as r}from"node:util";import{spawn as i}from"node:child_process";import{on as a,once as o}from"node:events";import s from"node:fs/promises";import{pipeline as c}from"node:stream/promises";import*as l from"node:readline/promises";const u=e=>({start:t.hrtime.bigint(),command:e.map(e=>d(r(e))).join(` `),state:{stdout:``,stderr:``,output:``,isIterating:{},nonIterable:[!1,!1]}}),d=e=>/[^\w./-]/.test(e)?`'${e.replaceAll(`'`,`'\\''`)}'`:e,f=({stdin:r,stdout:i,stderr:a,stdio:o=[r,i,a],env:s,preferLocal:c,cwd:l=`.`,...u})=>{let d=l instanceof URL?n(l):e.resolve(l),f=s?{...t.env,...s}:void 0,m=o[0]?.string;return{...u,input:m,stdio:m===void 0?o:[`pipe`,...o.slice(1)],env:c?p(f??t.env,d):f,cwd:d}},p=({Path:t=``,PATH:n=t,...r},i)=>{let a=n.split(e.delimiter),o=m([],e.resolve(i)).map(t=>e.join(t,`node_modules/.bin`)).filter(e=>!a.includes(e));return{...r,PATH:[...o,n].filter(Boolean).join(e.delimiter)}},m=(t,n)=>t.at(-1)===n?t:m([...t,n],e.resolve(n,`..`)),h=async(e,t,n)=>await g(e,n)?[w(e),t.map(e=>C(e)),{...n,shell:!0}]:[e,t,n],g=async(e,{shell:n,cwd:r,env:i=t.env})=>t.platform===`win32`&&!n&&!await _(e,r,i),_=(e,t,{Path:n=``,PATH:r=n})=>S.some(t=>e.toLowerCase().endsWith(t))||x(e,t,r),v={},y=e=>(...t)=>v[t.join(`\0`)]??=e(...t),b=y(s.access),x=y(async(t,n,r)=>{let i=r.split(e.delimiter).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{await Promise.any([n,...i].flatMap(n=>S.map(r=>b(`${e.resolve(n,t)}${r}`))))}catch{return!1}return!0}),S=[`.exe`,`.com`],C=e=>w(w(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),w=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),T=async(e,{input:t},n)=>{let r=await e;t!==void 0&&r.stdin.end(t);let i=o(r,`close`);try{return await Promise.race([i,...r.stdio.filter(Boolean).map(e=>E(e))]),D(n,j(r)),M(n)}catch(e){throw await Promise.allSettled([i]),O(e,r,n)}},E=async e=>{for await(let[t]of a(e,`error`))if(![`ERR_STREAM_PREMATURE_CLOSE`,`EPIPE`].includes(t?.code))throw t},D=({command:e},{exitCode:t,signalName:n})=>{if(n!==void 0)throw new A(`Command was terminated with ${n}: ${e}`);if(t!==void 0)throw new A(`Command failed with exit code ${t}: ${e}`)},O=(e,t,n)=>Object.assign(k(e,n),j(t),M(n)),k=(e,{command:t})=>e instanceof A?e:new A(`Command failed: ${t}`,{cause:e});var A=class extends Error{name=`SubprocessError`};const j=({exitCode:e,signalCode:t})=>({...e<1?{}:{exitCode:e},...t===null?{}:{signalName:t}}),M=({state:{stdout:e,stderr:n,output:r},command:i,start:a})=>({stdout:N(e),stderr:N(n),output:N(r),command:i,durationMs:Number(t.hrtime.bigint()-a)/1e6}),N=e=>e.at(-1)===`
2
+ `?e.slice(0,e.at(-2)===`\r`?-2:-1):e,P=async(e,n,r,a)=>{try{[`node`,`node.exe`].includes(e.toLowerCase())&&(e=t.execPath,n=[...t.execArgv.filter(e=>!e.startsWith(`--inspect`)),...n]),[e,n,r]=await h(e,n,r),[e,n,r]=F(e,n,r);let s=i(e,n,r);return I(s.stdout,a,`stdout`),I(s.stderr,a,`stderr`),s.once(`error`,()=>{}),await o(s,`spawn`),s}catch(e){throw O(e,{},a)}},F=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n],I=(e,{state:t},n)=>{e&&(e.setEncoding(`utf8`),t.isIterating[n]||(t.isIterating[n]=!1,e.on(`data`,e=>{t[n]+=e,t.output+=e})))},L=async e=>{let[[t,n]]=await Promise.all([Promise.allSettled(e),R(e)]);if(n.reason)throw n.reason.pipedFrom=t.reason??t.value,n.reason;if(t.reason)throw t.reason;return{...n.value,pipedFrom:t.value}},R=async e=>{try{let[{stdout:t},{stdin:n}]=await Promise.all(e.map(({nodeChildProcess:e})=>e));if(n===null)throw Error(`The "stdin" option must be set on the first "spawn()" call in the pipeline.`);if(t===null)throw Error(`The "stdout" option must be set on the last "spawn()" call in the pipeline.`);c(t,n).catch(()=>{})}catch(t){throw await Promise.allSettled(e.map(({nodeChildProcess:e})=>z(e))),t}},z=async e=>{let{stdin:t}=await e;t.end()},B=async function*(e,{state:t},n,r){if(t.isIterating[n]===!1)throw Error(`The subprocess must be iterated right away, for example:
3
3
  for await (const line of spawn(...)) { ... }`);t.isIterating[n]=!0;try{let{[n]:i}=await e.nodeChildProcess;if(!i){t.nonIterable[r]=!0;let e=t.nonIterable.every(Boolean)?"either the option `stdout` or `stderr`":`the option \`${n}\``;throw TypeError(`The subprocess cannot be iterated unless ${e} is 'pipe'.`)}V(e),yield*l.createInterface({input:i})}finally{await e}},V=async e=>{try{await e}catch{}},H=async function*({state:e},...t){try{let n=[];for(;t.length>0;){n=t.map((t,r)=>n[r]??U(t,r,e));let[{value:r,done:i},a]=await Promise.race(n.map((e,t)=>Promise.all([e,t]))),[o]=t.splice(a,1);n.splice(a,1),i||(t.push(o),yield r)}}finally{await Promise.all(t.map(e=>e.return()))}},U=async(e,t,{nonIterable:n})=>{try{return await e.next()}catch(r){return W(n,t)?e.return():e.throw(r)}},W=(e,t)=>e.every(Boolean)?t!==e.length-1:e[t];function G(e,t,n,r){let[i=[],a={}]=Array.isArray(t)?[t,n]:[[],t],o=u([e,...i]),s=f(a),c=P(e,i,s,o),l=T(c,s,o);Object.assign(l,{nodeChildProcess:c}),l=r?L([r,l]):l;let d=B(l,o,`stdout`,0),p=B(l,o,`stderr`,1);return Object.assign(l,{nodeChildProcess:c,stdout:d,stderr:p,[Symbol.asyncIterator]:()=>H(o,d,p),pipe:(e,t,n)=>G(e,t,n,l)})}export{A as n,G as t};
@@ -0,0 +1 @@
1
+ const e=/^[A-Za-z]:\//;function t(t=``){return t&&t.replace(/\\/g,`/`).replace(e,e=>e.toUpperCase())}const n=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;function r(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const i=function(...e){e=e.map(e=>t(e));let n=``,i=!1;for(let t=e.length-1;t>=-1&&!i;t--){let a=t>=0?e[t]:r();!a||a.length===0||(n=`${a}/${n}`,i=o(a))}return n=a(n,!i),i&&!o(n)?`/${n}`:n.length>0?n:`.`};function a(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const o=function(e){return n.test(e)},s=function(e,n){let r=t(e).split(`/`),i=``;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){i=t;break}}return n&&i.endsWith(n)?i.slice(0,-n.length):i};globalThis.process?.platform;export{i as n,s as t};
@@ -1,2 +1,2 @@
1
- function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.every(t=>t(e));function i(...e){return t(a,e)}const a=(e,t)=>t.some(t=>t(e));function o(...e){return t(s,e)}function s(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function c(...e){return t(l,e)}const l=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function u(...e){return t(d,e)}const d=(e,t)=>[...e,...t];function f(e){return()=>e}const ee={done:!0,hasNext:!1},p={done:!1,hasNext:!1},m=()=>ee,h=e=>({hasNext:!0,next:e,done:!1});function g(e,...t){let n=e,r=t.map(e=>`lazy`in e?te(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ne(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(_(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function _(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=p,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(_(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function te(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ne(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function v(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return g(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>g(e,n),n)}throw Error(`Wrong number of arguments`)}function y(...e){return v(b,e)}function b(e){if(e.length===0)return h;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),p)}}function x(...e){return t(re,e)}const re=(e,t)=>e.length>=t,S={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function ie(e,t){let[n,...r]=t;if(!ae(n))return e(n,C(...r));let i=C(n,...r);return t=>e(t,i)}function C(e,t,...n){let r=typeof e==`function`?e:e[0],i=typeof e==`function`?`asc`:e[1],{[i]:a}=S,o=t===void 0?void 0:C(t,...n);return(e,t)=>{let n=r(e),i=r(t);return a(n,i)?1:a(i,n)?-1:o?.(e,t)??0}}function ae(e){if(w(e))return!0;if(typeof e!=`object`||!Array.isArray(e))return!1;let[t,n,...r]=e;return w(t)&&typeof n==`string`&&n in S&&r.length===0}const w=e=>typeof e==`function`&&e.length===1;function T(...e){return t(E,e)}function E(e,t){for(let[n,r]of e.entries())if(!t(r,n,e))return e.slice(n);return[]}function D(...e){return t(Object.entries,e)}function O(...e){return t(k,e,A)}const k=(e,t)=>e.filter(t),A=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:p,j=e=>Object.assign(e,{single:!0});function M(...e){return t(N,e,j(P))}const N=(e,t)=>e.find(t),P=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:p;function F(...e){return t(I,e)}const I=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function L(...e){return t(R,e,j(z))}const R=([e])=>e,z=()=>B,B=e=>({hasNext:!0,next:e,done:!0});function V(t,n){return typeof t==`object`?H(t,n):e(H,t===void 0?[]:[t],U)}const H=(e,t)=>t===void 0?e.flat():e.flat(t),U=e=>e===void 0||e===1?W:e<=0?h:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},W=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function G(...e){return t(K,e,q)}const K=(e,t)=>e.flatMap(t),q=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function J(...e){return t(oe,e,se)}function oe(e,t){return e.forEach(t),e}const se=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function ce(...e){return t(le,e)}function le(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const Y=Symbol(`funnel/voidReducer`),ue=()=>Y;function de(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=ue}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===Y?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function fe(...e){return t(pe,e)}const pe=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function me(...e){return t(he,e)}function he(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ge(...e){return t(X,e)}function X(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return _e(e,t);if(e instanceof Map)return ve(e,t);if(e instanceof Set)return ye(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!X(r,t[n]))return!1;return!0}function _e(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!X(r,t[n]))return!1;return!0}function ve(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!X(r,t.get(n)))return!1;return!0}function ye(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(X(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function be(){return xe}const xe=e=>e;function Se(...e){return t(Ce,e)}function Ce(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function we(e){return Array.isArray(e)}function Te(e){return typeof e==`boolean`}function Ee(e){return e!==void 0}function De(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function Oe(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}const ke=e=>typeof e==`function`;function Ae(e){return e!=null}function je(e){return t=>!e(t)}function Me(e){return e==null}function Ne(e){return typeof e==`number`&&!Number.isNaN(e)}function Pe(e){return e instanceof Promise}function Fe(...e){return t(Ie,e)}function Ie(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map)return Le(e,t);if(e instanceof Set&&t instanceof Set)return Re(e,t);let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.hasOwn(t,r))return!1;let{[r]:n}=e,{[r]:i}=t;if(n!==i||!Object.is(n,i))return!1}return!0}function Le(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(r!==e||!Object.is(r,e))return!1}return!0}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(e){return typeof e==`string`}function Be(e){return!!e}function Ve(...e){return t(Object.keys,e)}function He(...e){return t(Ue,e)}const Ue=e=>e.at(-1);function We(...e){return t(Ge,e,Ke)}const Ge=(e,t)=>e.map(t),Ke=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function qe(...e){return t(Je,e)}function Je(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Ye(...e){return t(Xe,e)}function Xe(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Ze(...e){return t(Qe,e)}function Qe(e,t){if(!x(t,1))return{...e};if(!x(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function $e(...e){return t(et,e)}function et(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function tt(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function nt(...e){return t(rt,e)}const rt=e=>e.length===1?e[0]:void 0;function it(...e){return t(at,e)}const at=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function ot(...e){return t(st,e)}function st(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ct(...e){return t(lt,e)}function lt(e,t){let n={};for(let[r,i]of Object.entries(e))t(i,r,e)&&(n[r]=i);return n}function ut(...e){return t=>g(t,...e)}function dt(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Z(n,e,...t):Z(e,...t)}function Z(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function ft(...e){return t(pt,e)}function pt(e,t,n){let r={};for(let[i,a]of e.entries()){let o=t(a,i,e);r[o]=n(a,i,e)}return r}function mt(e,t){let n=Math.ceil(e),r=Math.floor(t);if(r<n)throw RangeError(`randomInteger: The range [${e.toString()},${t.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}function ht(...e){return t(gt,e)}const gt=(e,t,n)=>e.reduce(t,n);function _t(...e){return t(vt,e)}function vt(e){return[...e].reverse()}function yt(...e){return t(bt,e)}function bt(e,t){let n=[...e];return n.sort(t),n}function xt(...e){return ie(St,e)}const St=(e,t)=>[...e].sort(t);function Ct(e,t,n){return typeof t==`number`||t===void 0?n=>n.split(e,t):e.split(t,n)}function wt(...e){return t(Tt,e,Et)}const Tt=(e,t)=>t<0?[]:e.slice(0,t);function Et(e){if(e<=0)return m;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function Dt(...e){return t(Q,e)}function Q(e,t){let n=[];for(let[r,i]of e.entries()){if(!t(i,r,e))break;n.push(i)}return n}function Ot(...e){return t(kt,e)}function kt(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
- .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function At(...e){return v(jt,e)}function jt(){let e=new Set;return t=>e.has(t)?p:(e.add(t),{done:!1,hasNext:!0,next:t})}function Mt(...e){return v(Nt,e)}function Nt(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?p:(n.add(a),{done:!1,hasNext:!0,next:e})}}function Pt(...e){return t(Object.values,e)}function Ft(...e){return e.length===2?(t,...n)=>$(t,...e,...n):$(...e)}const $=(e,t,n,...r)=>t(e,...r)?typeof n==`function`?n(e,...r):n.onTrue(e,...r):typeof n==`function`?e:n.onFalse(e,...r);function It(...e){return t(Lt,e,Rt)}const Lt=(e,t)=>e.length<t.length?e.map((e,n)=>[e,t[n]]):t.map((t,n)=>[e[n],t]),Rt=e=>(t,n)=>({hasNext:!0,next:[t,e[n]],done:n>=e.length-1});export{V as $,Be as A,De as B,$e as C,We as D,qe as E,Me as F,be as G,Te as H,je as I,fe as J,ge as K,Ae as L,Fe as M,Pe as N,He as O,Ne as P,G as Q,ke as R,tt as S,Ye as T,we as U,Ee as V,Se as W,ce as X,de as Y,J as Z,ut as _,At as a,T as at,it as b,wt as c,g as ct,yt as d,c as dt,L as et,_t as f,o as ft,dt as g,ft as h,t as ht,Mt as i,D as it,ze as j,Ve as k,Ct as l,f as lt,mt as m,n as mt,Ft as n,M as nt,Ot as o,x as ot,ht as p,i as pt,me as q,Pt as r,O as rt,Dt as s,y as st,It as t,F as tt,xt as u,u as ut,ct as v,Ze as w,nt as x,ot as y,Oe as z};
1
+ function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.every(t=>t(e));function i(...e){return t(a,e)}const a=(e,t)=>t.some(t=>t(e));function o(...e){return t(s,e)}function s(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function c(...e){return t(l,e)}const l=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function u(...e){return t(d,e)}const d=(e,t)=>[...e,...t];function f(e){return()=>e}const ee={done:!0,hasNext:!1},p={done:!1,hasNext:!1},m=()=>ee,h=e=>({hasNext:!0,next:e,done:!1});function g(e,...t){let n=e,r=t.map(e=>`lazy`in e?te(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ne(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(_(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function _(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=p,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(_(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function te(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ne(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function v(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return g(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>g(e,n),n)}throw Error(`Wrong number of arguments`)}function y(...e){return v(b,e)}function b(e){if(e.length===0)return h;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),p)}}function x(...e){return t(re,e)}const re=(e,t)=>e.length>=t,S={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function ie(e,t){let[n,...r]=t;if(!ae(n))return e(n,C(...r));let i=C(n,...r);return t=>e(t,i)}function C(e,t,...n){let r=typeof e==`function`?e:e[0],i=typeof e==`function`?`asc`:e[1],{[i]:a}=S,o=t===void 0?void 0:C(t,...n);return(e,t)=>{let n=r(e),i=r(t);return a(n,i)?1:a(i,n)?-1:o?.(e,t)??0}}function ae(e){if(w(e))return!0;if(typeof e!=`object`||!Array.isArray(e))return!1;let[t,n,...r]=e;return w(t)&&typeof n==`string`&&n in S&&r.length===0}const w=e=>typeof e==`function`&&e.length===1;function T(...e){return t(E,e)}function E(e,t){for(let[n,r]of e.entries())if(!t(r,n,e))return e.slice(n);return[]}function D(...e){return t(Object.entries,e)}function O(...e){return t(k,e,A)}const k=(e,t)=>e.filter(t),A=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:p,j=e=>Object.assign(e,{single:!0});function M(...e){return t(N,e,j(P))}const N=(e,t)=>e.find(t),P=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:p;function F(...e){return t(I,e)}const I=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function L(...e){return t(R,e,j(z))}const R=([e])=>e,z=()=>B,B=e=>({hasNext:!0,next:e,done:!0});function V(t,n){return typeof t==`object`?H(t,n):e(H,t===void 0?[]:[t],U)}const H=(e,t)=>t===void 0?e.flat():e.flat(t),U=e=>e===void 0||e===1?W:e<=0?h:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},W=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function G(...e){return t(K,e,q)}const K=(e,t)=>e.flatMap(t),q=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function J(...e){return t(oe,e,se)}function oe(e,t){return e.forEach(t),e}const se=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function ce(...e){return t(le,e)}function le(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const Y=Symbol(`funnel/voidReducer`),ue=()=>Y;function de(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=ue}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===Y?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function fe(...e){return t(pe,e)}const pe=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function me(...e){return t(he,e)}function he(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ge(...e){return t(X,e)}function X(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return _e(e,t);if(e instanceof Map)return ve(e,t);if(e instanceof Set)return ye(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!X(r,t[n]))return!1;return!0}function _e(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!X(r,t[n]))return!1;return!0}function ve(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!X(r,t.get(n)))return!1;return!0}function ye(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(X(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function be(){return xe}const xe=e=>e;function Se(...e){return t(Ce,e)}function Ce(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function we(e){return Array.isArray(e)}function Te(e){return typeof e==`boolean`}function Ee(e){return e!==void 0}function De(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function Oe(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}const ke=e=>typeof e==`function`;function Ae(e){return e!=null}function je(e){return t=>!e(t)}function Me(e){return e==null}function Ne(e){return typeof e==`number`&&!Number.isNaN(e)}function Pe(e){return e instanceof Promise}function Fe(...e){return t(Ie,e)}function Ie(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map)return Le(e,t);if(e instanceof Set&&t instanceof Set)return Re(e,t);let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.hasOwn(t,r))return!1;let{[r]:n}=e,{[r]:i}=t;if(n!==i||!Object.is(n,i))return!1}return!0}function Le(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(r!==e||!Object.is(r,e))return!1}return!0}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(e){return typeof e==`string`}function Be(e){return!!e}function Ve(...e){return t(Object.keys,e)}function He(...e){return t(Ue,e)}const Ue=e=>e.at(-1);function We(...e){return t(Ge,e,Ke)}const Ge=(e,t)=>e.map(t),Ke=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function qe(...e){return t(Je,e)}function Je(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Ye(...e){return t(Xe,e)}function Xe(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Ze(...e){return t(Qe,e)}function Qe(e,t){if(!x(t,1))return{...e};if(!x(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function $e(...e){return t(et,e)}function et(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function tt(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function nt(...e){return t(rt,e)}const rt=e=>e.length===1?e[0]:void 0;function it(...e){return t(at,e)}const at=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function ot(...e){return t(st,e)}function st(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ct(...e){return t(lt,e)}function lt(e,t){let n={};for(let[r,i]of Object.entries(e))t(i,r,e)&&(n[r]=i);return n}function ut(...e){return t=>g(t,...e)}function dt(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Z(n,e,...t):Z(e,...t)}function Z(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function ft(...e){return t(pt,e)}function pt(e,t,n){let r={};for(let[i,a]of e.entries()){let o=t(a,i,e);r[o]=n(a,i,e)}return r}function mt(e,t){let n=Math.ceil(e),r=Math.floor(t);if(r<n)throw RangeError(`randomInteger: The range [${e.toString()},${t.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}function ht(...e){return t(gt,e)}function gt(e){let t=[];for(let n=0;n<e;n++){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];t.push(e)}return t.join(``)}function _t(...e){return t(vt,e)}const vt=(e,t,n)=>e.reduce(t,n);function yt(...e){return t(bt,e)}function bt(e){return[...e].reverse()}function xt(...e){return t(St,e)}function St(e,t){let n=[...e];return n.sort(t),n}function Ct(...e){return ie(wt,e)}const wt=(e,t)=>[...e].sort(t);function Tt(e,t,n){return typeof t==`number`||t===void 0?n=>n.split(e,t):e.split(t,n)}function Et(...e){return t(Dt,e,Q)}const Dt=(e,t)=>t<0?[]:e.slice(0,t);function Q(e){if(e<=0)return m;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function Ot(...e){return t(kt,e)}function kt(e,t){let n=[];for(let[r,i]of e.entries()){if(!t(i,r,e))break;n.push(i)}return n}function At(...e){return t(jt,e)}function jt(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
+ .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function Mt(...e){return v(Nt,e)}function Nt(){let e=new Set;return t=>e.has(t)?p:(e.add(t),{done:!1,hasNext:!0,next:t})}function Pt(...e){return v(Ft,e)}function Ft(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?p:(n.add(a),{done:!1,hasNext:!0,next:e})}}function It(...e){return t(Object.values,e)}function Lt(...e){return e.length===2?(t,...n)=>$(t,...e,...n):$(...e)}const $=(e,t,n,...r)=>t(e,...r)?typeof n==`function`?n(e,...r):n.onTrue(e,...r):typeof n==`function`?e:n.onFalse(e,...r);function Rt(...e){return t(zt,e,Bt)}const zt=(e,t)=>e.length<t.length?e.map((e,n)=>[e,t[n]]):t.map((t,n)=>[e[n],t]),Bt=e=>(t,n)=>({hasNext:!0,next:[t,e[n]],done:n>=e.length-1});export{G as $,Ve as A,Oe as B,tt as C,qe as D,Ye as E,Ne as F,Se as G,Ee as H,Me as I,me as J,be as K,je as L,ze as M,Fe as N,We as O,Pe as P,J as Q,Ae as R,nt as S,Ze as T,Te as U,De as V,we as W,de as X,fe as Y,ce as Z,dt as _,Mt as a,D as at,ot as b,Et as c,y as ct,xt as d,u as dt,V as et,yt as f,c as ft,ft as g,t as gt,mt as h,n as ht,Pt as i,O as it,Be as j,He as k,Tt as l,g as lt,ht as m,i as mt,Lt as n,F as nt,At as o,T as ot,_t as p,o as pt,ge as q,It as r,M as rt,Ot as s,x as st,Rt as t,L as tt,Ct as u,f as ut,ut as v,$e as w,it as x,ct as y,ke as z};
@@ -0,0 +1 @@
1
+ var e={reset:[0,0],bold:[1,22,`\x1B[22m\x1B[1m`],dim:[2,22,`\x1B[22m\x1B[2m`],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function t(e){return String(e)}t.open=``,t.close=``;function n(){let e=typeof process<`u`?process:void 0,t=e?.env||{},n=t.FORCE_TTY!==`false`,r=e?.argv||[];return!(`NO_COLOR`in t||r.includes(`--no-color`))&&(`FORCE_COLOR`in t||r.includes(`--color`)||e?.platform===`win32`||n&&t.TERM!==`dumb`||`CI`in t)||typeof window<`u`&&!!window.chrome}function r(){let r=n(),i=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},a=(e,t,n=e)=>{let r=r=>{let a=String(r),o=a.indexOf(t,e.length);return~o?e+i(a,t,n,o)+t:e+a+t};return r.open=e,r.close=t,r},o={isColorSupported:r},s=e=>`\x1B[${e}m`;for(let n in e){let i=e[n];o[n]=r?a(s(i[0]),s(i[1]),i[2]):t}return o}var i=r();export{i as t};
@@ -1 +1 @@
1
- import{s as e}from"../rolldown-runtime.mjs";import{t}from"./is-plain-obj.mjs";import"./devlop.mjs";import{n}from"./mdast-util-from-markdown.mjs";import{t as r}from"./bail.mjs";import{t as i}from"./extend.mjs";import{t as a}from"./trough.mjs";import o from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";var l=class extends Error{constructor(e,t,r){super(),typeof t==`string`&&(r=t,t=void 0);let i=``,a={},o=!1;if(t&&(a=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=n(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};l.prototype.file=``,l.prototype.name=``,l.prototype.reason=``,l.prototype.message=``,l.prototype.stack=``,l.prototype.column=void 0,l.prototype.line=void 0,l.prototype.ancestors=void 0,l.prototype.cause=void 0,l.prototype.fatal=void 0,l.prototype.place=void 0,l.prototype.ruleId=void 0,l.prototype.source=void 0;function u(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}const d=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var f=class{constructor(e){let t;t=e?u(e)?{path:e}:typeof e==`string`||g(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:s.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<d.length;){let e=d[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)d.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?o.basename(this.path):void 0}set basename(e){m(e,`basename`),p(e,`basename`),this.path=o.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?o.dirname(this.path):void 0}set dirname(e){h(this.basename,`dirname`),this.path=o.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?o.extname(this.path):void 0}set extname(e){if(p(e,`extname`),h(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=o.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){u(e)&&(e=c(e)),m(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?o.basename(this.path,this.extname):void 0}set stem(e){m(e,`stem`),p(e,`stem`),this.path=o.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new l(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function p(e,t){if(e&&e.includes(o.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+o.sep+"`")}function m(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function h(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function g(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const _=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var v=e(i(),1);const y={}.hasOwnProperty,b=new class e extends _{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,v.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(C(`data`,this.frozen),this.namespace[e]=t,this):y.call(this.namespace,e)&&this.namespace[e]||void 0:e?(C(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=E(e),n=this.parser||this.Parser;return x(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),x(`process`,this.parser||this.Parser),S(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=E(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);O(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),x(`processSync`,this.parser||this.Parser),S(`processSync`,this.compiler||this.Compiler),this.process(e,i),T(`processSync`,`process`,t),n;function i(e,i){t=!0,r(e),n=i}}run(e,t,n){w(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=E(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,i;return this.run(e,t,a),T(`runSync`,`run`,n),i;function a(e,t){r(e),i=t,n=!0}}stringify(e,t){this.freeze();let n=E(t),r=this.compiler||this.Compiler;return S(`stringify`,r),w(e),r(e,n)}use(e,...n){let r=this.attachers,i=this.namespace;if(C(`use`,this.frozen),e!=null)if(typeof e==`function`)c(e,n);else if(typeof e==`object`)Array.isArray(e)?s(e):o(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)c(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;c(t,n)}else o(e);else throw TypeError("Expected usable value, not `"+e+"`")}function o(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(i.settings=(0,v.default)(!0,i.settings,e.settings))}function s(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function c(e,n){let i=-1,a=-1;for(;++i<r.length;)if(r[i][0]===e){a=i;break}if(a===-1)r.push([e,...n]);else if(n.length>0){let[i,...o]=n,s=r[a][1];t(s)&&t(i)&&(i=(0,v.default)(!0,s,i)),r[a]=[e,i,...o]}}}}().freeze();function x(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function S(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function C(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w(e){if(!t(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function T(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function E(e){return D(e)?e:new f(e)}function D(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function O(e){return typeof e==`string`||k(e)}function k(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{b as t};
1
+ import{s as e}from"../rolldown-runtime.mjs";import"./devlop.mjs";import{n as t}from"./mdast-util-from-markdown.mjs";import{t as n}from"./bail.mjs";import{t as r}from"./extend.mjs";import{t as i}from"./is-plain-obj.mjs";import{t as a}from"./trough.mjs";import o from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";var l=class extends Error{constructor(e,n,r){super(),typeof n==`string`&&(r=n,n=void 0);let i=``,a={},o=!1;if(n&&(a=`line`in n&&`column`in n||`start`in n&&`end`in n?{place:n}:`type`in n?{ancestors:[n],place:n.position}:{...n}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=t(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};l.prototype.file=``,l.prototype.name=``,l.prototype.reason=``,l.prototype.message=``,l.prototype.stack=``,l.prototype.column=void 0,l.prototype.line=void 0,l.prototype.ancestors=void 0,l.prototype.cause=void 0,l.prototype.fatal=void 0,l.prototype.place=void 0,l.prototype.ruleId=void 0,l.prototype.source=void 0;function u(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}const d=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var f=class{constructor(e){let t;t=e?u(e)?{path:e}:typeof e==`string`||g(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:s.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<d.length;){let e=d[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)d.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?o.basename(this.path):void 0}set basename(e){m(e,`basename`),p(e,`basename`),this.path=o.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?o.dirname(this.path):void 0}set dirname(e){h(this.basename,`dirname`),this.path=o.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?o.extname(this.path):void 0}set extname(e){if(p(e,`extname`),h(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=o.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){u(e)&&(e=c(e)),m(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?o.basename(this.path,this.extname):void 0}set stem(e){m(e,`stem`),p(e,`stem`),this.path=o.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new l(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function p(e,t){if(e&&e.includes(o.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+o.sep+"`")}function m(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function h(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function g(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const _=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var v=e(r(),1);const y={}.hasOwnProperty,b=new class e extends _{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,v.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(C(`data`,this.frozen),this.namespace[e]=t,this):y.call(this.namespace,e)&&this.namespace[e]||void 0:e?(C(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=E(e),n=this.parser||this.Parser;return x(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),x(`process`,this.parser||this.Parser),S(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=E(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);O(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,r;return this.freeze(),x(`processSync`,this.parser||this.Parser),S(`processSync`,this.compiler||this.Compiler),this.process(e,i),T(`processSync`,`process`,t),r;function i(e,i){t=!0,n(e),r=i}}run(e,t,n){w(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=E(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let r=!1,i;return this.run(e,t,a),T(`runSync`,`run`,r),i;function a(e,t){n(e),i=t,r=!0}}stringify(e,t){this.freeze();let n=E(t),r=this.compiler||this.Compiler;return S(`stringify`,r),w(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(C(`use`,this.frozen),e!=null)if(typeof e==`function`)c(e,t);else if(typeof e==`object`)Array.isArray(e)?s(e):o(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)c(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;c(t,n)}else o(e);else throw TypeError("Expected usable value, not `"+e+"`")}function o(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,v.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function c(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(a===-1)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[a][1];i(s)&&i(r)&&(r=(0,v.default)(!0,s,r)),n[a]=[e,r,...o]}}}}().freeze();function x(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function S(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function C(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w(e){if(!i(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function T(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function E(e){return D(e)?e:new f(e)}function D(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function O(e){return typeof e==`string`||k(e)}function k(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{b as t};