( routeNodes: Array<RouteNode>, )
| 750 | * Creates a map from fullPath to routeNode |
| 751 | */ |
| 752 | export const createRouteNodesByFullPath = ( |
| 753 | routeNodes: Array<RouteNode>, |
| 754 | ): Map<string, RouteNode> => { |
| 755 | const map = new Map<string, RouteNode>() |
| 756 | |
| 757 | for (const routeNode of routeNodes) { |
| 758 | const fullPath = inferFullPath(routeNode) |
| 759 | |
| 760 | if (fullPath === '/' && map.has('/')) { |
| 761 | const existing = map.get('/')! |
| 762 | if (shouldPreferIndexRoute(routeNode, existing)) { |
| 763 | continue |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | map.set(fullPath, routeNode) |
| 768 | } |
| 769 | |
| 770 | return map |
| 771 | } |
| 772 | |
| 773 | /** |
| 774 | * Create a map from 'to' to a routeNode |
no test coverage detected