Function: buildRouteTree()
API / @xmachines/play-router / buildRouteTree
function buildRouteTree(routes): RouteTree;Defined in: build-tree.ts:21
Build hierarchical route tree from flat route list
Constructs nested tree respecting parent-child state relationships. Absolute routes become top-level, relative routes nest under parents. Creates bidirectional maps for state ID ↔ path lookup.
Duplicate detection runs here — after relative routes are resolved against
their parent’s full path — so two relative routes with the same raw string
under different parents are valid, while distinct raw strings that resolve to
the same full path (which would silently overwrite each other in byPath)
are rejected.
Parameters
| Parameter | Type | Description |
|---|---|---|
routes | RouteInfo[] | Flat list of RouteInfo from extraction |
Returns
RouteTree with root, byStateId map, and byPath map
Throws
If two states resolve to the same full path