The component a route names: an identifier, or the file a lazy import names.
(text: string)
| 358 | |
| 359 | /** The component a route names: an identifier, or the file a lazy import names. */ |
| 360 | function componentIn(text: string): string | null { |
| 361 | const lazy = /\bimport\s*\(\s*['"`]([^'"`]+)['"`]/.exec(text); |
| 362 | if (lazy) return (lazy[1]!.split('/').pop() ?? '').replace(/\.\w+$/, '') || null; |
| 363 | 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; |
| 364 | } |
| 365 | |
| 366 | /** The id a TanStack route carries — a verbatim reconstruction, so the table can recognise its own. */ |
| 367 | function routeId(filePath: string, line: number, path: string): string { |
no test coverage detected