( name: string, filePath: string, context: ResolutionContext, )
| 683 | * such value (a function or class component is found the usual way). |
| 684 | */ |
| 685 | export function declaredComponent( |
| 686 | name: string, |
| 687 | filePath: string, |
| 688 | context: ResolutionContext, |
| 689 | ): { declaration: Node; component: Node | null } | undefined { |
| 690 | const declaration = declaredValue(name, filePath, context); |
| 691 | if (!declaration) return undefined; |
| 692 | const loaded = valueLoader(declaration, context); |
| 693 | if (!loaded) return { declaration, component: wrappedComponent(declaration, context) }; |
| 694 | const id = loaded.member === 'default' |
| 695 | ? lazyRouteComponent(loaded.spec, filePath, context) |
| 696 | : pickedExport(loaded.spec, loaded.member, filePath, context); |
| 697 | return { declaration, component: id ? context.getNodeById?.(id) ?? null : null }; |
| 698 | } |
| 699 | |
| 700 | /** |
| 701 | * The module a value `filePath` declares as `name` loads lazily, and the |
no test coverage detected