vinext 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/static-export.d.ts.map +1 -1
- package/dist/build/static-export.js +9 -7
- package/dist/build/static-export.js.map +1 -1
- package/dist/config/next-config.d.ts +4 -1
- package/dist/config/next-config.d.ts.map +1 -1
- package/dist/config/next-config.js +10 -5
- package/dist/config/next-config.js.map +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +17 -4
- package/dist/deploy.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +381 -38
- package/dist/index.js.map +1 -1
- package/dist/routing/app-router.d.ts +2 -1
- package/dist/routing/app-router.d.ts.map +1 -1
- package/dist/routing/app-router.js +74 -107
- package/dist/routing/app-router.js.map +1 -1
- package/dist/routing/file-matcher.d.ts +24 -0
- package/dist/routing/file-matcher.d.ts.map +1 -0
- package/dist/routing/file-matcher.js +75 -0
- package/dist/routing/file-matcher.js.map +1 -0
- package/dist/routing/pages-router.d.ts +3 -2
- package/dist/routing/pages-router.d.ts.map +1 -1
- package/dist/routing/pages-router.js +25 -44
- package/dist/routing/pages-router.js.map +1 -1
- package/dist/routing/utils.d.ts +25 -0
- package/dist/routing/utils.d.ts.map +1 -0
- package/dist/routing/utils.js +70 -0
- package/dist/routing/utils.js.map +1 -0
- package/dist/server/app-dev-server.d.ts.map +1 -1
- package/dist/server/app-dev-server.js +123 -47
- package/dist/server/app-dev-server.js.map +1 -1
- package/dist/server/dev-server.d.ts +2 -1
- package/dist/server/dev-server.d.ts.map +1 -1
- package/dist/server/dev-server.js +93 -18
- package/dist/server/dev-server.js.map +1 -1
- package/dist/server/prod-server.d.ts.map +1 -1
- package/dist/server/prod-server.js +33 -2
- package/dist/server/prod-server.js.map +1 -1
- package/dist/server/request-log.d.ts +34 -0
- package/dist/server/request-log.d.ts.map +1 -0
- package/dist/server/request-log.js +65 -0
- package/dist/server/request-log.js.map +1 -0
- package/dist/shims/cache-runtime.d.ts.map +1 -1
- package/dist/shims/cache-runtime.js +5 -1
- package/dist/shims/cache-runtime.js.map +1 -1
- package/dist/shims/cache.d.ts +7 -1
- package/dist/shims/cache.d.ts.map +1 -1
- package/dist/shims/cache.js +30 -5
- package/dist/shims/cache.js.map +1 -1
- package/dist/shims/head.d.ts +11 -0
- package/dist/shims/head.d.ts.map +1 -1
- package/dist/shims/head.js +21 -0
- package/dist/shims/head.js.map +1 -1
- package/dist/shims/headers.d.ts +8 -0
- package/dist/shims/headers.d.ts.map +1 -1
- package/dist/shims/headers.js +41 -0
- package/dist/shims/headers.js.map +1 -1
- package/dist/shims/metadata.d.ts +1 -0
- package/dist/shims/metadata.d.ts.map +1 -1
- package/dist/shims/metadata.js +5 -1
- package/dist/shims/metadata.js.map +1 -1
- package/dist/shims/script.d.ts.map +1 -1
- package/dist/shims/script.js +7 -1
- package/dist/shims/script.js.map +1 -1
- package/dist/shims/server.d.ts.map +1 -1
- package/dist/shims/server.js +2 -1
- package/dist/shims/server.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-router.js","sourceRoot":"","sources":["../../src/routing/app-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAwFxC,uBAAuB;AACvB,IAAI,YAAY,GAAsB,IAAI,CAAC;AAC3C,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,MAAM,UAAU,uBAAuB;IACrC,YAAY,GAAG,IAAI,CAAC;IACpB,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,IAAI,YAAY,IAAI,YAAY,KAAK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AAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,iBAAiB,GAAG,CAAC,CAAC;IAE1B,gEAAgE;IAChE,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM;QACnE,iBAAiB,EAAE,CAAC;IACtB,CAAC;IAED,wEAAwE;IACxE,0DAA0D;IAC1D,KAAK,IAAI,iBAAiB,GAAG,KAAK,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,8BAA8B;QACnD,CAAC;aAAM,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,KAAK,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,mCAAmC;QACxD,CAAC;aAAM,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,KAAK,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,qCAAqC;QACzD,CAAC;QACD,6DAA6D;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * App Router file-system routing.\n *\n * Scans the app/ directory following Next.js App Router conventions:\n * - app/page.tsx -> /\n * - app/about/page.tsx -> /about\n * - app/blog/[slug]/page.tsx -> /blog/:slug\n * - app/[...catchAll]/page.tsx -> /:catchAll+\n * - app/route.ts -> / (API route)\n * - app/(group)/page.tsx -> / (route groups are transparent)\n * - Layouts: app/layout.tsx wraps all children\n * - Loading: app/loading.tsx -> Suspense fallback\n * - Error: app/error.tsx -> ErrorBoundary\n * - Not Found: app/not-found.tsx\n */\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { glob } from \"node:fs/promises\";\n\nexport interface InterceptingRoute {\n /** The interception convention: \".\" | \"..\" | \"../..\" | \"...\" */\n convention: string;\n /** The URL pattern this intercepts (e.g. \"/photos/:id\") */\n targetPattern: string;\n /** Absolute path to the intercepting page component */\n pagePath: string;\n /** Parameter names for dynamic segments */\n params: string[];\n}\n\nexport interface ParallelSlot {\n /** Slot name (e.g. \"team\" from @team) */\n name: string;\n /** Absolute path to the slot's page component */\n pagePath: string | null;\n /** Absolute path to the slot's default.tsx fallback */\n defaultPath: string | null;\n /** Absolute path to the slot's layout component (wraps slot content) */\n layoutPath: string | null;\n /** Absolute path to the slot's loading component */\n loadingPath: string | null;\n /** Absolute path to the slot's error component */\n errorPath: string | null;\n /** Intercepting routes within this slot */\n interceptingRoutes: InterceptingRoute[];\n /**\n * The layout index (0-based, in route.layouts[]) that this slot belongs to.\n * Slots are passed as props to the layout at their directory level, not\n * necessarily the innermost layout. -1 means \"innermost\" (legacy default).\n */\n layoutIndex: number;\n}\n\nexport interface AppRoute {\n /** URL pattern, e.g. \"/\" or \"/about\" or \"/blog/:slug\" */\n pattern: string;\n /** Absolute file path to the page component */\n pagePath: string | null;\n /** Absolute file path to the route handler (route.ts) */\n routePath: string | null;\n /** Ordered list of layout files from root to leaf */\n layouts: string[];\n /** Ordered list of template files from root to leaf (parallel to layouts) */\n templates: string[];\n /** Parallel route slots (from @slot directories at the route's directory level) */\n parallelSlots: ParallelSlot[];\n /** Loading component path */\n loadingPath: string | null;\n /** Error component path (leaf directory only) */\n errorPath: string | null;\n /**\n * Per-layout error boundary paths, aligned with the layouts array.\n * Each entry is the error.tsx at the same directory level as the\n * corresponding layout (or null if that level has no error.tsx).\n * Used to interleave ErrorBoundary components with layouts so that\n * ancestor error boundaries catch errors from descendant segments.\n */\n layoutErrorPaths: (string | null)[];\n /** Not-found component path (nearest, walking up from page dir) */\n notFoundPath: string | null;\n /**\n * Not-found component paths per layout level (aligned with layouts array).\n * Each entry is the not-found.tsx at that layout's directory, or null.\n * Used to create per-layout NotFoundBoundary so that notFound() thrown from\n * a layout is caught by the parent layout's boundary (matching Next.js behavior).\n */\n notFoundPaths: (string | null)[];\n /** Forbidden component path (403) */\n forbiddenPath: string | null;\n /** Unauthorized component path (401) */\n unauthorizedPath: string | null;\n /**\n * URL segment depth for each layout in the layouts array.\n * Used by useSelectedLayoutSegments() to determine which segments are\n * below a given layout. For example, root layout has depth 0, a layout\n * at app/dashboard/ has depth 1 (one URL segment: \"dashboard\").\n * Route groups and parallel slots don't contribute to the depth.\n */\n layoutSegmentDepths: number[];\n /** Whether this is a dynamic route */\n isDynamic: boolean;\n /** Parameter names for dynamic segments */\n params: string[];\n}\n\n// Cache for app routes\nlet cachedRoutes: AppRoute[] | null = null;\nlet cachedAppDir: string | null = null;\n\nexport function invalidateAppRouteCache(): void {\n cachedRoutes = null;\n cachedAppDir = null;\n}\n\n/**\n * Scan the app/ directory and return a list of routes.\n */\nexport async function appRouter(appDir: string): Promise<AppRoute[]> {\n if (cachedRoutes && cachedAppDir === appDir) return cachedRoutes;\n\n // Find all page.tsx and route.ts files, excluding @slot directories\n // (slot pages are not standalone routes — they're rendered as props of their parent layout)\n const routes: AppRoute[] = [];\n\n // Process page files in a single pass\n // Use function form of exclude for Node < 22.14 compatibility (string arrays require >= 22.14)\n for await (const file of glob(\"**/page.{tsx,ts,jsx,js}\", { cwd: appDir, exclude: (name: string) => name.startsWith(\"@\") })) {\n const route = fileToAppRoute(file, appDir, \"page\");\n if (route) routes.push(route);\n }\n\n // Process route handler files (API routes) in a single pass\n for await (const file of glob(\"**/route.{tsx,ts,jsx,js}\", { cwd: appDir, exclude: (name: string) => name.startsWith(\"@\") })) {\n const route = fileToAppRoute(file, appDir, \"route\");\n if (route) routes.push(route);\n }\n\n // Discover sub-routes created by nested pages within parallel slots.\n // In Next.js, pages nested inside @slot directories create additional URL routes.\n // For example, @audience/demographics/page.tsx at app/parallel-routes/ creates\n // a route at /parallel-routes/demographics.\n const slotSubRoutes = discoverSlotSubRoutes(routes, appDir);\n routes.push(...slotSubRoutes);\n\n // Sort: static routes first, then dynamic, then catch-all\n routes.sort((a, b) => {\n const diff = routePrecedence(a.pattern) - routePrecedence(b.pattern);\n return diff !== 0 ? diff : a.pattern.localeCompare(b.pattern);\n });\n\n cachedRoutes = routes;\n cachedAppDir = appDir;\n return routes;\n}\n\n/**\n * Discover sub-routes created by nested pages within parallel slots.\n *\n * In Next.js, pages nested inside @slot directories create additional URL routes.\n * For example, given:\n * app/parallel-routes/@audience/demographics/page.tsx\n * This creates a route at /parallel-routes/demographics where:\n * - children slot → parent's default.tsx\n * - @audience slot → @audience/demographics/page.tsx (matched)\n * - other slots → their default.tsx (fallback)\n */\nfunction discoverSlotSubRoutes(\n routes: AppRoute[],\n _appDir: string,\n): AppRoute[] {\n const syntheticRoutes: AppRoute[] = [];\n const existingPatterns = new Set(routes.map((r) => r.pattern));\n\n for (const parentRoute of routes) {\n if (parentRoute.parallelSlots.length === 0) continue;\n if (!parentRoute.pagePath) continue;\n\n const parentPageDir = path.dirname(parentRoute.pagePath);\n\n // Collect sub-paths from all slots.\n // Map: relative sub-path (e.g., \"demographics\") -> Map<slotName, pagePath>\n const subPathMap = new Map<string, Map<string, string>>();\n\n for (const slot of parentRoute.parallelSlots) {\n const slotDir = path.join(parentPageDir, `@${slot.name}`);\n if (!fs.existsSync(slotDir)) continue;\n\n const subPages = findSlotSubPages(slotDir);\n for (const { relativePath, pagePath } of subPages) {\n if (!subPathMap.has(relativePath)) {\n subPathMap.set(relativePath, new Map());\n }\n subPathMap.get(relativePath)!.set(slot.name, pagePath);\n }\n }\n\n if (subPathMap.size === 0) continue;\n\n // Find the default.tsx for the children slot at the parent directory\n const childrenDefault = findFile(parentPageDir, \"default\");\n\n for (const [subPath, slotPages] of subPathMap) {\n // Convert sub-path segments to URL pattern parts\n const subSegments = subPath.split(path.sep);\n const urlParts: string[] = [];\n const subParams: string[] = [];\n let subIsDynamic = false;\n\n for (const seg of subSegments) {\n // Route groups are transparent\n if (seg.startsWith(\"(\") && seg.endsWith(\")\")) continue;\n\n const catchAllMatch = seg.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n subIsDynamic = true;\n subParams.push(catchAllMatch[1]);\n urlParts.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n const optionalCatchAllMatch = seg.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n subIsDynamic = true;\n subParams.push(optionalCatchAllMatch[1]);\n urlParts.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n const dynamicMatch = seg.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n subIsDynamic = true;\n subParams.push(dynamicMatch[1]);\n urlParts.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n urlParts.push(seg);\n }\n\n const subUrlPath = urlParts.join(\"/\");\n const pattern =\n parentRoute.pattern === \"/\"\n ? \"/\" + subUrlPath\n : parentRoute.pattern + \"/\" + subUrlPath;\n\n // Skip if this pattern already exists as a regular route\n if (existingPatterns.has(pattern)) continue;\n if (syntheticRoutes.some((r) => r.pattern === pattern)) continue;\n\n // Build parallel slots for this sub-route: matching slots get the sub-page,\n // non-matching slots get null pagePath (rendering falls back to defaultPath)\n const subSlots: ParallelSlot[] = parentRoute.parallelSlots.map(\n (slot) => ({\n ...slot,\n pagePath: slotPages.get(slot.name) || null,\n }),\n );\n\n syntheticRoutes.push({\n pattern,\n pagePath: childrenDefault, // children slot uses parent's default.tsx as page\n routePath: null,\n layouts: parentRoute.layouts,\n templates: parentRoute.templates,\n parallelSlots: subSlots,\n loadingPath: parentRoute.loadingPath,\n errorPath: parentRoute.errorPath,\n layoutErrorPaths: parentRoute.layoutErrorPaths,\n notFoundPath: parentRoute.notFoundPath,\n notFoundPaths: parentRoute.notFoundPaths,\n forbiddenPath: parentRoute.forbiddenPath,\n unauthorizedPath: parentRoute.unauthorizedPath,\n layoutSegmentDepths: parentRoute.layoutSegmentDepths,\n isDynamic: parentRoute.isDynamic || subIsDynamic,\n params: [...parentRoute.params, ...subParams],\n });\n }\n }\n\n return syntheticRoutes;\n}\n\n/**\n * Find all page files in subdirectories of a parallel slot directory.\n * Returns relative paths (from the slot dir) and absolute page paths.\n * Skips the root page.tsx (already handled as the slot's main page)\n * and intercepting route directories.\n */\nfunction findSlotSubPages(\n slotDir: string,\n): Array<{ relativePath: string; pagePath: string }> {\n const results: Array<{ relativePath: string; pagePath: string }> = [];\n\n function scan(dir: string): void {\n if (!fs.existsSync(dir)) return;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n // Skip intercepting route directories\n if (matchInterceptConvention(entry.name)) continue;\n // Skip private folders (prefixed with _)\n if (entry.name.startsWith(\"_\")) continue;\n\n const subDir = path.join(dir, entry.name);\n const page = findFile(subDir, \"page\");\n if (page) {\n const relativePath = path.relative(slotDir, subDir);\n results.push({ relativePath, pagePath: page });\n }\n // Continue scanning deeper for nested sub-pages\n scan(subDir);\n }\n }\n\n scan(slotDir);\n return results;\n}\n\n/**\n * Convert a file path relative to app/ into an AppRoute.\n */\nfunction fileToAppRoute(\n file: string,\n appDir: string,\n type: \"page\" | \"route\",\n): AppRoute | null {\n // Remove the filename (page.tsx or route.ts)\n const dir = path.dirname(file);\n const segments = dir === \".\" ? [] : dir.split(path.sep);\n\n const params: string[] = [];\n let isDynamic = false;\n\n // Convert segments to URL pattern, stripping route groups and parallel slots\n const urlSegments: string[] = [];\n for (const segment of segments) {\n // Route groups: (group) -> skip (transparent in URL)\n if (segment.startsWith(\"(\") && segment.endsWith(\")\")) {\n continue;\n }\n\n // Parallel slots: @slot -> skip (invisible in URL, content passed as layout props)\n if (segment.startsWith(\"@\")) {\n continue;\n }\n\n // Catch-all: [...slug] (param names may contain hyphens, e.g. [...sign-in])\n const catchAllMatch = segment.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n isDynamic = true;\n params.push(catchAllMatch[1]);\n urlSegments.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n\n // Optional catch-all: [[...slug]] (param names may contain hyphens, e.g. [[...sign-in]])\n const optionalCatchAllMatch = segment.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n isDynamic = true;\n params.push(optionalCatchAllMatch[1]);\n urlSegments.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n\n // Dynamic segment: [id] (param names may contain hyphens, e.g. [my-param])\n const dynamicMatch = segment.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n isDynamic = true;\n params.push(dynamicMatch[1]);\n urlSegments.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n try {\n urlSegments.push(decodeURIComponent(segment));\n } catch {\n urlSegments.push(segment);\n }\n }\n\n const pattern = \"/\" + urlSegments.join(\"/\");\n\n // Discover layouts and templates from root to leaf\n const layouts = discoverLayouts(segments, appDir);\n const templates = discoverTemplates(segments, appDir);\n\n // Compute the URL segment depth for each layout.\n // Each layout corresponds to a directory level. We need to count how many\n // of the filesystem segments up to that layout's level contribute URL segments\n // (i.e., are not route groups or parallel slots).\n const layoutSegmentDepths = computeLayoutSegmentDepths(\n segments,\n appDir,\n layouts,\n );\n\n // Discover per-layout error boundaries (aligned with layouts array).\n // In Next.js, each segment independently wraps its children with an ErrorBoundary.\n // This array enables interleaving error boundaries with layouts in the rendering.\n const layoutErrorPaths = discoverLayoutAlignedErrors(segments, appDir);\n\n // Discover loading, error in the route's directory\n const routeDir = dir === \".\" ? appDir : path.join(appDir, dir);\n const loadingPath = findFile(routeDir, \"loading\");\n const errorPath = findFile(routeDir, \"error\");\n\n // Discover not-found/forbidden/unauthorized: walk from route directory up to root (nearest wins).\n const notFoundPath = discoverBoundaryFile(segments, appDir, \"not-found\");\n const forbiddenPath = discoverBoundaryFile(segments, appDir, \"forbidden\");\n const unauthorizedPath = discoverBoundaryFile(\n segments,\n appDir,\n \"unauthorized\",\n );\n\n // Discover per-layout not-found files (one per layout directory).\n // These are used for per-layout NotFoundBoundary to match Next.js behavior where\n // notFound() thrown from a layout is caught by the parent layout's boundary.\n const notFoundPaths = discoverBoundaryFilePerLayout(layouts, \"not-found\");\n\n // Discover parallel slots (@team, @analytics, etc.).\n // Slots at the route's own directory use page.tsx; slots at ancestor directories\n // (inherited from parent layouts) use default.tsx as fallback.\n const parallelSlots = discoverInheritedParallelSlots(\n segments,\n appDir,\n routeDir,\n );\n\n return {\n pattern: pattern === \"/\" ? \"/\" : pattern,\n pagePath: type === \"page\" ? path.join(appDir, file) : null,\n routePath: type === \"route\" ? path.join(appDir, file) : null,\n layouts,\n templates,\n parallelSlots,\n loadingPath,\n errorPath,\n layoutErrorPaths,\n notFoundPath,\n notFoundPaths,\n forbiddenPath,\n unauthorizedPath,\n layoutSegmentDepths,\n isDynamic,\n params,\n };\n}\n\n/**\n * Compute the URL segment depth for each layout in the layouts array.\n * Root layout = 0, then each directory level that contributes a URL segment\n * increments the depth. Route groups and parallel slots don't contribute.\n */\nfunction computeLayoutSegmentDepths(\n segments: string[],\n appDir: string,\n layouts: string[],\n): number[] {\n // Build a map: layout file path → depth in URL segments\n // Walk the segments directory-by-directory, tracking cumulative URL depth\n const depthMap = new Map<string, number>();\n\n // Root layout (at appDir) always has depth 0\n const rootLayout = findFile(appDir, \"layout\");\n if (rootLayout) depthMap.set(rootLayout, 0);\n\n let urlDepth = 0;\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n\n // Count URL-visible segments (skip route groups and parallel slots)\n const isRouteGroup = segment.startsWith(\"(\") && segment.endsWith(\")\");\n const isParallelSlot = segment.startsWith(\"@\");\n if (!isRouteGroup && !isParallelSlot) {\n urlDepth++;\n }\n\n const layout = findFile(currentDir, \"layout\");\n if (layout) {\n depthMap.set(layout, urlDepth);\n }\n }\n\n // Map the ordered layouts array to their depths\n return layouts.map((layoutPath) => depthMap.get(layoutPath) ?? 0);\n}\n\n/**\n * Discover all layout files from root to the given directory.\n * Each level of the directory tree may have a layout.tsx.\n */\nfunction discoverLayouts(segments: string[], appDir: string): string[] {\n const layouts: string[] = [];\n\n // Check root layout\n const rootLayout = findFile(appDir, \"layout\");\n if (rootLayout) layouts.push(rootLayout);\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const layout = findFile(currentDir, \"layout\");\n if (layout) layouts.push(layout);\n }\n\n return layouts;\n}\n\n/**\n * Discover all template files from root to the given directory.\n * Each level of the directory tree may have a template.tsx.\n * Templates are like layouts but re-mount on navigation.\n */\nfunction discoverTemplates(segments: string[], appDir: string): string[] {\n const templates: string[] = [];\n\n // Check root template\n const rootTemplate = findFile(appDir, \"template\");\n if (rootTemplate) templates.push(rootTemplate);\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const template = findFile(currentDir, \"template\");\n if (template) templates.push(template);\n }\n\n return templates;\n}\n\n/**\n * Discover error.tsx files aligned with the layouts array.\n * Walks the same directory levels as discoverLayouts and, for each level\n * that contributes a layout entry, checks whether error.tsx also exists.\n * Returns an array of the same length as discoverLayouts() would return,\n * with the error path (or null) at each corresponding layout level.\n *\n * This enables interleaving ErrorBoundary components with layouts in the\n * rendering tree, matching Next.js behavior where each segment independently\n * wraps its children with an error boundary.\n */\nfunction discoverLayoutAlignedErrors(\n segments: string[],\n appDir: string,\n): (string | null)[] {\n const errors: (string | null)[] = [];\n\n // Root level (only if root has a layout — matching discoverLayouts logic)\n const rootLayout = findFile(appDir, \"layout\");\n if (rootLayout) {\n errors.push(findFile(appDir, \"error\"));\n }\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const layout = findFile(currentDir, \"layout\");\n if (layout) {\n errors.push(findFile(currentDir, \"error\"));\n }\n }\n\n return errors;\n}\n\n/**\n * Discover the nearest boundary file (not-found, forbidden, unauthorized)\n * by walking from the route's directory up to the app root.\n * Returns the first (closest) file found, or null.\n */\nfunction discoverBoundaryFile(\n segments: string[],\n appDir: string,\n fileName: string,\n): string | null {\n // Build all directory paths from leaf to root\n const dirs: string[] = [];\n let dir = appDir;\n dirs.push(dir);\n for (const segment of segments) {\n dir = path.join(dir, segment);\n dirs.push(dir);\n }\n\n // Walk from leaf (last) to root (first)\n for (let i = dirs.length - 1; i >= 0; i--) {\n const f = findFile(dirs[i], fileName);\n if (f) return f;\n }\n return null;\n}\n\n/**\n * Discover boundary files (not-found, forbidden, unauthorized) at each layout directory.\n * Returns an array aligned with the layouts array, where each entry is the boundary\n * file at that layout's directory, or null if none exists there.\n *\n * This is used for per-layout error boundaries. In Next.js, each layout level\n * has its own boundary that wraps the layout's children. When notFound() is thrown\n * from a layout, it propagates up to the parent layout's boundary.\n */\nfunction discoverBoundaryFilePerLayout(\n layouts: string[],\n fileName: string,\n): (string | null)[] {\n return layouts.map((layoutPath) => {\n const layoutDir = path.dirname(layoutPath);\n return findFile(layoutDir, fileName);\n });\n}\n\n/**\n * Discover parallel slots inherited from ancestor directories.\n *\n * In Next.js, parallel slots belong to the layout that defines them. When a\n * child route is rendered, its parent layout's slots must still be present.\n * If the child doesn't have matching content in a slot, the slot's default.tsx\n * is rendered instead.\n *\n * Walk from appDir through each segment to the route's directory. At each level\n * that has @slot dirs, collect them. Slots at the route's own directory level\n * use page.tsx; slots at ancestor levels use default.tsx only.\n */\nfunction discoverInheritedParallelSlots(\n segments: string[],\n appDir: string,\n routeDir: string,\n): ParallelSlot[] {\n const slotMap = new Map<string, ParallelSlot>();\n\n // Walk from appDir through each segment, tracking layout indices.\n // layoutIndex tracks which position in the route's layouts[] array corresponds\n // to a given directory. Only directories with a layout.tsx file increment.\n let currentDir = appDir;\n const dirsToCheck: { dir: string; layoutIdx: number }[] = [];\n let layoutIdx = findFile(appDir, \"layout\") ? 0 : -1;\n dirsToCheck.push({ dir: appDir, layoutIdx: Math.max(layoutIdx, 0) });\n\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n if (findFile(currentDir, \"layout\")) {\n layoutIdx++;\n }\n dirsToCheck.push({ dir: currentDir, layoutIdx: Math.max(layoutIdx, 0) });\n }\n\n for (const { dir, layoutIdx: lvlLayoutIdx } of dirsToCheck) {\n const isOwnDir = dir === routeDir;\n const slotsAtLevel = discoverParallelSlots(dir, appDir);\n\n for (const slot of slotsAtLevel) {\n if (isOwnDir) {\n // At the route's own directory: use page.tsx (normal behavior)\n slot.layoutIndex = lvlLayoutIdx;\n slotMap.set(slot.name, slot);\n } else {\n // At an ancestor directory: use default.tsx as the page, not page.tsx\n // (the slot's page.tsx is for the parent route, not this child route)\n const inheritedSlot: ParallelSlot = {\n ...slot,\n pagePath: null, // Don't use ancestor's page.tsx\n layoutIndex: lvlLayoutIdx,\n // defaultPath, loadingPath, errorPath, interceptingRoutes remain\n };\n // Only inherit if we haven't seen this slot at a closer level\n if (!slotMap.has(slot.name)) {\n slotMap.set(slot.name, inheritedSlot);\n }\n }\n }\n }\n\n return Array.from(slotMap.values());\n}\n\n/**\n * Discover parallel route slots (@team, @analytics, etc.) in a directory.\n * Returns a ParallelSlot for each @-prefixed subdirectory that has a page or default component.\n */\nfunction discoverParallelSlots(dir: string, appDir: string): ParallelSlot[] {\n if (!fs.existsSync(dir)) return [];\n\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n const slots: ParallelSlot[] = [];\n\n for (const entry of entries) {\n if (!entry.isDirectory() || !entry.name.startsWith(\"@\")) continue;\n\n const slotName = entry.name.slice(1); // \"@team\" -> \"team\"\n const slotDir = path.join(dir, entry.name);\n\n const pagePath = findFile(slotDir, \"page\");\n const defaultPath = findFile(slotDir, \"default\");\n const interceptingRoutes = discoverInterceptingRoutes(slotDir, dir, appDir);\n\n // Only include slots that have at least a page, default, or intercepting route\n if (!pagePath && !defaultPath && interceptingRoutes.length === 0) continue;\n\n slots.push({\n name: slotName,\n pagePath,\n defaultPath,\n layoutPath: findFile(slotDir, \"layout\"),\n loadingPath: findFile(slotDir, \"loading\"),\n errorPath: findFile(slotDir, \"error\"),\n interceptingRoutes,\n layoutIndex: -1, // Will be set by discoverInheritedParallelSlots\n });\n }\n\n return slots;\n}\n\n/**\n * The interception convention prefix patterns.\n * (.) — same level, (..) — one level up, (..)(..)\" — two levels up, (...) — root\n */\nconst INTERCEPT_PATTERNS = [\n { prefix: \"(...)\", convention: \"...\" },\n { prefix: \"(..)(..)\", convention: \"../..\" },\n { prefix: \"(..)\", convention: \"..\" },\n { prefix: \"(.)\", convention: \".\" },\n] as const;\n\n/**\n * Discover intercepting routes inside a parallel slot directory.\n *\n * Intercepting routes use conventions like (.)photo, (..)feed, (...), etc.\n * They intercept navigation to another route and render within the slot instead.\n *\n * @param slotDir - The parallel slot directory (e.g. app/feed/@modal)\n * @param routeDir - The directory of the route that owns this slot (e.g. app/feed)\n * @param appDir - The root app directory\n */\nfunction discoverInterceptingRoutes(\n slotDir: string,\n routeDir: string,\n appDir: string,\n): InterceptingRoute[] {\n if (!fs.existsSync(slotDir)) return [];\n\n const results: InterceptingRoute[] = [];\n\n // Recursively scan for page files inside intercepting directories\n scanForInterceptingPages(slotDir, routeDir, appDir, results);\n\n return results;\n}\n\n/**\n * Recursively scan a directory tree for page.tsx files that are inside\n * intercepting route directories.\n */\nfunction scanForInterceptingPages(\n currentDir: string,\n routeDir: string,\n appDir: string,\n results: InterceptingRoute[],\n): void {\n if (!fs.existsSync(currentDir)) return;\n\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n // Check if this directory name starts with an interception convention\n const interceptMatch = matchInterceptConvention(entry.name);\n\n if (interceptMatch) {\n // This directory is the start of an intercepting route\n // e.g. \"(.)photos\" means intercept same-level \"photos\" route\n const restOfName = entry.name.slice(interceptMatch.prefix.length);\n const interceptDir = path.join(currentDir, entry.name);\n\n // Find page files within this intercepting directory tree\n collectInterceptingPages(\n interceptDir,\n interceptDir,\n interceptMatch.convention,\n restOfName,\n routeDir,\n appDir,\n results,\n );\n } else {\n // Regular subdirectory — keep scanning for intercepting dirs\n scanForInterceptingPages(\n path.join(currentDir, entry.name),\n routeDir,\n appDir,\n results,\n );\n }\n }\n}\n\n/**\n * Match a directory name against interception convention prefixes.\n */\nfunction matchInterceptConvention(\n name: string,\n): { prefix: string; convention: string } | null {\n for (const pattern of INTERCEPT_PATTERNS) {\n if (name.startsWith(pattern.prefix)) {\n return pattern;\n }\n }\n return null;\n}\n\n/**\n * Collect page.tsx files inside an intercepting route directory tree\n * and compute their target URL patterns.\n */\nfunction collectInterceptingPages(\n currentDir: string,\n interceptRoot: string,\n convention: string,\n interceptSegment: string,\n routeDir: string,\n appDir: string,\n results: InterceptingRoute[],\n): void {\n // Check for page.tsx in current directory\n const page = findFile(currentDir, \"page\");\n if (page) {\n const targetPattern = computeInterceptTarget(\n convention,\n interceptSegment,\n currentDir,\n interceptRoot,\n routeDir,\n appDir,\n );\n if (targetPattern) {\n results.push({\n convention,\n targetPattern: targetPattern.pattern,\n pagePath: page,\n params: targetPattern.params,\n });\n }\n }\n\n // Recurse into subdirectories for nested intercepting routes\n if (!fs.existsSync(currentDir)) return;\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n collectInterceptingPages(\n path.join(currentDir, entry.name),\n interceptRoot,\n convention,\n interceptSegment,\n routeDir,\n appDir,\n results,\n );\n }\n}\n\n/**\n * Compute the target URL pattern for an intercepting route.\n *\n * - (.) same level: resolve relative to routeDir\n * - (..) one level up: resolve relative to parent of routeDir\n * - (..)(..)\" two levels up: resolve relative to grandparent of routeDir\n * - (...) root: resolve from appDir\n */\nfunction computeInterceptTarget(\n convention: string,\n interceptSegment: string,\n currentDir: string,\n interceptRoot: string,\n routeDir: string,\n appDir: string,\n): { pattern: string; params: string[] } | null {\n // Determine the base directory for target resolution\n let baseDir: string;\n switch (convention) {\n case \".\":\n baseDir = routeDir;\n break;\n case \"..\":\n baseDir = path.dirname(routeDir);\n break;\n case \"../..\":\n baseDir = path.dirname(path.dirname(routeDir));\n break;\n case \"...\":\n baseDir = appDir;\n break;\n default:\n return null;\n }\n\n // Build the target URL segments from baseDir relative to appDir\n const baseParts = path\n .relative(appDir, baseDir)\n .split(path.sep)\n .filter(Boolean);\n\n // Add the intercept segment and any nested path segments\n const nestedParts = path\n .relative(interceptRoot, currentDir)\n .split(path.sep)\n .filter(Boolean);\n const allSegments = [...baseParts, interceptSegment, ...nestedParts];\n\n // Convert segments to URL pattern\n const urlSegments: string[] = [];\n const params: string[] = [];\n\n for (const segment of allSegments) {\n if (segment === \".\") continue;\n // Route groups and @ slots are transparent\n if (segment.startsWith(\"(\") && segment.endsWith(\")\")) continue;\n if (segment.startsWith(\"@\")) continue;\n\n // Dynamic segments\n const catchAllMatch = segment.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n params.push(catchAllMatch[1]);\n urlSegments.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n const optionalCatchAllMatch = segment.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n params.push(optionalCatchAllMatch[1]);\n urlSegments.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n const dynamicMatch = segment.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n params.push(dynamicMatch[1]);\n urlSegments.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n // Decode URL-encoded directory names (e.g., %5Fsites -> _sites)\n try {\n urlSegments.push(decodeURIComponent(segment));\n } catch {\n urlSegments.push(segment);\n }\n }\n\n const pattern = \"/\" + urlSegments.join(\"/\");\n return { pattern: pattern === \"/\" ? \"/\" : pattern, params };\n}\n\n/**\n * Find a file by name (without extension) in a directory.\n * Checks .tsx, .ts, .jsx, .js extensions.\n */\nfunction findFile(dir: string, name: string): string | null {\n const extensions = [\".tsx\", \".ts\", \".jsx\", \".js\"];\n for (const ext of extensions) {\n const filePath = path.join(dir, name + ext);\n if (fs.existsSync(filePath)) return filePath;\n }\n return null;\n}\n\n/**\n * Match a URL against App Router routes.\n */\nexport function matchAppRoute(\n url: string,\n routes: AppRoute[],\n): { route: AppRoute; params: Record<string, string | string[]> } | null {\n const pathname = url.split(\"?\")[0];\n let normalizedUrl = pathname === \"/\" ? \"/\" : pathname.replace(/\\/$/, \"\");\n try {\n normalizedUrl = decodeURIComponent(normalizedUrl);\n } catch {\n /* malformed percent-encoding — match as-is */\n }\n\n for (const route of routes) {\n const params = matchPattern(normalizedUrl, route.pattern);\n if (params !== null) {\n return { route, params };\n }\n }\n\n return null;\n}\n\nfunction matchPattern(\n url: string,\n pattern: string,\n): Record<string, string | string[]> | null {\n const urlParts = url.split(\"/\").filter(Boolean);\n const patternParts = pattern.split(\"/\").filter(Boolean);\n\n const params: Record<string, string | string[]> = Object.create(null);\n\n for (let i = 0; i < patternParts.length; i++) {\n const pp = patternParts[i];\n\n if (pp.endsWith(\"+\")) {\n const paramName = pp.slice(1, -1);\n const remaining = urlParts.slice(i);\n if (remaining.length === 0) return null;\n params[paramName] = remaining;\n return params;\n }\n\n if (pp.endsWith(\"*\")) {\n const paramName = pp.slice(1, -1);\n const remaining = urlParts.slice(i);\n params[paramName] = remaining;\n return params;\n }\n\n if (pp.startsWith(\":\")) {\n const paramName = pp.slice(1);\n if (i >= urlParts.length) return null;\n params[paramName] = urlParts[i];\n continue;\n }\n\n if (i >= urlParts.length || urlParts[i] !== pp) return null;\n }\n\n if (urlParts.length !== patternParts.length) return null;\n\n return params;\n}\n\n/**\n * Route precedence — lower score is higher priority.\n * Matches Next.js specificity rules:\n * 1. Static routes first (scored by segment count, more = more specific)\n * 2. Dynamic segments penalized by position\n * 3. Catch-all comes after dynamic\n * 4. Optional catch-all last\n * 5. Lexicographic tiebreaker for determinism\n *\n * Key insight: routes with static prefix segments should have higher priority\n * than catch-all routes without them. E.g., /_sites/:subdomain/:slug* should\n * match before /:slug* because \"_sites\" must match exactly.\n */\nfunction routePrecedence(pattern: string): number {\n const parts = pattern.split(\"/\").filter(Boolean);\n let score = 0;\n let staticPrefixCount = 0;\n\n // Count static prefix segments (before first dynamic/catch-all)\n for (const p of parts) {\n if (p.startsWith(\":\") || p.endsWith(\"+\") || p.endsWith(\"*\")) break;\n staticPrefixCount++;\n }\n\n // Static prefix segments dramatically reduce score (increase priority).\n // Each static prefix segment gives -10000 priority boost.\n score -= staticPrefixCount * 10000;\n\n for (let i = 0; i < parts.length; i++) {\n const p = parts[i];\n if (p.endsWith(\"+\")) {\n score += 1000 + i; // catch-all: moderate penalty\n } else if (p.endsWith(\"*\")) {\n score += 2000 + i; // optional catch-all: high penalty\n } else if (p.startsWith(\":\")) {\n score += 100 + i; // dynamic: small penalty by position\n }\n // static segments after first dynamic don't contribute extra\n }\n return score;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-router.js","sourceRoot":"","sources":["../../src/routing/app-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAwF3B,uBAAuB;AACvB,IAAI,YAAY,GAAsB,IAAI,CAAC;AAC3C,IAAI,YAAY,GAAkB,IAAI,CAAC;AACvC,IAAI,uBAAuB,GAAkB,IAAI,CAAC;AAElD,MAAM,UAAU,uBAAuB;IACrC,YAAY,GAAG,IAAI,CAAC;IACpB,YAAY,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;YACxC,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;YAC9B,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;YAC9B,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACtC,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;YAChC,SAAS;QACX,CAAC;QAED,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC;IAC9D,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * App Router file-system routing.\n *\n * Scans the app/ directory following Next.js App Router conventions:\n * - app/page.tsx -> /\n * - app/about/page.tsx -> /about\n * - app/blog/[slug]/page.tsx -> /blog/:slug\n * - app/[...catchAll]/page.tsx -> /:catchAll+\n * - app/route.ts -> / (API route)\n * - app/(group)/page.tsx -> / (route groups are transparent)\n * - Layouts: app/layout.tsx wraps all children\n * - Loading: app/loading.tsx -> Suspense fallback\n * - Error: app/error.tsx -> ErrorBoundary\n * - Not Found: app/not-found.tsx\n */\nimport path from \"node:path\";\nimport fs from \"node:fs\";\nimport { routePrecedence } from \"./utils.js\";\nimport {\n createValidFileMatcher,\n scanWithExtensions,\n type ValidFileMatcher,\n} from \"./file-matcher.js\";\n\nexport interface InterceptingRoute {\n /** The interception convention: \".\" | \"..\" | \"../..\" | \"...\" */\n convention: string;\n /** The URL pattern this intercepts (e.g. \"/photos/:id\") */\n targetPattern: string;\n /** Absolute path to the intercepting page component */\n pagePath: string;\n /** Parameter names for dynamic segments */\n params: string[];\n}\n\nexport interface ParallelSlot {\n /** Slot name (e.g. \"team\" from @team) */\n name: string;\n /** Absolute path to the slot's page component */\n pagePath: string | null;\n /** Absolute path to the slot's default.tsx fallback */\n defaultPath: string | null;\n /** Absolute path to the slot's layout component (wraps slot content) */\n layoutPath: string | null;\n /** Absolute path to the slot's loading component */\n loadingPath: string | null;\n /** Absolute path to the slot's error component */\n errorPath: string | null;\n /** Intercepting routes within this slot */\n interceptingRoutes: InterceptingRoute[];\n /**\n * The layout index (0-based, in route.layouts[]) that this slot belongs to.\n * Slots are passed as props to the layout at their directory level, not\n * necessarily the innermost layout. -1 means \"innermost\" (legacy default).\n */\n layoutIndex: number;\n}\n\nexport interface AppRoute {\n /** URL pattern, e.g. \"/\" or \"/about\" or \"/blog/:slug\" */\n pattern: string;\n /** Absolute file path to the page component */\n pagePath: string | null;\n /** Absolute file path to the route handler (route.ts) */\n routePath: string | null;\n /** Ordered list of layout files from root to leaf */\n layouts: string[];\n /** Ordered list of template files from root to leaf (parallel to layouts) */\n templates: string[];\n /** Parallel route slots (from @slot directories at the route's directory level) */\n parallelSlots: ParallelSlot[];\n /** Loading component path */\n loadingPath: string | null;\n /** Error component path (leaf directory only) */\n errorPath: string | null;\n /**\n * Per-layout error boundary paths, aligned with the layouts array.\n * Each entry is the error.tsx at the same directory level as the\n * corresponding layout (or null if that level has no error.tsx).\n * Used to interleave ErrorBoundary components with layouts so that\n * ancestor error boundaries catch errors from descendant segments.\n */\n layoutErrorPaths: (string | null)[];\n /** Not-found component path (nearest, walking up from page dir) */\n notFoundPath: string | null;\n /**\n * Not-found component paths per layout level (aligned with layouts array).\n * Each entry is the not-found.tsx at that layout's directory, or null.\n * Used to create per-layout NotFoundBoundary so that notFound() thrown from\n * a layout is caught by the parent layout's boundary (matching Next.js behavior).\n */\n notFoundPaths: (string | null)[];\n /** Forbidden component path (403) */\n forbiddenPath: string | null;\n /** Unauthorized component path (401) */\n unauthorizedPath: string | null;\n /**\n * URL segment depth for each layout in the layouts array.\n * Used by useSelectedLayoutSegments() to determine which segments are\n * below a given layout. For example, root layout has depth 0, a layout\n * at app/dashboard/ has depth 1 (one URL segment: \"dashboard\").\n * Route groups and parallel slots don't contribute to the depth.\n */\n layoutSegmentDepths: number[];\n /** Whether this is a dynamic route */\n isDynamic: boolean;\n /** Parameter names for dynamic segments */\n params: string[];\n}\n\n// Cache for app routes\nlet cachedRoutes: AppRoute[] | null = null;\nlet cachedAppDir: string | null = null;\nlet cachedPageExtensionsKey: string | null = null;\n\nexport function invalidateAppRouteCache(): void {\n cachedRoutes = null;\n cachedAppDir = null;\n cachedPageExtensionsKey = null;\n}\n\n/**\n * Scan the app/ directory and return a list of routes.\n */\nexport async function appRouter(\n appDir: string,\n pageExtensions?: readonly string[],\n matcher?: ValidFileMatcher,\n): Promise<AppRoute[]> {\n matcher ??= createValidFileMatcher(pageExtensions);\n const pageExtensionsKey = JSON.stringify(matcher.extensions);\n if (\n cachedRoutes &&\n cachedAppDir === appDir &&\n cachedPageExtensionsKey === pageExtensionsKey\n ) {\n return cachedRoutes;\n }\n\n // Find all page.tsx and route.ts files, excluding @slot directories\n // (slot pages are not standalone routes — they're rendered as props of their parent layout)\n const routes: AppRoute[] = [];\n\n // Process page files in a single pass\n // Use function form of exclude for Node < 22.14 compatibility (string arrays require >= 22.14)\n for await (const file of scanWithExtensions(\n \"**/page\",\n appDir,\n matcher.extensions,\n (name: string) => name.startsWith(\"@\"),\n )) {\n const route = fileToAppRoute(file, appDir, \"page\", matcher);\n if (route) routes.push(route);\n }\n\n // Process route handler files (API routes) in a single pass\n for await (const file of scanWithExtensions(\n \"**/route\",\n appDir,\n matcher.extensions,\n (name: string) => name.startsWith(\"@\"),\n )) {\n const route = fileToAppRoute(file, appDir, \"route\", matcher);\n if (route) routes.push(route);\n }\n\n // Discover sub-routes created by nested pages within parallel slots.\n // In Next.js, pages nested inside @slot directories create additional URL routes.\n // For example, @audience/demographics/page.tsx at app/parallel-routes/ creates\n // a route at /parallel-routes/demographics.\n const slotSubRoutes = discoverSlotSubRoutes(routes, appDir, matcher);\n routes.push(...slotSubRoutes);\n\n // Sort: static routes first, then dynamic, then catch-all\n routes.sort((a, b) => {\n const diff = routePrecedence(a.pattern) - routePrecedence(b.pattern);\n return diff !== 0 ? diff : a.pattern.localeCompare(b.pattern);\n });\n\n cachedRoutes = routes;\n cachedAppDir = appDir;\n cachedPageExtensionsKey = pageExtensionsKey;\n return routes;\n}\n\n/**\n * Discover sub-routes created by nested pages within parallel slots.\n *\n * In Next.js, pages nested inside @slot directories create additional URL routes.\n * For example, given:\n * app/parallel-routes/@audience/demographics/page.tsx\n * This creates a route at /parallel-routes/demographics where:\n * - children slot → parent's default.tsx\n * - @audience slot → @audience/demographics/page.tsx (matched)\n * - other slots → their default.tsx (fallback)\n */\nfunction discoverSlotSubRoutes(\n routes: AppRoute[],\n _appDir: string,\n matcher: ValidFileMatcher,\n): AppRoute[] {\n const syntheticRoutes: AppRoute[] = [];\n const existingPatterns = new Set(routes.map((r) => r.pattern));\n\n for (const parentRoute of routes) {\n if (parentRoute.parallelSlots.length === 0) continue;\n if (!parentRoute.pagePath) continue;\n\n const parentPageDir = path.dirname(parentRoute.pagePath);\n\n // Collect sub-paths from all slots.\n // Map: relative sub-path (e.g., \"demographics\") -> Map<slotName, pagePath>\n const subPathMap = new Map<string, Map<string, string>>();\n\n for (const slot of parentRoute.parallelSlots) {\n const slotDir = path.join(parentPageDir, `@${slot.name}`);\n if (!fs.existsSync(slotDir)) continue;\n\n const subPages = findSlotSubPages(slotDir, matcher);\n for (const { relativePath, pagePath } of subPages) {\n if (!subPathMap.has(relativePath)) {\n subPathMap.set(relativePath, new Map());\n }\n subPathMap.get(relativePath)!.set(slot.name, pagePath);\n }\n }\n\n if (subPathMap.size === 0) continue;\n\n // Find the default.tsx for the children slot at the parent directory\n const childrenDefault = findFile(parentPageDir, \"default\", matcher);\n\n for (const [subPath, slotPages] of subPathMap) {\n // Convert sub-path segments to URL pattern parts\n const subSegments = subPath.split(path.sep);\n const urlParts: string[] = [];\n const subParams: string[] = [];\n let subIsDynamic = false;\n\n for (const seg of subSegments) {\n // Route groups are transparent\n if (seg.startsWith(\"(\") && seg.endsWith(\")\")) continue;\n\n const catchAllMatch = seg.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n subIsDynamic = true;\n subParams.push(catchAllMatch[1]);\n urlParts.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n const optionalCatchAllMatch = seg.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n subIsDynamic = true;\n subParams.push(optionalCatchAllMatch[1]);\n urlParts.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n const dynamicMatch = seg.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n subIsDynamic = true;\n subParams.push(dynamicMatch[1]);\n urlParts.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n urlParts.push(seg);\n }\n\n const subUrlPath = urlParts.join(\"/\");\n const pattern =\n parentRoute.pattern === \"/\"\n ? \"/\" + subUrlPath\n : parentRoute.pattern + \"/\" + subUrlPath;\n\n // Skip if this pattern already exists as a regular route\n if (existingPatterns.has(pattern)) continue;\n if (syntheticRoutes.some((r) => r.pattern === pattern)) continue;\n\n // Build parallel slots for this sub-route: matching slots get the sub-page,\n // non-matching slots get null pagePath (rendering falls back to defaultPath)\n const subSlots: ParallelSlot[] = parentRoute.parallelSlots.map(\n (slot) => ({\n ...slot,\n pagePath: slotPages.get(slot.name) || null,\n }),\n );\n\n syntheticRoutes.push({\n pattern,\n pagePath: childrenDefault, // children slot uses parent's default.tsx as page\n routePath: null,\n layouts: parentRoute.layouts,\n templates: parentRoute.templates,\n parallelSlots: subSlots,\n loadingPath: parentRoute.loadingPath,\n errorPath: parentRoute.errorPath,\n layoutErrorPaths: parentRoute.layoutErrorPaths,\n notFoundPath: parentRoute.notFoundPath,\n notFoundPaths: parentRoute.notFoundPaths,\n forbiddenPath: parentRoute.forbiddenPath,\n unauthorizedPath: parentRoute.unauthorizedPath,\n layoutSegmentDepths: parentRoute.layoutSegmentDepths,\n isDynamic: parentRoute.isDynamic || subIsDynamic,\n params: [...parentRoute.params, ...subParams],\n });\n }\n }\n\n return syntheticRoutes;\n}\n\n/**\n * Find all page files in subdirectories of a parallel slot directory.\n * Returns relative paths (from the slot dir) and absolute page paths.\n * Skips the root page.tsx (already handled as the slot's main page)\n * and intercepting route directories.\n */\nfunction findSlotSubPages(\n slotDir: string,\n matcher: ValidFileMatcher,\n): Array<{ relativePath: string; pagePath: string }> {\n const results: Array<{ relativePath: string; pagePath: string }> = [];\n\n function scan(dir: string): void {\n if (!fs.existsSync(dir)) return;\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n // Skip intercepting route directories\n if (matchInterceptConvention(entry.name)) continue;\n // Skip private folders (prefixed with _)\n if (entry.name.startsWith(\"_\")) continue;\n\n const subDir = path.join(dir, entry.name);\n const page = findFile(subDir, \"page\", matcher);\n if (page) {\n const relativePath = path.relative(slotDir, subDir);\n results.push({ relativePath, pagePath: page });\n }\n // Continue scanning deeper for nested sub-pages\n scan(subDir);\n }\n }\n\n scan(slotDir);\n return results;\n}\n\n/**\n * Convert a file path relative to app/ into an AppRoute.\n */\nfunction fileToAppRoute(\n file: string,\n appDir: string,\n type: \"page\" | \"route\",\n matcher: ValidFileMatcher,\n): AppRoute | null {\n // Remove the filename (page.tsx or route.ts)\n const dir = path.dirname(file);\n const segments = dir === \".\" ? [] : dir.split(path.sep);\n\n const params: string[] = [];\n let isDynamic = false;\n\n // Convert segments to URL pattern, stripping route groups and parallel slots\n const urlSegments: string[] = [];\n for (const segment of segments) {\n // Route groups: (group) -> skip (transparent in URL)\n if (segment.startsWith(\"(\") && segment.endsWith(\")\")) {\n continue;\n }\n\n // Parallel slots: @slot -> skip (invisible in URL, content passed as layout props)\n if (segment.startsWith(\"@\")) {\n continue;\n }\n\n // Catch-all: [...slug] (param names may contain hyphens, e.g. [...sign-in])\n const catchAllMatch = segment.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n isDynamic = true;\n params.push(catchAllMatch[1]);\n urlSegments.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n\n // Optional catch-all: [[...slug]] (param names may contain hyphens, e.g. [[...sign-in]])\n const optionalCatchAllMatch = segment.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n isDynamic = true;\n params.push(optionalCatchAllMatch[1]);\n urlSegments.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n\n // Dynamic segment: [id] (param names may contain hyphens, e.g. [my-param])\n const dynamicMatch = segment.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n isDynamic = true;\n params.push(dynamicMatch[1]);\n urlSegments.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n try {\n urlSegments.push(decodeURIComponent(segment));\n } catch {\n urlSegments.push(segment);\n }\n }\n\n const pattern = \"/\" + urlSegments.join(\"/\");\n\n // Discover layouts and templates from root to leaf\n const layouts = discoverLayouts(segments, appDir, matcher);\n const templates = discoverTemplates(segments, appDir, matcher);\n\n // Compute the URL segment depth for each layout.\n // Each layout corresponds to a directory level. We need to count how many\n // of the filesystem segments up to that layout's level contribute URL segments\n // (i.e., are not route groups or parallel slots).\n const layoutSegmentDepths = computeLayoutSegmentDepths(\n segments,\n appDir,\n layouts,\n matcher,\n );\n\n // Discover per-layout error boundaries (aligned with layouts array).\n // In Next.js, each segment independently wraps its children with an ErrorBoundary.\n // This array enables interleaving error boundaries with layouts in the rendering.\n const layoutErrorPaths = discoverLayoutAlignedErrors(segments, appDir, matcher);\n\n // Discover loading, error in the route's directory\n const routeDir = dir === \".\" ? appDir : path.join(appDir, dir);\n const loadingPath = findFile(routeDir, \"loading\", matcher);\n const errorPath = findFile(routeDir, \"error\", matcher);\n\n // Discover not-found/forbidden/unauthorized: walk from route directory up to root (nearest wins).\n const notFoundPath = discoverBoundaryFile(\n segments,\n appDir,\n \"not-found\",\n matcher,\n );\n const forbiddenPath = discoverBoundaryFile(\n segments,\n appDir,\n \"forbidden\",\n matcher,\n );\n const unauthorizedPath = discoverBoundaryFile(\n segments,\n appDir,\n \"unauthorized\",\n matcher,\n );\n\n // Discover per-layout not-found files (one per layout directory).\n // These are used for per-layout NotFoundBoundary to match Next.js behavior where\n // notFound() thrown from a layout is caught by the parent layout's boundary.\n const notFoundPaths = discoverBoundaryFilePerLayout(\n layouts,\n \"not-found\",\n matcher,\n );\n\n // Discover parallel slots (@team, @analytics, etc.).\n // Slots at the route's own directory use page.tsx; slots at ancestor directories\n // (inherited from parent layouts) use default.tsx as fallback.\n const parallelSlots = discoverInheritedParallelSlots(\n segments,\n appDir,\n routeDir,\n matcher,\n );\n\n return {\n pattern: pattern === \"/\" ? \"/\" : pattern,\n pagePath: type === \"page\" ? path.join(appDir, file) : null,\n routePath: type === \"route\" ? path.join(appDir, file) : null,\n layouts,\n templates,\n parallelSlots,\n loadingPath,\n errorPath,\n layoutErrorPaths,\n notFoundPath,\n notFoundPaths,\n forbiddenPath,\n unauthorizedPath,\n layoutSegmentDepths,\n isDynamic,\n params,\n };\n}\n\n/**\n * Compute the URL segment depth for each layout in the layouts array.\n * Root layout = 0, then each directory level that contributes a URL segment\n * increments the depth. Route groups and parallel slots don't contribute.\n */\nfunction computeLayoutSegmentDepths(\n segments: string[],\n appDir: string,\n layouts: string[],\n matcher: ValidFileMatcher,\n): number[] {\n // Build a map: layout file path → depth in URL segments\n // Walk the segments directory-by-directory, tracking cumulative URL depth\n const depthMap = new Map<string, number>();\n\n // Root layout (at appDir) always has depth 0\n const rootLayout = findFile(appDir, \"layout\", matcher);\n if (rootLayout) depthMap.set(rootLayout, 0);\n\n let urlDepth = 0;\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n\n // Count URL-visible segments (skip route groups and parallel slots)\n const isRouteGroup = segment.startsWith(\"(\") && segment.endsWith(\")\");\n const isParallelSlot = segment.startsWith(\"@\");\n if (!isRouteGroup && !isParallelSlot) {\n urlDepth++;\n }\n\n const layout = findFile(currentDir, \"layout\", matcher);\n if (layout) {\n depthMap.set(layout, urlDepth);\n }\n }\n\n // Map the ordered layouts array to their depths\n return layouts.map((layoutPath) => depthMap.get(layoutPath) ?? 0);\n}\n\n/**\n * Discover all layout files from root to the given directory.\n * Each level of the directory tree may have a layout.tsx.\n */\nfunction discoverLayouts(\n segments: string[],\n appDir: string,\n matcher: ValidFileMatcher,\n): string[] {\n const layouts: string[] = [];\n\n // Check root layout\n const rootLayout = findFile(appDir, \"layout\", matcher);\n if (rootLayout) layouts.push(rootLayout);\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const layout = findFile(currentDir, \"layout\", matcher);\n if (layout) layouts.push(layout);\n }\n\n return layouts;\n}\n\n/**\n * Discover all template files from root to the given directory.\n * Each level of the directory tree may have a template.tsx.\n * Templates are like layouts but re-mount on navigation.\n */\nfunction discoverTemplates(\n segments: string[],\n appDir: string,\n matcher: ValidFileMatcher,\n): string[] {\n const templates: string[] = [];\n\n // Check root template\n const rootTemplate = findFile(appDir, \"template\", matcher);\n if (rootTemplate) templates.push(rootTemplate);\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const template = findFile(currentDir, \"template\", matcher);\n if (template) templates.push(template);\n }\n\n return templates;\n}\n\n/**\n * Discover error.tsx files aligned with the layouts array.\n * Walks the same directory levels as discoverLayouts and, for each level\n * that contributes a layout entry, checks whether error.tsx also exists.\n * Returns an array of the same length as discoverLayouts() would return,\n * with the error path (or null) at each corresponding layout level.\n *\n * This enables interleaving ErrorBoundary components with layouts in the\n * rendering tree, matching Next.js behavior where each segment independently\n * wraps its children with an error boundary.\n */\nfunction discoverLayoutAlignedErrors(\n segments: string[],\n appDir: string,\n matcher: ValidFileMatcher,\n): (string | null)[] {\n const errors: (string | null)[] = [];\n\n // Root level (only if root has a layout — matching discoverLayouts logic)\n const rootLayout = findFile(appDir, \"layout\", matcher);\n if (rootLayout) {\n errors.push(findFile(appDir, \"error\", matcher));\n }\n\n // Check each directory level\n let currentDir = appDir;\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n const layout = findFile(currentDir, \"layout\", matcher);\n if (layout) {\n errors.push(findFile(currentDir, \"error\", matcher));\n }\n }\n\n return errors;\n}\n\n/**\n * Discover the nearest boundary file (not-found, forbidden, unauthorized)\n * by walking from the route's directory up to the app root.\n * Returns the first (closest) file found, or null.\n */\nfunction discoverBoundaryFile(\n segments: string[],\n appDir: string,\n fileName: string,\n matcher: ValidFileMatcher,\n): string | null {\n // Build all directory paths from leaf to root\n const dirs: string[] = [];\n let dir = appDir;\n dirs.push(dir);\n for (const segment of segments) {\n dir = path.join(dir, segment);\n dirs.push(dir);\n }\n\n // Walk from leaf (last) to root (first)\n for (let i = dirs.length - 1; i >= 0; i--) {\n const f = findFile(dirs[i], fileName, matcher);\n if (f) return f;\n }\n return null;\n}\n\n/**\n * Discover boundary files (not-found, forbidden, unauthorized) at each layout directory.\n * Returns an array aligned with the layouts array, where each entry is the boundary\n * file at that layout's directory, or null if none exists there.\n *\n * This is used for per-layout error boundaries. In Next.js, each layout level\n * has its own boundary that wraps the layout's children. When notFound() is thrown\n * from a layout, it propagates up to the parent layout's boundary.\n */\nfunction discoverBoundaryFilePerLayout(\n layouts: string[],\n fileName: string,\n matcher: ValidFileMatcher,\n): (string | null)[] {\n return layouts.map((layoutPath) => {\n const layoutDir = path.dirname(layoutPath);\n return findFile(layoutDir, fileName, matcher);\n });\n}\n\n/**\n * Discover parallel slots inherited from ancestor directories.\n *\n * In Next.js, parallel slots belong to the layout that defines them. When a\n * child route is rendered, its parent layout's slots must still be present.\n * If the child doesn't have matching content in a slot, the slot's default.tsx\n * is rendered instead.\n *\n * Walk from appDir through each segment to the route's directory. At each level\n * that has @slot dirs, collect them. Slots at the route's own directory level\n * use page.tsx; slots at ancestor levels use default.tsx only.\n */\nfunction discoverInheritedParallelSlots(\n segments: string[],\n appDir: string,\n routeDir: string,\n matcher: ValidFileMatcher,\n): ParallelSlot[] {\n const slotMap = new Map<string, ParallelSlot>();\n\n // Walk from appDir through each segment, tracking layout indices.\n // layoutIndex tracks which position in the route's layouts[] array corresponds\n // to a given directory. Only directories with a layout.tsx file increment.\n let currentDir = appDir;\n const dirsToCheck: { dir: string; layoutIdx: number }[] = [];\n let layoutIdx = findFile(appDir, \"layout\", matcher) ? 0 : -1;\n dirsToCheck.push({ dir: appDir, layoutIdx: Math.max(layoutIdx, 0) });\n\n for (const segment of segments) {\n currentDir = path.join(currentDir, segment);\n if (findFile(currentDir, \"layout\", matcher)) {\n layoutIdx++;\n }\n dirsToCheck.push({ dir: currentDir, layoutIdx: Math.max(layoutIdx, 0) });\n }\n\n for (const { dir, layoutIdx: lvlLayoutIdx } of dirsToCheck) {\n const isOwnDir = dir === routeDir;\n const slotsAtLevel = discoverParallelSlots(dir, appDir, matcher);\n\n for (const slot of slotsAtLevel) {\n if (isOwnDir) {\n // At the route's own directory: use page.tsx (normal behavior)\n slot.layoutIndex = lvlLayoutIdx;\n slotMap.set(slot.name, slot);\n } else {\n // At an ancestor directory: use default.tsx as the page, not page.tsx\n // (the slot's page.tsx is for the parent route, not this child route)\n const inheritedSlot: ParallelSlot = {\n ...slot,\n pagePath: null, // Don't use ancestor's page.tsx\n layoutIndex: lvlLayoutIdx,\n // defaultPath, loadingPath, errorPath, interceptingRoutes remain\n };\n // Only inherit if we haven't seen this slot at a closer level\n if (!slotMap.has(slot.name)) {\n slotMap.set(slot.name, inheritedSlot);\n }\n }\n }\n }\n\n return Array.from(slotMap.values());\n}\n\n/**\n * Discover parallel route slots (@team, @analytics, etc.) in a directory.\n * Returns a ParallelSlot for each @-prefixed subdirectory that has a page or default component.\n */\nfunction discoverParallelSlots(\n dir: string,\n appDir: string,\n matcher: ValidFileMatcher,\n): ParallelSlot[] {\n if (!fs.existsSync(dir)) return [];\n\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n const slots: ParallelSlot[] = [];\n\n for (const entry of entries) {\n if (!entry.isDirectory() || !entry.name.startsWith(\"@\")) continue;\n\n const slotName = entry.name.slice(1); // \"@team\" -> \"team\"\n const slotDir = path.join(dir, entry.name);\n\n const pagePath = findFile(slotDir, \"page\", matcher);\n const defaultPath = findFile(slotDir, \"default\", matcher);\n const interceptingRoutes = discoverInterceptingRoutes(\n slotDir,\n dir,\n appDir,\n matcher,\n );\n\n // Only include slots that have at least a page, default, or intercepting route\n if (!pagePath && !defaultPath && interceptingRoutes.length === 0) continue;\n\n slots.push({\n name: slotName,\n pagePath,\n defaultPath,\n layoutPath: findFile(slotDir, \"layout\", matcher),\n loadingPath: findFile(slotDir, \"loading\", matcher),\n errorPath: findFile(slotDir, \"error\", matcher),\n interceptingRoutes,\n layoutIndex: -1, // Will be set by discoverInheritedParallelSlots\n });\n }\n\n return slots;\n}\n\n/**\n * The interception convention prefix patterns.\n * (.) — same level, (..) — one level up, (..)(..)\" — two levels up, (...) — root\n */\nconst INTERCEPT_PATTERNS = [\n { prefix: \"(...)\", convention: \"...\" },\n { prefix: \"(..)(..)\", convention: \"../..\" },\n { prefix: \"(..)\", convention: \"..\" },\n { prefix: \"(.)\", convention: \".\" },\n] as const;\n\n/**\n * Discover intercepting routes inside a parallel slot directory.\n *\n * Intercepting routes use conventions like (.)photo, (..)feed, (...), etc.\n * They intercept navigation to another route and render within the slot instead.\n *\n * @param slotDir - The parallel slot directory (e.g. app/feed/@modal)\n * @param routeDir - The directory of the route that owns this slot (e.g. app/feed)\n * @param appDir - The root app directory\n */\nfunction discoverInterceptingRoutes(\n slotDir: string,\n routeDir: string,\n appDir: string,\n matcher: ValidFileMatcher,\n): InterceptingRoute[] {\n if (!fs.existsSync(slotDir)) return [];\n\n const results: InterceptingRoute[] = [];\n\n // Recursively scan for page files inside intercepting directories\n scanForInterceptingPages(slotDir, routeDir, appDir, results, matcher);\n\n return results;\n}\n\n/**\n * Recursively scan a directory tree for page.tsx files that are inside\n * intercepting route directories.\n */\nfunction scanForInterceptingPages(\n currentDir: string,\n routeDir: string,\n appDir: string,\n results: InterceptingRoute[],\n matcher: ValidFileMatcher,\n): void {\n if (!fs.existsSync(currentDir)) return;\n\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n\n // Check if this directory name starts with an interception convention\n const interceptMatch = matchInterceptConvention(entry.name);\n\n if (interceptMatch) {\n // This directory is the start of an intercepting route\n // e.g. \"(.)photos\" means intercept same-level \"photos\" route\n const restOfName = entry.name.slice(interceptMatch.prefix.length);\n const interceptDir = path.join(currentDir, entry.name);\n\n // Find page files within this intercepting directory tree\n collectInterceptingPages(\n interceptDir,\n interceptDir,\n interceptMatch.convention,\n restOfName,\n routeDir,\n appDir,\n results,\n matcher,\n );\n } else {\n // Regular subdirectory — keep scanning for intercepting dirs\n scanForInterceptingPages(\n path.join(currentDir, entry.name),\n routeDir,\n appDir,\n results,\n matcher,\n );\n }\n }\n}\n\n/**\n * Match a directory name against interception convention prefixes.\n */\nfunction matchInterceptConvention(\n name: string,\n): { prefix: string; convention: string } | null {\n for (const pattern of INTERCEPT_PATTERNS) {\n if (name.startsWith(pattern.prefix)) {\n return pattern;\n }\n }\n return null;\n}\n\n/**\n * Collect page.tsx files inside an intercepting route directory tree\n * and compute their target URL patterns.\n */\nfunction collectInterceptingPages(\n currentDir: string,\n interceptRoot: string,\n convention: string,\n interceptSegment: string,\n routeDir: string,\n appDir: string,\n results: InterceptingRoute[],\n matcher: ValidFileMatcher,\n): void {\n // Check for page.tsx in current directory\n const page = findFile(currentDir, \"page\", matcher);\n if (page) {\n const targetPattern = computeInterceptTarget(\n convention,\n interceptSegment,\n currentDir,\n interceptRoot,\n routeDir,\n appDir,\n );\n if (targetPattern) {\n results.push({\n convention,\n targetPattern: targetPattern.pattern,\n pagePath: page,\n params: targetPattern.params,\n });\n }\n }\n\n // Recurse into subdirectories for nested intercepting routes\n if (!fs.existsSync(currentDir)) return;\n const entries = fs.readdirSync(currentDir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n collectInterceptingPages(\n path.join(currentDir, entry.name),\n interceptRoot,\n convention,\n interceptSegment,\n routeDir,\n appDir,\n results,\n matcher,\n );\n }\n}\n\n/**\n * Compute the target URL pattern for an intercepting route.\n *\n * - (.) same level: resolve relative to routeDir\n * - (..) one level up: resolve relative to parent of routeDir\n * - (..)(..)\" two levels up: resolve relative to grandparent of routeDir\n * - (...) root: resolve from appDir\n */\nfunction computeInterceptTarget(\n convention: string,\n interceptSegment: string,\n currentDir: string,\n interceptRoot: string,\n routeDir: string,\n appDir: string,\n): { pattern: string; params: string[] } | null {\n // Determine the base directory for target resolution\n let baseDir: string;\n switch (convention) {\n case \".\":\n baseDir = routeDir;\n break;\n case \"..\":\n baseDir = path.dirname(routeDir);\n break;\n case \"../..\":\n baseDir = path.dirname(path.dirname(routeDir));\n break;\n case \"...\":\n baseDir = appDir;\n break;\n default:\n return null;\n }\n\n // Build the target URL segments from baseDir relative to appDir\n const baseParts = path\n .relative(appDir, baseDir)\n .split(path.sep)\n .filter(Boolean);\n\n // Add the intercept segment and any nested path segments\n const nestedParts = path\n .relative(interceptRoot, currentDir)\n .split(path.sep)\n .filter(Boolean);\n const allSegments = [...baseParts, interceptSegment, ...nestedParts];\n\n // Convert segments to URL pattern\n const urlSegments: string[] = [];\n const params: string[] = [];\n\n for (const segment of allSegments) {\n if (segment === \".\") continue;\n // Route groups and @ slots are transparent\n if (segment.startsWith(\"(\") && segment.endsWith(\")\")) continue;\n if (segment.startsWith(\"@\")) continue;\n\n // Dynamic segments\n const catchAllMatch = segment.match(/^\\[\\.\\.\\.([\\w-]+)\\]$/);\n if (catchAllMatch) {\n params.push(catchAllMatch[1]);\n urlSegments.push(`:${catchAllMatch[1]}+`);\n continue;\n }\n const optionalCatchAllMatch = segment.match(/^\\[\\[\\.\\.\\.([\\w-]+)\\]\\]$/);\n if (optionalCatchAllMatch) {\n params.push(optionalCatchAllMatch[1]);\n urlSegments.push(`:${optionalCatchAllMatch[1]}*`);\n continue;\n }\n const dynamicMatch = segment.match(/^\\[([\\w-]+)\\]$/);\n if (dynamicMatch) {\n params.push(dynamicMatch[1]);\n urlSegments.push(`:${dynamicMatch[1]}`);\n continue;\n }\n\n // Decode URL-encoded directory names (e.g., %5Fsites -> _sites)\n try {\n urlSegments.push(decodeURIComponent(segment));\n } catch {\n urlSegments.push(segment);\n }\n }\n\n const pattern = \"/\" + urlSegments.join(\"/\");\n return { pattern: pattern === \"/\" ? \"/\" : pattern, params };\n}\n\n/**\n * Find a file by name (without extension) in a directory.\n * Checks configured pageExtensions.\n */\nfunction findFile(\n dir: string,\n name: string,\n matcher: ValidFileMatcher,\n): string | null {\n for (const ext of matcher.dottedExtensions) {\n const filePath = path.join(dir, name + ext);\n if (fs.existsSync(filePath)) return filePath;\n }\n return null;\n}\n\n/**\n * Match a URL against App Router routes.\n */\nexport function matchAppRoute(\n url: string,\n routes: AppRoute[],\n): { route: AppRoute; params: Record<string, string | string[]> } | null {\n const pathname = url.split(\"?\")[0];\n let normalizedUrl = pathname === \"/\" ? \"/\" : pathname.replace(/\\/$/, \"\");\n try {\n normalizedUrl = decodeURIComponent(normalizedUrl);\n } catch {\n /* malformed percent-encoding — match as-is */\n }\n\n for (const route of routes) {\n const params = matchPattern(normalizedUrl, route.pattern);\n if (params !== null) {\n return { route, params };\n }\n }\n\n return null;\n}\n\nfunction matchPattern(\n url: string,\n pattern: string,\n): Record<string, string | string[]> | null {\n const urlParts = url.split(\"/\").filter(Boolean);\n const patternParts = pattern.split(\"/\").filter(Boolean);\n\n const params: Record<string, string | string[]> = Object.create(null);\n\n for (let i = 0; i < patternParts.length; i++) {\n const pp = patternParts[i];\n\n if (pp.endsWith(\"+\")) {\n const paramName = pp.slice(1, -1);\n const remaining = urlParts.slice(i);\n if (remaining.length === 0) return null;\n params[paramName] = remaining;\n return params;\n }\n\n if (pp.endsWith(\"*\")) {\n const paramName = pp.slice(1, -1);\n const remaining = urlParts.slice(i);\n params[paramName] = remaining;\n return params;\n }\n\n if (pp.startsWith(\":\")) {\n const paramName = pp.slice(1);\n if (i >= urlParts.length) return null;\n params[paramName] = urlParts[i];\n continue;\n }\n\n if (i >= urlParts.length || urlParts[i] !== pp) return null;\n }\n\n if (urlParts.length !== patternParts.length) return null;\n\n return params;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const DEFAULT_PAGE_EXTENSIONS: readonly ["tsx", "ts", "jsx", "js"];
|
|
2
|
+
export declare function normalizePageExtensions(pageExtensions?: readonly string[] | null): string[];
|
|
3
|
+
export declare function buildExtensionGlob(stem: string, extensions: readonly string[]): string;
|
|
4
|
+
export interface ValidFileMatcher {
|
|
5
|
+
extensions: string[];
|
|
6
|
+
dottedExtensions: string[];
|
|
7
|
+
extensionRegex: RegExp;
|
|
8
|
+
isPageFile(filePath: string): boolean;
|
|
9
|
+
isAppRouterPage(filePath: string): boolean;
|
|
10
|
+
isAppRouterRoute(filePath: string): boolean;
|
|
11
|
+
isAppLayoutFile(filePath: string): boolean;
|
|
12
|
+
isAppDefaultFile(filePath: string): boolean;
|
|
13
|
+
stripExtension(filePath: string): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Ported in spirit from Next.js createValidFileMatcher:
|
|
17
|
+
* packages/next/src/server/lib/find-page-file.ts
|
|
18
|
+
*/
|
|
19
|
+
export declare function createValidFileMatcher(pageExtensions?: readonly string[] | null): ValidFileMatcher;
|
|
20
|
+
/**
|
|
21
|
+
* Use function-form exclude for Node < 22.14 compatibility.
|
|
22
|
+
*/
|
|
23
|
+
export declare function scanWithExtensions(stem: string, cwd: string, extensions: readonly string[], exclude?: (name: string) => boolean): AsyncGenerator<string>;
|
|
24
|
+
//# sourceMappingURL=file-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-matcher.d.ts","sourceRoot":"","sources":["../../src/routing/file-matcher.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,qCAAsC,CAAC;AAM3E,wBAAgB,uBAAuB,CACrC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GACxC,MAAM,EAAE,CAUV;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAKtF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3C,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GACxC,gBAAgB,CAwClB;AAED;;GAEG;AACH,wBAAuB,kBAAkB,CACvC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAClC,cAAc,CAAC,MAAM,CAAC,CAQxB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { glob } from "node:fs/promises";
|
|
2
|
+
export const DEFAULT_PAGE_EXTENSIONS = ["tsx", "ts", "jsx", "js"];
|
|
3
|
+
function escapeRegex(value) {
|
|
4
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5
|
+
}
|
|
6
|
+
export function normalizePageExtensions(pageExtensions) {
|
|
7
|
+
if (!Array.isArray(pageExtensions) || pageExtensions.length === 0) {
|
|
8
|
+
return [...DEFAULT_PAGE_EXTENSIONS];
|
|
9
|
+
}
|
|
10
|
+
const filtered = pageExtensions
|
|
11
|
+
.filter((ext) => typeof ext === "string")
|
|
12
|
+
.map((ext) => ext.trim().replace(/^\.+/, ""))
|
|
13
|
+
.filter((ext) => ext.length > 0);
|
|
14
|
+
return filtered.length > 0 ? [...filtered] : [...DEFAULT_PAGE_EXTENSIONS];
|
|
15
|
+
}
|
|
16
|
+
export function buildExtensionGlob(stem, extensions) {
|
|
17
|
+
if (extensions.length === 1) {
|
|
18
|
+
return `${stem}.${extensions[0]}`;
|
|
19
|
+
}
|
|
20
|
+
return `${stem}.{${extensions.join(",")}}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Ported in spirit from Next.js createValidFileMatcher:
|
|
24
|
+
* packages/next/src/server/lib/find-page-file.ts
|
|
25
|
+
*/
|
|
26
|
+
export function createValidFileMatcher(pageExtensions) {
|
|
27
|
+
const extensions = normalizePageExtensions(pageExtensions);
|
|
28
|
+
const dottedExtensions = extensions.map((ext) => `.${ext}`);
|
|
29
|
+
const extPattern = `(?:${extensions.map((ext) => escapeRegex(ext)).join("|")})`;
|
|
30
|
+
const extensionRegex = new RegExp(`\\.${extPattern}$`);
|
|
31
|
+
const createLeafPattern = (fileNames) => {
|
|
32
|
+
const names = fileNames.length === 1 ? fileNames[0] : `(${fileNames.join("|")})`;
|
|
33
|
+
return new RegExp(`(^${names}|[\\\\/]${names})\\.${extPattern}$`);
|
|
34
|
+
};
|
|
35
|
+
const appRouterPageRegex = createLeafPattern(["page", "route"]);
|
|
36
|
+
const appRouterRouteRegex = createLeafPattern(["route"]);
|
|
37
|
+
const appLayoutRegex = createLeafPattern(["layout"]);
|
|
38
|
+
const appDefaultRegex = createLeafPattern(["default"]);
|
|
39
|
+
return {
|
|
40
|
+
extensions,
|
|
41
|
+
dottedExtensions,
|
|
42
|
+
extensionRegex,
|
|
43
|
+
isPageFile(filePath) {
|
|
44
|
+
return extensionRegex.test(filePath);
|
|
45
|
+
},
|
|
46
|
+
isAppRouterPage(filePath) {
|
|
47
|
+
return appRouterPageRegex.test(filePath);
|
|
48
|
+
},
|
|
49
|
+
isAppRouterRoute(filePath) {
|
|
50
|
+
return appRouterRouteRegex.test(filePath);
|
|
51
|
+
},
|
|
52
|
+
isAppLayoutFile(filePath) {
|
|
53
|
+
return appLayoutRegex.test(filePath);
|
|
54
|
+
},
|
|
55
|
+
isAppDefaultFile(filePath) {
|
|
56
|
+
return appDefaultRegex.test(filePath);
|
|
57
|
+
},
|
|
58
|
+
stripExtension(filePath) {
|
|
59
|
+
return filePath.replace(extensionRegex, "");
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Use function-form exclude for Node < 22.14 compatibility.
|
|
65
|
+
*/
|
|
66
|
+
export async function* scanWithExtensions(stem, cwd, extensions, exclude) {
|
|
67
|
+
const pattern = buildExtensionGlob(stem, extensions);
|
|
68
|
+
for await (const file of glob(pattern, {
|
|
69
|
+
cwd,
|
|
70
|
+
...(exclude ? { exclude } : {}),
|
|
71
|
+
})) {
|
|
72
|
+
yield file;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=file-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-matcher.js","sourceRoot":"","sources":["../../src/routing/file-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAU,CAAC;AAE3E,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,cAAyC;IAEzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,OAAO,CAAC,GAAG,uBAAuB,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc;SAC5B,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC;SACvD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,UAA6B;IAC5E,IAAI,UAAU,CAAC,MA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C,CAAC,SAAS,CAAC,CAAC,CAAC;IAEvD,OAAO;QACL,UAAU;QACV,gBAAgB;QAChB,cAAc;QACd,UAAU,CAAC,QAAgB;YACzB,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QACD,eAAe,CAAC,QAAgB;YAC9B,OAAO,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;QACD,gBAAgB,CAAC,QAAgB;YAC/B,OAAO,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,eAAe,CAAC,QAAgB;YAC9B,OAAO,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QACD,gBAAgB,CAAC,QAAgB;YAC/B,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QACD,cAAc,CAAC,QAAgB;YAC7B,OAAO,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,kBAAkB,CACvC,IAAY,EACZ,GAAW,EACX,UAA6B,EAC7B,OAAmC;IAEnC,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;QACrC,GAAG;QACH,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC,EAAE,CAAC;QACH,MAAM,IAAI,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["import { glob } from \"node:fs/promises\";\n\nexport const DEFAULT_PAGE_EXTENSIONS = [\"tsx\", \"ts\", \"jsx\", \"js\"] as const;\n\nfunction escapeRegex(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nexport function normalizePageExtensions(\n pageExtensions?: readonly string[] | null,\n): string[] {\n if (!Array.isArray(pageExtensions) || pageExtensions.length === 0) {\n return [...DEFAULT_PAGE_EXTENSIONS];\n }\n\n const filtered = pageExtensions\n .filter((ext): ext is string => typeof ext === \"string\")\n .map((ext) => ext.trim().replace(/^\\.+/, \"\"))\n .filter((ext) => ext.length > 0);\n return filtered.length > 0 ? [...filtered] : [...DEFAULT_PAGE_EXTENSIONS];\n}\n\nexport function buildExtensionGlob(stem: string, extensions: readonly string[]): string {\n if (extensions.length === 1) {\n return `${stem}.${extensions[0]}`;\n }\n return `${stem}.{${extensions.join(\",\")}}`;\n}\n\nexport interface ValidFileMatcher {\n extensions: string[];\n dottedExtensions: string[];\n extensionRegex: RegExp;\n isPageFile(filePath: string): boolean;\n isAppRouterPage(filePath: string): boolean;\n isAppRouterRoute(filePath: string): boolean;\n isAppLayoutFile(filePath: string): boolean;\n isAppDefaultFile(filePath: string): boolean;\n stripExtension(filePath: string): string;\n}\n\n/**\n * Ported in spirit from Next.js createValidFileMatcher:\n * packages/next/src/server/lib/find-page-file.ts\n */\nexport function createValidFileMatcher(\n pageExtensions?: readonly string[] | null,\n): ValidFileMatcher {\n const extensions = normalizePageExtensions(pageExtensions);\n const dottedExtensions = extensions.map((ext) => `.${ext}`);\n const extPattern = `(?:${extensions.map((ext) => escapeRegex(ext)).join(\"|\")})`;\n\n const extensionRegex = new RegExp(`\\\\.${extPattern}$`);\n const createLeafPattern = (fileNames: readonly string[]): RegExp => {\n const names =\n fileNames.length === 1 ? fileNames[0] : `(${fileNames.join(\"|\")})`;\n return new RegExp(`(^${names}|[\\\\\\\\/]${names})\\\\.${extPattern}$`);\n };\n\n const appRouterPageRegex = createLeafPattern([\"page\", \"route\"]);\n const appRouterRouteRegex = createLeafPattern([\"route\"]);\n const appLayoutRegex = createLeafPattern([\"layout\"]);\n const appDefaultRegex = createLeafPattern([\"default\"]);\n\n return {\n extensions,\n dottedExtensions,\n extensionRegex,\n isPageFile(filePath: string) {\n return extensionRegex.test(filePath);\n },\n isAppRouterPage(filePath: string) {\n return appRouterPageRegex.test(filePath);\n },\n isAppRouterRoute(filePath: string) {\n return appRouterRouteRegex.test(filePath);\n },\n isAppLayoutFile(filePath: string) {\n return appLayoutRegex.test(filePath);\n },\n isAppDefaultFile(filePath: string) {\n return appDefaultRegex.test(filePath);\n },\n stripExtension(filePath: string) {\n return filePath.replace(extensionRegex, \"\");\n },\n };\n}\n\n/**\n * Use function-form exclude for Node < 22.14 compatibility.\n */\nexport async function* scanWithExtensions(\n stem: string,\n cwd: string,\n extensions: readonly string[],\n exclude?: (name: string) => boolean,\n): AsyncGenerator<string> {\n const pattern = buildExtensionGlob(stem, extensions);\n for await (const file of glob(pattern, {\n cwd,\n ...(exclude ? { exclude } : {}),\n })) {\n yield file;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ValidFileMatcher } from "./file-matcher.js";
|
|
1
2
|
export interface Route {
|
|
2
3
|
/** URL pattern, e.g. "/" or "/about" or "/posts/:id" */
|
|
3
4
|
pattern: string;
|
|
@@ -25,7 +26,7 @@ export declare function invalidateRouteCache(pagesDir: string): void;
|
|
|
25
26
|
* - Ignores _app.tsx, _document.tsx, _error.tsx, files starting with _
|
|
26
27
|
* - Ignores pages/api/ (handled separately later)
|
|
27
28
|
*/
|
|
28
|
-
export declare function pagesRouter(pagesDir: string): Promise<Route[]>;
|
|
29
|
+
export declare function pagesRouter(pagesDir: string, pageExtensions?: readonly string[], matcher?: ValidFileMatcher): Promise<Route[]>;
|
|
29
30
|
/**
|
|
30
31
|
* Match a URL path against a route pattern.
|
|
31
32
|
* Returns the matched params or null if no match.
|
|
@@ -42,7 +43,7 @@ export declare function matchRoute(url: string, routes: Route[]): {
|
|
|
42
43
|
* - pages/api/hello.ts -> /api/hello
|
|
43
44
|
* - pages/api/users/[id].ts -> /api/users/:id
|
|
44
45
|
*/
|
|
45
|
-
export declare function apiRouter(pagesDir: string): Promise<Route[]>;
|
|
46
|
+
export declare function apiRouter(pagesDir: string, pageExtensions?: readonly string[], matcher?: ValidFileMatcher): Promise<Route[]>;
|
|
46
47
|
/**
|
|
47
48
|
* Convert internal route pattern (e.g., "/posts/:id", "/docs/:slug+")
|
|
48
49
|
* to Next.js bracket format (e.g., "/posts/[id]", "/docs/[...slug]").
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-router.d.ts","sourceRoot":"","sources":["../../src/routing/pages-router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pages-router.d.ts","sourceRoot":"","sources":["../../src/routing/pages-router.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,KAAK;IACpB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAM3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,KAAK,EAAE,CAAC,CAWlB;AA2FD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,KAAK,EAAE,GACd;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,IAAI,CAepE;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,KAAK,EAAE,CAAC,CAWlB;AAuFD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK3D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { glob } from "node:fs/promises";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { routePrecedence } from "./utils.js";
|
|
3
|
+
import { createValidFileMatcher, scanWithExtensions, } from "./file-matcher.js";
|
|
3
4
|
// Route cache — invalidated when pages directory changes
|
|
4
5
|
const routeCache = new Map();
|
|
5
6
|
/**
|
|
@@ -7,8 +8,11 @@ const routeCache = new Map();
|
|
|
7
8
|
* Called by the file watcher when pages are added/removed.
|
|
8
9
|
*/
|
|
9
10
|
export function invalidateRouteCache(pagesDir) {
|
|
10
|
-
routeCache.
|
|
11
|
-
|
|
11
|
+
for (const key of routeCache.keys()) {
|
|
12
|
+
if (key.startsWith(`pages:${pagesDir}:`) || key.startsWith(`api:${pagesDir}:`)) {
|
|
13
|
+
routeCache.delete(key);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* Scan the pages/ directory and return a list of routes.
|
|
@@ -22,22 +26,23 @@ export function invalidateRouteCache(pagesDir) {
|
|
|
22
26
|
* - Ignores _app.tsx, _document.tsx, _error.tsx, files starting with _
|
|
23
27
|
* - Ignores pages/api/ (handled separately later)
|
|
24
28
|
*/
|
|
25
|
-
export async function pagesRouter(pagesDir) {
|
|
26
|
-
|
|
29
|
+
export async function pagesRouter(pagesDir, pageExtensions, matcher) {
|
|
30
|
+
matcher ??= createValidFileMatcher(pageExtensions);
|
|
31
|
+
const cacheKey = `pages:${pagesDir}:${JSON.stringify(matcher.extensions)}`;
|
|
27
32
|
const cached = routeCache.get(cacheKey);
|
|
28
33
|
if (cached)
|
|
29
34
|
return cached.promise;
|
|
30
|
-
const promise = scanPageRoutes(pagesDir);
|
|
35
|
+
const promise = scanPageRoutes(pagesDir, matcher);
|
|
31
36
|
routeCache.set(cacheKey, { routes: [], promise });
|
|
32
37
|
const routes = await promise;
|
|
33
38
|
routeCache.set(cacheKey, { routes, promise });
|
|
34
39
|
return routes;
|
|
35
40
|
}
|
|
36
|
-
async function scanPageRoutes(pagesDir) {
|
|
41
|
+
async function scanPageRoutes(pagesDir, matcher) {
|
|
37
42
|
const routes = [];
|
|
38
43
|
// Use function form of exclude for Node < 22.14 compatibility (string arrays require >= 22.14)
|
|
39
|
-
for await (const file of
|
|
40
|
-
const route = fileToRoute(file, pagesDir);
|
|
44
|
+
for await (const file of scanWithExtensions("**/*", pagesDir, matcher.extensions, (name) => name === "api" || name.startsWith("_"))) {
|
|
45
|
+
const route = fileToRoute(file, pagesDir, matcher);
|
|
41
46
|
if (route)
|
|
42
47
|
routes.push(route);
|
|
43
48
|
}
|
|
@@ -51,9 +56,11 @@ async function scanPageRoutes(pagesDir) {
|
|
|
51
56
|
/**
|
|
52
57
|
* Convert a file path relative to pages/ into a Route.
|
|
53
58
|
*/
|
|
54
|
-
function fileToRoute(file, pagesDir) {
|
|
59
|
+
function fileToRoute(file, pagesDir, matcher) {
|
|
55
60
|
// Remove extension
|
|
56
|
-
const withoutExt =
|
|
61
|
+
const withoutExt = matcher.stripExtension(file);
|
|
62
|
+
if (withoutExt === file)
|
|
63
|
+
return null;
|
|
57
64
|
// Convert to URL segments
|
|
58
65
|
const segments = withoutExt.split(path.sep);
|
|
59
66
|
// Handle index files: pages/index.tsx -> /
|
|
@@ -96,33 +103,6 @@ function fileToRoute(file, pagesDir) {
|
|
|
96
103
|
params,
|
|
97
104
|
};
|
|
98
105
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Route precedence — lower score is higher priority.
|
|
101
|
-
* Matches Next.js specificity rules:
|
|
102
|
-
* 1. Static routes first (scored by segment count, more = more specific)
|
|
103
|
-
* 2. Dynamic segments penalized by position
|
|
104
|
-
* 3. Catch-all comes after dynamic
|
|
105
|
-
* 4. Optional catch-all last
|
|
106
|
-
* 5. Lexicographic tiebreaker for determinism
|
|
107
|
-
*/
|
|
108
|
-
function routePrecedence(pattern) {
|
|
109
|
-
const parts = pattern.split("/").filter(Boolean);
|
|
110
|
-
let score = 0;
|
|
111
|
-
for (let i = 0; i < parts.length; i++) {
|
|
112
|
-
const p = parts[i];
|
|
113
|
-
if (p.endsWith("+")) {
|
|
114
|
-
score += 10000 + i; // catch-all: high penalty
|
|
115
|
-
}
|
|
116
|
-
else if (p.endsWith("*")) {
|
|
117
|
-
score += 20000 + i; // optional catch-all: highest penalty
|
|
118
|
-
}
|
|
119
|
-
else if (p.startsWith(":")) {
|
|
120
|
-
score += 100 + i; // dynamic: moderate penalty by position
|
|
121
|
-
}
|
|
122
|
-
// static segments contribute nothing (better specificity)
|
|
123
|
-
}
|
|
124
|
-
return score;
|
|
125
|
-
}
|
|
126
106
|
/**
|
|
127
107
|
* Match a URL path against a route pattern.
|
|
128
108
|
* Returns the matched params or null if no match.
|
|
@@ -151,23 +131,24 @@ export function matchRoute(url, routes) {
|
|
|
151
131
|
* - pages/api/hello.ts -> /api/hello
|
|
152
132
|
* - pages/api/users/[id].ts -> /api/users/:id
|
|
153
133
|
*/
|
|
154
|
-
export async function apiRouter(pagesDir) {
|
|
155
|
-
|
|
134
|
+
export async function apiRouter(pagesDir, pageExtensions, matcher) {
|
|
135
|
+
matcher ??= createValidFileMatcher(pageExtensions);
|
|
136
|
+
const cacheKey = `api:${pagesDir}:${JSON.stringify(matcher.extensions)}`;
|
|
156
137
|
const cached = routeCache.get(cacheKey);
|
|
157
138
|
if (cached)
|
|
158
139
|
return cached.promise;
|
|
159
|
-
const promise = scanApiRoutes(pagesDir);
|
|
140
|
+
const promise = scanApiRoutes(pagesDir, matcher);
|
|
160
141
|
routeCache.set(cacheKey, { routes: [], promise });
|
|
161
142
|
const routes = await promise;
|
|
162
143
|
routeCache.set(cacheKey, { routes, promise });
|
|
163
144
|
return routes;
|
|
164
145
|
}
|
|
165
|
-
async function scanApiRoutes(pagesDir) {
|
|
146
|
+
async function scanApiRoutes(pagesDir, matcher) {
|
|
166
147
|
const apiDir = path.join(pagesDir, "api");
|
|
167
148
|
let files;
|
|
168
149
|
try {
|
|
169
150
|
files = [];
|
|
170
|
-
for await (const file of
|
|
151
|
+
for await (const file of scanWithExtensions("**/*", apiDir, matcher.extensions)) {
|
|
171
152
|
files.push(file);
|
|
172
153
|
}
|
|
173
154
|
}
|
|
@@ -177,7 +158,7 @@ async function scanApiRoutes(pagesDir) {
|
|
|
177
158
|
const routes = [];
|
|
178
159
|
for (const file of files) {
|
|
179
160
|
// Reuse fileToRoute but pretend the file is under a virtual "api/" prefix
|
|
180
|
-
const route = fileToRoute(path.join("api", file), pagesDir);
|
|
161
|
+
const route = fileToRoute(path.join("api", file), pagesDir, matcher);
|
|
181
162
|
if (route) {
|
|
182
163
|
routes.push(route);
|
|
183
164
|
}
|