(component: Node, context: ResolutionContext)
| 896 | * around an inline render function, which has a body of its own. |
| 897 | */ |
| 898 | export function wrappedComponentName(component: Node, context: ResolutionContext): string | null { |
| 899 | const code = stripCommentsForRegex(declarationText(component, context), 'typescript'); |
| 900 | const init = initializerAt(code, component.name.length); |
| 901 | if (init < 0) return null; |
| 902 | const expression = code.slice(init, statementEnd(code, init)).trim(); |
| 903 | const styled = /^styled\s*\(\s*([A-Za-z_$][\w$]*)\s*[,)]/.exec(expression); |
| 904 | const name = styled ? styled[1]! |
| 905 | : /^(?:React\s*\.\s*)?(?:memo|forwardRef)\b/.test(expression) ? wrappedName(expression) : null; |
| 906 | return name && isPascalCase(name) && name !== component.name ? name : null; |
| 907 | } |
| 908 | |
| 909 | /** |
| 910 | * The component a route's `layout:` reference names, found the way the |
no test coverage detected