@serverless-devs/s 2.0.94 → 2.0.95-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/clean/index.js +12 -12
- package/lib/cli/cli-manager.js +9 -9
- package/lib/cli/index.js +42 -42
- package/lib/component/index.js +81 -81
- package/lib/config/add/index.js +13 -13
- package/lib/config/delete/index.js +34 -34
- package/lib/config/get/index.js +20 -20
- package/lib/config/index.js +12 -12
- package/lib/core/command/command-manager.js +4 -4
- package/lib/core/component/hook.js +4 -4
- package/lib/core/component/index.js +9 -9
- package/lib/error/human-error.js +5 -5
- package/lib/error/human-warning.js +4 -4
- package/lib/error/index.js +9 -9
- package/lib/index.js +121 -101
- package/lib/init/index.js +97 -82
- package/lib/init/init-manager.js +11 -11
- package/lib/onboarding/index.js +5 -5
- package/lib/set/analysis/index.js +15 -15
- package/lib/set/index.js +12 -12
- package/lib/set/locale/index.js +26 -26
- package/lib/set/registry/index.js +26 -26
- package/lib/set/workspace/index.js +15 -15
- package/lib/specification/parse.js +10 -10
- package/lib/update-notifier/index.js +19 -19
- package/lib/utils/command-util.js +9 -9
- package/lib/utils/common.js +6 -6
- package/lib/utils/index.js +3 -3
- package/package.json +2 -2
- package/spec/zh/0.0.1/serverless_registry_model/2.overview_and_terminology.md +1 -1
- package/spec/zh/0.0.1/serverless_registry_model/3.registry_model.md +2 -2
- package/spec/zh/0.0.1/serverless_registry_model/5.design_principles.md +1 -1
- package/test/ci.sh +33 -0
- package/test/start-fc-http-nodejs12/code/index.js +47 -0
- package/test/start-fc-http-nodejs12/s.yaml +38 -0
package/lib/set/locale/index.js
CHANGED
|
@@ -32,38 +32,38 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
32
32
|
`:`;
|
|
33
33
|
`)+A+`return __p
|
|
34
34
|
}`;var W=hc(function(){return J(p,q+"return "+A).apply(i,g)});if(W.source=A,Lo(W))throw W;return W}function ny(e){return Q(e).toLowerCase()}function iy(e){return Q(e).toUpperCase()}function sy(e,t,s){if(e=Q(e),e&&(s||t===i))return wa(e);if(!e||!(t=ze(t)))return e;var l=ht(e),f=ht(t),p=ba(l,f),g=Ca(l,f)+1;return Qt(l,p,g).join("")}function oy(e,t,s){if(e=Q(e),e&&(s||t===i))return e.slice(0,xa(e)+1);if(!e||!(t=ze(t)))return e;var l=ht(e),f=Ca(l,ht(t))+1;return Qt(l,0,f).join("")}function uy(e,t,s){if(e=Q(e),e&&(s||t===i))return e.replace(Ps,"");if(!e||!(t=ze(t)))return e;var l=ht(e),f=ba(l,ht(t));return Qt(l,f).join("")}function ay(e,t){var s=It,l=rd;if(ae(t)){var f="separator"in t?t.separator:f;s="length"in t?G(t.length):s,l="omission"in t?ze(t.omission):l}e=Q(e);var p=e.length;if(Pr(e)){var g=ht(e);p=g.length}if(s>=p)return e;var y=s-Lr(l);if(y<1)return l;var w=g?Qt(g,0,y).join(""):e.slice(0,y);if(f===i)return w+l;if(g&&(y+=w.length-y),Do(f)){if(e.slice(y).search(f)){var x,O=w;for(f.global||(f=Xs(f.source,Q(Wu.exec(f))+"g")),f.lastIndex=0;x=f.exec(O);)var A=x.index;w=w.slice(0,A===i?y:A)}}else if(e.indexOf(ze(f),y)!=y){var T=w.lastIndexOf(f);T>-1&&(w=w.slice(0,T))}return w+l}function ly(e){return e=Q(e),e&&Ed.test(e)?e.replace(Hu,Mg):e}var cy=Mr(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),$o=pl("toUpperCase");function fc(e,t,s){return e=Q(e),t=s?i:t,t===i?Dg(e)?Ug(e):Sg(e):e.match(t)||[]}var hc=k(function(e,t){try{return Be(e,i,t)}catch(s){return Lo(s)?s:new j(s)}}),fy=qt(function(e,t){return Qe(t,function(s){s=Et(s),Dt(e,s,To(e[s],e))}),e});function hy(e){var t=e==null?0:e.length,s=$();return e=t?ue(e,function(l){if(typeof l[1]!="function")throw new et(a);return[s(l[0]),l[1]]}):[],k(function(l){for(var f=-1;++f<t;){var p=e[f];if(Be(p[0],this,l))return Be(p[1],this,l)}})}function py(e){return Mm(rt(e,c))}function Fo(e){return function(){return e}}function dy(e,t){return e==null||e!==e?t:e}var gy=gl(),my=gl(!0);function Ue(e){return e}function Mo(e){return ka(typeof e=="function"?e:rt(e,c))}function vy(e){return Va(rt(e,c))}function _y(e,t){return Xa(e,rt(t,c))}var yy=k(function(e,t){return function(s){return En(s,e,t)}}),Ey=k(function(e,t){return function(s){return En(e,s,t)}});function jo(e,t,s){var l=ye(t),f=xi(t,l);s==null&&!(ae(t)&&(f.length||!l.length))&&(s=t,t=e,e=this,f=xi(t,ye(t)));var p=!(ae(s)&&"chain"in s)||!!s.chain,g=Ft(e);return Qe(f,function(y){var w=t[y];e[y]=w,g&&(e.prototype[y]=function(){var x=this.__chain__;if(p||x){var O=e(this.__wrapped__),A=O.__actions__=Me(this.__actions__);return A.push({func:w,args:arguments,thisArg:e}),O.__chain__=x,O}return w.apply(e,zt([this.value()],arguments))})}),e}function wy(){return _e._===this&&(_e._=Vg),this}function Ho(){}function by(e){return e=G(e),k(function(t){return Ya(t,e)})}var Cy=vo(ue),Sy=vo(ma),xy=vo(Us);function pc(e){return So(e)?Gs(Et(e)):tv(e)}function Oy(e){return function(t){return e==null?i:cr(e,t)}}var Ay=vl(),Ry=vl(!0);function Uo(){return[]}function Go(){return!1}function Iy(){return{}}function Ty(){return""}function Py(){return!0}function Ly(e,t){if(e=G(e),e<1||e>Bt)return[];var s=vt,l=Oe(e,vt);t=$(t),e-=vt;for(var f=ks(l,t);++s<e;)t(s);return f}function Dy(e){return H(e)?ue(e,Et):Ve(e)?[e]:Me(Dl(Q(e)))}function Ny(e){var t=++kg;return Q(e)+t}var qy=Pi(function(e,t){return e+t},0),$y=_o("ceil"),Fy=Pi(function(e,t){return e/t},1),My=_o("floor");function jy(e){return e&&e.length?Si(e,Ue,ro):i}function Hy(e,t){return e&&e.length?Si(e,$(t,2),ro):i}function Uy(e){return ya(e,Ue)}function Gy(e,t){return ya(e,$(t,2))}function Wy(e){return e&&e.length?Si(e,Ue,oo):i}function By(e,t){return e&&e.length?Si(e,$(t,2),oo):i}var ky=Pi(function(e,t){return e*t},1),zy=_o("round"),Vy=Pi(function(e,t){return e-t},0);function Xy(e){return e&&e.length?Bs(e,Ue):0}function Yy(e,t){return e&&e.length?Bs(e,$(t,2)):0}return h.after=v0,h.ary=Bl,h.assign=i1,h.assignIn=ic,h.assignInWith=Bi,h.assignWith=s1,h.at=o1,h.before=kl,h.bind=To,h.bindAll=fy,h.bindKey=zl,h.castArray=I0,h.chain=Ul,h.chunk=Mv,h.compact=jv,h.concat=Hv,h.cond=hy,h.conforms=py,h.constant=Fo,h.countBy=X_,h.create=u1,h.curry=Vl,h.curryRight=Xl,h.debounce=Yl,h.defaults=a1,h.defaultsDeep=l1,h.defer=_0,h.delay=y0,h.difference=Uv,h.differenceBy=Gv,h.differenceWith=Wv,h.drop=Bv,h.dropRight=kv,h.dropRightWhile=zv,h.dropWhile=Vv,h.fill=Xv,h.filter=K_,h.flatMap=Q_,h.flatMapDeep=e0,h.flatMapDepth=t0,h.flatten=Fl,h.flattenDeep=Yv,h.flattenDepth=Kv,h.flip=E0,h.flow=gy,h.flowRight=my,h.fromPairs=Zv,h.functions=m1,h.functionsIn=v1,h.groupBy=r0,h.initial=Qv,h.intersection=e_,h.intersectionBy=t_,h.intersectionWith=r_,h.invert=y1,h.invertBy=E1,h.invokeMap=i0,h.iteratee=Mo,h.keyBy=s0,h.keys=ye,h.keysIn=He,h.map=Mi,h.mapKeys=b1,h.mapValues=C1,h.matches=vy,h.matchesProperty=_y,h.memoize=Hi,h.merge=S1,h.mergeWith=sc,h.method=yy,h.methodOf=Ey,h.mixin=jo,h.negate=Ui,h.nthArg=by,h.omit=x1,h.omitBy=O1,h.once=w0,h.orderBy=o0,h.over=Cy,h.overArgs=b0,h.overEvery=Sy,h.overSome=xy,h.partial=Po,h.partialRight=Kl,h.partition=u0,h.pick=A1,h.pickBy=oc,h.property=pc,h.propertyOf=Oy,h.pull=o_,h.pullAll=jl,h.pullAllBy=u_,h.pullAllWith=a_,h.pullAt=l_,h.range=Ay,h.rangeRight=Ry,h.rearg=C0,h.reject=c0,h.remove=c_,h.rest=S0,h.reverse=Ro,h.sampleSize=h0,h.set=I1,h.setWith=T1,h.shuffle=p0,h.slice=f_,h.sortBy=m0,h.sortedUniq=__,h.sortedUniqBy=y_,h.split=Q1,h.spread=x0,h.tail=E_,h.take=w_,h.takeRight=b_,h.takeRightWhile=C_,h.takeWhile=S_,h.tap=j_,h.throttle=O0,h.thru=Fi,h.toArray=tc,h.toPairs=uc,h.toPairsIn=ac,h.toPath=Dy,h.toPlainObject=nc,h.transform=P1,h.unary=A0,h.union=x_,h.unionBy=O_,h.unionWith=A_,h.uniq=R_,h.uniqBy=I_,h.uniqWith=T_,h.unset=L1,h.unzip=Io,h.unzipWith=Hl,h.update=D1,h.updateWith=N1,h.values=Ur,h.valuesIn=q1,h.without=P_,h.words=fc,h.wrap=R0,h.xor=L_,h.xorBy=D_,h.xorWith=N_,h.zip=q_,h.zipObject=$_,h.zipObjectDeep=F_,h.zipWith=M_,h.entries=uc,h.entriesIn=ac,h.extend=ic,h.extendWith=Bi,jo(h,h),h.add=qy,h.attempt=hc,h.camelCase=j1,h.capitalize=lc,h.ceil=$y,h.clamp=$1,h.clone=T0,h.cloneDeep=L0,h.cloneDeepWith=D0,h.cloneWith=P0,h.conformsTo=N0,h.deburr=cc,h.defaultTo=dy,h.divide=Fy,h.endsWith=H1,h.eq=dt,h.escape=U1,h.escapeRegExp=G1,h.every=Y_,h.find=Z_,h.findIndex=ql,h.findKey=c1,h.findLast=J_,h.findLastIndex=$l,h.findLastKey=f1,h.floor=My,h.forEach=Gl,h.forEachRight=Wl,h.forIn=h1,h.forInRight=p1,h.forOwn=d1,h.forOwnRight=g1,h.get=No,h.gt=q0,h.gte=$0,h.has=_1,h.hasIn=qo,h.head=Ml,h.identity=Ue,h.includes=n0,h.indexOf=Jv,h.inRange=F1,h.invoke=w1,h.isArguments=pr,h.isArray=H,h.isArrayBuffer=F0,h.isArrayLike=je,h.isArrayLikeObject=ce,h.isBoolean=M0,h.isBuffer=er,h.isDate=j0,h.isElement=H0,h.isEmpty=U0,h.isEqual=G0,h.isEqualWith=W0,h.isError=Lo,h.isFinite=B0,h.isFunction=Ft,h.isInteger=Zl,h.isLength=Gi,h.isMap=Jl,h.isMatch=k0,h.isMatchWith=z0,h.isNaN=V0,h.isNative=X0,h.isNil=K0,h.isNull=Y0,h.isNumber=Ql,h.isObject=ae,h.isObjectLike=le,h.isPlainObject=On,h.isRegExp=Do,h.isSafeInteger=Z0,h.isSet=ec,h.isString=Wi,h.isSymbol=Ve,h.isTypedArray=Hr,h.isUndefined=J0,h.isWeakMap=Q0,h.isWeakSet=e1,h.join=n_,h.kebabCase=W1,h.last=it,h.lastIndexOf=i_,h.lowerCase=B1,h.lowerFirst=k1,h.lt=t1,h.lte=r1,h.max=jy,h.maxBy=Hy,h.mean=Uy,h.meanBy=Gy,h.min=Wy,h.minBy=By,h.stubArray=Uo,h.stubFalse=Go,h.stubObject=Iy,h.stubString=Ty,h.stubTrue=Py,h.multiply=ky,h.nth=s_,h.noConflict=wy,h.noop=Ho,h.now=ji,h.pad=z1,h.padEnd=V1,h.padStart=X1,h.parseInt=Y1,h.random=M1,h.reduce=a0,h.reduceRight=l0,h.repeat=K1,h.replace=Z1,h.result=R1,h.round=zy,h.runInContext=E,h.sample=f0,h.size=d0,h.snakeCase=J1,h.some=g0,h.sortedIndex=h_,h.sortedIndexBy=p_,h.sortedIndexOf=d_,h.sortedLastIndex=g_,h.sortedLastIndexBy=m_,h.sortedLastIndexOf=v_,h.startCase=ey,h.startsWith=ty,h.subtract=Vy,h.sum=Xy,h.sumBy=Yy,h.template=ry,h.times=Ly,h.toFinite=Mt,h.toInteger=G,h.toLength=rc,h.toLower=ny,h.toNumber=st,h.toSafeInteger=n1,h.toString=Q,h.toUpper=iy,h.trim=sy,h.trimEnd=oy,h.trimStart=uy,h.truncate=ay,h.unescape=ly,h.uniqueId=Ny,h.upperCase=cy,h.upperFirst=$o,h.each=Gl,h.eachRight=Wl,h.first=Ml,jo(h,function(){var e={};return _t(h,function(t,s){ee.call(h.prototype,s)||(e[s]=t)}),e}(),{chain:!1}),h.VERSION=r,Qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){h[e].placeholder=h}),Qe(["drop","take"],function(e,t){V.prototype[e]=function(s){s=s===i?1:me(G(s),0);var l=this.__filtered__&&!t?new V(this):this.clone();return l.__filtered__?l.__takeCount__=Oe(s,l.__takeCount__):l.__views__.push({size:Oe(s,vt),type:e+(l.__dir__<0?"Right":"")}),l},V.prototype[e+"Right"]=function(s){return this.reverse()[e](s).reverse()}}),Qe(["filter","map","takeWhile"],function(e,t){var s=t+1,l=s==Fu||s==od;V.prototype[e]=function(f){var p=this.clone();return p.__iteratees__.push({iteratee:$(f,3),type:s}),p.__filtered__=p.__filtered__||l,p}}),Qe(["head","last"],function(e,t){var s="take"+(t?"Right":"");V.prototype[e]=function(){return this[s](1).value()[0]}}),Qe(["initial","tail"],function(e,t){var s="drop"+(t?"":"Right");V.prototype[e]=function(){return this.__filtered__?new V(this):this[s](1)}}),V.prototype.compact=function(){return this.filter(Ue)},V.prototype.find=function(e){return this.filter(e).head()},V.prototype.findLast=function(e){return this.reverse().find(e)},V.prototype.invokeMap=k(function(e,t){return typeof e=="function"?new V(this):this.map(function(s){return En(s,e,t)})}),V.prototype.reject=function(e){return this.filter(Ui($(e)))},V.prototype.slice=function(e,t){e=G(e);var s=this;return s.__filtered__&&(e>0||t<0)?new V(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==i&&(t=G(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},V.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},V.prototype.toArray=function(){return this.take(vt)},_t(V.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),l=/^(?:head|last)$/.test(t),f=h[l?"take"+(t=="last"?"Right":""):t],p=l||/^find/.test(t);!f||(h.prototype[t]=function(){var g=this.__wrapped__,y=l?[1]:arguments,w=g instanceof V,x=y[0],O=w||H(g),A=function(z){var X=f.apply(h,zt([z],y));return l&&T?X[0]:X};O&&s&&typeof x=="function"&&x.length!=1&&(w=O=!1);var T=this.__chain__,q=!!this.__actions__.length,F=p&&!T,W=w&&!q;if(!p&&O){g=W?g:new V(this);var M=e.apply(g,y);return M.__actions__.push({func:Fi,args:[A],thisArg:i}),new tt(M,T)}return F&&W?e.apply(this,y):(M=this.thru(A),F?l?M.value()[0]:M.value():M)})}),Qe(["pop","push","shift","sort","splice","unshift"],function(e){var t=li[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",l=/^(?:pop|shift)$/.test(e);h.prototype[e]=function(){var f=arguments;if(l&&!this.__chain__){var p=this.value();return t.apply(H(p)?p:[],f)}return this[s](function(g){return t.apply(H(g)?g:[],f)})}}),_t(V.prototype,function(e,t){var s=h[t];if(s){var l=s.name+"";ee.call(qr,l)||(qr[l]=[]),qr[l].push({name:t,func:s})}}),qr[Ti(i,oe).name]=[{name:"wrapper",func:i}],V.prototype.clone=lm,V.prototype.reverse=cm,V.prototype.value=fm,h.prototype.at=H_,h.prototype.chain=U_,h.prototype.commit=G_,h.prototype.next=W_,h.prototype.plant=k_,h.prototype.reverse=z_,h.prototype.toJSON=h.prototype.valueOf=h.prototype.value=V_,h.prototype.first=h.prototype.head,pn&&(h.prototype[pn]=B_),h},Xt=Gg();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(_e._=Xt,define(function(){return Xt})):sr?((sr.exports=Xt)._=Xt,Fs._=Xt):_e._=Xt}).call(kr)});var us=I(Gt=>{"use strict";var xh=Gt&&Gt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Gt,"__esModule",{value:!0});Gt.getHistoryFile=Gt.getHomeDir=void 0;var lb=xh(require("path")),Oh=xh(Te()),os=Oh.default.fse,cb=Oh.default.getRootHome;function ou(){var i=cb();return os.existsSync(i)||os.mkdirSync(i),i}Gt.getHomeDir=ou;function Ah(){var i=lb.default.join(ou(),"history");return os.existsSync(i)||os.createFileSync(i),i}Gt.getHistoryFile=Ah;Gt.default={getHomeDir:ou,getHistoryFile:Ah}});var ls=I($e=>{"use strict";var fb=$e&&$e.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},hb=$e&&$e.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},uu=$e&&$e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($e,"__esModule",{value:!0});$e.handlerProfileFile=$e.getConfig=$e.setConfig=void 0;var Rh=uu(require("path")),pb=uu(us()),au=uu(Te()),wt=au.default.fse,as=au.default.jsyaml,Ih=au.default.getRootHome;function db(i){var r=Ph();wt.writeFileSync(r,as.dump(i))}function Th(){var i=Ph();if(!wt.existsSync(i))return{};try{var r=as.load(wt.readFileSync(i,"utf8"))||{};return r}catch(n){throw n}}function Ph(){var i=Rh.default.join(pb.default.getHomeDir(),"set-config.yml");return wt.existsSync(i)||wt.createFileSync(i),i}function Lh(i,r){var n=Th();n[i]=r,db(n)}$e.setConfig=Lh;function Dh(i,r){var n=Th();return n[i]||r}$e.getConfig=Dh;function Nh(i){return fb(this,void 0,void 0,function(){var r,n,o,a,u,d,m;return hb(this,function(_){switch(_.label){case 0:if(r=i.filePath||"set-config.yml",n=Rh.default.join(Ih(),r),o=wt.existsSync(n),a={},o)return[3,5];u=Ih(),_.label=1;case 1:return _.trys.push([1,2,,4]),wt.statSync(u),[3,4];case 2:return d=_.sent(),[4,wt.mkdirSync(u)];case 3:return _.sent(),[3,4];case 4:return[3,6];case 5:try{a=as.load(wt.readFileSync(n,"utf8"))||{}}catch(c){throw c}_.label=6;case 6:return i.read?[2,a]:(m=i.configKey||"",a[m]=i.data,[4,wt.writeFileSync(n,as.dump(a))]);case 7:return _.sent(),[2,a]}})})}$e.handlerProfileFile=Nh;$e.default={setConfig:Lh,getConfig:Dh,handlerProfileFile:Nh}});var br=I(zr=>{"use strict";var gb=zr&&zr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(zr,"__esModule",{value:!0});zr.ServerlessError=void 0;var mb=gb(Te()),vb=mb.default.Logger,_b=new vb("S-CLI-ERROR"),yb=function(){function i(r,n,o){_b.error(r+": "+n,o),process.exit(1)}return i}();zr.ServerlessError=yb});var qh=I(Vr=>{"use strict";var Eb=Vr&&Vr.__extends||function(){var i=function(r,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])},i(r,n)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");i(r,n);function o(){this.constructor=r}r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.CommandError=void 0;var wb=br(),bb=function(i){Eb(r,i);function r(n,o){return i.call(this,"Error",n,o)||this}return r}(wb.ServerlessError);Vr.CommandError=bb});var $h=I(Xr=>{"use strict";var Cb=Xr&&Xr.__extends||function(){var i=function(r,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])},i(r,n)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");i(r,n);function o(){this.constructor=r}r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ConfigDeleteError=void 0;var Sb=br(),xb=function(i){Cb(r,i);function r(n,o){return i.call(this,"Deletion failed",n,o)||this}return r}(Sb.ServerlessError);Xr.ConfigDeleteError=xb});var Fh=I(Yr=>{"use strict";var Ob=Yr&&Yr.__extends||function(){var i=function(r,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])},i(r,n)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");i(r,n);function o(){this.constructor=r}r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.ConfigError=void 0;var Ab=br(),Rb=function(i){Ob(r,i);function r(n,o){return i.call(this,"Config failed",n,o)||this}return r}(Ab.ServerlessError);Yr.ConfigError=Rb});var Mh=I(Kr=>{"use strict";var Ib=Kr&&Kr.__extends||function(){var i=function(r,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])},i(r,n)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");i(r,n);function o(){this.constructor=r}r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.ConfigGetError=void 0;var Tb=br(),Pb=function(i){Ib(r,i);function r(n,o){return i.call(this,"Get failed",n,o)||this}return r}(Tb.ServerlessError);Kr.ConfigGetError=Pb});var jh=I(Zr=>{"use strict";var Lb=Zr&&Zr.__extends||function(){var i=function(r,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,a){o.__proto__=a}||function(o,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(o[u]=a[u])},i(r,n)};return function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");i(r,n);function o(){this.constructor=r}r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.InitError=void 0;var Db=br(),Nb=function(i){Lb(r,i);function r(n,o){return i.call(this,"Initialization failed",n,o)||this}return r}(Db.ServerlessError);Zr.InitError=Nb});var Uh=I(bt=>{"use strict";var qb=bt&&bt.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},$b=bt&&bt.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Fb=bt&&bt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(bt,"__esModule",{value:!0});bt.HumanError=void 0;var Hh=Fb(Te()),Mb=rr(),jb=Hh.default.colors,Hb=function(){function i(r){var n=r.errorMessage,o=r.tips;this.errorMessage=n,console.log(`
|
|
35
|
-
|
|
36
|
-
`)
|
|
37
|
-
`)
|
|
38
|
-
|
|
39
|
-
`)
|
|
40
|
-
`)
|
|
41
|
-
`))
|
|
42
|
-
`)),console.log(
|
|
43
|
-
|
|
44
|
-
`)
|
|
45
|
-
`))}return i.prototype.report=function(r){return Bb(this,void 0,void 0,function(){return kb(this,function(n){return Xb({type:"jsError",content:"".concat(r.message,"||").concat(r.stack),traceId:this.traceId}),[2]})})},i}();ie.HandleError=sC});var Bh=I((Gx,oC)=>{oC.exports={name:"@serverless-devs/s",version:"2.0.94",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"MIT",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{prewatch:"rm -rf lib/* && cp -r ./src/daemon ./lib",watch:"tsc -w",test:"npx jest",prebuild:"rm -rf lib",build:"tsc && cp -r ./src/daemon ./lib",postbuild:"./shell/postbuild.sh","test:cov":"jest --coverage",lint:"npm run typecheck && f2elint scan -i src",fix:"f2elint fix",typecheck:"npx tsc -p tsconfig.json --noEmit",update:"rm -rf yarn.lock && rm -rf package-lock.json && rm -rf node_modules && yarn",beta:"npm publish --tag=beta"},main:"./lib/index.js",bin:{s:"bin/s"},devDependencies:{"@types/jest":"^27.0.1","@types/lodash":"^4.14.168","@types/node":"^14.0.23","@typescript-eslint/eslint-plugin":"^4.14.1","@typescript-eslint/parser":"^4.14.1","babel-eslint":"^10.1.0",boxen:"^5.0.0",commander:"^6.0.0",dotenv:"^10.0.0",esbuild:"^0.13.6",eslint:"^7.7.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.1","eslint-plugin-prettier":"^3.1.2",husky:"^4.2.3",inquirer:"^8.2.0","inquirer-autocomplete-prompt":"^1.3.0",jest:"^27.1.0","latest-version":"^5.1.0","lint-staged":"^10.0.8",lodash:"^4.17.20","os-locale":"5.0.0",prettier:"^2.2.1",semver:"^7.3.5","semver-diff":"^3.1.1","ts-jest":"^27.0.1","ts-node":"^9.1.1","tty-table":"^4.1.5",typescript:"^4.1.3"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"},jest:{coverageDirectory:"coverage",testEnvironment:"node",coverageProvider:"v8",preset:"ts-jest",testMatch:["**/test/**/*test.[jt]s"],setupFilesAfterEnv:["./jest.setup.ts"]},dependencies:{"@serverless-devs/core":"latest"}}});var rr=I(U=>{"use strict";var uC=U&&U.__createBinding||(Object.create?function(i,r,n,o){o===void 0&&(o=n),Object.defineProperty(i,o,{enumerable:!0,get:function(){return r[n]}})}:function(i,r,n,o){o===void 0&&(o=n),i[o]=r[n]}),aC=U&&U.__setModuleDefault||(Object.create?function(i,r){Object.defineProperty(i,"default",{enumerable:!0,value:r})}:function(i,r){i.default=r}),lC=U&&U.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(i!=null)for(var n in i)n!=="default"&&Object.prototype.hasOwnProperty.call(i,n)&&uC(r,i,n);return aC(r,i),r},kh=U&&U.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},zh=U&&U.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},cs=U&&U.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(U,"__esModule",{value:!0});U.emoji=U.mark=U.replaceTemplate=U.getTemplatekey=U.replaceFun=U.getLang=U.printn=U.checkTemplateFile=U.checkAndReturnTemplateFile=U.yamlLoad=U.getFolderSize=U.getVersion=U.bgRed=U.red=void 0;var we=cs(require("path")),Ke=cs(require("fs")),hu=cs(ss()),cC=cs(require("os")),fC=Qr(),fs=lC(Te()),pu=fs.default.colors,hC=fs.default.jsyaml,hs=Bh();U.red=pu.hex("#fd5750");U.bgRed=pu.hex("#000").bgHex("#fd5750");function pC(){return(0,fs.getCoreVersion)()?"".concat(hs.name,": ").concat(hs.version,", @serverless-devs/core: ").concat((0,fs.getCoreVersion)(),", ").concat(process.platform,"-").concat(process.arch,", node-").concat(process.version):"".concat(hs.name,": ").concat(hs.version,", ").concat(process.platform,"-").concat(process.arch,", node-").concat(process.version)}U.getVersion=pC;function dC(i){return kh(this,void 0,void 0,function(){function r(a){return kh(this,void 0,void 0,function(){var u,d;return zh(this,function(m){switch(m.label){case 0:return u=Ke.default.lstatSync(a),typeof u!="object"?[2]:(n.set(u.ino,u.size),u.isDirectory()?(d=Ke.default.readdirSync(a),typeof d!="object"?[2]:[4,Promise.all(d.map(function(_){return r(we.default.join(a,_))}))]):[3,2]);case 1:m.sent(),m.label=2;case 2:return[2]}})})}var n,o;return zh(this,function(a){switch(a.label){case 0:return n=new Map,[4,r(i)];case 1:return a.sent(),o=Array.from(n.values()).reduce(function(u,d){return u+d},0),[2,o]}})})}U.getFolderSize=dC;function Vh(i){var r=Ke.default.readFileSync(i,"utf8");try{return hC.load(r)}catch{if(["-h","--help"].includes(process.argv[2]))return;var n=we.default.basename(i);new fC.HumanError({errorMessage:"".concat(n," format is incorrect"),tips:"Please check the configuration of ".concat(n,", Serverless Devs' Yaml specification document can refer to\uFF1A").concat(pu.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/yaml.md"))}),process.exit(1)}}U.yamlLoad=Vh;function Gn(i,r){r===void 0&&(r=!1);var n=Ke.default.readFileSync(i,"utf8"),o=r?JSON.parse(n):Vh(i);if(!o)return!1;for(var a in o)if(o[a].Component&&o[a].Provider&&o[a].Properties)return!0;return o.hasOwnProperty("edition")}function Xh(){if(process.env.serverless_devs_temp_template)return process.env.serverless_devs_temp_template;var i=process.cwd(),r=process.argv.includes("-t")?"-t":process.argv.includes("--template")?"--template":null,n=r?process.argv.indexOf(r):-1;if(n!==-1){var o=n+1,a=process.argv[o];if(a&&(a.endsWith(".yaml")||a.endsWith(".yml")||a.endsWith(".json"))){var u=!!a.endsWith(".json");if(Ke.default.existsSync(we.default.join(i,a))&&Gn(we.default.join(i,a),u)){process.argv.splice(n,2);var d=JSON.parse(process.env.serverless_devs_temp_argv);return d.splice(d.indexOf(r),2),process.env.serverless_devs_temp_argv=JSON.stringify(d),process.env.serverless_devs_temp_template=we.default.join(i,a),we.default.join(i,a)}else if(Ke.default.existsSync(a)&&Gn(a,u)){process.argv.splice(n,2);var d=JSON.parse(process.env.serverless_devs_temp_argv);return d.splice(d.indexOf(r),2),process.env.serverless_devs_temp_argv=JSON.stringify(d),process.env.serverless_devs_temp_template=a,a}}}return Ke.default.existsSync(we.default.join(i,"s.yaml"))&&Gn(we.default.join(i,"s.yaml"))?(process.env.serverless_devs_temp_template=we.default.join(i,"s.yaml"),we.default.join(i,"s.yaml")):Ke.default.existsSync(we.default.join(i,"s.yml"))&&Gn(we.default.join(i,"s.yml"))?(process.env.serverless_devs_temp_template=we.default.join(i,"s.yml"),we.default.join(i,"s.yml")):Ke.default.existsSync(we.default.join(i,"s.json"))&&Gn(we.default.join(i,"s.json"),!0)?(process.env.serverless_devs_temp_template=we.default.join(i,"s.json"),we.default.join(i,"s.json")):null}U.checkAndReturnTemplateFile=Xh;function Yh(i){return Ke.default.existsSync(i)?i:null}U.checkTemplateFile=Yh;function Kh(i,r){r===void 0&&(r=" ");for(var n="",o=0;o<i;o++)n=n+r;return n}U.printn=Kh;function Zh(){return"en"}U.getLang=Zh;function du(i,r){var n=/\{\{(.*?)\}\}/g,o=i.match(n);if(o)for(var a=0;a<o.length;a++){var u=o[a].replace(/{{|}}/g,""),d=hu.default.trim(u.split("|")[0]);r[d]&&(i=i.replace(o[a],r[d]))}return i}U.replaceFun=du;function Jh(i){var r=/\{\{(.*?)\}\}/g,n=i.match(r);return n?n.filter(function(o){return o}).map(function(o){var a=o.replace(/{{|}}/g,""),u=a.split("|");return{name:hu.default.trim(u[0]),desc:hu.default.trim(u[1])}}):[]}U.getTemplatekey=Jh;function Qh(i,r){i.forEach(function(n){if(Ke.default.existsSync(n)){var o=Ke.default.readFileSync(n,"utf-8"),a=du(o,r);Ke.default.writeFileSync(n,a,"utf-8")}})}U.replaceTemplate=Qh;function ep(i){if(!i)return i;var r=i.slice(-4);return"***********".concat(r)}U.mark=ep;function gC(i){return cC.default.platform()==="win32"?"":i}U.emoji=gC;U.default={checkAndReturnTemplateFile:Xh,checkTemplateFile:Yh,printn:Kh,mark:ep,getLang:Zh,replaceTemplate:Qh,replaceFun:du,getTemplatekey:Jh}});var sp=I(Ze=>{"use strict";var mC=Ze&&Ze.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extractTemplateInfo=Ze.isUrlFormat=Ze.getProjectNameFromUrl=Ze.parse=void 0;var vC=mC(require("url"));function tp(i){return vC.default.parse(i)}Ze.parse=tp;function rp(i){var r=i.lastIndexOf("/");return r&&r>=0&&(i=i.substr(r+1)),i.endsWith(".git")?i.substr(0,i.length-4):i}Ze.getProjectNameFromUrl=rp;function np(i){return i.includes(":")||i.includes("/")}Ze.isUrlFormat=np;function ip(i){var r=i.pathname||"",n=r.split("/"),o=n[1],a=n[3];return{host:i.host,ownerName:o,repoName:a,branch:"",hasSubPath:!1,subPath:"",zipFile:""}}Ze.extractTemplateInfo=ip;Ze.default={extractTemplateInfo:ip,getProjectNameFromUrl:rp,isUrlFormat:np,parse:tp}});var ps=I(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getServiceList=Fe.getServiceActions=Fe.getServiceInputs=Fe.getServiceConfigDetail=Fe.getServiceConfig=Fe.getSubcommand=void 0;function op(i){var r=i.edition||"0.0.1";if(r==="0.0.1")return Object.keys(i).filter(function(o){return o!=="Global"});var n=i.services||{};return Object.keys(n)}Fe.getSubcommand=op;function up(i,r){var n=i.edition||"0.0.1";if(n==="0.0.1")return i[r];var o=i.services||{},a=o[r],u=a.provider?a.provider:i.provider,d=a.access?a.access:i.access,m=Object.assign({},a,{access:d,provider:u});return m}Fe.getServiceConfig=up;function ap(i){var r=i.Component||i.component,n=i.Provider||i.provider,o=i.Access||i.access||"default",a=i.autoCredential;return{name:r,provider:n,access:o,autoCredential:a}}Fe.getServiceConfigDetail=ap;function lp(i,r,n){if(r==="0.0.1"){var o=i.Properties,a=i.Params,u=i.Provider,d=i.Access,m=i.Component,_=i.ProjectName,c=n.credentials,v=n.method,C={Properties:o,Credentials:c,Project:{ProjectName:_,Component:m,Provider:u,AccessAlias:d||""},Command:v,Args:a||"",Path:{ConfigPath:process.env.templateFile||""}};return C}var R=i.props,P=i.params,Z=i.provider,oe=i.access,be=i.component,Y=i.ProjectName,lt=i.appName,ve=n.credentials,pe=n.method,xe={props:R,Properties:R,Credentials:ve,credentials:ve,appName:lt,Project:{ProjectName:Y,projectName:Y,component:be,Component:be,provider:Z,Provider:Z,accessAlias:oe||"",AccessAlias:oe||""},project:{component:be,access:oe||"",projectName:Y},command:pe,Command:pe,args:P||"",Args:P||"",argsObj:process.temp_params||[],ArgsObj:process.temp_params||[],path:{configPath:process.env.templateFile||""},Path:{ConfigPath:process.env.templateFile||""}};return xe}Fe.getServiceInputs=lp;function cp(i,r,n){var o=n.method;if(r==="0.0.1"){var a=i.Extends,u=a===void 0?{}:a,d=u[o];return d}var m=i.actions,_=m===void 0?{}:m,c=[];return Object.keys(_).forEach(function(v){var C=v.split("-"),R=_[v];if(C.length>1){var P=C[1];if(P===o){var Z=C[0];R.forEach(function(oe){var be={Hook:oe.run,Path:oe.path,Pre:Z==="pre"};c.push(be)})}}else v===o&&R.forEach(function(oe){var be={Hook:oe.run,Path:oe.path,Pre:!1};c.push(be)})}),c}Fe.getServiceActions=cp;function fp(i){var r=i.edition||"0.0.1";return r==="0.0.1"?i:i.services}Fe.getServiceList=fp;Fe.default={getSubcommand:op,getServiceConfig:up,getServiceConfigDetail:ap,getServiceInputs:lp,getServiceActions:cp,getServiceList:fp}});var _p=I(Pe=>{"use strict";var _C=Pe&&Pe.__createBinding||(Object.create?function(i,r,n,o){o===void 0&&(o=n),Object.defineProperty(i,o,{enumerable:!0,get:function(){return r[n]}})}:function(i,r,n,o){o===void 0&&(o=n),i[o]=r[n]}),yC=Pe&&Pe.__setModuleDefault||(Object.create?function(i,r){Object.defineProperty(i,"default",{enumerable:!0,value:r})}:function(i,r){i.default=r}),hp=Pe&&Pe.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(i!=null)for(var n in i)n!=="default"&&Object.prototype.hasOwnProperty.call(i,n)&&_C(r,i,n);return yC(r,i),r},pp=Pe&&Pe.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},dp=Pe&&Pe.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},EC=Pe&&Pe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.Parse=void 0;var gu=hp(require("fs")),gp=hp(require("path")),wC=ps(),bC=Qr(),mp=ss(),CC=EC(Te()),SC=CC.default.jsyaml,xC=ss(),vp=new RegExp(/\$\{(.*)\}/,"i"),OC=new RegExp(/(.*)\((.*)\)/,"i"),AC=["[object Number]","[object Boolean]"],RC=function(){function i(r){if(this.path=r,this.parsedObj={},this.dependenciesMap={},this.globalJsonKeyMap={},this.globalKeyArr=[],this.magicVariablesArray=[],gu.existsSync(r))try{this.init(r)}catch(n){throw new Error(n.message)}}return i.prototype.getFileObj=function(r){var n={};try{var o=gp.extname(r);(o.indexOf(".yaml")!==-1||o.indexOf(".yml")!==-1)&&(n=SC.load(gu.readFileSync(r,"utf8"))),o.indexOf(".json")!==-1&&(n=JSON.parse(gu.readFileSync(r).toString()))}catch(a){new bC.HandleError({error:a}).report(a).then(function(){return process.exit(1)})}return n},i.prototype.init=function(r){return pp(this,void 0,void 0,function(){return dp(this,function(n){return this.parsedObj=this.getFileObj(r),[2]})})},i.prototype.getOriginalParsedObj=function(){return this.parsedObj},i.prototype.findVariableValue=function(r){var n=r.variableName,o=r.type,a=r.funName,u=r.funVariable,d="";return o==="Literal"?this.globalJsonKeyMap[n]||this.globalJsonKeyMap["services.".concat(n)]||"${"+n+"}":o==="Fun"&&(a==="Env"||a==="env")?process.env[u]:o==="Fun"&&(a==="Path"||a==="path")?gp.join(process.cwd(),u):o==="Fun"&&(a==="File"||a==="file")?this.getFileObj(u):d},i.prototype.generateMagicVariables=function(r,n,o){var a=this;return n===void 0&&(n=[]),o===void 0&&(o=""),Object.prototype.toString.call(r)==="[object Object]"?(o!==""&&(o="".concat(o,".")),Object.keys(r).map(function(u){var d="".concat(o).concat(u),m=r[u];n.push(d),n.concat(a.generateMagicVariables(m,n,"".concat(d))),a.globalJsonKeyMap[d]=m})):Object.prototype.toString.call(r)==="[object Array]"?r.forEach(function(u,d){var m="".concat(o,"[").concat(d,"]"),_="".concat(o,"[").concat(d-r.length,"]");n.push(m),n.push(_),n.concat(a.generateMagicVariables(u,n,"".concat(m))),n.concat(a.generateMagicVariables(u,n,"".concat(_))),a.globalJsonKeyMap[m]=u,a.globalJsonKeyMap[_]=u}):n=[],n},i.prototype.isProjectProperties=function(r,n){var o=!1;return n==="Properties"&&this.globalJsonKeyMap["".concat(r,".").concat(n)]&&(o=!0),o},i.prototype.iteratorToSetValue=function(r,n,o){var a=this;if(AC.includes(Object.prototype.toString.call(r)))return r;if(Object.prototype.toString.call(r)==="[object String]"){var u=r.match(vp);if(u){var d=u[1],m={variableName:d,type:"Literal",funName:null,funVariable:""},_=d.match(OC);if(_)m.funName=_[1],m.funVariable=_[2],m.type="Fun";else{var c=this.dependenciesMap[n];c||(c={});var v=d.split(".")[0];c[v]=1,this.dependenciesMap[n]=c}var C=(0,mp.startsWith)(d,"env.")?(0,mp.get)(process,d):this.findVariableValue(m);return Object.prototype.toString.call(C)==="[object String]"?r.replace(vp,C):C}return(!this.dependenciesMap[n]||Object.keys(this.dependenciesMap[n]).length==0)&&(this.dependenciesMap[n]={}),r}if(Object.prototype.toString.call(r)==="[object Array]")return r.map(function(R){return a.iteratorToSetValue(R,n)});if(Object.prototype.toString.call(r)==="[object Object]")return Object.keys(r).forEach(function(R){r[R]=a.iteratorToSetValue(r[R],n,o||R)}),r},i.prototype.replaceVariable=function(r){var n=this,o=(0,wC.getServiceList)(r);return Object.keys(o).forEach(function(a){var u=o[a];o[a]=n.iteratorToSetValue(u,a)}),r.services?r.services=o:r=o,(0,xC.cloneDeep)(r)},i.prototype.getRealVariables=function(r){return pp(this,void 0,void 0,function(){return dp(this,function(n){return this.globalKeyArr=this.generateMagicVariables(r),[2,this.replaceVariable(r)]})})},i}();Pe.Parse=RC});var yp=I(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.Analysis=void 0;var IC=function(){function i(r,n){this.parsedObj=r,this.dependenciesMap=n,this.componentOrderKeyMap={}}return i.prototype.getComponentOrderKeyMap=function(r){var n=this;r.forEach(function(o){n.componentOrderKeyMap[o]=1})},i.prototype.calculateOrderNumber=function(r){var n=this;r.forEach(function(o){var a=n.dependenciesMap[o];Object.keys(a).forEach(function(u){n.componentOrderKeyMap[u]&&(n.componentOrderKeyMap[u]+=a[u])})})},i.prototype.getProjectOrder=function(){var r=this,n=Object.keys(this.dependenciesMap).filter(function(a){return a!=="Global"});this.getComponentOrderKeyMap(n),this.calculateOrderNumber(n);var o=Object.keys(this.componentOrderKeyMap).map(function(a){return{name:a,order:r.componentOrderKeyMap[a]}});return o.sort(function(a,u){return u.order-a.order}).map(function(a){return a.name})},i}();ds.Analysis=IC});var gs=I(Ct=>{"use strict";var TC=Ct&&Ct.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.version=Ct.Analysis=Ct.Parse=void 0;var PC=_p();Object.defineProperty(Ct,"Parse",{enumerable:!0,get:function(){return PC.Parse}});var LC=yp();Object.defineProperty(Ct,"Analysis",{enumerable:!0,get:function(){return LC.Analysis}});var DC=ps();Object.defineProperty(Ct,"version",{enumerable:!0,get:function(){return TC(DC).default}})});var mu=I(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.UPDATE_CHECK_INTERVAL=nr.DEFAULT_REGIRSTRY=nr.PROCESS_ENV_TEMPLATE_NAME=void 0;nr.PROCESS_ENV_TEMPLATE_NAME="templateFile";nr.DEFAULT_REGIRSTRY="http://registry.devsapp.cn/simple";nr.UPDATE_CHECK_INTERVAL=1e3*60*60*12});var Ep=I(St=>{"use strict";var vu=St&&St.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},_u=St&&St.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},yu=St&&St.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(St,"__esModule",{value:!0});St.PluginExeCute=void 0;var Wn=yu(require("fs")),Eu=yu(require("path")),NC=yu(Te()),qC=NC.default.getRootHome,ms=Eu.default.join(qC(),"plugins"),$C=function(){function i(r){this.pluginConfig=r,Wn.default.existsSync(ms)||Wn.default.mkdirSync(ms);var n=this.pluginConfig.name;this.pluginPath=Eu.default.join(ms,n)}return i.prototype.init=function(){return vu(this,void 0,void 0,function(){var r;return _u(this,function(n){switch(n.label){case 0:return r=this.pluginConfig.name,this.pluginExist()?[3,2]:[4,this.downLoadPlugin(r)];case 1:n.sent(),n.label=2;case 2:return[2]}})})},i.prototype.pluginExist=function(){return Wn.default.existsSync(this.pluginPath)},i.prototype.downLoadPlugin=function(r){return vu(this,void 0,void 0,function(){var n;return _u(this,function(o){return n=Eu.default.join(ms,r),Wn.default.existsSync(n)||Wn.default.mkdirSync(n),[2]})})},i.prototype.loadPlugin=function(){return vu(this,void 0,void 0,function(){var r;return _u(this,function(n){return r=require(this.pluginPath),[2,r]})})},i}();St.PluginExeCute=$C});var Cp=I(xt=>{"use strict";var Bn=xt&&xt.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},kn=xt&&xt.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wp=xt&&xt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(xt,"__esModule",{value:!0});xt.Hook=void 0;var bp=wp(require("fs")),FC=wp(require("path")),en=zn(),MC=Ep(),jC=require("child_process").spawnSync,HC=function(){function i(r){var n=this;r===void 0&&(r=[]),this.preHooks=[],this.afterHooks=[],r.forEach(function(o){o.Pre?n.preHooks.push(o):n.afterHooks.push(o)})}return i.prototype.executePreHook=function(){return Bn(this,void 0,void 0,function(){var r,n;return kn(this,function(o){switch(o.label){case 0:if(!(this.preHooks.length>0))return[3,5];en.logger.info("Start the pre-action"),r=0,o.label=1;case 1:return r<this.preHooks.length?(n=r,en.logger.info("Action: ".concat(this.preHooks[n].Hook||this.preHooks[n].Plugin)),[4,this.executeByConfig(this.preHooks[n])]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:en.logger.info("End the pre-action"),o.label=5;case 5:return[2]}})})},i.prototype.executeAfterHook=function(){return Bn(this,void 0,void 0,function(){var r,n;return kn(this,function(o){switch(o.label){case 0:if(!(this.afterHooks.length>0))return[3,5];en.logger.info("Start the after-action"),r=0,o.label=1;case 1:return r<this.afterHooks.length?(n=r,en.logger.info("Action: ".concat(this.afterHooks[n].Hook||this.afterHooks[n].Plugin)),[4,this.executeByConfig(this.afterHooks[n])]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:en.logger.info("End the after-action"),o.label=5;case 5:return[2]}})})},i.prototype.commandExecute=function(r,n){return Bn(this,void 0,void 0,function(){var o,a,u;return kn(this,function(d){if(o=process.cwd(),a=n?FC.default.resolve(o,n):o,bp.default.existsSync(a)&&bp.default.lstatSync(a).isDirectory()&&(process.env["next-command-execute-flag"]="true",u=jC(r,[],{cwd:a,stdio:"inherit",shell:!0}),u&&u.status!==0))throw new Error("Action [".concat(r,"] run error."));return[2]})})},i.prototype.pluginExecute=function(r){return Bn(this,void 0,void 0,function(){var n,o;return kn(this,function(a){switch(a.label){case 0:return n=new MC.PluginExeCute({name:r}),[4,n.init()];case 1:return a.sent(),[4,n.loadPlugin()];case 2:return o=a.sent(),o.apply(null,[]),[2]}})})},i.prototype.executeByConfig=function(r){return Bn(this,void 0,void 0,function(){return kn(this,function(n){switch(n.label){case 0:return r.Hook?[4,this.commandExecute(r.Hook,r.Path)]:[3,2];case 1:return n.sent(),[3,4];case 2:return r.Plugin?[4,this.pluginExecute(r.Plugin)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[2]}})})},i}();xt.Hook=HC});var Pp=I(Ge=>{"use strict";var Ot=Ge&&Ge.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},At=Ge&&Ge.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wu=Ge&&Ge.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ComponentExeCute=Ge.generateSynchronizeComponentExeList=Ge.synchronizeExecuteComponentList=void 0;var bu=wu(require("fs")),Sp=wu(require("path")),UC=mu(),Cu=gs(),Su=zn(),GC=Cp(),vs=Qr(),Vn=wu(Te()),WC=Vn.default.getCredential,BC=Vn.default.loadComponent,kC=Vn.default.jsyaml,xp=Vn.default.colors,Op=Vn.default.getRootHome,Ap=Cu.version.getServiceConfigDetail,zC=Cu.version.getServiceInputs,VC=Cu.version.getServiceActions,Rp=Sp.default.join(Op(),"components");function Ip(i,r,n){return i===void 0&&(i=[]),r===void 0&&(r=0),n===void 0&&(n={}),Ot(this,void 0,void 0,function(){var o=this;return At(this,function(a){switch(a.label){case 0:return r>=0&&r<i.length?[4,i[r]().then(function(u){var d=u.name,m=u.data;return Ot(o,void 0,void 0,function(){return At(this,function(_){switch(_.label){case 0:return d&&(n[d]=m),[4,Ip(i,r+1,n)];case 1:return[2,_.sent()]}})})})]:[3,2];case 1:return[2,a.sent()];case 2:return[2,n]}})})}Ge.synchronizeExecuteComponentList=Ip;function XC(i,r){var n=this,o=i.list,a=i.parse,u=i.parsedObj,d=i.method,m=i.params;return o.map(function(_){return function(){return new Promise(function(c,v){return Ot(n,void 0,void 0,function(){var C,R,P;return At(this,function(Z){switch(Z.label){case 0:return u.Params=m||"",Su.logger.info("Start executing project ".concat(_)),[4,r(a,_,u)];case 1:return C=Z.sent(),process.env.serverless_devs_temp_access&&(C.Access=process.env.serverless_devs_temp_access,C.access=process.env.serverless_devs_temp_access),R=new Tp({componentConfig:C,method:d,version:u.edition}),[4,R.init()];case 2:return P=Z.sent(),u.edition?u.services[_].output=P:u[_].Output=P,Su.logger.info("Project ".concat(_,` successfully to execute
|
|
46
|
-
`)
|
|
35
|
+
`+(0,Mb.bgRed)("ERROR:")),console.log("TypeError: "+n+`
|
|
36
|
+
`),console.log(jb.gray(o)+`
|
|
37
|
+
`)}return i.prototype.report=function(r){return qb(this,void 0,void 0,function(){var n;return $b(this,function(o){switch(o.label){case 0:return n=r.error,[4,Hh.default.report({type:"jsError",content:this.errorMessage+"||"+n.stack})];case 1:return o.sent(),[2]}})})},i}();bt.HumanError=Hb});var Wh=I(Jr=>{"use strict";var Ub=Jr&&Jr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.HumanWarning=void 0;var Gb=Ub(Te()),Gh=Gb.default.colors,Wb=function(){function i(r){var n=r.warningMessage,o=r.tips;console.log(`
|
|
38
|
+
`+Gh.hex("#000").bgYellow("WARNING:")),console.log(n+`
|
|
39
|
+
`),o&&console.log(Gh.gray(o)+`
|
|
40
|
+
`)}return i}();Jr.HumanWarning=Wb});var Qr=I(ie=>{"use strict";var Bb=ie&&ie.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},kb=ie&&ie.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},zb=ie&&ie.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ie,"__esModule",{value:!0});ie.HandleError=ie.HumanWarning=ie.HumanError=ie.ServerlessError=ie.InitError=ie.ConfigGetError=ie.ConfigError=ie.ConfigDeleteError=ie.CommandError=void 0;var lu=rr(),Vb=ls(),cu=zb(Te()),Cr=cu.default.colors,Xb=cu.default.report,Yb=cu.default.getMAC,Kb=qh();Object.defineProperty(ie,"CommandError",{enumerable:!0,get:function(){return Kb.CommandError}});var Zb=$h();Object.defineProperty(ie,"ConfigDeleteError",{enumerable:!0,get:function(){return Zb.ConfigDeleteError}});var Jb=Fh();Object.defineProperty(ie,"ConfigError",{enumerable:!0,get:function(){return Jb.ConfigError}});var Qb=Mh();Object.defineProperty(ie,"ConfigGetError",{enumerable:!0,get:function(){return Qb.ConfigGetError}});var eC=jh();Object.defineProperty(ie,"InitError",{enumerable:!0,get:function(){return eC.InitError}});var tC=br();Object.defineProperty(ie,"ServerlessError",{enumerable:!0,get:function(){return tC.ServerlessError}});var rC=Uh();Object.defineProperty(ie,"HumanError",{enumerable:!0,get:function(){return rC.HumanError}});var nC=Wh();Object.defineProperty(ie,"HumanWarning",{enumerable:!0,get:function(){return nC.HumanWarning}});function iC(){try{return Yb().replace(/:/g,"")}catch{return"unknown"}}function fu(i,r){return""+Cr.gray(i)+Cr.gray.underline(r)}var sC=function(){function i(r){var n=r.error,o=r.prefix,a=o===void 0?"Message:":o;this.traceId=""+iC()+Date.now(),console.log((0,lu.red)("\u2716 "+a+`
|
|
41
|
+
`));var u=(0,Vb.getConfig)("analysis");u!=="disable"&&console.log(Cr.gray("TraceId: "+this.traceId)),console.log(Cr.gray("Environment: "+(0,lu.getVersion)())),console.log(fu("Documents: ","https://www.serverless-devs.com")),console.log(fu("Discussions: ","https://github.com/Serverless-Devs/Serverless-Devs/discussions")),console.log(fu("Issues: ",`https://github.com/Serverless-Devs/Serverless-Devs/issues
|
|
42
|
+
`)),console.log((0,lu.bgRed)("ERROR:")+`
|
|
43
|
+
`+n+`
|
|
44
|
+
`),u!=="disable"&&console.log(Cr.gray("Please copy traceId: "+this.traceId+" and join Dingding group: 33947367 for consultation.")),console.log(Cr.gray("You can run 's clean --cache' to prune Serverless devs.")),console.log(Cr.gray(`And run again with the '--debug' option or 's -h' to get more logs.
|
|
45
|
+
`))}return i.prototype.report=function(r){return Bb(this,void 0,void 0,function(){return kb(this,function(n){return Xb({type:"jsError",content:r.message+"||"+r.stack,traceId:this.traceId}),[2]})})},i}();ie.HandleError=sC});var Bh=I((Gx,oC)=>{oC.exports={name:"@serverless-devs/s",version:"2.0.95-beta.1",description:"Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",homepage:"https://www.serverless-devs.com",keywords:["serverless","alibaba","tencent","azure","baidu","huawei","google","function","faas","serverless-devs"],publishConfig:{access:"public",registry:"https://registry.npmjs.org"},license:"MIT",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{prewatch:"rm -rf lib/* && cp -r ./src/daemon ./lib",watch:"tsc -w",test:"npx jest",prebuild:"rm -rf lib",build:"tsc && cp -r ./src/daemon ./lib",postbuild:"./shell/postbuild.sh","test:cov":"jest --coverage",lint:"npm run typecheck && f2elint scan -i src",fix:"f2elint fix",typecheck:"npx tsc -p tsconfig.json --noEmit",update:"rm -rf yarn.lock && rm -rf package-lock.json && rm -rf node_modules && yarn",beta:"npm publish --tag=beta"},main:"./lib/index.js",bin:{s:"bin/s"},devDependencies:{"@types/jest":"^27.0.1","@types/lodash":"^4.14.168","@types/node":"^14.0.23","@typescript-eslint/eslint-plugin":"^4.14.1","@typescript-eslint/parser":"^4.14.1","babel-eslint":"^10.1.0",boxen:"^5.0.0",commander:"^6.0.0",dotenv:"^10.0.0",esbuild:"^0.13.6",eslint:"^7.7.0","eslint-config-prettier":"^7.2.0","eslint-plugin-import":"^2.20.1","eslint-plugin-prettier":"^3.1.2",husky:"^4.2.3",inquirer:"^8.2.0","inquirer-autocomplete-prompt":"^1.3.0",jest:"^27.1.0","latest-version":"^5.1.0","lint-staged":"^10.0.8",lodash:"^4.17.20","os-locale":"5.0.0",prettier:"^2.2.1",semver:"^7.3.5","semver-diff":"^3.1.1","ts-jest":"^27.0.1","ts-node":"^9.1.1","tty-table":"^4.1.5",typescript:"^4.1.3"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"},jest:{coverageDirectory:"coverage",testEnvironment:"node",coverageProvider:"v8",preset:"ts-jest",testMatch:["**/test/**/*test.[jt]s"],setupFilesAfterEnv:["./jest.setup.ts"]},dependencies:{"@serverless-devs/core":"^0.1.15-beta.2"}}});var rr=I(U=>{"use strict";var uC=U&&U.__createBinding||(Object.create?function(i,r,n,o){o===void 0&&(o=n),Object.defineProperty(i,o,{enumerable:!0,get:function(){return r[n]}})}:function(i,r,n,o){o===void 0&&(o=n),i[o]=r[n]}),aC=U&&U.__setModuleDefault||(Object.create?function(i,r){Object.defineProperty(i,"default",{enumerable:!0,value:r})}:function(i,r){i.default=r}),lC=U&&U.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(i!=null)for(var n in i)n!=="default"&&Object.prototype.hasOwnProperty.call(i,n)&&uC(r,i,n);return aC(r,i),r},kh=U&&U.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},zh=U&&U.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},cs=U&&U.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(U,"__esModule",{value:!0});U.emoji=U.mark=U.replaceTemplate=U.getTemplatekey=U.replaceFun=U.getLang=U.printn=U.checkTemplateFile=U.checkAndReturnTemplateFile=U.yamlLoad=U.getFolderSize=U.getVersion=U.bgRed=U.red=void 0;var we=cs(require("path")),Ke=cs(require("fs")),hu=cs(ss()),cC=cs(require("os")),fC=Qr(),fs=lC(Te()),pu=fs.default.colors,hC=fs.default.jsyaml,hs=Bh();U.red=pu.hex("#fd5750");U.bgRed=pu.hex("#000").bgHex("#fd5750");function pC(){return(0,fs.getCoreVersion)()?hs.name+": "+hs.version+", @serverless-devs/core: "+(0,fs.getCoreVersion)()+", "+process.platform+"-"+process.arch+", node-"+process.version:hs.name+": "+hs.version+", "+process.platform+"-"+process.arch+", node-"+process.version}U.getVersion=pC;function dC(i){return kh(this,void 0,void 0,function(){function r(a){return kh(this,void 0,void 0,function(){var u,d;return zh(this,function(m){switch(m.label){case 0:return u=Ke.default.lstatSync(a),typeof u!="object"?[2]:(n.set(u.ino,u.size),u.isDirectory()?(d=Ke.default.readdirSync(a),typeof d!="object"?[2]:[4,Promise.all(d.map(function(_){return r(we.default.join(a,_))}))]):[3,2]);case 1:m.sent(),m.label=2;case 2:return[2]}})})}var n,o;return zh(this,function(a){switch(a.label){case 0:return n=new Map,[4,r(i)];case 1:return a.sent(),o=Array.from(n.values()).reduce(function(u,d){return u+d},0),[2,o]}})})}U.getFolderSize=dC;function Vh(i){var r=Ke.default.readFileSync(i,"utf8");try{return hC.load(r)}catch{if(["-h","--help"].includes(process.argv[2]))return;var n=we.default.basename(i);new fC.HumanError({errorMessage:n+" format is incorrect",tips:"Please check the configuration of "+n+", Serverless Devs' Yaml specification document can refer to\uFF1A"+pu.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/yaml.md")}),process.exit(1)}}U.yamlLoad=Vh;function Gn(i,r){r===void 0&&(r=!1);var n=Ke.default.readFileSync(i,"utf8"),o=r?JSON.parse(n):Vh(i);if(!o)return!1;for(var a in o)if(o[a].Component&&o[a].Provider&&o[a].Properties)return!0;return o.hasOwnProperty("edition")}function Xh(){if(process.env.serverless_devs_temp_template)return process.env.serverless_devs_temp_template;var i=process.cwd(),r=process.argv.includes("-t")?"-t":process.argv.includes("--template")?"--template":null,n=r?process.argv.indexOf(r):-1;if(n!==-1){var o=n+1,a=process.argv[o];if(a&&(a.endsWith(".yaml")||a.endsWith(".yml")||a.endsWith(".json"))){var u=!!a.endsWith(".json");if(Ke.default.existsSync(we.default.join(i,a))&&Gn(we.default.join(i,a),u)){process.argv.splice(n,2);var d=JSON.parse(process.env.serverless_devs_temp_argv);return d.splice(d.indexOf(r),2),process.env.serverless_devs_temp_argv=JSON.stringify(d),process.env.serverless_devs_temp_template=we.default.join(i,a),we.default.join(i,a)}else if(Ke.default.existsSync(a)&&Gn(a,u)){process.argv.splice(n,2);var d=JSON.parse(process.env.serverless_devs_temp_argv);return d.splice(d.indexOf(r),2),process.env.serverless_devs_temp_argv=JSON.stringify(d),process.env.serverless_devs_temp_template=a,a}}}return Ke.default.existsSync(we.default.join(i,"s.yaml"))&&Gn(we.default.join(i,"s.yaml"))?(process.env.serverless_devs_temp_template=we.default.join(i,"s.yaml"),we.default.join(i,"s.yaml")):Ke.default.existsSync(we.default.join(i,"s.yml"))&&Gn(we.default.join(i,"s.yml"))?(process.env.serverless_devs_temp_template=we.default.join(i,"s.yml"),we.default.join(i,"s.yml")):Ke.default.existsSync(we.default.join(i,"s.json"))&&Gn(we.default.join(i,"s.json"),!0)?(process.env.serverless_devs_temp_template=we.default.join(i,"s.json"),we.default.join(i,"s.json")):null}U.checkAndReturnTemplateFile=Xh;function Yh(i){return Ke.default.existsSync(i)?i:null}U.checkTemplateFile=Yh;function Kh(i,r){r===void 0&&(r=" ");for(var n="",o=0;o<i;o++)n=n+r;return n}U.printn=Kh;function Zh(){return"en"}U.getLang=Zh;function du(i,r){var n=/\{\{(.*?)\}\}/g,o=i.match(n);if(o)for(var a=0;a<o.length;a++){var u=o[a].replace(/{{|}}/g,""),d=hu.default.trim(u.split("|")[0]);r[d]&&(i=i.replace(o[a],r[d]))}return i}U.replaceFun=du;function Jh(i){var r=/\{\{(.*?)\}\}/g,n=i.match(r);return n?n.filter(function(o){return o}).map(function(o){var a=o.replace(/{{|}}/g,""),u=a.split("|");return{name:hu.default.trim(u[0]),desc:hu.default.trim(u[1])}}):[]}U.getTemplatekey=Jh;function Qh(i,r){i.forEach(function(n){if(Ke.default.existsSync(n)){var o=Ke.default.readFileSync(n,"utf-8"),a=du(o,r);Ke.default.writeFileSync(n,a,"utf-8")}})}U.replaceTemplate=Qh;function ep(i){if(!i)return i;var r=i.slice(-4);return"***********"+r}U.mark=ep;function gC(i){return cC.default.platform()==="win32"?"":i}U.emoji=gC;U.default={checkAndReturnTemplateFile:Xh,checkTemplateFile:Yh,printn:Kh,mark:ep,getLang:Zh,replaceTemplate:Qh,replaceFun:du,getTemplatekey:Jh}});var sp=I(Ze=>{"use strict";var mC=Ze&&Ze.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extractTemplateInfo=Ze.isUrlFormat=Ze.getProjectNameFromUrl=Ze.parse=void 0;var vC=mC(require("url"));function tp(i){return vC.default.parse(i)}Ze.parse=tp;function rp(i){var r=i.lastIndexOf("/");return r&&r>=0&&(i=i.substr(r+1)),i.endsWith(".git")?i.substr(0,i.length-4):i}Ze.getProjectNameFromUrl=rp;function np(i){return i.includes(":")||i.includes("/")}Ze.isUrlFormat=np;function ip(i){var r=i.pathname||"",n=r.split("/"),o=n[1],a=n[3];return{host:i.host,ownerName:o,repoName:a,branch:"",hasSubPath:!1,subPath:"",zipFile:""}}Ze.extractTemplateInfo=ip;Ze.default={extractTemplateInfo:ip,getProjectNameFromUrl:rp,isUrlFormat:np,parse:tp}});var ps=I(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getServiceList=Fe.getServiceActions=Fe.getServiceInputs=Fe.getServiceConfigDetail=Fe.getServiceConfig=Fe.getSubcommand=void 0;function op(i){var r=i.edition||"0.0.1";if(r==="0.0.1")return Object.keys(i).filter(function(o){return o!=="Global"});var n=i.services||{};return Object.keys(n)}Fe.getSubcommand=op;function up(i,r){var n=i.edition||"0.0.1";if(n==="0.0.1")return i[r];var o=i.services||{},a=o[r],u=a.provider?a.provider:i.provider,d=a.access?a.access:i.access,m=Object.assign({},a,{access:d,provider:u});return m}Fe.getServiceConfig=up;function ap(i){var r=i.Component||i.component,n=i.Provider||i.provider,o=i.Access||i.access||"default",a=i.autoCredential;return{name:r,provider:n,access:o,autoCredential:a}}Fe.getServiceConfigDetail=ap;function lp(i,r,n){if(r==="0.0.1"){var o=i.Properties,a=i.Params,u=i.Provider,d=i.Access,m=i.Component,_=i.ProjectName,c=n.credentials,v=n.method,C={Properties:o,Credentials:c,Project:{ProjectName:_,Component:m,Provider:u,AccessAlias:d||""},Command:v,Args:a||"",Path:{ConfigPath:process.env.templateFile||""}};return C}var R=i.props,P=i.params,Z=i.provider,oe=i.access,be=i.component,Y=i.ProjectName,lt=i.appName,ve=n.credentials,pe=n.method,xe={props:R,Properties:R,Credentials:ve,credentials:ve,appName:lt,Project:{ProjectName:Y,projectName:Y,component:be,Component:be,provider:Z,Provider:Z,accessAlias:oe||"",AccessAlias:oe||""},project:{component:be,access:oe||"",projectName:Y},command:pe,Command:pe,args:P||"",Args:P||"",argsObj:process.temp_params||[],ArgsObj:process.temp_params||[],path:{configPath:process.env.templateFile||""},Path:{ConfigPath:process.env.templateFile||""}};return xe}Fe.getServiceInputs=lp;function cp(i,r,n){var o=n.method;if(r==="0.0.1"){var a=i.Extends,u=a===void 0?{}:a,d=u[o];return d}var m=i.actions,_=m===void 0?{}:m,c=[];return Object.keys(_).forEach(function(v){var C=v.split("-"),R=_[v];if(C.length>1){var P=C[1];if(P===o){var Z=C[0];R.forEach(function(oe){var be={Hook:oe.run,Path:oe.path,Pre:Z==="pre"};c.push(be)})}}else v===o&&R.forEach(function(oe){var be={Hook:oe.run,Path:oe.path,Pre:!1};c.push(be)})}),c}Fe.getServiceActions=cp;function fp(i){var r=i.edition||"0.0.1";return r==="0.0.1"?i:i.services}Fe.getServiceList=fp;Fe.default={getSubcommand:op,getServiceConfig:up,getServiceConfigDetail:ap,getServiceInputs:lp,getServiceActions:cp,getServiceList:fp}});var _p=I(Pe=>{"use strict";var _C=Pe&&Pe.__createBinding||(Object.create?function(i,r,n,o){o===void 0&&(o=n),Object.defineProperty(i,o,{enumerable:!0,get:function(){return r[n]}})}:function(i,r,n,o){o===void 0&&(o=n),i[o]=r[n]}),yC=Pe&&Pe.__setModuleDefault||(Object.create?function(i,r){Object.defineProperty(i,"default",{enumerable:!0,value:r})}:function(i,r){i.default=r}),hp=Pe&&Pe.__importStar||function(i){if(i&&i.__esModule)return i;var r={};if(i!=null)for(var n in i)n!=="default"&&Object.prototype.hasOwnProperty.call(i,n)&&_C(r,i,n);return yC(r,i),r},pp=Pe&&Pe.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},dp=Pe&&Pe.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},EC=Pe&&Pe.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.Parse=void 0;var gu=hp(require("fs")),gp=hp(require("path")),wC=ps(),bC=Qr(),mp=ss(),CC=EC(Te()),SC=CC.default.jsyaml,xC=ss(),vp=new RegExp(/\$\{(.*)\}/,"i"),OC=new RegExp(/(.*)\((.*)\)/,"i"),AC=["[object Number]","[object Boolean]"],RC=function(){function i(r){if(this.path=r,this.parsedObj={},this.dependenciesMap={},this.globalJsonKeyMap={},this.globalKeyArr=[],this.magicVariablesArray=[],gu.existsSync(r))try{this.init(r)}catch(n){throw new Error(n.message)}}return i.prototype.getFileObj=function(r){var n={};try{var o=gp.extname(r);(o.indexOf(".yaml")!==-1||o.indexOf(".yml")!==-1)&&(n=SC.load(gu.readFileSync(r,"utf8"))),o.indexOf(".json")!==-1&&(n=JSON.parse(gu.readFileSync(r).toString()))}catch(a){new bC.HandleError({error:a}).report(a).then(function(){return process.exit(1)})}return n},i.prototype.init=function(r){return pp(this,void 0,void 0,function(){return dp(this,function(n){return this.parsedObj=this.getFileObj(r),[2]})})},i.prototype.getOriginalParsedObj=function(){return this.parsedObj},i.prototype.findVariableValue=function(r){var n=r.variableName,o=r.type,a=r.funName,u=r.funVariable,d="";return o==="Literal"?this.globalJsonKeyMap[n]||this.globalJsonKeyMap["services."+n]||"${"+n+"}":o==="Fun"&&(a==="Env"||a==="env")?process.env[u]:o==="Fun"&&(a==="Path"||a==="path")?gp.join(process.cwd(),u):o==="Fun"&&(a==="File"||a==="file")?this.getFileObj(u):d},i.prototype.generateMagicVariables=function(r,n,o){var a=this;return n===void 0&&(n=[]),o===void 0&&(o=""),Object.prototype.toString.call(r)==="[object Object]"?(o!==""&&(o=o+"."),Object.keys(r).map(function(u){var d=""+o+u,m=r[u];n.push(d),n.concat(a.generateMagicVariables(m,n,""+d)),a.globalJsonKeyMap[d]=m})):Object.prototype.toString.call(r)==="[object Array]"?r.forEach(function(u,d){var m=o+"["+d+"]",_=o+"["+(d-r.length)+"]";n.push(m),n.push(_),n.concat(a.generateMagicVariables(u,n,""+m)),n.concat(a.generateMagicVariables(u,n,""+_)),a.globalJsonKeyMap[m]=u,a.globalJsonKeyMap[_]=u}):n=[],n},i.prototype.isProjectProperties=function(r,n){var o=!1;return n==="Properties"&&this.globalJsonKeyMap[r+"."+n]&&(o=!0),o},i.prototype.iteratorToSetValue=function(r,n,o){var a=this;if(AC.includes(Object.prototype.toString.call(r)))return r;if(Object.prototype.toString.call(r)==="[object String]"){var u=r.match(vp);if(u){var d=u[1],m={variableName:d,type:"Literal",funName:null,funVariable:""},_=d.match(OC);if(_)m.funName=_[1],m.funVariable=_[2],m.type="Fun";else{var c=this.dependenciesMap[n];c||(c={});var v=d.split(".")[0];c[v]=1,this.dependenciesMap[n]=c}var C=(0,mp.startsWith)(d,"env.")?(0,mp.get)(process,d):this.findVariableValue(m);return Object.prototype.toString.call(C)==="[object String]"?r.replace(vp,C):C}return(!this.dependenciesMap[n]||Object.keys(this.dependenciesMap[n]).length==0)&&(this.dependenciesMap[n]={}),r}if(Object.prototype.toString.call(r)==="[object Array]")return r.map(function(R){return a.iteratorToSetValue(R,n)});if(Object.prototype.toString.call(r)==="[object Object]")return Object.keys(r).forEach(function(R){r[R]=a.iteratorToSetValue(r[R],n,o||R)}),r},i.prototype.replaceVariable=function(r){var n=this,o=(0,wC.getServiceList)(r);return Object.keys(o).forEach(function(a){var u=o[a];o[a]=n.iteratorToSetValue(u,a)}),r.services?r.services=o:r=o,(0,xC.cloneDeep)(r)},i.prototype.getRealVariables=function(r){return pp(this,void 0,void 0,function(){return dp(this,function(n){return this.globalKeyArr=this.generateMagicVariables(r),[2,this.replaceVariable(r)]})})},i}();Pe.Parse=RC});var yp=I(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.Analysis=void 0;var IC=function(){function i(r,n){this.parsedObj=r,this.dependenciesMap=n,this.componentOrderKeyMap={}}return i.prototype.getComponentOrderKeyMap=function(r){var n=this;r.forEach(function(o){n.componentOrderKeyMap[o]=1})},i.prototype.calculateOrderNumber=function(r){var n=this;r.forEach(function(o){var a=n.dependenciesMap[o];Object.keys(a).forEach(function(u){n.componentOrderKeyMap[u]&&(n.componentOrderKeyMap[u]+=a[u])})})},i.prototype.getProjectOrder=function(){var r=this,n=Object.keys(this.dependenciesMap).filter(function(a){return a!=="Global"});this.getComponentOrderKeyMap(n),this.calculateOrderNumber(n);var o=Object.keys(this.componentOrderKeyMap).map(function(a){return{name:a,order:r.componentOrderKeyMap[a]}});return o.sort(function(a,u){return u.order-a.order}).map(function(a){return a.name})},i}();ds.Analysis=IC});var gs=I(Ct=>{"use strict";var TC=Ct&&Ct.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.version=Ct.Analysis=Ct.Parse=void 0;var PC=_p();Object.defineProperty(Ct,"Parse",{enumerable:!0,get:function(){return PC.Parse}});var LC=yp();Object.defineProperty(Ct,"Analysis",{enumerable:!0,get:function(){return LC.Analysis}});var DC=ps();Object.defineProperty(Ct,"version",{enumerable:!0,get:function(){return TC(DC).default}})});var mu=I(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.UPDATE_CHECK_INTERVAL=nr.DEFAULT_REGIRSTRY=nr.PROCESS_ENV_TEMPLATE_NAME=void 0;nr.PROCESS_ENV_TEMPLATE_NAME="templateFile";nr.DEFAULT_REGIRSTRY="http://registry.devsapp.cn/simple";nr.UPDATE_CHECK_INTERVAL=1e3*60*60*12});var Ep=I(St=>{"use strict";var vu=St&&St.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},_u=St&&St.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},yu=St&&St.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(St,"__esModule",{value:!0});St.PluginExeCute=void 0;var Wn=yu(require("fs")),Eu=yu(require("path")),NC=yu(Te()),qC=NC.default.getRootHome,ms=Eu.default.join(qC(),"plugins"),$C=function(){function i(r){this.pluginConfig=r,Wn.default.existsSync(ms)||Wn.default.mkdirSync(ms);var n=this.pluginConfig.name;this.pluginPath=Eu.default.join(ms,n)}return i.prototype.init=function(){return vu(this,void 0,void 0,function(){var r;return _u(this,function(n){switch(n.label){case 0:return r=this.pluginConfig.name,this.pluginExist()?[3,2]:[4,this.downLoadPlugin(r)];case 1:n.sent(),n.label=2;case 2:return[2]}})})},i.prototype.pluginExist=function(){return Wn.default.existsSync(this.pluginPath)},i.prototype.downLoadPlugin=function(r){return vu(this,void 0,void 0,function(){var n;return _u(this,function(o){return n=Eu.default.join(ms,r),Wn.default.existsSync(n)||Wn.default.mkdirSync(n),[2]})})},i.prototype.loadPlugin=function(){return vu(this,void 0,void 0,function(){var r;return _u(this,function(n){return r=require(this.pluginPath),[2,r]})})},i}();St.PluginExeCute=$C});var Cp=I(xt=>{"use strict";var Bn=xt&&xt.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},kn=xt&&xt.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wp=xt&&xt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(xt,"__esModule",{value:!0});xt.Hook=void 0;var bp=wp(require("fs")),FC=wp(require("path")),en=zn(),MC=Ep(),jC=require("child_process").spawnSync,HC=function(){function i(r){var n=this;r===void 0&&(r=[]),this.preHooks=[],this.afterHooks=[],r.forEach(function(o){o.Pre?n.preHooks.push(o):n.afterHooks.push(o)})}return i.prototype.executePreHook=function(){return Bn(this,void 0,void 0,function(){var r,n;return kn(this,function(o){switch(o.label){case 0:if(!(this.preHooks.length>0))return[3,5];en.logger.info("Start the pre-action"),r=0,o.label=1;case 1:return r<this.preHooks.length?(n=r,en.logger.info("Action: "+(this.preHooks[n].Hook||this.preHooks[n].Plugin)),[4,this.executeByConfig(this.preHooks[n])]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:en.logger.info("End the pre-action"),o.label=5;case 5:return[2]}})})},i.prototype.executeAfterHook=function(){return Bn(this,void 0,void 0,function(){var r,n;return kn(this,function(o){switch(o.label){case 0:if(!(this.afterHooks.length>0))return[3,5];en.logger.info("Start the after-action"),r=0,o.label=1;case 1:return r<this.afterHooks.length?(n=r,en.logger.info("Action: "+(this.afterHooks[n].Hook||this.afterHooks[n].Plugin)),[4,this.executeByConfig(this.afterHooks[n])]):[3,4];case 2:o.sent(),o.label=3;case 3:return r++,[3,1];case 4:en.logger.info("End the after-action"),o.label=5;case 5:return[2]}})})},i.prototype.commandExecute=function(r,n){return Bn(this,void 0,void 0,function(){var o,a,u;return kn(this,function(d){if(o=process.cwd(),a=n?FC.default.resolve(o,n):o,bp.default.existsSync(a)&&bp.default.lstatSync(a).isDirectory()&&(process.env["next-command-execute-flag"]="true",u=jC(r,[],{cwd:a,stdio:"inherit",shell:!0}),u&&u.status!==0))throw new Error("Action ["+r+"] run error.");return[2]})})},i.prototype.pluginExecute=function(r){return Bn(this,void 0,void 0,function(){var n,o;return kn(this,function(a){switch(a.label){case 0:return n=new MC.PluginExeCute({name:r}),[4,n.init()];case 1:return a.sent(),[4,n.loadPlugin()];case 2:return o=a.sent(),o.apply(null,[]),[2]}})})},i.prototype.executeByConfig=function(r){return Bn(this,void 0,void 0,function(){return kn(this,function(n){switch(n.label){case 0:return r.Hook?[4,this.commandExecute(r.Hook,r.Path)]:[3,2];case 1:return n.sent(),[3,4];case 2:return r.Plugin?[4,this.pluginExecute(r.Plugin)]:[3,4];case 3:n.sent(),n.label=4;case 4:return[2]}})})},i}();xt.Hook=HC});var Pp=I(Ge=>{"use strict";var Ot=Ge&&Ge.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},At=Ge&&Ge.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},wu=Ge&&Ge.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ComponentExeCute=Ge.generateSynchronizeComponentExeList=Ge.synchronizeExecuteComponentList=void 0;var bu=wu(require("fs")),Sp=wu(require("path")),UC=mu(),Cu=gs(),Su=zn(),GC=Cp(),vs=Qr(),Vn=wu(Te()),WC=Vn.default.getCredential,BC=Vn.default.loadComponent,kC=Vn.default.jsyaml,xp=Vn.default.colors,Op=Vn.default.getRootHome,Ap=Cu.version.getServiceConfigDetail,zC=Cu.version.getServiceInputs,VC=Cu.version.getServiceActions,Rp=Sp.default.join(Op(),"components");function Ip(i,r,n){return i===void 0&&(i=[]),r===void 0&&(r=0),n===void 0&&(n={}),Ot(this,void 0,void 0,function(){var o=this;return At(this,function(a){switch(a.label){case 0:return r>=0&&r<i.length?[4,i[r]().then(function(u){var d=u.name,m=u.data;return Ot(o,void 0,void 0,function(){return At(this,function(_){switch(_.label){case 0:return d&&(n[d]=m),[4,Ip(i,r+1,n)];case 1:return[2,_.sent()]}})})})]:[3,2];case 1:return[2,a.sent()];case 2:return[2,n]}})})}Ge.synchronizeExecuteComponentList=Ip;function XC(i,r){var n=this,o=i.list,a=i.parse,u=i.parsedObj,d=i.method,m=i.params;return o.map(function(_){return function(){return new Promise(function(c,v){return Ot(n,void 0,void 0,function(){var C,R,P;return At(this,function(Z){switch(Z.label){case 0:return u.Params=m||"",Su.logger.info("Start executing project "+_),[4,r(a,_,u)];case 1:return C=Z.sent(),process.env.serverless_devs_temp_access&&(C.Access=process.env.serverless_devs_temp_access,C.access=process.env.serverless_devs_temp_access),R=new Tp({componentConfig:C,method:d,version:u.edition}),[4,R.init()];case 2:return P=Z.sent(),u.edition?u.services[_].output=P:u[_].Output=P,Su.logger.info("Project "+_+` successfully to execute
|
|
46
|
+
`),c({name:_,data:P}),[2]}})})})}})}Ge.generateSynchronizeComponentExeList=XC;var Tp=function(){function i(r){this.version="0.0.1",this.componentConfig=r.componentConfig,this.method=r.method,this.version=r.version,this.customerCommandName=r.customerCommandName,bu.default.existsSync(Rp)||bu.default.mkdirSync(Rp)}return i.prototype.init=function(){return Ot(this,void 0,void 0,function(){var r;return At(this,function(n){switch(n.label){case 0:return r=this,[4,this.getCredentials()];case 1:return r.credentials=n.sent()||{},[4,this.startExecute()];case 2:return[2,n.sent()]}})})},i.prototype.getCredentials=function(){return Ot(this,void 0,void 0,function(){var r,n,o,a,u,d,m,_;return At(this,function(c){switch(c.label){case 0:if(r=Ap(this.componentConfig),n=r.access,o=r.autoCredential,o===!1)return[2,null];c.label=1;case 1:return c.trys.push([1,5,,6]),a=Sp.default.join(Op(),"access.yaml"),u=kC.load(bu.default.readFileSync(a,"utf8")||"{}"),u[n]?[4,WC(n)]:[3,3];case 2:return m=c.sent(),[3,4];case 3:m={},c.label=4;case 4:return d=m,this.componentConfig.access=n,[2,d];case 5:return _=c.sent(),[3,6];case 6:return[2,{}]}})})},i.prototype.loadExtends=function(){var r=VC(this.componentConfig,this.version,{method:this.method}),n=null;return r&&(n=new GC.Hook(r)),n},i.prototype.loadPreExtends=function(r){return Ot(this,void 0,void 0,function(){return At(this,function(n){switch(n.label){case 0:return r?[4,r.executePreHook()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},i.prototype.loadAfterExtend=function(r){return Ot(this,void 0,void 0,function(){return At(this,function(n){switch(n.label){case 0:return r?[4,r.executeAfterHook()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},i.prototype.invokeMethod=function(r,n,o){return Ot(this,void 0,void 0,function(){var a,u,a,d;return At(this,function(m){switch(m.label){case 0:if(!this.customerCommandName)return[3,6];if(!r[n])return[3,5];m.label=1;case 1:return m.trys.push([1,3,,5]),[4,r[n](o)];case 2:return a=m.sent(),[2,a];case 3:return u=m.sent(),[4,new vs.HandleError({error:u,prefix:"Project "+this.componentConfig.ProjectName+" failed to execute:"}).report(u)];case 4:return m.sent(),process.exit(101),[3,5];case 5:new vs.HumanError({errorMessage:"The ["+this.method+"] command was not found.",tips:"Please check the component "+this.componentConfig.component+" has the "+this.method+" method. Serverless Devs documents\uFF1A"+xp.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command")}),process.exit(100),m.label=6;case 6:if(!r[n])return[3,12];m.label=7;case 7:return m.trys.push([7,9,,11]),[4,r[n](o)];case 8:return a=m.sent(),[2,a];case 9:return d=m.sent(),[4,new vs.HandleError({error:d,prefix:"Project "+this.componentConfig.ProjectName+" failed to execute:"}).report(d)];case 10:return m.sent(),process.exit(101),[3,11];case 11:return[3,13];case 12:new vs.HumanWarning({warningMessage:"The ["+this.method+"] command was not found.",tips:"Please check the component "+this.componentConfig.component+" has the "+this.method+" method, Serverless Devs documents\uFF1A"+xp.underline("https://github.com/Serverless-Devs/Serverless-Devs/blob/master/docs/zh/command")}),m.label=13;case 13:return[2]}})})},i.prototype.executeCommand=function(){return Ot(this,void 0,void 0,function(){var r,n,o,a,u;return At(this,function(d){switch(d.label){case 0:return r=zC(this.componentConfig,this.version,{method:this.method,credentials:this.credentials}),n=Ap(this.componentConfig).name,o=Su.configSet.getConfig("registry")||UC.DEFAULT_REGIRSTRY,[4,BC(n,o)];case 1:return a=d.sent(),[4,this.invokeMethod(a,this.method,r)];case 2:return u=d.sent(),[2,u]}})})},i.prototype.startExecute=function(){return Ot(this,void 0,void 0,function(){var r,n,o,a,u;return At(this,function(d){switch(d.label){case 0:return r={},n=process.env.temp_params||"",o=n.includes("--help")||n.includes("-h"),process.env["skip-actions"]==="true"||o?(u=null,[3,3]):[3,1];case 1:return[4,this.loadExtends()];case 2:u=d.sent(),d.label=3;case 3:return a=u,[4,this.loadPreExtends(a)];case 4:return d.sent(),[4,this.executeCommand()];case 5:return r=d.sent(),[4,this.loadAfterExtend(a)];case 6:return d.sent(),[2,r]}})})},i}();Ge.ComponentExeCute=Tp});var $p=I(Rt=>{"use strict";var Lp=Rt&&Rt.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},Dp=Rt&&Rt.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},YC=Rt&&Rt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.CommandManager=void 0;var Np=gs(),KC=ps(),Xn=zn(),xu=Pp(),tn=rr(),ZC=YC(Te()),qp=ZC.default.colors,JC=Qr(),QC=function(){function i(r,n,o,a){this.templateFile=r,this.method=n,this.customerCommandName=o,this.deployParams=a}return i.prototype.assemblyProjectConfig=function(r,n,o){return Lp(this,void 0,void 0,function(){var a,u;return Dp(this,function(d){switch(d.label){case 0:return[4,r.getRealVariables(o)];case 1:return a=d.sent(),u=(0,KC.getServiceConfig)(a,n),u.appName=a.name,u.ProjectName=n,this.deployParams&&(u.params=this.deployParams),[2,u]}})})},i.prototype.init=function(){return Lp(this,void 0,void 0,function(){var r,n,o,a,u,d,m,_,c,v,C,R,P,C,Z,oe,be;return Dp(this,function(Y){switch(Y.label){case 0:return Y.trys.push([0,9,,11]),Xn.logger.info("Start ..."),r=(0,tn.checkTemplateFile)(this.templateFile),r?(n={},o=new Np.Parse(r),a=o.getOriginalParsedObj(),[4,o.getRealVariables(a)]):[3,7];case 1:return u=Y.sent(),d=new Np.Analysis(u,o.dependenciesMap),m=d.getProjectOrder(),this.customerCommandName||m.length===1?(_=m[0],[4,this.assemblyProjectConfig(o,this.customerCommandName||_,a)]):[3,4];case 2:return c=Y.sent(),process.env.serverless_devs_temp_access&&(c.Access=process.env.serverless_devs_temp_access,c.access=process.env.serverless_devs_temp_access),v=new xu.ComponentExeCute({componentConfig:c,method:this.method,version:a.edition,customerCommandName:this.customerCommandName}),[4,v.init()];case 3:return C=Y.sent(),C&&(n[c.ProjectName]=C),[3,6];case 4:return R=this.deployParams||"",Xn.logger.info("It is detected that your project has the following projects < "+m.join(",")+" > to be execute"),P=(0,xu.generateSynchronizeComponentExeList)({list:m,parse:o,parsedObj:a,method:this.method,params:R},this.assemblyProjectConfig.bind(this)),[4,(0,xu.synchronizeExecuteComponentList)(P)];case 5:C=Y.sent();for(Z in C)m.includes(Z)&&C[Z]&&(n[Z]=C[Z]);Y.label=6;case 6:return oe=JSON.parse(JSON.stringify(n)),Object.keys(n).length===0?Xn.logger.success("End of method: "+this.method):Xn.logger.output(oe),[3,8];case 7:Xn.logger.error(`Failed to execute:
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
`)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`)
|
|
57
|
-
|
|
58
|
-
`:""))}return[3,6];case 5:return nn=It.sent(),ys.default.error("Help information could not be found"),[3,6];case 6:return[3,8];case 7:ys.default.error("Help information could not be found"),It.label=8;case 8:return[2]}})})}),r.push(C)}),[2,r]}})})}te.createCustomerCommand=Gp;function Wp(i){i.on("command:*",function(r){var n=i.commands.map(function(o){return o.name()});n.includes(r[0])||(ys.default.error(" error: unknown command ".concat(r[0])),i.help())})}te.registerCommandChecker=Wp;function Bp(i,r){return xr(this,void 0,void 0,function(){var n;return Or(this,function(o){switch(o.label){case 0:return r?[4,Gp(r)]:[3,2];case 1:n=o.sent(),n.forEach(function(a){i.addCommand(a)}),o.label=2;case 2:return[2]}})})}te.registerCustomerCommand=Bp;function kp(i,r){return xr(this,void 0,void 0,function(){var n,o;return Or(this,function(a){switch(a.label){case 0:return r?[4,Pu(r)]:[3,2];case 1:n=a.sent(),o=Lu(n),process.argv[2]&&!o.includes(process.argv[2])&&!["-h","--help"].includes(process.argv[2])&&i.addCommand(Tu(process.argv[2])),a.label=2;case 2:return[2]}})})}te.registerUniversalCommand=kp;function gS(i){process.argv.includes("--verbose")&&(process.env.VERBOSE=i.verbose)}te.registerVerbose=gS;function zp(i){var r=aS.default.getHistoryFile();Iu.appendFileSync(r,i.join(",")+sS.default.EOL)}te.recordCommandHistory=zp;te.default={registerCommandChecker:Wp,recordCommandHistory:zp,registerCustomerCommand:Bp,registerUniversalCommand:kp}});var Xp=I(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.default={clean_up_the_environment:"\u6E05\u7406\u73AF\u5883",display_help_for_command:"\u663E\u793A\u547D\u4EE4\u5E2E\u52A9",remove_components:"\u5220\u9664\u7EC4\u4EF6",delete_the_file_under_the_cache:"\u5220\u9664\u7F13\u5B58\u91CC\u7684\u7684<dirname>\u6587\u4EF6",record_your_log_information:"\u662F\u5426\u8BB0\u5F55\u60A8\u7684\u65E5\u5FD7\u4FE1\u606F\uFF1F",init_pproject_deploy_tip:"\u662F\u5426\u7ACB\u5373\u90E8\u7F72\u8BE5\u9879\u76EE\uFF1F",tip_for_a_serverless_project:"\u68C0\u6D4B\u5230\u5F53\u524D\u76EE\u5F55\u4E0B\u5DF2\u5B58\u5728\u4E00\u4E2AServerless-Devs\u9879\u76EE\uFF0C\u8BF7\u901A\u8FC7 's deploy' \u8FDB\u884C\u90E8\u7F72\u6216\u901A\u8FC7 's -h' \u83B7\u53D6\u66F4\u591A\u4FE1\u606F",create_a_new_project:"\u672A\u68C0\u6D4B\u5230 Serverless-Devs \u9879\u76EE\uFF0C\u662F\u5426\u65B0\u5EFA\u4E00\u4E2A\u9879\u76EE\uFF1F",en:"English (en)",zh:"\u4E2D\u6587 (zh)",select_current_language:"\u8BF7\u9009\u62E9\u5F53\u524D\u8BED\u8A00","app-tip":"\u8BF7\u9009\u62E9\u60A8\u5E0C\u671B\u521B\u5EFA\u7684 Serverless-Devs \u5E94\u7528","template-tip":"\u8BF7\u9009\u62E9\u60A8\u559C\u6B22\u7684\u6A21\u7248","fc-runtime-starter":"fc-runtime-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A FC \u51FD\u6570","fc-custom-container-stater":"fc-custom-container-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A custom-container \u5E94\u7528",web:"web-framework-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Web \u6846\u67B6","static-site":"static-website-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","best-practice":"serverless-best-practice - \u5FEB\u901F\u4F53\u9A8C Serverless \u6700\u4F73\u5B9E\u8DF5","devs-template":"Serverless Devs \u5F00\u53D1\u6A21\u677F","fc-http-nodejs":"fc-http-nodejs - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nodejs12 \u51FD\u6570","fc-http-python":"fc-http-python - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A python3 \u51FD\u6570","fc-http-java":"fc-http-java - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A java8 \u51FD\u6570","fc-custom-container-event-python3":"fc-custom-container-event-python3 - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 python3 \u5E94\u7528","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 cpp \u5E94\u7528","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 springboot \u5E94\u7528","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 aspdotnetcore \u5E94\u7528","express-starter":"express-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A express \u57FA\u7840\u5E94\u7528","koa-starter":"koa-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A koa \u57FA\u7840\u5E94\u7528","nuxtjs-starter":"nuxtjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nuxtjs \u57FA\u7840\u5E94\u7528","eggjs-starter":"eggjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A eggjs \u57FA\u7840\u5E94\u7528","flask-starter":"flask-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A flask \u57FA\u7840\u5E94\u7528","SpringBoot-starter":"SpringBoot-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A SpringBoot \u57FA\u7840\u5E94\u7528","Zblog-starter":"Zblog-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Zblog \u57FA\u7840\u5E94\u7528","website-starter":"website-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","react-starter":"react-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A React.js \u5E94\u7528","vue-starter":"vue-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Vue.js \u5E94\u7528",puppeteer:"puppeteer - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E puppeteer \u622A\u56FE\u7684 Web \u5E94\u7528",ffmpeg:"ffmpeg - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E ffmpeg \u5B9E\u73B0\u97F3\u89C6\u9891\u5904\u7406\u5E94\u7528",pdf2Img:"pdf2Img - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A pdf \u8F6C\u56FE\u7247\u5E94\u7528",tensorflow:"tensorflow - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A tensorflow \u5E94\u7528",todoList:"todoList - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E nodejs \u7684\u7F51\u9875 TodoList \u5E94\u7528"}});var Yp=I(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.default={clean_up_the_environment:"Clean up the environment",display_help_for_command:"Display help for command",remove_components:"Remove component (like: fc, fc@0.0.1)",delete_the_file_under_the_cache:"Delete the <dirname> file in the cache",record_your_log_information:"Do you record your log information?",init_pproject_deploy_tip:"Do you want to deploy the project immediately?",tip_for_a_serverless_project:"A Serverless-Devs project is detected in the current directory, please deploy via 's deploy' or get more information via 's -h'",create_a_new_project:"No Serverless-Devs project is currently detected. Do you want to create a new project?",en:"English (en)",zh:"Chinese (zh)",select_current_language:"Please select current language","app-tip":"Hello, serverlesser. Which template do you like?","template-tip":"Which template do you like?","fc-runtime-starter":"fc-runtime-starter - Deploy FC function in 5 minutes","fc-custom-container-stater":"fc-custom-container-stater - Deploy FC function with custom-container",web:"web-framework-stater-Quickly deploy a web framework","static-site":"static-website-stater-Quickly deploy a static website","best-practice":"serverless-best-practice-Quickly experience serverless best practices","devs-template":"Serverless Develop scaffold","fc-http-nodejs":"fc-http-nodejs - Deploy FC nodejs12 runtime function","fc-http-python":"fc-http-python - Deploy FC python3 runtime function","fc-http-java":"fc-http-java - Deploy FC java8 runtime function","fc-custom-container-event-python3":"fc-custom-container-event-python3 - Deploy python3 event-triggered application","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - Deploy cpp event-triggered application","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - Deploy springboot HTTP Request-triggered application","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - Deploy dotnetcore HTTP Request-triggered application","express-starter":"express-starter - Deploy express application","koa-starter":"koa-starter - Deploy koa application","nuxtjs-starter":"nuxtjs-starter - Deploy nuxtjs application","eggjs-starter":"eggjs-starter - Deploy eggjs application","flask-starter":"flask-starter - Deploy flask application","SpringBoot-starter":"SpringBoot-starter - Deploy SpringBoot application","Zblog-starter":"Zblog-starter - Deploy Zblog application","website-starter":"website-starter - Deploy static website","react-starter":"react-starter - Deploy React.js application","vue-starter":"vue-starter - Deploy Vue.js application",puppeteer:"puppeteer - Deploy screenshot application base on puppeteer + fc",ffmpeg:"ffmpeg - Deploy audio and video processing application base on ffmpeg + fc",pdf2Img:"pdf2Img - Deploy pdf to images application",tensorflow:"tensorflow - Deploy tensorflow application",todoList:"todoList - Deploy todoList application"}});var Zp=I(Zn=>{"use strict";var Kp=Zn&&Zn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Zn,"__esModule",{value:!0});var mS=rr(),vS=Kp(Xp()),_S=Kp(Yp()),qu={en:_S.default,zh:vS.default},yS=function(i){var r=(0,mS.getLang)(),n=qu[r]?qu[r][i]:qu.en[i];return n||i};Zn.default=yS});var zn=I(de=>{"use strict";var Wt=de&&de.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(de,"__esModule",{value:!0});de.getYamlPath=de.i18n=de.logger=de.registerAction=de.urlParser=de.storage=de.configSet=de.common=void 0;var Jp=Wt(require("path")),ES=Wt(Te()),Qp=ES.default.fse,wS=rr();Object.defineProperty(de,"common",{enumerable:!0,get:function(){return Wt(wS).default}});var bS=ls();Object.defineProperty(de,"configSet",{enumerable:!0,get:function(){return Wt(bS).default}});var CS=us();Object.defineProperty(de,"storage",{enumerable:!0,get:function(){return Wt(CS).default}});var SS=sp();Object.defineProperty(de,"urlParser",{enumerable:!0,get:function(){return Wt(SS).default}});var xS=Vp();Object.defineProperty(de,"registerAction",{enumerable:!0,get:function(){return Wt(xS).default}});var OS=Ou();Object.defineProperty(de,"logger",{enumerable:!0,get:function(){return Wt(OS).default}});var AS=Zp();Object.defineProperty(de,"i18n",{enumerable:!0,get:function(){return Wt(AS).default}});var RS=function(i,r){var n=Jp.default.join(i,"".concat(r,".yaml")),o=Jp.default.join(i,"".concat(r,".yml")),a=Qp.existsSync(n)?n:Qp.existsSync(o)?o:void 0;return a};de.getYamlPath=RS});"use strict";var IS=exports&&exports.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},TS=exports&&exports.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},ed=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});var Es=ed(zo()),rn=zn(),PS=Qr(),td=ed(Te()),LS=td.default.inquirer,DS=td.default.colors,NS=rr(),$u=ls(),qS=`Set language information.
|
|
48
|
+
`+(0,tn.emoji)("\u274C")+" Message: Cannot find s.yaml / s.yml / template.yaml / template.yml file, please check the directory "+this.templateFile+`
|
|
49
|
+
`+(0,tn.emoji)("\u{1F9ED}")+` If you want to use Serverless Devs, you should have a s.yaml or use [s cli] command.
|
|
50
|
+
`+(0,tn.emoji)("1\uFE0F\u20E3")+" Yaml document: "+qp.underline("https://github.com/Serverless-Devs/docs/blob/master/zh/yaml.md")+`
|
|
51
|
+
`+(0,tn.emoji)("2\uFE0F\u20E3")+` Cli document: [s cli -h]
|
|
52
|
+
`+(0,tn.emoji)("\u{1F608}")+" If you have questions, please tell us: "+qp.underline("https://github.com/Serverless-Devs/Serverless-Devs/issues")+`
|
|
53
|
+
`),process.exit(1),Y.label=8;case 8:return[3,11];case 9:return be=Y.sent(),[4,new JC.HandleError({error:be,prefix:"Failed to execute:"}).report(be)];case 10:return Y.sent(),process.exit(1),[3,11];case 11:return[2]}})})},i}();Rt.CommandManager=QC});var Fp=I(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.CommandManager=void 0;var eS=$p();Object.defineProperty(_s,"CommandManager",{enumerable:!0,get:function(){return eS.CommandManager}})});var Ou=I(Yn=>{"use strict";var tS=Yn&&Yn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Yn,"__esModule",{value:!0});var Mp=tS(Te()),rS=Mp.default.Logger,nS=Mp.default.spinner,Sr=new rS("S-CLI"),iS=function(){function i(){}return i.log=function(r){Sr.log(r)},i.info=function(r){Sr.info(r)},i.debug=function(r){Sr.debug(r)},i.error=function(r){Sr.error(r)},i.warning=function(r){Sr.warn(r)},i.success=function(r){Sr.log(r,"green")},i.spinner=function(r){return nS(r)},i.output=function(r){return Sr.output(r)},i}();Yn.default=iS});var Vp=I(te=>{"use strict";var xr=te&&te.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},Or=te&&te.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Kn=te&&te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(te,"__esModule",{value:!0});te.recordCommandHistory=te.registerVerbose=te.registerUniversalCommand=te.registerCustomerCommand=te.registerCommandChecker=te.createCustomerCommand=te.getCustomerCommandInfo=te.getParsedTemplateObj=te.getCommandDetail=te.createUniversalCommand=void 0;var sS=Kn(require("os")),jp=Kn(require("path")),Hp=zo(),oS=Fp(),Au=gs(),uS=mu(),aS=Kn(us()),ys=Kn(Ou()),Up=rr(),Ru=Kn(Te()),lS=Ru.default.loadComponent,Iu=Ru.default.fse,cS=Ru.default.jsyaml,fS=Au.version.getSubcommand,hS=Au.version.getServiceConfig;function Tu(i,r,n){for(var o=new Hp.Command(i),a=[],u=[],d=r,m=!1,_=0;_<process.argv.length;_++)m?u.push(process.argv[_]):a.push(process.argv[_]),process.argv[_]===i&&(m=!0);return u.length!==0&&(process.env.temp_params=u.join(" "),process.temp_params=u),process.argv=a,o.description(n||"").action(function(){var c=process.env[uS.PROCESS_ENV_TEMPLATE_NAME];if(c){var v=new oS.CommandManager(c,i,d,process.env.temp_params);v.init()}}),o}te.createUniversalCommand=Tu;function pS(i,r,n){return xr(this,void 0,void 0,function(){var o;return Or(this,function(a){return o=[],[2,o]})})}te.getCommandDetail=pS;function Pu(i){return xr(this,void 0,void 0,function(){var r,n,o;return Or(this,function(a){switch(a.label){case 0:return r=new Au.Parse(i),n=r.getOriginalParsedObj(),[4,r.getRealVariables(n)];case 1:return o=a.sent(),[2,o]}})})}te.getParsedTemplateObj=Pu;function Lu(i){return fS(i)}te.getCustomerCommandInfo=Lu;function dS(i,r){var n=i.length,o=new Array(r-n).fill(" ");return""+i+o.join("")+" : "}function Gp(i){return xr(this,void 0,void 0,function(){var r,n,o,a,u,d=this;return Or(this,function(m){switch(m.label){case 0:return r=[],[4,Pu(i)];case 1:return n=m.sent(),o=Lu(n),a=o.map(function(_){return xr(d,void 0,void 0,function(){var c;return Or(this,function(v){return c=hS(n,_),[2,{projectName:_,projectDocDetail:c}]})})}),[4,Promise.all(a)];case 2:return u=m.sent(),u.forEach(function(_){var c=_.projectName,v=_.projectDocDetail,C=new Hp.Command(c),R=(0,Up.emoji)("\u{1F449}")+" This is a customer command please use [s "+c+" -h] obtain the documentation";C.description(R);var P=process.argv.slice(2),Z=P[0],oe=P[1];Z===c&&oe&&oe.indexOf("-")!==0&&C.addCommand(Tu(oe,c)),C.option("-h, --help","Print usage document"),C.action(function(){return xr(d,void 0,void 0,function(){var be,Y,lt,ve,pe,xe,We,We,nn;return Or(this,function(It){switch(It.label){case 0:return be=v.component,[4,lS(be)];case 1:return Y=It.sent(),Y?Y.__doc&&Y.__doc().length>1685?(lt=Y.__doc(c),ys.default.info(`
|
|
54
|
+
`+lt),[3,6]):[3,2]:[3,7];case 2:return It.trys.push([2,5,,6]),ve=jp.default.join(Y.__path,"publish.yml"),[4,Iu.existsSync(ve)];case 3:return It.sent()||(ve=jp.default.join(Y.__path,"publish.yaml")),[4,cS.load(Iu.readFileSync(ve,"utf8"))];case 4:if(pe=It.sent(),console.log(`
|
|
55
|
+
`+pe.Name+"@"+pe.Version+": "+pe.Description+`
|
|
56
|
+
`),xe=0,pe.Commands){for(We in pe.Commands)We.length>xe&&(xe=We.length);for(We in pe.Commands)console.log(" "+dS(We,xe)+" "+pe.Commands[We]);console.log(`
|
|
57
|
+
`+(pe.HomePage?(0,Up.emoji)("\u{1F9ED}")+" More information: "+pe.HomePage+`
|
|
58
|
+
`:""))}return[3,6];case 5:return nn=It.sent(),ys.default.error("Help information could not be found"),[3,6];case 6:return[3,8];case 7:ys.default.error("Help information could not be found"),It.label=8;case 8:return[2]}})})}),r.push(C)}),[2,r]}})})}te.createCustomerCommand=Gp;function Wp(i){i.on("command:*",function(r){var n=i.commands.map(function(o){return o.name()});n.includes(r[0])||(ys.default.error(" error: unknown command "+r[0]),i.help())})}te.registerCommandChecker=Wp;function Bp(i,r){return xr(this,void 0,void 0,function(){var n;return Or(this,function(o){switch(o.label){case 0:return r?[4,Gp(r)]:[3,2];case 1:n=o.sent(),n.forEach(function(a){i.addCommand(a)}),o.label=2;case 2:return[2]}})})}te.registerCustomerCommand=Bp;function kp(i,r){return xr(this,void 0,void 0,function(){var n,o;return Or(this,function(a){switch(a.label){case 0:return r?[4,Pu(r)]:[3,2];case 1:n=a.sent(),o=Lu(n),process.argv[2]&&!o.includes(process.argv[2])&&!["-h","--help"].includes(process.argv[2])&&i.addCommand(Tu(process.argv[2])),a.label=2;case 2:return[2]}})})}te.registerUniversalCommand=kp;function gS(i){process.argv.includes("--verbose")&&(process.env.VERBOSE=i.verbose)}te.registerVerbose=gS;function zp(i){var r=aS.default.getHistoryFile();Iu.appendFileSync(r,i.join(",")+sS.default.EOL)}te.recordCommandHistory=zp;te.default={registerCommandChecker:Wp,recordCommandHistory:zp,registerCustomerCommand:Bp,registerUniversalCommand:kp}});var Xp=I(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.default={clean_up_the_environment:"\u6E05\u7406\u73AF\u5883",display_help_for_command:"\u663E\u793A\u547D\u4EE4\u5E2E\u52A9",remove_components:"\u5220\u9664\u7EC4\u4EF6",delete_the_file_under_the_cache:"\u5220\u9664\u7F13\u5B58\u91CC\u7684\u7684<dirname>\u6587\u4EF6",record_your_log_information:"\u662F\u5426\u8BB0\u5F55\u60A8\u7684\u65E5\u5FD7\u4FE1\u606F\uFF1F",init_pproject_deploy_tip:"\u662F\u5426\u7ACB\u5373\u90E8\u7F72\u8BE5\u9879\u76EE\uFF1F",tip_for_a_serverless_project:"\u68C0\u6D4B\u5230\u5F53\u524D\u76EE\u5F55\u4E0B\u5DF2\u5B58\u5728\u4E00\u4E2AServerless-Devs\u9879\u76EE\uFF0C\u8BF7\u901A\u8FC7 's deploy' \u8FDB\u884C\u90E8\u7F72\u6216\u901A\u8FC7 's -h' \u83B7\u53D6\u66F4\u591A\u4FE1\u606F",create_a_new_project:"\u672A\u68C0\u6D4B\u5230 Serverless-Devs \u9879\u76EE\uFF0C\u662F\u5426\u65B0\u5EFA\u4E00\u4E2A\u9879\u76EE\uFF1F",en:"English (en)",zh:"\u4E2D\u6587 (zh)",select_current_language:"\u8BF7\u9009\u62E9\u5F53\u524D\u8BED\u8A00","app-tip":"\u8BF7\u9009\u62E9\u60A8\u5E0C\u671B\u521B\u5EFA\u7684 Serverless-Devs \u5E94\u7528","template-tip":"\u8BF7\u9009\u62E9\u60A8\u559C\u6B22\u7684\u6A21\u7248","fc-runtime-starter":"fc-runtime-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A FC \u51FD\u6570","fc-custom-container-stater":"fc-custom-container-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A custom-container \u5E94\u7528",web:"web-framework-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Web \u6846\u67B6","static-site":"static-website-stater - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","best-practice":"serverless-best-practice - \u5FEB\u901F\u4F53\u9A8C Serverless \u6700\u4F73\u5B9E\u8DF5","devs-template":"Serverless Devs \u5F00\u53D1\u6A21\u677F","fc-http-nodejs":"fc-http-nodejs - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nodejs12 \u51FD\u6570","fc-http-python":"fc-http-python - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A python3 \u51FD\u6570","fc-http-java":"fc-http-java - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A java8 \u51FD\u6570","fc-custom-container-event-python3":"fc-custom-container-event-python3 - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 python3 \u5E94\u7528","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7\u4E8B\u4EF6\u89E6\u53D1\u7684 cpp \u5E94\u7528","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 springboot \u5E94\u7528","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u901A\u8FC7 HTTP \u8BF7\u6C42\u89E6\u53D1\u7684 aspdotnetcore \u5E94\u7528","express-starter":"express-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A express \u57FA\u7840\u5E94\u7528","koa-starter":"koa-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A koa \u57FA\u7840\u5E94\u7528","nuxtjs-starter":"nuxtjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A nuxtjs \u57FA\u7840\u5E94\u7528","eggjs-starter":"eggjs-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A eggjs \u57FA\u7840\u5E94\u7528","flask-starter":"flask-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A flask \u57FA\u7840\u5E94\u7528","SpringBoot-starter":"SpringBoot-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A SpringBoot \u57FA\u7840\u5E94\u7528","Zblog-starter":"Zblog-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Zblog \u57FA\u7840\u5E94\u7528","website-starter":"website-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u9759\u6001\u7F51\u7AD9","react-starter":"react-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A React.js \u5E94\u7528","vue-starter":"vue-starter - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A Vue.js \u5E94\u7528",puppeteer:"puppeteer - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E puppeteer \u622A\u56FE\u7684 Web \u5E94\u7528",ffmpeg:"ffmpeg - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E ffmpeg \u5B9E\u73B0\u97F3\u89C6\u9891\u5904\u7406\u5E94\u7528",pdf2Img:"pdf2Img - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A pdf \u8F6C\u56FE\u7247\u5E94\u7528",tensorflow:"tensorflow - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A tensorflow \u5E94\u7528",todoList:"todoList - \u5FEB\u901F\u90E8\u7F72\u4E00\u4E2A\u57FA\u4E8E nodejs \u7684\u7F51\u9875 TodoList \u5E94\u7528"}});var Yp=I(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.default={clean_up_the_environment:"Clean up the environment",display_help_for_command:"Display help for command",remove_components:"Remove component (like: fc, fc@0.0.1)",delete_the_file_under_the_cache:"Delete the <dirname> file in the cache",record_your_log_information:"Do you record your log information?",init_pproject_deploy_tip:"Do you want to deploy the project immediately?",tip_for_a_serverless_project:"A Serverless-Devs project is detected in the current directory, please deploy via 's deploy' or get more information via 's -h'",create_a_new_project:"No Serverless-Devs project is currently detected. Do you want to create a new project?",en:"English (en)",zh:"Chinese (zh)",select_current_language:"Please select current language","app-tip":"Hello, serverlesser. Which template do you like?","template-tip":"Which template do you like?","fc-runtime-starter":"fc-runtime-starter - Deploy FC function in 5 minutes","fc-custom-container-stater":"fc-custom-container-stater - Deploy FC function with custom-container",web:"web-framework-stater-Quickly deploy a web framework","static-site":"static-website-stater-Quickly deploy a static website","best-practice":"serverless-best-practice-Quickly experience serverless best practices","devs-template":"Serverless Develop scaffold","fc-http-nodejs":"fc-http-nodejs - Deploy FC nodejs12 runtime function","fc-http-python":"fc-http-python - Deploy FC python3 runtime function","fc-http-java":"fc-http-java - Deploy FC java8 runtime function","fc-custom-container-event-python3":"fc-custom-container-event-python3 - Deploy python3 event-triggered application","fc-custom-container-event-cpp":"fc-custom-container-event-cpp - Deploy cpp event-triggered application","fc-custom-container-http-springboot":"fc-custom-container-http-springboot - Deploy springboot HTTP Request-triggered application","fc-custom-container-http-aspdotnetcore":"fc-custom-container-http-aspdotnetcore - Deploy dotnetcore HTTP Request-triggered application","express-starter":"express-starter - Deploy express application","koa-starter":"koa-starter - Deploy koa application","nuxtjs-starter":"nuxtjs-starter - Deploy nuxtjs application","eggjs-starter":"eggjs-starter - Deploy eggjs application","flask-starter":"flask-starter - Deploy flask application","SpringBoot-starter":"SpringBoot-starter - Deploy SpringBoot application","Zblog-starter":"Zblog-starter - Deploy Zblog application","website-starter":"website-starter - Deploy static website","react-starter":"react-starter - Deploy React.js application","vue-starter":"vue-starter - Deploy Vue.js application",puppeteer:"puppeteer - Deploy screenshot application base on puppeteer + fc",ffmpeg:"ffmpeg - Deploy audio and video processing application base on ffmpeg + fc",pdf2Img:"pdf2Img - Deploy pdf to images application",tensorflow:"tensorflow - Deploy tensorflow application",todoList:"todoList - Deploy todoList application"}});var Zp=I(Zn=>{"use strict";var Kp=Zn&&Zn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Zn,"__esModule",{value:!0});var mS=rr(),vS=Kp(Xp()),_S=Kp(Yp()),qu={en:_S.default,zh:vS.default},yS=function(i){var r=(0,mS.getLang)(),n=qu[r]?qu[r][i]:qu.en[i];return n||i};Zn.default=yS});var zn=I(de=>{"use strict";var Wt=de&&de.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(de,"__esModule",{value:!0});de.getYamlPath=de.i18n=de.logger=de.registerAction=de.urlParser=de.storage=de.configSet=de.common=void 0;var Jp=Wt(require("path")),ES=Wt(Te()),Qp=ES.default.fse,wS=rr();Object.defineProperty(de,"common",{enumerable:!0,get:function(){return Wt(wS).default}});var bS=ls();Object.defineProperty(de,"configSet",{enumerable:!0,get:function(){return Wt(bS).default}});var CS=us();Object.defineProperty(de,"storage",{enumerable:!0,get:function(){return Wt(CS).default}});var SS=sp();Object.defineProperty(de,"urlParser",{enumerable:!0,get:function(){return Wt(SS).default}});var xS=Vp();Object.defineProperty(de,"registerAction",{enumerable:!0,get:function(){return Wt(xS).default}});var OS=Ou();Object.defineProperty(de,"logger",{enumerable:!0,get:function(){return Wt(OS).default}});var AS=Zp();Object.defineProperty(de,"i18n",{enumerable:!0,get:function(){return Wt(AS).default}});var RS=function(i,r){var n=Jp.default.join(i,r+".yaml"),o=Jp.default.join(i,r+".yml"),a=Qp.existsSync(n)?n:Qp.existsSync(o)?o:void 0;return a};de.getYamlPath=RS});"use strict";var IS=exports&&exports.__awaiter||function(i,r,n,o){function a(u){return u instanceof n?u:new n(function(d){d(u)})}return new(n||(n=Promise))(function(u,d){function m(v){try{c(o.next(v))}catch(C){d(C)}}function _(v){try{c(o.throw(v))}catch(C){d(C)}}function c(v){v.done?u(v.value):a(v.value).then(m,_)}c((o=o.apply(i,r||[])).next())})},TS=exports&&exports.__generator||function(i,r){var n={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,d;return d={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function m(c){return function(v){return _([c,v])}}function _(c){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,a&&(u=c[0]&2?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[c[0]&2,u.value]),c[0]){case 0:case 1:u=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,a=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(u=n.trys,!(u=u.length>0&&u[u.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!u||c[1]>u[0]&&c[1]<u[3])){n.label=c[1];break}if(c[0]===6&&n.label<u[1]){n.label=u[1],u=c;break}if(u&&n.label<u[2]){n.label=u[2],n.ops.push(c);break}u[2]&&n.ops.pop(),n.trys.pop();continue}c=r.call(i,n)}catch(v){c=[6,v],a=0}finally{o=u=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},ed=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});var Es=ed(zo()),rn=zn(),PS=Qr(),td=ed(Te()),LS=td.default.inquirer,DS=td.default.colors,NS=rr(),$u=ls(),qS=`Set language information.
|
|
59
59
|
|
|
60
60
|
Example:
|
|
61
61
|
$ s set locale
|
|
62
62
|
$ s set locale zh
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
\u{1F4AC} Current language:
|
|
66
|
-
`)
|
|
64
|
+
`+(0,NS.emoji)("\u{1F4D6}")+" Document: "+DS.underline("https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/set.md");Es.default.name("s set locale").helpOption("-h, --help","Display help for command").addHelpCommand(!1).description(qS).parse(process.argv);var $S=[{type:"list",name:"locale",message:(0,rn.i18n)("select_current_language"),choices:[{name:(0,rn.i18n)("zh"),value:"zh"},{name:(0,rn.i18n)("en"),value:"en"}]}];(function(){return IS(void 0,void 0,void 0,function(){var i,r;return TS(this,function(n){switch(n.label){case 0:return Es.default.args.length!==0?[3,2]:(rn.logger.log(`
|
|
65
|
+
\u{1F4AC} Current language: `+(0,rn.i18n)((0,$u.getConfig)("locale"))+`
|
|
66
|
+
`),[4,LS.prompt($S)]);case 1:i=n.sent(),(0,$u.setConfig)("locale",i.locale),n.label=2;case 2:return Es.default.args.length>0&&(r=Es.default.args[0],r&&((0,$u.setConfig)("locale",r),rn.logger.success("Setup succeeded"))),[2]}})})})().catch(function(i){throw new PS.CommandError(i.message)});
|
|
67
67
|
/**
|
|
68
68
|
* @license
|
|
69
69
|
* Lodash <https://lodash.com/>
|