From 9730374a54a93706a0e13841b040fd1cc29bb125 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 17 Aug 2025 20:10:13 +0800 Subject: [PATCH] fix: match active path for versioned clients and plugins --- package.json | 2 +- src/shared/shared.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7ab3484d..a22d8994 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "vitepress", + "name": "@hey-api/vitepress", "version": "2.0.0-alpha.11", "description": "Vite & Vue powered static site generator", "keywords": [ diff --git a/src/shared/shared.ts b/src/shared/shared.ts index c556e723..1e3d9882 100644 --- a/src/shared/shared.ts +++ b/src/shared/shared.ts @@ -60,8 +60,22 @@ export function isActive( return new RegExp(matchPath).test(currentPath) } - if (normalize(matchPath) !== currentPath) { - return false + const normalizedMatchPath = normalize(matchPath) + + if (normalizedMatchPath !== currentPath) { + const currentPathParts = currentPath.split('/') + // handle versioned clients and plugins + if ( + currentPathParts.length > 3 && + (currentPathParts[2] === 'plugins' || currentPathParts[2] === 'clients') + ) { + currentPath = currentPathParts.slice(0, 4).join('/') + if (normalizedMatchPath !== currentPath) { + return false + } + } else { + return false + } } const hashMatch = matchPath.match(HASH_RE)