@vuepress/core 2.0.0-beta.6 → 2.0.0-beta.61

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.
Files changed (152) hide show
  1. package/dist/index.d.ts +830 -0
  2. package/dist/index.js +1035 -0
  3. package/package.json +34 -17
  4. package/CHANGELOG.md +0 -279
  5. package/lib/app/appInit.d.ts +0 -7
  6. package/lib/app/appInit.js +0 -37
  7. package/lib/app/appPrepare.d.ts +0 -10
  8. package/lib/app/appPrepare.js +0 -46
  9. package/lib/app/appUse.d.ts +0 -2
  10. package/lib/app/appUse.js +0 -26
  11. package/lib/app/appUseByConfig.d.ts +0 -2
  12. package/lib/app/appUseByConfig.js +0 -14
  13. package/lib/app/createApp.d.ts +0 -5
  14. package/lib/app/createApp.js +0 -44
  15. package/lib/app/createAppDir.d.ts +0 -9
  16. package/lib/app/createAppDir.js +0 -32
  17. package/lib/app/createAppEnv.d.ts +0 -5
  18. package/lib/app/createAppEnv.js +0 -14
  19. package/lib/app/createAppOptions.d.ts +0 -5
  20. package/lib/app/createAppOptions.js +0 -48
  21. package/lib/app/createAppPages.d.ts +0 -5
  22. package/lib/app/createAppPages.js +0 -36
  23. package/lib/app/createAppSiteData.d.ts +0 -7
  24. package/lib/app/createAppSiteData.js +0 -19
  25. package/lib/app/createAppVersion.d.ts +0 -4
  26. package/lib/app/createAppVersion.js +0 -11
  27. package/lib/app/createAppWriteTemp.d.ts +0 -5
  28. package/lib/app/createAppWriteTemp.js +0 -21
  29. package/lib/app/index.d.ts +0 -16
  30. package/lib/app/index.js +0 -28
  31. package/lib/app/normalizePlugin.d.ts +0 -2
  32. package/lib/app/normalizePlugin.js +0 -19
  33. package/lib/app/normalizePluginConfig.d.ts +0 -2
  34. package/lib/app/normalizePluginConfig.js +0 -18
  35. package/lib/app/prepare/index.d.ts +0 -12
  36. package/lib/app/prepare/index.js +0 -24
  37. package/lib/app/prepare/prepareClientAppEnhances.d.ts +0 -5
  38. package/lib/app/prepare/prepareClientAppEnhances.js +0 -24
  39. package/lib/app/prepare/prepareClientAppRootComponents.d.ts +0 -5
  40. package/lib/app/prepare/prepareClientAppRootComponents.js +0 -24
  41. package/lib/app/prepare/prepareClientAppSetups.d.ts +0 -5
  42. package/lib/app/prepare/prepareClientAppSetups.js +0 -24
  43. package/lib/app/prepare/prepareLayoutComponents.d.ts +0 -5
  44. package/lib/app/prepare/prepareLayoutComponents.js +0 -20
  45. package/lib/app/prepare/preparePageComponent.d.ts +0 -5
  46. package/lib/app/prepare/preparePageComponent.js +0 -10
  47. package/lib/app/prepare/preparePageData.d.ts +0 -5
  48. package/lib/app/prepare/preparePageData.js +0 -37
  49. package/lib/app/prepare/preparePageRoutes.d.ts +0 -5
  50. package/lib/app/prepare/preparePageRoutes.js +0 -57
  51. package/lib/app/prepare/preparePagesComponent.d.ts +0 -5
  52. package/lib/app/prepare/preparePagesComponent.js +0 -23
  53. package/lib/app/prepare/preparePagesData.d.ts +0 -5
  54. package/lib/app/prepare/preparePagesData.js +0 -19
  55. package/lib/app/prepare/preparePagesRoutes.d.ts +0 -5
  56. package/lib/app/prepare/preparePagesRoutes.js +0 -25
  57. package/lib/app/prepare/prepareSiteData.d.ts +0 -5
  58. package/lib/app/prepare/prepareSiteData.js +0 -31
  59. package/lib/app/prepare/resolvePageData.d.ts +0 -5
  60. package/lib/app/prepare/resolvePageData.js +0 -18
  61. package/lib/app/resolveBundler.d.ts +0 -2
  62. package/lib/app/resolveBundler.js +0 -10
  63. package/lib/app/resolvePlugin.d.ts +0 -5
  64. package/lib/app/resolvePlugin.js +0 -20
  65. package/lib/index.d.ts +0 -5
  66. package/lib/index.js +0 -17
  67. package/lib/page/createPage.d.ts +0 -2
  68. package/lib/page/createPage.js +0 -98
  69. package/lib/page/index.d.ts +0 -17
  70. package/lib/page/index.js +0 -29
  71. package/lib/page/inferPagePath.d.ts +0 -11
  72. package/lib/page/inferPagePath.js +0 -27
  73. package/lib/page/resolvePageComponentInfo.d.ts +0 -20
  74. package/lib/page/resolvePageComponentInfo.js +0 -41
  75. package/lib/page/resolvePageContent.d.ts +0 -11
  76. package/lib/page/resolvePageContent.js +0 -31
  77. package/lib/page/resolvePageDataInfo.d.ts +0 -12
  78. package/lib/page/resolvePageDataInfo.js +0 -18
  79. package/lib/page/resolvePageDate.d.ts +0 -10
  80. package/lib/page/resolvePageDate.js +0 -46
  81. package/lib/page/resolvePageExcerpt.d.ts +0 -9
  82. package/lib/page/resolvePageExcerpt.js +0 -15
  83. package/lib/page/resolvePageFileContent.d.ts +0 -8
  84. package/lib/page/resolvePageFileContent.js +0 -24
  85. package/lib/page/resolvePageFilePath.d.ts +0 -11
  86. package/lib/page/resolvePageFilePath.js +0 -29
  87. package/lib/page/resolvePageFrontmatter.d.ts +0 -8
  88. package/lib/page/resolvePageFrontmatter.js +0 -12
  89. package/lib/page/resolvePageKey.d.ts +0 -6
  90. package/lib/page/resolvePageKey.js +0 -9
  91. package/lib/page/resolvePageLang.d.ts +0 -9
  92. package/lib/page/resolvePageLang.js +0 -15
  93. package/lib/page/resolvePagePath.d.ts +0 -9
  94. package/lib/page/resolvePagePath.js +0 -8
  95. package/lib/page/resolvePagePermalink.d.ts +0 -11
  96. package/lib/page/resolvePagePermalink.js +0 -32
  97. package/lib/page/resolvePageRoutesInfo.d.ts +0 -11
  98. package/lib/page/resolvePageRoutesInfo.js +0 -16
  99. package/lib/page/resolvePageSlug.d.ts +0 -6
  100. package/lib/page/resolvePageSlug.js +0 -17
  101. package/lib/page/resolvePageTitle.d.ts +0 -9
  102. package/lib/page/resolvePageTitle.js +0 -26
  103. package/lib/pluginApi/createHookQueue.d.ts +0 -5
  104. package/lib/pluginApi/createHookQueue.js +0 -81
  105. package/lib/pluginApi/createPluginApi.d.ts +0 -2
  106. package/lib/pluginApi/createPluginApi.js +0 -16
  107. package/lib/pluginApi/createPluginApiHooks.d.ts +0 -2
  108. package/lib/pluginApi/createPluginApiHooks.js +0 -24
  109. package/lib/pluginApi/createPluginApiRegisterHooks.d.ts +0 -2
  110. package/lib/pluginApi/createPluginApiRegisterHooks.js +0 -54
  111. package/lib/pluginApi/index.d.ts +0 -6
  112. package/lib/pluginApi/index.js +0 -18
  113. package/lib/pluginApi/normalizeClientFilesHook.d.ts +0 -5
  114. package/lib/pluginApi/normalizeClientFilesHook.js +0 -25
  115. package/lib/pluginApi/normalizeReturnObjectHook.d.ts +0 -5
  116. package/lib/pluginApi/normalizeReturnObjectHook.js +0 -9
  117. package/lib/themeApi/createThemeApi.d.ts +0 -7
  118. package/lib/themeApi/createThemeApi.js +0 -30
  119. package/lib/themeApi/index.d.ts +0 -1
  120. package/lib/themeApi/index.js +0 -13
  121. package/lib/themeApi/resolveThemeInfo.d.ts +0 -2
  122. package/lib/themeApi/resolveThemeInfo.js +0 -34
  123. package/lib/themeApi/resolveThemeLayouts.d.ts +0 -5
  124. package/lib/themeApi/resolveThemeLayouts.js +0 -33
  125. package/lib/types/app/app.d.ts +0 -30
  126. package/lib/types/app/app.js +0 -2
  127. package/lib/types/app/index.d.ts +0 -3
  128. package/lib/types/app/index.js +0 -15
  129. package/lib/types/app/options.d.ts +0 -32
  130. package/lib/types/app/options.js +0 -2
  131. package/lib/types/app/utils.d.ts +0 -29
  132. package/lib/types/app/utils.js +0 -2
  133. package/lib/types/bundler.d.ts +0 -34
  134. package/lib/types/bundler.js +0 -2
  135. package/lib/types/index.d.ts +0 -9
  136. package/lib/types/index.js +0 -19
  137. package/lib/types/page.d.ts +0 -98
  138. package/lib/types/page.js +0 -2
  139. package/lib/types/plugin-api/hooks.d.ts +0 -75
  140. package/lib/types/plugin-api/hooks.js +0 -2
  141. package/lib/types/plugin-api/index.d.ts +0 -2
  142. package/lib/types/plugin-api/index.js +0 -14
  143. package/lib/types/plugin-api/pluginApi.d.ts +0 -23
  144. package/lib/types/plugin-api/pluginApi.js +0 -2
  145. package/lib/types/plugin.d.ts +0 -48
  146. package/lib/types/plugin.js +0 -2
  147. package/lib/types/theme-api/index.d.ts +0 -1
  148. package/lib/types/theme-api/index.js +0 -13
  149. package/lib/types/theme-api/themeApi.d.ts +0 -44
  150. package/lib/types/theme-api/themeApi.js +0 -2
  151. package/lib/types/theme.d.ts +0 -33
  152. package/lib/types/theme.js +0 -2
