(ref: UnresolvedRef, context: ResolutionContext)
| 36 | |
| 37 | /** A page route's reference to its file's own component, or null when this is not one. */ |
| 38 | export function resolvePageComponent(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null { |
| 39 | if (ref.referenceKind !== 'calls' || !ref.fromNodeId.startsWith(`route:${ref.filePath}:`)) return null; |
| 40 | const component = context |
| 41 | .getNodesInFile(ref.filePath) |
| 42 | .find((n) => n.kind === 'component' && n.name === ref.referenceName); |
| 43 | return component ? { original: ref, targetNodeId: component.id, confidence: 0.95, resolvedBy: 'framework' } : null; |
| 44 | } |
no test coverage detected