UNPKG

@sdesktop/s

Version:

Serverless devs tool, just for desktop.

1 lines 2.19 MB
(()=>{var __webpack_modules__={9380:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DEFAULT_REGIRSTRY=r.PROCESS_ENV_TEMPLATE_NAME=void 0;r.PROCESS_ENV_TEMPLATE_NAME="templateFile";r.DEFAULT_REGIRSTRY="http://registry.devsapp.cn/simple"},4410:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.CommandManager=void 0;var u=s(n(3528));var l=n(2001);var p=n(8683);var h=n(1389);var m=p.common.checkTemplateFile;var v=l.version.getServiceConfig,y=l.version.getServiceConfigDetail;var g=function(){function CommandManager(t,r,n,i){this.templateFile=t;this.method=r;this.customerCommandName=n;this.deployParams=i}CommandManager.prototype.assemblyProjectConfig=function(t,r,n){return i(this,void 0,void 0,(function(){var i,s;return o(this,(function(o){switch(o.label){case 0:return[4,t.getRealVariables(n)];case 1:i=o.sent();s=v(i,r);s.appName=i.name;s.ProjectName=r;if(this.deployParams){s.params=this.deployParams;s.Params=this.deployParams}return[2,s]}}))}))};CommandManager.prototype.init=function(){return i(this,void 0,void 0,(function(){var t,r,n,i,s,v,g,_,w,x,S,E,k,O,C,D,w,j,A,S,T,S;return o(this,(function(o){switch(o.label){case 0:t={isOk:true,customerCommand:"",component:"",result:""};o.label=1;case 1:o.trys.push([1,13,,14]);p.logger.info("Start ...");r=m(this.templateFile);if(!r)return[3,11];n={};i=new l.Parse(r);s=i.getOriginalParsedObj();if(!this.customerCommandName)return[3,7];return[4,this.assemblyProjectConfig(i,this.customerCommandName,s)];case 2:v=o.sent();g=y(v).name;t.component=g;t.customerCommand=this.customerCommandName;_=new h.ComponentExeCute(v,this.method,s.edition);o.label=3;case 3:o.trys.push([3,5,,6]);return[4,_.init()];case 4:w=o.sent();if(w){n[v.ProjectName]=w}return[3,6];case 5:x=o.sent();t.isOk=false;S=x.message.includes("componentInstance[method] is not a function")?"Project "+v.ProjectName+" does not include ["+this.method+"] method":x.message;throw new Error("Project "+v.ProjectName+" failed to execute:\n \n 📝 Message: "+S+"\n 🧭 You can get help for this component by [s "+v.ProjectName+" -h]\n 😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n");case 6:return[3,10];case 7:E=this.deployParams||"";return[4,i.getRealVariables(s)];case 8:k=o.sent();O=new l.Analysis(k,i.dependenciesMap);C=O.getProjectOrder();t.component=C.join(",");p.logger.info("It is detected that your project has the following projects < "+C.join(",")+" > to be execute");D=h.generateSynchronizeComponentExeList({list:C,parse:i,parsedObj:s,method:this.method,params:E},this.assemblyProjectConfig.bind(this));return[4,h.synchronizeExecuteComponentList(D)];case 9:w=o.sent();for(j in w){if(C.includes(j)&&w[j]){n[j]=w[j]}}o.label=10;case 10:A=u.default.dump(JSON.parse(JSON.stringify(n)));t.result=A;if(process.env["s-execute-file"]){t.isOk=false;p.logger.error("All projects were not deployed successfully.\n \n "+u.default.dump(JSON.parse(process.env["s-execute-file"])["Error"])+" 😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n");process.send({action:"execute-command",data:t});process.exit(-1)}else{process.send({action:"execute-command",data:t});p.logger.success(Object.keys(n).length===0?"End of method: "+this.method:A)}return[3,12];case 11:t.isOk=false;S="Failed to execute:\n\n ❌ Message: Cannot find s.yaml / s.yml / template.yaml / template.yml file, please check the directory "+this.templateFile+"\n 🧭 If you want to use Serverless Devs, you should have a s.yaml or use [s cli] command.\n 1️⃣ Yaml document: https://github.com/Serverless-Devs/docs/blob/master/zh/yaml.md\n 2️⃣ Cli document: [s cli -h]\n 😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n";t.result=S;p.logger.error(S);process.send({action:"execute-command",data:t});process.exit(-1);o.label=12;case 12:return[3,14];case 13:T=o.sent();S="Failed to execute:\n\n ❌ Message: "+T.message+"\n 😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n";t.result=S;p.logger.error(S);process.send({action:"execute-command",data:t});process.exit(-1);return[3,14];case 14:return[2]}}))}))};return CommandManager}();r.CommandManager=g},9211:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};Object.defineProperty(r,"__esModule",{value:true});var s=n(4410);var u="templateFile";function start(t){var r=t.method,n=t.sPath,u=t.customerCommand,l=t.actionParams;return i(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:t=new s.CommandManager(n,r,u,l);return[4,t.init()];case 1:i.sent();return[2]}}))}))}process.on("message",(function(t){return i(void 0,void 0,void 0,(function(){var r,n,i,s;return o(this,(function(o){switch(o.label){case 0:if(!(t.action==="start"))return[3,2];r=t.method,n=t.sPath,i=t.customerCommand,s=t.actionParams;process.env[u]=n;return[4,start({method:r,sPath:n,customerCommand:i,actionParams:s})];case 1:o.sent();process.exit(-1);o.label=2;case 2:return[2]}}))}))}))},2630:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.Hook=void 0;var u=s(n(5747));var l=s(n(5622));var p=n(8683);var h=n(3845);var m=n(3129).spawnSync;var v=function(){function Hook(t){var r=this;if(t===void 0){t=[]}this.preHooks=[];this.afterHooks=[];t.forEach((function(t){if(t.Pre){r.preHooks.push(t)}else{r.afterHooks.push(t)}}))}Hook.prototype.executePreHook=function(){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!(this.preHooks.length>0))return[3,5];p.logger.info("Start the pre-action");t=0;n.label=1;case 1:if(!(t<this.preHooks.length))return[3,4];r=t;p.logger.info("Action: "+(this.preHooks[r].Hook||this.preHooks[r].Plugin));return[4,this.executeByConfig(this.preHooks[r])];case 2:n.sent();n.label=3;case 3:t++;return[3,1];case 4:p.logger.info("End the pre-action");n.label=5;case 5:return[2]}}))}))};Hook.prototype.executeAfterHook=function(){return i(this,void 0,void 0,(function(){var t,r;return o(this,(function(n){switch(n.label){case 0:if(!(this.afterHooks.length>0))return[3,5];p.logger.info("Start the after-action");t=0;n.label=1;case 1:if(!(t<this.afterHooks.length))return[3,4];r=t;p.logger.info("Action: "+(this.afterHooks[r].Hook||this.afterHooks[r].Plugin));return[4,this.executeByConfig(this.afterHooks[r])];case 2:n.sent();n.label=3;case 3:t++;return[3,1];case 4:p.logger.info("End the after-action");n.label=5;case 5:return[2]}}))}))};Hook.prototype.commandExecute=function(t,r){return i(this,void 0,void 0,(function(){var n,i,s;return o(this,(function(o){n=process.cwd();i=r?l.default.resolve(n,r):n;if(u.default.existsSync(i)&&u.default.lstatSync(i).isDirectory()){process.env["next-command-execute-flag"]="true";s=m(t,[],{cwd:i,stdio:"inherit",shell:true});if(s&&s.status!==0){throw new Error("Action ["+t+"] run error.")}}return[2]}))}))};Hook.prototype.pluginExecute=function(t){return i(this,void 0,void 0,(function(){var r,n;return o(this,(function(i){switch(i.label){case 0:r=new h.PluginExeCute({name:t});return[4,r.init()];case 1:i.sent();return[4,r.loadPlugin()];case 2:n=i.sent();n.apply(null,[]);return[2]}}))}))};Hook.prototype.executeByConfig=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:if(!t.Hook)return[3,2];return[4,this.commandExecute(t.Hook,t.Path)];case 1:r.sent();return[3,4];case 2:if(!t.Plugin)return[3,4];return[4,this.pluginExecute(t.Plugin)];case 3:r.sent();r.label=4;case 4:return[2]}}))}))};return Hook}();r.Hook=v},1389:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.ComponentExeCute=r.generateSynchronizeComponentExeList=r.synchronizeExecuteComponentList=void 0;var u=s(n(5747));var l=s(n(5622));var p=s(n(2087));var h=n(3188);var m=n(9380);var v=n(2001);var y=n(8683);var g=n(2630);var _=s(n(3528));var w=v.version.getServiceConfigDetail,x=v.version.getServiceInputs,S=v.version.getServiceActions;var E=l.default.join(p.default.homedir(),".s","components");function synchronizeExecuteComponentList(t,r,n){if(t===void 0){t=[]}if(r===void 0){r=0}if(n===void 0){n={}}return i(this,void 0,void 0,(function(){var s=this;return o(this,(function(u){switch(u.label){case 0:if(!(r>=0&&r<t.length))return[3,2];return[4,t[r]().then((function(u){var l=u.name,p=u.data;return i(s,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:if(l){n[l]=p}return[4,synchronizeExecuteComponentList(t,r+1,n)];case 1:return[2,i.sent()]}}))}))}))];case 1:return[2,u.sent()];case 2:return[2,n]}}))}))}r.synchronizeExecuteComponentList=synchronizeExecuteComponentList;function generateSynchronizeComponentExeList(t,r){var n=this;var s=t.list,u=t.parse,l=t.parsedObj,p=t.method,h=t.params;return s.map((function(t){return function(){return new Promise((function(s,m){return i(n,void 0,void 0,(function(){var n,i,m,v,g,_;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);l.Params=h||"";y.logger.info("Start executing project "+t);return[4,r(u,t,l)];case 1:n=o.sent();i=new k(n,p,l.edition);return[4,i.init()];case 2:m=o.sent();if(l.edition){l.services[t].output=m}else{l[t].Output=m}y.logger.info("Project "+t+" successfully to execute \n\t");s({name:t,data:m});return[3,4];case 3:v=o.sent();g=JSON.parse(process.env["s-execute-file"]||'{"Error": []}');_={};_[t]=v.message.includes("componentInstance[method] is not a function")?"Project "+t+" does not include ["+p+"] method":v.message;g["Error"].push(_);process.env["s-execute-file"]=JSON.stringify(g);y.logger.error("Project "+t+" failed to execute: \n 📝 Message: "+_[t]+"\n 🧭 You can get help for this component by [s "+t+" -h]");s({});return[3,4];case 4:return[2]}}))}))}))}}))}r.generateSynchronizeComponentExeList=generateSynchronizeComponentExeList;var k=function(){function ComponentExeCute(t,r,n){if(n===void 0){n="0.0.1"}this.componentConfig=t;this.method=r;this.version=n;if(!u.default.existsSync(E)){u.default.mkdirSync(E)}}ComponentExeCute.prototype.init=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:t=this;return[4,this.getCredentials()];case 1:t.credentials=r.sent()||{};return[4,this.startExecute()];case 2:return[2,r.sent()]}}))}))};ComponentExeCute.prototype.getCredentials=function(){return i(this,void 0,void 0,(function(){var t,r,n,i,s,m;return o(this,(function(o){switch(o.label){case 0:t=w(this.componentConfig),r=t.access,n=t.autoCredential;if(n===false){return[2,null]}o.label=1;case 1:o.trys.push([1,4,,5]);i=l.default.join(p.default.homedir(),".s","access.yaml");s=_.default.load(u.default.readFileSync(i,"utf8")||"{}");if(!s[r])return[3,3];return[4,h.getCredential(r)];case 2:return[2,o.sent()];case 3:return[3,5];case 4:m=o.sent();return[3,5];case 5:return[2,{}]}}))}))};ComponentExeCute.prototype.loadExtends=function(){var t=S(this.componentConfig,this.version,{method:this.method});var r=null;if(t){r=new g.Hook(t)}return r};ComponentExeCute.prototype.loadPreExtends=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:if(!t)return[3,2];return[4,t.executePreHook()];case 1:r.sent();r.label=2;case 2:return[2]}}))}))};ComponentExeCute.prototype.loadAfterExtend=function(t){return i(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:if(!t)return[3,2];return[4,t.executeAfterHook()];case 1:r.sent();r.label=2;case 2:return[2]}}))}))};ComponentExeCute.prototype.invokeMethod=function(t,r,n){return i(this,void 0,void 0,(function(){var s;var u=this;return o(this,(function(l){s=new Promise((function(s,l){return i(u,void 0,void 0,(function(){var i,u;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,t[r](n)];case 1:i=o.sent();s(i);return[3,3];case 2:u=o.sent();l(u);return[3,3];case 3:return[2]}}))}))}));return[2,s]}))}))};ComponentExeCute.prototype.executeCommand=function(){return i(this,void 0,void 0,(function(){var t,r,n,i,s;return o(this,(function(o){switch(o.label){case 0:t=x(this.componentConfig,this.version,{method:this.method,credentials:this.credentials});r=w(this.componentConfig).name;n=m.DEFAULT_REGIRSTRY;return[4,h.loadComponent(r,n)];case 1:i=o.sent();return[4,this.invokeMethod(i,this.method,t)];case 2:s=o.sent();return[2,s]}}))}))};ComponentExeCute.prototype.startExecute=function(){return i(this,void 0,void 0,(function(){var t,r,n,i,s;return o(this,(function(o){switch(o.label){case 0:t={};r=process.env.temp_params||"";n=r.includes("--help")||r.includes("-h");if(!(process.env["skip-actions"]==="true"||n))return[3,1];s=null;return[3,3];case 1:return[4,this.loadExtends()];case 2:s=o.sent();o.label=3;case 3:i=s;return[4,this.loadPreExtends(i)];case 4:o.sent();return[4,this.executeCommand()];case 5:t=o.sent();return[4,this.loadAfterExtend(i)];case 6:o.sent();return[2,t]}}))}))};return ComponentExeCute}();r.ComponentExeCute=k},3845:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.PluginExeCute=void 0;var u=s(n(5747));var l=s(n(5622));var p=s(n(2087));var h=l.default.join(p.default.homedir(),".s","plugins");var m=function(){function PluginExeCute(t){this.pluginConfig=t;if(!u.default.existsSync(h)){u.default.mkdirSync(h)}var r=this.pluginConfig.name;this.pluginPath=l.default.join(h,r)}PluginExeCute.prototype.init=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:t=this.pluginConfig.name;if(!!this.pluginExist())return[3,2];return[4,this.downLoadPlugin(t)];case 1:r.sent();r.label=2;case 2:return[2]}}))}))};PluginExeCute.prototype.pluginExist=function(){return u.default.existsSync(this.pluginPath)};PluginExeCute.prototype.downLoadPlugin=function(t){return i(this,void 0,void 0,(function(){var r;return o(this,(function(n){r=l.default.join(h,t);if(!u.default.existsSync(r)){u.default.mkdirSync(r)}return[2]}))}))};PluginExeCute.prototype.loadPlugin=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){t=require(this.pluginPath);return[2,t]}))}))};return PluginExeCute}();r.PluginExeCute=m},6049:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.Analysis=void 0;var n=function(){function Analysis(t,r){this.parsedObj=t;this.dependenciesMap=r;this.componentOrderKeyMap={}}Analysis.prototype.getComponentOrderKeyMap=function(t){var r=this;t.forEach((function(t){r.componentOrderKeyMap[t]=1}))};Analysis.prototype.calculateOrderNumber=function(t){var r=this;t.forEach((function(t){var n=r.dependenciesMap[t];Object.keys(n).forEach((function(t){if(r.componentOrderKeyMap[t]){r.componentOrderKeyMap[t]+=n[t]}}))}))};Analysis.prototype.getProjectOrder=function(){var t=this;var r=Object.keys(this.dependenciesMap).filter((function(t){return t!=="Global"}));this.getComponentOrderKeyMap(r);this.calculateOrderNumber(r);var n=Object.keys(this.componentOrderKeyMap).map((function(r){return{name:r,order:t.componentOrderKeyMap[r]}}));return n.sort((function(t,r){return r.order-t.order})).map((function(t){return t.name}))};return Analysis}();r.Analysis=n},2001:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.version=r.Analysis=r.Parse=void 0;var o=n(9818);Object.defineProperty(r,"Parse",{enumerable:true,get:function(){return o.Parse}});var s=n(6049);Object.defineProperty(r,"Analysis",{enumerable:true,get:function(){return s.Analysis}});var u=n(9127);Object.defineProperty(r,"version",{enumerable:true,get:function(){return i(u).default}})},9818:function(t,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,r,n,i){if(i===undefined)i=n;Object.defineProperty(t,i,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,i){if(i===undefined)i=n;t[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.prototype.hasOwnProperty.call(t,n))i(r,t,n);o(r,t);return r};var u=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var l=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var p=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.Parse=void 0;var h=s(n(5747));var m=s(n(5622));var v=p(n(3528));var y=n(9127);var g=n(8683);var _=new RegExp(/\$\{(.*)\}/,"i");var w=new RegExp(/(.*)\((.*)\)/,"i");var x=["[object Number]","[object Boolean]"];var S=function(){function Parse(t){this.path=t;this.parsedObj={};this.dependenciesMap={};this.globalJsonKeyMap={};this.globalKeyArr=[];this.magicVariablesArray=[];if(h.existsSync(t)){try{this.init(t)}catch(t){throw new Error(t.message)}}}Parse.prototype.getFileObj=function(t){var r={};try{var n=m.extname(t);if(n.indexOf(".yaml")!==-1||n.indexOf(".yml")!==-1){r=v.default.load(h.readFileSync(t,"utf8"))}if(n.indexOf(".json")!==-1){r=JSON.parse(h.readFileSync(t).toString())}}catch(t){if(process.env["serverless_devs_out_put_help"]!=="true"){g.logger.error("Failed to execute:\n\n ❌ Message: The file converted by parse is abnormal "+t.message+"\n 🧭 Please make sure your Yaml/JSON file is standard. \n 📚 Yaml document: https://github.com/Serverless-Devs/docs/blob/master/zh/yaml.md\n 😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues\n");process.exit(-1)}}return r};Parse.prototype.init=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(r){this.parsedObj=this.getFileObj(t);return[2]}))}))};Parse.prototype.getOriginalParsedObj=function(){return this.parsedObj};Parse.prototype.findVariableValue=function(t){var r=t.variableName,n=t.type,i=t.funName,o=t.funVariable;var s="";if(n==="Literal"){return this.globalJsonKeyMap[r]||this.globalJsonKeyMap["services."+r]||"${"+r+"}"}if(n==="Fun"&&(i==="Env"||i==="env")){return process.env[o]}if(n==="Fun"&&(i==="Path"||i==="path")){return m.join(process.cwd(),o)}if(n==="Fun"&&(i==="File"||i==="file")){return this.getFileObj(o)}return s};Parse.prototype.generateMagicVariables=function(t,r,n){var i=this;if(r===void 0){r=[]}if(n===void 0){n=""}if(Object.prototype.toString.call(t)==="[object Object]"){if(n!==""){n=n+"."}Object.keys(t).map((function(o){var s=""+n+o;var u=t[o];r.push(s);r.concat(i.generateMagicVariables(u,r,""+s));i.globalJsonKeyMap[s]=u}))}else if(Object.prototype.toString.call(t)==="[object Array]"){t.forEach((function(o,s){var u=n+"["+s+"]";var l=n+"["+(s-t.length)+"]";r.push(u);r.push(l);r.concat(i.generateMagicVariables(o,r,""+u));r.concat(i.generateMagicVariables(o,r,""+l));i.globalJsonKeyMap[u]=o;i.globalJsonKeyMap[l]=o}))}else{r=[]}return r};Parse.prototype.isProjectProperties=function(t,r){var n=false;if(r==="Properties"&&this.globalJsonKeyMap[t+"."+r]){n=true}return n};Parse.prototype.iteratorToSetValue=function(t,r,n){var i=this;if(x.includes(Object.prototype.toString.call(t))){return t}if(Object.prototype.toString.call(t)==="[object String]"){var o=t.match(_);if(o){var s=o[1];var u={variableName:s,type:"Literal",funName:null,funVariable:""};var l=s.match(w);if(l){u.funName=l[1];u.funVariable=l[2];u.type="Fun"}else{var p=this.dependenciesMap[r];if(!p){p={}}var h=s.split(".")[0];p[h]=1;this.dependenciesMap[r]=p}var m=this.findVariableValue(u);return Object.prototype.toString.call(m)==="[object String]"?t.replace(_,m):m}this.dependenciesMap[r]={};return t}if(Object.prototype.toString.call(t)==="[object Array]"){return t.map((function(t){return i.iteratorToSetValue(t,r)}))}if(Object.prototype.toString.call(t)==="[object Object]"){Object.keys(t).forEach((function(o){t[o]=i.iteratorToSetValue(t[o],r,n||o)}));return t}};Parse.prototype.replaceVariable=function(t){var r=this;var n=y.getServiceList(t);Object.keys(n).forEach((function(t){var i=n[t];n[t]=r.iteratorToSetValue(i,t)}));if(t.services){t.services=n}else{t=n}return t};Parse.prototype.getRealVariables=function(t){return u(this,void 0,void 0,(function(){var r;return l(this,(function(n){this.globalKeyArr=this.generateMagicVariables(t);r=this.replaceVariable(t);return[2,r]}))}))};return Parse}();r.Parse=S},9127:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getServiceList=r.getServiceActions=r.getServiceInputs=r.getServiceConfigDetail=r.getServiceConfig=r.getSubcommand=void 0;function getSubcommand(t){var r=t.edition||"0.0.1";if(r==="0.0.1"){return Object.keys(t).filter((function(t){return t!=="Global"}))}else{var n=t.services||{};return Object.keys(n)}}r.getSubcommand=getSubcommand;function getServiceConfig(t,r){var n=t.edition||"0.0.1";if(n==="0.0.1"){return t[r]}else{var i=t.services||{};var o=i[r];var s=o.provider?o.provider:t.provider;var u=o.access?o.access:t.access;var l=Object.assign({},o,{access:u,provider:s});return l}}r.getServiceConfig=getServiceConfig;function getServiceConfigDetail(t){var r=t.Component||t.component;var n=t.Provider||t.provider;var i=t.Access||t.access||"default";var o=t.autoCredential;return{name:r,provider:n,access:i,autoCredential:o}}r.getServiceConfigDetail=getServiceConfigDetail;function getServiceInputs(t,r,n){if(r==="0.0.1"){var i=t.Properties,o=t.Params,s=t.Provider,u=t.Access,l=t.Component,p=t.ProjectName;var h=n.credentials,m=n.method;var v={Properties:i,Credentials:h,Project:{ProjectName:p,Component:l,Provider:s,AccessAlias:u||""},Command:m,Args:o||"",Path:{ConfigPath:process.env.templateFile||""}};return v}else{var y=t.props,g=t.params,_=t.provider,w=t.access,x=t.component,p=t.ProjectName,S=t.appName;var h=n.credentials,m=n.method;var v={props:y,Properties:y,Credentials:h,credentials:h,appName:S,Project:{ProjectName:p,projectName:p,component:x,Component:x,provider:_,Provider:_,accessAlias:w||"",AccessAlias:w||""},project:{component:x,access:w||"",projectName:p},command:m,Command:m,args:g||"",Args:g||"",path:{configPath:process.env.templateFile||""},Path:{ConfigPath:process.env.templateFile||""}};return v}}r.getServiceInputs=getServiceInputs;function getServiceActions(t,r,n){var i=n.method;if(r==="0.0.1"){var o=t.Extends,s=o===void 0?{}:o;var u=s[i];return u}else{var l=t.actions,p=l===void 0?{}:l;var h=[];Object.keys(p).forEach((function(t){var r=t.split("-");var n=p[t];if(r.length>1){var o=r[1];if(o===i){var s=r[0];n.forEach((function(t){var r={Hook:t.run,Path:t.path,Pre:s==="pre"?true:false};h.push(r)}))}}else if(t===i){n.forEach((function(t){var r={Hook:t.run,Path:t.path,Pre:false};h.push(r)}))}}));return h}}r.getServiceActions=getServiceActions;function getServiceList(t){var r=t.edition||"0.0.1";if(r==="0.0.1"){return t}else{return t.services}}r.getServiceList=getServiceList;r.default={getSubcommand:getSubcommand,getServiceConfig:getServiceConfig,getServiceConfigDetail:getServiceConfigDetail,getServiceInputs:getServiceInputs,getServiceActions:getServiceActions,getServiceList:getServiceList}},3570:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.recordCommandHistory=r.registerVerbose=r.registerCommandChecker=r.getCustomerCommandInfo=r.getParsedTemplateObj=r.getCommandDetail=void 0;var u=s(n(7083));var l=s(n(2087));var p=n(2001);var h=n(9127);var m=s(n(5571));var v=s(n(4193));function getCommandDetail(t,r,n){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){t=[];return[2,t]}))}))}r.getCommandDetail=getCommandDetail;function getParsedTemplateObj(t){return i(this,void 0,void 0,(function(){var r,n,i;return o(this,(function(o){switch(o.label){case 0:r=new p.Parse(t);n=r.getOriginalParsedObj();return[4,r.getRealVariables(n)];case 1:i=o.sent();return[2,i]}}))}))}r.getParsedTemplateObj=getParsedTemplateObj;function getCustomerCommandInfo(t){return h.getSubcommand(t)}r.getCustomerCommandInfo=getCustomerCommandInfo;function registerCommandChecker(t){t.on("command:*",(function(r){var n=t.commands.map((function(t){return t.name()}));if(!n.includes(r[0])){v.default.error(" error: unknown command "+r[0]);t.help()}}))}r.registerCommandChecker=registerCommandChecker;function registerVerbose(t){if(process.argv.includes("--verbose")){process.env.VERBOSE=t.verbose}}r.registerVerbose=registerVerbose;function recordCommandHistory(t){var r=m.default.getHistoryFile();u.default.appendFileSync(r,t.join(",")+l.default.EOL)}r.recordCommandHistory=recordCommandHistory;r.default={registerCommandChecker:registerCommandChecker,recordCommandHistory:recordCommandHistory}},5115:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.mark=r.replaceTemplate=r.getTemplatekey=r.replaceFun=r.getLang=r.printn=r.checkTemplateFile=r.checkAndReturnTemplateFile=void 0;var u=s(n(5622));var l=s(n(5747));var p=s(n(3528));var h=s(n(1676));var m=n(5074);function checkTemplateFormat(t,r){if(r===void 0){r=false}var n=l.default.readFileSync(t,"utf8");var i=r?JSON.parse(n):p.default.load(n);for(var o in i){if(i[o].Component&&i[o].Provider&&i[o].Properties){return true}}return false}function checkAndReturnTemplateFile(){var t=process.cwd();var r=process.argv.indexOf("-t")||process.argv.indexOf("--template");if(r!==-1){var n=r+1;var i=process.argv[n];if(i){if(i.endsWith(".yaml")||i.endsWith(".yml")||i.endsWith(".json")){var o=i.endsWith(".json")?true:false;if(l.default.existsSync(u.default.join(t,i))&&checkTemplateFormat(u.default.join(t,i),o)){process.argv.splice(r,2);return u.default.join(t,i)}else if(l.default.existsSync(i)&&checkTemplateFormat(i,o)){process.argv.splice(r,2);return i}}}}if(l.default.existsSync(u.default.join(t,"s.yaml"))){return u.default.join(t,"s.yaml")}if(l.default.existsSync(u.default.join(t,"s.yml"))){return u.default.join(t,"s.yml")}if(l.default.existsSync(u.default.join(t,"s.json"))){return u.default.join(t,"s.json")}if(l.default.existsSync(u.default.join(t,"template.yaml"))){return u.default.join(t,"template.yaml")}if(l.default.existsSync(u.default.join(t,"template.yml"))){return u.default.join(t,"template.yml")}if(l.default.existsSync(u.default.join(t,"template.json"))){return u.default.join(t,"template.json")}return null}r.checkAndReturnTemplateFile=checkAndReturnTemplateFile;function checkTemplateFile(t){if(l.default.existsSync(t)){return t}return null}r.checkTemplateFile=checkTemplateFile;function printn(t,r){if(r===void 0){r=" "}var n="";for(var i=0;i<t;i++){n=n+r}return n}r.printn=printn;function getLang(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,m.handlerProfileFile({read:true,filePath:"set-config.yml"})];case 1:return[2,r.sent().locale||"en"];case 2:t=r.sent();return[2,"en"];case 3:return[2]}}))}))}r.getLang=getLang;function replaceFun(t,r){var n=/\{\{(.*?)\}\}/g;var i=t.match(n);if(i){for(var o=0;o<i.length;o++){var s=i[o].replace(/{{|}}/g,"");var u=h.default.trim(s.split("|")[0]);if(r[u]){t=t.replace(i[o],r[u])}}}return t}r.replaceFun=replaceFun;function getTemplatekey(t){var r=/\{\{(.*?)\}\}/g;var n=t.match(r);if(!n){return[]}return n.filter((function(t){return t})).map((function(t){var r=t.replace(/{{|}}/g,"");var n=r.split("|");return{name:h.default.trim(n[0]),desc:n[1]||""}}))}r.getTemplatekey=getTemplatekey;function replaceTemplate(t,r){t.forEach((function(t){if(l.default.existsSync(t)){var n=l.default.readFileSync(t,"utf-8");var i=replaceFun(n,r);l.default.writeFileSync(t,i,"utf-8")}}))}r.replaceTemplate=replaceTemplate;function mark(t){if(!t){return t}var r=t.slice(-4);return"***********"+r}r.mark=mark;r.default={checkAndReturnTemplateFile:checkAndReturnTemplateFile,checkTemplateFile:checkTemplateFile,printn:printn,mark:mark,getLang:getLang,replaceTemplate:replaceTemplate,replaceFun:replaceFun,getTemplatekey:getTemplatekey}},5074:function(t,r,n){"use strict";var i=this&&this.__awaiter||function(t,r,n,i){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(t){try{step(i.next(t))}catch(t){o(t)}}function rejected(t){try{step(i["throw"](t))}catch(t){o(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((i=i.apply(t,r||[])).next())}))};var o=this&&this.__generator||function(t,r){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,o,s,u;return u={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function verb(t){return function(r){return step([t,r])}}function step(u){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,o&&(s=u[0]&2?o["return"]:u[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,u[1])).done)return s;if(o=0,s)u=[u[0]&2,s.value];switch(u[0]){case 0:case 1:s=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;o=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1];s=u;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(u);break}if(s[2])n.ops.pop();n.trys.pop();continue}u=r.call(t,n)}catch(t){u=[6,t];o=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.handlerProfileFile=r.getConfig=r.setConfig=void 0;var u=s(n(2087));var l=s(n(7083));var p=s(n(5622));var h=s(n(3528));var m=s(n(5571));function setProfileFile(t){var r=getDefaultProfilePath();l.default.writeFileSync(r,h.default.dump(t))}function getProfileFile(){var t=getDefaultProfilePath();if(!l.default.existsSync(t)){return{}}try{var r=h.default.load(l.default.readFileSync(t,"utf8"))||{};return r}catch(t){throw t}}function getDefaultProfilePath(){var t=p.default.join(m.default.getHomeDir(),"set-config.yml");if(!l.default.existsSync(t)){l.default.createFileSync(t)}return t}function setConfig(t,r){var n=getProfileFile();n[t]=r;setProfileFile(n)}r.setConfig=setConfig;function getConfig(t){var r=getProfileFile();return r[t]}r.getConfig=getConfig;function handlerProfileFile(t){return i(this,void 0,void 0,(function(){var r,n,i,s,m,v,y;return o(this,(function(o){switch(o.label){case 0:r=t.filePath||"set-config.yml";n=p.default.join(u.default.homedir(),".s",r);i=l.default.existsSync(n);s={};if(!!i)return[3,5];m=p.default.join(u.default.homedir(),".s");o.label=1;case 1:o.trys.push([1,2,,4]);l.default.statSync(m);return[3,4];case 2:v=o.sent();return[4,l.default.mkdirSync(m)];case 3:o.sent();return[3,4];case 4:return[3,6];case 5:try{s=h.default.load(l.default.readFileSync(n,"utf8"))||{}}catch(t){throw t}o.label=6;case 6:if(t.read){return[2,s]}y=t.configKey||"";s[y]=t.data;return[4,l.default.writeFileSync(n,h.default.dump(s))];case 7:o.sent();return[2,s]}}))}))}r.handlerProfileFile=handlerProfileFile;r.default={setConfig:setConfig,getConfig:getConfig,handlerProfileFile:handlerProfileFile}},8683:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.getYamlPath=r.logger=r.registerAction=r.urlParser=r.storage=r.configSet=r.common=void 0;var o=i(n(5622));var s=i(n(7083));var u=n(5115);Object.defineProperty(r,"common",{enumerable:true,get:function(){return i(u).default}});var l=n(5074);Object.defineProperty(r,"configSet",{enumerable:true,get:function(){return i(l).default}});var p=n(5571);Object.defineProperty(r,"storage",{enumerable:true,get:function(){return i(p).default}});var h=n(1791);Object.defineProperty(r,"urlParser",{enumerable:true,get:function(){return i(h).default}});var m=n(3570);Object.defineProperty(r,"registerAction",{enumerable:true,get:function(){return i(m).default}});var v=n(4193);Object.defineProperty(r,"logger",{enumerable:true,get:function(){return i(v).default}});var getYamlPath=function(t,r){var n=o.default.join(t,r+".yaml");var i=o.default.join(t,r+".yml");var u=s.default.existsSync(n)?n:s.default.existsSync(i)?i:undefined;return u};r.getYamlPath=getYamlPath},4193:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});var i=n(3188);var o="S-CLI";var s=function(){function ServerlessDevsCliLogger(){}ServerlessDevsCliLogger.log=function(t){i.Logger.log(t)};ServerlessDevsCliLogger.info=function(t){i.Logger.info(o,t)};ServerlessDevsCliLogger.debug=function(t){i.Logger.debug(o,t)};ServerlessDevsCliLogger.error=function(t){i.Logger.error(o,t)};ServerlessDevsCliLogger.warning=function(t){i.Logger.warn(o,t)};ServerlessDevsCliLogger.success=function(t){i.Logger.log(t,"green")};ServerlessDevsCliLogger.spinner=function(t){return i.spinner(t)};return ServerlessDevsCliLogger}();r.default=s},5571:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.getHistoryFile=r.getHomeDir=void 0;var o=i(n(2087));var s=i(n(5622));var u=i(n(7083));function getHomeDir(){var t=s.default.join(o.default.homedir(),".s");if(!u.default.existsSync(t)){u.default.mkdirSync(t)}return t}r.getHomeDir=getHomeDir;function getHistoryFile(){var t=s.default.join(getHomeDir(),"history");if(!u.default.existsSync(t)){u.default.createFileSync(t)}return t}r.getHistoryFile=getHistoryFile;r.default={getHomeDir:getHomeDir,getHistoryFile:getHistoryFile}},1791:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.extractTemplateInfo=r.isUrlFormat=r.getProjectNameFromUrl=r.parse=void 0;var o=i(n(8835));function parse(t){return o.default.parse(t)}r.parse=parse;function getProjectNameFromUrl(t){var r=t.lastIndexOf("/");if(r&&r>=0){t=t.substr(r+1)}if(t.endsWith(".git")){return t.substr(0,t.length-4)}return t}r.getProjectNameFromUrl=getProjectNameFromUrl;function isUrlFormat(t){return t.includes(":")||t.includes("/")}r.isUrlFormat=isUrlFormat;function extractTemplateInfo(t){var r=t.pathname||"";var n=r.split("/");var i=n[1];var o=n[3];return{host:t.host,ownerName:i,repoName:o,branch:"",hasSubPath:false,subPath:"",zipFile:""}}r.extractTemplateInfo=extractTemplateInfo;r.default={extractTemplateInfo:extractTemplateInfo,getProjectNameFromUrl:getProjectNameFromUrl,isUrlFormat:isUrlFormat,parse:parse}},3188:(module,__unused_webpack_exports,__nccwpck_require__)=>{(()=>{var __webpack_modules__={46834:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});var o=i(n(35871));function commandParse(t,r){var n=(t===null||t===void 0?void 0:t.argsObj)||(t===null||t===void 0?void 0:t.ArgsObj)||(t===null||t===void 0?void 0:t.args)||(t===null||t===void 0?void 0:t.Args);if(!n){return{rawData:n,data:undefined}}var i;if(typeof n=="object"){i=(0,o.default)(n,r||{})}else{i=(0,o.default)(n.split(/[\s]+/g),r||{})}return{rawData:n,data:i}}r.default=commandParse},98033:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.RegistryEnum=void 0;var n;(function(t){t["github"]="https://api.github.com/repos";t["serverlessOld"]="http://registry.serverlessfans.cn/simple";t["serverless"]="http://registry.devsapp.cn/simple"})(n=r.RegistryEnum||(r.RegistryEnum={}))},65497:function(t,r,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(r,"__esModule",{value:true});r.getInputData=r.checkProviderList=r.providerCollection=r.providerObject=r.providerArray=void 0;var o=i(n(43167));r.providerArray=["alibaba","baidu","huawei","aws","azure","google","tencent","custom"];r.providerObject={alibaba:o.default.__("Alibaba Cloud"),baidu:o.default.__("Baidu Cloud"),huawei:o.default.__("Huawei Cloud"),aws:o.default.__("AWS"),azure:o.default.__("Azure"),google:o.default.__("Google Cloud"),tencent:o.default.__("Tencent Cloud"),custom:o.default.__("Custom")};r.providerCollection={alibaba:[{type:"input",message:"AccountID",name:"AccountID",default:""},{type:"input",message:"AccessKeyID",name:"AccessKeyID",default:""},{type:"input",message:"AccessKeySecret",name:"AccessKeySecret",default:""}],aws:[{type:"input",message:"AccessKeyID",name:"AccessKeyID",default:""},{type:"input",message:"SecretAccessKey",name:"SecretAccessKey",default:""}],huawei:[{type:"input",message:"AccessKeyID",name:"AccessKeyID",default:""},{type:"input",message:"SecretAccessKey",name:"SecretAccessKey",default:""}],azure:[{type:"input",message:"KeyVaultName",name:"KeyVaultName",default:""},{type:"input",message:"TenantID",name:"TenantID",default:""},{type:"input",message:"ClentID",name:"ClentID",default:""},{type:"input",message:"ClientSecret",name:"ClientSecret",default:""}],baidu:[{type:"input",message:"AccessKeyID",name:"AccessKeyID",default:""},{type:"input",message:"SecretAccessKey",name:"SecretAccessKey",default:""}],google:[{type:"input",message:"PrivateKeyData",name:"PrivateKeyData",default:""}],tencent:[{type:"input",message:"AccountID",name:"AccountID",default:""},{type:"input",message:"SecretID",name:"SecretID",default:""},{type:"input",message:"SecretKey",name:"SecretKey",default:""}]};r.checkProviderList=[{type:"list",name:"