@vuepress/core 2.0.0-rc.2 → 2.0.0-rc.20
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/README.md +1 -1
- package/dist/index.d.ts +166 -312
- package/dist/index.js +275 -291
- package/package.json +6 -6
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MarkdownLink, MarkdownSfcBlocks, MarkdownOptions, Markdown
|
|
2
|
-
import { PageBase, PageData,
|
|
1
|
+
import { MarkdownLink, MarkdownSfcBlocks, MarkdownOptions, Markdown } from '@vuepress/markdown';
|
|
2
|
+
import { PageFrontmatter, PageBase, PageData, SiteData } from '@vuepress/shared';
|
|
3
3
|
export { HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, LocaleConfig, LocaleData, PageData, PageFrontmatter, PageHeader, SiteData, SiteLocaleConfig } from '@vuepress/shared';
|
|
4
4
|
import { TemplateRenderer } from '@vuepress/utils';
|
|
5
5
|
|
|
@@ -11,15 +11,25 @@ import { TemplateRenderer } from '@vuepress/utils';
|
|
|
11
11
|
* - build: bundle assets for deployment
|
|
12
12
|
*/
|
|
13
13
|
interface Bundler {
|
|
14
|
+
/**
|
|
15
|
+
* Name of the bundler
|
|
16
|
+
*/
|
|
14
17
|
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Method to run vuepress app in dev mode, starting dev server
|
|
20
|
+
*/
|
|
15
21
|
dev: (app: App) => Promise<() => Promise<void>>;
|
|
22
|
+
/**
|
|
23
|
+
* Method to run vuepress app in build mode, generating static pages and assets
|
|
24
|
+
*/
|
|
16
25
|
build: (app: App) => Promise<void>;
|
|
17
26
|
}
|
|
27
|
+
type BundlerOptions = Record<string, unknown>;
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* Vuepress Page
|
|
21
31
|
*/
|
|
22
|
-
type Page<ExtraPageData extends Record<
|
|
32
|
+
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> & {
|
|
23
33
|
/**
|
|
24
34
|
* Data of the page, which will be available in client code
|
|
25
35
|
*/
|
|
@@ -73,9 +83,7 @@ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPa
|
|
|
73
83
|
*/
|
|
74
84
|
permalink: string | null;
|
|
75
85
|
/**
|
|
76
|
-
* Custom data to be attached to
|
|
77
|
-
*
|
|
78
|
-
* @see https://router.vuejs.org/api/#meta
|
|
86
|
+
* Custom data to be attached to route record
|
|
79
87
|
*/
|
|
80
88
|
routeMeta: Record<string, unknown>;
|
|
81
89
|
/**
|
|
@@ -107,25 +115,19 @@ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPa
|
|
|
107
115
|
*/
|
|
108
116
|
componentFilePathRelative: string;
|
|
109
117
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* Only take effect in webpack
|
|
118
|
+
* Chunk file path
|
|
113
119
|
*/
|
|
114
|
-
|
|
120
|
+
chunkFilePath: string;
|
|
115
121
|
/**
|
|
116
|
-
*
|
|
122
|
+
* Chunk file path relative to temp directory
|
|
117
123
|
*/
|
|
118
|
-
|
|
124
|
+
chunkFilePathRelative: string;
|
|
119
125
|
/**
|
|
120
|
-
*
|
|
121
|
-
*/
|
|
122
|
-
dataFilePathRelative: string;
|
|
123
|
-
/**
|
|
124
|
-
* Page data file chunk name
|
|
126
|
+
* Chunk name
|
|
125
127
|
*
|
|
126
|
-
*
|
|
128
|
+
* This will only take effect in webpack
|
|
127
129
|
*/
|
|
128
|
-
|
|
130
|
+
chunkName: string;
|
|
129
131
|
/**
|
|
130
132
|
* Rendered html file path
|
|
131
133
|
*/
|
|
@@ -140,11 +142,10 @@ type Page<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPa
|
|
|
140
142
|
*/
|
|
141
143
|
interface PageOptions {
|
|
142
144
|
/**
|
|
143
|
-
*
|
|
144
|
-
* markdown content of the page.
|
|
145
|
+
* The raw markdown content of the page.
|
|
145
146
|
*
|
|
146
|
-
* If `
|
|
147
|
-
*
|
|
147
|
+
* If `content` is not provided, the file content of the `filePath`
|
|
148
|
+
* will be used.
|
|
148
149
|
*/
|
|
149
150
|
content?: string;
|
|
150
151
|
/**
|
|
@@ -167,7 +168,7 @@ type PromiseOrNot<T> = Promise<T> | T;
|
|
|
167
168
|
interface Closable {
|
|
168
169
|
close(): void;
|
|
169
170
|
}
|
|
170
|
-
interface Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...args: any) => infer U ? U extends Promise<infer V> ? V : U :
|
|
171
|
+
interface Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...args: any) => infer U ? U extends Promise<infer V> ? V : U : never> {
|
|
171
172
|
exposed: Exposed;
|
|
172
173
|
normalized: Normalized;
|
|
173
174
|
result: Result;
|
|
@@ -175,7 +176,7 @@ interface Hook<Exposed, Normalized = Exposed, Result = Normalized extends (...ar
|
|
|
175
176
|
type LifeCycleHook<T extends unknown[] = []> = Hook<(app: App, ...args: T) => PromiseOrNot<void>>;
|
|
176
177
|
type ExtendsHook<T> = Hook<(extendable: T, app: App) => PromiseOrNot<void>>;
|
|
177
178
|
type ClientConfigFileHook = Hook<string | ((app: App) => PromiseOrNot<string>), (app: App) => Promise<string>>;
|
|
178
|
-
type AliasDefineHook = Hook<Record<string,
|
|
179
|
+
type AliasDefineHook = Hook<Record<string, unknown> | ((app: App, isServer: boolean) => PromiseOrNot<Record<string, unknown>>), (app: App, isServer: boolean) => Promise<Record<string, unknown>>>;
|
|
179
180
|
/**
|
|
180
181
|
* List of hooks
|
|
181
182
|
*/
|
|
@@ -188,7 +189,7 @@ interface Hooks {
|
|
|
188
189
|
extendsMarkdown: ExtendsHook<Markdown>;
|
|
189
190
|
extendsPageOptions: ExtendsHook<PageOptions>;
|
|
190
191
|
extendsPage: ExtendsHook<Page>;
|
|
191
|
-
extendsBundlerOptions: ExtendsHook<
|
|
192
|
+
extendsBundlerOptions: ExtendsHook<BundlerOptions>;
|
|
192
193
|
clientConfigFile: ClientConfigFileHook;
|
|
193
194
|
alias: AliasDefineHook;
|
|
194
195
|
define: AliasDefineHook;
|
|
@@ -263,7 +264,7 @@ interface PluginApi {
|
|
|
263
264
|
*
|
|
264
265
|
* A plugin package should have a `Plugin` as the default export
|
|
265
266
|
*/
|
|
266
|
-
type Plugin<T extends PluginObject = PluginObject> = T |
|
|
267
|
+
type Plugin<T extends PluginObject = PluginObject> = PluginFunction<T> | T;
|
|
267
268
|
/**
|
|
268
269
|
* Vuepress plugin function
|
|
269
270
|
*
|
|
@@ -274,7 +275,13 @@ type PluginFunction<T extends PluginObject = PluginObject> = (app: App) => T;
|
|
|
274
275
|
* Vuepress plugin object
|
|
275
276
|
*/
|
|
276
277
|
interface PluginObject extends Partial<HooksExposed> {
|
|
278
|
+
/**
|
|
279
|
+
* Name of the plugin
|
|
280
|
+
*/
|
|
277
281
|
name: string;
|
|
282
|
+
/**
|
|
283
|
+
* Allow the plugin to be used multiple times or not
|
|
284
|
+
*/
|
|
278
285
|
multiple?: boolean;
|
|
279
286
|
}
|
|
280
287
|
/**
|
|
@@ -347,17 +354,87 @@ interface ThemeInfo {
|
|
|
347
354
|
* Vuepress app common config that shared between dev and build
|
|
348
355
|
*/
|
|
349
356
|
interface AppConfigCommon extends Partial<SiteData> {
|
|
357
|
+
/**
|
|
358
|
+
* Source directory of the markdown files.
|
|
359
|
+
*
|
|
360
|
+
* Vuepress will load markdown files from this directory.
|
|
361
|
+
*
|
|
362
|
+
* @required
|
|
363
|
+
*/
|
|
350
364
|
source: string;
|
|
365
|
+
/**
|
|
366
|
+
* Destination directory of the output files.
|
|
367
|
+
*
|
|
368
|
+
* Vuepress will output the static site files to this directory.
|
|
369
|
+
*
|
|
370
|
+
* @default `${source}/.vuepress/dist`
|
|
371
|
+
*/
|
|
351
372
|
dest?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Temp files directory.
|
|
375
|
+
*
|
|
376
|
+
* Vuepress will write temp files to this directory.
|
|
377
|
+
*
|
|
378
|
+
* @default `${source}/.vuepress/.temp`
|
|
379
|
+
*/
|
|
352
380
|
temp?: string;
|
|
381
|
+
/**
|
|
382
|
+
* Cache files directory.
|
|
383
|
+
*
|
|
384
|
+
* Vuepress will write cache files to this directory.
|
|
385
|
+
*
|
|
386
|
+
* @default `${source}/.vuepress/.cache`
|
|
387
|
+
*/
|
|
353
388
|
cache?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Public files directory.
|
|
391
|
+
*
|
|
392
|
+
* Vuepress will copy the files from public directory to the output directory.
|
|
393
|
+
*
|
|
394
|
+
* @default `${source}/.vuepress/public`
|
|
395
|
+
*/
|
|
354
396
|
public?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Whether to enable debug mode
|
|
399
|
+
*
|
|
400
|
+
* @default false
|
|
401
|
+
*/
|
|
355
402
|
debug?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Markdown options
|
|
405
|
+
*
|
|
406
|
+
* @default {}
|
|
407
|
+
*/
|
|
356
408
|
markdown?: MarkdownOptions;
|
|
409
|
+
/**
|
|
410
|
+
* Patterns to match the markdown files as pages
|
|
411
|
+
*
|
|
412
|
+
* @default ['**\/*.md', '!.vuepress', '!node_modules']
|
|
413
|
+
*/
|
|
357
414
|
pagePatterns?: string[];
|
|
415
|
+
/**
|
|
416
|
+
* Pattern to generate permalink for pages
|
|
417
|
+
*
|
|
418
|
+
* @default null
|
|
419
|
+
*/
|
|
358
420
|
permalinkPattern?: string | null;
|
|
421
|
+
/**
|
|
422
|
+
* Vuepress bundler
|
|
423
|
+
*
|
|
424
|
+
* @required
|
|
425
|
+
*/
|
|
359
426
|
bundler: Bundler;
|
|
427
|
+
/**
|
|
428
|
+
* Vuepress theme
|
|
429
|
+
*
|
|
430
|
+
* @required
|
|
431
|
+
*/
|
|
360
432
|
theme: Theme;
|
|
433
|
+
/**
|
|
434
|
+
* Vuepress plugins
|
|
435
|
+
*
|
|
436
|
+
* @default []
|
|
437
|
+
*/
|
|
361
438
|
plugins?: PluginConfig;
|
|
362
439
|
}
|
|
363
440
|
/**
|
|
@@ -399,14 +476,14 @@ interface AppConfigBuild {
|
|
|
399
476
|
*
|
|
400
477
|
* @default true
|
|
401
478
|
*/
|
|
402
|
-
shouldPreload?: ((file: string, type: string) => boolean)
|
|
479
|
+
shouldPreload?: boolean | ((file: string, type: string) => boolean);
|
|
403
480
|
/**
|
|
404
481
|
* Determine what resource files should be prefetched. Use boolean value to
|
|
405
482
|
* totally enable / disable.
|
|
406
483
|
*
|
|
407
484
|
* @default true
|
|
408
485
|
*/
|
|
409
|
-
shouldPrefetch?: ((file: string, type: string) => boolean)
|
|
486
|
+
shouldPrefetch?: boolean | ((file: string, type: string) => boolean);
|
|
410
487
|
/**
|
|
411
488
|
* Specify the path of the HTML template to be used for build
|
|
412
489
|
*
|
|
@@ -416,16 +493,20 @@ interface AppConfigBuild {
|
|
|
416
493
|
/**
|
|
417
494
|
* Specify the HTML template renderer to be used for build
|
|
418
495
|
*
|
|
419
|
-
* @default templateRenderer from '@vuepress/utils'
|
|
496
|
+
* @default `import { templateRenderer } from '@vuepress/utils'`
|
|
420
497
|
*/
|
|
421
498
|
templateBuildRenderer?: TemplateRenderer;
|
|
422
499
|
}
|
|
423
500
|
/**
|
|
424
|
-
* Vuepress app config
|
|
501
|
+
* Vuepress app user config.
|
|
502
|
+
*
|
|
503
|
+
* It would be provided by user, typically via a config file.
|
|
425
504
|
*/
|
|
426
|
-
type AppConfig =
|
|
505
|
+
type AppConfig = AppConfigBuild & AppConfigCommon & AppConfigDev;
|
|
427
506
|
/**
|
|
428
|
-
* Vuepress app options
|
|
507
|
+
* Vuepress app options that resolved from user config.
|
|
508
|
+
*
|
|
509
|
+
* It fills all optional fields with a default value.
|
|
429
510
|
*/
|
|
430
511
|
type AppOptions = Required<AppConfig>;
|
|
431
512
|
|
|
@@ -437,11 +518,29 @@ type AppDirFunction = (...args: string[]) => string;
|
|
|
437
518
|
* Directory utils
|
|
438
519
|
*/
|
|
439
520
|
interface AppDir {
|
|
521
|
+
/**
|
|
522
|
+
* Resolve file path in cache directory
|
|
523
|
+
*/
|
|
440
524
|
cache: AppDirFunction;
|
|
525
|
+
/**
|
|
526
|
+
* Resolve file path in temp directory
|
|
527
|
+
*/
|
|
441
528
|
temp: AppDirFunction;
|
|
529
|
+
/**
|
|
530
|
+
* Resolve file path in source directory
|
|
531
|
+
*/
|
|
442
532
|
source: AppDirFunction;
|
|
533
|
+
/**
|
|
534
|
+
* Resolve file path in dest directory
|
|
535
|
+
*/
|
|
443
536
|
dest: AppDirFunction;
|
|
537
|
+
/**
|
|
538
|
+
* Resolve file path in public directory
|
|
539
|
+
*/
|
|
444
540
|
public: AppDirFunction;
|
|
541
|
+
/**
|
|
542
|
+
* Resolve file path in client directory
|
|
543
|
+
*/
|
|
445
544
|
client: AppDirFunction;
|
|
446
545
|
}
|
|
447
546
|
/**
|
|
@@ -467,41 +566,33 @@ interface AppEnv {
|
|
|
467
566
|
type AppWriteTemp = (file: string, content: string) => Promise<string>;
|
|
468
567
|
|
|
469
568
|
/**
|
|
470
|
-
*
|
|
569
|
+
* App base properties, will be available after creation, even before initialization
|
|
471
570
|
*/
|
|
472
|
-
interface
|
|
571
|
+
interface AppPropertiesBase {
|
|
473
572
|
/**
|
|
474
|
-
* Directory utils
|
|
573
|
+
* Directory utils.
|
|
475
574
|
*/
|
|
476
575
|
dir: AppDir;
|
|
477
576
|
/**
|
|
478
|
-
* Environment flags
|
|
577
|
+
* Environment flags.
|
|
479
578
|
*/
|
|
480
579
|
env: AppEnv;
|
|
481
580
|
/**
|
|
482
|
-
* Options that filled all optional fields with a default value
|
|
581
|
+
* Options that filled all optional fields with a default value.
|
|
483
582
|
*/
|
|
484
583
|
options: AppOptions;
|
|
485
584
|
/**
|
|
486
|
-
* Plugin system
|
|
585
|
+
* Plugin system.
|
|
487
586
|
*/
|
|
488
587
|
pluginApi: PluginApi;
|
|
489
588
|
/**
|
|
490
|
-
* Site data, which will be used in client side
|
|
589
|
+
* Site data, which will be used in client side.
|
|
491
590
|
*/
|
|
492
591
|
siteData: SiteData;
|
|
493
592
|
/**
|
|
494
|
-
* Version of vuepress core
|
|
593
|
+
* Version of vuepress core.
|
|
495
594
|
*/
|
|
496
595
|
version: string;
|
|
497
|
-
/**
|
|
498
|
-
* Write temp file
|
|
499
|
-
*/
|
|
500
|
-
writeTemp: AppWriteTemp;
|
|
501
|
-
/**
|
|
502
|
-
* Use a plugin
|
|
503
|
-
*/
|
|
504
|
-
use: (plugin: Plugin) => this;
|
|
505
596
|
/**
|
|
506
597
|
* Initialize app.
|
|
507
598
|
*
|
|
@@ -515,6 +606,21 @@ interface App {
|
|
|
515
606
|
* Should be called after `app.init()`.
|
|
516
607
|
*/
|
|
517
608
|
prepare: () => Promise<void>;
|
|
609
|
+
/**
|
|
610
|
+
* Use a plugin.
|
|
611
|
+
*
|
|
612
|
+
* Should be called before `app.init()`.
|
|
613
|
+
*/
|
|
614
|
+
use: (plugin: Plugin) => this;
|
|
615
|
+
/**
|
|
616
|
+
* Util to write temp file
|
|
617
|
+
*/
|
|
618
|
+
writeTemp: AppWriteTemp;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* App initialized properties, will only be available after initialization
|
|
622
|
+
*/
|
|
623
|
+
interface AppPropertiesInitialized {
|
|
518
624
|
/**
|
|
519
625
|
* Markdown-it instance.
|
|
520
626
|
*
|
|
@@ -528,6 +634,10 @@ interface App {
|
|
|
528
634
|
*/
|
|
529
635
|
pages: Page[];
|
|
530
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Vuepress app instance
|
|
639
|
+
*/
|
|
640
|
+
type App = AppPropertiesBase & AppPropertiesInitialized;
|
|
531
641
|
/**
|
|
532
642
|
* Vuepress dev app
|
|
533
643
|
*/
|
|
@@ -552,294 +662,38 @@ interface BuildApp extends App {
|
|
|
552
662
|
}
|
|
553
663
|
|
|
554
664
|
/**
|
|
555
|
-
* Generate
|
|
665
|
+
* Generate page chunk temp file of a single page
|
|
556
666
|
*/
|
|
557
|
-
declare const
|
|
667
|
+
declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
|
|
558
668
|
|
|
559
669
|
/**
|
|
560
670
|
* Generate page component temp file of a single page
|
|
561
671
|
*/
|
|
562
672
|
declare const preparePageComponent: (app: App, page: Page) => Promise<void>;
|
|
563
673
|
|
|
564
|
-
/**
|
|
565
|
-
* Generate page data temp file of a single page
|
|
566
|
-
*/
|
|
567
|
-
declare const preparePageData: (app: App, page: Page) => Promise<void>;
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Generate page key to page component map temp file
|
|
571
|
-
*/
|
|
572
|
-
declare const preparePagesComponents: (app: App) => Promise<void>;
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Generate page path to page data map temp file
|
|
576
|
-
*/
|
|
577
|
-
declare const preparePagesData: (app: App) => Promise<void>;
|
|
578
|
-
|
|
579
674
|
/**
|
|
580
675
|
* Generate routes temp file
|
|
581
676
|
*/
|
|
582
|
-
declare const
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Generate site data temp file
|
|
586
|
-
*/
|
|
587
|
-
declare const prepareSiteData: (app: App) => Promise<void>;
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Initialize a vuepress app
|
|
591
|
-
*
|
|
592
|
-
* Plugins should be used before initialization.
|
|
593
|
-
*/
|
|
594
|
-
declare const appInit: (app: App) => Promise<void>;
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Prepare files for development or build
|
|
598
|
-
*
|
|
599
|
-
* - page components
|
|
600
|
-
* - routes
|
|
601
|
-
* - site data
|
|
602
|
-
* - other files that generated by plugins
|
|
603
|
-
*/
|
|
604
|
-
declare const appPrepare: (app: App) => Promise<void>;
|
|
605
|
-
|
|
606
|
-
declare const appUse: (app: App, rawPlugin: Plugin) => App;
|
|
677
|
+
declare const prepareRoutes: (app: App) => Promise<void>;
|
|
607
678
|
|
|
608
679
|
/**
|
|
609
|
-
* Create vuepress app
|
|
610
|
-
*/
|
|
611
|
-
declare const createBaseApp: (config: AppConfig, isBuild?: boolean) => App;
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Create vuepress build app
|
|
680
|
+
* Create vuepress build app.
|
|
615
681
|
*/
|
|
616
682
|
declare const createBuildApp: (config: AppConfig) => BuildApp;
|
|
617
683
|
|
|
618
684
|
/**
|
|
619
|
-
* Create vuepress dev app
|
|
685
|
+
* Create vuepress dev app.
|
|
620
686
|
*/
|
|
621
687
|
declare const createDevApp: (config: AppConfig) => DevApp;
|
|
622
688
|
|
|
623
|
-
/**
|
|
624
|
-
* Create directory util function
|
|
625
|
-
*/
|
|
626
|
-
declare const createAppDirFunction: (baseDir: string) => AppDirFunction;
|
|
627
689
|
/**
|
|
628
690
|
* Resolve directory utils for vuepress app
|
|
629
691
|
*/
|
|
630
692
|
declare const resolveAppDir: (options: AppOptions) => AppDir;
|
|
631
693
|
|
|
632
694
|
/**
|
|
633
|
-
*
|
|
634
|
-
*/
|
|
635
|
-
declare const resolveAppEnv: (options: AppOptions, isBuild: boolean) => AppEnv;
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Create app options with default values
|
|
695
|
+
* Create vuepress page object
|
|
639
696
|
*/
|
|
640
|
-
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;
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* Resolve pages for vuepress app
|
|
644
|
-
*/
|
|
645
|
-
declare const resolveAppPages: (app: App) => Promise<Page[]>;
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Resolve site data for vuepress app
|
|
649
|
-
*
|
|
650
|
-
* Site data will also be used in client
|
|
651
|
-
*/
|
|
652
|
-
declare const resolveAppSiteData: (options: AppOptions) => SiteData;
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Resolve version of vuepress app
|
|
656
|
-
*/
|
|
657
|
-
declare const resolveAppVersion: () => string;
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Resolve write temp file util for vuepress app
|
|
661
|
-
*/
|
|
662
|
-
declare const resolveAppWriteTemp: (dir: AppDir) => AppWriteTemp;
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Resolve a plugin object according to name / path / module and config
|
|
666
|
-
*/
|
|
667
|
-
declare const resolvePluginObject: <T extends PluginObject = PluginObject>(app: App, plugin: Plugin<T>) => T;
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* Resolve theme info and its parent theme info
|
|
671
|
-
*/
|
|
672
|
-
declare const resolveThemeInfo: (app: App, theme: Theme) => ThemeInfo;
|
|
673
|
-
|
|
674
697
|
declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
|
|
675
698
|
|
|
676
|
-
|
|
677
|
-
* Infer page path according to file path
|
|
678
|
-
*/
|
|
679
|
-
declare const inferPagePath: ({ app, filePathRelative, }: {
|
|
680
|
-
app: App;
|
|
681
|
-
filePathRelative: string | null;
|
|
682
|
-
}) => {
|
|
683
|
-
pathInferred: string | null;
|
|
684
|
-
pathLocale: string;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Render page content and extract related info
|
|
689
|
-
*/
|
|
690
|
-
declare const renderPageContent: ({ app, content, filePath, filePathRelative, options, }: {
|
|
691
|
-
app: App;
|
|
692
|
-
content: string;
|
|
693
|
-
filePath: string | null;
|
|
694
|
-
filePathRelative: string | null;
|
|
695
|
-
options: PageOptions;
|
|
696
|
-
}) => {
|
|
697
|
-
contentRendered: string;
|
|
698
|
-
deps: string[];
|
|
699
|
-
markdownEnv: Record<string, unknown>;
|
|
700
|
-
frontmatter: PageFrontmatter;
|
|
701
|
-
headers: MarkdownHeader[];
|
|
702
|
-
links: MarkdownLink[];
|
|
703
|
-
sfcBlocks: MarkdownSfcBlocks;
|
|
704
|
-
title: string;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Resolve page component and related info
|
|
709
|
-
*/
|
|
710
|
-
declare const resolvePageComponentInfo: ({ app, htmlFilePathRelative, key, }: {
|
|
711
|
-
app: App;
|
|
712
|
-
htmlFilePathRelative: string;
|
|
713
|
-
key: string;
|
|
714
|
-
}) => Promise<{
|
|
715
|
-
componentFilePath: string;
|
|
716
|
-
componentFilePathRelative: string;
|
|
717
|
-
componentFileChunkName: string;
|
|
718
|
-
}>;
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* Resolve page data file path
|
|
722
|
-
*/
|
|
723
|
-
declare const resolvePageDataInfo: ({ app, htmlFilePathRelative, key, }: {
|
|
724
|
-
app: App;
|
|
725
|
-
htmlFilePathRelative: string;
|
|
726
|
-
key: string;
|
|
727
|
-
}) => {
|
|
728
|
-
dataFilePath: string;
|
|
729
|
-
dataFilePathRelative: string;
|
|
730
|
-
dataFileChunkName: string;
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Resolve page date according to frontmatter or file path
|
|
735
|
-
*
|
|
736
|
-
* It will be resolved as 'yyyy-MM-dd' format
|
|
737
|
-
*/
|
|
738
|
-
declare const resolvePageDate: ({ frontmatter, filePathRelative, }: {
|
|
739
|
-
frontmatter: PageFrontmatter;
|
|
740
|
-
filePathRelative: string | null;
|
|
741
|
-
}) => string;
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* Resolve page file content according to filePath or options content
|
|
745
|
-
*/
|
|
746
|
-
declare const resolvePageFileContent: ({ filePath, options, }: {
|
|
747
|
-
filePath: string | null;
|
|
748
|
-
options: PageOptions;
|
|
749
|
-
}) => Promise<string>;
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* Resolve absolute and relative path of page file
|
|
753
|
-
*/
|
|
754
|
-
declare const resolvePageFilePath: ({ app, options, }: {
|
|
755
|
-
app: App;
|
|
756
|
-
options: PageOptions;
|
|
757
|
-
}) => {
|
|
758
|
-
filePath: string | null;
|
|
759
|
-
filePathRelative: string | null;
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Resolve page rendered html file path
|
|
764
|
-
*/
|
|
765
|
-
declare const resolvePageHtmlInfo: ({ app, path: pagePath, }: {
|
|
766
|
-
app: App;
|
|
767
|
-
path: string;
|
|
768
|
-
}) => {
|
|
769
|
-
htmlFilePath: string;
|
|
770
|
-
htmlFilePathRelative: string;
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Resolve page key to identify the page
|
|
775
|
-
*/
|
|
776
|
-
declare const resolvePageKey: ({ path }: {
|
|
777
|
-
path: string;
|
|
778
|
-
}) => string;
|
|
779
|
-
|
|
780
|
-
/**
|
|
781
|
-
* Resolve language of page
|
|
782
|
-
*/
|
|
783
|
-
declare const resolvePageLang: ({ app, frontmatter, pathLocale, }: {
|
|
784
|
-
app: App;
|
|
785
|
-
frontmatter: PageFrontmatter;
|
|
786
|
-
pathLocale: string;
|
|
787
|
-
}) => string;
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* Resolve the final route path of a page
|
|
791
|
-
*/
|
|
792
|
-
declare const resolvePagePath: ({ permalink, pathInferred, options, }: {
|
|
793
|
-
permalink: string | null;
|
|
794
|
-
pathInferred: string | null;
|
|
795
|
-
options: PageOptions;
|
|
796
|
-
}) => string;
|
|
797
|
-
|
|
798
|
-
/**
|
|
799
|
-
* Resolve page permalink from frontmatter / options / pattern
|
|
800
|
-
*/
|
|
801
|
-
declare const resolvePagePermalink: ({ app, frontmatter, slug, date, pathInferred, pathLocale, }: {
|
|
802
|
-
app: App;
|
|
803
|
-
frontmatter: PageFrontmatter;
|
|
804
|
-
slug: string;
|
|
805
|
-
date: string;
|
|
806
|
-
pathInferred: string | null;
|
|
807
|
-
pathLocale: string;
|
|
808
|
-
}) => string | null;
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Resolve page route meta
|
|
812
|
-
*/
|
|
813
|
-
declare const resolvePageRouteMeta: ({ frontmatter, }: {
|
|
814
|
-
frontmatter: PageFrontmatter;
|
|
815
|
-
}) => Record<string, unknown>;
|
|
816
|
-
|
|
817
|
-
/**
|
|
818
|
-
* Resolve page slug from filename
|
|
819
|
-
*/
|
|
820
|
-
declare const resolvePageSlug: ({ filePathRelative, }: {
|
|
821
|
-
filePathRelative: string | null;
|
|
822
|
-
}) => string;
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Create hook queue for plugin system
|
|
826
|
-
*/
|
|
827
|
-
declare const createHookQueue: <T extends keyof Hooks>(name: T) => HookQueue<T>;
|
|
828
|
-
|
|
829
|
-
declare const createPluginApi: () => PluginApi;
|
|
830
|
-
|
|
831
|
-
declare const createPluginApiHooks: () => PluginApi['hooks'];
|
|
832
|
-
|
|
833
|
-
declare const createPluginApiRegisterHooks: (plugins: PluginApi['plugins'], hooks: PluginApi['hooks']) => PluginApi['registerHooks'];
|
|
834
|
-
|
|
835
|
-
/**
|
|
836
|
-
* Normalize alias and define hook
|
|
837
|
-
*/
|
|
838
|
-
declare const normalizeAliasDefineHook: (hook: AliasDefineHook['exposed']) => AliasDefineHook['normalized'];
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Normalize hook for client config file
|
|
842
|
-
*/
|
|
843
|
-
declare const normalizeClientConfigFileHook: (hook: ClientConfigFileHook['exposed']) => ClientConfigFileHook['normalized'];
|
|
844
|
-
|
|
845
|
-
export { type AliasDefineHook, type App, type AppConfig, type AppConfigBuild, type AppConfigCommon, type AppConfigDev, type AppDir, type AppDirFunction, type AppEnv, type AppOptions, type AppWriteTemp, type BuildApp, type Bundler, type ClientConfigFileHook, type DevApp, type ExtendsHook, type Hook, type HookItem, type HookQueue, type Hooks, type HooksExposed, type HooksName, type HooksNormalized, type HooksResult, type LifeCycleHook, type Page, type PageOptions, type Plugin, type PluginApi, type PluginConfig, type PluginFunction, type PluginObject, type Theme, type ThemeFunction, type ThemeInfo, type 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 };
|
|
699
|
+
export { type AliasDefineHook, type App, type AppConfig, type AppConfigBuild, type AppConfigCommon, type AppConfigDev, type AppDir, type AppDirFunction, type AppEnv, type AppOptions, type AppPropertiesBase, type AppPropertiesInitialized, type AppWriteTemp, type BuildApp, type Bundler, type BundlerOptions, type ClientConfigFileHook, type DevApp, type ExtendsHook, type Hook, type HookItem, type HookQueue, type Hooks, type HooksExposed, type HooksName, type HooksNormalized, type HooksResult, type LifeCycleHook, type Page, type PageOptions, type Plugin, type PluginApi, type PluginConfig, type PluginFunction, type PluginObject, type Theme, type ThemeFunction, type ThemeInfo, type ThemeObject, createBuildApp, createDevApp, createPage, preparePageChunk, preparePageComponent, prepareRoutes, resolveAppDir };
|