The references that bind a route: what it renders, and the layouts around it.
(route: RouteDeclaration, fromNodeId: string, filePath: string, line: number)
| 1950 | |
| 1951 | /** The references that bind a route: what it renders, and the layouts around it. */ |
| 1952 | function routeReferences(route: RouteDeclaration, fromNodeId: string, filePath: string, line: number): UnresolvedRef[] { |
| 1953 | const language = filePath.endsWith('.tsx') ? 'tsx' : 'jsx'; |
| 1954 | const ref = (referenceName: string): UnresolvedRef => |
| 1955 | ({ fromNodeId, referenceName, referenceKind: 'references', line, column: 0, filePath, language }); |
| 1956 | const refs: UnresolvedRef[] = []; |
| 1957 | const target = route.component ?? route.lazy; |
| 1958 | if (target) refs.push(ref(target)); |
| 1959 | for (const layout of route.layouts) refs.push(ref(LAYOUT_PREFIX + layout)); |
| 1960 | return refs; |
| 1961 | } |
| 1962 | |
| 1963 | /** |
| 1964 | * Routes written in a table that another file hands to the router. |
no test coverage detected