@vuepress/client 2.0.0-rc.31 → 2.0.0-rc.32
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.d.ts +2 -5
- package/dist/app.js +31 -30
- package/dist/{constants-CWVu3aBh.js → constants-KnoIK7Ob.js} +2 -3
- package/dist/{index-wQR7Pl0s.d.ts → index-DXAyy5fd.d.ts} +1 -11
- package/dist/index.d.ts +50 -80
- package/dist/index.js +3 -4
- package/dist/rolldown-runtime-D3KUYPsf.js +12 -0
- package/dist/{setupDevtools-DJemw8CK.js → setupDevtools-5p-_XGbk.js} +2 -3
- package/dist/{utils-jFeCv-dX.js → utils-B71L9rqN.js} +37 -51
- package/package.json +6 -6
- package/types.d.ts +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
package/dist/app.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { t as CreateVueAppFunction } from "./index-
|
|
1
|
+
import { t as CreateVueAppFunction } from "./index-DXAyy5fd.js";
|
|
2
2
|
import "@internal/userStyle";
|
|
3
|
-
|
|
4
|
-
declare const createVueApp: CreateVueAppFunction;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { createVueApp };
|
|
3
|
+
export declare const createVueApp: CreateVueAppFunction;
|
package/dist/app.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { D as usePageLang, E as usePageHead, L as clientDataSymbol, O as usePageLayout, f as redirects, i as ClientOnly, m as updateHeadSymbol, n as resolvers, o as RouteLink, p as routes, r as Content, t as withBase, u as resolveRoute } from "./utils-
|
|
1
|
+
import { D as usePageLang, E as usePageHead, L as clientDataSymbol, O as usePageLayout, f as redirects, i as ClientOnly, m as updateHeadSymbol, n as resolvers, o as RouteLink, p as routes, r as Content, t as withBase, u as resolveRoute } from "./utils-B71L9rqN.js";
|
|
2
2
|
import { clientConfigs } from "@internal/clientConfigs";
|
|
3
3
|
import { computed, createApp, createSSRApp, customRef, h, onMounted, provide, shallowRef, useSSRContext, watch } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { START_LOCATION, createMemoryHistory, createRouter, createWebHistory, useRoute } from "vue-router";
|
|
5
|
+
import { SCROLL_RESTORATION_CAPTURE_DEFAULT, SCROLL_RESTORATION_RESTORE_DEFAULT, ScrollRestoration, useScrollRestoration } from "vue-router/experimental";
|
|
6
|
+
import { siteData as siteData$1 } from "@internal/siteData";
|
|
5
7
|
import { isPlainObject, isString, removeEndingSlash } from "@vuepress/shared";
|
|
6
|
-
import { START_LOCATION, createMemoryHistory, createRouter, createWebHistory } from "vue-router";
|
|
7
8
|
import "@internal/userStyle";
|
|
8
|
-
|
|
9
|
+
// src/internal/siteData.ts
|
|
9
10
|
/**
|
|
10
11
|
* Global site data ref
|
|
11
12
|
*/
|
|
12
|
-
const siteData
|
|
13
|
+
const siteData = shallowRef(siteData$1);
|
|
13
14
|
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) __VUE_HMR_RUNTIME__.updateSiteData = (data) => {
|
|
14
|
-
siteData
|
|
15
|
+
siteData.value = data;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
//#region src/router/createVueRouter.ts
|
|
17
|
+
// src/router/createVueRouter.ts
|
|
18
18
|
/**
|
|
19
19
|
* - use `createWebHistory` in dev mode and build mode client bundle
|
|
20
20
|
* - use `createMemoryHistory` in build mode server bundle
|
|
@@ -30,12 +30,7 @@ const createVueRouter = () => {
|
|
|
30
30
|
name: "vuepress-route",
|
|
31
31
|
path: "/:catchAll(.*)",
|
|
32
32
|
components: {}
|
|
33
|
-
}]
|
|
34
|
-
scrollBehavior: (to, _from, savedPosition) => {
|
|
35
|
-
if (savedPosition) return savedPosition;
|
|
36
|
-
if (to.hash) return { el: to.hash };
|
|
37
|
-
return { top: 0 };
|
|
38
|
-
}
|
|
33
|
+
}]
|
|
39
34
|
});
|
|
40
35
|
router.beforeResolve(async (to, from) => {
|
|
41
36
|
if (to.path !== from.path || from === START_LOCATION) {
|
|
@@ -50,8 +45,7 @@ const createVueRouter = () => {
|
|
|
50
45
|
});
|
|
51
46
|
return router;
|
|
52
47
|
};
|
|
53
|
-
|
|
54
|
-
//#region src/setupGlobalComponents.ts
|
|
48
|
+
// src/setupGlobalComponents.ts
|
|
55
49
|
/**
|
|
56
50
|
* Register global built-in components
|
|
57
51
|
*/
|
|
@@ -60,8 +54,7 @@ const setupGlobalComponents = (app) => {
|
|
|
60
54
|
app.component("Content", Content);
|
|
61
55
|
app.component("RouteLink", RouteLink);
|
|
62
56
|
};
|
|
63
|
-
|
|
64
|
-
//#region src/setupGlobalComputed.ts
|
|
57
|
+
// src/setupGlobalComputed.ts
|
|
65
58
|
/**
|
|
66
59
|
* Create and provide global computed
|
|
67
60
|
*/
|
|
@@ -86,8 +79,8 @@ const setupGlobalComputed = (app, router, clientConfigs) => {
|
|
|
86
79
|
if (newPageData.path === router.currentRoute.value.meta._pageChunk?._pageData.path) pageChunk.value = newPageChunk;
|
|
87
80
|
};
|
|
88
81
|
const layouts = computed(() => resolvers.resolveLayouts(clientConfigs));
|
|
89
|
-
const routeLocale = computed(() => resolvers.resolveRouteLocale(siteData
|
|
90
|
-
const siteLocaleData = computed(() => resolvers.resolveSiteLocaleData(siteData
|
|
82
|
+
const routeLocale = computed(() => resolvers.resolveRouteLocale(siteData.value.locales, routePath.value));
|
|
83
|
+
const siteLocaleData = computed(() => resolvers.resolveSiteLocaleData(siteData.value, routeLocale.value));
|
|
91
84
|
const pageComponent = computed(() => pageChunk.value.default);
|
|
92
85
|
const pageData = computed(() => pageChunk.value._pageData);
|
|
93
86
|
const pageFrontmatter = computed(() => pageData.value.frontmatter);
|
|
@@ -107,14 +100,14 @@ const setupGlobalComputed = (app, router, clientConfigs) => {
|
|
|
107
100
|
routeLocale,
|
|
108
101
|
routePath,
|
|
109
102
|
routes,
|
|
110
|
-
siteData
|
|
103
|
+
siteData,
|
|
111
104
|
siteLocaleData,
|
|
112
105
|
frontmatter: pageFrontmatter,
|
|
113
106
|
head: pageHead,
|
|
114
107
|
headTitle: pageHeadTitle,
|
|
115
108
|
lang: pageLang,
|
|
116
109
|
page: pageData,
|
|
117
|
-
site: siteData
|
|
110
|
+
site: siteData,
|
|
118
111
|
siteLocale: siteLocaleData
|
|
119
112
|
};
|
|
120
113
|
app.provide(clientDataSymbol, clientData);
|
|
@@ -131,13 +124,12 @@ const setupGlobalComputed = (app, router, clientConfigs) => {
|
|
|
131
124
|
$headTitle: { get: () => pageHeadTitle.value },
|
|
132
125
|
$lang: { get: () => pageLang.value },
|
|
133
126
|
$page: { get: () => pageData.value },
|
|
134
|
-
$site: { get: () => siteData
|
|
127
|
+
$site: { get: () => siteData.value },
|
|
135
128
|
$siteLocale: { get: () => siteLocaleData.value }
|
|
136
129
|
});
|
|
137
130
|
return clientData;
|
|
138
131
|
};
|
|
139
|
-
|
|
140
|
-
//#region src/setupUpdateHead.ts
|
|
132
|
+
// src/setupUpdateHead.ts
|
|
141
133
|
/**
|
|
142
134
|
* Query the matched head element of head config
|
|
143
135
|
*/
|
|
@@ -219,8 +211,7 @@ const setupUpdateHead = () => {
|
|
|
219
211
|
watch(head, updateHead, { immediate: __VUEPRESS_DEV__ });
|
|
220
212
|
});
|
|
221
213
|
};
|
|
222
|
-
|
|
223
|
-
//#region src/app.ts
|
|
214
|
+
// src/app.ts
|
|
224
215
|
/**
|
|
225
216
|
* - use `createApp` in dev mode
|
|
226
217
|
* - use `createSSRApp` in build mode
|
|
@@ -234,6 +225,12 @@ const createVueApp = async () => {
|
|
|
234
225
|
for (const clientConfig of clientConfigs) clientConfig.setup?.();
|
|
235
226
|
const clientRootComponents = clientConfigs.flatMap(({ rootComponents = [] }) => rootComponents.map((component) => h(component)));
|
|
236
227
|
const pageLayout = usePageLayout();
|
|
228
|
+
const { scroll } = useScrollRestoration({ manual: true });
|
|
229
|
+
const route = useRoute();
|
|
230
|
+
onMounted(scroll);
|
|
231
|
+
watch(() => route.fullPath, () => {
|
|
232
|
+
scroll();
|
|
233
|
+
}, { flush: "post" });
|
|
237
234
|
return () => [h(pageLayout.value), clientRootComponents];
|
|
238
235
|
}
|
|
239
236
|
});
|
|
@@ -241,13 +238,18 @@ const createVueApp = async () => {
|
|
|
241
238
|
setupGlobalComponents(app);
|
|
242
239
|
const globalComputed = setupGlobalComputed(app, router, clientConfigs);
|
|
243
240
|
if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
|
|
244
|
-
const { setupDevtools } = await import("./setupDevtools-
|
|
241
|
+
const { setupDevtools } = await import("./setupDevtools-5p-_XGbk.js");
|
|
245
242
|
setupDevtools(app, globalComputed);
|
|
246
243
|
}
|
|
247
244
|
for (const clientConfig of clientConfigs) await clientConfig.enhance?.({
|
|
248
245
|
app,
|
|
249
246
|
router,
|
|
250
|
-
siteData
|
|
247
|
+
siteData
|
|
248
|
+
});
|
|
249
|
+
app.use(ScrollRestoration, {
|
|
250
|
+
router,
|
|
251
|
+
capture: SCROLL_RESTORATION_CAPTURE_DEFAULT,
|
|
252
|
+
restore: SCROLL_RESTORATION_RESTORE_DEFAULT
|
|
251
253
|
});
|
|
252
254
|
app.use(router);
|
|
253
255
|
return {
|
|
@@ -260,5 +262,4 @@ if (!__VUEPRESS_SSR__) createVueApp().then(({ app, router }) => {
|
|
|
260
262
|
app.mount("#app");
|
|
261
263
|
});
|
|
262
264
|
});
|
|
263
|
-
//#endregion
|
|
264
265
|
export { createVueApp };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.js";
|
|
2
|
+
// src/devtools/constants.ts
|
|
3
3
|
var constants_exports = /* @__PURE__ */ __exportAll({
|
|
4
4
|
COMPONENT_STATE_TYPE: () => COMPONENT_STATE_TYPE,
|
|
5
5
|
INSPECTOR_ID: () => INSPECTOR_ID,
|
|
@@ -53,5 +53,4 @@ const INSPECTOR_NODES = {
|
|
|
53
53
|
[INSPECTOR_NODE_PAGE.id]: INSPECTOR_NODE_PAGE
|
|
54
54
|
};
|
|
55
55
|
const INSPECTOR_STATE_SECTION_NAME = "State";
|
|
56
|
-
//#endregion
|
|
57
56
|
export { INSPECTOR_STATE_SECTION_NAME as a, constants_exports as c, INSPECTOR_NODES as i, INSPECTOR_ID as n, PLUGIN_ID as o, INSPECTOR_LABEL as r, PLUGIN_LABEL as s, COMPONENT_STATE_TYPE as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { App, Component, ComputedRef, Ref } from "vue";
|
|
2
|
-
import { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleData } from "@vuepress/shared";
|
|
3
2
|
import { Router } from "vue-router";
|
|
4
|
-
|
|
3
|
+
import { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleData } from "@vuepress/shared";
|
|
5
4
|
/**
|
|
6
5
|
* Name of the default layout
|
|
7
6
|
*/
|
|
@@ -10,8 +9,6 @@ declare const LAYOUT_NAME_DEFAULT = "Layout";
|
|
|
10
9
|
* Name of the 404 page layout
|
|
11
10
|
*/
|
|
12
11
|
declare const LAYOUT_NAME_NOT_FOUND = "NotFound";
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/types/routes.d.ts
|
|
15
12
|
interface PageChunk {
|
|
16
13
|
default: Component;
|
|
17
14
|
_pageData: PageData;
|
|
@@ -23,8 +20,6 @@ interface Route<T extends RouteMeta = RouteMeta> {
|
|
|
23
20
|
}
|
|
24
21
|
type Redirects = Record<string, string>;
|
|
25
22
|
type Routes = Record<string, Route>;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/types/clientData.d.ts
|
|
28
23
|
interface Layouts {
|
|
29
24
|
[LAYOUT_NAME_DEFAULT]: Component;
|
|
30
25
|
[LAYOUT_NAME_NOT_FOUND]: Component;
|
|
@@ -74,8 +69,6 @@ interface ClientData<Frontmatter extends Record<string, unknown> = Record<string
|
|
|
74
69
|
site: SiteDataRef;
|
|
75
70
|
siteLocale: SiteLocaleDataRef;
|
|
76
71
|
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/types/clientConfig.d.ts
|
|
79
72
|
/**
|
|
80
73
|
* Configure vuepress client
|
|
81
74
|
*/
|
|
@@ -102,11 +95,8 @@ interface ClientConfig {
|
|
|
102
95
|
*/
|
|
103
96
|
rootComponents?: Component[];
|
|
104
97
|
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/types/createVueAppFunction.d.ts
|
|
107
98
|
type CreateVueAppFunction = () => Promise<{
|
|
108
99
|
app: App;
|
|
109
100
|
router: Router;
|
|
110
101
|
}>;
|
|
111
|
-
//#endregion
|
|
112
102
|
export { SiteLocaleData as A, RouteLocale as C, RoutesRef as D, RoutePathRef as E, RouteMeta as F, Routes as I, PageChunk as M, Redirects as N, SiteData as O, Route as P, RedirectsRef as S, RoutePath as T, PageHeader as _, Layouts as a, PageLayout as b, PageComponentRef as c, PageFrontmatter as d, PageFrontmatterRef as f, PageHeadTitleRef as g, PageHeadTitle as h, HeadConfig as i, SiteLocaleDataRef as j, SiteDataRef as k, PageData as l, PageHeadRef as m, ClientConfig as n, LayoutsRef as o, PageHead as p, ClientData as r, PageComponent as s, CreateVueAppFunction as t, PageDataRef as u, PageLang as v, RouteLocaleRef as w, PageLayoutRef as x, PageLangRef as y };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { A as SiteLocaleData, C as RouteLocale, D as RoutesRef, E as RoutePathRef, F as RouteMeta, I as Routes, M as PageChunk, N as Redirects, O as SiteData, P as Route, S as RedirectsRef, T as RoutePath, _ as PageHeader, a as Layouts, b as PageLayout, c as PageComponentRef, d as PageFrontmatter, f as PageFrontmatterRef, g as PageHeadTitleRef, h as PageHeadTitle, i as HeadConfig, j as SiteLocaleDataRef, k as SiteDataRef, l as PageData, m as PageHeadRef, n as ClientConfig, o as LayoutsRef, p as PageHead, r as ClientData, s as PageComponent, t as CreateVueAppFunction, u as PageDataRef, v as PageLang, w as RouteLocaleRef, x as PageLayoutRef, y as PageLangRef } from "./index-
|
|
1
|
+
import { A as SiteLocaleData, C as RouteLocale, D as RoutesRef, E as RoutePathRef, F as RouteMeta, I as Routes, M as PageChunk, N as Redirects, O as SiteData, P as Route, S as RedirectsRef, T as RoutePath, _ as PageHeader, a as Layouts, b as PageLayout, c as PageComponentRef, d as PageFrontmatter, f as PageFrontmatterRef, g as PageHeadTitleRef, h as PageHeadTitle, i as HeadConfig, j as SiteLocaleDataRef, k as SiteDataRef, l as PageData, m as PageHeadRef, n as ClientConfig, o as LayoutsRef, p as PageHead, r as ClientData, s as PageComponent, t as CreateVueAppFunction, u as PageDataRef, v as PageLang, w as RouteLocaleRef, x as PageLayoutRef, y as PageLangRef } from "./index-DXAyy5fd.js";
|
|
2
2
|
import { InjectionKey, PropType, SlotsType, VNode } from "vue";
|
|
3
3
|
import { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from "vue-router";
|
|
4
|
-
//#region src/types/onContentUpdated.d.ts
|
|
5
4
|
type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated';
|
|
6
5
|
type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown;
|
|
7
|
-
|
|
8
|
-
//#region src/components/AutoLink.d.ts
|
|
9
|
-
interface AutoLinkConfig {
|
|
6
|
+
export interface AutoLinkConfig {
|
|
10
7
|
/**
|
|
11
8
|
* Pattern to determine if the link should be active, which has higher priority than `exact`
|
|
12
9
|
*/
|
|
@@ -42,7 +39,7 @@ interface AutoLinkConfig {
|
|
|
42
39
|
* - If the link is internal, it will be rendered as a `<RouteLink>`
|
|
43
40
|
* - If the link is external, it will be rendered as a normal `<a>` tag
|
|
44
41
|
*/
|
|
45
|
-
declare const AutoLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
42
|
+
export declare const AutoLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
46
43
|
config: {
|
|
47
44
|
type: PropType<AutoLinkConfig>;
|
|
48
45
|
required: true;
|
|
@@ -59,8 +56,6 @@ declare const AutoLink: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
59
56
|
before?: (config: AutoLinkConfig) => VNode | VNode[] | null;
|
|
60
57
|
after?: (config: AutoLinkConfig) => VNode | VNode[] | null;
|
|
61
58
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/components/ClientOnly.d.ts
|
|
64
59
|
/**
|
|
65
60
|
* Wrapper component that only renders its content on the client side and skips server side rendering
|
|
66
61
|
*
|
|
@@ -68,15 +63,13 @@ declare const AutoLink: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
68
63
|
*
|
|
69
64
|
* @see https://blog.vuejs.org/posts/vue-3-5#data-allow-mismatch
|
|
70
65
|
*/
|
|
71
|
-
declare const ClientOnly: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
66
|
+
export declare const ClientOnly: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
72
67
|
[key: string]: any;
|
|
73
68
|
}>[] | null | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/components/Content.d.ts
|
|
76
69
|
/**
|
|
77
70
|
* Markdown rendered content
|
|
78
71
|
*/
|
|
79
|
-
declare const Content: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
72
|
+
export declare const Content: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
80
73
|
path: {
|
|
81
74
|
type: StringConstructor;
|
|
82
75
|
required: false;
|
|
@@ -93,9 +86,7 @@ declare const Content: import("vue").DefineComponent<import("vue").ExtractPropTy
|
|
|
93
86
|
}>> & Readonly<{}>, {
|
|
94
87
|
path: string;
|
|
95
88
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
96
|
-
|
|
97
|
-
//#region src/components/RouteLink.d.ts
|
|
98
|
-
interface RouteLinkProps {
|
|
89
|
+
export interface RouteLinkProps {
|
|
99
90
|
/**
|
|
100
91
|
* Whether the link is active to have an active class
|
|
101
92
|
*
|
|
@@ -122,7 +113,7 @@ interface RouteLinkProps {
|
|
|
122
113
|
*
|
|
123
114
|
* It's recommended to use `RouteLink` in VuePress.
|
|
124
115
|
*/
|
|
125
|
-
declare const RouteLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
116
|
+
export declare const RouteLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
126
117
|
/**
|
|
127
118
|
* The route path to link to
|
|
128
119
|
*/
|
|
@@ -172,61 +163,53 @@ declare const RouteLink: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
172
163
|
}, SlotsType<{
|
|
173
164
|
default: () => (VNode | string)[] | VNode | string;
|
|
174
165
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region src/composables/clientData.d.ts
|
|
177
166
|
/**
|
|
178
167
|
* The problem only occurs during hot updates in the development environment,
|
|
179
168
|
* It only needs to be processed in the development environment.
|
|
180
169
|
* (see vuepress/core#1715)
|
|
181
170
|
*/
|
|
182
|
-
declare const clientDataSymbol: InjectionKey<ClientData>;
|
|
171
|
+
export declare const clientDataSymbol: InjectionKey<ClientData>;
|
|
183
172
|
/**
|
|
184
173
|
* Returns client data
|
|
185
174
|
*/
|
|
186
|
-
declare const useClientData: <Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>>() => ClientData<Frontmatter, Data>;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
declare const
|
|
190
|
-
declare const
|
|
191
|
-
declare const
|
|
192
|
-
declare const
|
|
193
|
-
declare const
|
|
194
|
-
declare const
|
|
195
|
-
declare const
|
|
196
|
-
declare const
|
|
197
|
-
declare const
|
|
198
|
-
declare const
|
|
199
|
-
declare const
|
|
200
|
-
declare const
|
|
201
|
-
declare const
|
|
202
|
-
declare const
|
|
203
|
-
declare const
|
|
204
|
-
declare const
|
|
205
|
-
declare const
|
|
206
|
-
declare const
|
|
207
|
-
declare const useSite: () => SiteDataRef;
|
|
208
|
-
declare const useSiteLocale: () => SiteLocaleDataRef;
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/composables/onContentUpdated.d.ts
|
|
175
|
+
export declare const useClientData: <Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>>() => ClientData<Frontmatter, Data>;
|
|
176
|
+
export declare const useLayouts: () => LayoutsRef;
|
|
177
|
+
export declare const usePageComponent: () => PageComponentRef;
|
|
178
|
+
export declare const usePageData: <T extends Record<string, unknown> = Record<string, unknown>>() => PageDataRef<T>;
|
|
179
|
+
export declare const usePageFrontmatter: <T extends Record<string, unknown> = Record<string, unknown>>() => PageFrontmatterRef<T>;
|
|
180
|
+
export declare const usePageHead: () => PageHeadRef;
|
|
181
|
+
export declare const usePageLang: () => PageLangRef;
|
|
182
|
+
export declare const usePageLayout: () => PageLayoutRef;
|
|
183
|
+
export declare const useRedirects: () => RedirectsRef;
|
|
184
|
+
export declare const useRouteLocale: () => RouteLocaleRef;
|
|
185
|
+
export declare const useRoutePath: () => RoutePathRef;
|
|
186
|
+
export declare const useRoutes: () => RoutesRef;
|
|
187
|
+
export declare const useSiteData: () => SiteDataRef;
|
|
188
|
+
export declare const useSiteLocaleData: () => SiteLocaleDataRef;
|
|
189
|
+
export declare const useData: typeof useClientData;
|
|
190
|
+
export declare const useFrontmatter: typeof usePageFrontmatter;
|
|
191
|
+
export declare const useHead: typeof usePageHead;
|
|
192
|
+
export declare const useLang: typeof usePageLang;
|
|
193
|
+
export declare const usePage: typeof usePageData;
|
|
194
|
+
export declare const useSite: typeof useSiteData;
|
|
195
|
+
export declare const useSiteLocale: typeof useSiteLocaleData;
|
|
211
196
|
/**
|
|
212
197
|
* Register callback that is called every time the markdown content is updated
|
|
213
198
|
* in the DOM.
|
|
214
199
|
*/
|
|
215
|
-
declare const onContentUpdated: (fn: ContentUpdatedCallback) => void;
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/composables/updateHead.d.ts
|
|
200
|
+
export declare const onContentUpdated: (fn: ContentUpdatedCallback) => void;
|
|
218
201
|
/**
|
|
219
202
|
* A util function to force update `<head>` of current page
|
|
220
203
|
*/
|
|
221
|
-
type UpdateHead = () => void;
|
|
204
|
+
export type UpdateHead = () => void;
|
|
222
205
|
/**
|
|
223
206
|
* Injection key for `updateHead` util
|
|
224
207
|
*/
|
|
225
|
-
declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
208
|
+
export declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
226
209
|
/**
|
|
227
210
|
* Returns the `updateHead` util
|
|
228
211
|
*/
|
|
229
|
-
declare const useUpdateHead: () => UpdateHead;
|
|
212
|
+
export declare const useUpdateHead: () => UpdateHead;
|
|
230
213
|
declare namespace constants_d_exports {
|
|
231
214
|
export { COMPONENT_STATE_TYPE, INSPECTOR_ID, INSPECTOR_LABEL, INSPECTOR_NODES, INSPECTOR_STATE_SECTION_NAME, PLUGIN_ID, PLUGIN_LABEL };
|
|
232
215
|
}
|
|
@@ -237,51 +220,43 @@ declare const INSPECTOR_ID = "org.vuejs.vuepress";
|
|
|
237
220
|
declare const INSPECTOR_LABEL = "VuePress";
|
|
238
221
|
declare const INSPECTOR_NODES: {
|
|
239
222
|
INTERNAL: {
|
|
240
|
-
readonly id:
|
|
241
|
-
readonly label:
|
|
223
|
+
readonly id: 'INTERNAL';
|
|
224
|
+
readonly label: 'Internal';
|
|
242
225
|
readonly keys: ["layouts", "routes", "redirects"];
|
|
243
226
|
};
|
|
244
227
|
SITE: {
|
|
245
|
-
readonly id:
|
|
246
|
-
readonly label:
|
|
228
|
+
readonly id: 'SITE';
|
|
229
|
+
readonly label: 'Site';
|
|
247
230
|
readonly keys: ["siteData", "siteLocaleData"];
|
|
248
231
|
};
|
|
249
232
|
ROUTE: {
|
|
250
|
-
readonly id:
|
|
251
|
-
readonly label:
|
|
233
|
+
readonly id: 'ROUTE';
|
|
234
|
+
readonly label: 'Route';
|
|
252
235
|
readonly keys: ["routePath", "routeLocale"];
|
|
253
236
|
};
|
|
254
237
|
PAGE: {
|
|
255
|
-
readonly id:
|
|
256
|
-
readonly label:
|
|
238
|
+
readonly id: 'PAGE';
|
|
239
|
+
readonly label: 'Page';
|
|
257
240
|
readonly keys: ["pageData", "pageFrontmatter", "pageLang", "pageHead", "pageHeadTitle", "pageLayout", "pageComponent"];
|
|
258
241
|
};
|
|
259
242
|
};
|
|
260
243
|
declare const INSPECTOR_STATE_SECTION_NAME = "State";
|
|
261
|
-
|
|
262
|
-
//#region src/router/resolveRoute.d.ts
|
|
263
|
-
interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
|
|
244
|
+
export interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
|
|
264
245
|
path: string;
|
|
265
246
|
notFound: boolean;
|
|
266
247
|
}
|
|
267
248
|
/**
|
|
268
249
|
* Resolve route with given path
|
|
269
250
|
*/
|
|
270
|
-
declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region src/router/resolveRouteFullPath.d.ts
|
|
251
|
+
export declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
|
|
273
252
|
/**
|
|
274
253
|
* Resolve route full path with given raw path
|
|
275
254
|
*/
|
|
276
|
-
declare const resolveRouteFullPath: (path: string, currentPath?: string) => string;
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region src/router/resolveRoutePath.d.ts
|
|
255
|
+
export declare const resolveRouteFullPath: (path: string, currentPath?: string) => string;
|
|
279
256
|
/**
|
|
280
257
|
* Resolve route path with given raw path
|
|
281
258
|
*/
|
|
282
|
-
declare const resolveRoutePath: (pathname: string, currentPath?: string) => string;
|
|
283
|
-
//#endregion
|
|
284
|
-
//#region src/resolvers.d.ts
|
|
259
|
+
export declare const resolveRoutePath: (pathname: string, currentPath?: string) => string;
|
|
285
260
|
/**
|
|
286
261
|
* Resolver methods to get global computed
|
|
287
262
|
*
|
|
@@ -289,26 +264,21 @@ declare const resolveRoutePath: (pathname: string, currentPath?: string) => stri
|
|
|
289
264
|
*
|
|
290
265
|
* @experimental - This is an experimental API and may be changed in minor versions
|
|
291
266
|
*/
|
|
292
|
-
declare const resolvers: {
|
|
267
|
+
export declare const resolvers: {
|
|
293
268
|
resolveLayouts: (clientConfigs: ClientConfig[]) => Layouts;
|
|
294
269
|
resolvePageHead: (pageHeadTitle: PageHeadTitle, pageFrontmatter: PageFrontmatter, siteLocaleDate: SiteLocaleData) => PageHead;
|
|
295
270
|
resolvePageHeadTitle: (pageData: PageData, siteLocaleDate: SiteLocaleData) => PageHeadTitle;
|
|
296
271
|
resolvePageLang: (pageData: PageData, siteLocaleData: SiteLocaleData) => PageLang;
|
|
297
272
|
resolvePageLayout: (pageData: PageData, layouts: Layouts) => PageLayout;
|
|
298
|
-
resolveRouteLocale: (locales: SiteData[
|
|
273
|
+
resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
|
|
299
274
|
resolveSiteLocaleData: ({ base, locales, ...siteData }: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
|
|
300
275
|
};
|
|
301
|
-
//#endregion
|
|
302
|
-
//#region src/utils/defineClientConfig.d.ts
|
|
303
276
|
/**
|
|
304
277
|
* A helper function to help you define vuepress client config file
|
|
305
278
|
*/
|
|
306
|
-
declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
307
|
-
//#endregion
|
|
308
|
-
//#region src/utils/withBase.d.ts
|
|
279
|
+
export declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
309
280
|
/**
|
|
310
281
|
* Prefix url with site base
|
|
311
282
|
*/
|
|
312
|
-
declare const withBase: (url: string) => string;
|
|
313
|
-
|
|
314
|
-
export { AutoLink, AutoLinkConfig, type ClientConfig, type ClientData, ClientOnly, Content, type ContentUpdatedCallback, type ContentUpdatedReason, type CreateVueAppFunction, constants_d_exports as DEVTOOLS, type HeadConfig, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageData, type PageDataRef, type PageFrontmatter, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageHeader, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, ResolvedRoute, type Route, RouteLink, RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteLocationNormalizedLoaded, type RouteMeta, type RoutePath, type RoutePathRef, type Router, type Routes, type RoutesRef, type SiteData, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, UpdateHead, clientDataSymbol, defineClientConfig, onContentUpdated, resolveRoute, resolveRouteFullPath, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useData, useFrontmatter, useHead, useLang, useLayouts, usePage, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRoute, useRouteLocale, useRoutePath, useRouter, useRoutes, useSite, useSiteData, useSiteLocale, useSiteLocaleData, useUpdateHead, withBase };
|
|
283
|
+
export declare const withBase: (url: string) => string;
|
|
284
|
+
export { type ClientConfig, type ClientData, type ContentUpdatedCallback, type ContentUpdatedReason, type CreateVueAppFunction, constants_d_exports as DEVTOOLS, type HeadConfig, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageData, type PageDataRef, type PageFrontmatter, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageHeader, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type Route, type RouteLocale, type RouteLocaleRef, type RouteLocationNormalizedLoaded, type RouteMeta, type RoutePath, type RoutePathRef, type Router, type Routes, type RoutesRef, type SiteData, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, useRoute, useRouter };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { A as useRouteLocale, C as usePageComponent, D as usePageLang, E as usePageHead, F as useSiteLocale, I as useSiteLocaleData, L as clientDataSymbol, M as useRoutes, N as useSite, O as usePageLayout, P as useSiteData, R as useClientData, S as usePage, T as usePageFrontmatter, _ as useData, a as AutoLink, b as useLang, c as useRouter, d as resolveRoutePath, g as onContentUpdated, h as useUpdateHead, i as ClientOnly, j as useRoutePath, k as useRedirects, l as resolveRouteFullPath, m as updateHeadSymbol, n as resolvers, o as RouteLink, r as Content, s as useRoute, t as withBase, u as resolveRoute, v as useFrontmatter, w as usePageData, x as useLayouts, y as useHead } from "./utils-
|
|
2
|
-
import { c as constants_exports } from "./constants-
|
|
3
|
-
|
|
1
|
+
import { A as useRouteLocale, C as usePageComponent, D as usePageLang, E as usePageHead, F as useSiteLocale, I as useSiteLocaleData, L as clientDataSymbol, M as useRoutes, N as useSite, O as usePageLayout, P as useSiteData, R as useClientData, S as usePage, T as usePageFrontmatter, _ as useData, a as AutoLink, b as useLang, c as useRouter, d as resolveRoutePath, g as onContentUpdated, h as useUpdateHead, i as ClientOnly, j as useRoutePath, k as useRedirects, l as resolveRouteFullPath, m as updateHeadSymbol, n as resolvers, o as RouteLink, r as Content, s as useRoute, t as withBase, u as resolveRoute, v as useFrontmatter, w as usePageData, x as useLayouts, y as useHead } from "./utils-B71L9rqN.js";
|
|
2
|
+
import { c as constants_exports } from "./constants-KnoIK7Ob.js";
|
|
3
|
+
// src/utils/defineClientConfig.ts
|
|
4
4
|
/**
|
|
5
5
|
* A helper function to help you define vuepress client config file
|
|
6
6
|
*/
|
|
7
7
|
const defineClientConfig = (clientConfig = {}) => clientConfig;
|
|
8
|
-
//#endregion
|
|
9
8
|
export { AutoLink, ClientOnly, Content, constants_exports as DEVTOOLS, RouteLink, clientDataSymbol, defineClientConfig, onContentUpdated, resolveRoute, resolveRouteFullPath, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useData, useFrontmatter, useHead, useLang, useLayouts, usePage, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRoute, useRouteLocale, useRoutePath, useRouter, useRoutes, useSite, useSiteData, useSiteLocale, useSiteLocaleData, useUpdateHead, withBase };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, flags) => {
|
|
4
|
+
let target = Object.setPrototypeOf({}, null);
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
11
|
+
};
|
|
12
|
+
export { __exportAll as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as INSPECTOR_STATE_SECTION_NAME, i as INSPECTOR_NODES, n as INSPECTOR_ID, o as PLUGIN_ID, r as INSPECTOR_LABEL, s as PLUGIN_LABEL, t as COMPONENT_STATE_TYPE } from "./constants-
|
|
1
|
+
import { a as INSPECTOR_STATE_SECTION_NAME, i as INSPECTOR_NODES, n as INSPECTOR_ID, o as PLUGIN_ID, r as INSPECTOR_LABEL, s as PLUGIN_LABEL, t as COMPONENT_STATE_TYPE } from "./constants-KnoIK7Ob.js";
|
|
2
2
|
import { watch } from "vue";
|
|
3
3
|
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
4
|
-
|
|
4
|
+
// src/devtools/setupDevtools.ts
|
|
5
5
|
const setupDevtools = (app, clientData) => {
|
|
6
6
|
setupDevtoolsPlugin({
|
|
7
7
|
app,
|
|
@@ -60,5 +60,4 @@ const setupDevtools = (app, clientData) => {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
-
//#endregion
|
|
64
63
|
export { setupDevtools };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed, defineAsyncComponent, defineComponent, h, inject, onMounted, onUnmounted, reactive, ref, shallowRef, toRef } from "vue";
|
|
2
|
-
import { dedupeHead, isLinkHttp, isLinkWithProtocol, isString, normalizeRoutePath, removeLeadingSlash, resolveLocalePath, splitPath } from "@vuepress/shared";
|
|
3
2
|
import { useRoute, useRoute as useRoute$1, useRouter, useRouter as useRouter$1 } from "vue-router";
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { dedupeHead, isLinkHttp, isLinkWithProtocol, isString, normalizeRoutePath, removeLeadingSlash, resolveLocalePath, splitPath } from "@vuepress/shared";
|
|
4
|
+
import { redirects as redirects$1, routes as routes$1 } from "@internal/routes";
|
|
5
|
+
// src/composables/clientData.ts
|
|
6
6
|
const CLIENT_DATA_SYMBOL_GLOBAL_KEY = "__VUEPRESS_CLIENT_DATA_SYMBOL__";
|
|
7
7
|
/**
|
|
8
8
|
* Injection key for client data
|
|
@@ -31,8 +31,7 @@ const useClientData = () => {
|
|
|
31
31
|
if (!clientData) throw new Error("useClientData() is called without provider.");
|
|
32
32
|
return clientData;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
//#region src/composables/clientDataUtils.ts
|
|
34
|
+
// src/composables/clientDataUtils.ts
|
|
36
35
|
const useLayouts = () => useClientData().layouts;
|
|
37
36
|
const usePageComponent = () => useClientData().pageComponent;
|
|
38
37
|
const usePageData = () => useClientData().pageData;
|
|
@@ -53,26 +52,24 @@ const useLang = usePageLang;
|
|
|
53
52
|
const usePage = usePageData;
|
|
54
53
|
const useSite = useSiteData;
|
|
55
54
|
const useSiteLocale = useSiteLocaleData;
|
|
56
|
-
|
|
57
|
-
//#region src/internal/contentUpdatedCallbacks.ts
|
|
55
|
+
// src/internal/contentUpdatedCallbacks.ts
|
|
58
56
|
/**
|
|
59
57
|
* Global content updated callbacks
|
|
60
58
|
*/
|
|
61
59
|
const contentUpdatedCallbacks = /* @__PURE__ */ new Set();
|
|
62
|
-
|
|
63
|
-
//#region src/composables/onContentUpdated.ts
|
|
60
|
+
// src/composables/onContentUpdated.ts
|
|
64
61
|
/**
|
|
65
62
|
* Register callback that is called every time the markdown content is updated
|
|
66
63
|
* in the DOM.
|
|
67
64
|
*/
|
|
68
65
|
const onContentUpdated = (fn) => {
|
|
66
|
+
if (__VUEPRESS_SSR__) return;
|
|
69
67
|
contentUpdatedCallbacks.add(fn);
|
|
70
68
|
onUnmounted(() => {
|
|
71
69
|
contentUpdatedCallbacks.delete(fn);
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
|
-
|
|
75
|
-
//#region src/composables/updateHead.ts
|
|
72
|
+
// src/composables/updateHead.ts
|
|
76
73
|
/**
|
|
77
74
|
* Injection key for `updateHead` util
|
|
78
75
|
*/
|
|
@@ -85,40 +82,37 @@ const useUpdateHead = () => {
|
|
|
85
82
|
if (!updateHead) throw new Error("useUpdateHead() is called without provider.");
|
|
86
83
|
return updateHead;
|
|
87
84
|
};
|
|
88
|
-
|
|
89
|
-
//#region src/internal/routes.ts
|
|
85
|
+
// src/internal/routes.ts
|
|
90
86
|
/**
|
|
91
87
|
* Global redirects ref
|
|
92
88
|
*/
|
|
93
|
-
const redirects
|
|
89
|
+
const redirects = shallowRef(redirects$1);
|
|
94
90
|
/**
|
|
95
91
|
* Global routes ref
|
|
96
92
|
*/
|
|
97
|
-
const routes
|
|
93
|
+
const routes = shallowRef(routes$1);
|
|
98
94
|
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
99
95
|
__VUE_HMR_RUNTIME__.updateRedirects = (data) => {
|
|
100
|
-
redirects
|
|
96
|
+
redirects.value = data;
|
|
101
97
|
};
|
|
102
98
|
__VUE_HMR_RUNTIME__.updateRoutes = (data) => {
|
|
103
|
-
routes
|
|
99
|
+
routes.value = data;
|
|
104
100
|
};
|
|
105
101
|
}
|
|
106
|
-
|
|
107
|
-
//#region src/router/resolveRoutePath.ts
|
|
102
|
+
// src/router/resolveRoutePath.ts
|
|
108
103
|
/**
|
|
109
104
|
* Resolve route path with given raw path
|
|
110
105
|
*/
|
|
111
106
|
const resolveRoutePath = (pathname, currentPath) => {
|
|
112
107
|
const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
|
|
113
|
-
if (routes
|
|
108
|
+
if (routes.value[normalizedRoutePath]) return normalizedRoutePath;
|
|
114
109
|
const encodedRoutePath = encodeURI(normalizedRoutePath);
|
|
115
|
-
if (routes
|
|
116
|
-
const redirectedRoutePath = redirects
|
|
110
|
+
if (routes.value[encodedRoutePath]) return encodedRoutePath;
|
|
111
|
+
const redirectedRoutePath = redirects.value[normalizedRoutePath] || redirects.value[encodedRoutePath];
|
|
117
112
|
if (redirectedRoutePath) return redirectedRoutePath;
|
|
118
113
|
return normalizedRoutePath;
|
|
119
114
|
};
|
|
120
|
-
|
|
121
|
-
//#region src/router/resolveRoute.ts
|
|
115
|
+
// src/router/resolveRoute.ts
|
|
122
116
|
/**
|
|
123
117
|
* Resolve route with given path
|
|
124
118
|
*/
|
|
@@ -126,19 +120,18 @@ const resolveRoute = (path, currentPath) => {
|
|
|
126
120
|
const { pathname, hashAndQueries } = splitPath(path);
|
|
127
121
|
const routePath = resolveRoutePath(pathname, currentPath);
|
|
128
122
|
const routeFullPath = routePath + hashAndQueries;
|
|
129
|
-
if (!routes
|
|
130
|
-
...routes
|
|
123
|
+
if (!routes.value[routePath]) return {
|
|
124
|
+
...routes.value["/404.html"],
|
|
131
125
|
path: routeFullPath,
|
|
132
126
|
notFound: true
|
|
133
127
|
};
|
|
134
128
|
return {
|
|
135
|
-
...routes
|
|
129
|
+
...routes.value[routePath],
|
|
136
130
|
path: routeFullPath,
|
|
137
131
|
notFound: false
|
|
138
132
|
};
|
|
139
133
|
};
|
|
140
|
-
|
|
141
|
-
//#region src/router/resolveRouteFullPath.ts
|
|
134
|
+
// src/router/resolveRouteFullPath.ts
|
|
142
135
|
/**
|
|
143
136
|
* Resolve route full path with given raw path
|
|
144
137
|
*/
|
|
@@ -146,8 +139,7 @@ const resolveRouteFullPath = (path, currentPath) => {
|
|
|
146
139
|
const { pathname, hashAndQueries } = splitPath(path);
|
|
147
140
|
return resolveRoutePath(pathname, currentPath) + hashAndQueries;
|
|
148
141
|
};
|
|
149
|
-
|
|
150
|
-
//#region src/components/RouteLink.ts
|
|
142
|
+
// src/components/RouteLink.ts
|
|
151
143
|
/**
|
|
152
144
|
* Forked from https://github.com/vuejs/router/blob/941b2131e80550009e5221d4db9f366b1fea3fd5/packages/router/src/RouterLink.ts#L293
|
|
153
145
|
*/
|
|
@@ -194,20 +186,19 @@ const RouteLink = defineComponent({
|
|
|
194
186
|
},
|
|
195
187
|
slots: Object,
|
|
196
188
|
setup(props, { slots }) {
|
|
197
|
-
const router = useRouter();
|
|
198
|
-
const route = useRoute();
|
|
189
|
+
const router = useRouter$1();
|
|
190
|
+
const route = useRoute$1();
|
|
199
191
|
const path = computed(() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`);
|
|
200
192
|
return () => h("a", {
|
|
201
193
|
class: ["route-link", { [props.activeClass]: props.active }],
|
|
202
194
|
href: path.value,
|
|
203
195
|
onClick: (event = {}) => {
|
|
204
|
-
if (guardEvent(event)) router.push(props.to).catch();
|
|
196
|
+
if (guardEvent(event)) router.push(props.to).catch(() => {});
|
|
205
197
|
}
|
|
206
198
|
}, slots.default());
|
|
207
199
|
}
|
|
208
200
|
});
|
|
209
|
-
|
|
210
|
-
//#region src/components/AutoLink.ts
|
|
201
|
+
// src/components/AutoLink.ts
|
|
211
202
|
/**
|
|
212
203
|
* Component to render a link automatically according to the link type
|
|
213
204
|
*
|
|
@@ -223,7 +214,7 @@ const AutoLink = defineComponent({
|
|
|
223
214
|
slots: Object,
|
|
224
215
|
setup(props, { slots }) {
|
|
225
216
|
const config = toRef(props, "config");
|
|
226
|
-
const route = useRoute();
|
|
217
|
+
const route = useRoute$1();
|
|
227
218
|
const siteData = useSiteData();
|
|
228
219
|
const withProtocol = computed(() => isLinkWithProtocol(config.value.link));
|
|
229
220
|
const linkTarget = computed(() => config.value.target || (withProtocol.value ? "_blank" : void 0));
|
|
@@ -264,8 +255,7 @@ const AutoLink = defineComponent({
|
|
|
264
255
|
};
|
|
265
256
|
}
|
|
266
257
|
});
|
|
267
|
-
|
|
268
|
-
//#region src/components/ClientOnly.ts
|
|
258
|
+
// src/components/ClientOnly.ts
|
|
269
259
|
/**
|
|
270
260
|
* Wrapper component that only renders its content on the client side and skips server side rendering
|
|
271
261
|
*
|
|
@@ -283,8 +273,7 @@ const ClientOnly = defineComponent({
|
|
|
283
273
|
return () => isMounted.value ? ctx.slots.default?.() : null;
|
|
284
274
|
}
|
|
285
275
|
});
|
|
286
|
-
|
|
287
|
-
//#region src/components/Content.ts
|
|
276
|
+
// src/components/Content.ts
|
|
288
277
|
/**
|
|
289
278
|
* Execute all callbacks registered via `onContentUpdated`.
|
|
290
279
|
*
|
|
@@ -323,14 +312,12 @@ const Content = defineComponent({
|
|
|
323
312
|
});
|
|
324
313
|
}
|
|
325
314
|
});
|
|
326
|
-
|
|
327
|
-
//#region src/constants.ts
|
|
315
|
+
// src/constants.ts
|
|
328
316
|
/**
|
|
329
317
|
* Name of the default layout
|
|
330
318
|
*/
|
|
331
319
|
const LAYOUT_NAME_DEFAULT = "Layout";
|
|
332
|
-
|
|
333
|
-
//#region src/resolvers.ts
|
|
320
|
+
// src/resolvers.ts
|
|
334
321
|
/**
|
|
335
322
|
* Resolver methods to get global computed
|
|
336
323
|
*
|
|
@@ -353,7 +340,7 @@ const resolvers = reactive({
|
|
|
353
340
|
*/
|
|
354
341
|
resolvePageHead: (pageHeadTitle, pageFrontmatter, siteLocaleDate) => {
|
|
355
342
|
const description = isString(pageFrontmatter.description) ? pageFrontmatter.description : siteLocaleDate.description;
|
|
356
|
-
|
|
343
|
+
const head = [
|
|
357
344
|
...Array.isArray(pageFrontmatter.head) ? pageFrontmatter.head : [],
|
|
358
345
|
...siteLocaleDate.head,
|
|
359
346
|
[
|
|
@@ -365,7 +352,8 @@ const resolvers = reactive({
|
|
|
365
352
|
name: "description",
|
|
366
353
|
content: description
|
|
367
354
|
}]
|
|
368
|
-
]
|
|
355
|
+
];
|
|
356
|
+
return dedupeHead(head);
|
|
369
357
|
},
|
|
370
358
|
/**
|
|
371
359
|
* Resolve the content of page head title
|
|
@@ -402,8 +390,7 @@ const resolvers = reactive({
|
|
|
402
390
|
head: [...locales[routeLocale]?.head ?? [], ...siteData.head]
|
|
403
391
|
})
|
|
404
392
|
});
|
|
405
|
-
|
|
406
|
-
//#region src/utils/withBase.ts
|
|
393
|
+
// src/utils/withBase.ts
|
|
407
394
|
/**
|
|
408
395
|
* Prefix url with site base
|
|
409
396
|
*/
|
|
@@ -411,5 +398,4 @@ const withBase = (url) => {
|
|
|
411
398
|
if (isLinkHttp(url)) return url;
|
|
412
399
|
return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
|
|
413
400
|
};
|
|
414
|
-
|
|
415
|
-
export { useRouteLocale as A, usePageComponent as C, usePageLang as D, usePageHead as E, useSiteLocale as F, useSiteLocaleData as I, clientDataSymbol as L, useRoutes as M, useSite as N, usePageLayout as O, useSiteData as P, useClientData as R, usePage as S, usePageFrontmatter as T, useData as _, AutoLink as a, useLang as b, useRouter$1 as c, resolveRoutePath as d, redirects$1 as f, onContentUpdated as g, useUpdateHead as h, ClientOnly as i, useRoutePath as j, useRedirects as k, resolveRouteFullPath as l, updateHeadSymbol as m, resolvers as n, RouteLink as o, routes$1 as p, Content as r, useRoute$1 as s, withBase as t, resolveRoute as u, useFrontmatter as v, usePageData as w, useLayouts as x, useHead as y };
|
|
401
|
+
export { useRouteLocale as A, usePageComponent as C, usePageLang as D, usePageHead as E, useSiteLocale as F, useSiteLocaleData as I, clientDataSymbol as L, useRoutes as M, useSite as N, usePageLayout as O, useSiteData as P, useClientData as R, usePage as S, usePageFrontmatter as T, useData as _, AutoLink as a, useLang as b, useRouter as c, resolveRoutePath as d, redirects as f, onContentUpdated as g, useUpdateHead as h, ClientOnly as i, useRoutePath as j, useRedirects as k, resolveRouteFullPath as l, updateHeadSymbol as m, resolvers as n, RouteLink as o, routes as p, Content as r, useRoute as s, withBase as t, resolveRoute as u, useFrontmatter as v, usePageData as w, useLayouts as x, useHead as y };
|
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.32",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"client",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@vue/devtools-api": "^8.1
|
|
40
|
-
"@vue/devtools-kit": "^8.1
|
|
41
|
-
"
|
|
42
|
-
"vue
|
|
43
|
-
"
|
|
39
|
+
"@vue/devtools-api": "^8.2.1",
|
|
40
|
+
"@vue/devtools-kit": "^8.2.1",
|
|
41
|
+
"@vuepress/shared": "2.0.0-rc.32",
|
|
42
|
+
"vue": "^3.5.45",
|
|
43
|
+
"vue-router": "^5.4.0"
|
|
44
44
|
},
|
|
45
45
|
"tsdown": {
|
|
46
46
|
"deps": {
|
package/types.d.ts
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) __defProp(target, name, {
|
|
6
|
-
get: all[name],
|
|
7
|
-
enumerable: true
|
|
8
|
-
});
|
|
9
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
-
return target;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { __exportAll as t };
|