( matches: Map<string, BuildMatch>, files: BuilderInputs, requestPath: string, devServer: DevServer, vercelConfig: VercelConfig, isFilesystem = false )
| 3230 | } |
| 3231 | |
| 3232 | async function findBuildMatch( |
| 3233 | matches: Map<string, BuildMatch>, |
| 3234 | files: BuilderInputs, |
| 3235 | requestPath: string, |
| 3236 | devServer: DevServer, |
| 3237 | vercelConfig: VercelConfig, |
| 3238 | isFilesystem = false |
| 3239 | ): Promise<BuildMatch | null> { |
| 3240 | requestPath = requestPath.replace(/^\//, ''); |
| 3241 | |
| 3242 | let bestIndexMatch: undefined | BuildMatch; |
| 3243 | for (const match of matches.values()) { |
| 3244 | if ( |
| 3245 | await shouldServe( |
| 3246 | match, |
| 3247 | files, |
| 3248 | requestPath, |
| 3249 | devServer, |
| 3250 | vercelConfig, |
| 3251 | isFilesystem, |
| 3252 | !!bestIndexMatch |
| 3253 | ) |
| 3254 | ) { |
| 3255 | if (!isIndex(match.src)) { |
| 3256 | return match; |
| 3257 | } else { |
| 3258 | // If isIndex === true and ends in `.html`, we're done. |
| 3259 | // Otherwise, keep searching. |
| 3260 | if (extname(match.src) === '.html') { |
| 3261 | return match; |
| 3262 | } |
| 3263 | bestIndexMatch = match; |
| 3264 | } |
| 3265 | } |
| 3266 | } |
| 3267 | |
| 3268 | // return a non-.html index file or none are found |
| 3269 | return bestIndexMatch || null; |
| 3270 | } |
| 3271 | |
| 3272 | async function shouldServe( |
| 3273 | match: BuildMatch, |
no test coverage detected