@serverless-devs/s 3.0.7-578af2fc → 3.0.7-9987d343

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/index.js CHANGED
@@ -334,7 +334,7 @@ ${" ".repeat(t)}`):"").join(`
334
334
  ${Cbt("ERROR:")}`),At.write(`
335
335
  ${t}
336
336
  `),r&&At.write(`${mt.gray(r)}
337
- `)}},dP=Q7e});var mP=N((l_u,xvn)=>{xvn.exports={name:"@serverless-devs/s",version:"3.0.7-578af2fc",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:"Apache 2.0",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{start:"npm run watch",test:"jest --testTimeout 10000","test:watch":"jest --testTimeout 10000 --watchAll",format:"prettier --write src/ __tests__/**/*.test.ts",watch:"npm run build -- --watch",prebuild:"cross-os prebuild",build:"node ./scripts/build.js","build:ci":"node ./scripts/build.js",pkg:"pkg . --out-path releases",prepublishOnly:"npm run build",beta:"npm publish --tag=beta",canary:"npm publish --tag=canary",pub:"npm publish",eslint:"eslint . --ext .ts,.tsx","eslint:fix":"eslint . --ext .ts,.tsx --fix"},"cross-os":{prebuild:{darwin:"rm -rf node_modules && npm install --production false",linux:"rm -rf node_modules && npm install --production false",win32:"rmdir /s /q node_modules && npm install --production false"}},pkg:{scripts:["./lib/daemon/**/*.js"]},main:"./lib/index.js",bin:{s:"bin/s"},engines:{node:">=14.14.0"},devDependencies:{"@serverless-devs/core":"^0.1.67-beta.1","@serverless-devs/credential":"^0.0.6-beta.1","@serverless-devs/engine":"^0.1.2-beta.8","@serverless-devs/load-application":"^0.0.13-beta.5","@serverless-devs/load-component":"^0.0.7-beta.4","@serverless-devs/logger":"^0.0.5-beta.2","@serverless-devs/parse-spec":"^0.0.26-beta.3","@serverless-devs/registry":"^0.0.9","@serverless-devs/utils":"^0.0.14","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^29.5.8","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.201","@types/node":"^20.9.1","@types/semver":"^7.5.5","@typescript-eslint/eslint-plugin":"^7.3.1","@typescript-eslint/parser":"^7.3.1",ajv:"^8.12.0",axios:"^1.6.2",boxen:"^7.1.1",chalk:"^5.3.0",commander:"^11.1.0","cross-os":"^1.5.0",dotenv:"^16.3.1","dotenv-expand":"^10.0.0",esbuild:"^0.19.5",eslint:"^8.57.0","eslint-plugin-prettier":"^5.1.3","fs-extra":"^11.1.1","global-agent":"^3.0.0",inquirer:"^9.2.12","inquirer-autocomplete-prompt":"^3.0.1",jest:"^29.7.0","js-yaml":"^4.1.0","latest-version":"^7.0.0",leven:"^4.0.0",lodash:"^4.17.21",pkg:"^5.8.1",prettier:"^3.1.0",prettyjson:"^1.2.5",rimraf:"^5.0.5",semver:"^7.5.4","semver-diff":"^4.0.0","strip-ansi":"^7.1.0","table-layout":"^3.0.2","ts-jest":"^29.1.1","ts-node":"^10.9.1",typescript:"^5.2.2"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"}}});var _0,gP,vP,Obt,fE,DJ,Bbt,Avn,wbt,Fvn,Sbt,cd,cg=_t(()=>{_0=ot(pr());qn();gr();gP=ot(require("path")),vP=ot(ji());Cn();Obt=ot(pr()),fE=ot(fr());sg();_bt();DJ=ot(pr()),Bbt=mP(),Avn=async(e,t={})=>{At.unsilent();let{silent:r}=(0,Obt.parseArgv)(process.argv.slice(2)),n=gP.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json");vP.default.ensureFileSync(n),vP.default.writeJSONSync(n,[],{spaces:2});let u=1;if((0,fE.isArray)(e))for(let i of e){wbt(i,t);let o=(0,fE.get)(i,"exitCode");o&&(u=o)}else{wbt(e,t);let i=(0,fE.get)(e,"exitCode");i&&(u=i)}DJ.getGlobalConfig("log")!=="disable"&&(At.write(" "),At.write(mt.gray(`A complete log of this run can be found in: ${mt.underline(gP.default.join(DJ.getRootHome(),"logs",process.env.serverless_devs_traceid))}`))),At.write(" "),At.write(mt.gray(Tbt([{key:"Env:",value:`${Bbt.name}: ${Bbt.version}, ${process.platform}-${process.arch} node-${process.version}`},{key:"Logs:",value:mt.underline(gP.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid))},{key:"Feedback:",value:mt.cyan.underline("https://github.com/Serverless-Devs/Serverless-Devs/issues")}]))),r&&At.silent(),process.exitCode=u},wbt=(e,t={})=>{Mc("report.js",{argv:process.argv.slice(2),userAgent:(0,_0.getUserAgent)(),...t,type:(0,fE.get)(e,"trackerType"),message:e.message}),Fvn(e),At.write(" ");let r=e;if(r.CODE===_0.DevsError.CODE){let i=r.prefix?[`${mt.red("\u2716")} ${r.prefix}`,"===================="]:[];i.push(mt.red("Error Message:"),mt.red((0,_0.isDebugMode)()?r.stack:r.message)),r.tips&&i.push(`
337
+ `)}},dP=Q7e});var mP=N((l_u,xvn)=>{xvn.exports={name:"@serverless-devs/s",version:"3.0.7-9987d343",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:"Apache 2.0",repository:{type:"git",url:"https://github.com/Serverless-Devs/Serverless-Devs"},bugs:{url:"https://github.com/Serverless-Devs/Serverless-Devs/issues"},scripts:{start:"npm run watch",test:"jest --testTimeout 10000","test:watch":"jest --testTimeout 10000 --watchAll",format:"prettier --write src/ __tests__/**/*.test.ts",watch:"npm run build -- --watch",prebuild:"cross-os prebuild",build:"node ./scripts/build.js","build:ci":"node ./scripts/build.js",pkg:"pkg . --out-path releases",prepublishOnly:"npm run build",beta:"npm publish --tag=beta",canary:"npm publish --tag=canary",pub:"npm publish",eslint:"eslint . --ext .ts,.tsx","eslint:fix":"eslint . --ext .ts,.tsx --fix"},"cross-os":{prebuild:{darwin:"rm -rf node_modules && npm install --production false",linux:"rm -rf node_modules && npm install --production false",win32:"rmdir /s /q node_modules && npm install --production false"}},pkg:{scripts:["./lib/daemon/**/*.js"]},main:"./lib/index.js",bin:{s:"bin/s"},engines:{node:">=14.14.0"},devDependencies:{"@serverless-devs/core":"^0.1.67-beta.1","@serverless-devs/credential":"^0.0.6-beta.1","@serverless-devs/engine":"^0.1.2-beta.9","@serverless-devs/load-application":"^0.0.13-beta.5","@serverless-devs/load-component":"^0.0.7-beta.4","@serverless-devs/logger":"^0.0.5-beta.2","@serverless-devs/parse-spec":"^0.0.26-beta.3","@serverless-devs/registry":"^0.0.9","@serverless-devs/utils":"^0.0.14","@types/fs-extra":"^11.0.4","@types/inquirer":"^9.0.7","@types/jest":"^29.5.8","@types/js-yaml":"^4.0.9","@types/lodash":"^4.14.201","@types/node":"^20.9.1","@types/semver":"^7.5.5","@typescript-eslint/eslint-plugin":"^7.3.1","@typescript-eslint/parser":"^7.3.1",ajv:"^8.12.0",axios:"^1.6.2",boxen:"^7.1.1",chalk:"^5.3.0",commander:"^11.1.0","cross-os":"^1.5.0",dotenv:"^16.3.1","dotenv-expand":"^10.0.0",esbuild:"^0.19.5",eslint:"^8.57.0","eslint-plugin-prettier":"^5.1.3","fs-extra":"^11.1.1","global-agent":"^3.0.0",inquirer:"^9.2.12","inquirer-autocomplete-prompt":"^3.0.1",jest:"^29.7.0","js-yaml":"^4.1.0","latest-version":"^7.0.0",leven:"^4.0.0",lodash:"^4.17.21",pkg:"^5.8.1",prettier:"^3.1.0",prettyjson:"^1.2.5",rimraf:"^5.0.5",semver:"^7.5.4","semver-diff":"^4.0.0","strip-ansi":"^7.1.0","table-layout":"^3.0.2","ts-jest":"^29.1.1","ts-node":"^10.9.1",typescript:"^5.2.2"},"lint-staged":{"**/*.{js,jsx,ts}":"f2elint exec eslint"}}});var _0,gP,vP,Obt,fE,DJ,Bbt,Avn,wbt,Fvn,Sbt,cd,cg=_t(()=>{_0=ot(pr());qn();gr();gP=ot(require("path")),vP=ot(ji());Cn();Obt=ot(pr()),fE=ot(fr());sg();_bt();DJ=ot(pr()),Bbt=mP(),Avn=async(e,t={})=>{At.unsilent();let{silent:r}=(0,Obt.parseArgv)(process.argv.slice(2)),n=gP.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json");vP.default.ensureFileSync(n),vP.default.writeJSONSync(n,[],{spaces:2});let u=1;if((0,fE.isArray)(e))for(let i of e){wbt(i,t);let o=(0,fE.get)(i,"exitCode");o&&(u=o)}else{wbt(e,t);let i=(0,fE.get)(e,"exitCode");i&&(u=i)}DJ.getGlobalConfig("log")!=="disable"&&(At.write(" "),At.write(mt.gray(`A complete log of this run can be found in: ${mt.underline(gP.default.join(DJ.getRootHome(),"logs",process.env.serverless_devs_traceid))}`))),At.write(" "),At.write(mt.gray(Tbt([{key:"Env:",value:`${Bbt.name}: ${Bbt.version}, ${process.platform}-${process.arch} node-${process.version}`},{key:"Logs:",value:mt.underline(gP.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid))},{key:"Feedback:",value:mt.cyan.underline("https://github.com/Serverless-Devs/Serverless-Devs/issues")}]))),r&&At.silent(),process.exitCode=u},wbt=(e,t={})=>{Mc("report.js",{argv:process.argv.slice(2),userAgent:(0,_0.getUserAgent)(),...t,type:(0,fE.get)(e,"trackerType"),message:e.message}),Fvn(e),At.write(" ");let r=e;if(r.CODE===_0.DevsError.CODE){let i=r.prefix?[`${mt.red("\u2716")} ${r.prefix}`,"===================="]:[];i.push(mt.red("Error Message:"),mt.red((0,_0.isDebugMode)()?r.stack:r.message)),r.tips&&i.push(`
338
338
  \u{1F37C} Tips`,"====================",mt.yellow(`${r.tips}`)),At.write(i.join(`
