@vuepress/client 2.0.0-rc.8 → 2.0.0-rc.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  usePageLang,
13
13
  usePageLayout,
14
14
  withBase
15
- } from "./chunk-VA7KP4YF.js";
15
+ } from "./chunk-FJNK2BS7.js";
16
16
 
17
17
  // src/app.ts
18
18
  import { clientConfigs } from "@internal/clientConfigs";
@@ -67,7 +67,7 @@ var resolveRoutePath = (path) => {
67
67
  const encodedPath = encodeURI(normalizedPath);
68
68
  if (routes.value[encodedPath])
69
69
  return encodedPath;
70
- return redirects.value[normalizedPath] || normalizedPath;
70
+ return redirects.value[normalizedPath] || redirects.value[encodedPath] || normalizedPath;
71
71
  };
72
72
 
73
73
  // src/router/resolveRoute.ts
@@ -124,6 +124,9 @@ var Content = defineComponent2({
124
124
  }
125
125
  });
126
126
 
127
+ // src/utils/defineClientConfig.ts
128
+ var defineClientConfig = (clientConfig = {}) => clientConfig;
129
+
127
130
  // src/utils/withBase.ts
128
131
  import { isLinkHttp, removeLeadingSlash } from "@vuepress/shared";
129
132
  var withBase = (url) => {
@@ -152,7 +155,11 @@ var guardEvent = (event) => {
152
155
  };
153
156
  var RouteLink = ({ active = false, activeClass = "route-link-active", to, ...attrs }, { slots }) => {
154
157
  const router = useRouter2();
155
- const path = withBase(resolveRoutePath(to));
158
+ const resolvedPath = resolveRoutePath(to);
159
+ const path = (
160
+ // only anchor or query
161
+ resolvedPath.startsWith("#") || resolvedPath.startsWith("?") ? resolvedPath : withBase(resolvedPath)
162
+ );
156
163
  return h2(
157
164
  "a",
158
165
  {
@@ -277,6 +284,7 @@ export {
277
284
  useRoute,
278
285
  useRouter,
279
286
  Content,
287
+ defineClientConfig,
280
288
  withBase,
281
289
  RouteLink,
282
290
  resolvers
package/dist/index.d.ts CHANGED
@@ -224,9 +224,14 @@ declare const resolvers: {
224
224
  resolveSiteLocaleData: (siteData: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
225
225
  };
226
226
 
227
+ /**
228
+ * A helper function to help you define vuepress client config file
229
+ */
230
+ declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
231
+
227
232
  /**
228
233
  * Prefix url with site base
229
234
  */
230
235
  declare const withBase: (url: string) => string;
231
236
 
232
- export { type ClientConfig, type ClientData, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type RoutePath, type RoutePathRef, type Routes, type RoutesRef, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead, clientDataSymbol, resolveRoute, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
237
+ export { type ClientConfig, type ClientData, ClientOnly, Content, type Layouts, type LayoutsRef, type PageChunk, type PageComponent, type PageComponentRef, type PageDataRef, type PageFrontmatterRef, type PageHead, type PageHeadRef, type PageHeadTitle, type PageHeadTitleRef, type PageLang, type PageLangRef, type PageLayout, type PageLayoutRef, type Redirects, type RedirectsRef, type Route, RouteLink, type RouteLinkProps, type RouteLocale, type RouteLocaleRef, type RouteMeta, type RoutePath, type RoutePathRef, type Routes, type RoutesRef, type SiteDataRef, type SiteLocaleData, type SiteLocaleDataRef, type UpdateHead, clientDataSymbol, defineClientConfig, resolveRoute, resolveRoutePath, resolvers, updateHeadSymbol, useClientData, useLayouts, usePageComponent, usePageData, usePageFrontmatter, usePageHead, usePageLang, usePageLayout, useRedirects, useRouteLocale, useRoutePath, useRoutes, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  Content,
4
4
  RouteLink,
5
5
  clientDataSymbol,
6
+ defineClientConfig,
6
7
  resolveRoute,
7
8
  resolveRoutePath,
8
9
  resolvers,
@@ -25,12 +26,13 @@ import {
25
26
  useSiteLocaleData,
26
27
  useUpdateHead,
27
28
  withBase
28
- } from "./chunk-VA7KP4YF.js";
29
+ } from "./chunk-FJNK2BS7.js";
29
30
  export {
30
31
  ClientOnly,
31
32
  Content,
32
33
  RouteLink,
33
34
  clientDataSymbol,
35
+ defineClientConfig,
34
36
  resolveRoute,
35
37
  resolveRoutePath,
36
38
  resolvers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/client",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.0-rc.9",
4
4
  "description": "Client package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@vue/devtools-api": "^6.6.1",
37
- "vue": "^3.4.19",
38
- "vue-router": "^4.2.5",
39
- "@vuepress/shared": "2.0.0-rc.8"
37
+ "vue": "^3.4.21",
38
+ "vue-router": "^4.3.0",
39
+ "@vuepress/shared": "2.0.0-rc.9"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"