@vuepress/core 2.0.0-rc.30 → 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 CHANGED
@@ -1,8 +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
-
5
- //#region src/types/bundler.d.ts
4
+ type DeepPartialArray<T> = DeepPartial<T>[];
5
+ type DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]>; };
6
+ type DeepPartial<T> = T extends Function ? T : T extends (infer U)[] ? DeepPartialArray<U> : T extends object ? DeepPartialObject<T> : T | undefined;
6
7
  /**
7
8
  * Vuepress bundler
8
9
  *
@@ -15,6 +16,10 @@ interface Bundler {
15
16
  * Name of the bundler
16
17
  */
17
18
  name: string;
19
+ /**
20
+ * Type of the bundler, e.g. 'vite' or 'webpack'
21
+ */
22
+ type: string;
18
23
  /**
19
24
  * Method to run vuepress app in dev mode, starting dev server
20
25
  */
@@ -23,10 +28,12 @@ interface Bundler {
23
28
  * Method to run vuepress app in build mode, generating static pages and assets
24
29
  */
25
30
  build: (app: App) => Promise<void>;
31
+ /**
32
+ * Merge config helper for current bundler.
33
+ */
34
+ mergeConfig: <Config extends Record<string, unknown> = Record<string, unknown>>(currentConfig: Config, newConfig: DeepPartial<Config>) => Config;
26
35
  }
27
36
  type BundlerOptions = Record<string, unknown>;
28
- //#endregion
29
- //#region src/types/page.d.ts
30
37
  /**
31
38
  * Vuepress Page
32
39
  */
@@ -160,13 +167,11 @@ interface PageOptions {
160
167
  */
161
168
  path?: string;
162
169
  }
163
- //#endregion
164
- //#region src/types/pluginApi/hooks.d.ts
165
170
  type PromiseOrNot<T> = Promise<T> | T;
166
171
  interface Closable {
167
172
  close(): void;
168
173
  }
