import fs from 'node:fs/promises'; import path from 'node:path'; import { createHash } from 'node:crypto'; import fg from 'fast-glob'; const readText = async (file) => fs.readFile(file, 'utf8'); function hrefValues(html, rel) { const values = []; const pattern = new RegExp(`]*\\brel=["']${rel}["'][^>]*\\bhref=["']([^"']+)["']`, 'gi'); for (const match of html.matchAll(pattern)) values.push(match[1]); return values; } function routeFromHtml(file, root) { const relative = path.relative(root, file).replaceAll(path.sep, '/'); if (relative === 'index.html') return '/'; if (relative.endsWith('/index.html')) return `/${relative.slice(0, -'/index.html'.length)}`; return `/${relative.replace(/\.html$/, '')}`; } function formActions(html) { return [...html.matchAll(/