1
- import { resolveRoutePathInfo } from '@vuepress/shared'
1
+ import { resolvePathInfo , resolveRoutePathWithExt } from '@vuepress/shared'
2
2
import { routes } from '../internal/routes.js'
3
3
import type { Route , RouteMeta } from '../types/index.js'
4
- import { resolveRoutePath } from './resolveRoutePath .js'
4
+ import { resolveRouteKey } from './resolveRouteKey .js'
5
5
6
6
export interface ResolvedRoute < T extends RouteMeta = RouteMeta >
7
7
extends Route < T > {
@@ -17,14 +17,16 @@ export const resolveRoute = <T extends RouteMeta = RouteMeta>(
17
17
currentPath ?: string ,
18
18
) : ResolvedRoute < T > => {
19
19
// get only the pathname from the path
20
- const [ pathname , hashAndQueries ] = resolveRoutePathInfo ( path )
20
+ const [ pathname , hashAndQueries ] = resolvePathInfo ( path )
21
21
22
22
// resolve the route path
23
- const routePath = resolveRoutePath ( pathname , currentPath )
24
- const routeFullPath = routePath + hashAndQueries
23
+ const routeKey = resolveRouteKey ( pathname , currentPath )
24
+ const routeFullPath = __VUEPRESS_CLEAN_URL__
25
+ ? routeKey
26
+ : resolveRoutePathWithExt ( routeKey ) + hashAndQueries
25
27
26
28
// the route not found
27
- if ( ! routes . value [ routePath ] ) {
29
+ if ( ! routes . value [ routeKey ] ) {
28
30
return {
29
31
...routes . value [ '/404.html' ] ,
30
32
path : routeFullPath ,
@@ -33,7 +35,7 @@ export const resolveRoute = <T extends RouteMeta = RouteMeta>(
33
35
}
34
36
35
37
return {
36
- ...routes . value [ routePath ] ,
38
+ ...routes . value [ routeKey ] ,
37
39
path : routeFullPath ,
38
40
notFound : false ,
39
41
} as ResolvedRoute < T >
0 commit comments