From 7981a0798a4f7184296bf42e94b6a8677f3ef2a0 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Tue, 24 Nov 2026 18:00:43 +0100 Subject: [PATCH] chore(docs|site): Vitepress 2 upgrade (#5164) * chore(docs): upgrade to VitePress 2 - Bump vitepress to 2.0.0-alpha.21 - Drop direct @docsearch/js and @docsearch/css deps; VitePress 2 ships DocSearch v4 and imports its styles itself - VPNavBarSearch override: use the new VPAlgoliaSearchBox props (algoliaOptions + openRequest) instead of dispatching synthetic keydown events - VPCarbonAds override: replace removed useAside composable with a media query, matching upstream - VPFooter override: use useLayout from vitepress/theme instead of the removed useSidebar().hasSidebar Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G9u8FhZukDbCKe1ZFByn43 * Fix types and imports * Fix ts imports * fix styling * Update mediaqueries * chore(docs): remove unused theme overrides VitePress 2 has no VPIconAlignLeft.vue for the alias to replace (the local nav uses the vpi-text-align-start icon class), and the Hero and HeroMatrix overrides aren't imported anywhere. Co-Authored-By: Claude Opus 5.5 * chore(docs): use rem media queries in MCP and waitlist styles Matches the rest of the theme and VitePress 2, which switched its breakpoints to rem. Co-Authored-By: Claude Opus 5.5 * fix(docs): don't fail the build when GitHub's release API drops The home hero's data loader let a network error from the GitHub releases API escape, which failed the whole docs build in CI ("fetch failed: other side closed"). Retry once, then fall back to null and hide the version badge instead of rendering "vundefined". Co-Authored-By: Claude Opus 5.5 * Add sentry --------- Co-authored-by: Claude --- docs/.vitepress/config.ts | 20 +- docs/.vitepress/lib/categories.ts | 2 +- .../lib/codeExamples/createLabCodeExamples.ts | 2 +- docs/.vitepress/lib/fetchPackages.ts | 2 +- docs/.vitepress/markdown/example.ts | 2 +- docs/.vitepress/markdown/sandpack.ts | 4 +- docs/.vitepress/markdown/snackPlayer.ts | 2 +- docs/.vitepress/sidebar/index.ts | 22 +- .../theme/components/base/ButtonMenu.vue | 5 +- .../theme/components/base/CardGrid.vue | 4 +- .../theme/components/base/Checkbox.vue | 1 + .../theme/components/base/LayoutTop.vue | 2 +- .../components/base/OverviewLinkGrid.vue | 4 +- .../theme/components/base/PageTabs.vue | 6 +- .../theme/components/base/Select.vue | 2 +- .../theme/components/home/HomeContainer.vue | 6 +- .../home/HomeHeroIconsAnimation.vue | 12 +- .../components/home/HomeHeroIconsCard.data.ts | 2 +- .../home/HomeHeroInfoBefore.data.ts | 38 +- .../components/home/HomeHeroInfoBefore.vue | 7 +- .../components/home/HomeIconCustomizer.vue | 4 +- .../home/HomeIconCustomizerIcons.vue | 2 +- .../theme/components/home/HomeSponsorCard.vue | 2 +- .../theme/components/home/HomeTeamSection.vue | 6 +- .../components/icons/CarbonAdOverlay.vue | 4 +- .../components/icons/CategoryList.data.ts | 4 +- .../theme/components/icons/CategoryList.vue | 4 +- .../components/icons/IconContributors.vue | 1 + .../components/icons/IconDetailOverlay.vue | 4 +- .../theme/components/icons/IconItem.vue | 2 +- .../theme/components/icons/IconPreview.vue | 1 + .../theme/components/icons/IconShowcase.vue | 2 + .../components/icons/KeyboardShortcuts.vue | 2 + .../theme/components/icons/StickyBar.vue | 6 +- .../theme/components/overrides/Hero.vue | 379 --------- .../theme/components/overrides/HeroMatrix.vue | 248 ------ .../components/overrides/VPCarbonAds.vue | 4 +- .../theme/components/overrides/VPFooter.vue | 6 +- .../components/overrides/VPIconAlignLeft.vue | 10 - .../components/overrides/VPNavBarSearch.vue | 111 ++- .../components/packages/PackageList.data.ts | 6 +- .../components/packages/PackageListItem.vue | 2 +- .../theme/components/sponsor/SponsorHero.vue | 6 +- .../sponsor/SponsorHeroAnimation.vue | 2 +- .../components/sponsor/SponsorStats.data.ts | 4 +- .../components/sponsor/SponsorTierCard.vue | 3 +- .../theme/components/sponsor/SponsorTiers.vue | 2 +- .../theme/components/waitlist/McpDiagram.vue | 2 +- .../components/waitlist/WaitlistHero.vue | 6 +- docs/.vitepress/theme/index.ts | 2 + .../theme/layouts/NavBarSponsorButton.vue | 4 +- docs/.vitepress/theme/style.css | 67 +- docs/.vitepress/theme/utils/sentry.ts | 19 + docs/.vitepress/transformPageData.ts | 4 +- docs/icons/[name].md | 4 +- docs/icons/categories.data.ts | 4 +- docs/icons/codeExamples.data.ts | 2 +- docs/icons/icons.data.ts | 2 +- docs/icons/lab/codeExamples.data.ts | 2 +- docs/package.json | 5 +- docs/scripts/writeIconDetails.mts | 4 +- docs/scripts/writeIconNodes.mts | 2 +- pnpm-lock.yaml | 738 +++++------------- 63 files changed, 481 insertions(+), 1358 deletions(-) delete mode 100644 docs/.vitepress/theme/components/overrides/Hero.vue delete mode 100644 docs/.vitepress/theme/components/overrides/HeroMatrix.vue delete mode 100644 docs/.vitepress/theme/components/overrides/VPIconAlignLeft.vue create mode 100644 docs/.vitepress/theme/utils/sentry.ts diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 6ab869aed..90c8dd532 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,15 +1,15 @@ import { fileURLToPath, URL } from 'node:url'; import { defineConfig, UserConfig } from 'vitepress'; import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons'; -import sidebar from './sidebar'; -import snackPlayer from './markdown/snackPlayer'; -import sandpackPlugin from './markdown/sandpack'; -import examplePlugin from './markdown/example'; +import sidebar from './sidebar/index.ts'; +import snackPlayer from './markdown/snackPlayer.ts'; +import sandpackPlugin from './markdown/sandpack.ts'; +import examplePlugin from './markdown/example.ts'; import { readFile } from 'node:fs/promises'; -import { resourcesSidebar } from './sidebar/resources'; +import { resourcesSidebar } from './sidebar/resources.ts'; import llmstxt from 'vitepress-plugin-llms'; -import { transformPageData } from './transformPageData'; -import getHeadConfig from './getHeadConfig'; +import { transformPageData } from './transformPageData.ts'; +import getHeadConfig from './getHeadConfig.ts'; const defaultSandpackCSS = await readFile( fileURLToPath(new URL('./theme/sandpack-default.css', import.meta.url)), @@ -56,12 +56,6 @@ export default defineConfig({ }, resolve: { alias: [ - { - find: /^.*\/VPIconAlignLeft\.vue$/, - replacement: fileURLToPath( - new URL('./theme/components/overrides/VPIconAlignLeft.vue', import.meta.url), - ), - }, { find: /^.*\/VPFooter\.vue$/, replacement: fileURLToPath( diff --git a/docs/.vitepress/lib/categories.ts b/docs/.vitepress/lib/categories.ts index 10f5daf3a..282ee4b3c 100644 --- a/docs/.vitepress/lib/categories.ts +++ b/docs/.vitepress/lib/categories.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import path from 'path'; -import { Category, IconEntity } from '../theme/types'; +import type { Category, IconEntity } from '../theme/types.ts'; const directory = path.join(process.cwd(), '../categories'); diff --git a/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts b/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts index 1541d3670..f65ac2348 100644 --- a/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts +++ b/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts @@ -1,4 +1,4 @@ -import { highLightCode } from './createCodeExamples'; +import { highLightCode } from './createCodeExamples.ts'; type CodeExampleType = { title: string; diff --git a/docs/.vitepress/lib/fetchPackages.ts b/docs/.vitepress/lib/fetchPackages.ts index aede27839..4c08828dc 100644 --- a/docs/.vitepress/lib/fetchPackages.ts +++ b/docs/.vitepress/lib/fetchPackages.ts @@ -1,6 +1,6 @@ import { promises as fs, constants } from 'fs'; import path from 'path'; -import { PackageItem } from '../theme/types'; +import { type PackageItem } from '../theme/types.ts'; const fileExist = (filePath) => fs diff --git a/docs/.vitepress/markdown/example.ts b/docs/.vitepress/markdown/example.ts index f38b949c1..536b3160f 100644 --- a/docs/.vitepress/markdown/example.ts +++ b/docs/.vitepress/markdown/example.ts @@ -1,6 +1,6 @@ import { readFileSync } from 'node:fs'; import { dirname, isAbsolute, resolve } from 'node:path'; -import type { MarkdownIt, RenderRule } from './types'; +import type { MarkdownIt, RenderRule } from './types.ts'; import container from 'markdown-it-container'; type ContainerArgs = [typeof container, string, { render: RenderRule }]; diff --git a/docs/.vitepress/markdown/sandpack.ts b/docs/.vitepress/markdown/sandpack.ts index 983a2ef90..b1b3d8933 100644 --- a/docs/.vitepress/markdown/sandpack.ts +++ b/docs/.vitepress/markdown/sandpack.ts @@ -1,6 +1,6 @@ -import type { MarkdownIt, RenderRule, Token } from './types'; +import type { MarkdownIt, RenderRule, Token } from './types.ts'; import container from 'markdown-it-container'; -import sandpackTheme from '../theme/sandpackTheme.json'; +import sandpackTheme from '../theme/sandpackTheme.json' with { type: 'json' }; type SnackParams = { defaultFiles?: Record< diff --git a/docs/.vitepress/markdown/snackPlayer.ts b/docs/.vitepress/markdown/snackPlayer.ts index 3005ed208..bdcd84b13 100644 --- a/docs/.vitepress/markdown/snackPlayer.ts +++ b/docs/.vitepress/markdown/snackPlayer.ts @@ -16,7 +16,7 @@ * /> */ -import type { MarkdownIt } from './types'; +import type { MarkdownIt } from './types.ts'; type SnackParams = Record; diff --git a/docs/.vitepress/sidebar/index.ts b/docs/.vitepress/sidebar/index.ts index 62fa9d001..889afb2af 100644 --- a/docs/.vitepress/sidebar/index.ts +++ b/docs/.vitepress/sidebar/index.ts @@ -1,15 +1,15 @@ import { DefaultTheme, UserConfig } from 'vitepress'; -import { reactSidebar } from './react'; -import { vueSidebar } from './vue'; -import { svelteSidebar } from './svelte'; -import { lucideSidebar } from './lucide'; -import { solidSidebar } from './solid'; -import { preactSidebar } from './preact'; -import { reactNativeSidebar } from './react-native'; -import { astroSidebar } from './astro'; -import { resourcesSidebar } from './resources'; -import { angularSidebar } from './angular'; -import { lucideStaticSidebar } from './static'; +import { reactSidebar } from './react.ts'; +import { vueSidebar } from './vue.ts'; +import { svelteSidebar } from './svelte.ts'; +import { lucideSidebar } from './lucide.ts'; +import { solidSidebar } from './solid.ts'; +import { preactSidebar } from './preact.ts'; +import { reactNativeSidebar } from './react-native.ts'; +import { astroSidebar } from './astro.ts'; +import { resourcesSidebar } from './resources.ts'; +import { angularSidebar } from './angular.ts'; +import { lucideStaticSidebar } from './static.ts'; type Sidebar = UserConfig['themeConfig']['sidebar']; diff --git a/docs/.vitepress/theme/components/base/ButtonMenu.vue b/docs/.vitepress/theme/components/base/ButtonMenu.vue index 618642d4a..a06191a85 100644 --- a/docs/.vitepress/theme/components/base/ButtonMenu.vue +++ b/docs/.vitepress/theme/components/base/ButtonMenu.vue @@ -161,7 +161,10 @@ ul.menu-items { .arrow-up-button::before { content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%0A%3E%3Cpolyline points='18 15 12 9 6 15' /%3E%3C/svg%3E%0A"); width: 20px; - height: 28px; + height: 20px; + /* line-height 0 keeps the chevron image at the top of this box, so the button's flex centering + centers it; it used to rely on VitePress 1's 38px button line-height instead */ + line-height: 0; margin: auto; display: block; } diff --git a/docs/.vitepress/theme/components/base/CardGrid.vue b/docs/.vitepress/theme/components/base/CardGrid.vue index 9f022ec8d..490bbca2f 100644 --- a/docs/.vitepress/theme/components/base/CardGrid.vue +++ b/docs/.vitepress/theme/components/base/CardGrid.vue @@ -21,13 +21,13 @@ padding: 8px; } -@media (min-width: 960px) { +@media (min-width: 60rem) { .card-grid-flex > * { flex-basis: 50%; } } -@media (min-width: 1280px) { +@media (min-width: 80rem) { .card-grid-flex > * { flex-basis: 33.33%; } diff --git a/docs/.vitepress/theme/components/base/Checkbox.vue b/docs/.vitepress/theme/components/base/Checkbox.vue index 058d9fdf5..dd3ddcd74 100644 --- a/docs/.vitepress/theme/components/base/Checkbox.vue +++ b/docs/.vitepress/theme/components/base/Checkbox.vue @@ -75,6 +75,7 @@ const model = computed({ appearance: none; width: 16px; height: 16px; + margin: 3px 3px 3px 4px; cursor: pointer; border: 1px solid var(--vp-input-border-color); background-color: var(--vp-input-switch-bg-color); diff --git a/docs/.vitepress/theme/components/base/LayoutTop.vue b/docs/.vitepress/theme/components/base/LayoutTop.vue index e008251f6..cac96d7d8 100644 --- a/docs/.vitepress/theme/components/base/LayoutTop.vue +++ b/docs/.vitepress/theme/components/base/LayoutTop.vue @@ -29,7 +29,7 @@ import RocketDuotoneIcon from '../home/RocketDuotoneIcon.ts'; diff --git a/docs/.vitepress/theme/components/overrides/HeroMatrix.vue b/docs/.vitepress/theme/components/overrides/HeroMatrix.vue deleted file mode 100644 index cd3f8b46c..000000000 --- a/docs/.vitepress/theme/components/overrides/HeroMatrix.vue +++ /dev/null @@ -1,248 +0,0 @@ - - - - - diff --git a/docs/.vitepress/theme/components/overrides/VPCarbonAds.vue b/docs/.vitepress/theme/components/overrides/VPCarbonAds.vue index b033e9c7d..338c05d50 100644 --- a/docs/.vitepress/theme/components/overrides/VPCarbonAds.vue +++ b/docs/.vitepress/theme/components/overrides/VPCarbonAds.vue @@ -1,7 +1,7 @@ - - diff --git a/docs/.vitepress/theme/components/overrides/VPNavBarSearch.vue b/docs/.vitepress/theme/components/overrides/VPNavBarSearch.vue index 59305c683..7137289f8 100644 --- a/docs/.vitepress/theme/components/overrides/VPNavBarSearch.vue +++ b/docs/.vitepress/theme/components/overrides/VPNavBarSearch.vue @@ -2,31 +2,33 @@ import { ref } from 'vue' // This component can be rendered more than once on a page (e.g. a hidden -// copy inside `.content-body`). DocSearch mounts into the first `#docsearch` -// in the document, so only a single instance may ever render the search box. +// copy inside `.content-body`). DocSearch mounts into `#vp-docsearch`, so only +// a single instance may ever render the search box. const loaded = ref(false) +// Shared so that any instance (e.g. the visible input) can open the modal +// rendered by the owning instance. +const openRequest = ref<{ target: 'search'; nonce: number } | null>(null) +let openNonce = 0 +// Every instance registers the hotkeys; only handle each event once. +let lastHandledEvent: KeyboardEvent | null = null