@vuepress/client 2.0.0-rc.11 → 2.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/{chunk-MPZOAYAQ.js → chunk-ZQJPP2LC.js} +37 -18
- package/dist/index.d.ts +7 -2
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/dist/app.js
CHANGED
|
@@ -60,30 +60,48 @@ if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/router/resolveRoutePath.ts
|
|
63
|
-
var resolveRoutePath = (
|
|
64
|
-
const
|
|
65
|
-
if (routes.value[
|
|
66
|
-
return
|
|
67
|
-
const
|
|
68
|
-
if (routes.value[
|
|
69
|
-
return
|
|
70
|
-
|
|
63
|
+
var resolveRoutePath = (pathname, currentPath) => {
|
|
64
|
+
const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
|
|
65
|
+
if (routes.value[normalizedRoutePath])
|
|
66
|
+
return normalizedRoutePath;
|
|
67
|
+
const encodedRoutePath = encodeURI(normalizedRoutePath);
|
|
68
|
+
if (routes.value[encodedRoutePath]) {
|
|
69
|
+
return encodedRoutePath;
|
|
70
|
+
}
|
|
71
|
+
const redirectedRoutePath = redirects.value[normalizedRoutePath] || redirects.value[encodedRoutePath];
|
|
72
|
+
if (redirectedRoutePath) {
|
|
73
|
+
return redirectedRoutePath;
|
|
74
|
+
}
|
|
75
|
+
return normalizedRoutePath;
|
|
71
76
|
};
|
|
72
77
|
|
|
73
78
|
// src/router/resolveRoute.ts
|
|
79
|
+
import { splitPath } from "@vuepress/shared";
|
|
74
80
|
var resolveRoute = (path, currentPath) => {
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
const { pathname, hashAndQueries } = splitPath(path);
|
|
82
|
+
const routePath = resolveRoutePath(pathname, currentPath);
|
|
83
|
+
const routeFullPath = routePath + hashAndQueries;
|
|
84
|
+
if (!routes.value[routePath]) {
|
|
85
|
+
return {
|
|
86
|
+
...routes.value["/404.html"],
|
|
87
|
+
path: routeFullPath,
|
|
88
|
+
notFound: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
80
91
|
return {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
...routes.value[routePath],
|
|
93
|
+
path: routeFullPath,
|
|
94
|
+
notFound: false
|
|
84
95
|
};
|
|
85
96
|
};
|
|
86
97
|
|
|
98
|
+
// src/router/resolveRouteFullPath.ts
|
|
99
|
+
import { splitPath as splitPath2 } from "@vuepress/shared";
|
|
100
|
+
var resolveRouteFullPath = (path, currentPath) => {
|
|
101
|
+
const { pathname, hashAndQueries } = splitPath2(path);
|
|
102
|
+
return resolveRoutePath(pathname, currentPath) + hashAndQueries;
|
|
103
|
+
};
|
|
104
|
+
|
|
87
105
|
// src/router/index.ts
|
|
88
106
|
import { useRoute, useRouter } from "vue-router";
|
|
89
107
|
|
|
@@ -134,7 +152,7 @@ var RouteLink = defineComponent({
|
|
|
134
152
|
const router = useRouter2();
|
|
135
153
|
const route = useRoute2();
|
|
136
154
|
const path = computed(
|
|
137
|
-
() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${
|
|
155
|
+
() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`
|
|
138
156
|
);
|
|
139
157
|
return () => h(
|
|
140
158
|
"a",
|
|
@@ -334,7 +352,7 @@ var resolvers = reactive({
|
|
|
334
352
|
/**
|
|
335
353
|
* Resolve locale path according to route path and locales config
|
|
336
354
|
*/
|
|
337
|
-
resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, routePath),
|
|
355
|
+
resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, decodeURI(routePath)),
|
|
338
356
|
/**
|
|
339
357
|
* Resolve site data for specific locale
|
|
340
358
|
*
|
|
@@ -385,6 +403,7 @@ export {
|
|
|
385
403
|
routes,
|
|
386
404
|
resolveRoutePath,
|
|
387
405
|
resolveRoute,
|
|
406
|
+
resolveRouteFullPath,
|
|
388
407
|
useRoute,
|
|
389
408
|
useRouter,
|
|
390
409
|
RouteLink,
|
package/dist/index.d.ts
CHANGED
|
@@ -302,10 +302,15 @@ interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
|
|
|
302
302
|
*/
|
|
303
303
|
declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
|
|
304
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Resolve route full path with given raw path
|
|
307
|
+
*/
|
|
308
|
+
declare const resolveRouteFullPath: (path: string, currentPath?: string) => string;
|
|
309
|
+
|
|
305
310
|
/**
|
|
306
311
|
* Resolve route path with given raw path
|
|
307
312
|
*/
|
|
308
|
-
declare const resolveRoutePath: (
|
|
313
|
+
declare const resolveRoutePath: (pathname: string, currentPath?: string) => string;
|
|
309
314
|
|
|
310
315
|
/**
|
|
311
316
|
* Resolver methods to get global computed
|
|
@@ -334,4 +339,4 @@ declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
|
334
339
|
*/
|
|
335
340
|
declare const withBase: (url: string) => string;
|
|
336
341
|
|
|
337
|
-
export { AutoLink, type AutoLinkConfig, type ClientConfig, type ClientData, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type ResolvedRoute, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type RoutePath, type RoutePathRef, type Routes, type RoutesRef, type SiteDataRef, type SiteLocaleDataRef, type UpdateHead, clientDataSymbol, defineClientConfig, resolveRoute, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
|
342
|
+
export { AutoLink, type AutoLinkConfig, type ClientConfig, type ClientData, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type ResolvedRoute, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type RoutePath, type RoutePathRef, type Routes, type RoutesRef, type SiteDataRef, type SiteLocaleDataRef, type UpdateHead, clientDataSymbol, defineClientConfig, resolveRoute, resolveRouteFullPath, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
clientDataSymbol,
|
|
7
7
|
defineClientConfig,
|
|
8
8
|
resolveRoute,
|
|
9
|
+
resolveRouteFullPath,
|
|
9
10
|
resolveRoutePath,
|
|
10
11
|
resolvers,
|
|
11
12
|
updateHeadSymbol,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
useSiteLocaleData,
|
|
28
29
|
useUpdateHead,
|
|
29
30
|
withBase
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZQJPP2LC.js";
|
|
31
32
|
export {
|
|
32
33
|
AutoLink,
|
|
33
34
|
ClientOnly,
|
|
@@ -36,6 +37,7 @@ export {
|
|
|
36
37
|
clientDataSymbol,
|
|
37
38
|
defineClientConfig,
|
|
38
39
|
resolveRoute,
|
|
40
|
+
resolveRouteFullPath,
|
|
39
41
|
resolveRoutePath,
|
|
40
42
|
resolvers,
|
|
41
43
|
updateHeadSymbol,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.13",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@vue/devtools-api": "^6.6.1",
|
|
37
37
|
"vue": "^3.4.27",
|
|
38
38
|
"vue-router": "^4.3.2",
|
|
39
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
39
|
+
"@vuepress/shared": "2.0.0-rc.13"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|