@gadgetinc/ggt 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/add-FTY6SEGW.js +78 -0
- package/dist/{add-R6TZAGXK.js.map → add-FTY6SEGW.js.map} +2 -2
- package/dist/chunk-6BALPDKR.js +2 -0
- package/dist/{chunk-3V7YWBUK.js.map → chunk-6BALPDKR.js.map} +2 -2
- package/dist/chunk-B2QVXD4S.js +2 -0
- package/dist/{chunk-B6XQEEUK.js.map → chunk-B2QVXD4S.js.map} +2 -2
- package/dist/chunk-DKP76YB2.js +11 -0
- package/dist/{chunk-HCQR6OPH.js.map → chunk-DKP76YB2.js.map} +2 -2
- package/dist/{chunk-NGYGSK7A.js → chunk-FLX4WQHD.js} +7 -5
- package/dist/chunk-FLX4WQHD.js.map +7 -0
- package/dist/chunk-IOJ2LNUK.js +2 -0
- package/dist/{chunk-SGMPMYEU.js.map → chunk-IOJ2LNUK.js.map} +2 -2
- package/dist/chunk-KXSKHE3X.js +65 -0
- package/dist/chunk-KXSKHE3X.js.map +7 -0
- package/dist/chunk-LMY5YGE5.js +121 -0
- package/dist/chunk-LMY5YGE5.js.map +7 -0
- package/dist/chunk-O3D5GVFK.js +8 -0
- package/dist/{chunk-TMPKLC3N.js.map → chunk-O3D5GVFK.js.map} +2 -2
- package/dist/chunk-P5UB5UJ6.js +6 -0
- package/dist/chunk-P5UB5UJ6.js.map +7 -0
- package/dist/chunk-RLMEA3WE.js +2 -0
- package/dist/{chunk-P5OUQ5XQ.js.map → chunk-RLMEA3WE.js.map} +2 -2
- package/dist/chunk-SWVUOPJX.js +12 -0
- package/dist/{chunk-AGRDDZFS.js.map → chunk-SWVUOPJX.js.map} +2 -2
- package/dist/chunk-VF4CDM7R.js +18 -0
- package/dist/{chunk-AGPFNOXG.js.map → chunk-VF4CDM7R.js.map} +2 -2
- package/dist/chunk-WCP5LTNQ.js +50 -0
- package/dist/{chunk-RIIVR43B.js.map → chunk-WCP5LTNQ.js.map} +4 -4
- package/dist/chunk-YB7NQA2X.js +2 -0
- package/dist/{chunk-NO72UU5F.js.map → chunk-YB7NQA2X.js.map} +2 -2
- package/dist/chunk-ZZIIWV6T.js +187 -0
- package/dist/chunk-ZZIIWV6T.js.map +7 -0
- package/dist/deploy-PQZW3X7G.js +25 -0
- package/dist/{deploy-2SXBPB5C.js.map → deploy-PQZW3X7G.js.map} +2 -2
- package/dist/dev-27YLA4GG.js +58 -0
- package/dist/{dev-I23ZQELT.js.map → dev-27YLA4GG.js.map} +2 -2
- package/dist/esm-RPCDY7LG.js +36 -0
- package/dist/esm-RPCDY7LG.js.map +7 -0
- package/dist/list-OTGSESA6.js +11 -0
- package/dist/{list-ML7QUWEU.js.map → list-OTGSESA6.js.map} +2 -2
- package/dist/login-YOXXXAJN.js +2 -0
- package/dist/logout-5YOHPXGR.js +7 -0
- package/dist/{logout-PPA6JCDY.js.map → logout-5YOHPXGR.js.map} +2 -2
- package/dist/main.js +12 -12
- package/dist/main.js.map +3 -3
- package/dist/{open-5DTFJE26.js → open-QPMDV7ZL.js} +7 -7
- package/dist/{open-5DTFJE26.js.map → open-QPMDV7ZL.js.map} +2 -2
- package/dist/{pull-TC2GVZRD.js → pull-3DUIUAIP.js} +7 -7
- package/dist/pull-3DUIUAIP.js.map +7 -0
- package/dist/push-RS6QHKDD.js +2 -0
- package/dist/status-N3VF5MBE.js +14 -0
- package/dist/{status-2CZXUGSZ.js.map → status-N3VF5MBE.js.map} +2 -2
- package/dist/version-EGM7PLFX.js +11 -0
- package/dist/{version-CXGPMLMK.js.map → version-EGM7PLFX.js.map} +2 -2
- package/dist/whoami-ES6XN3RI.js +7 -0
- package/dist/{whoami-NI52A6U4.js.map → whoami-ES6XN3RI.js.map} +2 -2
- package/package.json +33 -33
- package/dist/add-R6TZAGXK.js +0 -78
- package/dist/chunk-3V7YWBUK.js +0 -2
- package/dist/chunk-AGPFNOXG.js +0 -18
- package/dist/chunk-AGRDDZFS.js +0 -12
- package/dist/chunk-B6XQEEUK.js +0 -2
- package/dist/chunk-E3I3MPQD.js +0 -117
- package/dist/chunk-E3I3MPQD.js.map +0 -7
- package/dist/chunk-FQ2LR3BI.js +0 -6
- package/dist/chunk-FQ2LR3BI.js.map +0 -7
- package/dist/chunk-GIAIN3IJ.js +0 -65
- package/dist/chunk-GIAIN3IJ.js.map +0 -7
- package/dist/chunk-HCQR6OPH.js +0 -11
- package/dist/chunk-IPKFNVOS.js +0 -187
- package/dist/chunk-IPKFNVOS.js.map +0 -7
- package/dist/chunk-NGYGSK7A.js.map +0 -7
- package/dist/chunk-NO72UU5F.js +0 -2
- package/dist/chunk-P5OUQ5XQ.js +0 -2
- package/dist/chunk-RIIVR43B.js +0 -50
- package/dist/chunk-SGMPMYEU.js +0 -2
- package/dist/chunk-TMPKLC3N.js +0 -8
- package/dist/deploy-2SXBPB5C.js +0 -25
- package/dist/dev-I23ZQELT.js +0 -58
- package/dist/esm-46TFUFSK.js +0 -36
- package/dist/esm-46TFUFSK.js.map +0 -7
- package/dist/list-ML7QUWEU.js +0 -11
- package/dist/login-CEGC4DIJ.js +0 -2
- package/dist/logout-PPA6JCDY.js +0 -7
- package/dist/pull-TC2GVZRD.js.map +0 -7
- package/dist/push-DUSAXZ3K.js +0 -2
- package/dist/status-2CZXUGSZ.js +0 -14
- package/dist/version-CXGPMLMK.js +0 -11
- package/dist/whoami-NI52A6U4.js +0 -7
- /package/dist/{login-CEGC4DIJ.js.map → login-YOXXXAJN.js.map} +0 -0
- /package/dist/{push-DUSAXZ3K.js.map → push-RS6QHKDD.js.map} +0 -0
package/dist/add-R6TZAGXK.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-IPKFNVOS.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-E3I3MPQD.js";import"./chunk-HCQR6OPH.js";import"./chunk-TMPKLC3N.js";import{c as f}from"./chunk-NO72UU5F.js";import"./chunk-FQ2LR3BI.js";import"./chunk-AGPFNOXG.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-RIIVR43B.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
|
|
2
|
-
`).join(`
|
|
3
|
-
\u200E \u2022 `)).join(`
|
|
4
|
-
`)}`}else n=r`${t.cause}`;super(n)}render(){return`${m.redBright(y.cross)} Failed to add:
|
|
5
|
-
`+this.message}},ce={...M},I=()=>r`
|
|
6
|
-
Adds models, fields, actions and routes to your app.
|
|
7
|
-
|
|
8
|
-
This command first performs a sync to ensure that your local and environment directories match, changes are tracked since last sync.
|
|
9
|
-
If any conflicts are detected, they must be resolved before adding models, fields, actions or routes.
|
|
10
|
-
|
|
11
|
-
{gray Usage}
|
|
12
|
-
ggt add model <model_name> [field_name:field_type ...]
|
|
13
|
-
|
|
14
|
-
ggt add action [CONTEXT]/<action_name>
|
|
15
|
-
CONTEXT:Specifies the kind of action. Use "model" for model actions otherwise use "action".
|
|
16
|
-
|
|
17
|
-
ggt add route <HTTP_METHOD> <route_path>
|
|
18
|
-
|
|
19
|
-
ggt add field <model_path>/<field_name>:<field_type>
|
|
20
|
-
|
|
21
|
-
{gray Options}
|
|
22
|
-
-e, --env <env_name> Selects the environment to add to. Default set on ".gadget/sync.json"
|
|
23
|
-
|
|
24
|
-
{gray Examples}
|
|
25
|
-
Add a new model 'post' with out fields:
|
|
26
|
-
{cyanBright $ ggt add model modelA}
|
|
27
|
-
|
|
28
|
-
Add a new model 'post' with 2 new 'string' type fields 'title' and 'body':
|
|
29
|
-
{cyanBright $ ggt add model post title:string body:string}
|
|
30
|
-
|
|
31
|
-
Add new action 'publish' to the 'post' model:
|
|
32
|
-
{cyanBright ggt add action model/post/publish}
|
|
33
|
-
|
|
34
|
-
Add a new action 'audit'
|
|
35
|
-
{cyanBright ggt add action action/audit}
|
|
36
|
-
|
|
37
|
-
Add a new route 'howdy'
|
|
38
|
-
{cyanBright ggt add route GET howdy}
|
|
39
|
-
|
|
40
|
-
Add a new 'boolean' type field 'published' to an existing model
|
|
41
|
-
{cyanBright ggt add field post/published:boolean}
|
|
42
|
-
`,me=async(o,t)=>{let n=await k(process.cwd()),a=await N.load(o,{command:"add",args:t,directory:n});if(!a)throw new F({command:"add",args:t,directory:n});let e=new P(a),s=await e.hashes(o,!0);switch(s.inSync||await e.merge(o,{hashes:s,printEnvironmentChangesOptions:{limit:5},printLocalChangesOptions:{limit:5},quietly:!0}),p({ensureEmptyLineAbove:!0,content:`${m.greenBright(y.tick)} Sync completed ${R()}`}),t._[0]){case"model":await V(o,{args:t,filesync:e});break;case"action":await G(o,{args:t,filesync:e});break;case"route":await H(o,{args:t,filesync:e});break;case"field":await X(o,{args:t,filesync:e});break;default:p(I(o));return}},J=o=>{let t=[],n=[];return o.forEach(a=>{let e=/^(.*):+(.*)$/.exec(a);!e||e.length!==3||!e[1]||!e[2]?t.push(r`${a} is not a valid field definition`):n.push({name:e[1].replace(/:+/g,""),fieldType:e[2]})}),[n,t]},V=async(o,{args:t,filesync:n})=>{let a=n.syncJson,e=t._[1];if(!e)throw new f(r`Failed to add model, missing model path
|
|
43
|
-
|
|
44
|
-
{gray Usage}
|
|
45
|
-
{cyanBright ggt add model <model_name> [field_name:field_type ...]}`);let s=[];if(t._.length>2){let[c,g]=J(t._.slice(2));if(g.length>0)throw new f(r`
|
|
46
|
-
Failed to add model:
|
|
47
|
-
• ${g.join(`
|
|
48
|
-
\u2022 `)}
|
|
49
|
-
|
|
50
|
-
{gray Usage}
|
|
51
|
-
{cyanBright ggt add model ${e} [field_name:field_type ...]}`);s.push(...c)}let i;try{i=(await a.edit.mutate({mutation:U,variables:{path:e,fields:s.map(c=>({name:c.name,fieldType:c.fieldType}))}})).createModel}catch(c){throw c instanceof u?new h(c):c}p({ensureEmptyLineAbove:!0,content:m.gray("New model created in environment.")}),await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]});let d=T.isSupported?T(e,`https://${a.environment.application.primaryDomain}/edit/${a.environment.name}/model/${e}/schema`):e;p({ensureEmptyLineAbove:!0,content:`${m.greenBright(y.tick)} Model ${m.cyanBright(d)} added successfully.`})},G=async(o,{args:t,filesync:n})=>{let a=n.syncJson,e=t._[1];if(!e)throw new f(r`Failed to add action, missing action path
|
|
52
|
-
|
|
53
|
-
{gray Usage}
|
|
54
|
-
{cyanBright ggt add action [CONTEXT]/<action_name>
|
|
55
|
-
CONTEXT:Specifies the kind of action. Use "model" for model actions otherwise use "action".}`);let s=await C(o,a.environment),i=await B(o,a.environment),d=e.split("/"),c,g=d.length>1?d.slice(0,d.length-1):d,w=d[d.length-1],x=s.find(l=>{let A=g[g.length-1];return l.apiIdentifier.toUpperCase()===A?.toUpperCase()&&l.namespace?.join("/")===g.slice(0,g.length-1).join("/")}),D=i.find(l=>l.namespace?.join("/")===g.join("/"));if(x&&D){let l=g.join("/");c=await j({choices:["models","actions"],content:r`
|
|
56
|
-
{bold Namespace Conflict:} The action '${w}.js' cannot be automatically added due to a namespace conflict.
|
|
57
|
-
|
|
58
|
-
How would you like to proceed?:
|
|
59
|
-
`,formatChoice:A=>{switch(A){case"models":return`As a Model action in ${m.gray(`models/${l}/${w}.js`)}`;case"actions":return`As an Action in ${m.gray(`actions/${l}/${w}.js`)}`}}}),p({ensureEmptyLineAbove:!0,content:r`${m.yellowBright(y.info)} You can override the context of the action by specifying the context in the path. For example: {gray ggt add action ${c}/${e}}`})}try{let l=(await a.edit.mutate({mutation:L,variables:{path:c?`${c}/`+e:e}})).createAction;await n.writeToLocalFilesystem(o,{filesVersion:l.remoteFilesVersion,files:l.changed,delete:[]})}catch(l){throw l instanceof u?new h(l):l}p({ensureEmptyLineAbove:!0,content:`Action ${m.cyanBright(e)} added successfully.`})},H=async(o,{args:t,filesync:n})=>{let a=n.syncJson,e=t._[1],s=t._[2];if(!e)throw new f(r`Failed to add route, missing route method
|
|
60
|
-
|
|
61
|
-
{gray Usage}
|
|
62
|
-
{cyanBright ggt add route <HTTP_METHOD> <route_path>}`);if(!s)throw new f(r`Failed to add route, missing route path
|
|
63
|
-
|
|
64
|
-
{gray Usage}
|
|
65
|
-
{cyanBright ggt add route ${e} <route_path>}`);try{let i=(await a.edit.mutate({mutation:S,variables:{method:e,path:s}})).createRoute;await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof u?new h(i):i}p({ensureEmptyLineAbove:!0,content:`Route ${m.cyanBright(s)} added successfully.`})},X=async(o,{args:t,filesync:n})=>{let a=n.syncJson,e=t._[1]?.split("/");if(!e)throw new f(r`Failed to add field, invalid field path definition
|
|
66
|
-
|
|
67
|
-
{gray Usage}
|
|
68
|
-
{cyanBright ggt add field <model_path>/<field_name>:<field_type>}`);let s=[];if(e[1]){let[i,d]=J([e[1]]);if(d.length>0)throw new f(r`
|
|
69
|
-
Failed to add field:
|
|
70
|
-
• ${d.join(`
|
|
71
|
-
\u2022`)}
|
|
72
|
-
|
|
73
|
-
{gray Usage}
|
|
74
|
-
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);s.push(...i)}else throw new f(r`Failed to add field, invalid field definition
|
|
75
|
-
|
|
76
|
-
{gray Usage}
|
|
77
|
-
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let i=(await a.edit.mutate({mutation:O,variables:{path:e[0],fields:s.map(d=>({name:d.name,fieldType:d.fieldType}))}})).createModelFields;await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof u?new h(i):i}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(s[0]?.name)} added successfully.`})};export{h as AddClientError,ce as args,me as run,I as usage};
|
|
78
|
-
//# sourceMappingURL=add-R6TZAGXK.js.map
|
package/dist/chunk-3V7YWBUK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as m,g as l,h as Z,i as b,j as O,k as M,l as Or,m as v,n as C,o as Cr,p as Ar}from"./chunk-SGMPMYEU.js";var te=m((tn,re)=>{l();var ee=v(),Lr=(t,e,r,s,i)=>{typeof r=="string"&&(i=s,s=r,r=void 0);try{return new ee(t instanceof ee?t.version:t,r).inc(e,s,i).version}catch{return null}};re.exports=Lr});var ie=m((nn,ne)=>{l();var se=C(),jr=(t,e)=>{let r=se(t,null,!0),s=se(e,null,!0),i=r.compare(s);if(i===0)return null;let n=i>0,o=n?r:s,c=n?s:r,a=!!o.prerelease.length;if(!!c.prerelease.length&&!a)return!c.patch&&!c.minor?"major":o.patch?"patch":o.minor?"minor":"major";let p=a?"pre":"";return r.major!==s.major?p+"major":r.minor!==s.minor?p+"minor":r.patch!==s.patch?p+"patch":"prerelease"};ne.exports=jr});var le=m((ln,oe)=>{l();var Vr=v(),Ir=(t,e)=>new Vr(t,e).major;oe.exports=Ir});var ae=m((an,ce)=>{l();var Nr=v(),Gr=(t,e)=>new Nr(t,e).minor;ce.exports=Gr});var fe=m((fn,ue)=>{l();var Wr=v(),Yr=(t,e)=>new Wr(t,e).patch;ue.exports=Yr});var pe=m((pn,he)=>{l();var Dr=C(),Hr=(t,e)=>{let r=Dr(t,e);return r&&r.prerelease.length?r.prerelease:null};he.exports=Hr});var R=m((qn,qe)=>{l();var me=v(),Xr=(t,e,r)=>new me(t,r).compare(new me(e,r));qe.exports=Xr});var de=m((dn,$e)=>{l();var kr=R(),Br=(t,e,r)=>kr(e,t,r);$e.exports=Br});var ve=m((vn,we)=>{l();var _r=R(),zr=(t,e)=>_r(t,e,!0);we.exports=zr});var A=m((Rn,Re)=>{l();var ge=v(),Fr=(t,e,r)=>{let s=new ge(t,r),i=new ge(e,r);return s.compare(i)||s.compareBuild(i)};Re.exports=Fr});var Se=m((Sn,Ee)=>{l();var Ur=A(),Kr=(t,e)=>t.sort((r,s)=>Ur(r,s,e));Ee.exports=Kr});var Te=m((Tn,xe)=>{l();var Jr=A(),Qr=(t,e)=>t.sort((r,s)=>Jr(s,r,e));xe.exports=Qr});var S=m((Pn,ye)=>{l();var Zr=R(),br=(t,e,r)=>Zr(t,e,r)>0;ye.exports=br});var L=m((Cn,Pe)=>{l();var Mr=R(),et=(t,e,r)=>Mr(t,e,r)<0;Pe.exports=et});var W=m((Ln,Oe)=>{l();var rt=R(),tt=(t,e,r)=>rt(t,e,r)===0;Oe.exports=tt});var Y=m((Vn,Ce)=>{l();var st=R(),nt=(t,e,r)=>st(t,e,r)!==0;Ce.exports=nt});var j=m((Nn,Ae)=>{l();var it=R(),ot=(t,e,r)=>it(t,e,r)>=0;Ae.exports=ot});var V=m((Wn,Le)=>{l();var lt=R(),ct=(t,e,r)=>lt(t,e,r)<=0;Le.exports=ct});var D=m((Dn,je)=>{l();var at=W(),ut=Y(),ft=S(),ht=j(),pt=L(),mt=V(),qt=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return at(t,r,s);case"!=":return ut(t,r,s);case">":return ft(t,r,s);case">=":return ht(t,r,s);case"<":return pt(t,r,s);case"<=":return mt(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};je.exports=qt});var Ie=m((Xn,Ve)=>{l();var $t=v(),dt=C(),{safeRe:I,t:N}=O(),wt=(t,e)=>{if(t instanceof $t)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?I[N.COERCEFULL]:I[N.COERCE]);else{let a=e.includePrerelease?I[N.COERCERTLFULL]:I[N.COERCERTL],h;for(;(h=a.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),a.lastIndex=h.index+h[1].length+h[2].length;a.lastIndex=-1}if(r===null)return null;let s=r[2],i=r[3]||"0",n=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",c=e.includePrerelease&&r[6]?`+${r[6]}`:"";return dt(`${s}.${i}.${n}${o}${c}`,e)};Ve.exports=wt});var Ge=m((Bn,Ne)=>{l();var H=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Ne.exports=H});var E=m((zn,He)=>{l();var vt=/\s+/g,X=class t{constructor(e,r){if(r=Rt(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof k)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(vt," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(i=>!Ye(i[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Ot(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let s=((this.options.includePrerelease&&yt)|(this.options.loose&&Pt))+":"+e,i=We.get(s);if(i)return i;let n=this.options.loose,o=n?g[d.HYPHENRANGELOOSE]:g[d.HYPHENRANGE];e=e.replace(o,Yt(this.options.includePrerelease)),q("hyphen replace",e),e=e.replace(g[d.COMPARATORTRIM],St),q("comparator trim",e),e=e.replace(g[d.TILDETRIM],xt),q("tilde trim",e),e=e.replace(g[d.CARETTRIM],Tt),q("caret trim",e);let c=e.split(" ").map(u=>Ct(u,this.options)).join(" ").split(/\s+/).map(u=>Wt(u,this.options));n&&(c=c.filter(u=>(q("loose invalid filter",u,this.options),!!u.match(g[d.COMPARATORLOOSE])))),q("range list",c);let a=new Map,h=c.map(u=>new k(u,this.options));for(let u of h){if(Ye(u))return[u];a.set(u.value,u)}a.size>1&&a.has("")&&a.delete("");let p=[...a.values()];return We.set(s,p),p}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>De(s,r)&&e.set.some(i=>De(i,r)&&s.every(n=>i.every(o=>n.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Et(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Dt(this.set[r],e,this.options))return!0;return!1}};He.exports=X;var gt=Ge(),We=new gt,Rt=M(),k=x(),q=Z(),Et=v(),{safeRe:g,t:d,comparatorTrimReplace:St,tildeTrimReplace:xt,caretTrimReplace:Tt}=O(),{FLAG_INCLUDE_PRERELEASE:yt,FLAG_LOOSE:Pt}=b(),Ye=t=>t.value==="<0.0.0-0",Ot=t=>t.value==="",De=(t,e)=>{let r=!0,s=t.slice(),i=s.pop();for(;r&&s.length;)r=s.every(n=>i.intersects(n,e)),i=s.pop();return r},Ct=(t,e)=>(q("comp",t,e),t=jt(t,e),q("caret",t),t=At(t,e),q("tildes",t),t=It(t,e),q("xrange",t),t=Gt(t,e),q("stars",t),t),w=t=>!t||t.toLowerCase()==="x"||t==="*",At=(t,e)=>t.trim().split(/\s+/).map(r=>Lt(r,e)).join(" "),Lt=(t,e)=>{let r=e.loose?g[d.TILDELOOSE]:g[d.TILDE];return t.replace(r,(s,i,n,o,c)=>{q("tilde",t,s,i,n,o,c);let a;return w(i)?a="":w(n)?a=`>=${i}.0.0 <${+i+1}.0.0-0`:w(o)?a=`>=${i}.${n}.0 <${i}.${+n+1}.0-0`:c?(q("replaceTilde pr",c),a=`>=${i}.${n}.${o}-${c} <${i}.${+n+1}.0-0`):a=`>=${i}.${n}.${o} <${i}.${+n+1}.0-0`,q("tilde return",a),a})},jt=(t,e)=>t.trim().split(/\s+/).map(r=>Vt(r,e)).join(" "),Vt=(t,e)=>{q("caret",t,e);let r=e.loose?g[d.CARETLOOSE]:g[d.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(i,n,o,c,a)=>{q("caret",t,i,n,o,c,a);let h;return w(n)?h="":w(o)?h=`>=${n}.0.0${s} <${+n+1}.0.0-0`:w(c)?n==="0"?h=`>=${n}.${o}.0${s} <${n}.${+o+1}.0-0`:h=`>=${n}.${o}.0${s} <${+n+1}.0.0-0`:a?(q("replaceCaret pr",a),n==="0"?o==="0"?h=`>=${n}.${o}.${c}-${a} <${n}.${o}.${+c+1}-0`:h=`>=${n}.${o}.${c}-${a} <${n}.${+o+1}.0-0`:h=`>=${n}.${o}.${c}-${a} <${+n+1}.0.0-0`):(q("no pr"),n==="0"?o==="0"?h=`>=${n}.${o}.${c}${s} <${n}.${o}.${+c+1}-0`:h=`>=${n}.${o}.${c}${s} <${n}.${+o+1}.0-0`:h=`>=${n}.${o}.${c} <${+n+1}.0.0-0`),q("caret return",h),h})},It=(t,e)=>(q("replaceXRanges",t,e),t.split(/\s+/).map(r=>Nt(r,e)).join(" ")),Nt=(t,e)=>{t=t.trim();let r=e.loose?g[d.XRANGELOOSE]:g[d.XRANGE];return t.replace(r,(s,i,n,o,c,a)=>{q("xRange",t,s,i,n,o,c,a);let h=w(n),p=h||w(o),u=p||w(c),$=u;return i==="="&&$&&(i=""),a=e.includePrerelease?"-0":"",h?i===">"||i==="<"?s="<0.0.0-0":s="*":i&&$?(p&&(o=0),c=0,i===">"?(i=">=",p?(n=+n+1,o=0,c=0):(o=+o+1,c=0)):i==="<="&&(i="<",p?n=+n+1:o=+o+1),i==="<"&&(a="-0"),s=`${i+n}.${o}.${c}${a}`):p?s=`>=${n}.0.0${a} <${+n+1}.0.0-0`:u&&(s=`>=${n}.${o}.0${a} <${n}.${+o+1}.0-0`),q("xRange return",s),s})},Gt=(t,e)=>(q("replaceStars",t,e),t.trim().replace(g[d.STAR],"")),Wt=(t,e)=>(q("replaceGTE0",t,e),t.trim().replace(g[e.includePrerelease?d.GTE0PRE:d.GTE0],"")),Yt=t=>(e,r,s,i,n,o,c,a,h,p,u,$)=>(w(s)?r="":w(i)?r=`>=${s}.0.0${t?"-0":""}`:w(n)?r=`>=${s}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,w(h)?a="":w(p)?a=`<${+h+1}.0.0-0`:w(u)?a=`<${h}.${+p+1}.0-0`:$?a=`<=${h}.${p}.${u}-${$}`:t?a=`<${h}.${p}.${+u+1}-0`:a=`<=${a}`,`${r} ${a}`.trim()),Dt=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(q(t[s].semver),t[s].semver!==k.ANY&&t[s].semver.prerelease.length>0){let i=t[s].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var x=m((Un,Fe)=>{l();var T=Symbol("SemVer ANY"),z=class t{static get ANY(){return T}constructor(e,r){if(r=Xe(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===T?this.value="":this.value=this.operator+this.semver.version,_("comp",this)}parse(e){let r=this.options.loose?ke[Be.COMPARATORLOOSE]:ke[Be.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new _e(s[2],this.options.loose):this.semver=T}toString(){return this.value}test(e){if(_("Comparator.test",e,this.options.loose),this.semver===T||e===T)return!0;if(typeof e=="string")try{e=new _e(e,this.options)}catch{return!1}return B(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new ze(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new ze(this.value,r).test(e.semver):(r=Xe(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||B(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||B(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Fe.exports=z;var Xe=M(),{safeRe:ke,t:Be}=O(),B=D(),_=Z(),_e=v(),ze=E()});var y=m((Jn,Ue)=>{l();var Ht=E(),Xt=(t,e,r)=>{try{e=new Ht(e,r)}catch{return!1}return e.test(t)};Ue.exports=Xt});var Je=m((Zn,Ke)=>{l();var kt=E(),Bt=(t,e)=>new kt(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));Ke.exports=Bt});var Ze=m((Mn,Qe)=>{l();var _t=v(),zt=E(),Ft=(t,e,r)=>{let s=null,i=null,n=null;try{n=new zt(e,r)}catch{return null}return t.forEach(o=>{n.test(o)&&(!s||i.compare(o)===-1)&&(s=o,i=new _t(s,r))}),s};Qe.exports=Ft});var Me=m((ri,be)=>{l();var Ut=v(),Kt=E(),Jt=(t,e,r)=>{let s=null,i=null,n=null;try{n=new Kt(e,r)}catch{return null}return t.forEach(o=>{n.test(o)&&(!s||i.compare(o)===1)&&(s=o,i=new Ut(s,r))}),s};be.exports=Jt});var tr=m((si,rr)=>{l();var F=v(),Qt=E(),er=S(),Zt=(t,e)=>{t=new Qt(t,e);let r=new F("0.0.0");if(t.test(r)||(r=new F("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let i=t.set[s],n=null;i.forEach(o=>{let c=new F(o.semver.version);switch(o.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!n||er(c,n))&&(n=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),n&&(!r||er(r,n))&&(r=n)}return r&&t.test(r)?r:null};rr.exports=Zt});var nr=m((ii,sr)=>{l();var bt=E(),Mt=(t,e)=>{try{return new bt(t,e).range||"*"}catch{return null}};sr.exports=Mt});var G=m((li,cr)=>{l();var es=v(),lr=x(),{ANY:rs}=lr,ts=E(),ss=y(),ir=S(),or=L(),ns=V(),is=j(),os=(t,e,r,s)=>{t=new es(t,s),e=new ts(e,s);let i,n,o,c,a;switch(r){case">":i=ir,n=ns,o=or,c=">",a=">=";break;case"<":i=or,n=is,o=ir,c="<",a="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ss(t,e,s))return!1;for(let h=0;h<e.set.length;++h){let p=e.set[h],u=null,$=null;if(p.forEach(f=>{f.semver===rs&&(f=new lr(">=0.0.0")),u=u||f,$=$||f,i(f.semver,u.semver,s)?u=f:o(f.semver,$.semver,s)&&($=f)}),u.operator===c||u.operator===a||(!$.operator||$.operator===c)&&n(t,$.semver))return!1;if($.operator===a&&o(t,$.semver))return!1}return!0};cr.exports=os});var ur=m((ai,ar)=>{l();var ls=G(),cs=(t,e,r)=>ls(t,e,">",r);ar.exports=cs});var hr=m((fi,fr)=>{l();var as=G(),us=(t,e,r)=>as(t,e,"<",r);fr.exports=us});var qr=m((pi,mr)=>{l();var pr=E(),fs=(t,e,r)=>(t=new pr(t,r),e=new pr(e,r),t.intersects(e,r));mr.exports=fs});var dr=m((qi,$r)=>{l();var hs=y(),ps=R();$r.exports=(t,e,r)=>{let s=[],i=null,n=null,o=t.sort((p,u)=>ps(p,u,r));for(let p of o)hs(p,e,r)?(n=p,i||(i=p)):(n&&s.push([i,n]),n=null,i=null);i&&s.push([i,null]);let c=[];for(let[p,u]of s)p===u?c.push(p):!u&&p===o[0]?c.push("*"):u?p===o[0]?c.push(`<=${u}`):c.push(`${p} - ${u}`):c.push(`>=${p}`);let a=c.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return a.length<h.length?a:e}});var Sr=m((di,Er)=>{l();var wr=E(),K=x(),{ANY:U}=K,P=y(),J=R(),ms=(t,e,r={})=>{if(t===e)return!0;t=new wr(t,r),e=new wr(e,r);let s=!1;e:for(let i of t.set){for(let n of e.set){let o=$s(i,n,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},qs=[new K(">=0.0.0-0")],vr=[new K(">=0.0.0")],$s=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===U){if(e.length===1&&e[0].semver===U)return!0;r.includePrerelease?t=qs:t=vr}if(e.length===1&&e[0].semver===U){if(r.includePrerelease)return!0;e=vr}let s=new Set,i,n;for(let f of t)f.operator===">"||f.operator===">="?i=gr(i,f,r):f.operator==="<"||f.operator==="<="?n=Rr(n,f,r):s.add(f.semver);if(s.size>1)return null;let o;if(i&&n){if(o=J(i.semver,n.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||n.operator!=="<="))return null}for(let f of s){if(i&&!P(f,String(i),r)||n&&!P(f,String(n),r))return null;for(let Pr of e)if(!P(f,String(Pr),r))return!1;return!0}let c,a,h,p,u=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1,$=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;u&&u.prerelease.length===1&&n.operator==="<"&&u.prerelease[0]===0&&(u=!1);for(let f of e){if(p=p||f.operator===">"||f.operator===">=",h=h||f.operator==="<"||f.operator==="<=",i){if($&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===$.major&&f.semver.minor===$.minor&&f.semver.patch===$.patch&&($=!1),f.operator===">"||f.operator===">="){if(c=gr(i,f,r),c===f&&c!==i)return!1}else if(i.operator===">="&&!P(i.semver,String(f),r))return!1}if(n){if(u&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===u.major&&f.semver.minor===u.minor&&f.semver.patch===u.patch&&(u=!1),f.operator==="<"||f.operator==="<="){if(a=Rr(n,f,r),a===f&&a!==n)return!1}else if(n.operator==="<="&&!P(n.semver,String(f),r))return!1}if(!f.operator&&(n||i)&&o!==0)return!1}return!(i&&h&&!n&&o!==0||n&&p&&!i&&o!==0||$||u)},gr=(t,e,r)=>{if(!t)return e;let s=J(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},Rr=(t,e,r)=>{if(!t)return e;let s=J(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};Er.exports=ms});var rn=m((vi,yr)=>{l();var Q=O(),xr=b(),ds=v(),Tr=Or(),ws=C(),vs=Cr(),gs=Ar(),Rs=te(),Es=ie(),Ss=le(),xs=ae(),Ts=fe(),ys=pe(),Ps=R(),Os=de(),Cs=ve(),As=A(),Ls=Se(),js=Te(),Vs=S(),Is=L(),Ns=W(),Gs=Y(),Ws=j(),Ys=V(),Ds=D(),Hs=Ie(),Xs=x(),ks=E(),Bs=y(),_s=Je(),zs=Ze(),Fs=Me(),Us=tr(),Ks=nr(),Js=G(),Qs=ur(),Zs=hr(),bs=qr(),Ms=dr(),en=Sr();yr.exports={parse:ws,valid:vs,clean:gs,inc:Rs,diff:Es,major:Ss,minor:xs,patch:Ts,prerelease:ys,compare:Ps,rcompare:Os,compareLoose:Cs,compareBuild:As,sort:Ls,rsort:js,gt:Vs,lt:Is,eq:Ns,neq:Gs,gte:Ws,lte:Ys,cmp:Ds,coerce:Hs,Comparator:Xs,Range:ks,satisfies:Bs,toComparators:_s,maxSatisfying:zs,minSatisfying:Fs,minVersion:Us,validRange:Ks,outside:Js,gtr:Qs,ltr:Zs,intersects:bs,simplifyRange:Ms,subset:en,SemVer:ds,re:Q.re,src:Q.src,tokens:Q.t,SEMVER_SPEC_VERSION:xr.SEMVER_SPEC_VERSION,RELEASE_TYPES:xr.RELEASE_TYPES,compareIdentifiers:Tr.compareIdentifiers,rcompareIdentifiers:Tr.rcompareIdentifiers}});export{rn as a};
|
|
2
|
-
//# sourceMappingURL=chunk-3V7YWBUK.js.map
|
package/dist/chunk-AGPFNOXG.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{E as se,b as oe,r as ne,s as ie}from"./chunk-RIIVR43B.js";import{e as G}from"./chunk-AGRDDZFS.js";import{$ as p,D,F as te,G as E,P as w,U as x,Z as T,_ as H,b as A,e as h}from"./chunk-GIAIN3IJ.js";import{d as Ae,g as s}from"./chunk-SGMPMYEU.js";s();s();import Ee from"node:net";import Te from"node:os";var I=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Le=1e3*15;var L,$e=()=>{let e=Te.networkInterfaces(),r=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(e))for(let o of t)r.add(o.address);return r},ae=e=>new Promise((r,t)=>{let o=Ee.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),ce=async(e,r)=>{if(e.host||e.port===0)return ae(e);for(let t of r)try{await ae({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Be=function*(e){e&&(yield*e),yield 0};async function _(e){let r,t=new Set;if(e&&(e.port&&(r=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of n){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},Le),L.unref&&L.unref());let o=$e();for(let n of Be(r))try{if(t.has(n))continue;let a=await ce({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new I(n);a=await ce({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof I))throw a}throw new Error("No available ports found")}import re from"node:assert";import Wr from"node:http";s();import R from"node:process";import{Buffer as Ke}from"node:buffer";import me from"node:path";import{fileURLToPath as Ye}from"node:url";import Xe from"node:child_process";import q,{constants as he}from"node:fs/promises";s();function g(e,r,t){let o=n=>Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let n=t();return o(n),n},set(n){o(n)}}),e}s();import{promisify as Ge}from"node:util";import Y from"node:process";import{execFile as _e}from"node:child_process";s();import{promisify as Ce}from"node:util";import We from"node:process";import{execFile as Ie}from"node:child_process";var Ne=Ce(Ie);async function j(){if(We.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ne("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}s();s();import Re from"node:process";import{promisify as ke}from"node:util";import{execFile as Fe,execFileSync as Yr}from"node:child_process";var Oe=ke(Fe);async function le(e,{humanReadableOutput:r=!0}={}){if(Re.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await Oe("osascript",["-e",e,t]);return o.trim()}async function z(e){return le(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
2
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}s();import{promisify as Ue}from"node:util";import{execFile as Me}from"node:child_process";var De=Ue(Me),He={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},N=class extends Error{};async function K(e=De){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new N(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=t.groups,n=He[o];if(!n)throw new N(`Unknown browser ID: ${o}`);return n}var je=Ge(_e),ze=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function X(){if(Y.platform==="darwin"){let e=await j();return{name:await z(e),id:e}}if(Y.platform==="linux"){let{stdout:e}=await je("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:ze(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(Y.platform==="win32")return K();throw new Error("Only macOS, Linux, and Windows are supported")}var J=me.dirname(Ye(import.meta.url)),ue=me.join(J,"xdg-open"),{platform:y,arch:de}=R,qe=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",o=!1;try{await q.access(t,he.F_OK),o=!0}catch{}if(!o)return e;let n=await q.readFile(t,{encoding:"utf8"}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return a?(r=a.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),pe=async(e,r)=>{let t;for(let o of e)try{return await r(o)}catch(n){t=n}throw t},k=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return pe(e.app,l=>k({...e,app:l}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return pe(r,l=>k({...e,app:{name:l,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let l={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},c={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},u=await X();if(u.id in l){let m=l[u.id];return r==="browserPrivate"&&t.push(c[m]),k({...e,app:{name:v[m],arguments:t}})}throw new Error(`${u.name} is not supported as a default browser`)}let o,n=[],a={};if(y==="darwin")o="open",e.wait&&n.push("--wait-apps"),e.background&&n.push("--background"),e.newInstance&&n.push("--new"),r&&n.push("-a",r);else if(y==="win32"||E&&!te()&&!r){let l=await qe();o=E?`${l}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${R.env.SYSTEMROOT||R.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),E||(a.windowsVerbatimArguments=!0);let c=["Start"];e.wait&&c.push("-Wait"),r?(c.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&c.push(`"${e.target}"`),t.length>0&&(t=t.map(u=>`"\`"${u}\`""`),c.push("-ArgumentList",t.join(","))),e.target=Ke.from(c.join(" "),"utf16le").toString("base64")}else{if(r)o=r;else{let l=!J||J==="/",c=!1;try{await q.access(ue,he.X_OK),c=!0}catch{}o=R.versions.electron??(y==="android"||l||!c)?"xdg-open":ue}t.length>0&&n.push(...t),e.wait||(a.stdio="ignore",a.detached=!0)}y==="darwin"&&t.length>0&&n.push("--args",...t),e.target&&n.push(e.target);let d=Xe.spawn(o,n,a);return e.wait?new Promise((l,c)=>{d.once("error",c),d.once("close",u=>{if(!e.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}l(d)})}):(d.unref(),d)},Je=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return k({...r,target:e})};function fe(e){if(typeof e=="string"||Array.isArray(e))return e;let{[de]:r}=e;if(!r)throw new Error(`${de} is not supported`);return r}function V({[y]:e},{wsl:r}){if(r&&E)return fe(r);if(!e)throw new Error(`${y} is not supported`);return fe(e)}var v={};g(v,"chrome",()=>V({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));g(v,"firefox",()=>V({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));g(v,"edge",()=>V({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));g(v,"browser",()=>"browser");g(v,"browserPrivate",()=>"browserPrivate");var ge=Je;s();import Br from"node:assert";s();import W from"node:process";s();s();var O={};Ae(O,{beep:()=>Sr,clearScreen:()=>xr,clearTerminal:()=>br,cursorBackward:()=>or,cursorDown:()=>rr,cursorForward:()=>tr,cursorGetPosition:()=>sr,cursorHide:()=>lr,cursorLeft:()=>be,cursorMove:()=>er,cursorNextLine:()=>ar,cursorPrevLine:()=>cr,cursorRestorePosition:()=>ir,cursorSavePosition:()=>nr,cursorShow:()=>ur,cursorTo:()=>Ze,cursorUp:()=>xe,enterAlternativeScreen:()=>yr,eraseDown:()=>mr,eraseEndLine:()=>pr,eraseLine:()=>ye,eraseLines:()=>dr,eraseScreen:()=>Q,eraseStartLine:()=>fr,eraseUp:()=>hr,exitAlternativeScreen:()=>vr,iTerm:()=>Er,image:()=>Ar,link:()=>Pr,scrollDown:()=>wr,scrollUp:()=>gr});s();import Z from"node:process";s();var F=globalThis.window?.document!==void 0,Pt=globalThis.process?.versions?.node!==void 0,At=globalThis.process?.versions?.bun!==void 0,Et=globalThis.Deno?.version?.deno!==void 0,Tt=globalThis.process?.versions?.electron!==void 0,Lt=globalThis.navigator?.userAgent?.includes("jsdom")===!0,$t=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Bt=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,Ct=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,Wt=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,$=globalThis.navigator?.userAgentData?.platform,It=$==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Nt=$==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",Rt=$==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",kt=$==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Ft=$==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var i="\x1B[",C="\x1B]",S="\x07",B=";",we=!F&&Z.env.TERM_PROGRAM==="Apple_Terminal",Ve=!F&&Z.platform==="win32",Qe=F?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Z.cwd,Ze=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?i+(e+1)+"G":i+(r+1)+B+(e+1)+"H"},er=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=i+-e+"D":e>0&&(t+=i+e+"C"),r<0?t+=i+-r+"A":r>0&&(t+=i+r+"B"),t},xe=(e=1)=>i+e+"A",rr=(e=1)=>i+e+"B",tr=(e=1)=>i+e+"C",or=(e=1)=>i+e+"D",be=i+"G",nr=we?"\x1B7":i+"s",ir=we?"\x1B8":i+"u",sr=i+"6n",ar=i+"E",cr=i+"F",lr=i+"?25l",ur=i+"?25h",dr=e=>{let r="";for(let t=0;t<e;t++)r+=ye+(t<e-1?xe():"");return e&&(r+=be),r},pr=i+"K",fr=i+"1K",ye=i+"2K",mr=i+"J",hr=i+"1J",Q=i+"2J",gr=i+"S",wr=i+"T",xr="\x1Bc",br=Ve?`${Q}${i}0f`:`${Q}${i}3J${i}H`,yr=i+"?1049h",vr=i+"?1049l",Sr=S,Pr=(e,r)=>[C,"8",B,B,r,S,e,C,"8",B,B,S].join(""),Ar=(e,r={})=>{let t=`${C}1337;File=inline=1`;return r.width&&(t+=`;width=${r.width}`),r.height&&(t+=`;height=${r.height}`),r.preserveAspectRatio===!1&&(t+=";preserveAspectRatio=0"),t+":"+Buffer.from(e).toString("base64")+S},Er={setCwd:(e=Qe())=>`${C}50;CurrentDir=${e}${S}`,annotation(e,r={}){let t=`${C}1337;`,o=r.x!==void 0,n=r.y!==void 0;if((o||n)&&!(o&&n&&r.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),t+=r.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",r.length>0?t+=(o?[e,r.length,r.x,r.y]:[r.length,e]).join("|"):t+=e,t+S}};import Tr from"node:assert";import Lr from"node:events";import f from"node:process";import ve from"node:readline";var U=class e extends Lr{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),Tr(!e.active,"only one prompt can be active at a time"),e.active=!0;let r=ve.createInterface({input:f.stdin,escapeCodeTimeout:50});ve.emitKeypressEvents(f.stdin,r),f.stdin.isTTY&&f.stdin.setRawMode(!0);let t=["SelectPrompt"].includes(this.constructor.name),o=(n,a)=>{let d=$r(a,t);d===!1?this._(n,a):d&&typeof this[d]=="function"?this[d](a):this.bell()};this.close=()=>{f.stdin.removeListener("keypress",o),f.stdin.isTTY&&f.stdin.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0,e.active=!1},f.stdin.on("keypress",o)}_(r,t){}onRender(){}fire(){this.emit("state",{value:this.value,aborted:this.aborted,exited:this.exited})}bell(){x.writeStdout(O.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},$r=(e,r)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)switch(e.name){case"a":return"first";case"c":case"d":return"abort";case"e":return"last";case"g":return"reset"}if(r){if(e.name==="j")return"down";if(e.name==="k")return"up"}switch(e.name){case"return":case"enter":return"submit";case"backspace":return"delete";case"delete":return"deleteForward";case"abort":return"abort";case"escape":return"exit";case"tab":return"next";case"pagedown":return"nextPage";case"pageup":return"prevPage";case"home":return"home";case"end":return"end";case"up":return"up";case"down":return"down";case"right":return"right";case"left":return"left";default:return!1}}},Vt=(e,r,t)=>{t=t||r;let o=Math.min(r-t,e-Math.floor(t/2));o<0&&(o=0);let n=Math.min(o+t,r);return{startIndex:o,endIndex:n}};var Se=e=>{let r;if(typeof e=="string"?r={content:e}:r=e,r=D(r,{ensureEmptyLineAbove:!0,ensureNewLine:!0,exitWhenNo:!0}),!x.isInteractive){let t=r.whenNotInteractive??(()=>{p(r),p({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),W.exit(1)});return Promise.resolve(t())}return new Promise(t=>{let o=new ee(r);o.on("submit",t),o.on("exit",()=>W.exit(0)),o.on("abort",()=>W.exit(1))})},ee=class extends U{value=void 0;defaultValue=!1;options;constructor(r){super(),this.options=D(r,{exitWhenNo:!0,ensureEmptyLineAbove:!0}),this.render()}reset(){this.value=this.defaultValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=!1,this.done=this.aborted=!0,this.fire(),this.render(!1),this.close(),this.options.exitWhenNo&&W.exit(0)}submit(){this.value=this.value??!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.close(),this.options.exitWhenNo&&!this.value&&W.exit(0)}_(r,t){if(r.toLowerCase()==="y"){this.value=!0,this.submit();return}if(r.toLowerCase()==="n"){this.value=!1,this.submit();return}this.bell()}render(r=this.value){if(super.render(),this.done){x.persistPrompt(H({...this.options,content:`${this.options.content} ${r?A.bold.greenBright("Yes."):A.bold.redBright("No.")}`}));return}x.updatePrompt(H({...this.options,content:`${this.options.content} ${this.defaultValue?A.blueBright("[Y/n] "):A.blueBright("[y/N] ")}`}))}};var Cr=h.object({id:h.union([h.string(),h.number()]).transform(Number),name:h.string().nullish(),email:h.string()}),M=async e=>{let r=ne(e);if(r)try{let t=await se({context:{ctx:e},url:`https://${w.domains.services}/auth/api/current-user`,headers:r,responseType:"json",resolveBodyOnly:!0}),o=Cr.parse(t);return e.log.info("loaded user",{user:{id:o.id}},{user:o}),oe(o),o}catch(t){ie(e,t);return}},bo=async(e,r)=>{let t=await M(e);return t||(e.log.info("prompting user to log in"),p({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${r}".`}),await Se({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await Pe(e,{_:[]}),t=await M(e),Br(t,"missing user after successful login"),t)};var Wo=()=>T`
|
|
3
|
-
Log in to your account.
|
|
4
|
-
|
|
5
|
-
{bold Usage}
|
|
6
|
-
ggt login
|
|
7
|
-
`,Ir=async e=>{let r;try{let t=await _(),o=new Promise((a,d)=>{r=Wr.createServer(async(l,c)=>{let u=new URL(`https://${w.domains.services}/auth/cli`);try{re(l.url,"missing url");let m=new URL(l.url,`http://localhost:${t}`).searchParams.get("session");re(m,"missing session"),G(e,m);let P=await M(e);re(P,"missing user after successful login"),P.name?p({ensureEmptyLineAbove:!0,content:T`Hello, ${P.name} {gray (${P.email})}`}):p({ensureEmptyLineAbove:!0,content:`Hello, ${P.email}`}),u.searchParams.set("success","true"),a()}catch(m){G(e,void 0),u.searchParams.set("success","false"),d(m)}finally{c.writeHead(303,{Location:u.toString()}),c.end()}}),e.log.info("starting login server",{port:t}),r.listen(t)}),n=new URL(`https://${w.domains.services}/auth/login`);n.searchParams.set("returnTo",`https://${w.domains.services}/auth/cli/callback?port=${t}`);try{e.log.info("opening browser",{url:n.toString()}),await ge(n.toString()),p({ensureEmptyLineAbove:!0,content:T`
|
|
8
|
-
We've opened Gadget's login page using your default browser.
|
|
9
|
-
|
|
10
|
-
Please log in and then return to this terminal.
|
|
11
|
-
`})}catch(a){e.log.error("failed to open browser",{error:a}),p({ensureEmptyLineAbove:!0,content:T`
|
|
12
|
-
Please open the following URL in your browser and log in:
|
|
13
|
-
|
|
14
|
-
{gray ${n.toString()}}
|
|
15
|
-
|
|
16
|
-
Once logged in, return to this terminal.
|
|
17
|
-
`})}await o}finally{r?.close()}},Pe=Ir;export{U as a,Vt as b,Se as c,ge as d,Wo as e,Ir as f,Pe as g,M as h,bo as i};
|
|
18
|
-
//# sourceMappingURL=chunk-AGPFNOXG.js.map
|
package/dist/chunk-AGRDDZFS.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{I as E,Q as u,z as $}from"./chunk-GIAIN3IJ.js";import{c as b,e as g,g as a}from"./chunk-SGMPMYEU.js";var k=b((me,F)=>{a();function G(t){return Array.isArray(t)?t:[t]}var S="",C=" ",p="\\",B=/^\s+$/,W=/(?:[^\\]|^)\\$/,K=/^\\!/,V=/^\\#/,Y=/\r?\n/g,M=/^\.*\/|^\.+$/,y="/",T="node-ignore";typeof Symbol<"u"&&(T=Symbol.for("node-ignore"));var I=T,q=(t,e,s)=>Object.defineProperty(t,e,{value:s}),J=/([0-z])-([0-z])/g,H=()=>!1,Q=t=>t.replace(J,(e,s,r)=>s.charCodeAt(0)<=r.charCodeAt(0)?e:S),U=t=>{let{length:e}=t;return t.slice(0,e-e%2)},Z=[[/^\uFEFF/,()=>S],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,s)=>e+(s.indexOf("\\")===0?C:S)],[/(\\+?)\s/g,(t,e)=>{let{length:s}=e;return e.slice(0,s-s%2)+C}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,s)=>e+6<s.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,s)=>{let r=s.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>p],[/\\\\/g,()=>p],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,s,r,n)=>e===p?`\\[${s}${U(r)}${n}`:n==="]"&&r.length%2===0?`[${Q(s)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],O=Object.create(null),ee=(t,e)=>{let s=O[t];return s||(s=Z.reduce((r,[n,i])=>r.replace(n,i.bind(t)),t),O[t]=s),e?new RegExp(s,"i"):new RegExp(s)},R=t=>typeof t=="string",te=t=>t&&R(t)&&!B.test(t)&&!W.test(t)&&t.indexOf("#")!==0,se=t=>t.split(Y),x=class{constructor(e,s,r,n){this.origin=e,this.pattern=s,this.negative=r,this.regex=n}},re=(t,e)=>{let s=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(K,"!").replace(V,"#");let n=ee(t,e);return new x(s,t,r,n)},ne=(t,e)=>{throw new e(t)},o=(t,e,s)=>R(t)?t?o.isNotRelative(t)?s(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:s("path must not be empty",TypeError):s(`path must be a string, but got \`${e}\``,TypeError),L=t=>M.test(t);o.isNotRelative=L;o.convert=t=>t;var v=class{constructor({ignorecase:e=!0,ignoreCase:s=e,allowRelativePaths:r=!1}={}){q(this,I,!0),this._rules=[],this._ignoreCase=s,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[I]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(te(e)){let s=re(e,this._ignoreCase);this._added=!0,this._rules.push(s)}}add(e){return this._added=!1,G(R(e)?se(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,s){let r=!1,n=!1;return this._rules.forEach(i=>{let{negative:l}=i;if(n===l&&r!==n||l&&!r&&!n&&!s)return;i.regex.test(e)&&(r=!l,n=l)}),{ignored:r,unignored:n}}_test(e,s,r,n){let i=e&&o.convert(e);return o(i,e,this._allowRelativePaths?H:ne),this._t(i,s,r,n)}_t(e,s,r,n){if(e in s)return s[e];if(n||(n=e.split(y)),n.pop(),!n.length)return s[e]=this._testOne(e,r);let i=this._t(n.join(y)+y,s,r,n);return s[e]=i.ignored?i:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return G(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},d=t=>new v(t),ie=t=>o(t&&o.convert(t),t,H);d.isPathValid=ie;d.default=d;F.exports=d;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=s=>/^\\\\\?\\/.test(s)||/["<>|\u0000-\u001F]+/u.test(s)?s:s.replace(/\\/g,"/");o.convert=t;let e=/^[a-z]:\//i;o.isNotRelative=s=>e.test(s)||L(s)}});var D=b((pe,X)=>{a();X.exports=function(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return"/";var s=t.length;if(s<=1)return t;var r="";if(s>4&&t[3]==="\\"){var n=t[2];(n==="?"||n===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),r="//")}var i=t.split(/[/\\]+/);return e!==!1&&i[i.length-1]===""&&i.pop(),r+i.join("/")}});a();var _=g($(),1);a();var f=g($(),1),j=g(k(),1),A=g(D(),1);import oe from"node:assert";import{createHash as ae}from"node:crypto";import c from"node:path";import{Transform as ce}from"node:stream";import{pipeline as le}from"node:stream/promises";var ue=[".gadget/"],fe=[".DS_Store","node_modules",".git"],ge=[".gadget/sync.json",".gadget/backup","yarn-error.log"],z=class t{constructor(e){this.path=e}_ignorer;_isHashing=!1;static async init(e){let s=new t(e);return await s.loadIgnoreFile(),s}relative(e){return c.isAbsolute(e)?c.relative(this.path,e):e}absolute(...e){let s=c.resolve(this.path,...e);return oe(s.startsWith(this.path),`expected ${s} to be within ${this.path}`),s}normalize(e,s){return c.isAbsolute(e)&&(e=this.relative(e)),e=(0,A.default)(e,!0),s&&(e+="/"),e}async loadIgnoreFile(){this._ignorer=j.default.default(),this._ignorer.add(fe);try{let e=await f.default.readFile(this.absolute(".ignore"),"utf8");this._ignorer.add(e)}catch(e){h(e)}}ignores(e){return e=this.relative(e),e===""?!1:e.startsWith("..")||(e=(0,A.default)(e,!1),this._isHashing&&ge.some(s=>e.startsWith(s)))?!0:ue.some(s=>e.startsWith(s))?!1:this._ignorer.ignores(e)}async*walk({dir:e=this.path}={}){e!==this.path&&(yield this.normalize(e,!0));for await(let s of await f.default.opendir(e)){let r=c.join(e,s.name);this.ignores(r)||(s.isDirectory()?yield*this.walk({dir:r}):s.isFile()&&(yield this.normalize(r,!1)))}}async hashes(){try{this._isHashing=!0;let e={};for await(let s of this.walk()){let r=this.absolute(s);e[s]=await he(r)}return e}finally{this._isHashing=!1}}async hasFiles(){return!await this.isEmptyOrNonExistent()}async isEmptyOrNonExistent(){let e=!0;try{for await(let s of this.walk()){e=!1;break}}catch(s){h(s)}return e}},de=process.platform==="linux"||process.platform==="darwin",he=async t=>{let e=ae("sha1");e.update(c.basename(t));let s=await f.default.stat(t),r;if(de&&(r=s.mode&511),s.isDirectory())return{sha1:e.digest("hex"),permissions:r};let n=new ce({transform(i,l,m){if(!i.includes(13)){m(void 0,i);return}let w=Buffer.alloc(i.length),N=0;for(let P of i)P!==13&&(w[N++]=P);m(void 0,w.subarray(0,N))}});return await le(f.default.createReadStream(t),n,e),{sha1:e.digest("hex"),permissions:r}},h=t=>{if(!(t&&typeof t=="object"&&"code"in t&&t.code==="ENOENT"))throw t};var _e=E(t=>{if(process.env.GGT_SESSION)return t.log.debug("reading session from env"),process.env.GGT_SESSION;try{return t.log.debug("reading session from disk"),_.default.readFileSync(u("session.txt"),"utf8")}catch(e){h(e);return}}),Ge=(t,e)=>{_e.clear(),process.env.GGT_SESSION&&(t.log.debug("writing session to env",{session:!!e}),process.env.GGT_SESSION=e),t.log.debug("writing session to disk",{session:!!e,path:u("session.txt")}),e?_.default.outputFileSync(u("session.txt"),e):_.default.removeSync(u("session.txt"))},Ce=E(t=>(t.log.debug("reading token from env"),process.env.GGT_TOKEN));export{z as a,de as b,h as c,_e as d,Ge as e,Ce as f};
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
normalize-path/index.js:
|
|
5
|
-
(*!
|
|
6
|
-
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
7
|
-
*
|
|
8
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
9
|
-
* Released under the MIT License.
|
|
10
|
-
*)
|
|
11
|
-
*/
|
|
12
|
-
//# sourceMappingURL=chunk-AGRDDZFS.js.map
|
package/dist/chunk-B6XQEEUK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as h,g as o}from"./chunk-SGMPMYEU.js";var g=h((b,f)=>{o();var a=1e3,c=a*60,i=c*60,n=i*24,y=n*7,l=n*365.25;f.exports=function(e,r){r=r||{};var s=typeof e;if(s==="string"&&e.length>0)return p(e);if(s==="number"&&isFinite(e))return r.long?w(e):v(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function p(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var s=parseFloat(r[1]),t=(r[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return s*l;case"weeks":case"week":case"w":return s*y;case"days":case"day":case"d":return s*n;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*c;case"seconds":case"second":case"secs":case"sec":case"s":return s*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}function v(e){var r=Math.abs(e);return r>=n?Math.round(e/n)+"d":r>=i?Math.round(e/i)+"h":r>=c?Math.round(e/c)+"m":r>=a?Math.round(e/a)+"s":e+"ms"}function w(e){var r=Math.abs(e);return r>=n?d(e,r,n,"day"):r>=i?d(e,r,i,"hour"):r>=c?d(e,r,c,"minute"):r>=a?d(e,r,a,"second"):e+" ms"}function d(e,r,s,t){var u=r>=s*1.5;return Math.round(e/s)+" "+t+(u?"s":"")}});var M=h((k,m)=>{"use strict";o();m.exports=(e,r=process.argv)=>{let s=e.startsWith("-")?"":e.length===1?"-":"--",t=r.indexOf(s+e),u=r.indexOf("--");return t!==-1&&(u===-1||t<u)}});export{g as a,M as b};
|
|
2
|
-
//# sourceMappingURL=chunk-B6XQEEUK.js.map
|
package/dist/chunk-E3I3MPQD.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import{c as V}from"./chunk-NO72UU5F.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-AGPFNOXG.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-RIIVR43B.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
|
|
2
|
-
`);n+=T` {red ✖} `,(e??o.type==="SourceFile")&&(n+=T`${Hi(s)} `),n+=T(a);for(let p of c)n+=R(""),n+=T` ${p}`;for(let p of o.labels)n+=T` {dim ${p}}`;n+=R("")}}return R({...r,content:n})},Pc=t=>{z(ne(t))},Hi=t=>{switch(!0){case sr(t):return G.yellowBright("JavaScript");case ir(t):return G.blue("TypeScript");case or(t):return G.magenta("Gelly");default:return G.gray("File")}},Cc=t=>{let e={};for(let r of t){let n=r.node?.apiIdentifier??r.node?.name??"Other";e[n]??=[],e[n].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:mr(r.nodeLabels?.map(s=>s?.identifier)??[])})}return e},Rc=t=>{let e={};for(let r of t)e[r.path]??=[],e[r.path].push({type:r.type,severity:r.level,message:r.message,labels:[]});return e};C();var kr=class extends mt{isBug=pt.NO;constructor(){super("Yarn not found")}render(){return T`
|
|
3
|
-
Yarn must be installed to sync your application. You can install it by running:
|
|
4
|
-
|
|
5
|
-
$ npm install --global yarn
|
|
6
|
-
|
|
7
|
-
For more information, see: https://classic.yarnpkg.com/en/docs/install
|
|
8
|
-
`}},Ct=class extends mt{constructor(r){super('The ".gadget/sync.json" file was invalid or not found');this.details=r}isBug=pt.NO;render(){let r=this.details.directory.path;switch(this.details.command){case"add":case"open":case"status":return T`
|
|
9
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
10
|
-
|
|
11
|
-
${r}
|
|
12
|
-
|
|
13
|
-
In order to use "ggt ${this.details.command}", you must run it within a directory
|
|
14
|
-
that has already been initialized with "ggt dev".
|
|
15
|
-
`;case"dev":return T`
|
|
16
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
17
|
-
|
|
18
|
-
${r}
|
|
19
|
-
|
|
20
|
-
If you're running "ggt dev" for the first time, we recommend
|
|
21
|
-
using a gadget specific directory like this:
|
|
22
|
-
|
|
23
|
-
ggt dev ~/gadget/${this.details.args["--app"]??"<name>"}
|
|
24
|
-
|
|
25
|
-
To use a non-empty directory without a ".gadget/sync.json" file,
|
|
26
|
-
run "ggt dev" again with the "--allow-unknown-directory" flag:
|
|
27
|
-
|
|
28
|
-
ggt dev ${r} --allow-unknown-directory
|
|
29
|
-
`;default:return T`
|
|
30
|
-
A ".gadget/sync.json" file is missing in this directory:
|
|
31
|
-
|
|
32
|
-
${r}
|
|
33
|
-
|
|
34
|
-
If you're certain you want to use this directory, you can run
|
|
35
|
-
"ggt ${this.details.command}" again with the "--allow-unknown-directory" flag:
|
|
36
|
-
|
|
37
|
-
ggt ${this.details.command} --allow-unknown-directory
|
|
38
|
-
`}}},wr=class extends mt{constructor(r){super(`Failed to synchronize files after ${r} attempts.`);this.attempts=r}isBug=pt.MAYBE;render(){return T`
|
|
39
|
-
We merged your local files with your environment's files ${this.attempts} times,
|
|
40
|
-
but your local and environment's files still don't match.
|
|
41
|
-
|
|
42
|
-
Make sure no one else is editing files on your environment, and try again.
|
|
43
|
-
`}},Tr=class extends mt{constructor(r){super("This application is not allowed to be deployed due to fatal errors.");this.fatalErrors=r}isBug=pt.MAYBE;render(){let r=R`{red Gadget has detected the following fatal errors with your files:}`;return r+=ne({ensureEmptyLineAbove:!0,problems:this.fatalErrors,showFileTypes:!1}),r+=R({ensureEmptyLineAbove:!0,content:G.red("Please fix these errors and try again.")}),r}},Yi=t=>(t instanceof Q&&(t=t.cause),rr(t)&&(t=t.errors),nr(t)&&(t=t[0]),er(t)&&"message"in t&&tr(t.message)&&t.message.includes("Files version mismatch")),Fc=(t,e)=>{if(Yi(e)){t.log.debug("swallowing files version mismatch",{error:e});return}throw e};C();import Sr from"node:assert";import se from"node:process";var oe=t=>(t=ct(t,{ensureEmptyLineAbove:!0}),Et.isInteractive||(z(t.content),z(JSON.stringify(t.choices??t.groupedChoices,void 0,2)),z({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),se.exit(1)),new Promise(e=>{let r=new ie({formatChoice:n=>n,formatSelection:n=>n,...t});r.on("submit",e),r.on("exit",()=>se.exit(0)),r.on("abort",()=>se.exit(0))})),ie=class extends yr{cursor=0;optionsPerPage=10;options;currentChoices;groupedChoicesTitleIndexMap=new Map;constructor(e){if(super(),this.options=ct(e,{formatChoice:r=>r,formatSelection:r=>r,...e}),this.options.choices)this.currentChoices=this.options.choices;else{this.currentChoices=this.options.groupedChoices.flatMap(([n,s])=>s);let r=0;this.options.groupedChoices.forEach(n=>{let[s,i]=n;i.forEach((o,a)=>{a===0&&this.groupedChoicesTitleIndexMap.set(r,s),r++})})}this.render()}get selection(){let e=this.currentChoices[this.cursor];return Sr(e,`choices[${this.cursor}] is not defined`),e}moveCursor(e){this.cursor=e,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render("Cancel (Ctrl+C)"),this.close()}submit(){this.done=!0,this.aborted=!1,this.value=this.selection,this.fire(),this.render(),this.close()}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.currentChoices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.currentChoices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.currentChoices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.currentChoices.length),this.render()}_(e,r){if(e===" "){this.submit();return}}render(e){if(this.closed)return;super.render();let r=this.options.content;if(this.done){Et.persistPrompt(R({...this.options,content:`${r.trimEnd()} ${this.options.formatChoice(e??this.selection)}`}));return}r+=` ${G.gray("Use arrow keys to move")}
|
|
44
|
-
|
|
45
|
-
`;let n="",{startIndex:s,endIndex:i}=vr(this.cursor,this.currentChoices.length,this.optionsPerPage);for(let o=s;o<i;o++){let a;this.cursor===o?a=`${Pt.arrowRight} `:o===s&&s>0?a=`${Pt.arrowUp} `:o===i-1&&i<this.currentChoices.length?a=`${Pt.arrowDown} `:a=" ";let c=this.currentChoices[o];Sr(c,`choices[${o}] is not defined`);let p=this.options.formatChoice(c);this.cursor===o&&(p=G.blue.underline(p)),this.groupedChoicesTitleIndexMap.has(o)&&(o!==s&&(n+=`
|
|
46
|
-
`),n+=`${G.grey(this.groupedChoicesTitleIndexMap.get(o))}
|
|
47
|
-
`),n+=`${a}${p}
|
|
48
|
-
`}this.options.indent&&(n=cr(n,this.options.indent)),Et.updatePrompt(r+n)}};C();var Kt=nt(Qi(),1);import ci from"node:assert";import li from"node:path";C();var Ut=nt(Er(),1),Bt=nt(lr(),1),js=nt(ue(),1),ot=nt(ue(),1);import{spawn as zo}from"child_process";import{EventEmitter as ac}from"node:events";var Nt=Object.defineProperty,no=Object.defineProperties,so=Object.getOwnPropertyDescriptor,io=Object.getOwnPropertyDescriptors,Ce=Object.getOwnPropertyNames,Pr=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable,Cr=(t,e,r)=>e in t?Nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e)=>{for(var r in e||(e={}))an.call(e,r)&&Cr(t,r,e[r]);if(Pr)for(var r of Pr(e))oo.call(e,r)&&Cr(t,r,e[r]);return t},gt=(t,e)=>no(t,io(e)),l=(t,e)=>function(){return t&&(e=(0,t[Ce(t)[0]])(t=0)),e},ao=(t,e)=>function(){return e||(0,t[Ce(t)[0]])((e={exports:{}}).exports,e),e.exports},P=(t,e)=>{for(var r in e)Nt(t,r,{get:e[r],enumerable:!0})},uo=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ce(e))!an.call(t,s)&&s!==r&&Nt(t,s,{get:()=>e[s],enumerable:!(n=so(e,s))||n.enumerable});return t},S=t=>uo(Nt({},"__esModule",{value:!0}),t),dt=(t,e,r)=>new Promise((n,s)=>{var i=c=>{try{a(r.next(c))}catch(p){s(p)}},o=c=>{try{a(r.throw(c))}catch(p){s(p)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,o);a((r=r.apply(t,e)).next())});function co(...t){let e=new String(t);return Gt.set(e,t),e}function Dt(t){return t instanceof String&&Gt.has(t)}function Rr(t){return Gt.get(t)||[]}var Gt,_t=l({"src/lib/args/pathspec.ts"(){"use strict";Gt=new WeakMap}}),H,K=l({"src/lib/errors/git-error.ts"(){"use strict";H=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),kt,ut=l({"src/lib/errors/git-response-error.ts"(){"use strict";K(),kt=class extends H{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),un,cn=l({"src/lib/errors/task-configuration-error.ts"(){"use strict";K(),un=class extends H{constructor(t){super(void 0,t)}}}});function ln(t){return typeof t=="function"?t:rt}function pn(t){return typeof t=="function"&&t!==rt}function mn(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function fn(t,e=0){return hn(t)&&t.length>e?t[e]:void 0}function et(t,e=0){if(hn(t)&&t.length>e)return t[t.length-1-e]}function hn(t){return!!(t&&typeof t.length=="number")}function wt(t="",e=!0,r=`
|
|
49
|
-
`){return t.split(r).reduce((n,s)=>{let i=e?s.trim():s;return i&&n.push(i),n},[])}function Re(t,e){return wt(t,!0).map(r=>e(r))}function Oe(t){return(0,Ut.exists)(t,Ut.FOLDER)}function _(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function dn(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function qt(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function q(t){return Array.isArray(t)?t:[t]}function gn(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function yn(t){return q(t).map(String)}function w(t,e=0){if(t==null)return e;let r=parseInt(t,10);return isNaN(r)?e:r}function yt(t,e){let r=[];for(let n=0,s=t.length;n<s;n++)r.push(e,t[n]);return r}function vt(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function vn(t,e){return Object.assign({},...e.map(r=>r in t?{[r]:t[r]}:{}))}function de(t=0){return new Promise(e=>setTimeout(e,t))}function ge(t){if(t!==!1)return t}var at,rt,Tt,Jt=l({"src/lib/utils/util.ts"(){"use strict";at="\0",rt=()=>{},Tt=Object.prototype.toString.call.bind(Object.prototype.toString)}});function J(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Ae(t,e){let r=Dt(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function $e(t){return!!t&&Tt(t)==="[object Object]"}function bn(t){return typeof t=="function"}var St,O,_n,It,Le,kn=l({"src/lib/utils/argument-filters.ts"(){"use strict";Jt(),_t(),St=t=>Array.isArray(t),O=t=>typeof t=="string",_n=t=>Array.isArray(t)&&t.every(O),It=t=>O(t)||Array.isArray(t)&&t.every(O),Le=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),ye,lo=l({"src/lib/utils/exit-codes.ts"(){"use strict";ye=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(ye||{})}}),bt,po=l({"src/lib/utils/git-output-streams.ts"(){"use strict";bt=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new bt(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),g,Y,mo=l({"src/lib/utils/line-parser.ts"(){"use strict";g=class{constructor(t,e){this.matches=[],this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((s,i)=>this.addMatch(s,i,r(i)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let n=r&&t.exec(r);return n&&this.pushMatch(e,n),!!n}pushMatch(t,e){this.matches.push(...e.slice(1))}},Y=class extends g{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function wn(...t){let e=process.cwd(),r=Object.assign(F({baseDir:e},Tn),...t.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var Tn,fo=l({"src/lib/utils/simple-git-options.ts"(){"use strict";Tn={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Me(t,e=[]){return $e(t)?Object.keys(t).reduce((r,n)=>{let s=t[n];return Dt(s)?r.push(s):Ae(s,["boolean"])?r.push(n+"="+s):r.push(n),r},e):e}function L(t,e=0,r=!1){let n=[];for(let s=0,i=e<0?t.length:e;s<i;s++)"string|number".includes(typeof t[s])&&n.push(String(t[s]));return Me(je(t),n),r||n.push(...ho(t)),n}function ho(t){let e=typeof et(t)=="function";return J(et(t,e?1:0),St,[])}function je(t){let e=bn(et(t));return J(et(t,e?1:0),$e)}function x(t,e=!0){let r=ln(et(t));return e||pn(r)?r:void 0}var go=l({"src/lib/utils/task-options.ts"(){"use strict";kn(),Jt(),_t()}});function ve(t,e){return t(e.stdOut,e.stdErr)}function j(t,e,r,n=!0){return q(r).forEach(s=>{for(let i=wt(s,n),o=0,a=i.length;o<a;o++){let c=(p=0)=>{if(!(o+p>=a))return i[o+p]};e.some(({parse:p})=>p(c,t))}}),t}var yo=l({"src/lib/utils/task-parser.ts"(){"use strict";Jt()}}),Sn={};P(Sn,{ExitCodes:()=>ye,GitOutputStreams:()=>bt,LineParser:()=>g,NOOP:()=>rt,NULL:()=>at,RemoteLineParser:()=>Y,append:()=>_,appendTaskOptions:()=>Me,asArray:()=>q,asCamelCase:()=>gn,asFunction:()=>ln,asNumber:()=>w,asStringArray:()=>yn,bufferToString:()=>vt,callTaskParser:()=>ve,createInstanceConfig:()=>wn,delay:()=>de,filterArray:()=>St,filterFunction:()=>bn,filterHasLength:()=>Le,filterPlainObject:()=>$e,filterPrimitives:()=>Ae,filterString:()=>O,filterStringArray:()=>_n,filterStringOrStringArray:()=>It,filterType:()=>J,first:()=>fn,folderExists:()=>Oe,forEachLineWithContent:()=>Re,getTrailingOptions:()=>L,including:()=>dn,isUserFunction:()=>pn,last:()=>et,objectToString:()=>Tt,orVoid:()=>ge,parseStringResponse:()=>j,pick:()=>vn,prefixedArray:()=>yt,remove:()=>qt,splitOn:()=>mn,toLinesWithContent:()=>wt,trailingFunctionArgument:()=>x,trailingOptionsArgument:()=>je});var d=l({"src/lib/utils/index.ts"(){"use strict";kn(),lo(),po(),mo(),fo(),go(),yo(),Jt()}}),xn={};P(xn,{CheckRepoActions:()=>be,checkIsBareRepoTask:()=>Pn,checkIsRepoRootTask:()=>En,checkIsRepoTask:()=>vo});function vo(t){switch(t){case"bare":return Pn();case"root":return En()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:zt,parser:De}}function En(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:zt,parser(e){return/^\.(git)?$/.test(e.trim())}}}function Pn(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:zt,parser:De}}function bo(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var be,zt,De,Cn=l({"src/lib/tasks/check-is-repo.ts"(){"use strict";d(),be=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(be||{}),zt=({exitCode:t},e,r,n)=>{if(t===128&&bo(e))return r(Buffer.from("false"));n(e)},De=t=>t.trim()==="true"}});function _o(t,e){let r=new Rn(t),n=t?An:On;return wt(e).forEach(s=>{let i=s.replace(n,"");r.paths.push(i),($n.test(i)?r.folders:r.files).push(i)}),r}var Rn,On,An,$n,ko=l({"src/lib/responses/CleanSummary.ts"(){"use strict";d(),Rn=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},On=/^[a-z]+\s*/i,An=/^[a-z]+\s+[a-z]+\s*/i,$n=/\/$/}}),_e={};P(_e,{EMPTY_COMMANDS:()=>Vt,adhocExecTask:()=>Ln,configurationErrorTask:()=>M,isBufferTask:()=>jn,isEmptyTask:()=>Dn,straightThroughBufferTask:()=>Mn,straightThroughStringTask:()=>$});function Ln(t){return{commands:Vt,format:"empty",parser:t}}function M(t){return{commands:Vt,format:"empty",parser(){throw typeof t=="string"?new un(t):t}}}function $(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function Mn(t){return{commands:t,format:"buffer",parser(e){return e}}}function jn(t){return t.format==="buffer"}function Dn(t){return t.format==="empty"||!t.commands.length}var Vt,E=l({"src/lib/tasks/task.ts"(){"use strict";cn(),Vt=[]}}),In={};P(In,{CONFIG_ERROR_INTERACTIVE_MODE:()=>Ie,CONFIG_ERROR_MODE_REQUIRED:()=>Be,CONFIG_ERROR_UNKNOWN_OPTION:()=>Fe,CleanOptions:()=>$t,cleanTask:()=>Bn,cleanWithOptionsTask:()=>wo,isCleanOptionsArray:()=>To});function wo(t,e){let{cleanMode:r,options:n,valid:s}=So(t);return r?s.options?(n.push(...e),n.some(Po)?M(Ie):Bn(r,n)):M(Fe+JSON.stringify(t)):M(Be)}function Bn(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(n){return _o(t==="n",n)}}}function To(t){return Array.isArray(t)&&t.every(e=>Ne.has(e))}function So(t){let e,r=[],n={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(s=>{xo(s)?(e=s,n.cleanMode=!0):n.options=n.options&&Eo(r[r.length]=`-${s}`)}),{cleanMode:e,options:r,valid:n}}function xo(t){return t==="f"||t==="n"}function Eo(t){return/^-[a-z]$/i.test(t)&&Ne.has(t.charAt(1))}function Po(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var Ie,Be,Fe,$t,Ne,Fn=l({"src/lib/tasks/clean.ts"(){"use strict";ko(),d(),E(),Ie="Git clean interactive mode is not supported",Be='Git clean mode parameter ("n" or "f") is required',Fe="Git clean unknown option found in: ",$t=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))($t||{}),Ne=new Set(["i",...yn(Object.values($t))])}});function Co(t){let e=new Gn;for(let r of Nn(t))e.addValue(r.file,String(r.key),r.value);return e}function Ro(t,e){let r=null,n=[],s=new Map;for(let i of Nn(t,e))i.key===e&&(n.push(r=i.value),s.has(i.file)||s.set(i.file,[]),s.get(i.file).push(r));return{key:e,paths:Array.from(s.keys()),scopes:s,value:r,values:n}}function Oo(t){return t.replace(/^(file):/,"")}function*Nn(t,e=null){let r=t.split("\0");for(let n=0,s=r.length-1;n<s;){let i=Oo(r[n++]),o=r[n++],a=e;if(o.includes(`
|
|
50
|
-
`)){let c=mn(o,`
|
|
51
|
-
`);a=c[0],o=c[1]}yield{file:i,key:a,value:o}}}var Gn,Ao=l({"src/lib/responses/ConfigList.ts"(){"use strict";d(),Gn=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=et(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let n=this.addFile(t);n.hasOwnProperty(e)?Array.isArray(n[e])?n[e].push(r):n[e]=[n[e],r]:n[e]=r,this._all=void 0}}}});function ce(t,e){return typeof t=="string"&&ke.hasOwnProperty(t)?t:e}function $o(t,e,r,n){let s=["config",`--${n}`];return r&&s.push("--add"),s.push(t,e),{commands:s,format:"utf-8",parser(i){return i}}}function Lo(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(n){return Ro(n,t)}}}function Mo(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return Co(r)}}}function jo(){return{addConfig(t,e,...r){return this._runTask($o(t,e,r[0]===!0,ce(r[1],"local")),x(arguments))},getConfig(t,e){return this._runTask(Lo(t,ce(e,void 0)),x(arguments))},listConfig(...t){return this._runTask(Mo(ce(t[0],void 0)),x(arguments))}}}var ke,Un=l({"src/lib/tasks/config.ts"(){"use strict";Ao(),d(),ke=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ke||{})}});function Do(t){return qn.has(t)}var le,qn,Jn=l({"src/lib/tasks/diff-name-status.ts"(){"use strict";le=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(le||{}),qn=new Set(Object.values(le))}});function Io(...t){return new Vn().param(...t)}function Bo(t){let e=new Set,r={};return Re(t,n=>{let[s,i,o]=n.split(at);e.add(s),(r[s]=r[s]||[]).push({line:w(i),path:s,preview:o})}),{paths:e,results:r}}function Fo(){return{grep(t){let e=x(arguments),r=L(arguments);for(let s of zn)if(r.includes(s))return this._runTask(M(`git.grep: use of "${s}" is not supported.`),e);typeof t=="string"&&(t=Io().param(t));let n=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:n,format:"utf-8",parser(s){return Bo(s)}},e)}}}var zn,ht,Or,Vn,Qn=l({"src/lib/tasks/grep.ts"(){"use strict";d(),E(),zn=["-h"],ht=Symbol("grepQuery"),Vn=class{constructor(){this[Or]=[]}*[(Or=ht,Symbol.iterator)](){for(let t of this[ht])yield t}and(...t){return t.length&&this[ht].push("--and","(",...yt(t,"-e"),")"),this}param(...t){return this[ht].push(...yt(t,"-e")),this}}}}),Wn={};P(Wn,{ResetMode:()=>Lt,getResetMode:()=>Go,resetTask:()=>No});function No(t,e){let r=["reset"];return Hn(t)&&r.push(`--${t}`),r.push(...e),$(r)}function Go(t){if(Hn(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function Hn(t){return Yn.includes(t)}var Lt,Yn,Kn=l({"src/lib/tasks/reset.ts"(){"use strict";E(),Lt=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(Lt||{}),Yn=Array.from(Object.values(Lt))}});function Uo(){return(0,Bt.default)("simple-git")}function Ar(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(n,...s)=>{t(n,...s),r(n,...s)}:t:(n,...s)=>{t(`%s ${n}`,e,...s),r&&r(n,...s)}}function qo(t,e,{namespace:r}){if(typeof t=="string")return t;let n=e&&e.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function Ge(t,e,r,n=Uo()){let s=t&&`[${t}]`||"",i=[],o=typeof e=="string"?n.extend(e):e,a=qo(J(e,O),o,n);return p(r);function c(v,b){return _(i,Ge(t,a.replace(/^[^:]+/,v),b,n))}function p(v){let b=v&&`[${v}]`||"",y=o&&Ar(o,b)||rt,f=Ar(n,`${s} ${b}`,y);return Object.assign(o?y:f,{label:t,sibling:c,info:f,step:p})}}var Xn=l({"src/lib/git-logger.ts"(){"use strict";d(),Bt.default.formatters.L=t=>String(Le(t)?t.length:"-"),Bt.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):Tt(t)}}),Ot,we,Jo=l({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";K(),Xn(),Ot=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=Ot.getName(t.commands[0]),r=Ge(this.logLabel,e);return{task:t,logger:r,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:r}]of Array.from(this._queue.entries()))e===t.task?(r.info("Failed %o",t),r("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):r.info("A fatal exception occurred in a previous task, the queue has been purged: %o",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new H(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++Ot.counter}`}},we=Ot,we.counter=0}});function tt(t,e){return{method:fn(t.commands)||"",commands:e}}function Vo(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(Buffer.from(String(r.stack),"ascii"))}}function $r(t,e,r,n){return s=>{r("%s received %L bytes",e,s),n("%B",s),t.push(s)}}var Te,Qo=l({"src/lib/runners/git-executor-chain.ts"(){"use strict";K(),E(),d(),Jo(),Te=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new we}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}attemptTask(t){return dt(this,null,function*(){let e=yield this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:n}=this._queue.attempt(t);return yield Dn(t)?this.attemptEmptyTask(t,n):this.attemptRemoteTask(t,n)}catch(n){throw this.onFatalException(t,n)}finally{r(),e()}})}onFatalException(t,e){let r=e instanceof H?Object.assign(e,{task:t}):new H(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}attemptRemoteTask(t,e){return dt(this,null,function*(){let r=this._plugins.exec("spawn.binary","",tt(t,t.commands)),n=this._plugins.exec("spawn.args",[...t.commands],tt(t,t.commands)),s=yield this.gitResponse(t,r,n,this.outputHandler,e.step("SPAWN")),i=yield this.handleTaskData(t,n,s,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),jn(t)?ve(t.parser,i):ve(t.parser,i.asStrings())})}attemptEmptyTask(t,e){return dt(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,r,n){let{exitCode:s,rejection:i,stdOut:o,stdErr:a}=r;return new Promise((c,p)=>{n("Preparing to handle process response exitCode=%d stdOut=",s);let{error:v}=this._plugins.exec("task.error",{error:i},F(F({},tt(t,e)),r));if(v&&t.onError)return n.info("exitCode=%s handling with custom error handler"),t.onError(r,v,b=>{n.info("custom error handler treated as success"),n("custom error returned a %s",Tt(b)),c(new bt(Array.isArray(b)?Buffer.concat(b):b,Buffer.concat(a)))},p);if(v)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",s,a.length,i),p(v);n.info("retrieving task output complete"),c(new bt(Buffer.concat(o),Buffer.concat(a)))})}gitResponse(t,e,r,n,s){return dt(this,null,function*(){let i=s.sibling("output"),o=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},tt(t,t.commands));return new Promise(a=>{let c=[],p=[];s.info("%s %o",e,r),s("%O",o);let v=this._beforeSpawn(t,r);if(v)return a({stdOut:c,stdErr:p,exitCode:9901,rejection:v});this._plugins.exec("spawn.before",void 0,gt(F({},tt(t,r)),{kill(y){v=y||v}}));let b=zo(e,r,o);b.stdout.on("data",$r(c,"stdOut",s,i.step("stdOut"))),b.stderr.on("data",$r(p,"stdErr",s,i.step("stdErr"))),b.on("error",Vo(p,s)),n&&(s("Passing child process stdOut/stdErr to custom outputHandler"),n(e,b.stdout,b.stderr,[...r])),this._plugins.exec("spawn.after",void 0,gt(F({},tt(t,r)),{spawned:b,close(y,f){a({stdOut:c,stdErr:p,exitCode:y,rejection:v||f})},kill(y){b.killed||(v=y,b.kill("SIGINT"))}}))})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,gt(F({},tt(t,e)),{kill(n){r=n||r}})),r}}}}),Zn={};P(Zn,{GitExecutor:()=>ts});var ts,Wo=l({"src/lib/runners/git-executor.ts"(){"use strict";Qo(),ts=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new Te(this,this._scheduler,this._plugins)}chain(){return new Te(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function Ho(t,e,r=rt){let n=i=>{r(null,i)},s=i=>{i?.task===t&&r(i instanceof kt?Yo(i):i,void 0)};e.then(n,s)}function Yo(t){let e=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),e=rt};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(n,s){return s in t||(n[s]={enumerable:!1,configurable:!1,get(){return e(s),t.git[s]}}),n}}var Ko=l({"src/lib/task-callback.ts"(){"use strict";ut(),d()}});function Lr(t,e){return Ln(r=>{if(!Oe(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var Xo=l({"src/lib/tasks/change-working-directory.ts"(){"use strict";d(),E()}});function pe(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=qt(e,"-B")),$(e)}function Zo(){return{checkout(){return this._runTask(pe(L(arguments,1)),x(arguments))},checkoutBranch(t,e){return this._runTask(pe(["-b",t,e,...L(arguments)]),x(arguments))},checkoutLocalBranch(t){return this._runTask(pe(["-b",t,...L(arguments)]),x(arguments))}}}var ta=l({"src/lib/tasks/checkout.ts"(){"use strict";d(),E()}});function ea(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function ra(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return j(ea(),[es],t)}})}}}var es,na=l({"src/lib/tasks/count-objects.ts"(){"use strict";d(),es=new g(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let n=gn(e);t.hasOwnProperty(n)&&(t[n]=w(r))})}});function sa(t){return j({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},rs,t)}var rs,ia=l({"src/lib/parsers/parse-commit.ts"(){"use strict";d(),rs=[new g(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,n])=>{t.branch=e,t.commit=n,t.root=!!r}),new g(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),n=r.pop();!n||!n.includes("@")||(t.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new g(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(n,10)||0}),new g(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,n])=>{t.summary.changes=parseInt(e,10)||0;let s=parseInt(r,10)||0;n==="-"?t.summary.deletions=s:n==="+"&&(t.summary.insertions=s)})]}});function oa(t,e,r){return{commands:["-c","core.abbrev=40","commit",...yt(t,"-m"),...e,...r],format:"utf-8",parser:sa}}function aa(){return{commit(e,...r){let n=x(arguments),s=t(e)||oa(q(e),q(J(r[0],It,[])),[...J(r[1],St,[]),...L(arguments,0,!0)]);return this._runTask(s,n)}};function t(e){return!It(e)&&M("git.commit: requires the commit message to be supplied as a string/string[]")}}var ua=l({"src/lib/tasks/commit.ts"(){"use strict";ia(),d(),E()}});function ca(){return{firstCommit(){return this._runTask($(["rev-list","--max-parents=0","HEAD"],!0),x(arguments))}}}var la=l({"src/lib/tasks/first-commit.ts"(){"use strict";d(),E()}});function pa(t,e){let r=["hash-object",t];return e&&r.push("-w"),$(r,!0)}var ma=l({"src/lib/tasks/hash-object.ts"(){"use strict";E()}});function fa(t,e,r){let n=String(r).trim(),s;if(s=ns.exec(n))return new Mt(t,e,!1,s[1]);if(s=ss.exec(n))return new Mt(t,e,!0,s[1]);let i="",o=n.split(" ");for(;o.length;)if(o.shift()==="in"){i=o.join(" ");break}return new Mt(t,e,/^re/i.test(n),i)}var Mt,ns,ss,ha=l({"src/lib/responses/InitSummary.ts"(){"use strict";Mt=class{constructor(t,e,r,n){this.bare=t,this.path=e,this.existing=r,this.gitDir=n}},ns=/^Init.+ repository in (.+)$/,ss=/^Rein.+ in (.+)$/}});function da(t){return t.includes(Ue)}function ga(t=!1,e,r){let n=["init",...r];return t&&!da(n)&&n.splice(1,0,Ue),{commands:n,format:"utf-8",parser(s){return fa(n.includes("--bare"),e,s)}}}var Ue,ya=l({"src/lib/tasks/init.ts"(){"use strict";ha(),Ue="--bare"}});function qe(t){for(let e=0;e<t.length;e++){let r=Je.exec(t[e]);if(r)return`--${r[1]}`}return""}function va(t){return Je.test(t)}var Je,xt=l({"src/lib/args/log-format.ts"(){"use strict";Je=/^--(stat|numstat|name-only|name-status)(=|$)/}}),is,ba=l({"src/lib/responses/DiffSummary.ts"(){"use strict";is=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function os(t=""){let e=as[t];return r=>j(new is,e,r,!1)}var me,Mr,jr,Dr,as,us=l({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";xt(),ba(),Jn(),d(),me=[new g(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,n=""])=>{t.files.push({file:e.trim(),changes:w(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new g(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,n])=>{t.files.push({file:e.trim(),before:w(r),after:w(n),binary:!0})}),new g(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let n=/(\d+) i/.exec(r),s=/(\d+) d/.exec(r);t.changed=w(e),t.insertions=w(n?.[1]),t.deletions=w(s?.[1])})],Mr=[new g(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,n])=>{let s=w(e),i=w(r);t.changed++,t.insertions+=s,t.deletions+=i,t.files.push({file:n,changes:s+i,insertions:s,deletions:i,binary:!1})}),new g(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],jr=[new g(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Dr=[new g(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,n,s,i])=>{t.changed++,t.files.push({file:i??n,changes:0,insertions:0,deletions:0,binary:!1,status:ge(Do(e)&&e),from:ge(!!i&&n!==i&&n),similarity:w(r)})})],as={"":me,"--stat":me,"--numstat":Mr,"--name-status":Dr,"--name-only":jr}}});function _a(t,e){return e.reduce((r,n,s)=>(r[n]=t[s]||"",r),Object.create({diff:null}))}function cs(t=Qe,e=ls,r=""){let n=os(r);return function(s){let i=wt(s.trim(),!1,ze).map(function(o){let a=o.split(Ve),c=_a(a[0].split(t),e);return a.length>1&&a[1].trim()&&(c.diff=n(a[1])),c});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var ze,Ve,Qe,ls,ps=l({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";d(),us(),xt(),ze="\xF2\xF2\xF2\xF2\xF2\xF2 ",Ve=" \xF2\xF2",Qe=" \xF2 ",ls=["hash","date","message","refs","author_name","author_email"]}}),ms={};P(ms,{diffSummaryTask:()=>ka,validateLogFormatConfig:()=>Qt});function ka(t){let e=qe(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),Qt(r)||{commands:r,format:"utf-8",parser:os(e)}}function Qt(t){let e=t.filter(va);if(e.length>1)return M(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return M(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var We=l({"src/lib/tasks/diff.ts"(){"use strict";xt(),us(),E()}});function wa(t,e){let r=[],n=[];return Object.keys(t).forEach(s=>{r.push(s),n.push(String(t[s]))}),[r,n.join(e)]}function Ta(t){return Object.keys(t).reduce((e,r)=>(r in Se||(e[r]=t[r]),e),{})}function fs(t={},e=[]){let r=J(t.splitter,O,Qe),n=!Ae(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[s,i]=wa(n,r),o=[],a=[`--pretty=format:${ze}${i}${Ve}`,...e],c=t.n||t["max-count"]||t.maxCount;if(c&&a.push(`--max-count=${c}`),t.from||t.to){let p=t.symmetric!==!1?"...":"..";o.push(`${t.from||""}${p}${t.to||""}`)}return O(t.file)&&a.push("--follow",co(t.file)),Me(Ta(t),a),{fields:s,splitter:r,commands:[...a,...o]}}function Sa(t,e,r){let n=cs(t,e,qe(r));return{commands:["log",...r],format:"utf-8",parser:n}}function xa(){return{log(...r){let n=x(arguments),s=fs(je(arguments),J(arguments[0],St)),i=e(...r)||Qt(s.commands)||t(s);return this._runTask(i,n)}};function t(r){return Sa(r.splitter,r.fields,r.commands)}function e(r,n){return O(r)&&O(n)&&M("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Se,hs=l({"src/lib/tasks/log.ts"(){"use strict";xt(),_t(),ps(),d(),E(),We(),Se=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(Se||{})}}),jt,ds,Ea=l({"src/lib/responses/MergeSummary.ts"(){"use strict";jt=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},ds=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),xe,gs,Pa=l({"src/lib/responses/PullSummary.ts"(){"use strict";xe=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},gs=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function fe(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function Ir(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:w(e&&e[1]||"0"),delta:w(r&&r[1]||"0")}}var ys,Ca=l({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";d(),ys=[new Y(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let n=e.toLowerCase(),s=fe(t.remoteMessages);Object.assign(s,{[n]:w(r)})}),new Y(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let n=e.toLowerCase(),s=fe(t.remoteMessages);Object.assign(s,{[n]:w(r)})}),new Y(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,n])=>{let s=fe(t.remoteMessages);s.total=Ir(e),s.reused=Ir(r),s.packReused=w(n)})]}});function vs(t,e){return j({remoteMessages:new _s},bs,e)}var bs,_s,ks=l({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";d(),Ca(),bs=[new Y(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...ys,new Y([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new Y([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,n])=>{t.remoteMessages.vulnerabilities={count:w(e),summary:r,url:n}})],_s=class{constructor(){this.all=[]}}}});function Ra(t,e){let r=j(new gs,ws,[t,e]);return r.message&&r}var Br,Fr,Nr,Gr,ws,Ur,He,Ts=l({"src/lib/parsers/parse-pull.ts"(){"use strict";Pa(),d(),ks(),Br=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,Fr=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,Nr=/^(create|delete) mode \d+ (.+)/,Gr=[new g(Br,(t,[e,r,n])=>{t.files.push(e),r&&(t.insertions[e]=r.length),n&&(t.deletions[e]=n.length)}),new g(Fr,(t,[e,,r,,n])=>r!==void 0||n!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+n||0,!0):!1),new g(Nr,(t,[e,r])=>{_(t.files,r),_(e==="create"?t.created:t.deleted,r)})],ws=[new g(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new g(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new g(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,n,s])=>{t.branch.local=n,t.hash.local=e,t.branch.remote=s,t.hash.remote=r})],Ur=(t,e)=>j(new xe,Gr,[t,e]),He=(t,e)=>Object.assign(new xe,Ur(t,e),vs(t,e))}}),qr,Ss,Jr,Oa=l({"src/lib/parsers/parse-merge.ts"(){"use strict";Ea(),d(),Ts(),qr=[new g(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new g(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new jt(e,r))}),new g(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,n])=>{t.conflicts.push(new jt(e,r,{deleteRef:n}))}),new g(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new jt(e,null))}),new g(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],Ss=(t,e)=>Object.assign(Jr(t,e),He(t,e)),Jr=t=>j(new ds,qr,t)}});function zr(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let n=Ss(e,r);if(n.failed)throw new kt(n);return n}}:M("Git.merge requires at least one option")}var Aa=l({"src/lib/tasks/merge.ts"(){"use strict";ut(),Oa(),E()}});function $a(t,e,r){let n=r.includes("deleted"),s=r.includes("tag")||/^refs\/tags/.test(t),i=!r.includes("new");return{deleted:n,tag:s,branch:!s,new:!i,alreadyUpdated:i,local:t,remote:e}}var Vr,xs,Qr,La=l({"src/lib/parsers/parse-push.ts"(){"use strict";d(),ks(),Vr=[new g(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new g(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=gt(F({},t.ref||{}),{local:e})}),new g(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,n])=>{t.pushed.push($a(e,r,n))}),new g(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,n])=>{t.branch=gt(F({},t.branch||{}),{local:e,remote:r,remoteName:n})}),new g(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,n,s])=>{t.update={head:{local:e,remote:r},hash:{from:n,to:s}}})],xs=(t,e)=>{let r=Qr(t,e),n=vs(t,e);return F(F({},r),n)},Qr=(t,e)=>j({pushed:[]},Vr,[t,e])}}),Es={};P(Es,{pushTagsTask:()=>Ma,pushTask:()=>Ye});function Ma(t={},e){return _(e,"--tags"),Ye(t,e)}function Ye(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),qt(r,"-v"),_(r,"--verbose"),_(r,"--porcelain"),{commands:r,format:"utf-8",parser:xs}}var Ps=l({"src/lib/tasks/push.ts"(){"use strict";La(),d()}});function ja(){return{showBuffer(){let t=["show",...L(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(Mn(t),x(arguments))},show(){let t=["show",...L(arguments,1)];return this._runTask($(t),x(arguments))}}}var Da=l({"src/lib/tasks/show.ts"(){"use strict";d(),E()}}),Wr,Cs,Ia=l({"src/lib/responses/FileStatusSummary.ts"(){"use strict";Wr=/^(.+)\0(.+)$/,Cs=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let n=Wr.exec(t)||[null,t,t];this.from=n[2]||"",this.path=n[1]||""}}}}});function Hr(t){let[e,r]=t.split(at);return{from:r||e,to:e}}function I(t,e,r){return[`${t}${e}`,r]}function he(t,...e){return e.map(r=>I(t,r,(n,s)=>_(n.conflicted,s)))}function Ba(t,e){let r=e.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return n(" ",r.charAt(0),r.substr(2));default:return}function n(s,i,o){let a=`${s}${i}`,c=Rs.get(a);c&&c(t,o),a!=="##"&&a!=="!!"&&t.files.push(new Cs(o,s,i))}}var Yr,Rs,Os,Fa=l({"src/lib/responses/StatusSummary.ts"(){"use strict";d(),Ia(),Yr=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Rs=new Map([I(" ","A",(t,e)=>_(t.created,e)),I(" ","D",(t,e)=>_(t.deleted,e)),I(" ","M",(t,e)=>_(t.modified,e)),I("A"," ",(t,e)=>_(t.created,e)&&_(t.staged,e)),I("A","M",(t,e)=>_(t.created,e)&&_(t.staged,e)&&_(t.modified,e)),I("D"," ",(t,e)=>_(t.deleted,e)&&_(t.staged,e)),I("M"," ",(t,e)=>_(t.modified,e)&&_(t.staged,e)),I("M","M",(t,e)=>_(t.modified,e)&&_(t.staged,e)),I("R"," ",(t,e)=>{_(t.renamed,Hr(e))}),I("R","M",(t,e)=>{let r=Hr(e);_(t.renamed,r),_(t.modified,r.to)}),I("!","!",(t,e)=>{_(t.ignored=t.ignored||[],e)}),I("?","?",(t,e)=>_(t.not_added,e)),...he("A","A","U"),...he("D","D","U"),...he("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,s=/^(.+?(?=(?:\.{3}|\s|$)))/,i=/\.{3}(\S*)/,o=/\son\s([\S]+)$/,a;a=r.exec(e),t.ahead=a&&+a[1]||0,a=n.exec(e),t.behind=a&&+a[1]||0,a=s.exec(e),t.current=a&&a[1],a=i.exec(e),t.tracking=a&&a[1],a=o.exec(e),t.current=a&&a[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),Os=function(t){let e=t.split(at),r=new Yr;for(let n=0,s=e.length;n<s;){let i=e[n++].trim();i&&(i.charAt(0)==="R"&&(i+=at+(e[n++]||"")),Ba(r,i))}return r}}});function Na(t){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...t.filter(r=>!As.includes(r))],parser(r){return Os(r)}}}var As,Ga=l({"src/lib/tasks/status.ts"(){"use strict";Fa(),As=["--null","-z"]}});function Ft(t=0,e=0,r=0,n="",s=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:n,installed:s},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function Ua(){return Ft(0,0,0,"",!1)}function qa(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:Ja,onError(t,e,r,n){if(t.exitCode===-2)return r(Buffer.from(Ke));n(e)}})}}}function Ja(t){return t===Ke?Ua():j(Ft(0,0,0,t),$s,t)}var Ke,$s,za=l({"src/lib/tasks/version.ts"(){"use strict";d(),Ke="installed=false",$s=[new g(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,n,s=""])=>{Object.assign(t,Ft(w(e),w(r),w(n),s))}),new g(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,n,s=""])=>{Object.assign(t,Ft(w(e),w(r),n,s))})]}}),Ls={};P(Ls,{SimpleGitApi:()=>Ee});var Ee,Va=l({"src/lib/simple-git-api.ts"(){"use strict";Ko(),Xo(),ta(),na(),ua(),Un(),la(),Qn(),ma(),ya(),hs(),Aa(),Ps(),Da(),Ga(),E(),za(),d(),Ee=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),n=r.push(t);return e&&Ho(t,n,e),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(t){return this._runTask($(["add",...q(t)]),x(arguments))}cwd(t){let e=x(arguments);return typeof t=="string"?this._runTask(Lr(t,this._executor),e):typeof t?.path=="string"?this._runTask(Lr(t.path,t.root&&this._executor||void 0),e):this._runTask(M("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(pa(t,e===!0),x(arguments))}init(t){return this._runTask(ga(t===!0,this._executor.cwd,L(arguments)),x(arguments))}merge(){return this._runTask(zr(L(arguments)),x(arguments))}mergeFromTo(t,e){return O(t)&&O(e)?this._runTask(zr([t,e,...L(arguments)]),x(arguments,!1)):this._runTask(M("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Ye({remote:J(arguments[0],O),branch:J(arguments[1],O)},L(arguments));return this._runTask(t,x(arguments))}stash(){return this._runTask($(["stash",...L(arguments)]),x(arguments))}status(){return this._runTask(Na(L(arguments)),x(arguments))}},Object.assign(Ee.prototype,Zo(),aa(),jo(),ra(),ca(),Fo(),xa(),ja(),qa())}}),Ms={};P(Ms,{Scheduler:()=>Ds});var Kr,Ds,Qa=l({"src/lib/runners/scheduler.ts"(){"use strict";d(),Xn(),Kr=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,js.createDeferred)();return{promise:e,done:r,id:t}}})(),Ds=class{constructor(t=2){this.concurrency=t,this.logger=Ge("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=_(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),qt(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=_(this.pending,Kr());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),Is={};P(Is,{applyPatchTask:()=>Wa});function Wa(t,e){return $(["apply",...e,...t])}var Ha=l({"src/lib/tasks/apply-patch.ts"(){"use strict";E()}});function Ya(t,e){return{branch:t,hash:e,success:!0}}function Ka(t){return{branch:t,hash:null,success:!1}}var Bs,Xa=l({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";Bs=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function Fs(t,e){return e===1&&Pe.test(t)}var Xr,Pe,Zr,Wt,Za=l({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";Xa(),d(),Xr=/(\S+)\s+\(\S+\s([^)]+)\)/,Pe=/^error[^']+'([^']+)'/m,Zr=[new g(Xr,(t,[e,r])=>{let n=Ya(e,r);t.all.push(n),t.branches[e]=n}),new g(Pe,(t,[e])=>{let r=Ka(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],Wt=(t,e)=>j(new Bs,Zr,[t,e])}}),Ns,tu=l({"src/lib/responses/BranchSummary.ts"(){"use strict";Ns=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,n,s){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:n,label:s}}}}});function tn(t){return t?t.charAt(0):""}function Gs(t){return j(new Ns,Us,t)}var Us,eu=l({"src/lib/parsers/parse-branch.ts"(){"use strict";tu(),d(),Us=[new g(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,n,s])=>{t.push(tn(e),!0,r,n,s)}),new g(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),(t,[e,r,n,s])=>{t.push(tn(e),!1,r,n,s)})]}}),qs={};P(qs,{branchLocalTask:()=>nu,branchTask:()=>ru,containsDeleteBranchCommand:()=>Js,deleteBranchTask:()=>iu,deleteBranchesTask:()=>su});function Js(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function ru(t){let e=Js(t),r=["branch",...t];return r.length===1&&r.push("-a"),r.includes("-v")||r.splice(1,0,"-v"),{format:"utf-8",commands:r,parser(n,s){return e?Wt(n,s).all[0]:Gs(n)}}}function nu(){return{format:"utf-8",commands:["branch","-v"],parser:Gs}}function su(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,n){return Wt(r,n)},onError({exitCode:r,stdOut:n},s,i,o){if(!Fs(String(s),r))return o(s);i(n)}}}function iu(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(n,s){return Wt(n,s).branches[t]},onError({exitCode:n,stdErr:s,stdOut:i},o,a,c){if(!Fs(String(o),n))return c(o);throw new kt(r.parser(vt(i),vt(s)),String(o))}};return r}var ou=l({"src/lib/tasks/branch.ts"(){"use strict";ut(),Za(),eu(),d()}}),zs,au=l({"src/lib/responses/CheckIgnore.ts"(){"use strict";zs=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),Vs={};P(Vs,{checkIgnoreTask:()=>uu});function uu(t){return{commands:["check-ignore",...t],format:"utf-8",parser:zs}}var cu=l({"src/lib/tasks/check-ignore.ts"(){"use strict";au()}}),Qs={};P(Qs,{cloneMirrorTask:()=>pu,cloneTask:()=>Ws});function lu(t){return/^--upload-pack(=|$)/.test(t)}function Ws(t,e,r){let n=["clone",...r];return O(t)&&n.push(t),O(e)&&n.push(e),n.find(lu)?M("git.fetch: potential exploit argument blocked."):$(n)}function pu(t,e,r){return _(r,"--mirror"),Ws(t,e,r)}var mu=l({"src/lib/tasks/clone.ts"(){"use strict";E(),d()}});function fu(t,e){return j({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},Hs,[t,e])}var Hs,hu=l({"src/lib/parsers/parse-fetch.ts"(){"use strict";d(),Hs=[new g(/From (.+)$/,(t,[e])=>{t.remote=e}),new g(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new g(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new g(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new g(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,n,s])=>{t.updated.push({name:n,tracking:s,to:r,from:e})})]}}),Ys={};P(Ys,{fetchTask:()=>gu});function du(t){return/^--upload-pack(=|$)/.test(t)}function gu(t,e,r){let n=["fetch",...r];return t&&e&&n.push(t,e),n.find(du)?M("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:fu}}var yu=l({"src/lib/tasks/fetch.ts"(){"use strict";hu(),E()}});function vu(t){return j({moves:[]},Ks,t)}var Ks,bu=l({"src/lib/parsers/parse-move.ts"(){"use strict";d(),Ks=[new g(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),Xs={};P(Xs,{moveTask:()=>_u});function _u(t,e){return{commands:["mv","-v",...q(t),e],format:"utf-8",parser:vu}}var ku=l({"src/lib/tasks/move.ts"(){"use strict";bu(),d()}}),Zs={};P(Zs,{pullTask:()=>wu});function wu(t,e,r){let n=["pull",...r];return t&&e&&n.splice(1,0,t,e),{commands:n,format:"utf-8",parser(s,i){return He(s,i)},onError(s,i,o,a){let c=Ra(vt(s.stdOut),vt(s.stdErr));if(c)return a(new kt(c));a(i)}}}var Tu=l({"src/lib/tasks/pull.ts"(){"use strict";ut(),Ts(),d()}});function Su(t){let e={};return ti(t,([r])=>e[r]={name:r}),Object.values(e)}function xu(t){let e={};return ti(t,([r,n,s])=>{e.hasOwnProperty(r)||(e[r]={name:r,refs:{fetch:"",push:""}}),s&&n&&(e[r].refs[s.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function ti(t,e){Re(t,r=>e(r.split(/\s+/)))}var Eu=l({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";d()}}),ei={};P(ei,{addRemoteTask:()=>Pu,getRemotesTask:()=>Cu,listRemotesTask:()=>Ru,remoteTask:()=>Ou,removeRemoteTask:()=>Au});function Pu(t,e,r){return $(["remote","add",...r,t,e])}function Cu(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?xu:Su}}function Ru(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),$(e)}function Ou(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),$(e)}function Au(t){return $(["remote","remove",t])}var $u=l({"src/lib/tasks/remote.ts"(){"use strict";Eu(),E()}}),ri={};P(ri,{stashListTask:()=>Lu});function Lu(t={},e){let r=fs(t),n=["stash","list",...r.commands,...e],s=cs(r.splitter,r.fields,qe(n));return Qt(n)||{commands:n,format:"utf-8",parser:s}}var Mu=l({"src/lib/tasks/stash-list.ts"(){"use strict";xt(),ps(),We(),hs()}}),ni={};P(ni,{addSubModuleTask:()=>ju,initSubModuleTask:()=>Du,subModuleTask:()=>Ht,updateSubModuleTask:()=>Iu});function ju(t,e){return Ht(["add",t,e])}function Du(t){return Ht(["init",...t])}function Ht(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),$(e)}function Iu(t){return Ht(["update",...t])}var Bu=l({"src/lib/tasks/sub-module.ts"(){"use strict";E()}});function Fu(t,e){let r=isNaN(t),n=isNaN(e);return r!==n?r?1:-1:r?si(t,e):0}function si(t,e){return t===e?0:t>e?1:-1}function Nu(t){return t.trim()}function At(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var en,ii,Gu=l({"src/lib/responses/TagList.ts"(){"use strict";en=class{constructor(t,e){this.all=t,this.latest=e}},ii=function(t,e=!1){let r=t.split(`
|
|
52
|
-
`).map(Nu).filter(Boolean);e||r.sort(function(s,i){let o=s.split("."),a=i.split(".");if(o.length===1||a.length===1)return Fu(At(o[0]),At(a[0]));for(let c=0,p=Math.max(o.length,a.length);c<p;c++){let v=si(At(o[c]),At(a[c]));if(v)return v}return 0});let n=e?r[0]:[...r].reverse().find(s=>s.indexOf(".")>=0);return new en(r,n)}}}),oi={};P(oi,{addAnnotatedTagTask:()=>Ju,addTagTask:()=>qu,tagListTask:()=>Uu});function Uu(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return ii(r,e)}}}function qu(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function Ju(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var zu=l({"src/lib/tasks/tag.ts"(){"use strict";Gu()}}),Vu=ao({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(Wo(),S(Zn)),{SimpleGitApi:n}=(Va(),S(Ls)),{Scheduler:s}=(Qa(),S(Ms)),{configurationErrorTask:i}=(E(),S(_e)),{asArray:o,filterArray:a,filterPrimitives:c,filterString:p,filterStringOrStringArray:v,filterType:b,getTrailingOptions:y,trailingFunctionArgument:f,trailingOptionsArgument:X}=(d(),S(Sn)),{applyPatchTask:hi}=(Ha(),S(Is)),{branchTask:di,branchLocalTask:gi,deleteBranchesTask:yi,deleteBranchTask:vi}=(ou(),S(qs)),{checkIgnoreTask:bi}=(cu(),S(Vs)),{checkIsRepoTask:_i}=(Cn(),S(xn)),{cloneTask:ki,cloneMirrorTask:wi}=(mu(),S(Qs)),{cleanWithOptionsTask:Ti,isCleanOptionsArray:Si}=(Fn(),S(In)),{diffSummaryTask:xi}=(We(),S(ms)),{fetchTask:Ei}=(yu(),S(Ys)),{moveTask:Pi}=(ku(),S(Xs)),{pullTask:Ci}=(Tu(),S(Zs)),{pushTagsTask:Ri}=(Ps(),S(Es)),{addRemoteTask:Oi,getRemotesTask:Ai,listRemotesTask:$i,remoteTask:Li,removeRemoteTask:Mi}=($u(),S(ei)),{getResetMode:ji,resetTask:Di}=(Kn(),S(Wn)),{stashListTask:Ii}=(Mu(),S(ri)),{addSubModuleTask:Bi,initSubModuleTask:Fi,subModuleTask:Ni,updateSubModuleTask:Gi}=(Bu(),S(ni)),{addAnnotatedTagTask:Ui,addTagTask:qi,tagListTask:Ji}=(zu(),S(oi)),{straightThroughBufferTask:zi,straightThroughStringTask:U}=(E(),S(_e));function h(u,m){this._plugins=m,this._executor=new r(u.baseDir,new s(u.maxConcurrentProcesses),m),this._trimmed=u.trimmed}(h.prototype=Object.create(n.prototype)).constructor=h,h.prototype.customBinary=function(u){return this._plugins.reconfigure("binary",u),this},h.prototype.env=function(u,m){return arguments.length===1&&typeof u=="object"?this._executor.env=u:(this._executor.env=this._executor.env||{})[u]=m,this},h.prototype.stashList=function(u){return this._runTask(Ii(X(arguments)||{},a(u)&&u||[]),f(arguments))};function Ze(u,m,k,A){return typeof k!="string"?i(`git.${u}() requires a string 'repoPath'`):m(k,b(A,p),y(arguments))}h.prototype.clone=function(){return this._runTask(Ze("clone",ki,...arguments),f(arguments))},h.prototype.mirror=function(){return this._runTask(Ze("mirror",wi,...arguments),f(arguments))},h.prototype.mv=function(u,m){return this._runTask(Pi(u,m),f(arguments))},h.prototype.checkoutLatestTag=function(u){var m=this;return this.pull(function(){m.tags(function(k,A){m.checkout(A.latest,u)})})},h.prototype.pull=function(u,m,k,A){return this._runTask(Ci(b(u,p),b(m,p),y(arguments)),f(arguments))},h.prototype.fetch=function(u,m){return this._runTask(Ei(b(u,p),b(m,p),y(arguments)),f(arguments))},h.prototype.silent=function(u){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},h.prototype.tags=function(u,m){return this._runTask(Ji(y(arguments)),f(arguments))},h.prototype.rebase=function(){return this._runTask(U(["rebase",...y(arguments)]),f(arguments))},h.prototype.reset=function(u){return this._runTask(Di(ji(u),y(arguments)),f(arguments))},h.prototype.revert=function(u){let m=f(arguments);return typeof u!="string"?this._runTask(i("Commit must be a string"),m):this._runTask(U(["revert",...y(arguments,0,!0),u]),m)},h.prototype.addTag=function(u){let m=typeof u=="string"?qi(u):i("Git.addTag requires a tag name");return this._runTask(m,f(arguments))},h.prototype.addAnnotatedTag=function(u,m){return this._runTask(Ui(u,m),f(arguments))},h.prototype.deleteLocalBranch=function(u,m,k){return this._runTask(vi(u,typeof m=="boolean"?m:!1),f(arguments))},h.prototype.deleteLocalBranches=function(u,m,k){return this._runTask(yi(u,typeof m=="boolean"?m:!1),f(arguments))},h.prototype.branch=function(u,m){return this._runTask(di(y(arguments)),f(arguments))},h.prototype.branchLocal=function(u){return this._runTask(gi(),f(arguments))},h.prototype.raw=function(u){let m=!Array.isArray(u),k=[].slice.call(m?arguments:u,0);for(let N=0;N<k.length&&m;N++)if(!c(k[N])){k.splice(N,k.length-N);break}k.push(...y(arguments,0,!0));var A=f(arguments);return k.length?this._runTask(U(k,this._trimmed),A):this._runTask(i("Raw: must supply one or more command to execute"),A)},h.prototype.submoduleAdd=function(u,m,k){return this._runTask(Bi(u,m),f(arguments))},h.prototype.submoduleUpdate=function(u,m){return this._runTask(Gi(y(arguments,!0)),f(arguments))},h.prototype.submoduleInit=function(u,m){return this._runTask(Fi(y(arguments,!0)),f(arguments))},h.prototype.subModule=function(u,m){return this._runTask(Ni(y(arguments)),f(arguments))},h.prototype.listRemote=function(){return this._runTask($i(y(arguments)),f(arguments))},h.prototype.addRemote=function(u,m,k){return this._runTask(Oi(u,m,y(arguments)),f(arguments))},h.prototype.removeRemote=function(u,m){return this._runTask(Mi(u),f(arguments))},h.prototype.getRemotes=function(u,m){return this._runTask(Ai(u===!0),f(arguments))},h.prototype.remote=function(u,m){return this._runTask(Li(y(arguments)),f(arguments))},h.prototype.tag=function(u,m){let k=y(arguments);return k[0]!=="tag"&&k.unshift("tag"),this._runTask(U(k),f(arguments))},h.prototype.updateServerInfo=function(u){return this._runTask(U(["update-server-info"]),f(arguments))},h.prototype.pushTags=function(u,m){let k=Ri({remote:b(u,p)},y(arguments));return this._runTask(k,f(arguments))},h.prototype.rm=function(u){return this._runTask(U(["rm","-f",...o(u)]),f(arguments))},h.prototype.rmKeepLocal=function(u){return this._runTask(U(["rm","--cached",...o(u)]),f(arguments))},h.prototype.catFile=function(u,m){return this._catFile("utf-8",arguments)},h.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},h.prototype._catFile=function(u,m){var k=f(m),A=["cat-file"],N=m[0];if(typeof N=="string")return this._runTask(i("Git.catFile: options must be supplied as an array of strings"),k);Array.isArray(N)&&A.push.apply(A,N);let Xt=u==="buffer"?zi(A):U(A);return this._runTask(Xt,k)},h.prototype.diff=function(u,m){let k=p(u)?i("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):U(["diff",...y(arguments)]);return this._runTask(k,f(arguments))},h.prototype.diffSummary=function(){return this._runTask(xi(y(arguments,1)),f(arguments))},h.prototype.applyPatch=function(u){let m=v(u)?hi(o(u),y([].slice.call(arguments,1))):i("git.applyPatch requires one or more string patches as the first argument");return this._runTask(m,f(arguments))},h.prototype.revparse=function(){let u=["rev-parse",...y(arguments,!0)];return this._runTask(U(u,!0),f(arguments))},h.prototype.clean=function(u,m,k){let A=Si(u),N=A&&u.join("")||b(u,p)||"",Xt=y([].slice.call(arguments,A?1:0));return this._runTask(Ti(N,Xt),f(arguments))},h.prototype.exec=function(u){let m={commands:[],format:"utf-8",parser(){typeof u=="function"&&u()}};return this._runTask(m)},h.prototype.clearQueue=function(){return this},h.prototype.checkIgnore=function(u,m){return this._runTask(bi(o(b(u,v,[]))),f(arguments))},h.prototype.checkIsRepo=function(u,m){return this._runTask(_i(b(u,p)),f(arguments))},e.exports=h}});_t();K();var Qu=class extends H{constructor(t,e){super(void 0,e),this.config=t}};K();K();var W=class extends H{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};ut();cn();Cn();Fn();Un();Jn();Qn();Kn();function Wu(t){return t?[{type:"spawn.before",action(n,s){t.aborted&&s.kill(new W(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,s){function i(){s.kill(new W(void 0,"abort","Abort signal received"))}t.addEventListener("abort",i),s.spawned.on("close",()=>t.removeEventListener("abort",i))}}]:void 0}function Hu(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function Yu(t,e){if(Hu(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new W(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function Ku(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new W(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new W(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new W(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function Xu({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((s,i)=>{let o=i<r.length?r[i+1]:"";t||Yu(s,o),e||Ku(s,n.method)}),r}}}d();function Zu(t){let e=yt(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}d();var rn=(0,ot.deferred)().promise;function tc({onClose:t=!0,onExit:e=50}={}){function r(){let s=-1,i={close:(0,ot.deferred)(),closeTimeout:(0,ot.deferred)(),exit:(0,ot.deferred)(),exitTimeout:(0,ot.deferred)()},o=Promise.race([t===!1?rn:i.closeTimeout.promise,e===!1?rn:i.exitTimeout.promise]);return n(t,i.close,i.closeTimeout),n(e,i.exit,i.exitTimeout),{close(a){s=a,i.close.done()},exit(a){s=a,i.exit.done()},get exitCode(){return s},result:o}}function n(s,i,o){s!==!1&&(s===!0?i.promise:i.promise.then(()=>de(s))).then(o.done)}return{type:"spawn.after",action(s,i){return dt(this,arguments,function*(o,{spawned:a,close:c}){var p,v;let b=r(),y=!0,f=()=>void(y=!1);(p=a.stdout)==null||p.on("data",f),(v=a.stderr)==null||v.on("data",f),a.on("error",f),a.on("close",X=>b.close(X)),a.on("exit",X=>b.exit(X));try{yield b.result,y&&(yield de(50)),c(b.exitCode)}catch(X){c(b.exitCode,X)}})}}}d();var ec="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",nn="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function rc(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function sn(t,e){if(t.length<1||t.length>2)throw new W(void 0,"binary",ec);if(t.some(rc))if(e)console.warn(nn);else throw new W(void 0,"binary",nn);let[n,s]=t;return{binary:n,prefix:s}}function nc(t,e=["git"],r=!1){let n=sn(q(e),r);t.on("binary",s=>{n=sn(q(s),r)}),t.append("spawn.binary",()=>n.binary),t.append("spawn.args",s=>n.prefix?[n.prefix,...s]:s)}K();function sc(t){return!!(t.exitCode&&t.stdErr.length)}function ic(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function oc(t=!1,e=sc,r=ic){return(n,s)=>!t&&n||!e(s)?n:r(s)}function on(t){return{type:"task.error",action(e,r){let n=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new H(void 0,n.toString("utf-8"))}:{error:n}}}}d();var uc=class{constructor(){this.plugins=new Set,this.events=new ac}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=_(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return q(t).forEach(r=>r&&this.plugins.add(_(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let n=e,s=Object.freeze(Object.create(r));for(let i of this.plugins)i.type===t&&(n=i.action(n,s));return n}};d();function cc(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(i,o){return r.includes(o.method)?dn(i,e):i}},{type:"spawn.after",action(i,o){var a;o.commands.includes(e)&&((a=o.spawned.stderr)==null||a.on("data",c=>{let p=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(c.toString("utf8"));p&&t({method:o.method,stage:lc(p[1]),progress:w(p[2]),processed:w(p[3]),total:w(p[4])})}))}}]}function lc(t){return String(t.toLowerCase().split(" ",1))||"unknown"}d();function pc(t){let e=vn(t,["uid","gid"]);return{type:"spawn.options",action(r){return F(F({},e),r)}}}function mc({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(n,s){var i,o;let a;function c(){a&&clearTimeout(a),a=setTimeout(v,t)}function p(){var b,y;(b=s.spawned.stdout)==null||b.off("data",c),(y=s.spawned.stderr)==null||y.off("data",c),s.spawned.off("exit",p),s.spawned.off("close",p),a&&clearTimeout(a)}function v(){p(),s.kill(new W(void 0,"timeout","block timeout reached"))}r&&((i=s.spawned.stdout)==null||i.on("data",c)),e&&((o=s.spawned.stderr)==null||o.on("data",c)),s.spawned.on("exit",p),s.spawned.on("close",p),c()}}}_t();function fc(){return{type:"spawn.args",action(t){let e=[],r;function n(s){(r=r||[]).push(...s)}for(let s=0;s<t.length;s++){let i=t[s];if(Dt(i)){n(Rr(i));continue}if(i==="--"){n(t.slice(s+1).flatMap(o=>Dt(o)&&Rr(o)||o));break}e.push(i)}return r?[...e,"--",...r.map(String)]:e}}}d();var hc=Vu();function dc(t,e){var r;let n=new uc,s=wn(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Oe(s.baseDir))throw new Qu(s,"Cannot use simple-git on a directory that does not exist");return Array.isArray(s.config)&&n.add(Zu(s.config)),n.add(Xu(s.unsafe)),n.add(fc()),n.add(tc(s.completion)),s.abort&&n.add(Wu(s.abort)),s.progress&&n.add(cc(s.progress)),s.timeout&&n.add(mc(s.timeout)),s.spawnOptions&&n.add(pc(s.spawnOptions)),n.add(on(oc(!0))),s.errors&&n.add(on(s.errors)),nc(n,s.binary,(r=s.unsafe)==null?void 0:r.allowUnsafeCustomBinary),new hc(s,n)}ut();var ai=dc;C();var ui=(t,e)=>{let r=/^(https:\/\/)?(?<slug>[\w-]+?)(--development)?(\..*)?$/.exec(t)?.groups?.slug;if(r)return r;throw new V(T`
|
|
53
|
-
${e} must be the application's {bold slug} or {bold URL}
|
|
54
|
-
|
|
55
|
-
{bold EXAMPLES:}
|
|
56
|
-
${e} my-app
|
|
57
|
-
${e} my-app.gadget.app
|
|
58
|
-
${e} https://my-app.gadget.app
|
|
59
|
-
${e} https://my-app.gadget.app/edit
|
|
60
|
-
${e} https://my-app--development.gadget.app/edit
|
|
61
|
-
`)};C();import Xe from"node:assert";var Yt=class{ctx;#t;constructor(e,r){this.ctx=e.child({name:"edit"}),this.#t=new hr(this.ctx,r,"/edit/api/graphql")}async query({query:e,variables:r,...n}){let s=/query (\w+)/.exec(e)?.[1];Xe(s,"query name not found");let i=this.ctx.child({name:"edit",fields:{edit:{query:s}},devFields:{edit:{query:s,variables:lt(r)}}});i.log.info("executing graphql query");let o=await this.#t.execute(i,{operation:e,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(o.errors)throw new Q(e,o.errors);if(!o.data)throw new Q(e,"Query response did not contain data");return o.data}async mutate({mutation:e,variables:r,...n}){let s=/mutation (\w+)/.exec(e)?.[1];Xe(s,"mutation name not found");let i=this.ctx.child({name:"edit",fields:{edit:{mutation:s}},devFields:{edit:{mutation:s,variables:lt(r)}}});i.log.info("executing graphql mutation");let o=await this.#t.execute(i,{operation:e,variables:r,...n});if(o.errors)throw new Q(e,o.errors);if(!o.data)throw new Q(e,"Mutation response did not contain data");return o.data}subscribe({onData:e,...r}){let n=/subscription (\w+)/.exec(r.subscription)?.[1];Xe(n,"subscription name not found");let s=this.ctx.child({name:"edit",fields:{edit:{subscription:n}},devFields:{edit:{subscription:n,variables:lt(r.variables)}}}),i=async a=>{if(a.errors){o(),await r.onError(new Q(r.subscription,a.errors));return}if(!a.data){o(),await r.onError(new Q(r.subscription,"Subscription response did not contain data"));return}await e(a.data)};s.log.info("subscribing to graphql subscription");let o=this.#t.subscribe(s,{...r,onResponse:i});return{unsubscribe:()=>{o()},resubscribe:a=>{o(),a!==void 0&&(r.variables=a),s=this.ctx.child({name:"edit",fields:{edit:{subscription:n}},devFields:{edit:{subscription:n,variables:lt(r.variables)}}}),s.log.info("re-subscribing to graphql subscription"),o=this.#t.subscribe(s,{...r,onResponse:i})}}}async dispose(){await this.#t.dispose()}};var yp={"--app":{type:ui,alias:["-a","--application"]},"--env":{type:String,alias:["-e","--environment"]},"--allow-unknown-directory":Boolean,"--allow-different-app":Boolean},pi=class t{constructor(e,r,n,s,i,o){this.ctx=e;this.args=r;this.directory=n;this.environment=s;this.previousEnvironment=i;this.state=o;this.ctx=e.child({name:"sync-json",fields:()=>({syncJson:{directory:this.directory.path,branch:this.gitBranch,...this.state}})}),this.edit=new Yt(this.ctx,this.environment)}gitBranch;edit;get filesVersion(){let e=this.state.environments[this.state.environment];return ci(e,"environment must exist in environments"),BigInt(e.filesVersion)}static async load(e,{command:r,args:n,directory:s}){e=e.child({name:"sync-json"});let i=await br(e,r),o=await re(e);if(o.length===0)throw new V(T`
|
|
62
|
-
You (${i.email}) don't have have any Gadget applications.
|
|
63
|
-
|
|
64
|
-
Visit https://gadget.new to create one!
|
|
65
|
-
`);let a=await Kt.default.readFile(s.absolute(".gadget/sync.json"),"utf8").catch(f=>e.log.warn("failed to read .gadget/sync.json",{error:f}));if(!a)return;let c;try{c=_c.parse(JSON.parse(a))}catch(f){e.log.warn("failed to parse .gadget/sync.json",{error:f,syncJsonFile:a});return}let p=await mi({args:n,availableApps:o,state:c}),v=await fi({command:r,args:n,application:p,state:c});if(pr({application_id:p.id,environment_id:v.id}),c.application!==p.slug){if(n["--allow-different-app"]){let f=new t(e,n,s,v,void 0,{application:p.slug,environment:v.name,environments:{[v.name]:{filesVersion:"0"}}});return await f.loadGitBranch(),f}throw new V(T`
|
|
66
|
-
You were about to sync the following app to the following directory:
|
|
67
|
-
|
|
68
|
-
${p.slug} (${v.name}) → ${s.path}
|
|
69
|
-
|
|
70
|
-
However, that directory has already been synced with this app:
|
|
71
|
-
|
|
72
|
-
${c.application} (${c.environment})
|
|
73
|
-
|
|
74
|
-
If you're sure that you want to sync:
|
|
75
|
-
|
|
76
|
-
${p.slug} (${v.name}) → ${s.path}
|
|
77
|
-
|
|
78
|
-
Run "ggt dev" with the {bold --allow-different-app} flag.
|
|
79
|
-
`)}let b;c.environment!==v.name&&(z({ensureEmptyLineAbove:!0,content:T`
|
|
80
|
-
Changing environment.
|
|
81
|
-
|
|
82
|
-
${c.environment} → ${v.name}
|
|
83
|
-
`}),b=c.environment,c.environment=v.name,c.environments[v.name]||(c.environments[v.name]={filesVersion:"0"}));let y=new t(e,n,s,v,b,c);return await y.save(y.filesVersion),await y.loadGitBranch(),y}static async loadOrInit(e,{command:r,args:n,directory:s}){e=e.child({name:"sync-json"});let i=await t.load(e,{command:r,args:n,directory:s});if(i)return i;if(await s.hasFiles()&&!n["--allow-unknown-directory"])throw new Ct({command:r,args:n,directory:s});let o=await mi({args:n,availableApps:await re(e)}),a=await fi({command:r,args:n,application:o});return await Kt.default.ensureDir(s.path),i=new t(e,n,s,a,void 0,{application:o.slug,environment:a.name,environments:{[a.name]:{filesVersion:"0"}}}),await i.save(i.filesVersion),await i.loadGitBranch(),i}async save(e){let r=this.state.environments[this.state.environment];ci(r,"environment must exist in environments"),r.filesVersion=String(e),this.ctx.log.debug("saving .gadget/sync.json"),await Kt.default.outputJSON(this.directory.absolute(".gadget/sync.json"),this.state,{spaces:2})}async loadGitBranch(){this.gitBranch=await gc(this.ctx,{directory:this.directory})}sprint(e={}){let r=R`
|
|
84
|
-
Application ${this.environment.application.slug}
|
|
85
|
-
Environment ${this.environment.name}
|
|
86
|
-
`;this.gitBranch&&(r+=R({indent:5,content:`Branch ${this.gitBranch}`}));let n=te.domains.app;return st.isSupported?r+=R({ensureEmptyLineAbove:!0,content:`${st(ft.link("Preview"),`https://${this.environment.application.slug}--${this.environment.name}.${n}`)} ${st(ft.link("Editor"),`https://${this.environment.application.primaryDomain}/edit/${this.environment.name}`)} ${st(ft.link("Playground"),`https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}`)} ${st(ft.link("Docs"),`https://docs.gadget.dev/api/${this.environment.application.slug}`)}`}):r+=R`
|
|
87
|
-
------------------------
|
|
88
|
-
Preview https://${this.environment.application.slug}--${this.environment.name}.${n}
|
|
89
|
-
Editor https://${this.environment.application.primaryDomain}/edit/${this.environment.name}
|
|
90
|
-
Playground https://${this.environment.application.primaryDomain}/api/playground/javascript?environment=${this.environment.name}
|
|
91
|
-
Docs https://docs.gadget.dev/api/${this.environment.application.slug}
|
|
92
|
-
`,R({...e,content:r})}print(e){e=ct(e,{ensureEmptyLineAbove:!0}),z(this.sprint(e))}},vp=async t=>{te.windows&&t.startsWith("~/")&&(t=ur(t.slice(2)));let e=await ar(".gadget/sync.json",{cwd:t});return e&&(t=li.join(e,"../..")),t=li.resolve(t),await fr.init(t)},mi=async({args:t,availableApps:e,state:r})=>{let n=t["--app"]||r?.application;if(!n){let o=Array.from(gr(e)).map(([a,c])=>[a,c.map(p=>p.slug)]);n=await oe({groupedChoices:o,content:"Which application do you want to develop?"})}let s=e.find(o=>o.slug===n);if(s)return s;let i=ee(n,e.map(o=>o.slug)).slice(0,5);throw new V(T`
|
|
93
|
-
Unknown application:
|
|
94
|
-
|
|
95
|
-
${n}
|
|
96
|
-
|
|
97
|
-
Did you mean one of these?
|
|
98
|
-
|
|
99
|
-
• ${i.join(`
|
|
100
|
-
\u2022 `)}
|
|
101
|
-
`)},fi=async({command:t,args:e,application:r,state:n})=>{if(e["--env"]&&!r.multiEnvironmentEnabled)throw new V(T`
|
|
102
|
-
You specified an environment but your app doesn't have multiple environments.
|
|
103
|
-
|
|
104
|
-
Remove the "--env" flag to sync to the {bold ${r.primaryDomain}} environment.
|
|
105
|
-
`);let s=r.environments.filter(c=>c.type===dr.Development),i=e["--env"]||n?.environment;if(i||(i=await oe({choices:s.map(c=>c.name),content:"Which environment do you want to develop on?"})),i.toLowerCase()==="production")throw new V(T`
|
|
106
|
-
You cannot "ggt ${t}" your {bold production} environment.
|
|
107
|
-
`);let o=s.find(c=>c.name===i.toLowerCase());if(o)return{...o,application:r};let a=ee(i,s.map(c=>c.name)).slice(0,5);throw new V(T`
|
|
108
|
-
Unknown environment:
|
|
109
|
-
|
|
110
|
-
${i}
|
|
111
|
-
|
|
112
|
-
Did you mean one of these?
|
|
113
|
-
|
|
114
|
-
• ${a.join(`
|
|
115
|
-
\u2022 `)}
|
|
116
|
-
`)},gc=async(t,{directory:e})=>{try{return await ai(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},yc=B.object({application:B.string(),environment:B.string(),environments:B.record(B.object({filesVersion:B.string()}))}),vc=B.object({app:B.string(),filesVersion:B.string(),mtime:B.number()}),bc=B.union([yc,vc]),_c=bc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{Ec as a,ne as b,Pc as c,Cc as d,Rc as e,kr as f,Ct as g,wr as h,Tr as i,Yi as j,Fc as k,oe as l,yp as m,pi as n,vp as o};
|
|
117
|
-
//# sourceMappingURL=chunk-E3I3MPQD.js.map
|