(context: ResolutionContext)
| 303 | const tables = new WeakMap<ResolutionContext, TanstackTable>(); |
| 304 | |
| 305 | export function tanstackTable(context: ResolutionContext): TanstackTable { |
| 306 | const all = context.getNodesByKind('route'); |
| 307 | const cached = tables.get(context); |
| 308 | if (cached && cached.source === all) return cached; |
| 309 | const byRoot = new Map<string, RouteTable>(); |
| 310 | for (const node of all) { |
| 311 | if (!isTanstackRoute(node)) continue; |
| 312 | const root = appRootFor(node.filePath); |
| 313 | let t = byRoot.get(root); |
| 314 | if (!t) byRoot.set(root, (t = { source: all, exact: new Map(), dynamic: [] })); |
| 315 | addRouteTo(t, node.name, node); |
| 316 | } |
| 317 | const table: TanstackTable = { source: all, byRoot }; |
| 318 | tables.set(context, table); |
| 319 | return table; |
| 320 | } |
| 321 | |
| 322 | // ============================================================================= |
| 323 | // Navigation calls |
no test coverage detected