/** * THE filename→URL mapper for TanStack Start file routes, in a browser-safe * module with NO imports. * * ☠️ **This file exists so there can be exactly ONE implementation of the * conventions.** `route-collector.ts` — the enumerator — needs `oxc-parser` and * `fs/promises`, and the package root needs `vite` and `node:fs`, so neither * specifier can be imported into a browser bundle. The builder cockpit * (`apps/proyecta-app`) has to answer the same question the enumerator does — * "which URL does this route module serve?" — to show the owner their site * taking shape as a map of PAGES, and for want of an importable module it grew * a hand-rolled copy that diverged on four inputs: `tienda_/$id.tsx` (it kept * the layout-opt-out `_` and showed the owner a literal underscore), * `menu.d.ts` (it minted `/menu/d` for a declaration file), an ABSOLUTE * `/workspace/repo/src/routes/menu.tsx` (it matched only a literal `src/routes/` * prefix and answered `null`), and `.route`/`.lazy` at any depth rather than * only as the last segment. * * That is the same failure `route-collector.ts`'s own header and * `adminRouteCheck.ts` both already record — "a second implementation of the * same conventions is exactly how cycle 3 shipped: the copies each covered a * different subset … so two gates could disagree about which URL the same file * serves". The remedy is not a better copy; it is this module, published at the * `@proyecta-ai/vite/file-route-path` subpath the way the visual editor's * decisions are published at `@proyecta-ai/vite/analysis`. * * ⚠️ **Node-free is a hard constraint, not a preference.** The cockpit bundles * this file into a Vite SPA, so nothing here may import `fs`, `path`, * `oxc-parser`, `vite`, or anything else. Everything the mapper needs is two * regexes and one string helper, all of which live here. */ /** Only these extensions can declare a route. */ export declare const SOURCE_FILE_RE: RegExp; /** The directory whose mere presence selects file-route mode. */ export declare const FILE_ROUTES_DIR = "src/routes/"; /** * Never a route module even though it sits under `src/routes/`: a TypeScript * DECLARATION file. Nothing else — and the narrowing is measured. * * ⚠️ This was `/\.(spec|test|stories|d)\.[jt]sx?$/`, on the stated grounds that * "TanStack's generator ignores them and so must we — `menu.spec.tsx` would * otherwise mint `/menu/spec`". **The premise is false for this template**, * which configures no `routeFileIgnorePattern`, and the FLAT route form makes * the rule actively wrong: under flat naming every `.` is a PATH SEPARATOR, so * `_site.test.tsx` is not a co-located spec at all — it is the route `/test`. * * MEASURED (prod build review 2026-08-30, prototype `1543714793491292161`): the * app's central feature is a house-sorting quiz at `/test` ("test" is the * ordinary es-MX word for a quiz), authored as `src/routes/_site.test.tsx` with * `createFileRoute('/_site/test')` and a literal `component:`. The build's OWN * `routeTree.gen.ts` imports it — TanStack routed it — while this regex dropped * it, so `routeReachability` reported `/test` as linked from EIGHT files with * "no route module under `src/routes/` serves it", and its remedy was to * repoint those links away from a working page or mint a duplicate route. * * Dropping `spec|test|stories` is safe because the FILENAME was never what kept * a real spec out of the published set — `toFileRoute` (`route-collector.ts`) * is: `excluded: isExcludedRoute(path) || !component.declared`. A co-located * spec passes no literal `component:` to `createFileRoute`, so it is collected * but EXCLUDED, which is what every publish-path consumer and * `routeReachability` (`filter(r => r.kind === 'route' && !r.excluded)`) already * read. A `.d.ts` stays here because it declares no runtime module at all. */ export declare const NON_ROUTE_MODULE_RE: RegExp; /** * The `src/routes/`-relative path of a route module, or `null` for a file that * lives anywhere else. Uses the LAST occurrence so a checkout whose own * directory happens to contain `src/routes/` cannot shadow the app's. */ export declare function fileRouteRelativePath(filePath: string): string | null; /** * Translate a route module's filename into the URL it serves, following * TanStack Start's file-route conventions: * * ``` * index.tsx → / * menu/index.tsx → /menu * menu/$slug.tsx → /menu/$slug * menu.$slug.tsx → /menu/$slug (flat form — `.` is a separator) * admin.$.tsx → /admin/$ (splat) * blog/route.tsx → /blog (the directory's layout route) * (marketing)/pricing.tsx→ /pricing (route group — invisible in the URL) * shop_/$id.tsx → /shop/$id (non-nested marker, stripped) * ``` * * Returns `null` for a module that names no URL of its own: * * ``` * __root.tsx the document shell — every route renders inside it * _public.tsx a pathless layout module * -helpers.tsx TanStack ignores a `-` prefix entirely * ``` * * Note that the returned path keeps TanStack's `$param` spelling rather than * react-router's `:param`. It is the app's own vocabulary, and rewriting it * here would put two spellings of the same route in the tree. (A consumer that * shows the path to a HUMAN rather than to a router — the cockpit's build * progress card — swaps the `$param` for a label on its own side, after this * function has answered.) * * ## Exported because it is THE filename→URL mapper * * Every consumer that has to answer "which URL does this route module serve?" * reads it from here. Three in-repo scans previously each carried their own * partial answer, and the partial ones all split on `/` alone — so TanStack's * flat form (`vehicle.$slug.tsx`, `admin.$.tsx`) collapsed into a single fake * segment (`vehicle.$slug`, `admin.$`) and the builder's coherence gates * reported the template's own routes as unreachable app routes on every build. * A fourth copy is how that happens again: use this one. */ export declare function resolveFileRoutePath(filePath: string): string | null; //# sourceMappingURL=file-route-path.d.ts.map