@vuepress/client 2.0.0-rc.7 → 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.d.ts
CHANGED
package/dist/app.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
usePageLang,
|
|
13
13
|
usePageLayout,
|
|
14
14
|
withBase
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FJNK2BS7.js";
|
|
16
16
|
|
|
17
17
|
// src/app.ts
|
|
18
18
|
import { clientConfigs } from "@internal/clientConfigs";
|
|
@@ -69,6 +69,8 @@ var createVueRouter = () => {
|
|
|
69
69
|
// attach page chunk route meta
|
|
70
70
|
_pageChunk: pageChunk
|
|
71
71
|
};
|
|
72
|
+
} else if (to.path === from.path) {
|
|
73
|
+
to.meta = from.meta;
|
|
72
74
|
}
|
|
73
75
|
});
|
|
74
76
|
return router;
|
|
@@ -82,21 +84,26 @@ var setupGlobalComponents = (app) => {
|
|
|
82
84
|
};
|
|
83
85
|
|
|
84
86
|
// src/setupGlobalComputed.ts
|
|
85
|
-
import {
|
|
86
|
-
import { computed } from "vue";
|
|
87
|
+
import { computed, customRef } from "vue";
|
|
87
88
|
var setupGlobalComputed = (app, router, clientConfigs2) => {
|
|
88
89
|
const routePath = computed(() => router.currentRoute.value.path);
|
|
89
|
-
const pageChunk =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
const pageChunk = customRef((track, trigger) => ({
|
|
91
|
+
get() {
|
|
92
|
+
track();
|
|
93
|
+
return router.currentRoute.value.meta._pageChunk;
|
|
94
|
+
},
|
|
95
|
+
set(value) {
|
|
96
|
+
router.currentRoute.value.meta._pageChunk = value;
|
|
97
|
+
trigger();
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
93
100
|
if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
|
|
94
101
|
__VUE_HMR_RUNTIME__.updatePageData = async (newPageData) => {
|
|
95
102
|
const oldPageChunk = await routes.value[newPageData.path].loader();
|
|
96
|
-
|
|
103
|
+
const newPageChunk = { comp: oldPageChunk.comp, data: newPageData };
|
|
104
|
+
routes.value[newPageData.path].loader = () => Promise.resolve(newPageChunk);
|
|
97
105
|
if (newPageData.path === router.currentRoute.value.meta._pageChunk?.data.path) {
|
|
98
|
-
|
|
99
|
-
pageChunk.trigger();
|
|
106
|
+
pageChunk.value = newPageChunk;
|
|
100
107
|
}
|
|
101
108
|
};
|
|
102
109
|
}
|
|
@@ -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
|
|
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
|
{
|
|
@@ -225,6 +232,9 @@ var resolvers = reactive({
|
|
|
225
232
|
*/
|
|
226
233
|
resolvePageLayout: (pageData, layouts) => {
|
|
227
234
|
const layoutName = isString(pageData.frontmatter.layout) ? pageData.frontmatter.layout : LAYOUT_NAME_DEFAULT;
|
|
235
|
+
if (!layouts[layoutName]) {
|
|
236
|
+
throw new Error(`[vuepress] Cannot resolve layout: ${layoutName}`);
|
|
237
|
+
}
|
|
228
238
|
return layouts[layoutName];
|
|
229
239
|
},
|
|
230
240
|
/**
|
|
@@ -274,6 +284,7 @@ export {
|
|
|
274
284
|
useRoute,
|
|
275
285
|
useRouter,
|
|
276
286
|
Content,
|
|
287
|
+
defineClientConfig,
|
|
277
288
|
withBase,
|
|
278
289
|
RouteLink,
|
|
279
290
|
resolvers
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PageData, HeadConfig, SiteData, PageFrontmatter } from '@vuepress/share
|
|
|
4
4
|
export { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
|
|
5
5
|
import { Router } from 'vue-router';
|
|
6
6
|
export { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from 'vue-router';
|
|
7
|
-
export { C as CreateVueAppFunction } from './createVueAppFunction-
|
|
7
|
+
export { C as CreateVueAppFunction } from './createVueAppFunction-onJTVJru.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Name of the default layout
|
|
@@ -91,7 +91,7 @@ interface ClientConfig {
|
|
|
91
91
|
/**
|
|
92
92
|
* Layout components
|
|
93
93
|
*/
|
|
94
|
-
layouts?: Layouts
|
|
94
|
+
layouts?: Partial<Layouts>;
|
|
95
95
|
/**
|
|
96
96
|
* Components to be placed directly into the root node of vue app
|
|
97
97
|
*/
|
|
@@ -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-
|
|
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.
|
|
3
|
+
"version": "2.0.0-rc.9",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -33,11 +33,10 @@
|
|
|
33
33
|
"types.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@vue/devtools-api": "^6.
|
|
37
|
-
"
|
|
38
|
-
"vue": "^3.
|
|
39
|
-
"
|
|
40
|
-
"@vuepress/shared": "2.0.0-rc.7"
|
|
36
|
+
"@vue/devtools-api": "^6.6.1",
|
|
37
|
+
"vue": "^3.4.21",
|
|
38
|
+
"vue-router": "^4.3.0",
|
|
39
|
+
"@vuepress/shared": "2.0.0-rc.9"
|
|
41
40
|
},
|
|
42
41
|
"publishConfig": {
|
|
43
42
|
"access": "public"
|
|
File without changes
|