@nice-move/cli 0.11.31 → 0.11.32
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-BD7HfmW0.mjs +1 -0
- package/dist/{cli-truncate-D08h2JlU.mjs → cli-truncate-61rlXElX.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/cmd/git.mjs +1 -1
- package/dist/cmd/lint.mjs +1 -1
- package/dist/git-hooks-CZK05VMP.mjs +35 -0
- package/dist/lib-BI92cQxl.mjs +43 -0
- package/dist/{lib-7I1NoRZ3.mjs → lib-DyylIeSq.mjs} +1 -1
- package/dist/lint-B722qPF1.mjs +116 -0
- package/dist/lint-C7aukiMw.mjs +1 -0
- package/dist/{log-update-BTynwCnX.mjs → log-update-DUXk7rhY.mjs} +1 -1
- package/dist/{path-key-DjAVgzm2.mjs → path-key-_mkIRVBk.mjs} +1 -1
- package/dist/{string-width-BcVmQkTo.mjs → string-width-HBt3xzMc.mjs} +1 -1
- package/dist/{wrap-ansi-BT78d4D8.mjs → wrap-ansi-HBdkTv8z.mjs} +1 -1
- package/package.json +3 -3
- package/dist/chunk-tuRmWmEN.mjs +0 -1
- package/dist/execa-CFcZKRhQ.mjs +0 -35
- package/dist/lib-8Gx3YkdY.mjs +0 -43
- package/dist/lint-C8XlgPsV.mjs +0 -116
- package/dist/staged-dkPXnLdU.mjs +0 -1
- /package/dist/{mjs-Cl59bDdr.mjs → mjs-CsQ9gy60.mjs} +0 -0
package/dist/execa-CFcZKRhQ.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./chunk-tuRmWmEN.mjs";import{n as t,t as n}from"./path-key-DjAVgzm2.mjs";import{t as r}from"./mjs-Cl59bDdr.mjs";import{fileURLToPath as i}from"node:url";import{ChildProcess as a,execFile as o,spawn as s,spawnSync as c}from"node:child_process";import{StringDecoder as l}from"node:string_decoder";import{aborted as u,callbackify as d,debuglog as f,inspect as p,promisify as m,stripVTControlCharacters as h}from"node:util";import g,{execArgv as _,execPath as v,hrtime as y,platform as b}from"node:process";import x from"node:tty";import S from"node:path";import{scheduler as C,setImmediate as ee,setTimeout as w}from"node:timers/promises";import{constants as T}from"node:os";import{EventEmitter as te,addAbortListener as ne,on as re,once as E,setMaxListeners as ie}from"node:events";import{serialize as ae}from"node:v8";import{appendFileSync as oe,createReadStream as se,createWriteStream as ce,readFileSync as le,statSync as ue,writeFileSync as de}from"node:fs";import{finished as D}from"node:stream/promises";import{Duplex as fe,PassThrough as pe,Readable as O,Transform as me,Writable as he,getDefaultHighWaterMark as ge}from"node:stream";import{Buffer as _e}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 ve=(e,t)=>{let n=xe(ye(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},ye=e=>be(e)?e.toString():e,be=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,xe=e=>e instanceof URL?i(e):e,Se=(e,t=[],n={})=>{let r=ve(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:Ce}=Object.prototype,we=e=>Ce.call(e)===`[object ArrayBuffer]`,A=e=>Ce.call(e)===`[object Uint8Array]`,j=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Te=new TextEncoder,Ee=e=>Te.encode(e),De=new TextDecoder,Oe=e=>De.decode(e),ke=(e,t)=>Ae(e,t).join(``),Ae=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new l(t),r=e.map(e=>typeof e==`string`?Ee(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},je=e=>e.length===1&&A(e[0])?e[0]:Ne(Me(e)),Me=e=>e.map(e=>typeof e==`string`?Ee(e):e),Ne=e=>{let t=new Uint8Array(Pe(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},Pe=e=>{let t=0;for(let n of e)t+=n.length;return t},Fe=e=>Array.isArray(e)&&Array.isArray(e.raw),Ie=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Le({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,{}]},Le=({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}=Re(i,e.raw[r]),c=Ve(n,a,o);if(r===t.length)return c;let l=t[r];return Ve(c,Array.isArray(l)?l.map(e=>He(e)):[He(l)],s)},Re=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=ze.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(ze.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+=Be[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},ze=new Set([` `,` `,`\r`,`
|
|
3
|
-
`]),Be={x:3,u:5},Ve=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],He=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 Ue(e);throw e instanceof a||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`)},Ue=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return Oe(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=>We.includes(e),We=[g.stdin,g.stdout,g.stderr],N=[`stdin`,`stdout`,`stderr`],Ge=e=>N[e]??`stdio[${e}]`,Ke=e=>{let t={...e};for(let n of it)t[n]=qe(e,n);return t},qe=(e,t)=>{let n=Array.from({length:Je(e)+1});return nt(Ye(e[t],n,t),t)},Je=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,Ye=(e,t,n)=>k(e)?Xe(e,t,n):t.fill(e),Xe=(e,t,n)=>{for(let r of Object.keys(e).sort(Ze))for(let i of $e(r,n,t))t[i]=e[r];return t},Ze=(e,t)=>Qe(e)<Qe(t)?1:-1,Qe=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,$e=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=et(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]},et=e=>{if(e===`all`)return e;if(N.includes(e))return N.indexOf(e);let t=tt.exec(e);if(t!==null)return Number(t[1])},tt=/^fd(\d+)$/,nt=(e,t)=>e.map(e=>e===void 0?rt[t]:e),rt={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:f(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},it=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],at=(e,t)=>t===`ipc`?e.at(-1):e[t],ot=({verbose:e},t)=>lt(e,t)!==`none`,st=({verbose:e},t)=>![`none`,`short`].includes(lt(e,t)),ct=({verbose:e},t)=>{let n=lt(e,t);return dt(n)?n:void 0},lt=(e,t)=>t===void 0?ut(e):at(e,t),ut=e=>e.find(e=>dt(e))??ft.findLast(t=>e.includes(t)),dt=e=>typeof e==`function`,ft=[`none`,`short`,`full`],pt=(e,t)=>{let n=[e,...t];return{command:n.join(` `),escapedCommand:n.map(e=>bt(ht(e))).join(` `)}},mt=e=>h(e).split(`
|
|
6
|
-
`).map(e=>ht(e)).join(`
|
|
7
|
-
`),ht=e=>e.replaceAll(_t,e=>gt(e)),gt=e=>{let t=vt[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=yt?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},_t=(()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),vt={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},yt=65535,bt=e=>xt.test(e)?e:b===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,xt=/^[\w./-]+$/;function St(){let{env:e}=g,{TERM:t,TERM_PROGRAM:n}=e;return g.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 Ct={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:`╱`},wt={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:`⅒`},Tt={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`},Et={...Ct,...wt},Dt={...Ct,...Tt},Ot=St()?Et:Dt;Object.entries(wt);const kt=x?.WriteStream?.prototype?.hasColors?.()??!1,P=(e,t)=>{if(!kt)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}};P(0,0);const At=P(1,22);P(2,22),P(3,23),P(4,24),P(53,55),P(7,27),P(8,28),P(9,29),P(30,39),P(31,39),P(32,39),P(33,39),P(34,39),P(35,39),P(36,39),P(37,39);const jt=P(90,39);P(40,49),P(41,49),P(42,49),P(43,49),P(44,49),P(45,49),P(46,49),P(47,49),P(100,49);const Mt=P(91,39);P(92,39);const Nt=P(93,39);P(94,39),P(95,39),P(96,39),P(97,39),P(101,49),P(102,49),P(103,49),P(104,49),P(105,49),P(106,49),P(107,49);const Pt=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=Ft(n),c=Rt[e]({failed:a,reject:o,piped:r}),l=Bt[e]({reject:o});return`${jt(`[${s}]`)} ${jt(`[${i}]`)} ${l(c)} ${l(t)}`},Ft=e=>`${It(e.getHours(),2)}:${It(e.getMinutes(),2)}:${It(e.getSeconds(),2)}.${It(e.getMilliseconds(),3)}`,It=(e,t)=>String(e).padStart(t,`0`),Lt=({failed:e,reject:t})=>e?t?Ot.cross:Ot.warning:Ot.tick,Rt={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:Lt,duration:Lt},zt=e=>e,Bt={command:()=>At,output:()=>zt,ipc:()=>zt,error:({reject:e})=>e?Mt:Nt,duration:()=>jt},Vt=(e,t,n)=>{let r=ct(t,n);return e.map(({verboseLine:e,verboseObject:t})=>Ht(e,t,r)).filter(e=>e!==void 0).map(e=>Ut(e)).join(``)},Ht=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},Ut=e=>e.endsWith(`
|
|
8
|
-
`)?e:`${e}\n`,F=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=Vt(Gt(t,Wt({type:e,result:i,verboseInfo:r})),r,n);a!==``&&console.warn(a.slice(0,-1))},Wt=({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}),Gt=(e,t)=>e.split(`
|
|
9
|
-
`).map(e=>Kt({...t,message:e})),Kt=e=>({verboseLine:Pt(e),verboseObject:e}),qt=e=>mt(typeof e==`string`?e:p(e)).replaceAll(` `,` `.repeat(Jt)),Jt=2,Yt=(e,t)=>{ot(t)&&F({type:`command`,verboseMessage:e,verboseInfo:t})},Xt=(e,t,n)=>($t(e),{verbose:e,escapedCommand:t,commandId:Zt(e),rawOptions:n}),Zt=e=>ot({verbose:e})?Qt++:void 0;let Qt=0n;const $t=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(!ft.includes(t)&&!dt(t)){let e=ft.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},en=()=>y.bigint(),tn=e=>Number(y.bigint()-e)/1e6,nn=(e,t,n)=>{let r=en(),{command:i,escapedCommand:a}=pt(e,t),o=Xt(qe(n,`verbose`),a,{...n});return Yt(a,o),{command:i,escapedCommand:a,startTime:r,verboseInfo:o}};m(o);function rn(e){return e instanceof URL?i(e):e}function an(e){return{*[Symbol.iterator](){let t=S.resolve(rn(e)),n;for(;n!==t;)yield t,n=t,t=S.resolve(t,`..`)}}}const on=({cwd:e=g.cwd(),path:t=g.env[n()],preferLocal:r=!0,execPath:i=g.execPath,addExecPath:a=!0}={})=>{let o=S.resolve(rn(e)),s=[],c=t.split(S.delimiter);return r&&sn(s,c,o),a&&cn(s,c,i,o),t===``||t===S.delimiter?`${s.join(S.delimiter)}${t}`:[...s,t].join(S.delimiter)},sn=(e,t,n)=>{for(let r of an(n)){let n=S.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},cn=(e,t,n,r)=>{let i=S.resolve(r,rn(n),`..`);t.includes(i)||e.push(i)},ln=({env:e=g.env,...t}={})=>{e={...e};let r=n({env:e});return t.path=e[r],e[r]=on(t),e},un=(e,t,n)=>new(n?gn:hn)(t,e instanceof I?{}:{cause:e});var I=class extends Error{};const dn=(e,t)=>{Object.defineProperty(e.prototype,`name`,{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,pn,{value:!0,writable:!1,enumerable:!1,configurable:!1})},fn=e=>mn(e)&&pn in e,pn=Symbol(`isExecaError`),mn=e=>Object.prototype.toString.call(e)===`[object Error]`;var hn=class extends Error{};dn(hn,hn.name);var gn=class extends Error{};dn(gn,gn.name);const _n=()=>{let e=bn-yn+1;return Array.from({length:e},vn)},vn=(e,t)=>({name:`SIGRT${t+1}`,number:yn+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),yn=34,bn=64,xn=[{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`}],Sn=()=>{let e=_n();return[...xn,...e].map(Cn)},Cn=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=T,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}},wn=()=>{let e=Sn();return Object.fromEntries(e.map(Tn))},Tn=({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}],En=wn(),Dn=()=>{let e=Sn(),t=Array.from({length:65},(t,n)=>On(n,e));return Object.assign({},...t)},On=(e,t)=>{let n=kn(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}}},kn=(e,t)=>{let n=t.find(({name:t})=>T.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};Dn();const An=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return Mn(e,t)},jn=e=>e===0?e:Mn(e,"`subprocess.kill()`'s argument"),Mn=(e,t)=>{if(Number.isInteger(e))return Nn(e,t);if(typeof e==`string`)return Fn(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${In()}`)},Nn=(e,t)=>{if(Pn.has(e))return Pn.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${In()}`)},Pn=new Map(Object.entries(T.signals).reverse().map(([e,t])=>[t,e])),Fn=(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${In()}`)},In=()=>`Available signal names: ${Ln()}.
|
|
10
|
-
Available signal numbers: ${Rn()}.`,Ln=()=>Object.keys(T.signals).sort().map(e=>`'${e}'`).join(`, `),Rn=()=>[...new Set(Object.values(T.signals).sort((e,t)=>e-t))].join(`, `),zn=e=>En[e].description,Bn=e=>{if(e===!1)return e;if(e===!0)return Vn;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Vn=1e3*5,Hn=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Un(o,s,n);Wn(l,r);let u=e(c);return Gn({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Un=(e,t,n)=>{let[r=n,i]=mn(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&&!mn(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:jn(r),error:i}},Wn=(e,t)=>{e!==void 0&&t.reject(e)},Gn=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&Kn({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},Kn=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await w(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},qn=async(e,t)=>{e.aborted||await E(e,`abort`,{signal:t})},Jn=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Yn=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[Xn(e,t,r,i)],Xn=async(e,t,n,{signal:r})=>{throw await qn(t,r),n.terminationReason??=`cancel`,e.kill(),t.reason},Zn=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{Qn(e,t,n),$n(e,t,r)},Qn=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},$n=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} cannot be used: the ${R(t)} has already exited or disconnected.`)},er=e=>{throw Error(`${L(`getOneMessage`,e)} could not complete: the ${R(e)} exited or disconnected.`)},tr=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
|
-
]);`)},nr=(e,t)=>Error(`${L(`sendMessage`,t)} failed when sending an acknowledgment response to the ${R(t)}.`,{cause:e}),rr=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is not listening to incoming messages.`)},ir=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} exited without listening to incoming messages.`)},ar=()=>Error(`\`cancelSignal\` aborted: the ${R(!0)} disconnected.`),or=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},sr=({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})},cr=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(lr(e))throw Error(`${L(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},lr=({code:e,message:t})=>ur.has(e)||dr.some(e=>t.includes(e)),ur=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),dr=[`could not be cloned`,`circular structure`,`call stack size exceeded`],L=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${fr(t)}${e}(${n})`,fr=e=>e?``:`subprocess.`,R=e=>e?`parent process`:`subprocess`,pr=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)},mr=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=B.get(e),i=gr(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(yr(i,t,n,!0));return a},hr=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=B.get(e),i=gr(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(yr(i,t,n,!1));return a},B=new WeakMap,gr=(e,t,n)=>{let r=_r(t,n);return vr(r,t,n,e),r},_r=(e,t)=>{let n=et(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(`"${V(t)}" must not be "${e}".
|
|
17
|
-
It must be ${r} or "fd3", "fd4" (and so on).
|
|
18
|
-
It is optional and defaults to "${i}".`)},vr=(e,t,n,r)=>{let i=r[xr(e)];if(i===void 0)throw TypeError(`"${V(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(`"${V(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${V(n)}" must not be ${t}. It must be a writable stream, not readable.`)},yr=(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}=br(e,n);return`The "${i}: ${Sr(a)}" option is incompatible with using "${V(r)}: ${Sr(t)}".
|
|
20
|
-
Please set this option with "pipe" instead.`},br=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=xr(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]}},xr=e=>e===`all`?1:e,V=e=>e?`to`:`from`,Sr=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,Cr=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),ne(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},wr=(e,t)=>{t&&Tr(e)},Tr=e=>{e.refCounted()},Er=(e,t)=>{t&&Dr(e)},Dr=e=>{e.unrefCounted()},Or=(e,t)=>{t&&(Dr(e),Dr(e))},kr=(e,t)=>{t&&(Tr(e),Tr(e))},Ar=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Vr(i)||si(i))return;Mr.has(e)||Mr.set(e,[]);let a=Mr.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await Yr(e,r,i),await C.yield();let o=await Br({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},jr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{li();let a=Mr.get(e);for(;a?.length>0;)await E(r,`message:done`);e.removeListener(`message`,i),kr(t,n),r.connected=!1,r.emit(`disconnect`)},Mr=new WeakMap,Nr=(e,t,n)=>{if(Pr.has(e))return Pr.get(e);let r=new te;return r.connected=!0,Pr.set(e,r),Fr({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Pr=new WeakMap,Fr=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=Ar.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,jr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Or(n,r)},Ir=e=>{let t=Pr.get(e);return t===void 0?e.channel!==null:t.connected},Lr=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=Xr(e,Nr(e,t,n));return{id:Rr++,type:Gr,message:r,hasListeners:a}};let Rr=0n;const zr=(e,t)=>{if(!(t?.type!==Gr||t.hasListeners))for(let{id:t}of e)t!==void 0&&Ur[t].resolve({isDeadlock:!0,hasListeners:!1})},Br=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==Gr||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:Kr,message:Xr(t,i)};try{await Qr({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},Vr=e=>{if(e?.type!==Kr)return!1;let{id:t,message:n}=e;return Ur[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},Hr=async(e,t,n)=>{if(e?.type!==Gr)return;let r=z();Ur[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,Wr(t,n,i)]);e&&tr(n),a||rr(n)}finally{i.abort(),delete Ur[e.id]}},Ur={},Wr=async(e,t,{signal:n})=>{Cr(e,1,n),await E(e,`disconnect`,{signal:n}),ir(t)},Gr=`execa:ipc:request`,Kr=`execa:ipc:response`,qr=(e,t,n)=>{H.has(e)||H.set(e,new Set);let r=H.get(e),i={onMessageSent:z(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},Jr=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Yr=async(e,t,n)=>{for(;!Xr(e,t)&&H.get(e)?.size>0;){let t=[...H.get(e)];zr(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},H=new WeakMap,Xr=(e,t)=>t.listenerCount(`message`)>Zr(e),Zr=e=>B.has(e)&&!at(B.get(e).options.buffer,`ipc`)?1:0,Qr=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return Zn({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),$r({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},$r=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=Lr({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=qr(e,o,a);try{await ei({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw pr(e),t}finally{Jr(s)}},ei=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=ti(e);try{await Promise.all([Hr(r,e,n),a(r)])}catch(e){throw sr({error:e,methodName:t,isSubprocess:n}),cr({error:e,methodName:t,isSubprocess:n,message:i}),e}},ti=e=>{if(ni.has(e))return ni.get(e);let t=m(e.send.bind(e));return ni.set(e,t),t},ni=new WeakMap,ri=(e,t)=>{let n=`cancelSignal`;return $n(n,!1,e.connected),ei({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:ci,message:t},message:t})},ii=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await ai({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),ui.signal),ai=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!oi){if(oi=!0,!r){or();return}if(t===null){li();return}Nr(e,t,n),await C.yield()}};let oi=!1;const si=e=>e?.type===ci?(ui.abort(e.message),!0):!1,ci=`execa:ipc:cancel`,li=()=>{ui.abort(ar())},ui=new AbortController,di=({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.")}},fi=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[pi({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],pi=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{throw await qn(t,i),await ri(e,mi(t)),Kn({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??=`gracefulCancel`,t.reason},mi=({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},hi=({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})`)},gi=(e,t,n,r)=>t===0||t===void 0?[]:[_i(e,t,n,r)],_i=async(e,t,n,{signal:r})=>{throw await w(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e.kill(),new I},vi=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},yi=(e,t,{node:n=!1,nodePath:r=v,nodeOptions:i=_.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=ve(r,`The "nodePath" option`),l=S.resolve(a,c),u={...s,nodePath:l,node:n,cwd:a};if(!n)return[e,t,u];if(S.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}]},bi=({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`.");xi[n](e)}},xi={advanced:e=>{try{ae(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},json:e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}}},Si=async(e,t)=>{t!==void 0&&await e.sendMessage(t)},Ci=({encoding:e})=>{if(Ti.has(e))return;let t=Ei(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${Oi(e)}\`.
|
|
21
|
-
Please rename it to ${Oi(t)}.`);let n=[...Ti].map(e=>Oi(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${Oi(e)}\`.
|
|
22
|
-
Please rename it to one of: ${n}.`)},wi=new Set([`utf8`,`utf16le`]),U=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),Ti=new Set([...wi,...U]),Ei=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in Di)return Di[t];if(Ti.has(t))return t},Di={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},Oi=e=>typeof e==`string`?`"${e}"`:String(e),ki=(e=Ai())=>{let t=ve(e,`The "cwd" option`);return S.resolve(t)},Ai=()=>{try{return g.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},ji=(e,t)=>{if(t===Ai())return e;let n;try{n=ue(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 Mi=e(t(),1);const Ni=(e,t,n)=>{n.cwd=ki(n.cwd);let[r,i,a]=yi(e,t,n),{command:o,args:s,options:c}=Mi.default._parse(r,i,a),l=Pi(Ke(c));return hi(l),Ci(l),bi(l),Jn(l),di(l),l.shell=xe(l.shell),l.env=Fi(l),l.killSignal=An(l.killSignal),l.forceKillAfterDelay=Bn(l.forceKillAfterDelay),l.lines=l.lines.map((e,t)=>e&&!U.has(l.encoding)&&l.buffer[t]),g.platform===`win32`&&S.basename(o,`.exe`)===`cmd`&&s.unshift(`/q`),{file:o,commandArguments:s,options:l}},Pi=({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}),Fi=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{...g.env,...e}:e;return n||r?ln({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o},Ii=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n];function Li(e){if(typeof e==`string`)return Ri(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return zi(e)}const Ri=e=>e.at(-1)===Bi?e.slice(0,e.at(-2)===Hi?-2:-1):e,zi=e=>e.at(-1)===Vi?e.subarray(0,e.at(-2)===Ui?-2:-1):e,Bi=`
|
|
23
|
-
`,Vi=`
|
|
24
|
-
`.codePointAt(0),Hi=`\r`,Ui=`\r`.codePointAt(0);function W(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 Wi(e,{checkOpen:t=!0}={}){return W(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 Gi(e,{checkOpen:t=!0}={}){return W(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 Ki(e,t){return Wi(e,t)&&Gi(e,t)}const qi=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);var Ji=class{#e;#t;#n=!1;#r=void 0;constructor(e,t){this.#e=e,this.#t=t}next(){let e=()=>this.#i();return this.#r=this.#r?this.#r.then(e,e):e(),this.#r}return(e){let t=()=>this.#a(e);return this.#r?this.#r.then(t,t):t()}async#i(){if(this.#n)return{done:!0,value:void 0};let e;try{e=await this.#e.read()}catch(e){throw this.#r=void 0,this.#n=!0,this.#e.releaseLock(),e}return e.done&&(this.#r=void 0,this.#n=!0,this.#e.releaseLock()),e}async#a(e){if(this.#n)return{done:!0,value:e};if(this.#n=!0,!this.#t){let t=this.#e.cancel(e);return this.#e.releaseLock(),await t,{done:!0,value:e}}return this.#e.releaseLock(),{done:!0,value:e}}};const Yi=Symbol();function Xi(){return this[Yi].next()}Object.defineProperty(Xi,`name`,{value:`next`});function Zi(e){return this[Yi].return(e)}Object.defineProperty(Zi,`name`,{value:`return`});const Qi=Object.create(qi,{next:{enumerable:!0,configurable:!0,writable:!0,value:Xi},return:{enumerable:!0,configurable:!0,writable:!0,value:Zi}});function $i({preventCancel:e=!1}={}){let t=new Ji(this.getReader(),e),n=Object.create(Qi);return n[Yi]=t,n}const ea=e=>{if(Gi(e,{checkOpen:!1})&&ia.on!==void 0)return na(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(ta.call(e)===`[object ReadableStream]`)return $i.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:ta}=Object.prototype,na=async function*(e){let t=new AbortController,n={};ra(e,t,n);try{for await(let[n]of ia.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()}},ra=async(e,t,n)=>{try{await ia.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},ia={},aa=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=ea(e),u=t();u.length=0;try{for await(let e of l)sa({convertedChunk:n[la(e)](e,u),state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c});return oa({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}},oa=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&sa({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},sa=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){ca(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&ca(c,t,i,a),new da},ca=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},la=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=ua.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&ua.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:ua}=Object.prototype;var da=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const G=e=>e,fa=()=>void 0,pa=({contents:e})=>e,ma=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ha=e=>e.length;async function ga(e,t){return aa(e,_a,t)}const _a={init:()=>({contents:[]}),convertChunk:{string:G,buffer:G,arrayBuffer:G,dataView:G,typedArray:G,others:G},getSize:()=>1,truncateChunk:fa,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:fa,finalize:pa};async function va(e,t){return aa(e,Ma,t)}const ya=()=>({contents:new ArrayBuffer(0)}),ba=e=>xa.encode(e),xa=new TextEncoder,Sa=e=>new Uint8Array(e),Ca=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),wa=(e,t)=>e.slice(0,t),Ta=(e,{contents:t,length:n},r)=>{let i=ja()?Da(t,r):Ea(t,r);return new Uint8Array(i).set(e,n),i},Ea=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(Oa(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Da=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:Oa(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},Oa=e=>ka**Math.ceil(Math.log(e)/Math.log(ka)),ka=2,Aa=({contents:e,length:t})=>ja()?e:e.slice(0,t),ja=()=>`resize`in ArrayBuffer.prototype,Ma={init:ya,convertChunk:{string:ba,buffer:Sa,arrayBuffer:Sa,dataView:Ca,typedArray:Ca,others:ma},getSize:ha,truncateChunk:wa,addChunk:Ta,getFinalChunk:fa,finalize:Aa};async function Na(e,t){return aa(e,Ia,t)}const Pa=()=>({contents:``,textDecoder:new TextDecoder}),Fa=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Ia={init:Pa,convertChunk:{string:G,buffer:Fa,arrayBuffer:Fa,dataView:Fa,typedArray:Fa,others:ma},getSize:ha,truncateChunk:(e,t)=>e.slice(0,t),addChunk:(e,{contents:t})=>t+e,getFinalChunk:({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},finalize:pa},La=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof da))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:Ra(n,r,i)},t.destroy(),e},Ra=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,za=(e,t,n)=>{if(t.length!==n)return;let r=new da;throw r.maxBufferInfo={fdNumber:`ipc`},r},Ba=(e,t)=>{let{streamName:n,threshold:r,unit:i}=Va(e,t);return`Command's ${n} was larger than ${r} ${i}`},Va=(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=at(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:Ge(n),threshold:i,unit:r}},Ha=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>Wa(n)),Ua=(e,t,n)=>{if(!t)return e;let r=Wa(n);return e.length>r?e.slice(0,r):e},Wa=([,e])=>e,Ga=({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=Ka({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=Ja(r,_),x=`${y}: ${s}${b===void 0?``:`\n${b}`}`;return{originalMessage:b,shortMessage:x,message:[x,...t===void 0?[e[2],e[1]]:[t],...e.slice(3),n.map(e=>Ya(e)).join(`
|
|
25
|
-
`)].map(e=>mt(Li(Xa(e)))).filter(Boolean).join(`
|
|
26
|
-
|
|
27
|
-
`)}},Ka=({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=qa(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?`${Ba(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${zn(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}`},qa=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,Ja=(e,t)=>{if(e instanceof I)return;let n=mt(ji(fn(e)?e.originalMessage:String(e?.message??e),t));return n===``?void 0:n},Ya=e=>typeof e==`string`?e:p(e),Xa=e=>Array.isArray(e)?e.map(e=>Li(Za(e))).filter(Boolean).join(`
|
|
28
|
-
`):Za(e),Za=e=>typeof e==`string`?e:A(e)?Oe(e):``,Qa=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>no({command:e,escapedCommand:t,cwd:a,durationMs:tn(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:[]}),$a=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>eo({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}),eo=({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}=ro(l,u),{originalMessage:ee,shortMessage:w,message:T}=Ga({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}),te=un(e,T,b);return Object.assign(te,to({error:te,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:ee,shortMessage:w})),te},to=({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:_})=>no({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:tn(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:[]}),no=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),ro=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t;return{exitCode:n,signal:r,signalDescription:r===void 0?void 0:zn(t)}},io=e=>Number.isFinite(e)?e:0;function ao(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(io(e*1e3)%1e3),nanoseconds:Math.trunc(io(e*1e6)%1e3)}}function oo(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 so(e){switch(typeof e){case`number`:if(Number.isFinite(e))return ao(e);break;case`bigint`:return oo(e)}throw TypeError(`Expected a finite number or bigint`)}const co=e=>e===0||e===0n,lo=(e,t)=>t===1||t===1n?e:`${e}s`,uo=24n*60n*60n*1000n;function fo(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+1e-7);return(Math.round(n)/10**t).toFixed(t)},o=(e,n,r,a)=>{if(!((i.length===0||!t.colonNotation)&&co(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?` `+lo(n,e):r;i.push(a)}},s=so(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&&!t.subSecondsAsDecimals){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=a?e.toFixed(a):e>=1?Math.round(e):Math.ceil(e);o(Number.parseFloat(s),`millisecond`,`ms`,s)}}else{let r=a((n?Number(e%uo):e)/1e3%60,typeof t.secondsDecimalDigits==`number`?t.secondsDecimalDigits:1),i=t.keepDecimalsOnWholeSeconds?r:r.replace(/\.0+$/,``);o(Number.parseFloat(i),`second`,`s`,i)}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 po=(e,t)=>{e.failed&&F({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})},mo=(e,t)=>{ot(t)&&(po(e,t),ho(e,t))},ho=(e,t)=>{F({type:`duration`,verboseMessage:`(done in ${fo(e.durationMs)})`,verboseInfo:t,result:e})},go=(e,t,{reject:n})=>{if(mo(e,t),e.failed&&n)throw e;return e},_o=(e,t)=>K(e)?`asyncGenerator`:Eo(e)?`generator`:Oo(e)?`fileUrl`:Ao(e)?`filePath`:Lo(e)?`webStream`:W(e,{checkOpen:!1})?`native`:A(e)?`uint8Array`:zo(e)?`asyncIterable`:Bo(e)?`iterable`:Ro(e)?bo({transform:e},t):Do(e)?vo(e,t):`native`,vo=(e,t)=>Ki(e.transform,{checkOpen:!1})?yo(e,t):Ro(e.transform)?bo(e,t):Co(e,t),yo=(e,t)=>(xo(e,t,`Duplex stream`),`duplex`),bo=(e,t)=>(xo(e,t,`web TransformStream`),`webTransform`),xo=({final:e,binary:t,objectMode:n},r,i)=>{So(e,`${r}.final`,i),So(t,`${r}.binary`,i),wo(n,`${r}.objectMode`)},So=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},Co=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!To(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Ki(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(Ro(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!To(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return wo(n,`${i}.binary`),wo(r,`${i}.objectMode`),K(e)||K(t)?`asyncGenerator`:`generator`},wo=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},To=e=>K(e)||Eo(e),K=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,Eo=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Do=e=>k(e)&&(e.transform!==void 0||e.final!==void 0),Oo=e=>Object.prototype.toString.call(e)===`[object URL]`,ko=e=>Oo(e)&&e.protocol!==`file:`,Ao=e=>k(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>jo.has(e))&&Mo(e.file),jo=new Set([`file`,`append`]),Mo=e=>typeof e==`string`,No=(e,t)=>e===`native`&&typeof t==`string`&&!Po.has(t),Po=new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),Fo=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,Io=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,Lo=e=>Fo(e)||Io(e),Ro=e=>Fo(e?.readable)&&Io(e?.writable),zo=e=>Vo(e)&&typeof e[Symbol.asyncIterator]==`function`,Bo=e=>Vo(e)&&typeof e[Symbol.iterator]==`function`,Vo=e=>typeof e==`object`&&!!e,q=new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),Ho=new Set([`fileUrl`,`filePath`,`fileNumber`]),Uo=new Set([`fileUrl`,`filePath`]),Wo=new Set([...Uo,`webStream`,`nodeStream`]),Go=new Set([`webTransform`,`duplex`]),Ko={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`},qo=(e,t,n,r)=>r===`output`?Jo(e,t,n):Yo(e,t,n),Jo=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},Yo=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t!==n.length-1&&(e??r)}},Xo=(e,t)=>{let n=e.findLast(({type:e})=>q.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode},Zo=(e,t,n,r)=>[...e.filter(({type:e})=>!q.has(e)),...Qo(e,t,n,r)],Qo=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>q.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=$o({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return rs(a,n)},$o=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?es({stdioItem:e,optionName:i}):t===`webTransform`?ts({stdioItem:e,index:n,newTransforms:r,direction:a}):ns({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),es=({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}}},ts=({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}=qo(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},ns=({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||U.has(a),{writableObjectMode:f,readableObjectMode:p}=qo(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},rs=(e,t)=>t===`input`?e.reverse():e,is=(e,t,n)=>{let r=e.map(e=>as(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)??us},as=({type:e,value:t},n)=>os[n]??cs[e](t),os=[`input`,`output`,`output`],J=()=>void 0,ss=()=>`input`,cs={generator:J,asyncGenerator:J,fileUrl:J,filePath:J,iterable:ss,asyncIterable:ss,uint8Array:ss,webStream:e=>Io(e)?`output`:`input`,nodeStream(e){return Gi(e,{checkOpen:!1})?Wi(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:J,duplex:J,native(e){let t=ls(e);if(t!==void 0)return t;if(W(e,{checkOpen:!1}))return cs.nodeStream(e)}},ls=e=>{if([0,g.stdin].includes(e))return`input`;if([1,2,g.stdout,g.stderr].includes(e))return`output`},us=`output`,ds=(e,t)=>t&&!e.includes(`ipc`)?[...e,`ipc`]:e,fs=({stdio:e,ipc:t,buffer:n,...r},i,a)=>{let o=ps(e,r).map((e,t)=>hs(e,t));return a?gs(o,n,i):ds(o,t)},ps=(e,t)=>{if(e===void 0)return N.map(e=>t[e]);if(ms(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])},ms=e=>N.some(t=>e[t]!==void 0),hs=(e,t)=>Array.isArray(e)?e.map(e=>hs(e,t)):e??(t>=N.length?`ignore`:`pipe`),gs=(e,t,n)=>e.map((e,r)=>!t[r]&&r!==0&&!st(n,r)&&_s(e)?`ignore`:e),_s=e=>e===`pipe`||Array.isArray(e)&&e.every(e=>e===`pipe`),vs=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?ys({stdioItem:e,fdNumber:r,direction:i}):Ss({stdioItem:e,fdNumber:r}),ys=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=bs({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(W(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},bs=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=xs(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(x.isatty(i))throw TypeError(`The \`${t}: ${Sr(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,value:j(le(i)),optionName:t}}},xs=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=We.indexOf(e);if(n!==-1)return n},Ss=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:Cs(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:Cs(t,t,n),optionName:n}:W(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,Cs=(e,t,n)=>{let r=We[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},ws=({input:e,inputFile:t},n)=>n===0?[...Ts(e),...Ds(t)]:[],Ts=e=>e===void 0?[]:[{type:Es(e),value:e,optionName:`input`}],Es=e=>{if(Gi(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.")},Ds=e=>e===void 0?[]:[{...Os(e),optionName:`inputFile`}],Os=e=>{if(Oo(e))return{type:`fileUrl`,value:e};if(Mo(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},ks=e=>e.filter((t,n)=>e.every((e,r)=>t.value!==e.value||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),As=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=js(i,e);if(o.length!==0){if(a){Ms({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});return}if(Wo.has(e))return Ns({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});Go.has(e)&&Fs({otherStdioItems:o,type:e,value:t,optionName:n})}},js=(e,t)=>e.flatMap(({direction:e,stdioItems:n})=>n.filter(e=>e.type===t).map((t=>({...t,direction:e})))),Ms=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Uo.has(t)&&Ns({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Ns=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>Ps(e,n));if(a.length!==0)return Is(a.find(e=>e.direction!==i),r,t),i===`output`?a[0].stream:void 0},Ps=({type:e,value:t},n)=>e===`filePath`?t.file===n.file:e===`fileUrl`?t.href===n.href:t===n,Fs=({otherStdioItems:e,type:t,value:n,optionName:r})=>{Is(e.find(({value:{transform:e}})=>e===n.transform),r,t)},Is=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Ko[n]} that is the same.`)},Ls=(e,t,n,r)=>{let i=Ks({initialFileDescriptors:fs(t,n,r).map((e,n)=>Rs({stdioOption:e,fdNumber:n,options:t,isSync:r})),addProperties:e,options:t,isSync:r});return t.stdio=i.map(({stdioItems:e})=>Xs(e)),i},Rs=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=Ge(t),{stdioItems:a,isStdioArray:o}=zs({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=is(a,t,i),c=Zo(a.map(e=>vs({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),i,s,n),l=Xo(c,s);return Gs(c,l),{direction:s,objectMode:l,stdioItems:c}},zs=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=ks([...(Array.isArray(e)?e:[e]).map(e=>Bs(e,r)),...ws(n,t)]),a=i.length>1;return Vs(i,a,r),Us(i),{stdioItems:i,isStdioArray:a}},Bs=(e,t)=>({type:_o(e,t),value:e,optionName:t}),Vs=(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(Hs.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},Hs=new Set([`ignore`,`ipc`]),Us=e=>{for(let t of e)Ws(t)},Ws=({type:e,value:t,optionName:n})=>{if(ko(t))throw TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
|
|
29
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(No(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},Gs=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>Ho.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},Ks=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)i.push(qs({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(e){throw Ys(i),e}},qs=({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:a,isSync:o})=>({direction:e,objectMode:t,stdioItems:n.map(t=>Js({stdioItem:t,addProperties:i,direction:e,options:a,fileDescriptors:r,isSync:o}))}),Js=({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:a})=>{let o=As({stdioItem:e,direction:n,fileDescriptors:i,isSync:a});return o===void 0?{...e,...t[n][e.type](e,r)}:{...e,stream:o}},Ys=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)e!==void 0&&!M(e)&&e.destroy()},Xs=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`},Zs=(e,t)=>Ls(tc,e,t,!0),Y=({type:e,optionName:t})=>{$s(t,Ko[e])},Qs=({optionName:e,value:t})=>((t===`ipc`||t===`overlapped`)&&$s(e,`"${t}"`),{}),$s=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},ec={generator(){},asyncGenerator:Y,webStream:Y,nodeStream:Y,webTransform:Y,duplex:Y,asyncIterable:Y,native:Qs},tc={input:{...ec,fileUrl:({value:e})=>({contents:[j(le(e))]}),filePath:({value:{file:e}})=>({contents:[j(le(e))]}),fileNumber:Y,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...ec,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Y,string:Y,uint8Array:Y}},X=(e,{stripFinalNewline:t},n)=>nc(t,n)&&e!==void 0&&!Array.isArray(e)?Li(e):e,nc=(e,t)=>t===`all`?e[1]||e[2]:e[t],rc=(e,t,n,r)=>e||n?void 0:oc(t,r),ic=(e,t,n)=>n?e.flatMap(e=>ac(e,t)):ac(e,t),ac=(e,t)=>{let{transform:n,final:r}=oc(t,{});return[...n(e),...r()]},oc=(e,t)=>(t.previousChunks=``,{transform:sc.bind(void 0,t,e),final:lc.bind(void 0,t)}),sc=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]===`
|
|
30
|
-
`){let o=cc(n,a,t,e),s=n.slice(i+1,a+1-o);r.length>0&&(s=fc(r,s),r=``),yield s,i=a}i!==n.length-1&&(r=fc(r,n.slice(i+1))),e.previousChunks=r},cc=(e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]===`\r`,r.isWindowsNewline?2:1),lc=function*({previousChunks:e}){e.length>0&&(yield e)},uc=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:dc.bind(void 0,r)},dc=function*({isWindowsNewline:e=!1},t){let{unixNewline:n,windowsNewline:r,LF:i,concatBytes:a}=typeof t==`string`?pc:mc;if(t.at(-1)===i){yield t;return}yield a(t,e?r:n)},fc=(e,t)=>`${e}${t}`,pc={windowsNewline:`\r
|
|
31
|
-
`,unixNewline:`
|
|
32
|
-
`,LF:`
|
|
33
|
-
`,concatBytes:fc},mc={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}},hc=(e,t)=>e?void 0:gc.bind(void 0,t),gc=function*(e,t){if(typeof t!=`string`&&!A(t)&&!_e.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},_c=(e,t)=>e?vc.bind(void 0,t):yc.bind(void 0,t),vc=function*(e,t){bc(e,t),yield t},yc=function*(e,t){if(bc(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},bc=(e,t)=>{if(t==null)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
34
|
-
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
35
|
-
if (condition) { yield value; }`)},xc=(e,t,n)=>{if(n)return;if(e)return{transform:Sc.bind(void 0,new TextEncoder)};let r=new l(t);return{transform:Cc.bind(void 0,r),final:wc.bind(void 0,r)}},Sc=function*(e,t){_e.isBuffer(t)?yield j(t):typeof t==`string`?yield e.encode(t):yield t},Cc=function*(e,t){yield A(t)?e.write(t):t},wc=function*(e){let t=e.end();t!==``&&(yield t)},Tc=d(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),Ec=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Ac}=t[n];for await(let i of r(e))yield*Ec(i,t,n+1)},Dc=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Oc(n,Number(t),e)},Oc=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*Ec(r,n,t+1)},kc=d(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Ac=function*(e){yield e},jc=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(e)}},Mc=(e,t)=>[...t.flatMap(t=>[...Z(t,e,0)]),...Nc(e)],Z=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Fc}=t[n];for(let i of r(e))yield*Z(i,t,n+1)},Nc=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Pc(n,Number(t),e)},Pc=function*(e,t,n){if(e!==void 0)for(let r of e())yield*Z(r,n,t+1)},Fc=function*(e){yield e},Ic=({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:a},{encoding:o})=>{let s={},c=Rc(e,o,a),l=K(t),u=K(n),d=l?Tc.bind(void 0,Ec,s):jc.bind(void 0,Z),f=l||u?Tc.bind(void 0,Dc,s):jc.bind(void 0,Nc),p=l||u?kc.bind(void 0,s):void 0;return{stream:new me({writableObjectMode:r,writableHighWaterMark:ge(r),readableObjectMode:i,readableHighWaterMark:ge(i),transform(e,t,n){d([e,c,0],this,n)},flush(e){f([c],this,e)},destroy:p})}},Lc=(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)e=Mc(Rc(t,n,r),e);return e},Rc=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:hc(r,s)},xc(n,o,r),rc(n,a,r,c),{transform:e,final:t},{transform:_c(i,s)},uc({binary:n,preserveNewlines:a,readableObjectMode:i,state:c})].filter(Boolean)},zc=(e,t)=>{for(let n of Bc(e))Vc(e,n,t)},Bc=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),Vc=(e,t,n)=>{let{stdioItems:r}=e[t],i=r.filter(({contents:e})=>e!==void 0);if(i.length!==0){if(t!==0){let[{type:e,optionName:t}]=i;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${Ko[e]} with synchronous methods.`)}n.input=je(i.map(({contents:e})=>e).map(e=>Hc(e,r)))}},Hc=(e,t)=>{let n=Lc(e,t,`utf8`,!0);return Uc(n),je(n)},Uc=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}.`)},Wc=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&st(n,r)&&!U.has(t)&&Gc(r)&&(e.some(({type:e,value:t})=>e===`native`&&Kc.has(t))||e.every(({type:e})=>q.has(e))),Gc=e=>e===1||e===2,Kc=new Set([`pipe`,`overlapped`]),qc=async(e,t,n,r)=>{for await(let i of e)Yc(t)||Xc(i,n,r)},Jc=(e,t,n)=>{for(let r of e)Xc(r,t,n)},Yc=e=>e._readableState.pipes.length>0,Xc=(e,t,n)=>{F({type:`output`,verboseMessage:qt(e),fdNumber:t,verboseInfo:n})},Zc=({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([]);return{output:t.map((t,s)=>Qc({result:t,fileDescriptors:e,fdNumber:s,state:a,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...a}},Qc=({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=j(Ua(e,a,d)),{stdioItems:p,objectMode:m}=t[n],{serializedResult:h,finalResult:g=h}=el({chunks:$c([f],p,c,r),objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});tl({serializedResult:h,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:m});let _=s[n]?g:void 0;try{return r.error===void 0&&nl(h,p,i),_}catch(e){return r.error=e,_}},$c=(e,t,n,r)=>{try{return Lc(e,t,n,!1)}catch(t){return r.error=t,e}},el=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e};if(n===`buffer`)return{serializedResult:je(e)};let o=ke(e,n);return r[a]?{serializedResult:o,finalResult:ic(o,!i[a],t)}:{serializedResult:o}},tl=({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:a,objectMode:o})=>{if(!Wc({stdioItems:a,encoding:i,verboseInfo:r,fdNumber:t}))return;let s=ic(e,!1,o);try{Jc(s,t,r)}catch(e){n.error??=e}},nl=(e,t,n)=>{for(let{path:r,append:i}of t.filter(({type:e})=>Ho.has(e))){let t=typeof r==`string`?r:r.toString();i||n.has(t)?oe(r,e):(n.add(t),de(r,e))}},rl=([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,X(t,n,`all`)]:Array.isArray(t)?[X(e,n,`all`),...t]:A(e)&&A(t)?Ne([e,t]):`${e}${t}`},il=async(e,t)=>{let[n,r]=await al(e);return t.isForcefullyTerminated??=!1,[n,r]},al=async e=>{let[t,n]=await Promise.allSettled([E(e,`spawn`),E(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?ol(e):n.value},ol=async e=>{try{return await E(e,`exit`)}catch{return ol(e)}},sl=async e=>{let[t,n]=await e;if(!cl(t,n)&&ll(t,n))throw new I;return[t,n]},cl=(e,t)=>e===void 0&&t===void 0,ll=(e,t)=>e!==0||t!==null,ul=({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{let a=dl(e,t,n);return{resultError:a,exitCode:t,signal:n,timedOut:a?.code===`ETIMEDOUT`,isMaxBuffer:Ha(a,r,i)}},dl=(e,t,n)=>e===void 0?ll(t,n)?new I:void 0:e,fl=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=pl(e,t,n);return go(_l({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s}),c,l)},pl=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=nn(e,t,n),{file:s,commandArguments:c,options:l}=Ni(e,t,ml(n));return hl(l),{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:l,fileDescriptors:Zs(l,o)}},ml=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,hl=({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&gl(`ipcInput`),e&&gl(`ipc: true`),n&&gl(`detached: true`),r&&gl(`cancelSignal`)},gl=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},_l=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=vl({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}=ul(c,n),{output:m,error:h=l}=Zc({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:p,verboseInfo:a});return bl({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:m.map((e,t)=>X(e,n,t)),all:X(rl(m,n),n,`all`),options:n,command:r,escapedCommand:i,startTime:s})},vl=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:o})=>{try{return zc(a,n),c(...Ii(e,t,yl(n)))}catch(e){return $a({error:e,command:r,escapedCommand:i,fileDescriptors:a,options:n,startTime:o,isSync:!0})}},yl=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:Wa(t)}),bl=({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?Qa({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):eo({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}),xl=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:a}={})=>(Zn({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:Ir(e)}),Sl({anyProcess:e,channel:t,isSubprocess:n,filter:a,reference:i})),Sl=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{wr(t,i);let a=Nr(e,t,n),o=new AbortController;try{return await Promise.race([Cl(a,r,o),wl(a,n,o),Tl(a,n,o)])}catch(t){throw pr(e),t}finally{o.abort(),Er(t,i)}},Cl=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await E(e,`message`,{signal:n});return t}for await(let[r]of re(e,`message`,{signal:n}))if(t(r))return r},wl=async(e,t,{signal:n})=>{await E(e,`disconnect`,{signal:n}),er(t)},Tl=async(e,t,{signal:n})=>{let[r]=await E(e,`strict:error`,{signal:n});throw nr(r,t)},El=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>Dl({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),Dl=({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:a})=>{Zn({methodName:`getEachMessage`,isSubprocess:n,ipc:r,isConnected:Ir(e)}),wr(t,a);let o=Nr(e,t,n),s=new AbortController,c={};return Ol(e,o,s),kl({ipcEmitter:o,isSubprocess:n,controller:s,state:c}),Al({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:s,state:c,reference:a})},Ol=async(e,t,n)=>{try{await E(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},kl=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await E(e,`strict:error`,{signal:n.signal});r.error=nr(i,t),n.abort()}catch{}},Al=async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:a,state:o,reference:s}){try{for await(let[e]of re(n,`message`,{signal:a.signal}))jl(o),yield e}catch{jl(o)}finally{a.abort(),Er(t,s),r||pr(e),i&&await e}},jl=({error:e})=>{if(e)throw e},Ml=(e,{ipc:t})=>{Object.assign(e,Pl(e,!1,t))},Nl=()=>{let e=g,t=g.channel!==void 0;return{...Pl(e,!0,t),getCancelSignal:ii.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:!0,ipc:t})}},Pl=(e,t,n)=>({sendMessage:Qr.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:xl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:El.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}),Fl=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:o,verboseInfo:s})=>{Ys(r);let c=new a;return Il(c,r),Object.assign(c,{readable:Ll,writable:Rl,duplex:zl}),{subprocess:c,promise:Bl($a({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:o,isSync:!1}),s,i)}},Il=(e,t)=>{let n=Q(),r=Q(),i=Q(),a=Array.from({length:t.length-3},Q),o=Q(),s=[n,r,i,...a];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:o,stdio:s})},Q=()=>{let e=new pe;return e.end(),e},Ll=()=>new O({read(){}}),Rl=()=>new he({write(){}}),zl=()=>new fe({read(){},write(){}}),Bl=async(e,t,n)=>go(e,t,n),Vl=(e,t)=>Ls(Wl,e,t,!1),Hl=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${Ko[e]}.`)},Ul={fileNumber:Hl,generator:Ic,asyncGenerator:Ic,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){let r=t||n;return{stream:fe.fromWeb(e,{objectMode:r})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Wl={input:{...Ul,fileUrl:({value:e})=>({stream:se(e)}),filePath:({value:{file:e}})=>({stream:se(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(_e.from(e))})},output:{...Ul,fileUrl:({value:e})=>({stream:ce(e)}),filePath:({value:{file:e,append:t}})=>({stream:ce(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:he.fromWeb(e)}),iterable:Hl,asyncIterable:Hl,string:Hl,uint8Array:Hl}};function Gl(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)Zl(t);let t=e.some(({readableObjectMode:e})=>e),n=Kl(e,t),r=new ql({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(let t of e)r.add(t);return r}const Kl=(e,t)=>{if(e.length===0)return ge(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)};var ql=class extends pe{#e=new Set([]);#t=new Set([]);#n=new Set([]);#r;#i=Symbol(`unpipe`);#a=new WeakMap;add(e){if(Zl(e),this.#e.has(e))return;this.#e.add(e),this.#r??=Jl(this,this.#e,this.#i);let t=Ql({passThroughStream:this,stream:e,streams:this.#e,ended:this.#t,aborted:this.#n,onFinished:this.#r,unpipeEvent:this.#i});this.#a.set(e,t),e.pipe(this,{end:!1})}async remove(e){if(Zl(e),!this.#e.has(e))return!1;let t=this.#a.get(e);return t===void 0?!1:(this.#a.delete(e),e.unpipe(this),await t,!0)}};const Jl=async(e,t,n)=>{cu(e,lu);let r=new AbortController;try{await Promise.race([Yl(e,r),Xl(e,t,n,r)])}finally{r.abort(),cu(e,-lu)}},Yl=async(e,{signal:t})=>{try{await D(e,{signal:t,cleanup:!0})}catch(t){throw ru(e,t),t}},Xl=async(e,t,n,{signal:r})=>{for await(let[i]of re(e,`unpipe`,{signal:r}))t.has(i)&&i.emit(n)},Zl=e=>{if(typeof e?.pipe!=`function`)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Ql=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:a,unpipeEvent:o})=>{cu(e,uu);let s=new AbortController;try{await Promise.race([$l(a,t,s),eu({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:s}),tu({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:s})])}finally{s.abort(),cu(e,-uu)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?au(e):nu(e))},$l=async(e,t,{signal:n})=>{try{await e,n.aborted||au(t)}catch(e){n.aborted||ru(t,e)}},eu=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;iu(r)?i.add(t):ou(e,r)}},tu=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)},nu=e=>{e.writable&&e.end()},ru=(e,t)=>{iu(t)?au(e):ou(e,t)},iu=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,au=e=>{(e.readable||e.writable)&&e.destroy()},ou=(e,t)=>{e.destroyed||(e.once(`error`,su),e.destroy(t))},su=()=>{},cu=(e,t)=>{let n=e.getMaxListeners();n!==0&&n!==1/0&&e.setMaxListeners(n+t)},lu=2,uu=1,du=(e,t)=>{e.pipe(t),fu(e,t),mu(e,t)},fu=async(e,t)=>{if(!(M(e)||M(t))){try{await D(e,{cleanup:!0,readable:!0,writable:!1})}catch{}pu(t)}},pu=e=>{e.writable&&e.end()},mu=async(e,t)=>{if(!(M(e)||M(t))){try{await D(t,{cleanup:!0,readable:!1,writable:!0})}catch{}hu(e)}},hu=e=>{e.readable&&e.destroy()},gu=(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})=>q.has(e)))_u(e,t,o,i);for(let{stream:t}of a.filter(({type:e})=>!q.has(e)))yu({subprocess:e,stream:t,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(let[e,t]of r.entries())du(t.length===1?t[0]:Gl(t),e)},_u=(e,t,n,r)=>{n===`output`?du(e.stdio[r],t):du(t,e.stdio[r]);let i=vu[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},vu=[`stdin`,`stdout`,`stderr`],yu=({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:a})=>{if(t===void 0)return;bu(t,a);let[o,s]=n===`output`?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(o)??[];i.set(o,[...c,s])},bu=(e,{signal:t})=>{M(e)&&Cr(e,xu,t)},xu=2,Su=(e,{cleanup:t,detached:n},{signal:i})=>{if(!t||n)return;let a=r(()=>{e.kill()});ne(i,()=>{a()})},Cu=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=en(),{destination:o,destinationStream:s,destinationError:c,from:l,unpipeSignal:u}=wu(n,r,i),{sourceStream:d,sourceError:f}=Du(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}},wu=(e,t,n)=>{try{let{destination:r,pipeOptions:{from:i,to:a,unpipeSignal:o}={}}=Tu(e,t,...n);return{destination:r,destinationStream:mr(r,a),from:i,unpipeSignal:o}}catch(e){return{destinationError:e}}},Tu=(e,t,n,...r)=>{if(Array.isArray(n))return{destination:t(Eu,e)(n,...r),pipeOptions:e};if(typeof n==`string`||n instanceof URL||be(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]=Se(n,...r);return{destination:t(Eu)(i,a,o),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}`)},Eu=({options:e})=>({options:{...e,stdin:`pipe`,piped:!0}}),Du=(e,t)=>{try{return{sourceStream:hr(e,t)}}catch(e){return{sourceError:e}}},Ou=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:a,startTime:o})=>{let s=ku({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(s!==void 0)throw Au({error:s,fileDescriptors:i,sourceOptions:a,startTime:o})},ku=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return hu(e),r;if(t!==void 0)return pu(n),t},Au=({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>$a({error:e,command:ju,escapedCommand:ju,fileDescriptors:t,options:n,startTime:r,isSync:!1}),ju=`source.pipe(destination)`,Mu=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},Nu=(e,t,n)=>{let r=Lu.has(t)?Fu(e,t):Pu(e,t);return Cr(e,Ru,n.signal),Cr(t,zu,n.signal),Iu(t),r},Pu=(e,t)=>{let n=Gl([e]);return du(n,t),Lu.set(t,n),n},Fu=(e,t)=>{let n=Lu.get(t);return n.add(e),n},Iu=async e=>{try{await D(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Lu.delete(e)},Lu=new WeakMap,Ru=2,zu=1,Bu=(e,t)=>e===void 0?[]:[Vu(e,t)],Vu=async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:a})=>{throw await u(e,t),await n.remove(t),Au({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:r,sourceOptions:i,startTime:a})},Hu=(e,...t)=>{if(k(t[0]))return Hu.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:n,...r}=Cu(e,...t),i=Uu({...r,destination:n});return i.pipe=Hu.bind(void 0,{...e,source:n,sourcePromise:i,boundOptions:{}}),i},Uu=async({sourcePromise:e,sourceStream:t,sourceOptions:n,sourceError:r,destination:i,destinationStream:a,destinationError:o,unpipeSignal:s,fileDescriptors:c,startTime:l})=>{let u=Wu(e,i);Ou({sourceStream:t,sourceError:r,destinationStream:a,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});let d=new AbortController;try{let e=Nu(t,a,d);return await Promise.race([Mu(u),...Bu(s,{sourceStream:t,mergedStream:e,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Wu=(e,t)=>Promise.allSettled([e,t]),Gu=({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:a})=>{let o=new AbortController;return Ku(t,o),Yu({stream:e,controller:o,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:a})},Ku=async(e,t)=>{try{await e}catch{}finally{t.abort()}},qu=({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:a})=>{let o=new AbortController;Ju(t,o,e);let s=e.readableObjectMode&&!a;return Yu({stream:e,controller:o,binary:r===`buffer`,shouldEncode:!s,encoding:r,shouldSplit:!s&&n,preserveNewlines:!i})},Ju=async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},Yu=({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})=>Qu({onStdoutChunk:re(e,`data`,{signal:t.signal,highWaterMark:Zu,highWatermark:Zu}),controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}),Xu=ge(!0),Zu=Xu,Qu=async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}){let s=$u({binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o});try{for await(let[t]of e)yield*Z(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*Nc(s)}},$u=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[xc(e,n,!t),rc(e,i,!r,{})].filter(Boolean),ed=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=td({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:s,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([nd(e),d]);return}let f=qu({stream:e,onStreamEnd:t,lines:o,encoding:r,stripFinalNewline:nc(c,n),allMixed:s}),[p]=await Promise.all([rd({stream:e,iterable:f,fdNumber:n,encoding:r,maxBuffer:a,lines:o}),d]);return p},td=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:a,streamInfo:{fileDescriptors:o}})=>{Wc({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n})&&await qc(qu({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i}),e,n,a)},nd=async e=>{await ee(),e.readableFlowing===null&&e.resume()},rd=async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:a,lines:o})=>{try{return t||o?await ga(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await va(n,{maxBuffer:a})):await Na(n,{maxBuffer:a})}catch(n){return ad(La({error:n,stream:e,readableObjectMode:t,lines:o,encoding:i,fdNumber:r}))}},id=async e=>{try{return await e}catch(e){return ad(e)}},ad=({bufferedData:e})=>we(e)?new Uint8Array(e):e,od=async(e,t,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{let a=sd(e,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],D(e,{cleanup:!0,signal:o.signal})])}catch(e){a.stdinCleanedUp||ud(e,t,n,r)}finally{o.abort()}},sd=(e,{originalStreams:[t],subprocess:n})=>{let r={stdinCleanedUp:!1};return e===t&&cd(e,n,r),r},cd=(e,t,n)=>{let{_destroy:r}=e;e._destroy=(...i)=>{ld(t,n),r.call(e,...i)}},ld=({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},ud=(e,t,n,r)=>{if(!dd(e,t,n,r))throw e},dd=(e,t,n,r=!0)=>n.propagating?md(e)||pd(e):(n.propagating=!0,fd(n,t)===r?md(e):pd(e)),fd=({fileDescriptors:e},t)=>t!==`all`&&e[t].direction===`input`,pd=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,md=e=>e?.code===`EPIPE`,hd=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>e.stdio.map((e,c)=>gd({stream:e,fdNumber:c,encoding:t,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:a,verboseInfo:o,streamInfo:s})),gd=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=od(e,t,l);if(fd(l,t)){await u;return}let[d]=await Promise.all([ed({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},_d=({stdout:e,stderr:t},{all:n})=>n&&(e||t)?Gl([e,t].filter(Boolean)):void 0,vd=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>gd({...yd(e,n),fdNumber:`all`,encoding:t,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:bd(e),stripFinalNewline:a,verboseInfo:o,streamInfo:s}),yd=({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}},bd=({all:e,stdout:t,stderr:n})=>e&&t&&n&&t.readableObjectMode!==n.readableObjectMode,xd=e=>st(e,`ipc`),Sd=(e,t)=>{F({type:`ipc`,verboseMessage:qt(e),fdNumber:`ipc`,verboseInfo:t})},Cd=async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:a})=>{if(!r)return i;let o=xd(a),s=at(t,`ipc`),c=at(n,`ipc`);for await(let t of Dl({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))s&&(za(e,i,c),i.push(t)),o&&Sd(t,a);return i},wd=async(e,t)=>(await Promise.allSettled([e]),t),Td=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=il(e,f),y={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:v,propagating:!1},b=hd({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),x=vd({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),S=[],C=Cd({subprocess:e,buffer:n,maxBuffer:r,ipc:u,ipcOutput:S,verboseInfo:p}),ee=Ed(h,e,y),w=Dd(m,y);try{return await Promise.race([Promise.all([{},sl(v),Promise.all(b),x,C,Si(e,d),...ee,...w]),g,Od(e,_),...gi(e,a,f,_),...Yn({subprocess:e,cancelSignal:o,gracefulCancel:s,context:f,controller:_}),...fi({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=>id(e))),id(x),wd(C,S),Promise.allSettled(ee),Promise.allSettled(w)])}},Ed=(e,t,n)=>e.map((e,r)=>e===t.stdio[r]?void 0:od(e,r,n)),Dd=(e,t)=>e.flatMap(({stdioItems:e},n)=>e.filter(({value:e,stream:t=e})=>W(t,{checkOpen:!1})&&!M(t)).map(({type:e,value:r,stream:i=r})=>od(i,n,t,{isSameDirection:q.has(e),stopOnExit:e===`native`}))),Od=async(e,{signal:t})=>{let[n]=await E(e,`error`,{signal:t});throw n},kd=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Ad=(e,t,n)=>{let r=e[n];r.has(t)||r.set(t,[]);let i=r.get(t),a=z();return i.push(a),{resolve:a.resolve.bind(a),promises:i}},jd=async({resolve:e,promises:t},n)=>{e();let[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r},Md=async e=>{if(e!==void 0)try{await Pd(e)}catch{}},Nd=async e=>{if(e!==void 0)try{await Fd(e)}catch{}},Pd=async e=>{await D(e,{cleanup:!0,readable:!1,writable:!0})},Fd=async e=>{await D(e,{cleanup:!0,readable:!0,writable:!1})},Id=async(e,t)=>{if(await e,t)throw t},Ld=(e,t,n)=>{n&&!pd(n)?e.destroy(n):t&&e.destroy()},Rd=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,binary:i=!0,preserveNewlines:a=!0}={})=>{let o=i||U.has(n),{subprocessStdout:s,waitReadableDestroy:c}=zd(e,r,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:f}=Bd(s,o),{read:p,onStdoutDataDone:m}=Vd({subprocessStdout:s,subprocess:e,binary:o,encoding:n,preserveNewlines:a}),h=new O({read:p,destroy:d(Wd.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:c})),highWaterMark:f,objectMode:u,encoding:l});return Ud({subprocessStdout:s,onStdoutDataDone:m,readable:h,subprocess:e}),h},zd=(e,t,n)=>{let r=hr(e,t);return{subprocessStdout:r,waitReadableDestroy:Ad(n,r,`readableDestroy`)}},Bd=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Xu},Vd=({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{let a=z(),o=Gu({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){Hd(this,o,a)},onStdoutDataDone:a}},Hd=async(e,t,n)=>{try{let{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},Ud=async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await Fd(e),await r,await Md(i),await t,n.readable&&n.push(null)}catch(e){await Md(i),Gd(n,e)}},Wd=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await jd(n,t)&&(Gd(e,r),await Id(t,r))},Gd=(e,t)=>{Ld(e,e.readable,t)},Kd=({subprocess:e,concurrentStreams:t},{to:n}={})=>{let{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:a}=qd(e,n,t),o=new he({...Jd(r,e,i),destroy:d(Qd.bind(void 0,{subprocessStdin:r,subprocess:e,waitWritableFinal:i,waitWritableDestroy:a})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return Zd(r,o),o},qd=(e,t,n)=>{let r=mr(e,t);return{subprocessStdin:r,waitWritableFinal:Ad(n,r,`writableFinal`),waitWritableDestroy:Ad(n,r,`writableDestroy`)}},Jd=(e,t,n)=>({write:Yd.bind(void 0,e),final:d(Xd.bind(void 0,e,t,n))}),Yd=(e,t,n,r)=>{e.write(t,n)?r():e.once(`drain`,r)},Xd=async(e,t,n)=>{await jd(n,t)&&(e.writable&&e.end(),await t)},Zd=async(e,t,n)=>{try{await Pd(e),t.writable&&t.end()}catch(e){await Nd(n),$d(t,e)}},Qd=async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await jd(n,t),await jd(r,t)&&($d(e,i),await Id(t,i))},$d=(e,t)=>{Ld(e,e.writable,t)},ef=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,to:i,binary:a=!0,preserveNewlines:o=!0}={})=>{let s=a||U.has(n),{subprocessStdout:c,waitReadableDestroy:l}=zd(e,r,t),{subprocessStdin:u,waitWritableFinal:f,waitWritableDestroy:p}=qd(e,i,t),{readableEncoding:m,readableObjectMode:h,readableHighWaterMark:g}=Bd(c,s),{read:_,onStdoutDataDone:v}=Vd({subprocessStdout:c,subprocess:e,binary:s,encoding:n,preserveNewlines:o}),y=new fe({read:_,...Jd(u,e,f),destroy:d(tf.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:f,waitWritableDestroy:p})),readableHighWaterMark:g,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:m});return Ud({subprocessStdout:c,onStdoutDataDone:v,readable:y,subprocess:e,subprocessStdin:u}),Zd(u,y,c),y},tf=async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:a},o)=>{await Promise.all([Wd({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},o),Qd({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:a},o)])},nf=(e,t,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{let a=r||U.has(t),o=hr(e,n);return rf(Gu({subprocessStdout:o,subprocess:e,binary:a,shouldEncode:!0,encoding:t,preserveNewlines:i}),o,e)},rf=async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}},af=(e,{encoding:t})=>{let n=kd();e.readable=Rd.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=Kd.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=ef.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.iterable=nf.bind(void 0,e,t),e[Symbol.asyncIterator]=nf.bind(void 0,e,t,{})},of=(e,t)=>{for(let[n,r]of cf){let i=r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},sf=(async()=>{})().constructor.prototype,cf=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(sf,e)]),lf=(e,t,n,r)=>{let{file:i,commandArguments:a,command:o,escapedCommand:s,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=uf(e,t,n),{subprocess:f,promise:p}=ff({file:i,commandArguments:a,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:s,fileDescriptors:d});return f.pipe=Hu.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:r}),of(f,p),B.set(f,{options:u,fileDescriptors:d}),f},uf=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=nn(e,t,n),{file:s,commandArguments:c,options:l}=Ni(e,t,n),u=df(l);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:Vl(u,o)}},df=({timeout:e,signal:t,...n})=>{if(t!==void 0)throw TypeError(`The "signal" option has been renamed to "cancelSignal" instead.`);return{...n,timeoutDuration:e}},ff=({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:i,command:a,escapedCommand:o,fileDescriptors:c})=>{let l;try{l=s(...Ii(e,t,n))}catch(e){return Fl({error:e,command:a,escapedCommand:o,fileDescriptors:c,options:n,startTime:r,verboseInfo:i})}let u=new AbortController;ie(1/0,u.signal);let d=[...l.stdio];gu(l,c,u),Su(l,n,u);let f={},p=z();l.kill=Hn.bind(void 0,{kill:l.kill.bind(l),options:n,onInternalError:p,context:f,controller:u}),l.all=_d(l,n),af(l,n),Ml(l,n);let m=pf({subprocess:l,options:n,startTime:r,verboseInfo:i,fileDescriptors:c,originalStreams:d,command:a,escapedCommand:o,context:f,onInternalError:p,controller:u});return{subprocess:l,promise:m}},pf=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 Td({subprocess:e,options:t,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:a,onInternalError:l,controller:u});return u.abort(),l.resolve(),go(mf({errorInfo:d,exitCode:f,signal:p,stdio:m.map((e,n)=>X(e,t,n)),all:X(h,t,`all`),ipcOutput:g,context:c,options:t,command:o,escapedCommand:s,startTime:n}),r,t)},mf=({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?eo({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 da,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):Qa({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:a,options:s,startTime:u}),hf=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>[t,gf(t,e[t],n)]));return{...e,...n}},gf=(e,t,n)=>_f.has(e)&&k(t)&&k(n)?{...t,...n}:n,_f=new Set([`env`,...it]),$=(e,t,n,r)=>{let i=(e,t,r)=>$(e,t,n,r),a=(...a)=>vf({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a);return r!==void 0&&r(a,i,t),a},vf=({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},a,...o)=>{if(k(a))return i(e,hf(n,a),r);let{file:s,commandArguments:c,options:l,isSync:u}=yf({mapArguments:e,firstArgument:a,nextArguments:o,deepOptions:t,boundOptions:n});return u?fl(s,c,l):lf(s,c,l,i)},yf=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let[a,o,s]=Se(...Fe(t)?Ie(t,n):[t,...n]),c=hf(hf(r,i),s),{file:l=a,commandArguments:u=o,options:d=c,isSync:f=!1}=e({file:a,commandArguments:o,options:c});return{file:l,commandArguments:u,options:d,isSync:f}},bf=({file:e,commandArguments:t})=>Sf(e,t),xf=({file:e,commandArguments:t})=>({...Sf(e,t),isSync:!0}),Sf=(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]=Cf(e);return{file:n,commandArguments:r}},Cf=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(wf)){let t=n.at(-1);t&&t.endsWith(`\\`)?n[n.length-1]=`${t.slice(0,-1)} ${e}`:n.push(e)}return n},wf=/ +/g,Tf=(e,t,n)=>{e.sync=t(Df,n),e.s=e.sync},Ef=({options:e})=>Of(e),Df=({options:e})=>({...Of(e),isSync:!0}),Of=e=>({options:{...kf(e),...e}}),kf=({input:e,inputFile:t,stdio:n})=>e===void 0&&t===void 0&&n===void 0?{stdin:`inherit`}:{},Af={preferLocal:!0},jf=$(()=>({})),Mf=$(()=>({isSync:!0}));$(bf),$(xf),$(vi),$(Ef,{},Af,Tf);const{sendMessage:Nf,getOneMessage:Pf,getEachMessage:Ff,getCancelSignal:If}=Nl();export{Mf as n,jf as t};
|