@vuepress/core 2.0.0-beta.41 → 2.0.0-beta.42

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.
@@ -7,12 +7,11 @@ const resolveThemeLayouts_1 = require("./resolveThemeLayouts");
7
7
  * Resolve theme info and its parent theme info
8
8
  */
9
9
  const resolveThemeInfo = (app, theme) => {
10
- var _a, _b, _c;
11
10
  // resolve current theme info
12
11
  const themeObject = (0, resolvePluginObject_1.resolvePluginObject)(app, theme);
13
12
  const themeInfo = {
14
13
  layouts: (0, resolveThemeLayouts_1.resolveThemeLayouts)(themeObject.layouts),
15
- plugins: [...((_a = themeObject.plugins) !== null && _a !== void 0 ? _a : []), themeObject],
14
+ plugins: [...(themeObject.plugins ?? []), themeObject],
16
15
  templateBuild: themeObject.templateBuild,
17
16
  templateDev: themeObject.templateDev,
18
17
  };
@@ -25,8 +24,8 @@ const resolveThemeInfo = (app, theme) => {
25
24
  return {
26
25
  layouts: { ...parentThemeInfo.layouts, ...themeInfo.layouts },
27
26
  plugins: [...parentThemeInfo.plugins, ...themeInfo.plugins],
28
- templateBuild: (_b = themeObject.templateBuild) !== null && _b !== void 0 ? _b : parentThemeInfo.templateBuild,
29
- templateDev: (_c = themeObject.templateDev) !== null && _c !== void 0 ? _c : parentThemeInfo.templateDev,
27
+ templateBuild: themeObject.templateBuild ?? parentThemeInfo.templateBuild,
28
+ templateDev: themeObject.templateDev ?? parentThemeInfo.templateDev,
30
29
  };
31
30
  };
32
31
  exports.resolveThemeInfo = resolveThemeInfo;
@@ -6,15 +6,14 @@ const resolveThemeInfo_1 = require("./resolveThemeInfo");
6
6
  * Setup theme and plugins for vuepress app
7
7
  */
8
8
  const setupAppThemeAndPlugins = (app, config) => {
9
- var _a, _b, _c, _d;
10
9
  // recursively resolve theme info
11
10
  const themeInfo = (0, resolveThemeInfo_1.resolveThemeInfo)(app, app.options.theme);
12
11
  // set up app layouts and templates
13
12
  app.layouts = themeInfo.layouts;
14
13
  app.options.templateDev =
15
- (_b = (_a = config.templateDev) !== null && _a !== void 0 ? _a : themeInfo.templateDev) !== null && _b !== void 0 ? _b : app.options.templateDev;
14
+ config.templateDev ?? themeInfo.templateDev ?? app.options.templateDev;
16
15
  app.options.templateBuild =
17
- (_d = (_c = config.templateBuild) !== null && _c !== void 0 ? _c : themeInfo.templateBuild) !== null && _d !== void 0 ? _d : app.options.templateBuild;
16
+ config.templateBuild ?? themeInfo.templateBuild ?? app.options.templateBuild;
18
17
  [...themeInfo.plugins, ...app.options.plugins]
19
18
  .flat()
20
19
  .forEach((plugin) => app.use(plugin));
@@ -12,7 +12,6 @@ const DEFAULT_DATE = '0000-00-00';
12
12
  * It will be resolved as 'yyyy-MM-dd' format
13
13
  */
14
14
  const resolvePageDate = ({ frontmatter, filePathRelative, }) => {
15
- var _a, _b;
16
15
  // `frontmatter.date` could be parsed as UTC Date directly
17
16
  if (frontmatter.date instanceof Date) {
18
17
  return (0, shared_1.formatDateString)([
@@ -31,14 +30,14 @@ const resolvePageDate = ({ frontmatter, filePathRelative, }) => {
31
30
  if (filename) {
32
31
  const matches = filename.match(FILENAME_DATE_RE);
33
32
  if (matches) {
34
- return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${(_a = matches[3]) !== null && _a !== void 0 ? _a : '01'}`, DEFAULT_DATE);
33
+ return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${matches[3] ?? '01'}`, DEFAULT_DATE);
35
34
  }
36
35
  }
37
36
  const dirname = utils_1.path.dirname(filePathRelative);
38
37
  if (dirname !== '.') {
39
38
  const matches = dirname.match(DIRNAME_DATE_RE);
40
39
  if (matches) {
41
- return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${(_b = matches[3]) !== null && _b !== void 0 ? _b : '01'}`, DEFAULT_DATE);
40
+ return (0, shared_1.formatDateString)(`${matches[1]}-${matches[2]}-${matches[3] ?? '01'}`, DEFAULT_DATE);
42
41
  }
43
42
  }
44
43
  return DEFAULT_DATE;
@@ -7,7 +7,6 @@ const log = (0, utils_1.debug)('vuepress:core/page');
7
7
  * Resolve page file content according to filePath or options content
8
8
  */
9
9
  const resolvePageFileContent = async ({ filePath, options, }) => {
10
- var _a;
11
10
  if (filePath) {
12
11
  try {
13
12
  // read page content from file
@@ -19,6 +18,6 @@ const resolvePageFileContent = async ({ filePath, options, }) => {
19
18
  }
20
19
  }
21
20
  // load raw content from options
22
- return (_a = options.content) !== null && _a !== void 0 ? _a : '';
21
+ return options.content ?? '';
23
22
  };
24
23
  exports.resolvePageFileContent = resolvePageFileContent;
@@ -6,10 +6,9 @@ const shared_1 = require("@vuepress/shared");
6
6
  * Resolve language of page
7
7
  */
8
8
  const resolvePageLang = ({ app, frontmatter, pathLocale, }) => {
9
- var _a, _b;
10
9
  if ((0, shared_1.isString)(frontmatter.lang) && frontmatter.lang) {
11
10
  return frontmatter.lang;
12
11
  }
13
- return (_b = (_a = app.siteData.locales[pathLocale]) === null || _a === void 0 ? void 0 : _a.lang) !== null && _b !== void 0 ? _b : app.siteData.lang;
12
+ return app.siteData.locales[pathLocale]?.lang ?? app.siteData.lang;
14
13
  };
15
14
  exports.resolvePageLang = resolvePageLang;
@@ -7,7 +7,6 @@ const utils_1 = require("@vuepress/utils");
7
7
  * Resolve page permalink from frontmatter / options / pattern
8
8
  */
9
9
  const resolvePagePermalink = ({ frontmatter, slug, date, pathInferred, pathLocale, }) => {
10
- var _a;
11
10
  // use permalink in frontmatter directly
12
11
  if ((0, shared_1.isString)(frontmatter.permalink)) {
13
12
  return frontmatter.permalink;
@@ -26,7 +25,7 @@ const resolvePagePermalink = ({ frontmatter, slug, date, pathInferred, pathLocal
26
25
  .replace(/:month/, month)
27
26
  .replace(/:day/, day)
28
27
  .replace(/:slug/, slug)
29
- .replace(/:raw/, (_a = pathInferred === null || pathInferred === void 0 ? void 0 : pathInferred.replace(/^\//, '')) !== null && _a !== void 0 ? _a : ''));
28
+ .replace(/:raw/, pathInferred?.replace(/^\//, '') ?? ''));
30
29
  return (0, shared_1.ensureLeadingSlash)(link);
31
30
  };
32
31
  exports.resolvePagePermalink = resolvePagePermalink;
@@ -4,5 +4,5 @@ exports.resolvePageRouteMeta = void 0;
4
4
  /**
5
5
  * Resolve page route meta
6
6
  */
7
- const resolvePageRouteMeta = ({ frontmatter, }) => { var _a; return (_a = frontmatter.routeMeta) !== null && _a !== void 0 ? _a : {}; };
7
+ const resolvePageRouteMeta = ({ frontmatter, }) => frontmatter.routeMeta ?? {};
8
8
  exports.resolvePageRouteMeta = resolvePageRouteMeta;
@@ -13,6 +13,7 @@ const createPluginApiHooks = () => ({
13
13
  extendsMarkdown: (0, createHookQueue_1.createHookQueue)('extendsMarkdown'),
14
14
  extendsPageOptions: (0, createHookQueue_1.createHookQueue)('extendsPageOptions'),
15
15
  extendsPage: (0, createHookQueue_1.createHookQueue)('extendsPage'),
16
+ extendsBundlerOptions: (0, createHookQueue_1.createHookQueue)('extendsBundlerOptions'),
16
17
  // client files hooks
17
18
  clientAppEnhanceFiles: (0, createHookQueue_1.createHookQueue)('clientAppEnhanceFiles'),
18
19
  clientAppRootComponentFiles: (0, createHookQueue_1.createHookQueue)('clientAppRootComponentFiles'),
@@ -59,7 +59,7 @@ export declare type Page<ExtraPageData extends Record<any, any> = Record<never,
59
59
  /**
60
60
  * Custom data to be attached to the page route record of vue-router
61
61
  *
62
- * @see https://next.router.vuejs.org/api/#meta
62
+ * @see https://router.vuejs.org/api/#meta
63
63
  */
64
64
  routeMeta: Record<string, unknown>;
65
65
  /**
@@ -26,6 +26,7 @@ export interface Hooks {
26
26
  extendsMarkdown: ExtendsHook<Markdown>;
27
27
  extendsPageOptions: ExtendsHook<PageOptions>;
28
28
  extendsPage: ExtendsHook<Page>;
29
+ extendsBundlerOptions: ExtendsHook<any>;
29
30
  clientAppEnhanceFiles: ClientFilesHook;
30
31
  clientAppRootComponentFiles: ClientFilesHook;
31
32
  clientAppSetupFiles: ClientFilesHook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/core",
3
- "version": "2.0.0-beta.41",
3
+ "version": "2.0.0-beta.42",
4
4
  "description": "Core package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -22,17 +22,14 @@
22
22
  "lib"
23
23
  ],
24
24
  "dependencies": {
25
- "@vuepress/client": "2.0.0-beta.41",
26
- "@vuepress/markdown": "2.0.0-beta.41",
27
- "@vuepress/shared": "2.0.0-beta.41",
28
- "@vuepress/utils": "2.0.0-beta.41",
25
+ "@vuepress/client": "2.0.0-beta.42",
26
+ "@vuepress/markdown": "2.0.0-beta.42",
27
+ "@vuepress/shared": "2.0.0-beta.42",
28
+ "@vuepress/utils": "2.0.0-beta.42",
29
29
  "gray-matter": "^4.0.3",
30
30
  "toml": "^3.0.0",
31
31
  "vue": "^3.2.33"
32
32
  },
33
- "peerDependencies": {
34
- "vue": "^3.2.33"
35
- },
36
33
  "publishConfig": {
37
34
  "access": "public"
38
35
  },