serverless-aws-lambda
Version:
AWS Application Load Balancer and API Gateway - Lambda dev tool for Serverless. Allows Express synthax in handlers. Supports packaging, local invoking and offline ALB, APG, S3, SNS, SQS, DynamoDB Stream server mocking.
2 lines (1 loc) • 3.37 kB
JavaScript
;var S=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var T=(e,s)=>{for(var i in s)S(e,i,{get:s[i],enumerable:!0})},N=(e,s,i,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of M(s))!U.call(e,t)&&t!==i&&S(e,t,{get:()=>s[t],enumerable:!(r=B(s,t))||r.enumerable});return e};var Q=e=>N(S({},"__esModule",{value:!0}),e);var m=(e,s,i)=>new Promise((r,t)=>{var h=a=>{try{d(i.next(a))}catch(u){t(u)}},y=a=>{try{d(i.throw(a))}catch(u){t(u)}},d=a=>a.done?r(a.value):Promise.resolve(a.value).then(h,y);d((i=i.apply(e,s)).next())});var X={};T(X,{default:()=>K,defineConfig:()=>L});module.exports=Q(X);var C=!1,$=e=>{C=e},H=()=>C,p=(e,s)=>{C&&console.log(`\x1B[${e}m${s}\x1B[0m`)},Y=e=>console.log(`\x1B[31m${e}\x1B[0m`),_=e=>p("32",e),j=e=>p("33",e),W=e=>p("36",e),F=e=>p("90",e),V=e=>p("94",e),z=e=>C?console.log(e):void 0,b={GREEN:_,YELLOW:j,CYAN:W,BR_BLUE:V,RED:Y,GREY:F,setDebug:$,getDebug:H,info:z};var E=["exit","beforeExit","uncaughtException","unhandledRejection","SIGHUP","SIGINT","SIGQUIT","SIGILL","SIGTRAP","SIGABRT","SIGBUS","SIGFPE","SIGUSR1","SIGSEGV","SIGUSR2","SIGTERM"];var R=!1,w=[],J=e=>{if(!R){R=!0;for(let s of w)try{s(e)}catch(i){console.log(i),process.exitCode=1}process.exit()}};E.forEach(e=>{process.on(e,J)});function L(e){let s=new Set;return e.plugins&&(e.plugins=e.plugins.filter((i,r)=>typeof i!="object"||!i||!("name"in i)?!1:((!i.name||!i.name.length||typeof i.name!="string")&&(i.name="plugin-"+r,b.YELLOW(`Invalid plugin name at index ${r}`)),s.has(i.name)?i.name=i.name+r:s.add(i.name),!0))),function(ge){return m(this,arguments,function*({stop:r,lambdas:t,isDeploying:h,isPackaging:y,setEnv:d,stage:a,region:u,esbuild:q,serverless:D,resources:G,getServices:A,setServices:k}){var P,I,x;let o={esbuild:(P=e.esbuild)!=null?P:{},shimRequire:e.shimRequire,includeAwsSdk:e.includeAwsSdk,offline:{staticPath:(I=e.offline)==null?void 0:I.staticPath,port:(x=e.offline)==null?void 0:x.port},afterDeployCallbacks:[],afterPackageCallbacks:[]};e.services&&(yield k(e.services));let g={stop:r,lambdas:t,isDeploying:h,isPackaging:y,setEnv:d,stage:a,region:u,esbuild:q,serverless:D,options:e,config:o,resources:G,getServices:A,setServices:k};if(e.plugins){o.offline.onReady=(n,l)=>m(this,null,function*(){var f;for(let c of e.plugins)if((f=c.offline)!=null&&f.onReady)try{yield c.offline.onReady.call(g,n,l)}catch(O){b.RED(c.name),console.error(O)}}),o.buildCallback=(n,l)=>m(this,null,function*(){for(let f of e.plugins)if(f.buildCallback)try{yield f.buildCallback.call(g,n,l)}catch(c){b.RED(f.name),console.error(c),l||process.exit(1)}});let v=e.plugins.reduce((n,l)=>{var f,c;return(c=(f=l.offline)==null?void 0:f.request)!=null&&c.length&&n.push(...l.offline.request),n},[]);v!=null&&v.length&&(o.offline.request=v.map(n=>(n.callback=n.callback.bind(g),n)));for(let n of e.plugins)if(n.onExit&&w.push(n.onExit.bind(g)),typeof n.afterDeploy=="function"&&o.afterDeployCallbacks.push(n.afterDeploy.bind(g)),typeof n.afterPackage=="function"&&o.afterPackageCallbacks.push(n.afterPackage.bind(g)),n.onInit)try{yield n.onInit.call(g)}catch(l){b.RED(n.name),console.error(l)}}return o.afterDeployCallbacks.length||delete o.afterDeployCallbacks,o.afterPackageCallbacks.length||delete o.afterPackageCallbacks,o})}}var K=L;0&&(module.exports={defineConfig});