@vuepress/client 2.0.0-beta.43 → 2.0.0-beta.46
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 +7 -9
- package/dist/{chunk-RTLFYRTT.js → chunk-HEGD2UVF.js} +18 -23
- package/dist/index.d.ts +44 -14
- package/dist/index.js +4 -8
- package/package.json +5 -8
package/dist/app.js
CHANGED
|
@@ -14,12 +14,10 @@ import {
|
|
|
14
14
|
usePageHead,
|
|
15
15
|
usePageLang,
|
|
16
16
|
withBase
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HEGD2UVF.js";
|
|
18
18
|
|
|
19
19
|
// src/app.ts
|
|
20
|
-
import {
|
|
21
|
-
import { clientAppRootComponents } from "@internal/clientAppRootComponents";
|
|
22
|
-
import { clientAppSetups } from "@internal/clientAppSetups";
|
|
20
|
+
import { clientConfigs } from "@internal/clientConfigs";
|
|
23
21
|
import { createApp, createSSRApp, h } from "vue";
|
|
24
22
|
import { RouterView } from "vue-router";
|
|
25
23
|
|
|
@@ -223,12 +221,12 @@ var createVueApp = async () => {
|
|
|
223
221
|
name: "VuepressApp",
|
|
224
222
|
setup() {
|
|
225
223
|
setupUpdateHead();
|
|
226
|
-
for (const
|
|
227
|
-
|
|
224
|
+
for (const clientConfig of clientConfigs) {
|
|
225
|
+
clientConfig.setup?.();
|
|
228
226
|
}
|
|
229
227
|
return () => [
|
|
230
228
|
h(RouterView),
|
|
231
|
-
...
|
|
229
|
+
...clientConfigs.flatMap(({ rootComponents = [] }) => rootComponents.map((component) => h(component)))
|
|
232
230
|
];
|
|
233
231
|
}
|
|
234
232
|
});
|
|
@@ -238,8 +236,8 @@ var createVueApp = async () => {
|
|
|
238
236
|
if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
|
|
239
237
|
setupDevtools(app, globalComputed);
|
|
240
238
|
}
|
|
241
|
-
for (const
|
|
242
|
-
await
|
|
239
|
+
for (const clientConfig of clientConfigs) {
|
|
240
|
+
await clientConfig.enhance?.({ app, router, siteData });
|
|
243
241
|
}
|
|
244
242
|
app.use(router);
|
|
245
243
|
return {
|
|
@@ -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,7 +1,7 @@
|
|
|
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,
|
|
4
|
+
import { Ref, ComputedRef, InjectionKey, App, ComponentOptions } from 'vue';
|
|
5
5
|
import { Router } from 'vue-router';
|
|
6
6
|
export { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
|
|
7
7
|
|
|
@@ -166,13 +166,28 @@ declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
|
166
166
|
*/
|
|
167
167
|
declare const useUpdateHead: () => UpdateHead;
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Configure vuepress client
|
|
171
|
+
*/
|
|
172
|
+
interface ClientConfig {
|
|
173
|
+
/**
|
|
174
|
+
* An enhance function to be called after vue app instance and
|
|
175
|
+
* vue-router instance has been created
|
|
176
|
+
*/
|
|
177
|
+
enhance?: (context: {
|
|
178
|
+
app: App;
|
|
179
|
+
router: Router;
|
|
180
|
+
siteData: SiteDataRef;
|
|
181
|
+
}) => void | Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* A function to be called inside the setup function of vue app
|
|
184
|
+
*/
|
|
185
|
+
setup?: () => void;
|
|
186
|
+
/**
|
|
187
|
+
* Components to be placed directly into the root node of vue app
|
|
188
|
+
*/
|
|
189
|
+
rootComponents?: ComponentOptions[];
|
|
190
|
+
}
|
|
176
191
|
|
|
177
192
|
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
178
193
|
[key: string]: any;
|
|
@@ -181,8 +196,22 @@ declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNo
|
|
|
181
196
|
/**
|
|
182
197
|
* Markdown rendered content
|
|
183
198
|
*/
|
|
184
|
-
declare const Content:
|
|
185
|
-
pageKey
|
|
199
|
+
declare const Content: vue.DefineComponent<{
|
|
200
|
+
pageKey: {
|
|
201
|
+
type: StringConstructor;
|
|
202
|
+
required: false;
|
|
203
|
+
default: string;
|
|
204
|
+
};
|
|
205
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
208
|
+
pageKey: {
|
|
209
|
+
type: StringConstructor;
|
|
210
|
+
required: false;
|
|
211
|
+
default: string;
|
|
212
|
+
};
|
|
213
|
+
}>>, {
|
|
214
|
+
pageKey: string;
|
|
186
215
|
}>;
|
|
187
216
|
|
|
188
217
|
/**
|
|
@@ -192,9 +221,10 @@ declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode
|
|
|
192
221
|
[key: string]: any;
|
|
193
222
|
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
|
|
194
223
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
224
|
+
/**
|
|
225
|
+
* A helper function to help you define vuepress client config file
|
|
226
|
+
*/
|
|
227
|
+
declare const defineClientConfig: (clientConfig: ClientConfig) => ClientConfig;
|
|
198
228
|
|
|
199
229
|
/**
|
|
200
230
|
* Resolver methods to get global computed
|
|
@@ -216,4 +246,4 @@ declare const resolvers: {
|
|
|
216
246
|
*/
|
|
217
247
|
declare const withBase: (url: string) => string;
|
|
218
248
|
|
|
219
|
-
export {
|
|
249
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -25,19 +25,15 @@ import {
|
|
|
25
25
|
useSiteLocaleData,
|
|
26
26
|
useUpdateHead,
|
|
27
27
|
withBase
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HEGD2UVF.js";
|
|
29
29
|
|
|
30
|
-
// src/helpers/
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
// src/helpers/defineClientAppSetup.ts
|
|
34
|
-
var defineClientAppSetup = (clientAppSetup) => clientAppSetup;
|
|
30
|
+
// src/helpers/defineClientConfig.ts
|
|
31
|
+
var defineClientConfig = (clientConfig) => clientConfig;
|
|
35
32
|
export {
|
|
36
33
|
ClientOnly,
|
|
37
34
|
Content,
|
|
38
35
|
Vuepress,
|
|
39
|
-
|
|
40
|
-
defineClientAppSetup,
|
|
36
|
+
defineClientConfig,
|
|
41
37
|
pageData,
|
|
42
38
|
pageDataEmpty,
|
|
43
39
|
pageFrontmatterSymbol,
|
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.46",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/index.js",
|
|
22
22
|
"./app": "./dist/app.js",
|
|
23
|
-
"./helpers": "./helpers/index.js",
|
|
24
23
|
"./package.json": "./package.json",
|
|
25
24
|
"./templates/*": "./templates/*",
|
|
26
25
|
"./types": "./types.d.ts"
|
|
@@ -35,9 +34,9 @@
|
|
|
35
34
|
],
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@vue/devtools-api": "^6.1.4",
|
|
38
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
39
|
-
"vue": "^3.2.
|
|
40
|
-
"vue-router": "^4.0.
|
|
37
|
+
"@vuepress/shared": "2.0.0-beta.46",
|
|
38
|
+
"vue": "^3.2.35",
|
|
39
|
+
"vue-router": "^4.0.15"
|
|
41
40
|
},
|
|
42
41
|
"publishConfig": {
|
|
43
42
|
"access": "public"
|
|
@@ -52,9 +51,7 @@
|
|
|
52
51
|
"src/index.ts"
|
|
53
52
|
],
|
|
54
53
|
"external": [
|
|
55
|
-
"@internal/
|
|
56
|
-
"@internal/clientAppRootComponents",
|
|
57
|
-
"@internal/clientAppSetups",
|
|
54
|
+
"@internal/clientConfigs",
|
|
58
55
|
"@internal/layoutComponents",
|
|
59
56
|
"@internal/pagesComponents",
|
|
60
57
|
"@internal/pagesData",
|