( source: string, path?: string | undefined, )
| 74 | } |
| 75 | |
| 76 | export function classifyRenderableSource( |
| 77 | source: string, |
| 78 | path?: string | undefined, |
| 79 | ): RenderableSourceKind { |
| 80 | if (looksLikeFullHtmlDocument(source)) return 'html'; |
| 81 | const ext = extensionKind(path); |
| 82 | if (ext === 'tsx') return 'tsx'; |
| 83 | if (ext === 'jsx') return 'jsx'; |
| 84 | if (looksLikeJsxSource(source)) return 'jsx'; |
| 85 | if (ext === 'html') return 'html'; |
| 86 | return 'unknown'; |
| 87 | } |
| 88 | |
| 89 | export function isRenderableSourceKind(kind: RenderableSourceKind): kind is 'html' | 'jsx' | 'tsx' { |
| 90 | return kind === 'html' || kind === 'jsx' || kind === 'tsx'; |
no test coverage detected