Astro 6, Shiki 4, and Major Dependency Upgrade with Dead Code Cleanup
Summary
Upgraded the site from Astro 5.16.11 to Astro 6.1.2 -- a major framework version jump that brings Vite 7, Zod 4, and Shiki 4 under the hood. Updated 27 packages total (11 major, 16 minor/patch). Discovered and removed
rehype-mermaid and playwright as dead code, shedding 181 packages from the dependency tree.Why Care
Astro 6 is the first major Astro release since the Content Layer API was introduced in Astro 5. It drops legacy content collection support entirely, upgrades the build pipeline to Vite 7, and introduces new capabilities like built-in fonts, live content collections, and CSP. Staying current keeps us on supported versions and unblocks future features.
The dead code cleanup is equally significant -- we were carrying Playwright (a full headless browser) as a dependency for
rehype-mermaid, which never actually processed any Mermaid blocks. Our custom pipeline in AstroMarkdown.astro intercepts them before rehype runs, and MermaidChart.astro renders them client-side via the Mermaid CDN.Implementation
Major Version Bumps
| Package | Previous | Updated | Notes |
| astro | 5.16.11 | 6.1.2 | Vite 7, Zod 4, Shiki 4 bundled |
| @astrojs/mdx | 4.3.13 | 5.0.3 | Astro 6 compatibility |
| @astrojs/node | 9.5.2 | 10.0.4 | Astro 6 compatibility |
| @astrojs/prism | 3.3.0 | 4.0.1 | Astro 6 compatibility |
| @astrojs/svelte | 7.2.5 | 8.0.4 | Astro 6 compatibility |
| @astrojs/vercel | 9.0.4 | 10.0.3 | Astro 6 compatibility |
| shiki | 3.15.0 | 4.0.2 | Cleanup release, our APIs already compatible |
| glob | 11.0.3 | 13.0.6 | CLI moved to separate package (we only use JS API) |
| tailwind-variants | 2.1.0 | 3.2.2 | |
| uuid | 11.1.0 | 13.0.0 | |
| @vercel/routing-utils | 5.3.0 | 6.1.1 |
Minor/Patch Bumps
| Package | Previous | Updated |
| svelte | 5.43.14 | 5.55.1 |
| tailwindcss | 4.1.17 | 4.2.2 |
| @tailwindcss/vite | 4.1.17 | 4.2.2 |
| @tailwindcss/forms | 0.5.10 | 0.5.11 |
| @iconify-json/tabler | 1.2.23 | 1.2.33 |
| @tabler/icons | 3.35.0 | 3.41.1 |
| choices.js | 11.1.0 | 11.2.1 |
| undici | 7.16.0 | 7.24.6 |
| smol-toml | 1.6.0 | 1.6.1 |
| mdast-util-from-markdown | 2.0.2 | 2.0.3 |
| mdast-util-to-hast | 13.2.0 | 13.2.1 |
| unist-util-visit | 5.0.0 | 5.1.0 |
| dotenv | 17.2.3 | 17.3.1 |
| serve | 14.2.5 | 14.2.6 |
| tsx | 4.20.6 | 4.21.0 |
| @astrojs/check | 0.9.6 | 0.9.8 |
| @astrojs/sitemap | 3.7.0 | 3.7.2 |
Content Collection Migration (Astro 6 / Zod 4)
Astro 6 removes all legacy content collection support. Two collections needed migration:
src/content.config.ts:- Changed
import { defineCollection, z } from 'astro:content'to separate imports:defineCollectionfromastro:content,zfromastro/zod(Zod 4 requirement) - Migrated
cardCollectionfromtype: 'data'toloader: glob({pattern: "**/*.json", base: "./src/content/cards"}) - Migrated
reportCollectionfromtype: 'content'toloader: glob({pattern: "**/*.md", base: "./src/content/reports"})
src/content/cards/config.ts:- Updated
zimport to useastro/zod(legacy file, superseded bysrc/content.config.ts)
Dead Code Removal (-181 packages)
rehype-mermaid + Playwright
Removed
rehype-mermaid from astro.config.mjs. Analysis of the full rendering chain confirmed it never processed Mermaid code blocks:AstroMarkdown.astrodetectslang="mermaid"viagetLanguageRoutingStrategy()fromshikiHighlighter.ts- Routes them to
MermaidChart.astrocomponent MermaidChart.astroloads Mermaid client-side from CDN (https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs)- Browser renders SVGs at runtime
Since
rehype-mermaid was the only consumer of playwright, both were removed along with:decktape(slide-to-PDF export, also depended on Puppeteer)- The
postinstallscript that installed Playwright Chromium browsers
imagekit
The
imagekit npm package (v6.0.0, deprecated) was never imported in any source file. The site uses ImageKit CDN URLs (ik.imagekit.io) directly in templates, which are independent of the npm package.Not Upgraded
- TypeScript: stays at 5.9.3. The Astro toolchain (
tsconfck,@astrojs/check,svelte2tsx) all require TypeScript 5.x via peer dependencies. Will revisit when the ecosystem catches up to TS 6.
Known Impact
pnpm export-pdfis temporarily broken --decktapewas removed. The script atscripts/export-slides-to-pdf.jsstill exists but needs an alternative PDF export approach.- Markdown heading ID generation algorithm changed in Astro 6 -- existing anchor links may break on the deployed site.
Files Changed
text
Modified:
astro.config.mjs (removed rehype-mermaid import and plugin config)
package.json (27 upgrades, 4 removals, postinstall removed)
pnpm-lock.yaml
src/content.config.ts (Zod 4 import, legacy collection migration)
src/content/cards/config.ts (Zod 4 import) Build Verification
- Production build completes successfully (~101 seconds)
- Dev server starts clean (2.7 seconds, no errors)
- All static pages generated
- Vercel adapter bundles correctly
- Sitemap generated