Embed KiCad's gerbview WASM in the graphics-to-WebGL blog post as a
click-to-load demo that opens the tiny_tapeout board entirely in-browser.
- GerberDemo.astro: lazy iframe embed + cross-origin-isolation reload guard
+ WebGL2/SharedArrayBuffer feature-detect with a poster fallback
- public/gerber-demo/{index.html,boot.js}: self-contained gerbview boot
harness (config seed, MEMFS board preload, argv auto-open)
- board/ tiny_tapeout layers + poster.png committed; wasm/ glue JS committed
(served same-origin — pthread worker can't be cross-origin), while
gerbview.wasm + kicad-resources.bin are git-ignored and served from
Cloudflare R2 (assets.pcbjam.com)
- COOP/COEP require-corp scoped to the post + /gerber-demo routes
(dev: astro.config.mjs + middleware.ts; prod: vercel.json)
- post converted to MDX (@astrojs/mdx) so it can embed the component
- scripts/: sync-demo-wasm.sh, r2-deploy.sh, r2-cors.json
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
894 B
TypeScript
26 lines
894 B
TypeScript
import { defineCollection, z } from 'astro:content';
|
|
import { glob } from 'astro/loaders';
|
|
|
|
// Content Layer API (Astro 5+). Markdown files live in src/content/blog/.
|
|
// NOTE: this config file is src/content.config.ts — NOT src/content/config.ts.
|
|
const blog = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
pubDate: z.coerce.date(),
|
|
}),
|
|
});
|
|
|
|
// Legal pages (cookies, privacy, terms) render from one clean markdown source
|
|
// via src/pages/[legal].astro. File basename → URL slug (cookies.md → /cookies).
|
|
const legal = defineCollection({
|
|
loader: glob({ pattern: '**/*.md', base: './src/content/legal' }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
description: z.string(),
|
|
updated: z.coerce.date(),
|
|
}),
|
|
});
|
|
|
|
export const collections = { blog, legal };
|