From 87ee81d1ab5449d5c75d0930355c52a37f7afd34 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sat, 8 Aug 2026 11:01:39 +0800 Subject: [PATCH 1/2] test(docs): fail docs build when SSR errors are detected Vue SSR silently swallows component render errors via handleError (console.warn), so vitepress build exits 0 even when pages are broken. This caused the voidzero/vitepress-alpha.19 incompatibility to go unnoticed. Add a wrapper script that greps the build output for SSR errors and exits non-zero if any are found. --- package.json | 2 +- scripts/test-docs.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 scripts/test-docs.sh diff --git a/package.json b/package.json index 532f4a36aca560..c80ba4abfe0dd2 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test-serve-bundled": "VITE_TEST_BUNDLED_DEV=1 vitest run -c vitest.config.e2e.ts", "test-build": "VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", "test-unit": "vitest run", - "test-docs": "pnpm run docs-build", + "test-docs": "bash scripts/test-docs.sh", "debug-serve": "VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", "debug-build": "VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts", "docs": "pnpm --filter=./docs run docs", diff --git a/scripts/test-docs.sh b/scripts/test-docs.sh new file mode 100755 index 00000000000000..4830a5b8236ce6 --- /dev/null +++ b/scripts/test-docs.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Run docs build and fail if there are SSR errors in the output. +# Vue SSR silently swallows component render errors via handleError (console.warn), +# so vitepress build exits 0 even when pages are broken. This script catches that. +set -e + +LOG_FILE=$(mktemp) +trap 'rm -f "$LOG_FILE"' EXIT + +pnpm run docs-build 2>&1 | tee "$LOG_FILE" + +if grep -qE '^(TypeError|Error|ReferenceError|SyntaxError):' "$LOG_FILE"; then + echo "" + echo "ERROR: SSR errors detected during docs build. See output above." + echo " Vue SSR silently swallows component errors, so the build exits 0" + echo " even when pages render incorrectly." + exit 1 +fi From c8ffad795ac21f8dd3d656a91c9409c4da793b9c Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Mon, 17 Aug 2026 13:46:34 +0800 Subject: [PATCH 2/2] test: update --- docs/package.json | 2 +- package.json | 2 +- patches/vitepress.patch | 27 +++++++++++++++ pnpm-lock.yaml | 23 +++++++------ pnpm-workspace.yaml | 75 +++++++++++++++++++++-------------------- 5 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 patches/vitepress.patch diff --git a/docs/package.json b/docs/package.json index c65bfe53cd8218..cf7db0c7c83e38 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,7 +11,7 @@ "@iconify/vue": "^5.0.1", "@shikijs/vitepress-twoslash": "^4.4.1", "@types/express": "^5.0.6", - "@voidzero-dev/vitepress-theme": "^5.0.6", + "@voidzero-dev/vitepress-theme": "5.0.4", "feed": "^6.0.0", "markdown-it-image-size": "^15.2.0", "oxc-minify": "^0.142.0", diff --git a/package.json b/package.json index c80ba4abfe0dd2..532f4a36aca560 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test-serve-bundled": "VITE_TEST_BUNDLED_DEV=1 vitest run -c vitest.config.e2e.ts", "test-build": "VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts", "test-unit": "vitest run", - "test-docs": "bash scripts/test-docs.sh", + "test-docs": "pnpm run docs-build", "debug-serve": "VITE_DEBUG_SERVE=1 vitest run -c vitest.config.e2e.ts", "debug-build": "VITE_TEST_BUILD=1 VITE_PRESERVE_BUILD_ARTIFACTS=1 vitest run -c vitest.config.e2e.ts", "docs": "pnpm --filter=./docs run docs", diff --git a/patches/vitepress.patch b/patches/vitepress.patch new file mode 100644 index 00000000000000..79084c8620ad71 --- /dev/null +++ b/patches/vitepress.patch @@ -0,0 +1,27 @@ +diff --git a/dist/client/app/ssr.js b/dist/client/app/ssr.js +index ca8086dc0ec91b10abf8fcecf0e513fe819db9a9..b28a2bbf31e33ad232620feaec588eb94c76ee71 100644 +--- a/dist/client/app/ssr.js ++++ b/dist/client/app/ssr.js +@@ -5,6 +5,22 @@ export async function render(path) { + const { app, router } = await createApp(); + await router.go(path); + const ctx = { content: '', vpSocialIcons: new Set() }; ++ const errors = []; ++ const userErrorHandler = app.config.errorHandler ++ app.config.errorHandler = (err, instance, info) => { ++ errors.push([err, info]) ++ userErrorHandler?.(err, instance, info) ++ } + ctx.content = await renderToString(app, ctx); ++ if (errors.length) { ++ const details = errors ++ .map(([err, info]) => ++ err instanceof Error ++ ? `[${info}] ${err.stack || err.message}` ++ : `[${info}] ${String(err)}` ++ ) ++ .join('\n') ++ throw new Error(`Errors during SSR rendering of ${path}:\n${details}`) ++ } + return ctx; + } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 189ba158380396..ebea80116c5f12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,9 +6,9 @@ settings: excludeLinksFromLockfile: false overrides: + debug: npm:obug@^1.0.2 rolldown: ~1.2.1 vite: workspace:* - debug: npm:obug@^1.0.2 packageExtensionsChecksum: sha256-TN34VxQ4aEf/0bmMCAf/tyq2fur66+GWTFoIOcaYREE= @@ -22,6 +22,9 @@ patchedDependencies: sirv@3.0.2: hash: c07c56eb72faea34341d465cde2314e89db472106ed378181e3447893af6bf95 path: patches/sirv@3.0.2.patch + vitepress: + hash: f5a056d993c87f7881e7f489d7e4481d0e8b1ef4de8fff701c5b0123c86dfc27 + path: patches/vitepress.patch importers: @@ -133,8 +136,8 @@ importers: specifier: ^5.0.6 version: 5.0.6 '@voidzero-dev/vitepress-theme': - specifier: ^5.0.6 - version: 5.0.6(focus-trap@8.2.2)(vite@packages+vite)(vitepress@2.0.0-alpha.19)(vue@3.5.40) + specifier: 5.0.4 + version: 5.0.4(focus-trap@8.2.2)(vite@packages+vite)(vitepress@2.0.0-alpha.19)(vue@3.5.40) feed: specifier: ^6.0.0 version: 6.0.0 @@ -146,7 +149,7 @@ importers: version: 0.142.0 vitepress: specifier: ^2.0.0-alpha.19 - version: 2.0.0-alpha.19(postcss@8.5.25)(typescript@6.0.3) + version: 2.0.0-alpha.19(patch_hash=f5a056d993c87f7881e7f489d7e4481d0e8b1ef4de8fff701c5b0123c86dfc27)(postcss@8.5.25)(typescript@6.0.3) vitepress-plugin-graphviz: specifier: ^0.1.0 version: 0.1.0(vitepress@2.0.0-alpha.19) @@ -4772,8 +4775,8 @@ packages: resolution: {integrity: sha512-y932hw4I0qrdlqbDhOC4VS7mtLad+MtXToSVJIZ79Cd7Ib6p4bRuoTRrx6OeedhdPm2yf9+r8ndlhJjn8LbsxQ==} engines: {node: '>=18'} - '@voidzero-dev/vitepress-theme@5.0.6': - resolution: {integrity: sha512-pzACA3+D564tulGW5XSWSaJ8YwghPJCKYJdZtGuMDkqji6xH/TDhvlHr35b1s9fCLeN/ksGTjBaWO9S5uwTvtA==} + '@voidzero-dev/vitepress-theme@5.0.4': + resolution: {integrity: sha512-sLCs+hAfejOAQP2B92djz1CIOgRmgRuYEwrE2Fu0i55SQu9+VDz/U9snVOEhYcz/RcHgAU6J24SMyZFqWOZGng==} peerDependencies: vitepress: ^2.0.0-alpha.16 vue: ^3.5.0 @@ -10800,7 +10803,7 @@ snapshots: '@voidzero-dev/vite-task-client@0.2.0': {} - '@voidzero-dev/vitepress-theme@5.0.6(focus-trap@8.2.2)(vite@packages+vite)(vitepress@2.0.0-alpha.19)(vue@3.5.40)': + '@voidzero-dev/vitepress-theme@5.0.4(focus-trap@8.2.2)(vite@packages+vite)(vitepress@2.0.0-alpha.19)(vue@3.5.40)': dependencies: '@docsearch/css': 4.7.0 '@docsearch/js': 4.7.0 @@ -10817,7 +10820,7 @@ snapshots: minisearch: 7.2.0 reka-ui: 2.9.0(vue@3.5.40) tailwindcss: 4.3.3 - vitepress: 2.0.0-alpha.19(postcss@8.5.25)(typescript@6.0.3) + vitepress: 2.0.0-alpha.19(patch_hash=f5a056d993c87f7881e7f489d7e4481d0e8b1ef4de8fff701c5b0123c86dfc27)(postcss@8.5.25)(typescript@6.0.3) vue: 3.5.40(typescript@6.0.3) transitivePeerDependencies: - '@vue/composition-api' @@ -14251,7 +14254,7 @@ snapshots: vitepress-plugin-graphviz@0.1.0(vitepress@2.0.0-alpha.19): dependencies: '@hpcc-js/wasm-graphviz': 1.21.2 - vitepress: 2.0.0-alpha.19(postcss@8.5.25)(typescript@6.0.3) + vitepress: 2.0.0-alpha.19(patch_hash=f5a056d993c87f7881e7f489d7e4481d0e8b1ef4de8fff701c5b0123c86dfc27)(postcss@8.5.25)(typescript@6.0.3) vitepress-plugin-group-icons@1.7.6(vite@packages+vite): dependencies: @@ -14280,7 +14283,7 @@ snapshots: transitivePeerDependencies: - ms - vitepress@2.0.0-alpha.19(postcss@8.5.25)(typescript@6.0.3): + vitepress@2.0.0-alpha.19(patch_hash=f5a056d993c87f7881e7f489d7e4481d0e8b1ef4de8fff701c5b0123c86dfc27)(postcss@8.5.25)(typescript@6.0.3): dependencies: '@docsearch/css': 4.7.0 '@docsearch/js': 4.7.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 3a62aa17a31ee6..6b22fd0e732a95 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,61 +3,62 @@ packages: - 'playground/**' - 'packages/**/__tests__/**' - docs - -hoistPattern: - - postcss # package/vite - - pug # playground/tailwind: @vue/compiler-sfc - - eslint-import-resolver-* # eslint-plugin-import-x -shellEmulator: true -autoInstallPeers: false -dedupeInjectedDeps: false -overrides: - rolldown: $rolldown - vite: 'workspace:*' - debug: 'npm:obug@^1.0.2' -patchedDependencies: - "sirv@3.0.2": "patches/sirv@3.0.2.patch" - "chokidar@3.6.0": "patches/chokidar@3.6.0.patch" - "dotenv-expand@13.0.0": "patches/dotenv-expand@13.0.0.patch" -peerDependencyRules: - allowedVersions: - vite: "*" -packageExtensions: - sass-embedded: - peerDependencies: - source-map-js: "*" - peerDependenciesMeta: - source-map-js: - optional: true - '@rollup/plugin-dynamic-import-vars': - dependencies: - '@types/estree': ^1.0.0 - '@volar/typescript': - dependencies: - '@volar/language-service': 2.4.28 allowBuilds: - core-js: false - vue-demi: false "@parcel/watcher": true "@tailwindcss/oxide": true + core-js: false esbuild: true playwright-chromium: true sharp: true simple-git-hooks: true unrs-resolver: true + vue-demi: false workerd: true +autoInstallPeers: false +blockExoticSubdeps: true +dedupeInjectedDeps: false + +dedupePeers: true + +hoistPattern: + - postcss # package/vite + - pug # playground/tailwind: @vue/compiler-sfc + - eslint-import-resolver-* # eslint-plugin-import-x minimumReleaseAge: 1440 minimumReleaseAgeExclude: - rolldown - '@rolldown/binding-*' - '@voidzero-dev/vitepress-theme@5.0.6' -blockExoticSubdeps: true +overrides: + debug: 'npm:obug@^1.0.2' + rolldown: $rolldown + vite: 'workspace:*' +packageExtensions: + '@rollup/plugin-dynamic-import-vars': + dependencies: + '@types/estree': ^1.0.0 + '@volar/typescript': + dependencies: + '@volar/language-service': 2.4.28 + sass-embedded: + peerDependencies: + source-map-js: "*" + peerDependenciesMeta: + source-map-js: + optional: true +patchedDependencies: + "chokidar@3.6.0": "patches/chokidar@3.6.0.patch" + "dotenv-expand@13.0.0": "patches/dotenv-expand@13.0.0.patch" + "sirv@3.0.2": "patches/sirv@3.0.2.patch" + vitepress: patches/vitepress.patch +peerDependencyRules: + allowedVersions: + vite: "*" +shellEmulator: true trustPolicy: no-downgrade trustPolicyExclude: - chokidar@4.0.3 # https://github.com/paulmillr/chokidar/issues/1440 - semver@5.7.2 || 6.3.1 - tailwindcss@3.4.18 - undici-types@6.21.0 # https://github.com/nodejs/undici/issues/4666 - -dedupePeers: true