@vuepress/client 2.0.0-rc.30 → 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 CHANGED
@@ -1,5 +1,3 @@
1
- import { r as CreateVueAppFunction } from "./index-CNztZIId.js";
2
- //#region src/app.d.ts
3
- declare const createVueApp: CreateVueAppFunction;
4
- //#endregion
5
- export { createVueApp };
1
+ import { t as CreateVueAppFunction } from "./index-DXAyy5fd.js";
2
+ import "@internal/userStyle";
3
+ export declare const createVueApp: CreateVueAppFunction;
package/dist/app.js CHANGED
@@ -1,20 +1,20 @@
1
- import { D as usePageHead, O as usePageLang, R as clientDataSymbol, a as ClientOnly, d as resolveRoute, h as updateHeadSymbol, i as Content, k as usePageLayout, m as routes, p as redirects, r as resolvers, s as RouteLink, t as withBase } from "./utils-CIxUK0LM.js";
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 { siteData } from "@internal/siteData";
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
- //#region src/internal/siteData.ts
9
+ // src/internal/siteData.ts
9
10
  /**
10
11
  * Global site data ref
11
12
  */
12
- const siteData$1 = shallowRef(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$1.value = data;
15
+ siteData.value = data;
15
16
  };
16
- //#endregion
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
- //#endregion
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
- //#endregion
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$1.value.locales, routePath.value));
90
- const siteLocaleData = computed(() => resolvers.resolveSiteLocaleData(siteData$1.value, routeLocale.value));
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: siteData$1,
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$1,
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$1.value },
127
+ $site: { get: () => siteData.value },
135
128
  $siteLocale: { get: () => siteLocaleData.value }
136
129
  });
137
130
  return clientData;
138
131
  };
139
- //#endregion
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
- //#endregion
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-B3cgI7XH.js");
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: siteData$1
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 "./chunk-pbuEa-1d.js";
2
- //#region src/devtools/constants.ts
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,8 +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
-
5
- //#region src/constants.d.ts
3
+ import { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleData } from "@vuepress/shared";
6
4
  /**
7
5
  * Name of the default layout
8
6
  */
@@ -11,8 +9,6 @@ declare const LAYOUT_NAME_DEFAULT = "Layout";
11
9
  * Name of the 404 page layout
12
10
  */
13
11
  declare const LAYOUT_NAME_NOT_FOUND = "NotFound";