339
339
  `)),Sbt(r.stack);return}let n=e,u=[mt.red("Error Message:"),mt.red((0,_0.isDebugMode)()?n.stack:n.message)];At.write(u.join(`
340
340
  `)),Sbt(n.stack)},Fvn=e=>{let t=u=>{let i=(0,fE.get)(u,"data");if(i)return i;let o=u;return o.CODE===_0.DevsError.CODE?{prefix:o.prefix,message:o.message,exitCode:o.exitCode,tips:o.tips}:{message:o.message}},r=gP.default.join((0,_0.getRootHome)(),"logs",process.env.serverless_devs_traceid,"error.json"),n=vP.default.readJSONSync(r);n.push(t(e)),vP.default.writeJSONSync(r,n,{spaces:2})},Sbt=e=>{(0,_0.isDebugMode)()||At.debug(e)},cd=Avn});function Bvn(){let{version:e}=Z7e.default.minVersion(_vn.engines.node);Z7e.default.gte(process.versions.node,e)||(new dP(`Node.js version must be greater than or equal to ${e}`,`Your current Node.js version is ${process.versions.node}, please upgrade your Node.js version at ${mt.underline("https://nodejs.org/en")}.`),process.exit(1))}var Z7e,_vn,e9e,Pbt=_t(()=>{cg();gr();Z7e=ot(cE()),_vn=mP();e9e=Bvn});var kbt=N(yJ=>{"use strict";Object.defineProperty(yJ,"__esModule",{value:!0});yJ.boolean=void 0;var wvn=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};yJ.boolean=wvn});var Rbt=N(EJ=>{"use strict";Object.defineProperty(EJ,"__esModule",{value:!0});EJ.isBooleanable=void 0;var Svn=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};EJ.isBooleanable=Svn});var bJ=N(VC=>{"use strict";Object.defineProperty(VC,"__esModule",{value:!0});VC.isBooleanable=VC.boolean=void 0;var Ovn=kbt();Object.defineProperty(VC,"boolean",{enumerable:!0,get:function(){return Ovn.boolean}});var Tvn=Rbt();Object.defineProperty(VC,"isBooleanable",{enumerable:!0,get:function(){return Tvn.isBooleanable}})});var CJ=N((x_u,Ibt)=>{Ibt.exports=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"});var t9e=N((A_u,Lbt)=>{"use strict";var jbt=Object.prototype.toString;Lbt.exports=function(t){var r=jbt.call(t),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jbt.call(t.callee)==="[object Function]"),n}});var Gbt=N((F_u,Vbt)=>{"use strict";var Wbt;Object.keys||(DP=Object.prototype.hasOwnProperty,r9e=Object.prototype.toString,Nbt=t9e(),n9e=Object.prototype.propertyIsEnumerable,qbt=!n9e.call({toString:null},"toString"),Mbt=n9e.call(function(){},"prototype"),yP=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],xJ=function(e){var t=e.constructor;return t&&t.prototype===e},Ubt={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},$bt=function(){if(typeof window>"u")return!1;for(var e in window)try{if(!Ubt["$"+e]&&DP.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{xJ(window[e])}catch{return!0}}catch{return!0}return!1}(),zbt=function(e){if(typeof window>"u"||!$bt)return xJ(e);try{return xJ(e)}catch{return!1}},Wbt=function(t){var r=t!==null&&typeof t=="object",n=r9e.call(t)==="[object Function]",u=Nbt(t),i=r&&r9e.call(t)==="[object String]",o=[];if(!r&&!n&&!u)throw new TypeError("Object.keys called on a non-object");var s=Mbt&&n;if(i&&t.length>0&&!DP.call(t,0))for(var a=0;a<t.length;++a)o.push(String(a));if(u&&t.length>0)for(var c=0;c<t.length;++c)o.push(String(c));else for(var l in t)!(s&&l==="prototype")&&DP.call(t,l)&&o.push(String(l));if(qbt)for(var f=zbt(t),p=0;p<yP.length;++p)!(f&&yP[p]==="constructor")&&DP.call(t,yP[p])&&o.push(yP[p]);return o});var DP,r9e,Nbt,n9e,qbt,Mbt,yP,xJ,Ubt,$bt,zbt;Vbt.exports=Wbt});var Xbt=N((__u,Ybt)=>{"use strict";var Pvn=Array.prototype.slice,kvn=t9e(),Hbt=Object.keys,AJ=Hbt?function(t){return Hbt(t)}:Gbt(),Kbt=Object.keys;AJ.shim=function(){if(Object.keys){var t=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);t||(Object.keys=function(n){return kvn(n)?Kbt(Pvn.call(n)):Kbt(n)})}else Object.keys=AJ;return Object.keys||AJ};Ybt.exports=AJ});var Qbt=N((B_u,Jbt)=>{"use strict";Jbt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var u=42;t[r]=u;for(r in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var i=Object.getOwnPropertySymbols(t);if(i.length!==1||i[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(t,r);if(o.value!==u||o.enumerable!==!0)return!1}return!0}});var tCt=N((w_u,eCt)=>{"use strict";var Zbt=typeof Symbol<"u"&&Symbol,Rvn=Qbt();eCt.exports=function(){return typeof Zbt!="function"||typeof Symbol!="function"||typeof Zbt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Rvn()}});var uCt=N((S_u,nCt)=>{"use strict";var rCt={foo:{}},Ivn=Object;nCt.exports=function(){return{__proto__:rCt}.foo===rCt.foo&&!({__proto__:null}instanceof Ivn)}});var sCt=N((O_u,oCt)=>{"use strict";var jvn="Function.prototype.bind called on incompatible ",Lvn=Object.prototype.toString,Nvn=Math.max,qvn="[object Function]",iCt=function(t,r){for(var n=[],u=0;u<t.length;u+=1)n[u]=t[u];for(var i=0;i<r.length;i+=1)n[i+t.length]=r[i];return n},Mvn=function(t,r){for(var n=[],u=r||0,i=0;u<t.length;u+=1,i+=1)n[i]=t[u];return n},Uvn=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};oCt.exports=function(t){var r=this;if(typeof r!="function"||Lvn.apply(r)!==qvn)throw new TypeError(jvn+r);for(var n=Mvn(arguments,1),u,i=function(){if(this instanceof u){var l=r.apply(this,iCt(n,arguments));return Object(l)===l?l:this}return r.apply(t,iCt(n,arguments))},o=Nvn(0,r.length-n.length),s=[],a=0;a<o;a++)s[a]="$"+a;if(u=Function("binder","return function ("+Uvn(s,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var c=function(){};c.prototype=r.prototype,u.prototype=new c,c.prototype=null}return u}});var FJ=N((T_u,aCt)=>{"use strict";var $vn=sCt();aCt.exports=Function.prototype.bind||$vn});var lCt=N((P_u,cCt)=>{"use strict";var zvn=Function.prototype.call,Wvn=Object.prototype.hasOwnProperty,Vvn=FJ();cCt.exports=Vvn.call(zvn,Wvn)});var XC=N((k_u,mCt)=>{"use strict";var eu,YC=SyntaxError,dCt=Function,KC=TypeError,u9e=function(e){try{return dCt('"use strict"; return ('+e+").constructor;")()}catch{}},pE=Object.getOwnPropertyDescriptor;if(pE)try{pE({},"")}catch{pE=null}var i9e=function(){throw new KC},Gvn=pE?function(){try{return arguments.callee,i9e}catch{try{return pE(arguments,"callee").get}catch{return i9e}}}():i9e,GC=tCt()(),Hvn=uCt()(),ca=Object.getPrototypeOf||(Hvn?function(e){return e.__proto__}:null),HC={},Kvn=typeof Uint8Array>"u"||!ca?eu:ca(Uint8Array),hE={"%AggregateError%":typeof AggregateError>"u"?eu:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?eu:ArrayBuffer,"%ArrayIteratorPrototype%":GC&&ca?ca([][Symbol.iterator]()):eu,"%AsyncFromSyncIteratorPrototype%":eu,"%AsyncFunction%":HC,"%AsyncGenerator%":HC,"%AsyncGeneratorFunction%":HC,"%AsyncIteratorPrototype%":HC,"%Atomics%":typeof Atomics>"u"?eu:Atomics,"%BigInt%":typeof BigInt>"u"?eu:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?eu:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?eu:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?eu:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?eu:Float32Array,"%Float64Array%":typeof Float64Array>"u"?eu:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?eu:FinalizationRegistry,"%Function%":dCt,"%GeneratorFunction%":HC,"%Int8Array%":typeof Int8Array>"u"?eu:Int8Array,"%Int16Array%":typeof Int16Array>"u"?eu:Int16Array,"%Int32Array%":typeof Int32Array>"u"?eu:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":GC&&ca?ca(ca([][Symbol.iterator]())):eu,"%JSON%":typeof JSON=="object"?JSON:eu,"%Map%":typeof Map>"u"?eu:Map,"%MapIteratorPrototype%":typeof Map>"u"||!GC||!ca?eu:ca(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?eu:Promise,"%Proxy%":typeof Proxy>"u"?eu:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?eu:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?eu:Set,"%SetIteratorPrototype%":typeof Set>"u"||!GC||!ca?eu:ca(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?eu:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":GC&&ca?ca(""[Symbol.iterator]()):eu,"%Symbol%":GC?Symbol:eu,"%SyntaxError%":YC,"%ThrowTypeError%":Gvn,"%TypedArray%":Kvn,"%TypeError%":KC,"%Uint8Array%":typeof Uint8Array>"u"?eu:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?eu:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?eu:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?eu:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?eu:WeakMap,"%WeakRef%":typeof WeakRef>"u"?eu:WeakRef,"%WeakSet%":typeof WeakSet>"u"?eu:WeakSet};if(ca)try{null.error}catch(e){fCt=ca(ca(e)),hE["%Error.prototype%"]=fCt}var fCt,Yvn=function e(t){var r;if(t==="%AsyncFunction%")r=u9e("async function () {}");else if(t==="%GeneratorFunction%")r=u9e("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=u9e("async function* () {}");else if(t==="%AsyncGenerator%"){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(t==="%AsyncIteratorPrototype%"){var u=e("%AsyncGenerator%");u&&ca&&(r=ca(u.prototype))}return hE[t]=r,r},pCt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},EP=FJ(),_J=lCt(),Xvn=EP.call(Function.call,Array.prototype.concat),Jvn=EP.call(Function.apply,Array.prototype.splice),hCt=EP.call(Function.call,String.prototype.replace),BJ=EP.call(Function.call,String.prototype.slice),Qvn=EP.call(Function.call,RegExp.prototype.exec),Zvn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,eDn=/\\(\\)?/g,tDn=function(t){var r=BJ(t,0,1),n=BJ(t,-1);if(r==="%"&&n!=="%")throw new YC("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new YC("invalid intrinsic syntax, expected opening `%`");var u=[];return hCt(t,Zvn,function(i,o,s,a){u[u.length]=s?hCt(a,eDn,"$1"):o||i}),u},rDn=function(t,r){var n=t,u;if(_J(pCt,n)&&(u=pCt[n],n="%"+u[0]+"%"),_J(hE,n)){var i=hE[n];if(i===HC&&(i=Yvn(n)),typeof i>"u"&&!r)throw new KC("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:u,name:n,value:i}}throw new YC("intrinsic "+t+" does not exist!")};mCt.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new KC("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new KC('"allowMissing" argument must be a boolean');if(Qvn(/^%?[^%]*%?$/,t)===null)throw new YC("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=tDn(t),u=n.length>0?n[0]:"",i=rDn("%"+u+"%",r),o=i.name,s=i.value,a=!1,c=i.alias;c&&(u=c[0],Jvn(n,Xvn([0,1],c)));for(var l=1,f=!0;l<n.length;l+=1){var p=n[l],h=BJ(p,0,1),d=BJ(p,-1);if((h==='"'||h==="'"||h==="`"||d==='"'||d==="'"||d==="`")&&h!==d)throw new YC("property names with quotes must have matching quotes");if((p==="constructor"||!f)&&(a=!0),u+="."+p,o="%"+u+"%",_J(hE,o))s=hE[o];else if(s!=null){if(!(p in s)){if(!r)throw new KC("base intrinsic for "+t+" exists, but the property is not available.");return}if(pE&&l+1>=n.length){var m=pE(s,p);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[p]}else f=_J(s,p),s=s[p];f&&!a&&(hE[o]=s)}}return s}});var wJ=N((R_u,gCt)=>{"use strict";var nDn=XC(),o9e=nDn("%Object.defineProperty%",!0),s9e=function(){if(o9e)try{return o9e({},"a",{value:1}),!0}catch{return!1}return!1};s9e.hasArrayLengthDefineBug=function(){if(!s9e())return null;try{return o9e([],"length",{value:1}).length!==1}catch{return!0}};gCt.exports=s9e});var a9e=N((I_u,vCt)=>{"use strict";var uDn=XC(),SJ=uDn("%Object.getOwnPropertyDescriptor%",!0);if(SJ)try{SJ([],"length")}catch{SJ=null}vCt.exports=SJ});var l9e=N((j_u,yCt)=>{"use strict";var iDn=wJ()(),c9e=XC(),bP=iDn&&c9e("%Object.defineProperty%",!0);if(bP)try{bP({},"a",{value:1})}catch{bP=!1}var oDn=c9e("%SyntaxError%"),JC=c9e("%TypeError%"),DCt=a9e();yCt.exports=function(t,r,n){if(!t||typeof t!="object"&&typeof t!="function")throw new JC("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new JC("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new JC("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new JC("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new JC("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new JC("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,s=arguments.length>6?arguments[6]:!1,a=!!DCt&&DCt(t,r);if(bP)bP(t,r,{configurable:o===null&&a?a.configurable:!o,enumerable:u===null&&a?a.enumerable:!u,value:n,writable:i===null&&a?a.writable:!i});else if(s||!u&&!i&&!o)t[r]=n;else throw new oDn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var f9e=N((L_u,xCt)=>{"use strict";var sDn=Xbt(),aDn=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",cDn=Object.prototype.toString,lDn=Array.prototype.concat,ECt=l9e(),fDn=function(e){return typeof e=="function"&&cDn.call(e)==="[object Function]"},bCt=wJ()(),pDn=function(e,t,r,n){if(t in e){if(n===!0){if(e[t]===r)return}else if(!fDn(n)||!n())return}bCt?ECt(e,t,r,!0):ECt(e,t,r)},CCt=function(e,t){var r=arguments.length>2?arguments[2]:{},n=sDn(t);aDn&&(n=lDn.call(n,Object.getOwnPropertySymbols(t)));for(var u=0;u<n.length;u+=1)pDn(e,n[u],t[n[u]],r[n[u]])};CCt.supportsDescriptors=!!bCt;xCt.exports=CCt});var p9e=N((N_u,ACt)=>{"use strict";ACt.exports=global});var h9e=N((q_u,FCt)=>{"use strict";var hDn=p9e();FCt.exports=function(){return typeof global!="object"||!global||global.Math!==Math||global.Array!==Array?hDn:global}});var BCt=N((M_u,_Ct)=>{"use strict";var dDn=f9e(),mDn=h9e();_Ct.exports=function(){var t=mDn();if(dDn.supportsDescriptors){var r=Object.getOwnPropertyDescriptor(t,"globalThis");(!r||r.configurable&&(r.enumerable||!r.writable||globalThis!==t))&&Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else(typeof globalThis!="object"||globalThis!==t)&&(t.globalThis=t);return t}});var d9e=N((U_u,OCt)=>{"use strict";var gDn=f9e(),vDn=p9e(),wCt=h9e(),DDn=BCt(),yDn=wCt(),SCt=function(){return yDn};gDn(SCt,{getPolyfill:wCt,implementation:vDn,shim:DDn});OCt.exports=SCt});var kCt=N((m9e,PCt)=>{m9e=PCt.exports=EDn;m9e.getSerialize=TCt;function EDn(e,t,r,n){return JSON.stringify(e,TCt(t,n),r)}function TCt(e,t){var r=[],n=[];return t==null&&(t=function(u,i){return r[0]===i?"[Circular ~]":"[Circular ~."+n.slice(0,r.indexOf(i)).join(".")+"]"}),function(u,i){if(r.length>0){var o=r.indexOf(this);~o?r.splice(o+1):r.push(this),~o?n.splice(o,1/0,u):n.push(u),~r.indexOf(i)&&(i=t.call(this,u,i))}else r.push(i);return e==null?i:e.call(this,u,i)}}});var RCt=N(OJ=>{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(o){return n(i(o),arguments)}function r(o,s){return t.apply(null,[o].concat(s||[]))}function n(o,s){var a=1,c=o.length,l,f="",p,h,d,m,v,y,g,D;for(p=0;p<c;p++)if(typeof o[p]=="string")f+=o[p];else if(typeof o[p]=="object"){if(d=o[p],d.keys)for(l=s[a],h=0;h<d.keys.length;h++){if(l==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',d.keys[h],d.keys[h-1]));l=l[d.keys[h]]}else d.param_no?l=s[d.param_no]:l=s[a++];if(e.not_type.test(d.type)&&e.not_primitive.test(d.type)&&l instanceof Function&&(l=l()),e.numeric_arg.test(d.type)&&typeof l!="number"&&isNaN(l))throw new TypeError(t("[sprintf] expecting number but found %T",l));switch(e.number.test(d.type)&&(g=l>=0),d.type){case"b":l=parseInt(l,10).toString(2);break;case"c":l=String.fromCharCode(parseInt(l,10));break;case"d":case"i":l=parseInt(l,10);break;case"j":l=JSON.stringify(l,null,d.width?parseInt(d.width):0);break;case"e":l=d.precision?parseFloat(l).toExponential(d.precision):parseFloat(l).toExponential();break;case"f":l=d.precision?parseFloat(l).toFixed(d.precision):parseFloat(l);break;case"g":l=d.precision?String(Number(l.toPrecision(d.precision))):parseFloat(l);break;case"o":l=(parseInt(l,10)>>>0).toString(8);break;case"s":l=String(l),l=d.precision?l.substring(0,d.precision):l;break;case"t":l=String(!!l),l=d.precision?l.substring(0,d.precision):l;break;case"T":l=Object.prototype.toString.call(l).slice(8,-1).toLowerCase(),l=d.precision?l.substring(0,d.precision):l;break;case"u":l=parseInt(l,10)>>>0;break;case"v":l=l.valueOf(),l=d.precision?l.substring(0,d.precision):l;break;case"x":l=(parseInt(l,10)>>>0).toString(16);break;case"X":l=(parseInt(l,10)>>>0).toString(16).toUpperCase();break}e.json.test(d.type)?f+=l:(e.number.test(d.type)&&(!g||d.sign)?(D=g?"+":"-",l=l.toString().replace(e.sign,"")):D="",v=d.pad_char?d.pad_char==="0"?"0":d.pad_char.charAt(1):" ",y=d.width-(D+l).length,m=d.width&&y>0?v.repeat(y):"",f+=d.align?D+l+m:v==="0"?D+m+l:m+D+l)}return f}var u=Object.create(null);function i(o){if(u[o])return u[o];for(var s=o,a,c=[],l=0;s;){if((a=e.text.exec(s))!==null)c.push(a[0]);else if((a=e.modulo.exec(s))!==null)c.push("%");else if((a=e.placeholder.exec(s))!==null){if(a[2]){l|=1;var f=[],p=a[2],h=[];if((h=e.key.exec(p))!==null)for(f.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)f.push(h[1]);else if((h=e.index_access.exec(p))!==null)f.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");a[2]=f}else l|=2;if(l===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:a[0],param_no:a[1],keys:a[2],sign:a[3],pad_char:a[4],align:a[5],width:a[6],precision:a[7],type:a[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");s=s.substring(a[0].length)}return u[o]=c}typeof OJ<"u"&&(OJ.sprintf=t,OJ.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var g9e=N(TJ=>{"use strict";Object.defineProperty(TJ,"__esModule",{value:!0});TJ.logLevels=void 0;var bDn={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};TJ.logLevels=bDn});var LCt=N(kJ=>{"use strict";Object.defineProperty(kJ,"__esModule",{value:!0});kJ.default=void 0;var CDn=E9e(CJ()),xDn=E9e(d9e()),ADn=E9e(kCt()),v9e=RCt(),ICt=g9e();function E9e(e){return e&&e.__esModule?e:{default:e}}function D9e(){return D9e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D9e.apply(this,arguments)}function jCt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),r.push.apply(r,n)}return r}function Bf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jCt(Object(r),!0).forEach(function(n){FDn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jCt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FDn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _Dn=(0,xDn.default)(),CP;CDn.default&&(CP=require("domain"));var BDn=()=>{if(!CP)return{};let e=[],t=process.domain;if(!t||!t.parentDomain)return{};for(;t&&t.parentDomain;)t=t.parentDomain,t.roarr&&t.roarr.context&&e.push(t.roarr.context);let r={};for(let n of e)r=Bf(Bf({},r),n);return r},PJ=()=>{if(!CP)return{};let e=process.domain;if(e&&e.roarr&&e.roarr.context)return e.roarr.context;if(!e||!e.parentDomain)return{};for(;e&&e.parentDomain;)if(e=e.parentDomain,e.roarr&&e.roarr.context)return e.roarr.context;return{}},y9e=(e,t)=>{let r=(n,u,i,o,s,a,c,l,f,p)=>{let h=Date.now(),d=_Dn.ROARR.sequence++,m,v;if(typeof n=="string"){m=Bf(Bf({},PJ()),t||{});let y=D9e({},{a:n,b:u,c:i,d:o,e:s,f:a,g:c,h:l,i:f,k:p});v=Object.keys(y).map(E=>y[E]).reduce((E,b)=>E+=typeof b>"u"?0:1,0)===1?(0,v9e.sprintf)("%s",n):(0,v9e.sprintf)(n,u,i,o,s,a,c,l,f,p)}else{if(typeof u!="string")throw new TypeError("Message must be a string.");m=JSON.parse((0,ADn.default)(Bf(Bf(Bf({},PJ()),t||{}),n))),v=(0,v9e.sprintf)(u,i,o,s,a,c,l,f,p)}e({context:m,message:v,sequence:d,time:h,version:"1.0.0"})};r.child=n=>typeof n=="function"?y9e(u=>{if(typeof n!="function")throw new TypeError("Unexpected state.");e(n(u))},t):y9e(e,Bf(Bf(Bf({},PJ()),t),n)),r.getContext=()=>Bf(Bf({},PJ()),t||{}),r.adopt=async(n,u)=>{if(!CP)return n();let i=CP.create();return i.run(()=>(i.roarr={context:Bf(Bf({},BDn()),u)},n()))};for(let n of Object.keys(ICt.logLevels))r[n]=(u,i,o,s,a,c,l,f,p,h)=>r.child({logLevel:ICt.logLevels[n]})(u,i,o,s,a,c,l,f,p,h);return r},wDn=y9e;kJ.default=wDn});var MCt=N(RJ=>{"use strict";Object.defineProperty(RJ,"__esModule",{value:!0});RJ.default=void 0;var NCt=g9e(),qCt=(e,t)=>{let r=(n,u,i,o,s,a,c,l,f,p)=>{};r.adopt=async n=>n(),r.child=n=>qCt(e,t),r.getContext=()=>({});for(let n of Object.keys(NCt.logLevels))r[n]=(u,i,o,s,a,c,l,f,p,h)=>r.child({logLevel:NCt.logLevels[n]})(u,i,o,s,a,c,l,f,p,h);return r},SDn=qCt;RJ.default=SDn});var $Ct=N((G_u,UCt)=>{UCt.exports=function(t,r){for(var n=t.split("."),u=r.split("."),i=0;i<3;i++){var o=Number(n[i]),s=Number(u[i]);if(o>s)return 1;if(s>o)return-1;if(!isNaN(o)&&isNaN(s))return 1;if(isNaN(o)&&!isNaN(s))return-1}return 0}});var zCt=N((H_u,ODn)=>{ODn.exports={author:{email:"gajus@gajus.com",name:"Gajus Kuizinas",url:"http://gajus.com"},ava:{babel:{compileAsTests:["test/helpers/**/*"]},files:["test/roarr/**/*"],require:["@babel/register"]},dependencies:{boolean:"^3.0.1","detect-node":"^2.0.4",globalthis:"^1.0.1","json-stringify-safe":"^5.0.1","semver-compare":"^1.0.0","sprintf-js":"^1.1.2"},description:"JSON logger for Node.js and browser.",devDependencies:{"@ava/babel":"^1.0.1","@babel/cli":"^7.11.6","@babel/core":"^7.11.6","@babel/node":"^7.10.5","@babel/plugin-transform-flow-strip-types":"^7.10.4","@babel/preset-env":"^7.11.5","@babel/register":"^7.11.5",ava:"^3.12.1","babel-plugin-istanbul":"^6.0.0","babel-plugin-transform-export-default-name":"^2.0.4",coveralls:"^3.1.0","domain-parent":"^1.0.0",eslint:"^7.9.0","eslint-config-canonical":"^24.1.1","flow-bin":"^0.133.0","flow-copy-source":"^2.0.9",gitdown:"^3.1.3",husky:"^4.3.0",nyc:"^15.1.0","semantic-release":"^17.1.1"},engines:{node:">=8.0"},husky:{hooks:{"pre-commit":"npm run lint && npm run test && npm run build","pre-push":"gitdown ./.README/README.md --output-file ./README.md --check"}},keywords:["log","logger","json"],main:"./dist/log.js",name:"roarr",nyc:{include:["src/**/*.js"],instrument:!1,reporter:["text-lcov"],require:["@babel/register"],sourceMap:!1},license:"BSD-3-Clause",repository:{type:"git",url:"git@github.com:gajus/roarr.git"},scripts:{build:"rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist","create-readme":"gitdown ./.README/README.md --output-file ./README.md",dev:"NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps --watch",lint:"eslint ./src ./test && flow",test:"NODE_ENV=test ava --serial --verbose"},version:"2.15.4"}});var WCt=N(IJ=>{"use strict";Object.defineProperty(IJ,"__esModule",{value:!0});IJ.default=void 0;var TDn=e=>({write:t=>{e.write(t+`
