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