文件操作 - index.js
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/@netlify/serverless-functions-api/dist/index.js
编辑文件内容
import{createRequire}from"module";const require=createRequire(import.meta.url); import{fileURLToPath as sr}from"url";import{Buffer as Jt}from"node:buffer";import Je from"node:process";import{pipeline as Kt,Readable as Xt}from"node:stream";import{promisify as Yt}from"node:util";var ne=e=>({id:e??""});var se="x-nf-client-connection-ip",oe="x-nf-geo",ie="x-nf-account-id",H="x-nf-deploy-id",ae="x-nf-deploy-context",ce="x-nf-deploy-published",ue="x-nf-site-id",he="x-nf-request-flags",z="x-nf-invocation-metadata",fe="x-nf-request-id",Ye=255,le=e=>{let t=new Headers;return Object.entries(e).forEach(([r,n])=>{if(n!==void 0)try{t.set(r.toLowerCase(),n)}catch(o){if([...n].every(i=>i.codePointAt(0)<=Ye))throw o;console.warn(`Discarded request header '${r}' because it contains non-ASCII characters`)}}),t},pe=e=>{let t={};for(let[r,n]of e.entries())r in t?t[r].push(n):t[r]=[n];return t};var me=e=>({context:e.get(ae)??"",id:e.get(H)??"",published:e.get(ce)==="1"});import{Buffer as Qe}from"buffer";var M=Symbol("Request flags"),_=Symbol("Request route"),Ze=typeof Request>"u"?class{}:Request,de,j=class extends(de=Ze,M,_,de){},ge=(e,t)=>{if(!(e==null||e===""))return t?Qe.from(e,"base64"):e};var $=class{#e;#t;constructor(t){this.#e=new Set,this.#t=t}get(t){let r=this.#t[t];return r!==void 0&&this.#e.add(t),r}get evaluations(){return this.#e}},xe=e=>e[M]??new $({}),Se=(e,t)=>{e[M]=t};import{Buffer as et}from"node:buffer";var ye=e=>{if(e===null)return{};try{let{postal_code:t,...r}=JSON.parse(et.from(e,"base64").toString("utf-8"));return Object.fromEntries(Object.entries({...r,postalCode:t}).filter(([,o])=>o!==void 0))}catch{return{}}};var we=e=>e??"";var D=class{constructor(e,t,r,n,o,u){this.type=3,this.name="",this.prefix="",this.value="",this.suffix="",this.modifier=3,this.type=e,this.name=t,this.prefix=r,this.value=n,this.suffix=o,this.modifier=u}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},tt=/[$_\p{ID_Start}]/u,rt=/[$_\u200C\u200D\p{ID_Continue}]/u,K=".*";function nt(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}function Re(e,t=!1){let r=[],n=0;for(;n<e.length;){let o=e[n],u=function(i){if(!t)throw new TypeError(i);r.push({type:"INVALID_CHAR",index:n,value:e[n++]})};if(o==="*"){r.push({type:"ASTERISK",index:n,value:e[n++]});continue}if(o==="+"||o==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});continue}if(o==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(o==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(o==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(o===":"){let i="",s=n+1;for(;s<e.length;){let c=e.substr(s,1);if(s===n+1&&tt.test(c)||s!==n+1&&rt.test(c)){i+=e[s++];continue}break}if(!i){u(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:i}),n=s;continue}if(o==="("){let i=1,s="",c=n+1,a=!1;if(e[c]==="?"){u(`Pattern cannot start with "?" at ${c}`);continue}for(;c<e.length;){if(!nt(e[c],!1)){u(`Invalid character '${e[c]}' at ${c}.`),a=!0;break}if(e[c]==="\\"){s+=e[c++]+e[c++];continue}if(e[c]===")"){if(i--,i===0){c++;break}}else if(e[c]==="("&&(i++,e[c+1]!=="?")){u(`Capturing groups are not allowed at ${c}`),a=!0;break}s+=e[c++]}if(a)continue;if(i){u(`Unbalanced pattern at ${n}`);continue}if(!s){u(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:s}),n=c;continue}r.push({type:"CHAR",index:n,value:e[n++]})}return r.push({type:"END",index:n,value:""}),r}function ke(e,t={}){let r=Re(e);t.delimiter??(t.delimiter="/#?"),t.prefixes??(t.prefixes="./");let n=`[^${y(t.delimiter)}]+?`,o=[],u=0,i=0,s="",c=new Set,a=h=>{if(i<r.length&&r[i].type===h)return r[i++].value},f=()=>a("OTHER_MODIFIER")??a("ASTERISK"),l=h=>{let p=a(h);if(p!==void 0)return p;let{type:d,index:S}=r[i];throw new TypeError(`Unexpected ${d} at ${S}, expected ${h}`)},m=()=>{let h="",p;for(;p=a("CHAR")??a("ESCAPED_CHAR");)h+=p;return h},N=h=>h,E=t.encodePart||N,P="",w=h=>{P+=h},L=()=>{P.length&&(o.push(new D(3,"","",E(P),"",3)),P="")},T=(h,p,d,S,re)=>{let g=3;switch(re){case"?":g=1;break;case"*":g=0;break;case"+":g=2;break}if(!p&&!d&&g===3){w(h);return}if(L(),!p&&!d){if(!h)return;o.push(new D(3,"","",E(h),"",g));return}let x;d?d==="*"?x=K:x=d:x=n;let v=2;x===n?(v=1,x=""):x===K&&(v=0,x="");let b;if(p?b=p:d&&(b=u++),c.has(b))throw new TypeError(`Duplicate name '${b}'.`);c.add(b),o.push(new D(v,b,E(h),x,E(S),g))};for(;i<r.length;){let h=a("CHAR"),p=a("NAME"),d=a("REGEX");if(!p&&!d&&(d=a("ASTERISK")),p||d){let g=h??"";t.prefixes.indexOf(g)===-1&&(w(g),g=""),L();let x=f();T(g,p,d,"",x);continue}let S=h??a("ESCAPED_CHAR");if(S){w(S);continue}if(a("OPEN")){let g=m(),x=a("NAME"),v=a("REGEX");!x&&!v&&(v=a("ASTERISK"));let b=m();l("CLOSE");let Xe=f();T(g,x,v,b,Xe);continue}L(),l("END")}return o}function y(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Ce(e){return e&&e.ignoreCase?"ui":"u"}function st(e,t,r){return ve(ke(e,r),t,r)}function A(e){switch(e){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function ve(e,t,r={}){r.delimiter??(r.delimiter="/#?"),r.prefixes??(r.prefixes="./"),r.sensitive??(r.sensitive=!1),r.strict??(r.strict=!1),r.end??(r.end=!0),r.start??(r.start=!0),r.endsWith="";let n=r.start?"^":"";for(let s of e){if(s.type===3){s.modifier===3?n+=y(s.value):n+=`(?:${y(s.value)})${A(s.modifier)}`;continue}t&&t.push(s.name);let c=`[^${y(r.delimiter)}]+?`,a=s.value;if(s.type===1?a=c:s.type===0&&(a=K),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${a})${A(s.modifier)}`:n+=`((?:${a})${A(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${y(s.prefix)}(${a})${y(s.suffix)})`,n+=A(s.modifier);continue}n+=`(?:${y(s.prefix)}`,n+=`((?:${a})(?:`,n+=y(s.suffix),n+=y(s.prefix),n+=`(?:${a}))*)${y(s.suffix)})`,s.modifier===0&&(n+="?")}let o=`[${y(r.endsWith)}]|$`,u=`[${y(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${u}?`),r.endsWith.length?n+=`(?=${o})`:n+="$",new RegExp(n,Ce(r));r.strict||(n+=`(?:${u}(?=${o}))?`);let i=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(i=r.delimiter.indexOf(s)>-1)}return i||(n+=`(?=${u}|${o})`),new RegExp(n,Ce(r))}var k={delimiter:"",prefixes:"",sensitive:!0,strict:!0},ot={delimiter:".",prefixes:"",sensitive:!0,strict:!0},it={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function at(e,t){return e.length?e[0]==="/"?!0:!t||e.length<2?!1:(e[0]=="\\"||e[0]=="{")&&e[1]=="/":!1}function Ie(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}function ct(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}function Ee(e){return!e||e.length<2?!1:e[0]==="["||(e[0]==="\\"||e[0]==="{")&&e[1]==="["}var Pe=["ftp","file","http","https","ws","wss"];function Le(e){if(!e)return!0;for(let t of Pe)if(e.test(t))return!0;return!1}function ut(e,t){if(e=Ie(e,"#"),t||e==="")return e;let r=new URL("https://example.com");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):""}function ht(e,t){if(e=Ie(e,"?"),t||e==="")return e;let r=new URL("https://example.com");return r.search=e,r.search?r.search.substring(1,r.search.length):""}function ft(e,t){return t||e===""?e:Ee(e)?Ne(e):Ae(e)}function lt(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.password=e,r.password}function pt(e,t){if(t||e==="")return e;let r=new URL("https://example.com");return r.username=e,r.username}function mt(e,t,r){if(r||e==="")return e;if(t&&!Pe.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]=="/";return e=new URL(n?e:"/-"+e,"https://example.com").pathname,n||(e=e.substring(2,e.length)),e}function dt(e,t,r){return _e(t)===e&&(e=""),r||e===""?e:Te(e)}function gt(e,t){return e=ct(e,":"),t||e===""?e:X(e)}function _e(e){switch(e){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function X(e){if(e==="")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}function xt(e){if(e==="")return e;let t=new URL("https://example.com");return t.username=e,t.username}function St(e){if(e==="")return e;let t=new URL("https://example.com");return t.password=e,t.password}function Ae(e){if(e==="")return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL("https://example.com");return t.hostname=e,t.hostname}function Ne(e){if(e==="")return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}function Te(e){if(e===""||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}function yt(e){if(e==="")return e;let t=new URL("https://example.com");return t.pathname=e[0]!=="/"?"/-"+e:e,e[0]!=="/"?t.pathname.substring(2,t.pathname.length):t.pathname}function wt(e){return e===""?e:new URL(`data:${e}`).pathname}function Ct(e){if(e==="")return e;let t=new URL("https://example.com");return t.search=e,t.search.substring(1,t.search.length)}function bt(e){if(e==="")return e;let t=new URL("https://example.com");return t.hash=e,t.hash.substring(1,t.hash.length)}var Rt=class{constructor(e){this.tokenList=[],this.internalResult={},this.tokenIndex=0,this.tokenIncrement=1,this.componentStart=0,this.state=0,this.groupDepth=0,this.hostnameIPv6BracketDepth=0,this.shouldTreatAsStandardURL=!1,this.input=e}get result(){return this.internalResult}parse(){for(this.tokenList=Re(this.input,!0);this.tokenIndex<this.tokenList.length;this.tokenIndex+=this.tokenIncrement){if(this.tokenIncrement=1,this.tokenList[this.tokenIndex].type==="END"){if(this.state===0){this.rewind(),this.isHashPrefix()?this.changeState(9,1):this.isSearchPrefix()?(this.changeState(8,1),this.internalResult.hash=""):(this.changeState(7,0),this.internalResult.search="",this.internalResult.hash="");continue}else if(this.state===2){this.rewindAndSetState(5);continue}this.changeState(10,0);break}if(this.groupDepth>0)if(this.isGroupClose())this.groupDepth-=1;else continue;if(this.isGroupOpen()){this.groupDepth+=1;continue}switch(this.state){case 0:this.isProtocolSuffix()&&(this.internalResult.username="",this.internalResult.password="",this.internalResult.hostname="",this.internalResult.port="",this.internalResult.pathname="",this.internalResult.search="",this.internalResult.hash="",this.rewindAndSetState(1));break;case 1:if(this.isProtocolSuffix()){this.computeShouldTreatAsStandardURL();let e=7,t=1;this.shouldTreatAsStandardURL&&(this.internalResult.pathname="/"),this.nextIsAuthoritySlashes()?(e=2,t=3):this.shouldTreatAsStandardURL&&(e=2),this.changeState(e,t)}break;case 2:this.isIdentityTerminator()?this.rewindAndSetState(3):(this.isPathnameStart()||this.isSearchPrefix()||this.isHashPrefix())&&this.rewindAndSetState(5);break;case 3:this.isPasswordPrefix()?this.changeState(4,1):this.isIdentityTerminator()&&this.changeState(5,1);break;case 4:this.isIdentityTerminator()&&this.changeState(5,1);break;case 5:this.isIPv6Open()?this.hostnameIPv6BracketDepth+=1:this.isIPv6Close()&&(this.hostnameIPv6BracketDepth-=1),this.isPortPrefix()&&!this.hostnameIPv6BracketDepth?this.changeState(6,1):this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 6:this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 7:this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 8:this.isHashPrefix()&&this.changeState(9,1);break;case 9:break;case 10:break}}}changeState(e,t){switch(this.state){case 0:break;case 1:this.internalResult.protocol=this.makeComponentString();break;case 2:break;case 3:this.internalResult.username=this.makeComponentString();break;case 4:this.internalResult.password=this.makeComponentString();break;case 5:this.internalResult.hostname=this.makeComponentString();break;case 6:this.internalResult.port=this.makeComponentString();break;case 7:this.internalResult.pathname=this.makeComponentString();break;case 8:this.internalResult.search=this.makeComponentString();break;case 9:this.internalResult.hash=this.makeComponentString();break;case 10:break}this.changeStateWithoutSettingComponent(e,t)}changeStateWithoutSettingComponent(e,t){this.state=e,this.componentStart=this.tokenIndex+t,this.tokenIndex+=t,this.tokenIncrement=0}rewind(){this.tokenIndex=this.componentStart,this.tokenIncrement=0}rewindAndSetState(e){this.rewind(),this.state=e}safeToken(e){return e<0&&(e=this.tokenList.length-e),e<this.tokenList.length?this.tokenList[e]:this.tokenList[this.tokenList.length-1]}isNonSpecialPatternChar(e,t){let r=this.safeToken(e);return r.value===t&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}isProtocolSuffix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}nextIsAuthoritySlashes(){return this.isNonSpecialPatternChar(this.tokenIndex+1,"/")&&this.isNonSpecialPatternChar(this.tokenIndex+2,"/")}isIdentityTerminator(){return this.isNonSpecialPatternChar(this.tokenIndex,"@")}isPasswordPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPortPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPathnameStart(){return this.isNonSpecialPatternChar(this.tokenIndex,"/")}isSearchPrefix(){if(this.isNonSpecialPatternChar(this.tokenIndex,"?"))return!0;if(this.tokenList[this.tokenIndex].value!=="?")return!1;let e=this.safeToken(this.tokenIndex-1);return e.type!=="NAME"&&e.type!=="REGEX"&&e.type!=="CLOSE"&&e.type!=="ASTERISK"}isHashPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,"#")}isGroupOpen(){return this.tokenList[this.tokenIndex].type=="OPEN"}isGroupClose(){return this.tokenList[this.tokenIndex].type=="CLOSE"}isIPv6Open(){return this.isNonSpecialPatternChar(this.tokenIndex,"[")}isIPv6Close(){return this.isNonSpecialPatternChar(this.tokenIndex,"]")}makeComponentString(){let e=this.tokenList[this.tokenIndex],t=this.safeToken(this.componentStart).index;return this.input.substring(t,e.index)}computeShouldTreatAsStandardURL(){let e={};Object.assign(e,k),e.encodePart=X;let t=st(this.makeComponentString(),void 0,e);this.shouldTreatAsStandardURL=Le(t)}},J=["protocol","username","password","hostname","port","pathname","search","hash"],R="*";function be(e,t){if(typeof e!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}function C(e,t){return t?O(e):e}function F(e,t,r){let n;if(typeof t.baseURL=="string")try{n=new URL(t.baseURL),e.protocol=C(n.protocol.substring(0,n.protocol.length-1),r),e.username=C(n.username,r),e.password=C(n.password,r),e.hostname=C(n.hostname,r),e.port=C(n.port,r),e.pathname=C(n.pathname,r),e.search=C(n.search.substring(1,n.search.length),r),e.hash=C(n.hash.substring(1,n.hash.length),r)}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol=="string"&&(e.protocol=gt(t.protocol,r)),typeof t.username=="string"&&(e.username=pt(t.username,r)),typeof t.password=="string"&&(e.password=lt(t.password,r)),typeof t.hostname=="string"&&(e.hostname=ft(t.hostname,r)),typeof t.port=="string"&&(e.port=dt(t.port,e.protocol,r)),typeof t.pathname=="string"){if(e.pathname=t.pathname,n&&!at(e.pathname,r)){let o=n.pathname.lastIndexOf("/");o>=0&&(e.pathname=C(n.pathname.substring(0,o+1),r)+e.pathname)}e.pathname=mt(e.pathname,e.protocol,r)}return typeof t.search=="string"&&(e.search=ht(t.search,r)),typeof t.hash=="string"&&(e.hash=ut(t.hash,r)),e}function O(e){return e.replace(/([+*?:{}()\\])/g,"\\$1")}function kt(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function vt(e,t){t.delimiter??(t.delimiter="/#?"),t.prefixes??(t.prefixes="./"),t.sensitive??(t.sensitive=!1),t.strict??(t.strict=!1),t.end??(t.end=!0),t.start??(t.start=!0),t.endsWith="";let r=".*",n=`[^${kt(t.delimiter)}]+?`,o=/[$_\u200C\u200D\p{ID_Continue}]/u,u="";for(let i=0;i<e.length;++i){let s=e[i];if(s.type===3){if(s.modifier===3){u+=O(s.value);continue}u+=`{${O(s.value)}}${A(s.modifier)}`;continue}let c=s.hasCustomName(),a=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),f=i>0?e[i-1]:null,l=i<e.length-1?e[i+1]:null;if(!a&&c&&s.type===1&&s.modifier===3&&l&&!l.prefix.length&&!l.suffix.length)if(l.type===3){let m=l.value.length>0?l.value[0]:"";a=o.test(m)}else a=!l.hasCustomName();if(!a&&!s.prefix.length&&f&&f.type===3){let m=f.value[f.value.length-1];a=t.prefixes.includes(m)}a&&(u+="{"),u+=O(s.prefix),c&&(u+=`:${s.name}`),s.type===2?u+=`(${s.value})`:s.type===1?c||(u+=`(${n})`):s.type===0&&(!c&&(!f||f.type===3||f.modifier!==3||a||s.prefix!=="")?u+="*":u+=`(${r})`),s.type===1&&c&&s.suffix.length&&o.test(s.suffix[0])&&(u+="\\"),u+=O(s.suffix),a&&(u+="}"),s.modifier!==3&&(u+=A(s.modifier))}return u}var B=class{constructor(e={},t,r){this.regexp={},this.names={},this.component_pattern={},this.parts={};try{let n;if(typeof t=="string"?n=t:r=t,typeof e=="string"){let s=new Rt(e);if(s.parse(),e=s.result,n===void 0&&typeof e.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");e.baseURL=n}else{if(!e||typeof e!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let o={ignoreCase:r.ignoreCase===!0},u={pathname:R,protocol:R,username:R,password:R,hostname:R,port:R,search:R,hash:R};this.pattern=F(u,e,!0),_e(this.pattern.protocol)===this.pattern.port&&(this.pattern.port="");let i;for(i of J){if(!(i in this.pattern))continue;let s={},c=this.pattern[i];switch(this.names[i]=[],i){case"protocol":Object.assign(s,k),s.encodePart=X;break;case"username":Object.assign(s,k),s.encodePart=xt;break;case"password":Object.assign(s,k),s.encodePart=St;break;case"hostname":Object.assign(s,ot),Ee(c)?s.encodePart=Ne:s.encodePart=Ae;break;case"port":Object.assign(s,k),s.encodePart=Te;break;case"pathname":Le(this.regexp.protocol)?(Object.assign(s,it,o),s.encodePart=yt):(Object.assign(s,k,o),s.encodePart=wt);break;case"search":Object.assign(s,k,o),s.encodePart=Ct;break;case"hash":Object.assign(s,k,o),s.encodePart=bt;break}try{this.parts[i]=ke(c,s),this.regexp[i]=ve(this.parts[i],this.names[i],s),this.component_pattern[i]=vt(this.parts[i],s)}catch{throw new TypeError(`invalid ${i} pattern '${this.pattern[i]}'.`)}}}catch(n){throw new TypeError(`Failed to construct 'URLPattern': ${n.message}`)}}test(e={},t){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof e!="string"&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return!1;try{typeof e=="object"?r=F(r,e,!1):r=F(r,be(e,t),!1)}catch{return!1}let n;for(n of J)if(!this.regexp[n].exec(r[n]))return!1;return!0}exec(e={},t){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof e!="string"&&t)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof e>"u")return;try{typeof e=="object"?r=F(r,e,!1):r=F(r,be(e,t),!1)}catch{return null}let n={};t?n.inputs=[e,t]:n.inputs=[e];let o;for(o of J){let u=this.regexp[o].exec(r[o]);if(!u)return null;let i={};for(let[s,c]of this.names[o].entries())if(typeof c=="string"||typeof c=="number"){let a=u[s+1];i[c]=a}n[o]={input:r[o]??"",groups:i}}return n}static compareComponent(e,t,r){let n=(s,c)=>{for(let a of["type","modifier","prefix","value","suffix"]){if(s[a]<c[a])return-1;if(s[a]===c[a])continue;return 1}return 0},o=new D(3,"","","","",3),u=new D(0,"","","","",3),i=(s,c)=>{let a=0;for(;a<Math.min(s.length,c.length);++a){let f=n(s[a],c[a]);if(f)return f}return s.length===c.length?0:n(s[a]??o,c[a]??o)};return!t.component_pattern[e]&&!r.component_pattern[e]?0:t.component_pattern[e]&&!r.component_pattern[e]?i(t.parts[e],[u]):!t.component_pattern[e]&&r.component_pattern[e]?i([u],r.parts[e]):i(t.parts[e],r.parts[e])}get protocol(){return this.component_pattern.protocol}get username(){return this.component_pattern.username}get password(){return this.component_pattern.password}get hostname(){return this.component_pattern.hostname}get port(){return this.component_pattern.port}get pathname(){return this.component_pattern.pathname}get search(){return this.component_pattern.search}get hash(){return this.component_pattern.hash}};globalThis.URLPattern||(globalThis.URLPattern=B);var $e=(e,t)=>{var i;if(e===void 0)return{};let r=t.endsWith("/")?t.slice(0,-1):t,o=(i=new B({pathname:e,baseURL:r}).exec(r))==null?void 0:i.pathname.groups;return o?Object.entries(o).reduce((s,[c,a])=>a===void 0?s:{...s,[c]:a},{}):{}};var G=e=>e.headers.get(fe)||"";import{env as It}from"process";var Fe=()=>({region:It.AWS_REGION});import{env as Y}from"process";var Oe=()=>({id:Y.SITE_ID,name:Y.SITE_NAME,url:Y.URL});var Et=e=>{let t=JSON.stringify(e);return new Response(t,{headers:{"content-type":"application/json"}})},De=(e,t,r)=>{let n={};try{n=$e(e[_],e.url)}catch{console.log(`Could not parse function route ${e[_]}.`)}let o={enqueuedPromises:[]};return{context:{account:ne(e.headers.get(ie)),cookies:t.getPublicInterface(),deploy:me(e.headers),flags:xe(e),geo:ye(e.headers.get(oe)),ip:we(e.headers.get(se)),json:Et,log:console.log,next:()=>{throw new Error("`context.next` is not implemented for serverless functions")},params:n,requestId:G(e),rewrite:i=>{let s=Pt(i,e.url);return Lt(s)},server:Fe(),site:Oe(),url:new URL(e.url),waitUntil:r?i=>{o.enqueuedPromises.push(i)}:void 0},state:o}},Pt=(e,t)=>{if(e instanceof URL)return e;if(e.startsWith("/")){let r=new URL(t);return r.pathname=e,r}return new URL(e)},Lt=async e=>await fetch(e);import qe from"node:assert";function Ue(e){function t(a,f=2){return a.padStart(f,"0")}let r=t(e.getUTCDate().toString()),n=t(e.getUTCHours().toString()),o=t(e.getUTCMinutes().toString()),u=t(e.getUTCSeconds().toString()),i=e.getUTCFullYear(),s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return`${s[e.getUTCDay()]}, ${r} ${c[e.getUTCMonth()]} ${i} ${n}:${o}:${u} GMT`}var _t=/^(?=[\u0020-\u007E]*$)[^()@<>,;:\\"[\]?={}\s]+$/;function At(e){if(!e.name)return"";let t=[];if(Nt(e.name),$t(e.name,e.value),t.push(`${e.name}=${e.value}`),e.name.startsWith("__Secure")&&(e.secure=!0),e.name.startsWith("__Host")&&(e.path="/",e.secure=!0,delete e.domain),e.secure&&t.push("Secure"),e.httpOnly&&t.push("HttpOnly"),typeof e.maxAge=="number"&&Number.isInteger(e.maxAge)&&(qe(e.maxAge>=0,"Max-Age must be an integer superior or equal to 0"),t.push(`Max-Age=${e.maxAge}`)),e.domain&&(Ft(e.domain),t.push(`Domain=${e.domain}`)),e.sameSite&&t.push(`SameSite=${e.sameSite}`),e.path&&(Tt(e.path),t.push(`Path=${e.path}`)),e.expires){let{expires:r}=e,n=Ue(typeof r=="number"?new Date(r):r);t.push(`Expires=${n}`)}return e.unparsed&&t.push(e.unparsed.join("; ")),t.join("; ")}function Nt(e){if(e&&!_t.test(e))throw new TypeError(`Invalid cookie name: "${e}".`)}function Tt(e){if(e!=null)for(let t=0;t<e.length;t++){let r=e.charAt(t);if(r<" "||r>"~"||r==";")throw new Error(`${e}: Invalid cookie path char '${r}'`)}}function $t(e,t){if(!(t==null||e==null))for(let r=0;r<t.length;r++){let n=t.charAt(r);if(n<"!"||n=='"'||n==","||n==";"||n=="\\"||n=="\x7F")throw new Error(`RFC2616 cookie '${e}' cannot contain character '${n}'`);if(n>"\x80")throw new Error(`RFC2616 cookie '${e}' can only have US-ASCII chars as value${n.charCodeAt(0).toString(16)}`)}}function Ft(e){if(e==null)return;let t=e.charAt(0),r=e.charAt(e.length-1);if(t=="-"||r=="."||r=="-")throw new Error(`Invalid first/last char in cookie domain: ${e}`)}function He(e){let t=e.get("Cookie");if(t!=null){let r={},n=t.split(";");for(let o of n){let[u,...i]=o.split("=");qe(u!=null);let s=u.trim();r[s]=i.join("=")}return r}return{}}function Q(e,t){let r=At(t);r&&e.append("Set-Cookie",r)}function je(e,t,r){Q(e,Object.assign({name:t,value:"",expires:new Date(0)},r))}var W=class{constructor(t){this.ops=[],this.request=t}apply(t){this.ops.forEach(r=>{switch(r.type){case"delete":je(t.headers,r.options.name,{domain:r.options.domain,path:r.options.path});break;case"set":Q(t.headers,r.cookie);break;default:}})}delete(t){let r={path:"/"},n=typeof t=="string"?{name:t}:t;this.ops.push({options:{...r,...n},type:"delete"})}get(t){return He(this.request.headers)[t]}getPublicInterface(){return{delete:this.delete.bind(this),get:this.get.bind(this),set:this.set.bind(this)}}set(t,r){let n;if(typeof t=="string"){if(typeof r!="string")throw new TypeError("You must provide the cookie value as a string to 'cookies.set'");n={name:t,value:r}}else n=t;this.ops.push({cookie:n,type:"set"})}};import{Buffer as Me}from"node:buffer";import Be from"node:process";var Ot="NETLIFY_PURGE_API_TOKEN",Dt="NETLIFY_BLOBS_CONTEXT",Ge=(e,t,r)=>{var u,i;let{blobs:n}=t,o=(i=(u=r==null?void 0:r.clientContext)==null?void 0:u.custom)==null?void 0:i.purge_api_token;if(typeof n=="string"&&n!=="")try{let s=Me.from(n,"base64").toString("utf8"),c=JSON.parse(s),a=e.get(ue),f=e.get(H);Be.env[Dt]=Me.from(JSON.stringify({edgeURL:c.url,uncachedEdgeURL:c.url_uncached,token:c.token,siteID:a,deployID:f,primaryRegion:c.primary_region})).toString("base64")}catch(s){console.error("An internal error occurred while setting up Netlify Blobs:",s)}typeof o=="string"&&o!==""&&(Be.env[Ot]=o)};var V=class e extends Error{constructor(t){super(t),this.name="NetlifyUserError",Object.setPrototypeOf(this,e.prototype)}};import Ht from"node:http";import jt from"node:https";import{AsyncLocalStorage as Ut}from"node:async_hooks";var I=new Ut;import{env as qt}from"node:process";var U=(e,t)=>{qt.NETLIFY_DEV||console.log("__nfSystemLog",{msg:e,fields:t})};var Mt=globalThis.fetch,We=!1,Ve=e=>{let t=I.getStore();if(t!=null&&t.cdnLoopHeader){if(e.headersSent){U("Headers already sent, cannot add CDN-Loop header");return}e.setHeader("CDN-Loop",t==null?void 0:t.cdnLoopHeader)}},ze=()=>{if(!We){We=!0,globalThis.fetch=function(t,r){let n=new Request(t,r),o=I.getStore();return o!=null&&o.cdnLoopHeader&&n.headers.set("CDN-Loop",o.cdnLoopHeader),Mt(n)};for(let e of[Ht,jt]){let t=e.request;e.get=function(...n){let o=t(...n);return Ve(o),o.end(),o},e.request=function(...n){let o=t(...n);return Ve(o),o}}}};import{promises as Bt,writeFileSync as Gt}from"node:fs";import{join as Wt}from"node:path";import Z from"node:process";var Vt=".error",zt="/tmp/nf_req_v1",ee=class e{constructor(){this.entries=new Map}static getFilePath(t,r=""){return Wt(zt,t+r)}async save(t,r){if(!r){U("Failed to write request metadata file because AWS request ID is missing");return}let n=new URL(t.url),o=G(t),u={host:n.host,method:t.method,nf_req_id:o,ts:Date.now(),path:n.pathname};this.entries.set(o,u);try{let i=e.getFilePath(r);await Bt.writeFile(i,JSON.stringify(u)),this.entries.delete(o)}catch(i){U("Failed to write request metadata file",{error:i.message})}}flush(){for(let[t,r]of this.entries){let n=e.getFilePath(t,Vt);try{Gt(n,JSON.stringify(r))}catch{}}}},te=new ee;if(Z.env.NETLIFY_LOCAL===void 0){let e=t=>{te.flush();let r=Z.listeners("uncaughtException"),n=r.indexOf(e);if(!r[n+1])throw t};Z.on("uncaughtException",e)}var Qt=Yt(Kt),Zt=20,er=e=>awslambda.streamifyResponse(async(t,r,n)=>{let o=Je.env.NETLIFY_LOCAL!==void 0,{body:u,httpMethod:i,flags:s,isBase64Encoded:c,headers:a,rawUrl:f,route:l}=t,m=new $(s||{}),N=le(a),E=ge(u,c),P=m.get("serverless_functions_abort_signal")===!0?AbortSignal.timeout(n.getRemainingTimeInMillis()-Zt):void 0,w=new j(f,{body:E,headers:N,method:i,signal:P}),L=m.get("serverless_functions_metadata_file")===!0&&!o?te.save(w,n.awsRequestId):null;Ge(N,t,n),Se(w,m),l&&(w[_]=l),m.get("serverless_functions_request_interceptor_v2")===!0&&ze(),m.get("serverless_functions_wait_event_loop")===!0&&(n.callbackWaitsForEmptyEventLoop=!1);let T=m.get("serverless_functions_context_waituntil")===!0,h=new W(w),{context:p,state:d}=De(w,h,T);try{let S=await I.run({cdnLoopHeader:N.get("cdn-loop"),context:p},()=>e.default(w,p));await tr(S,r,h,m)}catch(S){throw await L,S}if(T&&d.enqueuedPromises.length!==0)try{await Promise.allSettled(d.enqueuedPromises)}catch(S){console.error(S)}await L}),tr=async(e,t,r,n)=>{let o={version:Je.version},u=Jt.from(JSON.stringify(o)).toString("base64");if(e instanceof Response){r.apply(e);let i=new Headers(e.headers),{body:s,status:c}=e,a=n.evaluations;a.size!==0&&i.set(he,[...a].join(",")),i.set(z,u);let f={multiValueHeaders:pe(i),statusCode:c},l=awslambda.HttpResponseStream.from(t,f);if((n.get("serverless_functions_fix_empty_body")===!0||s===null)&&l.write(""),s===null){l.end();return}let m=Xt.fromWeb(s);await Qt(m,l);return}if(e===void 0){let i=awslambda.HttpResponseStream.from(t,{statusCode:204,headers:{[z]:u}});i.write(""),i.end();return}throw new V("Function returned an unsupported value. Accepted types are 'Response' or 'undefined'")};import q from"process";var rr={delete:e=>{delete q.env[e]},get:e=>q.env[e],has:e=>!!q.env[e],set:(e,t)=>{q.env[e]=t},toObject:()=>Object.entries(q.env).reduce((e,[t,r])=>r===void 0?e:{...e,[t]:r},{})},Ke={get context(){let e=I.getStore();return(e==null?void 0:e.context)??null},env:rr};globalThis.Netlify=Ke;var nr=()=>Ke;var jn=()=>sr(import.meta.url);export{er as getLambdaHandler,nr as getNetlifyGlobal,jn as getPath};
修改文件时间
将文件时间修改为当前时间的前一年
删除文件