@@ -1234,7 +1234,7 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==Pi.InterpreterSta
1234
1234
  `,u)}while(n!==-1);return i+=e.substr(u),i};tnr.exports={stringReplaceAll:Hfu,stringEncaseCRLFWithFirstIndex:Kfu}});var snr=N((cXu,onr)=>{"use strict";var Yfu=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,nnr=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Xfu=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Jfu=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Qfu=new Map([["n",`
1235
1235
  `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function inr(e){let t=e[0]==="u",r=e[1]==="{";return t&&!r&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):t&&r?String.fromCodePoint(parseInt(e.slice(2,-1),16)):Qfu.get(e)||e}function Zfu(e,t){let r=[],n=t.trim().split(/\s*,\s*/g),u;for(let i of n){let o=Number(i);if(!Number.isNaN(o))r.push(o);else if(u=i.match(Xfu))r.push(u[2].replace(Jfu,(s,a,c)=>a?inr(a):c));else throw new Error(`Invalid Chalk template style argument: ${i} (in style '${e}')`)}return r}function e0u(e){nnr.lastIndex=0;let t=[],r;for(;(r=nnr.exec(e))!==null;){let n=r[1];if(r[2]){let u=Zfu(n,r[2]);t.push([n].concat(u))}else t.push([n])}return t}function unr(e,t){let r={};for(let u of t)for(let i of u.styles)r[i[0]]=u.inverse?null:i.slice(1);let n=e;for(let[u,i]of Object.entries(r))if(Array.isArray(i)){if(!(u in n))throw new Error(`Unknown Chalk style: ${u}`);n=i.length>0?n[u](...i):n[u]}return n}onr.exports=(e,t)=>{let r=[],n=[],u=[];if(t.replace(Yfu,(i,o,s,a,c,l)=>{if(o)u.push(inr(o));else if(a){let f=u.join("");u=[],n.push(r.length===0?f:unr(e,r)(f)),r.push({inverse:s,styles:e0u(a)})}else if(c){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");n.push(unr(e,r)(u.join(""))),u=[],r.pop()}else u.push(l)}),n.push(u.join("")),r.length>0){let i=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(i)}return n.join("")}});var Zke=N((lXu,hnr)=>{"use strict";var KL=enr(),{stdout:Yke,stderr:Xke}=h0(),{stringReplaceAll:t0u,stringEncaseCRLFWithFirstIndex:r0u}=rnr(),{isArray:Nie}=Array,cnr=["ansi","ansi","ansi256","ansi16m"],C_=Object.create(null),n0u=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Yke?Yke.level:0;e.level=t.level===void 0?r:t.level},Jke=class{constructor(t){return lnr(t)}},lnr=e=>{let t={};return n0u(t,e),t.template=(...r)=>pnr(t.template,...r),Object.setPrototypeOf(t,qie.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=Jke,t.template};function qie(e){return lnr(e)}for(let[e,t]of Object.entries(KL))C_[e]={get(){let r=Mie(this,Qke(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:r}),r}};C_.visible={get(){let e=Mie(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};var fnr=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let e of fnr)C_[e]={get(){let{level:t}=this;return function(...r){let n=Qke(KL.color[cnr[t]][e](...r),KL.color.close,this._styler);return Mie(this,n,this._isEmpty)}}};for(let e of fnr){let t="bg"+e[0].toUpperCase()+e.slice(1);C_[t]={get(){let{level:r}=this;return function(...n){let u=Qke(KL.bgColor[cnr[r]][e](...n),KL.bgColor.close,this._styler);return Mie(this,u,this._isEmpty)}}}}var u0u=Object.defineProperties(()=>{},{...C_,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),Qke=(e,t,r)=>{let n,u;return r===void 0?(n=e,u=t):(n=r.openAll+e,u=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:u,parent:r}},Mie=(e,t,r)=>{let n=(...u)=>Nie(u[0])&&Nie(u[0].raw)?anr(n,pnr(n,...u)):anr(n,u.length===1?""+u[0]:u.join(" "));return Object.setPrototypeOf(n,u0u),n._generator=e,n._styler=t,n._isEmpty=r,n},anr=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let r=e._styler;if(r===void 0)return t;let{openAll:n,closeAll:u}=r;if(t.indexOf("\x1B")!==-1)for(;r!==void 0;)t=t0u(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
1236
1236
  `);return i!==-1&&(t=r0u(t,u,n,i)),n+t+u},Kke,pnr=(e,...t)=>{let[r]=t;if(!Nie(r)||!Nie(r.raw))return t.join(" ");let n=t.slice(1),u=[r.raw[0]];for(let i=1;i<r.length;i++)u.push(String(n[i-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[i]));return Kke===void 0&&(Kke=snr()),Kke(e,u.join(""))};Object.defineProperties(qie.prototype,C_);var Uie=qie();Uie.supportsColor=Yke;Uie.stderr=qie({level:Xke?Xke.level:0});Uie.stderr.supportsColor=Xke;hnr.exports=Uie});var mnr=N(YL=>{"use strict";YL.__esModule=!0;YL.parseArgsStringToArgv=void 0;function dnr(e,t,r){var n=/([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi,u=e,i=[];t&&i.push(t),r&&i.push(r);var o;do o=n.exec(u),o!==null&&i.push(i0u(o[1],o[6],o[0]));while(o!==null);return i}YL.default=dnr;YL.parseArgsStringToArgv=dnr;function i0u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0;r<e.length;r++){var n=e[r];if(typeof n=="string")return n}}});var eRe=N($ie=>{"use strict";Object.defineProperty($ie,"__esModule",{value:!0});$ie.EXIT_CODE=void 0;$ie.EXIT_CODE={DEVS:100,COMPONENT:101,PLUGIN:101,RUN:101}});var ynr=N(Y0=>{"use strict";var o0u=Y0&&Y0.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),s0u=Y0&&Y0.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a0u=Y0&&Y0.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&o0u(t,e,r);return s0u(t,e),t},XL=Y0&&Y0.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},zie=Y0&&Y0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Y0,"__esModule",{value:!0});var el=Cf(),N2=fr(),gnr=a0u(pr()),q2=pr(),vnr=zie(ji()),c0u=require("child_process"),Dnr=zie(f5()),l0u=zie(mnr()),Uv=Iie(),JL=zie(Zke()),M2=eRe(),tRe=Qh()("serverless-devs:engine"),rRe=class{constructor(t=[],r={}){this.actions=t,this.option=r,this.record={},this.inputs={},this.logger=r.logger}setValue(t,r){this.option.skipActions||(0,N2.set)(this.record,t,r)}start(t,r={}){return XL(this,void 0,void 0,function*(){try{return yield this.afterStart(t,r)}catch(n){let u=n;throw this.option.hookLevel===el.IActionLevel.GLOBAL&&this.logger.write(`${JL.default.red("\u2716")} ${JL.default.gray(`${el.IActionLevel.GLOBAL} ${t}-action failed to [${this.record.command}] (${(0,Uv.getProcessTime)(this.record.startTime)}s)`)}`),n}})}afterStart(t,r={}){return XL(this,void 0,void 0,function*(){if(this.option.skipActions)return{};this.inputs=r,t===el.IHookType.COMPLETE&&this.actions.find(i=>i.hookType===el.IHookType.POST)&&(this.actions=this.actions.map(i=>i.hookType===el.IHookType.POST?Object.assign(Object.assign({},i),{hookType:el.IHookType.COMPLETE}):i),this.logger.warn(`The action hook 'post-<command>' has been renamed to 'complete-<command>'.
1237
- You can still use them now, but we suggest to modify them.`));let n=(0,N2.filter)(this.actions,i=>i.hookType===t);if((0,N2.isEmpty)(n))return{};this.record.startTime=Date.now(),this.record.label=this.option.hookLevel===el.IActionLevel.PROJECT?`[${this.option.projectName}]`:el.IActionLevel.GLOBAL,this.logger.debug(`Start executing the ${t}-action in ${this.record.label}`);let u=(0,el.getInputs)(n,this.record.magic);t!==el.IHookType.PRE&&(this.record.pluginOutput={});for(let i of u)tRe(`${i.level} action item: ${(0,Uv.stringify)(i)}`),this.record.allowFailure=this.record.step&&"allow_failure"in this.record.step?(0,N2.get)(this.record,"step.allow_failure"):i.allow_failure,i.actionType===el.IActionType.RUN&&(yield this.run(i)),i.actionType===el.IActionType.PLUGIN&&(yield this.plugin(i)),i.actionType===el.IActionType.COMPONENT&&i.level===el.IActionLevel.PROJECT&&(yield this.component(i));return this.logger.debug(`The ${t}-action successfully to execute in ${this.record.label}`),this.option.hookLevel===el.IActionLevel.GLOBAL&&this.logger.write(`${JL.default.green("\u2714")} ${JL.default.gray(`${el.IActionLevel.GLOBAL} ${t}-action completed (${(0,Uv.getProcessTime)(this.record.startTime)})`)}`),this.record})}onFinish(t){return new Promise((r,n)=>{let u=[],i=[];t.stdout.on("data",o=>{this.logger.append(o.toString()),u.push(o)}),t.stderr.on("data",o=>{this.logger.append(o.toString()),i.push(o)}),t.on("exit",o=>{o===0?r({}):n(new Error(Buffer.concat(i).toString()))})})}run(t){return XL(this,void 0,void 0,function*(){if(vnr.default.existsSync(t.path)&&vnr.default.lstatSync(t.path).isDirectory()){try{let n=(0,c0u.spawn)(t.value,{cwd:t.path,shell:!0});yield this.onFinish(n)}catch(n){let u=n;if(gnr.isWindow()&&(tRe("Command run execution environment\uFF1ACMD"),tRe("Please check whether the actions section of yaml can be executed in the current environment.")),(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.RUN,command:this.record.command}))return;throw new q2.DevsError(u.message,{data:(0,N2.get)(n,"data"),stack:u.stack,exitCode:M2.EXIT_CODE.RUN,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}return}if(!(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.DEVS,command:this.record.command}))throw new q2.DevsError(`The ${t.path} directory does not exist.`,{exitCode:M2.EXIT_CODE.DEVS,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.parseException})})}plugin(t){return XL(this,void 0,void 0,function*(){try{let r=yield(0,Dnr.default)(t.value),n=(0,N2.isEmpty)(this.record.pluginOutput)?this.inputs:this.record.pluginOutput;this.record.pluginOutput=yield r(n,t.args,this.logger)}catch(r){let n=r;if((0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.PLUGIN,command:this.record.command}))return;throw new q2.DevsError(n.message,{data:(0,N2.get)(r,"data"),stack:n.stack,exitCode:M2.EXIT_CODE.PLUGIN,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}})}component(t){return XL(this,void 0,void 0,function*(){let r=(0,l0u.default)(t.value),{_:n}=gnr.parseArgv(r),[u,i]=n,o=yield(0,Dnr.default)(u,{logger:this.logger});if(o[i]){let a=Object.assign(Object.assign({},this.record.componentProps),{argv:(0,N2.filter)(r.slice(2),c=>!(0,N2.includes)([u,i],c))});try{yield o[i](a);return}catch(c){let l=c;if((0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.COMPONENT,command:this.record.command}))return;throw new q2.DevsError(l.message,{data:(0,N2.get)(c,"data"),stack:l.stack,exitCode:M2.EXIT_CODE.COMPONENT,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}}if(!(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.DEVS,command:this.record.command}))throw new q2.DevsError(`The [${i}] command was not found.`,{exitCode:M2.EXIT_CODE.DEVS,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,tips:`Please check the component ${u} has the ${i} command. Serverless Devs documents\uFF1A${JL.default.underline("https://manual.serverless-devs.com/")}`,trackerType:q2.ETrackerType.parseException})})}};Y0.default=rRe});var wnr=N(As=>{"use strict";var _nr=As&&As.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),f0u=As&&As.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p0u=As&&As.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_nr(t,e,r);return f0u(t,e),t},h0u=As&&As.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&_nr(t,e,r)},Mf=As&&As.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},zv=As&&As.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(As,"__esModule",{value:!0});As.preview=As.verify=void 0;var Enr=_rr(),sn=fr(),Wu=Wke(),U2=Iie(),X0=p0u(Cf()),bnr=zv(require("path")),n7=zv(Zke()),Cnr=zv(ynr()),d0u=zv(vl()),xnr=zv(f5()),Anr=zv(Xye()),Vl=pr(),$v=eRe(),Fnr=zv(require("assert")),m0u=zv(Xj());h0u(Wke(),As);var Bnr=Iie();Object.defineProperty(As,"verify",{enumerable:!0,get:function(){return Bnr.verify}});Object.defineProperty(As,"preview",{enumerable:!0,get:function(){return Bnr.preview}});var $2=Qh()("serverless-devs:engine"),nRe=class{constructor(t){this.options=t,this.context={status:Wu.STEP_STATUS.PENDING,completed:!1,error:[]},this.record={status:Wu.STEP_STATUS.PENDING,editStatusAble:!0},this.spec={},$2("engine start"),this.options.args=(0,sn.get)(this.options,"args",process.argv.slice(2)),this.options.cwd=(0,sn.get)(this.options,"cwd",process.cwd()),this.options.template=(0,Vl.getAbsolutePath)((0,sn.get)(this.options,"template"),this.options.cwd),$2(`engine options: ${(0,U2.stringify)(t)}`)}beforeStart(){return Mf(this,void 0,void 0,function*(){this.glog=this.getLogger(),this.logger=this.glog.__generate("engine"),this.parseSpecInstance=new X0.default((0,sn.get)(this.options,"template"),{argv:this.options.args,logger:this.logger}),this.spec=yield this.parseSpecInstance.start(),(0,sn.each)(this.options.env,(r,n)=>{process.env[n]=r});let{steps:t}=this.spec;yield this.validate(),this.context.steps=yield this.download(t)})}start(){return Mf(this,void 0,void 0,function*(){this.context.status=Wu.STEP_STATUS.RUNNING,this.record.status=Wu.STEP_STATUS.RUNNING;try{yield this.beforeStart()}catch(s){return this.context.status=Wu.STEP_STATUS.FAILURE,this.context.completed=!0,this.context.error.push(s),this.context}let{steps:t,yaml:r,command:n,access:u=r.access}=this.spec;this.logger.write(n7.default.gray(`${(0,Vl.emoji)("\u231B")} Steps for [${n}] of [${(0,sn.get)(this.spec,"yaml.appName")}]
1237
+ You can still use them now, but we suggest to modify them.`));let n=(0,N2.filter)(this.actions,i=>i.hookType===t);if((0,N2.isEmpty)(n))return{};this.record.startTime=Date.now(),this.record.label=this.option.hookLevel===el.IActionLevel.PROJECT?`[${this.option.projectName}]`:el.IActionLevel.GLOBAL,this.logger.debug(`Start executing the ${t}-action in ${this.record.label}`);let u=(0,el.getInputs)(n,this.record.magic);t!==el.IHookType.PRE&&(this.record.pluginOutput={});for(let i of u)tRe(`${i.level} action item: ${(0,Uv.stringify)(i)}`),this.record.allowFailure=this.record.step&&"allow_failure"in this.record.step?(0,N2.get)(this.record,"step.allow_failure"):i.allow_failure,i.actionType===el.IActionType.RUN&&(yield this.run(i)),i.actionType===el.IActionType.PLUGIN&&(yield this.plugin(i)),i.actionType===el.IActionType.COMPONENT&&i.level===el.IActionLevel.PROJECT&&(yield this.component(i));return this.logger.debug(`The ${t}-action successfully to execute in ${this.record.label}`),this.option.hookLevel===el.IActionLevel.GLOBAL&&this.logger.write(`${JL.default.green("\u2714")} ${JL.default.gray(`${el.IActionLevel.GLOBAL} ${t}-action completed (${(0,Uv.getProcessTime)(this.record.startTime)})`)}`),this.record})}onFinish(t){return new Promise((r,n)=>{let u=[],i=[];t.stdout.on("data",o=>{this.logger.append(o.toString()),u.push(o)}),t.stderr.on("data",o=>{this.logger.append(o.toString()),i.push(o)}),t.on("exit",o=>{o===0?r({}):n(new Error(Buffer.concat(i).toString()))})})}run(t){return XL(this,void 0,void 0,function*(){if(vnr.default.existsSync(t.path)&&vnr.default.lstatSync(t.path).isDirectory()){try{let n=(0,c0u.spawn)(t.value,{cwd:t.path,shell:!0});yield this.onFinish(n)}catch(n){let u=n;if(gnr.isWindow()&&(tRe("Command run execution environment\uFF1ACMD"),tRe("Please check whether the actions section of yaml can be executed in the current environment.")),(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.RUN,command:this.record.command}))return;throw new q2.DevsError(u.message,{data:(0,N2.get)(n,"data"),stack:u.stack,exitCode:M2.EXIT_CODE.RUN,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}return}if(!(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.DEVS,command:this.record.command}))throw new q2.DevsError(`The ${t.path} directory does not exist.`,{exitCode:M2.EXIT_CODE.DEVS,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.parseException})})}plugin(t){return XL(this,void 0,void 0,function*(){try{let r=yield(0,Dnr.default)(t.value),n=(0,N2.isEmpty)(this.record.pluginOutput)?this.inputs:this.record.pluginOutput;this.record.pluginOutput=yield r(n,t.args,this.logger)}catch(r){let n=r;if((0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.PLUGIN,command:this.record.command}))return;throw new q2.DevsError(n.message,{data:(0,N2.get)(r,"data"),stack:n.stack,exitCode:M2.EXIT_CODE.PLUGIN,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}})}component(t){return XL(this,void 0,void 0,function*(){let r=(0,l0u.default)(t.value),{_:n}=gnr.parseArgv(r),[u,i]=n,o=yield(0,Dnr.default)(u,{logger:this.logger});if(o[i]){let a=Object.assign(Object.assign({},this.record.componentProps),{args:(0,N2.filter)(r.slice(2),c=>!(0,N2.includes)([u,i],c))});try{yield o[i](a);return}catch(c){let l=c;if((0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.COMPONENT,command:this.record.command}))return;throw new q2.DevsError(l.message,{data:(0,N2.get)(c,"data"),stack:l.stack,exitCode:M2.EXIT_CODE.COMPONENT,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,trackerType:q2.ETrackerType.runtimeException})}}if(!(0,Uv.getAllowFailure)(this.record.allowFailure,{exitCode:M2.EXIT_CODE.DEVS,command:this.record.command}))throw new q2.DevsError(`The [${i}] command was not found.`,{exitCode:M2.EXIT_CODE.DEVS,prefix:`${this.record.label} ${t.hookType}-action failed to [${this.record.command}]:`,tips:`Please check the component ${u} has the ${i} command. Serverless Devs documents\uFF1A${JL.default.underline("https://manual.serverless-devs.com/")}`,trackerType:q2.ETrackerType.parseException})})}};Y0.default=rRe});var wnr=N(As=>{"use strict";var _nr=As&&As.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),f0u=As&&As.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p0u=As&&As.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&_nr(t,e,r);return f0u(t,e),t},h0u=As&&As.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&_nr(t,e,r)},Mf=As&&As.__awaiter||function(e,t,r,n){function u(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{c(n.next(l))}catch(f){o(f)}}function a(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?i(l.value):u(l.value).then(s,a)}c((n=n.apply(e,t||[])).next())})},zv=As&&As.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(As,"__esModule",{value:!0});As.preview=As.verify=void 0;var Enr=_rr(),sn=fr(),Wu=Wke(),U2=Iie(),X0=p0u(Cf()),bnr=zv(require("path")),n7=zv(Zke()),Cnr=zv(ynr()),d0u=zv(vl()),xnr=zv(f5()),Anr=zv(Xye()),Vl=pr(),$v=eRe(),Fnr=zv(require("assert")),m0u=zv(Xj());h0u(Wke(),As);var Bnr=Iie();Object.defineProperty(As,"verify",{enumerable:!0,get:function(){return Bnr.verify}});Object.defineProperty(As,"preview",{enumerable:!0,get:function(){return Bnr.preview}});var $2=Qh()("serverless-devs:engine"),nRe=class{constructor(t){this.options=t,this.context={status:Wu.STEP_STATUS.PENDING,completed:!1,error:[]},this.record={status:Wu.STEP_STATUS.PENDING,editStatusAble:!0},this.spec={},$2("engine start"),this.options.args=(0,sn.get)(this.options,"args",process.argv.slice(2)),this.options.cwd=(0,sn.get)(this.options,"cwd",process.cwd()),this.options.template=(0,Vl.getAbsolutePath)((0,sn.get)(this.options,"template"),this.options.cwd),$2(`engine options: ${(0,U2.stringify)(t)}`)}beforeStart(){return Mf(this,void 0,void 0,function*(){this.glog=this.getLogger(),this.logger=this.glog.__generate("engine"),this.parseSpecInstance=new X0.default((0,sn.get)(this.options,"template"),{argv:this.options.args,logger:this.logger}),this.spec=yield this.parseSpecInstance.start(),(0,sn.each)(this.options.env,(r,n)=>{process.env[n]=r});let{steps:t}=this.spec;yield this.validate(),this.context.steps=yield this.download(t)})}start(){return Mf(this,void 0,void 0,function*(){this.context.status=Wu.STEP_STATUS.RUNNING,this.record.status=Wu.STEP_STATUS.RUNNING;try{yield this.beforeStart()}catch(s){return this.context.status=Wu.STEP_STATUS.FAILURE,this.context.completed=!0,this.context.error.push(s),this.context}let{steps:t,yaml:r,command:n,access:u=r.access}=this.spec;this.logger.write(n7.default.gray(`${(0,Vl.emoji)("\u231B")} Steps for [${n}] of [${(0,sn.get)(this.spec,"yaml.appName")}]
1238
1238
  ${n7.default.gray("====================")}`)),this.globalActionInstance=new Cnr.default(r.actions,{hookLevel:X0.IActionLevel.GLOBAL,logger:this.logger,skipActions:this.spec.skipActions});let i=yield(0,U2.getCredential)(u,this.logger);this.context.credential=i;try{this.globalActionInstance.setValue("magic",this.getFilterContext()),this.globalActionInstance.setValue("command",n),yield this.globalActionInstance.start(X0.IHookType.PRE,{access:u,credential:i})}catch(s){return this.context.error.push(s),this.context.status=Wu.STEP_STATUS.FAILURE,yield this.doCompleted(),this.context}this.context.steps=(0,sn.map)(this.context.steps,s=>Object.assign(Object.assign({},s),{stepCount:(0,sn.uniqueId)(),status:Wu.STEP_STATUS.PENDING,done:!1}));let o=yield new Promise(s=>Mf(this,void 0,void 0,function*(){let a={init:{on:{INIT:this.context.steps.length===0?"final":(0,sn.get)(this.context.steps,"[0].stepCount")}},final:{type:"final",invoke:{src:()=>Mf(this,void 0,void 0,function*(){let f=this.record.status===Wu.STEP_STATUS.ERROR_WITH_CONTINUE?Wu.STEP_STATUS.SUCCESS:this.record.status;this.context.status=f,yield this.doCompleted(),this.context.steps=(0,sn.map)(this.context.steps,p=>(0,sn.omit)(p,["instance"])),this.context.output=this.getOutput(),$2(`context: ${(0,U2.stringify)(this.context)}`),$2("engine end"),s(this.context)})}}};(0,sn.each)(this.context.steps,(f,p)=>{let h=this.context.steps[p+1]?(0,sn.get)(this.context.steps,`[${p+1}].stepCount`):"final",d=r.useFlow?(0,sn.filter)(this.context.steps,m=>m.flowId===f.flowId):[f];a[f.stepCount]={invoke:{id:f.stepCount,src:()=>Mf(this,void 0,void 0,function*(){if(!f.done)return this.record.startTime=Date.now(),this.recordContext(f,{status:Wu.STEP_STATUS.RUNNING}),this.record.status===Wu.STEP_STATUS.FAILURE?yield Promise.all((0,sn.map)(d,m=>this.doSkip(m))):yield Promise.all((0,sn.map)(d,m=>this.handleSrc(m)))}),onDone:{target:h},onError:h}}});let c=(0,Enr.createMachine)({predictableActionArguments:!0,id:"step",initial:"init",states:a});(0,Enr.interpret)(c).onTransition(f=>f.value).start().send("INIT")}));return this.glog.__clear(),o})}getOutput(){let t={};return(0,sn.each)(this.context.steps,r=>{(0,sn.isNil)(r.output)||(0,sn.set)(t,r.projectName,r.output)}),t}validate(){return Mf(this,void 0,void 0,function*(){let{steps:t,command:r,projectName:n}=this.spec,u=[],i=new m0u.default({allErrors:!0});(0,Fnr.default)(!(0,sn.isEmpty)(t),"Step is required");for(let o of t){let s=yield(0,xnr.default)(o.component,{logger:this.logger,engineLogger:this.logger});if(n&&(0,sn.keys)((0,sn.get)(s,"commands")).includes(n))throw new Vl.DevsError(`The name of the project [${n}] overlaps with a command, please change it's name.`,{exitCode:$v.EXIT_CODE.DEVS,trackerType:Vl.ETrackerType.parseException,prefix:`[${n}] failed to [${r}]:`});if((0,sn.get)(this.spec,"yaml.use3x")&&(0,sn.get)(this.spec,"yaml.content.validation")){let a=yield this.getSchemaByInstance(s);if((0,sn.isEmpty)(a))continue;let c=i.compile(JSON.parse(a));if(!c(o.props)){let l=c.errors;if(!l)continue;for(let f of l)f.instancePath=o.projectName+"/props"+f.instancePath,f.keyword==="enum"&&(f.message=f.message+": "+f.params.allowedValues.join(", "));u=u.concat(l)}}}if((0,Fnr.default)(r,"Command is required"),!(0,sn.isEmpty)(u))throw new Vl.DevsError(`${i.errorsText(u,{dataVar:"",separator:`
1239
1239
  `})}`,{exitCode:$v.EXIT_CODE.DEVS,trackerType:Vl.ETrackerType.parseException,prefix:"Function props validation error:"})})}getSchemaByInstance(t){return!t||!t.getSchema?null:t.getSchema()}download(t){return Mf(this,void 0,void 0,function*(){let{command:r}=this.spec,n=[];for(let u of t){let i=this.glog.__generate(u.projectName),o=yield(0,xnr.default)(u.component,{logger:i,engineLogger:this.logger}),s=(0,sn.get)(o,`commands.${r}.verify`);n.push(Object.assign(Object.assign({},u),{instance:o,logger:i,verify:(0,sn.isUndefined)(s)?!0:s}))}return n})}getLogger(){let t=(0,sn.get)(this.options,"logConfig.customLogger");if(t){if($2("use custom logger"),(t==null?void 0:t.CODE)===Anr.default.CODE)return t;throw new Error("customLogger must be instance of Logger")}return new Anr.default(Object.assign(Object.assign({traceId:(0,Vl.traceid)(),logDir:bnr.default.join((0,Vl.getRootHome)(),"logs")},this.options.logConfig),{level:(0,sn.get)(this.options,"logConfig.level",this.spec.debug?"DEBUG":void 0)}))}recordContext(t,r={}){let{status:n,error:u,output:i,process_time:o,props:s,done:a}=r;this.context.stepCount=t.stepCount,this.context.steps=(0,sn.map)(this.context.steps,c=>(c.stepCount===t.stepCount&&(n&&(c.status=n),u&&(c.error=u,this.context.error.push(u)),s&&(c.props=s),i&&(c.output=i),a&&(c.done=a),(0,sn.has)(r,"process_time")&&(c.process_time=o)),c))}getFilterContext(t){let r={cwd:bnr.default.dirname(this.spec.yaml.path),vars:this.spec.yaml.vars,resources:{},__runtime:this.options.verify?"engine":"parse",__steps:this.context.steps};for(let n of this.context.steps)r.resources[n.projectName]={output:n.output||{},props:n.props||{}};return t&&(r.credential=t.credential,r.that={name:t.projectName,access:t.access,component:t.component,props:r.resources[t.projectName].props,output:r.resources[t.projectName].output}),r}doCompleted(){return Mf(this,void 0,void 0,function*(){if(this.context.completed=!0,this.context.status===Wu.STEP_STATUS.FAILURE)try{yield this.globalActionInstance.start(X0.IHookType.FAIL,this.context)}catch(t){this.context.status=Wu.STEP_STATUS.FAILURE,this.context.error.push(t)}if(this.context.status===Wu.STEP_STATUS.SUCCESS)try{yield this.globalActionInstance.start(X0.IHookType.SUCCESS,this.context)}catch(t){this.context.status=Wu.STEP_STATUS.FAILURE,this.context.error.push(t)}try{yield this.globalActionInstance.start(X0.IHookType.COMPLETE,this.context)}catch(t){this.context.status=Wu.STEP_STATUS.FAILURE,this.context.error.push(t)}})}handleSrc(t){var r,n,u;return Mf(this,void 0,void 0,function*(){let{command:i}=this.spec;try{yield this.handleAfterSrc(t)}catch{try{let a=yield(r=this.actionInstance)===null||r===void 0?void 0:r.start(X0.IHookType.FAIL,this.record.componentProps);this.recordContext(t,(0,sn.get)(a,"pluginOutput",{}))}catch(a){this.record.status=Wu.STEP_STATUS.FAILURE,this.recordContext(t,{error:a})}}if(this.record.status===Wu.STEP_STATUS.SUCCESS)try{this.actionInstance.setValue("magic",this.getFilterContext(t));let s=yield(n=this.actionInstance)===null||n===void 0?void 0:n.start(X0.IHookType.SUCCESS,Object.assign(Object.assign({},this.record.componentProps),{output:(0,sn.get)(t,"output",{})}));this.recordContext(t,(0,sn.get)(s,"pluginOutput",{}))}catch(s){this.record.status=Wu.STEP_STATUS.FAILURE,this.recordContext(t,{error:s})}try{let s=yield(u=this.actionInstance)===null||u===void 0?void 0:u.start(X0.IHookType.COMPLETE,Object.assign(Object.assign({},this.record.componentProps),{output:(0,sn.get)(t,"output",{})}));this.recordContext(t,(0,sn.get)(s,"pluginOutput",{}))}catch(s){this.record.status=Wu.STEP_STATUS.FAILURE,this.recordContext(t,{error:s})}let o=(0,U2.getProcessTime)(this.record.startTime);this.recordContext(t,{done:!0,process_time:o}),this.record.status===Wu.STEP_STATUS.SUCCESS&&this.logger.write(`${n7.default.green("\u2714")} ${n7.default.gray(`[${t.projectName}] completed (${o}s)`)}`),this.record.status===Wu.STEP_STATUS.FAILURE&&this.logger.write(`${n7.default.red("\u2716")} ${n7.default.gray(`[${t.projectName}] failed to [${i}] (${o}s)`)}`),this.glog.__unset(t.projectName)})}handleAfterSrc(t){var r;return Mf(this,void 0,void 0,function*(){try{$2(`project item: ${(0,U2.stringify)(t)}`);let{command:n}=this.spec;t.credential=yield(0,U2.getCredential)(t.access,this.logger);let{AccessKeyID:u,AccessKeySecret:i}=t.credential;this.glog.__setSecret([u,i]);let o=this.parseSpecInstance.parseActions(t.actions,X0.IActionLevel.PROJECT);$2(`project actions: ${JSON.stringify(o)}`),this.actionInstance=new Cnr.default(o,{hookLevel:X0.IActionLevel.PROJECT,projectName:t.projectName,logger:t.logger,skipActions:this.spec.skipActions}),this.actionInstance.setValue("magic",this.getFilterContext(t)),this.actionInstance.setValue("step",t),this.actionInstance.setValue("command",n);let s=yield this.getProps(t);this.actionInstance.setValue("componentProps",s);let a=yield(r=this.actionInstance)===null||r===void 0?void 0:r.start(X0.IHookType.PRE,s),c=yield this.doSrc(t,a);this.record.editStatusAble&&(this.record.status=Wu.STEP_STATUS.SUCCESS),t.id&&(this.record.steps=Object.assign(Object.assign({},this.record.steps),{[t.id]:{status:Wu.STEP_STATUS.SUCCESS,output:c}})),this.recordContext(t,{status:Wu.STEP_STATUS.SUCCESS,output:c})}catch(n){let u=n,i=t["continue-on-error"]===!0?Wu.STEP_STATUS.ERROR_WITH_CONTINUE:Wu.STEP_STATUS.FAILURE;if(this.record.editStatusAble&&(this.record.status=i),i===Wu.STEP_STATUS.FAILURE&&(this.record.editStatusAble=!1),t.id&&(this.record.steps=Object.assign(Object.assign({},this.record.steps),{[t.id]:{status:i}})),t["continue-on-error"])this.recordContext(t,{status:i});else throw this.recordContext(t,{status:i,error:u}),u}})}getProps(t){return Mf(this,void 0,void 0,function*(){let r=this.getFilterContext(t);$2(`magic context: ${JSON.stringify(r)}`);let n=(0,X0.getInputs)(t.props,r),{projectName:u,command:i}=this.spec,o={cwd:this.options.cwd,userAgent:(0,Vl.getUserAgent)({component:t.instance.__info}),name:(0,sn.get)(this.spec,"yaml.appName"),props:n,command:i,args:(0,sn.filter)(this.options.args,s=>!(0,sn.includes)([u,i],s)),yaml:{path:(0,sn.get)(this.spec,"yaml.path")},resource:{name:t.projectName,component:t.component,access:t.access},outputs:this.getOutput(),getCredential:()=>Mf(this,void 0,void 0,function*(){let s=yield new d0u.default({logger:this.logger}).get(t.access);return(0,sn.get)(s,"credential",{})})};return this.recordContext(t,{props:n}),$2(`get props: ${JSON.stringify(o)}`),o})}doSrc(t,r={}){return Mf(this,void 0,void 0,function*(){let{command:n="",projectName:u}=this.spec,i=yield this.getProps(t);if(this.record.componentProps=(0,sn.isEmpty)(r.pluginOutput)?i:r.pluginOutput,$2(`component props: ${(0,U2.stringify)(this.record.componentProps)}`),this.actionInstance.setValue("componentProps",this.record.componentProps),u){if((0,sn.isFunction)(t.instance[n]))try{return yield t.instance[n](this.record.componentProps)}catch(s){if((0,U2.getAllowFailure)(t.allow_failure,{exitCode:$v.EXIT_CODE.COMPONENT,command:n}))return;let c=s;throw new Vl.DevsError(c.message,{data:(0,sn.get)(s,"data"),stack:c.stack,exitCode:$v.EXIT_CODE.COMPONENT,prefix:`[${t.projectName}] failed to [${n}]:`,trackerType:Vl.ETrackerType.runtimeException})}if((0,U2.getAllowFailure)(t.allow_failure,{exitCode:$v.EXIT_CODE.DEVS,command:n}))return;throw new Vl.DevsError(`The [${n}] command was not found.`,{exitCode:$v.EXIT_CODE.DEVS,tips:`Please check the component ${t.component} has the ${n} command. Serverless Devs documents\uFF1A${n7.default.underline("https://manual.serverless-devs.com/")}`,prefix:`[${t.projectName}] failed to [${n}]:`,trackerType:Vl.ETrackerType.parseException})}if((0,sn.isFunction)(t.instance[n]))try{return yield t.instance[n](this.record.componentProps)}catch(o){if((0,U2.getAllowFailure)(t.allow_failure,{exitCode:$v.EXIT_CODE.COMPONENT,command:n}))return;let a=o;throw new Vl.DevsError(a.message,{data:(0,sn.get)(o,"data"),stack:a.stack,exitCode:$v.EXIT_CODE.COMPONENT,prefix:`[${t.projectName}] failed to [${n}]:`,trackerType:Vl.ETrackerType.runtimeException})}this.logger.tips(`The [${n}] command was not found.`,`Please check the component ${t.component} has the ${n} command. Serverless Devs documents\uFF1Ahttps://manual.serverless-devs.com/`)})}doSkip(t){return Mf(this,void 0,void 0,function*(){return t.id&&(this.record.steps=Object.assign(Object.assign({},this.record.steps),{[t.id]:{status:Wu.STEP_STATUS.SKIP}})),this.recordContext(t,{status:Wu.STEP_STATUS.SKIP,process_time:0}),Promise.resolve()})}};As.default=nRe});var z2,Wie,W2,wo,uRe,Snr,iRe,Onr,g0u,Tnr,Pnr=_t(()=>{z2=ot(mie()),Wie=ot(require("path")),W2=ot(pr()),wo=ot(fr());gr();Cn();uRe=ot(pr()),Snr=ot(mie());Gx();sg();cg();iRe=class{constructor(t,r={}){this.program=t;this.spec=r}async init(){let t=process.argv.slice(2),{_:r,help:n}=(0,uRe.parseArgv)(t);if(r.length===0&&n)return await this.showSimpleHelp();if(r.length===1&&(this.customProgram=this.program.command(r[0]).allowUnknownOption(),n))return await this.showHelp();if(r.length>1&&(this.customProgram=this.program.command(r[0]).allowUnknownOption(),n))return await this.showComflexHelp();this.customProgram.action(async()=>{await this.doExecCommand()})}async doExecCommand(){let t=process.argv.slice(2),{template:r,help:n,access:u,debug:i,output:o,...s}=(0,uRe.parseArgv)(t),a=await this.getReportComponent(),c={uid:await ux(u),argv:t,command:this.spec.command,component:a,userAgent:(0,W2.getUserAgent)({component:a})};try{let l=await Snr.execCommand({syaml:r,serverName:this.spec.projectName,method:this.spec.command,args:process.argv.slice(2),globalArgs:{access:u,skipActions:s["skip-actions"],debug:i,help:n,output:o||s["output-format"]},env:{serverless_devs_temp_argv:JSON.stringify(process.argv.slice(2))}});B0(l),Mc("report.js",{...c,type:"command"})}catch(l){cd(new W2.DevsError(l.message,{stack:l.stack,trackerType:W2.ETrackerType.runtimeException}),c)}}async getReportComponent(){let t=[],r=(0,wo.get)(this.spec,"components");for(let n of r){if((0,wo.isEmpty)(n))continue;let u=await(0,z2.loadComponent)(n),i=(0,W2.getYamlContent)(Wie.default.join(u.__path,"publish.yaml")),o=(0,wo.get)(i,"Version");t.push(o?`${(0,wo.get)(i,"Name")}@${o}`:n)}return(0,wo.join)(t,",")}async showSimpleHelp(){let{steps:t,components:r}=this.spec;if((0,wo.isEmpty)(t))return;let n=["Custom Commands"," Can be used in projects with Serverless Devs Yaml. Usage\uFF1A"," - s <component_command>\uFF1AOperate on the project, E.x: s deploy"," - s <project_name> <component_command>\uFF1AOperate on the resource, E.x: s website deploy"," More information: https://serverless.help/custom"];if(r.length===1)return(await Onr((0,wo.first)(r))).join(`
1240
1240
  `);let u={};return(0,wo.each)(t,i=>{u[`${i.projectName} [options]`]=`Please use [s ${i.projectName} -h] obtain the documentation.`}),n.push(z2.publishHelp.helpInfo(u,"",27)),n.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serverless-devs/s",
3
- "version": "3.0.7-578af2fc",
3
+ "version": "3.0.7-9987d343",
4
4
  "description": "Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",
5
5
  "homepage": "https://www.serverless-devs.com",
6
6
  "keywords": [
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@serverless-devs/core": "^0.1.67-beta.1",
68
68
  "@serverless-devs/credential": "^0.0.6-beta.1",
69
- "@serverless-devs/engine": "^0.1.2-beta.8",
69
+ "@serverless-devs/engine": "^0.1.2-beta.9",
70
70
  "@serverless-devs/load-application": "^0.0.13-beta.5",
71
71
  "@serverless-devs/load-component": "^0.0.7-beta.4",
72
72
  "@serverless-devs/logger": "^0.0.5-beta.2",