(html: string)
| 112 | } |
| 113 | |
| 114 | function extractLinks(html: string): Array<string> { |
| 115 | const linkRegex = /<a[^>]+href=["']([^"']+)["'][^>]*>/g |
| 116 | const links: Array<string> = [] |
| 117 | let match |
| 118 | |
| 119 | while ((match = linkRegex.exec(html)) !== null) { |
| 120 | const href = match[1] |
| 121 | if (href && (href.startsWith('/') || href.startsWith('./'))) { |
| 122 | links.push(href) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | return links |
| 127 | } |
| 128 | |
| 129 | async function prerenderPages({ outputDir }: { outputDir: string }) { |
| 130 | const seen = new Set<string>() |
no test coverage detected