169
- interface Hook<Exposed, Normalized = Exposed, Result = (Normalized extends ((...args: any) => infer U) ? U extends Promise<infer V> ? V : U : never)> {
174
+ interface Hook<Exposed, Normalized = Exposed, Result = Normalized extends ((...args: any) => infer U) ? U extends Promise<infer V> ? V : U : never> {
170
175
  exposed: Exposed;
171
176
  normalized: Normalized;
172
177
  result: Result;
@@ -201,15 +206,15 @@ type HooksName = keyof Hooks;
201
206
  /**
202
207
  * Exposed hooks API that can be accessed by a plugin
203
208
  */
204
- type HooksExposed = { [K in HooksName]: Hooks[K]['exposed'] };
209
+ type HooksExposed = { [K in HooksName]: Hooks[K]['exposed']; };
205
210
  /**
206
211
  * Normalized hooks
207
212
  */
208
- type HooksNormalized = { [K in HooksName]: Hooks[K]['normalized'] };
213
+ type HooksNormalized = { [K in HooksName]: Hooks[K]['normalized']; };
209
214
  /**
210
215
  * Result of hooks
211
216
  */
212
- type HooksResult = { [K in HooksName]: Hooks[K]['result'] };
217
+ type HooksResult = { [K in HooksName]: Hooks[K]['result']; };
213
218
  /**
214
219
  * Hook item
215
220
  */
@@ -226,8 +231,6 @@ interface HookQueue<T extends HooksName> {
226
231
  add: (item: HookItem<T>) => void;
227
232
  process: (...args: Parameters<HooksNormalized[T]>) => Promise<HooksResult[T][]>;
228
233
  }
229
- //#endregion
230
- //#region src/types/pluginApi/pluginApi.d.ts
231
234
  /**
232
235
  * Vuepress plugin system
233
236
  */
@@ -239,7 +242,7 @@ interface PluginApi {
239
242
  /**
240
243
  * All available hooks
241
244
  */
242
- hooks: { [K in HooksName]: HookQueue<K> };
245
+ hooks: { [K in HooksName]: HookQueue<K>; };
243
246
  /**
244
247
  * Register hooks of plugins
245
248
  *
@@ -247,8 +250,6 @@ interface PluginApi {
247
250
  */
248
251
  registerHooks: () => void;
249
252
  }
250
- //#endregion
251
- //#region src/types/plugin.d.ts
252
253
  /**
253
254
  * Vuepress plugin
254
255
  *
@@ -282,8 +283,6 @@ interface PluginObject extends Partial<HooksExposed> {
282
283
  * Config field for plugins
283
284
  */
284
285
  type PluginConfig = (Plugin | Plugin[])[];
285
- //#endregion
286
- //#region src/types/theme.d.ts
287
286
  /**
288
287
  * Vuepress theme
289
288
  *
@@ -352,8 +351,6 @@ interface ThemeInfo {
352
351
  */
353
352
  userStyle?: string;
354
353
  }
355
- //#endregion
356
- //#region src/types/app/options.d.ts
357
354
  /**
358
355
  * Vuepress app common config that shared between dev and build
359
356
  */
@@ -479,19 +476,29 @@ interface AppConfigDev {
479
476
  */
480
477
  interface AppConfigBuild {
481
478
  /**
482
- * Determine what resource files should be preloaded. Use boolean value to
483
- * totally enable / disable.
479
+ * Determine what resource files should be preloaded.
480
+ *
481
+ * - `false` disables preloading.
482
+ * - `true` preloads script and style resource files used by the current page.
483
+ * - A function preloads a candidate file when it returns `true`. It receives
484
+ * the output file name and inferred resource type.
484
485
  *
485
486
  * @default true
486
487
  */
487
488
  shouldPreload?: boolean | ((file: string, type: string) => boolean);
488
489
  /**
489
- * Determine what resource files should be prefetched. Use boolean value to
490
- * totally enable / disable.
490
+ * Determine what resource files should be prefetched.
491
491
  *
492
- * @default true
492
+ * - `false` disables prefetching.
493
+ * - `true` prefetches all async resource files not used by the current page.
494
+ * - `'as-needed'` prefetches async resource files only for pages linked from
495
+ * the current page's Markdown content.
496
+ * - A function prefetches a candidate file when it returns `true`. It receives
497
+ * the output file name and inferred resource type.
498
+ *
499
+ * @default 'as-needed'
493
500
  */
494
- shouldPrefetch?: boolean | ((file: string, type: string) => boolean);
501
+ shouldPrefetch?: boolean | 'as-needed' | ((file: string, type: string) => boolean);
495
502
  /**
496
503
  * Specify the path of the HTML template to be used for build
497
504
  *
@@ -517,8 +524,6 @@ type AppConfig = AppConfigBuild & AppConfigCommon & AppConfigDev;
517
524
  * It fills all optional fields with a default value.
518
525
  */
519
526
  type AppOptions = Required<AppConfig>;
520
- //#endregion
521
- //#region src/types/app/utils.d.ts
522
527
  /**
523
528
  * Directory util function
524
529
  */
@@ -584,8 +589,6 @@ interface AppWriteTemp {
584
589
  */
585
590
  cleanup: () => void;
586
591
  }
587
- //#endregion
588
- //#region src/types/app/app.d.ts
589
592
  /**
590
593
  * App base properties, will be available after creation, even before initialization
591
594
  */
@@ -687,50 +690,33 @@ interface BuildApp extends App {
687
690
  */
688
691
  build: () => ReturnType<Bundler['build']>;
689
692
  }
690
- //#endregion
691
- //#region src/app/prepare/preparePageChunk.d.ts
692
693
  /**
693
694
  * Generate temp file if the page does not have a source file
694
695
  */
695
- declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
696
- //#endregion
697
- //#region src/app/prepare/prepareRoutes.d.ts
696
+ export declare const preparePageChunk: (app: App, page: Page) => Promise<void>;
698
697
  /**
699
698
  * Generate routes temp file
700
699
  */
701
- declare const prepareRoutes: (app: App) => Promise<void>;
702
- //#endregion
703
- //#region src/app/createBuildApp.d.ts
700
+ export declare const prepareRoutes: (app: App) => Promise<void>;
704
701
  /**
705
702
  * Create vuepress build app.
706
703
  */
707
- declare const createBuildApp: (config: AppConfig) => BuildApp;
708
- //#endregion
709
- //#region src/app/createDevApp.d.ts
704
+ export declare const createBuildApp: (config: AppConfig) => BuildApp;
710
705
  /**
711
706
  * Create vuepress dev app.
712
707
  */
713
- declare const createDevApp: (config: AppConfig) => DevApp;
714
- //#endregion
715
- //#region src/app/resolveAppDir.d.ts
708
+ export declare const createDevApp: (config: AppConfig) => DevApp;
716
709
  /**
717
710
  * Resolve directory utils for vuepress app
718
711
  */
719
- declare const resolveAppDir: (options: AppOptions) => AppDir;
720
- //#endregion
721
- //#region src/page/createPage.d.ts
712
+ export declare const resolveAppDir: (options: AppOptions) => AppDir;
722
713
  /**
723
714
  * Create vuepress page object
724
715
  */
725
- declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
726
- //#endregion
727
- //#region src/page/renderPageToVue.d.ts
716
+ export declare const createPage: (app: App, options: PageOptions) => Promise<Page>;
728
717
  /**
729
718
  * Render page to vue component
730
719
  */
731
- declare const renderPageToVue: (app: App, page: Page) => string;
732
- //#endregion
733
- //#region src/constants.d.ts
734
- declare const DEFAULT_IGNORE_PATTERNS: string[];
735
- //#endregion
736
- 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 };
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
- //#region src/app/prepare/prepareClientConfigs.ts
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- return ensureLeadingSlash(path.join(pathLocale, permalinkPattern.replace(/:year/, year).replace(/:month/, month).replace(/:day/, day).replace(/:slug/, slug).replace(/:raw/, pathInferred?.replace(/^\//, "") ?? "")));
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
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
- //#endregion
519
- //#region src/app/resolveAppMarkdown.ts
501
+ // src/app/resolveAppMarkdown.ts
520
502
  /**
521
503
  * Resolve markdown-it instance for vuepress app
522
504
  *
@@ -524,12 +506,15 @@ const prepareUserStyle = async (app, fileExists = null) => {
524
506
  */
525
507
  const resolveAppMarkdown = async (app) => {
526
508
  await app.pluginApi.hooks.extendsMarkdownOptions.process(app.options.markdown, app);
509
+ if (app.options.markdown.assets !== false) {
510
+ app.options.markdown.assets ??= {};
511
+ app.options.markdown.assets.absolutePathPrependBase ??= app.options.bundler.type === "rspack" || app.options.bundler.type === "webpack";
512
+ }
527
513
  const markdown = createMarkdown(app.options.markdown);
528
514
  await app.pluginApi.hooks.extendsMarkdown.process(markdown, app);
529
515
  return markdown;
530
516
  };
531
- //#endregion
532
- //#region src/constants.ts
517
+ // src/constants.ts
533
518
  const DEFAULT_IGNORE_PATTERNS = [
534
519
  "**/node_modules",
535
520
  "**/.yarn",
@@ -537,8 +522,7 @@ const DEFAULT_IGNORE_PATTERNS = [
537
522
  "**/.svn",
538
523
  "**/.hg"
539
524
  ];
540
- //#endregion
541
- //#region src/app/resolveAppPages.ts
525
+ // src/app/resolveAppPages.ts
542
526
  const log$4 = debug("vuepress:core/app");
543
527
  /**
544
528
  * Resolve pages for vuepress app
@@ -574,8 +558,7 @@ const resolveAppPages = async (app) => {
574
558
  pagesMap
575
559
  };
576
560
  };
577
- //#endregion
578
- //#region src/app/appInit.ts
561
+ // src/app/appInit.ts
579
562
  const log$3 = debug("vuepress:core/app");
580
563
  /**
581
564
  * Initialize a vuepress app
@@ -594,8 +577,7 @@ const appInit = async (app) => {
594
577
  await app.pluginApi.hooks.onInitialized.process(app);
595
578
  log$3("init finish");
596
579
  };
597
- //#endregion
598
- //#region src/app/appPrepare.ts
580
+ // src/app/appPrepare.ts
599
581
  const log$2 = debug("vuepress:core/app");
600
582
  /**
601
583
  * Prepare files for development or build
@@ -619,16 +601,14 @@ const appPrepare = async (app) => {
619
601
  await app.pluginApi.hooks.onPrepared.process(app);
620
602
  log$2("prepare finish");
621
603
  };
622
- //#endregion
623
- //#region src/app/resolvePluginObject.ts
604
+ // src/app/resolvePluginObject.ts
624
605
  /**
625
606
  * Resolve a plugin object according to name / path / module and config
626
607
  *
627
608
  * @internal
628
609
  */
629
610
  const resolvePluginObject = (app, plugin) => isFunction(plugin) ? plugin(app) : plugin;
630
- //#endregion
631
- //#region src/app/appUse.ts
611
+ // src/app/appUse.ts
632
612
  const log$1 = debug("vuepress:core/app");
633
613
  /**
634
614
  * Use a plugin in vuepress app.
@@ -654,8 +634,7 @@ const appUse = (app, rawPlugin) => {
654
634
  app.pluginApi.plugins.push(pluginObject);
655
635
  return app;
656
636
  };
657
- //#endregion
658
- //#region src/pluginApi/createHookQueue.ts
637
+ // src/pluginApi/createHookQueue.ts
659
638
  const log = debug("vuepress:core/plugin-api");
660
639
  /**
661
640
  * Create hook queue for plugin system
@@ -686,8 +665,7 @@ const createHookQueue = (name) => {
686
665
  }
687
666
  };
688
667
  };
689
- //#endregion
690
- //#region src/pluginApi/createPluginApiHooks.ts
668
+ // src/pluginApi/createPluginApiHooks.ts
691
669
  /**
692
670
  * Create hooks for plugin api
693
671
  *
@@ -708,16 +686,14 @@ const createPluginApiHooks = () => ({
708
686
  alias: createHookQueue("alias"),
709
687
  define: createHookQueue("define")
710
688
  });
711
- //#endregion
712
- //#region src/pluginApi/normalizeAliasDefineHook.ts
689
+ // src/pluginApi/normalizeAliasDefineHook.ts
713
690
  /**
714
691
  * Normalize alias and define hook
715
692
  *
716
693
  * @internal
717
694
  */
718
695
  const normalizeAliasDefineHook = (hook) => async (app, isServer) => isFunction(hook) ? hook(app, isServer) : hook;
719
- //#endregion
720
- //#region src/pluginApi/normalizeClientConfigFileHook.ts
696
+ // src/pluginApi/normalizeClientConfigFileHook.ts
721
697
  /**
722
698
  * Normalize hook for client config file
723
699
  *
@@ -728,8 +704,7 @@ const normalizeClientConfigFileHook = (hook) => async (app) => {
728
704
  if (!await fs.pathExists(clientConfigFileResult)) throw logger.createError(`client config file does not exist: ${clientConfigFileResult}`);
729
705
  return clientConfigFileResult;
730
706
  };
731
- //#endregion
732
- //#region src/pluginApi/createPluginApiRegisterHooks.ts
707
+ // src/pluginApi/createPluginApiRegisterHooks.ts
733
708
  /**
734
709
  * Create registerHooks method for plugin api
735
710
  *
@@ -763,8 +738,7 @@ const createPluginApiRegisterHooks = (plugins, hooks) => () => {
763
738
  });
764
739
  });
765
740
  };
766
- //#endregion
767
- //#region src/pluginApi/createPluginApi.ts
741
+ // src/pluginApi/createPluginApi.ts
768
742
  /**
769
743
  * Create vuepress plugin api
770
744
  *
@@ -779,8 +753,7 @@ const createPluginApi = () => {
779
753
  registerHooks: createPluginApiRegisterHooks(plugins, hooks)
780
754
  };
781
755
  };
782
- //#endregion
783
- //#region src/app/resolveAppDir.ts
756
+ // src/app/resolveAppDir.ts
784
757
  const require$2 = createRequire(import.meta.url);
785
758
  /**
786
759
  * Create directory util function
@@ -806,8 +779,7 @@ const resolveAppDir = (options) => {
806
779
  public: publicDir
807
780
  };
808
781
  };
809
- //#endregion
810
- //#region src/app/resolveAppEnv.ts
782
+ // src/app/resolveAppEnv.ts
811
783
  /**
812
784
  * Resolve environment flags for vuepress app
813
785
  *
@@ -818,15 +790,14 @@ const resolveAppEnv = (options) => ({
818
790
  isDev: false,
819
791
  isDebug: options.debug
820
792
  });
821
- //#endregion
822
- //#region src/app/resolveAppOptions.ts
793
+ // src/app/resolveAppOptions.ts
823
794
  const require$1 = createRequire(import.meta.url);
824
795
  /**
825
796
  * Create app options with default values
826
797
  *
827
798
  * @internal
828
799
  */
829
- const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description = "", head = [], locales = {}, source, dest = path.resolve(source, ".vuepress/dist"), temp = path.resolve(source, ".vuepress/.temp"), cache = path.resolve(source, ".vuepress/.cache"), public: publicDir = path.resolve(source, ".vuepress/public"), host = "0.0.0.0", port = 8080, open = false, templateDev = path.normalize(require$1.resolve("@vuepress/client/templates/dev.html")), shouldPreload = true, shouldPrefetch = true, templateBuild = path.normalize(require$1.resolve("@vuepress/client/templates/build.html")), templateBuildRenderer = templateRenderer, bundler, debug = false, markdown = {}, pagePatterns = ["**/*.md", "!.vuepress"], permalinkPattern = null, userStyle = null, plugins = [], theme }) => {
800
+ const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description = "", head = [], locales = {}, source, dest = path.resolve(source, ".vuepress/dist"), temp = path.resolve(source, ".vuepress/.temp"), cache = path.resolve(source, ".vuepress/.cache"), public: publicDir = path.resolve(source, ".vuepress/public"), host = "0.0.0.0", port = 8080, open = false, templateDev = path.normalize(require$1.resolve("@vuepress/client/templates/dev.html")), shouldPreload = true, shouldPrefetch = "as-needed", templateBuild = path.normalize(require$1.resolve("@vuepress/client/templates/build.html")), templateBuildRenderer = templateRenderer, bundler, debug = false, markdown = {}, pagePatterns = ["**/*.md", "!.vuepress"], permalinkPattern = null, userStyle = null, plugins = [], theme }) => {
830
801
  locales["/"] ??= {
831
802
  lang,
832
803
  title,
@@ -862,8 +833,7 @@ const resolveAppOptions = ({ base = "/", lang = "en-US", title = "", description
862
833
  theme
863
834
  };
864
835
  };
865
- //#endregion
866
- //#region src/app/resolveAppSiteData.ts
836
+ // src/app/resolveAppSiteData.ts
867
837
  /**
868
838
  * Resolve site data for vuepress app
869
839
  *
@@ -879,8 +849,7 @@ const resolveAppSiteData = (options) => ({
879
849
  head: options.head,
880
850
  locales: options.locales
881
851
  });
882
- //#endregion
883
- //#region src/app/resolveAppVersion.ts
852
+ // src/app/resolveAppVersion.ts
884
853
  const require = createRequire(import.meta.url);
885
854
  /**
886
855
  * Resolve version of vuepress app
@@ -890,8 +859,7 @@ const require = createRequire(import.meta.url);
890
859
  const resolveAppVersion = () => {
891
860
  return fs.readJsonSync(require.resolve("@vuepress/core/package.json")).version;
892
861
  };
893
- //#endregion
894
- //#region src/app/resolveAppWriteTemp.ts
862
+ // src/app/resolveAppWriteTemp.ts
895
863
  /**
896
864
  * Resolve write temp file util for vuepress app
897
865
  *
@@ -924,8 +892,7 @@ const resolveAppWriteTemp = (dir) => {
924
892
  };
925
893
  return writeTemp;
926
894
  };
927
- //#endregion
928
- //#region src/app/createBaseApp.ts
895
+ // src/app/createBaseApp.ts
929
896
  /**
930
897
  * Create base vuepress app.
931
898
  *
@@ -954,8 +921,7 @@ const createBaseApp = (config) => {
954
921
  };
955
922
  return app;
956
923
  };
957
- //#endregion
958
- //#region src/app/resolveThemeInfo.ts
924
+ // src/app/resolveThemeInfo.ts
959
925
  /**
960
926
  * Resolve theme info and its parent theme info
961
927
  *
@@ -980,8 +946,7 @@ const resolveThemeInfo = (app, theme) => {
980
946
  userStyle: themeObject.userStyle ?? parentThemeInfo.userStyle
981
947
  };
982
948
  };
983
- //#endregion
984
- //#region src/app/setupAppThemeAndPlugins.ts
949
+ // src/app/setupAppThemeAndPlugins.ts
985
950
  /**
986
951
  * Setup theme and plugins for vuepress app
987
952
  *
@@ -995,8 +960,7 @@ const setupAppThemeAndPlugins = (app, config) => {
995
960
  app.options.userStyle = config.userStyle ?? themeInfo.userStyle ?? app.options.userStyle;
996
961
  [...themeInfo.plugins, ...app.options.plugins].flat().forEach((plugin) => app.use(plugin));
997
962
  };
998
- //#endregion
999
- //#region src/app/createBuildApp.ts
963
+ // src/app/createBuildApp.ts
1000
964
  /**
1001
965
  * Create vuepress build app.
1002
966
  */
@@ -1007,8 +971,7 @@ const createBuildApp = (config) => {
1007
971
  setupAppThemeAndPlugins(app, config);
1008
972
  return app;
1009
973
  };
1010
- //#endregion
1011
- //#region src/app/createDevApp.ts
974
+ // src/app/createDevApp.ts
1012
975
  /**
1013
976
  * Create vuepress dev app.
1014
977
  */
@@ -1019,5 +982,4 @@ const createDevApp = (config) => {
1019
982
  setupAppThemeAndPlugins(app, config);
1020
983
  return app;
1021
984
  };
1022
- //#endregion
1023
- 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, resolvePageRouteMeta, resolvePageSlug, resolvePluginObject, resolveThemeInfo };
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.30",
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
- "vue": "^3.5.34",
35
- "@vuepress/shared": "2.0.0-rc.30",
36
- "@vuepress/utils": "2.0.0-rc.30",
37
- "@vuepress/client": "2.0.0-rc.30",
38
- "@vuepress/markdown": "2.0.0-rc.30"
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,