MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / routeAddresses

Function routeAddresses

src/resolution/frameworks/next-proxy.ts:310–319  ·  view source on GitHub ↗

* Addresses a route serves, one of each shape: a parameter is a segment no * literal stands for, so `/blog/featured` doesn't cover `/blog/[slug]` (a * `blog/featured` page would own that address), and the route's name writes * `[...all]` and `[[...all]]` alike as `:all*`, so the file says which m

(path: string, routeFile: string)

Source from the content-addressed store, hash-verified

308 * empty.
309 */
310function routeAddresses(path: string, routeFile: string): string[] {
311 const segments = path.split('/').filter(Boolean);
312 const filled = segments.map((segment) => (segment.startsWith(':') ? ANY_SEGMENT : segment));
313 const addresses = [`/${filled.join('/')}`];
314 const last = segments[segments.length - 1];
315 if (last?.endsWith('*') && routeFile.includes(`[[...${last.slice(1, -1)}]]`)) {
316 addresses.push(`/${filled.slice(0, -1).join('/')}`);
317 }
318 return addresses;
319}
320
321/** Whether a compiled matcher entry accepts an address the route serves. */
322export function matcherCovers(matcher: RegExp, routePath: string, routeFile: string): boolean {

Callers 1

matcherCoversFunction · 0.85

Calls 3

mapMethod · 0.80
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected