One recovered route as a row, with the strength of the reading on it.
(route: RouteRef)
| 108 | |
| 109 | /** One recovered route as a row, with the strength of the reading on it. */ |
| 110 | function rowOfRoute(route: RouteRef): EntryRow { |
| 111 | const label = `${route.method === undefined ? '' : `${route.method} `}${route.path}`; |
| 112 | return { |
| 113 | key: `route:${label}`, |
| 114 | name: route.handler === undefined || route.handler.length === 0 ? label : `${label} -> ${route.handler}`, |
| 115 | where: whereOf(route.filePath, route.line), |
| 116 | origin: route.origin === 'index' ? 'route (from the index)' : 'route (read from the source)', |
| 117 | ...(route.filePath === undefined || route.filePath.length === 0 |
| 118 | ? {} |
| 119 | : { |
| 120 | target: { |
| 121 | name: route.handler === undefined || route.handler.length === 0 ? label : route.handler, |
| 122 | kind: 'route', |
| 123 | filePath: route.filePath, |
| 124 | startLine: route.line, |
| 125 | } satisfies DeclarationTarget, |
| 126 | }), |
| 127 | }; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * The offered rows, entry points first and routes after them. |