(context: ResolutionContext)
| 382 | const tables = new WeakMap<ResolutionContext, TanstackTable>(); |
| 383 | |
| 384 | export function tanstackTable(context: ResolutionContext): TanstackTable { |
| 385 | const all = context.getNodesByKind('route'); |
| 386 | const cached = tables.get(context); |
| 387 | if (cached && cached.source === all) return cached; |
| 388 | const byRoot = new Map<string, RouteTable>(); |
| 389 | for (const node of all) { |
| 390 | if (!isTanstackRoute(node)) continue; |
| 391 | const root = appRootFor(node.filePath); |
| 392 | let t = byRoot.get(root); |
| 393 | if (!t) byRoot.set(root, (t = { source: all, exact: new Map(), dynamic: [] })); |
| 394 | addRouteTo(t, node.name, node); |
| 395 | } |
| 396 | const table: TanstackTable = { source: all, byRoot }; |
| 397 | tables.set(context, table); |
| 398 | return table; |
| 399 | } |
| 400 | |
| 401 | // ============================================================================= |
| 402 | // Navigation calls |
no test coverage detected