fix: match active path for versioned clients and plugins

pull/4911/head
Lubos 1 month ago
parent b83799a6e7
commit 9730374a54
No known key found for this signature in database
GPG Key ID: 315496906558D20F

@ -1,5 +1,5 @@
{
"name": "vitepress",
"name": "@hey-api/vitepress",
"version": "2.0.0-alpha.11",
"description": "Vite & Vue powered static site generator",
"keywords": [

@ -60,9 +60,23 @@ export function isActive(
return new RegExp(matchPath).test(currentPath)
}
if (normalize(matchPath) !== currentPath) {
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)

Loading…
Cancel
Save