MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / componentIn

Function componentIn

src/resolution/frameworks/tanstack-router.ts:281–285  ·  view source on GitHub ↗

The component a route names: an identifier, or the file a lazy import names.

(text: string)

Source from the content-addressed store, hash-verified

279
280/** The component a route names: an identifier, or the file a lazy import names. */
281function 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. */
288function routeId(filePath: string, line: number, path: string): string {

Callers 1

parseTanstackRoutesFunction · 0.70

Calls 1

execMethod · 0.65

Tested by

no test coverage detected