14
- //#endregion
15
- //#region src/types/routes.d.ts
16
12
  interface PageChunk {
17
13
  default: Component;
18
14
  _pageData: PageData;
@@ -24,8 +20,6 @@ interface Route<T extends RouteMeta = RouteMeta> {
24
20
  }
25
21
  type Redirects = Record<string, string>;
26
22
  type Routes = Record<string, Route>;
27
- //#endregion
28
- //#region src/types/clientData.d.ts
29
23
  interface Layouts {
30
24
  [LAYOUT_NAME_DEFAULT]: Component;
31
25
  [LAYOUT_NAME_NOT_FOUND]: Component;
@@ -75,8 +69,6 @@ interface ClientData<Frontmatter extends Record<string, unknown> = Record<string
75
69
  site: SiteDataRef;
76
70
  siteLocale: SiteLocaleDataRef;
77
71
  }
78
- //#endregion
79
- //#region src/types/clientConfig.d.ts
80
72
  /**
81
73
  * Configure vuepress client
82
74
  */
@@ -103,15 +95,8 @@ interface ClientConfig {
103
95
  */
104
96
  rootComponents?: Component[];
105
97
  }
106
- //#endregion
107
- //#region src/types/createVueAppFunction.d.ts
108
98
  type CreateVueAppFunction = () => Promise<{
109
99
  app: App;
110
100
  router: Router;
111
101
  }>;
112
- //#endregion
113
- //#region src/types/onContentUpdated.d.ts
114
- type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated';
115
- type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown;
116
- //#endregion
117
- export { SiteData as A, PageLayoutRef as C, RoutePath as D, RouteLocaleRef as E, Redirects as F, Route as I, RouteMeta as L, SiteLocaleData as M, SiteLocaleDataRef as N, RoutePathRef as O, PageChunk as P, Routes as R, PageLayout as S, RouteLocale as T, PageHeadTitle as _, ClientData as a, PageLang as b, LayoutsRef as c, PageData as d, PageDataRef as f, PageHeadRef as g, PageHead as h, ClientConfig as i, SiteDataRef as j, RoutesRef as k, PageComponent as l, PageFrontmatterRef as m, ContentUpdatedReason as n, HeadConfig as o, PageFrontmatter as p, CreateVueAppFunction as r, Layouts as s, ContentUpdatedCallback as t, PageComponentRef as u, PageHeadTitleRef as v, RedirectsRef as w, PageLangRef as x, PageHeader as y };
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,10 +1,9 @@
1
- import { A as SiteData, C as PageLayoutRef, D as RoutePath, E as RouteLocaleRef, F as Redirects, I as Route, L as RouteMeta, M as SiteLocaleData, N as SiteLocaleDataRef, O as RoutePathRef, P as PageChunk, R as Routes, S as PageLayout, T as RouteLocale, _ as PageHeadTitle, a as ClientData, b as PageLang, c as LayoutsRef, d as PageData, f as PageDataRef, g as PageHeadRef, h as PageHead, i as ClientConfig, j as SiteDataRef, k as RoutesRef, l as PageComponent, m as PageFrontmatterRef, n as ContentUpdatedReason, o as HeadConfig, p as PageFrontmatter, r as CreateVueAppFunction, s as Layouts, t as ContentUpdatedCallback, u as PageComponentRef, v as PageHeadTitleRef, w as RedirectsRef, x as PageLangRef, y as PageHeader } from "./index-CNztZIId.js";
2
- import * as _$vue from "vue";
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";
3
2
  import { InjectionKey, PropType, SlotsType, VNode } from "vue";
4
3
  import { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from "vue-router";
5
-
6
- //#region src/components/AutoLink.d.ts
7
- interface AutoLinkConfig {
4
+ type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated';
5
+ type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown;
6
+ export interface AutoLinkConfig {
8
7
  /**
9
8
  * Pattern to determine if the link should be active, which has higher priority than `exact`
10
9
  */
@@ -40,14 +39,14 @@ interface AutoLinkConfig {
40
39
  * - If the link is internal, it will be rendered as a `<RouteLink>`
41
40
  * - If the link is external, it will be rendered as a normal `<a>` tag
42
41
  */
43
- declare const AutoLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
42
+ export declare const AutoLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
44
43
  config: {
45
44
  type: PropType<AutoLinkConfig>;
46
45
  required: true;
47
46
  };
48
- }>, () => VNode<_$vue.RendererNode, _$vue.RendererElement, {
47
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
49
48
  [key: string]: any;
50
- }>, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
49
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
51
50
  config: {
52
51
  type: PropType<AutoLinkConfig>;
53
52
  required: true;
@@ -56,9 +55,7 @@ declare const AutoLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
56
55
  default?: (config: AutoLinkConfig) => VNode | VNode[];
57
56
  before?: (config: AutoLinkConfig) => VNode | VNode[] | null;
58
57
  after?: (config: AutoLinkConfig) => VNode | VNode[] | null;
59
- }>, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
60
- //#endregion
61
- //#region src/components/ClientOnly.d.ts
58
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
62
59
  /**
63
60
  * Wrapper component that only renders its content on the client side and skips server side rendering
64
61
  *
@@ -66,23 +63,21 @@ declare const AutoLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
66
63
  *
67
64
  * @see https://blog.vuejs.org/posts/vue-3-5#data-allow-mismatch
68
65
  */
69
- declare const ClientOnly: _$vue.DefineComponent<{}, () => _$vue.VNode<_$vue.RendererNode, _$vue.RendererElement, {
66
+ export declare const ClientOnly: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
70
67
  [key: string]: any;
71
- }>[] | null | undefined, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
72
- //#endregion
73
- //#region src/components/Content.d.ts
68
+ }>[] | null | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
74
69
  /**
75
70
  * Markdown rendered content
76
71
  */
77
- declare const Content: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
72
+ export declare const Content: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
78
73
  path: {
79
74
  type: StringConstructor;
80
75
  required: false;
81
76
  default: string;
82
77
  };
83
- }>, () => _$vue.VNode<_$vue.RendererNode, _$vue.RendererElement, {
78
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
84
79
  [key: string]: any;
85
- }>, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
80
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
86
81
  path: {
87
82
  type: StringConstructor;
88
83
  required: false;
@@ -90,10 +85,8 @@ declare const Content: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
90
85
  };
91
86
  }>> & Readonly<{}>, {
92
87
  path: string;
93
- }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
94
- //#endregion
95
- //#region src/components/RouteLink.d.ts
96
- interface RouteLinkProps {
88
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
89
+ export interface RouteLinkProps {
97
90
  /**
98
91
  * Whether the link is active to have an active class
99
92
  *
@@ -120,7 +113,7 @@ interface RouteLinkProps {
120
113
  *
121
114
  * It's recommended to use `RouteLink` in VuePress.
122
115
  */
123
- declare const RouteLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
116
+ export declare const RouteLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
124
117
  /**
125
118
  * The route path to link to
126
119
  */
@@ -141,9 +134,9 @@ declare const RouteLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
141
134
  type: StringConstructor;
142
135
  default: string;
143
136
  };
144
- }>, () => VNode<_$vue.RendererNode, _$vue.RendererElement, {
137
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
145
138
  [key: string]: any;
146
- }>, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
139
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
147
140
  /**
148
141
  * The route path to link to
149
142
  */
@@ -169,60 +162,54 @@ declare const RouteLink: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
169
162
  activeClass: string;
170
163
  }, SlotsType<{
171
164
  default: () => (VNode | string)[] | VNode | string;
172
- }>, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
173
- //#endregion
174
- //#region src/composables/clientData.d.ts
165
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
175
166
  /**
176
- * Injection key for client data
167
+ * The problem only occurs during hot updates in the development environment,
168
+ * It only needs to be processed in the development environment.
169
+ * (see vuepress/core#1715)
177
170
  */
