@vuepress/client 2.0.0-beta.37 → 2.0.0-beta.40
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 +7 -0
- package/dist/app.js +259 -0
- package/dist/chunk-RTLFYRTT.js +250 -0
- package/dist/createVueAppFunction-c8e67ca1.d.ts +9 -0
- package/dist/index.d.ts +220 -0
- package/dist/index.js +70 -0
- package/package.json +49 -18
- package/templates/{index.build.html → build.html} +0 -0
- package/templates/{index.dev.html → dev.html} +0 -0
- package/lib/app.d.ts +0 -7
- package/lib/app.js +0 -65
- package/lib/components/ClientOnly.d.ts +0 -3
- package/lib/components/ClientOnly.js +0 -10
- package/lib/components/Content.d.ts +0 -7
- package/lib/components/Content.js +0 -34
- package/lib/components/Vuepress.d.ts +0 -6
- package/lib/components/Vuepress.js +0 -38
- package/lib/components/index.d.ts +0 -3
- package/lib/components/index.js +0 -3
- package/lib/composables/index.d.ts +0 -10
- package/lib/composables/index.js +0 -10
- package/lib/composables/pageData.d.ts +0 -19
- package/lib/composables/pageData.js +0 -31
- package/lib/composables/pageFrontmatter.d.ts +0 -15
- package/lib/composables/pageFrontmatter.js +0 -15
- package/lib/composables/pageHead.d.ts +0 -18
- package/lib/composables/pageHead.js +0 -15
- package/lib/composables/pageHeadTitle.d.ts +0 -17
- package/lib/composables/pageHeadTitle.js +0 -15
- package/lib/composables/pageLang.d.ts +0 -17
- package/lib/composables/pageLang.js +0 -15
- package/lib/composables/pagesData.d.ts +0 -21
- package/lib/composables/pagesData.js +0 -10
- package/lib/composables/routeLocale.d.ts +0 -17
- package/lib/composables/routeLocale.js +0 -15
- package/lib/composables/siteData.d.ts +0 -15
- package/lib/composables/siteData.js +0 -16
- package/lib/composables/siteLocaleData.d.ts +0 -18
- package/lib/composables/siteLocaleData.js +0 -15
- package/lib/composables/updateHead.d.ts +0 -13
- package/lib/composables/updateHead.js +0 -15
- package/lib/helpers/defineClientAppEnhance.d.ts +0 -2
- package/lib/helpers/defineClientAppEnhance.js +0 -1
- package/lib/helpers/defineClientAppSetup.d.ts +0 -2
- package/lib/helpers/defineClientAppSetup.js +0 -1
- package/lib/helpers/index.d.ts +0 -3
- package/lib/helpers/index.js +0 -3
- package/lib/helpers/withBase.d.ts +0 -4
- package/lib/helpers/withBase.js +0 -11
- package/lib/index.d.ts +0 -8
- package/lib/index.js +0 -7
- package/lib/resolvers.d.ts +0 -15
- package/lib/resolvers.js +0 -64
- package/lib/router.d.ts +0 -5
- package/lib/router.js +0 -40
- package/lib/setupDevtools.d.ts +0 -3
- package/lib/setupDevtools.js +0 -22
- package/lib/setupGlobalComponents.d.ts +0 -5
- package/lib/setupGlobalComponents.js +0 -10
- package/lib/setupGlobalComputed.d.ts +0 -34
- package/lib/setupGlobalComputed.js +0 -45
- package/lib/setupUpdateHead.d.ts +0 -13
- package/lib/setupUpdateHead.js +0 -101
- package/lib/types/clientAppEnhance.d.ts +0 -8
- package/lib/types/clientAppEnhance.js +0 -1
- package/lib/types/clientAppSetup.d.ts +0 -1
- package/lib/types/clientAppSetup.js +0 -1
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.js +0 -2
- package/lib/types/internal/clientAppEnhances.d.ts +0 -5
- package/lib/types/internal/clientAppRootComponents.d.ts +0 -5
- package/lib/types/internal/clientAppSetups.d.ts +0 -5
- package/lib/types/internal/layoutComponents.d.ts +0 -5
- package/lib/types/internal/pagesComponents.d.ts +0 -5
- package/lib/types/internal/pagesData.d.ts +0 -5
- package/lib/types/internal/pagesRoutes.d.ts +0 -5
- package/lib/types/internal/siteData.d.ts +0 -5
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { PageData, PageFrontmatter, HeadConfig, SiteData } from '@vuepress/shared';
|
|
2
|
+
export { PageData, PageFrontmatter, PageHeader, SiteData } from '@vuepress/shared';
|
|
3
|
+
import { Router } from 'vue-router';
|
|
4
|
+
export { RouterLink, useRoute, useRouter } from 'vue-router';
|
|
5
|
+
import * as vue from 'vue';
|
|
6
|
+
import { Ref, ComputedRef, InjectionKey, App, FunctionalComponent } from 'vue';
|
|
7
|
+
export { C as CreateVueAppFunction } from './createVueAppFunction-c8e67ca1.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Ref wrapper of `PageData`
|
|
11
|
+
*/
|
|
12
|
+
declare type PageDataRef<T extends Record<any, any> = Record<never, never>> = Ref<PageData<T>>;
|
|
13
|
+
/**
|
|
14
|
+
* Empty page data to be used as the fallback value
|
|
15
|
+
*/
|
|
16
|
+
declare const pageDataEmpty: PageData<Record<never, never>, Record<string, unknown>>;
|
|
17
|
+
/**
|
|
18
|
+
* Global page data ref
|
|
19
|
+
*/
|
|
20
|
+
declare const pageData: PageDataRef;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the ref of the data of current page
|
|
23
|
+
*/
|
|
24
|
+
declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Ref wrapper of `PageFrontmatter`
|
|
28
|
+
*/
|
|
29
|
+
declare type PageFrontmatterRef<T extends Record<any, any> = Record<string, unknown>> = ComputedRef<PageFrontmatter<T>>;
|
|
30
|
+
/**
|
|
31
|
+
* Injection key for page frontmatter
|
|
32
|
+
*/
|
|
33
|
+
declare const pageFrontmatterSymbol: InjectionKey<PageFrontmatterRef>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the ref of the frontmatter of current page
|
|
36
|
+
*/
|
|
37
|
+
declare const usePageFrontmatter: <T extends Record<any, any> = Record<string, unknown>>() => PageFrontmatterRef<T>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Page head config, which would be used for generate html tags in `<head>`
|
|
41
|
+
*/
|
|
42
|
+
declare type PageHead = HeadConfig[];
|
|
43
|
+
/**
|
|
44
|
+
* Ref wrapper of `PageHead`
|
|
45
|
+
*/
|
|
46
|
+
declare type PageHeadRef = ComputedRef<PageHead>;
|
|
47
|
+
/**
|
|
48
|
+
* Injection key for page head
|
|
49
|
+
*/
|
|
50
|
+
declare const pageHeadSymbol: InjectionKey<PageHeadRef>;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the ref of the head config of current page
|
|
53
|
+
*/
|
|
54
|
+
declare const usePageHead: () => PageHeadRef;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Page head title, which would be used as the content of `head > title` tag
|
|
58
|
+
*/
|
|
59
|
+
declare type PageHeadTitle = string;
|
|
60
|
+
/**
|
|
61
|
+
* Ref wrapper of `PageHeadTitle`
|
|
62
|
+
*/
|
|
63
|
+
declare type PageHeadTitleRef = ComputedRef<PageHeadTitle>;
|
|
64
|
+
/**
|
|
65
|
+
* Injection key for page head title
|
|
66
|
+
*/
|
|
67
|
+
declare const pageHeadTitleSymbol: InjectionKey<PageHeadTitleRef>;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the ref of the head title of current page
|
|
70
|
+
*/
|
|
71
|
+
declare const usePageHeadTitle: () => PageHeadTitleRef;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Page language
|
|
75
|
+
*/
|
|
76
|
+
declare type PageLang = string;
|
|
77
|
+
/**
|
|
78
|
+
* Ref wrapper of `PageLang`
|
|
79
|
+
*/
|
|
80
|
+
declare type PageLangRef = ComputedRef<PageLang>;
|
|
81
|
+
/**
|
|
82
|
+
* Injection key for page language
|
|
83
|
+
*/
|
|
84
|
+
declare const pageLangSymbol: InjectionKey<PageLangRef>;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the ref of the language of current page
|
|
87
|
+
*/
|
|
88
|
+
declare const usePageLang: () => PageLangRef;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Data resolvers of all pages
|
|
92
|
+
*
|
|
93
|
+
* The key is page key, and the value is an async function that
|
|
94
|
+
* returns the page data
|
|
95
|
+
*/
|
|
96
|
+
declare type PagesData = Record<string, (() => Promise<PageData>) | undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Ref wrapper of `PagesData`
|
|
99
|
+
*/
|
|
100
|
+
declare type PagesDataRef = Ref<PagesData>;
|
|
101
|
+
/**
|
|
102
|
+
* Global pages data ref
|
|
103
|
+
*/
|
|
104
|
+
declare const pagesData: PagesDataRef;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the ref of data resolvers of all pages
|
|
107
|
+
*/
|
|
108
|
+
declare const usePagesData: () => PagesDataRef;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Route locale path
|
|
112
|
+
*/
|
|
113
|
+
declare type RouteLocale = string;
|
|
114
|
+
/**
|
|
115
|
+
* Ref wrapper of `RouteLocale`
|
|
116
|
+
*/
|
|
117
|
+
declare type RouteLocaleRef = ComputedRef<RouteLocale>;
|
|
118
|
+
/**
|
|
119
|
+
* Injection key for page route locale path
|
|
120
|
+
*/
|
|
121
|
+
declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
|
|
122
|
+
/**
|
|
123
|
+
* Returns the ref of the route locale path of current page
|
|
124
|
+
*/
|
|
125
|
+
declare const useRouteLocale: () => RouteLocaleRef;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Ref wrapper of `SiteData`
|
|
129
|
+
*/
|
|
130
|
+
declare type SiteDataRef = Ref<SiteData>;
|
|
131
|
+
/**
|
|
132
|
+
* Global site data ref
|
|
133
|
+
*/
|
|
134
|
+
declare const siteData: SiteDataRef;
|
|
135
|
+
/**
|
|
136
|
+
* Returns the ref of the site data
|
|
137
|
+
*/
|
|
138
|
+
declare const useSiteData: () => SiteDataRef;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Site data of current locale
|
|
142
|
+
*/
|
|
143
|
+
declare type SiteLocaleData = SiteData;
|
|
144
|
+
/**
|
|
145
|
+
* Ref wrapper of `SiteLocaleData`
|
|
146
|
+
*/
|
|
147
|
+
declare type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
|
|
148
|
+
/**
|
|
149
|
+
* Injection key for site locale data
|
|
150
|
+
*/
|
|
151
|
+
declare const siteLocaleDataSymbol: InjectionKey<SiteLocaleDataRef>;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the ref of the site data of current locale
|
|
154
|
+
*/
|
|
155
|
+
declare const useSiteLocaleData: () => SiteLocaleDataRef;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A util function to force update `<head>` of current page
|
|
159
|
+
*/
|
|
160
|
+
declare type UpdateHead = () => void;
|
|
161
|
+
/**
|
|
162
|
+
* Injection key for `updateHead` util
|
|
163
|
+
*/
|
|
164
|
+
declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
165
|
+
/**
|
|
166
|
+
* Returns the `updateHead` util
|
|
167
|
+
*/
|
|
168
|
+
declare const useUpdateHead: () => UpdateHead;
|
|
169
|
+
|
|
170
|
+
declare type ClientAppEnhance = (context: {
|
|
171
|
+
app: App;
|
|
172
|
+
router: Router;
|
|
173
|
+
siteData: SiteDataRef;
|
|
174
|
+
}) => void | Promise<void>;
|
|
175
|
+
|
|
176
|
+
declare type ClientAppSetup = () => void;
|
|
177
|
+
|
|
178
|
+
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
179
|
+
[key: string]: any;
|
|
180
|
+
}>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Markdown rendered content
|
|
184
|
+
*/
|
|
185
|
+
declare const Content: FunctionalComponent<{
|
|
186
|
+
pageKey?: string;
|
|
187
|
+
}>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Global Layout
|
|
191
|
+
*/
|
|
192
|
+
declare const Vuepress: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
|
|
195
|
+
|
|
196
|
+
declare const defineClientAppEnhance: (clientAppEnhance: ClientAppEnhance) => ClientAppEnhance;
|
|
197
|
+
|
|
198
|
+
declare const defineClientAppSetup: (clientAppSetup: ClientAppSetup) => ClientAppSetup;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Resolver methods to get global computed
|
|
202
|
+
*
|
|
203
|
+
* Users can override corresponding method for advanced customization
|
|
204
|
+
*/
|
|
205
|
+
declare const resolvers: {
|
|
206
|
+
resolvePageData: (pageKey: string) => Promise<PageData>;
|
|
207
|
+
resolvePageFrontmatter: (pageData: PageData) => PageFrontmatter;
|
|
208
|
+
resolvePageHead: (headTitle: PageHeadTitle, frontmatter: PageFrontmatter, siteLocale: SiteLocaleData) => PageHead;
|
|
209
|
+
resolvePageHeadTitle: (page: PageData, siteLocale: SiteLocaleData) => PageHeadTitle;
|
|
210
|
+
resolvePageLang: (pageData: PageData) => PageLang;
|
|
211
|
+
resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
|
|
212
|
+
resolveSiteLocaleData: (site: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Prefix url with site base
|
|
217
|
+
*/
|
|
218
|
+
declare const withBase: (url: string) => string;
|
|
219
|
+
|
|
220
|
+
export { ClientAppEnhance, ClientAppSetup, ClientOnly, Content, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, Vuepress, defineClientAppEnhance, defineClientAppSetup, 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
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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-RTLFYRTT.js";
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
import { RouterLink, useRoute, useRouter } from "vue-router";
|
|
32
|
+
|
|
33
|
+
// src/helpers/defineClientAppEnhance.ts
|
|
34
|
+
var defineClientAppEnhance = (clientAppEnhance) => clientAppEnhance;
|
|
35
|
+
|
|
36
|
+
// src/helpers/defineClientAppSetup.ts
|
|
37
|
+
var defineClientAppSetup = (clientAppSetup) => clientAppSetup;
|
|
38
|
+
export {
|
|
39
|
+
ClientOnly,
|
|
40
|
+
Content,
|
|
41
|
+
RouterLink,
|
|
42
|
+
Vuepress,
|
|
43
|
+
defineClientAppEnhance,
|
|
44
|
+
defineClientAppSetup,
|
|
45
|
+
pageData,
|
|
46
|
+
pageDataEmpty,
|
|
47
|
+
pageFrontmatterSymbol,
|
|
48
|
+
pageHeadSymbol,
|
|
49
|
+
pageHeadTitleSymbol,
|
|
50
|
+
pageLangSymbol,
|
|
51
|
+
pagesData,
|
|
52
|
+
resolvers,
|
|
53
|
+
routeLocaleSymbol,
|
|
54
|
+
siteData,
|
|
55
|
+
siteLocaleDataSymbol,
|
|
56
|
+
updateHeadSymbol,
|
|
57
|
+
usePageData,
|
|
58
|
+
usePageFrontmatter,
|
|
59
|
+
usePageHead,
|
|
60
|
+
usePageHeadTitle,
|
|
61
|
+
usePageLang,
|
|
62
|
+
usePagesData,
|
|
63
|
+
useRoute,
|
|
64
|
+
useRouteLocale,
|
|
65
|
+
useRouter,
|
|
66
|
+
useSiteData,
|
|
67
|
+
useSiteLocaleData,
|
|
68
|
+
useUpdateHead,
|
|
69
|
+
withBase
|
|
70
|
+
};
|
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.40",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -15,31 +15,62 @@
|
|
|
15
15
|
"url": "git+https://github.com/vuepress/vuepress-next.git"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"author": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"author": "meteorlxy",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./dist/index.js",
|
|
22
|
+
"./app": "./dist/app.js",
|
|
23
|
+
"./helpers": "./helpers/index.js",
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
"./templates/*": "./templates/*",
|
|
26
|
+
"./types": "./types.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
21
31
|
"files": [
|
|
22
|
-
"
|
|
32
|
+
"dist",
|
|
23
33
|
"templates",
|
|
24
34
|
"types.d.ts"
|
|
25
35
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc -b tsconfig.build.json",
|
|
28
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
29
|
-
"copy": "cpx \"src/**/*.{d.ts,css}\" lib"
|
|
30
|
-
},
|
|
31
36
|
"dependencies": {
|
|
32
37
|
"@vue/devtools-api": "^6.1.4",
|
|
33
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
34
|
-
"vue": "^3.2.
|
|
38
|
+
"@vuepress/shared": "2.0.0-beta.40",
|
|
39
|
+
"vue": "^3.2.33",
|
|
35
40
|
"vue-router": "^4.0.14"
|
|
36
41
|
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@types/webpack-env": "^1.16.3",
|
|
39
|
-
"vite": "~2.8.6"
|
|
40
|
-
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
45
|
+
"tsup": {
|
|
46
|
+
"clean": true,
|
|
47
|
+
"dts": [
|
|
48
|
+
"src/index.ts"
|
|
49
|
+
],
|
|
50
|
+
"entry": [
|
|
51
|
+
"src/app.ts",
|
|
52
|
+
"src/index.ts"
|
|
53
|
+
],
|
|
54
|
+
"external": [
|
|
55
|
+
"@internal/clientAppEnhances",
|
|
56
|
+
"@internal/clientAppRootComponents",
|
|
57
|
+
"@internal/clientAppSetups",
|
|
58
|
+
"@internal/layoutComponents",
|
|
59
|
+
"@internal/pagesComponents",
|
|
60
|
+
"@internal/pagesData",
|
|
61
|
+
"@internal/pagesRoutes",
|
|
62
|
+
"@internal/siteData"
|
|
63
|
+
],
|
|
64
|
+
"format": [
|
|
65
|
+
"esm"
|
|
66
|
+
],
|
|
67
|
+
"outDir": "dist",
|
|
68
|
+
"sourcemap": false,
|
|
69
|
+
"target": "es2020",
|
|
70
|
+
"tsconfig": "tsconfig.dts.json"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsup",
|
|
74
|
+
"clean": "rimraf dist"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
File without changes
|
|
File without changes
|
package/lib/app.d.ts
DELETED
package/lib/app.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { clientAppEnhances } from '@internal/clientAppEnhances';
|
|
2
|
-
import { clientAppRootComponents } from '@internal/clientAppRootComponents';
|
|
3
|
-
import { clientAppSetups } from '@internal/clientAppSetups';
|
|
4
|
-
import { createApp, createSSRApp, h } from 'vue';
|
|
5
|
-
import { RouterView } from 'vue-router';
|
|
6
|
-
import { siteData } from './composables';
|
|
7
|
-
import { createVueRouter } from './router';
|
|
8
|
-
import { setupDevtools } from './setupDevtools';
|
|
9
|
-
import { setupGlobalComponents } from './setupGlobalComponents';
|
|
10
|
-
import { setupGlobalComputed } from './setupGlobalComputed';
|
|
11
|
-
import { setupUpdateHead } from './setupUpdateHead';
|
|
12
|
-
/**
|
|
13
|
-
* - use `createApp` in dev mode
|
|
14
|
-
* - use `createSSRApp` in build mode
|
|
15
|
-
*/
|
|
16
|
-
const appCreator = __VUEPRESS_DEV__ ? createApp : createSSRApp;
|
|
17
|
-
export const createVueApp = async () => {
|
|
18
|
-
// create vue app
|
|
19
|
-
const app = appCreator({
|
|
20
|
-
name: 'VuepressApp',
|
|
21
|
-
setup() {
|
|
22
|
-
// auto update head
|
|
23
|
-
setupUpdateHead();
|
|
24
|
-
// invoke all clientAppSetups
|
|
25
|
-
for (const clientAppSetup of clientAppSetups) {
|
|
26
|
-
clientAppSetup();
|
|
27
|
-
}
|
|
28
|
-
return () => [
|
|
29
|
-
h(RouterView),
|
|
30
|
-
...clientAppRootComponents.map((comp) => h(comp)),
|
|
31
|
-
];
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
// create vue-router instance
|
|
35
|
-
const router = createVueRouter();
|
|
36
|
-
// global components and computed
|
|
37
|
-
setupGlobalComponents(app);
|
|
38
|
-
const globalComputed = setupGlobalComputed(app, router);
|
|
39
|
-
// setup devtools in dev mode
|
|
40
|
-
if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) {
|
|
41
|
-
setupDevtools(app, globalComputed);
|
|
42
|
-
}
|
|
43
|
-
// invoke all clientAppEnhances
|
|
44
|
-
for (const clientAppEnhance of clientAppEnhances) {
|
|
45
|
-
await clientAppEnhance({ app, router, siteData });
|
|
46
|
-
}
|
|
47
|
-
// vue-router will start to initialize once it is installed
|
|
48
|
-
// via `app.use()`, but users might make some modifications
|
|
49
|
-
// to router in `clientAppEnhance`, so we install it after
|
|
50
|
-
// that. This can also avoid the `scrollBehavior` issue on
|
|
51
|
-
// initial navigation.
|
|
52
|
-
app.use(router);
|
|
53
|
-
return {
|
|
54
|
-
app,
|
|
55
|
-
router,
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
// mount app in client bundle
|
|
59
|
-
if (!__VUEPRESS_SSR__) {
|
|
60
|
-
createVueApp().then(({ app, router }) => {
|
|
61
|
-
router.isReady().then(() => {
|
|
62
|
-
app.mount('#app');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const ClientOnly: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}>[] | null | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { defineComponent, onMounted, ref } from 'vue';
|
|
2
|
-
export const ClientOnly = defineComponent({
|
|
3
|
-
setup(_, ctx) {
|
|
4
|
-
const isMounted = ref(false);
|
|
5
|
-
onMounted(() => {
|
|
6
|
-
isMounted.value = true;
|
|
7
|
-
});
|
|
8
|
-
return () => { var _a, _b; return (isMounted.value ? (_b = (_a = ctx.slots).default) === null || _b === void 0 ? void 0 : _b.call(_a) : null); };
|
|
9
|
-
},
|
|
10
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { pagesComponents } from '@internal/pagesComponents';
|
|
2
|
-
import { h } from 'vue';
|
|
3
|
-
import { usePageData } from '../composables';
|
|
4
|
-
/**
|
|
5
|
-
* Markdown rendered content
|
|
6
|
-
*/
|
|
7
|
-
export const Content = (props) => {
|
|
8
|
-
let key;
|
|
9
|
-
// use the page key from props directly
|
|
10
|
-
if (props.pageKey) {
|
|
11
|
-
key = props.pageKey;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// get current page key from page data
|
|
15
|
-
const page = usePageData();
|
|
16
|
-
key = page.value.key;
|
|
17
|
-
}
|
|
18
|
-
const component = pagesComponents[key];
|
|
19
|
-
// use page component
|
|
20
|
-
if (component) {
|
|
21
|
-
return h(component);
|
|
22
|
-
}
|
|
23
|
-
// fallback
|
|
24
|
-
return h('div', __VUEPRESS_DEV__
|
|
25
|
-
? 'Page does not exist. This is a fallback content.'
|
|
26
|
-
: '404 Not Found');
|
|
27
|
-
};
|
|
28
|
-
Content.displayName = 'Content';
|
|
29
|
-
Content.props = {
|
|
30
|
-
pageKey: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: false,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Global Layout
|
|
3
|
-
*/
|
|
4
|
-
export declare const Vuepress: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { layoutComponents } from '@internal/layoutComponents';
|
|
2
|
-
import { isString } from '@vuepress/shared';
|
|
3
|
-
import { computed, defineComponent, h, resolveComponent } from 'vue';
|
|
4
|
-
import { usePageData } from '../composables';
|
|
5
|
-
/**
|
|
6
|
-
* Global Layout
|
|
7
|
-
*/
|
|
8
|
-
export const Vuepress = defineComponent({
|
|
9
|
-
name: 'Vuepress',
|
|
10
|
-
setup() {
|
|
11
|
-
const page = usePageData();
|
|
12
|
-
// resolve layout component
|
|
13
|
-
const layoutComponent = computed(() => {
|
|
14
|
-
// resolve layout name of current page
|
|
15
|
-
let layoutName;
|
|
16
|
-
if (page.value.path) {
|
|
17
|
-
// if current page exists
|
|
18
|
-
// use layout from frontmatter
|
|
19
|
-
const frontmatterLayout = page.value.frontmatter.layout;
|
|
20
|
-
if (isString(frontmatterLayout)) {
|
|
21
|
-
layoutName = frontmatterLayout;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
// fallback to default layout
|
|
25
|
-
layoutName = 'Layout';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// if current page does not exist
|
|
30
|
-
// use 404 layout
|
|
31
|
-
layoutName = '404';
|
|
32
|
-
}
|
|
33
|
-
// use theme layout or fallback to custom layout
|
|
34
|
-
return layoutComponents[layoutName] || resolveComponent(layoutName, false);
|
|
35
|
-
});
|
|
36
|
-
return () => h(layoutComponent.value);
|
|
37
|
-
},
|
|
38
|
-
});
|
package/lib/components/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './pageData';
|
|
2
|
-
export * from './pageFrontmatter';
|
|
3
|
-
export * from './pageHead';
|
|
4
|
-
export * from './pageHeadTitle';
|
|
5
|
-
export * from './pageLang';
|
|
6
|
-
export * from './pagesData';
|
|
7
|
-
export * from './routeLocale';
|
|
8
|
-
export * from './siteData';
|
|
9
|
-
export * from './siteLocaleData';
|
|
10
|
-
export * from './updateHead';
|
package/lib/composables/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './pageData';
|
|
2
|
-
export * from './pageFrontmatter';
|
|
3
|
-
export * from './pageHead';
|
|
4
|
-
export * from './pageHeadTitle';
|
|
5
|
-
export * from './pageLang';
|
|
6
|
-
export * from './pagesData';
|
|
7
|
-
export * from './routeLocale';
|
|
8
|
-
export * from './siteData';
|
|
9
|
-
export * from './siteLocaleData';
|
|
10
|
-
export * from './updateHead';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { PageData } from '@vuepress/shared';
|
|
2
|
-
import type { Ref } from 'vue';
|
|
3
|
-
export type { PageData };
|
|
4
|
-
/**
|
|
5
|
-
* Ref wrapper of `PageData`
|
|
6
|
-
*/
|
|
7
|
-
export declare type PageDataRef<T extends Record<any, any> = Record<never, never>> = Ref<PageData<T>>;
|
|
8
|
-
/**
|
|
9
|
-
* Empty page data to be used as the fallback value
|
|
10
|
-
*/
|
|
11
|
-
export declare const pageDataEmpty: PageData<Record<never, never>>;
|
|
12
|
-
/**
|
|
13
|
-
* Global page data ref
|
|
14
|
-
*/
|
|
15
|
-
export declare const pageData: PageDataRef;
|
|
16
|
-
/**
|
|
17
|
-
* Returns the ref of the data of current page
|
|
18
|
-
*/
|
|
19
|
-
export declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { readonly, ref } from 'vue';
|
|
2
|
-
import { pagesData } from './pagesData';
|
|
3
|
-
/**
|
|
4
|
-
* Empty page data to be used as the fallback value
|
|
5
|
-
*/
|
|
6
|
-
export const pageDataEmpty = readonly({
|
|
7
|
-
key: '',
|
|
8
|
-
path: '',
|
|
9
|
-
title: '',
|
|
10
|
-
lang: '',
|
|
11
|
-
frontmatter: {},
|
|
12
|
-
excerpt: '',
|
|
13
|
-
headers: [],
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* Global page data ref
|
|
17
|
-
*/
|
|
18
|
-
export const pageData = ref(pageDataEmpty);
|
|
19
|
-
/**
|
|
20
|
-
* Returns the ref of the data of current page
|
|
21
|
-
*/
|
|
22
|
-
export const usePageData = () => pageData;
|
|
23
|
-
if (import.meta.webpackHot || import.meta.hot) {
|
|
24
|
-
// reuse vue HMR runtime
|
|
25
|
-
__VUE_HMR_RUNTIME__.updatePageData = (data) => {
|
|
26
|
-
pagesData.value[data.key] = () => Promise.resolve(data);
|
|
27
|
-
if (data.key === pageData.value.key) {
|
|
28
|
-
pageData.value = data;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PageFrontmatter } from '@vuepress/shared';
|
|
2
|
-
import type { ComputedRef, InjectionKey } from 'vue';
|
|
3
|
-
export type { PageFrontmatter };
|
|
4
|
-
/**
|
|
5
|
-
* Ref wrapper of `PageFrontmatter`
|
|
6
|
-
*/
|
|
7
|
-
export declare type PageFrontmatterRef<T extends Record<any, any> = Record<string, unknown>> = ComputedRef<PageFrontmatter<T>>;
|
|
8
|
-
/**
|
|
9
|
-
* Injection key for page frontmatter
|
|
10
|
-
*/
|
|
11
|
-
export declare const pageFrontmatterSymbol: InjectionKey<PageFrontmatterRef>;
|
|
12
|
-
/**
|
|
13
|
-
* Returns the ref of the frontmatter of current page
|
|
14
|
-
*/
|
|
15
|
-
export declare const usePageFrontmatter: <T extends Record<any, any> = Record<string, unknown>>() => PageFrontmatterRef<T>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { inject } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* Injection key for page frontmatter
|
|
4
|
-
*/
|
|
5
|
-
export const pageFrontmatterSymbol = Symbol(__VUEPRESS_DEV__ ? 'pageFrontmatter' : '');
|
|
6
|
-
/**
|
|
7
|
-
* Returns the ref of the frontmatter of current page
|
|
8
|
-
*/
|
|
9
|
-
export const usePageFrontmatter = () => {
|
|
10
|
-
const pageFrontmatter = inject(pageFrontmatterSymbol);
|
|
11
|
-
if (!pageFrontmatter) {
|
|
12
|
-
throw new Error('usePageFrontmatter() is called without provider.');
|
|
13
|
-
}
|
|
14
|
-
return pageFrontmatter;
|
|
15
|
-
};
|