(node: any)
| 703 | } |
| 704 | |
| 705 | function getStaticRenderableText(node: any): string | null { |
| 706 | if (!node) return ""; |
| 707 | if (node.type === "JSXText") return collapseVisibleWhitespace(node.value ?? ""); |
| 708 | if (node.type === "JSXElement") { |
| 709 | const parts: string[] = []; |
| 710 | for (const child of node.children ?? []) { |
| 711 | const text = getStaticRenderableText(child); |
| 712 | if (text == null) return null; |
| 713 | parts.push(text); |
| 714 | } |
| 715 | return collapseVisibleWhitespace(parts.join("")); |
| 716 | } |
| 717 | if (node.type === "JSXExpressionContainer") { |
| 718 | const expr = node.expression; |
| 719 | if (expr?.type === "StringLiteral" || expr?.type === "Literal") { |
| 720 | return collapseVisibleWhitespace(String(expr.value ?? "")); |
| 721 | } |
| 722 | return null; |
| 723 | } |
| 724 | return ""; |
| 725 | } |
| 726 | |
| 727 | function readStringLiteralValue(node: any): string | null { |
| 728 | if (!node) return null; |
nothing calls this directly
no test coverage detected