@@ -119,7 +119,13 @@ export default defineConfig({
119119 content : "https://fulll.github.io/github-code-search/social-preview.png" ,
120120 } ,
121121 ] ,
122- [ "meta" , { property : "og:url" , content : "https://fulll.github.io/github-code-search/" } ] ,
122+ [
123+ "meta" ,
124+ {
125+ property : "og:url" ,
126+ content : "https://fulll.github.io/github-code-search/" ,
127+ } ,
128+ ] ,
123129 // ── Twitter Card ────────────────────────────────────────────────────────
124130 [ "meta" , { name : "twitter:card" , content : "summary_large_image" } ] ,
125131 [ "meta" , { name : "twitter:title" , content : "github-code-search" } ] ,
@@ -158,11 +164,40 @@ export default defineConfig({
158164 const svgPath = fileURLToPath ( new URL ( "../public/social-preview.svg" , import . meta. url ) ) ;
159165 const pngPath = fileURLToPath ( new URL ( "../public/social-preview.png" , import . meta. url ) ) ;
160166 const svg = readFileSync ( svgPath , "utf-8" ) ;
161- const resvg = new Resvg ( svg , { fitTo : { mode : "width" , value : 1200 } } ) ;
167+ const resvg = new Resvg ( svg , {
168+ fitTo : { mode : "width" , value : 1200 } ,
169+ } ) ;
162170 writeFileSync ( pngPath , resvg . render ( ) . asPng ( ) ) ;
163171 } ,
164172 } ,
165173 ] ,
174+ // ── Chunk splitting ──────────────────────────────────────────────────────
175+ // Mermaid alone is >900 kB minified; split it + the d3 sub-tree into
176+ // dedicated async chunks to eliminate the Rollup 500 kB warning and
177+ // improve long-term caching. No generic vendor catch-all — VitePress
178+ // internals (mark.js etc.) need Rollup's default resolution.
179+ build : {
180+ // Mermaid (bundled with d3) is legitimately large (~2.4 MB minified).
181+ // 2500 kB threshold avoids the Rollup warning without masking real bloat
182+ // on other chunks (next largest is katex at ~260 kB).
183+ chunkSizeWarningLimit : 2500 ,
184+ rollupOptions : {
185+ output : {
186+ manualChunks ( id : string ) {
187+ // Mermaid + d3 must be co-located (circular dependency between them).
188+ if (
189+ id . includes ( "node_modules/mermaid" ) ||
190+ id . includes ( "node_modules/vitepress-plugin-mermaid" ) ||
191+ id . includes ( "node_modules/d3" ) ||
192+ id . includes ( "node_modules/dagre-d3-es" ) ||
193+ id . includes ( "node_modules/internmap" ) ||
194+ id . includes ( "node_modules/robust-predicates" )
195+ )
196+ return "mermaid" ;
197+ } ,
198+ } ,
199+ } ,
200+ } ,
166201 } ,
167202
168203 themeConfig : {
@@ -305,13 +340,19 @@ export default defineConfig({
305340 // ── Markdown ──────────────────────────────────────────────────────────────
306341 markdown : {
307342 theme : {
308- light : "github-light" ,
343+ // github-light-high-contrast fixes WCAG AA contrast for Shiki tokens
344+ // (github-light has #D73A49 4.24:1, #6A737D 4.46:1, #22863A 4.28:1 — all below 4.5:1)
345+ light : "github-light-high-contrast" ,
309346 dark : "github-dark" ,
310347 } ,
311348 } ,
312349
313350 // ── Sitemap ───────────────────────────────────────────────────────────────
351+ // VITEPRESS_HOSTNAME overrides the default for local/CI a11y audits:
352+ // VITEPRESS_HOSTNAME=http://localhost:4173 vitepress build docs
353+ // → sitemap.xml contains localhost URLs that pa11y-ci can reach directly.
314354 sitemap : {
315- hostname : "https://fulll.github.io/github-code-search/" ,
355+ hostname :
356+ ( process . env . VITEPRESS_HOSTNAME ?? "https://fulll.github.io" ) + "/github-code-search/" ,
316357 } ,
317358} ) ;
0 commit comments