178
- declare const clientDataSymbol: InjectionKey<ClientData>;
171
+ export declare const clientDataSymbol: InjectionKey<ClientData>;
179
172
  /**
180
173
  * Returns client data
181
174
  */
182
- declare const useClientData: <Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>>() => ClientData<Frontmatter, Data>;
183
- //#endregion
184
- //#region src/composables/clientDataUtils.d.ts
185
- declare const useLayouts: () => LayoutsRef;
186
- declare const usePageComponent: () => PageComponentRef;
187
- declare const usePageData: <T extends Record<string, unknown> = Record<string, unknown>>() => PageDataRef<T>;
188
- declare const usePageFrontmatter: <T extends Record<string, unknown> = Record<string, unknown>>() => PageFrontmatterRef<T>;
189
- declare const usePageHead: () => PageHeadRef;
190
- declare const usePageLang: () => PageLangRef;
191
- declare const usePageLayout: () => PageLayoutRef;
192
- declare const useRedirects: () => RedirectsRef;
193
- declare const useRouteLocale: () => RouteLocaleRef;
194
- declare const useRoutePath: () => RoutePathRef;
195
- declare const useRoutes: () => RoutesRef;
196
- declare const useSiteData: () => SiteDataRef;
197
- declare const useSiteLocaleData: () => SiteLocaleDataRef;
198
- declare const useData: <Frontmatter extends Record<string, unknown> = Record<string, unknown>, Data extends Record<string, unknown> = Record<string, unknown>>() => ClientData<Frontmatter, Data>;
199
- declare const useFrontmatter: <T extends Record<string, unknown> = Record<string, unknown>>() => PageFrontmatterRef<T>;
200
- declare const useHead: () => PageHeadRef;
201
- declare const useLang: () => PageLangRef;
202
- declare const usePage: <T extends Record<string, unknown> = Record<string, unknown>>() => PageDataRef<T>;
203
- declare const useSite: () => SiteDataRef;
204
- declare const useSiteLocale: () => SiteLocaleDataRef;
205
- //#endregion
206
- //#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;
207
196
  /**
208
197
  * Register callback that is called every time the markdown content is updated
209
198
  * in the DOM.
210
199
  */
