From 18cc22399b7b1c27dafe12a50e8108f622af07d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:13:35 +0000 Subject: [PATCH 1/2] Initial plan From 102ded99c2926b2d4bfcf82f08b143be9e83a917 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 18:29:38 +0000 Subject: [PATCH 2/2] fix: reduce website build memory by switching rehype-mermaid to client-side rendering The rehype-mermaid plugin was using the default 'inline-svg' strategy which launches a headless Playwright/Chromium browser during build to render mermaid diagrams server-side. Combined with Astro 6's higher baseline memory usage, this caused OOM errors requiring an 8GB memory limit workaround. Changes: - Switch rehype-mermaid to 'pre-mermaid' strategy (no browser needed) - Add client-side mermaid.js script that only loads on pages with diagrams - Remove NODE_OPTIONS --max-old-space-size=8192 from build script Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com> --- website/astro.config.mjs | 14 +++++++++++++- website/package.json | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/website/astro.config.mjs b/website/astro.config.mjs index ea4a1ad8e76..46734aaeb4e 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -49,6 +49,18 @@ export default defineConfig({ src: "1ds-init.js", }, }, + { + tag: "script", + attrs: { + type: "module", + }, + content: `const els = document.querySelectorAll("pre.mermaid"); +if (els.length > 0) { + const { default: mermaid } = await import("https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs"); + mermaid.initialize({ startOnLoad: false }); + await mermaid.run({ nodes: els }); +}`, + }, ], social: [ { @@ -70,7 +82,7 @@ export default defineConfig({ // @ts-expect-error wrong type remarkPlugins: [remarkHeadingID], rehypePlugins: [ - rehypeMermaid, + [rehypeMermaid, { strategy: "pre-mermaid" }], [rehypeAstroRelativeMarkdownLinks, { base, collectionBase: false, trailingSlash: "always" }], ], shikiConfig: { diff --git a/website/package.json b/website/package.json index 4c8d3fb6b6d..2eff2114e74 100644 --- a/website/package.json +++ b/website/package.json @@ -8,7 +8,7 @@ "dev": "astro dev", "start": "astro dev", "build": "tsx ./.scripts/build.ts", - "build:web": "pnpm regen-all-packages-docs && astro check --minimumFailingSeverity hint && NODE_OPTIONS=\"--max-old-space-size=8192\" astro build", + "build:web": "pnpm regen-all-packages-docs && astro check --minimumFailingSeverity hint && astro build", "preview": "astro preview", "astro": "astro", "update-playground-versions": "tsx ./.scripts/update-playground-versions.ts",