hins
Version:
[](https://codecov.io/gh/l-zoy/hins) [](https://github.com/l-zoy/hins/blob/master/LICENSE)  • 45.3 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./chokidar"),e=require("resolve"),n=require("./joi"),r=require("assert"),o=require("path"),i=require("fs");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=a(t),u=a(e),c=a(n),f=a(r),l=a(o),h=a(i),p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var d,y,g=Function.prototype,_=Object.prototype,v=g.toString,b=_.hasOwnProperty,j=v.call(Object),m=_.toString,w=(d=Object.getPrototypeOf,y=Object,function(t){return d(y(t))});var O=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=m.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=w(t);if(null===e)return!0;var n=b.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&v.call(n)==j},A={exports:{}};!function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",s="[object Function]",u="[object GeneratorFunction]",c="[object Map]",f="[object Number]",l="[object Object]",h="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",_="[object Symbol]",v="[object WeakMap]",b="[object ArrayBuffer]",j="[object DataView]",m="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",A="[object Int16Array]",k="[object Int32Array]",P="[object Uint8Array]",x="[object Uint8ClampedArray]",$="[object Uint16Array]",S="[object Uint32Array]",C=/\w*$/,z=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,I={};I[o]=I["[object Array]"]=I[b]=I[j]=I[i]=I[a]=I[m]=I[w]=I[O]=I[A]=I[k]=I[c]=I[f]=I[l]=I[d]=I[y]=I[g]=I[_]=I[P]=I[x]=I[$]=I[S]=!0,I["[object Error]"]=I[s]=I[v]=!1;var F="object"==typeof p&&p&&p.Object===Object&&p,R="object"==typeof self&&self&&self.Object===Object&&self,M=F||R||Function("return this")(),T=e&&!e.nodeType&&e,U=T&&t&&!t.nodeType&&t,B=U&&U.exports===T;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function N(t,e,n,r){var o=-1,i=t?t.length:0;for(r&&i&&(n=t[++o]);++o<i;)n=e(n,t[o],o,t);return n}function q(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function D(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function V(t,e){return function(n){return t(e(n))}}function G(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var W,J=Array.prototype,K=Function.prototype,Q=Object.prototype,X=M["__core-js_shared__"],Y=(W=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Z=K.toString,tt=Q.hasOwnProperty,et=Q.toString,nt=RegExp("^"+Z.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=B?M.Buffer:void 0,ot=M.Symbol,it=M.Uint8Array,at=V(Object.getPrototypeOf,Object),st=Object.create,ut=Q.propertyIsEnumerable,ct=J.splice,ft=Object.getOwnPropertySymbols,lt=rt?rt.isBuffer:void 0,ht=V(Object.keys,Object),pt=Ut(M,"DataView"),dt=Ut(M,"Map"),yt=Ut(M,"Promise"),gt=Ut(M,"Set"),_t=Ut(M,"WeakMap"),vt=Ut(Object,"create"),bt=qt(pt),jt=qt(dt),mt=qt(yt),wt=qt(gt),Ot=qt(_t),At=ot?ot.prototype:void 0,kt=At?At.valueOf:void 0;function Pt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function xt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $t(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function St(t){this.__data__=new xt(t)}function Ct(t,e){var n=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Gt(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var a in t)!e&&!tt.call(t,a)||i&&("length"==a||Ht(a,r))||n.push(a);return n}function zt(t,e,n){var r=t[e];tt.call(t,e)&&Dt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Et(t,e){for(var n=t.length;n--;)if(Dt(t[n][0],e))return n;return-1}function It(t,e,n,r,h,p,v){var z;if(r&&(z=p?r(t,h,p,v):r(t)),void 0!==z)return z;if(!Kt(t))return t;var E=Vt(t);if(E){if(z=function(t){var e=t.length,n=t.constructor(e);e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!e)return function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(t,z)}else{var F=Lt(t),R=F==s||F==u;if(Wt(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(F==l||F==o||R&&!p){if(q(t))return p?t:{};if(z=function(t){return"function"!=typeof t.constructor||Nt(t)?{}:(e=at(t),Kt(e)?st(e):{});var e}(R?{}:t),!e)return function(t,e){return Mt(t,Bt(t),e)}(t,function(t,e){return t&&Mt(e,Qt(e),t)}(z,t))}else{if(!I[F])return p?t:{};z=function(t,e,n,r){var o=t.constructor;switch(e){case b:return Rt(t);case i:case a:return new o(+t);case j:return function(t,e){var n=e?Rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case m:case w:case O:case A:case k:case P:case x:case $:case S:return function(t,e){var n=e?Rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case c:return function(t,e,n){return N(e?n(D(t),!0):D(t),L,new t.constructor)}(t,r,n);case f:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,C.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return N(e?n(G(t),!0):G(t),H,new t.constructor)}(t,r,n);case _:return s=t,kt?Object(kt.call(s)):{}}var s}(t,F,It,e)}}v||(v=new St);var M=v.get(t);if(M)return M;if(v.set(t,z),!E)var T=n?function(t){return function(t,e,n){var r=e(t);return Vt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Qt,Bt)}(t):Qt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n,t););}(T||t,(function(o,i){T&&(o=t[i=o]),zt(z,i,It(o,e,n,r,i,t,v))})),z}function Ft(t){return!(!Kt(t)||function(t){return!!Y&&Y in t}(t))&&(Jt(t)||q(t)?nt:z).test(qt(t))}function Rt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function Mt(t,e,n,r){n||(n={});for(var o=-1,i=e.length;++o<i;){var a=e[o],s=r?r(n[a],t[a],a,n,t):void 0;zt(n,a,void 0===s?t[a]:s)}return n}function Tt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Ut(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return Ft(n)?n:void 0}Pt.prototype.clear=function(){this.__data__=vt?vt(null):{}},Pt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Pt.prototype.get=function(t){var e=this.__data__;if(vt){var r=e[t];return r===n?void 0:r}return tt.call(e,t)?e[t]:void 0},Pt.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:tt.call(e,t)},Pt.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?n:e,this},xt.prototype.clear=function(){this.__data__=[]},xt.prototype.delete=function(t){var e=this.__data__,n=Et(e,t);return!(n<0)&&(n==e.length-1?e.pop():ct.call(e,n,1),!0)},xt.prototype.get=function(t){var e=this.__data__,n=Et(e,t);return n<0?void 0:e[n][1]},xt.prototype.has=function(t){return Et(this.__data__,t)>-1},xt.prototype.set=function(t,e){var n=this.__data__,r=Et(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},$t.prototype.clear=function(){this.__data__={hash:new Pt,map:new(dt||xt),string:new Pt}},$t.prototype.delete=function(t){return Tt(this,t).delete(t)},$t.prototype.get=function(t){return Tt(this,t).get(t)},$t.prototype.has=function(t){return Tt(this,t).has(t)},$t.prototype.set=function(t,e){return Tt(this,t).set(t,e),this},St.prototype.clear=function(){this.__data__=new xt},St.prototype.delete=function(t){return this.__data__.delete(t)},St.prototype.get=function(t){return this.__data__.get(t)},St.prototype.has=function(t){return this.__data__.has(t)},St.prototype.set=function(t,e){var n=this.__data__;if(n instanceof xt){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new $t(r)}return n.set(t,e),this};var Bt=ft?V(ft,Object):function(){return[]},Lt=function(t){return et.call(t)};function Ht(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<e}function Nt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Q)}function qt(t){if(null!=t){try{return Z.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Dt(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=j||dt&&Lt(new dt)!=c||yt&&Lt(yt.resolve())!=h||gt&&Lt(new gt)!=y||_t&&Lt(new _t)!=v)&&(Lt=function(t){var e=et.call(t),n=e==l?t.constructor:void 0,r=n?qt(n):void 0;if(r)switch(r){case bt:return j;case jt:return c;case mt:return h;case wt:return y;case Ot:return v}return e});var Vt=Array.isArray;function Gt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}(t.length)&&!Jt(t)}var Wt=lt||function(){return!1};function Jt(t){var e=Kt(t)?et.call(t):"";return e==s||e==u}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Qt(t){return Gt(t)?Ct(t):function(t){if(!Nt(t))return ht(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return It(t,!0,!0)}}(A,A.exports);var k=A.exports,P={exports:{}};!function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",u="[object Error]",c="[object Function]",f="[object Map]",l="[object Number]",h="[object Object]",d="[object Promise]",y="[object RegExp]",g="[object Set]",_="[object String]",v="[object Symbol]",b="[object WeakMap]",j="[object ArrayBuffer]",m="[object DataView]",w=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[o]=A[i]=A[j]=A[a]=A[m]=A[s]=A[u]=A[c]=A[f]=A[l]=A[h]=A[y]=A[g]=A[_]=A[b]=!1;var k="object"==typeof p&&p&&p.Object===Object&&p,P="object"==typeof self&&self&&self.Object===Object&&self,x=k||P||Function("return this")(),$=e&&!e.nodeType&&e,S=$&&t&&!t.nodeType&&t,C=S&&S.exports===$,z=C&&k.process,E=function(){try{return z&&z.binding&&z.binding("util")}catch(t){}}(),I=E&&E.isTypedArray;function F(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function R(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function M(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var T,U=Array.prototype,B=Function.prototype,L=Object.prototype,H=x["__core-js_shared__"],N=B.toString,q=L.hasOwnProperty,D=(T=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",V=L.toString,G=RegExp("^"+N.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=C?x.Buffer:void 0,J=x.Symbol,K=x.Uint8Array,Q=L.propertyIsEnumerable,X=U.splice,Y=J?J.toStringTag:void 0,Z=Object.getOwnPropertySymbols,tt=W?W.isBuffer:void 0,et=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),nt=Ct(x,"DataView"),rt=Ct(x,"Map"),ot=Ct(x,"Promise"),it=Ct(x,"Set"),at=Ct(x,"WeakMap"),st=Ct(Object,"create"),ut=Ft(nt),ct=Ft(rt),ft=Ft(ot),lt=Ft(it),ht=Ft(at),pt=J?J.prototype:void 0,dt=pt?pt.valueOf:void 0;function yt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function gt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _t(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function vt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new _t;++e<n;)this.add(t[e])}function bt(t){var e=this.__data__=new gt(t);this.size=e.size}function jt(t,e){var n=Tt(t),r=!n&&Mt(t),o=!n&&!r&&Ut(t),i=!n&&!r&&!o&&qt(t),a=n||r||o||i,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!q.call(t,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||It(c,u))||s.push(c);return s}function mt(t,e){for(var n=t.length;n--;)if(Rt(t[n][0],e))return n;return-1}function wt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Y&&Y in Object(t)?function(t){var e=q.call(t,Y),n=t[Y];try{t[Y]=void 0;var r=!0}catch(t){}var o=V.call(t);r&&(e?t[Y]=n:delete t[Y]);return o}(t):function(t){return V.call(t)}(t)}function Ot(t){return Nt(t)&&wt(t)==o}function At(t,e,n,r,c){return t===e||(null==t||null==e||!Nt(t)&&!Nt(e)?t!=t&&e!=e:function(t,e,n,r,c,p){var d=Tt(t),b=Tt(e),w=d?i:Et(t),O=b?i:Et(e),A=(w=w==o?h:w)==h,k=(O=O==o?h:O)==h,P=w==O;if(P&&Ut(t)){if(!Ut(e))return!1;d=!0,A=!1}if(P&&!A)return p||(p=new bt),d||qt(t)?xt(t,e,n,r,c,p):function(t,e,n,r,o,i,c){switch(n){case m:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case j:return!(t.byteLength!=e.byteLength||!i(new K(t),new K(e)));case a:case s:case l:return Rt(+t,+e);case u:return t.name==e.name&&t.message==e.message;case y:case _:return t==e+"";case f:var h=R;case g:var p=1&r;if(h||(h=M),t.size!=e.size&&!p)return!1;var d=c.get(t);if(d)return d==e;r|=2,c.set(t,e);var b=xt(h(t),h(e),r,o,i,c);return c.delete(t),b;case v:if(dt)return dt.call(t)==dt.call(e)}return!1}(t,e,w,n,r,c,p);if(!(1&n)){var x=A&&q.call(t,"__wrapped__"),$=k&&q.call(e,"__wrapped__");if(x||$){var S=x?t.value():t,C=$?e.value():e;return p||(p=new bt),c(S,C,n,r,p)}}if(!P)return!1;return p||(p=new bt),function(t,e,n,r,o,i){var a=1&n,s=$t(t),u=s.length,c=$t(e).length;if(u!=c&&!a)return!1;var f=u;for(;f--;){var l=s[f];if(!(a?l in e:q.call(e,l)))return!1}var h=i.get(t);if(h&&i.get(e))return h==e;var p=!0;i.set(t,e),i.set(e,t);var d=a;for(;++f<u;){var y=t[l=s[f]],g=e[l];if(r)var _=a?r(g,y,l,e,t,i):r(y,g,l,t,e,i);if(!(void 0===_?y===g||o(y,g,n,r,i):_)){p=!1;break}d||(d="constructor"==l)}if(p&&!d){var v=t.constructor,b=e.constructor;v==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(p=!1)}return i.delete(t),i.delete(e),p}(t,e,n,r,c,p)}(t,e,n,r,At,c))}function kt(t){return!(!Ht(t)||function(t){return!!D&&D in t}(t))&&(Bt(t)?G:w).test(Ft(t))}function Pt(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||L,e!==r)return et(t);var e,n,r,o=[];for(var i in Object(t))q.call(t,i)&&"constructor"!=i&&o.push(i);return o}function xt(t,e,n,r,o,i){var a=1&n,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var f=-1,l=!0,h=2&n?new vt:void 0;for(i.set(t,e),i.set(e,t);++f<s;){var p=t[f],d=e[f];if(r)var y=a?r(d,p,f,e,t,i):r(p,d,f,t,e,i);if(void 0!==y){if(y)continue;l=!1;break}if(h){if(!F(e,(function(t,e){if(a=e,!h.has(a)&&(p===t||o(p,t,n,r,i)))return h.push(e);var a}))){l=!1;break}}else if(p!==d&&!o(p,d,n,r,i)){l=!1;break}}return i.delete(t),i.delete(e),l}function $t(t){return function(t,e,n){var r=e(t);return Tt(t)?r:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(r,n(t))}(t,Dt,zt)}function St(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Ct(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return kt(n)?n:void 0}yt.prototype.clear=function(){this.__data__=st?st(null):{},this.size=0},yt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},yt.prototype.get=function(t){var e=this.__data__;if(st){var r=e[t];return r===n?void 0:r}return q.call(e,t)?e[t]:void 0},yt.prototype.has=function(t){var e=this.__data__;return st?void 0!==e[t]:q.call(e,t)},yt.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=st&&void 0===e?n:e,this},gt.prototype.clear=function(){this.__data__=[],this.size=0},gt.prototype.delete=function(t){var e=this.__data__,n=mt(e,t);return!(n<0)&&(n==e.length-1?e.pop():X.call(e,n,1),--this.size,!0)},gt.prototype.get=function(t){var e=this.__data__,n=mt(e,t);return n<0?void 0:e[n][1]},gt.prototype.has=function(t){return mt(this.__data__,t)>-1},gt.prototype.set=function(t,e){var n=this.__data__,r=mt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},_t.prototype.clear=function(){this.size=0,this.__data__={hash:new yt,map:new(rt||gt),string:new yt}},_t.prototype.delete=function(t){var e=St(this,t).delete(t);return this.size-=e?1:0,e},_t.prototype.get=function(t){return St(this,t).get(t)},_t.prototype.has=function(t){return St(this,t).has(t)},_t.prototype.set=function(t,e){var n=St(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},vt.prototype.add=vt.prototype.push=function(t){return this.__data__.set(t,n),this},vt.prototype.has=function(t){return this.__data__.has(t)},bt.prototype.clear=function(){this.__data__=new gt,this.size=0},bt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},bt.prototype.get=function(t){return this.__data__.get(t)},bt.prototype.has=function(t){return this.__data__.has(t)},bt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof gt){var r=n.__data__;if(!rt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _t(r)}return n.set(t,e),this.size=n.size,this};var zt=Z?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i}(Z(t),(function(e){return Q.call(t,e)})))}:function(){return[]},Et=wt;function It(t,e){return!!(e=null==e?r:e)&&("number"==typeof t||O.test(t))&&t>-1&&t%1==0&&t<e}function Ft(t){if(null!=t){try{return N.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Rt(t,e){return t===e||t!=t&&e!=e}(nt&&Et(new nt(new ArrayBuffer(1)))!=m||rt&&Et(new rt)!=f||ot&&Et(ot.resolve())!=d||it&&Et(new it)!=g||at&&Et(new at)!=b)&&(Et=function(t){var e=wt(t),n=e==h?t.constructor:void 0,r=n?Ft(n):"";if(r)switch(r){case ut:return m;case ct:return f;case ft:return d;case lt:return g;case ht:return b}return e});var Mt=Ot(function(){return arguments}())?Ot:function(t){return Nt(t)&&q.call(t,"callee")&&!Q.call(t,"callee")},Tt=Array.isArray;var Ut=tt||function(){return!1};function Bt(t){if(!Ht(t))return!1;var e=wt(t);return e==c||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Lt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function Ht(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Nt(t){return null!=t&&"object"==typeof t}var qt=I?function(t){return function(e){return t(e)}}(I):function(t){return Nt(t)&&Lt(t.length)&&!!A[wt(t)]};function Dt(t){return null!=(e=t)&&Lt(e.length)&&!Bt(e)?jt(t):Pt(t);var e}t.exports=function(t,e){return At(t,e)}}(P,P.exports);var x=P.exports,$={exports:{}};!function(t,e){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Function]",a="[object Object]",s=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,c={};c["[object Float32Array]"]=c["[object Float64Array]"]=c["[object Int8Array]"]=c["[object Int16Array]"]=c["[object Int32Array]"]=c["[object Uint8Array]"]=c["[object Uint8ClampedArray]"]=c["[object Uint16Array]"]=c["[object Uint32Array]"]=!0,c[o]=c["[object Array]"]=c["[object ArrayBuffer]"]=c["[object Boolean]"]=c["[object DataView]"]=c["[object Date]"]=c["[object Error]"]=c[i]=c["[object Map]"]=c["[object Number]"]=c[a]=c["[object RegExp]"]=c["[object Set]"]=c["[object String]"]=c["[object WeakMap]"]=!1;var f="object"==typeof p&&p&&p.Object===Object&&p,l="object"==typeof self&&self&&self.Object===Object&&self,h=f||l||Function("return this")(),d=e&&!e.nodeType&&e,y=d&&t&&!t.nodeType&&t,g=y&&y.exports===d,_=g&&f.process,v=function(){try{var t=y&&y.require&&y.require("util").types;return t||_&&_.binding&&_.binding("util")}catch(t){}}(),b=v&&v.isTypedArray;function j(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var m,w=Array.prototype,O=Function.prototype,A=Object.prototype,k=h["__core-js_shared__"],P=O.toString,x=A.hasOwnProperty,$=(m=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",S=A.toString,C=P.call(Object),z=RegExp("^"+P.call(x).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),E=g?h.Buffer:void 0,I=h.Symbol,F=h.Uint8Array,R=E?E.allocUnsafe:void 0,M=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),T=Object.create,U=A.propertyIsEnumerable,B=w.splice,L=I?I.toStringTag:void 0,H=function(){try{var t=ht(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),N=E?E.isBuffer:void 0,q=Math.max,D=Date.now,V=ht(h,"Map"),G=ht(Object,"create"),W=function(){function t(){}return function(e){if(!At(e))return{};if(T)return T(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function K(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Q(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function X(t){var e=this.__data__=new K(t);this.size=e.size}function Y(t,e){var n=bt(t),r=!n&&vt(t),o=!n&&!r&&mt(t),i=!n&&!r&&!o&&Pt(t),a=n||r||o||i,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!x.call(t,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||pt(c,u))||s.push(c);return s}function Z(t,e,n){(void 0!==n&&!_t(t[e],n)||void 0===n&&!(e in t))&&nt(t,e,n)}function tt(t,e,n){var r=t[e];x.call(t,e)&&_t(r,n)&&(void 0!==n||e in t)||nt(t,e,n)}function et(t,e){for(var n=t.length;n--;)if(_t(t[n][0],e))return n;return-1}function nt(t,e,n){"__proto__"==e&&H?H(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}J.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(G){var r=e[t];return r===n?void 0:r}return x.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return G?void 0!==e[t]:x.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=G&&void 0===e?n:e,this},K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,n=et(e,t);return!(n<0)&&(n==e.length-1?e.pop():B.call(e,n,1),--this.size,!0)},K.prototype.get=function(t){var e=this.__data__,n=et(e,t);return n<0?void 0:e[n][1]},K.prototype.has=function(t){return et(this.__data__,t)>-1},K.prototype.set=function(t,e){var n=this.__data__,r=et(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Q.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(V||K),string:new J}},Q.prototype.delete=function(t){var e=lt(this,t).delete(t);return this.size-=e?1:0,e},Q.prototype.get=function(t){return lt(this,t).get(t)},Q.prototype.has=function(t){return lt(this,t).has(t)},Q.prototype.set=function(t,e){var n=lt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},X.prototype.clear=function(){this.__data__=new K,this.size=0},X.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},X.prototype.get=function(t){return this.__data__.get(t)},X.prototype.has=function(t){return this.__data__.has(t)},X.prototype.set=function(t,e){var n=this.__data__;if(n instanceof K){var r=n.__data__;if(!V||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Q(r)}return n.set(t,e),this.size=n.size,this};var rt,ot=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),a=i.length;a--;){var s=i[rt?a:++r];if(!1===e(o[s],s,o))break}return t};function it(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var e=x.call(t,L),n=t[L];try{t[L]=void 0;var r=!0}catch(t){}var o=S.call(t);r&&(e?t[L]=n:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return kt(t)&&it(t)==o}function st(t){return!(!At(t)||function(t){return!!$&&$ in t}(t))&&(wt(t)?z:s).test(function(t){if(null!=t){try{return P.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function ut(t){if(!At(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=dt(t),n=[];for(var r in t)("constructor"!=r||!e&&x.call(t,r))&&n.push(r);return n}function ct(t,e,n,r,o){t!==e&&ot(e,(function(i,s){if(o||(o=new X),At(i))!function(t,e,n,r,o,i,s){var u=yt(t,n),c=yt(e,n),f=s.get(c);if(f)return void Z(t,n,f);var l=i?i(u,c,n+"",t,e,s):void 0,h=void 0===l;if(h){var p=bt(c),d=!p&&mt(c),y=!p&&!d&&Pt(c);l=c,p||d||y?bt(u)?l=u:kt(j=u)&&jt(j)?l=function(t,e){var n=-1,r=t.length;e||(e=Array(r));for(;++n<r;)e[n]=t[n];return e}(u):d?(h=!1,l=function(t,e){if(e)return t.slice();var n=t.length,r=R?R(n):new t.constructor(n);return t.copy(r),r}(c,!0)):y?(h=!1,g=c,_=!0?(v=g.buffer,b=new v.constructor(v.byteLength),new F(b).set(new F(v)),b):g.buffer,l=new g.constructor(_,g.byteOffset,g.length)):l=[]:function(t){if(!kt(t)||it(t)!=a)return!1;var e=M(t);if(null===e)return!0;var n=x.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&P.call(n)==C}(c)||vt(c)?(l=u,vt(u)?l=function(t){return function(t,e,n,r){var o=!n;n||(n={});var i=-1,a=e.length;for(;++i<a;){var s=e[i],u=r?r(n[s],t[s],s,n,t):void 0;void 0===u&&(u=t[s]),o?nt(n,s,u):tt(n,s,u)}return n}(t,xt(t))}(u):At(u)&&!wt(u)||(l=function(t){return"function"!=typeof t.constructor||dt(t)?{}:W(M(t))}(c))):h=!1}var g,_,v,b;var j;h&&(s.set(c,l),o(l,c,r,i,s),s.delete(c));Z(t,n,l)}(t,e,s,n,ct,r,o);else{var u=r?r(yt(t,s),i,s+"",t,e,o):void 0;void 0===u&&(u=i),Z(t,s,u)}}),xt)}function ft(t,e){return gt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=q(r.length-e,0),a=Array(i);++o<i;)a[o]=r[e+o];o=-1;for(var s=Array(e+1);++o<e;)s[o]=r[o];return s[e]=n(a),j(t,this,s)}}(t,e,Ct),t+"")}function lt(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function ht(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return st(n)?n:void 0}function pt(t,e){var n=typeof t;return!!(e=null==e?r:e)&&("number"==n||"symbol"!=n&&u.test(t))&&t>-1&&t%1==0&&t<e}function dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||A)}function yt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var gt=function(t){var e=0,n=0;return function(){var r=D(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(H?function(t,e){return H(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct);function _t(t,e){return t===e||t!=t&&e!=e}var vt=at(function(){return arguments}())?at:function(t){return kt(t)&&x.call(t,"callee")&&!U.call(t,"callee")},bt=Array.isArray;function jt(t){return null!=t&&Ot(t.length)&&!wt(t)}var mt=N||function(){return!1};function wt(t){if(!At(t))return!1;var e=it(t);return e==i||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=r}function At(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function kt(t){return null!=t&&"object"==typeof t}var Pt=b?function(t){return function(e){return t(e)}}(b):function(t){return kt(t)&&Ot(t.length)&&!!c[it(t)]};function xt(t){return jt(t)?Y(t,!0):ut(t)}var $t,St=($t=function(t,e,n){ct(t,e,n)},ft((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=$t.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!At(n))return!1;var r=typeof e;return!!("number"==r?jt(n)&&pt(e,n.length):"string"==r&&e in n)&&_t(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var a=e[n];a&&$t(t,a,n,o)}return t})));function Ct(t){return t}t.exports=St}($,$.exports);var S=$.exports,C="[object GeneratorFunction]",z=/^\[object .+?Constructor\]$/,E="object"==typeof p&&p&&p.Object===Object&&p,I="object"==typeof self&&self&&self.Object===Object&&self,F=E||I||Function("return this")();function R(t,e){return!!(t?t.length:0)&&function(t,e,n){if(e!=e)return function(t,e,n,r){var o=t.length,i=n+(r?1:-1);for(;r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}(t,T,n);var r=n-1,o=t.length;for(;++r<o;)if(t[r]===e)return r;return-1}(t,e,0)>-1}function M(t,e,n){for(var r=-1,o=t?t.length:0;++r<o;)if(n(e,t[r]))return!0;return!1}function T(t){return t!=t}function U(t,e){return t.has(e)}function B(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var L,H=Array.prototype,N=Function.prototype,q=Object.prototype,D=F["__core-js_shared__"],V=(L=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+L:"",G=N.toString,W=q.hasOwnProperty,J=q.toString,K=RegExp("^"+G.call(W).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Q=H.splice,X=ut(F,"Map"),Y=ut(F,"Set"),Z=ut(Object,"create");function tt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function et(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function nt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function rt(t){var e=-1,n=t?t.length:0;for(this.__data__=new nt;++e<n;)this.add(t[e])}function ot(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function it(t){return!(!ct(t)||function(t){return!!V&&V in t}(t))&&(function(t){var e=ct(t)?J.call(t):"";return"[object Function]"==e||e==C}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?K:z).test(function(t){if(null!=t){try{return G.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}tt.prototype.clear=function(){this.__data__=Z?Z(null):{}},tt.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},tt.prototype.get=function(t){var e=this.__data__;if(Z){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return W.call(e,t)?e[t]:void 0},tt.prototype.has=function(t){var e=this.__data__;return Z?void 0!==e[t]:W.call(e,t)},tt.prototype.set=function(t,e){return this.__data__[t]=Z&&void 0===e?"__lodash_hash_undefined__":e,this},et.prototype.clear=function(){this.__data__=[]},et.prototype.delete=function(t){var e=this.__data__,n=ot(e,t);return!(n<0)&&(n==e.length-1?e.pop():Q.call(e,n,1),!0)},et.prototype.get=function(t){var e=this.__data__,n=ot(e,t);return n<0?void 0:e[n][1]},et.prototype.has=function(t){return ot(this.__data__,t)>-1},et.prototype.set=function(t,e){var n=this.__data__,r=ot(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},nt.prototype.clear=function(){this.__data__={hash:new tt,map:new(X||et),string:new tt}},nt.prototype.delete=function(t){return st(this,t).delete(t)},nt.prototype.get=function(t){return st(this,t).get(t)},nt.prototype.has=function(t){return st(this,t).has(t)},nt.prototype.set=function(t,e){return st(this,t).set(t,e),this},rt.prototype.add=rt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},rt.prototype.has=function(t){return this.__data__.has(t)};var at=Y&&1/B(new Y([,-0]))[1]==1/0?function(t){return new Y(t)}:function(){};function st(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function ut(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return it(n)?n:void 0}function ct(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var ft,lt,ht=function(t){return t&&t.length?function(t,e,n){var r=-1,o=R,i=t.length,a=!0,s=[],u=s;if(n)a=!1,o=M;else if(i>=200){var c=e?null:at(t);if(c)return B(c);a=!1,o=U,u=new rt}else u=e?[]:s;t:for(;++r<i;){var f=t[r],l=e?e(f):f;if(f=n||0!==f?f:0,a&&l==l){for(var h=u.length;h--;)if(u[h]===l)continue t;e&&u.push(l),s.push(f)}else o(u,l,n)||(u!==s&&u.push(l),s.push(f))}return s}(t):[]},pt=t=>{const e=/^\\\\\?\\/.test(t),n=/[^\u0000-\u0080]+/.test(t);return e||n?t:t.replace(/\\/g,"/")};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function dt(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function yt(t,e=[]){return t.forEach((t=>{Array.isArray(t)?yt(t,e):e.push(t)})),e}function gt(t){return t.__esModule?t.default:t}function _t(t){return"function"==typeof t?t.toString():O(t)?Object.keys(t).reduce(((e,n)=>(e[n]=_t(t[n]),e)),{}):t}function vt(t){return f.default(h.default.existsSync(t),`${t} not exists, pathToRegister failed`),{path:pt(t),apply:()=>gt(require(t))}}function bt(t){return yt([...t.plugins].filter(Boolean)).map((e=>u.default.sync(e,{basedir:t.cwd,extensions:[".js",".ts"]}))).map(vt)}!function(t){t[t.uninitialized=0]="uninitialized",t[t.init=1]="init",t[t.initPlugins=2]="initPlugins",t[t.pluginReady=3]="pluginReady",t[t.getConfig=4]="getConfig",t[t.start=5]="start"}(ft||(ft={})),function(t){t.add="add",t.modify="modify",t.event="event"}(lt||(lt={}));const jt=["onPluginReady","modifyConfig","onStart"];class mt{constructor(t){this.core=t.core,this.possibleConfigName=t.possibleConfigName}getPluginConfig(t){const e=this.getPluginDefaultConfig(),{stage:n,plugins:r}=this.core;f.default(n>=ft.pluginReady,"Config.getPluginConfig() failed, it should not be executed before plugin is ready.");const o=Object.keys(t),i={};if(Object.keys(r).forEach((n=>{const{key:a,config:s}=r[n];if(!a||!s)return;const u=t[a];if(i[a])throw new Error(`have multiple same ${a}`);i[a]=a;const l=s.schema(c.default);f.default(c.default.isSchema(l),`schema return from plugin ${n} is not valid schema.`);const{error:h}=l.validate(u);if(h)throw new Error(h.message);const p=o.indexOf(a.split(".")[0]);if(-1!==p&&o.splice(p,1),a in e){const n=function({defaultConfig:t,config:e}){return O(t)&&O(e)?S(t,e):void 0!==e?e:t}({defaultConfig:e[a],config:u});t[a]=n}})),o.length){const t=o.length>1?"keys":"key";throw new Error(`Invalid config ${t}: ${o.join(", ")}`)}return t}getPluginDefaultConfig(){const{plugins:t}=this.core;return Object.keys(t).reduce(((e,n)=>{const{key:r,config:o}=t[n];return r&&o?("default"in o&&(e[r]=o.default),e):e}),{})}getConfigFile(){const{cwd:t}=this.core,e=process.env.HINS_CONFIG_ENV;let n=this.possibleConfigName.find((e=>h.default.existsSync(l.default.join(t,e))));if(n){if(e){const t=l.default.extname(n);n=n.replace(t,`.${e}${t}`)}return pt(l.default.join(t,n))}return!1}getUserConfig(){const{babelRegister:t}=this.core,e=this.getConfigFile();return e?(delete require.cache[e],t(e),gt(require(e))):{}}watchConfig(){const{cwd:t,config:e,args:n,watchConfig:r}=this.core,o=this.getConfigFile();if(o){const i=s.default.watch(o,{cwd:t,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:500}});i.on("all",((t,o)=>dt(this,void 0,void 0,(function*(){const a=this.getUserConfig(),s=this.getPluginConfig(a),u=(c=e,!x(_t(s),_t(c)));var c;r.changeLog(t,o,u),u&&(r.reloadLog(t,o),this.core.initConfig=a,this.core.reset(),yield i.close(),this.core.start(Object.assign(Object.assign({},n),{reloadCommand:!1})))}))))}}}class wt{constructor(){this.taps=[],this.funcs=[]}tap(t){t.forEach((t=>{this.insert(t)})),this.taps.forEach((({fn:t})=>{this.funcs.push(t)}))}tapCall(t){return this.create()(t)}insert(t){var e;let n;"string"==typeof t.before?n=new Set([t.before]):Array.isArray(t.before)&&(n=new Set(t.before));let r=0;"number"==typeof t.stage&&(r=t.stage);let o=this.taps.length;for(;o>0;){o--;const t=this.taps[o];this.taps[o+1]=t;const i=null!==(e=t.stage)&&void 0!==e?e:0;if(n){if(n.has(t.name)){n.delete(t.name);continue}if(n.size>0)throw new Error(`key name not found: ${[...n].join(", ")}`)}if(!(i>r)){o++;break}}this.taps[o]=t}create(){const t=this.callTapsSeries();return new Function("memo",`const fn = this.funcs;\n return new Promise( (resolve, reject) => {\n let sync = true;\n function error(err){\n if (sync){\n resolve(Promise.resolve().then((function() { throw err; })))\n } else {\n reject(err)\n }\n }\n ${t}\n sync = false;\n })`).bind(this)}callTapsSeries(){let t="";const e="resolve(memo);";let n=e;for(let r=this.taps.length-1;r>=0;r--){const o=n!==e;o&&(t+=`function next${r}(){ ${n} } \n`,n=`next${r}();\n`);n=`let hasResult${r} = false;\n const promise${r} = fn[${r}](memo)\n if (!promise${r}.then) {\n throw new Error("Not return promise (returned promise0)");\n }\n promise${r}.then((rest${r})=>{\n hasResult${r} = true;\n if(rest${r} !== undefined){\n memo = rest${r}\n }\n ${o?`next${r}()`:e};\n },(err)=>{\n if (hasResult${r}){\n throw err\n }\n error(err)\n })`}return t+n}}const Ot=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/,At=/\\n/g,kt=/\n|\r|\r\n/;var Pt=function(t,e){const n=Boolean(e&&e.debug),r={};return t.toString().split(kt).forEach((function(t,e){const o=t.match(Ot);if(null!=o){const t=o[1];let e=o[2]||"";const n=e.length-1,i='"'===e[0]&&'"'===e[n];"'"===e[0]&&"'"===e[n]||i?(e=e.substring(1,n),i&&(e=e.replace(At,"\n"))):e=e.trim(),r[t]=e}else n&&(i=`did not match key and value when parsing line ${e+1}: ${t}`,console.log(`[dotenv][DEBUG] ${i}`));var i})),r};class xt{constructor(t){const{core:e}=t;this.core=e}describe(t){const{key:e,config:n}=t,{plugins:r}=this.core;f.default(t.key,"api.describe() failed, the plugin is missing an 'key'."),f.default(t.config.schema&&"function"==typeof t.config.schema,"api.describe() failed, the plugin is missing 'schema'"),f.default(this.path,"api.describe() failed, this.Path is not initialized"),r[this.path].key=e,r[this.path].config=n}registerCommand(t){const{commands:e}=this.core,{command:n,alias:r}=t;f.default(!e[n],`api.registerCommand() failed, the command ${n} is exists.`),e[n]=t,r&&(e[r]=t)}registerPlugins(t){f.default(this.core.stage===ft.initPlugins,"api.registerPlugins() failed, it should only be used in registering stage."),f.default(Array.isArray(t),"api.registerPlugins() failed, plugins must be Array.");const e={},n=[];for(const r of t)if("string"!=typeof r){if(!r.key||!r.apply)throw new Error("Inline plugins must contain 'key' and 'apply'");e[r.key]||(e[r.key]=1,n.push({path:r.key,apply:()=>r.apply}))}else{if(e[r])continue;const t=vt(r);if(this.core.plugins[t.path])throw new Error(`Same plugin registered ${t.path}`);this.core.extraPlugins.forEach((({path:e})=>{if(e===t.path)throw new Error(`Repeat the plugin to be registered ${t.path}`)})),e[r]=1,n.push(vt(r))}this.core.extraPlugins.unshift(...n)}registerMethod(t){const{pluginMethods:e}=this.core,{fn:n,name:r}=t;f.default(!e[r],`api.registerMethod() failed, method ${r} is already exist.`),e[r]=null!=n?n:function(t){const e="function"==typeof t?{fn:t}:t;this.register(Object.assign({key:r},e))}}register(t){var e;const{hooksByPluginId:n}=this.core;f.default(t.key&&"string"==typeof t.key,`api.register() failed, hook.key must supplied and should be string, but got ${t.key}.`),f.default("function"==typeof t.fn,`api.register() failed, hook.fn must supplied and should be function, but got ${t.fn}.`),f.default(this.path,"api.register() failed, this.Path is not initialized"),n[t.key]=(null!==(e=n[t.key])&&void 0!==e?e:[]).concat(Object.assign({pluginId:this.path},t))}}Object.defineProperty(exports,"chokidar",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(exports,"resolve",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(exports,"joi",{enumerable:!0,get:function(){return c.default}}),exports.Core=class{constructor(t){var e,n,r,o,i;this.plugins={},this.extraPlugins=[],this.initPlugins=[],this.commands={},this.ApplyHookType=lt,this.pluginMethods={},this.hooksByPluginId={},this.stage=ft.uninitialized,this.coreStage=ft,this.initConfig={},this.config={},this.watchConfig=null!==(e=t.watchConfig)&&void 0!==e?e:{changeLog:(t,e)=>{console.log(` ${t} `,e)},reloadLog:()=>{console.log("Try to restart...")}},this.cwd=null!==(n=t.cwd)&&void 0!==n?n:process.cwd(),this.internalPlugins=null!==(r=t.plugins)&&void 0!==r?r:[],this.babelRegister=null!==(o=t.babelRegister)&&void 0!==o?o:()=>{},this.applyAddHooks=t=>this.applyHooks(Object.assign(Object.assign({},t),{type:lt.add})),this.applyModifyHooks=t=>this.applyHooks(Object.assign(Object.assign({},t),{type:lt.modify})),this.applyEventHooks=t=>this.applyHooks(Object.assign(Object.assign({},t),{type:lt.event})),this.configInstance=new mt({possibleConfigName:null!==(i=t.possibleConfigName)&&void 0!==i?i:[],core:this}),this.initConfig=this.configInstance.getUserConfig(),this.ApiInstance=new xt({core:this}),this.registerLifeCycle()}registerLifeCycle(){this.ApiInstance.path="internal",jt.forEach((t=>{this.ApiInstance.registerMethod({name:t})}))}setStage(t){this.stage=t}init(){this.initPlugins=bt({plugins:this.internalPlugins,cwd:this.cwd}),this.babelRegister(ht(this.initPlugins.map((t=>pt(t.path))))),function(t){if(h.default.existsSync(t)){const e=Pt(h.default.readFileSync(t,"utf-8"));Object.keys(e).forEach((t=>{Object.prototype.hasOwnProperty.call(process.env,t)||(process.env[t]=e[t])}))}}(l.default.join(this.cwd,".env"))}applyHooks(t){var e;return dt(this,void 0,void 0,(function*(){const{add:n,modify:r,event:o}=this.ApplyHookType,{key:i,type:a,args:s}=t;let{initialValue:u}=t;if(a===n&&u&&!Array.isArray(u))throw new Error("when ApplyHooksType is `add`, initialValue must be an array");a===n&&void 0===u&&(u=[]);const c=null!==(e=this.hooksByPluginId[i])&&void 0!==e?e:[],f=new wt,l=t=>{f.tap(c.map((e=>({before:e.before,name:e.pluginId,stage:e.stage,fn:t(e)}))))};switch(a){case n:l((t=>e=>dt(this,void 0,void 0,(function*(){const n=yield t.fn(s);return e.concat(n)}))));break;case r:l((t=>e=>dt(this,void 0,void 0,(function*(){return t.fn(e,s)}))));break;case o:l((t=>()=>dt(this,void 0,void 0,(function*(){yield t.fn(s)}))));break;default:throw new Error(`applyPlugin failed, type is not defined or is not matched, got ${a}.`)}return f.tapCall(u)}))}readyPlugins(){return dt(this,void 0,void 0,(function*(){for(this.setStage(ft.init),this.extraPlugins=k(this.initPlugins),this.setStage(ft.initPlugins);this.extraPlugins.length;){const{path:t,apply:e}=this.extraPlugins.shift();this.ApiInstance.path=t;const n=new Proxy(this.ApiInstance,{get:(t,e)=>{var n;if("config"===e&&this.stage<ft.pluginReady&&console.warn("Cannot get config before plugin registration"),"ApiInstance"!==e)return null!==(n=this.pluginMethods[e])&&void 0!==n?n:this[e]?"function"==typeof this[e]?this[e].bind(this):this[e]:t[e]}});this.plugins[t]={path:t,apply:e};const r=yield e()(n);r&&Array.isArray(r.plugins)&&r.plugins.length&&(this.babelRegister(r.plugins),r.plugins.reverse().forEach((t=>{this.extraPlugins.unshift(vt(t))})))}this.setStage(ft.pluginReady),yield this.applyEventHooks({key:"onPluginReady"})}))}readyConfig(){return dt(this,void 0,void 0,(function*(){this.setStage(ft.getConfig),this.config=yield this.applyModifyHooks({key:"modifyConfig",initialValue:this.configInstance.getPluginConfig(this.initConfig)})}))}start(t){return dt(this,void 0,void 0,(function*(){const{args:e,command:n,reloadCommand:r}=t;this.args=t,r||(this.init(),yield this.readyPlugins(),yield this.readyConfig(),this.setStage(ft.start),yield this.applyEventHooks({key:"onStart",args:{args:e}}));const o=this.commands[n];return f.default(o,`start command failed, command "${n}" does not exists.`),o.fn({args:e})}))}reset(){["hooksByPluginId","pluginMethods","plugins","commands"].forEach((t=>{this[t]={}})),this.registerLifeCycle()}},exports.clonedeep=k,exports.isEqual=x,exports.isplainobject=O,exports.merge=S,exports.slash=pt,exports.uniq=ht;