@vuepress/core 2.0.0-rc.26 → 2.0.0-rc.28
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/index.d.ts +522 -502
- package/dist/index.js +966 -986
- package/package.json +24 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { TemplateRenderer } from '@vuepress/utils';
|
|
1
|
+
import { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageBase, PageData, PageData as PageData$1, PageFrontmatter, PageFrontmatter as PageFrontmatter$1, PageHeader, PageHeader as PageHeader$1, SiteData, SiteData as SiteData$1, SiteLocaleConfig } from "@vuepress/shared";
|
|
2
|
+
import { TemplateRenderer } from "@vuepress/utils";
|
|
3
|
+
import { Markdown, MarkdownLink, MarkdownOptions, MarkdownSfcBlocks } from "@vuepress/markdown";
|
|
5
4
|
|
|
5
|
+
//#region src/types/bundler.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Vuepress bundler
|
|
8
8
|
*
|
|
@@ -11,171 +11,165 @@ import { TemplateRenderer } from '@vuepress/utils';
|
|
|
11
11
|
* - build: bundle assets for deployment
|
|
12
12
|
*/
|
|
13
13
|
interface Bundler {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Name of the bundler
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Method to run vuepress app in dev mode, starting dev server
|
|
20
|
+
*/
|
|
21
|
+
dev: (app: App) => Promise<() => Promise<void>>;
|
|
22
|
+
/**
|
|
23
|
+
* Method to run vuepress app in build mode, generating static pages and assets
|
|
24
|
+
*/
|
|
25
|
+
build: (app: App) => Promise<void>;
|
|
26
26
|
}
|
|
27
27
|
type BundlerOptions = Record<string, unknown>;
|
|
28
|
-
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/types/page.d.ts
|
|
29
30
|
/**
|
|
30
31
|
* Vuepress Page
|
|
31
32
|
*/
|
|
32
33
|
type Page<ExtraPageData extends Record<string, unknown> = Record<string, unknown>, ExtraPageFrontmatter extends Record<string, unknown> = Record<string, unknown>, ExtraPageFields extends Record<string, unknown> = Record<string, unknown>> = ExtraPageFields & PageBase<ExtraPageFrontmatter> & {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Rendered html file path
|
|
137
|
-
*/
|
|
138
|
-
htmlFilePath: string;
|
|
139
|
-
/**
|
|
140
|
-
* Rendered html file path relative to dest directory
|
|
141
|
-
*/
|
|
142
|
-
htmlFilePathRelative: string;
|
|
34
|
+
/**
|
|
35
|
+
* Data of the page, which will be available in client code
|
|
36
|
+
*/
|
|
37
|
+
data: PageData$1<ExtraPageData, ExtraPageFrontmatter>;
|
|
38
|
+
/**
|
|
39
|
+
* Raw Content of the page
|
|
40
|
+
*/
|
|
41
|
+
content: string;
|
|
42
|
+
/**
|
|
43
|
+
* Rendered content of the page
|
|
44
|
+
*/
|
|
45
|
+
contentRendered: string;
|
|
46
|
+
/**
|
|
47
|
+
* Date of the page, in 'yyyy-MM-dd' format
|
|
48
|
+
*
|
|
49
|
+
* @example '2020-09-09'
|
|
50
|
+
*/
|
|
51
|
+
date: string;
|
|
52
|
+
/**
|
|
53
|
+
* Dependencies of the page
|
|
54
|
+
*/
|
|
55
|
+
deps: string[];
|
|
56
|
+
/**
|
|
57
|
+
* Headers of the page
|
|
58
|
+
*/
|
|
59
|
+
headers: PageHeader$1[];
|
|
60
|
+
/**
|
|
61
|
+
* Links of the page
|
|
62
|
+
*/
|
|
63
|
+
links: MarkdownLink[];
|
|
64
|
+
/**
|
|
65
|
+
* Markdown env object of the page
|
|
66
|
+
*/
|
|
67
|
+
markdownEnv: Record<string, unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* Path of the page that inferred from file path
|
|
70
|
+
*
|
|
71
|
+
* If the page does not come from a file, it would be `null`
|
|
72
|
+
*
|
|
73
|
+
* @example '/guide/index.html'
|
|
74
|
+
*/
|
|
75
|
+
pathInferred: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* Locale path prefix of the page
|
|
78
|
+
*
|
|
79
|
+
* @example '/getting-started.html' -> '/'
|
|
80
|
+
* @example '/en/getting-started.html' -> '/en/'
|
|
81
|
+
* @example '/zh/getting-started.html' -> '/zh/'
|
|
82
|
+
*/
|
|
83
|
+
pathLocale: string;
|
|
84
|
+
/**
|
|
85
|
+
* Permalink of the page
|
|
86
|
+
*
|
|
87
|
+
* If the page does not have a permalink, it would be `null`
|
|
88
|
+
*/
|
|
89
|
+
permalink: string | null;
|
|
90
|
+
/**
|
|
91
|
+
* Custom data to be attached to route record
|
|
92
|
+
*/
|
|
93
|
+
routeMeta: Record<string, unknown>;
|
|
94
|
+
/**
|
|
95
|
+
* Extracted sfc blocks of the page
|
|
96
|
+
*/
|
|
97
|
+
sfcBlocks: MarkdownSfcBlocks;
|
|
98
|
+
/**
|
|
99
|
+
* Slug of the page
|
|
100
|
+
*/
|
|
101
|
+
slug: string;
|
|
102
|
+
/**
|
|
103
|
+
* Source file path
|
|
104
|
+
*
|
|
105
|
+
* If the page does not come from a file, it would be `null`
|
|
106
|
+
*/
|
|
107
|
+
filePath: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Source file path relative to source directory
|
|
110
|
+
*
|
|
111
|
+
* If the page does not come from a file, it would be `null`
|
|
112
|
+
*/
|
|
113
|
+
filePathRelative: string | null;
|
|
114
|
+
/**
|
|
115
|
+
* Chunk file path
|
|
116
|
+
*/
|
|
117
|
+
chunkFilePath: string;
|
|
118
|
+
/**
|
|
119
|
+
* Chunk file path relative to temp directory
|
|
120
|
+
*/
|
|
121
|
+
chunkFilePathRelative: string;
|
|
122
|
+
/**
|
|
123
|
+
* Chunk name
|
|
124
|
+
*
|
|
125
|
+
* This will only take effect in webpack
|
|
126
|
+
*/
|
|
127
|
+
chunkName: string;
|
|
128
|
+
/**
|
|
129
|
+
* Rendered html file path
|
|
130
|
+
*/
|
|
131
|
+
htmlFilePath: string;
|
|
132
|
+
/**
|
|
133
|
+
* Rendered html file path relative to dest directory
|
|
134
|
+
*/
|
|
135
|
+
htmlFilePathRelative: string;
|
|
143
136
|
};
|
|
144
137
|
/**
|
|
145
138
|
* Options to create vuepress page
|
|
146
139
|
*/
|
|
147
140
|
interface PageOptions {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
141
|
+
/**
|
|
142
|
+
* The raw markdown content of the page.
|
|
143
|
+
*
|
|
144
|
+
* If `content` is not provided, the file content of the `filePath`
|
|
145
|
+
* will be used.
|
|
146
|
+
*/
|
|
147
|
+
content?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Absolute file path of the markdown source file.
|
|
150
|
+
*/
|
|
151
|
+
filePath?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Default frontmatter of the page, which could be overridden by
|
|
154
|
+
* the frontmatter of the markdown content.
|
|
155
|
+
*/
|
|
156
|
+
frontmatter?: PageFrontmatter$1;
|
|
157
|
+
/**
|
|
158
|
+
* If this option is set, it will be used as the final route path
|
|
159
|
+
* of the page, ignoring the relative path and permalink.
|
|
160
|
+
*/
|
|
161
|
+
path?: string;
|
|
169
162
|
}
|
|
170
|
-
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/types/pluginApi/hooks.d.ts
|
|
171
165
|
type PromiseOrNot<T> = Promise<T> | T;
|
|
172
166
|
interface Closable {
|
|
173
|
-
|
|
167
|
+
close(): void;
|
|
174
168
|
}
|
|
175
|
-
interface Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...args: any) => infer U ? U extends Promise<infer V> ? V : U : never> {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
interface Hook<Exposed, Normalized = Exposed, Result = (Normalized extends ((...args: any) => infer U) ? U extends Promise<infer V> ? V : U : never)> {
|
|
170
|
+
exposed: Exposed;
|
|
171
|
+
normalized: Normalized;
|
|
172
|
+
result: Result;
|
|
179
173
|
}
|
|
180
174
|
type LifeCycleHook<T extends unknown[] = []> = Hook<(app: App, ...args: T) => PromiseOrNot<void>>;
|
|
181
175
|
type ExtendsHook<T> = Hook<(extendable: T, app: App) => PromiseOrNot<void>>;
|
|
@@ -186,18 +180,19 @@ type DefineHook = Hook<Record<string, unknown> | ((app: App, isServer: boolean)
|
|
|
186
180
|
* List of hooks
|
|
187
181
|
*/
|
|
188
182
|
interface Hooks {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
183
|
+
onInitialized: LifeCycleHook;
|
|
184
|
+
onPrepared: LifeCycleHook;
|
|
185
|
+
onWatched: LifeCycleHook<[watchers: Closable[], restart: () => Promise<void>]>;
|
|
186
|
+
onPageUpdated: LifeCycleHook<[type: 'create', newPage: Page, oldPage: null] | [type: 'delete', newPage: null, oldPage: Page] | [type: 'update', newPage: Page, oldPage: Page]>;
|
|
187
|
+
onGenerated: LifeCycleHook;
|
|
188
|
+
extendsMarkdownOptions: ExtendsHook<MarkdownOptions>;
|
|
189
|
+
extendsMarkdown: ExtendsHook<Markdown>;
|
|
190
|
+
extendsPageOptions: ExtendsHook<PageOptions>;
|
|
191
|
+
extendsPage: ExtendsHook<Page>;
|
|
192
|
+
extendsBundlerOptions: ExtendsHook<BundlerOptions>;
|
|
193
|
+
clientConfigFile: ClientConfigFileHook;
|
|
194
|
+
alias: AliasHook;
|
|
195
|
+
define: DefineHook;
|
|
201
196
|
}
|
|
202
197
|
/**
|
|
203
198
|
* Name of hooks
|
|
@@ -206,60 +201,54 @@ type HooksName = keyof Hooks;
|
|
|
206
201
|
/**
|
|
207
202
|
* Exposed hooks API that can be accessed by a plugin
|
|
208
203
|
*/
|
|
209
|
-
type HooksExposed = {
|
|
210
|
-
[K in HooksName]: Hooks[K]['exposed'];
|
|
211
|
-
};
|
|
204
|
+
type HooksExposed = { [K in HooksName]: Hooks[K]['exposed'] };
|
|
212
205
|
/**
|
|
213
206
|
* Normalized hooks
|
|
214
207
|
*/
|
|
215
|
-
type HooksNormalized = {
|
|
216
|
-
[K in HooksName]: Hooks[K]['normalized'];
|
|
217
|
-
};
|
|
208
|
+
type HooksNormalized = { [K in HooksName]: Hooks[K]['normalized'] };
|
|
218
209
|
/**
|
|
219
210
|
* Result of hooks
|
|
220
211
|
*/
|
|
221
|
-
type HooksResult = {
|
|
222
|
-
[K in HooksName]: Hooks[K]['result'];
|
|
223
|
-
};
|
|
212
|
+
type HooksResult = { [K in HooksName]: Hooks[K]['result'] };
|
|
224
213
|
/**
|
|
225
214
|
* Hook item
|
|
226
215
|
*/
|
|
227
216
|
interface HookItem<T extends HooksName> {
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
pluginName: string;
|
|
218
|
+
hook: HooksNormalized[T];
|
|
230
219
|
}
|
|
231
220
|
/**
|
|
232
221
|
* Hook items queue
|
|
233
222
|
*/
|
|
234
223
|
interface HookQueue<T extends HooksName> {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
224
|
+
name: T;
|
|
225
|
+
items: HookItem<T>[];
|
|
226
|
+
add: (item: HookItem<T>) => void;
|
|
227
|
+
process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
|
|
239
228
|
}
|
|
240
|
-
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/types/pluginApi/pluginApi.d.ts
|
|
241
231
|
/**
|
|
242
232
|
* Vuepress plugin system
|
|
243
233
|
*/
|
|
244
234
|
interface PluginApi {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
*/
|
|
260
|
-
registerHooks: () => void;
|
|
235
|
+
/**
|
|
236
|
+
* Plugins that have been used
|
|
237
|
+
*/
|
|
238
|
+
plugins: PluginObject[];
|
|
239
|
+
/**
|
|
240
|
+
* All available hooks
|
|
241
|
+
*/
|
|
242
|
+
hooks: { [K in HooksName]: HookQueue<K> };
|
|
243
|
+
/**
|
|
244
|
+
* Register hooks of plugins
|
|
245
|
+
*
|
|
246
|
+
* Should be invoked before applying a hook
|
|
247
|
+
*/
|
|
248
|
+
registerHooks: () => void;
|
|
261
249
|
}
|
|
262
|
-
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/types/plugin.d.ts
|
|
263
252
|
/**
|
|
264
253
|
* Vuepress plugin
|
|
265
254
|
*
|
|
@@ -280,20 +269,21 @@ type PluginFunction<T extends PluginObject = PluginObject> = (app: App) => T;
|
|
|
280
269
|
* Vuepress plugin object
|
|
281
270
|
*/
|
|
282
271
|
interface PluginObject extends Partial<HooksExposed> {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Name of the plugin
|
|
274
|
+
*/
|
|
275
|
+
name: string;
|
|
276
|
+
/**
|
|
277
|
+
* Allow the plugin to be used multiple times or not
|
|
278
|
+
*/
|
|
279
|
+
multiple?: boolean;
|
|
291
280
|
}
|
|
292
281
|
/**
|
|
293
282
|
* Config field for plugins
|
|
294
283
|
*/
|
|
295
284
|
type PluginConfig = (Plugin | Plugin[])[];
|
|
296
|
-
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/types/theme.d.ts
|
|
297
287
|
/**
|
|
298
288
|
* Vuepress theme
|
|
299
289
|
*
|
|
@@ -312,195 +302,196 @@ type ThemeFunction = PluginFunction<ThemeObject>;
|
|
|
312
302
|
* Vuepress theme object
|
|
313
303
|
*/
|
|
314
304
|
interface ThemeObject extends Omit<PluginObject, 'multiple'> {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Extended parent theme
|
|
307
|
+
*/
|
|
308
|
+
extends?: Theme;
|
|
309
|
+
/**
|
|
310
|
+
* Allow using plugins in theme
|
|
311
|
+
*/
|
|
312
|
+
plugins?: PluginConfig;
|
|
313
|
+
/**
|
|
314
|
+
* Allow overriding default templateBuild
|
|
315
|
+
*/
|
|
316
|
+
templateBuild?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Allow specifying custom template renderer
|
|
319
|
+
*/
|
|
320
|
+
templateBuildRenderer?: TemplateRenderer;
|
|
321
|
+
/**
|
|
322
|
+
* Allow overriding default templateDev
|
|
323
|
+
*/
|
|
324
|
+
templateDev?: string;
|
|
335
325
|
}
|
|
336
326
|
/**
|
|
337
327
|
* Resolved theme info
|
|
338
328
|
*/
|
|
339
329
|
interface ThemeInfo {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
330
|
+
/**
|
|
331
|
+
* Plugins, including theme itself and plugins used by theme
|
|
332
|
+
*/
|
|
333
|
+
plugins: PluginConfig;
|
|
334
|
+
/**
|
|
335
|
+
* Default build template
|
|
336
|
+
*/
|
|
337
|
+
templateBuild?: string;
|
|
338
|
+
/**
|
|
339
|
+
* Default build template renderer
|
|
340
|
+
*/
|
|
341
|
+
templateBuildRenderer?: TemplateRenderer;
|
|
342
|
+
/**
|
|
343
|
+
* Default dev template
|
|
344
|
+
*/
|
|
345
|
+
templateDev?: string;
|
|
356
346
|
}
|
|
357
|
-
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/types/app/options.d.ts
|
|
358
349
|
/**
|
|
359
350
|
* Vuepress app common config that shared between dev and build
|
|
360
351
|
*/
|
|
361
|
-
interface AppConfigCommon extends Partial<SiteData> {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
352
|
+
interface AppConfigCommon extends Partial<SiteData$1> {
|
|
353
|
+
/**
|
|
354
|
+
* Source directory of the markdown files.
|
|
355
|
+
*
|
|
356
|
+
* Vuepress will load markdown files from this directory.
|
|
357
|
+
*
|
|
358
|
+
* @required
|
|
359
|
+
*/
|
|
360
|
+
source: string;
|
|
361
|
+
/**
|
|
362
|
+
* Destination directory of the output files.
|
|
363
|
+
*
|
|
364
|
+
* Vuepress will output the static site files to this directory.
|
|
365
|
+
*
|
|
366
|
+
* @default `${source}/.vuepress/dist`
|
|
367
|
+
*/
|
|
368
|
+
dest?: string;
|
|
369
|
+
/**
|
|
370
|
+
* Temp files directory.
|
|
371
|
+
*
|
|
372
|
+
* Vuepress will write temp files to this directory.
|
|
373
|
+
*
|
|
374
|
+
* @default `${source}/.vuepress/.temp`
|
|
375
|
+
*/
|
|
376
|
+
temp?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Cache files directory.
|
|
379
|
+
*
|
|
380
|
+
* Vuepress will write cache files to this directory.
|
|
381
|
+
*
|
|
382
|
+
* @default `${source}/.vuepress/.cache`
|
|
383
|
+
*/
|
|
384
|
+
cache?: string;
|
|
385
|
+
/**
|
|
386
|
+
* Public files directory.
|
|
387
|
+
*
|
|
388
|
+
* Vuepress will copy the files from public directory to the output directory.
|
|
389
|
+
*
|
|
390
|
+
* @default `${source}/.vuepress/public`
|
|
391
|
+
*/
|
|
392
|
+
public?: string;
|
|
393
|
+
/**
|
|
394
|
+
* Whether to enable debug mode
|
|
395
|
+
*
|
|
396
|
+
* @default false
|
|
397
|
+
*/
|
|
398
|
+
debug?: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Markdown options
|
|
401
|
+
*
|
|
402
|
+
* @default {}
|
|
403
|
+
*/
|
|
404
|
+
markdown?: MarkdownOptions;
|
|
405
|
+
/**
|
|
406
|
+
* Patterns to match the markdown files as pages
|
|
407
|
+
*
|
|
408
|
+
* @default ['**\/*.md', '!.vuepress']
|
|
409
|
+
*/
|
|
410
|
+
pagePatterns?: string[];
|
|
411
|
+
/**
|
|
412
|
+
* Pattern to generate permalink for pages
|
|
413
|
+
*
|
|
414
|
+
* @default null
|
|
415
|
+
*/
|
|
416
|
+
permalinkPattern?: string | null;
|
|
417
|
+
/**
|
|
418
|
+
* Vuepress bundler
|
|
419
|
+
*
|
|
420
|
+
* @required
|
|
421
|
+
*/
|
|
422
|
+
bundler: Bundler;
|
|
423
|
+
/**
|
|
424
|
+
* Vuepress theme
|
|
425
|
+
*
|
|
426
|
+
* @required
|
|
427
|
+
*/
|
|
428
|
+
theme: Theme;
|
|
429
|
+
/**
|
|
430
|
+
* Vuepress plugins
|
|
431
|
+
*
|
|
432
|
+
* @default []
|
|
433
|
+
*/
|
|
434
|
+
plugins?: PluginConfig;
|
|
444
435
|
}
|
|
445
436
|
/**
|
|
446
437
|
* Vuepress app config for dev
|
|
447
438
|
*/
|
|
448
439
|
interface AppConfigDev {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Specify the host to use for the dev server
|
|
442
|
+
*
|
|
443
|
+
* @default '0.0.0.0'
|
|
444
|
+
*/
|
|
445
|
+
host?: string;
|
|
446
|
+
/**
|
|
447
|
+
* Specify the port to use for the dev server
|
|
448
|
+
*
|
|
449
|
+
* @default 8080
|
|
450
|
+
*/
|
|
451
|
+
port?: number;
|
|
452
|
+
/**
|
|
453
|
+
* Whether to open the browser after dev-server had been started
|
|
454
|
+
*
|
|
455
|
+
* @default false
|
|
456
|
+
*/
|
|
457
|
+
open?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Specify the path of the HTML template to be used for dev
|
|
460
|
+
*
|
|
461
|
+
* @default '@vuepress/client/templates/dev.html'
|
|
462
|
+
*/
|
|
463
|
+
templateDev?: string;
|
|
473
464
|
}
|
|
474
465
|
/**
|
|
475
466
|
* Vuepress app config for build
|
|
476
467
|
*/
|
|
477
468
|
interface AppConfigBuild {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
469
|
+
/**
|
|
470
|
+
* Determine what resource files should be preloaded. Use boolean value to
|
|
471
|
+
* totally enable / disable.
|
|
472
|
+
*
|
|
473
|
+
* @default true
|
|
474
|
+
*/
|
|
475
|
+
shouldPreload?: boolean | ((file: string, type: string) => boolean);
|
|
476
|
+
/**
|
|
477
|
+
* Determine what resource files should be prefetched. Use boolean value to
|
|
478
|
+
* totally enable / disable.
|
|
479
|
+
*
|
|
480
|
+
* @default true
|
|
481
|
+
*/
|
|
482
|
+
shouldPrefetch?: boolean | ((file: string, type: string) => boolean);
|
|
483
|
+
/**
|
|
484
|
+
* Specify the path of the HTML template to be used for build
|
|
485
|
+
*
|
|
486
|
+
* @default '@vuepress/client/templates/build.html'
|
|
487
|
+
*/
|
|
488
|
+
templateBuild?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Specify the HTML template renderer to be used for build
|
|
491
|
+
*
|
|
492
|
+
* @default `import { templateRenderer } from '@vuepress/utils'`
|
|
493
|
+
*/
|
|
494
|
+
templateBuildRenderer?: TemplateRenderer;
|
|
504
495
|
}
|
|
505
496
|
/**
|
|
506
497
|
* Vuepress app user config.
|
|
@@ -514,7 +505,8 @@ type AppConfig = AppConfigBuild & AppConfigCommon & AppConfigDev;
|
|
|
514
505
|
* It fills all optional fields with a default value.
|
|
515
506
|
*/
|
|
516
507
|
type AppOptions = Required<AppConfig>;
|
|
517
|
-
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/types/app/utils.d.ts
|
|
518
510
|
/**
|
|
519
511
|
* Directory util function
|
|
520
512
|
*/
|
|
@@ -523,121 +515,139 @@ type AppDirFunction = (...args: string[]) => string;
|
|
|
523
515
|
* Directory utils
|
|
524
516
|
*/
|
|
525
517
|
interface AppDir {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
518
|
+
/**
|
|
519
|
+
* Resolve file path in cache directory
|
|
520
|
+
*/
|
|
521
|
+
cache: AppDirFunction;
|
|
522
|
+
/**
|
|
523
|
+
* Resolve file path in temp directory
|
|
524
|
+
*/
|
|
525
|
+
temp: AppDirFunction;
|
|
526
|
+
/**
|
|
527
|
+
* Resolve file path in source directory
|
|
528
|
+
*/
|
|
529
|
+
source: AppDirFunction;
|
|
530
|
+
/**
|
|
531
|
+
* Resolve file path in dest directory
|
|
532
|
+
*/
|
|
533
|
+
dest: AppDirFunction;
|
|
534
|
+
/**
|
|
535
|
+
* Resolve file path in public directory
|
|
536
|
+
*/
|
|
537
|
+
public: AppDirFunction;
|
|
538
|
+
/**
|
|
539
|
+
* Resolve file path in client directory
|
|
540
|
+
*/
|
|
541
|
+
client: AppDirFunction;
|
|
550
542
|
}
|
|
551
543
|
/**
|
|
552
544
|
* Environment flags
|
|
553
545
|
*/
|
|
554
546
|
interface AppEnv {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Is running in build mode or not
|
|
549
|
+
*/
|
|
550
|
+
isBuild: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Is running in dev mode or not
|
|
553
|
+
*/
|
|
554
|
+
isDev: boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Is debug mode enabled or not
|
|
557
|
+
*/
|
|
558
|
+
isDebug: boolean;
|
|
567
559
|
}
|
|
568
560
|
/**
|
|
569
561
|
* Write temp file util
|
|
570
562
|
*/
|
|
571
|
-
|
|
572
|
-
|
|
563
|
+
interface AppWriteTemp {
|
|
564
|
+
(file: string, content: string): Promise<string>;
|
|
565
|
+
/**
|
|
566
|
+
* Clean up the internal write temp cache.
|
|
567
|
+
*
|
|
568
|
+
* This should be called when the dev server restarts
|
|
569
|
+
* to avoid stale cache and to release references to any
|
|
570
|
+
* in-memory write state so that pending write promises can
|
|
571
|
+
* complete and be garbage-collected naturally.
|
|
572
|
+
*/
|
|
573
|
+
cleanup: () => void;
|
|
574
|
+
}
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/types/app/app.d.ts
|
|
573
577
|
/**
|
|
574
578
|
* App base properties, will be available after creation, even before initialization
|
|
575
579
|
*/
|
|
576
580
|
interface AppPropertiesBase {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
581
|
+
/**
|
|
582
|
+
* Directory utils.
|
|
583
|
+
*/
|
|
584
|
+
dir: AppDir;
|
|
585
|
+
/**
|
|
586
|
+
* Environment flags.
|
|
587
|
+
*/
|
|
588
|
+
env: AppEnv;
|
|
589
|
+
/**
|
|
590
|
+
* Options that filled all optional fields with a default value.
|
|
591
|
+
*/
|
|
592
|
+
options: AppOptions;
|
|
593
|
+
/**
|
|
594
|
+
* Plugin system.
|
|
595
|
+
*/
|
|
596
|
+
pluginApi: PluginApi;
|
|
597
|
+
/**
|
|
598
|
+
* Site data, which will be used in client side.
|
|
599
|
+
*/
|
|
600
|
+
siteData: SiteData$1;
|
|
601
|
+
/**
|
|
602
|
+
* Version of vuepress core.
|
|
603
|
+
*/
|
|
604
|
+
version: string;
|
|
605
|
+
/**
|
|
606
|
+
* Initialize app.
|
|
607
|
+
*
|
|
608
|
+
* - Theme and plugin will be loaded.
|
|
609
|
+
* - Layouts and pages will be resolved.
|
|
610
|
+
*/
|
|
611
|
+
init: () => Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Prepare data for client and write temp files.
|
|
614
|
+
*
|
|
615
|
+
* Should be called after `app.init()`.
|
|
616
|
+
*/
|
|
617
|
+
prepare: () => Promise<void>;
|
|
618
|
+
/**
|
|
619
|
+
* Use a plugin.
|
|
620
|
+
*
|
|
621
|
+
* Should be called before `app.init()`.
|
|
622
|
+
*/
|
|
623
|
+
use: (plugin: Plugin) => this;
|
|
624
|
+
/**
|
|
625
|
+
* Util to write temp file
|
|
626
|
+
*/
|
|
627
|
+
writeTemp: AppWriteTemp;
|
|
624
628
|
}
|
|
625
629
|
/**
|
|
626
630
|
* App initialized properties, will only be available after initialization
|
|
627
631
|
*/
|
|
628
632
|
interface AppPropertiesInitialized {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
633
|
+
/**
|
|
634
|
+
* Markdown-it instance.
|
|
635
|
+
*
|
|
636
|
+
* Only available after initialization
|
|
637
|
+
*/
|
|
638
|
+
markdown: Markdown;
|
|
639
|
+
/**
|
|
640
|
+
* Page objects.
|
|
641
|
+
*
|
|
642
|
+
* Only available after initialization
|
|
643
|
+
*/
|
|
644
|
+
pages: Page[];
|
|
645
|
+
/**
|
|
646
|
+
* Page source filepath map.
|
|
647
|
+
*
|
|
648
|
+
* Only available after initialization
|
|
649
|
+
*/
|
|
650
|
+
pagesMap: Record<string, Page | undefined>;
|
|
641
651
|
}
|
|
642
652
|
/**
|
|
643
653
|
* Vuepress app instance
|
|
@@ -647,58 +657,68 @@ type App = AppPropertiesBase & AppPropertiesInitialized;
|
|
|
647
657
|
* Vuepress dev app
|
|
648
658
|
*/
|
|
649
659
|
interface DevApp extends App {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Start dev server
|
|
662
|
+
*
|
|
663
|
+
* Should be called after `app.prepare()`.
|
|
664
|
+
*/
|
|
665
|
+
dev: () => ReturnType<Bundler['dev']>;
|
|
656
666
|
}
|
|
657
667
|
/**
|
|
658
668
|
* Vuepress build app
|
|
659
669
|
*/
|
|
660
670
|
interface BuildApp extends App {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
671
|
+
/**
|
|
672
|
+
* Build static files
|
|
673
|
+
*
|
|
674
|
+
* Should be called after `app.prepare()`.
|
|
675
|
+
*/
|
|
676
|
+
build: () => ReturnType<Bundler['build']>;
|
|
667
677
|
}
|
|
668
|
-
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/app/prepare/preparePageChunk.d.ts
|
|
669
680
|
/**
|
|
670
|
-
* Generate page
|
|
681
|
+
* Generate temp file if the page does not have a source file
|
|
671
682
|
*/
|
|
672
683
|
declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
* Generate page component temp file of a single page
|
|
676
|
-
*/
|
|
677
|
-
declare const preparePageComponent: (app: App, page: Page) => Promise<void>;
|
|
678
|
-
|
|
684
|
+
//#endregion
|
|
685
|
+
//#region src/app/prepare/prepareRoutes.d.ts
|
|
679
686
|
/**
|
|
680
687
|
* Generate routes temp file
|
|
681
688
|
*/
|
|
682
689
|
declare const prepareRoutes: (app: App) => Promise<void>;
|
|
683
|
-
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/app/createBuildApp.d.ts
|
|
684
692
|
/**
|
|
685
693
|
* Create vuepress build app.
|
|
686
694
|
*/
|
|
687
695
|
declare const createBuildApp: (config: AppConfig) => BuildApp;
|
|
688
|
-
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region src/app/createDevApp.d.ts
|
|
689
698
|
/**
|
|
690
699
|
* Create vuepress dev app.
|
|
691
700
|
*/
|
|
692
701
|
declare const createDevApp: (config: AppConfig) => DevApp;
|
|
693
|
-
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/app/resolveAppDir.d.ts
|
|
694
704
|
/**
|
|
695
705
|
* Resolve directory utils for vuepress app
|
|
696
706
|
*/
|
|
697
707
|
declare const resolveAppDir: (options: AppOptions) => AppDir;
|
|
698
|
-
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/page/createPage.d.ts
|
|
699
710
|
/**
|
|
700
711
|
* Create vuepress page object
|
|
701
712
|
*/
|
|
702
713
|
declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
|
|
703
|
-
|
|
704
|
-
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/page/renderPageToVue.d.ts
|
|
716
|
+
/**
|
|
717
|
+
* Render page to vue component
|
|
718
|
+
*/
|
|
719
|
+
declare const renderPageToVue: (app: App, page: Page) => string;
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/constants.d.ts
|
|
722
|
+
declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
723
|
+
//#endregion
|
|
724
|
+
export { AliasHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppPropertiesBase, AppPropertiesInitialized, AppWriteTemp, BuildApp, Bundler, BundlerOptions, ClientConfigFileHook, DEFAULT_IGNORE_PATTERNS, DefineHook, DevApp, ExtendsHook, type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, type LocaleConfig, type LocaleData, Page, type PageData, type PageFrontmatter, type PageHeader, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, type SiteData, type SiteLocaleConfig, Theme, ThemeFunction, ThemeInfo, ThemeObject, createBuildApp, createDevApp, createPage, preparePageChunk, prepareRoutes, renderPageToVue, resolveAppDir };
|