211
- declare const onContentUpdated: (fn: ContentUpdatedCallback) => void;
212
- //#endregion
213
- //#region src/composables/updateHead.d.ts
200
+ export declare const onContentUpdated: (fn: ContentUpdatedCallback) => void;
214
201
  /**
215
202
  * A util function to force update `<head>` of current page
216
203
  */
217
- type UpdateHead = () => void;
204
+ export type UpdateHead = () => void;
218
205
  /**
219
206
  * Injection key for `updateHead` util
220
207
  */
221
- declare const updateHeadSymbol: InjectionKey<UpdateHead>;
208
+ export declare const updateHeadSymbol: InjectionKey<UpdateHead>;
222
209
  /**
223
210
  * Returns the `updateHead` util
224
211
  */
225
- declare const useUpdateHead: () => UpdateHead;
212
+ export declare const useUpdateHead: () => UpdateHead;
226
213
  declare namespace constants_d_exports {
227
214
  export { COMPONENT_STATE_TYPE, INSPECTOR_ID, INSPECTOR_LABEL, INSPECTOR_NODES, INSPECTOR_STATE_SECTION_NAME, PLUGIN_ID, PLUGIN_LABEL };
228
215
  }
@@ -233,51 +220,43 @@ declare const INSPECTOR_ID = "org.vuejs.vuepress";
233
220
  declare const INSPECTOR_LABEL = "VuePress";
234
221
  declare const INSPECTOR_NODES: {
235
222
  INTERNAL: {
236
- readonly id: "INTERNAL";
237
- readonly label: "Internal";
223
+ readonly id: 'INTERNAL';
224
+ readonly label: 'Internal';
238
225
  readonly keys: ["layouts", "routes", "redirects"];
239
226
  };
240
227
  SITE: {
241
- readonly id: "SITE";
242
- readonly label: "Site";
228
+ readonly id: 'SITE';
229
+ readonly label: 'Site';
243
230
  readonly keys: ["siteData", "siteLocaleData"];
244
231
  };
245
232
  ROUTE: {
246
- readonly id: "ROUTE";
247
- readonly label: "Route";
233
+ readonly id: 'ROUTE';
234
+ readonly label: 'Route';
248
235
  readonly keys: ["routePath", "routeLocale"];
249
236
  };
250
237
  PAGE: {
251
- readonly id: "PAGE";
252
- readonly label: "Page";
238
+ readonly id: 'PAGE';
239
+ readonly label: 'Page';
253
240
  readonly keys: ["pageData", "pageFrontmatter", "pageLang", "pageHead", "pageHeadTitle", "pageLayout", "pageComponent"];
254
241
  };
255
242
  };
256
243
  declare const INSPECTOR_STATE_SECTION_NAME = "State";
257
- //#endregion
258
- //#region src/router/resolveRoute.d.ts
259
- interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
244
+ export interface ResolvedRoute<T extends RouteMeta = RouteMeta> extends Route<T> {
260
245
  path: string;
261
246
  notFound: boolean;
262
247
  }
263
248
  /**
264
249
  * Resolve route with given path
265
250
  */
266
- declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
267
- //#endregion
268
- //#region src/router/resolveRouteFullPath.d.ts
251
+ export declare const resolveRoute: <T extends RouteMeta = RouteMeta>(path: string, currentPath?: string) => ResolvedRoute<T>;
269
252
  /**
270
253
  * Resolve route full path with given raw path
271
254
  */
272
- declare const resolveRouteFullPath: (path: string, currentPath?: string) => string;
273
- //#endregion
274
- //#region src/router/resolveRoutePath.d.ts
255
+ export declare const resolveRouteFullPath: (path: string, currentPath?: string) => string;
275
256
  /**
276
257
  * Resolve route path with given raw path
277
258
  */
278
- declare const resolveRoutePath: (pathname: string, currentPath?: string) => string;
279
- //#endregion
280
- //#region src/resolvers.d.ts
259
+ export declare const resolveRoutePath: (pathname: string, currentPath?: string) => string;
281
260
  /**
282
261
  * Resolver methods to get global computed
283
262
  *
@@ -285,30 +264,21 @@ declare const resolveRoutePath: (pathname: string, currentPath?: string) => stri
285
264
  *
286
265
  * @experimental - This is an experimental API and may be changed in minor versions
287
266
  */
