* Pick the one handler for a route from same-request-type candidates. Usually a * single candidate. When several share the request type (a cloned addon module), * keep controller-dir methods, then the one in the route's own module (core route * → core handler, addon route → that addon's handler).
(candidates: Node[], routeFile: string)
| 65 | * edge (silent beats wrong). |
| 66 | */ |
| 67 | function selectHandler(candidates: Node[], routeFile: string): Node | null { |
| 68 | if (candidates.length === 1) return candidates[0]!; |
| 69 | let cands = candidates.filter((h) => /\/controller(s)?\//.test(h.filePath)); |
| 70 | if (cands.length === 0) cands = candidates; |
| 71 | if (cands.length === 1) return cands[0]!; |
| 72 | const ar = addonRoot(routeFile); |
| 73 | const sameModule = cands.filter((h) => addonRoot(h.filePath) === ar); |
| 74 | return sameModule.length === 1 ? sameModule[0]! : null; |
| 75 | } |
| 76 | |
| 77 | export async function goframeRouteEdges(ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]> { |
| 78 | let scanned255 = 0; |
no test coverage detected