@gjsify/example-node-express-webserver 0.4.33 → 0.4.35
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/dist/index.gjs.js +24 -24
- package/package.json +5 -5
package/dist/index.gjs.js
CHANGED
|
@@ -215,35 +215,35 @@ t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is
|
|
|
215
215
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
216
216
|
* MIT Licensed
|
|
217
217
|
*/
|
|
218
|
-
t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Au(),r=ju(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Nu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Pu=
|
|
218
|
+
t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=Au(),r=ju(),i=/^[0-9]+$/,a=r.isValid,o=r.parse,s={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(s,e)&&(e=s[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!a(n))throw TypeError(`invalid IP address: `+n);var r=o(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var s=r.kind()===`ipv6`?128:32,c=t===-1?null:e.substring(t+1,e.length);if(c=c===null?s:i.test(c)?parseInt(c,10):r.kind()===`ipv4`&&a(c)?parseNetmask(c):null,c<=0||c>s)throw TypeError(`invalid range on address: `+e);return[r,c]}function parseNetmask(e){var t=o(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!a(t))return!1;for(var n=o(t),r,i=n.kind(),s=0;s<e.length;s++){var c=e[s],l=c[0],u=l.kind(),d=c[1],p=n;if(i!==u){if(u===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=u===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),p=r}if(p.match(l,d))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!a(e))return!1;var s=o(e);if(s.kind()!==n){if(r&&!s.isIPv4MappedAddress())return!1;s=r?s.toIPv4Address():s.toIPv4MappedAddress()}return s.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,Nu=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),Pu,Fu,Iu,Lu,Ru=__esmMin(()=>{Pu=Array.from({length:256});for(let e=0;e<256;++e)Pu[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();Fu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Iu=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]),Lu=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,a=0;for(let o=0;o<r;o++){let s=e.charCodeAt(o);if(s<128){if(t[s]===1)continue;a<o&&(i+=e.slice(a,o)),a=o+1,i+=n[s];continue}if(a<o&&(i+=e.slice(a,o)),s<2048){a=o+1,i+=n[192|s>>6]+n[128|s&63];continue}if(s<55296||s>=57344){a=o+1,i+=n[224|s>>12]+n[128|s>>6&63]+n[128|s&63];continue}if(++o,o>=r)throw new ERR_INVALID_URI;let c=e.charCodeAt(o)&1023;a=o+1,s=65536+((s&1023)<<10|c),i+=n[240|s>>18]+n[128|s>>12&63]+n[128|s>>6&63]+n[128|s&63]}return a===0?e:a<r?i+e.slice(a):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,Iu,Pu)}var ERR_INVALID_URI,zu=__esmMin(()=>{Nu(),Ru(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new q(e.length),r=0,i=0,a,o,s,c,l=e.length-2,u=!1;for(;r<e.length;){if(a=e.charCodeAt(r),a===43&&t){n[i++]=32,r++;continue}if(a===37&&r<l)if(a=e.charCodeAt(++r),s=Lu[a],s>=0)o=e.charCodeAt(++r),c=Lu[o],c>=0?(u=!0,a=s*16+c):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=a,r++}return u?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var Bu=__esmMin(()=>{Ru(),J()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,a){if(t.length>0&&r)try{t=a(t)}catch{}if(n.length>0&&i)try{n=a(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let a=Object.create(null);if(typeof e!=`string`||e.length===0)return a;let o=t?charCodes(String(t)):[38],s=n?charCodes(String(n)):[61],c=o.length,l=s.length,u=1e3;typeof i==`number`&&(u=i>0?i:-1);let d=qsUnescape;r&&(d=r);let p=d!==qsUnescape,m=0,h=0,g=0,_=``,v=``,y=p,b=p,x=p?`%20`:` `,S=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===o[h]){if(++h===c){let n=t-h+1;if(g<l){if(m<n)_+=e.slice(m,n);else if(_.length===0){if(--u===0)return a;m=t+1,h=g=0;continue}}else m<n&&(v+=e.slice(m,n));if(addKeyVal(a,_,v,y,b,d),--u===0)return a;_=v=``,S=0,m=t+1,h=g=0}}else{if(h=0,g<l){if(n===s[g]){if(++g===l){let n=t-g+1;m<n&&(_+=e.slice(m,n)),S=0,m=t+1}continue}else if(g=0,!y){if(n===37){S=1;continue}else if(S>0)if(Fu[n]===1){++S===3&&(y=!0);continue}else S=0}if(n===43){m<t&&(_+=e.slice(m,t)),_+=x,m=t+1;continue}}n===43?(m<t&&(v+=e.slice(m,t)),v+=x,m=t+1):b||(n===37?S=1:S>0&&(Fu[n]===1?++S===3&&(b=!0):S=0))}}if(m<e.length)g<l?_+=e.slice(m):h<c&&(v+=e.slice(m));else if(g===0&&_.length===0)return a;return addKeyVal(a,_,v,y,b,d),a}var Vu=__esmMin(()=>{Ru(),Bu()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,a=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),o=r.length,s=``;for(let c=0;c<o;++c){let o=r[c],l=e[o],u=a(o,i);if(u+=n,Array.isArray(l)){let e=l.length;if(e===0)continue;s&&(s+=t);for(let n=0;n<e;++n)n&&(s+=t),s+=u,s+=a(l[n],i)}else s&&(s+=t),s+=u,s+=a(l,i)}return s}return``}var Hu=__esmMin(()=>{zu()}),Uu=__exportAll$4({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>Wu,default:()=>Ju,encode:()=>Gu,escape:()=>Ku,parse:()=>parse,stringify:()=>stringify,unescape:()=>qu,unescapeBuffer:()=>unescapeBuffer}),Wu,Gu,Ku,qu,Ju,Yu=__esmMin(()=>{zu(),Bu(),Vu(),Hu(),Wu=parse,Gu=stringify,Ku=qsEscape,qu=qsUnescape,Ju={parse,stringify,decode:Wu,encode:Gu,unescape:qu,escape:Ku,unescapeBuffer}}),Xu=__commonJSMin((e=>{
|
|
219
219
|
/*!
|
|
220
220
|
* express
|
|
221
221
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
222
222
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
223
223
|
* MIT Licensed
|
|
224
224
|
*/
|
|
225
|
-
var{METHODS:t}=(Ou(),__toCommonJS(wu)),n=ms(),r=ku(),i=ds(),a=Mu(),o=ul(),s=(
|
|
225
|
+
var{METHODS:t}=(Ou(),__toCommonJS(wu)),n=ms(),r=ku(),i=ds(),a=Mu(),o=ul(),s=(Yu(),__toCommonJS(Uu));let{Buffer:c}=(J(),__toCommonJS(Yt));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var a=e.indexOf(`=`,r);if(a===-1)break;var n=e.indexOf(`;`,r),o=n===-1?t:n;if(a>o){r=e.lastIndexOf(`;`,a-1)+1;continue}var s=e.slice(r,a).trim(),c=e.slice(a+1,o).trim();s===`q`?i.quality=parseFloat(c):i.params[s]=c,r=o+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=s.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),a.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(c.isBuffer(t)?t:c.from(t,n),e)}}function parseExtendedQueryString(e){return o.parse(e,{allowPrototypes:!0})}})),Zu=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Qu=__commonJSMin(((e,t)=>{var n=Zu();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),$u=__exportAll$4({default:()=>isPromise});function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}var ed=__esmMin(()=>{}),td=__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,a=[...e],o=0;function consumeUntil(r){let s=[],c=``;function writePath(){c&&=(s.push({type:`text`,value:i(c)}),``)}for(;o<a.length;){let i=a[o++];if(i===r)return writePath(),s;if(i===`\\`){if(o===a.length)throw new PathError(`Unexpected end after \\ at index ${o}`,e);c+=a[o++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,c=``;if(t.test(a[o]))do c+=a[o++];while(n.test(a[o]));else if(a[o]===`"`){let t=o;for(;o<a.length;){if(a[++o]===`"`){o++,t=0;break}a[o]===`\\`&&o++,c+=a[o]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!c)throw new PathError(`Missing parameter name at index ${o}`,e);writePath(),s.push({type:r,name:c});continue}if(i===`{`){writePath(),s.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${o-1}`,e);c+=i}if(r)throw new PathError(`Unexpected end at index ${o}, expected ${r}`,e);return writePath(),s}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let a=n[e.name];if(a==null)return i.push(e.name),``;if(!Array.isArray(a)||a.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let o=``;for(let n=0;n<a.length;n++){if(typeof a[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(o+=t),o+=r(a[n])}return o}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:a}=pathToRegexp(e,t),o=a.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=a[e-1],i=o[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:a=!0}=t,o=[],s=``,c=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(c>=256)throw new PathError(`Too many path combinations`,r.originalPath);c>0&&(s+=`|`),s+=toRegExpSource(e,n,o,r.originalPath),c++})}process(e);let l=`^(?:${s})`;return a&&(l+=`(?:`+escape(n)+`$)?`),l+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(l,i?``:`i`),keys:o}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let a=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=a;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,a=``,o=``,s=0,c=0,l=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;l<e.length;){let u=e[l++];if(u.type===`text`){i+=escape(u.value),a+=u.value,s===2&&(o+=u.value),u.value.includes(t)&&(c=0);continue}if(u.type===`param`||u.type===`wildcard`){if(s&&!a)throw new PathError(`Missing text before "${u.name}" ${u.type}`,r);u.type===`param`?(i+=c&2?`(${negate(t,a)}+)`:hasInSegment(l,`wildcard`)?`(${negate(t,peekText(l))}+)`:c&1?`(${negate(t,a)}+|${escape(a)})`:`(${negate(t,``)}+)`,c|=s=1):(i+=c&2?`(${negate(a,``)}+)`:o?`(${negate(o,``)}+|${negate(t,``)}+)`:`([^]+)`,o=``,c|=s=2),n.push(u),a=``;continue}throw TypeError(`Unknown token type: ${u.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),nd=__commonJSMin(((e,t)=>{
|
|
226
226
|
/*!
|
|
227
227
|
* router
|
|
228
228
|
* Copyright(c) 2013 Roman Shtylman
|
|
229
229
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
230
230
|
* MIT Licensed
|
|
231
231
|
*/
|
|
232
|
-
let n=(
|
|
232
|
+
let n=(ed(),__toCommonJS($u)),r=td(),i=po()(`router:layer`),a=mo()(`router`),o=/\/+$/,s=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let a=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&a.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=s.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,a=decodeParam(r[e]);a!==void 0&&(i[n]=a)}return{params:i,path:r[0]}}}return r.match(a.strict?e:loosen(e),{sensitive:a.sensitive,end:a.end,trailing:!a.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let o=this.handle;if(o.length!==4)return i(e);try{let s=o(e,t,r,i);n(s)&&(s instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let o=i(e,t,r);n(o)&&(o instanceof Promise||a(`handlers that are Promise-like are deprecated, use a native Promise instead`),o.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(o,``)}})),rd=__commonJSMin(((e,t)=>{
|
|
233
233
|
/*!
|
|
234
234
|
* router
|
|
235
235
|
* Copyright(c) 2013 Roman Shtylman
|
|
236
236
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
237
237
|
* MIT Licensed
|
|
238
238
|
*/
|
|
239
|
-
let n=po()(`router:route`),r=
|
|
239
|
+
let n=po()(`router:route`),r=nd(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=Array.prototype.slice,o=Array.prototype.flat,s=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,a=0;if(i.length===0)return n();let o=typeof e.method==`string`?e.method.toLowerCase():e.method;o===`head`&&!this.methods.head&&(o=`get`),e.route=this,next();function next(s){if(s&&s===`route`)return n();if(s&&s===`router`||r>=i.length)return n(s);if(++a>100)return setImmediate(next,s);let c,l;for(;l!==!0&&r<i.length;)c=i[r++],l=!c.method||c.method===o;if(l!==!0)return n(s);s?c.handleError(s,e,t,next):c.handleRequest(e,t,next),a=0}},Route.prototype.all=function all(e){let t=o.call(a.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},s.forEach(function(e){Route.prototype[e]=function(t){let i=o.call(a.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let a=i[t];if(typeof a!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let o=r(`/`,{},a);o.method=e,this.methods[e]=!0,this.stack.push(o)}return this}})})),id=__commonJSMin(((e,t)=>{
|
|
240
240
|
/*!
|
|
241
241
|
* router
|
|
242
242
|
* Copyright(c) 2013 Roman Shtylman
|
|
243
243
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
244
244
|
* MIT Licensed
|
|
245
245
|
*/
|
|
246
|
-
let n=(
|
|
246
|
+
let n=(ed(),__toCommonJS($u)),r=nd(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=_l(),o=rd(),s=po()(`router`),c=mo()(`router`),l=Array.prototype.slice,u=Array.prototype.flat,d=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=o;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);s(`dispatching %s %s`,e.method,e.url);let r=0,i,a=getProtohost(e.url)||``,o=``,c=this,l=!1,u=0,d={},p=this.stack,m=e.params,h=e.baseUrl||``,g=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],g=wrap(g,generateOptionsResponder(t,i))),e.baseUrl=h,e.originalUrl=e.originalUrl||e.url,next();function next(n){let s=n===`route`?null:n;if(l&&=(e.url=e.url.slice(1),!1),o.length!==0&&(e.baseUrl=h,e.url=a+o+e.url.slice(a.length),o=``),s===`router`){setImmediate(g,null);return}if(r>=p.length){setImmediate(g,s);return}if(++u>100)return setImmediate(next,n);let _=getPathname(e);if(_==null)return g(s);let v,y,b;for(;y!==!0&&r<p.length;){if(v=p[r++],y=matchLayer(v,_),b=v.route,typeof y!=`boolean`&&(s||=y),y!==!0||!b)continue;if(s){y=!1;continue}let t=e.method,n=b._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,b._methods()),!n&&t!==`HEAD`&&(y=!1)}if(y!==!0)return g(s);b&&(e.route=b),e.params=c.mergeParams?mergeParams(v.params,m):v.params;let x=v.path;processParams(c.params,v,d,e,t,function(n){n?next(s||n):b?v.handleRequest(e,t,next):trimPrefix(v,s,x,_),u=0})}function trimPrefix(n,r,i,c){if(i.length!==0){if(i!==c.substring(0,i.length)){next(r);return}let t=c[i.length];if(t&&t!==`/`){next(r);return}s(`trim prefix (%s) from url %s`,i,e.url),o=i,e.url=a+e.url.slice(a.length+o.length),!a&&e.url[0]!==`/`&&(e.url=`/`+e.url,l=!0),e.baseUrl=h+(o[o.length-1]===`/`?o.substring(0,o.length-1):o)}s(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=u.call(l.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);s(`use %o %s`,n,t.name||`<anonymous>`);let a=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);a.route=void 0,this.stack.push(a)}return this},Router.prototype.route=function route(e){let t=new o(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},d.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,l.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return a(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,a,o){let s=t.keys;if(!s||s.length===0)return o();let l=0,u=0,d,p,m,h;function param(t){if(t)return o(t);if(l>=s.length)return o();if(u=0,d=s[l++],p=i.params[d],m=e[d],h=r[d],p===void 0||!m)return param();if(h&&(h.match===p||h.error&&h.error!==`route`))return i.params[d]=h.value,param(h.error);r[d]=h={error:null,match:p,value:p},paramCallback()}function paramCallback(e){let t=m[u++];if(h.value=i.params[d],e){h.error=e,param(e);return}if(!t)return param();try{let e=t(i,a,paramCallback,p,d);n(e)&&(e instanceof Promise||c(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),ad=__commonJSMin(((e,t)=>{
|
|
247
247
|
/*!
|
|
248
248
|
* express
|
|
249
249
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
@@ -251,7 +251,7 @@ let n=(Yu(),__toCommonJS(Ju)),r=Zu(),{METHODS:i}=(Ou(),__toCommonJS(wu)),a=_l(),
|
|
|
251
251
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
252
252
|
* MIT Licensed
|
|
253
253
|
*/
|
|
254
|
-
me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o=Gu().methods,s=Gu().compileETag,c=Gu().compileQueryParser,l=Gu().compileTrust,u=(lo(),__toCommonJS(Ja)).resolve,d=qu(),p=$u(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&I.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),td=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),nd=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),rd=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),id=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),ad=__commonJSMin(((e,t)=>{
|
|
254
|
+
me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o=Xu().methods,s=Xu().compileETag,c=Xu().compileQueryParser,l=Xu().compileTrust,u=(lo(),__toCommonJS(Ja)).resolve,d=Qu(),p=id(),m=Array.prototype.slice,h=Array.prototype.flat,g=e=t.exports={},_=`@@symbol:trust_proxy_default`;g.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new p({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},g.defaultConfiguration=function defaultConfiguration(){var e=process.env.NODE_ENV||`development`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,_,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[_]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,u(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},g.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},g.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var a=h.call(m.call(arguments,t),1/0);if(a.length===0)throw TypeError(`app.use() requires a middleware function`);var o=this.router;return a.forEach(function(e){if(!e||!e.handle||!e.set)return o.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,o.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},g.route=function route(e){return this.router.route(e)},g.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},g.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},g.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,s(t));break;case`query parser`:this.set(`query parser fn`,c(t));break;case`trust proxy`:this.set(`trust proxy fn`,l(t)),Object.defineProperty(this.settings,_,{configurable:!0,value:!1});break}return this},g.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},g.enabled=function enabled(e){return!!this.set(e)},g.disabled=function disabled(e){return!this.set(e)},g.enable=function enable(e){return this.set(e,!0)},g.disable=function disable(e){return this.set(e,!1)},o.forEach(function(e){g[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,m.call(arguments,1)),this}}),g.all=function all(e){for(var t=this.route(e),n=m.call(arguments,1),r=0;r<o.length;r++)t[o[r]].apply(t,n);return this},g.render=function render(e,t,n){var r=this.cache,i=n,a=this.engines,o=t,s;typeof t==`function`&&(i=t,o={});var c={...this.locals,...o._locals,...o};if(c.cache??=this.enabled(`view cache`),c.cache&&(s=r[e]),!s){if(s=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:a}),!s.path){var l=Array.isArray(s.root)&&s.root.length>1?`directories "`+s.root.slice(0,-1).join(`", "`)+`" or "`+s.root[s.root.length-1]+`"`:`directory "`+s.root+`"`,u=Error(`Failed to lookup view "`+e+`" in views `+l);return u.view=s,i(u)}c.cache&&(r[e]=s)}tryRender(s,c,i)},g.listen=function listen(){var e=a.createServer(this),t=m.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=d(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&I.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),od=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{charset:i,q:a,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),sd=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,a=0;i<t.length;i++){var o=parseEncoding(t[i].trim(),i);o&&(t[a++]=o,n||=specify(`identity`,o),r=Math.min(r,o.q||1))}return n||(t[a++]={encoding:`identity`,q:r,i}),t.length=a,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=1;if(r[2])for(var o=r[2].split(`;`),s=0;s<o.length;s++){var c=o[s].trim().split(`=`);if(c[0]===`q`){a=parseFloat(c[1]);break}}return{encoding:i,q:a,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var a=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return a.filter(isQuality).sort(i).map(function getEncoding(e){return t[a.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),cd=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],a=r[2],o=i;a&&(o+=`-`+a);var s=1;if(r[3])for(var c=r[3].split(`;`),l=0;l<c.length;l++){var u=c[l].split(`=`);u[0]===`q`&&(s=parseFloat(u[1]))}return{prefix:i,suffix:a,q:s,i:t,full:o}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),ld=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),a=1,o=r[2],s=r[1];if(r[3])for(var c=splitParameters(r[3]).map(splitKeyValuePair),l=0;l<c.length;l++){var u=c[l],d=u[0].toLowerCase(),p=u[1],m=p&&p[0]===`"`&&p[p.length-1]===`"`?p.slice(1,-1):p;if(d===`q`){a=parseFloat(m);break}i[d]=m}return{type:s,subtype:o,params:i,q:a,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var a=specify(e,t[i],n);a&&(r.s-a.s||r.q-a.q||r.o-a.o)<0&&(r=a)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var a=Object.keys(t.params);if(a.length>0)if(a.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),ud=__commonJSMin(((e,t)=>{
|
|
255
255
|
/*!
|
|
256
256
|
* negotiator
|
|
257
257
|
* Copyright(c) 2012 Federico Romero
|
|
@@ -259,28 +259,28 @@ me();var n=vl(),r=po()(`express:application`),i=su(),a=(Ou(),__toCommonJS(wu)),o
|
|
|
259
259
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
260
260
|
* MIT Licensed
|
|
261
261
|
*/
|
|
262
|
-
var n=
|
|
262
|
+
var n=od(),r=sd(),i=cd(),a=ld();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return a(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),dd=__commonJSMin(((e,t)=>{
|
|
263
263
|
/*!
|
|
264
264
|
* accepts
|
|
265
265
|
* Copyright(c) 2014 Jonathan Ong
|
|
266
266
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
267
267
|
* MIT Licensed
|
|
268
268
|
*/
|
|
269
|
-
var n=
|
|
269
|
+
var n=ud(),r=ds();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),fd,Server,pd=__esmMin(()=>{pu(),P(),L(),yn(),fd=new Set,Server=class extends Y{listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let a=e[0];t=a.port??0,n=a.host??`0.0.0.0`,r=a.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{this._service=new N.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,fd.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({}),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t)}),this.emit(`connection`,t)}address(){return this._address}close(e){if(e&&this.once(`close`,e),!this._service||!this.listening)return setTimeout(()=>{let e=Error(`Server is not running`);e.code=`ERR_SERVER_NOT_RUNNING`,this.emit(`error`,e)},0),this;this._service.stop(),this._service.close(),this._service=null,this.listening=!1,fd.delete(this);for(let e of this._connections)e.destroy();return this._connections.clear(),deferEmit(this,`close`),this}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),md=__exportAll$4({Server:()=>Server,Socket:()=>Socket,connect:()=>hd,createConnection:()=>createConnection,createServer:()=>createServer,default:()=>gd,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.split(`%`)[0]:e,n=N.InetAddress.new_from_string(t);if(!n)return 0;switch(n.get_family()){case N.SocketFamily.INVALID:return 0;case N.SocketFamily.IPV4:return 4;case N.SocketFamily.IPV6:return 6}}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer(e,t){return typeof e==`function`?new Server(e):new Server(e,t)}var hd,gd,_d=__esmMin(()=>{pu(),pd(),P(),hd=createConnection,gd={Socket,Server,isIP,isIPv4,isIPv6,createConnection,connect:hd,createServer}}),vd=__commonJSMin(((e,t)=>{
|
|
270
270
|
/*!
|
|
271
271
|
* fresh
|
|
272
272
|
* Copyright(c) 2012 TJ Holowaychuk
|
|
273
273
|
* Copyright(c) 2016-2017 Douglas Christopher Wilson
|
|
274
274
|
* MIT Licensed
|
|
275
275
|
*/
|
|
276
|
-
var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),
|
|
276
|
+
var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var a=e[`cache-control`];if(a&&n.test(a))return!1;if(i){if(i===`*`)return!0;var o=t.etag;if(!o)return!1;for(var s=parseTokenList(i),c=0;c<s.length;c++){var l=s[c];if(l===o||l===`W/`+o||`W/`+l===o)return!0}return!1}if(r){var u=t[`last-modified`];if(!u||!(parseHttpDate(u)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),yd=__commonJSMin(((e,t)=>{
|
|
277
277
|
/*!
|
|
278
278
|
* range-parser
|
|
279
279
|
* Copyright(c) 2012-2014 TJ Holowaychuk
|
|
280
280
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
|
281
281
|
* MIT Licensed
|
|
282
282
|
*/
|
|
283
|
-
t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),
|
|
283
|
+
t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),a=[];a.type=t.slice(0,r);for(var o=0;o<i.length;o++){var s=i[o].split(`-`),c=parseInt(s[0],10),l=parseInt(s[1],10);isNaN(c)?(c=e-l,l=e-1):isNaN(l)&&(l=e-1),l>e-1&&(l=e-1),!(isNaN(c)||isNaN(l)||c>l||c<0)&&a.push({start:c,end:l})}return a.length<1?-1:n&&n.combine?combineRanges(a):a}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],a=t[n];i.start>a.end+1?t[++n]=i:i.end>a.end&&(a.end=i.end,a.index=Math.min(a.index,i.index))}t.length=n+1;var o=t.sort(sortByRangeIndex).map(mapWithoutIndex);return o.type=e.type,o}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),bd=__commonJSMin(((e,t)=>{
|
|
284
284
|
/*!
|
|
285
285
|
* express
|
|
286
286
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
@@ -288,27 +288,27 @@ t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw Ty
|
|
|
288
288
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
289
289
|
* MIT Licensed
|
|
290
290
|
*/
|
|
291
|
-
var n=
|
|
291
|
+
var n=dd(),r=(_d(),__toCommonJS(md)).isIP,i=ps(),a=(Ou(),__toCommonJS(wu)),o=vd(),s=yd(),c=_l(),l=Mu(),u=Object.create(a.IncomingMessage.prototype);t.exports=u,u.get=u.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},u.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},u.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},u.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},u.acceptsLanguages=function(...e){return n(this).languages(...e)},u.range=function range(e,t){var n=this.get(`Range`);if(n)return s(e,n,t)},defineGetter(u,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=c(this).query;return e(t)}),u.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(u,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(u,`secure`,function secure(){return this.protocol===`https`}),defineGetter(u,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return l(this,e)}),defineGetter(u,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=l.all(this,e);return t.reverse().pop(),t}),defineGetter(u,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(u,`path`,function path(){return c(this).pathname}),defineGetter(u,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(u,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(u,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?o(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(u,`stale`,function stale(){return!this.fresh}),defineGetter(u,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),xd=__commonJSMin(((e,t)=>{
|
|
292
292
|
/*!
|
|
293
293
|
* content-disposition
|
|
294
294
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
295
295
|
* MIT Licensed
|
|
296
296
|
*/
|
|
297
|
-
t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),
|
|
297
|
+
t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,a=/\\([\u0000-\u007f])/g,o=/([\\"])/g,s=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,c=/^[\x20-\x7e\x80-\xff]+$/,l=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,u=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,d=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),a=c.test(r),o=typeof t==`string`?basename(t):t&&getlatin1(r),s=typeof o==`string`&&o!==r;return(s||!a||hasHexEscape(r))&&(n[`filename*`]=r),(a||s)&&(n.filename=s?o:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!l.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,a=Object.keys(t).sort(),o=0;o<a.length;o++){i=a[o];var s=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+s}return r}function decodefield(e){let t=u.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=d.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,o=[],c={},l;for(n=s.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=s.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),l=t[2],o.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(o.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),l=decodefield(l),c[i]=l;continue}typeof c[i]!=`string`&&(l[0]===`"`&&(l=l.slice(1,-1).replace(a,`$1`)),c[i]=l)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,c)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(o,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),Sd=__commonJSMin((e=>{var t=(ma(),__toCommonJS(fa));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),a=e.sign(i,r),o=Buffer.from(a),s=Buffer.from(n);return o.length===s.length&&t.timingSafeEqual(o,s)?i:!1}})),Cd=__commonJSMin((e=>{
|
|
298
298
|
/*!
|
|
299
299
|
* cookie
|
|
300
300
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
301
301
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
302
302
|
* MIT Licensed
|
|
303
303
|
*/
|
|
304
|
-
e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),
|
|
304
|
+
e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,o=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var a=t&&t.decode||decode,o=0,s=0,c=0;do{if(s=e.indexOf(`=`,o),s===-1)break;if(c=e.indexOf(`;`,o),c===-1)c=i;else if(s>c){o=e.lastIndexOf(`;`,s-1)+1;continue}var l=startIndex(e,o,s),u=endIndex(e,s,l),d=e.slice(l,u);if(!n.call(r,d)){var p=startIndex(e,s+1,c),m=endIndex(e,c,p);e.charCodeAt(p)===34&&e.charCodeAt(m-1)===34&&(p++,m--),r[d]=tryDecode(e.slice(p,m),a)}o=c+1}while(o<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var s=n&&n.encode||encodeURIComponent;if(typeof s!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var c=s(t);if(!i.test(c))throw TypeError(`argument val is invalid`);var l=e+`=`+c;if(!n)return l;if(n.maxAge!=null){var u=Math.floor(n.maxAge);if(!isFinite(u))throw TypeError(`option maxAge is invalid`);l+=`; Max-Age=`+u}if(n.domain){if(!a.test(n.domain))throw TypeError(`option domain is invalid`);l+=`; Domain=`+n.domain}if(n.path){if(!o.test(n.path))throw TypeError(`option path is invalid`);l+=`; Path=`+n.path}if(n.expires){var d=n.expires;if(!isDate(d)||isNaN(d.valueOf()))throw TypeError(`option expires is invalid`);l+=`; Expires=`+d.toUTCString()}if(n.httpOnly&&(l+=`; HttpOnly`),n.secure&&(l+=`; Secure`),n.partitioned&&(l+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:l+=`; Priority=Low`;break;case`medium`:l+=`; Priority=Medium`;break;case`high`:l+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:l+=`; SameSite=Strict`;break;case`lax`:l+=`; SameSite=Lax`;break;case`strict`:l+=`; SameSite=Strict`;break;case`none`:l+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return l}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),wd=__commonJSMin(((e,t)=>{
|
|
305
305
|
/*!
|
|
306
306
|
* send
|
|
307
307
|
* Copyright(c) 2012 TJ Holowaychuk
|
|
308
308
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
309
309
|
* MIT Licensed
|
|
310
310
|
*/
|
|
311
|
-
var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=
|
|
311
|
+
var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=vd(),c=(ou(),__toCommonJS(ru)),l=ds(),u=uo(),d=os(),p=yd(),m=(lo(),__toCommonJS(Ja)),h=_o(),g=Jo(),_=(ic(),__toCommonJS(ec)),v=m.extname,y=m.join,b=m.normalize,x=m.resolve,S=m.sep,w=/^ *bytes=/,T=3600*24*365*1e3,E=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){g.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?u(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),T),this._root=r.root?x(r.root):null}_.inherits(SendStream,g),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,a(h.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var a=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(a)||a>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return s(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+a(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=b(`.`+S+n),E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(S),n=b(y(t,n))}else{if(E.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=b(n).split(S),n=x(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,a={},o=this.res,s=this.req,c=s.headers.range,l=i.start||0;if(o.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-l),i.end!==void 0){var u=i.end-l+1;n>u&&(n=u)}if(this._acceptRanges&&w.test(c)){if(c=p(n,c,{combine:!0}),this.isRangeFresh()||(r(`range stale`),c=-2),c===-1)return r(`range unsatisfiable`),o.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":o.getHeader(`Content-Range`)}});c!==-2&&c.length===1&&(r(`range %j`,c),o.statusCode=206,o.setHeader(`Content-Range`,contentRange(`bytes`,n,c[0])),l+=c[0].start,n=c[0].end-c[0].start+1)}for(var d in i)a[d]=i[d];if(a.start=l,a.end=Math.max(l,l+n-1),o.setHeader(`Content-Length`,n),s.method===`HEAD`){o.end();return}this.stream(e,a)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),c.stat(e,function onstat(t,r){var i=e[e.length-1]===S;if(t&&t.code===`ENOENT`&&!v(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var a=e+`.`+n._extensions[t++];r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var a=y(e,n._index[t]);r(`stat "%s"`,a),c.stat(a,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,a,t),n.send(a,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=c.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}d(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=v(e),i=l.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var a=t.mtime.toUTCString();r(`modified %s`,a),n.setHeader(`Last-Modified`,a)}if(this._etag&&!n.getHeader(`ETag`)){var s=o(t);r(`etag %s`,s),n.setHeader(`ETag`,s)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
|
|
312
312
|
<html lang="en">
|
|
313
313
|
<head>
|
|
314
314
|
<meta charset="utf-8">
|
|
@@ -318,20 +318,20 @@ var n=bo(),r=po()(`send`),i=hl(),a=gl(),o=ku(),s=pd(),c=(ou(),__toCommonJS(ru)),
|
|
|
318
318
|
<pre>`+t+`</pre>
|
|
319
319
|
</body>
|
|
320
320
|
</html>
|
|
321
|
-
`}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),
|
|
321
|
+
`}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),Td=__commonJSMin(((e,t)=>{
|
|
322
322
|
/*!
|
|
323
323
|
* vary
|
|
324
324
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
325
325
|
* MIT Licensed
|
|
326
326
|
*/
|
|
327
|
-
t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var a=e,o=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||o.indexOf(`*`)!==-1)return`*`;for(var s=0;s<r.length;s++){var c=r[s].toLowerCase();o.indexOf(c)===-1&&(o.push(c),a=a?a+`, `+r[s]:r[s])}return a}function parse(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),
|
|
327
|
+
t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var a=e,o=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||o.indexOf(`*`)!==-1)return`*`;for(var s=0;s<r.length;s++){var c=r[s].toLowerCase();o.indexOf(c)===-1&&(o.push(c),a=a?a+`, `+r[s]:r[s])}return a}function parse(e){for(var t=0,n=[],r=0,i=0,a=e.length;i<a;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),Ed=__commonJSMin(((e,t)=>{
|
|
328
328
|
/*!
|
|
329
329
|
* express
|
|
330
330
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
331
331
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
332
332
|
* MIT Licensed
|
|
333
333
|
*/
|
|
334
|
-
var n=
|
|
334
|
+
var n=xd(),r=bo(),i=mo()(`express`),a=hl(),o=gl(),s=(Ou(),__toCommonJS(wu)),c=os(),l=ds(),u=(lo(),__toCommonJS(Ja)),d=(lo(),__toCommonJS(Ja)).isAbsolute,p=_o(),m=Sd().sign,h=Xu().normalizeType,g=Xu().normalizeTypes,_=Xu().setCharset,v=Cd(),y=wd(),b=u.extname,x=u.resolve,S=Td();let{Buffer:w}=(J(),__toCommonJS(Yt));var T=Object.create(s.ServerResponse.prototype);t.exports=T,T.status=function status(e){if(!Number.isInteger(e))throw TypeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be an integer.`);if(e<100||e>999)throw RangeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be greater than 99 and less than 1000.`);return this.statusCode=e,this},T.links=function(e){var t=this.get(`Link`)||``;return t&&(t+=`, `),this.set(`Link`,t+Object.keys(e).map(function(t){return Array.isArray(e[t])?e[t].map(function(e){return`<${e}>; rel="${t}"`}).join(`, `):`<${e[t]}>; rel="${t}"`}).join(`, `))},T.send=function send(e){var t=e,n,r=this.req,i,a=this.app;switch(typeof t){case`string`:this.get(`Content-Type`)||this.type(`html`);break;case`boolean`:case`number`:case`object`:if(t===null)t=``;else if(ArrayBuffer.isView(t))this.get(`Content-Type`)||this.type(`bin`);else return this.json(t);break}typeof t==`string`&&(n=`utf8`,i=this.get(`Content-Type`),typeof i==`string`&&this.set(`Content-Type`,_(i,`utf-8`)));var o=a.get(`etag fn`),s=!this.get(`ETag`)&&typeof o==`function`,c;t!==void 0&&(w.isBuffer(t)?c=t.length:!s&&t.length<1e3?c=w.byteLength(t,n):(t=w.from(t,n),n=void 0,c=t.length),this.set(`Content-Length`,c));var l;return s&&c!==void 0&&(l=o(t,n))&&this.set(`ETag`,l),r.fresh&&this.status(304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader(`Content-Type`),this.removeHeader(`Content-Length`),this.removeHeader(`Transfer-Encoding`),t=``),this.statusCode===205&&(this.set(`Content-Length`,`0`),this.removeHeader(`Transfer-Encoding`),t=``),r.method===`HEAD`?this.end():this.end(t,n),this},T.json=function json(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n);return this.get(`Content-Type`)||this.set(`Content-Type`,`application/json`),this.send(r)},T.jsonp=function jsonp(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n),i=this.req.query[t.get(`jsonp callback name`)];return this.get(`Content-Type`)||(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`application/json`)),Array.isArray(i)&&(i=i[0]),typeof i==`string`&&i.length!==0&&(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`text/javascript`),i=i.replace(/[^\[\]\w$.]/g,``),r===void 0?r=``:typeof r==`string`&&(r=r.replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)),r=`/**/ typeof `+i+` === 'function' && `+i+`(`+r+`);`),this.send(r)},T.sendStatus=function sendStatus(e){var t=p.message[e]||String(e);return this.status(e),this.type(`txt`),this.send(t)},T.sendFile=function sendFile(e,t,n){var r=n,i=this.req,a=this,o=i.next,s=t||{};if(!e)throw TypeError(`path argument is required to res.sendFile`);if(typeof e!=`string`)throw TypeError(`path must be a string to res.sendFile`);if(typeof t==`function`&&(r=t,s={}),!s.root&&!d(e))throw TypeError(`path must be absolute or specify root to res.sendFile`);var c=encodeURI(e);s.etag=this.app.enabled(`etag`),sendfile(a,y(i,c,s),s,function(e){if(r)return r(e);if(e&&e.code===`EISDIR`)return o();e&&e.code!==`ECONNABORTED`&&e.syscall!==`write`&&o(e)})},T.download=function download(e,t,r,i){var a=i,o=t,s=r||null;typeof t==`function`?(a=t,o=null,s=null):typeof r==`function`&&(a=r,s=null),typeof t==`object`&&(typeof r==`function`||r===void 0)&&(o=null,s=t);var c={"Content-Disposition":n(o||e)};if(s&&s.headers)for(var l=Object.keys(s.headers),u=0;u<l.length;u++){var d=l[u];d.toLowerCase()!==`content-disposition`&&(c[d]=s.headers[d])}s=Object.create(s),s.headers=c;var p=s.root?e:x(e);return this.sendFile(p,s,a)},T.contentType=T.type=function contentType(e){var t=e.indexOf(`/`)===-1?l.contentType(e)||`application/octet-stream`:e;return this.set(`Content-Type`,t)},T.format=function(e){var t=this.req,n=t.next,i=Object.keys(e).filter(function(e){return e!=="default"}),a=i.length>0?t.accepts(i):!1;return this.vary(`Accept`),a?(this.set(`Content-Type`,h(a).value),e[a](t,this,n)):e.default?e.default(t,this,n):n(r(406,{types:g(i).map(function(e){return e.value})})),this},T.attachment=function attachment(e){return e&&this.type(b(e)),this.set(`Content-Disposition`,n(e)),this},T.append=function append(e,t){var n=this.get(e),r=t;return n&&(r=Array.isArray(n)?n.concat(t):Array.isArray(t)?[n].concat(t):[n,t]),this.set(e,r)},T.set=T.header=function header(e,t){if(arguments.length===2){var n=Array.isArray(t)?t.map(String):String(t);if(e.toLowerCase()===`content-type`){if(Array.isArray(n))throw TypeError(`Content-Type cannot be set to an Array`);n=l.contentType(n)}this.setHeader(e,n)}else for(var r in e)this.set(r,e[r]);return this},T.get=function(e){return this.getHeader(e)},T.clearCookie=function clearCookie(e,t){let n={path:`/`,...t,expires:new Date(1)};return delete n.maxAge,this.cookie(e,``,n)},T.cookie=function(e,t,n){var r={...n},i=this.req.secret,a=r.signed;if(a&&!i)throw Error(`cookieParser("secret") required for signed cookies`);var o=typeof t==`object`?`j:`+JSON.stringify(t):String(t);if(a&&(o=`s:`+m(o,i)),r.maxAge!=null){var s=r.maxAge-0;isNaN(s)||(r.expires=new Date(Date.now()+s),r.maxAge=Math.floor(s/1e3))}return r.path??=`/`,this.append(`Set-Cookie`,v.serialize(e,String(o),r)),this},T.location=function location(e){return this.set(`Location`,a(e))},T.redirect=function redirect(e){var t=e,n,r=302;arguments.length===2&&(r=arguments[0],t=arguments[1]),t||i(`Provide a url argument`),typeof t!=`string`&&i(`Url must be a string`),typeof r!=`number`&&i(`Status must be a number`),t=this.location(t).get(`Location`),this.format({text:function(){n=p.message[r]+`. Redirecting to `+t},html:function(){var e=o(t);n=`<p>`+p.message[r]+`. Redirecting to `+e+`</p>`},default:function(){n=``}}),this.status(r),this.set(`Content-Length`,w.byteLength(n)),this.req.method===`HEAD`?this.end():this.end(n)},T.vary=function(e){return S(this,e),this},T.render=function render(e,t,n){var r=this.req.app,done=n,i=t||{},a=this.req,o=this;typeof t==`function`&&(done=t,i={}),i._locals=o.locals,done||=function(e,t){if(e)return a.next(e);o.send(t)},r.render(e,i,done)};function sendfile(e,t,n,r){var i=!1,a;function onaborted(){if(!i){i=!0;var e=Error(`Request aborted`);e.code=`ECONNABORTED`,r(e)}}function ondirectory(){if(!i){i=!0;var e=Error(`EISDIR, read`);e.code=`EISDIR`,r(e)}}function onerror(e){i||(i=!0,r(e))}function onend(){i||(i=!0,r())}function onfile(){a=!1}function onfinish(e){if(e&&e.code===`ECONNRESET`)return onaborted();if(e)return onerror(e);i||setImmediate(function(){if(a!==!1&&!i){onaborted();return}i||(i=!0,r())})}function onstream(){a=!0}t.on(`directory`,ondirectory),t.on(`end`,onend),t.on(`error`,onerror),t.on(`file`,onfile),t.on(`stream`,onstream),c(e,onfinish),n.headers&&t.on(`headers`,function headers(e){for(var t=n.headers,r=Object.keys(t),i=0;i<r.length;i++){var a=r[i];e.setHeader(a,t[a])}}),t.pipe(e)}function stringify(e,t,n,r){var i=t||n?JSON.stringify(e,t,n):JSON.stringify(e);return r&&typeof i==`string`&&(i=i.replace(/[<>&]/g,function(e){switch(e.charCodeAt(0)){case 60:return`\\u003c`;case 62:return`\\u003e`;case 38:return`\\u0026`;default:return e}})),i}})),Dd=__commonJSMin(((e,t)=>{
|
|
335
335
|
/*!
|
|
336
336
|
* serve-static
|
|
337
337
|
* Copyright(c) 2010 Sencha Inc.
|
|
@@ -339,7 +339,7 @@ var n=gd(),r=bo(),i=mo()(`express`),a=hl(),o=gl(),s=(Ou(),__toCommonJS(wu)),c=os
|
|
|
339
339
|
* Copyright(c) 2014-2016 Douglas Christopher Wilson
|
|
340
340
|
* MIT Licensed
|
|
341
341
|
*/
|
|
342
|
-
var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=
|
|
342
|
+
var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=wd(),s=(Dn(),__toCommonJS(Cn));t.exports=serveStatic;function serveStatic(e,t){if(!e)throw TypeError(`root path required`);if(typeof e!=`string`)throw TypeError(`root path must be a string`);var n=Object.create(t||null),r=n.fallthrough!==!1,s=n.redirect!==!1,c=n.setHeaders;if(c&&typeof c!=`function`)throw TypeError(`option setHeaders must be function`);n.maxage=n.maxage||n.maxAge||0,n.root=a(e);var l=s?createRedirectDirectoryListener():createNotFoundDirectoryListener();return function serveStatic(e,t,a){if(e.method!==`GET`&&e.method!==`HEAD`){if(r)return a();t.statusCode=405,t.setHeader(`Allow`,`GET, HEAD`),t.setHeader(`Content-Length`,`0`),t.end();return}var s=!r,u=i.original(e),d=i(e).pathname;d===`/`&&u.pathname.substr(-1)!==`/`&&(d=``);var p=o(e,d,n);p.on(`directory`,l),c&&p.on(`headers`,c),r&&p.on(`file`,function onFile(){s=!0}),p.on(`error`,function error(e){if(s||!(e.statusCode<500)){a(e);return}a()}),p.pipe(t)}}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e.charCodeAt(t)===47;t++);return t>1?`/`+e.substr(t):e}function createHtmlDocument(e,t){return`<!DOCTYPE html>
|
|
343
343
|
<html lang="en">
|
|
344
344
|
<head>
|
|
345
345
|
<meta charset="utf-8">
|
|
@@ -349,7 +349,7 @@ var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=yd(),s=(Dn(),__toCo
|
|
|
349
349
|
<pre>`+t+`</pre>
|
|
350
350
|
</body>
|
|
351
351
|
</html>
|
|
352
|
-
`}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var a=n(s.format(t)),o=createHtmlDocument(`Redirecting`,`Redirecting to `+r(a));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(o)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,a),e.end(o)}}})),
|
|
352
|
+
`}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var a=n(s.format(t)),o=createHtmlDocument(`Redirecting`,`Redirecting to `+r(a));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(o)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,a),e.end(o)}}})),Od=__commonJSMin(((e,t)=>{
|
|
353
353
|
/*!
|
|
354
354
|
* express
|
|
355
355
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
@@ -357,7 +357,7 @@ var n=hl(),r=gl(),i=_l(),a=(lo(),__toCommonJS(Ja)).resolve,o=yd(),s=(Dn(),__toCo
|
|
|
357
357
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
358
358
|
* MIT Licensed
|
|
359
359
|
*/
|
|
360
|
-
var n=fl(),r=pl().EventEmitter,i=ml(),a=
|
|
360
|
+
var n=fl(),r=pl().EventEmitter,i=ml(),a=ad(),o=id(),s=bd(),c=Ed();e=t.exports=createApplication;function createApplication(){var app=function(e,t,n){app.handle(e,t,n)};return i(app,r.prototype,!1),i(app,a,!1),app.request=Object.create(s,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.response=Object.create(c,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.init(),app}e.application=a,e.request=s,e.response=c,e.Route=o.Route,e.Router=o,e.json=n.json,e.raw=n.raw,e.static=Dd(),e.text=n.text,e.urlencoded=n.urlencoded})),kd=__toESM(__commonJSMin(((e,t)=>{
|
|
361
361
|
/*!
|
|
362
362
|
* express
|
|
363
363
|
* Copyright(c) 2009-2013 TJ Holowaychuk
|
|
@@ -365,14 +365,14 @@ var n=fl(),r=pl().EventEmitter,i=ml(),a=ed(),o=$u(),s=hd(),c=xd();e=t.exports=cr
|
|
|
365
365
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
366
366
|
* MIT Licensed
|
|
367
367
|
*/
|
|
368
|
-
t.exports=
|
|
368
|
+
t.exports=Od()}))());const Ad=[{id:1,slug:`hello-gjs`,title:`Hello, GJS!`,author:`Pascal`,date:`2026-04-01`,excerpt:`Running Express.js natively on Linux via GJS — no Node.js required.`,content:"This blog is served by a real Express.js application — the same code you would\nwrite for Node.js. The difference: it's running inside GJS, the GNOME JavaScript\nruntime, backed by GLib, Gio and Soup. No Node binary, no V8 — just SpiderMonkey\nand native Linux libraries.\n\nWith `@gjsify/node-globals` and the `@gjsify/*` package set, the full Node.js\nAPI surface is available: `fs`, `net`, `http`, `crypto`, `stream`, `events`,\nand many more. That means your existing npm ecosystem works out of the box."},{id:2,slug:`why-gjsify`,title:`Why GJSify?`,author:`Pascal`,date:`2026-04-03`,excerpt:`Bringing the full TypeScript ecosystem to the GNOME JavaScript runtime.`,content:`GJS is fantastic for writing GNOME applications, but historically you had to
|
|
369
369
|
choose between the GObject world and the rich npm ecosystem. GJSify bridges
|
|
370
370
|
that gap by implementing the Node.js and Web APIs on top of native GNOME
|
|
371
371
|
libraries — so a package like Express, Koa or Hono Just Works, and you can
|
|
372
372
|
still reach into GTK, Cairo or WebKit whenever you need to.
|
|
373
373
|
|
|
374
374
|
The trade-off is no longer "Node.js or GNOME" — you can have both in the
|
|
375
|
-
same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];me(),lo(),Dn();const
|
|
375
|
+
same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];me(),lo(),Dn();const jd=Qa(to(fileURLToPath(import.meta.url)),`public`),Md=parseInt(process.env.PORT||`3000`,10),Nd=(0,kd.default)();function escapeHtml(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}function renderContent(e){return e.split(/\n\n+/).map(e=>`<p>${escapeHtml(e.trim()).replace(/\n/g,`<br />`)}</p>`).join(`
|
|
376
376
|
`)}function renderPage(e,t){return`<!DOCTYPE html>
|
|
377
377
|
<html lang="en">
|
|
378
378
|
<head>
|
|
@@ -398,7 +398,7 @@ ${t}
|
|
|
398
398
|
</footer>
|
|
399
399
|
<script src="/app.js" defer><\/script>
|
|
400
400
|
</body>
|
|
401
|
-
</html>`}
|
|
401
|
+
</html>`}Nd.use(kd.json()),Nd.use((e,t,n)=>{let r=new Date().toISOString().slice(11,19);I.log(`[${r}] ${e.method} ${e.url}`),n()}),Nd.get(`/api/posts`,(e,t)=>{t.json({count:Ad.length,posts:Ad.map(({id:e,slug:t,title:n,author:r,date:i,excerpt:a})=>({id:e,slug:t,title:n,author:r,date:i,excerpt:a}))})}),Nd.get(`/api/posts/:slug`,(e,t)=>{let n=Ad.find(t=>t.slug===e.params.slug);if(!n){t.status(404).json({error:`Post not found`});return}t.json(n)}),Nd.get(`/api/runtime`,(e,t)=>{t.json({runtime:za,platform:process.platform,version:process.version,time:new Date().toISOString()})}),Nd.get(`/posts/:slug`,(e,t)=>{let n=Ad.find(t=>t.slug===e.params.slug);if(!n){t.status(404).send(renderPage(`Post not found`,`
|
|
402
402
|
<main class="post-detail">
|
|
403
403
|
<a href="/" class="back-link">← Back to posts</a>
|
|
404
404
|
<p class="loading">Post not found.</p>
|
|
@@ -415,4 +415,4 @@ ${t}
|
|
|
415
415
|
${renderContent(n.content)}
|
|
416
416
|
</div>
|
|
417
417
|
</article>
|
|
418
|
-
</main>`))}),
|
|
418
|
+
</main>`))}),Nd.use(kd.static(jd)),Nd.listen(Md,()=>{I.log(``),I.log(` Express.js blog running on ${za}`),I.log(``),I.log(` ➜ Local: http://localhost:${Md}/`),I.log(` ➜ API: http://localhost:${Md}/api/posts`),I.log(``),I.log(` Press Ctrl+C to stop`),I.log(``)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/example-node-express-webserver",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.35",
|
|
4
4
|
"description": "Express.js blog showcase with JSON API and static frontend — a real Node.js web app running on GJS",
|
|
5
5
|
"main": "dist/index.gjs.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"build:public": "mkdir -p dist/public && cp -r src/public/* dist/public/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gjsify/http-soup-bridge": "^0.4.
|
|
24
|
+
"@gjsify/http-soup-bridge": "^0.4.35"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@gjsify/cli": "^0.4.
|
|
28
|
-
"@gjsify/node-globals": "^0.4.
|
|
29
|
-
"@gjsify/runtime": "^0.4.
|
|
27
|
+
"@gjsify/cli": "^0.4.35",
|
|
28
|
+
"@gjsify/node-globals": "^0.4.35",
|
|
29
|
+
"@gjsify/runtime": "^0.4.35",
|
|
30
30
|
"@types/express": "^5.0.6",
|
|
31
31
|
"@types/node": "^25.9.1",
|
|
32
32
|
"express": "^5.2.1",
|