@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=e(import.meta.url);export{u as i,c as n,d as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./string-width-
|
|
1
|
+
import{a as e,t}from"./string-width-HBt3xzMc.mjs";function n(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}const r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]$/,i=[`\x1B`,``],a=e=>`${i[0]}[${e}m`,o=(t,n,r)=>{let i=[];t=[...t];for(let r of t){let o=r;r.includes(`;`)&&(r=r.split(`;`)[0][0]+`0`);let s=e.codes.get(Number.parseInt(r,10));if(s){let e=t.indexOf(s.toString());e===-1?i.push(a(n?s:o)):t.splice(e,1)}else if(n){i.push(a(0));break}else i.push(a(o))}if(n&&(i=i.filter((e,t)=>i.indexOf(e)===t),r!==void 0)){let t=a(e.codes.get(Number.parseInt(r,10)));i=i.reduce((e,n)=>n===t?[n,...e]:[...e,n],[])}return i.join(``)};function s(e,t,a){let s=[...e],c=[],l=typeof a==`number`?a:s.length,u=!1,d,f=0,p=``;for(let[m,h]of s.entries()){let s=!1;if(i.includes(h)){let t=/\d[^m]*/.exec(e.slice(m,m+18));d=t&&t.length>0?t[0]:void 0,f<l&&(u=!0,d!==void 0&&c.push(d))}else u&&h===`m`&&(u=!1,s=!0);if(!u&&!s&&f++,!r.test(h)&&n(h.codePointAt())&&(f++,typeof a!=`number`&&l++),f>t&&f<=l)p+=h;else if(f===t&&!u&&d!==void 0)p=o(c);else if(f>=l){p+=o(c,!0,d);break}}return p}function c(e,t,n){if(e.charAt(t)===` `)return t;let r=n?1:-1;for(let n=0;n<=3;n++){let i=t+n*r;if(e.charAt(i)===` `)return i}return t}function l(e,n,r={}){let{position:i=`end`,space:a=!1,preferTruncationOnSpace:o=!1}=r,{truncationCharacter:l=`…`}=r;if(typeof e!=`string`)throw TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof n!=`number`)throw TypeError(`Expected \`columns\` to be a number, got ${typeof n}`);if(n<1)return``;if(n===1)return l;let u=t(e);if(u<=n)return e;if(i===`start`){if(o){let t=c(e,u-n+1,!0);return l+s(e,t,u).trim()}return a===!0&&(l+=` `),l+s(e,u-n+t(l),u)}if(i===`middle`){a===!0&&(l=` ${l} `);let r=Math.floor(n/2);if(o){let t=c(e,r),i=c(e,u-(n-r)+1,!0);return s(e,0,t)+l+s(e,i,u).trim()}return s(e,0,r)+l+s(e,u-(n-r)+t(l),u)}if(i===`end`)return o?s(e,0,c(e,n-1))+l:(a===!0&&(l=` ${l}`),s(e,0,n-t(l))+l);throw Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${i}`)}export{l as default};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{a as e,i as t}from"./git-hooks-CZK05VMP.mjs";import{a as n,i as r}from"./lint-C7aukiMw.mjs";import{createRequire as i}from"node:module";import{Cheetor as a}from"cheetor";function o(){if(n(`svgo/package.json`)&&n(`svgo-config/package.json`))return{command:`svgo`,describe:"Run `svgo` to optimize `*.svg`",handler({_:[t,n=`./`]}){e(`svgo`,[`-r`,`-q`,`--pretty`,`--indent`,`2`,`--config`,i(import.meta.url).resolve(`svgo-config`),`-f`,n]).then(()=>{console.log(`Done: calling svgo`)}).catch(e=>{process.exitCode=1,console.error(`Error:`,e.message)})}}}process.on(`SIGINT`,()=>{}),new a(`../package.json`,import.meta.url).website(`https://www.npmjs.com/org/nice-move`).command(r).command(t).commandSmart(o).setup();export{};
|
package/dist/cmd/git.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e
|
|
1
|
+
import{n as e,r as t,t as n}from"../git-hooks-CZK05VMP.mjs";export{n as builder,e as command,t as description};
|
package/dist/cmd/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e
|
|
1
|
+
import{n as e,r as t,t as n}from"../lint-C7aukiMw.mjs";export{n as builder,e as command,t as description};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{i as e,n as t}from"./chunk-BD7HfmW0.mjs";import{n,t as r}from"./path-key-_mkIRVBk.mjs";import{t as i}from"./mjs-CsQ9gy60.mjs";import{fileURLToPath as a}from"node:url";import{ChildProcess as o,execFile as s,spawn as c,spawnSync as l}from"node:child_process";import{StringDecoder as u}from"node:string_decoder";import{aborted as d,callbackify as f,debuglog as p,inspect as m,promisify as h,stripVTControlCharacters as g}from"node:util";import _,{execArgv as v,execPath as y,hrtime as b,platform as x}from"node:process";import S from"node:tty";import C from"node:path";import{scheduler as w,setImmediate as ee,setTimeout as te}from"node:timers/promises";import{constants as T}from"node:os";import{EventEmitter as ne,addAbortListener as re,on as ie,once as E,setMaxListeners as ae}from"node:events";import{serialize as oe}from"node:v8";import{appendFileSync as se,createReadStream as ce,createWriteStream as le,readFileSync as ue,statSync as de,writeFileSync as fe}from"node:fs";import{finished as D}from"node:stream/promises";import{Duplex as pe,PassThrough as me,Readable as O,Transform as he,Writable as ge,getDefaultHighWaterMark as _e}from"node:stream";import{Buffer as ve}from"node:buffer";function k(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const ye=(e,t)=>{let n=Se(be(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},be=e=>xe(e)?e.toString():e,xe=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,Se=e=>e instanceof URL?a(e):e,Ce=(e,t=[],n={})=>{let r=ye(e,`First argument`),[i,a]=k(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!k(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]},{toString:we}=Object.prototype,Te=e=>we.call(e)===`[object ArrayBuffer]`,A=e=>we.call(e)===`[object Uint8Array]`,j=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ee=new TextEncoder,De=e=>Ee.encode(e),Oe=new TextDecoder,ke=e=>Oe.decode(e),Ae=(e,t)=>je(e,t).join(``),je=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new u(t),r=e.map(e=>typeof e==`string`?De(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},Me=e=>e.length===1&&A(e[0])?e[0]:Pe(Ne(e)),Ne=e=>e.map(e=>typeof e==`string`?De(e):e),Pe=e=>{let t=new Uint8Array(Fe(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},Fe=e=>{let t=0;for(let n of e)t+=n.length;return t},Ie=e=>Array.isArray(e)&&Array.isArray(e.raw),Le=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Re({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},Re=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ze(i,e.raw[r]),c=He(n,a,o);if(r===t.length)return c;let l=t[r];return He(c,Array.isArray(l)?l.map(e=>Ue(e)):[Ue(l)],s)},ze=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=Be.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(Be.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
|
|
2
|
+
`?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=Ve[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},Be=new Set([` `,` `,`\r`,`
|
|
3
|
+
`]),Ve={x:3,u:5},He=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Ue=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(k(e)&&(`stdout`in e||`isMaxBuffer`in e))return We(e);throw e instanceof o||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},We=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return ke(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)},M=e=>Ge.includes(e),Ge=[_.stdin,_.stdout,_.stderr],N=[`stdin`,`stdout`,`stderr`],Ke=e=>N[e]??`stdio[${e}]`,qe=e=>{let t={...e};for(let n of at)t[n]=Je(e,n);return t},Je=(e,t)=>{let n=Array.from({length:Ye(e)+1});return rt(Xe(e[t],n,t),t)},Ye=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,Xe=(e,t,n)=>k(e)?Ze(e,t,n):t.fill(e),Ze=(e,t,n)=>{for(let r of Object.keys(e).sort(Qe))for(let i of et(r,n,t))t[i]=e[r];return t},Qe=(e,t)=>$e(e)<$e(t)?1:-1,$e=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=tt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
|
|
4
|
+
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
5
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},tt=e=>{if(e===`all`)return e;if(N.includes(e))return N.indexOf(e);let t=nt.exec(e);if(t!==null)return Number(t[1])},nt=/^fd(\d+)$/,rt=(e,t)=>e.map(e=>e===void 0?it[t]:e),it={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:p(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},at=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],ot=(e,t)=>t===`ipc`?e.at(-1):e[t],st=({verbose:e},t)=>ut(e,t)!==`none`,ct=({verbose:e},t)=>![`none`,`short`].includes(ut(e,t)),lt=({verbose:e},t)=>{let n=ut(e,t);return ft(n)?n:void 0},ut=(e,t)=>t===void 0?dt(e):ot(e,t),dt=e=>e.find(e=>ft(e))??pt.findLast(t=>e.includes(t)),ft=e=>typeof e==`function`,pt=[`none`,`short`,`full`],mt=(e,t)=>{let n=[e,...t];return{command:n.join(` `),escapedCommand:n.map(e=>xt(gt(e))).join(` `)}},ht=e=>g(e).split(`
|
|
6
|
+
`).map(e=>gt(e)).join(`
|
|
7
|
+
`),gt=e=>e.replaceAll(vt,e=>_t(e)),_t=e=>{let t=yt[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=bt?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},vt=(()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}})(),yt={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},bt=65535,xt=e=>St.test(e)?e:x===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,St=/^[\w./-]+$/;function Ct(){let{env:e}=_,{TERM:t,TERM_PROGRAM:n}=e;return _.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const wt={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:`╱`},Tt={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:`⅒`},Et={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`},Dt={...wt,...Tt},Ot={...wt,...Et},kt=Ct()?Dt:Ot;Object.entries(Tt);const At=S?.WriteStream?.prototype?.hasColors?.()??!1,P=(e,t)=>{if(!At)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 jt=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 Mt=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 Nt=P(91,39);P(92,39);const Pt=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 Ft=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=It(n),c=zt[e]({failed:a,reject:o,piped:r}),l=Vt[e]({reject:o});return`${Mt(`[${s}]`)} ${Mt(`[${i}]`)} ${l(c)} ${l(t)}`},It=e=>`${Lt(e.getHours(),2)}:${Lt(e.getMinutes(),2)}:${Lt(e.getSeconds(),2)}.${Lt(e.getMilliseconds(),3)}`,Lt=(e,t)=>String(e).padStart(t,`0`),Rt=({failed:e,reject:t})=>e?t?kt.cross:kt.warning:kt.tick,zt={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:Rt,duration:Rt},Bt=e=>e,Vt={command:()=>jt,output:()=>Bt,ipc:()=>Bt,error:({reject:e})=>e?Nt:Pt,duration:()=>Mt},Ht=(e,t,n)=>{let r=lt(t,n);return e.map(({verboseLine:e,verboseObject:t})=>Ut(e,t,r)).filter(e=>e!==void 0).map(e=>Wt(e)).join(``)},Ut=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},Wt=e=>e.endsWith(`
|
|
8
|
+
`)?e:`${e}\n`,F=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=Ht(Kt(t,Gt({type:e,result:i,verboseInfo:r})),r,n);a!==``&&console.warn(a.slice(0,-1))},Gt=({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}),Kt=(e,t)=>e.split(`
|
|
9
|
+
`).map(e=>qt({...t,message:e})),qt=e=>({verboseLine:Ft(e),verboseObject:e}),Jt=e=>ht(typeof e==`string`?e:m(e)).replaceAll(` `,` `.repeat(Yt)),Yt=2,Xt=(e,t)=>{st(t)&&F({type:`command`,verboseMessage:e,verboseInfo:t})},Zt=(e,t,n)=>(en(e),{verbose:e,escapedCommand:t,commandId:Qt(e),rawOptions:n}),Qt=e=>st({verbose:e})?$t++:void 0;let $t=0n;const en=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!pt.includes(t)&&!ft(t)){let e=pt.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}},tn=()=>b.bigint(),nn=e=>Number(b.bigint()-e)/1e6,rn=(e,t,n)=>{let r=tn(),{command:i,escapedCommand:a}=mt(e,t),o=Zt(Je(n,`verbose`),a,{...n});return Xt(a,o),{command:i,escapedCommand:a,startTime:r,verboseInfo:o}};var an=e(n(),1);h(s);function on(e){return e instanceof URL?a(e):e}function sn(e){return{*[Symbol.iterator](){let t=C.resolve(on(e)),n;for(;n!==t;)yield t,n=t,t=C.resolve(t,`..`)}}}const cn=({cwd:e=_.cwd(),path:t=_.env[r()],preferLocal:n=!0,execPath:i=_.execPath,addExecPath:a=!0}={})=>{let o=C.resolve(on(e)),s=[],c=t.split(C.delimiter);return n&&ln(s,c,o),a&&un(s,c,i,o),t===``||t===C.delimiter?`${s.join(C.delimiter)}${t}`:[...s,t].join(C.delimiter)},ln=(e,t,n)=>{for(let r of sn(n)){let n=C.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},un=(e,t,n,r)=>{let i=C.resolve(r,on(n),`..`);t.includes(i)||e.push(i)},dn=({env:e=_.env,...t}={})=>{e={...e};let n=r({env:e});return t.path=e[n],e[n]=cn(t),e},fn=(e,t,n)=>new(n?vn:_n)(t,e instanceof I?{}:{cause:e});var I=class extends Error{};const pn=(e,t)=>{Object.defineProperty(e.prototype,`name`,{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,hn,{value:!0,writable:!1,enumerable:!1,configurable:!1})},mn=e=>gn(e)&&hn in e,hn=Symbol(`isExecaError`),gn=e=>Object.prototype.toString.call(e)===`[object Error]`;var _n=class extends Error{};pn(_n,_n.name);var vn=class extends Error{};pn(vn,vn.name);const yn=()=>{let e=64-xn+1;return Array.from({length:e},bn)},bn=(e,t)=>({name:`SIGRT${t+1}`,number:xn+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),xn=34,Sn=[{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`}],Cn=()=>{let e=yn();return[...Sn,...e].map(wn)},wn=({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}},Tn=()=>{let e=Cn();return Object.fromEntries(e.map(En))},En=({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}],Dn=Tn(),On=()=>{let e=Cn(),t=Array.from({length:65},(t,n)=>kn(n,e));return Object.assign({},...t)},kn=(e,t)=>{let n=An(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}}},An=(e,t)=>{let n=t.find(({name:t})=>T.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n};On();const jn=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return Nn(e,t)},Mn=e=>e===0?e:Nn(e,"`subprocess.kill()`'s argument"),Nn=(e,t)=>{if(Number.isInteger(e))return Pn(e,t);if(typeof e==`string`)return In(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${Ln()}`)},Pn=(e,t)=>{if(Fn.has(e))return Fn.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${Ln()}`)},Fn=new Map(Object.entries(T.signals).reverse().map(([e,t])=>[t,e])),In=(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${Ln()}`)},Ln=()=>`Available signal names: ${Rn()}.
|
|
10
|
+
Available signal numbers: ${zn()}.`,Rn=()=>Object.keys(T.signals).sort().map(e=>`'${e}'`).join(`, `),zn=()=>[...new Set(Object.values(T.signals).sort((e,t)=>e-t))].join(`, `),Bn=e=>Dn[e].description,Vn=e=>{if(e===!1)return e;if(e===!0)return Hn;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Hn=1e3*5,Un=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Wn(o,s,n);Gn(l,r);let u=e(c);return Kn({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Wn=(e,t,n)=>{let[r=n,i]=gn(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&&!gn(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Mn(r),error:i}},Gn=(e,t)=>{e!==void 0&&t.reject(e)},Kn=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&qn({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},qn=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await te(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??=!0)}catch{}},Jn=async(e,t)=>{e.aborted||await E(e,`abort`,{signal:t})},Yn=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Xn=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[Zn(e,t,r,i)],Zn=async(e,t,n,{signal:r})=>{throw await Jn(t,r),n.terminationReason??=`cancel`,e.kill(),t.reason},Qn=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{$n(e,t,n),er(e,t,r)},$n=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},er=(e,t,n)=>{if(!n)throw Error(`${L(e,t)} cannot be used: the ${R(t)} has already exited or disconnected.`)},tr=e=>{throw Error(`${L(`getOneMessage`,e)} could not complete: the ${R(e)} exited or disconnected.`)},nr=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
|
+
]);`)},rr=(e,t)=>Error(`${L(`sendMessage`,t)} failed when sending an acknowledgment response to the ${R(t)}.`,{cause:e}),ir=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} is not listening to incoming messages.`)},ar=e=>{throw Error(`${L(`sendMessage`,e)} failed: the ${R(e)} exited without listening to incoming messages.`)},or=()=>Error(`\`cancelSignal\` aborted: the ${R(!0)} disconnected.`),sr=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},cr=({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})},lr=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(ur(e))throw Error(`${L(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},ur=({code:e,message:t})=>dr.has(e)||fr.some(e=>t.includes(e)),dr=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),fr=[`could not be cloned`,`circular structure`,`call stack size exceeded`],L=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${pr(t)}${e}(${n})`,pr=e=>e?``:`subprocess.`,R=e=>e?`parent process`:`subprocess`,mr=e=>{e.connected&&e.disconnect()},hr=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)},gr=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=z.get(e),i=vr(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(xr(i,t,n,!0));return a},_r=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=z.get(e),i=vr(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(xr(i,t,n,!1));return a},z=new WeakMap,vr=(e,t,n)=>{let r=yr(t,n);return br(r,t,n,e),r},yr=(e,t)=>{let n=tt(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${B(t)}" must not be "${e}".
|
|
17
|
+
It must be ${r} or "fd3", "fd4" (and so on).
|
|
18
|
+
It is optional and defaults to "${i}".`)},br=(e,t,n,r)=>{let i=r[Cr(e)];if(i===void 0)throw TypeError(`"${B(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(`"${B(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${B(n)}" must not be ${t}. It must be a writable stream, not readable.`)},xr=(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}=Sr(e,n);return`The "${i}: ${wr(a)}" option is incompatible with using "${B(r)}: ${wr(t)}".
|
|
20
|
+
Please set this option with "pipe" instead.`},Sr=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=Cr(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]}},Cr=e=>e===`all`?1:e,B=e=>e?`to`:`from`,wr=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`,Tr=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),re(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))},Er=(e,t)=>{t&&Dr(e)},Dr=e=>{e.refCounted()},Or=(e,t)=>{t&&kr(e)},kr=e=>{e.unrefCounted()},Ar=(e,t)=>{t&&(kr(e),kr(e))},jr=(e,t)=>{t&&(Dr(e),Dr(e))},Mr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(Ur(i)||li(i))return;Pr.has(e)||Pr.set(e,[]);let a=Pr.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await Zr(e,r,i),await w.yield();let o=await Hr({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},Nr=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{di();let a=Pr.get(e);for(;a?.length>0;)await E(r,`message:done`);e.removeListener(`message`,i),jr(t,n),r.connected=!1,r.emit(`disconnect`)},Pr=new WeakMap,Fr=(e,t,n)=>{if(Ir.has(e))return Ir.get(e);let r=new ne;return r.connected=!0,Ir.set(e,r),Lr({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Ir=new WeakMap,Lr=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=Mr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Nr.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Ar(n,r)},Rr=e=>{let t=Ir.get(e);return t===void 0?e.channel!==null:t.connected},zr=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=Qr(e,Fr(e,t,n));return{id:Br++,type:qr,message:r,hasListeners:a}};let Br=0n;const Vr=(e,t)=>{if(!(t?.type!==qr||t.hasListeners))for(let{id:t}of e)t!==void 0&&Gr[t].resolve({isDeadlock:!0,hasListeners:!1})},Hr=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==qr||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:Jr,message:Qr(t,i)};try{await ei({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},Ur=e=>{if(e?.type!==Jr)return!1;let{id:t,message:n}=e;return Gr[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},Wr=async(e,t,n)=>{if(e?.type!==qr)return;let r=hr();Gr[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,Kr(t,n,i)]);e&&nr(n),a||ir(n)}finally{i.abort(),delete Gr[e.id]}},Gr={},Kr=async(e,t,{signal:n})=>{Tr(e,1,n),await E(e,`disconnect`,{signal:n}),ar(t)},qr=`execa:ipc:request`,Jr=`execa:ipc:response`,Yr=(e,t,n)=>{V.has(e)||V.set(e,new Set);let r=V.get(e),i={onMessageSent:hr(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},Xr=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Zr=async(e,t,n)=>{for(;!Qr(e,t)&&V.get(e)?.size>0;){let t=[...V.get(e)];Vr(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},V=new WeakMap,Qr=(e,t)=>t.listenerCount(`message`)>$r(e),$r=e=>z.has(e)&&!ot(z.get(e).options.buffer,`ipc`)?1:0,ei=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return Qn({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),ti({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},ti=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=zr({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=Yr(e,o,a);try{await ni({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw mr(e),t}finally{Xr(s)}},ni=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=ri(e);try{await Promise.all([Wr(r,e,n),a(r)])}catch(e){throw cr({error:e,methodName:t,isSubprocess:n}),lr({error:e,methodName:t,isSubprocess:n,message:i}),e}},ri=e=>{if(ii.has(e))return ii.get(e);let t=h(e.send.bind(e));return ii.set(e,t),t},ii=new WeakMap,ai=(e,t)=>{let n=`cancelSignal`;return er(n,!1,e.connected),ni({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:ui,message:t},message:t})},oi=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await si({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),fi.signal),si=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!ci){if(ci=!0,!r){sr();return}if(t===null){di();return}Fr(e,t,n),await w.yield()}};let ci=!1;const li=e=>e?.type===ui?(fi.abort(e.message),!0):!1,ui=`execa:ipc:cancel`,di=()=>{fi.abort(or())},fi=new AbortController,pi=({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.")}},mi=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[hi({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],hi=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{throw await Jn(t,i),await ai(e,gi(t)),qn({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??=`gracefulCancel`,t.reason},gi=({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},_i=({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})`)},vi=(e,t,n,r)=>t===0||t===void 0?[]:[yi(e,t,n,r)],yi=async(e,t,n,{signal:r})=>{throw await te(t,void 0,{signal:r}),n.terminationReason??=`timeout`,e.kill(),new I},bi=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},xi=(e,t,{node:n=!1,nodePath:r=y,nodeOptions:i=v.filter(e=>!e.startsWith(`--inspect`)),cwd:a,execPath:o,...s})=>{if(o!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);let c=ye(r,`The "nodePath" option`),l=C.resolve(a,c),u={...s,nodePath:l,node:n,cwd:a};if(!n)return[e,t,u];if(C.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[l,[...i,e,...t],{ipc:!0,...u,shell:!1}]},Si=({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`.");Ci[n](e)}},Ci={advanced:e=>{try{oe(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})}}},wi=async(e,t)=>{t!==void 0&&await e.sendMessage(t)},Ti=({encoding:e})=>{if(Di.has(e))return;let t=Oi(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${Ai(e)}\`.
|
|
21
|
+
Please rename it to ${Ai(t)}.`);let n=[...Di].map(e=>Ai(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${Ai(e)}\`.
|
|
22
|
+
Please rename it to one of: ${n}.`)},Ei=new Set([`utf8`,`utf16le`]),H=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),Di=new Set([...Ei,...H]),Oi=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in ki)return ki[t];if(Di.has(t))return t},ki={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},Ai=e=>typeof e==`string`?`"${e}"`:String(e),ji=(e=Mi())=>{let t=ye(e,`The "cwd" option`);return C.resolve(t)},Mi=()=>{try{return _.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},Ni=(e,t)=>{if(t===Mi())return e;let n;try{n=de(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`},Pi=(e,t,n)=>{n.cwd=ji(n.cwd);let[r,i,a]=xi(e,t,n),{command:o,args:s,options:c}=an.default._parse(r,i,a),l=Fi(qe(c));return _i(l),Ti(l),Si(l),Yn(l),pi(l),l.shell=Se(l.shell),l.env=Ii(l),l.killSignal=jn(l.killSignal),l.forceKillAfterDelay=Vn(l.forceKillAfterDelay),l.lines=l.lines.map((e,t)=>e&&!H.has(l.encoding)&&l.buffer[t]),_.platform===`win32`&&C.basename(o,`.exe`)===`cmd`&&s.unshift(`/q`),{file:o,commandArguments:s,options:l}},Fi=({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}),Ii=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{..._.env,...e}:e;return n||r?dn({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o},Li=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n];function Ri(e){if(typeof e==`string`)return zi(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return Bi(e)}const zi=e=>e.at(-1)===Vi?e.slice(0,e.at(-2)===Ui?-2:-1):e,Bi=e=>e.at(-1)===Hi?e.subarray(0,e.at(-2)===Wi?-2:-1):e,Vi=`
|
|
23
|
+
`,Hi=`
|
|
24
|
+
`.codePointAt(0),Ui=`\r`,Wi=`\r`.codePointAt(0);function U(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function Gi(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write==`function`&&typeof e.end==`function`&&typeof e.writable==`boolean`&&typeof e.writableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function Ki(e,{checkOpen:t=!0}={}){return U(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read==`function`&&typeof e.readable==`boolean`&&typeof e.readableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function qi(e,t){return Gi(e,t)&&Ki(e,t)}const Ji=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);var Yi=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 Xi=Symbol();function Zi(){return this[Xi].next()}Object.defineProperty(Zi,`name`,{value:`next`});function Qi(e){return this[Xi].return(e)}Object.defineProperty(Qi,`name`,{value:`return`});const $i=Object.create(Ji,{next:{enumerable:!0,configurable:!0,writable:!0,value:Zi},return:{enumerable:!0,configurable:!0,writable:!0,value:Qi}});function ea({preventCancel:e=!1}={}){let t=new Yi(this.getReader(),e),n=Object.create($i);return n[Xi]=t,n}const ta=e=>{if(Ki(e,{checkOpen:!1})&&aa.on!==void 0)return ra(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(na.call(e)===`[object ReadableStream]`)return ea.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:na}=Object.prototype,ra=async function*(e){let t=new AbortController,n={};ia(e,t,n);try{for await(let[n]of aa.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()}},ia=async(e,t,n)=>{try{await aa.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},aa={},oa=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=ta(e),u=t();u.length=0;try{for await(let e of l)ca({convertedChunk:n[ua(e)](e,u),state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c});return sa({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}},sa=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&ca({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},ca=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){la(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&la(c,t,i,a),new fa},la=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},ua=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=da.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&da.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:da}=Object.prototype;var fa=class extends Error{name=`MaxBufferError`;constructor(){super(`maxBuffer exceeded`)}};const W=e=>e,pa=()=>void 0,ma=({contents:e})=>e,ha=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},ga=e=>e.length;async function _a(e,t){return oa(e,va,t)}const va={init:()=>({contents:[]}),convertChunk:{string:W,buffer:W,arrayBuffer:W,dataView:W,typedArray:W,others:W},getSize:()=>1,truncateChunk:pa,addChunk:(e,{contents:t})=>(t.push(e),t),getFinalChunk:pa,finalize:ma};async function ya(e,t){return oa(e,Na,t)}const ba=()=>({contents:new ArrayBuffer(0)}),xa=e=>Sa.encode(e),Sa=new TextEncoder,Ca=e=>new Uint8Array(e),wa=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ta=(e,t)=>e.slice(0,t),Ea=(e,{contents:t,length:n},r)=>{let i=Ma()?Oa(t,r):Da(t,r);return new Uint8Array(i).set(e,n),i},Da=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(ka(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},Oa=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:ka(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},ka=e=>Aa**Math.ceil(Math.log(e)/Math.log(Aa)),Aa=2,ja=({contents:e,length:t})=>Ma()?e:e.slice(0,t),Ma=()=>`resize`in ArrayBuffer.prototype,Na={init:ba,convertChunk:{string:xa,buffer:Ca,arrayBuffer:Ca,dataView:wa,typedArray:wa,others:ha},getSize:ga,truncateChunk:Ta,addChunk:Ea,getFinalChunk:pa,finalize:ja};async function Pa(e,t){return oa(e,La,t)}const Fa=()=>({contents:``,textDecoder:new TextDecoder}),Ia=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),La={init:Fa,convertChunk:{string:W,buffer:Ia,arrayBuffer:Ia,dataView:Ia,typedArray:Ia,others:ha},getSize:ga,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:ma},Ra=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof fa))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:za(n,r,i)},t.destroy(),e},za=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,Ba=(e,t,n)=>{if(t.length!==n)return;let r=new fa;throw r.maxBufferInfo={fdNumber:`ipc`},r},Va=(e,t)=>{let{streamName:n,threshold:r,unit:i}=Ha(e,t);return`Command's ${n} was larger than ${r} ${i}`},Ha=(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=ot(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:Ke(n),threshold:i,unit:r}},Ua=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>Ga(n)),Wa=(e,t,n)=>{if(!t)return e;let r=Ga(n);return e.length>r?e.slice(0,r):e},Ga=([,e])=>e,Ka=({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=qa({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=Ya(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=>Xa(e)).join(`
|
|
25
|
+
`)].map(e=>ht(Ri(Za(e)))).filter(Boolean).join(`
|
|
26
|
+
|
|
27
|
+
`)}},qa=({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=Ja(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?`${Va(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Bn(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}`},Ja=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,Ya=(e,t)=>{if(e instanceof I)return;let n=ht(Ni(mn(e)?e.originalMessage:String(e?.message??e),t));return n===``?void 0:n},Xa=e=>typeof e==`string`?e:m(e),Za=e=>Array.isArray(e)?e.map(e=>Ri(Qa(e))).filter(Boolean).join(`
|
|
28
|
+
`):Qa(e),Qa=e=>typeof e==`string`?e:A(e)?ke(e):``,$a=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>ro({command:e,escapedCommand:t,cwd:a,durationMs:nn(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:[]}),eo=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>to({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}),to=({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}=io(l,u),{originalMessage:w,shortMessage:ee,message:te}=Ka({stdio:d,all:f,ipcOutput:p,originalError:e,signal:S,signalDescription:C,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),T=fn(e,te,b);return Object.assign(T,no({error:T,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:S,signalDescription:C,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:w,shortMessage:ee})),T},no=({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:_})=>ro({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:nn(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:[]}),ro=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),io=(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:Bn(t)}},ao=e=>Number.isFinite(e)?e:0;function oo(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(ao(e*1e3)%1e3),nanoseconds:Math.trunc(ao(e*1e6)%1e3)}}function so(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 co(e){switch(typeof e){case`number`:if(Number.isFinite(e))return oo(e);break;case`bigint`:return so(e)}throw TypeError(`Expected a finite number or bigint`)}const lo=e=>e===0||e===0n,uo=(e,t)=>t===1||t===1n?e:`${e}s`,fo=24n*60n*60n*1000n;function po(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)&&lo(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?` `+uo(n,e):r;i.push(a)}},s=co(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%fo):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 mo=(e,t)=>{e.failed&&F({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})},ho=(e,t)=>{st(t)&&(mo(e,t),go(e,t))},go=(e,t)=>{F({type:`duration`,verboseMessage:`(done in ${po(e.durationMs)})`,verboseInfo:t,result:e})},_o=(e,t,{reject:n})=>{if(ho(e,t),e.failed&&n)throw e;return e},vo=(e,t)=>G(e)?`asyncGenerator`:Do(e)?`generator`:ko(e)?`fileUrl`:jo(e)?`filePath`:Ro(e)?`webStream`:U(e,{checkOpen:!1})?`native`:A(e)?`uint8Array`:Bo(e)?`asyncIterable`:Vo(e)?`iterable`:zo(e)?xo({transform:e},t):Oo(e)?yo(e,t):`native`,yo=(e,t)=>qi(e.transform,{checkOpen:!1})?bo(e,t):zo(e.transform)?xo(e,t):wo(e,t),bo=(e,t)=>(So(e,t,`Duplex stream`),`duplex`),xo=(e,t)=>(So(e,t,`web TransformStream`),`webTransform`),So=({final:e,binary:t,objectMode:n},r,i)=>{Co(e,`${r}.final`,i),Co(t,`${r}.binary`,i),To(n,`${r}.objectMode`)},Co=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},wo=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!Eo(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(qi(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(zo(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!Eo(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return To(n,`${i}.binary`),To(r,`${i}.objectMode`),G(e)||G(t)?`asyncGenerator`:`generator`},To=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},Eo=e=>G(e)||Do(e),G=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,Do=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Oo=e=>k(e)&&(e.transform!==void 0||e.final!==void 0),ko=e=>Object.prototype.toString.call(e)===`[object URL]`,Ao=e=>ko(e)&&e.protocol!==`file:`,jo=e=>k(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>Mo.has(e))&&No(e.file),Mo=new Set([`file`,`append`]),No=e=>typeof e==`string`,Po=(e,t)=>e===`native`&&typeof t==`string`&&!Fo.has(t),Fo=new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),Io=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,Lo=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,Ro=e=>Io(e)||Lo(e),zo=e=>Io(e?.readable)&&Lo(e?.writable),Bo=e=>Ho(e)&&typeof e[Symbol.asyncIterator]==`function`,Vo=e=>Ho(e)&&typeof e[Symbol.iterator]==`function`,Ho=e=>typeof e==`object`&&!!e,K=new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),Uo=new Set([`fileUrl`,`filePath`,`fileNumber`]),Wo=new Set([`fileUrl`,`filePath`]),Go=new Set([...Wo,`webStream`,`nodeStream`]),Ko=new Set([`webTransform`,`duplex`]),qo={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`},Jo=(e,t,n,r)=>r===`output`?Yo(e,t,n):Xo(e,t,n),Yo=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},Xo=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t!==n.length-1&&(e??r)}},Zo=(e,t)=>{let n=e.findLast(({type:e})=>K.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode},Qo=(e,t,n,r)=>[...e.filter(({type:e})=>!K.has(e)),...$o(e,t,n,r)],$o=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>K.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=es({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return is(a,n)},es=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?ts({stdioItem:e,optionName:i}):t===`webTransform`?ns({stdioItem:e,index:n,newTransforms:r,direction:a}):rs({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),ts=({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}}},ns=({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}=Jo(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},rs=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:a})=>{let{transform:o,final:s,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=k(t)?t:{transform:t},d=c||H.has(a),{writableObjectMode:f,readableObjectMode:p}=Jo(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},is=(e,t)=>t===`input`?e.reverse():e,as=(e,t,n)=>{let r=e.map(e=>os(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)??ds},os=({type:e,value:t},n)=>ss[n]??ls[e](t),ss=[`input`,`output`,`output`],q=()=>void 0,cs=()=>`input`,ls={generator:q,asyncGenerator:q,fileUrl:q,filePath:q,iterable:cs,asyncIterable:cs,uint8Array:cs,webStream:e=>Lo(e)?`output`:`input`,nodeStream(e){return Ki(e,{checkOpen:!1})?Gi(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:q,duplex:q,native(e){let t=us(e);if(t!==void 0)return t;if(U(e,{checkOpen:!1}))return ls.nodeStream(e)}},us=e=>{if([0,_.stdin].includes(e))return`input`;if([1,2,_.stdout,_.stderr].includes(e))return`output`},ds=`output`,fs=(e,t)=>t&&!e.includes(`ipc`)?[...e,`ipc`]:e,ps=({stdio:e,ipc:t,buffer:n,...r},i,a)=>{let o=ms(e,r).map((e,t)=>gs(e,t));return a?_s(o,n,i):fs(o,t)},ms=(e,t)=>{if(e===void 0)return N.map(e=>t[e]);if(hs(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])},hs=e=>N.some(t=>e[t]!==void 0),gs=(e,t)=>Array.isArray(e)?e.map(e=>gs(e,t)):e??(t>=N.length?`ignore`:`pipe`),_s=(e,t,n)=>e.map((e,r)=>!t[r]&&r!==0&&!ct(n,r)&&vs(e)?`ignore`:e),vs=e=>e===`pipe`||Array.isArray(e)&&e.every(e=>e===`pipe`),ys=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?bs({stdioItem:e,fdNumber:r,direction:i}):Cs({stdioItem:e,fdNumber:r}),bs=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=xs({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(U(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},xs=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=Ss(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(S.isatty(i))throw TypeError(`The \`${t}: ${wr(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,value:j(ue(i)),optionName:t}}},Ss=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=Ge.indexOf(e);if(n!==-1)return n},Cs=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:ws(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:ws(t,t,n),optionName:n}:U(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,ws=(e,t,n)=>{let r=Ge[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r},Ts=({input:e,inputFile:t},n)=>n===0?[...Es(e),...Os(t)]:[],Es=e=>e===void 0?[]:[{type:Ds(e),value:e,optionName:`input`}],Ds=e=>{if(Ki(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.")},Os=e=>e===void 0?[]:[{...ks(e),optionName:`inputFile`}],ks=e=>{if(ko(e))return{type:`fileUrl`,value:e};if(No(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")},As=e=>e.filter((t,n)=>e.every((e,r)=>t.value!==e.value||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),js=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=Ms(i,e);if(o.length!==0){if(a){Ns({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});return}if(Go.has(e))return Ps({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});Ko.has(e)&&Is({otherStdioItems:o,type:e,value:t,optionName:n})}},Ms=(e,t)=>e.flatMap(({direction:e,stdioItems:n})=>n.filter(e=>e.type===t).map((t=>({...t,direction:e})))),Ns=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Wo.has(t)&&Ps({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Ps=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>Fs(e,n));if(a.length!==0)return Ls(a.find(e=>e.direction!==i),r,t),i===`output`?a[0].stream:void 0},Fs=({type:e,value:t},n)=>e===`filePath`?t.file===n.file:e===`fileUrl`?t.href===n.href:t===n,Is=({otherStdioItems:e,type:t,value:n,optionName:r})=>{Ls(e.find(({value:{transform:e}})=>e===n.transform),r,t)},Ls=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${qo[n]} that is the same.`)},Rs=(e,t,n,r)=>{let i=qs({initialFileDescriptors:ps(t,n,r).map((e,n)=>zs({stdioOption:e,fdNumber:n,options:t,isSync:r})),addProperties:e,options:t,isSync:r});return t.stdio=i.map(({stdioItems:e})=>Zs(e)),i},zs=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=Ke(t),{stdioItems:a,isStdioArray:o}=Bs({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=as(a,t,i),c=Qo(a.map(e=>ys({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),i,s,n),l=Zo(c,s);return Ks(c,l),{direction:s,objectMode:l,stdioItems:c}},Bs=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=As([...(Array.isArray(e)?e:[e]).map(e=>Vs(e,r)),...Ts(n,t)]),a=i.length>1;return Hs(i,a,r),Ws(i),{stdioItems:i,isStdioArray:a}},Vs=(e,t)=>({type:vo(e,t),value:e,optionName:t}),Hs=(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(Us.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},Us=new Set([`ignore`,`ipc`]),Ws=e=>{for(let t of e)Gs(t)},Gs=({type:e,value:t,optionName:n})=>{if(Ao(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(Po(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},Ks=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>Uo.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},qs=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)i.push(Js({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(e){throw Xs(i),e}},Js=({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:a,isSync:o})=>({direction:e,objectMode:t,stdioItems:n.map(t=>Ys({stdioItem:t,addProperties:i,direction:e,options:a,fileDescriptors:r,isSync:o}))}),Ys=({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:a})=>{let o=js({stdioItem:e,direction:n,fileDescriptors:i,isSync:a});return o===void 0?{...e,...t[n][e.type](e,r)}:{...e,stream:o}},Xs=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)e!==void 0&&!M(e)&&e.destroy()},Zs=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`},Qs=(e,t)=>Rs(nc,e,t,!0),J=({type:e,optionName:t})=>{ec(t,qo[e])},$s=({optionName:e,value:t})=>((t===`ipc`||t===`overlapped`)&&ec(e,`"${t}"`),{}),ec=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},tc={generator(){},asyncGenerator:J,webStream:J,nodeStream:J,webTransform:J,duplex:J,asyncIterable:J,native:$s},nc={input:{...tc,fileUrl:({value:e})=>({contents:[j(ue(e))]}),filePath:({value:{file:e}})=>({contents:[j(ue(e))]}),fileNumber:J,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...tc,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:J,string:J,uint8Array:J}},Y=(e,{stripFinalNewline:t},n)=>rc(t,n)&&e!==void 0&&!Array.isArray(e)?Ri(e):e,rc=(e,t)=>t===`all`?e[1]||e[2]:e[t],ic=(e,t,n,r)=>e||n?void 0:sc(t,r),ac=(e,t,n)=>n?e.flatMap(e=>oc(e,t)):oc(e,t),oc=(e,t)=>{let{transform:n,final:r}=sc(t,{});return[...n(e),...r()]},sc=(e,t)=>(t.previousChunks=``,{transform:cc.bind(void 0,t,e),final:uc.bind(void 0,t)}),cc=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=lc(n,a,t,e),s=n.slice(i+1,a+1-o);r.length>0&&(s=pc(r,s),r=``),yield s,i=a}i!==n.length-1&&(r=pc(r,n.slice(i+1))),e.previousChunks=r},lc=(e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]===`\r`,r.isWindowsNewline?2:1),uc=function*({previousChunks:e}){e.length>0&&(yield e)},dc=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:fc.bind(void 0,r)},fc=function*({isWindowsNewline:e=!1},t){let{unixNewline:n,windowsNewline:r,LF:i,concatBytes:a}=typeof t==`string`?mc:hc;if(t.at(-1)===i){yield t;return}yield a(t,e?r:n)},pc=(e,t)=>`${e}${t}`,mc={windowsNewline:`\r
|
|
31
|
+
`,unixNewline:`
|
|
32
|
+
`,LF:`
|
|
33
|
+
`,concatBytes:pc},hc={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}},gc=(e,t)=>e?void 0:_c.bind(void 0,t),_c=function*(e,t){if(typeof t!=`string`&&!A(t)&&!ve.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},vc=(e,t)=>e?yc.bind(void 0,t):bc.bind(void 0,t),yc=function*(e,t){xc(e,t),yield t},bc=function*(e,t){if(xc(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},xc=(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; }`)},Sc=(e,t,n)=>{if(n)return;if(e)return{transform:Cc.bind(void 0,new TextEncoder)};let r=new u(t);return{transform:wc.bind(void 0,r),final:Tc.bind(void 0,r)}},Cc=function*(e,t){ve.isBuffer(t)?yield j(t):typeof t==`string`?yield e.encode(t):yield t},wc=function*(e,t){yield A(t)?e.write(t):t},Tc=function*(e){let t=e.end();t!==``&&(yield t)},Ec=f(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),Dc=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=jc}=t[n];for await(let i of r(e))yield*Dc(i,t,n+1)},Oc=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*kc(n,Number(t),e)},kc=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*Dc(r,n,t+1)},Ac=f(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),jc=function*(e){yield e},Mc=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(e)}},Nc=(e,t)=>[...t.flatMap(t=>[...X(t,e,0)]),...Pc(e)],X=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Ic}=t[n];for(let i of r(e))yield*X(i,t,n+1)},Pc=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Fc(n,Number(t),e)},Fc=function*(e,t,n){if(e!==void 0)for(let r of e())yield*X(r,n,t+1)},Ic=function*(e){yield e},Lc=({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:a},{encoding:o})=>{let s={},c=zc(e,o,a),l=G(t),u=G(n),d=l?Ec.bind(void 0,Dc,s):Mc.bind(void 0,X),f=l||u?Ec.bind(void 0,Oc,s):Mc.bind(void 0,Pc),p=l||u?Ac.bind(void 0,s):void 0;return{stream:new he({writableObjectMode:r,writableHighWaterMark:_e(r),readableObjectMode:i,readableHighWaterMark:_e(i),transform(e,t,n){d([e,c,0],this,n)},flush(e){f([c],this,e)},destroy:p})}},Rc=(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=Nc(zc(t,n,r),e);return e},zc=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:gc(r,s)},Sc(n,o,r),ic(n,a,r,c),{transform:e,final:t},{transform:vc(i,s)},dc({binary:n,preserveNewlines:a,readableObjectMode:i,state:c})].filter(Boolean)},Bc=(e,t)=>{for(let n of Vc(e))Hc(e,n,t)},Vc=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),Hc=(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 ${qo[e]} with synchronous methods.`)}n.input=Me(i.map(({contents:e})=>e).map(e=>Uc(e,r)))}},Uc=(e,t)=>{let n=Rc(e,t,`utf8`,!0);return Wc(n),Me(n)},Wc=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}.`)},Gc=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&ct(n,r)&&!H.has(t)&&Kc(r)&&(e.some(({type:e,value:t})=>e===`native`&&qc.has(t))||e.every(({type:e})=>K.has(e))),Kc=e=>e===1||e===2,qc=new Set([`pipe`,`overlapped`]),Jc=async(e,t,n,r)=>{for await(let i of e)Xc(t)||Zc(i,n,r)},Yc=(e,t,n)=>{for(let r of e)Zc(r,t,n)},Xc=e=>e._readableState.pipes.length>0,Zc=(e,t,n)=>{F({type:`output`,verboseMessage:Jt(e),fdNumber:t,verboseInfo:n})},Qc=({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)=>$c({result:t,fileDescriptors:e,fdNumber:s,state:a,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...a}},$c=({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(Wa(e,a,d)),{stdioItems:p,objectMode:m}=t[n],{serializedResult:h,finalResult:g=h}=tl({chunks:el([f],p,c,r),objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});nl({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&&rl(h,p,i),_}catch(e){return r.error=e,_}},el=(e,t,n,r)=>{try{return Rc(e,t,n,!1)}catch(t){return r.error=t,e}},tl=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e};if(n===`buffer`)return{serializedResult:Me(e)};let o=Ae(e,n);return r[a]?{serializedResult:o,finalResult:ac(o,!i[a],t)}:{serializedResult:o}},nl=({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:a,objectMode:o})=>{if(!Gc({stdioItems:a,encoding:i,verboseInfo:r,fdNumber:t}))return;let s=ac(e,!1,o);try{Yc(s,t,r)}catch(e){n.error??=e}},rl=(e,t,n)=>{for(let{path:r,append:i}of t.filter(({type:e})=>Uo.has(e))){let t=typeof r==`string`?r:r.toString();i||n.has(t)?se(r,e):(n.add(t),fe(r,e))}},il=([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Y(t,n,`all`)]:Array.isArray(t)?[Y(e,n,`all`),...t]:A(e)&&A(t)?Pe([e,t]):`${e}${t}`},al=async(e,t)=>{let[n,r]=await ol(e);return t.isForcefullyTerminated??=!1,[n,r]},ol=async e=>{let[t,n]=await Promise.allSettled([E(e,`spawn`),E(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?sl(e):n.value},sl=async e=>{try{return await E(e,`exit`)}catch{return sl(e)}},cl=async e=>{let[t,n]=await e;if(!ll(t,n)&&ul(t,n))throw new I;return[t,n]},ll=(e,t)=>e===void 0&&t===void 0,ul=(e,t)=>e!==0||t!==null,dl=({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{let a=fl(e,t,n);return{resultError:a,exitCode:t,signal:n,timedOut:a?.code===`ETIMEDOUT`,isMaxBuffer:Ua(a,r,i)}},fl=(e,t,n)=>e===void 0?ul(t,n)?new I:void 0:e,pl=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=ml(e,t,n);return _o(vl({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s}),c,l)},ml=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=rn(e,t,n),{file:s,commandArguments:c,options:l}=Pi(e,t,hl(n));return gl(l),{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:l,fileDescriptors:Qs(l,o)}},hl=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,gl=({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&_l(`ipcInput`),e&&_l(`ipc: true`),n&&_l(`detached: true`),r&&_l(`cancelSignal`)},_l=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},vl=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=yl({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}=dl(c,n),{output:m,error:h=l}=Qc({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:p,verboseInfo:a});return xl({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:m.map((e,t)=>Y(e,n,t)),all:Y(il(m,n),n,`all`),options:n,command:r,escapedCommand:i,startTime:s})},yl=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:o})=>{try{return Bc(a,n),l(...Li(e,t,bl(n)))}catch(e){return eo({error:e,command:r,escapedCommand:i,fileDescriptors:a,options:n,startTime:o,isSync:!0})}},bl=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:Ga(t)}),xl=({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?$a({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):to({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}),Sl=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:a}={})=>(Qn({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:Rr(e)}),Cl({anyProcess:e,channel:t,isSubprocess:n,filter:a,reference:i})),Cl=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{Er(t,i);let a=Fr(e,t,n),o=new AbortController;try{return await Promise.race([wl(a,r,o),Tl(a,n,o),El(a,n,o)])}catch(t){throw mr(e),t}finally{o.abort(),Or(t,i)}},wl=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await E(e,`message`,{signal:n});return t}for await(let[r]of ie(e,`message`,{signal:n}))if(t(r))return r},Tl=async(e,t,{signal:n})=>{await E(e,`disconnect`,{signal:n}),tr(t)},El=async(e,t,{signal:n})=>{let[r]=await E(e,`strict:error`,{signal:n});throw rr(r,t)},Dl=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>Ol({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),Ol=({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:a})=>{Qn({methodName:`getEachMessage`,isSubprocess:n,ipc:r,isConnected:Rr(e)}),Er(t,a);let o=Fr(e,t,n),s=new AbortController,c={};return kl(e,o,s),Al({ipcEmitter:o,isSubprocess:n,controller:s,state:c}),jl({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:s,state:c,reference:a})},kl=async(e,t,n)=>{try{await E(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},Al=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await E(e,`strict:error`,{signal:n.signal});r.error=rr(i,t),n.abort()}catch{}},jl=async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:a,state:o,reference:s}){try{for await(let[e]of ie(n,`message`,{signal:a.signal}))Ml(o),yield e}catch{Ml(o)}finally{a.abort(),Or(t,s),r||mr(e),i&&await e}},Ml=({error:e})=>{if(e)throw e},Nl=(e,{ipc:t})=>{Object.assign(e,Fl(e,!1,t))},Pl=()=>{let e=_,t=_.channel!==void 0;return{...Fl(e,!0,t),getCancelSignal:oi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:!0,ipc:t})}},Fl=(e,t,n)=>({sendMessage:ei.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:Sl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:Dl.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})}),Il=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,verboseInfo:s})=>{Xs(r);let c=new o;return Ll(c,r),Object.assign(c,{readable:Rl,writable:zl,duplex:Bl}),{subprocess:c,promise:Vl(eo({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:!1}),s,i)}},Ll=(e,t)=>{let n=Z(),r=Z(),i=Z(),a=Array.from({length:t.length-3},Z),o=Z(),s=[n,r,i,...a];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:o,stdio:s})},Z=()=>{let e=new me;return e.end(),e},Rl=()=>new O({read(){}}),zl=()=>new ge({write(){}}),Bl=()=>new pe({read(){},write(){}}),Vl=async(e,t,n)=>_o(e,t,n),Hl=(e,t)=>Rs(Wl,e,t,!1),Q=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${qo[e]}.`)},Ul={fileNumber:Q,generator:Lc,asyncGenerator:Lc,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){let r=t||n;return{stream:pe.fromWeb(e,{objectMode:r})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Wl={input:{...Ul,fileUrl:({value:e})=>({stream:ce(e)}),filePath:({value:{file:e}})=>({stream:ce(e)}),webStream:({value:e})=>({stream:O.fromWeb(e)}),iterable:({value:e})=>({stream:O.from(e)}),asyncIterable:({value:e})=>({stream:O.from(e)}),string:({value:e})=>({stream:O.from(e)}),uint8Array:({value:e})=>({stream:O.from(ve.from(e))})},output:{...Ul,fileUrl:({value:e})=>({stream:le(e)}),filePath:({value:{file:e,append:t}})=>({stream:le(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:ge.fromWeb(e)}),iterable:Q,asyncIterable:Q,string:Q,uint8Array:Q}};function 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 _e(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)};var ql=class extends me{#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 ie(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})=>K.has(e)))_u(e,t,o,i);for(let{stream:t}of a.filter(({type:e})=>!K.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)&&Tr(e,xu,t)},xu=2,Su=(e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;let a=i(()=>{e.kill()});re(r,()=>{a()})},Cu=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=tn(),{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}=z.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:gr(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||xe(n)){if(Object.keys(e).length>0)throw TypeError(`Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).`);let[i,a,o]=Ce(n,...r);return{destination:t(Eu)(i,a,o),pipeOptions:o}}if(z.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:_r(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})=>eo({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 Tr(e,Ru,n.signal),Tr(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 d(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:ie(e,`data`,{signal:t.signal,highWaterMark:Zu,highWatermark:Zu}),controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}),Xu=_e(!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*X(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*Pc(s)}},$u=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[Sc(e,n,!t),ic(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:rc(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}})=>{Gc({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n})&&await Jc(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 _a(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await ya(n,{maxBuffer:a})):await Pa(n,{maxBuffer:a})}catch(n){return ad(Ra({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})=>Te(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=>ct(e,`ipc`),Sd=(e,t)=>{F({type:`ipc`,verboseMessage:Jt(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=ot(t,`ipc`),c=ot(n,`ipc`);for await(let t of Ol({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))s&&(Ba(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=al(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}),w=Ed(h,e,y),ee=Dd(m,y);try{return await Promise.race([Promise.all([{},cl(v),Promise.all(b),x,C,wi(e,d),...w,...ee]),g,Od(e,_),...vi(e,a,f,_),...Xn({subprocess:e,cancelSignal:o,gracefulCancel:s,context:f,controller:_}),...mi({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(w),Promise.allSettled(ee)])}},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})=>U(t,{checkOpen:!1})&&!M(t)).map(({type:e,value:r,stream:i=r})=>od(i,n,t,{isSameDirection:K.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=hr();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||H.has(n),{subprocessStdout:s,waitReadableDestroy:c}=zd(e,r,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Bd(s,o),{read:p,onStdoutDataDone:m}=Vd({subprocessStdout:s,subprocess:e,binary:o,encoding:n,preserveNewlines:a}),h=new O({read:p,destroy:f(Wd.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return Ud({subprocessStdout:s,onStdoutDataDone:m,readable:h,subprocess:e}),h},zd=(e,t,n)=>{let r=_r(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=hr(),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 ge({...Jd(r,e,i),destroy:f(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=gr(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:f(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||H.has(n),{subprocessStdout:c,waitReadableDestroy:l}=zd(e,r,t),{subprocessStdin:u,waitWritableFinal:d,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 pe({read:_,...Jd(u,e,d),destroy:f(tf.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:g,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:m});return 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||H.has(t),o=_r(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),z.set(f,{options:u,fileDescriptors:d}),f},uf=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=rn(e,t,n),{file:s,commandArguments:c,options:l}=Pi(e,t,n),u=df(l);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:Hl(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:s})=>{let l;try{l=c(...Li(e,t,n))}catch(e){return Il({error:e,command:a,escapedCommand:o,fileDescriptors:s,options:n,startTime:r,verboseInfo:i})}let u=new AbortController;ae(1/0,u.signal);let d=[...l.stdio];gu(l,s,u),Su(l,n,u);let f={},p=hr();l.kill=Un.bind(void 0,{kill:l.kill.bind(l),options:n,onInternalError:p,context:f,controller:u}),l.all=_d(l,n),af(l,n),Nl(l,n);let m=pf({subprocess:l,options:n,startTime:r,verboseInfo:i,fileDescriptors:s,originalStreams:d,command:a,escapedCommand:o,context:f,onInternalError:p,controller:u});return{subprocess:l,promise:m}},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(),_o(mf({errorInfo:d,exitCode:f,signal:p,stdio:m.map((e,n)=>Y(e,t,n)),all:Y(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?to({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 fa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):$a({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`,...at]),$=(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?pl(s,c,l):lf(s,c,l,i)},yf=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let[a,o,s]=Ce(...Ie(t)?Le(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),$(bi),$(Ef,{},Af,Tf);const{sendMessage:Nf,getOneMessage:Pf,getEachMessage:Ff,getCancelSignal:If}=Pl();var Lf=t({builder:()=>Gf,command:()=>`git`,description:()=>``});const Rf=`git`,zf=``,Bf=process.cwd();function Vf(){try{return!!Mf(`git`,[`--version`],{cwd:Bf}).stdout}catch{throw Error(`git is not installed`)}}function Hf(){try{return Mf(`git`,[`rev-parse`,`--is-inside-work-tree`],{cwd:Bf}).stdout===`true`}catch{throw Error(`not a git repository`)}}function Uf(){return jf(`git`,[`config`,`core.hooksPath`,`.githooks`],{cwd:Bf})}function Wf(){try{return Vf()&&Hf()}catch(e){return console.error(`Fail:`,e.message),!1}}function Gf(e){e.command(`hooks`,`Set .githooks as git.hooksPath`,{},()=>{Wf()&&Uf().then(()=>{console.log(`Done: set .githooks`)}).catch(()=>{console.error(`Fail:`,`setting hooks failed`),process.exitCode=1})}),e.demandCommand(1,"Typing `hooks`")}export{jf as a,Lf as i,Rf as n,zf as r,Gf as t};
|