@vuepress/client 2.0.0-beta.45 → 2.0.0-beta.48
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 +29 -5
- package/dist/{chunk-RTLFYRTT.js → chunk-OOQFWU6B.js} +18 -23
- package/dist/index.d.ts +27 -6
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientOnly,
|
|
3
3
|
Content,
|
|
4
|
+
Vuepress,
|
|
4
5
|
pageData,
|
|
5
6
|
pageFrontmatterSymbol,
|
|
6
7
|
pageHeadSymbol,
|
|
@@ -14,7 +15,7 @@ import {
|
|
|
14
15
|
usePageHead,
|
|
15
16
|
usePageLang,
|
|
16
17
|
withBase
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OOQFWU6B.js";
|
|
18
19
|
|
|
19
20
|
// src/app.ts
|
|
20
21
|
import { clientConfigs } from "@internal/clientConfigs";
|
|
@@ -23,7 +24,6 @@ import { RouterView } from "vue-router";
|
|
|
23
24
|
|
|
24
25
|
// src/router.ts
|
|
25
26
|
import { pagesComponents } from "@internal/pagesComponents";
|
|
26
|
-
import { pagesRoutes } from "@internal/pagesRoutes";
|
|
27
27
|
import { removeEndingSlash } from "@vuepress/shared";
|
|
28
28
|
import {
|
|
29
29
|
createMemoryHistory,
|
|
@@ -31,11 +31,34 @@ import {
|
|
|
31
31
|
createWebHistory,
|
|
32
32
|
START_LOCATION
|
|
33
33
|
} from "vue-router";
|
|
34
|
+
|
|
35
|
+
// src/routes.ts
|
|
36
|
+
import { pagesRoutes } from "@internal/pagesRoutes";
|
|
37
|
+
var createRoutes = () => pagesRoutes.reduce((result, [name, path, meta, redirects]) => {
|
|
38
|
+
result.push({
|
|
39
|
+
name,
|
|
40
|
+
path,
|
|
41
|
+
component: Vuepress,
|
|
42
|
+
meta
|
|
43
|
+
}, ...redirects.map((item) => ({
|
|
44
|
+
path: item,
|
|
45
|
+
redirect: path
|
|
46
|
+
})));
|
|
47
|
+
return result;
|
|
48
|
+
}, [
|
|
49
|
+
{
|
|
50
|
+
name: "404",
|
|
51
|
+
path: "/:catchAll(.*)",
|
|
52
|
+
component: Vuepress
|
|
53
|
+
}
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
// src/router.ts
|
|
34
57
|
var historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;
|
|
35
58
|
var createVueRouter = () => {
|
|
36
59
|
const router = createRouter({
|
|
37
60
|
history: historyCreator(removeEndingSlash(siteData.value.base)),
|
|
38
|
-
routes:
|
|
61
|
+
routes: createRoutes(),
|
|
39
62
|
scrollBehavior: (to, from, savedPosition) => {
|
|
40
63
|
if (savedPosition)
|
|
41
64
|
return savedPosition;
|
|
@@ -58,6 +81,7 @@ var createVueRouter = () => {
|
|
|
58
81
|
|
|
59
82
|
// src/setupDevtools.ts
|
|
60
83
|
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
84
|
+
var COMPONENT_STATE_TYPE = "VuePress";
|
|
61
85
|
var setupDevtools = (app, globalComputed) => {
|
|
62
86
|
setupDevtoolsPlugin({
|
|
63
87
|
app,
|
|
@@ -66,11 +90,11 @@ var setupDevtools = (app, globalComputed) => {
|
|
|
66
90
|
packageName: "@vuepress/client",
|
|
67
91
|
homepage: "https://v2.vuepress.vuejs.org",
|
|
68
92
|
logo: "https://v2.vuepress.vuejs.org/images/hero.png",
|
|
69
|
-
componentStateTypes: [
|
|
93
|
+
componentStateTypes: [COMPONENT_STATE_TYPE]
|
|
70
94
|
}, (api) => {
|
|
71
95
|
api.on.inspectComponent((payload) => {
|
|
72
96
|
payload.instanceData.state.push(...Object.entries(globalComputed).map(([name, item]) => ({
|
|
73
|
-
type:
|
|
97
|
+
type: COMPONENT_STATE_TYPE,
|
|
74
98
|
key: name,
|
|
75
99
|
editable: false,
|
|
76
100
|
value: item.value
|
|
@@ -151,6 +151,7 @@ var resolvers = reactive({
|
|
|
151
151
|
// src/components/ClientOnly.ts
|
|
152
152
|
import { defineComponent, onMounted, ref as ref4 } from "vue";
|
|
153
153
|
var ClientOnly = defineComponent({
|
|
154
|
+
name: "ClientOnly",
|
|
154
155
|
setup(_, ctx) {
|
|
155
156
|
const isMounted = ref4(false);
|
|
156
157
|
onMounted(() => {
|
|
@@ -162,38 +163,32 @@ var ClientOnly = defineComponent({
|
|
|
162
163
|
|
|
163
164
|
// src/components/Content.ts
|
|
164
165
|
import { pagesComponents } from "@internal/pagesComponents";
|
|
165
|
-
import { h } from "vue";
|
|
166
|
-
var Content = (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
import { computed, defineComponent as defineComponent2, h } from "vue";
|
|
167
|
+
var Content = defineComponent2({
|
|
168
|
+
name: "Content",
|
|
169
|
+
props: {
|
|
170
|
+
pageKey: {
|
|
171
|
+
type: String,
|
|
172
|
+
required: false,
|
|
173
|
+
default: ""
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
setup(props) {
|
|
171
177
|
const page = usePageData();
|
|
172
|
-
|
|
178
|
+
const pageComponent = computed(() => pagesComponents[props.pageKey || page.value.key]);
|
|
179
|
+
return () => pageComponent.value ? h(pageComponent.value) : h("div", __VUEPRESS_DEV__ ? "Page does not exist. This is a fallback content." : "404 Not Found");
|
|
173
180
|
}
|
|
174
|
-
|
|
175
|
-
if (component) {
|
|
176
|
-
return h(component);
|
|
177
|
-
}
|
|
178
|
-
return h("div", __VUEPRESS_DEV__ ? "Page does not exist. This is a fallback content." : "404 Not Found");
|
|
179
|
-
};
|
|
180
|
-
Content.displayName = "Content";
|
|
181
|
-
Content.props = {
|
|
182
|
-
pageKey: {
|
|
183
|
-
type: String,
|
|
184
|
-
required: false
|
|
185
|
-
}
|
|
186
|
-
};
|
|
181
|
+
});
|
|
187
182
|
|
|
188
183
|
// src/components/Vuepress.ts
|
|
189
184
|
import { layoutComponents } from "@internal/layoutComponents";
|
|
190
185
|
import { isString as isString2 } from "@vuepress/shared";
|
|
191
|
-
import { computed, defineComponent as
|
|
192
|
-
var Vuepress =
|
|
186
|
+
import { computed as computed2, defineComponent as defineComponent3, h as h2, resolveComponent } from "vue";
|
|
187
|
+
var Vuepress = defineComponent3({
|
|
193
188
|
name: "Vuepress",
|
|
194
189
|
setup() {
|
|
195
190
|
const page = usePageData();
|
|
196
|
-
const layoutComponent =
|
|
191
|
+
const layoutComponent = computed2(() => {
|
|
197
192
|
let layoutName;
|
|
198
193
|
if (page.value.path) {
|
|
199
194
|
const frontmatterLayout = page.value.frontmatter.layout;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
|
|
2
2
|
export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
|
|
3
3
|
import * as vue from 'vue';
|
|
4
|
-
import { Ref, ComputedRef, InjectionKey, App,
|
|
5
|
-
import { Router } from 'vue-router';
|
|
4
|
+
import { Ref, ComputedRef, InjectionKey, App, Component } from 'vue';
|
|
5
|
+
import { Router, RouteMeta } from 'vue-router';
|
|
6
6
|
export { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -186,9 +186,16 @@ interface ClientConfig {
|
|
|
186
186
|
/**
|
|
187
187
|
* Components to be placed directly into the root node of vue app
|
|
188
188
|
*/
|
|
189
|
-
rootComponents?:
|
|
189
|
+
rootComponents?: Component[];
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
declare type PageRouteItem = [
|
|
193
|
+
name: string,
|
|
194
|
+
path: string,
|
|
195
|
+
meta: RouteMeta,
|
|
196
|
+
redirects: string[]
|
|
197
|
+
];
|
|
198
|
+
|
|
192
199
|
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
193
200
|
[key: string]: any;
|
|
194
201
|
}>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
|
|
@@ -196,8 +203,22 @@ declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNo
|
|
|
196
203
|
/**
|
|
197
204
|
* Markdown rendered content
|
|
198
205
|
*/
|
|
199
|
-
declare const Content:
|
|
200
|
-
pageKey
|
|
206
|
+
declare const Content: vue.DefineComponent<{
|
|
207
|
+
pageKey: {
|
|
208
|
+
type: StringConstructor;
|
|
209
|
+
required: false;
|
|
210
|
+
default: string;
|
|
211
|
+
};
|
|
212
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
213
|
+
[key: string]: any;
|
|
214
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
215
|
+
pageKey: {
|
|
216
|
+
type: StringConstructor;
|
|
217
|
+
required: false;
|
|
218
|
+
default: string;
|
|
219
|
+
};
|
|
220
|
+
}>>, {
|
|
221
|
+
pageKey: string;
|
|
201
222
|
}>;
|
|
202
223
|
|
|
203
224
|
/**
|
|
@@ -232,4 +253,4 @@ declare const resolvers: {
|
|
|
232
253
|
*/
|
|
233
254
|
declare const withBase: (url: string) => string;
|
|
234
255
|
|
|
235
|
-
export { ClientConfig, ClientOnly, Content, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, Vuepress, defineClientConfig, pageData, pageDataEmpty, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
|
256
|
+
export { ClientConfig, ClientOnly, Content, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PageRouteItem, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, Vuepress, defineClientConfig, pageData, pageDataEmpty, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.48",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vue/devtools-api": "^6.1.4",
|
|
37
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
38
|
-
"vue": "^3.2.
|
|
37
|
+
"@vuepress/shared": "2.0.0-beta.48",
|
|
38
|
+
"vue": "^3.2.36",
|
|
39
39
|
"vue-router": "^4.0.15"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|