@qlover/fe-release
Version:
A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.
1 lines • 57.1 kB
JavaScript
"use strict";var t,e,r,n,o,i,a,s,u,c,h,f,l,g,p,m,d,v,b,y,w,k,_,R,x,P,j,C,$,N,O,E,B,T,S,L,A,W,U,G,M,D,F,H,I,q,z,V,J,Y,K,Q,X,Z,tt,et,rt,nt,ot,it,at,st,ut,ct,ht,ft,lt,gt,pt,mt,dt,vt,bt,yt,wt,kt,_t,Rt,xt,Pt,jt,Ct,$t,Nt,Ot,Et,Bt,Tt,St,Lt,At,Wt,Ut,Gt,Mt,Dt,Ft,Ht,It=require("@qlover/scripts-context"),qt=require("@qlover/env-loader"),zt=require("@qlover/fe-corekit"),Vt=require("@octokit/rest"),Jt=require("gitlog"),Yt=require("node:path"),Kt=require("find-workspaces"),Qt=require("fs"),Xt=require("path"),Zt=require("node:module"),te=require("node:url"),ee=require("p-limit"),re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ne(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function oe(){if(e)return t;return e=1,t=function(){this.__data__=[],this.size=0}}function ie(){if(n)return r;return n=1,r=function(t,e){return t===e||t!=t&&e!=e}}function ae(){if(i)return o;i=1;var t=ie();return o=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function se(){if(s)return a;s=1;var t=ae(),e=Array.prototype.splice;return a=function(r){var n=this.__data__,o=t(n,r);return!(o<0)&&(o==n.length-1?n.pop():e.call(n,o,1),--this.size,!0)}}function ue(){if(c)return u;c=1;var t=ae();return u=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]}}function ce(){if(f)return h;f=1;var t=ae();return h=function(e){return t(this.__data__,e)>-1}}function he(){if(g)return l;g=1;var t=ae();return l=function(e,r){var n=this.__data__,o=t(n,e);return o<0?(++this.size,n.push([e,r])):n[o][1]=r,this}}function fe(){if(m)return p;m=1;var t=oe(),e=se(),r=ue(),n=ce(),o=he();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,p=i}function le(){if(v)return d;v=1;var t=fe();return d=function(){this.__data__=new t,this.size=0}}function ge(){if(y)return b;return y=1,b=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}}function pe(){if(k)return w;return k=1,w=function(t){return this.__data__.get(t)}}function me(){if(R)return _;return R=1,_=function(t){return this.__data__.has(t)}}function de(){if(P)return x;P=1;var t="object"==typeof re&&re&&re.Object===Object&&re;return x=t}function ve(){if(C)return j;C=1;var t=de(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return j=r}function be(){if(N)return $;N=1;var t=ve().Symbol;return $=t}function ye(){if(E)return O;E=1;var t=be(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,o=t?t.toStringTag:void 0;return O=function(t){var e=r.call(t,o),i=t[o];try{t[o]=void 0;var a=!0}catch(t){}var s=n.call(t);return a&&(e?t[o]=i:delete t[o]),s}}function we(){if(T)return B;T=1;var t=Object.prototype.toString;return B=function(e){return t.call(e)}}function ke(){if(L)return S;L=1;var t=be(),e=ye(),r=we(),n=t?t.toStringTag:void 0;return S=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function _e(){if(W)return A;return W=1,A=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Re(){if(G)return U;G=1;var t=ke(),e=_e();return U=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function xe(){if(D)return M;D=1;var t=ve()["__core-js_shared__"];return M=t}function Pe(){if(H)return F;H=1;var t,e=xe(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return F=function(t){return!!r&&r in t}}function je(){if(q)return I;q=1;var t=Function.prototype.toString;return I=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function Ce(){if(V)return z;V=1;var t=Re(),e=Pe(),r=_e(),n=je(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,s=i.toString,u=a.hasOwnProperty,c=RegExp("^"+s.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return z=function(i){return!(!r(i)||e(i))&&(t(i)?c:o).test(n(i))}}function $e(){if(Y)return J;return Y=1,J=function(t,e){return null==t?void 0:t[e]}}function Ne(){if(Q)return K;Q=1;var t=Ce(),e=$e();return K=function(r,n){var o=e(r,n);return t(o)?o:void 0}}function Oe(){if(Z)return X;Z=1;var t=Ne()(ve(),"Map");return X=t}function Ee(){if(et)return tt;et=1;var t=Ne()(Object,"create");return tt=t}function Be(){if(nt)return rt;nt=1;var t=Ee();return rt=function(){this.__data__=t?t(null):{},this.size=0}}function Te(){if(it)return ot;return it=1,ot=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}}function Se(){if(st)return at;st=1;var t=Ee(),e=Object.prototype.hasOwnProperty;return at=function(r){var n=this.__data__;if(t){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(n,r)?n[r]:void 0}}function Le(){if(ct)return ut;ct=1;var t=Ee(),e=Object.prototype.hasOwnProperty;return ut=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}function Ae(){if(ft)return ht;ft=1;var t=Ee();return ht=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}function We(){if(gt)return lt;gt=1;var t=Be(),e=Te(),r=Se(),n=Le(),o=Ae();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,lt=i}function Ue(){if(mt)return pt;mt=1;var t=We(),e=fe(),r=Oe();return pt=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function Ge(){if(vt)return dt;return vt=1,dt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}}function Me(){if(yt)return bt;yt=1;var t=Ge();return bt=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map}}function De(){if(kt)return wt;kt=1;var t=Me();return wt=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}function Fe(){if(Rt)return _t;Rt=1;var t=Me();return _t=function(e){return t(this,e).get(e)}}function He(){if(Pt)return xt;Pt=1;var t=Me();return xt=function(e){return t(this,e).has(e)}}function Ie(){if(Ct)return jt;Ct=1;var t=Me();return jt=function(e,r){var n=t(this,e),o=n.size;return n.set(e,r),this.size+=n.size==o?0:1,this}}function qe(){if(Nt)return $t;Nt=1;var t=Ue(),e=De(),r=Fe(),n=He(),o=Ie();function i(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=n,i.prototype.set=o,$t=i}function ze(){if(Et)return Ot;Et=1;var t=fe(),e=Oe(),r=qe();return Ot=function(n,o){var i=this.__data__;if(i instanceof t){var a=i.__data__;if(!e||a.length<199)return a.push([n,o]),this.size=++i.size,this;i=this.__data__=new r(a)}return i.set(n,o),this.size=i.size,this}}function Ve(){if(Tt)return Bt;Tt=1;var t=fe(),e=le(),r=ge(),n=pe(),o=me(),i=ze();function a(e){var r=this.__data__=new t(e);this.size=r.size}return a.prototype.clear=e,a.prototype.delete=r,a.prototype.get=n,a.prototype.has=o,a.prototype.set=i,Bt=a}function Je(){if(Lt)return St;Lt=1;var t=Ne(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return St=e}function Ye(){if(Wt)return At;Wt=1;var t=Je();return At=function(e,r,n){"__proto__"==r&&t?t(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n}}function Ke(){if(Gt)return Ut;Gt=1;var t=Ye(),e=ie();return Ut=function(r,n,o){(void 0!==o&&!e(r[n],o)||void 0===o&&!(n in r))&&t(r,n,o)}}function Qe(){if(Dt)return Mt;return Dt=1,Mt=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===r(i[u],u,i))break}return e}}}function Xe(){if(Ht)return Ft;Ht=1;var t=Qe()();return Ft=t}var Ze,tr,er,rr,nr,or,ir,ar,sr,ur,cr,hr,fr,lr,gr,pr,mr,dr,vr,br,yr,wr,kr,_r,Rr,xr,Pr,jr,Cr,$r,Nr,Or,Er,Br={exports:{}};function Tr(){return Ze||(Ze=1,function(t,e){var r=ve(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n?r.Buffer:void 0,a=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=a?a(r):new t.constructor(r);return t.copy(n),n}}(Br,Br.exports)),Br.exports}function Sr(){if(er)return tr;er=1;var t=ve().Uint8Array;return tr=t}function Lr(){if(nr)return rr;nr=1;var t=Sr();return rr=function(e){var r=new e.constructor(e.byteLength);return new t(r).set(new t(e)),r}}function Ar(){if(ir)return or;ir=1;var t=Lr();return or=function(e,r){var n=r?t(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}}function Wr(){if(sr)return ar;return sr=1,ar=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}}function Ur(){if(cr)return ur;cr=1;var t=_e(),e=Object.create,r=function(){function r(){}return function(n){if(!t(n))return{};if(e)return e(n);r.prototype=n;var o=new r;return r.prototype=void 0,o}}();return ur=r}function Gr(){if(fr)return hr;return fr=1,hr=function(t,e){return function(r){return t(e(r))}}}function Mr(){if(gr)return lr;gr=1;var t=Gr()(Object.getPrototypeOf,Object);return lr=t}function Dr(){if(mr)return pr;mr=1;var t=Object.prototype;return pr=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}function Fr(){if(vr)return dr;vr=1;var t=Ur(),e=Mr(),r=Dr();return dr=function(n){return"function"!=typeof n.constructor||r(n)?{}:t(e(n))}}function Hr(){if(yr)return br;return yr=1,br=function(t){return null!=t&&"object"==typeof t}}function Ir(){if(kr)return wr;kr=1;var t=ke(),e=Hr();return wr=function(r){return e(r)&&"[object Arguments]"==t(r)}}function qr(){if(Rr)return _r;Rr=1;var t=Ir(),e=Hr(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,i=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!o.call(t,"callee")};return _r=i}function zr(){if(Pr)return xr;Pr=1;var t=Array.isArray;return xr=t}function Vr(){if(Cr)return jr;Cr=1;return jr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Jr(){if(Nr)return $r;Nr=1;var t=Re(),e=Vr();return $r=function(r){return null!=r&&e(r.length)&&!t(r)}}function Yr(){if(Er)return Or;Er=1;var t=Jr(),e=Hr();return Or=function(r){return e(r)&&t(r)}}var Kr,Qr,Xr,Zr,tn,en,rn,nn,on,an={exports:{}};function sn(){if(Qr)return Kr;return Qr=1,Kr=function(){return!1}}function un(){return Xr||(Xr=1,function(t,e){var r=ve(),n=sn(),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;t.exports=s}(an,an.exports)),an.exports}function cn(){if(tn)return Zr;tn=1;var t=ke(),e=Mr(),r=Hr(),n=Function.prototype,o=Object.prototype,i=n.toString,a=o.hasOwnProperty,s=i.call(Object);return Zr=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var o=e(n);if(null===o)return!0;var u=a.call(o,"constructor")&&o.constructor;return"function"==typeof u&&u instanceof u&&i.call(u)==s}}function hn(){if(rn)return en;rn=1;var t=ke(),e=Vr(),r=Hr(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,en=function(o){return r(o)&&e(o.length)&&!!n[t(o)]}}function fn(){if(on)return nn;return on=1,nn=function(t){return function(e){return t(e)}}}var ln,gn,pn,mn,dn,vn,bn,yn,wn,kn,_n,Rn,xn,Pn,jn,Cn,$n,Nn,On,En,Bn,Tn,Sn,Ln,An,Wn,Un,Gn,Mn,Dn,Fn,Hn,In,qn,zn,Vn,Jn,Yn,Kn,Qn,Xn,Zn,to,eo,ro,no,oo,io,ao,so={exports:{}};function uo(){return ln||(ln=1,function(t,e){var r=de(),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,a=function(){try{var t=o&&o.require&&o.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=a}(so,so.exports)),so.exports}function co(){if(pn)return gn;pn=1;var t=hn(),e=fn(),r=uo(),n=r&&r.isTypedArray,o=n?e(n):t;return gn=o}function ho(){if(dn)return mn;return dn=1,mn=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function fo(){if(bn)return vn;bn=1;var t=Ye(),e=ie(),r=Object.prototype.hasOwnProperty;return vn=function(n,o,i){var a=n[o];r.call(n,o)&&e(a,i)&&(void 0!==i||o in n)||t(n,o,i)}}function lo(){if(wn)return yn;wn=1;var t=fo(),e=Ye();return yn=function(r,n,o,i){var a=!o;o||(o={});for(var s=-1,u=n.length;++s<u;){var c=n[s],h=i?i(o[c],r[c],c,o,r):void 0;void 0===h&&(h=r[c]),a?e(o,c,h):t(o,c,h)}return o}}function go(){if(_n)return kn;return _n=1,kn=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}}function po(){if(xn)return Rn;xn=1;var t=/^(?:0|[1-9]\d*)$/;return Rn=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function mo(){if(jn)return Pn;jn=1;var t=go(),e=qr(),r=zr(),n=un(),o=po(),i=co(),a=Object.prototype.hasOwnProperty;return Pn=function(s,u){var c=r(s),h=!c&&e(s),f=!c&&!h&&n(s),l=!c&&!h&&!f&&i(s),g=c||h||f||l,p=g?t(s.length,String):[],m=p.length;for(var d in s)!u&&!a.call(s,d)||g&&("length"==d||f&&("offset"==d||"parent"==d)||l&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||o(d,m))||p.push(d);return p}}function vo(){if($n)return Cn;return $n=1,Cn=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}}function bo(){if(On)return Nn;On=1;var t=_e(),e=Dr(),r=vo(),n=Object.prototype.hasOwnProperty;return Nn=function(o){if(!t(o))return r(o);var i=e(o),a=[];for(var s in o)("constructor"!=s||!i&&n.call(o,s))&&a.push(s);return a}}function yo(){if(Bn)return En;Bn=1;var t=mo(),e=bo(),r=Jr();return En=function(n){return r(n)?t(n,!0):e(n)}}function wo(){if(Sn)return Tn;Sn=1;var t=lo(),e=yo();return Tn=function(r){return t(r,e(r))}}function ko(){if(An)return Ln;An=1;var t=Ke(),e=Tr(),r=Ar(),n=Wr(),o=Fr(),i=qr(),a=zr(),s=Yr(),u=un(),c=Re(),h=_e(),f=cn(),l=co(),g=ho(),p=wo();return Ln=function(m,d,v,b,y,w,k){var _=g(m,v),R=g(d,v),x=k.get(R);if(x)t(m,v,x);else{var P=w?w(_,R,v+"",m,d,k):void 0,j=void 0===P;if(j){var C=a(R),$=!C&&u(R),N=!C&&!$&&l(R);P=R,C||$||N?a(_)?P=_:s(_)?P=n(_):$?(j=!1,P=e(R,!0)):N?(j=!1,P=r(R,!0)):P=[]:f(R)||i(R)?(P=_,i(_)?P=p(_):h(_)&&!c(_)||(P=o(R))):j=!1}j&&(k.set(R,P),y(P,R,b,w,k),k.delete(R)),t(m,v,P)}}}function _o(){if(Un)return Wn;Un=1;var t=Ve(),e=Ke(),r=Xe(),n=ko(),o=_e(),i=yo(),a=ho();return Wn=function s(u,c,h,f,l){u!==c&&r(c,(function(r,i){if(l||(l=new t),o(r))n(u,c,i,h,s,f,l);else{var g=f?f(a(u,i),r,i+"",u,c,l):void 0;void 0===g&&(g=r),e(u,i,g)}}),i)},Wn}function Ro(){if(Mn)return Gn;return Mn=1,Gn=function(t){return t}}function xo(){if(Fn)return Dn;return Fn=1,Dn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}}function Po(){if(In)return Hn;In=1;var t=xo(),e=Math.max;return Hn=function(r,n,o){return n=e(void 0===n?r.length-1:n,0),function(){for(var i=arguments,a=-1,s=e(i.length-n,0),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var c=Array(n+1);++a<n;)c[a]=i[a];return c[n]=o(u),t(r,this,c)}},Hn}function jo(){if(zn)return qn;return zn=1,qn=function(t){return function(){return t}}}function Co(){if(Jn)return Vn;Jn=1;var t=jo(),e=Je();return Vn=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:Ro()}function $o(){if(Kn)return Yn;Kn=1;var t=Date.now;return Yn=function(e){var r=0,n=0;return function(){var o=t(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Yn}function No(){if(Xn)return Qn;Xn=1;var t=Co(),e=$o()(t);return Qn=e}function Oo(){if(to)return Zn;to=1;var t=Ro(),e=Po(),r=No();return Zn=function(n,o){return r(e(n,o,t),n+"")}}function Eo(){if(ro)return eo;ro=1;var t=ie(),e=Jr(),r=po(),n=_e();return eo=function(o,i,a){if(!n(a))return!1;var s=typeof i;return!!("number"==s?e(a)&&r(i,a.length):"string"==s&&i in a)&&t(a[i],o)}}function Bo(){if(oo)return no;oo=1;var t=Oo(),e=Eo();return no=function(r){return t((function(t,n){var o=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=r.length>3&&"function"==typeof a?(i--,a):void 0,s&&e(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),t=Object(t);++o<i;){var u=n[o];u&&r(t,u,o,a)}return t}))}}function To(){if(ao)return io;ao=1;var t=_o(),e=Bo()((function(e,r,n){t(e,r,n)}));return io=e}var So,Lo,Ao,Wo,Uo,Go,Mo,Do,Fo,Ho,Io,qo,zo,Vo,Jo,Yo,Ko,Qo,Xo,Zo,ti,ei,ri,ni,oi=ne(To());function ii(){if(Lo)return So;Lo=1;var t=ke(),e=Hr();return So=function(r){return"symbol"==typeof r||e(r)&&"[object Symbol]"==t(r)}}function ai(){if(Wo)return Ao;Wo=1;var t=zr(),e=ii(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return Ao=function(o,i){if(t(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!e(o))||(n.test(o)||!r.test(o)||null!=i&&o in Object(i))}}function si(){if(Go)return Uo;Go=1;var t=qe();function e(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,e=n?n.apply(this,t):t[0],i=o.cache;if(i.has(e))return i.get(e);var a=r.apply(this,t);return o.cache=i.set(e,a)||i,a};return o.cache=new(e.Cache||t),o}return e.Cache=t,Uo=e}function ui(){if(Do)return Mo;Do=1;var t=si();return Mo=function(e){var r=t(e,(function(t){return 500===n.size&&n.clear(),t})),n=r.cache;return r}}function ci(){if(Ho)return Fo;Ho=1;var t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=ui()((function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(t,(function(t,r,o,i){n.push(o?i.replace(e,"$1"):r||t)})),n}));return Fo=r}function hi(){if(qo)return Io;return qo=1,Io=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}}function fi(){if(Vo)return zo;Vo=1;var t=be(),e=hi(),r=zr(),n=ii(),o=t?t.prototype:void 0,i=o?o.toString:void 0;return zo=function t(o){if("string"==typeof o)return o;if(r(o))return e(o,t)+"";if(n(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},zo}function li(){if(Yo)return Jo;Yo=1;var t=fi();return Jo=function(e){return null==e?"":t(e)}}function gi(){if(Qo)return Ko;Qo=1;var t=zr(),e=ai(),r=ci(),n=li();return Ko=function(o,i){return t(o)?o:e(o,i)?[o]:r(n(o))}}function pi(){if(Zo)return Xo;Zo=1;var t=ii();return Xo=function(e){if("string"==typeof e||t(e))return e;var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}}function mi(){if(ei)return ti;ei=1;var t=gi(),e=pi();return ti=function(r,n){for(var o=0,i=(n=t(n,r)).length;null!=r&&o<i;)r=r[e(n[o++])];return o&&o==i?r:void 0},ti}function di(){if(ni)return ri;ni=1;var t=mi();return ri=function(e,r,n){var o=null==e?void 0:t(e,r);return void 0===o?n:o},ri}var vi=ne(di());const bi="package.json",yi=[".env.local",".env"];class wi extends It.FeScriptContext{_env;shared;constructor(t){super(t),this._env=qt.Env.searchEnv({logger:this.logger,preloadList:this.feConfig.envOrder||yi}),this.shared=Object.assign({},this.feConfig.release,this.getDefaultShreadOptions(t.shared))}getDefaultShreadOptions(t){return{rootPath:process.cwd(),sourceBranch:this._env.get("FE_RELEASE_BRANCH")||this._env.get("FE_RELEASE_SOURCE_BRANCH")||"master",releaseEnv:this._env.get("FE_RELEASE_ENV")||this._env.get("NODE_ENV")||"development",...t}}get rootPath(){return this.shared.rootPath}get sourceBranch(){return this.shared.sourceBranch}get releaseEnv(){return this.shared.releaseEnv}get env(){return this._env}get workspaces(){return this.getConfig("workspaces.workspaces")}get workspace(){return this.getConfig("workspaces.workspace")}setWorkspaces(t){this.options.workspaces={...this.options.workspaces,workspaces:t}}setConfig(t){this.options=oi(this.options,t)}getConfig(t,e){return vi(this.options,t,e)}setShared(t){this.shared=oi(this.shared,t)}getPkg(t,e){const r=this.workspace?.packageJson;if(!r)throw new Error("package.json is not found");return t?vi(r,t,e):r}getTemplateContext(){return{...this.shared,...this.workspace,publishPath:this.workspace?.path||"",env:this.releaseEnv,branch:this.sourceBranch}}async runChangesetsCli(t,e){let r="pnpm";try{await this.shell.exec("pnpm -v",{dryRun:!1})}catch{r="npx"}return await this.shell.exec([r,"changeset",t,...e??[]])}}function ki(t,...e){return[t,...e]}const _i={maxWorkspace:3,multiWorkspaceSeparator:"_",workspaceVersionSeparator:"@",batchBranchName:"batch-${releaseName}-${length}-packages-${timestamp}",batchTagName:"batch-${length}-packages-${timestamp}"};class Ri{shell;logger;config;constructor(t,e,r={}){this.shell=t,this.logger=e,this.config={..._i,...r}}getReleaseBranchName(t,e,r){const n=r.branchName||"release-${tagName}";if("string"!=typeof n)throw new Error("Branch name template is not a string");return this.logger.debug("Release Branch template is:",n),this.shell.format(n,{pkgName:t,releaseName:t,tagName:e,...r})}getBatchReleaseBranchName(t,e,r,n){const o=this.config.batchBranchName;if("string"!=typeof o)throw new Error("Branch name template is not a string");return this.logger.debug("Release Batch Branch template is:",o),this.shell.format(o,{pkgName:t,releaseName:t,tagName:e,...r,length:n,timestamp:Date.now()})}getReleaseName(t){if(1===t.length)return t[0].name;const{maxWorkspace:e,multiWorkspaceSeparator:r,workspaceVersionSeparator:n}=this.config;return t.slice(0,e).map((({name:t,version:e})=>`${t}${n}${e}`)).join(r)}getReleaseTagName(t){if(1===t.length)return t[0].version;const{batchTagName:e}=this.config;return this.shell.format(e,{length:t.length,timestamp:Date.now()})}getReleaseBranchParams(t,e){const r=this.getReleaseTagName(t),n=this.getReleaseName(t);return{tagName:r,releaseBranch:t.length>1?this.getBatchReleaseBranchName(n,r,e,t.length):this.getReleaseBranchName(n,r,e)}}getPRTitle(t,e){const r=this.config.PRTitle||"Release ${env} ${pkgName} ${tagName}";return this.shell.format(r,{...e,tagName:t.tagName,pkgName:t.releaseBranch})}getPRBody(t,e,r){const n=this.config.PRBody,o=t.length>1?t.map((t=>this.shell.format("\n## ${name} ${version}\n${changelog}\n",t))).join("\n"):t[0].changelog,{workspaceVersionSeparator:i}=this.config,a=1===t.length?e.tagName:t.map((t=>`${t.name}${i}${t.version}`)).join(" ");return this.shell.format(n,{...r,tagName:a,changelog:o})}}class xi{context;_octokit=null;constructor(t){this.context=t}getGitHubUserInfo(){const{authorName:t,repoName:e}=this.context.shared;if(!t||!e)throw new Error("Author name or repo name is not set");return{owner:t,repo:e}}getToken(){const{tokenRef:t="GITHUB_TOKEN"}=this.context.getConfig("githubPR"),e=this.context.env.get(t);if(!e)throw new Error(`Token is not set. Please set ${t} environment variable.`);return e}get octokit(){if(this._octokit)return this._octokit;const{timeout:t}=this.context.getConfig("githubPR"),e={auth:this.getToken(),request:{timeout:t}};return this._octokit=new Vt.Octokit(e),this._octokit}get logger(){return this.context.logger}get shell(){return this.context.shell}get autoMergeType(){return this.context.shared.autoMergeType||"squash"}get dryRunPRNumber(){return this.context.getConfig("githubPR.dryRunPRNumber","999999")}get autoMergeReleasePR(){return this.context.shared.autoMergeReleasePR||false}async mergePR(t,e){if(!t)return void this.logger.error("Failed to create Pull Request.",t);const r=this.autoMergeType;if(this.context.dryRun){const{repoName:n,authorName:o}=this.context.shared;this.logger.info(`[DRY RUN] Would merge PR #${t} with method '${r}' in repo ${o}/${n}, branch ${e}`)}else await this.octokit.rest.pulls.merge({...this.getGitHubUserInfo(),pull_number:Number(t),merge_method:r})}async getPullRequestCommits(t){return(await this.octokit.rest.pulls.listCommits({...this.getGitHubUserInfo(),pull_number:t})).data}async getCommitInfo(t){return(await this.octokit.rest.repos.getCommit({...this.getGitHubUserInfo(),ref:t})).data}async getPullRequest(t){return(await this.octokit.rest.pulls.get({...this.getGitHubUserInfo(),pull_number:t})).data}async checkedPR(t,e){try{await this.getPullRequest(Number(t)),await this.octokit.rest.git.deleteRef({...this.getGitHubUserInfo(),ref:`heads/${e}`}),this.logger.info(`Branch ${e} has been deleted`)}catch(r){if(404===r.status)return void this.logger.warn(`PR #${t} or branch ${e} not found`);throw this.logger.error("Failed to check PR or delete branch",r),r}}async createReleasePRLabel(){const t=this.context.shared.label;if(!(t&&t.name&&t.description&&t.color))throw new Error("Label is not valid, skipping creation");if(this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR label with:",t),t;try{const e=await this.octokit.rest.issues.createLabel({...this.getGitHubUserInfo(),name:t.name,description:t.description,color:t.color.replace("#","")});return this.logger.debug("Create PR label Success",e),t}catch(e){if(422===e.status)return this.logger.warn(`Label ${t.name} already exists, skipping!`),t;throw this.logger.error("Create PR label Failed",e),e}}async createReleasePR(t){if(this.context.getConfig("githubPR.dryRunCreatePR")||this.context.dryRun)return this.logger.info("[DRY RUN] Would create PR with:",{...t,labels:t.labels}),this.dryRunPRNumber;try{const e=await this.octokit.rest.pulls.create({...this.getGitHubUserInfo(),...t}),r=e.data.number;if(!r)throw new Error("CreateReleasePR Failed, prNumber is empty");if(this.logger.debug("Create PR Success",[e?.url]),t.labels&&t.labels.length){const e=await this.octokit.rest.issues.addLabels({...this.getGitHubUserInfo(),issue_number:r,labels:t.labels});this.logger.debug("Add PR label Success",[e.url])}return r.toString()}catch(t){if(422===t.status&&t.message.includes("already exists")){this.logger.warn("PR already exists");const e=t.message.match(/pull request #(\d+)/);return e?e[1]:""}throw this.logger.error("Failed to create PR",t),t}}truncateBody(t){return t&&t.length>=124e3?t.substring(0,124e3)+"...":t}getOctokitReleaseOptions(t){const{releaseName:e,draft:r=!1,preRelease:n=!1,autoGenerate:o=!1,makeLatest:i=!0,releaseNotes:a,discussionCategoryName:s}=this.context.getConfig("githubPR"),u=e,c=o?"":this.truncateBody(String(a));return{name:u,make_latest:i.toString(),body:c,draft:r,prerelease:n,generate_release_notes:o,discussion_category_name:s,tag_name:"",...t,...this.getGitHubUserInfo()}}async createRelease(t){const e=this.getOctokitReleaseOptions({tag_name:t.tagName,body:t.changelog});if(e.name=this.shell.format(e.name,t),this.logger.log(`[DRY RUN] octokit repos.createRelease "${e.name}" (${e.tag_name})`,{isDryRun:this.context.dryRun}),!e.tag_name)throw new Error("TagName is undefined");if(!this.context.dryRun)try{const t=await this.octokit.repos.createRelease(e);this.logger.debug(`[DONE] octokit repos.createRelease "${e.name}" (${e.tag_name}) (${t.headers.location})`)}catch(t){this.logger.error(`[FAILED] octokit repos.createRelease "${e.name}" (${e.tag_name})`,t)}}}var Pi,ji;function Ci(){if(ji)return Pi;ji=1;var t=ke(),e=zr(),r=Hr();return Pi=function(n){return"string"==typeof n||!e(n)&&r(n)&&"[object String]"==t(n)}}var $i=ne(Ci());class Ni{context;pluginName;props;onlyOne=!0;constructor(t,e,r={}){this.context=t,this.pluginName=e,this.props=r,this.setConfig(this.getInitialProps(r))}getInitialProps(t){const e=this.context.options[this.pluginName],r=vi(this.context.shared,this.pluginName);return e||t?oi({},r,t,e):{}}get logger(){return this.context.logger}get shell(){return this.context.shell}get options(){return this.context.getConfig(this.pluginName,{})}getEnv(t,e){return this.context.env.get(t)??e}enabled(t,e){return!0}getConfig(t,e){return t?this.context.getConfig([this.pluginName,...Array.isArray(t)?t:[t]],e):this.context.getConfig(this.pluginName,e)}setConfig(t){this.context.setConfig({[this.pluginName]:t})}onBefore(t){}onExec(t){}onSuccess(t){}onError(t){}async step({label:t,task:e}){this.logger.log(),this.logger.info(t),this.logger.log();try{const r=await e();return this.logger.info(`${t} - success`),r}catch(t){throw this.logger.error(t),t}}}class Oi extends Ni{async onBefore(){const t=await this.getUserInfo();if(!t)throw new Error("Failed to get repoInfo");let e=this.context.shared.currentBranch;e||(e=await this.getCurrentBranch()),e&&await this.context.shell.exec(`git checkout ${e}`,{dryRun:!1}),this.context.setShared({repoName:t.repoName,authorName:t.authorName,currentBranch:e})}async getCurrentBranch(){return await new Promise((t=>setTimeout(t,100))),this.context.shell.exec("git rev-parse --abbrev-ref HEAD",{dryRun:!1})}async getRemoteUrl(){return(await this.context.shell.exec("git config --get remote.origin.url",{dryRun:!1})).trim()}async getUserInfo(){let t;try{t=await this.getRemoteUrl()}catch{throw new Error("Failed to get git remote url. Please ensure this is a git repository with a valid remote.")}if(!t)throw new Error("Git remote URL is empty. Please set a valid GitHub remote URL.");this.context.logger.debug("repoUrl: ",t);const e=t.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);if(!e)throw new Error("Invalid GitHub repository URL format. Please ensure the remote URL is from GitHub.");const[,r,n]=e;if(!this.isValidString(r)||!this.isValidString(n))throw new Error("Failed to extract owner or repository name from GitHub URL");return{repoName:n,authorName:r}}isValidString(t){return!!t&&$i(t)}commit(t,e=[]){return this.context.shell.exec(["git","commit","--message",JSON.stringify(t),...e])}}const Ei=["hash","abbrevHash","treeHash","abbrevTreeHash","parentHashes","abbrevParentHashes","authorName","authorEmail","authorDate","authorDateRel","committerName","committerEmail","committerDate","committerDateRel","subject","body","rawBody","tag"];class Bi{options;constructor(t){this.options=t}async getGitLog(t={}){const{directory:e,noMerges:r=!0,fileds:n}=t,o=await this.resolveTag(t.from,"root"),i=await this.resolveTag(t.to,"HEAD"),a={repo:".",number:1e3,fields:n,branch:o===i?i:`${o}..${i}`,file:e,nameStatus:!1,includeMergeCommitFiles:!r},s=await Jt(a);return this.options.logger?.debug("GitChangelog",a),this.options.logger?.debug("GitChangelog commits",s),s}async getCommits(t){return(await this.getGitLog(t)).map((t=>{const{subject:e,rawBody:r}=t;return{base:t,commitlint:this.parseCommitlint(e||"",r),commits:[]}}))}createBaseCommit(t,e){return{subject:t,rawBody:t,body:t,...e}}tabify(t,e=2){return t.split("\n").map((t=>" ".repeat(e)+t.trim())).join("\n")}parseCommitlint(t,e=""){const[r]=t.trim().split("\n"),n=e.startsWith(r)?e.replace(r,""):e,o=r.replace(/\s*\(#\d+\)\s*$/,"").match(/^(?:([a-z]+)(?:\((.*?)\))?: )?(.+)$/i);return o?{type:o[1]?.toLowerCase(),scope:o[2]?.trim(),message:o[3].trim(),body:n?this.tabify(n):void 0}:{message:r,body:n?this.tabify(n):void 0}}toCommitValue(t,e){const[r]=e.trim().split("\n"),n=r.match(/\(#(\d+)\)/),o=this.parseCommitlint(r,e);return{base:this.createBaseCommit(r,{hash:t,abbrevHash:t.substring(0,7),rawBody:e}),commitlint:o,commits:[],prNumber:n?.[1]}}async resolveTag(t,e){if(t)try{if(await this.options.shell.exec(`git tag --list "${t}"`,{dryRun:!1}).then((t=>!!t.trim())))return t}catch{}return"root"===e?this.options.shell.exec("git rev-list --max-parents=0 HEAD",{dryRun:!1}).then((t=>t.trim())):"HEAD"}}var Ti,Si,Li,Ai,Wi,Ui,Gi,Mi,Di,Fi,Hi,Ii,qi,zi,Vi,Ji,Yi,Ki,Qi,Xi,Zi,ta,ea,ra,na,oa,ia,aa,sa,ua,ca,ha,fa,la,ga,pa,ma,da,va,ba,ya,wa,ka,_a,Ra,xa,Pa,ja,Ca,$a,Na,Oa,Ea,Ba,Ta,Sa,La,Aa,Wa,Ua,Ga,Ma,Da,Fa,Ha,Ia,qa,za,Va,Ja,Ya,Ka,Qa,Xa,Za,ts,es,rs,ns,os,is,as,ss,us,cs,hs,fs,ls,gs,ps,ms,ds;function vs(){if(Si)return Ti;return Si=1,Ti=function(t,e,r,n){for(var o=-1,i=null==t?0:t.length;++o<i;){var a=t[o];e(n,a,r(a),t)}return n}}function bs(){if(Ai)return Li;Ai=1;var t=Gr()(Object.keys,Object);return Li=t}function ys(){if(Ui)return Wi;Ui=1;var t=Dr(),e=bs(),r=Object.prototype.hasOwnProperty;return Wi=function(n){if(!t(n))return e(n);var o=[];for(var i in Object(n))r.call(n,i)&&"constructor"!=i&&o.push(i);return o}}function ws(){if(Mi)return Gi;Mi=1;var t=mo(),e=ys(),r=Jr();return Gi=function(n){return r(n)?t(n):e(n)}}function ks(){if(Fi)return Di;Fi=1;var t=Xe(),e=ws();return Di=function(r,n){return r&&t(r,n,e)}}function _s(){if(Ii)return Hi;Ii=1;var t=Jr();return Hi=function(e,r){return function(n,o){if(null==n)return n;if(!t(n))return e(n,o);for(var i=n.length,a=r?i:-1,s=Object(n);(r?a--:++a<i)&&!1!==o(s[a],a,s););return n}}}function Rs(){if(zi)return qi;zi=1;var t=ks(),e=_s()(t);return qi=e}function xs(){if(Ji)return Vi;Ji=1;var t=Rs();return Vi=function(e,r,n,o){return t(e,(function(t,e,i){r(o,t,n(t),i)})),o}}function Ps(){if(Ki)return Yi;Ki=1;return Yi=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}}function js(){if(Xi)return Qi;return Xi=1,Qi=function(t){return this.__data__.has(t)}}function Cs(){if(ta)return Zi;ta=1;var t=qe(),e=Ps(),r=js();function n(e){var r=-1,n=null==e?0:e.length;for(this.__data__=new t;++r<n;)this.add(e[r])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,Zi=n}function $s(){if(ra)return ea;return ra=1,ea=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}}function Ns(){if(oa)return na;return oa=1,na=function(t,e){return t.has(e)}}function Os(){if(aa)return ia;aa=1;var t=Cs(),e=$s(),r=Ns();return ia=function(n,o,i,a,s,u){var c=1&i,h=n.length,f=o.length;if(h!=f&&!(c&&f>h))return!1;var l=u.get(n),g=u.get(o);if(l&&g)return l==o&&g==n;var p=-1,m=!0,d=2&i?new t:void 0;for(u.set(n,o),u.set(o,n);++p<h;){var v=n[p],b=o[p];if(a)var y=c?a(b,v,p,o,n,u):a(v,b,p,n,o,u);if(void 0!==y){if(y)continue;m=!1;break}if(d){if(!e(o,(function(t,e){if(!r(d,e)&&(v===t||s(v,t,i,a,u)))return d.push(e)}))){m=!1;break}}else if(v!==b&&!s(v,b,i,a,u)){m=!1;break}}return u.delete(n),u.delete(o),m}}function Es(){if(ua)return sa;return ua=1,sa=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}}function Bs(){if(ha)return ca;return ha=1,ca=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},ca}function Ts(){if(la)return fa;la=1;var t=be(),e=Sr(),r=ie(),n=Os(),o=Es(),i=Bs(),a=t?t.prototype:void 0,s=a?a.valueOf:void 0;return fa=function(t,a,u,c,h,f,l){switch(u){case"[object DataView]":if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=a.byteLength||!f(new e(t),new e(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+t,+a);case"[object Error]":return t.name==a.name&&t.message==a.message;case"[object RegExp]":case"[object String]":return t==a+"";case"[object Map]":var g=o;case"[object Set]":var p=1&c;if(g||(g=i),t.size!=a.size&&!p)return!1;var m=l.get(t);if(m)return m==a;c|=2,l.set(t,a);var d=n(g(t),g(a),c,h,f,l);return l.delete(t),d;case"[object Symbol]":if(s)return s.call(t)==s.call(a)}return!1}}function Ss(){if(pa)return ga;return pa=1,ga=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}}function Ls(){if(da)return ma;da=1;var t=Ss(),e=zr();return ma=function(r,n,o){var i=n(r);return e(r)?i:t(i,o(r))}}function As(){if(ba)return va;return ba=1,va=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}}function Ws(){if(wa)return ya;return wa=1,ya=function(){return[]}}function Us(){if(_a)return ka;_a=1;var t=As(),e=Ws(),r=Object.prototype.propertyIsEnumerable,n=Object.getOwnPropertySymbols;return ka=n?function(e){return null==e?[]:(e=Object(e),t(n(e),(function(t){return r.call(e,t)})))}:e}function Gs(){if(xa)return Ra;xa=1;var t=Ls(),e=Us(),r=ws();return Ra=function(n){return t(n,r,e)}}function Ms(){if(ja)return Pa;ja=1;var t=Gs(),e=Object.prototype.hasOwnProperty;return Pa=function(r,n,o,i,a,s){var u=1&o,c=t(r),h=c.length;if(h!=t(n).length&&!u)return!1;for(var f=h;f--;){var l=c[f];if(!(u?l in n:e.call(n,l)))return!1}var g=s.get(r),p=s.get(n);if(g&&p)return g==n&&p==r;var m=!0;s.set(r,n),s.set(n,r);for(var d=u;++f<h;){var v=r[l=c[f]],b=n[l];if(i)var y=u?i(b,v,l,n,r,s):i(v,b,l,r,n,s);if(!(void 0===y?v===b||a(v,b,o,i,s):y)){m=!1;break}d||(d="constructor"==l)}if(m&&!d){var w=r.constructor,k=n.constructor;w==k||!("constructor"in r)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof k&&k instanceof k||(m=!1)}return s.delete(r),s.delete(n),m}}function Ds(){if($a)return Ca;$a=1;var t=Ne()(ve(),"DataView");return Ca=t}function Fs(){if(Oa)return Na;Oa=1;var t=Ne()(ve(),"Promise");return Na=t}function Hs(){if(Ba)return Ea;Ba=1;var t=Ne()(ve(),"Set");return Ea=t}function Is(){if(Sa)return Ta;Sa=1;var t=Ne()(ve(),"WeakMap");return Ta=t}function qs(){if(Aa)return La;Aa=1;var t=Ds(),e=Oe(),r=Fs(),n=Hs(),o=Is(),i=ke(),a=je(),s="[object Map]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",f="[object DataView]",l=a(t),g=a(e),p=a(r),m=a(n),d=a(o),v=i;return(t&&v(new t(new ArrayBuffer(1)))!=f||e&&v(new e)!=s||r&&v(r.resolve())!=u||n&&v(new n)!=c||o&&v(new o)!=h)&&(v=function(t){var e=i(t),r="[object Object]"==e?t.constructor:void 0,n=r?a(r):"";if(n)switch(n){case l:return f;case g:return s;case p:return u;case m:return c;case d:return h}return e}),La=v}function zs(){if(Ua)return Wa;Ua=1;var t=Ve(),e=Os(),r=Ts(),n=Ms(),o=qs(),i=zr(),a=un(),s=co(),u="[object Arguments]",c="[object Array]",h="[object Object]",f=Object.prototype.hasOwnProperty;return Wa=function(l,g,p,m,d,v){var b=i(l),y=i(g),w=b?c:o(l),k=y?c:o(g),_=(w=w==u?h:w)==h,R=(k=k==u?h:k)==h,x=w==k;if(x&&a(l)){if(!a(g))return!1;b=!0,_=!1}if(x&&!_)return v||(v=new t),b||s(l)?e(l,g,p,m,d,v):r(l,g,w,p,m,d,v);if(!(1&p)){var P=_&&f.call(l,"__wrapped__"),j=R&&f.call(g,"__wrapped__");if(P||j){var C=P?l.value():l,$=j?g.value():g;return v||(v=new t),d(C,$,p,m,v)}}return!!x&&(v||(v=new t),n(l,g,p,m,d,v))}}function Vs(){if(Ma)return Ga;Ma=1;var t=zs(),e=Hr();return Ga=function r(n,o,i,a,s){return n===o||(null==n||null==o||!e(n)&&!e(o)?n!=n&&o!=o:t(n,o,i,a,r,s))},Ga}function Js(){if(Fa)return Da;Fa=1;var t=Ve(),e=Vs();return Da=function(r,n,o,i){var a=o.length,s=a,u=!i;if(null==r)return!s;for(r=Object(r);a--;){var c=o[a];if(u&&c[2]?c[1]!==r[c[0]]:!(c[0]in r))return!1}for(;++a<s;){var h=(c=o[a])[0],f=r[h],l=c[1];if(u&&c[2]){if(void 0===f&&!(h in r))return!1}else{var g=new t;if(i)var p=i(f,l,h,r,n,g);if(!(void 0===p?e(l,f,3,i,g):p))return!1}}return!0}}function Ys(){if(Ia)return Ha;Ia=1;var t=_e();return Ha=function(e){return e==e&&!t(e)}}function Ks(){if(za)return qa;za=1;var t=Ys(),e=ws();return qa=function(r){for(var n=e(r),o=n.length;o--;){var i=n[o],a=r[i];n[o]=[i,a,t(a)]}return n}}function Qs(){if(Ja)return Va;return Ja=1,Va=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}}function Xs(){if(Ka)return Ya;Ka=1;var t=Js(),e=Ks(),r=Qs();return Ya=function(n){var o=e(n);return 1==o.length&&o[0][2]?r(o[0][0],o[0][1]):function(e){return e===n||t(e,n,o)}}}function Zs(){if(Xa)return Qa;return Xa=1,Qa=function(t,e){return null!=t&&e in Object(t)}}function tu(){if(ts)return Za;ts=1;var t=gi(),e=qr(),r=zr(),n=po(),o=Vr(),i=pi();return Za=function(a,s,u){for(var c=-1,h=(s=t(s,a)).length,f=!1;++c<h;){var l=i(s[c]);if(!(f=null!=a&&u(a,l)))break;a=a[l]}return f||++c!=h?f:!!(h=null==a?0:a.length)&&o(h)&&n(l,h)&&(r(a)||e(a))},Za}function eu(){if(rs)return es;rs=1;var t=Zs(),e=tu();return es=function(r,n){return null!=r&&e(r,n,t)},es}function ru(){if(os)return ns;os=1;var t=Vs(),e=di(),r=eu(),n=ai(),o=Ys(),i=Qs(),a=pi();return ns=function(s,u){return n(s)&&o(u)?i(a(s),u):function(n){var o=e(n,s);return void 0===o&&o===u?r(n,s):t(u,o,3)}},ns}function nu(){if(as)return is;return as=1,is=function(t){return function(e){return null==e?void 0:e[t]}}}function ou(){if(us)return ss;us=1;var t=mi();return ss=function(e){return function(r){return t(r,e)}},ss}function iu(){if(hs)return cs;hs=1;var t=nu(),e=ou(),r=ai(),n=pi();return cs=function(o){return r(o)?t(n(o)):e(o)},cs}function au(){if(ls)return fs;ls=1;var t=Xs(),e=ru(),r=Ro(),n=zr(),o=iu();return fs=function(i){return"function"==typeof i?i:null==i?r:"object"==typeof i?n(i)?e(i[0],i[1]):t(i):o(i)}}function su(){if(ps)return gs;ps=1;var t=vs(),e=xs(),r=au(),n=zr();return gs=function(o,i){return function(a,s){var u=n(a)?t:e,c=i?i():{};return u(a,o,r(s,2),c)}}}function uu(){if(ds)return ms;ds=1;var t=Ye(),e=su(),r=Object.prototype.hasOwnProperty,n=e((function(e,n,o){r.call(e,o)?e[o].push(n):t(e,o,[n])}));return ms=n}var cu=ne(uu());const hu="\n- ${scopeHeader} ${commitlint.message} ${commitLink} ${prLink}";class fu{options;constructor(t){this.options=t}format(t,e){const{types:r=[],commitBody:n=!1}={...this.options,...e},o=[],i=cu(t,(t=>t.commitlint.type?t.commitlint.type:t.commitlint.message));return r.forEach((t=>{const{type:r,section:a,hidden:s}=t;if(s)return;const u=i[r]||[];u.length>0&&(o.push(a||""),u.forEach((t=>{if(o.push(this.formatCommit(t,e)),n&&t.commitlint.body){const e=t.commitlint.body.split("\n").map((t=>` ${t}`));o.push(...e)}})))})),o}formatCommit(t,e){const{commitlint:r,base:{hash:n},prNumber:o}=t,{repoUrl:i,formatTemplate:a=hu}={...this.options,...e},s=r.scope?this.formatScope(r.scope):"",u=o?this.foramtLink("#"+o,i?`${i}/pull/${o}`:""):"",c=n?this.foramtLink(n.slice(0,7),i?`${i}/commit/${n}`:""):"";return this.options.shell.format(a,{...t,scopeHeader:s,commitLink:c,prLink:u})}foramtLink(t,e){return e?`([${t}](${e}))`:`(${t})`}formatCommitLink(t,e){return e?`([${t}](${e}))`:`(${t})`}formatScope(t){return`**${t}:**`}}class lu{toLocalPath(t){const e=t.replace(/[\\/]+/g,Yt.sep);return Yt.normalize(e).replace(/[\\/]+/g,Yt.sep)}isSubPath(t,e){let r=this.toLocalPath(t),n=this.toLocalPath(e);for(;r.endsWith(Yt.sep);)r=r.slice(0,-1);for(;n.endsWith(Yt.sep);)n=n.slice(0,-1);if(r===n)return!0;const o=n.length;return!!r.startsWith(n)&&r[o]===Yt.sep}startsWith(t,e){let r=this.toLocalPath(t),n=this.toLocalPath(e);for(;r.endsWith(Yt.sep);)r=r.slice(0,-1);for(;n.endsWith(Yt.sep);)n=n.slice(0,-1);return r.startsWith(n)}containsPath(t,e){let r=this.toLocalPath(t),n=this.toLocalPath(e);for(;r.endsWith(Yt.sep);)r=r.slice(0,-1);for(;n.endsWith(Yt.sep);)n=n.slice(0,-1);if(r===n)return!0;const o=r.indexOf(n);if(-1===o)return!1;const i=0===o?"":r[o-1],a=o+n.length,s=a>=r.length?"":r[a],u=""===i||i===Yt.sep,c=""===s||s===Yt.sep;return u&&c}}const gu="https://github.com";class pu extends Bi{options;githubManager;pather=new lu;constructor(t,e){super(t),this.options=t,this.githubManager=e}async filterCommitsByDirectory(t,e){const r=[];for(const n of t){const t=await this.githubManager.getCommitInfo(n.base.hash),o=t.files?.map((t=>t.filename))??[];for(const t of o)if(this.pather.isSubPath(t,e)){r.push(n);break}}return r}async getFullCommit(t){const e={...this.options,...t},r=await this.getCommits(e);return(await Promise.all(r.map((async t=>{let{prNumber:r}=t;if(!r&&t.base.subject){const e=t.base.subject.match(/\(#(\d+)\)/);e&&(r=e[1],t.prNumber=r)}if(!r)return t;const n=(await this.githubManager.getPullRequestCommits(+r)).map((({sha:t,commit:{message:e}})=>Object.assign(this.toCommitValue(t,e),{prNumber:r})));return this.filterCommitsByDirectory(n,e.directory)})))).flat()}async transformWorkspace(t,e){const r=[gu,e.shared.authorName,e.shared.repoName].join("/"),n={...e.getConfig("changelog"),githubRootPath:r,mergePRcommit:!0,shell:e.shell,logger:e.logger},o=new pu(n,this.githubManager),i=new fu(n);return await Promise.all(t.map((async t=>{const e=await o.getFullCommit({from:t.lastTag??"",directory:t.path,fileds:Ei});if("string"==typeof e)return{...t,changelog:e};const a=i.format(e,{...n,repoUrl:r});return{...t,changelog:a.join("\n")}})))}}class mu{options;constructor(t){this.options=t}compare(t,e){return"function"==typeof this.options.compare?this.options.compare(t,e):t.startsWith(e)}toChangeLabel(t,e=this.options.changePackagesLabel){return e.replace("${name}",t)}toChangeLabels(t,e=this.options.changePackagesLabel){return t.map((t=>this.toChangeLabel(t,e)))}pick(t,e=this.options.packagesDirectories){const r=[];for(const n of e)for(const e of t)if(this.compare(e,n)){r.push(n);break}return r}}class du{static readJson(t){const e=Qt.readFileSync(t,"utf-8");return JSON.parse(e)}static toWorkspace(t,e){let{root:r,packageJson:n}=t;const o=t.path;if(!o)throw new Error("path is not required!");return r=r||Xt.join(e,o),n=n||du.readJson(Xt.join(r,bi)),{name:n.name,version:n.version,path:o,root:r,packageJson:n}}}class vu extends Ni{releaseTask=null;workspacesList=[];_skip=!1;releaseLabel;constructor(t){super(t,"workspaces"),this.releaseLabel=new mu({changePackagesLabel:this.context.shared.changePackagesLabel||"change:${name}",packagesDirectories:this.context.shared.packagesDirectories||[],compare:(t,e)=>Yt.resolve(t).startsWith(Yt.resolve(e))})}enabled(){return!this._skip&&!this.getConfig("skip")}async onBefore(){const t=this.getConfig("workspace");if(t)return this.logger.debug("Use the specified workspace",t),void this.setCurrentWorkspace(t,[]);const e=await this.getWorkspaces();if(this.getConfig("skipCheckPackage")||0===e.length)throw new Error("No changes to publish packages");const{publishPath:r}=this.context.shared;if(r){const t=e.find((t=>Yt.resolve(t.root)===Yt.resolve(r)));if(this.nextSkip(),!t)throw new Error(`No workspace found for: ${r}`);return this.logger.debug(`Workspace of ${r} find!`,Yt.join(t.root,bi)),void this.setCurrentWorkspace(t,[t])}const[n,...o]=e;this.workspacesList=o,this.setCurrentWorkspace(n,e)}nextSkip(){this._skip=!0,this.logger.debug("skip next workspace")}setReleaseTask(t){this.releaseTask=t}setCurrentWorkspace(t,e){this.context.setShared({publishPath:t.path}),this.setConfig({workspace:t,workspaces:e})}async getGitWorkspaces(){const t=this.context.sourceBranch,e=await this.shell.exec(`git diff --name-only origin/${t}...HEAD`,{dryRun:!1});return"string"==typeof e?e.split("\n"):[]}async getChangedPackages(t,e){if(this.logger.debug("changeLabels",e),Array.isArray(e)&&e.length>0){const r=t.filter((t=>{const r=this.releaseLabel.toChangeLabel(t);return e.includes(r)}));return this.logger.debug("changed by labels",r),r}const r=await this.getGitWorkspaces();return this.logger.debug("changed by git",r),this.releaseLabel.pick(r,t)}getProjectWorkspaces(){const t=this.context.rootPath,e=this.context.shared.packagesDirectories;if(Array.isArray(e)&&e.length>0)return e.map((e=>du.toWorkspace({path:e},t)));return(Kt.findWorkspaces(t)||[]).map((e=>({name:e.package.name,version:e.package.version,path:Yt.relative(t,e.location),root:Yt.resolve(t,e.location),packageJson:e.package})))}async getWorkspaces(){const t=this.getProjectWorkspaces(),e=t.map((({path:t})=>t));this.logger.debug("packages",e);const r=this.getConfig("changeLabels"),n=await this.getChangedPackages(e,r);return this.setConfig({packages:e,changedPaths:n,projectWorkspaces:t}),this.logger.debug("changedPaths",n),t.filter((t=>n.includes(t.path)))}}function bu(t,...e){return"function"==typeof t&&t.prototype&&t.prototype.constructor===t?new t(...e):t(...e)}function yu(t){return t.startsWith(".")?Yt.parse(t).name:t}async function wu(t){let e=null;try{e=(await import(t)).default}catch{try{e=(await import(Yt.join(process.cwd(),t))).default}catch{const r=Zt.createRequire(process.cwd());e=(await import(te.pathToFileURL(r.resolve(t,{paths:[process.cwd()]})).href)).default}}return[yu(t),e]}async function ku(t,e,r=5){const n=ee(r),o=e.map((([e,...r])=>n((()=>(async(e,...r)=>{if("string"==typeof e){const[,n]=await wu(e);return bu(n,t,...r)}return bu(e,t,...r)})(e,...r)))));return Promise.all(o)}const _u=[ki(vu),ki(class extends Ni{constructor(t,e){super(t,"changelog",{increment:"patch",changesetRoot:".changeset",tagTemplate:"${name}@${version}",tagPrefix:"${name}",tagMatch:"${name}@*",...e})}get changesetRoot(){return Xt.join(this.context.rootPath,this.getConfig("changesetRoot"))}get changesetConfigPath(){return Xt.join(this.changesetRoot,"config.json")}enabled(){return!this.getConfig("skip")}async onBefore(){if(!Qt.existsSync(this.changesetRoot))throw new Error(`Changeset directory ${this.changesetRoot} does not exist`);this.logger.debug(`${this.changesetRoot} exists`)}mergeWorkspaces(t){return t.map((t=>{const e=du.toWorkspace({path:t.path},this.context.rootPath),r={...t,version:e.version};return r.tagName=this.generateTagName(r),r}))}async onExec(t){const e=await this.step({label:"Generate Changelogs",task:()=>Promise.all(this.context.workspaces.map((t=>this.generateChangelog(t))))});this.context.setWorkspaces(e)}async onSuccess(){const t=this.context.workspaces;this.getConfig("skipChangeset")?this.logger.debug("Skip generate changeset files"):(await this.step({label:"Changeset Version",task:()=>Promise.all(t.map((t=>this.generateChangesetFile(t))))}),await this.context.runChangesetsCli("version",["--no-changelog","--update-dependencies"]),this.getConfig("ignoreNonUpdatedPackages")&&await this.restoreIgnorePackages());const e=this.mergeWorkspaces(t);this.logger.debug("new workspaces",e),this.context.setWorkspaces(e)}async restoreIgnorePackages(){const{changedPaths:t=[],packages:e=[]}=this.context.getConfig("workspaces"),r=e.filter((e=>!t.includes(e))).map((t=>du.toWorkspace({path:t},this.context.rootPath).path));this.logger.debug("noChangedPackages",r),r.length>0&&await this.shell.exec(["git","restore",...r])}getTagPrefix(t){return this.shell.format(this.getConfig("tagPrefix"),t)}async generateChangelog(t){let e=await this.getTagName(t);t.lastTag&&(this.logger.warn(`${t.name} has lastTag: ${t.lastTag}`),e=t.lastTag),this.logger.debug("tagName is:",e);const r={...this.getConfig(),from:e,directory:t.path,shell:this.shell,fileds:Ei,logger:this.logger},n=new Bi(r),o=await n.getCommits(r),i=new fu(r).format(o);return{...t,lastTag:e,changelog:i.join("\n")}}generateTagName(t){try{const e=this.getConfig("t