Migrate from Vercel to Cloudflare Pages, fix distill command symbol

Replace Vercel serverless functions with Cloudflare Pages static
rewrites and lightweight download functions. Pre-generate all API
JSON data at build time for zero-invocation static serving. Also
fix stale simplify→distill rename in framework-viz periodic table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-03-08 18:34:14 -07:00
co-authored by Claude Opus 4.6
parent 98d16686dc
commit 7d2d42da96
17 changed files with 366 additions and 4203 deletions
@@ -0,0 +1,29 @@
const ALLOWED_PROVIDERS = ['universal', 'universal-prefixed'];
export async function onRequestGet(context) {
const { provider } = context.params;
if (!provider || !ALLOWED_PROVIDERS.includes(provider)) {
return Response.json({ error: "Invalid provider" }, { status: 400 });
}
const url = new URL(context.request.url);
url.pathname = `/_data/dist/${provider}.zip`;
const response = await context.env.ASSETS.fetch(url);
if (!response.ok) {
return Response.json({ error: "Bundle not found" }, { status: 404 });
}
const content = await response.arrayBuffer();
const safeProvider = provider.replace(/[^a-zA-Z0-9._-]/g, '');
return new Response(content, {
headers: {
'Content-Type': 'application/zip',
'Content-Disposition': `attachment; filename="impeccable-style-${safeProvider}.zip"`,
'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate=3600',
}
});
}