@@ -0,0 +1,830 @@
1
+ import { MarkdownLink, MarkdownSfcBlocks, MarkdownOptions, Markdown, MarkdownHeader } from '@vuepress/markdown';
2
+ import { PageBase, PageData, PageFrontmatter, SiteData } from '@vuepress/shared';
3
+ export { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig } from '@vuepress/shared';
4
+
5
+ /**
6
+ * Vuepress bundler
7
+ *
8
+ * It provides abilities to:
9
+ * - dev: run dev server for development
10
+ * - build: bundle assets for deployment
11
+ */
12
+ interface Bundler {
13
+ name: string;
14
+ dev: (app: App) => Promise<() => Promise<void>>;
15
+ build: (app: App) => Promise<void>;
16
+ }
17
+
18
+ /**
19
+ * Vuepress Page
20
+ */
21
+ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>, ExtraPageFields extends Record<any, any> = Record<never, never>> = PageBase<ExtraPageFrontmatter> & ExtraPageFields & {
22
+ /**
23
+ * Data of the page, which will be available in client code
24
+ */
25
+ data: PageData<ExtraPageData, ExtraPageFrontmatter>;
26
+ /**
27
+ * Raw Content of the page
28
+ */
29
+ content: string;
30
+ /**
31
+ * Rendered content of the page
32
+ */
33
+ contentRendered: string;
34
+ /**
35
+ * Date of the page, in 'yyyy-MM-dd' format
36
+ *
37
+ * @example '2020-09-09'
38
+ */
39
+ date: string;
40
+ /**
41
+ * Dependencies of the page
42
+ */
43
+ deps: string[];
44
+ /**
45
+ * Links of the page
46
+ */
47
+ links: MarkdownLink[];
48
+ /**
49
+ * Markdown env object of the page
50
+ */
51
+ markdownEnv: Record<string, unknown>;
52
+ /**
53
+ * Path of the page that inferred from file path
54
+ *
55
+ * If the page does not come from a file, it would be `null`
56
+ *
57
+ * @example '/guide/index.html'
58
+ */
59
+ pathInferred: string | null;
60
+ /**
61
+ * Locale path prefix of the page
62
+ *
63
+ * @example '/getting-started.html' -> '/'
64
+ * @example '/en/getting-started.html' -> '/en/'
65
+ * @example '/zh/getting-started.html' -> '/zh/'
66
+ */
67
+ pathLocale: string;
68
+ /**
69
+ * Permalink of the page
70
+ *
71
+ * If the page does not have a permalink, it would be `null`
72
+ */
73
+ permalink: string | null;
74
+ /**
75
+ * Custom data to be attached to the page route record of vue-router
76
+ *
77
+ * @see https://router.vuejs.org/api/#meta
78
+ */
79
+ routeMeta: Record<string, unknown>;
80
+ /**
81
+ * Extracted sfc blocks of the page
82
+ */
83
+ sfcBlocks: MarkdownSfcBlocks;
84
+ /**
85
+ * Slug of the page
86
+ */
87
+ slug: string;
88
+ /**
89
+ * Source file path
90
+ *
91
+ * If the page does not come from a file, it would be `null`
92
+ */
93
+ filePath: string | null;
94
+ /**
95
+ * Source file path relative to source directory
96
+ *
97
+ * If the page does not come from a file, it would be `null`
98
+ */
99
+ filePathRelative: string | null;
100
+ /**
101
+ * Component file path
102
+ */
103
+ componentFilePath: string;
104
+ /**
105
+ * Component file path relative to temp directory
106
+ */
107
+ componentFilePathRelative: string;
108
+ /**
109
+ * Component file chunk name
110
+ *
111
+ * Only take effect in webpack
112
+ */
113
+ componentFileChunkName: string;
114
+ /**
115
+ * Page data file path
116
+ */
117
+ dataFilePath: string;
118
+ /**
119
+ * Page data file path relative to temp directory
120
+ */
121
+ dataFilePathRelative: string;
122
+ /**
123
+ * Page data file chunk name
124
+ *
125
+ * Only take effect in webpack
126
+ */
127
+ dataFileChunkName: 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;
136
+ };
137
+ /**
138
+ * Options to create vuepress page
139
+ */
140
+ interface PageOptions {
141
+ /**
142
+ * If `filePath` is not set, this option will be used as the raw
143
+ * markdown content of the page.
144
+ *
145
+ * If `filePath` is set, this option will be ignored, while the
146
+ * content of the file will be used.
147
+ */
148
+ content?: string;
149
+ /**
150
+ * Absolute file path of the markdown source file.
151
+ */
152
+ filePath?: string;
153
+ /**
154
+ * Default frontmatter of the page, which could be overridden by
155
+ * the frontmatter of the markdown content.
156
+ */
157
+ frontmatter?: PageFrontmatter;
158
+ /**
159
+ * If this option is set, it will be used as the final route path
160
+ * of the page, ignoring the relative path and permalink.
161
+ */
162
+ path?: string;
163
+ }
164
+
165
+ type PromiseOrNot<T> = Promise<T> | T;
166
+ type Closable = {
167
+ close(): void;
168
+ };
169
+ type Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...args: any) => infer U ? U extends Promise<infer V> ? V : U : void> = {
170
+ exposed: Exposed;
171
+ normalized: Normalized;
172
+ result: Result;
173
+ };
174
+ type LifeCycleHook<T extends unknown[] = []> = Hook<(app: App, ...args: T) => PromiseOrNot<void>>;
175
+ type ExtendsHook<T> = Hook<(extendable: T, app: App) => PromiseOrNot<void>>;
176
+ type ClientConfigFileHook = Hook<string | ((app: App) => PromiseOrNot<string>), (app: App) => Promise<string>>;
177
+ type AliasDefineHook = Hook<Record<string, any> | ((app: App, isServer: boolean) => PromiseOrNot<Record<string, any>>), (app: App, isServer: boolean) => Promise<Record<string, any>>>;
178
+ /**
179
+ * List of hooks
180
+ */
181
+ interface Hooks {
182
+ onInitialized: LifeCycleHook;
183
+ onPrepared: LifeCycleHook;
184
+ onWatched: LifeCycleHook<[watchers: Closable[], restart: () => Promise<void>]>;
185
+ onGenerated: LifeCycleHook;
186
+ extendsMarkdownOptions: ExtendsHook<MarkdownOptions>;
187
+ extendsMarkdown: ExtendsHook<Markdown>;
188
+ extendsPageOptions: ExtendsHook<PageOptions>;
189
+ extendsPage: ExtendsHook<Page>;
190
+ extendsBundlerOptions: ExtendsHook<any>;
191
+ clientConfigFile: ClientConfigFileHook;
192
+ alias: AliasDefineHook;
193
+ define: AliasDefineHook;
194
+ }
195
+ /**
196
+ * Name of hooks
197
+ */
198
+ type HooksName = keyof Hooks;
199
+ /**
200
+ * Exposed hooks API that can be accessed by a plugin
201
+ */
202
+ type HooksExposed = {
203
+ [K in HooksName]: Hooks[K]['exposed'];
204
+ };
205
+ /**
206
+ * Normalized hooks
207
+ */
208
+ type HooksNormalized = {
209
+ [K in HooksName]: Hooks[K]['normalized'];
210
+ };
211
+ /**
212
+ * Result of hooks
213
+ */
214
+ type HooksResult = {
215
+ [K in HooksName]: Hooks[K]['result'];
216
+ };
217
+ /**
218
+ * Hook item
219
+ */
220
+ interface HookItem<T extends HooksName> {
221
+ pluginName: string;
222
+ hook: HooksNormalized[T];
223
+ }
224
+ /**
225
+ * Hook items queue
226
+ */
227
+ interface HookQueue<T extends HooksName> {
228
+ name: T;
229
+ items: HookItem<T>[];
230
+ add: (item: HookItem<T>) => void;
231
+ process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
232
+ }
233
+
234
+ /**
235
+ * Vuepress plugin system
236
+ */
237
+ interface PluginApi {
238
+ /**
239
+ * Plugins that have been used
240
+ */
241
+ plugins: PluginObject[];
242
+ /**
243
+ * All available hooks
244
+ */
245
+ hooks: {
246
+ [K in HooksName]: HookQueue<K>;
247
+ };
248
+ /**
249
+ * Register hooks of plugins
250
+ *
251
+ * Should be invoked before applying a hook
252
+ */
253
+ registerHooks: () => void;
254
+ }
255
+
256
+ /**
257
+ * Vuepress plugin
258
+ *
259
+ * A plugin should be rather:
260
+ * - an object (`PluginObject`)
261
+ * - a function that returns an object (`PluginFunction`)
262
+ *
263
+ * A plugin package should have a `Plugin` as the default export
264
+ */
265
+ type Plugin<T extends PluginObject = PluginObject> = T | PluginFunction<T>;
266
+ /**
267
+ * Vuepress plugin function
268
+ *
269
+ * It accepts plugin options and vuepress app, returns plugin object
270
+ */
271
+ type PluginFunction<T extends PluginObject = PluginObject> = (app: App) => T;
272
+ /**
273
+ * Vuepress plugin object
274
+ */
275
+ interface PluginObject extends Partial<HooksExposed> {
276
+ name: string;
277
+ multiple?: boolean;
278
+ }
279
+ /**
280
+ * Config field for plugins
281
+ */
282
+ type PluginConfig = (Plugin | Plugin[])[];
283
+
284
+ /**
285
+ * Vuepress theme
286
+ *
287
+ * Theme is a special type of plugin, it should be rather:
288
+ * - an object (`ThemeObject`)
289
+ * - a function that returns an object (`ThemeFunction`)
290
+ *
291
+ * A theme package should have a `Theme` as the default export
292
+ */
293
+ type Theme = Plugin<ThemeObject>;
294
+ /**
295
+ * Vuepress theme function
296
+ */
297
+ type ThemeFunction = PluginFunction<ThemeObject>;
298
+ /**
299
+ * Vuepress theme object
300
+ */
301
+ interface ThemeObject extends Omit<PluginObject, 'multiple'> {
302
+ /**
303
+ * Extended parent theme
304
+ */
305
+ extends?: Theme;
306
+ /**
307
+ * Allow using plugins in theme
308
+ */
309
+ plugins?: PluginConfig;
310
+ /**
311
+ * Allow overriding default templateBuild
312
+ */
313
+ templateBuild?: string;
314
+ /**
315
+ * Allow overriding default templateDev
316
+ */
317
+ templateDev?: string;
318
+ }
319
+ /**
320
+ * Resolved theme info
321
+ */
322
+ interface ThemeInfo {
323
+ /**
324
+ * Plugins, including theme itself and plugins used by theme
325
+ */
326
+ plugins: PluginConfig;
327
+ /**
328
+ * Default build template
329
+ */
330
+ templateBuild?: string;
331
+ /**
332
+ * Default dev template
333
+ */
334
+ templateDev?: string;
335
+ }
336
+
337
+ /**
338
+ * Vuepress app common config that shared between dev and build
339
+ */
340
+ interface AppConfigCommon extends Partial<SiteData> {
341
+ source: string;
342
+ dest?: string;
343
+ temp?: string;
344
+ cache?: string;
345
+ public?: string;
346
+ debug?: boolean;
347
+ markdown?: MarkdownOptions;
348
+ pagePatterns?: string[];
349
+ permalinkPattern?: string | null;
350
+ bundler: Bundler;
351
+ theme: Theme;
352
+ plugins?: PluginConfig;
353
+ }
354
+ /**
355
+ * Vuepress app config for dev
356
+ */
357
+ interface AppConfigDev {
358
+ /**
359
+ * Specify the host to use for the dev server
360
+ *
361
+ * @default '0.0.0.0'
362
+ */
363
+ host?: string;
364
+ /**
365
+ * Specify the port to use for the dev server
366
+ *
367
+ * @default 8080
368
+ */
369
+ port?: number;
370
+ /**
371
+ * Whether to open the browser after dev-server had been started
372
+ *
373
+ * @default false
374
+ */
375
+ open?: boolean;
376
+ /**
377
+ * Specify the path of the HTML template to be used for dev
378
+ *
379
+ * @default '@vuepress/client/templates/dev.html'
380
+ */
381
+ templateDev?: string;
382
+ }
383
+ /**
384
+ * Vuepress app config for build
385
+ */
386
+ interface AppConfigBuild {
387
+ /**
388
+ * Determine what resource files should be preloaded. Use boolean value to
389
+ * totally enable / disable.
390
+ *
391
+ * @default true
392
+ */
393
+ shouldPreload?: ((file: string, type: string) => boolean) | boolean;
394
+ /**
395
+ * Determine what resource files should be prefetched. Use boolean value to
396
+ * totally enable / disable.
397
+ *
398
+ * @default true
399
+ */
400
+ shouldPrefetch?: ((file: string, type: string) => boolean) | boolean;
401
+ /**
402
+ * Specify the path of the HTML template to be used for build
403
+ *
404
+ * @default '@vuepress/client/templates/build.html'
405
+ */
406
+ templateBuild?: string;
407
+ }
408
+ /**
409
+ * Vuepress app config
410
+ */
411
+ type AppConfig = AppConfigCommon & AppConfigDev & AppConfigBuild;
412
+ /**
413
+ * Vuepress app options
414
+ */
415
+ type AppOptions = Required<AppConfig>;
416
+
417
+ /**
418
+ * Directory util function
419
+ */
420
+ type AppDirFunction = (...args: string[]) => string;
421
+ /**
422
+ * Directory utils
423
+ */
424
+ interface AppDir {
425
+ cache: AppDirFunction;
426
+ temp: AppDirFunction;
427
+ source: AppDirFunction;
428
+ dest: AppDirFunction;
429
+ public: AppDirFunction;
430
+ client: AppDirFunction;
431
+ }
432
+ /**
433
+ * Environment flags
434
+ */
435
+ interface AppEnv {
436
+ /**
437
+ * Is running in build mode or not
438
+ */
439
+ isBuild: boolean;
440
+ /**
441
+ * Is running in dev mode or not
442
+ */
443
+ isDev: boolean;
444
+ /**
445
+ * Is debug mode enabled or not
446
+ */
447
+ isDebug: boolean;
448
+ }
449
+ /**
450
+ * Write temp file util
451
+ */
452
+ type AppWriteTemp = (file: string, content: string) => Promise<string>;
453
+
454
+ /**
455
+ * Vuepress app
456
+ */
457
+ interface App {
458
+ /**
459
+ * Directory utils
460
+ */
461
+ dir: AppDir;
462
+ /**
463
+ * Environment flags
464
+ */
465
+ env: AppEnv;
466
+ /**
467
+ * Options that filled all optional fields with a default value
468
+ */
469
+ options: AppOptions;
470
+ /**
471
+ * Plugin system
472
+ */
473
+ pluginApi: PluginApi;
474
+ /**
475
+ * Site data, which will be used in client side
476
+ */
477
+ siteData: SiteData;
478
+ /**
479
+ * Version of vuepress core
480
+ */
481
+ version: string;
482
+ /**
483
+ * Write temp file
484
+ */
485
+ writeTemp: AppWriteTemp;
486
+ /**
487
+ * Use a plugin
488
+ */
489
+ use: (plugin: Plugin) => this;
490
+ /**
491
+ * Initialize app.
492
+ *
493
+ * - Theme and plugin will be loaded.
494
+ * - Layouts and pages will be resolved.
495
+ */
496
+ init: () => Promise<void>;
497
+ /**
498
+ * Prepare data for client and write temp files.
499
+ *
500
+ * Should be called after `app.init()`.
501
+ */
502
+ prepare: () => Promise<void>;
503
+ /**
504
+ * Markdown-it instance.
505
+ *
506
+ * Only available after initialization
507
+ */
508
+ markdown: Markdown;
509
+ /**
510
+ * Page objects.
511
+ *
512
+ * Only available after initialization
513
+ */
514
+ pages: Page[];
515
+ }
516
+ /**
517
+ * Vuepress dev app
518
+ */
519
+ interface DevApp extends App {
520
+ /**
521
+ * Start dev server
522
+ *
523
+ * Should be called after `app.prepare()`.
524
+ */
525
+ dev: () => ReturnType<Bundler['dev']>;
526
+ }
527
+ /**
528
+ * Vuepress build app
529
+ */
530
+ interface BuildApp extends App {
531
+ /**
532
+ * Build static files
533
+ *
534
+ * Should be called after `app.prepare()`.
535
+ */
536
+ build: () => ReturnType<Bundler['build']>;
537
+ }
538
+
539
+ /**
540
+ * Generate client configs temp file
541
+ */
542
+ declare const prepareClientConfigs: (app: App) => Promise<void>;
543
+
544
+ /**
545
+ * Generate page component temp file of a single page
546
+ */
547
+ declare const preparePageComponent: (app: App, page: Page) => Promise<void>;
548
+
549
+ /**
550
+ * Generate page data temp file of a single page
551
+ */
552
+ declare const preparePageData: (app: App, page: Page) => Promise<void>;
553
+
554
+ /**
555
+ * Generate page key to page component map temp file
556
+ */
557
+ declare const preparePagesComponents: (app: App) => Promise<void>;
558
+
559
+ /**
560
+ * Generate page path to page data map temp file
561
+ */
562
+ declare const preparePagesData: (app: App) => Promise<void>;
563
+
564
+ /**
565
+ * Generate routes temp file
566
+ */
567
+ declare const preparePagesRoutes: (app: App) => Promise<void>;
568
+
569
+ /**
570
+ * Generate site data temp file
571
+ */
572
+ declare const prepareSiteData: (app: App) => Promise<void>;
573
+
574
+ /**
575
+ * Initialize a vuepress app
576
+ *
577
+ * Plugins should be used before initialization.
578
+ */
579
+ declare const appInit: (app: App) => Promise<void>;
580
+
581
+ /**
582
+ * Prepare files for development or build
583
+ *
584
+ * - page components
585
+ * - routes
586
+ * - site data
587
+ * - other files that generated by plugins
588
+ */
589
+ declare const appPrepare: (app: App) => Promise<void>;
590
+
591
+ declare const appUse: (app: App, rawPlugin: Plugin) => App;
592
+
593
+ /**
594
+ * Create vuepress app
595
+ */
596
+ declare const createBaseApp: (config: AppConfig, isBuild?: boolean) => App;
597
+
598
+ /**
599
+ * Create vuepress build app
600
+ */
601
+ declare const createBuildApp: (config: AppConfig) => BuildApp;
602
+
603
+ /**
604
+ * Create vuepress dev app
605
+ */
606
+ declare const createDevApp: (config: AppConfig) => DevApp;
607
+
608
+ /**
609
+ * Create directory util function
610
+ */
611
+ declare const createAppDirFunction: (baseDir: string) => AppDirFunction;
612
+ /**
613
+ * Resolve directory utils for vuepress app
614
+ */
615
+ declare const resolveAppDir: (options: AppOptions) => AppDir;
616
+
617
+ /**
618
+ * Resolve environment flags for vuepress app
619
+ */
620
+ declare const resolveAppEnv: (options: AppOptions, isBuild: boolean) => AppEnv;
621
+
622
+ /**
623
+ * Create app options with default values
624
+ */
625
+ declare const resolveAppOptions: ({ base, lang, title, description, head, locales, source, dest, temp, cache, public: publicDir, host, port, open, templateDev, shouldPreload, shouldPrefetch, templateBuild, bundler, debug, markdown, pagePatterns, permalinkPattern, plugins, theme, }: AppConfig) => AppOptions;
626
+
627
+ /**
628
+ * Resolve pages for vuepress app
629
+ */
630
+ declare const resolveAppPages: (app: App) => Promise<Page[]>;
631
+
632
+ /**
633
+ * Resolve site data for vuepress app
634
+ *
635
+ * Site data will also be used in client
636
+ */
637
+ declare const resolveAppSiteData: (options: AppOptions) => SiteData;
638
+
639
+ /**
640
+ * Resolve version of vuepress app
641
+ */
642
+ declare const resolveAppVersion: () => string;
643
+
644
+ /**
645
+ * Resolve write temp file util for vuepress app
646
+ */
647
+ declare const resolveAppWriteTemp: (dir: AppDir) => AppWriteTemp;
648
+
649
+ /**
650
+ * Resolve a plugin object according to name / path / module and config
651
+ */
652
+ declare const resolvePluginObject: <T extends PluginObject = PluginObject>(app: App, plugin: Plugin<T>) => T;
653
+
654
+ /**
655
+ * Resolve theme info and its parent theme info
656
+ */
657
+ declare const resolveThemeInfo: (app: App, theme: Theme) => ThemeInfo;
658
+
659
+ declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
660
+
661
+ /**
662
+ * Infer page path according to file path
663
+ */
664
+ declare const inferPagePath: ({ app, filePathRelative, }: {
665
+ app: App;
666
+ filePathRelative: string | null;
667
+ }) => {
668
+ pathInferred: string | null;
669
+ pathLocale: string;
670
+ };
671
+
672
+ /**
673
+ * Render page content and extract related info
674
+ */
675
+ declare const renderPageContent: ({ app, content, filePath, filePathRelative, options, }: {
676
+ app: App;
677
+ content: string;
678
+ filePath: string | null;
679
+ filePathRelative: string | null;
680
+ options: PageOptions;
681
+ }) => {
682
+ contentRendered: string;
683
+ deps: string[];
684
+ markdownEnv: Record<string, unknown>;
685
+ frontmatter: PageFrontmatter;
686
+ headers: MarkdownHeader[];
687
+ links: MarkdownLink[];
688
+ sfcBlocks: MarkdownSfcBlocks;
689
+ title: string;
690
+ };
691
+
692
+ /**
693
+ * Resolve page component and related info
694
+ */
695
+ declare const resolvePageComponentInfo: ({ app, htmlFilePathRelative, key, }: {
696
+ app: App;
697
+ htmlFilePathRelative: string;
698
+ key: string;
699
+ }) => Promise<{
700
+ componentFilePath: string;
701
+ componentFilePathRelative: string;
702
+ componentFileChunkName: string;
703
+ }>;
704
+
705
+ /**
706
+ * Resolve page data file path
707
+ */
708
+ declare const resolvePageDataInfo: ({ app, htmlFilePathRelative, key, }: {
709
+ app: App;
710
+ htmlFilePathRelative: string;
711
+ key: string;
712
+ }) => {
713
+ dataFilePath: string;
714
+ dataFilePathRelative: string;
715
+ dataFileChunkName: string;
716
+ };
717
+
718
+ /**
719
+ * Resolve page date according to frontmatter or file path
720
+ *
721
+ * It will be resolved as 'yyyy-MM-dd' format
722
+ */
723
+ declare const resolvePageDate: ({ frontmatter, filePathRelative, }: {
724
+ frontmatter: PageFrontmatter;
725
+ filePathRelative: string | null;
726
+ }) => string;
727
+
728
+ /**
729
+ * Resolve page file content according to filePath or options content
730
+ */
731
+ declare const resolvePageFileContent: ({ filePath, options, }: {
732
+ filePath: string | null;
733
+ options: PageOptions;
734
+ }) => Promise<string>;
735
+
736
+ /**
737
+ * Resolve absolute and relative path of page file
738
+ */
739
+ declare const resolvePageFilePath: ({ app, options, }: {
740
+ app: App;
741
+ options: PageOptions;
742
+ }) => {
743
+ filePath: string | null;
744
+ filePathRelative: string | null;
745
+ };
746
+
747
+ /**
748
+ * Resolve page rendered html file path
749
+ */
750
+ declare const resolvePageHtmlInfo: ({ app, path: pagePath, }: {
751
+ app: App;
752
+ path: string;
753
+ }) => {
754
+ htmlFilePath: string;
755
+ htmlFilePathRelative: string;
756
+ };
757
+
758
+ /**
759
+ * Resolve page key to identify the page
760
+ */
761
+ declare const resolvePageKey: ({ path }: {
762
+ path: string;
763
+ }) => string;
764
+
765
+ /**
766
+ * Resolve language of page
767
+ */
768
+ declare const resolvePageLang: ({ app, frontmatter, pathLocale, }: {
769
+ app: App;
770
+ frontmatter: PageFrontmatter;
771
+ pathLocale: string;
772
+ }) => string;
773
+
774
+ /**
775
+ * Resolve the final route path of a page
776
+ */
777
+ declare const resolvePagePath: ({ permalink, pathInferred, options, }: {
778
+ permalink: string | null;
779
+ pathInferred: string | null;
780
+ options: PageOptions;
781
+ }) => string;
782
+
783
+ /**
784
+ * Resolve page permalink from frontmatter / options / pattern
785
+ */
786
+ declare const resolvePagePermalink: ({ app, frontmatter, slug, date, pathInferred, pathLocale, }: {
787
+ app: App;
788
+ frontmatter: PageFrontmatter;
789
+ slug: string;
790
+ date: string;
791
+ pathInferred: string | null;
792
+ pathLocale: string;
793
+ }) => string | null;
794
+
795
+ /**
796
+ * Resolve page route meta
797
+ */
798
+ declare const resolvePageRouteMeta: ({ frontmatter, }: {
799
+ frontmatter: PageFrontmatter;
800
+ }) => Record<string, unknown>;
801
+
802
+ /**
803
+ * Resolve page slug from filename
804
+ */
805
+ declare const resolvePageSlug: ({ filePathRelative, }: {
806
+ filePathRelative: string | null;
807
+ }) => string;
808
+
809
+ /**
810
+ * Create hook queue for plugin system
811
+ */
812
+ declare const createHookQueue: <T extends keyof Hooks>(name: T) => HookQueue<T>;
813
+
814
+ declare const createPluginApi: () => PluginApi;
815
+
816
+ declare const createPluginApiHooks: () => PluginApi['hooks'];
817
+
818
+ declare const createPluginApiRegisterHooks: (plugins: PluginApi['plugins'], hooks: PluginApi['hooks']) => PluginApi['registerHooks'];
819
+
820
+ /**
821
+ * Normalize alias and define hook
822
+ */
823
+ declare const normalizeAliasDefineHook: (hook: AliasDefineHook['exposed']) => AliasDefineHook['normalized'];
824
+
825
+ /**
826
+ * Normalize hook for client config file
827
+ */
828
+ declare const normalizeClientConfigFileHook: (hook: ClientConfigFileHook['exposed']) => ClientConfigFileHook['normalized'];
829
+
830
+ export { AliasDefineHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppWriteTemp, BuildApp, Bundler, ClientConfigFileHook, DevApp, ExtendsHook, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, Page, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, Theme, ThemeFunction, ThemeInfo, ThemeObject, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, prepareClientConfigs, preparePageComponent, preparePageData, preparePagesComponents, preparePagesData, preparePagesRoutes, prepareSiteData, renderPageContent, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageComponentInfo, resolvePageDataInfo, resolvePageDate, resolvePageFileContent, resolvePageFilePath, resolvePageHtmlInfo, resolvePageKey, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };