Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
import e from"http2";import{parse as t}from"regexparam";import r from"qs";function s(e,t){let r=0,s={};if(t){let a=t.pattern.exec(e);for(;r<t.keys.length;)s[t.keys[r]]=a[++r]||null}return s}const a=(a={})=>{const n=[];let o;o=a.key&&a.cert?e.createSecureServer(a):e.createServer(),o.on("stream",async(e,t)=>{const a=t[":path"],o=t[":method"],[p,h]=a.split("?"),d={":status":200},l={status:e=>d.status=e,set:(e,t)=>d[e]=t,end:t=>{e.respond(d),e.end(t)}};for(let e of n){const a={params:s(p,e.pathRegex),query:r.parse(h),headers:t};if(e.method||e.path){if(e.method===o&&e.pathRegex.pattern.test(p))return void await e.handler(a,l)}else await e.handler(a,l)}e.respond({":status":404}),e.end(`Not found: ${o} ${a}`)});const p=(e,r,s)=>{n.push({method:e,pathRegex:t(r),handler:s})};return{listen:e=>o.listen(e),use:e=>n.push({handler:e}),get:(e,t)=>p("GET",e,t),post:(e,t)=>p("POST",e,t),delete:(e,t)=>p("DELETE",e,t),patch:(e,t)=>p("PATCH",e,t)}};export{a as h2}; | ||
import e from"http2";import{parse as t}from"regexparam";import r from"qs";function s(e,t){let r=0,s={};if(t){let a=t.pattern.exec(e);for(;r<t.keys.length;)s[t.keys[r]]=a[++r]||null}return s}const a=(a={})=>{const n=[];let o;o=a.key&&a.cert?e.createSecureServer(a):e.createServer(),o.on("stream",async(e,t)=>{const a=t[":path"],o=t[":method"],[p,h]=a.split("?"),d={":status":200},l={status:e=>d[":status"]=e,set:(e,t)=>d[e]=t,end:t=>{e.respond(d),e.end(t)}};for(let e of n)if(e.method||e.pathRegex){if(e.method===o&&e.pathRegex.pattern.test(p)){const a={params:s(p,e.pathRegex),query:r.parse(h),headers:t};return void await e.handler(a,l)}}else await e.handler(l);e.respond({":status":404}),e.end(`Not found: ${o} ${a}`)});const p=(e,r,s)=>{n.push({method:e,pathRegex:t(r),handler:s})};return{listen:e=>o.listen(e),use:e=>n.push({handler:e}),get:(e,t)=>p("GET",e,t),post:(e,t)=>p("POST",e,t),delete:(e,t)=>p("DELETE",e,t),patch:(e,t)=>p("PATCH",e,t)}};export{a as h2}; | ||
//# sourceMappingURL=h2.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import t from"http2";import{parse as n}from"regexparam";import r from"qs";const e="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function o(t,n,r){if(!t.s){if(r instanceof u){if(!r.s)return void(r.o=o.bind(null,t,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(o.bind(null,t,n),o.bind(null,t,2));t.s=n,t.v=r;var e=t.o;e&&e(t)}}var u=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var e=new t,u=this.s;if(u){var i=1&u?n:r;if(i){try{o(e,1,i(this.v))}catch(t){o(e,2,t)}return e}return this}return this.o=function(t){try{var u=t.v;1&t.s?o(e,1,n?n(u):u):r?o(e,1,r(u)):o(e,2,u)}catch(t){o(e,2,t)}},e},t}();function i(t){return t instanceof u&&1&t.s}var f=function(f){void 0===f&&(f={});var c,a=[];(c=f.key&&f.cert?t.createSecureServer(f):t.createServer()).on("stream",function(t,n){try{var f,c=function(n){if(f)return n;t.respond({":status":404}),t.end("Not found: "+h+" "+s)},s=n[":path"],h=n[":method"],l=s.split("?"),v=l[0],d=l[1],p={":status":200},m={status:function(t){return p.status=t},set:function(t,n){return p[t]=n},end:function(n){t.respond(p),t.end(n)}},y=function(t,n,r){if("function"==typeof t[e]){var f,c,a,s=t[e]();if(function t(e){try{for(;!((f=s.next()).done||r&&r());)if((e=n(f.value))&&e.then){if(!i(e))return void e.then(t,a||(a=o.bind(null,c=new u,2)));e=e.v}c?o(c,1,e):c=e}catch(t){o(c||(c=new u),2,t)}}(),s.return){var h=function(t){try{f.done||s.return()}catch(t){}return t};if(c&&c.then)return c.then(h,function(t){throw h(t)});h()}return c}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],v=0;v<t.length;v++)l.push(t[v]);return function(t,n,r){var e,f,c=-1;return function a(s){try{for(;++c<t.length&&(!r||!r());)if((s=n(c))&&s.then){if(!i(s))return void s.then(a,f||(f=o.bind(null,e=new u,2)));s=s.v}e?o(e,1,s):e=s}catch(t){o(e||(e=new u),2,t)}}(),e}(l,function(t){return n(l[t])},r)}(a,function(t){var e=function(t,n){var r=0,e={};if(n)for(var o=n.pattern.exec(t);r<n.keys.length;)e[n.keys[r]]=o[++r]||null;return e}(v,t.pathRegex),o={params:e,query:r.parse(d),headers:n};return t.method||t.path?function(){if(t.method===h&&t.pathRegex.pattern.test(v))return Promise.resolve(t.handler(o,m)).then(function(){f=1})}():Promise.resolve(t.handler(o,m)).then(function(){})},function(){return f});return Promise.resolve(y&&y.then?y.then(c):c(y))}catch(t){return Promise.reject(t)}});var s=function(t,r,e){a.push({method:t,pathRegex:n(r),handler:e})};return{listen:function(t){return c.listen(t)},use:function(t){return a.push({handler:t})},get:function(t,n){return s("GET",t,n)},post:function(t,n){return s("POST",t,n)},delete:function(t,n){return s("DELETE",t,n)},patch:function(t,n){return s("PATCH",t,n)}}};export{f as h2}; | ||
import t from"http2";import{parse as n}from"regexparam";import r from"qs";const e="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function o(t,n,r){if(!t.s){if(r instanceof u){if(!r.s)return void(r.o=o.bind(null,t,n));1&n&&(n=r.s),r=r.v}if(r&&r.then)return void r.then(o.bind(null,t,n),o.bind(null,t,2));t.s=n,t.v=r;var e=t.o;e&&e(t)}}var u=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var e=new t,u=this.s;if(u){var i=1&u?n:r;if(i){try{o(e,1,i(this.v))}catch(t){o(e,2,t)}return e}return this}return this.o=function(t){try{var u=t.v;1&t.s?o(e,1,n?n(u):u):r?o(e,1,r(u)):o(e,2,u)}catch(t){o(e,2,t)}},e},t}();function i(t){return t instanceof u&&1&t.s}var f=function(f){void 0===f&&(f={});var c,a=[];(c=f.key&&f.cert?t.createSecureServer(f):t.createServer()).on("stream",function(t,n){try{var f,c=function(n){if(f)return n;t.respond({":status":404}),t.end("Not found: "+h+" "+s)},s=n[":path"],h=n[":method"],l=s.split("?"),v=l[0],d=l[1],p={":status":200},m={status:function(t){return p[":status"]=t},set:function(t,n){return p[t]=n},end:function(n){t.respond(p),t.end(n)}},y=function(t,n,r){if("function"==typeof t[e]){var f,c,a,s=t[e]();if(function t(e){try{for(;!((f=s.next()).done||r&&r());)if((e=n(f.value))&&e.then){if(!i(e))return void e.then(t,a||(a=o.bind(null,c=new u,2)));e=e.v}c?o(c,1,e):c=e}catch(t){o(c||(c=new u),2,t)}}(),s.return){var h=function(t){try{f.done||s.return()}catch(t){}return t};if(c&&c.then)return c.then(h,function(t){throw h(t)});h()}return c}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],v=0;v<t.length;v++)l.push(t[v]);return function(t,n,r){var e,f,c=-1;return function a(s){try{for(;++c<t.length&&(!r||!r());)if((s=n(c))&&s.then){if(!i(s))return void s.then(a,f||(f=o.bind(null,e=new u,2)));s=s.v}e?o(e,1,s):e=s}catch(t){o(e||(e=new u),2,t)}}(),e}(l,function(t){return n(l[t])},r)}(a,function(t){return t.method||t.pathRegex?function(){if(t.method===h&&t.pathRegex.pattern.test(v)){var e=function(t,n){var r=0,e={};if(n)for(var o=n.pattern.exec(t);r<n.keys.length;)e[n.keys[r]]=o[++r]||null;return e}(v,t.pathRegex),o=r.parse(d);return Promise.resolve(t.handler({params:e,query:o,headers:n},m)).then(function(){f=1})}}():Promise.resolve(t.handler(m)).then(function(){})},function(){return f});return Promise.resolve(y&&y.then?y.then(c):c(y))}catch(t){return Promise.reject(t)}});var s=function(t,r,e){a.push({method:t,pathRegex:n(r),handler:e})};return{listen:function(t){return c.listen(t)},use:function(t){return a.push({handler:t})},get:function(t,n){return s("GET",t,n)},post:function(t,n){return s("POST",t,n)},delete:function(t,n){return s("DELETE",t,n)},patch:function(t,n){return s("PATCH",t,n)}}};export{f as h2}; | ||
//# sourceMappingURL=h2.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("http2"),require("regexparam"),require("qs")):"function"==typeof define&&define.amd?define(["exports","http2","regexparam","qs"],e):e((t||self).h2={},t.http2,t.regexparam,t.qs)}(this,function(t,e,n,r){function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=/*#__PURE__*/o(e),i=/*#__PURE__*/o(r);const f="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function a(t,e,n){if(!t.s){if(n instanceof c){if(!n.s)return void(n.o=a.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(a.bind(null,t,e),a.bind(null,t,2));t.s=e,t.v=n;var r=t.o;r&&r(t)}}var c=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var r=new t,o=this.s;if(o){var u=1&o?e:n;if(u){try{a(r,1,u(this.v))}catch(t){a(r,2,t)}return r}return this}return this.o=function(t){try{var o=t.v;1&t.s?a(r,1,e?e(o):o):n?a(r,1,n(o)):a(r,2,o)}catch(t){a(r,2,t)}},r},t}();function s(t){return t instanceof c&&1&t.s}t.h2=function(t){void 0===t&&(t={});var e,r=[];(e=t.key&&t.cert?u.default.createSecureServer(t):u.default.createServer()).on("stream",function(t,e){try{var n,o=function(e){if(n)return e;t.respond({":status":404}),t.end("Not found: "+h+" "+u)},u=e[":path"],h=e[":method"],l=u.split("?"),d=l[0],p=l[1],v={":status":200},y={status:function(t){return v.status=t},set:function(t,e){return v[t]=e},end:function(e){t.respond(v),t.end(e)}},m=function(t,e,n){if("function"==typeof t[f]){var r,o,u,i=t[f]();if(function t(f){try{for(;!((r=i.next()).done||n&&n());)if((f=e(r.value))&&f.then){if(!s(f))return void f.then(t,u||(u=a.bind(null,o=new c,2)));f=f.v}o?a(o,1,f):o=f}catch(t){a(o||(o=new c),2,t)}}(),i.return){var h=function(t){try{r.done||i.return()}catch(t){}return t};if(o&&o.then)return o.then(h,function(t){throw h(t)});h()}return o}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],d=0;d<t.length;d++)l.push(t[d]);return function(t,e,n){var r,o,u=-1;return function i(f){try{for(;++u<t.length&&(!n||!n());)if((f=e(u))&&f.then){if(!s(f))return void f.then(i,o||(o=a.bind(null,r=new c,2)));f=f.v}r?a(r,1,f):r=f}catch(t){a(r||(r=new c),2,t)}}(),r}(l,function(t){return e(l[t])},n)}(r,function(t){var r=function(t,e){var n=0,r={};if(e)for(var o=e.pattern.exec(t);n<e.keys.length;)r[e.keys[n]]=o[++n]||null;return r}(d,t.pathRegex),o={params:r,query:i.default.parse(p),headers:e};return t.method||t.path?function(){if(t.method===h&&t.pathRegex.pattern.test(d))return Promise.resolve(t.handler(o,y)).then(function(){n=1})}():Promise.resolve(t.handler(o,y)).then(function(){})},function(){return n});return Promise.resolve(m&&m.then?m.then(o):o(m))}catch(t){return Promise.reject(t)}});var o=function(t,e,o){r.push({method:t,pathRegex:n.parse(e),handler:o})};return{listen:function(t){return e.listen(t)},use:function(t){return r.push({handler:t})},get:function(t,e){return o("GET",t,e)},post:function(t,e){return o("POST",t,e)},delete:function(t,e){return o("DELETE",t,e)},patch:function(t,e){return o("PATCH",t,e)}}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("http2"),require("regexparam"),require("qs")):"function"==typeof define&&define.amd?define(["exports","http2","regexparam","qs"],e):e((t||self).h2={},t.http2,t.regexparam,t.qs)}(this,function(t,e,n,r){function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=/*#__PURE__*/o(e),i=/*#__PURE__*/o(r);const f="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function a(t,e,n){if(!t.s){if(n instanceof c){if(!n.s)return void(n.o=a.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(a.bind(null,t,e),a.bind(null,t,2));t.s=e,t.v=n;var r=t.o;r&&r(t)}}var c=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){var r=new t,o=this.s;if(o){var u=1&o?e:n;if(u){try{a(r,1,u(this.v))}catch(t){a(r,2,t)}return r}return this}return this.o=function(t){try{var o=t.v;1&t.s?a(r,1,e?e(o):o):n?a(r,1,n(o)):a(r,2,o)}catch(t){a(r,2,t)}},r},t}();function s(t){return t instanceof c&&1&t.s}t.h2=function(t){void 0===t&&(t={});var e,r=[];(e=t.key&&t.cert?u.default.createSecureServer(t):u.default.createServer()).on("stream",function(t,e){try{var n,o=function(e){if(n)return e;t.respond({":status":404}),t.end("Not found: "+h+" "+u)},u=e[":path"],h=e[":method"],l=u.split("?"),d=l[0],p=l[1],v={":status":200},y={status:function(t){return v[":status"]=t},set:function(t,e){return v[t]=e},end:function(e){t.respond(v),t.end(e)}},m=function(t,e,n){if("function"==typeof t[f]){var r,o,u,i=t[f]();if(function t(f){try{for(;!((r=i.next()).done||n&&n());)if((f=e(r.value))&&f.then){if(!s(f))return void f.then(t,u||(u=a.bind(null,o=new c,2)));f=f.v}o?a(o,1,f):o=f}catch(t){a(o||(o=new c),2,t)}}(),i.return){var h=function(t){try{r.done||i.return()}catch(t){}return t};if(o&&o.then)return o.then(h,function(t){throw h(t)});h()}return o}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],d=0;d<t.length;d++)l.push(t[d]);return function(t,e,n){var r,o,u=-1;return function i(f){try{for(;++u<t.length&&(!n||!n());)if((f=e(u))&&f.then){if(!s(f))return void f.then(i,o||(o=a.bind(null,r=new c,2)));f=f.v}r?a(r,1,f):r=f}catch(t){a(r||(r=new c),2,t)}}(),r}(l,function(t){return e(l[t])},n)}(r,function(t){return t.method||t.pathRegex?function(){if(t.method===h&&t.pathRegex.pattern.test(d)){var r=function(t,e){var n=0,r={};if(e)for(var o=e.pattern.exec(t);n<e.keys.length;)r[e.keys[n]]=o[++n]||null;return r}(d,t.pathRegex),o=i.default.parse(p);return Promise.resolve(t.handler({params:r,query:o,headers:e},y)).then(function(){n=1})}}():Promise.resolve(t.handler(y)).then(function(){})},function(){return n});return Promise.resolve(m&&m.then?m.then(o):o(m))}catch(t){return Promise.reject(t)}});var o=function(t,e,o){r.push({method:t,pathRegex:n.parse(e),handler:o})};return{listen:function(t){return e.listen(t)},use:function(t){return r.push({handler:t})},get:function(t,e){return o("GET",t,e)},post:function(t,e){return o("POST",t,e)},delete:function(t,e){return o("DELETE",t,e)},patch:function(t,e){return o("PATCH",t,e)}}}}); | ||
//# sourceMappingURL=h2.umd.js.map |
{ | ||
"name": "@sodra/h2", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35802