@vuepress/client 2.0.0-beta.9 → 2.0.0-rc.0
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 +333 -0
- package/dist/chunk-DHNSDB55.js +338 -0
- package/dist/index.d.ts +287 -0
- package/dist/index.js +64 -0
- package/dist/setupDevtools-X4YFRK4B.js +89 -0
- package/package.json +47 -15
- package/templates/build.html +16 -0
- package/templates/{index.dev.html → dev.html} +2 -0
- package/types.d.ts +6 -3
- package/CHANGELOG.md +0 -229
- package/lib/app.d.ts +0 -18
- package/lib/app.js +0 -139
- package/lib/client.d.ts +0 -1
- package/lib/client.js +0 -14
- package/lib/components/Content.d.ts +0 -7
- package/lib/components/Content.js +0 -34
- package/lib/components/OutboundLink.css +0 -7
- package/lib/components/OutboundLink.d.ts +0 -3
- package/lib/components/OutboundLink.js +0 -24
- package/lib/components/Vuepress.d.ts +0 -5
- package/lib/components/Vuepress.js +0 -33
- package/lib/components/index.d.ts +0 -3
- package/lib/components/index.js +0 -3
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -5
- package/lib/injections/index.d.ts +0 -10
- package/lib/injections/index.js +0 -10
- package/lib/injections/pageData.d.ts +0 -7
- package/lib/injections/pageData.js +0 -32
- package/lib/injections/pageFrontmatter.d.ts +0 -7
- package/lib/injections/pageFrontmatter.js +0 -10
- package/lib/injections/pageHead.d.ts +0 -15
- package/lib/injections/pageHead.js +0 -33
- package/lib/injections/pageHeadTitle.d.ts +0 -11
- package/lib/injections/pageHeadTitle.js +0 -13
- package/lib/injections/pageLang.d.ts +0 -13
- package/lib/injections/pageLang.js +0 -16
- package/lib/injections/pagesData.d.ts +0 -6
- package/lib/injections/pagesData.js +0 -6
- package/lib/injections/routeLocale.d.ts +0 -10
- package/lib/injections/routeLocale.js +0 -14
- package/lib/injections/siteData.d.ts +0 -6
- package/lib/injections/siteData.js +0 -10
- package/lib/injections/siteLocaleData.d.ts +0 -12
- package/lib/injections/siteLocaleData.js +0 -17
- package/lib/injections/updateHead.d.ts +0 -15
- package/lib/injections/updateHead.js +0 -100
- package/lib/server.d.ts +0 -8
- package/lib/server.js +0 -10
- 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 -7
- 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/pagesComponent.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/lib/utils/defineClientAppEnhance.d.ts +0 -2
- package/lib/utils/defineClientAppEnhance.js +0 -1
- package/lib/utils/defineClientAppSetup.d.ts +0 -2
- package/lib/utils/defineClientAppSetup.js +0 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -3
- package/lib/utils/withBase.d.ts +0 -4
- package/lib/utils/withBase.js +0 -11
- package/templates/index.ssr.html +0 -12
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
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 { Component, App, ComputedRef, InjectionKey, Ref } from 'vue';
|
|
5
|
+
import { Router, RouteMeta } from 'vue-router';
|
|
6
|
+
|
|
7
|
+
declare const ClientOnly: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}>[] | null | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Markdown rendered content
|
|
13
|
+
*/
|
|
14
|
+
declare const Content: vue.DefineComponent<{
|
|
15
|
+
pageKey: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: false;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
23
|
+
pageKey: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
required: false;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
}>>, {
|
|
29
|
+
pageKey: string;
|
|
30
|
+
}, {}>;
|
|
31
|
+
|
|
32
|
+
type Layouts = Record<string, Component>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Configure vuepress client
|
|
36
|
+
*/
|
|
37
|
+
interface ClientConfig {
|
|
38
|
+
/**
|
|
39
|
+
* An enhance function to be called after vue app instance and
|
|
40
|
+
* vue-router instance has been created
|
|
41
|
+
*/
|
|
42
|
+
enhance?: (context: {
|
|
43
|
+
app: App;
|
|
44
|
+
router: Router;
|
|
45
|
+
siteData: SiteDataRef;
|
|
46
|
+
}) => void | Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* A function to be called inside the setup function of vue app
|
|
49
|
+
*/
|
|
50
|
+
setup?: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Layout components
|
|
53
|
+
*/
|
|
54
|
+
layouts?: Layouts;
|
|
55
|
+
/**
|
|
56
|
+
* Components to be placed directly into the root node of vue app
|
|
57
|
+
*/
|
|
58
|
+
rootComponents?: Component[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type CreateVueAppFunction = () => Promise<{
|
|
62
|
+
app: App;
|
|
63
|
+
router: Router;
|
|
64
|
+
}>;
|
|
65
|
+
|
|
66
|
+
type PageRouteItem = [
|
|
67
|
+
name: string,
|
|
68
|
+
path: string,
|
|
69
|
+
meta: RouteMeta,
|
|
70
|
+
redirects: string[]
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Ref wrapper of `Layouts`
|
|
75
|
+
*/
|
|
76
|
+
type LayoutsRef = ComputedRef<Layouts>;
|
|
77
|
+
/**
|
|
78
|
+
* Injection key for layouts
|
|
79
|
+
*/
|
|
80
|
+
declare const layoutsSymbol: InjectionKey<LayoutsRef>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns layouts component map
|
|
83
|
+
*/
|
|
84
|
+
declare const useLayouts: () => LayoutsRef;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Ref wrapper of `PageData`
|
|
88
|
+
*/
|
|
89
|
+
type PageDataRef<T extends Record<any, any> = Record<never, never>> = Ref<PageData<T>>;
|
|
90
|
+
/**
|
|
91
|
+
* Injection key for page data
|
|
92
|
+
*/
|
|
93
|
+
declare const pageDataSymbol: InjectionKey<PageDataRef>;
|
|
94
|
+
/**
|
|
95
|
+
* Empty page data to be used as the fallback value
|
|
96
|
+
*/
|
|
97
|
+
declare const pageDataEmpty: PageData;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the ref of the data of current page
|
|
100
|
+
*/
|
|
101
|
+
declare const usePageData: <T extends Record<any, any> = Record<never, never>>() => PageDataRef<T>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Ref wrapper of `PageFrontmatter`
|
|
105
|
+
*/
|
|
106
|
+
type PageFrontmatterRef<T extends Record<any, any> = Record<string, unknown>> = ComputedRef<PageFrontmatter<T>>;
|
|
107
|
+
/**
|
|
108
|
+
* Injection key for page frontmatter
|
|
109
|
+
*/
|
|
110
|
+
declare const pageFrontmatterSymbol: InjectionKey<PageFrontmatterRef>;
|
|
111
|
+
/**
|
|
112
|
+
* Returns the ref of the frontmatter of current page
|
|
113
|
+
*/
|
|
114
|
+
declare const usePageFrontmatter: <T extends Record<any, any> = Record<string, unknown>>() => PageFrontmatterRef<T>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Page head config, which would be used for generate html tags in `<head>`
|
|
118
|
+
*/
|
|
119
|
+
type PageHead = HeadConfig[];
|
|
120
|
+
/**
|
|
121
|
+
* Ref wrapper of `PageHead`
|
|
122
|
+
*/
|
|
123
|
+
type PageHeadRef = ComputedRef<PageHead>;
|
|
124
|
+
/**
|
|
125
|
+
* Injection key for page head
|
|
126
|
+
*/
|
|
127
|
+
declare const pageHeadSymbol: InjectionKey<PageHeadRef>;
|
|
128
|
+
/**
|
|
129
|
+
* Returns the ref of the head config of current page
|
|
130
|
+
*/
|
|
131
|
+
declare const usePageHead: () => PageHeadRef;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Page head title, which would be used as the content of `head > title` tag
|
|
135
|
+
*/
|
|
136
|
+
type PageHeadTitle = string;
|
|
137
|
+
/**
|
|
138
|
+
* Ref wrapper of `PageHeadTitle`
|
|
139
|
+
*/
|
|
140
|
+
type PageHeadTitleRef = ComputedRef<PageHeadTitle>;
|
|
141
|
+
/**
|
|
142
|
+
* Injection key for page head title
|
|
143
|
+
*/
|
|
144
|
+
declare const pageHeadTitleSymbol: InjectionKey<PageHeadTitleRef>;
|
|
145
|
+
/**
|
|
146
|
+
* Returns the ref of the head title of current page
|
|
147
|
+
*/
|
|
148
|
+
declare const usePageHeadTitle: () => PageHeadTitleRef;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Page language
|
|
152
|
+
*/
|
|
153
|
+
type PageLang = string;
|
|
154
|
+
/**
|
|
155
|
+
* Ref wrapper of `PageLang`
|
|
156
|
+
*/
|
|
157
|
+
type PageLangRef = ComputedRef<PageLang>;
|
|
158
|
+
/**
|
|
159
|
+
* Injection key for page language
|
|
160
|
+
*/
|
|
161
|
+
declare const pageLangSymbol: InjectionKey<PageLangRef>;
|
|
162
|
+
/**
|
|
163
|
+
* Returns the ref of the language of current page
|
|
164
|
+
*/
|
|
165
|
+
declare const usePageLang: () => PageLangRef;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Ref wrapper of `PageLayout`
|
|
169
|
+
*/
|
|
170
|
+
type PageLayoutRef = ComputedRef<Component>;
|
|
171
|
+
/**
|
|
172
|
+
* Injection key for page layout
|
|
173
|
+
*/
|
|
174
|
+
declare const pageLayoutSymbol: InjectionKey<PageLayoutRef>;
|
|
175
|
+
/**
|
|
176
|
+
* Returns layout component of current page
|
|
177
|
+
*/
|
|
178
|
+
declare const usePageLayout: () => ComputedRef<Component>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Data resolvers of all pages
|
|
182
|
+
*
|
|
183
|
+
* The key is page key, and the value is an async function that
|
|
184
|
+
* returns the page data
|
|
185
|
+
*/
|
|
186
|
+
type PagesData = Record<string, (() => Promise<PageData>) | undefined>;
|
|
187
|
+
/**
|
|
188
|
+
* Ref wrapper of `PagesData`
|
|
189
|
+
*/
|
|
190
|
+
type PagesDataRef = Ref<PagesData>;
|
|
191
|
+
/**
|
|
192
|
+
* Global pages data ref
|
|
193
|
+
*/
|
|
194
|
+
declare const pagesData: PagesDataRef;
|
|
195
|
+
/**
|
|
196
|
+
* Returns the ref of data resolvers of all pages
|
|
197
|
+
*/
|
|
198
|
+
declare const usePagesData: () => PagesDataRef;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Route locale path
|
|
202
|
+
*/
|
|
203
|
+
type RouteLocale = string;
|
|
204
|
+
/**
|
|
205
|
+
* Ref wrapper of `RouteLocale`
|
|
206
|
+
*/
|
|
207
|
+
type RouteLocaleRef = Readonly<Ref<RouteLocale>>;
|
|
208
|
+
/**
|
|
209
|
+
* Injection key for page route locale path
|
|
210
|
+
*/
|
|
211
|
+
declare const routeLocaleSymbol: InjectionKey<RouteLocaleRef>;
|
|
212
|
+
/**
|
|
213
|
+
* Returns the ref of the route locale path of current page
|
|
214
|
+
*/
|
|
215
|
+
declare const useRouteLocale: () => RouteLocaleRef;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Ref wrapper of `SiteData`
|
|
219
|
+
*/
|
|
220
|
+
type SiteDataRef = Ref<SiteData>;
|
|
221
|
+
/**
|
|
222
|
+
* Global site data ref
|
|
223
|
+
*/
|
|
224
|
+
declare const siteData: SiteDataRef;
|
|
225
|
+
/**
|
|
226
|
+
* Returns the ref of the site data
|
|
227
|
+
*/
|
|
228
|
+
declare const useSiteData: () => SiteDataRef;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Site data of current locale
|
|
232
|
+
*/
|
|
233
|
+
type SiteLocaleData = SiteData;
|
|
234
|
+
/**
|
|
235
|
+
* Ref wrapper of `SiteLocaleData`
|
|
236
|
+
*/
|
|
237
|
+
type SiteLocaleDataRef = ComputedRef<SiteLocaleData>;
|
|
238
|
+
/**
|
|
239
|
+
* Injection key for site locale data
|
|
240
|
+
*/
|
|
241
|
+
declare const siteLocaleDataSymbol: InjectionKey<SiteLocaleDataRef>;
|
|
242
|
+
/**
|
|
243
|
+
* Returns the ref of the site data of current locale
|
|
244
|
+
*/
|
|
245
|
+
declare const useSiteLocaleData: () => SiteLocaleDataRef;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A util function to force update `<head>` of current page
|
|
249
|
+
*/
|
|
250
|
+
type UpdateHead = () => void;
|
|
251
|
+
/**
|
|
252
|
+
* Injection key for `updateHead` util
|
|
253
|
+
*/
|
|
254
|
+
declare const updateHeadSymbol: InjectionKey<UpdateHead>;
|
|
255
|
+
/**
|
|
256
|
+
* Returns the `updateHead` util
|
|
257
|
+
*/
|
|
258
|
+
declare const useUpdateHead: () => UpdateHead;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A helper function to help you define vuepress client config file
|
|
262
|
+
*/
|
|
263
|
+
declare const defineClientConfig: (clientConfig?: ClientConfig) => ClientConfig;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Prefix url with site base
|
|
267
|
+
*/
|
|
268
|
+
declare const withBase: (url: string) => string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Resolver methods to get global computed
|
|
272
|
+
*
|
|
273
|
+
* Users can override corresponding method for advanced customization
|
|
274
|
+
*/
|
|
275
|
+
declare const resolvers: {
|
|
276
|
+
resolveLayouts: (clientConfigs: ClientConfig[]) => Layouts;
|
|
277
|
+
resolvePageData: (pageKey: string) => Promise<PageData>;
|
|
278
|
+
resolvePageFrontmatter: (pageData: PageData) => PageFrontmatter;
|
|
279
|
+
resolvePageHead: (headTitle: PageHeadTitle, frontmatter: PageFrontmatter, siteLocale: SiteLocaleData) => PageHead;
|
|
280
|
+
resolvePageHeadTitle: (page: PageData, siteLocale: SiteLocaleData) => PageHeadTitle;
|
|
281
|
+
resolvePageLang: (page: PageData, siteLocale: SiteLocaleData) => PageLang;
|
|
282
|
+
resolvePageLayout: (page: PageData, layouts: Layouts) => Component;
|
|
283
|
+
resolveRouteLocale: (locales: SiteData['locales'], routePath: string) => RouteLocale;
|
|
284
|
+
resolveSiteLocaleData: (site: SiteData, routeLocale: RouteLocale) => SiteLocaleData;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export { ClientConfig, ClientOnly, Content, CreateVueAppFunction, Layouts, LayoutsRef, PageDataRef, PageFrontmatterRef, PageHead, PageHeadRef, PageHeadTitle, PageHeadTitleRef, PageLang, PageLangRef, PageLayoutRef, PageRouteItem, PagesData, PagesDataRef, RouteLocale, RouteLocaleRef, SiteDataRef, SiteLocaleData, SiteLocaleDataRef, UpdateHead, defineClientConfig, layoutsSymbol, pageDataEmpty, pageDataSymbol, pageFrontmatterSymbol, pageHeadSymbol, pageHeadTitleSymbol, pageLangSymbol, pageLayoutSymbol, pagesData, resolvers, routeLocaleSymbol, siteData, siteLocaleDataSymbol, updateHeadSymbol, useLayouts, usePageData, usePageFrontmatter, usePageHead, usePageHeadTitle, usePageLang, usePageLayout, usePagesData, useRouteLocale, useSiteData, useSiteLocaleData, useUpdateHead, withBase };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientOnly,
|
|
3
|
+
Content,
|
|
4
|
+
defineClientConfig,
|
|
5
|
+
layoutsSymbol,
|
|
6
|
+
pageDataEmpty,
|
|
7
|
+
pageDataSymbol,
|
|
8
|
+
pageFrontmatterSymbol,
|
|
9
|
+
pageHeadSymbol,
|
|
10
|
+
pageHeadTitleSymbol,
|
|
11
|
+
pageLangSymbol,
|
|
12
|
+
pageLayoutSymbol,
|
|
13
|
+
pagesData,
|
|
14
|
+
resolvers,
|
|
15
|
+
routeLocaleSymbol,
|
|
16
|
+
siteData,
|
|
17
|
+
siteLocaleDataSymbol,
|
|
18
|
+
updateHeadSymbol,
|
|
19
|
+
useLayouts,
|
|
20
|
+
usePageData,
|
|
21
|
+
usePageFrontmatter,
|
|
22
|
+
usePageHead,
|
|
23
|
+
usePageHeadTitle,
|
|
24
|
+
usePageLang,
|
|
25
|
+
usePageLayout,
|
|
26
|
+
usePagesData,
|
|
27
|
+
useRouteLocale,
|
|
28
|
+
useSiteData,
|
|
29
|
+
useSiteLocaleData,
|
|
30
|
+
useUpdateHead,
|
|
31
|
+
withBase
|
|
32
|
+
} from "./chunk-DHNSDB55.js";
|
|
33
|
+
export {
|
|
34
|
+
ClientOnly,
|
|
35
|
+
Content,
|
|
36
|
+
defineClientConfig,
|
|
37
|
+
layoutsSymbol,
|
|
38
|
+
pageDataEmpty,
|
|
39
|
+
pageDataSymbol,
|
|
40
|
+
pageFrontmatterSymbol,
|
|
41
|
+
pageHeadSymbol,
|
|
42
|
+
pageHeadTitleSymbol,
|
|
43
|
+
pageLangSymbol,
|
|
44
|
+
pageLayoutSymbol,
|
|
45
|
+
pagesData,
|
|
46
|
+
resolvers,
|
|
47
|
+
routeLocaleSymbol,
|
|
48
|
+
siteData,
|
|
49
|
+
siteLocaleDataSymbol,
|
|
50
|
+
updateHeadSymbol,
|
|
51
|
+
useLayouts,
|
|
52
|
+
usePageData,
|
|
53
|
+
usePageFrontmatter,
|
|
54
|
+
usePageHead,
|
|
55
|
+
usePageHeadTitle,
|
|
56
|
+
usePageLang,
|
|
57
|
+
usePageLayout,
|
|
58
|
+
usePagesData,
|
|
59
|
+
useRouteLocale,
|
|
60
|
+
useSiteData,
|
|
61
|
+
useSiteLocaleData,
|
|
62
|
+
useUpdateHead,
|
|
63
|
+
withBase
|
|
64
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/setupDevtools.ts
|
|
2
|
+
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
3
|
+
import { watch } from "vue";
|
|
4
|
+
var PLUGIN_ID = "org.vuejs.vuepress";
|
|
5
|
+
var PLUGIN_LABEL = "VuePress";
|
|
6
|
+
var PLUGIN_COMPONENT_STATE_TYPE = PLUGIN_LABEL;
|
|
7
|
+
var INSPECTOR_ID = PLUGIN_ID;
|
|
8
|
+
var INSPECTOR_LABEL = PLUGIN_LABEL;
|
|
9
|
+
var INSPECTOR_GLOBAL_COMPUTED_ID = "global-computed";
|
|
10
|
+
var INSPECTOR_GLOBAL_COMPUTED_LABEL = "Global Computed";
|
|
11
|
+
var setupDevtools = (app, globalComputed) => {
|
|
12
|
+
setupDevtoolsPlugin(
|
|
13
|
+
{
|
|
14
|
+
// fix recursive reference
|
|
15
|
+
app,
|
|
16
|
+
id: PLUGIN_ID,
|
|
17
|
+
label: PLUGIN_LABEL,
|
|
18
|
+
packageName: "@vuepress/client",
|
|
19
|
+
homepage: "https://v2.vuepress.vuejs.org",
|
|
20
|
+
logo: "https://v2.vuepress.vuejs.org/images/hero.png",
|
|
21
|
+
componentStateTypes: [PLUGIN_COMPONENT_STATE_TYPE]
|
|
22
|
+
},
|
|
23
|
+
(api) => {
|
|
24
|
+
const globalComputedEntries = Object.entries(globalComputed);
|
|
25
|
+
const globalComputedKeys = Object.keys(globalComputed);
|
|
26
|
+
const globalComputedValues = Object.values(globalComputed);
|
|
27
|
+
api.on.inspectComponent((payload) => {
|
|
28
|
+
payload.instanceData.state.push(
|
|
29
|
+
...globalComputedEntries.map(([name, item]) => ({
|
|
30
|
+
type: PLUGIN_COMPONENT_STATE_TYPE,
|
|
31
|
+
editable: false,
|
|
32
|
+
key: name,
|
|
33
|
+
value: item.value
|
|
34
|
+
}))
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
api.addInspector({
|
|
38
|
+
id: INSPECTOR_ID,
|
|
39
|
+
label: INSPECTOR_LABEL,
|
|
40
|
+
icon: "article"
|
|
41
|
+
});
|
|
42
|
+
api.on.getInspectorTree((payload) => {
|
|
43
|
+
if (payload.inspectorId !== INSPECTOR_ID)
|
|
44
|
+
return;
|
|
45
|
+
payload.rootNodes = [
|
|
46
|
+
{
|
|
47
|
+
id: INSPECTOR_GLOBAL_COMPUTED_ID,
|
|
48
|
+
label: INSPECTOR_GLOBAL_COMPUTED_LABEL,
|
|
49
|
+
children: globalComputedKeys.map((name) => ({
|
|
50
|
+
id: name,
|
|
51
|
+
label: name
|
|
52
|
+
}))
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
});
|
|
56
|
+
api.on.getInspectorState((payload) => {
|
|
57
|
+
if (payload.inspectorId !== INSPECTOR_ID)
|
|
58
|
+
return;
|
|
59
|
+
if (payload.nodeId === INSPECTOR_GLOBAL_COMPUTED_ID) {
|
|
60
|
+
payload.state = {
|
|
61
|
+
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: globalComputedEntries.map(
|
|
62
|
+
([name, item]) => ({
|
|
63
|
+
key: name,
|
|
64
|
+
value: item.value
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (globalComputedKeys.includes(payload.nodeId)) {
|
|
70
|
+
payload.state = {
|
|
71
|
+
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: [
|
|
72
|
+
{
|
|
73
|
+
key: payload.nodeId,
|
|
74
|
+
value: globalComputed[payload.nodeId].value
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
watch(globalComputedValues, () => {
|
|
81
|
+
api.notifyComponentUpdate();
|
|
82
|
+
api.sendInspectorState(INSPECTOR_ID);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
setupDevtools
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.0",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -15,26 +15,58 @@
|
|
|
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
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./templates/*": "./templates/*",
|
|
25
|
+
"./types": "./types.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
21
30
|
"files": [
|
|
22
|
-
"
|
|
31
|
+
"dist",
|
|
23
32
|
"templates",
|
|
24
33
|
"types.d.ts"
|
|
25
34
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc -b tsconfig.build.json",
|
|
28
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
29
|
-
"copy": "cpx \"src/**/*.{d.ts,css}\" lib"
|
|
30
|
-
},
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"vue
|
|
36
|
+
"@vue/devtools-api": "^6.5.1",
|
|
37
|
+
"@vueuse/core": "^10.6.1",
|
|
38
|
+
"vue": "^3.3.8",
|
|
39
|
+
"vue-router": "^4.2.5",
|
|
40
|
+
"@vuepress/shared": "2.0.0-rc.0"
|
|
35
41
|
},
|
|
36
42
|
"publishConfig": {
|
|
37
43
|
"access": "public"
|
|
38
44
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
45
|
+
"tsup": {
|
|
46
|
+
"clean": true,
|
|
47
|
+
"dts": "./src/index.ts",
|
|
48
|
+
"entry": [
|
|
49
|
+
"./src/app.ts",
|
|
50
|
+
"./src/index.ts"
|
|
51
|
+
],
|
|
52
|
+
"external": [
|
|
53
|
+
"@internal/clientConfigs",
|
|
54
|
+
"@internal/layoutComponents",
|
|
55
|
+
"@internal/pagesComponents",
|
|
56
|
+
"@internal/pagesData",
|
|
57
|
+
"@internal/pagesRoutes",
|
|
58
|
+
"@internal/siteData"
|
|
59
|
+
],
|
|
60
|
+
"format": [
|
|
61
|
+
"esm"
|
|
62
|
+
],
|
|
63
|
+
"outDir": "./dist",
|
|
64
|
+
"sourcemap": false,
|
|
65
|
+
"target": "es2022",
|
|
66
|
+
"tsconfig": "./tsconfig.dts.json"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "tsup",
|
|
70
|
+
"clean": "rimraf dist"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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-styles-->
|
|
9
|
+
<!--vuepress-ssr-preload-->
|
|
10
|
+
<!--vuepress-ssr-prefetch-->
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="app"><!--vuepress-ssr-content--></div>
|
|
14
|
+
<!--vuepress-ssr-scripts-->
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
1
|
+
declare const __VUEPRESS_VERSION__: string
|
|
2
|
+
declare const __VUEPRESS_BASE__: string
|
|
3
|
+
declare const __VUEPRESS_DEV__: boolean
|
|
4
|
+
declare const __VUEPRESS_SSR__: boolean
|
|
4
5
|
declare const __VUE_HMR_RUNTIME__: Record<string, any>
|
|
6
|
+
declare const __VUE_OPTIONS_API__: boolean
|
|
7
|
+
declare const __VUE_PROD_DEVTOOLS__: boolean
|