@vercel/build-utils 15.1.0 → 15.1.1
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/CHANGELOG.md +6 -0
- package/dist/index.js +2 -2
- package/dist/trace/trace.d.ts +3 -0
- package/dist/trace/trace.js +5 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 15.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 11a7991: Record service and daemon counts, build concurrency, and per-build timing totals on the `vc.doBuild` span, and the service name, runtime, and kind on each service or daemon `vc.builder` span. Spans now expose their duration once stopped.
|
|
8
|
+
|
|
3
9
|
## 15.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -106,10 +106,10 @@ ${fields}`:`${fields}`}throw new Error(`Unsupported value type (${value})`)}func
|
|
|
106
106
|
`?stringified:""}catch(error){throw error.location&&(error.message=error.message.replace(/(\.)?$/,` (line ${error.location.start.line}, column ${error.location.start.column})$1`)),error}}stringifySyml.PreserveOrdering=PreserveOrdering;function parseViaPeg(source){return source.endsWith(`
|
|
107
107
|
`)||(source+=`
|
|
108
108
|
`),(0,syml_1.parse)(source)}var LEGACY_REGEXP=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i;function parseViaJsYaml(source){if(LEGACY_REGEXP.test(source))return parseViaPeg(source);let value=(0,js_yaml_1.safeLoad)(source,{schema:js_yaml_1.FAILSAFE_SCHEMA,json:!0});if(value==null)return{};if(typeof value!="object")throw new Error(`Expected an indexed object, got a ${typeof value} instead. Does your file follow Yaml's rules?`);if(Array.isArray(value))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return value}function parseSyml2(source){return parseViaJsYaml(source)}}});var require_lib4=__commonJS({"../../node_modules/.pnpm/@yarnpkg+parsers@3.0.3/node_modules/@yarnpkg/parsers/lib/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.stringifySyml=exports2.parseSyml=exports2.stringifyResolution=exports2.parseResolution=exports2.stringifyValueArgument=exports2.stringifyShellLine=exports2.stringifyRedirectArgument=exports2.stringifyEnvSegment=exports2.stringifyCommandLineThen=exports2.stringifyCommandLine=exports2.stringifyCommandChainThen=exports2.stringifyCommandChain=exports2.stringifyCommand=exports2.stringifyArithmeticExpression=exports2.stringifyArgumentSegment=exports2.stringifyArgument=exports2.stringifyShell=exports2.parseShell=void 0;var shell_1=require_shell2();Object.defineProperty(exports2,"parseShell",{enumerable:!0,get:function(){return shell_1.parseShell}});Object.defineProperty(exports2,"stringifyShell",{enumerable:!0,get:function(){return shell_1.stringifyShell}});Object.defineProperty(exports2,"stringifyArgument",{enumerable:!0,get:function(){return shell_1.stringifyArgument}});Object.defineProperty(exports2,"stringifyArgumentSegment",{enumerable:!0,get:function(){return shell_1.stringifyArgumentSegment}});Object.defineProperty(exports2,"stringifyArithmeticExpression",{enumerable:!0,get:function(){return shell_1.stringifyArithmeticExpression}});Object.defineProperty(exports2,"stringifyCommand",{enumerable:!0,get:function(){return shell_1.stringifyCommand}});Object.defineProperty(exports2,"stringifyCommandChain",{enumerable:!0,get:function(){return shell_1.stringifyCommandChain}});Object.defineProperty(exports2,"stringifyCommandChainThen",{enumerable:!0,get:function(){return shell_1.stringifyCommandChainThen}});Object.defineProperty(exports2,"stringifyCommandLine",{enumerable:!0,get:function(){return shell_1.stringifyCommandLine}});Object.defineProperty(exports2,"stringifyCommandLineThen",{enumerable:!0,get:function(){return shell_1.stringifyCommandLineThen}});Object.defineProperty(exports2,"stringifyEnvSegment",{enumerable:!0,get:function(){return shell_1.stringifyEnvSegment}});Object.defineProperty(exports2,"stringifyRedirectArgument",{enumerable:!0,get:function(){return shell_1.stringifyRedirectArgument}});Object.defineProperty(exports2,"stringifyShellLine",{enumerable:!0,get:function(){return shell_1.stringifyShellLine}});Object.defineProperty(exports2,"stringifyValueArgument",{enumerable:!0,get:function(){return shell_1.stringifyValueArgument}});var resolution_1=require_resolution2();Object.defineProperty(exports2,"parseResolution",{enumerable:!0,get:function(){return resolution_1.parseResolution}});Object.defineProperty(exports2,"stringifyResolution",{enumerable:!0,get:function(){return resolution_1.stringifyResolution}});var syml_1=require_syml2();Object.defineProperty(exports2,"parseSyml",{enumerable:!0,get:function(){return syml_1.parseSyml}});Object.defineProperty(exports2,"stringifySyml",{enumerable:!0,get:function(){return syml_1.stringifySyml}})}});var node_diagnostics_exports={};__export(node_diagnostics_exports,{generateProjectManifest:()=>generateProjectManifest});function classifySource(resolvedUrl){if(!resolvedUrl)return{};if(resolvedUrl.startsWith("file:"))return{source:"file",sourceUrl:resolvedUrl.slice(5)};if(resolvedUrl.startsWith("git+")||resolvedUrl.startsWith("git://"))return{source:"git",sourceUrl:resolvedUrl.replace(/^git\+/,"")};try{return{source:"registry",sourceUrl:new URL(resolvedUrl).origin}}catch{return{}}}function npmEntryScopes(entry){let scopes=[];return entry.dev&&scopes.push("dev"),entry.peer&&scopes.push("peer"),entry.optional&&scopes.push("optional"),scopes.length===0&&scopes.push("prod"),scopes}function parseNpmLock(content,lockfileVersion){let lockMap=new Map,parsed=JSON.parse(content);if((lockfileVersion??parsed.lockfileVersion??1)>=2){let packages=parsed.packages;if(!packages)return lockMap;for(let[key,entry]of Object.entries(packages)){if(key===""||!key.startsWith("node_modules/")||entry.link===!0)continue;let rest=key.slice(13),isScoped=rest.startsWith("@"),slashCount=(rest.match(/\//g)??[]).length;if(isScoped?slashCount!==1:slashCount!==0)continue;let resolved=entry.resolved;if(resolved?.startsWith("file:"))continue;let version=entry.version??"",existing=lockMap.get(rest);if(existing&&!isHigherVersion(version,existing.resolved))continue;let{source,sourceUrl}=classifySource(resolved),lockEntry={resolved:version,scopes:npmEntryScopes(entry)};source&&(lockEntry.source=source),sourceUrl&&(lockEntry.sourceUrl=sourceUrl),lockMap.set(rest,lockEntry)}}else{let dependencies=parsed.dependencies;if(!dependencies)return lockMap;let walk=deps=>{for(let[name,entry]of Object.entries(deps)){let resolved=entry.resolved;if(!resolved?.startsWith("file:")){let version=entry.version??"",existing=lockMap.get(name);if(!existing||isHigherVersion(version,existing.resolved)){let{source,sourceUrl}=classifySource(resolved),lockEntry={resolved:version,scopes:npmEntryScopes(entry)};source&&(lockEntry.source=source),sourceUrl&&(lockEntry.sourceUrl=sourceUrl),lockMap.set(name,lockEntry)}}let nested=entry.dependencies;nested&&walk(nested)}};walk(dependencies)}return lockMap}function isHigherVersion(a,b){let seg=v=>v.split(/[.\-+]/).map(s=>parseInt(s,10)||0),pa=seg(a),pb=seg(b);for(let i=0;i<Math.max(pa.length,pb.length);i++){if((pa[i]??0)>(pb[i]??0))return!0;if((pa[i]??0)<(pb[i]??0))return!1}return!1}function extractPackageName(spec){let s=spec.replace(/\(.*\)$/,"");if(s.startsWith("@")){let i2=s.indexOf("@",1);return i2===-1?null:s.slice(0,i2)}let i=s.lastIndexOf("@");return i<=0?null:s.slice(0,i)}function parsePnpmV9Key(key){let name=extractPackageName(key);if(!name)return null;let withoutPeers=key.replace(/\(.*\)$/,"");return{name,version:withoutPeers.slice(name.length+1)}}function parsePnpmV5Key(key){if(!key.startsWith("/"))return null;let rest=key.slice(1);if(rest.startsWith("@")){let firstSlash=rest.indexOf("/");if(firstSlash===-1)return null;let secondSlash=rest.indexOf("/",firstSlash+1);if(secondSlash===-1)return null;let name2=rest.slice(0,secondSlash),version2=rest.slice(secondSlash+1).split("_")[0];return{name:name2,version:version2}}let slashIndex=rest.indexOf("/");if(slashIndex===-1)return null;let name=rest.slice(0,slashIndex),version=rest.slice(slashIndex+1).split("_")[0];return{name,version}}function parsePnpmV6Key(key){if(!key.startsWith("/"))return null;let rest=key.slice(1),atIdx;if(rest.startsWith("@")?atIdx=rest.indexOf("@",1):atIdx=rest.indexOf("@"),atIdx===-1)return null;let name=rest.slice(0,atIdx),version=rest.slice(atIdx+1).split("_")[0].replace(/\(.*\)$/,"");return{name,version}}function classifyPnpmResolution(resolution){return resolution?resolution.type==="directory"||resolution.directory?{local:!0}:typeof resolution.tarball=="string"?classifySource(resolution.tarball):resolution.type==="git"||typeof resolution.repo=="string"?{source:"git",sourceUrl:resolution.repo??void 0}:{}:{}}function parsePnpmLock(content,lockfileVersion){let lockMap=new Map,docs=[];import_js_yaml3.default.safeLoadAll(content,doc=>docs.push(doc));let parsedYaml=docs.at(-1);if(!parsedYaml)return lockMap;let lv=lockfileVersion??Number(parsedYaml.lockfileVersion??"0"),packages=parsedYaml.packages;if(!packages)return lockMap;let parseKey2=lv>=9?parsePnpmV9Key:lv>=6?parsePnpmV6Key:parsePnpmV5Key;for(let[key,entry]of Object.entries(packages)){let keyParsed=parseKey2(key);if(!keyParsed)continue;let{name,version}=keyParsed,resolution=entry.resolution,{local,source,sourceUrl}=classifyPnpmResolution(resolution);if(local)continue;let existing=lockMap.get(name);if(existing&&!isHigherVersion(version,existing.resolved))continue;let lockEntry={resolved:version,scopes:["prod"]};source&&(lockEntry.source=source),sourceUrl&&(lockEntry.sourceUrl=sourceUrl),lockMap.set(name,lockEntry)}return lockMap}function parseYarnLock(content,lockfileVersion){let lockMap=new Map,isBerry=(lockfileVersion??1)>=2,parsed=(0,import_parsers.parseSyml)(content);for(let[key,entry]of Object.entries(parsed)){if(key==="__metadata"||!entry||isBerry&&entry.linkType==="soft")continue;let version=entry.version;if(!version)continue;let source,sourceUrl;if(!isBerry&&entry.resolved){if(entry.resolved.startsWith("file:"))continue;let classified=classifySource(entry.resolved);source=classified.source,sourceUrl=classified.sourceUrl}let specifiers=key.split(",").map(s=>s.trim().replace(/^"|"$/g,"")),name=null;for(let spec of specifiers)if(name=extractPackageName(spec),name)break;if(!name)continue;let existing=lockMap.get(name);if(existing&&!isHigherVersion(version,existing.resolved))continue;let lockEntry={resolved:version,scopes:["prod"]};source&&(lockEntry.source=source),sourceUrl&&(lockEntry.sourceUrl=sourceUrl),lockMap.set(name,lockEntry)}return lockMap}function parseBunLock(content){let lockMap=new Map,json=content.replace(/,(\s*[}\]])/g,"$1"),packages=JSON.parse(json).packages;if(!packages)return lockMap;for(let[name,value]of Object.entries(packages)){if(!Array.isArray(value))continue;let ref=value[0];if(!ref||typeof ref!="string")continue;let pkgName=extractPackageName(ref);if(!pkgName)continue;let version=ref.slice(pkgName.length+1);if(!version||version.startsWith("file:")||version.startsWith("workspace:"))continue;let existing=lockMap.get(name);existing&&!isHigherVersion(version,existing.resolved)||lockMap.set(name,{resolved:version,scopes:["prod"]})}return lockMap}async function parseLockfile(cliType,lockfilePath,lockfileVersion){if(cliType==="bun"&&lockfileVersion===0)return new Map;if(cliType==="vlt")return new Map;let content=await import_fs4.default.promises.readFile(lockfilePath,"utf-8");switch(cliType){case"npm":return parseNpmLock(content,lockfileVersion);case"pnpm":return parsePnpmLock(content,lockfileVersion);case"yarn":return parseYarnLock(content,lockfileVersion);case"bun":return parseBunLock(content);default:return new Map}}async function readPackageJson(startDir){let current=startDir;for(;;)try{let content=await import_fs4.default.promises.readFile(import_path15.default.join(current,"package.json"),"utf-8");return JSON.parse(content)}catch{let parent=import_path15.default.dirname(current);if(parent===current)return null;current=parent}}function buildDirectMaps(pkgJson){let directScopes=new Map,directRequested=new Map,add=(deps,scope)=>{if(!(!deps||typeof deps!="object"))for(let[name,specifier]of Object.entries(deps))directScopes.has(name)||directScopes.set(name,new Set),directScopes.get(name).add(scope),directRequested.has(name)||directRequested.set(name,specifier)};return add(pkgJson.dependencies,"prod"),add(pkgJson.devDependencies,"dev"),add(pkgJson.peerDependencies,"peer"),add(pkgJson.optionalDependencies,"optional"),{directScopes,directRequested}}async function generateProjectManifest({workPath,nodeVersion,cliType,lockfilePath,lockfileVersion,framework,serviceType,outputRuntime="node"}){try{let pkgJson=await readPackageJson(workPath);if(!pkgJson){await writeProjectManifest({version:MANIFEST_VERSION,runtime:"node",...framework?{framework}:{},...serviceType?{serviceType}:{},runtimeVersion:{resolved:String(nodeVersion.major)},dependencies:[]},workPath,outputRuntime);return}let{directScopes,directRequested}=buildDirectMaps(pkgJson),lockMap=lockfilePath?await parseLockfile(cliType,lockfilePath,lockfileVersion):new Map,directDeps=[],transitiveDeps=[];for(let[name,scopes]of directScopes){let lock=lockMap.get(name),dep={name,type:"direct",scopes:[...scopes].sort(),requested:directRequested.get(name),resolved:lock?.resolved??""};lock?.source&&(dep.source=lock.source),lock?.sourceUrl&&(dep.sourceUrl=lock.sourceUrl),directDeps.push(dep)}for(let[name,lock]of lockMap){if(directScopes.has(name))continue;let dep={name,type:"transitive",scopes:lock.scopes,resolved:lock.resolved};lock.source&&(dep.source=lock.source),lock.sourceUrl&&(dep.sourceUrl=lock.sourceUrl),transitiveDeps.push(dep)}let runtimeVersion={resolved:String(nodeVersion.major)},enginesNode=pkgJson.engines?.node;if(enginesNode)runtimeVersion.requested=enginesNode,runtimeVersion.requestedSource="package.json";else for(let filename of[".node-version",".nvmrc"])try{let trimmed=(await import_fs4.default.promises.readFile(import_path15.default.join(workPath,filename),"utf-8")).trim();if(trimmed){runtimeVersion.requested=trimmed,runtimeVersion.requestedSource=filename;break}}catch{}let manifest={version:MANIFEST_VERSION,runtime:"node",...framework?{framework}:{},...serviceType?{serviceType}:{},runtimeVersion,dependencies:[...directDeps.sort((a,b)=>a.name.localeCompare(b.name)),...transitiveDeps.sort((a,b)=>a.name.localeCompare(b.name))]};await writeProjectManifest(manifest,workPath,outputRuntime)}catch(err){debug(`generateProjectManifest: ${err instanceof Error?err.message:String(err)}`)}}var import_fs4,import_path15,import_js_yaml3,import_parsers,init_node_diagnostics=__esm({"src/node-diagnostics.ts"(){"use strict";import_fs4=__toESM(require("fs")),import_path15=__toESM(require("path")),import_js_yaml3=__toESM(require_js_yaml2()),import_parsers=__toESM(require_lib4());init_package_manifest();init_debug()}});var ruby_diagnostics_exports={};__export(ruby_diagnostics_exports,{generateRubyProjectManifest:()=>generateRubyProjectManifest,parseGemfileLock:()=>parseGemfileLock});function parseGemfileLock(content){let gems=new Map,pathGems=new Set,directGems=new Map,Section;(Section2=>(Section2.GEM="gem",Section2.GIT="git",Section2.PATH="path",Section2.PLUGIN="plugin",Section2.DEPENDENCIES="dependencies"))(Section||={});let SubSection;(SubSection2=>SubSection2.SPECS="specs")(SubSection||={});let section=null,subSection=null,currentRemote="";for(let rawLine of content.split(`
|
|
109
|
-
`)){let line=rawLine.trimEnd();if(!line)continue;if(!line.startsWith(" ")){currentRemote="",line==="GEM"?section="gem":line==="GIT"?section="git":line==="PATH"?section="path":line==="PLUGIN SOURCE"?section="plugin":line==="DEPENDENCIES"?section="dependencies":section=null,subSection=null;continue}let indent=line.length-line.trimStart().length,text=line.trimStart();if(section==="gem"||section==="git"||section==="plugin"){if(indent===2)text.startsWith("remote:")?(currentRemote=text.slice(7).trim(),subSection=null):text==="specs:"&&(subSection="specs");else if(indent===4&&subSection==="specs"){let m=text.match(GEM_SPEC_PATTERN);if(!m)continue;let[,name,version]=m,gem;if(section==="git")gem={version,source:"git",sourceUrl:currentRemote};else if(section==="plugin")gem={version,source:"plugin",sourceUrl:currentRemote};else{let sourceUrl=currentRemote;try{sourceUrl=new URL(currentRemote).origin}catch{}gem={version,source:"registry",sourceUrl}}if(gems.has(name)){let existing=gems.get(name),isPlatformVariant=/-[a-zA-Z]/.test(version),existingIsPlatformVariant=/-[a-zA-Z]/.test(existing.version);if(isPlatformVariant||existing.source===gem.source&&!existingIsPlatformVariant||gem.source!=="registry")continue}gems.set(name,gem)}}if(section==="path"){if(indent===2&&text==="specs:")subSection="specs";else if(indent===4&&subSection==="specs"){let m=text.match(GEM_SPEC_PATTERN);if(!m)continue;let[,name]=m;pathGems.add(name)}}if(section==="dependencies"&&indent===2){let m=text.match(DEPENDENCY_PATTERN);if(!m)continue;let[,name,,version]=m;directGems.set(name,version)}}for(let name of pathGems)directGems.delete(name);return{gems,directGems}}async function generateRubyProjectManifest({workPath,gemfileLockPath,framework,serviceType,outputRuntime="ruby"}){try{if(!gemfileLockPath)return;let content;try{content=await import_fs5.default.promises.readFile(gemfileLockPath,"utf-8")}catch{return}let{gems,directGems}=parseGemfileLock(content),directEntries=[],transitiveEntries=[];for(let[name,version]of directGems){let gem=gems.get(name),entry={name,type:"direct",scopes:["prod"],...version?{requested:version}:{},resolved:gem?.version??""};gem?.source&&(entry.source=gem.source),gem?.sourceUrl&&(entry.sourceUrl=gem.sourceUrl),directEntries.push(entry)}for(let[name,gem]of gems){if(directGems.has(name))continue;let entry={name,type:"transitive",scopes:["prod"],resolved:gem.version};gem.source&&(entry.source=gem.source),gem.sourceUrl&&(entry.sourceUrl=gem.sourceUrl),transitiveEntries.push(entry)}let manifest={version:MANIFEST_VERSION,runtime:"ruby",...framework?{framework}:{},...serviceType?{serviceType}:{},dependencies:[...directEntries.sort((a,b)=>a.name.localeCompare(b.name)),...transitiveEntries.sort((a,b)=>a.name.localeCompare(b.name))]};await writeProjectManifest(manifest,workPath,outputRuntime)}catch{}}var import_fs5,GEM_SPEC_PATTERN,DEPENDENCY_PATTERN,init_ruby_diagnostics=__esm({"src/ruby-diagnostics.ts"(){"use strict";import_fs5=__toESM(require("fs"));init_package_manifest();GEM_SPEC_PATTERN=/^(\S+) \(([^)]+)\)$/,DEPENDENCY_PATTERN=/^([^\s!]+)(!?)(?:\s+\(([^)]+)\))?$/}});function mapUndefinedAttributes(attrs){return Object.fromEntries(Object.entries(attrs??{}).filter(attr=>!!attr[1]))}var import_node_crypto,NUM_OF_MICROSEC_IN_NANOSEC,Span,init_trace=__esm({"src/trace/trace.ts"(){"use strict";import_node_crypto=require("crypto"),NUM_OF_MICROSEC_IN_NANOSEC=BigInt("1000");Span=class _Span{constructor({name,parentId,attrs,reporter}){this.name=name,this.parentId=parentId,this.attrs=mapUndefinedAttributes(attrs),this.status="started",this.id=(0,import_node_crypto.randomUUID)(),this._reporter=reporter,this.now=Date.now(),this._start=process.hrtime.bigint()}stop(){if(this.status==="stopped")throw new Error("Cannot stop a span which is already stopped");this.status="stopped";let end=process.hrtime.bigint(),duration=Number((end-this._start)/NUM_OF_MICROSEC_IN_NANOSEC)
|
|
109
|
+
`)){let line=rawLine.trimEnd();if(!line)continue;if(!line.startsWith(" ")){currentRemote="",line==="GEM"?section="gem":line==="GIT"?section="git":line==="PATH"?section="path":line==="PLUGIN SOURCE"?section="plugin":line==="DEPENDENCIES"?section="dependencies":section=null,subSection=null;continue}let indent=line.length-line.trimStart().length,text=line.trimStart();if(section==="gem"||section==="git"||section==="plugin"){if(indent===2)text.startsWith("remote:")?(currentRemote=text.slice(7).trim(),subSection=null):text==="specs:"&&(subSection="specs");else if(indent===4&&subSection==="specs"){let m=text.match(GEM_SPEC_PATTERN);if(!m)continue;let[,name,version]=m,gem;if(section==="git")gem={version,source:"git",sourceUrl:currentRemote};else if(section==="plugin")gem={version,source:"plugin",sourceUrl:currentRemote};else{let sourceUrl=currentRemote;try{sourceUrl=new URL(currentRemote).origin}catch{}gem={version,source:"registry",sourceUrl}}if(gems.has(name)){let existing=gems.get(name),isPlatformVariant=/-[a-zA-Z]/.test(version),existingIsPlatformVariant=/-[a-zA-Z]/.test(existing.version);if(isPlatformVariant||existing.source===gem.source&&!existingIsPlatformVariant||gem.source!=="registry")continue}gems.set(name,gem)}}if(section==="path"){if(indent===2&&text==="specs:")subSection="specs";else if(indent===4&&subSection==="specs"){let m=text.match(GEM_SPEC_PATTERN);if(!m)continue;let[,name]=m;pathGems.add(name)}}if(section==="dependencies"&&indent===2){let m=text.match(DEPENDENCY_PATTERN);if(!m)continue;let[,name,,version]=m;directGems.set(name,version)}}for(let name of pathGems)directGems.delete(name);return{gems,directGems}}async function generateRubyProjectManifest({workPath,gemfileLockPath,framework,serviceType,outputRuntime="ruby"}){try{if(!gemfileLockPath)return;let content;try{content=await import_fs5.default.promises.readFile(gemfileLockPath,"utf-8")}catch{return}let{gems,directGems}=parseGemfileLock(content),directEntries=[],transitiveEntries=[];for(let[name,version]of directGems){let gem=gems.get(name),entry={name,type:"direct",scopes:["prod"],...version?{requested:version}:{},resolved:gem?.version??""};gem?.source&&(entry.source=gem.source),gem?.sourceUrl&&(entry.sourceUrl=gem.sourceUrl),directEntries.push(entry)}for(let[name,gem]of gems){if(directGems.has(name))continue;let entry={name,type:"transitive",scopes:["prod"],resolved:gem.version};gem.source&&(entry.source=gem.source),gem.sourceUrl&&(entry.sourceUrl=gem.sourceUrl),transitiveEntries.push(entry)}let manifest={version:MANIFEST_VERSION,runtime:"ruby",...framework?{framework}:{},...serviceType?{serviceType}:{},dependencies:[...directEntries.sort((a,b)=>a.name.localeCompare(b.name)),...transitiveEntries.sort((a,b)=>a.name.localeCompare(b.name))]};await writeProjectManifest(manifest,workPath,outputRuntime)}catch{}}var import_fs5,GEM_SPEC_PATTERN,DEPENDENCY_PATTERN,init_ruby_diagnostics=__esm({"src/ruby-diagnostics.ts"(){"use strict";import_fs5=__toESM(require("fs"));init_package_manifest();GEM_SPEC_PATTERN=/^(\S+) \(([^)]+)\)$/,DEPENDENCY_PATTERN=/^([^\s!]+)(!?)(?:\s+\(([^)]+)\))?$/}});function mapUndefinedAttributes(attrs){return Object.fromEntries(Object.entries(attrs??{}).filter(attr=>!!attr[1]))}var import_node_crypto,NUM_OF_MICROSEC_IN_NANOSEC,Span,init_trace=__esm({"src/trace/trace.ts"(){"use strict";import_node_crypto=require("crypto"),NUM_OF_MICROSEC_IN_NANOSEC=BigInt("1000");Span=class _Span{constructor({name,parentId,attrs,reporter}){this.name=name,this.parentId=parentId,this.attrs=mapUndefinedAttributes(attrs),this.status="started",this.id=(0,import_node_crypto.randomUUID)(),this._reporter=reporter,this.now=Date.now(),this._start=process.hrtime.bigint()}stop(){if(this.status==="stopped")throw new Error("Cannot stop a span which is already stopped");this.status="stopped";let end=process.hrtime.bigint(),duration=Number((end-this._start)/NUM_OF_MICROSEC_IN_NANOSEC);this._duration=duration;let timestamp=Number(this._start/NUM_OF_MICROSEC_IN_NANOSEC),traceEvent={name:this.name,duration,timestamp,id:this.id,parentId:this.parentId,tags:this.attrs,startTime:this.now};this._reporter&&this._reporter.report(traceEvent)}get duration(){return this._duration}setAttributes(attrs){Object.assign(this.attrs,mapUndefinedAttributes(attrs))}child(name,attrs){return new _Span({name,parentId:this.id,attrs,reporter:this._reporter})}reportChildEvents(events){if(!this._reporter)return;let ids=new Set(events.map(event=>event.id));for(let event of events){let isRoot=event.parentId===void 0||!ids.has(event.parentId);this._reporter.report(isRoot?{...event,parentId:this.id}:event)}}async trace(fn){try{return await fn(this)}finally{this.stop()}}}}});var BUILDER_INSTALLER_STEP,BUILDER_COMPILE_STEP,BUILDER_PRE_DEPLOY_STEP,init_constants=__esm({"src/trace/constants.ts"(){"use strict";BUILDER_INSTALLER_STEP="vc.builder.install",BUILDER_COMPILE_STEP="vc.builder.build",BUILDER_PRE_DEPLOY_STEP="vc.builder.preDeploy"}});var trace_exports={};__export(trace_exports,{BUILDER_COMPILE_STEP:()=>BUILDER_COMPILE_STEP,BUILDER_INSTALLER_STEP:()=>BUILDER_INSTALLER_STEP,BUILDER_PRE_DEPLOY_STEP:()=>BUILDER_PRE_DEPLOY_STEP,Span:()=>Span});var init_trace2=__esm({"src/trace/index.ts"(){"use strict";init_trace();init_constants()}});var get_installed_package_version_exports={};__export(get_installed_package_version_exports,{getInstalledPackageVersion:()=>getInstalledPackageVersion});async function getInstalledPackageVersion(packageName,path9){let paths=path9?Array.isArray(path9)?path9:[path9]:[process.cwd()];for(let searchPath of paths)try{let resolved=(0,import_node_module.createRequire)((0,import_node_path2.join)((0,import_node_path2.resolve)(searchPath),"package.json")).resolve(`${packageName}/package.json`),{version}=JSON.parse(await(0,import_promises3.readFile)(resolved,"utf8"));return version}catch(err){debug(`Could not resolve package "${packageName}". Package is not installed.`,err)}}var import_promises3,import_node_module,import_node_path2,init_get_installed_package_version=__esm({"src/get-installed-package-version.ts"(){"use strict";import_promises3=require("fs/promises"),import_node_module=require("module"),import_node_path2=require("path");init_debug()}});var is_package_installed_exports={};__export(is_package_installed_exports,{isPackageInstalled:()=>isPackageInstalled});async function isPackageInstalled(packageName,path9){try{let resolved=require.resolve(packageName,{paths:path9?Array.isArray(path9)?path9:[path9]:[process.cwd()]});return require(resolved),!0}catch(err){return debug(`Could not resolve package "${packageName}". Package is not installed.`,err),!1}}var init_is_package_installed=__esm({"src/is-package-installed.ts"(){"use strict";init_debug()}});var default_cache_path_glob_exports={};__export(default_cache_path_glob_exports,{defaultCachePathGlob:()=>defaultCachePathGlob});var defaultCachePathGlob,init_default_cache_path_glob=__esm({"src/default-cache-path-glob.ts"(){"use strict";defaultCachePathGlob="**/{node_modules,.yarn/cache}/**"}});var resolve_build_concurrency_exports={};__export(resolve_build_concurrency_exports,{resolveBuildConcurrency:()=>resolveBuildConcurrency});function resolveBuildConcurrency(raw=process.env.VERCEL_EXPERIMENTAL_BUILD_CONCURRENCY){let value=raw?.trim();if(!value)return 1;let parallelism=Math.max(typeof import_node_os.default.availableParallelism=="function"?import_node_os.default.availableParallelism():import_node_os.default.cpus().length,1);if(value.toLowerCase()==="auto")return Math.min(Math.max(parallelism-1,2),MAX_AUTO_CONCURRENCY,parallelism);if(value.endsWith("%")){let pct=Number(value.slice(0,-1));return Number.isFinite(pct)&&pct>0?Math.max(1,Math.floor(parallelism*pct/100)):1}let n=Number(value);return Number.isFinite(n)&&n>=1?Math.floor(n):1}var import_node_os,MAX_AUTO_CONCURRENCY,init_resolve_build_concurrency=__esm({"src/resolve-build-concurrency.ts"(){"use strict";import_node_os=__toESM(require("os")),MAX_AUTO_CONCURRENCY=8}});var generate_node_builder_functions_exports={};__export(generate_node_builder_functions_exports,{generateNodeBuilderFunctions:()=>generateNodeBuilderFunctions});function generateNodeBuilderFunctions(frameworkName,regex,validFilenames,validExtensions,nodeBuild,opts){let entrypointsForMessage=validFilenames.map(filename=>`- ${filename}.{${validExtensions.join(",")}}`).join(`
|
|
110
110
|
`),require_=(0,import_node_module2.createRequire)(__filename),build=async args=>{process.env.EXPERIMENTAL_NODE_TYPESCRIPT_ERRORS="1";let includeFiles=["views/**/*"],includeFilesFromConfig=args.config.includeFiles;includeFilesFromConfig&&includeFiles.push(...includeFilesFromConfig);let res=await nodeBuild({...args,config:{...args.config,includeFiles},entrypoint:"package.json",considerBuildCommand:!0,entrypointCallback:async()=>entrypointCallback(args),checks:opts?.checks??(()=>{})}),version;try{let resolved=require_.resolve(`${frameworkName}/package.json`,{paths:[args.workPath]}),frameworkVersion=require_(resolved).version;frameworkVersion&&(version=frameworkVersion)}catch{}return res.output.framework={slug:frameworkName,version},res.routes||(res.routes=[{handle:"filesystem"},{src:"/(.*)",dest:"/",transforms:[{type:"request.path",op:"set",args:"/$1"}]}]),res},entrypointCallback=async args=>{let mainPackageEntrypoint=findMainPackageEntrypoint(args.files),entrypointGlob=`{${validFilenames.map(entrypoint=>`${entrypoint}`).join(",")}}.{${validExtensions.join(",")}}`,dir=args.config.projectSettings?.outputDirectory?.replace(/^\/+|\/+$/g,"");if(dir){let{entrypoint:entrypointFromOutputDir,entrypointsNotMatchingRegex:entrypointsNotMatchingRegex2}=findEntrypoint(await glob(entrypointGlob,(0,import_node_path3.join)(args.workPath,dir)));if(entrypointFromOutputDir)return(0,import_node_path3.join)(dir,entrypointFromOutputDir);throw entrypointsNotMatchingRegex2.length>0?new Error(`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint",entrypointsNotMatchingRegex2.length)}: ${entrypointsNotMatchingRegex2.join(", ")}`):new Error(`No entrypoint found in output directory: "${dir}". Searched for:
|
|
111
111
|
${entrypointsForMessage}`)}let files=await glob(entrypointGlob,args.workPath),{entrypoint:entrypointFromRoot,entrypointsNotMatchingRegex}=findEntrypoint(files);if(entrypointFromRoot)return entrypointFromRoot;if(mainPackageEntrypoint){let entrypointFromPackageJson=await glob(mainPackageEntrypoint,args.workPath);if(entrypointFromPackageJson[mainPackageEntrypoint]&&checkMatchesRegex(entrypointFromPackageJson[mainPackageEntrypoint]))return mainPackageEntrypoint}throw entrypointsNotMatchingRegex.length>0?new Error(`No entrypoint found which imports ${frameworkName}. Found possible ${pluralize("entrypoint",entrypointsNotMatchingRegex.length)}: ${entrypointsNotMatchingRegex.join(", ")}`):new Error(`No entrypoint found. Searched for:
|
|
112
|
-
${entrypointsForMessage}`)};function pluralize(word,count){return count===1?word:`${word}s`}let findEntrypoint=files=>{let possibleEntrypointsInFiles=validFilenames.flatMap(filename=>validExtensions.map(extension=>`${filename}.${extension}`)).filter(entrypoint2=>files[entrypoint2]!==void 0),entrypointsMatchingRegex=possibleEntrypointsInFiles.filter(entrypoint2=>{let file=files[entrypoint2];return checkMatchesRegex(file)}),entrypointsNotMatchingRegex=possibleEntrypointsInFiles.filter(entrypoint2=>{let file=files[entrypoint2];return!checkMatchesRegex(file)}),entrypoint=entrypointsMatchingRegex[0];return entrypointsMatchingRegex.length>1&&console.warn(`Multiple entrypoints found: ${entrypointsMatchingRegex.join(", ")}. Using ${entrypoint}.`),{entrypoint,entrypointsNotMatchingRegex}},checkMatchesRegex=file=>import_node_fs2.default.readFileSync(file.fsPath,"utf-8").match(regex)!==null,findMainPackageEntrypoint=files=>{let packageJson=files["package.json"];if(packageJson&&packageJson.type==="FileFsRef"){let packageJsonContent=import_node_fs2.default.readFileSync(packageJson.fsPath,"utf-8"),packageJsonJson;try{packageJsonJson=JSON.parse(packageJsonContent)}catch{packageJsonJson={}}if("main"in packageJsonJson&&typeof packageJsonJson.main=="string")return packageJsonJson.main}return null};return{require_,findEntrypoint,build,entrypointCallback}}var import_node_path3,import_node_fs2,import_node_module2,init_generate_node_builder_functions=__esm({"src/generate-node-builder-functions.ts"(){"use strict";init_glob();import_node_path3=require("path"),import_node_fs2=__toESM(require("fs")),import_node_module2=require("module")}});var require_dist2=__commonJS({"../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});function lexer(str){for(var tokens=[],i=0;i<str.length;){var char=str[i];if(char==="*"||char==="+"||char==="?"){tokens.push({type:"MODIFIER",index:i,value:str[i++]});continue}if(char==="\\"){tokens.push({type:"ESCAPED_CHAR",index:i++,value:str[i++]});continue}if(char==="{"){tokens.push({type:"OPEN",index:i,value:str[i++]});continue}if(char==="}"){tokens.push({type:"CLOSE",index:i,value:str[i++]});continue}if(char===":"){for(var name="",j=i+1;j<str.length;){var code=str.charCodeAt(j);if(code>=48&&code<=57||code>=65&&code<=90||code>=97&&code<=122||code===95){name+=str[j++];continue}break}if(!name)throw new TypeError("Missing parameter name at "+i);tokens.push({type:"NAME",index:i,value:name}),i=j;continue}if(char==="("){var count=1,pattern="",j=i+1;if(str[j]==="?")throw new TypeError('Pattern cannot start with "?" at '+j);for(;j<str.length;){if(str[j]==="\\"){pattern+=str[j++]+str[j++];continue}if(str[j]===")"){if(count--,count===0){j++;break}}else if(str[j]==="("&&(count++,str[j+1]!=="?"))throw new TypeError("Capturing groups are not allowed at "+j);pattern+=str[j++]}if(count)throw new TypeError("Unbalanced pattern at "+i);if(!pattern)throw new TypeError("Missing pattern at "+i);tokens.push({type:"PATTERN",index:i,value:pattern}),i=j;continue}tokens.push({type:"CHAR",index:i,value:str[i++]})}return tokens.push({type:"END",index:i,value:""}),tokens}function parse6(str,options){options===void 0&&(options={});for(var tokens=lexer(str),_a=options.prefixes,prefixes=_a===void 0?"./":_a,defaultPattern="[^"+escapeString(options.delimiter||"/#?")+"]+?",result=[],key=0,i=0,path9="",tryConsume=function(type){if(i<tokens.length&&tokens[i].type===type)return tokens[i++].value},mustConsume=function(type){var value2=tryConsume(type);if(value2!==void 0)return value2;var _a2=tokens[i],nextType=_a2.type,index=_a2.index;throw new TypeError("Unexpected "+nextType+" at "+index+", expected "+type)},consumeText=function(){for(var result2="",value2;value2=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR");)result2+=value2;return result2};i<tokens.length;){var char=tryConsume("CHAR"),name=tryConsume("NAME"),pattern=tryConsume("PATTERN");if(name||pattern){var prefix=char||"";prefixes.indexOf(prefix)===-1&&(path9+=prefix,prefix=""),path9&&(result.push(path9),path9=""),result.push({name:name||key++,prefix,suffix:"",pattern:pattern||defaultPattern,modifier:tryConsume("MODIFIER")||""});continue}var value=char||tryConsume("ESCAPED_CHAR");if(value){path9+=value;continue}path9&&(result.push(path9),path9="");var open=tryConsume("OPEN");if(open){var prefix=consumeText(),name_1=tryConsume("NAME")||"",pattern_1=tryConsume("PATTERN")||"",suffix=consumeText();mustConsume("CLOSE"),result.push({name:name_1||(pattern_1?key++:""),pattern:name_1&&!pattern_1?defaultPattern:pattern_1,prefix,suffix,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return result}exports2.parse=parse6;function compile(str,options){return tokensToFunction(parse6(str,options),options)}exports2.compile=compile;function tokensToFunction(tokens,options){options===void 0&&(options={});var reFlags=flags(options),_a=options.encode,encode=_a===void 0?function(x){return x}:_a,_b=options.validate,validate=_b===void 0?!0:_b,matches=tokens.map(function(token){if(typeof token=="object")return new RegExp("^(?:"+token.pattern+")$",reFlags)});return function(data){for(var path9="",i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token=="string"){path9+=token;continue}var value=data?data[token.name]:void 0,optional=token.modifier==="?"||token.modifier==="*",repeat=token.modifier==="*"||token.modifier==="+";if(Array.isArray(value)){if(!repeat)throw new TypeError('Expected "'+token.name+'" to not repeat, but got an array');if(value.length===0){if(optional)continue;throw new TypeError('Expected "'+token.name+'" to not be empty')}for(var j=0;j<value.length;j++){var segment=encode(value[j],token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected all "'+token.name+'" to match "'+token.pattern+'", but got "'+segment+'"');path9+=token.prefix+segment+token.suffix}continue}if(typeof value=="string"||typeof value=="number"){var segment=encode(String(value),token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected "'+token.name+'" to match "'+token.pattern+'", but got "'+segment+'"');path9+=token.prefix+segment+token.suffix;continue}if(!optional){var typeOfMessage=repeat?"an array":"a string";throw new TypeError('Expected "'+token.name+'" to be '+typeOfMessage)}}return path9}}exports2.tokensToFunction=tokensToFunction;function match(str,options){var keys=[],re=pathToRegexp3(str,keys,options);return regexpToFunction(re,keys,options)}exports2.match=match;function regexpToFunction(re,keys,options){options===void 0&&(options={});var _a=options.decode,decode=_a===void 0?function(x){return x}:_a;return function(pathname){var m=re.exec(pathname);if(!m)return!1;for(var path9=m[0],index=m.index,params=Object.create(null),_loop_1=function(i2){if(m[i2]===void 0)return"continue";var key=keys[i2-1];key.modifier==="*"||key.modifier==="+"?params[key.name]=m[i2].split(key.prefix+key.suffix).map(function(value){return decode(value,key)}):params[key.name]=decode(m[i2],key)},i=1;i<m.length;i++)_loop_1(i);return{path:path9,index,params}}}exports2.regexpToFunction=regexpToFunction;function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(options){return options&&options.sensitive?"":"i"}function regexpToRegexp(path9,keys){if(!keys)return path9;var groups=path9.source.match(/\((?!\?)/g);if(groups)for(var i=0;i<groups.length;i++)keys.push({name:i,prefix:"",suffix:"",modifier:"",pattern:""});return path9}function arrayToRegexp(paths,keys,options){var parts=paths.map(function(path9){return pathToRegexp3(path9,keys,options).source});return new RegExp("(?:"+parts.join("|")+")",flags(options))}function stringToRegexp(path9,keys,options){return tokensToRegexp(parse6(path9,options),keys,options)}function tokensToRegexp(tokens,keys,options){options===void 0&&(options={});for(var _a=options.strict,strict=_a===void 0?!1:_a,_b=options.start,start=_b===void 0?!0:_b,_c=options.end,end=_c===void 0?!0:_c,_d=options.encode,encode=_d===void 0?function(x){return x}:_d,endsWith="["+escapeString(options.endsWith||"")+"]|$",delimiter2="["+escapeString(options.delimiter||"/#?")+"]",route=start?"^":"",_i=0,tokens_1=tokens;_i<tokens_1.length;_i++){var token=tokens_1[_i];if(typeof token=="string")route+=escapeString(encode(token));else{var prefix=escapeString(encode(token.prefix)),suffix=escapeString(encode(token.suffix));if(token.pattern)if(keys&&keys.push(token),prefix||suffix)if(token.modifier==="+"||token.modifier==="*"){var mod=token.modifier==="*"?"?":"";route+="(?:"+prefix+"((?:"+token.pattern+")(?:"+suffix+prefix+"(?:"+token.pattern+"))*)"+suffix+")"+mod}else route+="(?:"+prefix+"("+token.pattern+")"+suffix+")"+token.modifier;else route+="("+token.pattern+")"+token.modifier;else route+="(?:"+prefix+suffix+")"+token.modifier}}if(end)strict||(route+=delimiter2+"?"),route+=options.endsWith?"(?="+endsWith+")":"$";else{var endToken=tokens[tokens.length-1],isEndDelimited=typeof endToken=="string"?delimiter2.indexOf(endToken[endToken.length-1])>-1:endToken===void 0;strict||(route+="(?:"+delimiter2+"(?="+endsWith+"))?"),isEndDelimited||(route+="(?="+delimiter2+"|"+endsWith+")")}return new RegExp(route,flags(options))}exports2.tokensToRegexp=tokensToRegexp;function pathToRegexp3(path9,keys,options){return path9 instanceof RegExp?regexpToRegexp(path9,keys):Array.isArray(path9)?arrayToRegexp(path9,keys,options):stringToRegexp(path9,keys,options)}exports2.pathToRegexp=pathToRegexp3}});var require_dist3=__commonJS({"../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.pathToRegexp=exports2.tokensToRegexp=exports2.regexpToFunction=exports2.match=exports2.tokensToFunction=exports2.compile=exports2.parse=void 0;function lexer(str){for(var tokens=[],i=0;i<str.length;){var char=str[i];if(char==="*"||char==="+"||char==="?"){tokens.push({type:"MODIFIER",index:i,value:str[i++]});continue}if(char==="\\"){tokens.push({type:"ESCAPED_CHAR",index:i++,value:str[i++]});continue}if(char==="{"){tokens.push({type:"OPEN",index:i,value:str[i++]});continue}if(char==="}"){tokens.push({type:"CLOSE",index:i,value:str[i++]});continue}if(char===":"){for(var name="",j=i+1;j<str.length;){var code=str.charCodeAt(j);if(code>=48&&code<=57||code>=65&&code<=90||code>=97&&code<=122||code===95){name+=str[j++];continue}break}if(!name)throw new TypeError("Missing parameter name at ".concat(i));tokens.push({type:"NAME",index:i,value:name}),i=j;continue}if(char==="("){var count=1,pattern="",j=i+1;if(str[j]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(j));for(;j<str.length;){if(str[j]==="\\"){pattern+=str[j++]+str[j++];continue}if(str[j]===")"){if(count--,count===0){j++;break}}else if(str[j]==="("&&(count++,str[j+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(j));pattern+=str[j++]}if(count)throw new TypeError("Unbalanced pattern at ".concat(i));if(!pattern)throw new TypeError("Missing pattern at ".concat(i));tokens.push({type:"PATTERN",index:i,value:pattern}),i=j;continue}tokens.push({type:"CHAR",index:i,value:str[i++]})}return tokens.push({type:"END",index:i,value:""}),tokens}function parse6(str,options){options===void 0&&(options={});for(var tokens=lexer(str),_a=options.prefixes,prefixes=_a===void 0?"./":_a,_b=options.delimiter,delimiter2=_b===void 0?"/#?":_b,result=[],key=0,i=0,path9="",tryConsume=function(type){if(i<tokens.length&&tokens[i].type===type)return tokens[i++].value},mustConsume=function(type){var value2=tryConsume(type);if(value2!==void 0)return value2;var _a2=tokens[i],nextType=_a2.type,index=_a2.index;throw new TypeError("Unexpected ".concat(nextType," at ").concat(index,", expected ").concat(type))},consumeText=function(){for(var result2="",value2;value2=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR");)result2+=value2;return result2},isSafe=function(value2){for(var _i=0,delimiter_1=delimiter2;_i<delimiter_1.length;_i++){var char2=delimiter_1[_i];if(value2.indexOf(char2)>-1)return!0}return!1},safePattern=function(prefix2){var prev=result[result.length-1],prevText=prefix2||(prev&&typeof prev=="string"?prev:"");if(prev&&!prevText)throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name,'"'));return!prevText||isSafe(prevText)?"[^".concat(escapeString(delimiter2),"]+?"):"(?:(?!".concat(escapeString(prevText),")[^").concat(escapeString(delimiter2),"])+?")};i<tokens.length;){var char=tryConsume("CHAR"),name=tryConsume("NAME"),pattern=tryConsume("PATTERN");if(name||pattern){var prefix=char||"";prefixes.indexOf(prefix)===-1&&(path9+=prefix,prefix=""),path9&&(result.push(path9),path9=""),result.push({name:name||key++,prefix,suffix:"",pattern:pattern||safePattern(prefix),modifier:tryConsume("MODIFIER")||""});continue}var value=char||tryConsume("ESCAPED_CHAR");if(value){path9+=value;continue}path9&&(result.push(path9),path9="");var open=tryConsume("OPEN");if(open){var prefix=consumeText(),name_1=tryConsume("NAME")||"",pattern_1=tryConsume("PATTERN")||"",suffix=consumeText();mustConsume("CLOSE"),result.push({name:name_1||(pattern_1?key++:""),pattern:name_1&&!pattern_1?safePattern(prefix):pattern_1,prefix,suffix,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return result}exports2.parse=parse6;function compile(str,options){return tokensToFunction(parse6(str,options),options)}exports2.compile=compile;function tokensToFunction(tokens,options){options===void 0&&(options={});var reFlags=flags(options),_a=options.encode,encode=_a===void 0?function(x){return x}:_a,_b=options.validate,validate=_b===void 0?!0:_b,matches=tokens.map(function(token){if(typeof token=="object")return new RegExp("^(?:".concat(token.pattern,")$"),reFlags)});return function(data){for(var path9="",i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token=="string"){path9+=token;continue}var value=data?data[token.name]:void 0,optional=token.modifier==="?"||token.modifier==="*",repeat=token.modifier==="*"||token.modifier==="+";if(Array.isArray(value)){if(!repeat)throw new TypeError('Expected "'.concat(token.name,'" to not repeat, but got an array'));if(value.length===0){if(optional)continue;throw new TypeError('Expected "'.concat(token.name,'" to not be empty'))}for(var j=0;j<value.length;j++){var segment=encode(value[j],token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected all "'.concat(token.name,'" to match "').concat(token.pattern,'", but got "').concat(segment,'"'));path9+=token.prefix+segment+token.suffix}continue}if(typeof value=="string"||typeof value=="number"){var segment=encode(String(value),token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected "'.concat(token.name,'" to match "').concat(token.pattern,'", but got "').concat(segment,'"'));path9+=token.prefix+segment+token.suffix;continue}if(!optional){var typeOfMessage=repeat?"an array":"a string";throw new TypeError('Expected "'.concat(token.name,'" to be ').concat(typeOfMessage))}}return path9}}exports2.tokensToFunction=tokensToFunction;function match(str,options){var keys=[],re=pathToRegexp3(str,keys,options);return regexpToFunction(re,keys,options)}exports2.match=match;function regexpToFunction(re,keys,options){options===void 0&&(options={});var _a=options.decode,decode=_a===void 0?function(x){return x}:_a;return function(pathname){var m=re.exec(pathname);if(!m)return!1;for(var path9=m[0],index=m.index,params=Object.create(null),_loop_1=function(i2){if(m[i2]===void 0)return"continue";var key=keys[i2-1];key.modifier==="*"||key.modifier==="+"?params[key.name]=m[i2].split(key.prefix+key.suffix).map(function(value){return decode(value,key)}):params[key.name]=decode(m[i2],key)},i=1;i<m.length;i++)_loop_1(i);return{path:path9,index,params}}}exports2.regexpToFunction=regexpToFunction;function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(options){return options&&options.sensitive?"":"i"}function regexpToRegexp(path9,keys){if(!keys)return path9;for(var groupsRegex=/\((?:\?<(.*?)>)?(?!\?)/g,index=0,execResult=groupsRegex.exec(path9.source);execResult;)keys.push({name:execResult[1]||index++,prefix:"",suffix:"",modifier:"",pattern:""}),execResult=groupsRegex.exec(path9.source);return path9}function arrayToRegexp(paths,keys,options){var parts=paths.map(function(path9){return pathToRegexp3(path9,keys,options).source});return new RegExp("(?:".concat(parts.join("|"),")"),flags(options))}function stringToRegexp(path9,keys,options){return tokensToRegexp(parse6(path9,options),keys,options)}function tokensToRegexp(tokens,keys,options){options===void 0&&(options={});for(var _a=options.strict,strict=_a===void 0?!1:_a,_b=options.start,start=_b===void 0?!0:_b,_c=options.end,end=_c===void 0?!0:_c,_d=options.encode,encode=_d===void 0?function(x){return x}:_d,_e=options.delimiter,delimiter2=_e===void 0?"/#?":_e,_f=options.endsWith,endsWith=_f===void 0?"":_f,endsWithRe="[".concat(escapeString(endsWith),"]|$"),delimiterRe="[".concat(escapeString(delimiter2),"]"),route=start?"^":"",_i=0,tokens_1=tokens;_i<tokens_1.length;_i++){var token=tokens_1[_i];if(typeof token=="string")route+=escapeString(encode(token));else{var prefix=escapeString(encode(token.prefix)),suffix=escapeString(encode(token.suffix));if(token.pattern)if(keys&&keys.push(token),prefix||suffix)if(token.modifier==="+"||token.modifier==="*"){var mod=token.modifier==="*"?"?":"";route+="(?:".concat(prefix,"((?:").concat(token.pattern,")(?:").concat(suffix).concat(prefix,"(?:").concat(token.pattern,"))*)").concat(suffix,")").concat(mod)}else route+="(?:".concat(prefix,"(").concat(token.pattern,")").concat(suffix,")").concat(token.modifier);else{if(token.modifier==="+"||token.modifier==="*")throw new TypeError('Can not repeat "'.concat(token.name,'" without a prefix and suffix'));route+="(".concat(token.pattern,")").concat(token.modifier)}else route+="(?:".concat(prefix).concat(suffix,")").concat(token.modifier)}}if(end)strict||(route+="".concat(delimiterRe,"?")),route+=options.endsWith?"(?=".concat(endsWithRe,")"):"$";else{var endToken=tokens[tokens.length-1],isEndDelimited=typeof endToken=="string"?delimiterRe.indexOf(endToken[endToken.length-1])>-1:endToken===void 0;strict||(route+="(?:".concat(delimiterRe,"(?=").concat(endsWithRe,"))?")),isEndDelimited||(route+="(?=".concat(delimiterRe,"|").concat(endsWithRe,")"))}return new RegExp(route,flags(options))}exports2.tokensToRegexp=tokensToRegexp;function pathToRegexp3(path9,keys,options){return path9 instanceof RegExp?regexpToRegexp(path9,keys):Array.isArray(path9)?arrayToRegexp(path9,keys,options):stringToRegexp(path9,keys,options)}exports2.pathToRegexp=pathToRegexp3}});var require_superstatic=__commonJS({"../routing-utils/dist/superstatic.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),superstatic_exports={};__export3(superstatic_exports,{collectHasSegments:()=>collectHasSegments,compilePathToRegexpTemplate:()=>compilePathToRegexpTemplate2,convertCleanUrls:()=>convertCleanUrls,convertHeaders:()=>convertHeaders,convertRedirects:()=>convertRedirects,convertRewrites:()=>convertRewrites2,convertTrailingSlash:()=>convertTrailingSlash,getCleanUrls:()=>getCleanUrls2,pathToRegexp:()=>pathToRegexp3,sourceToRegex:()=>sourceToRegex2});module2.exports=__toCommonJS3(superstatic_exports);var import_url=require("url"),import_path_to_regexp=require_dist2(),import_path_to_regexp_updated=require_dist3();function cloneKeys(keys){if(!(typeof keys>"u"))return keys.slice(0)}function compareKeys(left,right){let leftSerialized=typeof left>"u"?"undefined":left.toString(),rightSerialized=typeof right>"u"?"undefined":right.toString();return leftSerialized===rightSerialized}function pathToRegexp3(callerId,path9,keys,options){let newKeys=cloneKeys(keys),currentRegExp=(0,import_path_to_regexp.pathToRegexp)(path9,keys,options);try{let currentKeys=keys,newRegExp=(0,import_path_to_regexp_updated.pathToRegexp)(path9,newKeys,options),isDiffRegExp=currentRegExp.toString()!==newRegExp.toString();if(process.env.FORCE_PATH_TO_REGEXP_LOG||isDiffRegExp){let message=JSON.stringify({path:path9,currentRegExp:currentRegExp.toString(),newRegExp:newRegExp.toString()});console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`)}let isDiffKeys=!compareKeys(keys,newKeys);if(process.env.FORCE_PATH_TO_REGEXP_LOG||isDiffKeys){let message=JSON.stringify({isDiffKeys,currentKeys,newKeys});console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`)}}catch(err){let message=JSON.stringify({path:path9,error:err.message});console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`)}return currentRegExp}var UN_NAMED_SEGMENT="__UN_NAMED_SEGMENT__";function getCleanUrls2(filePaths){return filePaths.map(toRoute).filter(f=>f.endsWith(".html")).map(f=>({html:f,clean:f.slice(0,-5)}))}function convertCleanUrls(cleanUrls,trailingSlash,status=308){let routes=[];if(cleanUrls){let loc=trailingSlash?"/$1/":"/$1";routes.push({src:"^/(?:(.+)/)?index(?:\\.html)?/?$",headers:{Location:loc},status}),routes.push({src:"^/(.*)\\.html/?$",headers:{Location:loc},status})}return routes}function convertRedirects(redirects,defaultStatus=308){return redirects.map(r=>{let{src,segments}=sourceToRegex2(r.source),hasSegments=collectHasSegments(r.has);normalizeHasKeys(r.has),normalizeHasKeys(r.missing);try{let loc=replaceSegments(segments,hasSegments,r.destination,!0),status;typeof r.permanent=="boolean"?status=r.permanent?308:307:r.statusCode?status=r.statusCode:status=defaultStatus;let route={src,headers:{Location:loc},status};return typeof r.env<"u"&&(route.env=r.env),r.has&&(route.has=r.has),r.missing&&(route.missing=r.missing),route}catch{throw new Error(`Failed to parse redirect: ${JSON.stringify(r)}`)}})}function convertRewrites2(rewrites,internalParamNames){return rewrites.map(r=>{let{src,segments}=sourceToRegex2(r.source),hasSegments=collectHasSegments(r.has);normalizeHasKeys(r.has),normalizeHasKeys(r.missing);try{let interpolate=value=>replaceSegments(segments,hasSegments,value,!1,internalParamNames),route;if(typeof r.destination=="string")route={src,dest:interpolate(r.destination),check:!0};else{let destination={...r.destination,type:"service"};typeof destination.path=="string"&&(destination.path=interpolate(destination.path)),route={src,destination}}return r.transforms&&(route.transforms=r.transforms.map(transform=>transform.type!=="request.path"?{...transform}:{...transform,args:compilePathToRegexpTemplateFromSegments(transform.args,segments,hasSegments,transform.env)})),typeof r.env<"u"&&(route.env=r.env),r.has&&(route.has=r.has),r.missing&&(route.missing=r.missing),r.statusCode&&(route.status=r.statusCode),route}catch{throw new Error(`Failed to parse rewrite: ${JSON.stringify(r)}`)}})}function convertHeaders(headers){return headers.map(h=>{let obj={},{src,segments}=sourceToRegex2(h.source),hasSegments=collectHasSegments(h.has);normalizeHasKeys(h.has),normalizeHasKeys(h.missing);let namedSegments=segments.filter(name=>name!==UN_NAMED_SEGMENT),indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index)}),hasSegments.forEach(name=>{indexes[name]="$"+name}),h.headers.forEach(({key,value})=>{(namedSegments.length>0||hasSegments.length>0)&&(key.includes(":")&&(key=safelyCompile(key,indexes)),value.includes(":")&&(value=safelyCompile(value,indexes))),obj[key]=value});let route={src,headers:obj,continue:!0};return h.has&&(route.has=h.has),h.missing&&(route.missing=h.missing),route})}function convertTrailingSlash(enable,status=308){let routes=[];return enable?(routes.push({src:"^/\\.well-known(?:/.*)?$"}),routes.push({src:"^/((?:[^/]+/)*[^/\\.]+)$",headers:{Location:"/$1/"},status}),routes.push({src:"^/((?:[^/]+/)*[^/]+\\.\\w+)/$",headers:{Location:"/$1"},status})):routes.push({src:"^/(.*)\\/$",headers:{Location:"/$1"},status}),routes}function sourceToRegex2(source){let keys=[],r=pathToRegexp3("632",source,keys,{strict:!0,sensitive:!0,delimiter:"/"}),segments=keys.map(k=>k.name).map(name=>typeof name!="string"?UN_NAMED_SEGMENT:name);return{src:r.source,segments}}var namedGroupsRegex=/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g,normalizeHasKeys=(hasItems=[])=>{for(let hasItem of hasItems)"key"in hasItem&&hasItem.type==="header"&&(hasItem.key=hasItem.key.toLowerCase());return hasItems};function getStringValueForRegex(value){return typeof value=="string"?value:value&&typeof value=="object"&&value!==null&&"re"in value&&typeof value.re=="string"?value.re:null}function collectHasSegments(has){let hasSegments=new Set;for(let hasItem of has||[]){!hasItem.value&&"key"in hasItem&&hasSegments.add(hasItem.key);let stringValue=getStringValueForRegex(hasItem.value);if(stringValue){for(let match of stringValue.matchAll(namedGroupsRegex))match[1]&&hasSegments.add(match[1]);hasItem.type==="host"&&hasSegments.add("host")}}return[...hasSegments]}var escapeSegment=(str,segmentName)=>str.replace(new RegExp(`:${segmentName}`,"g"),`__ESC_COLON_${segmentName}`),unescapeSegments=str=>str.replace(/__ESC_COLON_/gi,":"),pathTemplateSegmentNameRegex=/^([a-zA-Z_][a-zA-Z0-9_]*)/;function isEscaped2(value,index){let backslashCount=0;for(let i=index-1;i>=0&&value[i]==="\\";i--)backslashCount++;return backslashCount%2===1}function collectPathTemplateSegments(template){let segments=[];for(let i=0;i<template.length;i++){if(template[i]!==":"||isEscaped2(template,i))continue;let match=template.slice(i+1).match(pathTemplateSegmentNameRegex);match&&(segments.push(match[1]),i+=match[1].length)}return segments}function collectNamedDollarReferences(template){let references=[];for(let i=0;i<template.length;i++){if(template[i]!=="$"||isEscaped2(template,i))continue;let remainder=template.slice(i+1),bracedMatch=remainder.match(/^\{([a-zA-Z_][a-zA-Z0-9_]*)\}/),unbracedMatch=remainder.match(pathTemplateSegmentNameRegex),name=bracedMatch?.[1]||unbracedMatch?.[1];name&&references.push(name)}return references}function compilePathToRegexpTemplateFromSegments(template,segments,hasItemSegments,env=[]){let indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index)}),hasItemSegments.forEach(name=>{indexes[name]=`$${name}`});for(let name of collectPathTemplateSegments(template))if(!(name in indexes))throw new Error(`Path template references parameter ":${name}" that is not present in the source or has conditions.`);let routeParameters=new Set([...segments.filter(name=>name!==UN_NAMED_SEGMENT),...hasItemSegments]);for(let name of collectNamedDollarReferences(template))if(routeParameters.has(name)&&!env.includes(name))throw new Error(`Path template references route parameter "${name}" as \`$${name}\`. Use \`:${name}\` path-to-regexp syntax in high-level rewrites, or list "${name}" in the transform env allowlist if it is an environment variable.`);return safelyCompile(template,indexes,!0)}function compilePathToRegexpTemplate2(source,template,has,env){let{segments}=sourceToRegex2(source);return compilePathToRegexpTemplateFromSegments(template,segments,collectHasSegments(has),env)}function replaceSegments(segments,hasItemSegments,destination,isRedirect,internalParamNames){let namedSegments=segments.filter(name=>name!==UN_NAMED_SEGMENT);if(!(destination.includes(":")&&namedSegments.length>0||hasItemSegments.length>0||!isRedirect))return destination;let escapedDestination=destination,indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index),escapedDestination=escapeSegment(escapedDestination,name)}),hasItemSegments.forEach(name=>{indexes[name]="$"+name,escapedDestination=escapeSegment(escapedDestination,name)});let parsedDestination=(0,import_url.parse)(escapedDestination,!0);delete parsedDestination.href,delete parsedDestination.path,delete parsedDestination.search,delete parsedDestination.host;let{pathname,hash,query,hostname,...rest}=parsedDestination;pathname=unescapeSegments(pathname||""),hash=unescapeSegments(hash||""),hostname=unescapeSegments(hostname||"");let destParams=new Set,pathnameKeys=[],hashKeys=[],hostnameKeys=[];try{pathToRegexp3("528",pathname,pathnameKeys),pathToRegexp3("834",hash||"",hashKeys),pathToRegexp3("712",hostname||"",hostnameKeys)}catch{}destParams=new Set([...pathnameKeys,...hashKeys,...hostnameKeys].map(key=>key.name).filter(val=>typeof val=="string")),pathname=safelyCompile(pathname,indexes,!0),hash=hash?safelyCompile(hash,indexes,!0):null,hostname=hostname?safelyCompile(hostname,indexes,!0):null;for(let[key,strOrArray]of Object.entries(query))Array.isArray(strOrArray)?query[key]=strOrArray.map(str=>safelyCompile(unescapeSegments(str),indexes,!0)):query[key]=safelyCompile(unescapeSegments(strOrArray),indexes,!0);let paramKeys=Object.keys(indexes);if(!isRedirect&&!paramKeys.some(param=>!(internalParamNames&&internalParamNames.includes(param))&&destParams.has(param)))for(let param of paramKeys)!(param in query)&¶m!==UN_NAMED_SEGMENT&&(query[param]=indexes[param]);return destination=(0,import_url.format)({...rest,hostname,pathname,query,hash}),destination.replace(/%24/g,"$")}function safelyCompile(value,indexes,attemptDirectCompile){if(!value)return value;if(attemptDirectCompile)try{return(0,import_path_to_regexp.compile)(value,{validate:!1})(indexes)}catch{}for(let key of Object.keys(indexes))value.includes(`:${key}`)&&(value=value.replace(new RegExp(`:${key}\\*`,"g"),`:${key}--ESCAPED_PARAM_ASTERISK`).replace(new RegExp(`:${key}\\?`,"g"),`:${key}--ESCAPED_PARAM_QUESTION`).replace(new RegExp(`:${key}\\+`,"g"),`:${key}--ESCAPED_PARAM_PLUS`).replace(new RegExp(`:${key}(?!\\w)`,"g"),`--ESCAPED_PARAM_COLON${key}`));return value=value.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g,"\\$1").replace(/--ESCAPED_PARAM_PLUS/g,"+").replace(/--ESCAPED_PARAM_COLON/g,":").replace(/--ESCAPED_PARAM_QUESTION/g,"?").replace(/--ESCAPED_PARAM_ASTERISK/g,"*"),(0,import_path_to_regexp.compile)(`/${value}`,{validate:!1})(indexes).slice(1)}function toSegmentDest(index){return"$"+(index+1).toString()}function toRoute(filePath){return filePath.startsWith("/")?filePath:"/"+filePath}}});var require_append=__commonJS({"../routing-utils/dist/append.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),append_exports={};__export3(append_exports,{appendRoutesToPhase:()=>appendRoutesToPhase2});module2.exports=__toCommonJS3(append_exports);var import_index=require_dist4();function appendRoutesToPhase2({routes:prevRoutes,newRoutes,phase}){let routes=prevRoutes?[...prevRoutes]:[];if(newRoutes===null||newRoutes.length===0)return routes;let isInPhase=!1,insertIndex=-1;if(routes.forEach((r,i)=>{(0,import_index.isHandler)(r)&&(r.handle===phase?isInPhase=!0:isInPhase&&(insertIndex=i,isInPhase=!1))}),isInPhase)routes.push(...newRoutes);else if(phase===null){let lastPhase=routes.findIndex(r=>(0,import_index.isHandler)(r)&&r.handle);lastPhase===-1?routes.push(...newRoutes):routes.splice(lastPhase,0,...newRoutes)}else insertIndex>-1?routes.splice(insertIndex,0,...newRoutes):(routes.push({handle:phase}),routes.push(...newRoutes));return routes}}});var require_merge2=__commonJS({"../routing-utils/dist/merge.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),merge_exports={};__export3(merge_exports,{mergeRoutes:()=>mergeRoutes2});module2.exports=__toCommonJS3(merge_exports);var import_index=require_dist4();function getBuilderRoutesMapping(builds){let builderRoutes={};for(let{entrypoint,routes,use}of builds)routes&&(builderRoutes[entrypoint]||(builderRoutes[entrypoint]={}),builderRoutes[entrypoint][use]=routes);return builderRoutes}function addToHandleMap(path9,routesMapping,handleMap){let br=routesMapping[path9];Object.keys(br).sort().forEach(use=>{let prevHandle=null;br[use].forEach(route=>{if((0,import_index.isHandler)(route))prevHandle=route.handle;else{let routes=handleMap.get(prevHandle);routes?routes.push(route):handleMap.set(prevHandle,[route])}})})}function getCheckAndContinue(routes){let checks=[],continues=[],others=[];for(let route of routes){if((0,import_index.isHandler)(route))throw new Error(`Unexpected route found in getCheckAndContinue(): ${JSON.stringify(route)}`);route.check&&!route.override?checks.push(route):route.continue&&!route.override?continues.push(route):others.push(route)}return{checks,continues,others}}function mergeRoutes2({userRoutes,builds}){let userHandleMap=new Map,userPrevHandle=null;(userRoutes||[]).forEach(route=>{if((0,import_index.isHandler)(route))userPrevHandle=route.handle;else{let routes=userHandleMap.get(userPrevHandle);routes?routes.push(route):userHandleMap.set(userPrevHandle,[route])}});let projectHandleMap=new Map,projectMiddlewareRoutes=getBuilderRoutesMapping(builds.filter(b=>b.projectMiddleware));Object.keys(projectMiddlewareRoutes).sort().forEach(path9=>addToHandleMap(path9,projectMiddlewareRoutes,projectHandleMap));let builderHandleMap=new Map,builderRoutes=getBuilderRoutesMapping(builds.filter(b=>!b.projectMiddleware));Object.keys(builderRoutes).sort().forEach(path9=>addToHandleMap(path9,builderRoutes,builderHandleMap));let outputRoutes=[],uniqueHandleValues=new Set([null,...userHandleMap.keys(),...projectHandleMap.keys(),...builderHandleMap.keys()]);for(let handle of uniqueHandleValues){let userRoutes2=userHandleMap.get(handle)||[],projectRoutes=projectHandleMap.get(handle)||[],builderRoutes2=builderHandleMap.get(handle)||[],builderSorted=getCheckAndContinue(builderRoutes2);handle!==null&&(userRoutes2.length>0||projectRoutes.length>0||builderRoutes2.length>0)&&outputRoutes.push({handle}),outputRoutes.push(...builderSorted.continues),outputRoutes.push(...userRoutes2),outputRoutes.push(...projectRoutes),outputRoutes.push(...builderSorted.checks),outputRoutes.push(...builderSorted.others)}return outputRoutes}}});var require_service_route_ownership=__commonJS({"../routing-utils/dist/service-route-ownership.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),service_route_ownership_exports={};__export3(service_route_ownership_exports,{getOwnershipGuard:()=>getOwnershipGuard2,normalizeRoutePrefix:()=>normalizeRoutePrefix2,scopeRouteSourceToOwnership:()=>scopeRouteSourceToOwnership2});module2.exports=__toCommonJS3(service_route_ownership_exports);function normalizeRoutePrefix2(routePrefix){let normalized=routePrefix.startsWith("/")?routePrefix:`/${routePrefix}`;return normalized!=="/"&&normalized.endsWith("/")&&(normalized=normalized.slice(0,-1)),normalized||"/"}function escapeForRegex(value){return value.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function toPrefixMatcher(routePrefix){return`${escapeForRegex(routePrefix)}(?:/|$)`}function isDescendantPrefix(candidate,prefix){return candidate!==prefix&&candidate.startsWith(`${prefix}/`)}function getOwnershipGuard2(ownerPrefix,allRoutePrefixes){let owner=normalizeRoutePrefix2(ownerPrefix),nonRootPrefixes=Array.from(new Set(allRoutePrefixes.map(normalizeRoutePrefix2))).filter(prefix=>prefix!=="/").sort((a,b)=>b.length-a.length);if(owner==="/")return nonRootPrefixes.map(prefix=>`(?!${toPrefixMatcher(prefix)})`).join("");let descendants=nonRootPrefixes.filter(prefix=>isDescendantPrefix(prefix,owner)),positive=`(?=${toPrefixMatcher(owner)})`,negative=descendants.map(prefix=>`(?!${toPrefixMatcher(prefix)})`).join("");return`${positive}${negative}`}function scopeRouteSourceToOwnership2(source,ownershipGuard){if(!ownershipGuard)return source;let inner=source.startsWith("^")?source.slice(1):source;return`^${ownershipGuard}(?:${inner})`}}});var require_schemas=__commonJS({"../routing-utils/dist/schemas.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),schemas_exports2={};__export3(schemas_exports2,{cleanUrlsSchema:()=>cleanUrlsSchema,hasSchema:()=>hasSchema,headersSchema:()=>headersSchema,redirectsSchema:()=>redirectsSchema,rewritesSchema:()=>rewritesSchema,routesSchema:()=>routesSchema,trailingSlashSchema:()=>trailingSlashSchema,transformsSchema:()=>transformsSchema});module2.exports=__toCommonJS3(schemas_exports2);var mitigateSchema={description:"Mitigation action to take on a route",type:"object",additionalProperties:!1,required:["action"],properties:{action:{description:"The mitigation action to take",type:"string",enum:["challenge","deny"]}}},serviceNameSchema={description:"A service name identifier.",type:"string",minLength:1,maxLength:64,pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"},serviceDestinationSchema={description:"A service-targeted destination that delegates routing into a named service from `services`. Identified by the presence of `service`.",type:"object",additionalProperties:!1,required:["service"],properties:{type:{description:"Optional explicit format marker. The destination shape is identified by the `service` property, so `type` is no longer required. When present it must be `service`.",type:"string",enum:["service"]},service:serviceNameSchema,path:{description:"Routing-only path used to select a route inside the target service. It does not mutate the URL observed by user code.",type:"string",maxLength:4096}}},matchableValueSchema={description:"A value to match against. Can be a string (regex) or a condition operation object",anyOf:[{description:"A regular expression used to match thev value. Named groups can be used in the destination.",type:"string",maxLength:4096},{description:"A condition operation object",type:"object",additionalProperties:!1,minProperties:1,properties:{eq:{description:"Equal to",anyOf:[{type:"string",maxLength:4096},{type:"number"}]},neq:{description:"Not equal",type:"string",maxLength:4096},inc:{description:"In array",type:"array",items:{type:"string",maxLength:4096}},ninc:{description:"Not in array",type:"array",items:{type:"string",maxLength:4096}},pre:{description:"Starts with",type:"string",maxLength:4096},suf:{description:"Ends with",type:"string",maxLength:4096},re:{description:"Regex",type:"string",maxLength:4096},gt:{description:"Greater than",type:"number"},gte:{description:"Greater than or equal to",type:"number"},lt:{description:"Less than",type:"number"},lte:{description:"Less than or equal to",type:"number"}}}]},hasSchema={description:"An array of requirements that are needed to match",type:"array",maxItems:16,items:{anyOf:[{type:"object",additionalProperties:!1,required:["type","value"],properties:{type:{description:"The type of request element to check",type:"string",enum:["host"]},value:matchableValueSchema}},{type:"object",additionalProperties:!1,required:["type","key"],properties:{type:{description:"The type of request element to check",type:"string",enum:["header","cookie","query"]},key:{description:"The name of the element contained in the particular type",type:"string",maxLength:4096},value:matchableValueSchema}}]}},transformsSchema={description:"A list of transform rules to adjust a request path, request query parameters, or request/response headers",type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["type","op"],properties:{type:{description:"The scope of the transform to apply",type:"string",enum:["request.headers","request.query","response.headers","request.path"]},op:{description:"The operation to perform on the target",type:"string",enum:["append","set","delete"]},target:{description:"The target of the transform",type:"object",required:["key"],properties:{key:{description:"A value to match against. Can be a string or a condition operation object (without regex support)",anyOf:[{description:"A valid header name (letters, numbers, hyphens, underscores)",type:"string",maxLength:4096},{description:"A condition operation object",type:"object",additionalProperties:!1,minProperties:1,properties:{eq:{description:"Equal to",anyOf:[{type:"string",maxLength:4096},{type:"number"}]},neq:{description:"Not equal",type:"string",maxLength:4096},inc:{description:"In array",type:"array",items:{type:"string",maxLength:4096}},ninc:{description:"Not in array",type:"array",items:{type:"string",maxLength:4096}},pre:{description:"Starts with",type:"string",maxLength:4096},suf:{description:"Ends with",type:"string",maxLength:4096},gt:{description:"Greater than",type:"number"},gte:{description:"Greater than or equal to",type:"number"},lt:{description:"Less than",type:"number"},lte:{description:"Less than or equal to",type:"number"}}}]}}},args:{description:"The arguments to the operation",anyOf:[{type:"string",maxLength:4096},{type:"array",minItems:1,items:{type:"string",maxLength:4096}}]},env:{description:"An array of environment variable names that should be replaced at runtime in the args value",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}}},allOf:[{if:{properties:{op:{enum:["append","set"]}}},then:{required:["args"]}},{if:{allOf:[{properties:{type:{enum:["request.headers","response.headers"]}}},{properties:{op:{enum:["set","append"]}}}]},then:{properties:{target:{properties:{key:{if:{type:"string"},then:{pattern:"^[a-zA-Z0-9_-]+$"}}}},args:{anyOf:[{type:"string",pattern:"^[a-zA-Z0-9_ :;.,\"'?!(){}\\[\\]@<>=+*#$&`|~\\^%/-]+$"},{type:"array",items:{type:"string",pattern:"^[a-zA-Z0-9_ :;.,\"'?!(){}\\[\\]@<>=+*#$&`|~\\^%/-]+$"}}]}}}},{if:{required:["type"],properties:{type:{enum:["request.headers","request.query","response.headers"]}}},then:{required:["target"]}},{if:{required:["type"],properties:{type:{enum:["request.path"]}}},then:{required:["args"],not:{required:["target"]},properties:{op:{enum:["set"]},args:{description:"The runtime-visible request path. Must be an origin-form path without query or fragment.",type:"string",maxLength:2048,pattern:"^/(?!/)(?!.*[?#\\s\\x00-\\x1F\\x7F]).*$"}}}}]}},rewriteTransformsSchema={description:"A list of request path transforms using path-to-regexp parameters.",type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["type","op","args"],properties:{type:{description:"The request path to expose to the target runtime",type:"string",enum:["request.path"]},op:{description:"Replace the runtime-visible request path",type:"string",enum:["set"]},args:{description:"An origin-form request path. Route parameters use path-to-regexp syntax such as `/:path*`.",type:"string",maxLength:2048,pattern:"^/(?!/)(?!.*[?#\\s\\x00-\\x1F\\x7F]).*$"},env:{description:"An array of environment variable names that should be replaced at runtime in the args value",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}}}}},routesSchema={type:"array",description:"A list of routes objects used to rewrite paths to point towards other internal or external paths",example:[{dest:"https://docs.example.com",src:"/docs"}],items:{anyOf:[{type:"object",anyOf:[{required:["src"]},{required:["source"]}],additionalProperties:!1,properties:{src:{type:"string",maxLength:4096},source:{type:"string",maxLength:4096},dest:{type:"string",maxLength:4096},destination:{anyOf:[{type:"string",maxLength:4096},serviceDestinationSchema]},headers:{type:"object",additionalProperties:!1,minProperties:1,maxProperties:100,patternProperties:{"^.{1,256}$":{type:"string",maxLength:32768}}},methods:{type:"array",maxItems:10,items:{type:"string",maxLength:32}},caseSensitive:{type:"boolean"},important:{deprecated:!0,type:"boolean"},user:{type:"boolean"},continue:{type:"boolean"},override:{deprecated:!0,type:"boolean"},check:{type:"boolean"},isInternal:{type:"boolean"},status:{type:"integer",minimum:100,maximum:999},statusCode:{type:"integer",minimum:100,maximum:999},locale:{type:"object",additionalProperties:!1,minProperties:1,properties:{redirect:{type:"object",additionalProperties:!1,minProperties:1,maxProperties:100,patternProperties:{"^.{1,256}$":{type:"string",maxLength:4096}}},value:{type:"string",maxLength:4096},path:{type:"string",maxLength:4096},cookie:{type:"string",maxLength:4096},default:{type:"string",maxLength:4096}}},middleware:{type:"number"},middlewarePath:{type:"string"},middlewareRawSrc:{type:"array",items:{type:"string"}},has:hasSchema,missing:hasSchema,mitigate:mitigateSchema,transforms:transformsSchema,env:{description:"An array of environment variable names that should be replaced at runtime in the destination or headers",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},respectOriginCacheControl:{description:"When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",type:"boolean"}}},{type:"object",deprecated:!0,required:["handle"],additionalProperties:!1,properties:{handle:{type:"string",maxLength:32,enum:["error","filesystem","hit","miss","resource","rewrite"]}}}]}},rewritesSchema={type:"array",maxItems:2048,description:"A list of rewrite definitions.",items:{type:"object",additionalProperties:!1,required:["source","destination"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring).",type:"string",maxLength:4096},destination:{description:"An absolute pathname to an existing resource, an external URL, or a service-targeted destination object.",anyOf:[{type:"string",maxLength:4096},serviceDestinationSchema]},transforms:rewriteTransformsSchema,has:hasSchema,missing:hasSchema,statusCode:{description:"An optional integer to override the status code of the response.",type:"integer",minimum:100,maximum:999},env:{description:"An array of environment variable names that should be replaced at runtime in the destination",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},respectOriginCacheControl:{description:"When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",type:"boolean"}}}},redirectsSchema={title:"Redirects",type:"array",maxItems:2048,description:"A list of redirect definitions.",items:{type:"object",additionalProperties:!1,required:["source","destination"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring) or a full URL including domain.",type:"string",maxLength:4096},destination:{description:"A location destination defined as an absolute pathname or external URL.",type:"string",maxLength:4096},permanent:{description:"A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",type:"boolean"},statusCode:{description:"An optional integer to define the status code of the redirect.",private:!0,type:"integer",minimum:100,maximum:999},has:hasSchema,missing:hasSchema,env:{description:"An array of environment variable names that should be replaced at runtime in the destination",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}}}}},headersSchema={type:"array",maxItems:2048,description:"A list of header definitions.",items:{type:"object",additionalProperties:!1,required:["source","headers"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring)",type:"string",maxLength:4096},headers:{description:"An array of key/value pairs representing each response header.",type:"array",maxItems:1024,items:{type:"object",additionalProperties:!1,required:["key","value"],properties:{key:{type:"string",maxLength:4096},value:{type:"string",maxLength:32768}}}},has:hasSchema,missing:hasSchema}}},cleanUrlsSchema={description:"When set to `true`, all HTML files and Serverless Functions will have their extension removed. When visiting a path that ends with the extension, a 308 response will redirect the client to the extensionless path.",type:"boolean"},trailingSlashSchema={description:"When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.",type:"boolean"}}});var require_types=__commonJS({"../routing-utils/dist/types.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),types_exports2={};module2.exports=__toCommonJS3(types_exports2)}});var require_dist4=__commonJS({"../routing-utils/dist/index.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__reExport2=(target,mod,secondTarget)=>(__copyProps3(target,mod,"default"),secondTarget&&__copyProps3(secondTarget,mod,"default")),__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),src_exports={};__export3(src_exports,{appendRoutesToPhase:()=>import_append.appendRoutesToPhase,compilePathToRegexpTemplate:()=>import_superstatic2.compilePathToRegexpTemplate,convertRewrites:()=>import_superstatic2.convertRewrites,getCleanUrls:()=>import_superstatic2.getCleanUrls,getOwnershipGuard:()=>import_service_route_ownership.getOwnershipGuard,getTransformedRoutes:()=>getTransformedRoutes,isHandler:()=>isHandler,isValidHandleValue:()=>isValidHandleValue,mergeRoutes:()=>import_merge.mergeRoutes,normalizeRoutePrefix:()=>import_service_route_ownership.normalizeRoutePrefix,normalizeRoutes:()=>normalizeRoutes,pathToRegexp:()=>import_superstatic2.pathToRegexp,scopeRouteSourceToOwnership:()=>import_service_route_ownership.scopeRouteSourceToOwnership,sourceToRegex:()=>import_superstatic2.sourceToRegex});module2.exports=__toCommonJS3(src_exports);var import_url=require("url"),import_superstatic=require_superstatic(),import_append=require_append(),import_merge=require_merge2(),import_service_route_ownership=require_service_route_ownership();__reExport2(src_exports,require_schemas(),module2.exports);var import_superstatic2=require_superstatic();__reExport2(src_exports,require_types(),module2.exports);var VALID_HANDLE_VALUES=["filesystem","hit","miss","rewrite","error","resource"],validHandleValues=new Set(VALID_HANDLE_VALUES);function isHandler(route){return typeof route.handle<"u"}function isValidHandleValue(handle){return validHandleValues.has(handle)}function convertRouteAliases(route,index){if(route.source!==void 0){if(route.src!==void 0)throw new Error(`Route at index ${index} cannot define both \`src\` and \`source\`. Please use only one.`);route.src=route.source,delete route.source}if(route.destination!==void 0){if(route.dest!==void 0)throw new Error(`Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`);typeof route.destination=="string"?(route.dest=route.destination,delete route.destination):typeof route.destination.service=="string"&&(route.destination={...route.destination,type:"service"})}if(route.statusCode!==void 0){if(route.status!==void 0)throw new Error(`Route at index ${index} cannot define both \`status\` and \`statusCode\`. Please use only one.`);route.status=route.statusCode,delete route.statusCode}}function normalizeRoutes(inputRoutes){if(!inputRoutes||inputRoutes.length===0)return{routes:inputRoutes,error:null};let routes=[],handling=[],errors=[];inputRoutes.forEach((r,i)=>{let route={...r};if(routes.push(route),!isHandler(route))try{convertRouteAliases(route,i)}catch(err){errors.push(err.message)}let keys=Object.keys(route);if(isHandler(route)){let{handle}=route;if(keys.length!==1){let unknownProp=keys.find(prop=>prop!=="handle");errors.push(`Route at index ${i} has unknown property \`${unknownProp}\`.`)}else isValidHandleValue(handle)?handling.includes(handle)?errors.push(`Route at index ${i} is a duplicate. Please use one \`handle: ${handle}\` at most.`):handling.push(handle):errors.push(`Route at index ${i} has unknown handle value \`handle: ${handle}\`.`)}else if(route.src){route.src.startsWith("^")||(route.src=`^${route.src}`),route.src.endsWith("$")||(route.src=`${route.src}$`),route.src=route.src.replace(/\\\//g,"/");let regError=checkRegexSyntax("Route",i,route.src);regError&&errors.push(regError),route.destination&&typeof route.destination=="object"&&route.continue&&errors.push(`Route at index ${i} cannot define \`continue: true\` with a service \`destination\`. The service handoff is terminal.`);let handleValue=handling[handling.length-1];handleValue==="hit"?(route.dest&&errors.push(`Route at index ${i} cannot define \`dest\`/\`destination\` after \`handle: hit\`.`),route.status&&errors.push(`Route at index ${i} cannot define \`status\`/\`statusCode\` after \`handle: hit\`.`),route.continue||errors.push(`Route at index ${i} must define \`continue: true\` after \`handle: hit\`.`)):handleValue==="miss"&&(route.dest&&!route.check?errors.push(`Route at index ${i} must define \`check: true\` after \`handle: miss\`.`):!route.dest&&!route.continue&&errors.push(`Route at index ${i} must define \`continue: true\` after \`handle: miss\`.`))}else errors.push(`Route at index ${i} must define either \`src\` or \`source\` property.`)});let error=errors.length>0?createError("invalid_route",errors,"https://vercel.link/routes-json","Learn More"):null;return{routes,error}}function checkRegexSyntax(type,index,src){try{new RegExp(src)}catch{return`${type} at index ${index} has invalid \`${type==="Route"?"src`/`source":"source"}\` regular expression "${src}".`}return null}function checkPatternSyntax(type,index,{source,destination,has,transforms}){let sourceSegments=new Set,destinationSegments=new Set;try{sourceSegments=new Set((0,import_superstatic.sourceToRegex)(source).segments)}catch{return{message:`${type} at index ${index} has invalid \`source\` pattern "${source}".`,link:"https://vercel.link/invalid-route-source-pattern"}}let destinationString=typeof destination=="string"?destination:typeof destination?.path=="string"?destination.path:void 0;if(destinationString!==void 0){try{let{hostname,pathname,query}=(0,import_url.parse)(destinationString,!0);(0,import_superstatic.sourceToRegex)(hostname||"").segments.forEach(name=>destinationSegments.add(name)),(0,import_superstatic.sourceToRegex)(pathname||"").segments.forEach(name=>destinationSegments.add(name));for(let strOrArray of Object.values(query)){let value=Array.isArray(strOrArray)?strOrArray[0]:strOrArray;(0,import_superstatic.sourceToRegex)(value||"").segments.forEach(name=>destinationSegments.add(name))}}catch{}let hasSegments=(0,import_superstatic.collectHasSegments)(has);for(let segment of destinationSegments)if(!sourceSegments.has(segment)&&!hasSegments.includes(segment))return{message:`${type} at index ${index} has segment ":${segment}" in \`destination\` property but not in \`source\` or \`has\` property.`,link:"https://vercel.link/invalid-route-destination-segment"}}for(let transform of transforms||[])if(transform.type==="request.path")try{(0,import_superstatic.compilePathToRegexpTemplate)(source,transform.args,has,transform.env)}catch(error){return{message:`${type} at index ${index} has an invalid \`request.path\` transform: ${error instanceof Error?error.message:String(error)}`,link:"https://vercel.link/invalid-route-destination-segment"}}return null}function checkRedirect(r,index){return typeof r.permanent<"u"&&typeof r.statusCode<"u"?`Redirect at index ${index} cannot define both \`permanent\` and \`statusCode\` properties.`:null}function createError(code,allErrors,link,action){let errors=Array.isArray(allErrors)?allErrors:[allErrors],message=errors[0];return{name:"RouteApiError",code,message,link,action,errors}}function notEmpty(value){return value!=null}function getTransformedRoutes(vercelConfig){let{cleanUrls,rewrites,redirects,headers,trailingSlash}=vercelConfig,{routes:userRoutes=null}=vercelConfig,routes=null;if(typeof cleanUrls<"u"){let normalized=normalizeRoutes((0,import_superstatic.convertCleanUrls)(cleanUrls,trailingSlash));if(normalized.error)return normalized.error.code="invalid_clean_urls",{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof trailingSlash<"u"){let normalized=normalizeRoutes((0,import_superstatic.convertTrailingSlash)(trailingSlash));if(normalized.error)return normalized.error.code="invalid_trailing_slash",{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(userRoutes){let normalized=normalizeRoutes(userRoutes);if(normalized.error)return{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof redirects<"u"){let code="invalid_redirect",regexErrorMessage=redirects.map((r,i)=>checkRegexSyntax("Redirect",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError("invalid_redirect",regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=redirects.map((r,i)=>checkPatternSyntax("Redirect",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let redirectErrorMessage=redirects.map(checkRedirect).find(notEmpty);if(redirectErrorMessage)return{routes,error:createError(code,redirectErrorMessage,"https://vercel.link/redirects-json","Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertRedirects)(redirects));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof headers<"u"){let code="invalid_header",regexErrorMessage=headers.map((r,i)=>checkRegexSyntax("Header",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError(code,regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=headers.map((r,i)=>checkPatternSyntax("Header",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertHeaders)(headers));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof rewrites<"u"){let code="invalid_rewrite",regexErrorMessage=rewrites.map((r,i)=>checkRegexSyntax("Rewrite",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError(code,regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=rewrites.map((r,i)=>checkPatternSyntax("Rewrite",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertRewrites)(rewrites));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push({handle:"filesystem"}),routes.push(...normalized.routes||[])}return{routes,error:null}}}});var middleware_matcher_exports={};__export(middleware_matcher_exports,{getRegExpFromMatchers:()=>getRegExpFromMatchers,resolveMiddlewareMatcher:()=>resolveMiddlewareMatcher});function getRegExpFromMatchers(matcherOrMatchers){return matcherOrMatchers?(Array.isArray(matcherOrMatchers)?matcherOrMatchers:[matcherOrMatchers]).flatMap(getRegExpFromMatcher).join("|"):"^/.*$"}function resolveMiddlewareMatcher(configuredMatcher,sourceMatcher,entrypoint){if(configuredMatcher!==void 0&&sourceMatcher!==void 0)throw new Error(`${entrypoint}: \`proxy.matcher\` in vercel.json conflicts with \`config.matcher\` exported from the proxy entrypoint. Configure the matcher in only one location.`);return configuredMatcher??sourceMatcher}function getRegExpFromMatcher(matcher,_index,allMatchers){if(typeof matcher!="string")throw new Error("Middleware's `config.matcher` must be a path matcher (string) or an array of path matchers (string[])");if(!matcher.startsWith("/"))throw new Error(`Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`);let regExps=[(0,import_routing_utils.pathToRegexp)("316",matcher).source];return matcher==="/"&&!allMatchers.includes("/index")&®Exps.push((0,import_routing_utils.pathToRegexp)("491","/index").source),regExps}var import_routing_utils,init_middleware_matcher=__esm({"src/middleware-matcher.ts"(){"use strict";import_routing_utils=__toESM(require_dist4())}});var framework_helpers_exports={};__export(framework_helpers_exports,{BACKEND_BUILDERS:()=>BACKEND_BUILDERS,BACKEND_FRAMEWORKS:()=>BACKEND_FRAMEWORKS,PYTHON_FRAMEWORKS:()=>PYTHON_FRAMEWORKS,RUNTIME_FRAMEWORKS:()=>RUNTIME_FRAMEWORKS,UNIFIED_BACKEND_BUILDER:()=>UNIFIED_BACKEND_BUILDER,isBackendBuilder:()=>isBackendBuilder,isBackendFramework:()=>isBackendFramework,isExperimentalBackendsEnabled:()=>isExperimentalBackendsEnabled,isExperimentalBackendsWithoutIntrospectionEnabled:()=>isExperimentalBackendsWithoutIntrospectionEnabled,isNodeBackendFramework:()=>isNodeBackendFramework,isPythonFramework:()=>isPythonFramework,shouldUseExperimentalBackends:()=>shouldUseExperimentalBackends});function isBackendFramework(framework){return framework?BACKEND_FRAMEWORKS.includes(framework):!1}function isNodeBackendFramework(framework){return framework?BACKEND_FRAMEWORKS.includes(framework):!1}function isPythonFramework(framework){return framework?PYTHON_FRAMEWORKS.includes(framework):!1}function isExperimentalBackendsWithoutIntrospectionEnabled(){return process.env.VERCEL_BACKENDS_BUILDS==="1"}function isExperimentalBackendsEnabled(){return isExperimentalBackendsWithoutIntrospectionEnabled()||process.env.VERCEL_EXPERIMENTAL_BACKENDS==="1"||process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD==="1"||process.env.VERCEL_EXPERIMENTAL_HONO_BUILD==="1"}function isBackendBuilder(builder){if(!builder)return!1;if(builder.use===UNIFIED_BACKEND_BUILDER)return!0;let use=builder.use;return BACKEND_BUILDERS.includes(use)}function shouldUseExperimentalBackends(framework){return isExperimentalBackendsEnabled()&&isBackendFramework(framework)}var BACKEND_FRAMEWORKS,PYTHON_FRAMEWORKS,RUNTIME_FRAMEWORKS,BACKEND_BUILDERS,UNIFIED_BACKEND_BUILDER,init_framework_helpers=__esm({"src/framework-helpers.ts"(){"use strict";BACKEND_FRAMEWORKS=["express","hono","h3","koa","nestjs","fastify","elysia"],PYTHON_FRAMEWORKS=["fastapi","flask","django","python","fasthtml"],RUNTIME_FRAMEWORKS=["python"],BACKEND_BUILDERS=["@vercel/express","@vercel/hono","@vercel/h3","@vercel/koa","@vercel/nestjs","@vercel/fastify","@vercel/elysia"],UNIFIED_BACKEND_BUILDER="@vercel/backends"}});function parse4(E3,g2="@"){if(!C)return init.then(()=>parse4(E3));let I=E3.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));let D=C.sa(I-1);if((A?B:Q)(E3,new Uint16Array(C.memory.buffer,D,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g2}:${E3.slice(0,C.e()).split(`
|
|
112
|
+
${entrypointsForMessage}`)};function pluralize(word,count){return count===1?word:`${word}s`}let findEntrypoint=files=>{let possibleEntrypointsInFiles=validFilenames.flatMap(filename=>validExtensions.map(extension=>`${filename}.${extension}`)).filter(entrypoint2=>files[entrypoint2]!==void 0),entrypointsMatchingRegex=possibleEntrypointsInFiles.filter(entrypoint2=>{let file=files[entrypoint2];return checkMatchesRegex(file)}),entrypointsNotMatchingRegex=possibleEntrypointsInFiles.filter(entrypoint2=>{let file=files[entrypoint2];return!checkMatchesRegex(file)}),entrypoint=entrypointsMatchingRegex[0];return entrypointsMatchingRegex.length>1&&console.warn(`Multiple entrypoints found: ${entrypointsMatchingRegex.join(", ")}. Using ${entrypoint}.`),{entrypoint,entrypointsNotMatchingRegex}},checkMatchesRegex=file=>import_node_fs2.default.readFileSync(file.fsPath,"utf-8").match(regex)!==null,findMainPackageEntrypoint=files=>{let packageJson=files["package.json"];if(packageJson&&packageJson.type==="FileFsRef"){let packageJsonContent=import_node_fs2.default.readFileSync(packageJson.fsPath,"utf-8"),packageJsonJson;try{packageJsonJson=JSON.parse(packageJsonContent)}catch{packageJsonJson={}}if("main"in packageJsonJson&&typeof packageJsonJson.main=="string")return packageJsonJson.main}return null};return{require_,findEntrypoint,build,entrypointCallback}}var import_node_path3,import_node_fs2,import_node_module2,init_generate_node_builder_functions=__esm({"src/generate-node-builder-functions.ts"(){"use strict";init_glob();import_node_path3=require("path"),import_node_fs2=__toESM(require("fs")),import_node_module2=require("module")}});var require_dist2=__commonJS({"../../node_modules/.pnpm/path-to-regexp@6.1.0/node_modules/path-to-regexp/dist/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});function lexer(str){for(var tokens=[],i=0;i<str.length;){var char=str[i];if(char==="*"||char==="+"||char==="?"){tokens.push({type:"MODIFIER",index:i,value:str[i++]});continue}if(char==="\\"){tokens.push({type:"ESCAPED_CHAR",index:i++,value:str[i++]});continue}if(char==="{"){tokens.push({type:"OPEN",index:i,value:str[i++]});continue}if(char==="}"){tokens.push({type:"CLOSE",index:i,value:str[i++]});continue}if(char===":"){for(var name="",j=i+1;j<str.length;){var code=str.charCodeAt(j);if(code>=48&&code<=57||code>=65&&code<=90||code>=97&&code<=122||code===95){name+=str[j++];continue}break}if(!name)throw new TypeError("Missing parameter name at "+i);tokens.push({type:"NAME",index:i,value:name}),i=j;continue}if(char==="("){var count=1,pattern="",j=i+1;if(str[j]==="?")throw new TypeError('Pattern cannot start with "?" at '+j);for(;j<str.length;){if(str[j]==="\\"){pattern+=str[j++]+str[j++];continue}if(str[j]===")"){if(count--,count===0){j++;break}}else if(str[j]==="("&&(count++,str[j+1]!=="?"))throw new TypeError("Capturing groups are not allowed at "+j);pattern+=str[j++]}if(count)throw new TypeError("Unbalanced pattern at "+i);if(!pattern)throw new TypeError("Missing pattern at "+i);tokens.push({type:"PATTERN",index:i,value:pattern}),i=j;continue}tokens.push({type:"CHAR",index:i,value:str[i++]})}return tokens.push({type:"END",index:i,value:""}),tokens}function parse6(str,options){options===void 0&&(options={});for(var tokens=lexer(str),_a=options.prefixes,prefixes=_a===void 0?"./":_a,defaultPattern="[^"+escapeString(options.delimiter||"/#?")+"]+?",result=[],key=0,i=0,path9="",tryConsume=function(type){if(i<tokens.length&&tokens[i].type===type)return tokens[i++].value},mustConsume=function(type){var value2=tryConsume(type);if(value2!==void 0)return value2;var _a2=tokens[i],nextType=_a2.type,index=_a2.index;throw new TypeError("Unexpected "+nextType+" at "+index+", expected "+type)},consumeText=function(){for(var result2="",value2;value2=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR");)result2+=value2;return result2};i<tokens.length;){var char=tryConsume("CHAR"),name=tryConsume("NAME"),pattern=tryConsume("PATTERN");if(name||pattern){var prefix=char||"";prefixes.indexOf(prefix)===-1&&(path9+=prefix,prefix=""),path9&&(result.push(path9),path9=""),result.push({name:name||key++,prefix,suffix:"",pattern:pattern||defaultPattern,modifier:tryConsume("MODIFIER")||""});continue}var value=char||tryConsume("ESCAPED_CHAR");if(value){path9+=value;continue}path9&&(result.push(path9),path9="");var open=tryConsume("OPEN");if(open){var prefix=consumeText(),name_1=tryConsume("NAME")||"",pattern_1=tryConsume("PATTERN")||"",suffix=consumeText();mustConsume("CLOSE"),result.push({name:name_1||(pattern_1?key++:""),pattern:name_1&&!pattern_1?defaultPattern:pattern_1,prefix,suffix,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return result}exports2.parse=parse6;function compile(str,options){return tokensToFunction(parse6(str,options),options)}exports2.compile=compile;function tokensToFunction(tokens,options){options===void 0&&(options={});var reFlags=flags(options),_a=options.encode,encode=_a===void 0?function(x){return x}:_a,_b=options.validate,validate=_b===void 0?!0:_b,matches=tokens.map(function(token){if(typeof token=="object")return new RegExp("^(?:"+token.pattern+")$",reFlags)});return function(data){for(var path9="",i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token=="string"){path9+=token;continue}var value=data?data[token.name]:void 0,optional=token.modifier==="?"||token.modifier==="*",repeat=token.modifier==="*"||token.modifier==="+";if(Array.isArray(value)){if(!repeat)throw new TypeError('Expected "'+token.name+'" to not repeat, but got an array');if(value.length===0){if(optional)continue;throw new TypeError('Expected "'+token.name+'" to not be empty')}for(var j=0;j<value.length;j++){var segment=encode(value[j],token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected all "'+token.name+'" to match "'+token.pattern+'", but got "'+segment+'"');path9+=token.prefix+segment+token.suffix}continue}if(typeof value=="string"||typeof value=="number"){var segment=encode(String(value),token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected "'+token.name+'" to match "'+token.pattern+'", but got "'+segment+'"');path9+=token.prefix+segment+token.suffix;continue}if(!optional){var typeOfMessage=repeat?"an array":"a string";throw new TypeError('Expected "'+token.name+'" to be '+typeOfMessage)}}return path9}}exports2.tokensToFunction=tokensToFunction;function match(str,options){var keys=[],re=pathToRegexp3(str,keys,options);return regexpToFunction(re,keys,options)}exports2.match=match;function regexpToFunction(re,keys,options){options===void 0&&(options={});var _a=options.decode,decode=_a===void 0?function(x){return x}:_a;return function(pathname){var m=re.exec(pathname);if(!m)return!1;for(var path9=m[0],index=m.index,params=Object.create(null),_loop_1=function(i2){if(m[i2]===void 0)return"continue";var key=keys[i2-1];key.modifier==="*"||key.modifier==="+"?params[key.name]=m[i2].split(key.prefix+key.suffix).map(function(value){return decode(value,key)}):params[key.name]=decode(m[i2],key)},i=1;i<m.length;i++)_loop_1(i);return{path:path9,index,params}}}exports2.regexpToFunction=regexpToFunction;function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(options){return options&&options.sensitive?"":"i"}function regexpToRegexp(path9,keys){if(!keys)return path9;var groups=path9.source.match(/\((?!\?)/g);if(groups)for(var i=0;i<groups.length;i++)keys.push({name:i,prefix:"",suffix:"",modifier:"",pattern:""});return path9}function arrayToRegexp(paths,keys,options){var parts=paths.map(function(path9){return pathToRegexp3(path9,keys,options).source});return new RegExp("(?:"+parts.join("|")+")",flags(options))}function stringToRegexp(path9,keys,options){return tokensToRegexp(parse6(path9,options),keys,options)}function tokensToRegexp(tokens,keys,options){options===void 0&&(options={});for(var _a=options.strict,strict=_a===void 0?!1:_a,_b=options.start,start=_b===void 0?!0:_b,_c=options.end,end=_c===void 0?!0:_c,_d=options.encode,encode=_d===void 0?function(x){return x}:_d,endsWith="["+escapeString(options.endsWith||"")+"]|$",delimiter2="["+escapeString(options.delimiter||"/#?")+"]",route=start?"^":"",_i=0,tokens_1=tokens;_i<tokens_1.length;_i++){var token=tokens_1[_i];if(typeof token=="string")route+=escapeString(encode(token));else{var prefix=escapeString(encode(token.prefix)),suffix=escapeString(encode(token.suffix));if(token.pattern)if(keys&&keys.push(token),prefix||suffix)if(token.modifier==="+"||token.modifier==="*"){var mod=token.modifier==="*"?"?":"";route+="(?:"+prefix+"((?:"+token.pattern+")(?:"+suffix+prefix+"(?:"+token.pattern+"))*)"+suffix+")"+mod}else route+="(?:"+prefix+"("+token.pattern+")"+suffix+")"+token.modifier;else route+="("+token.pattern+")"+token.modifier;else route+="(?:"+prefix+suffix+")"+token.modifier}}if(end)strict||(route+=delimiter2+"?"),route+=options.endsWith?"(?="+endsWith+")":"$";else{var endToken=tokens[tokens.length-1],isEndDelimited=typeof endToken=="string"?delimiter2.indexOf(endToken[endToken.length-1])>-1:endToken===void 0;strict||(route+="(?:"+delimiter2+"(?="+endsWith+"))?"),isEndDelimited||(route+="(?="+delimiter2+"|"+endsWith+")")}return new RegExp(route,flags(options))}exports2.tokensToRegexp=tokensToRegexp;function pathToRegexp3(path9,keys,options){return path9 instanceof RegExp?regexpToRegexp(path9,keys):Array.isArray(path9)?arrayToRegexp(path9,keys,options):stringToRegexp(path9,keys,options)}exports2.pathToRegexp=pathToRegexp3}});var require_dist3=__commonJS({"../../node_modules/.pnpm/path-to-regexp@6.3.0/node_modules/path-to-regexp/dist/index.js"(exports2){"use strict";Object.defineProperty(exports2,"__esModule",{value:!0});exports2.pathToRegexp=exports2.tokensToRegexp=exports2.regexpToFunction=exports2.match=exports2.tokensToFunction=exports2.compile=exports2.parse=void 0;function lexer(str){for(var tokens=[],i=0;i<str.length;){var char=str[i];if(char==="*"||char==="+"||char==="?"){tokens.push({type:"MODIFIER",index:i,value:str[i++]});continue}if(char==="\\"){tokens.push({type:"ESCAPED_CHAR",index:i++,value:str[i++]});continue}if(char==="{"){tokens.push({type:"OPEN",index:i,value:str[i++]});continue}if(char==="}"){tokens.push({type:"CLOSE",index:i,value:str[i++]});continue}if(char===":"){for(var name="",j=i+1;j<str.length;){var code=str.charCodeAt(j);if(code>=48&&code<=57||code>=65&&code<=90||code>=97&&code<=122||code===95){name+=str[j++];continue}break}if(!name)throw new TypeError("Missing parameter name at ".concat(i));tokens.push({type:"NAME",index:i,value:name}),i=j;continue}if(char==="("){var count=1,pattern="",j=i+1;if(str[j]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(j));for(;j<str.length;){if(str[j]==="\\"){pattern+=str[j++]+str[j++];continue}if(str[j]===")"){if(count--,count===0){j++;break}}else if(str[j]==="("&&(count++,str[j+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(j));pattern+=str[j++]}if(count)throw new TypeError("Unbalanced pattern at ".concat(i));if(!pattern)throw new TypeError("Missing pattern at ".concat(i));tokens.push({type:"PATTERN",index:i,value:pattern}),i=j;continue}tokens.push({type:"CHAR",index:i,value:str[i++]})}return tokens.push({type:"END",index:i,value:""}),tokens}function parse6(str,options){options===void 0&&(options={});for(var tokens=lexer(str),_a=options.prefixes,prefixes=_a===void 0?"./":_a,_b=options.delimiter,delimiter2=_b===void 0?"/#?":_b,result=[],key=0,i=0,path9="",tryConsume=function(type){if(i<tokens.length&&tokens[i].type===type)return tokens[i++].value},mustConsume=function(type){var value2=tryConsume(type);if(value2!==void 0)return value2;var _a2=tokens[i],nextType=_a2.type,index=_a2.index;throw new TypeError("Unexpected ".concat(nextType," at ").concat(index,", expected ").concat(type))},consumeText=function(){for(var result2="",value2;value2=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR");)result2+=value2;return result2},isSafe=function(value2){for(var _i=0,delimiter_1=delimiter2;_i<delimiter_1.length;_i++){var char2=delimiter_1[_i];if(value2.indexOf(char2)>-1)return!0}return!1},safePattern=function(prefix2){var prev=result[result.length-1],prevText=prefix2||(prev&&typeof prev=="string"?prev:"");if(prev&&!prevText)throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name,'"'));return!prevText||isSafe(prevText)?"[^".concat(escapeString(delimiter2),"]+?"):"(?:(?!".concat(escapeString(prevText),")[^").concat(escapeString(delimiter2),"])+?")};i<tokens.length;){var char=tryConsume("CHAR"),name=tryConsume("NAME"),pattern=tryConsume("PATTERN");if(name||pattern){var prefix=char||"";prefixes.indexOf(prefix)===-1&&(path9+=prefix,prefix=""),path9&&(result.push(path9),path9=""),result.push({name:name||key++,prefix,suffix:"",pattern:pattern||safePattern(prefix),modifier:tryConsume("MODIFIER")||""});continue}var value=char||tryConsume("ESCAPED_CHAR");if(value){path9+=value;continue}path9&&(result.push(path9),path9="");var open=tryConsume("OPEN");if(open){var prefix=consumeText(),name_1=tryConsume("NAME")||"",pattern_1=tryConsume("PATTERN")||"",suffix=consumeText();mustConsume("CLOSE"),result.push({name:name_1||(pattern_1?key++:""),pattern:name_1&&!pattern_1?safePattern(prefix):pattern_1,prefix,suffix,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return result}exports2.parse=parse6;function compile(str,options){return tokensToFunction(parse6(str,options),options)}exports2.compile=compile;function tokensToFunction(tokens,options){options===void 0&&(options={});var reFlags=flags(options),_a=options.encode,encode=_a===void 0?function(x){return x}:_a,_b=options.validate,validate=_b===void 0?!0:_b,matches=tokens.map(function(token){if(typeof token=="object")return new RegExp("^(?:".concat(token.pattern,")$"),reFlags)});return function(data){for(var path9="",i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token=="string"){path9+=token;continue}var value=data?data[token.name]:void 0,optional=token.modifier==="?"||token.modifier==="*",repeat=token.modifier==="*"||token.modifier==="+";if(Array.isArray(value)){if(!repeat)throw new TypeError('Expected "'.concat(token.name,'" to not repeat, but got an array'));if(value.length===0){if(optional)continue;throw new TypeError('Expected "'.concat(token.name,'" to not be empty'))}for(var j=0;j<value.length;j++){var segment=encode(value[j],token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected all "'.concat(token.name,'" to match "').concat(token.pattern,'", but got "').concat(segment,'"'));path9+=token.prefix+segment+token.suffix}continue}if(typeof value=="string"||typeof value=="number"){var segment=encode(String(value),token);if(validate&&!matches[i].test(segment))throw new TypeError('Expected "'.concat(token.name,'" to match "').concat(token.pattern,'", but got "').concat(segment,'"'));path9+=token.prefix+segment+token.suffix;continue}if(!optional){var typeOfMessage=repeat?"an array":"a string";throw new TypeError('Expected "'.concat(token.name,'" to be ').concat(typeOfMessage))}}return path9}}exports2.tokensToFunction=tokensToFunction;function match(str,options){var keys=[],re=pathToRegexp3(str,keys,options);return regexpToFunction(re,keys,options)}exports2.match=match;function regexpToFunction(re,keys,options){options===void 0&&(options={});var _a=options.decode,decode=_a===void 0?function(x){return x}:_a;return function(pathname){var m=re.exec(pathname);if(!m)return!1;for(var path9=m[0],index=m.index,params=Object.create(null),_loop_1=function(i2){if(m[i2]===void 0)return"continue";var key=keys[i2-1];key.modifier==="*"||key.modifier==="+"?params[key.name]=m[i2].split(key.prefix+key.suffix).map(function(value){return decode(value,key)}):params[key.name]=decode(m[i2],key)},i=1;i<m.length;i++)_loop_1(i);return{path:path9,index,params}}}exports2.regexpToFunction=regexpToFunction;function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(options){return options&&options.sensitive?"":"i"}function regexpToRegexp(path9,keys){if(!keys)return path9;for(var groupsRegex=/\((?:\?<(.*?)>)?(?!\?)/g,index=0,execResult=groupsRegex.exec(path9.source);execResult;)keys.push({name:execResult[1]||index++,prefix:"",suffix:"",modifier:"",pattern:""}),execResult=groupsRegex.exec(path9.source);return path9}function arrayToRegexp(paths,keys,options){var parts=paths.map(function(path9){return pathToRegexp3(path9,keys,options).source});return new RegExp("(?:".concat(parts.join("|"),")"),flags(options))}function stringToRegexp(path9,keys,options){return tokensToRegexp(parse6(path9,options),keys,options)}function tokensToRegexp(tokens,keys,options){options===void 0&&(options={});for(var _a=options.strict,strict=_a===void 0?!1:_a,_b=options.start,start=_b===void 0?!0:_b,_c=options.end,end=_c===void 0?!0:_c,_d=options.encode,encode=_d===void 0?function(x){return x}:_d,_e=options.delimiter,delimiter2=_e===void 0?"/#?":_e,_f=options.endsWith,endsWith=_f===void 0?"":_f,endsWithRe="[".concat(escapeString(endsWith),"]|$"),delimiterRe="[".concat(escapeString(delimiter2),"]"),route=start?"^":"",_i=0,tokens_1=tokens;_i<tokens_1.length;_i++){var token=tokens_1[_i];if(typeof token=="string")route+=escapeString(encode(token));else{var prefix=escapeString(encode(token.prefix)),suffix=escapeString(encode(token.suffix));if(token.pattern)if(keys&&keys.push(token),prefix||suffix)if(token.modifier==="+"||token.modifier==="*"){var mod=token.modifier==="*"?"?":"";route+="(?:".concat(prefix,"((?:").concat(token.pattern,")(?:").concat(suffix).concat(prefix,"(?:").concat(token.pattern,"))*)").concat(suffix,")").concat(mod)}else route+="(?:".concat(prefix,"(").concat(token.pattern,")").concat(suffix,")").concat(token.modifier);else{if(token.modifier==="+"||token.modifier==="*")throw new TypeError('Can not repeat "'.concat(token.name,'" without a prefix and suffix'));route+="(".concat(token.pattern,")").concat(token.modifier)}else route+="(?:".concat(prefix).concat(suffix,")").concat(token.modifier)}}if(end)strict||(route+="".concat(delimiterRe,"?")),route+=options.endsWith?"(?=".concat(endsWithRe,")"):"$";else{var endToken=tokens[tokens.length-1],isEndDelimited=typeof endToken=="string"?delimiterRe.indexOf(endToken[endToken.length-1])>-1:endToken===void 0;strict||(route+="(?:".concat(delimiterRe,"(?=").concat(endsWithRe,"))?")),isEndDelimited||(route+="(?=".concat(delimiterRe,"|").concat(endsWithRe,")"))}return new RegExp(route,flags(options))}exports2.tokensToRegexp=tokensToRegexp;function pathToRegexp3(path9,keys,options){return path9 instanceof RegExp?regexpToRegexp(path9,keys):Array.isArray(path9)?arrayToRegexp(path9,keys,options):stringToRegexp(path9,keys,options)}exports2.pathToRegexp=pathToRegexp3}});var require_superstatic=__commonJS({"../routing-utils/dist/superstatic.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),superstatic_exports={};__export3(superstatic_exports,{collectHasSegments:()=>collectHasSegments,compilePathToRegexpTemplate:()=>compilePathToRegexpTemplate2,convertCleanUrls:()=>convertCleanUrls,convertHeaders:()=>convertHeaders,convertRedirects:()=>convertRedirects,convertRewrites:()=>convertRewrites2,convertTrailingSlash:()=>convertTrailingSlash,getCleanUrls:()=>getCleanUrls2,pathToRegexp:()=>pathToRegexp3,sourceToRegex:()=>sourceToRegex2});module2.exports=__toCommonJS3(superstatic_exports);var import_url=require("url"),import_path_to_regexp=require_dist2(),import_path_to_regexp_updated=require_dist3();function cloneKeys(keys){if(!(typeof keys>"u"))return keys.slice(0)}function compareKeys(left,right){let leftSerialized=typeof left>"u"?"undefined":left.toString(),rightSerialized=typeof right>"u"?"undefined":right.toString();return leftSerialized===rightSerialized}function pathToRegexp3(callerId,path9,keys,options){let newKeys=cloneKeys(keys),currentRegExp=(0,import_path_to_regexp.pathToRegexp)(path9,keys,options);try{let currentKeys=keys,newRegExp=(0,import_path_to_regexp_updated.pathToRegexp)(path9,newKeys,options),isDiffRegExp=currentRegExp.toString()!==newRegExp.toString();if(process.env.FORCE_PATH_TO_REGEXP_LOG||isDiffRegExp){let message=JSON.stringify({path:path9,currentRegExp:currentRegExp.toString(),newRegExp:newRegExp.toString()});console.error(`[vc] PATH TO REGEXP PATH DIFF @ #${callerId}: ${message}`)}let isDiffKeys=!compareKeys(keys,newKeys);if(process.env.FORCE_PATH_TO_REGEXP_LOG||isDiffKeys){let message=JSON.stringify({isDiffKeys,currentKeys,newKeys});console.error(`[vc] PATH TO REGEXP KEYS DIFF @ #${callerId}: ${message}`)}}catch(err){let message=JSON.stringify({path:path9,error:err.message});console.error(`[vc] PATH TO REGEXP ERROR @ #${callerId}: ${message}`)}return currentRegExp}var UN_NAMED_SEGMENT="__UN_NAMED_SEGMENT__";function getCleanUrls2(filePaths){return filePaths.map(toRoute).filter(f=>f.endsWith(".html")).map(f=>({html:f,clean:f.slice(0,-5)}))}function convertCleanUrls(cleanUrls,trailingSlash,status=308){let routes=[];if(cleanUrls){let loc=trailingSlash?"/$1/":"/$1";routes.push({src:"^/(?:(.+)/)?index(?:\\.html)?/?$",headers:{Location:loc},status}),routes.push({src:"^/(.*)\\.html/?$",headers:{Location:loc},status})}return routes}function convertRedirects(redirects,defaultStatus=308){return redirects.map(r=>{let{src,segments}=sourceToRegex2(r.source),hasSegments=collectHasSegments(r.has);normalizeHasKeys(r.has),normalizeHasKeys(r.missing);try{let loc=replaceSegments(segments,hasSegments,r.destination,!0),status;typeof r.permanent=="boolean"?status=r.permanent?308:307:r.statusCode?status=r.statusCode:status=defaultStatus;let route={src,headers:{Location:loc},status};return typeof r.env<"u"&&(route.env=r.env),r.has&&(route.has=r.has),r.missing&&(route.missing=r.missing),route}catch{throw new Error(`Failed to parse redirect: ${JSON.stringify(r)}`)}})}function convertRewrites2(rewrites,internalParamNames){return rewrites.map(r=>{let{src,segments}=sourceToRegex2(r.source),hasSegments=collectHasSegments(r.has);normalizeHasKeys(r.has),normalizeHasKeys(r.missing);try{let interpolate=value=>replaceSegments(segments,hasSegments,value,!1,internalParamNames),route;if(typeof r.destination=="string")route={src,dest:interpolate(r.destination),check:!0};else{let destination={...r.destination,type:"service"};typeof destination.path=="string"&&(destination.path=interpolate(destination.path)),route={src,destination}}return r.transforms&&(route.transforms=r.transforms.map(transform=>transform.type!=="request.path"?{...transform}:{...transform,args:compilePathToRegexpTemplateFromSegments(transform.args,segments,hasSegments,transform.env)})),typeof r.env<"u"&&(route.env=r.env),r.has&&(route.has=r.has),r.missing&&(route.missing=r.missing),r.statusCode&&(route.status=r.statusCode),route}catch{throw new Error(`Failed to parse rewrite: ${JSON.stringify(r)}`)}})}function convertHeaders(headers){return headers.map(h=>{let obj={},{src,segments}=sourceToRegex2(h.source),hasSegments=collectHasSegments(h.has);normalizeHasKeys(h.has),normalizeHasKeys(h.missing);let namedSegments=segments.filter(name=>name!==UN_NAMED_SEGMENT),indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index)}),hasSegments.forEach(name=>{indexes[name]="$"+name}),h.headers.forEach(({key,value})=>{(namedSegments.length>0||hasSegments.length>0)&&(key.includes(":")&&(key=safelyCompile(key,indexes)),value.includes(":")&&(value=safelyCompile(value,indexes))),obj[key]=value});let route={src,headers:obj,continue:!0};return h.has&&(route.has=h.has),h.missing&&(route.missing=h.missing),route})}function convertTrailingSlash(enable,status=308){let routes=[];return enable?(routes.push({src:"^/\\.well-known(?:/.*)?$"}),routes.push({src:"^/((?:[^/]+/)*[^/\\.]+)$",headers:{Location:"/$1/"},status}),routes.push({src:"^/((?:[^/]+/)*[^/]+\\.\\w+)/$",headers:{Location:"/$1"},status})):routes.push({src:"^/(.*)\\/$",headers:{Location:"/$1"},status}),routes}function sourceToRegex2(source){let keys=[],r=pathToRegexp3("632",source,keys,{strict:!0,sensitive:!0,delimiter:"/"}),segments=keys.map(k=>k.name).map(name=>typeof name!="string"?UN_NAMED_SEGMENT:name);return{src:r.source,segments}}var namedGroupsRegex=/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g,normalizeHasKeys=(hasItems=[])=>{for(let hasItem of hasItems)"key"in hasItem&&hasItem.type==="header"&&(hasItem.key=hasItem.key.toLowerCase());return hasItems};function getStringValueForRegex(value){return typeof value=="string"?value:value&&typeof value=="object"&&value!==null&&"re"in value&&typeof value.re=="string"?value.re:null}function collectHasSegments(has){let hasSegments=new Set;for(let hasItem of has||[]){!hasItem.value&&"key"in hasItem&&hasSegments.add(hasItem.key);let stringValue=getStringValueForRegex(hasItem.value);if(stringValue){for(let match of stringValue.matchAll(namedGroupsRegex))match[1]&&hasSegments.add(match[1]);hasItem.type==="host"&&hasSegments.add("host")}}return[...hasSegments]}var escapeSegment=(str,segmentName)=>str.replace(new RegExp(`:${segmentName}`,"g"),`__ESC_COLON_${segmentName}`),unescapeSegments=str=>str.replace(/__ESC_COLON_/gi,":"),pathTemplateSegmentNameRegex=/^([a-zA-Z_][a-zA-Z0-9_]*)/;function isEscaped2(value,index){let backslashCount=0;for(let i=index-1;i>=0&&value[i]==="\\";i--)backslashCount++;return backslashCount%2===1}function collectPathTemplateSegments(template){let segments=[];for(let i=0;i<template.length;i++){if(template[i]!==":"||isEscaped2(template,i))continue;let match=template.slice(i+1).match(pathTemplateSegmentNameRegex);match&&(segments.push(match[1]),i+=match[1].length)}return segments}function collectNamedDollarReferences(template){let references=[];for(let i=0;i<template.length;i++){if(template[i]!=="$"||isEscaped2(template,i))continue;let remainder=template.slice(i+1),bracedMatch=remainder.match(/^\{([a-zA-Z_][a-zA-Z0-9_]*)\}/),unbracedMatch=remainder.match(pathTemplateSegmentNameRegex),name=bracedMatch?.[1]||unbracedMatch?.[1];name&&references.push(name)}return references}function compilePathToRegexpTemplateFromSegments(template,segments,hasItemSegments,env=[]){let indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index)}),hasItemSegments.forEach(name=>{indexes[name]=`$${name}`});for(let name of collectPathTemplateSegments(template))if(!(name in indexes))throw new Error(`Path template references parameter ":${name}" that is not present in the source or has conditions.`);let routeParameters=new Set([...segments.filter(name=>name!==UN_NAMED_SEGMENT),...hasItemSegments]);for(let name of collectNamedDollarReferences(template))if(routeParameters.has(name)&&!env.includes(name))throw new Error(`Path template references route parameter "${name}" as \`$${name}\`. Use \`:${name}\` path-to-regexp syntax in high-level rewrites, or list "${name}" in the transform env allowlist if it is an environment variable.`);return safelyCompile(template,indexes,!0)}function compilePathToRegexpTemplate2(source,template,has,env){let{segments}=sourceToRegex2(source);return compilePathToRegexpTemplateFromSegments(template,segments,collectHasSegments(has),env)}function replaceSegments(segments,hasItemSegments,destination,isRedirect,internalParamNames){let namedSegments=segments.filter(name=>name!==UN_NAMED_SEGMENT);if(!(destination.includes(":")&&namedSegments.length>0||hasItemSegments.length>0||!isRedirect))return destination;let escapedDestination=destination,indexes={};segments.forEach((name,index)=>{indexes[name]=toSegmentDest(index),escapedDestination=escapeSegment(escapedDestination,name)}),hasItemSegments.forEach(name=>{indexes[name]="$"+name,escapedDestination=escapeSegment(escapedDestination,name)});let parsedDestination=(0,import_url.parse)(escapedDestination,!0);delete parsedDestination.href,delete parsedDestination.path,delete parsedDestination.search,delete parsedDestination.host;let{pathname,hash,query,hostname,...rest}=parsedDestination;pathname=unescapeSegments(pathname||""),hash=unescapeSegments(hash||""),hostname=unescapeSegments(hostname||"");let destParams=new Set,pathnameKeys=[],hashKeys=[],hostnameKeys=[];try{pathToRegexp3("528",pathname,pathnameKeys),pathToRegexp3("834",hash||"",hashKeys),pathToRegexp3("712",hostname||"",hostnameKeys)}catch{}destParams=new Set([...pathnameKeys,...hashKeys,...hostnameKeys].map(key=>key.name).filter(val=>typeof val=="string")),pathname=safelyCompile(pathname,indexes,!0),hash=hash?safelyCompile(hash,indexes,!0):null,hostname=hostname?safelyCompile(hostname,indexes,!0):null;for(let[key,strOrArray]of Object.entries(query))Array.isArray(strOrArray)?query[key]=strOrArray.map(str=>safelyCompile(unescapeSegments(str),indexes,!0)):query[key]=safelyCompile(unescapeSegments(strOrArray),indexes,!0);let paramKeys=Object.keys(indexes);if(!isRedirect&&!paramKeys.some(param=>!(internalParamNames&&internalParamNames.includes(param))&&destParams.has(param)))for(let param of paramKeys)!(param in query)&¶m!==UN_NAMED_SEGMENT&&(query[param]=indexes[param]);return destination=(0,import_url.format)({...rest,hostname,pathname,query,hash}),destination.replace(/%24/g,"$")}function safelyCompile(value,indexes,attemptDirectCompile){if(!value)return value;if(attemptDirectCompile)try{return(0,import_path_to_regexp.compile)(value,{validate:!1})(indexes)}catch{}for(let key of Object.keys(indexes))value.includes(`:${key}`)&&(value=value.replace(new RegExp(`:${key}\\*`,"g"),`:${key}--ESCAPED_PARAM_ASTERISK`).replace(new RegExp(`:${key}\\?`,"g"),`:${key}--ESCAPED_PARAM_QUESTION`).replace(new RegExp(`:${key}\\+`,"g"),`:${key}--ESCAPED_PARAM_PLUS`).replace(new RegExp(`:${key}(?!\\w)`,"g"),`--ESCAPED_PARAM_COLON${key}`));return value=value.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g,"\\$1").replace(/--ESCAPED_PARAM_PLUS/g,"+").replace(/--ESCAPED_PARAM_COLON/g,":").replace(/--ESCAPED_PARAM_QUESTION/g,"?").replace(/--ESCAPED_PARAM_ASTERISK/g,"*"),(0,import_path_to_regexp.compile)(`/${value}`,{validate:!1})(indexes).slice(1)}function toSegmentDest(index){return"$"+(index+1).toString()}function toRoute(filePath){return filePath.startsWith("/")?filePath:"/"+filePath}}});var require_append=__commonJS({"../routing-utils/dist/append.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),append_exports={};__export3(append_exports,{appendRoutesToPhase:()=>appendRoutesToPhase2});module2.exports=__toCommonJS3(append_exports);var import_index=require_dist4();function appendRoutesToPhase2({routes:prevRoutes,newRoutes,phase}){let routes=prevRoutes?[...prevRoutes]:[];if(newRoutes===null||newRoutes.length===0)return routes;let isInPhase=!1,insertIndex=-1;if(routes.forEach((r,i)=>{(0,import_index.isHandler)(r)&&(r.handle===phase?isInPhase=!0:isInPhase&&(insertIndex=i,isInPhase=!1))}),isInPhase)routes.push(...newRoutes);else if(phase===null){let lastPhase=routes.findIndex(r=>(0,import_index.isHandler)(r)&&r.handle);lastPhase===-1?routes.push(...newRoutes):routes.splice(lastPhase,0,...newRoutes)}else insertIndex>-1?routes.splice(insertIndex,0,...newRoutes):(routes.push({handle:phase}),routes.push(...newRoutes));return routes}}});var require_merge2=__commonJS({"../routing-utils/dist/merge.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),merge_exports={};__export3(merge_exports,{mergeRoutes:()=>mergeRoutes2});module2.exports=__toCommonJS3(merge_exports);var import_index=require_dist4();function getBuilderRoutesMapping(builds){let builderRoutes={};for(let{entrypoint,routes,use}of builds)routes&&(builderRoutes[entrypoint]||(builderRoutes[entrypoint]={}),builderRoutes[entrypoint][use]=routes);return builderRoutes}function addToHandleMap(path9,routesMapping,handleMap){let br=routesMapping[path9];Object.keys(br).sort().forEach(use=>{let prevHandle=null;br[use].forEach(route=>{if((0,import_index.isHandler)(route))prevHandle=route.handle;else{let routes=handleMap.get(prevHandle);routes?routes.push(route):handleMap.set(prevHandle,[route])}})})}function getCheckAndContinue(routes){let checks=[],continues=[],others=[];for(let route of routes){if((0,import_index.isHandler)(route))throw new Error(`Unexpected route found in getCheckAndContinue(): ${JSON.stringify(route)}`);route.check&&!route.override?checks.push(route):route.continue&&!route.override?continues.push(route):others.push(route)}return{checks,continues,others}}function mergeRoutes2({userRoutes,builds}){let userHandleMap=new Map,userPrevHandle=null;(userRoutes||[]).forEach(route=>{if((0,import_index.isHandler)(route))userPrevHandle=route.handle;else{let routes=userHandleMap.get(userPrevHandle);routes?routes.push(route):userHandleMap.set(userPrevHandle,[route])}});let projectHandleMap=new Map,projectMiddlewareRoutes=getBuilderRoutesMapping(builds.filter(b=>b.projectMiddleware));Object.keys(projectMiddlewareRoutes).sort().forEach(path9=>addToHandleMap(path9,projectMiddlewareRoutes,projectHandleMap));let builderHandleMap=new Map,builderRoutes=getBuilderRoutesMapping(builds.filter(b=>!b.projectMiddleware));Object.keys(builderRoutes).sort().forEach(path9=>addToHandleMap(path9,builderRoutes,builderHandleMap));let outputRoutes=[],uniqueHandleValues=new Set([null,...userHandleMap.keys(),...projectHandleMap.keys(),...builderHandleMap.keys()]);for(let handle of uniqueHandleValues){let userRoutes2=userHandleMap.get(handle)||[],projectRoutes=projectHandleMap.get(handle)||[],builderRoutes2=builderHandleMap.get(handle)||[],builderSorted=getCheckAndContinue(builderRoutes2);handle!==null&&(userRoutes2.length>0||projectRoutes.length>0||builderRoutes2.length>0)&&outputRoutes.push({handle}),outputRoutes.push(...builderSorted.continues),outputRoutes.push(...userRoutes2),outputRoutes.push(...projectRoutes),outputRoutes.push(...builderSorted.checks),outputRoutes.push(...builderSorted.others)}return outputRoutes}}});var require_service_route_ownership=__commonJS({"../routing-utils/dist/service-route-ownership.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),service_route_ownership_exports={};__export3(service_route_ownership_exports,{getOwnershipGuard:()=>getOwnershipGuard2,normalizeRoutePrefix:()=>normalizeRoutePrefix2,scopeRouteSourceToOwnership:()=>scopeRouteSourceToOwnership2});module2.exports=__toCommonJS3(service_route_ownership_exports);function normalizeRoutePrefix2(routePrefix){let normalized=routePrefix.startsWith("/")?routePrefix:`/${routePrefix}`;return normalized!=="/"&&normalized.endsWith("/")&&(normalized=normalized.slice(0,-1)),normalized||"/"}function escapeForRegex(value){return value.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function toPrefixMatcher(routePrefix){return`${escapeForRegex(routePrefix)}(?:/|$)`}function isDescendantPrefix(candidate,prefix){return candidate!==prefix&&candidate.startsWith(`${prefix}/`)}function getOwnershipGuard2(ownerPrefix,allRoutePrefixes){let owner=normalizeRoutePrefix2(ownerPrefix),nonRootPrefixes=Array.from(new Set(allRoutePrefixes.map(normalizeRoutePrefix2))).filter(prefix=>prefix!=="/").sort((a,b)=>b.length-a.length);if(owner==="/")return nonRootPrefixes.map(prefix=>`(?!${toPrefixMatcher(prefix)})`).join("");let descendants=nonRootPrefixes.filter(prefix=>isDescendantPrefix(prefix,owner)),positive=`(?=${toPrefixMatcher(owner)})`,negative=descendants.map(prefix=>`(?!${toPrefixMatcher(prefix)})`).join("");return`${positive}${negative}`}function scopeRouteSourceToOwnership2(source,ownershipGuard){if(!ownershipGuard)return source;let inner=source.startsWith("^")?source.slice(1):source;return`^${ownershipGuard}(?:${inner})`}}});var require_schemas=__commonJS({"../routing-utils/dist/schemas.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),schemas_exports2={};__export3(schemas_exports2,{cleanUrlsSchema:()=>cleanUrlsSchema,hasSchema:()=>hasSchema,headersSchema:()=>headersSchema,redirectsSchema:()=>redirectsSchema,rewritesSchema:()=>rewritesSchema,routesSchema:()=>routesSchema,trailingSlashSchema:()=>trailingSlashSchema,transformsSchema:()=>transformsSchema});module2.exports=__toCommonJS3(schemas_exports2);var mitigateSchema={description:"Mitigation action to take on a route",type:"object",additionalProperties:!1,required:["action"],properties:{action:{description:"The mitigation action to take",type:"string",enum:["challenge","deny"]}}},serviceNameSchema={description:"A service name identifier.",type:"string",minLength:1,maxLength:64,pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"},serviceDestinationSchema={description:"A service-targeted destination that delegates routing into a named service from `services`. Identified by the presence of `service`.",type:"object",additionalProperties:!1,required:["service"],properties:{type:{description:"Optional explicit format marker. The destination shape is identified by the `service` property, so `type` is no longer required. When present it must be `service`.",type:"string",enum:["service"]},service:serviceNameSchema,path:{description:"Routing-only path used to select a route inside the target service. It does not mutate the URL observed by user code.",type:"string",maxLength:4096}}},matchableValueSchema={description:"A value to match against. Can be a string (regex) or a condition operation object",anyOf:[{description:"A regular expression used to match thev value. Named groups can be used in the destination.",type:"string",maxLength:4096},{description:"A condition operation object",type:"object",additionalProperties:!1,minProperties:1,properties:{eq:{description:"Equal to",anyOf:[{type:"string",maxLength:4096},{type:"number"}]},neq:{description:"Not equal",type:"string",maxLength:4096},inc:{description:"In array",type:"array",items:{type:"string",maxLength:4096}},ninc:{description:"Not in array",type:"array",items:{type:"string",maxLength:4096}},pre:{description:"Starts with",type:"string",maxLength:4096},suf:{description:"Ends with",type:"string",maxLength:4096},re:{description:"Regex",type:"string",maxLength:4096},gt:{description:"Greater than",type:"number"},gte:{description:"Greater than or equal to",type:"number"},lt:{description:"Less than",type:"number"},lte:{description:"Less than or equal to",type:"number"}}}]},hasSchema={description:"An array of requirements that are needed to match",type:"array",maxItems:16,items:{anyOf:[{type:"object",additionalProperties:!1,required:["type","value"],properties:{type:{description:"The type of request element to check",type:"string",enum:["host"]},value:matchableValueSchema}},{type:"object",additionalProperties:!1,required:["type","key"],properties:{type:{description:"The type of request element to check",type:"string",enum:["header","cookie","query"]},key:{description:"The name of the element contained in the particular type",type:"string",maxLength:4096},value:matchableValueSchema}}]}},transformsSchema={description:"A list of transform rules to adjust a request path, request query parameters, or request/response headers",type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["type","op"],properties:{type:{description:"The scope of the transform to apply",type:"string",enum:["request.headers","request.query","response.headers","request.path"]},op:{description:"The operation to perform on the target",type:"string",enum:["append","set","delete"]},target:{description:"The target of the transform",type:"object",required:["key"],properties:{key:{description:"A value to match against. Can be a string or a condition operation object (without regex support)",anyOf:[{description:"A valid header name (letters, numbers, hyphens, underscores)",type:"string",maxLength:4096},{description:"A condition operation object",type:"object",additionalProperties:!1,minProperties:1,properties:{eq:{description:"Equal to",anyOf:[{type:"string",maxLength:4096},{type:"number"}]},neq:{description:"Not equal",type:"string",maxLength:4096},inc:{description:"In array",type:"array",items:{type:"string",maxLength:4096}},ninc:{description:"Not in array",type:"array",items:{type:"string",maxLength:4096}},pre:{description:"Starts with",type:"string",maxLength:4096},suf:{description:"Ends with",type:"string",maxLength:4096},gt:{description:"Greater than",type:"number"},gte:{description:"Greater than or equal to",type:"number"},lt:{description:"Less than",type:"number"},lte:{description:"Less than or equal to",type:"number"}}}]}}},args:{description:"The arguments to the operation",anyOf:[{type:"string",maxLength:4096},{type:"array",minItems:1,items:{type:"string",maxLength:4096}}]},env:{description:"An array of environment variable names that should be replaced at runtime in the args value",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},fallback:{description:"Keep an earlier runtime-visible request path when one is already set",type:"boolean"}},allOf:[{if:{properties:{op:{enum:["append","set"]}}},then:{required:["args"]}},{if:{allOf:[{properties:{type:{enum:["request.headers","response.headers"]}}},{properties:{op:{enum:["set","append"]}}}]},then:{properties:{target:{properties:{key:{if:{type:"string"},then:{pattern:"^[a-zA-Z0-9_-]+$"}}}},args:{anyOf:[{type:"string",pattern:"^[a-zA-Z0-9_ :;.,\"'?!(){}\\[\\]@<>=+*#$&`|~\\^%/-]+$"},{type:"array",items:{type:"string",pattern:"^[a-zA-Z0-9_ :;.,\"'?!(){}\\[\\]@<>=+*#$&`|~\\^%/-]+$"}}]}}}},{if:{required:["type"],properties:{type:{enum:["request.headers","request.query","response.headers"]}}},then:{required:["target"]}},{if:{required:["type"],properties:{type:{enum:["request.path"]}}},then:{required:["args"],not:{required:["target"]},properties:{op:{enum:["set"]},args:{description:"The runtime-visible request path. Must be an origin-form path without query or fragment.",type:"string",maxLength:2048,pattern:"^/(?!/)(?!.*[?#\\s\\x00-\\x1F\\x7F]).*$"}}}},{if:{required:["fallback"]},then:{properties:{type:{enum:["request.path"]}}}}]}},rewriteTransformsSchema={description:"A list of request path transforms using path-to-regexp parameters.",type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["type","op","args"],properties:{type:{description:"The request path to expose to the target runtime",type:"string",enum:["request.path"]},op:{description:"Replace the runtime-visible request path",type:"string",enum:["set"]},args:{description:"An origin-form request path. Route parameters use path-to-regexp syntax such as `/:path*`.",type:"string",maxLength:2048,pattern:"^/(?!/)(?!.*[?#\\s\\x00-\\x1F\\x7F]).*$"},env:{description:"An array of environment variable names that should be replaced at runtime in the args value",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},fallback:{description:"Keep an earlier runtime-visible request path when one is already set",type:"boolean"}}}},routesSchema={type:"array",description:"A list of routes objects used to rewrite paths to point towards other internal or external paths",example:[{dest:"https://docs.example.com",src:"/docs"}],items:{anyOf:[{type:"object",anyOf:[{required:["src"]},{required:["source"]}],additionalProperties:!1,properties:{src:{type:"string",maxLength:4096},source:{type:"string",maxLength:4096},dest:{type:"string",maxLength:4096},destination:{anyOf:[{type:"string",maxLength:4096},serviceDestinationSchema]},headers:{type:"object",additionalProperties:!1,minProperties:1,maxProperties:100,patternProperties:{"^.{1,256}$":{type:"string",maxLength:32768}}},methods:{type:"array",maxItems:10,items:{type:"string",maxLength:32}},caseSensitive:{type:"boolean"},important:{deprecated:!0,type:"boolean"},user:{type:"boolean"},continue:{type:"boolean"},override:{deprecated:!0,type:"boolean"},check:{type:"boolean"},isInternal:{type:"boolean"},status:{type:"integer",minimum:100,maximum:999},statusCode:{type:"integer",minimum:100,maximum:999},locale:{type:"object",additionalProperties:!1,minProperties:1,properties:{redirect:{type:"object",additionalProperties:!1,minProperties:1,maxProperties:100,patternProperties:{"^.{1,256}$":{type:"string",maxLength:4096}}},value:{type:"string",maxLength:4096},path:{type:"string",maxLength:4096},cookie:{type:"string",maxLength:4096},default:{type:"string",maxLength:4096}}},middleware:{type:"number"},middlewarePath:{type:"string"},middlewareRawSrc:{type:"array",items:{type:"string"}},has:hasSchema,missing:hasSchema,mitigate:mitigateSchema,transforms:transformsSchema,env:{description:"An array of environment variable names that should be replaced at runtime in the destination or headers",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},respectOriginCacheControl:{description:"When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",type:"boolean"}}},{type:"object",deprecated:!0,required:["handle"],additionalProperties:!1,properties:{handle:{type:"string",maxLength:32,enum:["error","filesystem","hit","miss","resource","rewrite"]}}}]}},rewritesSchema={type:"array",maxItems:2048,description:"A list of rewrite definitions.",items:{type:"object",additionalProperties:!1,required:["source","destination"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring).",type:"string",maxLength:4096},destination:{description:"An absolute pathname to an existing resource, an external URL, or a service-targeted destination object.",anyOf:[{type:"string",maxLength:4096},serviceDestinationSchema]},transforms:rewriteTransformsSchema,has:hasSchema,missing:hasSchema,statusCode:{description:"An optional integer to override the status code of the response.",type:"integer",minimum:100,maximum:999},env:{description:"An array of environment variable names that should be replaced at runtime in the destination",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}},respectOriginCacheControl:{description:"When set to true (default), external rewrites will respect the Cache-Control header from the origin. When false, caching is disabled for this rewrite.",type:"boolean"}}}},redirectsSchema={title:"Redirects",type:"array",maxItems:2048,description:"A list of redirect definitions.",items:{type:"object",additionalProperties:!1,required:["source","destination"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring) or a full URL including domain.",type:"string",maxLength:4096},destination:{description:"A location destination defined as an absolute pathname or external URL.",type:"string",maxLength:4096},permanent:{description:"A boolean to toggle between permanent and temporary redirect. When `true`, the status code is `308`. When `false` the status code is `307`.",type:"boolean"},statusCode:{description:"An optional integer to define the status code of the redirect.",private:!0,type:"integer",minimum:100,maximum:999},has:hasSchema,missing:hasSchema,env:{description:"An array of environment variable names that should be replaced at runtime in the destination",type:"array",minItems:1,maxItems:64,items:{type:"string",maxLength:256}}}}},headersSchema={type:"array",maxItems:2048,description:"A list of header definitions.",items:{type:"object",additionalProperties:!1,required:["source","headers"],properties:{source:{description:"A pattern that matches each incoming pathname (excluding querystring)",type:"string",maxLength:4096},headers:{description:"An array of key/value pairs representing each response header.",type:"array",maxItems:1024,items:{type:"object",additionalProperties:!1,required:["key","value"],properties:{key:{type:"string",maxLength:4096},value:{type:"string",maxLength:32768}}}},has:hasSchema,missing:hasSchema}}},cleanUrlsSchema={description:"When set to `true`, all HTML files and Serverless Functions will have their extension removed. When visiting a path that ends with the extension, a 308 response will redirect the client to the extensionless path.",type:"boolean"},trailingSlashSchema={description:"When `false`, visiting a path that ends with a forward slash will respond with a `308` status code and redirect to the path without the trailing slash.",type:"boolean"}}});var require_types=__commonJS({"../routing-utils/dist/types.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),types_exports2={};module2.exports=__toCommonJS3(types_exports2)}});var require_dist4=__commonJS({"../routing-utils/dist/index.js"(exports2,module2){"use strict";var __defProp3=Object.defineProperty,__getOwnPropDesc3=Object.getOwnPropertyDescriptor,__getOwnPropNames3=Object.getOwnPropertyNames,__hasOwnProp3=Object.prototype.hasOwnProperty,__export3=(target,all)=>{for(var name in all)__defProp3(target,name,{get:all[name],enumerable:!0})},__copyProps3=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames3(from))!__hasOwnProp3.call(to,key)&&key!==except&&__defProp3(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc3(from,key))||desc.enumerable});return to},__reExport2=(target,mod,secondTarget)=>(__copyProps3(target,mod,"default"),secondTarget&&__copyProps3(secondTarget,mod,"default")),__toCommonJS3=mod=>__copyProps3(__defProp3({},"__esModule",{value:!0}),mod),src_exports={};__export3(src_exports,{appendRoutesToPhase:()=>import_append.appendRoutesToPhase,compilePathToRegexpTemplate:()=>import_superstatic2.compilePathToRegexpTemplate,convertRewrites:()=>import_superstatic2.convertRewrites,getCleanUrls:()=>import_superstatic2.getCleanUrls,getOwnershipGuard:()=>import_service_route_ownership.getOwnershipGuard,getTransformedRoutes:()=>getTransformedRoutes,isHandler:()=>isHandler,isValidHandleValue:()=>isValidHandleValue,mergeRoutes:()=>import_merge.mergeRoutes,normalizeRoutePrefix:()=>import_service_route_ownership.normalizeRoutePrefix,normalizeRoutes:()=>normalizeRoutes,pathToRegexp:()=>import_superstatic2.pathToRegexp,scopeRouteSourceToOwnership:()=>import_service_route_ownership.scopeRouteSourceToOwnership,sourceToRegex:()=>import_superstatic2.sourceToRegex});module2.exports=__toCommonJS3(src_exports);var import_url=require("url"),import_superstatic=require_superstatic(),import_append=require_append(),import_merge=require_merge2(),import_service_route_ownership=require_service_route_ownership();__reExport2(src_exports,require_schemas(),module2.exports);var import_superstatic2=require_superstatic();__reExport2(src_exports,require_types(),module2.exports);var VALID_HANDLE_VALUES=["filesystem","hit","miss","rewrite","error","resource"],validHandleValues=new Set(VALID_HANDLE_VALUES);function isHandler(route){return typeof route.handle<"u"}function isValidHandleValue(handle){return validHandleValues.has(handle)}function convertRouteAliases(route,index){if(route.source!==void 0){if(route.src!==void 0)throw new Error(`Route at index ${index} cannot define both \`src\` and \`source\`. Please use only one.`);route.src=route.source,delete route.source}if(route.destination!==void 0){if(route.dest!==void 0)throw new Error(`Route at index ${index} cannot define both \`dest\` and \`destination\`. Please use only one.`);typeof route.destination=="string"?(route.dest=route.destination,delete route.destination):typeof route.destination.service=="string"&&(route.destination={...route.destination,type:"service"})}if(route.statusCode!==void 0){if(route.status!==void 0)throw new Error(`Route at index ${index} cannot define both \`status\` and \`statusCode\`. Please use only one.`);route.status=route.statusCode,delete route.statusCode}}function normalizeRoutes(inputRoutes){if(!inputRoutes||inputRoutes.length===0)return{routes:inputRoutes,error:null};let routes=[],handling=[],errors=[];inputRoutes.forEach((r,i)=>{let route={...r};if(routes.push(route),!isHandler(route))try{convertRouteAliases(route,i)}catch(err){errors.push(err.message)}let keys=Object.keys(route);if(isHandler(route)){let{handle}=route;if(keys.length!==1){let unknownProp=keys.find(prop=>prop!=="handle");errors.push(`Route at index ${i} has unknown property \`${unknownProp}\`.`)}else isValidHandleValue(handle)?handling.includes(handle)?errors.push(`Route at index ${i} is a duplicate. Please use one \`handle: ${handle}\` at most.`):handling.push(handle):errors.push(`Route at index ${i} has unknown handle value \`handle: ${handle}\`.`)}else if(route.src){route.src.startsWith("^")||(route.src=`^${route.src}`),route.src.endsWith("$")||(route.src=`${route.src}$`),route.src=route.src.replace(/\\\//g,"/");let regError=checkRegexSyntax("Route",i,route.src);regError&&errors.push(regError),route.destination&&typeof route.destination=="object"&&route.continue&&errors.push(`Route at index ${i} cannot define \`continue: true\` with a service \`destination\`. The service handoff is terminal.`);let handleValue=handling[handling.length-1];handleValue==="hit"?(route.dest&&errors.push(`Route at index ${i} cannot define \`dest\`/\`destination\` after \`handle: hit\`.`),route.status&&errors.push(`Route at index ${i} cannot define \`status\`/\`statusCode\` after \`handle: hit\`.`),route.continue||errors.push(`Route at index ${i} must define \`continue: true\` after \`handle: hit\`.`)):handleValue==="miss"&&(route.dest&&!route.check?errors.push(`Route at index ${i} must define \`check: true\` after \`handle: miss\`.`):!route.dest&&!route.continue&&errors.push(`Route at index ${i} must define \`continue: true\` after \`handle: miss\`.`))}else errors.push(`Route at index ${i} must define either \`src\` or \`source\` property.`)});let error=errors.length>0?createError("invalid_route",errors,"https://vercel.link/routes-json","Learn More"):null;return{routes,error}}function checkRegexSyntax(type,index,src){try{new RegExp(src)}catch{return`${type} at index ${index} has invalid \`${type==="Route"?"src`/`source":"source"}\` regular expression "${src}".`}return null}function checkPatternSyntax(type,index,{source,destination,has,transforms}){let sourceSegments=new Set,destinationSegments=new Set;try{sourceSegments=new Set((0,import_superstatic.sourceToRegex)(source).segments)}catch{return{message:`${type} at index ${index} has invalid \`source\` pattern "${source}".`,link:"https://vercel.link/invalid-route-source-pattern"}}let destinationString=typeof destination=="string"?destination:typeof destination?.path=="string"?destination.path:void 0;if(destinationString!==void 0){try{let{hostname,pathname,query}=(0,import_url.parse)(destinationString,!0);(0,import_superstatic.sourceToRegex)(hostname||"").segments.forEach(name=>destinationSegments.add(name)),(0,import_superstatic.sourceToRegex)(pathname||"").segments.forEach(name=>destinationSegments.add(name));for(let strOrArray of Object.values(query)){let value=Array.isArray(strOrArray)?strOrArray[0]:strOrArray;(0,import_superstatic.sourceToRegex)(value||"").segments.forEach(name=>destinationSegments.add(name))}}catch{}let hasSegments=(0,import_superstatic.collectHasSegments)(has);for(let segment of destinationSegments)if(!sourceSegments.has(segment)&&!hasSegments.includes(segment))return{message:`${type} at index ${index} has segment ":${segment}" in \`destination\` property but not in \`source\` or \`has\` property.`,link:"https://vercel.link/invalid-route-destination-segment"}}for(let transform of transforms||[])if(transform.type==="request.path")try{(0,import_superstatic.compilePathToRegexpTemplate)(source,transform.args,has,transform.env)}catch(error){return{message:`${type} at index ${index} has an invalid \`request.path\` transform: ${error instanceof Error?error.message:String(error)}`,link:"https://vercel.link/invalid-route-destination-segment"}}return null}function checkRedirect(r,index){return typeof r.permanent<"u"&&typeof r.statusCode<"u"?`Redirect at index ${index} cannot define both \`permanent\` and \`statusCode\` properties.`:null}function createError(code,allErrors,link,action){let errors=Array.isArray(allErrors)?allErrors:[allErrors],message=errors[0];return{name:"RouteApiError",code,message,link,action,errors}}function notEmpty(value){return value!=null}function getTransformedRoutes(vercelConfig){let{cleanUrls,rewrites,redirects,headers,trailingSlash}=vercelConfig,{routes:userRoutes=null}=vercelConfig,routes=null;if(typeof cleanUrls<"u"){let normalized=normalizeRoutes((0,import_superstatic.convertCleanUrls)(cleanUrls,trailingSlash));if(normalized.error)return normalized.error.code="invalid_clean_urls",{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof trailingSlash<"u"){let normalized=normalizeRoutes((0,import_superstatic.convertTrailingSlash)(trailingSlash));if(normalized.error)return normalized.error.code="invalid_trailing_slash",{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(userRoutes){let normalized=normalizeRoutes(userRoutes);if(normalized.error)return{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof redirects<"u"){let code="invalid_redirect",regexErrorMessage=redirects.map((r,i)=>checkRegexSyntax("Redirect",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError("invalid_redirect",regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=redirects.map((r,i)=>checkPatternSyntax("Redirect",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let redirectErrorMessage=redirects.map(checkRedirect).find(notEmpty);if(redirectErrorMessage)return{routes,error:createError(code,redirectErrorMessage,"https://vercel.link/redirects-json","Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertRedirects)(redirects));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof headers<"u"){let code="invalid_header",regexErrorMessage=headers.map((r,i)=>checkRegexSyntax("Header",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError(code,regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=headers.map((r,i)=>checkPatternSyntax("Header",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertHeaders)(headers));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push(...normalized.routes||[])}if(typeof rewrites<"u"){let code="invalid_rewrite",regexErrorMessage=rewrites.map((r,i)=>checkRegexSyntax("Rewrite",i,r.source)).find(notEmpty);if(regexErrorMessage)return{routes,error:createError(code,regexErrorMessage,"https://vercel.link/invalid-route-source-pattern","Learn More")};let patternError=rewrites.map((r,i)=>checkPatternSyntax("Rewrite",i,r)).find(notEmpty);if(patternError)return{routes,error:createError(code,patternError.message,patternError.link,"Learn More")};let normalized=normalizeRoutes((0,import_superstatic.convertRewrites)(rewrites));if(normalized.error)return normalized.error.code=code,{routes,error:normalized.error};routes=routes||[],routes.push({handle:"filesystem"}),routes.push(...normalized.routes||[])}return{routes,error:null}}}});var middleware_matcher_exports={};__export(middleware_matcher_exports,{getRegExpFromMatchers:()=>getRegExpFromMatchers,resolveMiddlewareMatcher:()=>resolveMiddlewareMatcher});function getRegExpFromMatchers(matcherOrMatchers){return matcherOrMatchers?(Array.isArray(matcherOrMatchers)?matcherOrMatchers:[matcherOrMatchers]).flatMap(getRegExpFromMatcher).join("|"):"^/.*$"}function resolveMiddlewareMatcher(configuredMatcher,sourceMatcher,entrypoint){if(configuredMatcher!==void 0&&sourceMatcher!==void 0)throw new Error(`${entrypoint}: \`proxy.matcher\` in vercel.json conflicts with \`config.matcher\` exported from the proxy entrypoint. Configure the matcher in only one location.`);return configuredMatcher??sourceMatcher}function getRegExpFromMatcher(matcher,_index,allMatchers){if(typeof matcher!="string")throw new Error("Middleware's `config.matcher` must be a path matcher (string) or an array of path matchers (string[])");if(!matcher.startsWith("/"))throw new Error(`Middleware's \`config.matcher\` values must start with "/". Received: ${matcher}`);let regExps=[(0,import_routing_utils.pathToRegexp)("316",matcher).source];return matcher==="/"&&!allMatchers.includes("/index")&®Exps.push((0,import_routing_utils.pathToRegexp)("491","/index").source),regExps}var import_routing_utils,init_middleware_matcher=__esm({"src/middleware-matcher.ts"(){"use strict";import_routing_utils=__toESM(require_dist4())}});var framework_helpers_exports={};__export(framework_helpers_exports,{BACKEND_BUILDERS:()=>BACKEND_BUILDERS,BACKEND_FRAMEWORKS:()=>BACKEND_FRAMEWORKS,PYTHON_FRAMEWORKS:()=>PYTHON_FRAMEWORKS,RUNTIME_FRAMEWORKS:()=>RUNTIME_FRAMEWORKS,UNIFIED_BACKEND_BUILDER:()=>UNIFIED_BACKEND_BUILDER,isBackendBuilder:()=>isBackendBuilder,isBackendFramework:()=>isBackendFramework,isExperimentalBackendsEnabled:()=>isExperimentalBackendsEnabled,isExperimentalBackendsWithoutIntrospectionEnabled:()=>isExperimentalBackendsWithoutIntrospectionEnabled,isNodeBackendFramework:()=>isNodeBackendFramework,isPythonFramework:()=>isPythonFramework,shouldUseExperimentalBackends:()=>shouldUseExperimentalBackends});function isBackendFramework(framework){return framework?BACKEND_FRAMEWORKS.includes(framework):!1}function isNodeBackendFramework(framework){return framework?BACKEND_FRAMEWORKS.includes(framework):!1}function isPythonFramework(framework){return framework?PYTHON_FRAMEWORKS.includes(framework):!1}function isExperimentalBackendsWithoutIntrospectionEnabled(){return process.env.VERCEL_BACKENDS_BUILDS==="1"}function isExperimentalBackendsEnabled(){return isExperimentalBackendsWithoutIntrospectionEnabled()||process.env.VERCEL_EXPERIMENTAL_BACKENDS==="1"||process.env.VERCEL_EXPERIMENTAL_EXPRESS_BUILD==="1"||process.env.VERCEL_EXPERIMENTAL_HONO_BUILD==="1"}function isBackendBuilder(builder){if(!builder)return!1;if(builder.use===UNIFIED_BACKEND_BUILDER)return!0;let use=builder.use;return BACKEND_BUILDERS.includes(use)}function shouldUseExperimentalBackends(framework){return isExperimentalBackendsEnabled()&&isBackendFramework(framework)}var BACKEND_FRAMEWORKS,PYTHON_FRAMEWORKS,RUNTIME_FRAMEWORKS,BACKEND_BUILDERS,UNIFIED_BACKEND_BUILDER,init_framework_helpers=__esm({"src/framework-helpers.ts"(){"use strict";BACKEND_FRAMEWORKS=["express","hono","h3","koa","nestjs","fastify","elysia"],PYTHON_FRAMEWORKS=["fastapi","flask","django","python","fasthtml"],RUNTIME_FRAMEWORKS=["python"],BACKEND_BUILDERS=["@vercel/express","@vercel/hono","@vercel/h3","@vercel/koa","@vercel/nestjs","@vercel/fastify","@vercel/elysia"],UNIFIED_BACKEND_BUILDER="@vercel/backends"}});function parse4(E3,g2="@"){if(!C)return init.then(()=>parse4(E3));let I=E3.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));let D=C.sa(I-1);if((A?B:Q)(E3,new Uint16Array(C.memory.buffer,D,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g2}:${E3.slice(0,C.e()).split(`
|
|
113
113
|
`).length}:${C.e()-E3.lastIndexOf(`
|
|
114
114
|
`,C.e()-1)}`),{idx:C.e()});let o=[],K=[];for(;C.ri();){let A3=C.is(),Q3=C.ie(),B3=C.it(),g3=C.ai(),I2=C.id(),w2=C.ss(),D2=C.se(),K2;C.ip()&&(K2=k(E3.slice(I2===-1?A3-1:A3,I2===-1?Q3+1:Q3))),o.push({n:K2,t:B3,s:A3,e:Q3,ss:w2,se:D2,d:I2,a:g3})}for(;C.re();){let A3=C.es(),Q3=C.ee(),B3=C.els(),g3=C.ele(),I2=E3.slice(A3,Q3),w2=I2[0],D2=B3<0?void 0:E3.slice(B3,g3),o2=D2?D2[0]:"";K.push({s:A3,e:Q3,ls:B3,le:g3,n:w2==='"'||w2==="'"?k(I2):I2,ln:o2==='"'||o2==="'"?k(D2):D2})}function k(A3){try{return(0,eval)(A3)}catch{}}return[o,K,!!C.f(),!!C.ms()]}function Q(A3,Q3){let B3=A3.length,C3=0;for(;C3<B3;){let B4=A3.charCodeAt(C3);Q3[C3++]=(255&B4)<<8|B4>>>8}}function B(A3,Q3){let B3=A3.length,C3=0;for(;C3<B3;)Q3[C3]=A3.charCodeAt(C3++)}var ImportType,A,C,init,E,init_lexer=__esm({"../../node_modules/.pnpm/es-module-lexer@1.5.0/node_modules/es-module-lexer/dist/lexer.js"(){(function(A3){A3[A3.Static=1]="Static",A3[A3.Dynamic=2]="Dynamic",A3[A3.ImportMeta=3]="ImportMeta",A3[A3.StaticSourcePhase=4]="StaticSourcePhase",A3[A3.DynamicSourcePhase=5]="DynamicSourcePhase"})(ImportType||(ImportType={}));A=new Uint8Array(new Uint16Array([1]).buffer)[0]===1;init=WebAssembly.compile((E="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAAAAAAAAwMDAAUGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKxUAwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGIgAbIAQgA0YiBBs2AgwgBSADNgIUIAVBADYCECAFIAI2AgQgBUEANgIgIAVBA0ECQQEgABsgBBs2AhwgBUEAKALQCSADRiICOgAYAkACQCACDQBBACgC1AkgA0cNAQtBAEEBOgCMCgsLXgEBf0EAKAL4CSIEQRBqQeQJIAQbQQAoAogKIgQ2AgBBACAENgL4CUEAIARBFGo2AogKQQBBAToAjAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKQCgsVAEEAKALoCSgCAEE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gCsAoiAi8BACIDQeEARg0AIAEhBCAAIQUMAQtBACACQQRqNgKwCkEBECkhAkEAKAKwCiEFAkACQCACQSJGDQAgAkEnRg0AIAIQLBpBACgCsAohBAwBCyACEBpBAEEAKAKwCkECaiIENgKwCgtBARApIQNBACgCsAohAgsCQCACIAVGDQAgBSAEQQAgACAAIAFGIgIbQQAgASACGxACCyADC3IBBH9BACgCsAohAEEAKAK0CiEBAkACQANAIABBAmohAiAAIAFPDQECQAJAIAIvAQAiA0Gkf2oOAgEEAAsgAiEAIANBdmoOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCsAoQJEEADwtBACACNgKwCkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwvsAQIAQYAIC84BAAB4AHAAbwByAHQAbQBwAG8AcgB0AGUAdABhAG8AdQByAGMAZQByAG8AbQB1AG4AYwB0AGkAbwBuAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBjAG8AbgB0AGkAbgBpAG4AcwB0AGEAbgB0AHkAYgByAGUAYQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQdAJCxABAAAAAgAAAAAEAABAOQAA",typeof Buffer<"u"?Buffer.from(E,"base64"):Uint8Array.from(atob(E),A3=>A3.charCodeAt(0)))).then(WebAssembly.instantiate).then(({exports:A3})=>{C=A3})}});function parse5(g2,I="@"){if(!A2)throw new Error("Not initialized");let D=g2.length+1,N=(A2.__heap_base.value||A2.__heap_base)+4*D-A2.memory.buffer.byteLength;N>0&&A2.memory.grow(Math.ceil(N/65536));let k=A2.sa(D);if((Q2?C2:E2)(g2,new Uint16Array(A2.memory.buffer,k,D)),!A2.parseCJS(k,g2.length,0,0,0))throw Object.assign(new Error(`Parse error ${I}${A2.e()}:${g2.slice(0,A2.e()).split(`
|
|
115
115
|
`).length}:${A2.e()-g2.lastIndexOf(`
|
package/dist/trace/trace.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare class Span {
|
|
|
20
20
|
private parentId?;
|
|
21
21
|
private attrs;
|
|
22
22
|
private status;
|
|
23
|
+
private _duration;
|
|
23
24
|
private _start;
|
|
24
25
|
private now;
|
|
25
26
|
private _reporter;
|
|
@@ -30,6 +31,8 @@ export declare class Span {
|
|
|
30
31
|
reporter?: Reporter;
|
|
31
32
|
});
|
|
32
33
|
stop(): void;
|
|
34
|
+
/** Duration in microseconds, as reported in the trace event; undefined until stopped. */
|
|
35
|
+
get duration(): number | undefined;
|
|
33
36
|
setAttributes(attrs: Attributes): void;
|
|
34
37
|
child(name: string, attrs?: Attributes): Span;
|
|
35
38
|
/**
|
package/dist/trace/trace.js
CHANGED
|
@@ -53,6 +53,7 @@ class Span {
|
|
|
53
53
|
this.status = "stopped";
|
|
54
54
|
const end = process.hrtime.bigint();
|
|
55
55
|
const duration = Number((end - this._start) / NUM_OF_MICROSEC_IN_NANOSEC);
|
|
56
|
+
this._duration = duration;
|
|
56
57
|
const timestamp = Number(this._start / NUM_OF_MICROSEC_IN_NANOSEC);
|
|
57
58
|
const traceEvent = {
|
|
58
59
|
name: this.name,
|
|
@@ -67,6 +68,10 @@ class Span {
|
|
|
67
68
|
this._reporter.report(traceEvent);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
71
|
+
/** Duration in microseconds, as reported in the trace event; undefined until stopped. */
|
|
72
|
+
get duration() {
|
|
73
|
+
return this._duration;
|
|
74
|
+
}
|
|
70
75
|
setAttributes(attrs) {
|
|
71
76
|
Object.assign(this.attrs, mapUndefinedAttributes(attrs));
|
|
72
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"vitest": "4.1.10",
|
|
49
49
|
"typescript": "4.9.5",
|
|
50
50
|
"yazl": "2.5.1",
|
|
51
|
-
"@vercel/
|
|
52
|
-
"@vercel/
|
|
51
|
+
"@vercel/routing-utils": "6.6.1",
|
|
52
|
+
"@vercel/error-utils": "2.2.1"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "node build.mjs",
|