@vuepress/client 2.0.0-beta.48 → 2.0.0-beta.50-pre

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/client",
3
- "version": "2.0.0-beta.48",
3
+ "version": "2.0.0-beta.50-pre",
4
4
  "description": "Client package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -28,27 +28,25 @@
28
28
  "module": "./dist/index.js",
29
29
  "types": "./dist/index.d.ts",
30
30
  "files": [
31
- "dist",
32
- "templates",
33
- "types.d.ts"
31
+ "./dist",
32
+ "./templates",
33
+ "./types.d.ts"
34
34
  ],
35
35
  "dependencies": {
36
- "@vue/devtools-api": "^6.1.4",
37
- "@vuepress/shared": "2.0.0-beta.48",
38
- "vue": "^3.2.36",
39
- "vue-router": "^4.0.15"
36
+ "@vue/devtools-api": "^6.2.1",
37
+ "@vuepress/shared": "2.0.0-beta.50-pre",
38
+ "vue": "^3.2.37",
39
+ "vue-router": "^4.1.3"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
44
  "tsup": {
45
45
  "clean": true,
46
- "dts": [
47
- "src/index.ts"
48
- ],
46
+ "dts": "./src/index.ts",
49
47
  "entry": [
50
- "src/app.ts",
51
- "src/index.ts"
48
+ "./src/app.ts",
49
+ "./src/index.ts"
52
50
  ],
53
51
  "external": [
54
52
  "@internal/clientConfigs",
@@ -61,10 +59,10 @@
61
59
  "format": [
62
60
  "esm"
63
61
  ],
64
- "outDir": "dist",
62
+ "outDir": "./dist",
65
63
  "sourcemap": false,
66
64
  "target": "es2020",
67
- "tsconfig": "tsconfig.dts.json"
65
+ "tsconfig": "./tsconfig.dts.json"
68
66
  },
69
67
  "scripts": {
70
68
  "build": "tsup",
package/dist/app.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
2
- import 'vue';
3
- import 'vue-router';
4
-
5
- declare const createVueApp: CreateVueAppFunction;
6
-
7
- export { createVueApp };
package/dist/app.js DELETED
@@ -1,281 +0,0 @@
1
- import {
2
- ClientOnly,
3
- Content,
4
- Vuepress,
5
- pageData,
6
- pageFrontmatterSymbol,
7
- pageHeadSymbol,
8
- pageHeadTitleSymbol,
9
- pageLangSymbol,
10
- resolvers,
11
- routeLocaleSymbol,
12
- siteData,
13
- siteLocaleDataSymbol,
14
- updateHeadSymbol,
15
- usePageHead,
16
- usePageLang,
17
- withBase
18
- } from "./chunk-OOQFWU6B.js";
19
-
20
- // src/app.ts
21
- import { clientConfigs } from "@internal/clientConfigs";
22
- import { createApp, createSSRApp, h } from "vue";
23
- import { RouterView } from "vue-router";
24
-
25
- // src/router.ts
26
- import { pagesComponents } from "@internal/pagesComponents";
27
- import { removeEndingSlash } from "@vuepress/shared";
28
- import {
29
- createMemoryHistory,
30
- createRouter,
31
- createWebHistory,
32
- START_LOCATION
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
57
- var historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;
58
- var createVueRouter = () => {
59
- const router = createRouter({
60
- history: historyCreator(removeEndingSlash(siteData.value.base)),
61
- routes: createRoutes(),
62
- scrollBehavior: (to, from, savedPosition) => {
63
- if (savedPosition)
64
- return savedPosition;
65
- if (to.hash)
66
- return { el: to.hash };
67
- return { top: 0 };
68
- }
69
- });
70
- router.beforeResolve(async (to, from) => {
71
- if (to.path !== from.path || from === START_LOCATION) {
72
- ;
73
- [pageData.value] = await Promise.all([
74
- resolvers.resolvePageData(to.name),
75
- pagesComponents[to.name]?.__asyncLoader()
76
- ]);
77
- }
78
- });
79
- return router;
80
- };
81
-
82
- // src/setupDevtools.ts
83
- import { setupDevtoolsPlugin } from "@vue/devtools-api";
84
- var COMPONENT_STATE_TYPE = "VuePress";
85
- var setupDevtools = (app, globalComputed) => {
86
- setupDevtoolsPlugin({
87
- app,
88
- id: "org.vuejs.vuepress",
89
- label: "VuePress",
90
- packageName: "@vuepress/client",
91
- homepage: "https://v2.vuepress.vuejs.org",
92
- logo: "https://v2.vuepress.vuejs.org/images/hero.png",
93
- componentStateTypes: [COMPONENT_STATE_TYPE]
94
- }, (api) => {
95
- api.on.inspectComponent((payload) => {
96
- payload.instanceData.state.push(...Object.entries(globalComputed).map(([name, item]) => ({
97
- type: COMPONENT_STATE_TYPE,
98
- key: name,
99
- editable: false,
100
- value: item.value
101
- })));
102
- });
103
- });
104
- };
105
-
106
- // src/setupGlobalComponents.ts
107
- var setupGlobalComponents = (app) => {
108
- app.component("ClientOnly", ClientOnly);
109
- app.component("Content", Content);
110
- };
111
-
112
- // src/setupGlobalComputed.ts
113
- import { computed } from "vue";
114
- var setupGlobalComputed = (app, router) => {
115
- const routeLocale = computed(() => resolvers.resolveRouteLocale(siteData.value.locales, router.currentRoute.value.path));
116
- const siteLocaleData = computed(() => resolvers.resolveSiteLocaleData(siteData.value, routeLocale.value));
117
- const pageFrontmatter = computed(() => resolvers.resolvePageFrontmatter(pageData.value));
118
- const pageHeadTitle = computed(() => resolvers.resolvePageHeadTitle(pageData.value, siteLocaleData.value));
119
- const pageHead = computed(() => resolvers.resolvePageHead(pageHeadTitle.value, pageFrontmatter.value, siteLocaleData.value));
120
- const pageLang = computed(() => resolvers.resolvePageLang(pageData.value));
121
- app.provide(routeLocaleSymbol, routeLocale);
122
- app.provide(siteLocaleDataSymbol, siteLocaleData);
123
- app.provide(pageFrontmatterSymbol, pageFrontmatter);
124
- app.provide(pageHeadTitleSymbol, pageHeadTitle);
125
- app.provide(pageHeadSymbol, pageHead);
126
- app.provide(pageLangSymbol, pageLang);
127
- Object.defineProperties(app.config.globalProperties, {
128
- $frontmatter: { get: () => pageFrontmatter.value },
129
- $head: { get: () => pageHead.value },
130
- $headTitle: { get: () => pageHeadTitle.value },
131
- $lang: { get: () => pageLang.value },
132
- $page: { get: () => pageData.value },
133
- $routeLocale: { get: () => routeLocale.value },
134
- $site: { get: () => siteData.value },
135
- $siteLocale: { get: () => siteLocaleData.value },
136
- $withBase: { get: () => withBase }
137
- });
138
- return {
139
- pageData,
140
- pageFrontmatter,
141
- pageHead,
142
- pageHeadTitle,
143
- pageLang,
144
- routeLocale,
145
- siteData,
146
- siteLocaleData
147
- };
148
- };
149
-
150
- // src/setupUpdateHead.ts
151
- import { isPlainObject, isString } from "@vuepress/shared";
152
- import { onMounted, provide, ref, useSSRContext, watch } from "vue";
153
- import { useRoute } from "vue-router";
154
- var setupUpdateHead = () => {
155
- const route = useRoute();
156
- const head = usePageHead();
157
- const lang = usePageLang();
158
- if (__VUEPRESS_SSR__) {
159
- const ssrContext = useSSRContext();
160
- if (ssrContext) {
161
- ssrContext.head = head.value;
162
- ssrContext.lang = lang.value;
163
- }
164
- return;
165
- }
166
- const headTags = ref([]);
167
- const loadHead = () => {
168
- head.value.forEach((item) => {
169
- const tag = queryHeadTag(item);
170
- if (tag) {
171
- headTags.value.push(tag);
172
- }
173
- });
174
- };
175
- const updateHead = () => {
176
- document.documentElement.lang = lang.value;
177
- headTags.value.forEach((item) => {
178
- if (item.parentNode === document.head) {
179
- document.head.removeChild(item);
180
- }
181
- });
182
- headTags.value.splice(0, headTags.value.length);
183
- head.value.forEach((item) => {
184
- const tag = createHeadTag(item);
185
- if (tag !== null) {
186
- document.head.appendChild(tag);
187
- headTags.value.push(tag);
188
- }
189
- });
190
- };
191
- provide(updateHeadSymbol, updateHead);
192
- onMounted(() => {
193
- loadHead();
194
- updateHead();
195
- watch(() => __VUEPRESS_DEV__ ? head.value : route.path, () => updateHead());
196
- });
197
- };
198
- var queryHeadTag = ([
199
- tagName,
200
- attrs,
201
- content = ""
202
- ]) => {
203
- const attrsSelector = Object.entries(attrs).map(([key, value]) => {
204
- if (isString(value)) {
205
- return `[${key}="${value}"]`;
206
- }
207
- if (value === true) {
208
- return `[${key}]`;
209
- }
210
- return "";
211
- }).join("");
212
- const selector = `head > ${tagName}${attrsSelector}`;
213
- const tags = Array.from(document.querySelectorAll(selector));
214
- const matchedTag = tags.find((item) => item.innerText === content);
215
- return matchedTag || null;
216
- };
217
- var createHeadTag = ([
218
- tagName,
219
- attrs,
220
- content
221
- ]) => {
222
- if (!isString(tagName)) {
223
- return null;
224
- }
225
- const tag = document.createElement(tagName);
226
- if (isPlainObject(attrs)) {
227
- Object.entries(attrs).forEach(([key, value]) => {
228
- if (isString(value)) {
229
- tag.setAttribute(key, value);
230
- } else if (value === true) {
231
- tag.setAttribute(key, "");
232
- }
233
- });
234
- }
235
- if (isString(content)) {
236
- tag.appendChild(document.createTextNode(content));
237
- }
238
- return tag;
239
- };
240
-
241
- // src/app.ts
242
- var appCreator = __VUEPRESS_DEV__ ? createApp : createSSRApp;
243
- var createVueApp = async () => {
244
- const app = appCreator({
245
- name: "VuepressApp",
246
- setup() {
247
- setupUpdateHead();
248
- for (const clientConfig of clientConfigs) {
249
- clientConfig.setup?.();
250
- }
251
- return () => [
252
- h(RouterView),
253
- ...clientConfigs.flatMap(({ rootComponents = [] }) => rootComponents.map((component) => h(component)))
254
- ];
255
- }
256
- });
257
- const router = createVueRouter();
258
- setupGlobalComponents(app);
259
- const globalComputed = setupGlobalComputed(app, router);
260
- if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
261
- setupDevtools(app, globalComputed);
262
- }
263
- for (const clientConfig of clientConfigs) {
264
- await clientConfig.enhance?.({ app, router, siteData });
265
- }
266
- app.use(router);
267
- return {
268
- app,
269
- router
270
- };
271
- };
272
- if (!__VUEPRESS_SSR__) {
273
- createVueApp().then(({ app, router }) => {
274
- router.isReady().then(() => {
275
- app.mount("#app");
276
- });
277
- });
278
- }
279
- export {
280
- createVueApp
281
- };
@@ -1,245 +0,0 @@
1
- // src/composables/pagesData.ts
2
- import { pagesData as pagesDataRaw } from "@internal/pagesData";
3
- import { ref } from "vue";
4
- var pagesData = ref(pagesDataRaw);
5
- var usePagesData = () => pagesData;
6
-
7
- // src/composables/pageData.ts
8
- import { readonly, ref as ref2 } from "vue";
9
- var pageDataEmpty = readonly({
10
- key: "",
11
- path: "",
12
- title: "",
13
- lang: "",
14
- frontmatter: {},
15
- excerpt: "",
16
- headers: []
17
- });
18
- var pageData = ref2(pageDataEmpty);
19
- var usePageData = () => pageData;
20
- if (import.meta.webpackHot || import.meta.hot) {
21
- __VUE_HMR_RUNTIME__.updatePageData = (data) => {
22
- pagesData.value[data.key] = () => Promise.resolve(data);
23
- if (data.key === pageData.value.key) {
24
- pageData.value = data;
25
- }
26
- };
27
- }
28
-
29
- // src/composables/pageFrontmatter.ts
30
- import { inject } from "vue";
31
- var pageFrontmatterSymbol = Symbol(__VUEPRESS_DEV__ ? "pageFrontmatter" : "");
32
- var usePageFrontmatter = () => {
33
- const pageFrontmatter = inject(pageFrontmatterSymbol);
34
- if (!pageFrontmatter) {
35
- throw new Error("usePageFrontmatter() is called without provider.");
36
- }
37
- return pageFrontmatter;
38
- };
39
-
40
- // src/composables/pageHead.ts
41
- import { inject as inject2 } from "vue";
42
- var pageHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "pageHead" : "");
43
- var usePageHead = () => {
44
- const pageHead = inject2(pageHeadSymbol);
45
- if (!pageHead) {
46
- throw new Error("usePageHead() is called without provider.");
47
- }
48
- return pageHead;
49
- };
50
-
51
- // src/composables/pageHeadTitle.ts
52
- import { inject as inject3 } from "vue";
53
- var pageHeadTitleSymbol = Symbol(__VUEPRESS_DEV__ ? "pageHeadTitle" : "");
54
- var usePageHeadTitle = () => {
55
- const pageHeadTitle = inject3(pageHeadTitleSymbol);
56
- if (!pageHeadTitle) {
57
- throw new Error("usePageHeadTitle() is called without provider.");
58
- }
59
- return pageHeadTitle;
60
- };
61
-
62
- // src/composables/pageLang.ts
63
- import { inject as inject4 } from "vue";
64
- var pageLangSymbol = Symbol(__VUEPRESS_DEV__ ? "pageLang" : "");
65
- var usePageLang = () => {
66
- const pageLang = inject4(pageLangSymbol);
67
- if (!pageLang) {
68
- throw new Error("usePageLang() is called without provider.");
69
- }
70
- return pageLang;
71
- };
72
-
73
- // src/composables/routeLocale.ts
74
- import { inject as inject5 } from "vue";
75
- var routeLocaleSymbol = Symbol(__VUEPRESS_DEV__ ? "routeLocale" : "");
76
- var useRouteLocale = () => {
77
- const routeLocale = inject5(routeLocaleSymbol);
78
- if (!routeLocale) {
79
- throw new Error("useRouteLocale() is called without provider.");
80
- }
81
- return routeLocale;
82
- };
83
-
84
- // src/composables/siteData.ts
85
- import { siteData as siteDataRaw } from "@internal/siteData";
86
- import { ref as ref3 } from "vue";
87
- var siteData = ref3(siteDataRaw);
88
- var useSiteData = () => siteData;
89
- if (import.meta.webpackHot || import.meta.hot) {
90
- __VUE_HMR_RUNTIME__.updateSiteData = (data) => {
91
- siteData.value = data;
92
- };
93
- }
94
-
95
- // src/composables/siteLocaleData.ts
96
- import { inject as inject6 } from "vue";
97
- var siteLocaleDataSymbol = Symbol(__VUEPRESS_DEV__ ? "siteLocaleData" : "");
98
- var useSiteLocaleData = () => {
99
- const siteLocaleData = inject6(siteLocaleDataSymbol);
100
- if (!siteLocaleData) {
101
- throw new Error("useSiteLocaleData() is called without provider.");
102
- }
103
- return siteLocaleData;
104
- };
105
-
106
- // src/composables/updateHead.ts
107
- import { inject as inject7 } from "vue";
108
- var updateHeadSymbol = Symbol(__VUEPRESS_DEV__ ? "updateHead" : "");
109
- var useUpdateHead = () => {
110
- const updateHead = inject7(updateHeadSymbol);
111
- if (!updateHead) {
112
- throw new Error("useUpdateHead() is called without provider.");
113
- }
114
- return updateHead;
115
- };
116
-
117
- // src/resolvers.ts
118
- import {
119
- dedupeHead,
120
- isArray,
121
- isString,
122
- resolveLocalePath
123
- } from "@vuepress/shared";
124
- import { reactive } from "vue";
125
- var resolvers = reactive({
126
- resolvePageData: async (pageKey) => {
127
- const pageDataResolver = pagesData.value[pageKey];
128
- const pageData2 = await pageDataResolver?.();
129
- return pageData2 ?? pageDataEmpty;
130
- },
131
- resolvePageFrontmatter: (pageData2) => pageData2.frontmatter,
132
- resolvePageHead: (headTitle, frontmatter, siteLocale) => {
133
- const description = isString(frontmatter.description) ? frontmatter.description : siteLocale.description;
134
- const head = [
135
- ...isArray(frontmatter.head) ? frontmatter.head : [],
136
- ...siteLocale.head,
137
- ["title", {}, headTitle],
138
- ["meta", { name: "description", content: description }]
139
- ];
140
- return dedupeHead(head);
141
- },
142
- resolvePageHeadTitle: (page, siteLocale) => `${page.title ? `${page.title} | ` : ``}${siteLocale.title}`,
143
- resolvePageLang: (pageData2) => pageData2.lang || "en",
144
- resolveRouteLocale: (locales, routePath) => resolveLocalePath(locales, routePath),
145
- resolveSiteLocaleData: (site, routeLocale) => ({
146
- ...site,
147
- ...site.locales[routeLocale]
148
- })
149
- });
150
-
151
- // src/components/ClientOnly.ts
152
- import { defineComponent, onMounted, ref as ref4 } from "vue";
153
- var ClientOnly = defineComponent({
154
- name: "ClientOnly",
155
- setup(_, ctx) {
156
- const isMounted = ref4(false);
157
- onMounted(() => {
158
- isMounted.value = true;
159
- });
160
- return () => isMounted.value ? ctx.slots.default?.() : null;
161
- }
162
- });
163
-
164
- // src/components/Content.ts
165
- import { pagesComponents } from "@internal/pagesComponents";
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) {
177
- const page = usePageData();
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");
180
- }
181
- });
182
-
183
- // src/components/Vuepress.ts
184
- import { layoutComponents } from "@internal/layoutComponents";
185
- import { isString as isString2 } from "@vuepress/shared";
186
- import { computed as computed2, defineComponent as defineComponent3, h as h2, resolveComponent } from "vue";
187
- var Vuepress = defineComponent3({
188
- name: "Vuepress",
189
- setup() {
190
- const page = usePageData();
191
- const layoutComponent = computed2(() => {
192
- let layoutName;
193
- if (page.value.path) {
194
- const frontmatterLayout = page.value.frontmatter.layout;
195
- if (isString2(frontmatterLayout)) {
196
- layoutName = frontmatterLayout;
197
- } else {
198
- layoutName = "Layout";
199
- }
200
- } else {
201
- layoutName = "404";
202
- }
203
- return layoutComponents[layoutName] || resolveComponent(layoutName, false);
204
- });
205
- return () => h2(layoutComponent.value);
206
- }
207
- });
208
-
209
- // src/withBase.ts
210
- import { isLinkHttp, removeLeadingSlash } from "@vuepress/shared";
211
- var withBase = (url) => {
212
- if (isLinkHttp(url))
213
- return url;
214
- const base = useSiteData().value.base;
215
- return `${base}${removeLeadingSlash(url)}`;
216
- };
217
-
218
- export {
219
- pagesData,
220
- usePagesData,
221
- pageDataEmpty,
222
- pageData,
223
- usePageData,
224
- pageFrontmatterSymbol,
225
- usePageFrontmatter,
226
- pageHeadSymbol,
227
- usePageHead,
228
- pageHeadTitleSymbol,
229
- usePageHeadTitle,
230
- pageLangSymbol,
231
- usePageLang,
232
- routeLocaleSymbol,
233
- useRouteLocale,
234
- siteData,
235
- useSiteData,
236
- siteLocaleDataSymbol,
237
- useSiteLocaleData,
238
- updateHeadSymbol,
239
- useUpdateHead,
240
- resolvers,
241
- ClientOnly,
242
- Content,
243
- Vuepress,
244
- withBase
245
- };
@@ -1,9 +0,0 @@
1
- import { App } from 'vue';
2
- import { Router } from 'vue-router';
3
-
4
- declare type CreateVueAppFunction = () => Promise<{
5
- app: App;
6
- router: Router;
7
- }>;
8
-
9
- export { CreateVueAppFunction as C };
package/dist/index.d.ts DELETED
@@ -1,256 +0,0 @@
1
- import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
2
- export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
3
- import * as vue from 'vue';
4
- import { Ref, ComputedRef, InjectionKey, App, Component } from 'vue';
5
- import { Router, RouteMeta } from 'vue-router';
6
- export { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
7
-
8
- /**
9
- * Ref wrapper of `PageData`
10
- */
11
- declare type PageDataRef<T extends Record<any, any> = Record<never, never>> = Ref<PageData<T>>;
12
- /**
13
- * Empty page data to be used as the fallback value
14
- */
15
- declare const pageDataEmpty: PageData<Record<never, never>, Record<string, unknown>>;
16
- /**
17
- * Global page data ref
18
- */
19
- declare const pageData: PageDataRef;
20
- /**
21
- * Returns the ref of the data of current page
22
- */
23
- declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
24
-
25
- /**
26
- * Ref wrapper of `PageFrontmatter`
27
- */
28
- declare type PageFrontmatterRef<T extends Record<any, any> = Record<string, unknown>> = ComputedRef<PageFrontmatter<T>>;
29
- /**
30
- * Injection key for page frontmatter
31
- */
32
- declare const pageFrontmatterSymbol: InjectionKey<PageFrontmatterRef>;
33
- /**
34
- * Returns the ref of the frontmatter of current page
35
- */
36
- declare const usePageFrontmatter: <T extends Record<any, any> = Record<string, unknown>>() => PageFrontmatterRef<T>;
37
-
38
- /**
39
- * Page head config, which would be used for generate html tags in `<head>`
40
- */
41
- declare type PageHead = HeadConfig[];
42
- /**
43
- * Ref wrapper of `PageHead`
44
- */
45
- declare type PageHeadRef = ComputedRef<PageHead>;
46
- /**
47
- * Injection key for page head
48
- */
49
- declare const pageHeadSymbol: InjectionKey<PageHeadRef>;
50
- /**
51
- * Returns the ref of the head config of current page
52
- */
53
- declare const usePageHead: () => PageHeadRef;
54
-
55
- /**
56
- * Page head title, which would be used as the content of `head > title` tag
57
- */
58
- declare type PageHeadTitle = string;
59
- /**
60
- * Ref wrapper of `PageHeadTitle`
61
- */
62
- declare type PageHeadTitleRef = ComputedRef<PageHeadTitle>;
63
- /**
64
- * Injection key for page head title
65
- */
66
- declare const pageHeadTitleSymbol: InjectionKey<PageHeadTitleRef>;
67
- /**
68
- * Returns the ref of the head title of current page
69
- */
70
- declare const usePageHeadTitle: () => PageHeadTitleRef;
71
-
72
- /**
73
- * Page language
74
- */
75
- declare type PageLang = string;
76
- /**
77
- * Ref wrapper of `PageLang`
78
- */
79
- declare type PageLangRef = ComputedRef<PageLang>;
80
- /**
81
- * Injection key for page language
82
- */
83
- declare const pageLangSymbol: InjectionKey<PageLangRef>;
84
- /**
85
- * Returns the ref of the language of current page
86
- */
87
- declare const usePageLang: () => PageLangRef;
88
-
89
- /**
90
- * Data resolvers of all pages
91
- *
92
- * The key is page key, and the value is an async function that
93
- * returns the page data
94
- */
95
- declare type PagesData = Record<string, (() => Promise<PageData>) | undefined>;
96
- /**
97
- * Ref wrapper of `PagesData`
98
- */
99
- declare type PagesDataRef = Ref<PagesData>;
100
- /**
101
- * Global pages data ref
102
- */
103
- declare const pagesData: PagesDataRef;
104
- /**
105
- * Returns the ref of data resolvers of all pages
106
- */
107
- declare const usePagesData: () => PagesDataRef;
108
-
109
- /**
110
- * Route locale path
111
- */
112
- declare type RouteLocale = string;
113
- /**
114
- * Ref wrapper of `RouteLocale`
115
- */
116
- declare type RouteLocaleRef = ComputedRef<RouteLocale>;
117
- /**
118
- * Injection key for page route locale path
119
- */
120
- declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
121
- /**
122
- * Returns the ref of the route locale path of current page
123
- */
124
- declare const useRouteLocale: () => RouteLocaleRef;
125
-
126
- /**
127
- * Ref wrapper of `SiteData`
128
- */
129
- declare type SiteDataRef = Ref<SiteData>;
130
- /**
131
- * Global site data ref
132
- */
133
- declare const siteData: SiteDataRef;
134
- /**
135
- * Returns the ref of the site data
136
- */
137
- declare const useSiteData: () => SiteDataRef;
138
-
139
- /**
140
- * Site data of current locale
141
- */
142
- declare type SiteLocaleData = SiteData;
143
- /**
144
- * Ref wrapper of `SiteLocaleData`
145
- */
146
- declare type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
147
- /**
148
- * Injection key for site locale data
149
- */
150
- declare const siteLocaleDataSymbol: InjectionKey<SiteLocaleDataRef>;
151
- /**
152
- * Returns the ref of the site data of current locale
153
- */
154
- declare const useSiteLocaleData: () => SiteLocaleDataRef;
155
-
156
- /**
157
- * A util function to force update `<head>` of current page
158
- */
159
- declare type UpdateHead = () => void;
160
- /**
161
- * Injection key for `updateHead` util
162
- */
163
- declare const updateHeadSymbol: InjectionKey<UpdateHead>;
164
- /**
165
- * Returns the `updateHead` util
166
- */
167
- declare const useUpdateHead: () => UpdateHead;
168
-
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?: Component[];
190
- }
191
-
192
- declare type PageRouteItem = [
193
- name: string,
194
- path: string,
195
- meta: RouteMeta,
196
- redirects: string[]
197
- ];
198
-
199
- declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
200
- [key: string]: any;
201
- }>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
202
-
203
- /**
204
- * Markdown rendered content
205
- */
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;
222
- }>;
223
-
224
- /**
225
- * Global Layout
226
- */
227
- declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
228
- [key: string]: any;
229
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
230
-
231
- /**
232
- * A helper function to help you define vuepress client config file
233
- */
234
- declare const defineClientConfig: (clientConfig: ClientConfig) => ClientConfig;
235
-
236
- /**
237
- * Resolver methods to get global computed
238
- *
239
- * Users can override corresponding method for advanced customization
240
- */
241
- declare const resolvers: {
242
- resolvePageData: (pageKey: string) => Promise<PageData>;
243
- resolvePageFrontmatter: (pageData: PageData) => PageFrontmatter;
244
- resolvePageHead: (headTitle: PageHeadTitle, frontmatter: PageFrontmatter, siteLocale: SiteLocaleData) => PageHead;
245
- resolvePageHeadTitle: (page: PageData, siteLocale: SiteLocaleData) => PageHeadTitle;
246
- resolvePageLang: (pageData: PageData) => PageLang;
247
- resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
248
- resolveSiteLocaleData: (site: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
249
- };
250
-
251
- /**
252
- * Prefix url with site base
253
- */
254
- declare const withBase: (url: string) => string;
255
-
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 DELETED
@@ -1,60 +0,0 @@
1
- import {
2
- ClientOnly,
3
- Content,
4
- Vuepress,
5
- pageData,
6
- pageDataEmpty,
7
- pageFrontmatterSymbol,
8
- pageHeadSymbol,
9
- pageHeadTitleSymbol,
10
- pageLangSymbol,
11
- pagesData,
12
- resolvers,
13
- routeLocaleSymbol,
14
- siteData,
15
- siteLocaleDataSymbol,
16
- updateHeadSymbol,
17
- usePageData,
18
- usePageFrontmatter,
19
- usePageHead,
20
- usePageHeadTitle,
21
- usePageLang,
22
- usePagesData,
23
- useRouteLocale,
24
- useSiteData,
25
- useSiteLocaleData,
26
- useUpdateHead,
27
- withBase
28
- } from "./chunk-OOQFWU6B.js";
29
-
30
- // src/helpers/defineClientConfig.ts
31
- var defineClientConfig = (clientConfig) => clientConfig;
32
- export {
33
- ClientOnly,
34
- Content,
35
- Vuepress,
36
- defineClientConfig,
37
- pageData,
38
- pageDataEmpty,
39
- pageFrontmatterSymbol,
40
- pageHeadSymbol,
41
- pageHeadTitleSymbol,
42
- pageLangSymbol,
43
- pagesData,
44
- resolvers,
45
- routeLocaleSymbol,
46
- siteData,
47
- siteLocaleDataSymbol,
48
- updateHeadSymbol,
49
- usePageData,
50
- usePageFrontmatter,
51
- usePageHead,
52
- usePageHeadTitle,
53
- usePageLang,
54
- usePagesData,
55
- useRouteLocale,
56
- useSiteData,
57
- useSiteLocaleData,
58
- useUpdateHead,
59
- withBase
60
- };
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="{{ lang }}">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <meta name="generator" content="VuePress {{ version }}">
7
- <!--vuepress-ssr-head-->
8
- <!--vuepress-ssr-resources-->
9
- <!--vuepress-ssr-styles-->
10
- </head>
11
- <body>
12
- <div id="app"><!--vuepress-ssr-app--></div>
13
- <!--vuepress-ssr-scripts-->
14
- </body>
15
- </html>
@@ -1,10 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1">
6
- </head>
7
- <body>
8
- <div id="app"></div>
9
- </body>
10
- </html>
package/types.d.ts DELETED
@@ -1,6 +0,0 @@
1
- declare const __VUEPRESS_VERSION__: string
2
- declare const __VUEPRESS_DEV__: boolean
3
- declare const __VUEPRESS_SSR__: boolean
4
- declare const __VUE_HMR_RUNTIME__: Record<string, any>
5
- declare const __VUE_OPTIONS_API__: boolean
6
- declare const __VUE_PROD_DEVTOOLS__: boolean