UNPKG

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) 1.95 kB
var R=Object.defineProperty,b=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var g=t=>{throw TypeError(t)};var m=(t,e,s)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,u=(t,e)=>{for(var s in e||(e={}))T.call(e,s)&&m(t,s,e[s]);if(G)for(var s of G(e))U.call(e,s)&&m(t,s,e[s]);return t},v=(t,e)=>b(t,C(e));var E=(t,e,s)=>e.has(t)||g("Cannot "+s);var i=(t,e,s)=>(E(t,e,"read from private field"),s?s.call(t):e.get(t)),c=(t,e,s)=>e.has(t)?g("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),f=(t,e,s,r)=>(E(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);var x=(t,e,s)=>new Promise((r,S)=>{var n=p=>{try{d(s.next(p))}catch(I){S(I)}},a=p=>{try{d(s.throw(p))}catch(I){S(I)}},d=p=>p.done?r(p.value):Promise.resolve(p.value).then(n,a);d((s=s.apply(t,e)).next())});import{fork as w}from"child_process";var y=["exit","beforeExit","uncaughtException","unhandledRejection","SIGHUP","SIGINT","SIGQUIT","SIGILL","SIGTRAP","SIGABRT","SIGBUS","SIGFPE","SIGUSR1","SIGSEGV","SIGUSR2","SIGTERM"],h,l,o,P=class{constructor(e){c(this,h);c(this,l,y);c(this,o);f(this,o,e!=null?e:{})}start(){return x(this,null,function*(){i(this,l).forEach(r=>{process.on(r,()=>{this.stop()})});let e=["aws-lambda"];i(this,o).stage&&e.push("-s","dev"),i(this,o).watch||e.push("-w","false");let s=v(u({},process.env),{PORT:i(this,o).port});return i(this,o).debug&&(s.SLS_DEBUG="*"),f(this,h,w(`${process.cwd()}/node_modules/serverless/bin/serverless`,e,{env:s})),i(this,h).on("message",({rebuild:r})=>{var S,n;r&&((n=(S=i(this,o)).onRebuild)==null||n.call(S))}),new Promise((r,S)=>{i(this,h).on("message",({port:n,ip:a})=>{n&&r({port:n,ip:a})})})})}stop(){var s;return(s=i(this,h))==null?void 0:s.kill()}};h=new WeakMap,l=new WeakMap,o=new WeakMap;export{P as Server,y as exitEvents};