@nice-move/cli 0.11.23 → 0.11.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-CYNyJ7h0.mjs +1 -0
- package/dist/cli-truncate-CxV18zNu.mjs +1 -0
- package/dist/cli.mjs +1 -2
- package/dist/cmd/git.mjs +1 -1
- package/dist/cmd/lint.mjs +1 -1
- package/dist/git-hooks-B0PSoENV.mjs +34 -0
- package/dist/lib-C-lgpykG.mjs +39 -0
- package/dist/lib-fG5EuqQx.mjs +2 -0
- package/dist/lint-Bg_BaD9i.mjs +1 -0
- package/dist/lint-D3-IJwiQ.mjs +6 -0
- package/dist/log-update-DcLbjgOc.mjs +5 -0
- package/dist/mjs-D7OvYRUm.mjs +1 -0
- package/dist/path-key-DNlqev5T.mjs +1 -0
- package/dist/source-Bmnmnmig.mjs +5 -0
- package/dist/string-width-VW94rQAG.mjs +1 -0
- package/dist/wrap-ansi-CH_XUBTM.mjs +8 -0
- package/dist/wrap-ansi-Zgn4s05l.mjs +1 -0
- package/package.json +2 -2
- package/dist/127.mjs +0 -1
- package/dist/145.mjs +0 -1
- package/dist/216.mjs +0 -1
- package/dist/652.mjs +0 -1
- package/dist/753.mjs +0 -1
- package/dist/782.mjs +0 -1
- package/dist/788.mjs +0 -1
- package/dist/799.mjs +0 -1
- package/dist/runtime.mjs +0 -1
- package/dist/vendor.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=e(import.meta.url);export{s as __commonJSMin,c as __export,d as __require,u as __toESM};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ansi_styles_default as e,stringWidth as t}from"./string-width-VW94rQAG.mjs";function n(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}const r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]$/,i=[`\x1B`,``],a=e=>`${i[0]}[${e}m`,o=(t,n,r)=>{let i=[];t=[...t];for(let r of t){let o=r;r.includes(`;`)&&(r=r.split(`;`)[0][0]+`0`);let s=e.codes.get(Number.parseInt(r,10));if(s){let e=t.indexOf(s.toString());e===-1?i.push(a(n?s:o)):t.splice(e,1)}else if(n){i.push(a(0));break}else i.push(a(o))}if(n&&(i=i.filter((e,t)=>i.indexOf(e)===t),r!==void 0)){let t=a(e.codes.get(Number.parseInt(r,10)));i=i.reduce((e,n)=>n===t?[n,...e]:[...e,n],[])}return i.join(``)};function s(e,t,a){let s=[...e],c=[],l=typeof a==`number`?a:s.length,u=!1,d,f=0,p=``;for(let[m,h]of s.entries()){let s=!1;if(i.includes(h)){let t=/\d[^m]*/.exec(e.slice(m,m+18));d=t&&t.length>0?t[0]:void 0,f<l&&(u=!0,d!==void 0&&c.push(d))}else u&&h===`m`&&(u=!1,s=!0);if(!u&&!s&&f++,!r.test(h)&&n(h.codePointAt())&&(f++,typeof a!=`number`&&l++),f>t&&f<=l)p+=h;else if(f===t&&!u&&d!==void 0)p=o(c);else if(f>=l){p+=o(c,!0,d);break}}return p}function c(e,t,n){if(e.charAt(t)===` `)return t;let r=n?1:-1;for(let n=0;n<=3;n++){let i=t+n*r;if(e.charAt(i)===` `)return i}return t}function l(e,n,r={}){let{position:i=`end`,space:a=!1,preferTruncationOnSpace:o=!1}=r,{truncationCharacter:l=`…`}=r;if(typeof e!=`string`)throw TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof n!=`number`)throw TypeError(`Expected \`columns\` to be a number, got ${typeof n}`);if(n<1)return``;if(n===1)return l;let u=t(e);if(u<=n)return e;if(i===`start`){if(o){let t=c(e,u-n+1,!0);return l+s(e,t,u).trim()}return a===!0&&(l+=` `),l+s(e,u-n+t(l),u)}if(i===`middle`){a===!0&&(l=` ${l} `);let r=Math.floor(n/2);if(o){let t=c(e,r),i=c(e,u-(n-r)+1,!0);return s(e,0,t)+l+s(e,i,u).trim()}return s(e,0,r)+l+s(e,u-(n-r)+t(l),u)}if(i===`end`){if(o){let t=c(e,n-1);return s(e,0,t)+l}return a===!0&&(l=` ${l}`),s(e,0,n-t(l))+l}throw Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${i}`)}export{l as default};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import*as o from"cheetor";import{createRequire as e}from"node:module";export const __webpack_id__=27;export const __webpack_ids__=[27];export const __webpack_modules__={7642:(r,t,m)=>{const s=(n={Cheetor:()=>o.Cheetor},c={},m.d(c,n),c);var n,c,a=m(3938);const i=e(import.meta.url)("node:module");var p=m(3208),d=m(9948),g=m(9767);process.on("SIGINT",(()=>{})),new s.Cheetor("../package.json",import.meta.url).website("https://www.npmjs.com/org/nice-move").command(g).command(a).commandSmart((function(){if((0,d.kj)("svgo/package.json")&&(0,d.kj)("svgo-config/package.json"))return{command:"svgo",describe:"Run `svgo` to optimize `*.svg`",handler({_:[o,e="./"]}){const r=(0,i.createRequire)(import.meta.url);(0,p.Ho)("svgo",["-r","-q","--pretty","--indent","2","--config",r.resolve("svgo-config"),"-f",e]).then((()=>{console.log("Done: calling svgo")})).catch((o=>{process.exitCode=1,console.error("Error:",o.message)}))}}})).setup()}};import r from"./runtime.mjs";import*as t from"./cli.mjs";r.C(t);import*as m from"./vendor.mjs";r.C(m);import*as s from"./cmd/lint.mjs";r.C(s);import*as n from"./cmd/git.mjs";r.C(n),r(r.s=7642);
|
|
1
|
+
import{execa as e,git_hooks_exports as t}from"./git-hooks-B0PSoENV.mjs";import"./path-key-DNlqev5T.mjs";import"./mjs-D7OvYRUm.mjs";import{isReachable as n,lint_exports as r}from"./lint-Bg_BaD9i.mjs";import{createRequire as i}from"node:module";import{Cheetor as a}from"cheetor";function o(){if(n(`svgo/package.json`)&&n(`svgo-config/package.json`))return{command:`svgo`,describe:"Run `svgo` to optimize `*.svg`",handler({_:[t,n=`./`]}){let r=i(import.meta.url);e(`svgo`,[`-r`,`-q`,`--pretty`,`--indent`,`2`,`--config`,r.resolve(`svgo-config`),`-f`,n]).then(()=>{console.log(`Done: calling svgo`)}).catch(e=>{process.exitCode=1,console.error(`Error:`,e.message)})}}}process.on(`SIGINT`,()=>{}),new a(`../package.json`,import.meta.url).website(`https://www.npmjs.com/org/nice-move`).command(r).command(t).commandSmart(o).setup();
|
package/dist/cmd/git.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{builder$1 as e,command$1 as t,description$1 as n}from"../git-hooks-B0PSoENV.mjs";import"../path-key-DNlqev5T.mjs";import"../mjs-D7OvYRUm.mjs";export{e as builder,t as command,n as description};
|
package/dist/cmd/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{builder as e,command as t,description as n}from"../lint-Bg_BaD9i.mjs";export{e as builder,t as command,n as description};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{__export as e,__toESM as t}from"./chunk-CYNyJ7h0.mjs";import{pathKey as n,require_cross_spawn as r}from"./path-key-DNlqev5T.mjs";import{onExit as i}from"./mjs-D7OvYRUm.mjs";import{fileURLToPath as a}from"node:url";import{ChildProcess as o,execFile as s,spawn as c,spawnSync as l}from"node:child_process";import{StringDecoder as u}from"node:string_decoder";import{aborted as d,callbackify as f,debuglog as p,inspect as m,promisify as h,stripVTControlCharacters as g}from"node:util";import _,{execArgv as v,execPath as y,hrtime as b,platform as x}from"node:process";import S from"node:tty";import C from"node:path";import{scheduler as w,setImmediate as ee,setTimeout as te}from"node:timers/promises";import{constants as T}from"node:os";import{EventEmitter as ne,addAbortListener as re,on as ie,once as E,setMaxListeners as ae}from"node:events";import{serialize as oe}from"node:v8";import{appendFileSync as se,createReadStream as ce,createWriteStream as le,readFileSync as ue,statSync as de,writeFileSync as fe}from"node:fs";import{finished as D}from"node:stream/promises";import{Duplex as pe,PassThrough as me,Readable as O,Transform as he,Writable as ge,getDefaultHighWaterMark as _e}from"node:stream";import{Buffer as ve}from"node:buffer";function k(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const ye=(e,t)=>{let n=Se(be(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},be=e=>xe(e)?e.toString():e,xe=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,Se=e=>e instanceof URL?a(e):e,Ce=(e,t=[],n={})=>{let r=ye(e,`First argument`),[i,a]=k(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!k(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]},{toString:we}=Object.prototype,Te=e=>we.call(e)===`[object ArrayBuffer]`,A=e=>we.call(e)===`[object Uint8Array]`,j=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ee=new TextEncoder,De=e=>Ee.encode(e),Oe=new TextDecoder,ke=e=>Oe.decode(e),Ae=(e,t)=>{let n=je(e,t);return n.join(``)},je=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new u(t),r=e.map(e=>typeof e==`string`?De(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},Me=e=>e.length===1&&A(e[0])?e[0]:Pe(Ne(e)),Ne=e=>e.map(e=>typeof e==`string`?De(e):e),Pe=e=>{let t=new Uint8Array(Fe(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},Fe=e=>{let t=0;for(let n of e)t+=n.length;return t},Ie=e=>Array.isArray(e)&&Array.isArray(e.raw),Le=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Re({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},Re=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ze(i,e.raw[r]),c=He(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>Ue(e)):[Ue(l)];return He(c,u,s)},ze=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=Be.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(Be.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
|
|
2
|
+
`?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=Ve[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},Be=new Set([` `,` `,`\r`,`
|
|
3
|
+
`]),Ve={x:3,u:5},He=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Ue=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(k(e)&&(`stdout`in e||`isMaxBuffer`in e))return We(e);throw e instanceof o||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},We=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return ke(e);throw e===void 0?TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):TypeError(`Unexpected "${typeof e}" stdout in template expression`)},M=e=>Ge.includes(e),Ge=[_.stdin,_.stdout,_.stderr],N=[`stdin`,`stdout`,`stderr`],Ke=e=>N[e]??`stdio[${e}]`,qe=e=>{let t={...e};for(let n of ot)t[n]=Je(e,n);return t},Je=(e,t)=>{let n=Array.from({length:Ye(e)+1}),r=Xe(e[t],n,t);return rt(r,t)},Ye=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,Xe=(e,t,n)=>k(e)?Ze(e,t,n):t.fill(e),Ze=(e,t,n)=>{for(let r of Object.keys(e).sort(Qe))for(let i of et(r,n,t))t[i]=e[r];return t},Qe=(e,t)=>$e(e)<$e(t)?1:-1,$e=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=tt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
|
|
4
|
+
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
5
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},tt=e=>{if(e===`all`)return e;if(N.includes(e))return N.indexOf(e);let t=nt.exec(e);if(t!==null)return Number(t[1])},nt=/^fd(\d+)$/,rt=(e,t)=>e.map(e=>e===void 0?at[t]:e),it=p(`execa`).enabled?`full`:`none`,at={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:it,stripFinalNewline:!0},ot=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],P=(e,t)=>t===`ipc`?e.at(-1):e[t],st=({verbose:e},t)=>ut(e,t)!==`none`,ct=({verbose:e},t)=>![`none`,`short`].includes(ut(e,t)),lt=({verbose:e},t)=>{let n=ut(e,t);return ft(n)?n:void 0},ut=(e,t)=>t===void 0?dt(e):P(e,t),dt=e=>e.find(e=>ft(e))??pt.findLast(t=>e.includes(t)),ft=e=>typeof e==`function`,pt=[`none`,`short`,`full`],mt=(e,t)=>{let n=[e,...t],r=n.join(` `),i=n.map(e=>St(gt(e))).join(` `);return{command:r,escapedCommand:i}},ht=e=>g(e).split(`
|
|
6
|
+
`).map(e=>gt(e)).join(`
|
|
7
|
+
`),gt=e=>e.replaceAll(yt,e=>_t(e)),_t=e=>{let t=bt[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=xt?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},vt=()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},yt=vt(),bt={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},xt=65535,St=e=>Ct.test(e)?e:x===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,Ct=/^[\w./-]+$/;function wt(){let{env:e}=_,{TERM:t,TERM_PROGRAM:n}=e;return _.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const Tt={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},Et={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Dt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ot={...Tt,...Et},kt={...Tt,...Dt},At=wt(),jt=At?Ot:kt;var Mt=jt;const Nt=Object.entries(Et),Pt=S?.WriteStream?.prototype?.hasColors?.()??!1,F=(e,t)=>{if(!Pt)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let t=e+``,i=t.indexOf(r);if(i===-1)return n+t+r;let a=n,o=0;for(;i!==-1;)a+=t.slice(o,i)+n,o=i+r.length,i=t.indexOf(r,o);return a+=t.slice(o)+r,a}},Ft=F(0,0),It=F(1,22),Lt=F(2,22),Rt=F(3,23),zt=F(4,24),Bt=F(53,55),Vt=F(7,27),Ht=F(8,28),Ut=F(9,29),Wt=F(30,39),Gt=F(31,39),Kt=F(32,39),qt=F(33,39),Jt=F(34,39),Yt=F(35,39),Xt=F(36,39),Zt=F(37,39),Qt=F(90,39),$t=F(40,49),en=F(41,49),tn=F(42,49),nn=F(43,49),rn=F(44,49),an=F(45,49),on=F(46,49),sn=F(47,49),cn=F(100,49),ln=F(91,39),un=F(92,39),dn=F(93,39),fn=F(94,39),pn=F(95,39),mn=F(96,39),hn=F(97,39),gn=F(101,49),_n=F(102,49),vn=F(103,49),yn=F(104,49),bn=F(105,49),xn=F(106,49),Sn=F(107,49),Cn=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=wn(n),c=Dn[e]({failed:a,reject:o,piped:r}),l=kn[e]({reject:o});return`${Qt(`[${s}]`)} ${Qt(`[${i}]`)} ${l(c)} ${l(t)}`},wn=e=>`${Tn(e.getHours(),2)}:${Tn(e.getMinutes(),2)}:${Tn(e.getSeconds(),2)}.${Tn(e.getMilliseconds(),3)}`,Tn=(e,t)=>String(e).padStart(t,`0`),En=({failed:e,reject:t})=>e?t?Mt.cross:Mt.warning:Mt.tick,Dn={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:En,duration:En},On=e=>e,kn={command:()=>It,output:()=>On,ipc:()=>On,error:({reject:e})=>e?ln:dn,duration:()=>Qt},An=(e,t,n)=>{let r=lt(t,n);return e.map(({verboseLine:e,verboseObject:t})=>jn(e,t,r)).filter(e=>e!==void 0).map(e=>Mn(e)).join(``)},jn=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},Mn=e=>e.endsWith(`
|
|
8
|
+
`)?e:`${e}\n`,Nn=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=Pn({type:e,result:i,verboseInfo:r}),o=Fn(t,a),s=An(o,r,n);s!==``&&console.warn(s.slice(0,-1))},Pn=({type:e,result:t,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...a}}})=>({type:e,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:t,options:a}),Fn=(e,t)=>e.split(`
|
|
9
|
+
`).map(e=>In({...t,message:e})),In=e=>{let t=Cn(e);return{verboseLine:t,verboseObject:e}},Ln=e=>{let t=typeof e==`string`?e:m(e),n=ht(t);return n.replaceAll(` `,` `.repeat(Rn))},Rn=2,zn=(e,t)=>{st(t)&&Nn({type:`command`,verboseMessage:e,verboseInfo:t})},Bn=(e,t,n)=>{Un(e);let r=Vn(e);return{verbose:e,escapedCommand:t,commandId:r,rawOptions:n}},Vn=e=>st({verbose:e})?Hn++:void 0;let Hn=0n;const Un=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!pt.includes(t)&&!ft(t)){let e=pt.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},Wn=()=>b.bigint(),Gn=e=>Number(b.bigint()-e)/1e6,Kn=(e,t,n)=>{let r=Wn(),{command:i,escapedCommand:a}=mt(e,t),o=Je(n,`verbose`),s=Bn(o,a,{...n});return zn(a,s),{command:i,escapedCommand:a,startTime:r,verboseInfo:s}},qn=h(s);function Jn(e){return e instanceof URL?a(e):e}function Yn(e){return{*[Symbol.iterator](){let t=C.resolve(Jn(e)),n;for(;n!==t;)yield t,n=t,t=C.resolve(t,`..`)}}}const Xn=10*1024*1024,Zn=({cwd:e=_.cwd(),path:t=_.env[n()],preferLocal:r=!0,execPath:i=_.execPath,addExecPath:a=!0}={})=>{let o=C.resolve(Jn(e)),s=[],c=t.split(C.delimiter);return r&&Qn(s,c,o),a&&$n(s,c,i,o),t===``||t===C.delimiter?`${s.join(C.delimiter)}${t}`:[...s,t].join(C.delimiter)},Qn=(e,t,n)=>{for(let r of Yn(n)){let n=C.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},$n=(e,t,n,r)=>{let i=C.resolve(r,Jn(n),`..`);t.includes(i)||e.push(i)},er=({env:e=_.env,...t}={})=>{e={...e};let r=n({env:e});return t.path=e[r],e[r]=Zn(t),e},tr=(e,t,n)=>{let r=n?sr:or,i=e instanceof I?{}:{cause:e};return new r(t,i)};var I=class extends Error{};const nr=(e,t)=>{Object.defineProperty(e.prototype,`name`,{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,ir,{value:!0,writable:!1,enumerable:!1,configurable:!1})},rr=e=>ar(e)&&ir in e,ir=Symbol(`isExecaError`),ar=e=>Object.prototype.toString.call(e)===`[object Error]`;var or=class extends Error{};nr(or,or.name);var sr=class extends Error{};nr(sr,sr.name);const cr=()=>{let e=dr-ur+1;return Array.from({length:e},lr)},lr=(e,t)=>({name:`SIGRT${t+1}`,number:ur+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),ur=34,dr=64,fr=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}],pr=()=>{let e=cr(),t=[...fr,...e].map(mr);return t},mr=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=T,s=o!==void 0,c=s?o:t;return{name:e,number:c,description:n,supported:s,action:r,forced:i,standard:a}},hr=()=>{let e=pr();return Object.fromEntries(e.map(gr))},gr=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],_r=hr(),vr=()=>{let e=pr(),t=dr+1,n=Array.from({length:t},(t,n)=>yr(n,e));return Object.assign({},...n)},yr=(e,t)=>{let n=br(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},br=(e,t)=>{let n=t.find(({name:t})=>T.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n},xr=vr(),Sr=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return wr(e,t)},Cr=e=>e===0?e:wr(e,"`subprocess.kill()`'s argument"),wr=(e,t)=>{if(Number.isInteger(e))return Tr(e,t);if(typeof e==`string`)return Or(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${kr()}`)},Tr=(e,t)=>{if(Dr.has(e))return Dr.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${kr()}`)},Er=()=>new Map(Object.entries(T.signals).reverse().map(([e,t])=>[t,e])),Dr=Er(),Or=(e,t)=>{if(e in T.signals)return e;throw e.toUpperCase()in T.signals?TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):TypeError(`Invalid ${t} '${e}': this signal name does not exist.\n${kr()}`)},kr=()=>`Available signal names: ${Ar()}.
|
|
10
|
+
Available signal numbers: ${jr()}.`,Ar=()=>Object.keys(T.signals).sort().map(e=>`'${e}'`).join(`, `),jr=()=>[...new Set(Object.values(T.signals).sort((e,t)=>e-t))].join(`, `),Mr=e=>_r[e].description,Nr=e=>{if(e===!1)return e;if(e===!0)return Pr;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Pr=1e3*5,Fr=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Ir(o,s,n);Lr(l,r);let u=e(c);return Rr({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Ir=(e,t,n)=>{let[r=n,i]=ar(e)?[void 0,e]:[e,t];if(typeof r!=`string`&&!Number.isInteger(r))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!ar(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Cr(r),error:i}},Lr=(e,t)=>{e!==void 0&&t.reject(e)},Rr=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&zr({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},zr=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await te(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},Br=async(e,t)=>{e.aborted||await E(e,`abort`,{signal:t})},Vr=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Hr=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[Ur(e,t,r,i)],Ur=async(e,t,n,{signal:r})=>{throw await Br(t,r),n.terminationReason??=`cancel`,e.kill(),t.reason},Wr=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{Gr(e,t,n),Kr(e,t,r)},Gr=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},Kr=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} cannot be used: the ${R(t)} has already exited or disconnected.`)},qr=e=>{throw Error(`${L(`getOneMessage`,e)} could not complete: the ${R(e)} exited or disconnected.`)},Jr=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is sending a message too, instead of listening to incoming messages.
|
|
11
|
+
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
12
|
+
|
|
13
|
+
const [receivedMessage] = await Promise.all([
|
|
14
|
+
${L(`getOneMessage`,e)},
|
|
15
|
+
${L(`sendMessage`,e,`message, {strict: true}`)},
|
|
16
|
+
]);`)},Yr=(e,t)=>Error(`${L(`sendMessage`,t)} failed when sending an acknowledgment response to the ${R(t)}.`,{cause:e}),Xr=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is not listening to incoming messages.`)},Zr=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} exited without listening to incoming messages.`)},Qr=()=>Error(`\`cancelSignal\` aborted: the ${R(!0)} disconnected.`),$r=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},ei=({error:e,methodName:t,isSubprocess:n})=>{if(e.code===`EPIPE`)throw Error(`${L(t,n)} cannot be used: the ${R(n)} is disconnecting.`,{cause:e})},ti=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(ni(e))throw Error(`${L(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},ni=({code:e,message:t})=>ri.has(e)||ii.some(e=>t.includes(e)),ri=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),ii=[`could not be cloned`,`circular structure`,`call stack size exceeded`],L=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${ai(t)}${e}(${n})`,ai=e=>e?``:`subprocess.`,R=e=>e?`parent process`:`subprocess`,oi=e=>{e.connected&&e.disconnect()},z=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)},si=(e,t=`stdin`)=>{let n=!0,{options:r,fileDescriptors:i}=B.get(e),a=li(i,t,n),o=e.stdio[a];if(o===null)throw TypeError(fi(a,t,r,n));return o},ci=(e,t=`stdout`)=>{let n=!1,{options:r,fileDescriptors:i}=B.get(e),a=li(i,t,n),o=a===`all`?e.all:e.stdio[a];if(o==null)throw TypeError(fi(a,t,r,n));return o},B=new WeakMap,li=(e,t,n)=>{let r=ui(t,n);return di(r,t,n,e),r},ui=(e,t)=>{let n=tt(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${hi(t)}" must not be "${e}".
|
|
17
|
+
It must be ${r} or "fd3", "fd4" (and so on).
|
|
18
|
+
It is optional and defaults to "${i}".`)},di=(e,t,n,r)=>{let i=r[mi(e)];if(i===void 0)throw TypeError(`"${hi(n)}" must not be ${t}. That file descriptor does not exist.
|
|
19
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction===`input`&&!n)throw TypeError(`"${hi(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${hi(n)}" must not be ${t}. It must be a writable stream, not readable.`)},fi=(e,t,n,r)=>{if(e===`all`&&!n.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:a}=pi(e,n);return`The "${i}: ${gi(a)}" option is incompatible with using "${hi(r)}: ${gi(t)}".
|
|
20
|
+
Please set this option with "pipe" instead.`},pi=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=mi(e);return a===0&&t!==void 0?{optionName:`stdin`,optionValue:t}:a===1&&n!==void 0?{optionName:`stdout`,optionValue:n}:a===2&&r!==void 0?{optionName:`stderr`,optionValue:r}:{optionName:`stdio[${a}]`,optionValue:i[a]}},mi=e=>e===`all`?1:e,hi=e=>e?`to`:`from`,gi=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,_i=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),re(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},vi=(e,t)=>{t&&yi(e)},yi=e=>{e.refCounted()},bi=(e,t)=>{t&&xi(e)},xi=e=>{e.unrefCounted()},Si=(e,t)=>{t&&(xi(e),xi(e))},Ci=(e,t)=>{t&&(yi(e),yi(e))},wi=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Fi(i)||ta(i))return;Ei.has(e)||Ei.set(e,[]);let a=Ei.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await Ui(e,r,i),await w.yield();let o=await Pi({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},Ti=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{ra();let a=Ei.get(e);for(;a?.length>0;)await E(r,`message:done`);e.removeListener(`message`,i),Ci(t,n),r.connected=!1,r.emit(`disconnect`)},Ei=new WeakMap,Di=(e,t,n)=>{if(Oi.has(e))return Oi.get(e);let r=new ne;return r.connected=!0,Oi.set(e,r),ki({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Oi=new WeakMap,ki=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=wi.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Ti.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Si(n,r)},Ai=e=>{let t=Oi.get(e);return t===void 0?e.channel!==null:t.connected},ji=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=Di(e,t,n),o=Wi(e,a);return{id:Mi++,type:zi,message:r,hasListeners:o}};let Mi=0n;const Ni=(e,t)=>{if(!(t?.type!==zi||t.hasListeners))for(let{id:t}of e)t!==void 0&&Li[t].resolve({isDeadlock:!0,hasListeners:!1})},Pi=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==zi||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:Bi,message:Wi(t,i)};try{await Ki({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},Fi=e=>{if(e?.type!==Bi)return!1;let{id:t,message:n}=e;return Li[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},Ii=async(e,t,n)=>{if(e?.type!==zi)return;let r=z();Li[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,Ri(t,n,i)]);e&&Jr(n),a||Xr(n)}finally{i.abort(),delete Li[e.id]}},Li={},Ri=async(e,t,{signal:n})=>{_i(e,1,n),await E(e,`disconnect`,{signal:n}),Zr(t)},zi=`execa:ipc:request`,Bi=`execa:ipc:response`,Vi=(e,t,n)=>{V.has(e)||V.set(e,new Set);let r=V.get(e),i=z(),a=n?t.id:void 0,o={onMessageSent:i,id:a};return r.add(o),{outgoingMessages:r,outgoingMessage:o}},Hi=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Ui=async(e,t,n)=>{for(;!Wi(e,t)&&V.get(e)?.size>0;){let t=[...V.get(e)];Ni(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},V=new WeakMap,Wi=(e,t)=>t.listenerCount(`message`)>Gi(e),Gi=e=>B.has(e)&&!P(B.get(e).options.buffer,`ipc`)?1:0,Ki=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return Wr({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),qi({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},qi=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=ji({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=Vi(e,o,a);try{await Ji({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw oi(e),t}finally{Hi(s)}},Ji=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=Yi(e);try{await Promise.all([Ii(r,e,n),a(r)])}catch(e){throw ei({error:e,methodName:t,isSubprocess:n}),ti({error:e,methodName:t,isSubprocess:n,message:i}),e}},Yi=e=>{if(Xi.has(e))return Xi.get(e);let t=h(e.send.bind(e));return Xi.set(e,t),t},Xi=new WeakMap,Zi=(e,t)=>{let n=`cancelSignal`;return Kr(n,!1,e.connected),Ji({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:na,message:t},message:t})},Qi=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await $i({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),ia.signal),$i=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!ea){if(ea=!0,!r){$r();return}if(t===null){ra();return}Di(e,t,n),await w.yield()}};let ea=!1;const ta=e=>e?.type===na?(ia.abort(e.message),!0):!1,na=`execa:ipc:cancel`,ra=()=>{ia.abort(Qr())},ia=new AbortController,aa=({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r===`json`)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},oa=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[sa({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],sa=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{await Br(t,i);let a=ca(t);throw await Zi(e,a),zr({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??=`gracefulCancel`,t.reason},ca=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,`stack`,{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t},la=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},ua=(e,t,n,r)=>t===0||t===void 0?[]:[da(e,t,n,r)],da=async(e,t,n,{signal:r})=>{throw await te(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e.kill(),new I},fa=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},pa=(e,t,{node:n=!1,nodePath:r=y,nodeOptions:i=v.filter(e=>!e.startsWith(`--inspect`)),cwd:a,execPath:o,...s})=>{if(o!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);let c=ye(r,`The "nodePath" option`),l=C.resolve(a,c),u={...s,nodePath:l,node:n,cwd:a};if(!n)return[e,t,u];if(C.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[l,[...i,e,...t],{ipc:!0,...u,shell:!1}]},ma=({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");_a[n](e)}},ha=e=>{try{oe(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ga=e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_a={advanced:ha,json:ga},va=async(e,t)=>{t!==void 0&&await e.sendMessage(t)},ya=({encoding:e})=>{if(xa.has(e))return;let t=Sa(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${wa(e)}\`.
|
|
21
|
+
Please rename it to ${wa(t)}.`);let n=[...xa].map(e=>wa(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${wa(e)}\`.
|
|
22
|
+
Please rename it to one of: ${n}.`)},ba=new Set([`utf8`,`utf16le`]),H=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),xa=new Set([...ba,...H]),Sa=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in Ca)return Ca[t];if(xa.has(t))return t},Ca={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},wa=e=>typeof e==`string`?`"${e}"`:String(e),Ta=(e=Ea())=>{let t=ye(e,`The "cwd" option`);return C.resolve(t)},Ea=()=>{try{return _.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},Da=(e,t)=>{if(t===Ea())return e;let n;try{n=de(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`};var Oa=t(r(),1);const ka=(e,t,n)=>{n.cwd=Ta(n.cwd);let[r,i,a]=pa(e,t,n),{command:o,args:s,options:c}=Oa.default._parse(r,i,a),l=qe(c),u=Aa(l);return la(u),ya(u),ma(u),Vr(u),aa(u),u.shell=Se(u.shell),u.env=ja(u),u.killSignal=Sr(u.killSignal),u.forceKillAfterDelay=Nr(u.forceKillAfterDelay),u.lines=u.lines.map((e,t)=>e&&!H.has(u.encoding)&&u.buffer[t]),_.platform===`win32`&&C.basename(o,`.exe`)===`cmd`&&s.unshift(`/q`),{file:o,commandArguments:s,options:u}},Aa=({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i=`utf8`,reject:a=!0,cleanup:o=!0,all:s=!1,windowsHide:c=!0,killSignal:l=`SIGTERM`,forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m=`advanced`,...h})=>({...h,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:a,cleanup:o,all:s,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),ja=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{..._.env,...e}:e;return n||r?er({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o},Ma=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n];function Na(e){if(typeof e==`string`)return Pa(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return Fa(e)}const Pa=e=>e.at(-1)===Ia?e.slice(0,e.at(-2)===Ra?-2:-1):e,Fa=e=>e.at(-1)===La?e.subarray(0,e.at(-2)===za?-2:-1):e,Ia=`
|
|
23
|
+
`,La=Ia.codePointAt(0),Ra=`\r`,za=Ra.codePointAt(0);function U(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function Ba(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write==`function`&&typeof e.end==`function`&&typeof e.writable==`boolean`&&typeof e.writableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Va(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read==`function`&&typeof e.readable==`boolean`&&typeof e.readableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Ha(e,t){return Ba(e,t)&&Va(e,t)}const Ua=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);var Wa=class{#t;#n;#r=!1;#e=void 0;constructor(e,t){this.#t=e,this.#n=t}next(){let e=()=>this.#s();return this.#e=this.#e?this.#e.then(e,e):e(),this.#e}return(e){let t=()=>this.#i(e);return this.#e?this.#e.then(t,t):t()}async#s(){if(this.#r)return{done:!0,value:void 0};let e;try{e=await this.#t.read()}catch(e){throw this.#e=void 0,this.#r=!0,this.#t.releaseLock(),e}return e.done&&(this.#e=void 0,this.#r=!0,this.#t.releaseLock()),e}async#i(e){if(this.#r)return{done:!0,value:e};if(this.#r=!0,!this.#n){let t=this.#t.cancel(e);return this.#t.releaseLock(),await t,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}};const Ga=Symbol();function Ka(){return this[Ga].next()}Object.defineProperty(Ka,`name`,{value:`next`});function qa(e){return this[Ga].return(e)}Object.defineProperty(qa,`name`,{value:`return`});const Ja=Object.create(Ua,{next:{enumerable:!0,configurable:!0,writable:!0,value:Ka},return:{enumerable:!0,configurable:!0,writable:!0,value:qa}});function Ya({preventCancel:e=!1}={}){let t=this.getReader(),n=new Wa(t,e),r=Object.create(Ja);return r[Ga]=n,r}const Xa=e=>{if(Va(e,{checkOpen:!1})&&eo.on!==void 0)return Qa(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(Za.call(e)===`[object ReadableStream]`)return Ya.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:Za}=Object.prototype,Qa=async function*(e){let t=new AbortController,n={};$a(e,t,n);try{for await(let[n]of eo.on(e,`data`,{signal:t.signal}))yield n}catch(e){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},$a=async(e,t,n)=>{try{await eo.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},eo={},to=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=Xa(e),u=t();u.length=0;try{for await(let e of l){let t=ao(e),o=n[t](e,u);ro({convertedChunk:o,state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c})}return no({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(u)}catch(e){let t=typeof e==`object`&&e?e:Error(e);throw t.bufferedData=s(u),t}},no=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&ro({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},ro=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){io(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&io(c,t,i,a),new so},io=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},ao=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=oo.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&oo.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:oo}=Object.prototype;var so=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const W=e=>e,co=()=>void 0,lo=({contents:e})=>e,uo=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},fo=e=>e.length;async function po(e,t){return to(e,_o,t)}const mo=()=>({contents:[]}),ho=()=>1,go=(e,{contents:t})=>(t.push(e),t),_o={init:mo,convertChunk:{string:W,buffer:W,arrayBuffer:W,dataView:W,typedArray:W,others:W},getSize:ho,truncateChunk:co,addChunk:go,getFinalChunk:co,finalize:lo};async function vo(e,t){return to(e,Mo,t)}const yo=()=>({contents:new ArrayBuffer(0)}),bo=e=>xo.encode(e),xo=new TextEncoder,So=e=>new Uint8Array(e),Co=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),wo=(e,t)=>e.slice(0,t),To=(e,{contents:t,length:n},r)=>{let i=jo()?Do(t,r):Eo(t,r);return new Uint8Array(i).set(e,n),i},Eo=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(Oo(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Do=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:Oo(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},Oo=e=>ko**Math.ceil(Math.log(e)/Math.log(ko)),ko=2,Ao=({contents:e,length:t})=>jo()?e:e.slice(0,t),jo=()=>`resize`in ArrayBuffer.prototype,Mo={init:yo,convertChunk:{string:bo,buffer:So,arrayBuffer:So,dataView:Co,typedArray:Co,others:uo},getSize:fo,truncateChunk:wo,addChunk:To,getFinalChunk:co,finalize:Ao};async function No(e,t){return to(e,zo,t)}const Po=()=>({contents:``,textDecoder:new TextDecoder}),Fo=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Io=(e,{contents:t})=>t+e,Lo=(e,t)=>e.slice(0,t),Ro=({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},zo={init:Po,convertChunk:{string:W,buffer:Fo,arrayBuffer:Fo,dataView:Fo,typedArray:Fo,others:uo},getSize:fo,truncateChunk:Lo,addChunk:Io,getFinalChunk:Ro,finalize:lo},Bo=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof so))throw e;if(a===`all`)return e;let o=Vo(n,r,i);throw e.maxBufferInfo={fdNumber:a,unit:o},t.destroy(),e},Vo=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,Ho=(e,t,n)=>{if(t.length!==n)return;let r=new so;throw r.maxBufferInfo={fdNumber:`ipc`},r},Uo=(e,t)=>{let{streamName:n,threshold:r,unit:i}=Wo(e,t);return`Command's ${n} was larger than ${r} ${i}`},Wo=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:`output`,threshold:t[1],unit:`bytes`};let{maxBufferInfo:{fdNumber:n,unit:r}}=e;delete e.maxBufferInfo;let i=P(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:Ke(n),threshold:i,unit:r}},Go=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>qo(n)),Ko=(e,t,n)=>{if(!t)return e;let r=qo(n);return e.length>r?e.slice(0,r):e},qo=([,e])=>e,Jo=({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:a,exitCode:o,escapedCommand:s,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:_})=>{let v=r?.code,y=Yo({originalError:r,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:v,signal:i,signalDescription:a,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),b=Zo(r,_),x=b===void 0?``:`\n${b}`,S=`${y}: ${s}${x}`,C=t===void 0?[e[2],e[1]]:[t],w=[S,...C,...e.slice(3),n.map(e=>Qo(e)).join(`
|
|
24
|
+
`)].map(e=>ht(Na($o(e)))).filter(Boolean).join(`
|
|
25
|
+
|
|
26
|
+
`);return{originalMessage:b,shortMessage:S,message:w}},Yo=({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:a,signal:o,signalDescription:s,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Xo(d,f);return t?`Command timed out after ${n} milliseconds${m}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${o} (${s})`:l?`Command was canceled${m}`:r?`${Uo(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Mr(p)})${m}`:o===void 0?c===void 0?`Command failed`:`Command failed with exit code ${c}`:`Command was killed with ${o} (${s})`:`Command failed with ${a}${m}`},Xo=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,Zo=(e,t)=>{if(e instanceof I)return;let n=rr(e)?e.originalMessage:String(e?.message??e),r=ht(Da(n,t));return r===``?void 0:r},Qo=e=>typeof e==`string`?e:m(e),$o=e=>Array.isArray(e)?e.map(e=>Na(es(e))).filter(Boolean).join(`
|
|
27
|
+
`):es(e),es=e=>typeof e==`string`?e:A(e)?ke(e):``,ts=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>ss({command:e,escapedCommand:t,cwd:a,durationMs:Gn(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),ns=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>rs({error:e,command:t,escapedCommand:n,startTime:a,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),rs=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:_,cwd:v,maxBuffer:y},isSync:b})=>{let{exitCode:x,signal:S,signalDescription:C}=cs(l,u),{originalMessage:w,shortMessage:ee,message:te}=Jo({stdio:d,all:f,ipcOutput:p,originalError:e,signal:S,signalDescription:C,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),T=tr(e,te,b);return Object.assign(T,os({error:T,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:S,signalDescription:C,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:w,shortMessage:ee})),T},os=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:_})=>ss({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:Gn(r),failed:!0,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),ss=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),cs=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t,i=r===void 0?void 0:Mr(t);return{exitCode:n,signal:r,signalDescription:i}},ls=e=>Number.isFinite(e)?e:0;function us(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(ls(e*1e3)%1e3),nanoseconds:Math.trunc(ls(e*1e6)%1e3)}}function ds(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function fs(e){switch(typeof e){case`number`:if(Number.isFinite(e))return us(e);break;case`bigint`:return ds(e)}throw TypeError(`Expected a finite number or bigint`)}const ps=e=>e===0||e===0n,ms=(e,t)=>t===1||t===1n?e:`${e}s`,hs=1e-7,gs=24n*60n*60n*1000n;function _s(e,t){let n=typeof e==`bigint`;if(!n&&!Number.isFinite(e))throw TypeError(`Expected a finite number or bigint`);t={...t};let r=e<0?`-`:``;e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[],a=(e,t)=>{let n=Math.floor(e*10**t+hs),r=Math.round(n)/10**t;return r.toFixed(t)},o=(e,n,r,a)=>{if(!((i.length===0||!t.colonNotation)&&ps(e)&&!(t.colonNotation&&r===`m`))){if(a??=String(e),t.colonNotation){let e=a.includes(`.`)?a.split(`.`)[0].length:a.length,t=i.length>0?2:1;a=`0`.repeat(Math.max(0,t-e))+a}else a+=t.verbose?` `+ms(n,e):r;i.push(a)}},s=fs(e),c=BigInt(s.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(s.hours),`hour`,`h`):(t.hideYear?o(c,`day`,`d`):(o(c/365n,`year`,`y`),o(c%365n,`day`,`d`)),o(Number(s.hours),`hour`,`h`)),o(Number(s.minutes),`minute`,`m`),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3){let e=Number(s.seconds),n=Number(s.milliseconds),r=Number(s.microseconds),i=Number(s.nanoseconds);if(o(e,`second`,`s`),t.formatSubMilliseconds)o(n,`millisecond`,`ms`),o(r,`microsecond`,`µs`),o(i,`nanosecond`,`ns`);else{let e=n+r/1e3+i/1e6,a=typeof t.millisecondsDecimalDigits==`number`?t.millisecondsDecimalDigits:0,s=e>=1?Math.round(e):Math.ceil(e),c=a?e.toFixed(a):s;o(Number.parseFloat(c),`millisecond`,`ms`,c)}}else{let r=(n?Number(e%gs):e)/1e3%60,i=typeof t.secondsDecimalDigits==`number`?t.secondsDecimalDigits:1,s=a(r,i),c=t.keepDecimalsOnWholeSeconds?s:s.replace(/\.0+$/,``);o(Number.parseFloat(c),`second`,`s`,c)}if(i.length===0)return r+`0`+(t.verbose?` milliseconds`:`ms`);let l=t.colonNotation?`:`:` `;return typeof t.unitCount==`number`&&(i=i.slice(0,Math.max(t.unitCount,1))),r+i.join(l)}const vs=(e,t)=>{e.failed&&Nn({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})},ys=(e,t)=>{st(t)&&(vs(e,t),bs(e,t))},bs=(e,t)=>{let n=`(done in ${_s(e.durationMs)})`;Nn({type:`duration`,verboseMessage:n,verboseInfo:t,result:e})},xs=(e,t,{reject:n})=>{if(ys(e,t),e.failed&&n)throw e;return e},Ss=(e,t)=>G(e)?`asyncGenerator`:js(e)?`generator`:Ns(e)?`fileUrl`:Fs(e)?`filePath`:Hs(e)?`webStream`:U(e,{checkOpen:!1})?`native`:A(e)?`uint8Array`:Ws(e)?`asyncIterable`:Gs(e)?`iterable`:Us(e)?Ts({transform:e},t):Ms(e)?Cs(e,t):`native`,Cs=(e,t)=>Ha(e.transform,{checkOpen:!1})?ws(e,t):Us(e.transform)?Ts(e,t):Os(e,t),ws=(e,t)=>(Es(e,t,`Duplex stream`),`duplex`),Ts=(e,t)=>(Es(e,t,`web TransformStream`),`webTransform`),Es=({final:e,binary:t,objectMode:n},r,i)=>{Ds(e,`${r}.final`,i),Ds(t,`${r}.binary`,i),ks(n,`${r}.objectMode`)},Ds=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},Os=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!As(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Ha(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(Us(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!As(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return ks(n,`${i}.binary`),ks(r,`${i}.objectMode`),G(e)||G(t)?`asyncGenerator`:`generator`},ks=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},As=e=>G(e)||js(e),G=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,js=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Ms=e=>k(e)&&(e.transform!==void 0||e.final!==void 0),Ns=e=>Object.prototype.toString.call(e)===`[object URL]`,Ps=e=>Ns(e)&&e.protocol!==`file:`,Fs=e=>k(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>Is.has(e))&&Ls(e.file),Is=new Set([`file`,`append`]),Ls=e=>typeof e==`string`,Rs=(e,t)=>e===`native`&&typeof t==`string`&&!zs.has(t),zs=new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),Bs=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,Vs=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,Hs=e=>Bs(e)||Vs(e),Us=e=>Bs(e?.readable)&&Vs(e?.writable),Ws=e=>Ks(e)&&typeof e[Symbol.asyncIterator]==`function`,Gs=e=>Ks(e)&&typeof e[Symbol.iterator]==`function`,Ks=e=>typeof e==`object`&&!!e,K=new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),qs=new Set([`fileUrl`,`filePath`,`fileNumber`]),Js=new Set([`fileUrl`,`filePath`]),Ys=new Set([...Js,`webStream`,`nodeStream`]),Xs=new Set([`webTransform`,`duplex`]),Zs={generator:`a generator`,asyncGenerator:`an async generator`,fileUrl:`a file URL`,filePath:`a file path string`,fileNumber:`a file descriptor number`,webStream:`a web stream`,nodeStream:`a Node.js stream`,webTransform:`a web TransformStream`,duplex:`a Duplex stream`,native:`any value`,iterable:`an iterable`,asyncIterable:`an async iterable`,string:`a string`,uint8Array:`a Uint8Array`},Qs=(e,t,n,r)=>r===`output`?$s(e,t,n):ec(e,t,n),$s=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode,i=e??r;return{writableObjectMode:r,readableObjectMode:i}},ec=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode,i=t!==n.length-1&&(e??r);return{writableObjectMode:r,readableObjectMode:i}},tc=(e,t)=>{let n=e.findLast(({type:e})=>K.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode},nc=(e,t,n,r)=>[...e.filter(({type:e})=>!K.has(e)),...rc(e,t,n,r)],rc=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>K.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=ic({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return cc(a,n)},ic=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?ac({stdioItem:e,optionName:i}):t===`webTransform`?oc({stdioItem:e,index:n,newTransforms:r,direction:a}):sc({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),ac=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:a})=>{if(i&&!r)throw TypeError(`The \`${a}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw TypeError(`The \`${a}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:n,readableObjectMode:r}}},oc=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i})=>{let{transform:a,objectMode:o}=k(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:c}=Qs(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},sc=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:a})=>{let{transform:o,final:s,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=k(t)?t:{transform:t},d=c||H.has(a),{writableObjectMode:f,readableObjectMode:p}=Qs(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},cc=(e,t)=>t===`input`?e.reverse():e,lc=(e,t,n)=>{let r=e.map(e=>uc(e,t));if(r.includes(`input`)&&r.includes(`output`))throw TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??hc},uc=({type:e,value:t},n)=>dc[n]??pc[e](t),dc=[`input`,`output`,`output`],q=()=>void 0,fc=()=>`input`,pc={generator:q,asyncGenerator:q,fileUrl:q,filePath:q,iterable:fc,asyncIterable:fc,uint8Array:fc,webStream:e=>Vs(e)?`output`:`input`,nodeStream(e){return Va(e,{checkOpen:!1})?Ba(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:q,duplex:q,native(e){let t=mc(e);if(t!==void 0)return t;if(U(e,{checkOpen:!1}))return pc.nodeStream(e)}},mc=e=>{if([0,_.stdin].includes(e))return`input`;if([1,2,_.stdout,_.stderr].includes(e))return`output`},hc=`output`,gc=(e,t)=>t&&!e.includes(`ipc`)?[...e,`ipc`]:e,_c=({stdio:e,ipc:t,buffer:n,...r},i,a)=>{let o=vc(e,r).map((e,t)=>bc(e,t));return a?xc(o,n,i):gc(o,t)},vc=(e,t)=>{if(e===void 0)return N.map(e=>t[e]);if(yc(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${N.map(e=>`\`${e}\``).join(`, `)}`);if(typeof e==`string`)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let n=Math.max(e.length,N.length);return Array.from({length:n},(t,n)=>e[n])},yc=e=>N.some(t=>e[t]!==void 0),bc=(e,t)=>Array.isArray(e)?e.map(e=>bc(e,t)):e??(t>=N.length?`ignore`:`pipe`),xc=(e,t,n)=>e.map((e,r)=>!t[r]&&r!==0&&!ct(n,r)&&Sc(e)?`ignore`:e),Sc=e=>e===`pipe`||Array.isArray(e)&&e.every(e=>e===`pipe`),Cc=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?wc({stdioItem:e,fdNumber:r,direction:i}):Dc({stdioItem:e,fdNumber:r}),wc=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=Tc({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(U(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Tc=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=Ec(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(S.isatty(i))throw TypeError(`The \`${t}: ${gi(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,value:j(ue(i)),optionName:t}}},Ec=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=Ge.indexOf(e);if(n!==-1)return n},Dc=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:Oc(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:Oc(t,t,n),optionName:n}:U(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,Oc=(e,t,n)=>{let r=Ge[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},kc=({input:e,inputFile:t},n)=>n===0?[...Ac(e),...Mc(t)]:[],Ac=e=>e===void 0?[]:[{type:jc(e),value:e,optionName:`input`}],jc=e=>{if(Va(e,{checkOpen:!1}))return`nodeStream`;if(typeof e==`string`)return`string`;if(A(e))return`uint8Array`;throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Mc=e=>e===void 0?[]:[{...Nc(e),optionName:`inputFile`}],Nc=e=>{if(Ns(e))return{type:`fileUrl`,value:e};if(Ls(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},Pc=e=>e.filter((t,n)=>e.every((e,r)=>t.value!==e.value||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),Fc=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=Ic(i,e);if(o.length!==0){if(a){Lc({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});return}if(Ys.has(e))return Rc({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});Xs.has(e)&&Bc({otherStdioItems:o,type:e,value:t,optionName:n})}},Ic=(e,t)=>e.flatMap(({direction:e,stdioItems:n})=>n.filter(e=>e.type===t).map(t=>({...t,direction:e}))),Lc=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Js.has(t)&&Rc({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Rc=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>zc(e,n));if(a.length===0)return;let o=a.find(e=>e.direction!==i);return Vc(o,r,t),i===`output`?a[0].stream:void 0},zc=({type:e,value:t},n)=>e===`filePath`?t.file===n.file:e===`fileUrl`?t.href===n.href:t===n,Bc=({otherStdioItems:e,type:t,value:n,optionName:r})=>{let i=e.find(({value:{transform:e}})=>e===n.transform);Vc(i,r,t)},Vc=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Zs[n]} that is the same.`)},Hc=(e,t,n,r)=>{let i=_c(t,n,r),a=i.map((e,n)=>Uc({stdioOption:e,fdNumber:n,options:t,isSync:r})),o=Zc({initialFileDescriptors:a,addProperties:e,options:t,isSync:r});return t.stdio=o.map(({stdioItems:e})=>tl(e)),o},Uc=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=Ke(t),{stdioItems:a,isStdioArray:o}=Wc({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=lc(a,t,i),c=a.map(e=>Cc({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),l=nc(c,i,s,n),u=tc(l,s);return Xc(l,u),{direction:s,objectMode:u,stdioItems:l}},Wc=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=Array.isArray(e)?e:[e],a=[...i.map(e=>Gc(e,r)),...kc(n,t)],o=Pc(a),s=o.length>1;return Kc(o,s,r),Jc(o),{stdioItems:o,isStdioArray:s}},Gc=(e,t)=>({type:Ss(e,t),value:e,optionName:t}),Kc=(e,t,n)=>{if(e.length===0)throw TypeError(`The \`${n}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:n}of e)if(qc.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},qc=new Set([`ignore`,`ipc`]),Jc=e=>{for(let t of e)Yc(t)},Yc=({type:e,value:t,optionName:n})=>{if(Ps(t))throw TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
|
|
28
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Rs(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},Xc=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>qs.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},Zc=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)i.push(Qc({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(e){throw el(i),e}},Qc=({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:a,isSync:o})=>{let s=n.map(t=>$c({stdioItem:t,addProperties:i,direction:e,options:a,fileDescriptors:r,isSync:o}));return{direction:e,objectMode:t,stdioItems:s}},$c=({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:a})=>{let o=Fc({stdioItem:e,direction:n,fileDescriptors:i,isSync:a});return o===void 0?{...e,...t[n][e.type](e,r)}:{...e,stream:o}},el=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)e!==void 0&&!M(e)&&e.destroy()},tl=e=>{if(e.length>1)return e.some(({value:e})=>e===`overlapped`)?`overlapped`:`pipe`;let[{type:t,value:n}]=e;return t===`native`?n:`pipe`},nl=(e,t)=>Hc(ol,e,t,!0),J=({type:e,optionName:t})=>{il(t,Zs[e])},rl=({optionName:e,value:t})=>((t===`ipc`||t===`overlapped`)&&il(e,`"${t}"`),{}),il=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},al={generator(){},asyncGenerator:J,webStream:J,nodeStream:J,webTransform:J,duplex:J,asyncIterable:J,native:rl},ol={input:{...al,fileUrl:({value:e})=>({contents:[j(ue(e))]}),filePath:({value:{file:e}})=>({contents:[j(ue(e))]}),fileNumber:J,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...al,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:J,string:J,uint8Array:J}},Y=(e,{stripFinalNewline:t},n)=>sl(t,n)&&e!==void 0&&!Array.isArray(e)?Na(e):e,sl=(e,t)=>t===`all`?e[1]||e[2]:e[t],cl=(e,t,n,r)=>e||n?void 0:dl(t,r),ll=(e,t,n)=>n?e.flatMap(e=>ul(e,t)):ul(e,t),ul=(e,t)=>{let{transform:n,final:r}=dl(t,{});return[...n(e),...r()]},dl=(e,t)=>(t.previousChunks=``,{transform:fl.bind(void 0,t,e),final:ml.bind(void 0,t)}),fl=function*(e,t,n){if(typeof n!=`string`){yield n;return}let{previousChunks:r}=e,i=-1;for(let a=0;a<n.length;a+=1)if(n[a]===`
|
|
29
|
+
`){let o=pl(n,a,t,e),s=n.slice(i+1,a+1-o);r.length>0&&(s=_l(r,s),r=``),yield s,i=a}i!==n.length-1&&(r=_l(r,n.slice(i+1))),e.previousChunks=r},pl=(e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]===`\r`,r.isWindowsNewline?2:1),ml=function*({previousChunks:e}){e.length>0&&(yield e)},hl=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:gl.bind(void 0,r)},gl=function*({isWindowsNewline:e=!1},t){let{unixNewline:n,windowsNewline:r,LF:i,concatBytes:a}=typeof t==`string`?vl:bl;if(t.at(-1)===i){yield t;return}let o=e?r:n;yield a(t,o)},_l=(e,t)=>`${e}${t}`,vl={windowsNewline:`\r
|
|
30
|
+
`,unixNewline:`
|
|
31
|
+
`,LF:`
|
|
32
|
+
`,concatBytes:_l},yl=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},bl={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:yl},xl=(e,t)=>e?void 0:Sl.bind(void 0,t),Sl=function*(e,t){if(typeof t!=`string`&&!A(t)&&!ve.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Cl=(e,t)=>e?wl.bind(void 0,t):Tl.bind(void 0,t),wl=function*(e,t){El(e,t),yield t},Tl=function*(e,t){if(El(e,t),typeof t!=`string`&&!A(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},El=(e,t)=>{if(t==null)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
33
|
+
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
34
|
+
if (condition) { yield value; }`)},Dl=(e,t,n)=>{if(n)return;if(e)return{transform:Ol.bind(void 0,new TextEncoder)};let r=new u(t);return{transform:kl.bind(void 0,r),final:Al.bind(void 0,r)}},Ol=function*(e,t){ve.isBuffer(t)?yield j(t):typeof t==`string`?yield e.encode(t):yield t},kl=function*(e,t){yield A(t)?e.write(t):t},Al=function*(e){let t=e.end();t!==``&&(yield t)},jl=f(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),Ml=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Il}=t[n];for await(let i of r(e))yield*Ml(i,t,n+1)},Nl=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Pl(n,Number(t),e)},Pl=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*Ml(r,n,t+1)},Fl=f(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Il=function*(e){yield e},Ll=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(e)}},Rl=(e,t)=>[...t.flatMap(t=>[...X(t,e,0)]),...zl(e)],X=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Vl}=t[n];for(let i of r(e))yield*X(i,t,n+1)},zl=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Bl(n,Number(t),e)},Bl=function*(e,t,n){if(e!==void 0)for(let r of e())yield*X(r,n,t+1)},Vl=function*(e){yield e},Hl=({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:a},{encoding:o})=>{let s={},c=Wl(e,o,a),l=G(t),u=G(n),d=l?jl.bind(void 0,Ml,s):Ll.bind(void 0,X),f=l||u?jl.bind(void 0,Nl,s):Ll.bind(void 0,zl),p=l||u?Fl.bind(void 0,s):void 0,m=new he({writableObjectMode:r,writableHighWaterMark:_e(r),readableObjectMode:i,readableHighWaterMark:_e(i),transform(e,t,n){d([e,c,0],this,n)},flush(e){f([c],this,e)},destroy:p});return{stream:m}},Ul=(e,t,n,r)=>{let i=t.filter(({type:e})=>e===`generator`),a=r?i.reverse():i;for(let{value:t,optionName:r}of a){let i=Wl(t,n,r);e=Rl(i,e)}return e},Wl=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:xl(r,s)},Dl(n,o,r),cl(n,a,r,c),{transform:e,final:t},{transform:Cl(i,s)},hl({binary:n,preserveNewlines:a,readableObjectMode:i,state:c})].filter(Boolean)},Gl=(e,t)=>{for(let n of Kl(e))ql(e,n,t)},Kl=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),ql=(e,t,n)=>{let{stdioItems:r}=e[t],i=r.filter(({contents:e})=>e!==void 0);if(i.length===0)return;if(t!==0){let[{type:e,optionName:t}]=i;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${Zs[e]} with synchronous methods.`)}let a=i.map(({contents:e})=>e),o=a.map(e=>Jl(e,r));n.input=Me(o)},Jl=(e,t)=>{let n=Ul(e,t,`utf8`,!0);return Yl(n),Me(n)},Yl=e=>{let t=e.find(e=>typeof e!=`string`&&!A(e));if(t!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)},Xl=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&ct(n,r)&&!H.has(t)&&Zl(r)&&(e.some(({type:e,value:t})=>e===`native`&&Ql.has(t))||e.every(({type:e})=>K.has(e))),Zl=e=>e===1||e===2,Ql=new Set([`pipe`,`overlapped`]),$l=async(e,t,n,r)=>{for await(let i of e)tu(t)||nu(i,n,r)},eu=(e,t,n)=>{for(let r of e)nu(r,t,n)},tu=e=>e._readableState.pipes.length>0,nu=(e,t,n)=>{let r=Ln(e);Nn({type:`output`,verboseMessage:r,fdNumber:t,verboseInfo:n})},ru=({fileDescriptors:e,syncResult:{output:t},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(t===null)return{output:Array.from({length:3})};let a={},o=new Set([]),s=t.map((t,s)=>iu({result:t,fileDescriptors:e,fdNumber:s,state:a,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n));return{output:s,...a}},iu=({result:e,fileDescriptors:t,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:a,verboseInfo:o},{buffer:s,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let f=Ko(e,a,d),p=j(f),{stdioItems:m,objectMode:h}=t[n],g=au([p],m,c,r),{serializedResult:_,finalResult:v=_}=ou({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});su({serializedResult:_,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:m,objectMode:h});let y=s[n]?v:void 0;try{return r.error===void 0&&cu(_,m,i),y}catch(e){return r.error=e,y}},au=(e,t,n,r)=>{try{return Ul(e,t,n,!1)}catch(t){return r.error=t,e}},ou=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e};if(n===`buffer`)return{serializedResult:Me(e)};let o=Ae(e,n);return r[a]?{serializedResult:o,finalResult:ll(o,!i[a],t)}:{serializedResult:o}},su=({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:a,objectMode:o})=>{if(!Xl({stdioItems:a,encoding:i,verboseInfo:r,fdNumber:t}))return;let s=ll(e,!1,o);try{eu(s,t,r)}catch(e){n.error??=e}},cu=(e,t,n)=>{for(let{path:r,append:i}of t.filter(({type:e})=>qs.has(e))){let t=typeof r==`string`?r:r.toString();i||n.has(t)?se(r,e):(n.add(t),fe(r,e))}},lu=([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Y(t,n,`all`)]:Array.isArray(t)?[Y(e,n,`all`),...t]:A(e)&&A(t)?Pe([e,t]):`${e}${t}`},uu=async(e,t)=>{let[n,r]=await du(e);return t.isForcefullyTerminated??=!1,[n,r]},du=async e=>{let[t,n]=await Promise.allSettled([E(e,`spawn`),E(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?fu(e):n.value},fu=async e=>{try{return await E(e,`exit`)}catch{return fu(e)}},pu=async e=>{let[t,n]=await e;if(!mu(t,n)&&hu(t,n))throw new I;return[t,n]},mu=(e,t)=>e===void 0&&t===void 0,hu=(e,t)=>e!==0||t!==null,gu=({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{let a=_u(e,t,n),o=a?.code===`ETIMEDOUT`,s=Go(a,r,i);return{resultError:a,exitCode:t,signal:n,timedOut:o,isMaxBuffer:s}},_u=(e,t,n)=>e===void 0?hu(t,n)?new I:void 0:e,vu=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=yu(e,t,n),d=Cu({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s});return xs(d,c,l)},yu=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Kn(e,t,n),s=bu(n),{file:c,commandArguments:l,options:u}=ka(e,t,s);xu(u);let d=nl(u,o);return{file:c,commandArguments:l,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:d}},bu=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,xu=({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&Su(`ipcInput`),e&&Su(`ipc: true`),n&&Su(`detached: true`),r&&Su(`cancelSignal`)},Su=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},Cu=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=wu({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:s});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=gu(c,n),{output:m,error:h=l}=ru({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:p,verboseInfo:a}),g=m.map((e,t)=>Y(e,n,t)),_=Y(lu(m,n),n,`all`);return Eu({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:_,options:n,command:r,escapedCommand:i,startTime:s})},wu=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:o})=>{try{Gl(a,n);let r=Tu(n);return l(...Ma(e,t,r))}catch(e){return ns({error:e,command:r,escapedCommand:i,fileDescriptors:a,options:n,startTime:o,isSync:!0})}},Tu=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:qo(t)}),Eu=({error:e,exitCode:t,signal:n,timedOut:r,isMaxBuffer:i,stdio:a,all:o,options:s,command:c,escapedCommand:l,startTime:u})=>e===void 0?ts({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):rs({error:e,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:t,signal:n,stdio:a,all:o,ipcOutput:[],options:s,startTime:u,isSync:!0}),Du=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:a}={})=>(Wr({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:Ai(e)}),Ou({anyProcess:e,channel:t,isSubprocess:n,filter:a,reference:i})),Ou=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{vi(t,i);let a=Di(e,t,n),o=new AbortController;try{return await Promise.race([ku(a,r,o),Au(a,n,o),ju(a,n,o)])}catch(t){throw oi(e),t}finally{o.abort(),bi(t,i)}},ku=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await E(e,`message`,{signal:n});return t}for await(let[r]of ie(e,`message`,{signal:n}))if(t(r))return r},Au=async(e,t,{signal:n})=>{await E(e,`disconnect`,{signal:n}),qr(t)},ju=async(e,t,{signal:n})=>{let[r]=await E(e,`strict:error`,{signal:n});throw Yr(r,t)},Mu=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>Nu({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),Nu=({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:a})=>{Wr({methodName:`getEachMessage`,isSubprocess:n,ipc:r,isConnected:Ai(e)}),vi(t,a);let o=Di(e,t,n),s=new AbortController,c={};return Pu(e,o,s),Fu({ipcEmitter:o,isSubprocess:n,controller:s,state:c}),Iu({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:s,state:c,reference:a})},Pu=async(e,t,n)=>{try{await E(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},Fu=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await E(e,`strict:error`,{signal:n.signal});r.error=Yr(i,t),n.abort()}catch{}},Iu=async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:a,state:o,reference:s}){try{for await(let[e]of ie(n,`message`,{signal:a.signal}))Lu(o),yield e}catch{Lu(o)}finally{a.abort(),bi(t,s),r||oi(e),i&&await e}},Lu=({error:e})=>{if(e)throw e},Ru=(e,{ipc:t})=>{Object.assign(e,Bu(e,!1,t))},zu=()=>{let e=_,t=!0,n=_.channel!==void 0;return{...Bu(e,t,n),getCancelSignal:Qi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}},Bu=(e,t,n)=>({sendMessage:Ki.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:Du.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:Mu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}),Vu=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,verboseInfo:s})=>{el(r);let c=new o;Hu(c,r),Object.assign(c,{readable:Uu,writable:Wu,duplex:Gu});let l=ns({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:!1}),u=Ku(l,s,i);return{subprocess:c,promise:u}},Hu=(e,t)=>{let n=Z(),r=Z(),i=Z(),a=Array.from({length:t.length-3},Z),o=Z(),s=[n,r,i,...a];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:o,stdio:s})},Z=()=>{let e=new me;return e.end(),e},Uu=()=>new O({read(){}}),Wu=()=>new ge({write(){}}),Gu=()=>new pe({read(){},write(){}}),Ku=async(e,t,n)=>xs(e,t,n),qu=(e,t)=>Hc(Yu,e,t,!1),Q=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${Zs[e]}.`)},Ju={fileNumber:Q,generator:Hl,asyncGenerator:Hl,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){let r=t||n,i=pe.fromWeb(e,{objectMode:r});return{stream:i}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Yu={input:{...Ju,fileUrl:({value:e})=>({stream:ce(e)}),filePath:({value:{file:e}})=>({stream:ce(e)}),webStream:({value:e})=>({stream:O.fromWeb(e)}),iterable:({value:e})=>({stream:O.from(e)}),asyncIterable:({value:e})=>({stream:O.from(e)}),string:({value:e})=>({stream:O.from(e)}),uint8Array:({value:e})=>({stream:O.from(ve.from(e))})},output:{...Ju,fileUrl:({value:e})=>({stream:le(e)}),filePath:({value:{file:e,append:t}})=>({stream:le(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:ge.fromWeb(e)}),iterable:Q,asyncIterable:Q,string:Q,uint8Array:Q}};function Xu(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)nd(t);let t=e.some(({readableObjectMode:e})=>e),n=Zu(e,t),r=new Qu({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(let t of e)r.add(t);return r}const Zu=(e,t)=>{if(e.length===0)return _e(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)};var Qu=class extends me{#streams=new Set([]);#ended=new Set([]);#aborted=new Set([]);#onFinished;#unpipeEvent=Symbol(`unpipe`);#streamPromises=new WeakMap;add(e){if(nd(e),this.#streams.has(e))return;this.#streams.add(e),this.#onFinished??=$u(this,this.#streams,this.#unpipeEvent);let t=rd({passThroughStream:this,stream:e,streams:this.#streams,ended:this.#ended,aborted:this.#aborted,onFinished:this.#onFinished,unpipeEvent:this.#unpipeEvent});this.#streamPromises.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(nd(e),!this.#streams.has(e))return!1;let t=this.#streamPromises.get(e);return t===void 0?!1:(this.#streamPromises.delete(e),e.unpipe(this),await t,!0)}};const $u=async(e,t,n)=>{pd(e,md);let r=new AbortController;try{await Promise.race([ed(e,r),td(e,t,n,r)])}finally{r.abort(),pd(e,-md)}},ed=async(e,{signal:t})=>{try{await D(e,{signal:t,cleanup:!0})}catch(t){throw cd(e,t),t}},td=async(e,t,n,{signal:r})=>{for await(let[i]of ie(e,`unpipe`,{signal:r}))t.has(i)&&i.emit(n)},nd=e=>{if(typeof e?.pipe!=`function`)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},rd=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:a,unpipeEvent:o})=>{pd(e,hd);let s=new AbortController;try{await Promise.race([id(a,t,s),ad({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:s}),od({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:s})])}finally{s.abort(),pd(e,-hd)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?ud(e):sd(e))},id=async(e,t,{signal:n})=>{try{await e,n.aborted||ud(t)}catch(e){n.aborted||cd(t,e)}},ad=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:{signal:a}})=>{try{await D(t,{signal:a,cleanup:!0,readable:!0,writable:!1}),n.has(t)&&r.add(t)}catch(r){if(a.aborted||!n.has(t))return;ld(r)?i.add(t):dd(e,r)}},od=async({stream:e,streams:t,ended:n,aborted:r,unpipeEvent:i,controller:{signal:a}})=>{if(await E(e,i,{signal:a}),!e.readable)return E(a,`abort`,{signal:a});t.delete(e),n.delete(e),r.delete(e)},sd=e=>{e.writable&&e.end()},cd=(e,t)=>{ld(t)?ud(e):dd(e,t)},ld=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,ud=e=>{(e.readable||e.writable)&&e.destroy()},dd=(e,t)=>{e.destroyed||(e.once(`error`,fd),e.destroy(t))},fd=()=>{},pd=(e,t)=>{let n=e.getMaxListeners();n!==0&&n!==1/0&&e.setMaxListeners(n+t)},md=2,hd=1,gd=(e,t)=>{e.pipe(t),_d(e,t),yd(e,t)},_d=async(e,t)=>{if(!(M(e)||M(t))){try{await D(e,{cleanup:!0,readable:!0,writable:!1})}catch{}vd(t)}},vd=e=>{e.writable&&e.end()},yd=async(e,t)=>{if(!(M(e)||M(t))){try{await D(t,{cleanup:!0,readable:!1,writable:!0})}catch{}bd(e)}},bd=e=>{e.readable&&e.destroy()},xd=(e,t,n)=>{let r=new Map;for(let[i,{stdioItems:a,direction:o}]of Object.entries(t)){for(let{stream:t}of a.filter(({type:e})=>K.has(e)))Sd(e,t,o,i);for(let{stream:t}of a.filter(({type:e})=>!K.has(e)))wd({subprocess:e,stream:t,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(let[e,t]of r.entries()){let n=t.length===1?t[0]:Xu(t);gd(n,e)}},Sd=(e,t,n,r)=>{n===`output`?gd(e.stdio[r],t):gd(t,e.stdio[r]);let i=Cd[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},Cd=[`stdin`,`stdout`,`stderr`],wd=({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:a})=>{if(t===void 0)return;Td(t,a);let[o,s]=n===`output`?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(o)??[];i.set(o,[...c,s])},Td=(e,{signal:t})=>{M(e)&&_i(e,Ed,t)},Ed=2,Dd=(e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;let a=i(()=>{e.kill()});re(r,()=>{a()})},Od=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=Wn(),{destination:o,destinationStream:s,destinationError:c,from:l,unpipeSignal:u}=kd(n,r,i),{sourceStream:d,sourceError:f}=Md(e,l),{options:p,fileDescriptors:m}=B.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:s,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:a}},kd=(e,t,n)=>{try{let{destination:r,pipeOptions:{from:i,to:a,unpipeSignal:o}={}}=Ad(e,t,...n),s=si(r,a);return{destination:r,destinationStream:s,from:i,unpipeSignal:o}}catch(e){return{destinationError:e}}},Ad=(e,t,n,...r)=>{if(Array.isArray(n)){let i=t(jd,e)(n,...r);return{destination:i,pipeOptions:e}}if(typeof n==`string`||n instanceof URL||xe(n)){if(Object.keys(e).length>0)throw TypeError(`Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).`);let[i,a,o]=Ce(n,...r),s=t(jd)(i,a,o);return{destination:s,pipeOptions:o}}if(B.has(n)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},jd=({options:e})=>({options:{...e,stdin:`pipe`,piped:!0}}),Md=(e,t)=>{try{let n=ci(e,t);return{sourceStream:n}}catch(e){return{sourceError:e}}},Nd=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:a,startTime:o})=>{let s=Pd({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(s!==void 0)throw Fd({error:s,fileDescriptors:i,sourceOptions:a,startTime:o})},Pd=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return bd(e),r;if(t!==void 0)return vd(n),t},Fd=({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>ns({error:e,command:Id,escapedCommand:Id,fileDescriptors:t,options:n,startTime:r,isSync:!1}),Id=`source.pipe(destination)`,Ld=async e=>{let[{status:t,reason:n,value:r=n},{status:i,reason:a,value:o=a}]=await e;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i===`rejected`)throw o;if(t===`rejected`)throw r;return o},Rd=(e,t,n)=>{let r=Hd.has(t)?Bd(e,t):zd(e,t);return _i(e,Ud,n.signal),_i(t,Wd,n.signal),Vd(t),r},zd=(e,t)=>{let n=Xu([e]);return gd(n,t),Hd.set(t,n),n},Bd=(e,t)=>{let n=Hd.get(t);return n.add(e),n},Vd=async e=>{try{await D(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Hd.delete(e)},Hd=new WeakMap,Ud=2,Wd=1,Gd=(e,t)=>e===void 0?[]:[Kd(e,t)],Kd=async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:a})=>{await d(e,t),await n.remove(t);let o=Error("Pipe canceled by `unpipeSignal` option.");throw Fd({error:o,fileDescriptors:r,sourceOptions:i,startTime:a})},qd=(e,...t)=>{if(k(t[0]))return qd.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:n,...r}=Od(e,...t),i=Jd({...r,destination:n});return i.pipe=qd.bind(void 0,{...e,source:n,sourcePromise:i,boundOptions:{}}),i},Jd=async({sourcePromise:e,sourceStream:t,sourceOptions:n,sourceError:r,destination:i,destinationStream:a,destinationError:o,unpipeSignal:s,fileDescriptors:c,startTime:l})=>{let u=Yd(e,i);Nd({sourceStream:t,sourceError:r,destinationStream:a,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});let d=new AbortController;try{let e=Rd(t,a,d);return await Promise.race([Ld(u),...Gd(s,{sourceStream:t,mergedStream:e,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Yd=(e,t)=>Promise.allSettled([e,t]),Xd=({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:a})=>{let o=new AbortController;return Zd(t,o),ef({stream:e,controller:o,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:a})},Zd=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Qd=({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:a})=>{let o=new AbortController;$d(t,o,e);let s=e.readableObjectMode&&!a;return ef({stream:e,controller:o,binary:r===`buffer`,shouldEncode:!s,encoding:r,shouldSplit:!s&&n,preserveNewlines:!i})},$d=async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},ef=({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})=>{let s=ie(e,`data`,{signal:t.signal,highWaterMark:nf,highWatermark:nf});return rf({onStdoutChunk:s,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})},tf=_e(!0),nf=tf,rf=async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}){let s=af({binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o});try{for await(let[t]of e)yield*X(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*zl(s)}},af=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[Dl(e,n,!t),cl(e,i,!r,{})].filter(Boolean),sf=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,buffer:i,maxBuffer:a,lines:o,allMixed:s,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=cf({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:s,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([lf(e),d]);return}let f=sl(c,n),p=Qd({stream:e,onStreamEnd:t,lines:o,encoding:r,stripFinalNewline:f,allMixed:s}),[m]=await Promise.all([uf({stream:e,iterable:p,fdNumber:n,encoding:r,maxBuffer:a,lines:o}),d]);return m},cf=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:a,streamInfo:{fileDescriptors:o}})=>{if(!Xl({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n}))return;let s=Qd({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i});await $l(s,e,n,a)},lf=async e=>{await ee(),e.readableFlowing===null&&e.resume()},uf=async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:a,lines:o})=>{try{return t||o?await po(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await vo(n,{maxBuffer:a})):await No(n,{maxBuffer:a})}catch(n){return ff(Bo({error:n,stream:e,readableObjectMode:t,lines:o,encoding:i,fdNumber:r}))}},df=async e=>{try{return await e}catch(e){return ff(e)}},ff=({bufferedData:e})=>Te(e)?new Uint8Array(e):e,pf=async(e,t,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{let a=mf(e,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],D(e,{cleanup:!0,signal:o.signal})])}catch(e){a.stdinCleanedUp||_f(e,t,n,r)}finally{o.abort()}},mf=(e,{originalStreams:[t],subprocess:n})=>{let r={stdinCleanedUp:!1};return e===t&&hf(e,n,r),r},hf=(e,t,n)=>{let{_destroy:r}=e;e._destroy=(...i)=>{gf(t,n),r.call(e,...i)}},gf=({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},_f=(e,t,n,r)=>{if(!vf(e,t,n,r))throw e},vf=(e,t,n,r=!0)=>n.propagating?xf(e)||bf(e):(n.propagating=!0,yf(n,t)===r?xf(e):bf(e)),yf=({fileDescriptors:e},t)=>t!==`all`&&e[t].direction===`input`,bf=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,xf=e=>e?.code===`EPIPE`,Sf=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>e.stdio.map((e,c)=>Cf({stream:e,fdNumber:c,encoding:t,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:a,verboseInfo:o,streamInfo:s})),Cf=async({stream:e,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=pf(e,t,l);if(yf(l,t)){await u;return}let[d]=await Promise.all([sf({stream:e,onStreamEnd:u,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l}),u]);return d},wf=({stdout:e,stderr:t},{all:n})=>n&&(e||t)?Xu([e,t].filter(Boolean)):void 0,Tf=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>Cf({...Ef(e,n),fdNumber:`all`,encoding:t,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Df(e),stripFinalNewline:a,verboseInfo:o,streamInfo:s}),Ef=({stdout:e,stderr:t,all:n},[,r,i])=>{let a=r||i;return a?r?i?{stream:n,buffer:a}:{stream:e,buffer:a}:{stream:t,buffer:a}:{stream:n,buffer:a}},Df=({all:e,stdout:t,stderr:n})=>e&&t&&n&&t.readableObjectMode!==n.readableObjectMode,Of=e=>ct(e,`ipc`),kf=(e,t)=>{let n=Ln(e);Nn({type:`ipc`,verboseMessage:n,fdNumber:`ipc`,verboseInfo:t})},Af=async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:a})=>{if(!r)return i;let o=Of(a),s=P(t,`ipc`),c=P(n,`ipc`);for await(let t of Nu({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))s&&(Ho(e,i,c),i.push(t)),o&&kf(t,a);return i},jf=async(e,t)=>(await Promise.allSettled([e]),t),Mf=async({subprocess:e,options:{encoding:t,buffer:n,maxBuffer:r,lines:i,timeoutDuration:a,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:_})=>{let v=uu(e,f),y={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:v,propagating:!1},b=Sf({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),x=Tf({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),S=[],C=Af({subprocess:e,buffer:n,maxBuffer:r,ipc:u,ipcOutput:S,verboseInfo:p}),w=Nf(h,e,y),ee=Pf(m,y);try{return await Promise.race([Promise.all([{},pu(v),Promise.all(b),x,C,va(e,d),...w,...ee]),g,Ff(e,_),...ua(e,a,f,_),...Hr({subprocess:e,cancelSignal:o,gracefulCancel:s,context:f,controller:_}),...oa({subprocess:e,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,context:f,controller:_})])}catch(e){return f.terminationReason??=`other`,Promise.all([{error:e},v,Promise.all(b.map(e=>df(e))),df(x),jf(C,S),Promise.allSettled(w),Promise.allSettled(ee)])}},Nf=(e,t,n)=>e.map((e,r)=>e===t.stdio[r]?void 0:pf(e,r,n)),Pf=(e,t)=>e.flatMap(({stdioItems:e},n)=>e.filter(({value:e,stream:t=e})=>U(t,{checkOpen:!1})&&!M(t)).map(({type:e,value:r,stream:i=r})=>pf(i,n,t,{isSameDirection:K.has(e),stopOnExit:e===`native`}))),Ff=async(e,{signal:t})=>{let[n]=await E(e,`error`,{signal:t});throw n},If=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Lf=(e,t,n)=>{let r=e[n];r.has(t)||r.set(t,[]);let i=r.get(t),a=z();i.push(a);let o=a.resolve.bind(a);return{resolve:o,promises:i}},Rf=async({resolve:e,promises:t},n)=>{e();let[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r},zf=async e=>{if(e!==void 0)try{await Vf(e)}catch{}},Bf=async e=>{if(e!==void 0)try{await Hf(e)}catch{}},Vf=async e=>{await D(e,{cleanup:!0,readable:!1,writable:!0})},Hf=async e=>{await D(e,{cleanup:!0,readable:!0,writable:!1})},Uf=async(e,t)=>{if(await e,t)throw t},Wf=(e,t,n)=>{n&&!bf(n)?e.destroy(n):t&&e.destroy()},Gf=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,binary:i=!0,preserveNewlines:a=!0}={})=>{let o=i||H.has(n),{subprocessStdout:s,waitReadableDestroy:c}=Kf(e,r,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=qf(s,o),{read:p,onStdoutDataDone:m}=Jf({subprocessStdout:s,subprocess:e,binary:o,encoding:n,preserveNewlines:a}),h=new O({read:p,destroy:f(Zf.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return Xf({subprocessStdout:s,onStdoutDataDone:m,readable:h,subprocess:e}),h},Kf=(e,t,n)=>{let r=ci(e,t),i=Lf(n,r,`readableDestroy`);return{subprocessStdout:r,waitReadableDestroy:i}},qf=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:tf},Jf=({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{let a=z(),o=Xd({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){Yf(this,o,a)},onStdoutDataDone:a}},Yf=async(e,t,n)=>{try{let{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},Xf=async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await Hf(e),await r,await zf(i),await t,n.readable&&n.push(null)}catch(e){await zf(i),Qf(n,e)}},Zf=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await Rf(n,t)&&(Qf(e,r),await Uf(t,r))},Qf=(e,t)=>{Wf(e,e.readable,t)},$f=({subprocess:e,concurrentStreams:t},{to:n}={})=>{let{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:a}=ep(e,n,t),o=new ge({...tp(r,e,i),destroy:f(ap.bind(void 0,{subprocessStdin:r,subprocess:e,waitWritableFinal:i,waitWritableDestroy:a})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return ip(r,o),o},ep=(e,t,n)=>{let r=si(e,t),i=Lf(n,r,`writableFinal`),a=Lf(n,r,`writableDestroy`);return{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:a}},tp=(e,t,n)=>({write:np.bind(void 0,e),final:f(rp.bind(void 0,e,t,n))}),np=(e,t,n,r)=>{e.write(t,n)?r():e.once(`drain`,r)},rp=async(e,t,n)=>{await Rf(n,t)&&(e.writable&&e.end(),await t)},ip=async(e,t,n)=>{try{await Vf(e),t.writable&&t.end()}catch(e){await Bf(n),op(t,e)}},ap=async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await Rf(n,t),await Rf(r,t)&&(op(e,i),await Uf(t,i))},op=(e,t)=>{Wf(e,e.writable,t)},sp=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,to:i,binary:a=!0,preserveNewlines:o=!0}={})=>{let s=a||H.has(n),{subprocessStdout:c,waitReadableDestroy:l}=Kf(e,r,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:p}=ep(e,i,t),{readableEncoding:m,readableObjectMode:h,readableHighWaterMark:g}=qf(c,s),{read:_,onStdoutDataDone:v}=Jf({subprocessStdout:c,subprocess:e,binary:s,encoding:n,preserveNewlines:o}),y=new pe({read:_,...tp(u,e,d),destroy:f(cp.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:g,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:m});return Xf({subprocessStdout:c,onStdoutDataDone:v,readable:y,subprocess:e,subprocessStdin:u}),ip(u,y,c),y},cp=async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:a},o)=>{await Promise.all([Zf({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},o),ap({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:a},o)])},lp=(e,t,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{let a=r||H.has(t),o=ci(e,n),s=Xd({subprocessStdout:o,subprocess:e,binary:a,shouldEncode:!0,encoding:t,preserveNewlines:i});return up(s,o,e)},up=async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}},dp=(e,{encoding:t})=>{let n=If();e.readable=Gf.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=$f.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=sp.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.iterable=lp.bind(void 0,e,t),e[Symbol.asyncIterator]=lp.bind(void 0,e,t,{})},fp=(e,t)=>{for(let[n,r]of mp){let i=r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},pp=(async()=>{})().constructor.prototype,mp=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(pp,e)]),hp=(e,t,n,r)=>{let{file:i,commandArguments:a,command:o,escapedCommand:s,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=gp(e,t,n),{subprocess:f,promise:p}=vp({file:i,commandArguments:a,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:s,fileDescriptors:d});return f.pipe=qd.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:r}),fp(f,p),B.set(f,{options:u,fileDescriptors:d}),f},gp=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Kn(e,t,n),{file:s,commandArguments:c,options:l}=ka(e,t,n),u=_p(l),d=qu(u,o);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:d}},_p=({timeout:e,signal:t,...n})=>{if(t!==void 0)throw TypeError(`The "signal" option has been renamed to "cancelSignal" instead.`);return{...n,timeoutDuration:e}},vp=({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:i,command:a,escapedCommand:o,fileDescriptors:s})=>{let l;try{l=c(...Ma(e,t,n))}catch(e){return Vu({error:e,command:a,escapedCommand:o,fileDescriptors:s,options:n,startTime:r,verboseInfo:i})}let u=new AbortController;ae(1/0,u.signal);let d=[...l.stdio];xd(l,s,u),Dd(l,n,u);let f={},p=z();l.kill=Fr.bind(void 0,{kill:l.kill.bind(l),options:n,onInternalError:p,context:f,controller:u}),l.all=wf(l,n),dp(l,n),Ru(l,n);let m=yp({subprocess:l,options:n,startTime:r,verboseInfo:i,fileDescriptors:s,originalStreams:d,command:a,escapedCommand:o,context:f,onInternalError:p,controller:u});return{subprocess:l,promise:m}},yp=async({subprocess:e,options:t,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:a,command:o,escapedCommand:s,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await Mf({subprocess:e,options:t,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:a,onInternalError:l,controller:u});u.abort(),l.resolve();let _=m.map((e,n)=>Y(e,t,n)),v=Y(h,t,`all`),y=bp({errorInfo:d,exitCode:f,signal:p,stdio:_,all:v,ipcOutput:g,context:c,options:t,command:o,escapedCommand:s,startTime:n});return xs(y,r,t)},bp=({errorInfo:e,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,context:o,options:s,command:c,escapedCommand:l,startTime:u})=>`error`in e?rs({error:e.error,command:c,escapedCommand:l,timedOut:o.terminationReason===`timeout`,isCanceled:o.terminationReason===`cancel`||o.terminationReason===`gracefulCancel`,isGracefullyCanceled:o.terminationReason===`gracefulCancel`,isMaxBuffer:e.error instanceof so,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):ts({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:a,options:s,startTime:u}),xp=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>[t,Sp(t,e[t],n)]));return{...e,...n}},Sp=(e,t,n)=>Cp.has(e)&&k(t)&&k(n)?{...t,...n}:n,Cp=new Set([`env`,...ot]),$=(e,t,n,r)=>{let i=(e,t,r)=>$(e,t,n,r),a=(...a)=>wp({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a);return r!==void 0&&r(a,i,t),a},wp=({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},a,...o)=>{if(k(a))return i(e,xp(n,a),r);let{file:s,commandArguments:c,options:l,isSync:u}=Tp({mapArguments:e,firstArgument:a,nextArguments:o,deepOptions:t,boundOptions:n});return u?vu(s,c,l):hp(s,c,l,i)},Tp=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let a=Ie(t)?Le(t,n):[t,...n],[o,s,c]=Ce(...a),l=xp(xp(r,i),c),{file:u=o,commandArguments:d=s,options:f=l,isSync:p=!1}=e({file:o,commandArguments:s,options:l});return{file:u,commandArguments:d,options:f,isSync:p}},Ep=({file:e,commandArguments:t})=>Op(e,t),Dp=({file:e,commandArguments:t})=>({...Op(e,t),isSync:!0}),Op=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[n,...r]=kp(e);return{file:n,commandArguments:r}},kp=e=>{if(typeof e!=`string`)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t===``)return[];let n=[];for(let e of t.split(Ap)){let t=n.at(-1);t&&t.endsWith(`\\`)?n[n.length-1]=`${t.slice(0,-1)} ${e}`:n.push(e)}return n},Ap=/ +/g,jp=(e,t,n)=>{e.sync=t(Np,n),e.s=e.sync},Mp=({options:e})=>Pp(e),Np=({options:e})=>({...Pp(e),isSync:!0}),Pp=e=>({options:{...Fp(e),...e}}),Fp=({input:e,inputFile:t,stdio:n})=>e===void 0&&t===void 0&&n===void 0?{stdin:`inherit`}:{},Ip={preferLocal:!0},Lp=$(()=>({})),Rp=$(()=>({isSync:!0})),zp=$(Ep),Bp=$(Dp),Vp=$(fa),Hp=$(Mp,{},Ip,jp),{sendMessage:Up,getOneMessage:Wp,getEachMessage:Gp,getCancelSignal:Kp}=zu();var qp={};e(qp,{builder:()=>tm,command:()=>Jp,description:()=>Yp});const Jp=`git`,Yp=``,Xp=process.cwd();function Zp(){try{return!!Rp(`git`,[`--version`],{cwd:Xp}).stdout}catch{throw Error(`git is not installed`)}}function Qp(){try{return Rp(`git`,[`rev-parse`,`--is-inside-work-tree`],{cwd:Xp}).stdout===`true`}catch{throw Error(`not a git repository`)}}function $p(){return Lp(`git`,[`config`,`core.hooksPath`,`.githooks`],{cwd:Xp})}function em(){try{return Zp()&&Qp()}catch(e){return console.error(`Fail:`,e.message),!1}}function tm(e){e.command(`hooks`,`Set .githooks as git.hooksPath`,{},()=>{em()&&$p().then(()=>{console.log(`Done: set .githooks`)}).catch(()=>{console.error(`Fail:`,`setting hooks failed`),process.exitCode=1})}),e.demandCommand(1,"Typing `hooks`")}export{tm as builder$1,Jp as command$1,Yp as description$1,Lp as execa,qp as git_hooks_exports};
|