/** * Route extractor. * * Routing is defined by the framework's own contract: * - Next.js App Router → file role (page/layout/route/...) + directory path * - Next.js Pages Router→ file path under pages/ * - React Router → JSX, or object/data-router * config arrays (`const routes = [{ path, element, * children, lazy }]`) wherever they are declared — * inline, in a const, or in a separate file * - TanStack Router → createFileRoute('/path'), createRoute({ path }), * createRootRoute(), new Route({ path }) * For Next.js the path-based mapping IS the semantic source of truth (the * framework derives URLs from the filesystem), so it is correct to use it here. * * Detection is monorepo-aware: each file is classified against its own * workspace's framework (ctx.frameworkOf) rather than the repo root, so a * Next.js or React Router app nested under apps/* is detected correctly. */ import { type SourceFile } from 'ts-morph'; import type { Extractor, ExtractionContext, RouteAsset } from '../core/types'; export declare class RouteExtractor implements Extractor { name: string; produces: 'route'; /** Per-file ordinal so same-path routes (e.g. multiple index routes) get * distinct ids and are not collapsed by the registry's id-based dedup. */ private seq; extract(file: SourceFile, ctx: ExtractionContext): RouteAsset[]; private nextAppRoute; private nextPagesRoute; private reactRouterRoutes; private tanstackRoutes; private make; }