@vuepress/core 2.0.0-rc.31 → 2.0.0-rc.32
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 +9 -45
- package/dist/index.js +46 -88
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
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
2
|
import { TemplateRenderer } from "@vuepress/utils";
|
|
3
3
|
import { Markdown, MarkdownLink, MarkdownOptions, MarkdownSfcBlocks } from "@vuepress/markdown";
|
|
4
|
-
//#region src/types/helpers.d.ts
|
|
5
4
|
type DeepPartialArray<T> = DeepPartial<T>[];
|
|
6
5
|
type DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]>; };
|
|
7
6
|
type DeepPartial<T> = T extends Function ? T : T extends (infer U)[] ? DeepPartialArray<U> : T extends object ? DeepPartialObject<T> : T | undefined;
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/types/bundler.d.ts
|
|
10
7
|
/**
|
|
11
8
|
* Vuepress bundler
|
|
12
9
|
*
|
|
@@ -37,8 +34,6 @@ interface Bundler {
|
|
|
37
34
|
mergeConfig: <Config extends Record<string, unknown> = Record<string, unknown>>(currentConfig: Config, newConfig: DeepPartial<Config>) => Config;
|
|
38
35
|
}
|
|
39
36
|
type BundlerOptions = Record<string, unknown>;
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/types/page.d.ts
|
|
42
37
|
/**
|
|
43
38
|
* Vuepress Page
|
|
44
39
|
*/
|
|
@@ -172,8 +167,6 @@ interface PageOptions {
|
|
|
172
167
|
*/
|
|
173
168
|
path?: string;
|
|
174
169
|
}
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region src/types/pluginApi/hooks.d.ts
|
|
177
170
|
type PromiseOrNot<T> = Promise<T> | T;
|
|
178
171
|
interface Closable {
|
|
179
172
|
close(): void;
|
|
@@ -238,8 +231,6 @@ interface HookQueue<T extends HooksName> {
|
|
|
238
231
|
add: (item: HookItem<T>) => void;
|
|
239
232
|
process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
|
|
240
233
|
}
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/types/pluginApi/pluginApi.d.ts
|
|
243
234
|
/**
|
|
244
235
|
* Vuepress plugin system
|
|
245
236
|
*/
|
|
@@ -259,8 +250,6 @@ interface PluginApi {
|
|
|
259
250
|
*/
|
|
260
251
|
registerHooks: () => void;
|
|
261
252
|
}
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/types/plugin.d.ts
|
|
264
253
|
/**
|
|
265
254
|
* Vuepress plugin
|
|
266
255
|
*
|
|
@@ -294,8 +283,6 @@ interface PluginObject extends Partial<HooksExposed> {
|
|
|
294
283
|
* Config field for plugins
|
|
295
284
|
*/
|
|
296
285
|
type PluginConfig = (Plugin | Plugin[])[];
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/types/theme.d.ts
|
|
299
286
|
/**
|
|
300
287
|
* Vuepress theme
|
|
301
288
|
*
|
|
@@ -364,8 +351,6 @@ interface ThemeInfo {
|
|
|
364
351
|
*/
|
|
365
352
|
userStyle?: string;
|
|
366
353
|
}
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/types/app/options.d.ts
|
|
369
354
|
/**
|
|
370
355
|
* Vuepress app common config that shared between dev and build
|
|
371
356
|
*/
|
|
@@ -539,8 +524,6 @@ type AppConfig = AppConfigBuild & AppConfigCommon & AppConfigDev;
|
|
|
539
524
|
* It fills all optional fields with a default value.
|
|
540
525
|
*/
|
|
541
526
|
type AppOptions = Required<AppConfig>;
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region src/types/app/utils.d.ts
|
|
544
527
|
/**
|
|
545
528
|
* Directory util function
|
|
546
529
|
*/
|
|
@@ -606,8 +589,6 @@ interface AppWriteTemp {
|
|
|
606
589
|
*/
|
|
607
590
|
cleanup: () => void;
|
|
608
591
|
}
|
|
609
|
-
//#endregion
|
|
610
|
-
//#region src/types/app/app.d.ts
|
|
611
592
|
/**
|
|
612
593
|
* App base properties, will be available after creation, even before initialization
|
|
613
594
|
*/
|
|
@@ -709,50 +690,33 @@ interface BuildApp extends App {
|
|
|
709
690
|
*/
|
|
710
691
|
build: () => ReturnType<Bundler['build']>;
|
|
711
692
|
}
|
|
712
|
-
//#endregion
|
|
713
|
-
//#region src/app/prepare/preparePageChunk.d.ts
|
|
714
693
|
/**
|
|
715
694
|
* Generate temp file if the page does not have a source file
|
|
716
695
|
*/
|
|
717
|
-
declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
|
|
718
|
-
//#endregion
|
|
719
|
-
//#region src/app/prepare/prepareRoutes.d.ts
|
|
696
|
+
export declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
|
|
720
697
|
/**
|
|
721
698
|
* Generate routes temp file
|
|
722
699
|
*/
|
|
723
|
-
declare const prepareRoutes: (app: App) => Promise<void>;
|
|
724
|
-
//#endregion
|
|
725
|
-
//#region src/app/createBuildApp.d.ts
|
|
700
|
+
export declare const prepareRoutes: (app: App) => Promise<void>;
|
|
726
701
|
/**
|
|
727
702
|
* Create vuepress build app.
|
|
728
703
|
*/
|
|
729
|
-
declare const createBuildApp: (config: AppConfig) => BuildApp;
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region src/app/createDevApp.d.ts
|
|
704
|
+
export declare const createBuildApp: (config: AppConfig) => BuildApp;
|
|
732
705
|
/**
|
|
733
706
|
* Create vuepress dev app.
|
|
734
707
|
*/
|
|
735
|
-
declare const createDevApp: (config: AppConfig) => DevApp;
|
|
736
|
-
//#endregion
|
|
737
|
-
//#region src/app/resolveAppDir.d.ts
|
|
708
|
+
export declare const createDevApp: (config: AppConfig) => DevApp;
|
|
738
709
|
/**
|
|
739
710
|
* Resolve directory utils for vuepress app
|
|
740
711
|
*/
|
|
741
|
-
declare const resolveAppDir: (options: AppOptions) => AppDir;
|
|
742
|
-
//#endregion
|
|
743
|
-
//#region src/page/createPage.d.ts
|
|
712
|
+
export declare const resolveAppDir: (options: AppOptions) => AppDir;
|
|
744
713
|
/**
|
|
745
714
|
* Create vuepress page object
|
|
746
715
|
*/
|
|
747
|
-
declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
|
|
748
|
-
//#endregion
|
|
749
|
-
//#region src/page/renderPageToVue.d.ts
|
|
716
|
+
export declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
|
|
750
717
|
/**
|
|
751
718
|
* Render page to vue component
|
|
752
719
|
*/
|
|
753
|
-
declare const renderPageToVue: (app: App, page: Page) => string;
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
757
|
-
//#endregion
|
|
758
|
-
export { type AliasHook, 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, DEFAULT_IGNORE_PATTERNS, type DefineHook, type DevApp, type ExtendsHook, type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, type Hook, type HookItem, type HookQueue, type Hooks, type HooksExposed, type HooksName, type HooksNormalized, type HooksResult, type LifeCycleHook, type LocaleConfig, type LocaleData, type Page, type PageData, type PageFrontmatter, type PageHeader, type PageOptions, type Plugin, type PluginApi, type PluginConfig, type PluginFunction, type PluginObject, type SiteData, type SiteLocaleConfig, type Theme, type ThemeFunction, type ThemeInfo, type ThemeObject, createBuildApp, createDevApp, createPage, preparePageChunk, prepareRoutes, renderPageToVue, resolveAppDir };
|
|
720
|
+
export declare const renderPageToVue: (app: App, page: Page) => string;
|
|
721
|
+
export declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
722
|
+
export type { AliasHook, App, AppConfig, AppConfigBuild, AppConfigCommon, AppConfigDev, AppDir, AppDirFunction, AppEnv, AppOptions, AppPropertiesBase, AppPropertiesInitialized, AppWriteTemp, BuildApp, Bundler, BundlerOptions, ClientConfigFileHook, DefineHook, DevApp, ExtendsHook, HeadAttrsConfig, HeadConfig, HeadTag, HeadTagEmpty, HeadTagNonEmpty, Hook, HookItem, HookQueue, Hooks, HooksExposed, HooksName, HooksNormalized, HooksResult, LifeCycleHook, LocaleConfig, LocaleData, Page, PageData, PageFrontmatter, PageHeader, PageOptions, Plugin, PluginApi, PluginConfig, PluginFunction, PluginObject, SiteData, SiteLocaleConfig, Theme, ThemeFunction, ThemeInfo, ThemeObject };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { ensureLeadingSlash, formatDateString, inferRoutePath, isFunction, isString, normalizeRoutePath, omit, removeLeadingSlash, resolveLocalePath } from "@vuepress/shared";
|
|
3
3
|
import { colors, debug, fs, hash, logger, path, sanitizeFileName, templateRenderer, tinyglobby, transformPathToFileName, warn } from "@vuepress/utils";
|
|
4
4
|
import { createMarkdown } from "@vuepress/markdown";
|
|
5
|
-
|
|
5
|
+
// src/app/prepare/prepareClientConfigs.ts
|
|
6
6
|
/**
|
|
7
7
|
* Generate client configs temp file
|
|
8
8
|
*
|
|
@@ -19,8 +19,7 @@ ${clientConfigFiles.map((_, index) => ` clientConfig${index},`).join("\n")}
|
|
|
19
19
|
`;
|
|
20
20
|
await app.writeTemp("internal/clientConfigs.js", content);
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
//#region src/page/inferPagePath.ts
|
|
22
|
+
// src/page/inferPagePath.ts
|
|
24
23
|
/**
|
|
25
24
|
* Infer page path according to file path
|
|
26
25
|
*
|
|
@@ -44,8 +43,7 @@ const inferPagePath = ({ app, filePathRelative, options }) => {
|
|
|
44
43
|
pathLocale: resolveLocalePath(app.siteData.locales, pathInferred)
|
|
45
44
|
};
|
|
46
45
|
};
|
|
47
|
-
|
|
48
|
-
//#region src/page/parsePageContent.ts
|
|
46
|
+
// src/page/parsePageContent.ts
|
|
49
47
|
/**
|
|
50
48
|
* Render page content and extract related info
|
|
51
49
|
*
|
|
@@ -79,8 +77,7 @@ const parsePageContent = ({ app, content, filePath, filePathRelative, options })
|
|
|
79
77
|
title: frontmatter.title ? `${frontmatter.title}` : title
|
|
80
78
|
};
|
|
81
79
|
};
|
|
82
|
-
|
|
83
|
-
//#region src/page/resolvePageChunkInfo.ts
|
|
80
|
+
// src/page/resolvePageChunkInfo.ts
|
|
84
81
|
/**
|
|
85
82
|
* Resolve page chunk file related info
|
|
86
83
|
*
|
|
@@ -100,8 +97,7 @@ const resolvePageChunkInfo = ({ app, filePath, filePathRelative, htmlFilePathRel
|
|
|
100
97
|
chunkName
|
|
101
98
|
};
|
|
102
99
|
};
|
|
103
|
-
|
|
104
|
-
//#region src/page/resolvePageContent.ts
|
|
100
|
+
// src/page/resolvePageContent.ts
|
|
105
101
|
const log$5 = debug("vuepress:core/page");
|
|
106
102
|
const FALLBACK_CONTENT = "";
|
|
107
103
|
/**
|
|
@@ -118,8 +114,7 @@ const resolvePageContent = async ({ filePath, options }) => {
|
|
|
118
114
|
}
|
|
119
115
|
return FALLBACK_CONTENT;
|
|
120
116
|
};
|
|
121
|
-
|
|
122
|
-
//#region src/page/resolvePageDate.ts
|
|
117
|
+
// src/page/resolvePageDate.ts
|
|
123
118
|
const FILENAME_DATE_RE = /^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?-(.*)$/;
|
|
124
119
|
const DIRNAME_DATE_RE = /(\d{4})\/(\d{1,2})(?:\/(\d{1,2}))?(\/|$)/;
|
|
125
120
|
const DEFAULT_DATE = "0000-00-00";
|
|
@@ -150,8 +145,7 @@ const resolvePageDate = ({ frontmatter, filePathRelative }) => {
|
|
|
150
145
|
}
|
|
151
146
|
return DEFAULT_DATE;
|
|
152
147
|
};
|
|
153
|
-
|
|
154
|
-
//#region src/page/resolvePageFilePath.ts
|
|
148
|
+
// src/page/resolvePageFilePath.ts
|
|
155
149
|
/**
|
|
156
150
|
* Resolve absolute and relative path of page file
|
|
157
151
|
*
|
|
@@ -168,8 +162,7 @@ const resolvePageFilePath = ({ app, options }) => {
|
|
|
168
162
|
filePathRelative: path.relative(app.dir.source(), options.filePath)
|
|
169
163
|
};
|
|
170
164
|
};
|
|
171
|
-
|
|
172
|
-
//#region src/page/resolvePageHtmlInfo.ts
|
|
165
|
+
// src/page/resolvePageHtmlInfo.ts
|
|
173
166
|
/**
|
|
174
167
|
* Resolve page rendered html file path
|
|
175
168
|
*
|
|
@@ -183,8 +176,7 @@ const resolvePageHtmlInfo = ({ app, path: pagePath }) => {
|
|
|
183
176
|
htmlFilePathRelative
|
|
184
177
|
};
|
|
185
178
|
};
|
|
186
|
-
|
|
187
|
-
//#region src/page/resolvePageLang.ts
|
|
179
|
+
// src/page/resolvePageLang.ts
|
|
188
180
|
/**
|
|
189
181
|
* Resolve language of page
|
|
190
182
|
*
|
|
@@ -194,8 +186,7 @@ const resolvePageLang = ({ app, frontmatter, pathLocale }) => {
|
|
|
194
186
|
if (isString(frontmatter.lang) && frontmatter.lang) return frontmatter.lang;
|
|
195
187
|
return app.siteData.locales[pathLocale]?.lang ?? app.siteData.lang;
|
|
196
188
|
};
|
|
197
|
-
|
|
198
|
-
//#region src/page/resolvePagePath.ts
|
|
189
|
+
// src/page/resolvePagePath.ts
|
|
199
190
|
/**
|
|
200
191
|
* Resolve the final route path of a page
|
|
201
192
|
*
|
|
@@ -206,8 +197,7 @@ const resolvePagePath = ({ permalink, pathInferred, options }) => {
|
|
|
206
197
|
if (!pagePath) throw logger.createError(`page path is empty, page options: ${JSON.stringify(options, null, 2)}`);
|
|
207
198
|
return encodeURI(pagePath.split("/").map(sanitizeFileName).join("/"));
|
|
208
199
|
};
|
|
209
|
-
|
|
210
|
-
//#region src/page/resolvePagePermalink.ts
|
|
200
|
+
// src/page/resolvePagePermalink.ts
|
|
211
201
|
/**
|
|
212
202
|
* Resolve page permalink from frontmatter / options / pattern
|
|
213
203
|
*
|
|
@@ -220,18 +210,17 @@ const resolvePagePermalink = ({ app, frontmatter, slug, date, pathInferred, path
|
|
|
220
210
|
const permalinkPattern = frontmatter.permalinkPattern || app.options.permalinkPattern;
|
|
221
211
|
if (!isString(permalinkPattern)) return null;
|
|
222
212
|
const [year, month, day] = date.split("-");
|
|
223
|
-
|
|
213
|
+
const link = path.join(pathLocale, permalinkPattern.replace(/:year/, year).replace(/:month/, month).replace(/:day/, day).replace(/:slug/, slug).replace(/:raw/, pathInferred?.replace(/^\//, "") ?? ""));
|
|
214
|
+
return ensureLeadingSlash(link);
|
|
224
215
|
};
|
|
225
|
-
|
|
226
|
-
//#region src/page/resolvePageRouteMeta.ts
|
|
216
|
+
// src/page/resolvePageRouteMeta.ts
|
|
227
217
|
/**
|
|
228
218
|
* Resolve page route meta
|
|
229
219
|
*
|
|
230
220
|
* @internal
|
|
231
221
|
*/
|
|
232
222
|
const resolvePageRouteMeta = ({ frontmatter }) => frontmatter.routeMeta ?? {};
|
|
233
|
-
|
|
234
|
-
//#region src/page/resolvePageSlug.ts
|
|
223
|
+
// src/page/resolvePageSlug.ts
|
|
235
224
|
const DATE_RE = /(\d{4}-\d{1,2}(-\d{1,2})?)-(.*)/;
|
|
236
225
|
/**
|
|
237
226
|
* Resolve page slug from filename
|
|
@@ -244,8 +233,7 @@ const resolvePageSlug = ({ filePathRelative }) => {
|
|
|
244
233
|
const match = filename.match(DATE_RE);
|
|
245
234
|
return match ? match[3] : filename;
|
|
246
235
|
};
|
|
247
|
-
|
|
248
|
-
//#region src/page/createPage.ts
|
|
236
|
+
// src/page/createPage.ts
|
|
249
237
|
/**
|
|
250
238
|
* Create vuepress page object
|
|
251
239
|
*/
|
|
@@ -340,8 +328,7 @@ const createPage = async (app, options) => {
|
|
|
340
328
|
await app.pluginApi.hooks.extendsPage.process(page, app);
|
|
341
329
|
return page;
|
|
342
330
|
};
|
|
343
|
-
|
|
344
|
-
//#region src/page/renderPageToVue.ts
|
|
331
|
+
// src/page/renderPageToVue.ts
|
|
345
332
|
const TEMPLATE_WRAPPER_TAG_OPEN = "<div>";
|
|
346
333
|
const TEMPLATE_WRAPPER_TAG_CLOSE = "</div>";
|
|
347
334
|
const SCRIPT_TAG_OPEN = "<script>";
|
|
@@ -418,16 +405,14 @@ const renderPageToVue = (app, page) => {
|
|
|
418
405
|
...sfcBlocks.customBlocks.map((item) => item.content)
|
|
419
406
|
].filter(isString).join("\n");
|
|
420
407
|
};
|
|
421
|
-
|
|
422
|
-
//#region src/app/prepare/preparePageChunk.ts
|
|
408
|
+
// src/app/prepare/preparePageChunk.ts
|
|
423
409
|
/**
|
|
424
410
|
* Generate temp file if the page does not have a source file
|
|
425
411
|
*/
|
|
426
412
|
const preparePageChunk = async (app, page) => {
|
|
427
413
|
if (page.filePath === null) await app.writeTemp(page.chunkFilePathRelative, renderPageToVue(app, page));
|
|
428
414
|
};
|
|
429
|
-
|
|
430
|
-
//#region src/app/prepare/prepareRoutes.ts
|
|
415
|
+
// src/app/prepare/prepareRoutes.ts
|
|
431
416
|
const ROUTES_VAR_NAME = "routes";
|
|
432
417
|
const REDIRECTS_VAR_NAME = "redirects";
|
|
433
418
|
const HMR_CODE$1 = `
|
|
@@ -472,8 +457,7 @@ ${app.pages.map(({ chunkFilePath, chunkName, path, routeMeta }) => ` [${JSON.st
|
|
|
472
457
|
if (app.env.isDev) content += HMR_CODE$1;
|
|
473
458
|
await app.writeTemp("internal/routes.js", content);
|
|
474
459
|
};
|
|
475
|
-
|
|
476
|
-
//#region src/app/prepare/prepareSiteData.ts
|
|
460
|
+
// src/app/prepare/prepareSiteData.ts
|
|
477
461
|
const SITE_DATA_VAR_NAME = "siteData";
|
|
478
462
|
const HMR_CODE = `
|
|
479
463
|
if (import.meta.webpackHot) {
|
|
@@ -499,8 +483,7 @@ export const ${SITE_DATA_VAR_NAME} = JSON.parse(${JSON.stringify(JSON.stringify(
|
|
|
499
483
|
if (app.env.isDev) content += HMR_CODE;
|
|
500
484
|
await app.writeTemp("internal/siteData.js", content);
|
|
501
485
|
};
|
|
502
|
-
|
|
503
|
-
//#region src/app/prepare/prepareUserStyle.ts
|
|
486
|
+
// src/app/prepare/prepareUserStyle.ts
|
|
504
487
|
/**
|
|
505
488
|
* Generate user style temp file
|
|
506
489
|
*
|
|
@@ -515,8 +498,7 @@ const prepareUserStyle = async (app, fileExists = null) => {
|
|
|
515
498
|
}
|
|
516
499
|
await app.writeTemp("internal/userStyle.js", content);
|
|
517
500
|
};
|
|
518
|
-
|
|
519
|
-
//#region src/app/resolveAppMarkdown.ts
|
|
501
|
+
// src/app/resolveAppMarkdown.ts
|
|
520
502
|
/**
|
|
521
503
|
* Resolve markdown-it instance for vuepress app
|
|
522
504
|
*
|
|
@@ -526,14 +508,13 @@ const resolveAppMarkdown = async (app) => {
|
|
|
526
508
|
await app.pluginApi.hooks.extendsMarkdownOptions.process(app.options.markdown, app);
|
|
527
509
|
if (app.options.markdown.assets !== false) {
|
|
528
510
|
app.options.markdown.assets ??= {};
|
|
529
|
-
app.options.markdown.assets.absolutePathPrependBase ??= app.options.bundler.type === "webpack";
|
|
511
|
+
app.options.markdown.assets.absolutePathPrependBase ??= app.options.bundler.type === "rspack" || app.options.bundler.type === "webpack";
|
|
530
512
|
}
|
|
531
513
|
const markdown = createMarkdown(app.options.markdown);
|
|
532
514
|
await app.pluginApi.hooks.extendsMarkdown.process(markdown, app);
|
|
533
515
|
return markdown;
|
|
534
516
|
};
|
|
535
|
-
|
|
536
|
-
//#region src/constants.ts
|
|
517
|
+
// src/constants.ts
|
|
537
518
|
const DEFAULT_IGNORE_PATTERNS = [
|
|
538
519
|
"**/node_modules",
|
|
539
520
|
"**/.yarn",
|
|
@@ -541,8 +522,7 @@ const DEFAULT_IGNORE_PATTERNS = [
|
|
|
541
522
|
"**/.svn",
|
|
542
523
|
"**/.hg"
|
|
543
524
|
];
|
|
544
|
-
|
|
545
|
-
//#region src/app/resolveAppPages.ts
|
|
525
|
+
// src/app/resolveAppPages.ts
|
|
546
526
|
const log$4 = debug("vuepress:core/app");
|
|
547
527
|
/**
|
|
548
528
|
* Resolve pages for vuepress app
|
|
@@ -578,8 +558,7 @@ const resolveAppPages = async (app) => {
|
|
|
578
558
|
pagesMap
|
|
579
559
|
};
|
|
580
560
|
};
|
|
581
|
-
|
|
582
|
-
//#region src/app/appInit.ts
|
|
561
|
+
// src/app/appInit.ts
|
|
583
562
|
const log$3 = debug("vuepress:core/app");
|
|
584
563
|
/**
|
|
585
564
|
* Initialize a vuepress app
|
|
@@ -598,8 +577,7 @@ const appInit = async (app) => {
|
|
|
598
577
|
await app.pluginApi.hooks.onInitialized.process(app);
|
|
599
578
|
log$3("init finish");
|
|
600
579
|
};
|
|
601
|
-
|
|
602
|
-
//#region src/app/appPrepare.ts
|
|
580
|
+
// src/app/appPrepare.ts
|
|
603
581
|
const log$2 = debug("vuepress:core/app");
|
|
604
582
|
/**
|
|
605
583
|
* Prepare files for development or build
|
|
@@ -623,16 +601,14 @@ const appPrepare = async (app) => {
|
|
|
623
601
|
await app.pluginApi.hooks.onPrepared.process(app);
|
|
624
602
|
log$2("prepare finish");
|
|
625
603
|
};
|
|
626
|
-
|
|
627
|
-
//#region src/app/resolvePluginObject.ts
|
|
604
|
+
// src/app/resolvePluginObject.ts
|
|
628
605
|
/**
|
|
629
606
|
* Resolve a plugin object according to name / path / module and config
|
|
630
607
|
*
|
|
631
608
|
* @internal
|
|
632
609
|
*/
|
|
633
610
|
const resolvePluginObject = (app, plugin) => isFunction(plugin) ? plugin(app) : plugin;
|
|
634
|
-
|
|
635
|
-
//#region src/app/appUse.ts
|
|
611
|
+
// src/app/appUse.ts
|
|
636
612
|
const log$1 = debug("vuepress:core/app");
|
|
637
613
|
/**
|
|
638
614
|
* Use a plugin in vuepress app.
|
|
@@ -658,8 +634,7 @@ const appUse = (app, rawPlugin) => {
|
|
|
658
634
|
app.pluginApi.plugins.push(pluginObject);
|
|
659
635
|
return app;
|
|
660
636
|
};
|
|
661
|
-
|
|
662
|
-
//#region src/pluginApi/createHookQueue.ts
|
|
637
|
+
// src/pluginApi/createHookQueue.ts
|
|
663
638
|
const log = debug("vuepress:core/plugin-api");
|
|
664
639
|
/**
|
|
665
640
|
* Create hook queue for plugin system
|
|
@@ -690,8 +665,7 @@ const createHookQueue = (name) => {
|
|
|
690
665
|
}
|
|
691
666
|
};
|
|
692
667
|
};
|
|
693
|
-
|
|
694
|
-
//#region src/pluginApi/createPluginApiHooks.ts
|
|
668
|
+
// src/pluginApi/createPluginApiHooks.ts
|
|
695
669
|
/**
|
|
696
670
|
* Create hooks for plugin api
|
|
697
671
|
*
|
|
@@ -712,16 +686,14 @@ const createPluginApiHooks = () => ({
|
|
|
712
686
|
alias: createHookQueue("alias"),
|
|
713
687
|
define: createHookQueue("define")
|
|
714
688
|
});
|
|
715
|
-
|
|
716
|
-
//#region src/pluginApi/normalizeAliasDefineHook.ts
|
|
689
|
+
// src/pluginApi/normalizeAliasDefineHook.ts
|
|
717
690
|
/**
|
|
718
691
|
* Normalize alias and define hook
|
|
719
692
|
*
|
|
720
693
|
* @internal
|
|
721
694
|
*/
|
|
722
695
|
const normalizeAliasDefineHook = (hook) => async (app, isServer) => isFunction(hook) ? hook(app, isServer) : hook;
|
|
723
|
-
|
|
724
|
-
//#region src/pluginApi/normalizeClientConfigFileHook.ts
|
|
696
|
+
// src/pluginApi/normalizeClientConfigFileHook.ts
|
|
725
697
|
/**
|
|
726
698
|
* Normalize hook for client config file
|
|
727
699
|
*
|
|
@@ -732,8 +704,7 @@ const normalizeClientConfigFileHook = (hook) => async (app) => {
|
|
|
732
704
|
if (!await fs.pathExists(clientConfigFileResult)) throw logger.createError(`client config file does not exist: ${clientConfigFileResult}`);
|
|
733
705
|
return clientConfigFileResult;
|
|
734
706
|
};
|
|
735
|
-
|
|
736
|
-
//#region src/pluginApi/createPluginApiRegisterHooks.ts
|
|
707
|
+
// src/pluginApi/createPluginApiRegisterHooks.ts
|
|
737
708
|
/**
|
|
738
709
|
* Create registerHooks method for plugin api
|
|
739
710
|
*
|
|
@@ -767,8 +738,7 @@ const createPluginApiRegisterHooks = (plugins, hooks) => () => {
|
|
|
767
738
|
});
|
|
768
739
|
});
|
|
769
740
|
};
|
|
770
|
-
|
|
771
|
-
//#region src/pluginApi/createPluginApi.ts
|
|
741
|
+
// src/pluginApi/createPluginApi.ts
|
|
772
742
|
/**
|
|
773
743
|
* Create vuepress plugin api
|
|
774
744
|
*
|
|
@@ -783,8 +753,7 @@ const createPluginApi = () => {
|
|
|
783
753
|
registerHooks: createPluginApiRegisterHooks(plugins, hooks)
|
|
784
754
|
};
|
|
785
755
|
};
|
|
786
|
-
|
|
787
|
-
//#region src/app/resolveAppDir.ts
|
|
756
|
+
// src/app/resolveAppDir.ts
|
|
788
757
|
const require$2 = createRequire(import.meta.url);
|
|
789
758
|
/**
|
|
790
759
|
* Create directory util function
|
|
@@ -810,8 +779,7 @@ const resolveAppDir = (options) => {
|
|
|
810
779
|
public: publicDir
|
|
811
780
|
};
|
|
812
781
|
};
|
|
813
|
-
|
|
814
|
-
//#region src/app/resolveAppEnv.ts
|
|
782
|
+
// src/app/resolveAppEnv.ts
|
|
815
783
|
/**
|
|
816
784
|
* Resolve environment flags for vuepress app
|
|
817
785
|
*
|
|
@@ -822,8 +790,7 @@ const resolveAppEnv = (options) => ({
|
|
|
822
790
|
isDev: false,
|
|
823
791
|
isDebug: options.debug
|
|
824
792
|
});
|
|
825
|
-
|
|
826
|
-
//#region src/app/resolveAppOptions.ts
|
|
793
|
+
// src/app/resolveAppOptions.ts
|
|
827
794
|
const require$1 = createRequire(import.meta.url);
|
|
828
795
|
/**
|
|
829
796
|
* Create app options with default values
|
|
@@ -866,8 +833,7 @@ const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description
|
|
|
866
833
|
theme
|
|
867
834
|
};
|
|
868
835
|
};
|
|
869
|
-
|
|
870
|
-
//#region src/app/resolveAppSiteData.ts
|
|
836
|
+
// src/app/resolveAppSiteData.ts
|
|
871
837
|
/**
|
|
872
838
|
* Resolve site data for vuepress app
|
|
873
839
|
*
|
|
@@ -883,8 +849,7 @@ const resolveAppSiteData = (options) => ({
|
|
|
883
849
|
head: options.head,
|
|
884
850
|
locales: options.locales
|
|
885
851
|
});
|
|
886
|
-
|
|
887
|
-
//#region src/app/resolveAppVersion.ts
|
|
852
|
+
// src/app/resolveAppVersion.ts
|
|
888
853
|
const require = createRequire(import.meta.url);
|
|
889
854
|
/**
|
|
890
855
|
* Resolve version of vuepress app
|
|
@@ -894,8 +859,7 @@ const require = createRequire(import.meta.url);
|
|
|
894
859
|
const resolveAppVersion = () => {
|
|
895
860
|
return fs.readJsonSync(require.resolve("@vuepress/core/package.json")).version;
|
|
896
861
|
};
|
|
897
|
-
|
|
898
|
-
//#region src/app/resolveAppWriteTemp.ts
|
|
862
|
+
// src/app/resolveAppWriteTemp.ts
|
|
899
863
|
/**
|
|
900
864
|
* Resolve write temp file util for vuepress app
|
|
901
865
|
*
|
|
@@ -928,8 +892,7 @@ const resolveAppWriteTemp = (dir) => {
|
|
|
928
892
|
};
|
|
929
893
|
return writeTemp;
|
|
930
894
|
};
|
|
931
|
-
|
|
932
|
-
//#region src/app/createBaseApp.ts
|
|
895
|
+
// src/app/createBaseApp.ts
|
|
933
896
|
/**
|
|
934
897
|
* Create base vuepress app.
|
|
935
898
|
*
|
|
@@ -958,8 +921,7 @@ const createBaseApp = (config) => {
|
|
|
958
921
|
};
|
|
959
922
|
return app;
|
|
960
923
|
};
|
|
961
|
-
|
|
962
|
-
//#region src/app/resolveThemeInfo.ts
|
|
924
|
+
// src/app/resolveThemeInfo.ts
|
|
963
925
|
/**
|
|
964
926
|
* Resolve theme info and its parent theme info
|
|
965
927
|
*
|
|
@@ -984,8 +946,7 @@ const resolveThemeInfo = (app, theme) => {
|
|
|
984
946
|
userStyle: themeObject.userStyle ?? parentThemeInfo.userStyle
|
|
985
947
|
};
|
|
986
948
|
};
|
|
987
|
-
|
|
988
|
-
//#region src/app/setupAppThemeAndPlugins.ts
|
|
949
|
+
// src/app/setupAppThemeAndPlugins.ts
|
|
989
950
|
/**
|
|
990
951
|
* Setup theme and plugins for vuepress app
|
|
991
952
|
*
|
|
@@ -999,8 +960,7 @@ const setupAppThemeAndPlugins = (app, config) => {
|
|
|
999
960
|
app.options.userStyle = config.userStyle ?? themeInfo.userStyle ?? app.options.userStyle;
|
|
1000
961
|
[...themeInfo.plugins, ...app.options.plugins].flat().forEach((plugin) => app.use(plugin));
|
|
1001
962
|
};
|
|
1002
|
-
|
|
1003
|
-
//#region src/app/createBuildApp.ts
|
|
963
|
+
// src/app/createBuildApp.ts
|
|
1004
964
|
/**
|
|
1005
965
|
* Create vuepress build app.
|
|
1006
966
|
*/
|
|
@@ -1011,8 +971,7 @@ const createBuildApp = (config) => {
|
|
|
1011
971
|
setupAppThemeAndPlugins(app, config);
|
|
1012
972
|
return app;
|
|
1013
973
|
};
|
|
1014
|
-
|
|
1015
|
-
//#region src/app/createDevApp.ts
|
|
974
|
+
// src/app/createDevApp.ts
|
|
1016
975
|
/**
|
|
1017
976
|
* Create vuepress dev app.
|
|
1018
977
|
*/
|
|
@@ -1023,5 +982,4 @@ const createDevApp = (config) => {
|
|
|
1023
982
|
setupAppThemeAndPlugins(app, config);
|
|
1024
983
|
return app;
|
|
1025
984
|
};
|
|
1026
|
-
//#endregion
|
|
1027
985
|
export { DEFAULT_IGNORE_PATTERNS, appInit, appPrepare, appUse, createAppDirFunction, createBaseApp, createBuildApp, createDevApp, createHookQueue, createPage, createPluginApi, createPluginApiHooks, createPluginApiRegisterHooks, inferPagePath, normalizeAliasDefineHook, normalizeClientConfigFileHook, parsePageContent, prepareClientConfigs, preparePageChunk, prepareRoutes, prepareSiteData, prepareUserStyle, renderPageToVue, resolveAppDir, resolveAppEnv, resolveAppOptions, resolveAppPages, resolveAppSiteData, resolveAppVersion, resolveAppWriteTemp, resolvePageChunkInfo, resolvePageContent, resolvePageDate, resolvePageFilePath, resolvePageHtmlInfo, resolvePageLang, resolvePagePath, resolvePagePermalink, resolvePageRedirects, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/core",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.32",
|
|
4
4
|
"description": "Core package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"@vuepress/markdown": "2.0.0-rc.
|
|
36
|
-
"@vuepress/
|
|
37
|
-
"@vuepress/utils": "2.0.0-rc.
|
|
38
|
-
"
|
|
34
|
+
"@vuepress/client": "2.0.0-rc.32",
|
|
35
|
+
"@vuepress/markdown": "2.0.0-rc.32",
|
|
36
|
+
"@vuepress/shared": "2.0.0-rc.32",
|
|
37
|
+
"@vuepress/utils": "2.0.0-rc.32",
|
|
38
|
+
"vue": "^3.5.45"
|
|
39
39
|
},
|
|
40
40
|
"tsdown": {
|
|
41
41
|
"dts": true,
|