The component a route names: an identifier, or the file a lazy import names.
(text: string)
| 279 | |
| 280 | /** The component a route names: an identifier, or the file a lazy import names. */ |
| 281 | function componentIn(text: string): string | null { |
| 282 | const lazy = /\bimport\s*\(\s*['"`]([^'"`]+)['"`]/.exec(text); |
| 283 | if (lazy) return (lazy[1]!.split('/').pop() ?? '').replace(/\.\w+$/, '') || null; |
| 284 | return /(?:^|[^\w$])component\s*:\s*([A-Z][A-Za-z0-9_]*)/.exec(text)?.[1] ?? /^\s*([A-Z][A-Za-z0-9_]*)\s*$/.exec(text)?.[1] ?? null; |
| 285 | } |
| 286 | |
| 287 | /** The id a TanStack route carries — a verbatim reconstruction, so the table can recognise its own. */ |
| 288 | function routeId(filePath: string, line: number, path: string): string { |
no test coverage detected