@vuepress/client 2.0.0-beta.50 → 2.0.0-beta.52

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
@@ -15,7 +15,7 @@ import {
15
15
  usePageHead,
16
16
  usePageLang,
17
17
  withBase
18
- } from "./chunk-V3MKNX2O.js";
18
+ } from "./chunk-X6HE2CCA.js";
19
19
 
20
20
  // src/app.ts
21
21
  import { clientConfigs } from "@internal/clientConfigs";
@@ -17,7 +17,7 @@ var pageDataEmpty = readonly({
17
17
  });
18
18
  var pageData = ref2(pageDataEmpty);
19
19
  var usePageData = () => pageData;
20
- if (import.meta.webpackHot || import.meta.hot) {
20
+ if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
21
21
  __VUE_HMR_RUNTIME__.updatePageData = (data) => {
22
22
  pagesData.value[data.key] = () => Promise.resolve(data);
23
23
  if (data.key === pageData.value.key) {
@@ -96,7 +96,7 @@ import { siteData as siteDataRaw } from "@internal/siteData";
96
96
  import { ref as ref3 } from "vue";
97
97
  var siteData = ref3(siteDataRaw);
98
98
  var useSiteData = () => siteData;
99
- if (import.meta.webpackHot || import.meta.hot) {
99
+ if (__VUEPRESS_DEV__ && (import.meta.webpackHot || import.meta.hot)) {
100
100
  __VUE_HMR_RUNTIME__.updateSiteData = (data) => {
101
101
  siteData.value = data;
102
102
  };
@@ -153,7 +153,7 @@ var resolvers = reactive({
153
153
  ];
154
154
  return dedupeHead(head);
155
155
  },
156
- resolvePageHeadTitle: (page, siteLocale) => `${page.title ? `${page.title} | ` : ``}${siteLocale.title}`,
156
+ resolvePageHeadTitle: (page, siteLocale) => `${page.title ? `${page.title}` : ``}${siteLocale.title ? ` | ${siteLocale.title}` : ``}`,
157
157
  resolvePageLang: (pageData2) => pageData2.lang || "en",
158
158
  resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, routePath),
159
159
  resolveSiteLocaleData: (site, routeLocale) => ({
@@ -200,9 +200,18 @@ var Content = defineComponent2({
200
200
  });
201
201
 
202
202
  // src/components/Vuepress.ts
203
- import { layoutComponents } from "@internal/layoutComponents";
203
+ import { clientConfigs } from "@internal/clientConfigs";
204
204
  import { isString as isString2 } from "@vuepress/shared";
205
- import { computed as computed2, defineComponent as defineComponent3, h as h2, resolveComponent } from "vue";
205
+ import { computed as computed2, defineComponent as defineComponent3, h as h2 } from "vue";
206
+ var LAYOUT_NAME_DEFAULT = "Layout";
207
+ var LAYOUT_NAME_NOT_FOUND = "NotFound";
208
+ var layouts = clientConfigs.reduce(
209
+ (prev, item) => ({
210
+ ...prev,
211
+ ...item.layouts
212
+ }),
213
+ {}
214
+ );
206
215
  var Vuepress = defineComponent3({
207
216
  name: "Vuepress",
208
217
  setup() {
@@ -214,12 +223,12 @@ var Vuepress = defineComponent3({
214
223
  if (isString2(frontmatterLayout)) {
215
224
  layoutName = frontmatterLayout;
216
225
  } else {
217
- layoutName = "Layout";
226
+ layoutName = LAYOUT_NAME_DEFAULT;
218
227
  }
219
228
  } else {
220
- layoutName = "404";
229
+ layoutName = LAYOUT_NAME_NOT_FOUND;
221
230
  }
222
- return layoutComponents[layoutName] || resolveComponent(layoutName, false);
231
+ return layouts[layoutName];
223
232
  });
224
233
  return () => h2(layoutComponent.value);
225
234
  }
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { Router, RouteMeta } from 'vue-router';
6
6
 
7
7
  declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
8
8
  [key: string]: any;
9
- }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
9
+ }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
10
10
 
11
11
  /**
12
12
  * Markdown rendered content
@@ -19,7 +19,7 @@ declare const Content: vue.DefineComponent<{
19
19
  };
20
20
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
21
21
  [key: string]: any;
22
- }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
22
+ }>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
23
23
  pageKey: {
24
24
  type: StringConstructor;
25
25
  required: false;
@@ -34,7 +34,7 @@ declare const Content: vue.DefineComponent<{
34
34
  */
35
35
  declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
36
36
  [key: string]: any;
37
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
37
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
38
38
 
39
39
  /**
40
40
  * Ref wrapper of `PageData`
@@ -214,6 +214,10 @@ interface ClientConfig {
214
214
  * A function to be called inside the setup function of vue app
215
215
  */
216
216
  setup?: () => void;
217
+ /**
218
+ * Layout components
219
+ */
220
+ layouts?: Record<string, Component>;
217
221
  /**
218
222
  * Components to be placed directly into the root node of vue app
219
223
  */
@@ -235,7 +239,7 @@ declare type PageRouteItem = [
235
239
  /**
236
240
  * A helper function to help you define vuepress client config file
237
241
  */
238
- declare const defineClientConfig: (clientConfig: ClientConfig) => ClientConfig;
242
+ declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
239
243
 
240
244
  /**
241
245
  * Resolver methods to get global computed
package/dist/index.js CHANGED
@@ -25,10 +25,10 @@ import {
25
25
  useSiteLocaleData,
26
26
  useUpdateHead,
27
27
  withBase
28
- } from "./chunk-V3MKNX2O.js";
28
+ } from "./chunk-X6HE2CCA.js";
29
29
 
30
30
  // src/helpers/defineClientConfig.ts
31
- var defineClientConfig = (clientConfig) => clientConfig;
31
+ var defineClientConfig = (clientConfig = {}) => clientConfig;
32
32
  export {
33
33
  ClientOnly,
34
34
  Content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/client",
3
- "version": "2.0.0-beta.50",
3
+ "version": "2.0.0-beta.52",
4
4
  "description": "Client package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -33,10 +33,10 @@
33
33
  "types.d.ts"
34
34
  ],
35
35
  "dependencies": {
36
- "@vue/devtools-api": "^6.2.1",
37
- "@vuepress/shared": "2.0.0-beta.50",
38
- "vue": "^3.2.37",
39
- "vue-router": "^4.1.4"
36
+ "@vue/devtools-api": "^6.4.5",
37
+ "@vuepress/shared": "2.0.0-beta.52",
38
+ "vue": "^3.2.41",
39
+ "vue-router": "^4.1.5"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <meta name="generator" content="VuePress {{ version }}">
7
7
  <!--vuepress-ssr-head-->
8
- <!--vuepress-ssr-resources-->
9
8
  <!--vuepress-ssr-styles-->
9
+ <!--vuepress-ssr-resources-->
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"><!--vuepress-ssr-app--></div>