@docusaurus/core 0.0.0-4688 → 0.0.0-4693

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.
@@ -5,20 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { RouteConfig, ReportingSeverity } from '@docusaurus/types';
8
- declare type BrokenLink = {
9
- link: string;
10
- resolvedLink: string;
11
- };
12
- export declare function getAllBrokenLinks({ allCollectedLinks, routes, }: {
13
- allCollectedLinks: Record<string, string[]>;
14
- routes: RouteConfig[];
15
- }): Record<string, BrokenLink[]>;
16
- export declare function getBrokenLinksErrorMessage(allBrokenLinks: Record<string, BrokenLink[]>): string | undefined;
17
- export declare function filterExistingFileLinks({ baseUrl, outDir, allCollectedLinks, }: {
18
- baseUrl: string;
19
- outDir: string;
20
- allCollectedLinks: Record<string, string[]>;
21
- }): Promise<Record<string, string[]>>;
22
8
  export declare function handleBrokenLinks({ allCollectedLinks, onBrokenLinks, routes, baseUrl, outDir, }: {
23
9
  allCollectedLinks: Record<string, string[]>;
24
10
  onBrokenLinks: ReportingSeverity;
@@ -26,4 +12,3 @@ export declare function handleBrokenLinks({ allCollectedLinks, onBrokenLinks, ro
26
12
  baseUrl: string;
27
13
  outDir: string;
28
14
  }): Promise<void>;
29
- export {};
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.handleBrokenLinks = exports.filterExistingFileLinks = exports.getBrokenLinksErrorMessage = exports.getAllBrokenLinks = void 0;
9
+ exports.handleBrokenLinks = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const react_router_config_1 = require("react-router-config");
12
12
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
@@ -57,7 +57,6 @@ function getAllBrokenLinks({ allCollectedLinks, routes, }) {
57
57
  // remove pages without any broken link
58
58
  return lodash_1.default.pickBy(allBrokenLinks, (brokenLinks) => brokenLinks.length > 0);
59
59
  }
60
- exports.getAllBrokenLinks = getAllBrokenLinks;
61
60
  function getBrokenLinksErrorMessage(allBrokenLinks) {
62
61
  if (Object.keys(allBrokenLinks).length === 0) {
63
62
  return undefined;
@@ -93,8 +92,7 @@ function getBrokenLinksErrorMessage(allBrokenLinks) {
93
92
  It looks like some of the broken links we found appear in many pages of your site.
94
93
  Maybe those broken links appear on all pages through your site layout?
95
94
  We recommend that you check your theme configuration for such links (particularly, theme navbar and footer).
96
- Frequent broken links are linking to:${frequentLinks}
97
- `;
95
+ Frequent broken links are linking to:${frequentLinks}`;
98
96
  }
99
97
  return `Docusaurus found broken links!
100
98
 
@@ -107,7 +105,6 @@ ${Object.entries(allBrokenLinks)
107
105
  .join('\n')}
108
106
  `;
109
107
  }
110
- exports.getBrokenLinksErrorMessage = getBrokenLinksErrorMessage;
111
108
  async function isExistingFile(filePath) {
112
109
  try {
113
110
  return (await fs_extra_1.default.stat(filePath)).isFile();
@@ -139,7 +136,6 @@ async function filterExistingFileLinks({ baseUrl, outDir, allCollectedLinks, })
139
136
  }
140
137
  return (0, combine_promises_1.default)(lodash_1.default.mapValues(allCollectedLinks, async (links) => (await Promise.all(links.map(async (link) => ((await linkFileExists(link)) ? '' : link)))).filter(Boolean)));
141
138
  }
142
- exports.filterExistingFileLinks = filterExistingFileLinks;
143
139
  async function handleBrokenLinks({ allCollectedLinks, onBrokenLinks, routes, baseUrl, outDir, }) {
144
140
  if (onBrokenLinks === 'ignore') {
145
141
  return;
@@ -5,6 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { ReportingSeverity, RouteConfig } from '@docusaurus/types';
8
- export declare function getAllDuplicateRoutes(pluginsRouteConfigs: RouteConfig[]): string[];
9
- export declare function getDuplicateRoutesMessage(allDuplicateRoutes: string[]): string;
10
8
  export declare function handleDuplicateRoutes(pluginsRouteConfigs: RouteConfig[], onDuplicateRoutes: ReportingSeverity): void;
@@ -6,28 +6,26 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.handleDuplicateRoutes = exports.getDuplicateRoutesMessage = exports.getAllDuplicateRoutes = void 0;
9
+ exports.handleDuplicateRoutes = void 0;
10
10
  const utils_1 = require("@docusaurus/utils");
11
11
  const utils_2 = require("./utils");
12
12
  function getAllDuplicateRoutes(pluginsRouteConfigs) {
13
13
  const allRoutes = (0, utils_2.getAllFinalRoutes)(pluginsRouteConfigs).map((routeConfig) => routeConfig.path);
14
- const seenRoutes = {};
14
+ const seenRoutes = new Set();
15
15
  return allRoutes.filter((route) => {
16
- if (Object.prototype.hasOwnProperty.call(seenRoutes, route)) {
16
+ if (seenRoutes.has(route)) {
17
17
  return true;
18
18
  }
19
- seenRoutes[route] = true;
19
+ seenRoutes.add(route);
20
20
  return false;
21
21
  });
22
22
  }
23
- exports.getAllDuplicateRoutes = getAllDuplicateRoutes;
24
23
  function getDuplicateRoutesMessage(allDuplicateRoutes) {
25
24
  const message = allDuplicateRoutes
26
- .map((duplicateRoute) => `Attempting to create page at ${duplicateRoute}, but a page already exists at this route`)
25
+ .map((duplicateRoute) => `- Attempting to create page at ${duplicateRoute}, but a page already exists at this route.`)
27
26
  .join('\n');
28
27
  return message;
29
28
  }
30
- exports.getDuplicateRoutesMessage = getDuplicateRoutesMessage;
31
29
  function handleDuplicateRoutes(pluginsRouteConfigs, onDuplicateRoutes) {
32
30
  if (onDuplicateRoutes === 'ignore') {
33
31
  return;
@@ -35,7 +33,9 @@ function handleDuplicateRoutes(pluginsRouteConfigs, onDuplicateRoutes) {
35
33
  const duplicatePaths = getAllDuplicateRoutes(pluginsRouteConfigs);
36
34
  const message = getDuplicateRoutesMessage(duplicatePaths);
37
35
  if (message) {
38
- const finalMessage = `Duplicate routes found!\n${message}\nThis could lead to non-deterministic routing behavior`;
36
+ const finalMessage = `Duplicate routes found!
37
+ ${message}
38
+ This could lead to non-deterministic routing behavior.`;
39
39
  (0, utils_1.reportMessage)(finalMessage, onDuplicateRoutes);
40
40
  }
41
41
  }
@@ -4,6 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { InjectedHtmlTags, HtmlTags, LoadedPlugin } from '@docusaurus/types';
8
- export declare function createHtmlTagsString(tags: HtmlTags): string;
7
+ import type { InjectedHtmlTags, LoadedPlugin } from '@docusaurus/types';
9
8
  export declare function loadHtmlTags(plugins: LoadedPlugin[]): InjectedHtmlTags;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.loadHtmlTags = exports.createHtmlTagsString = void 0;
9
+ exports.loadHtmlTags = void 0;
10
10
  const tslib_1 = require("tslib");
11
11
  const htmlTags_1 = tslib_1.__importDefault(require("./htmlTags"));
12
12
  function toString(val) {
@@ -15,7 +15,6 @@ function toString(val) {
15
15
  function createHtmlTagsString(tags) {
16
16
  return Array.isArray(tags) ? tags.map(toString).join('\n') : toString(tags);
17
17
  }
18
- exports.createHtmlTagsString = createHtmlTagsString;
19
18
  function loadHtmlTags(plugins) {
20
19
  const htmlTags = plugins.reduce((acc, plugin) => {
21
20
  if (!plugin.injectHtmlTags) {
@@ -14,9 +14,6 @@ const rtl_detect_1 = require("rtl-detect");
14
14
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
15
15
  function getDefaultLocaleLabel(locale) {
16
16
  const languageName = new Intl.DisplayNames(locale, { type: 'language' }).of(locale);
17
- if (!languageName) {
18
- return locale;
19
- }
20
17
  return (languageName.charAt(0).toLocaleUpperCase(locale) + languageName.substring(1));
21
18
  }
22
19
  function getDefaultLocaleConfig(locale) {
@@ -15,8 +15,8 @@ async function loadPresets(context) {
15
15
  // siteDir's package.json declares the dependency on these presets.
16
16
  const presetRequire = (0, module_1.createRequire)(context.siteConfigPath);
17
17
  const { presets } = context.siteConfig;
18
- const unflatPlugins = [];
19
- const unflatThemes = [];
18
+ const plugins = [];
19
+ const themes = [];
20
20
  presets.forEach((presetItem) => {
21
21
  let presetModuleImport;
22
22
  let presetOptions = {};
@@ -30,15 +30,12 @@ async function loadPresets(context) {
30
30
  const presetModule = (0, import_fresh_1.default)(presetRequire.resolve(presetName));
31
31
  const preset = (presetModule.default ?? presetModule)(context, presetOptions);
32
32
  if (preset.plugins) {
33
- unflatPlugins.push(preset.plugins);
33
+ plugins.push(...preset.plugins.filter(Boolean));
34
34
  }
35
35
  if (preset.themes) {
36
- unflatThemes.push(preset.themes);
36
+ themes.push(...preset.themes.filter(Boolean));
37
37
  }
38
38
  });
39
- return {
40
- plugins: unflatPlugins.flat().filter(Boolean),
41
- themes: unflatThemes.flat().filter(Boolean),
42
- };
39
+ return { plugins, themes };
43
40
  }
44
41
  exports.default = loadPresets;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-4688",
4
+ "version": "0.0.0-4693",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.17.2",
42
42
  "@babel/runtime-corejs3": "^7.17.2",
43
43
  "@babel/traverse": "^7.17.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4688",
45
- "@docusaurus/logger": "0.0.0-4688",
46
- "@docusaurus/mdx-loader": "0.0.0-4688",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4693",
45
+ "@docusaurus/logger": "0.0.0-4693",
46
+ "@docusaurus/mdx-loader": "0.0.0-4693",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4688",
49
- "@docusaurus/utils-common": "0.0.0-4688",
50
- "@docusaurus/utils-validation": "0.0.0-4688",
48
+ "@docusaurus/utils": "0.0.0-4693",
49
+ "@docusaurus/utils-common": "0.0.0-4693",
50
+ "@docusaurus/utils-validation": "0.0.0-4693",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.1",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.2",
@@ -106,8 +106,8 @@
106
106
  "webpackbar": "^5.0.2"
107
107
  },
108
108
  "devDependencies": {
109
- "@docusaurus/module-type-aliases": "0.0.0-4688",
110
- "@docusaurus/types": "0.0.0-4688",
109
+ "@docusaurus/module-type-aliases": "0.0.0-4693",
110
+ "@docusaurus/types": "0.0.0-4693",
111
111
  "@types/detect-port": "^1.3.2",
112
112
  "@types/nprogress": "^0.2.0",
113
113
  "@types/react-dom": "^17.0.11",
@@ -128,5 +128,5 @@
128
128
  "engines": {
129
129
  "node": ">=14"
130
130
  },
131
- "gitHead": "1b4b624e2d929f444465aec5a01ccb8518c60df6"
131
+ "gitHead": "f5ed3eaf62d30a211da3b0aaf76dfc6deafba859"
132
132
  }