288
- declare const resolvers: {
267
+ export declare const resolvers: {
289
268
  resolveLayouts: (clientConfigs: ClientConfig[]) => Layouts;
290
269
  resolvePageHead: (pageHeadTitle: PageHeadTitle, pageFrontmatter: PageFrontmatter, siteLocaleDate: SiteLocaleData) => PageHead;
291
270
  resolvePageHeadTitle: (pageData: PageData, siteLocaleDate: SiteLocaleData) => PageHeadTitle;
292
271
  resolvePageLang: (pageData: PageData, siteLocaleData: SiteLocaleData) => PageLang;
293
272
  resolvePageLayout: (pageData: PageData, layouts: Layouts) => PageLayout;
294
- resolveRouteLocale: (locales: SiteData["locales"], routePath: string) => RouteLocale;
295
- resolveSiteLocaleData: ({
296
- base,
297
- locales,
298
- ...siteData
299
- }: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
273
+ resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
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
- //#endregion
314
- export { AutoLink, AutoLinkConfig, ClientConfig, ClientData, ClientOnly, Content, ContentUpdatedCallback, ContentUpdatedReason, CreateVueAppFunction, constants_d_exports as DEVTOOLS, HeadConfig, Layouts, LayoutsRef, PageChunk, PageComponent, PageComponentRef, PageData, PageDataRef, PageFrontmatter, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageHeader, PageLang, PageLangRef, PageLayout, PageLayoutRef, Redirects, RedirectsRef, ResolvedRoute, Route, RouteLink, RouteLinkProps, RouteLocale, RouteLocaleRef, type RouteLocationNormalizedLoaded, RouteMeta, RoutePath, RoutePathRef, type Router, Routes, RoutesRef, SiteData, SiteDataRef, SiteLocaleData, 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,3 +1,8 @@
1
- import { A as useRedirects, C as usePage, D as usePageHead, E as usePageFrontmatter, F as useSiteData, I as useSiteLocale, L as useSiteLocaleData, M as useRoutePath, N as useRoutes, O as usePageLang, P as useSite, R as clientDataSymbol, S as useLayouts, T as usePageData, _ as onContentUpdated, a as ClientOnly, b as useHead, c as useRoute, d as resolveRoute, f as resolveRoutePath, g as useUpdateHead, h as updateHeadSymbol, i as Content, j as useRouteLocale, k as usePageLayout, l as useRouter, n as defineClientConfig, o as AutoLink, r as resolvers, s as RouteLink, t as withBase, u as resolveRouteFullPath, v as useData, w as usePageComponent, x as useLang, y as useFrontmatter, z as useClientData } from "./utils-CIxUK0LM.js";
2
- import { c as constants_exports } from "./constants-COBTj3zj.js";
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
+ /**
5
+ * A helper function to help you define vuepress client config file
6
+ */
7
+ const defineClientConfig = (clientConfig = {}) => clientConfig;
3
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-COBTj3zj.js";
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
- //#region src/devtools/setupDevtools.ts
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,12 +1,28 @@
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 { redirects, routes } from "@internal/routes";
5
- //#region src/composables/clientData.ts
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
+ const CLIENT_DATA_SYMBOL_GLOBAL_KEY = "__VUEPRESS_CLIENT_DATA_SYMBOL__";
6
7
  /**
7
8
  * Injection key for client data
9
+ *
10
+ * Use a global Symbol to keep the same reference across module reloads.
11
+ * This is required for HMR in dev mode: when a markdown page with local
12
+ * components is edited, the main module (and its transitive deps that host
13
+ * this symbol) may be re-executed by Vite, which would otherwise create a
14
+ * new Symbol instance and break `inject` (see vuepress/core#1715).
15
+ */
16
+ const resolveClientDataSymbol = () => {
17
+ globalThis[CLIENT_DATA_SYMBOL_GLOBAL_KEY] ??= Symbol("clientData");
18
+ return globalThis[CLIENT_DATA_SYMBOL_GLOBAL_KEY];
19
+ };
20
+ /**
21
+ * The problem only occurs during hot updates in the development environment,
22
+ * It only needs to be processed in the development environment.
23
+ * (see vuepress/core#1715)
8
24
  */
9
- const clientDataSymbol = Symbol(__VUEPRESS_DEV__ ? "clientData" : "");
25
+ const clientDataSymbol = __VUEPRESS_DEV__ ? resolveClientDataSymbol() : Symbol("");
10
26
  /**
11
27
  * Returns client data
12
28
  */
@@ -15,8 +31,7 @@ const useClientData = () => {
15
31
  if (!clientData) throw new Error("useClientData() is called without provider.");
16
32
  return clientData;
17
33
  };
18
- //#endregion
19
- //#region src/composables/clientDataUtils.ts
34
+ // src/composables/clientDataUtils.ts
20
35
  const useLayouts = () => useClientData().layouts;
21
36
  const usePageComponent = () => useClientData().pageComponent;
22
37
  const usePageData = () => useClientData().pageData;
@@ -37,26 +52,24 @@ const useLang = usePageLang;
37
52
  const usePage = usePageData;
38
53
  const useSite = useSiteData;
39
54
  const useSiteLocale = useSiteLocaleData;
40
- //#endregion
41
- //#region src/internal/contentUpdatedCallbacks.ts
55
+ // src/internal/contentUpdatedCallbacks.ts
42
56
  /**
43
57
  * Global content updated callbacks
44
58
  */
45
59
  const contentUpdatedCallbacks = /* @__PURE__ */ new Set();
46
- //#endregion
47
- //#region src/composables/onContentUpdated.ts
60
+ // src/composables/onContentUpdated.ts
48
61
  /**
49
62
  * Register callback that is called every time the markdown content is updated
50
63
  * in the DOM.
51
64
  */
52
65
  const onContentUpdated = (fn) => {
66
+ if (__VUEPRESS_SSR__) return;
53
67
  contentUpdatedCallbacks.add(fn);
54
68
  onUnmounted(() => {
55
69
  contentUpdatedCallbacks.delete(fn);
56
70
  });
57
71
  };
58
- //#endregion
59
- //#region src/composables/updateHead.ts
72
+ // src/composables/updateHead.ts
60
73
  /**
61
74
  * Injection key for `updateHead` util
62
75
  */
@@ -69,40 +82,37 @@ const useUpdateHead = () => {
69
82
  if (!updateHead) throw new Error("useUpdateHead() is called without provider.");
70
83
  return updateHead;
71
84
  };
72
- //#endregion
73
- //#region src/internal/routes.ts
85
+ // src/internal/routes.ts
74
86
  /**
75
87
  * Global redirects ref
76
88
  */
77
- const redirects$1 = shallowRef(redirects);
89
+ const redirects = shallowRef(redirects$1);
78
90
  /**
79
91
  * Global routes ref
80
92
  */
81
- const routes$1 = shallowRef(routes);
93
+ const routes = shallowRef(routes$1);
82
94
  if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
83
95
  __VUE_HMR_RUNTIME__.updateRedirects = (data) => {
84
- redirects$1.value = data;
96
+ redirects.value = data;
85
97
  };
86
98
  __VUE_HMR_RUNTIME__.updateRoutes = (data) => {
87
- routes$1.value = data;
99
+ routes.value = data;
88
100
  };
89
101
  }
90
- //#endregion
91
- //#region src/router/resolveRoutePath.ts
102
+ // src/router/resolveRoutePath.ts
92
103
  /**
93
104
  * Resolve route path with given raw path
94
105
  */
95
106
  const resolveRoutePath = (pathname, currentPath) => {
96
107
  const normalizedRoutePath = normalizeRoutePath(pathname, currentPath);
97
- if (routes$1.value[normalizedRoutePath]) return normalizedRoutePath;
108
+ if (routes.value[normalizedRoutePath]) return normalizedRoutePath;
98
109
  const encodedRoutePath = encodeURI(normalizedRoutePath);
99
- if (routes$1.value[encodedRoutePath]) return encodedRoutePath;
100
- const redirectedRoutePath = redirects$1.value[normalizedRoutePath] || redirects$1.value[encodedRoutePath];
110
+ if (routes.value[encodedRoutePath]) return encodedRoutePath;
111
+ const redirectedRoutePath = redirects.value[normalizedRoutePath] || redirects.value[encodedRoutePath];
101
112
  if (redirectedRoutePath) return redirectedRoutePath;
102
113
  return normalizedRoutePath;
103
114
  };
104
- //#endregion
105
- //#region src/router/resolveRoute.ts
115
+ // src/router/resolveRoute.ts
106
116
  /**
107
117
  * Resolve route with given path
108
118
  */
@@ -110,19 +120,18 @@ const resolveRoute = (path, currentPath) => {
110
120
  const { pathname, hashAndQueries } = splitPath(path);
111
121
  const routePath = resolveRoutePath(pathname, currentPath);
112
122
  const routeFullPath = routePath + hashAndQueries;
113
- if (!routes$1.value[routePath]) return {
114
- ...routes$1.value["/404.html"],
123
+ if (!routes.value[routePath]) return {
124
+ ...routes.value["/404.html"],
115
125
  path: routeFullPath,
116
126
  notFound: true
117
127
  };
118
128
  return {
119
- ...routes$1.value[routePath],
129
+ ...routes.value[routePath],
120
130
  path: routeFullPath,
121
131
  notFound: false
122
132
  };
123
133
  };
124
- //#endregion
125
- //#region src/router/resolveRouteFullPath.ts
134
+ // src/router/resolveRouteFullPath.ts
126
135
  /**
127
136
  * Resolve route full path with given raw path
128
137
  */
@@ -130,8 +139,7 @@ const resolveRouteFullPath = (path, currentPath) => {
130
139
  const { pathname, hashAndQueries } = splitPath(path);
131
140
  return resolveRoutePath(pathname, currentPath) + hashAndQueries;
132
141
  };
133
- //#endregion
134
- //#region src/components/RouteLink.ts
142
+ // src/components/RouteLink.ts
135
143
  /**
136
144
  * Forked from https://github.com/vuejs/router/blob/941b2131e80550009e5221d4db9f366b1fea3fd5/packages/router/src/RouterLink.ts#L293
137
145
  */
@@ -178,20 +186,19 @@ const RouteLink = defineComponent({
178
186
  },
179
187
  slots: Object,
180
188
  setup(props, { slots }) {
181
- const router = useRouter();
182
- const route = useRoute();
189
+ const router = useRouter$1();
190
+ const route = useRoute$1();
183
191
  const path = computed(() => props.to.startsWith("#") || props.to.startsWith("?") ? props.to : `${__VUEPRESS_BASE__}${resolveRouteFullPath(props.to, route.path).substring(1)}`);
184
192
  return () => h("a", {
185
193
  class: ["route-link", { [props.activeClass]: props.active }],
186
194
  href: path.value,
187
195
  onClick: (event = {}) => {
188
- if (guardEvent(event)) router.push(props.to).catch();
196
+ if (guardEvent(event)) router.push(props.to).catch(() => {});
189
197
  }
190
198
  }, slots.default());
191
199
  }
192
200
  });
193
- //#endregion
194
- //#region src/components/AutoLink.ts
201
+ // src/components/AutoLink.ts
195
202
  /**
196
203
  * Component to render a link automatically according to the link type
197
204
  *
@@ -207,7 +214,7 @@ const AutoLink = defineComponent({
207
214
  slots: Object,
208
215
  setup(props, { slots }) {
209
216
  const config = toRef(props, "config");
210
- const route = useRoute();
217
+ const route = useRoute$1();
211
218
  const siteData = useSiteData();
212
219
  const withProtocol = computed(() => isLinkWithProtocol(config.value.link));
213
220
  const linkTarget = computed(() => config.value.target || (withProtocol.value ? "_blank" : void 0));
@@ -248,8 +255,7 @@ const AutoLink = defineComponent({
248
255
  };
249
256
  }
250
257
  });
251
- //#endregion
252
- //#region src/components/ClientOnly.ts
258
+ // src/components/ClientOnly.ts
253
259
  /**
254
260
  * Wrapper component that only renders its content on the client side and skips server side rendering
255
261
  *
@@ -267,8 +273,7 @@ const ClientOnly = defineComponent({
267
273
  return () => isMounted.value ? ctx.slots.default?.() : null;
268
274
  }
269
275
  });
270
- //#endregion
271
- //#region src/components/Content.ts
276
+ // src/components/Content.ts
272
277
  /**
273
278
  * Execute all callbacks registered via `onContentUpdated`.
274
279
  *
@@ -307,14 +312,12 @@ const Content = defineComponent({
307
312
  });
308
313
  }
309
314
  });
310
- //#endregion
311
- //#region src/constants.ts
315
+ // src/constants.ts
312
316
  /**
313
317
  * Name of the default layout
314
318
  */
315
319
  const LAYOUT_NAME_DEFAULT = "Layout";
316
- //#endregion
317
- //#region src/resolvers.ts
320
+ // src/resolvers.ts
318
321
  /**
319
322
  * Resolver methods to get global computed
320
323
  *
@@ -337,7 +340,7 @@ const resolvers = reactive({
337
340
  */
338
341
  resolvePageHead: (pageHeadTitle, pageFrontmatter, siteLocaleDate) => {
339
342
  const description = isString(pageFrontmatter.description) ? pageFrontmatter.description : siteLocaleDate.description;
340
- return dedupeHead([
343
+ const head = [
341
344
  ...Array.isArray(pageFrontmatter.head) ? pageFrontmatter.head : [],
342
345
  ...siteLocaleDate.head,
343
346
  [
@@ -349,7 +352,8 @@ const resolvers = reactive({
349
352
  name: "description",
350
353
  content: description
351
354
  }]
352
- ]);
355
+ ];
356
+ return dedupeHead(head);
353
357
  },
354
358
  /**
355
359
  * Resolve the content of page head title
@@ -386,14 +390,7 @@ const resolvers = reactive({
386
390
  head: [...locales[routeLocale]?.head ?? [], ...siteData.head]
387
391
  })
388
392
  });
389
- //#endregion
390
- //#region src/utils/defineClientConfig.ts
391
- /**
392
- * A helper function to help you define vuepress client config file
393
- */
394
- const defineClientConfig = (clientConfig = {}) => clientConfig;
395
- //#endregion
396
- //#region src/utils/withBase.ts
393
+ // src/utils/withBase.ts
397
394
  /**
398
395
  * Prefix url with site base
399
396
  */
@@ -401,5 +398,4 @@ const withBase = (url) => {
401
398
  if (isLinkHttp(url)) return url;
402
399
  return `${__VUEPRESS_BASE__}${removeLeadingSlash(url)}`;
403
400
  };
404
- //#endregion
405
- export { useRedirects as A, usePage as C, usePageHead as D, usePageFrontmatter as E, useSiteData as F, useSiteLocale as I, useSiteLocaleData as L, useRoutePath as M, useRoutes as N, usePageLang as O, useSite as P, clientDataSymbol as R, useLayouts as S, usePageData as T, onContentUpdated as _, ClientOnly as a, useHead as b, useRoute$1 as c, resolveRoute as d, resolveRoutePath as f, useUpdateHead as g, updateHeadSymbol as h, Content as i, useRouteLocale as j, usePageLayout as k, useRouter$1 as l, routes$1 as m, defineClientConfig as n, AutoLink as o, redirects$1 as p, resolvers as r, RouteLink as s, withBase as t, resolveRouteFullPath as u, useData as v, usePageComponent as w, useLang as x, useFrontmatter as y, useClientData as z };
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.30",
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.1",
40
- "@vue/devtools-kit": "^8.1.1",
41
- "vue": "^3.5.34",
42
- "vue-router": "^5.0.6",
43
- "@vuepress/shared": "2.0.0-rc.30"
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,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/naming-convention, no-underscore-dangle */
1
+ /* oxlint-disable no-redeclare,no-underscore-dangle */
2
2
  declare const __VUEPRESS_VERSION__: string
3
3
  declare const __VUEPRESS_BASE__: string
4
4
  declare const __VUEPRESS_DEV__: boolean
@@ -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 };