@docusaurus/core 2.0.0-beta.16 → 2.0.0-beta.19
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/bin/beforeCli.mjs +14 -12
- package/bin/docusaurus.mjs +41 -93
- package/lib/babel/preset.js +2 -2
- package/lib/client/.eslintrc.js +2 -3
- package/lib/client/App.d.ts +1 -1
- package/lib/client/App.js +15 -7
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → BaseUrlIssueBanner/index.d.ts} +10 -5
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +14 -9
- package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
- package/lib/client/ClientLifecyclesDispatcher.d.ts +16 -0
- package/lib/client/ClientLifecyclesDispatcher.js +34 -0
- package/lib/client/LinksCollector.d.ts +1 -1
- package/lib/client/LinksCollector.js +4 -5
- package/lib/client/PendingNavigation.d.ts +8 -17
- package/lib/client/PendingNavigation.js +39 -70
- package/lib/{server/loadSetup.d.ts → client/SiteMetadataDefaults.d.ts} +2 -2
- package/lib/client/SiteMetadataDefaults.js +19 -0
- package/lib/client/{exports/browserContext.d.ts → browserContext.d.ts} +0 -0
- package/lib/client/{exports/browserContext.js → browserContext.js} +0 -0
- package/lib/client/clientEntry.js +3 -4
- package/lib/client/docusaurus.d.ts +5 -5
- package/lib/client/docusaurus.js +26 -33
- package/lib/client/{exports/docusaurusContext.d.ts → docusaurusContext.d.ts} +0 -0
- package/lib/client/{exports/docusaurusContext.js → docusaurusContext.js} +0 -0
- package/lib/client/exports/BrowserOnly.d.ts +3 -4
- package/lib/client/exports/BrowserOnly.js +2 -2
- package/lib/client/exports/ComponentCreator.js +65 -40
- package/lib/client/exports/ErrorBoundary.d.ts +2 -2
- package/lib/client/exports/ErrorBoundary.js +4 -5
- package/lib/client/exports/Interpolate.d.ts +1 -1
- package/lib/client/exports/Interpolate.js +18 -41
- package/lib/client/exports/Link.d.ts +3 -15
- package/lib/client/exports/Link.js +24 -30
- package/lib/client/exports/Translate.d.ts +2 -2
- package/lib/client/exports/Translate.js +3 -3
- package/lib/client/exports/useBaseUrl.js +8 -9
- package/lib/client/exports/useDocusaurusContext.js +1 -1
- package/lib/client/exports/useGlobalData.d.ts +4 -3
- package/lib/client/exports/useGlobalData.js +5 -5
- package/lib/client/exports/useIsBrowser.js +1 -1
- package/lib/{server/client-modules/index.d.ts → client/exports/useRouteContext.d.ts} +2 -2
- package/lib/client/exports/useRouteContext.js +15 -0
- package/lib/client/flat.d.ts +12 -2
- package/lib/client/flat.js +12 -5
- package/lib/client/normalizeLocation.js +13 -8
- package/lib/client/prefetch.js +10 -28
- package/lib/client/preload.d.ts +1 -3
- package/lib/client/preload.js +5 -11
- package/lib/client/routeContext.d.ts +13 -0
- package/lib/client/routeContext.js +31 -0
- package/lib/client/serverEntry.js +19 -18
- package/lib/client/theme-fallback/Error/index.js +7 -1
- package/lib/client/theme-fallback/Layout/index.d.ts +1 -1
- package/lib/client/theme-fallback/Layout/index.js +2 -17
- package/lib/client/theme-fallback/Loading/index.js +2 -0
- package/lib/client/theme-fallback/NotFound/index.js +13 -5
- package/lib/client/theme-fallback/Root/index.d.ts +4 -4
- package/lib/client/theme-fallback/Root/index.js +2 -1
- package/lib/{server/html-tags/htmlTags.d.ts → client/theme-fallback/SiteMetadata/index.d.ts} +2 -1
- package/lib/client/theme-fallback/SiteMetadata/index.js +10 -0
- package/lib/commands/build.d.ts +6 -2
- package/lib/commands/build.js +48 -30
- package/lib/commands/clear.d.ts +1 -1
- package/lib/commands/clear.js +6 -5
- package/lib/commands/deploy.d.ts +5 -5
- package/lib/commands/deploy.js +21 -45
- package/lib/commands/external.d.ts +1 -1
- package/lib/commands/external.js +6 -11
- package/lib/commands/serve.d.ts +7 -2
- package/lib/commands/serve.js +18 -19
- package/lib/commands/start.d.ts +8 -2
- package/lib/commands/start.js +33 -30
- package/lib/commands/swizzle/actions.d.ts +2 -2
- package/lib/commands/swizzle/actions.js +10 -10
- package/lib/commands/swizzle/common.d.ts +3 -3
- package/lib/commands/swizzle/common.js +8 -9
- package/lib/commands/swizzle/components.js +48 -13
- package/lib/commands/swizzle/config.js +21 -15
- package/lib/commands/swizzle/context.js +6 -12
- package/lib/commands/swizzle/index.d.ts +2 -2
- package/lib/commands/swizzle/index.js +5 -4
- package/lib/commands/swizzle/prompts.js +2 -2
- package/lib/commands/swizzle/tables.js +10 -13
- package/lib/commands/swizzle/themes.js +9 -8
- package/lib/commands/writeHeadingIds.d.ts +2 -9
- package/lib/commands/writeHeadingIds.js +11 -69
- package/lib/commands/writeTranslations.d.ts +3 -4
- package/lib/commands/writeTranslations.js +10 -14
- package/lib/index.d.ts +9 -10
- package/lib/index.js +18 -19
- package/lib/server/brokenLinks.d.ts +3 -16
- package/lib/server/brokenLinks.js +37 -31
- package/lib/server/clientModules.d.ts +12 -0
- package/lib/server/clientModules.js +20 -0
- package/lib/server/config.d.ts +5 -2
- package/lib/server/config.js +14 -9
- package/lib/server/configValidation.d.ts +1 -1
- package/lib/server/configValidation.js +39 -13
- package/lib/server/getHostPort.d.ts +14 -0
- package/lib/{choosePort.js → server/getHostPort.js} +24 -41
- package/lib/server/htmlTags.d.ts +12 -0
- package/lib/server/htmlTags.js +62 -0
- package/lib/server/i18n.d.ts +2 -11
- package/lib/server/i18n.js +7 -28
- package/lib/server/index.d.ts +28 -13
- package/lib/server/index.js +62 -229
- package/lib/server/plugins/configs.d.ts +51 -0
- package/lib/server/plugins/configs.js +101 -0
- package/lib/server/plugins/index.d.ts +9 -8
- package/lib/server/plugins/index.js +65 -132
- package/lib/server/plugins/init.d.ts +6 -15
- package/lib/server/plugins/init.js +25 -83
- package/lib/server/{moduleShorthand.d.ts → plugins/moduleShorthand.d.ts} +0 -0
- package/lib/server/{moduleShorthand.js → plugins/moduleShorthand.js} +0 -0
- package/lib/server/plugins/pluginIds.d.ts +4 -0
- package/lib/server/plugins/pluginIds.js +6 -4
- package/lib/server/plugins/presets.d.ts +12 -0
- package/lib/server/{presets/index.js → plugins/presets.js} +21 -20
- package/lib/server/plugins/{applyRouteTrailingSlash.d.ts → routeConfig.d.ts} +3 -1
- package/lib/server/plugins/routeConfig.js +54 -0
- package/lib/server/plugins/synthetic.d.ts +20 -0
- package/lib/server/plugins/synthetic.js +112 -0
- package/lib/server/routes.d.ts +39 -7
- package/lib/server/routes.js +169 -102
- package/lib/server/siteMetadata.d.ts +12 -0
- package/lib/server/siteMetadata.js +81 -0
- package/lib/server/translations/translations.d.ts +5 -14
- package/lib/server/translations/translations.js +23 -39
- package/lib/server/translations/translationsExtractor.d.ts +2 -2
- package/lib/server/translations/translationsExtractor.js +16 -19
- package/lib/server/utils.js +1 -1
- package/lib/webpack/aliases/index.d.ts +34 -0
- package/lib/webpack/aliases/index.js +106 -0
- package/lib/webpack/base.d.ts +0 -1
- package/lib/webpack/base.js +12 -30
- package/lib/webpack/client.js +7 -8
- package/lib/webpack/plugins/ChunkAssetPlugin.js +7 -7
- package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +2 -2
- package/lib/webpack/plugins/CleanWebpackPlugin.js +2 -2
- package/lib/webpack/plugins/LogPlugin.js +2 -2
- package/lib/webpack/plugins/WaitPlugin.d.ts +2 -2
- package/lib/webpack/plugins/WaitPlugin.js +3 -3
- package/lib/webpack/server.d.ts +2 -2
- package/lib/webpack/server.js +10 -8
- package/lib/webpack/utils.d.ts +9 -3
- package/lib/webpack/utils.js +20 -25
- package/package.json +38 -41
- package/lib/choosePort.d.ts +0 -11
- package/lib/client/client-lifecycles-dispatcher.d.ts +0 -9
- package/lib/client/client-lifecycles-dispatcher.js +0 -23
- package/lib/client/nprogress.css +0 -36
- package/lib/commands/commandUtils.d.ts +0 -9
- package/lib/commands/commandUtils.js +0 -21
- package/lib/server/client-modules/index.js +0 -12
- package/lib/server/duplicateRoutes.d.ts +0 -10
- package/lib/server/duplicateRoutes.js +0 -42
- package/lib/server/html-tags/htmlTags.js +0 -38
- package/lib/server/html-tags/index.d.ts +0 -9
- package/lib/server/html-tags/index.js +0 -43
- package/lib/server/loadSetup.js +0 -25
- package/lib/server/plugins/applyRouteTrailingSlash.js +0 -19
- package/lib/server/presets/index.d.ts +0 -11
- package/lib/server/themes/alias.d.ts +0 -9
- package/lib/server/themes/alias.js +0 -48
- package/lib/server/themes/index.d.ts +0 -12
- package/lib/server/themes/index.js +0 -47
- package/lib/server/versions/__fixtures__/dummy-plugin.d.ts +0 -0
- package/lib/server/versions/__fixtures__/dummy-plugin.js +0 -0
- package/lib/server/versions/__fixtures__/package.json +0 -3
- package/lib/server/versions/index.d.ts +0 -9
- package/lib/server/versions/index.js +0 -51
|
@@ -6,71 +6,17 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.writeHeadingIds = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const fs_extra_1 =
|
|
12
|
-
const logger_1 =
|
|
13
|
-
const server_1 = require("../server");
|
|
14
|
-
const init_1 = (0, tslib_1.__importDefault)(require("../server/plugins/init"));
|
|
11
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
15
13
|
const utils_1 = require("@docusaurus/utils");
|
|
14
|
+
const server_1 = require("../server");
|
|
15
|
+
const init_1 = require("../server/plugins/init");
|
|
16
16
|
const utils_2 = require("../server/utils");
|
|
17
|
-
function unwrapMarkdownLinks(line) {
|
|
18
|
-
return line.replace(/\[(?<alt>[^\]]+)\]\([^)]+\)/g, (match, p1) => p1);
|
|
19
|
-
}
|
|
20
|
-
function addHeadingId(line, slugger, maintainCase) {
|
|
21
|
-
let headingLevel = 0;
|
|
22
|
-
while (line.charAt(headingLevel) === '#') {
|
|
23
|
-
headingLevel += 1;
|
|
24
|
-
}
|
|
25
|
-
const headingText = line.slice(headingLevel).trimEnd();
|
|
26
|
-
const headingHashes = line.slice(0, headingLevel);
|
|
27
|
-
const slug = slugger
|
|
28
|
-
.slug(unwrapMarkdownLinks(headingText).trim(), { maintainCase })
|
|
29
|
-
.replace(/^-+/, '')
|
|
30
|
-
.replace(/-+$/, '');
|
|
31
|
-
return `${headingHashes}${headingText} {#${slug}}`;
|
|
32
|
-
}
|
|
33
|
-
function transformMarkdownHeadingLine(line, slugger, options = { maintainCase: false, overwrite: false }) {
|
|
34
|
-
const { maintainCase = false, overwrite = false } = options;
|
|
35
|
-
if (!line.startsWith('#')) {
|
|
36
|
-
throw new Error(`Line is not a Markdown heading: ${line}.`);
|
|
37
|
-
}
|
|
38
|
-
const parsedHeading = (0, utils_1.parseMarkdownHeadingId)(line);
|
|
39
|
-
// Do not process if id is already there
|
|
40
|
-
if (parsedHeading.id && !overwrite) {
|
|
41
|
-
return line;
|
|
42
|
-
}
|
|
43
|
-
return addHeadingId(parsedHeading.text, slugger, maintainCase);
|
|
44
|
-
}
|
|
45
|
-
exports.transformMarkdownHeadingLine = transformMarkdownHeadingLine;
|
|
46
|
-
function transformMarkdownLine(line, slugger, options) {
|
|
47
|
-
// Ignore h1 headings on purpose, as we don't create anchor links for those
|
|
48
|
-
if (line.startsWith('##')) {
|
|
49
|
-
return transformMarkdownHeadingLine(line, slugger, options);
|
|
50
|
-
}
|
|
51
|
-
return line;
|
|
52
|
-
}
|
|
53
|
-
function transformMarkdownLines(lines, options) {
|
|
54
|
-
let inCode = false;
|
|
55
|
-
const slugger = (0, utils_1.createSlugger)();
|
|
56
|
-
return lines.map((line) => {
|
|
57
|
-
if (line.startsWith('```')) {
|
|
58
|
-
inCode = !inCode;
|
|
59
|
-
return line;
|
|
60
|
-
}
|
|
61
|
-
if (inCode) {
|
|
62
|
-
return line;
|
|
63
|
-
}
|
|
64
|
-
return transformMarkdownLine(line, slugger, options);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function transformMarkdownContent(content, options) {
|
|
68
|
-
return transformMarkdownLines(content.split('\n'), options).join('\n');
|
|
69
|
-
}
|
|
70
|
-
exports.transformMarkdownContent = transformMarkdownContent;
|
|
71
17
|
async function transformMarkdownFile(filepath, options) {
|
|
72
18
|
const content = await fs_extra_1.default.readFile(filepath, 'utf8');
|
|
73
|
-
const updatedContent =
|
|
19
|
+
const updatedContent = (0, utils_1.writeMarkdownHeadingId)(content, options);
|
|
74
20
|
if (content !== updatedContent) {
|
|
75
21
|
await fs_extra_1.default.writeFile(filepath, updatedContent);
|
|
76
22
|
return filepath;
|
|
@@ -84,16 +30,12 @@ async function transformMarkdownFile(filepath, options) {
|
|
|
84
30
|
* transformed
|
|
85
31
|
*/
|
|
86
32
|
async function getPathsToWatch(siteDir) {
|
|
87
|
-
const context = await (0, server_1.loadContext)(siteDir);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
pluginConfigs,
|
|
91
|
-
context,
|
|
92
|
-
});
|
|
93
|
-
return plugins.flatMap((plugin) => { var _a, _b; return (_b = (_a = plugin === null || plugin === void 0 ? void 0 : plugin.getPathsToWatch) === null || _a === void 0 ? void 0 : _a.call(plugin)) !== null && _b !== void 0 ? _b : []; });
|
|
33
|
+
const context = await (0, server_1.loadContext)({ siteDir });
|
|
34
|
+
const plugins = await (0, init_1.initPlugins)(context);
|
|
35
|
+
return plugins.flatMap((plugin) => plugin?.getPathsToWatch?.() ?? []);
|
|
94
36
|
}
|
|
95
37
|
async function writeHeadingIds(siteDir, files, options) {
|
|
96
|
-
const markdownFiles = await (0, utils_2.safeGlobby)(files
|
|
38
|
+
const markdownFiles = await (0, utils_2.safeGlobby)(files ?? (await getPathsToWatch(siteDir)), {
|
|
97
39
|
expandDirectories: ['**/*.{md,mdx}'],
|
|
98
40
|
});
|
|
99
41
|
const result = await Promise.all(markdownFiles.map((p) => transformMarkdownFile(p, options)));
|
|
@@ -105,4 +47,4 @@ async function writeHeadingIds(siteDir, files, options) {
|
|
|
105
47
|
logger_1.default.warn `number=${markdownFiles.length} Markdown files already have explicit heading IDs. If you intend to overwrite the existing heading IDs, use the code=${'--overwrite'} option.`;
|
|
106
48
|
}
|
|
107
49
|
}
|
|
108
|
-
exports.
|
|
50
|
+
exports.writeHeadingIds = writeHeadingIds;
|
|
@@ -4,8 +4,7 @@
|
|
|
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
|
|
7
|
+
import { type LoadContextOptions } from '../server';
|
|
8
8
|
import { type WriteTranslationsOptions } from '../server/translations/translations';
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
}): Promise<void>;
|
|
9
|
+
export declare type WriteTranslationsCLIOptions = Pick<LoadContextOptions, 'config' | 'locale'> & WriteTranslationsOptions;
|
|
10
|
+
export declare function writeTranslations(siteDir: string, options: Partial<WriteTranslationsCLIOptions>): Promise<void>;
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.writeTranslations = void 0;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
|
-
const path_1 =
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
12
|
const server_1 = require("../server");
|
|
12
|
-
const init_1 =
|
|
13
|
+
const init_1 = require("../server/plugins/init");
|
|
13
14
|
const translations_1 = require("../server/translations/translations");
|
|
14
15
|
const translationsExtractor_1 = require("../server/translations/translationsExtractor");
|
|
15
16
|
const utils_1 = require("../webpack/utils");
|
|
@@ -30,9 +31,8 @@ async function getExtraSourceCodeFilePaths() {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
async function writePluginTranslationFiles({ siteDir, plugin, locale, options, }) {
|
|
33
|
-
var _a;
|
|
34
34
|
if (plugin.getTranslationFiles) {
|
|
35
|
-
const content = await
|
|
35
|
+
const content = await plugin.loadContent?.();
|
|
36
36
|
const translationFiles = await plugin.getTranslationFiles({
|
|
37
37
|
content,
|
|
38
38
|
});
|
|
@@ -48,17 +48,13 @@ async function writePluginTranslationFiles({ siteDir, plugin, locale, options, }
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
async function writeTranslations(siteDir, options) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const context = await (0, server_1.loadContext)({
|
|
52
|
+
siteDir,
|
|
53
|
+
config: options.config,
|
|
54
54
|
locale: options.locale,
|
|
55
55
|
});
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
pluginConfigs,
|
|
59
|
-
context,
|
|
60
|
-
});
|
|
61
|
-
const locale = (_a = options.locale) !== null && _a !== void 0 ? _a : context.i18n.defaultLocale;
|
|
56
|
+
const plugins = await (0, init_1.initPlugins)(context);
|
|
57
|
+
const locale = options.locale ?? context.i18n.defaultLocale;
|
|
62
58
|
if (!context.i18n.locales.includes(locale)) {
|
|
63
59
|
throw new Error(`Can't write-translation for locale "${locale}" that is not in the locale configuration file.
|
|
64
60
|
Available locales are: ${context.i18n.locales.join(',')}.`);
|
|
@@ -78,4 +74,4 @@ Available locales are: ${context.i18n.locales.join(',')}.`);
|
|
|
78
74
|
await writePluginTranslationFiles({ siteDir, plugin, locale, options });
|
|
79
75
|
}));
|
|
80
76
|
}
|
|
81
|
-
exports.
|
|
77
|
+
exports.writeTranslations = writeTranslations;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export { build, clear, deploy, externalCommand, serve, start, swizzle, writeHeadingIds, writeTranslations, };
|
|
7
|
+
export { build } from './commands/build';
|
|
8
|
+
export { clear } from './commands/clear';
|
|
9
|
+
export { deploy } from './commands/deploy';
|
|
10
|
+
export { externalCommand } from './commands/external';
|
|
11
|
+
export { serve } from './commands/serve';
|
|
12
|
+
export { start } from './commands/start';
|
|
13
|
+
export { swizzle } from './commands/swizzle';
|
|
14
|
+
export { writeHeadingIds } from './commands/writeHeadingIds';
|
|
15
|
+
export { writeTranslations } from './commands/writeTranslations';
|
package/lib/index.js
CHANGED
|
@@ -7,22 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.writeTranslations = exports.writeHeadingIds = exports.swizzle = exports.start = exports.serve = exports.externalCommand = exports.deploy = exports.clear = exports.build = void 0;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exports.writeTranslations = writeTranslations_1.default;
|
|
10
|
+
var build_1 = require("./commands/build");
|
|
11
|
+
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_1.build; } });
|
|
12
|
+
var clear_1 = require("./commands/clear");
|
|
13
|
+
Object.defineProperty(exports, "clear", { enumerable: true, get: function () { return clear_1.clear; } });
|
|
14
|
+
var deploy_1 = require("./commands/deploy");
|
|
15
|
+
Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return deploy_1.deploy; } });
|
|
16
|
+
var external_1 = require("./commands/external");
|
|
17
|
+
Object.defineProperty(exports, "externalCommand", { enumerable: true, get: function () { return external_1.externalCommand; } });
|
|
18
|
+
var serve_1 = require("./commands/serve");
|
|
19
|
+
Object.defineProperty(exports, "serve", { enumerable: true, get: function () { return serve_1.serve; } });
|
|
20
|
+
var start_1 = require("./commands/start");
|
|
21
|
+
Object.defineProperty(exports, "start", { enumerable: true, get: function () { return start_1.start; } });
|
|
22
|
+
var swizzle_1 = require("./commands/swizzle");
|
|
23
|
+
Object.defineProperty(exports, "swizzle", { enumerable: true, get: function () { return swizzle_1.swizzle; } });
|
|
24
|
+
var writeHeadingIds_1 = require("./commands/writeHeadingIds");
|
|
25
|
+
Object.defineProperty(exports, "writeHeadingIds", { enumerable: true, get: function () { return writeHeadingIds_1.writeHeadingIds; } });
|
|
26
|
+
var writeTranslations_1 = require("./commands/writeTranslations");
|
|
27
|
+
Object.defineProperty(exports, "writeTranslations", { enumerable: true, get: function () { return writeTranslations_1.writeTranslations; } });
|
|
@@ -5,25 +5,12 @@
|
|
|
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
|
-
allCollectedLinks:
|
|
9
|
+
allCollectedLinks: {
|
|
10
|
+
[location: string]: string[];
|
|
11
|
+
};
|
|
24
12
|
onBrokenLinks: ReportingSeverity;
|
|
25
13
|
routes: RouteConfig[];
|
|
26
14
|
baseUrl: string;
|
|
27
15
|
outDir: string;
|
|
28
16
|
}): Promise<void>;
|
|
29
|
-
export {};
|
|
@@ -6,36 +6,35 @@
|
|
|
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 =
|
|
9
|
+
exports.handleBrokenLinks = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const react_router_config_1 = require("react-router-config");
|
|
12
|
-
const fs_extra_1 =
|
|
13
|
-
const lodash_1 =
|
|
12
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
15
|
const utils_2 = require("./utils");
|
|
16
|
-
const path_1 =
|
|
17
|
-
const combine_promises_1 =
|
|
18
|
-
|
|
19
|
-
// @ts-expect-error: types incompatible???
|
|
20
|
-
return routes;
|
|
21
|
-
}
|
|
16
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
17
|
+
const combine_promises_1 = tslib_1.__importDefault(require("combine-promises"));
|
|
18
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
22
19
|
// matchRoutes does not support qs/anchors, so we remove it!
|
|
23
20
|
function onlyPathname(link) {
|
|
24
21
|
return link.split('#')[0].split('?')[0];
|
|
25
22
|
}
|
|
26
23
|
function getPageBrokenLinks({ pagePath, pageLinks, routes, }) {
|
|
27
|
-
// ReactRouter is able to support links like ./../somePath
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
// resolvePathname is used internally by ReactRouter
|
|
24
|
+
// ReactRouter is able to support links like ./../somePath but `matchRoutes`
|
|
25
|
+
// does not do this resolution internally. We must resolve the links before
|
|
26
|
+
// using `matchRoutes`. `resolvePathname` is used internally by React Router
|
|
31
27
|
function resolveLink(link) {
|
|
32
28
|
const resolvedLink = (0, utils_1.resolvePathname)(onlyPathname(link), pagePath);
|
|
33
29
|
return { link, resolvedLink };
|
|
34
30
|
}
|
|
35
31
|
function isBrokenLink(link) {
|
|
36
32
|
const matchedRoutes = [link, decodeURI(link)]
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
// @ts-expect-error: React router types RouteConfig with an actual React
|
|
34
|
+
// component, but we load route components with string paths.
|
|
35
|
+
// We don't actually access component here, so it's fine.
|
|
36
|
+
.map((l) => (0, react_router_config_1.matchRoutes)(routes, l))
|
|
37
|
+
.flat();
|
|
39
38
|
return matchedRoutes.length === 0;
|
|
40
39
|
}
|
|
41
40
|
return pageLinks.map(resolveLink).filter((l) => isBrokenLink(l.resolvedLink));
|
|
@@ -43,8 +42,8 @@ function getPageBrokenLinks({ pagePath, pageLinks, routes, }) {
|
|
|
43
42
|
/**
|
|
44
43
|
* The route defs can be recursive, and have a parent match-all route. We don't
|
|
45
44
|
* want to match broken links like /docs/brokenLink against /docs/*. For this
|
|
46
|
-
* reason, we only consider the "final routes"
|
|
47
|
-
* We also need to remove the match
|
|
45
|
+
* reason, we only consider the "final routes" that do not have subroutes.
|
|
46
|
+
* We also need to remove the match-all 404 route
|
|
48
47
|
*/
|
|
49
48
|
function filterIntermediateRoutes(routesInput) {
|
|
50
49
|
const routesWithout404 = routesInput.filter((route) => route.path !== '*');
|
|
@@ -53,10 +52,8 @@ function filterIntermediateRoutes(routesInput) {
|
|
|
53
52
|
function getAllBrokenLinks({ allCollectedLinks, routes, }) {
|
|
54
53
|
const filteredRoutes = filterIntermediateRoutes(routes);
|
|
55
54
|
const allBrokenLinks = lodash_1.default.mapValues(allCollectedLinks, (pageLinks, pagePath) => getPageBrokenLinks({ pageLinks, pagePath, routes: filteredRoutes }));
|
|
56
|
-
// remove pages without any broken link
|
|
57
55
|
return lodash_1.default.pickBy(allBrokenLinks, (brokenLinks) => brokenLinks.length > 0);
|
|
58
56
|
}
|
|
59
|
-
exports.getAllBrokenLinks = getAllBrokenLinks;
|
|
60
57
|
function getBrokenLinksErrorMessage(allBrokenLinks) {
|
|
61
58
|
if (Object.keys(allBrokenLinks).length === 0) {
|
|
62
59
|
return undefined;
|
|
@@ -66,7 +63,9 @@ function getBrokenLinksErrorMessage(allBrokenLinks) {
|
|
|
66
63
|
return `${brokenLink.link}${showResolvedLink ? ` (resolved as: ${brokenLink.resolvedLink})` : ''}`;
|
|
67
64
|
}
|
|
68
65
|
function pageBrokenLinksMessage(pagePath, brokenLinks) {
|
|
69
|
-
return
|
|
66
|
+
return `
|
|
67
|
+
- On source page path = ${pagePath}:
|
|
68
|
+
-> linking to ${brokenLinks
|
|
70
69
|
.map(brokenLinkMessage)
|
|
71
70
|
.join('\n -> linking to ')}`;
|
|
72
71
|
}
|
|
@@ -85,15 +84,24 @@ function getBrokenLinksErrorMessage(allBrokenLinks) {
|
|
|
85
84
|
if (frequentLinks.length === 0) {
|
|
86
85
|
return '';
|
|
87
86
|
}
|
|
88
|
-
return
|
|
87
|
+
return logger_1.default.interpolate `
|
|
88
|
+
|
|
89
|
+
It looks like some of the broken links we found appear in many pages of your site.
|
|
90
|
+
Maybe those broken links appear on all pages through your site layout?
|
|
91
|
+
We recommend that you check your theme configuration for such links (particularly, theme navbar and footer).
|
|
92
|
+
Frequent broken links are linking to:${frequentLinks}`;
|
|
89
93
|
}
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
return `Docusaurus found broken links!
|
|
95
|
+
|
|
96
|
+
Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist.
|
|
97
|
+
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.${getLayoutBrokenLinksHelpMessage()}
|
|
98
|
+
|
|
99
|
+
Exhaustive list of all broken links found:
|
|
100
|
+
${Object.entries(allBrokenLinks)
|
|
101
|
+
.map(([pagePath, brokenLinks]) => pageBrokenLinksMessage(pagePath, brokenLinks))
|
|
102
|
+
.join('\n')}
|
|
103
|
+
`;
|
|
95
104
|
}
|
|
96
|
-
exports.getBrokenLinksErrorMessage = getBrokenLinksErrorMessage;
|
|
97
105
|
async function isExistingFile(filePath) {
|
|
98
106
|
try {
|
|
99
107
|
return (await fs_extra_1.default.stat(filePath)).isFile();
|
|
@@ -107,14 +115,13 @@ async function isExistingFile(filePath) {
|
|
|
107
115
|
async function filterExistingFileLinks({ baseUrl, outDir, allCollectedLinks, }) {
|
|
108
116
|
async function linkFileExists(link) {
|
|
109
117
|
// /baseUrl/javadoc/ -> /outDir/javadoc
|
|
110
|
-
const baseFilePath = (0, utils_1.removeSuffix)(`${outDir}/${(0, utils_1.removePrefix)(link, baseUrl)}`, '/');
|
|
118
|
+
const baseFilePath = onlyPathname((0, utils_1.removeSuffix)(`${outDir}/${(0, utils_1.removePrefix)(link, baseUrl)}`, '/'));
|
|
111
119
|
// -> /outDir/javadoc
|
|
112
120
|
// -> /outDir/javadoc.html
|
|
113
121
|
// -> /outDir/javadoc/index.html
|
|
114
122
|
const filePathsToTry = [baseFilePath];
|
|
115
123
|
if (!path_1.default.extname(baseFilePath)) {
|
|
116
|
-
filePathsToTry.push(`${baseFilePath}.html
|
|
117
|
-
filePathsToTry.push(path_1.default.join(baseFilePath, 'index.html'));
|
|
124
|
+
filePathsToTry.push(`${baseFilePath}.html`, path_1.default.join(baseFilePath, 'index.html'));
|
|
118
125
|
}
|
|
119
126
|
for (const file of filePathsToTry) {
|
|
120
127
|
if (await isExistingFile(file)) {
|
|
@@ -125,7 +132,6 @@ async function filterExistingFileLinks({ baseUrl, outDir, allCollectedLinks, })
|
|
|
125
132
|
}
|
|
126
133
|
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)));
|
|
127
134
|
}
|
|
128
|
-
exports.filterExistingFileLinks = filterExistingFileLinks;
|
|
129
135
|
async function handleBrokenLinks({ allCollectedLinks, onBrokenLinks, routes, baseUrl, outDir, }) {
|
|
130
136
|
if (onBrokenLinks === 'ignore') {
|
|
131
137
|
return;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { LoadedPlugin } from '@docusaurus/types';
|
|
8
|
+
/**
|
|
9
|
+
* Runs the `getClientModules` lifecycle. The returned file paths are all
|
|
10
|
+
* absolute.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadClientModules(plugins: LoadedPlugin[]): string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.loadClientModules = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
/**
|
|
13
|
+
* Runs the `getClientModules` lifecycle. The returned file paths are all
|
|
14
|
+
* absolute.
|
|
15
|
+
*/
|
|
16
|
+
function loadClientModules(plugins) {
|
|
17
|
+
return plugins.flatMap((plugin) => plugin.getClientModules?.().map((p) => path_1.default.resolve(plugin.path, p)) ??
|
|
18
|
+
[]);
|
|
19
|
+
}
|
|
20
|
+
exports.loadClientModules = loadClientModules;
|
package/lib/server/config.d.ts
CHANGED
|
@@ -4,5 +4,8 @@
|
|
|
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 {
|
|
8
|
-
export
|
|
7
|
+
import type { LoadContext } from '@docusaurus/types';
|
|
8
|
+
export declare function loadSiteConfig({ siteDir, customConfigFilePath, }: {
|
|
9
|
+
siteDir: string;
|
|
10
|
+
customConfigFilePath?: string;
|
|
11
|
+
}): Promise<Pick<LoadContext, 'siteConfig' | 'siteConfigPath'>>;
|
package/lib/server/config.js
CHANGED
|
@@ -6,18 +6,23 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.loadSiteConfig = void 0;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
+
const import_fresh_1 = tslib_1.__importDefault(require("import-fresh"));
|
|
14
|
+
const utils_1 = require("@docusaurus/utils");
|
|
12
15
|
const configValidation_1 = require("./configValidation");
|
|
13
|
-
async function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
async function loadSiteConfig({ siteDir, customConfigFilePath, }) {
|
|
17
|
+
const siteConfigPath = path_1.default.resolve(siteDir, customConfigFilePath ?? utils_1.DEFAULT_CONFIG_FILE_NAME);
|
|
18
|
+
if (!(await fs_extra_1.default.pathExists(siteConfigPath))) {
|
|
19
|
+
throw new Error(`Config file at "${siteConfigPath}" not found.`);
|
|
16
20
|
}
|
|
17
|
-
const importedConfig = (0, import_fresh_1.default)(
|
|
18
|
-
const loadedConfig = importedConfig
|
|
21
|
+
const importedConfig = (0, import_fresh_1.default)(siteConfigPath);
|
|
22
|
+
const loadedConfig = typeof importedConfig === 'function'
|
|
19
23
|
? await importedConfig()
|
|
20
24
|
: await importedConfig;
|
|
21
|
-
|
|
25
|
+
const siteConfig = (0, configValidation_1.validateConfig)(loadedConfig);
|
|
26
|
+
return { siteConfig, siteConfigPath };
|
|
22
27
|
}
|
|
23
|
-
exports.
|
|
28
|
+
exports.loadSiteConfig = loadSiteConfig;
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
import type { DocusaurusConfig, I18nConfig } from '@docusaurus/types';
|
|
8
8
|
import { Joi } from '@docusaurus/utils-validation';
|
|
9
9
|
export declare const DEFAULT_I18N_CONFIG: I18nConfig;
|
|
10
|
-
export declare const DEFAULT_CONFIG: Pick<DocusaurusConfig, 'i18n' | 'onBrokenLinks' | 'onBrokenMarkdownLinks' | 'onDuplicateRoutes' | 'plugins' | 'themes' | 'presets' | 'customFields' | 'themeConfig' | 'titleDelimiter' | 'noIndex' | 'tagline' | 'baseUrlIssueBanner' | 'staticDirectories'>;
|
|
10
|
+
export declare const DEFAULT_CONFIG: Pick<DocusaurusConfig, 'i18n' | 'onBrokenLinks' | 'onBrokenMarkdownLinks' | 'onDuplicateRoutes' | 'plugins' | 'themes' | 'presets' | 'stylesheets' | 'scripts' | 'clientModules' | 'customFields' | 'themeConfig' | 'titleDelimiter' | 'noIndex' | 'tagline' | 'baseUrlIssueBanner' | 'staticDirectories'>;
|
|
11
11
|
export declare const ConfigSchema: Joi.ObjectSchema<any>;
|
|
12
12
|
export declare function validateConfig(config: Partial<DocusaurusConfig>): DocusaurusConfig;
|
|
@@ -23,19 +23,24 @@ exports.DEFAULT_CONFIG = {
|
|
|
23
23
|
plugins: [],
|
|
24
24
|
themes: [],
|
|
25
25
|
presets: [],
|
|
26
|
+
stylesheets: [],
|
|
27
|
+
scripts: [],
|
|
28
|
+
clientModules: [],
|
|
26
29
|
customFields: {},
|
|
27
30
|
themeConfig: {},
|
|
28
31
|
titleDelimiter: '|',
|
|
29
32
|
noIndex: false,
|
|
30
33
|
tagline: '',
|
|
31
34
|
baseUrlIssueBanner: true,
|
|
32
|
-
staticDirectories: [utils_1.
|
|
35
|
+
staticDirectories: [utils_1.DEFAULT_STATIC_DIR_NAME],
|
|
33
36
|
};
|
|
34
|
-
function createPluginSchema(theme
|
|
37
|
+
function createPluginSchema(theme) {
|
|
35
38
|
return (utils_validation_1.Joi.alternatives()
|
|
36
|
-
.try(utils_validation_1.Joi.function(), utils_validation_1.Joi.array()
|
|
39
|
+
.try(utils_validation_1.Joi.function(), utils_validation_1.Joi.array()
|
|
40
|
+
.ordered(utils_validation_1.Joi.function().required(), utils_validation_1.Joi.object().required())
|
|
41
|
+
.length(2), utils_validation_1.Joi.string(), utils_validation_1.Joi.array()
|
|
37
42
|
.ordered(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required())
|
|
38
|
-
.length(2), utils_validation_1.Joi.
|
|
43
|
+
.length(2), utils_validation_1.Joi.any().valid(false, null))
|
|
39
44
|
// @ts-expect-error: bad lib def, doesn't recognize an array of reports
|
|
40
45
|
.error((errors) => {
|
|
41
46
|
errors.forEach((error) => {
|
|
@@ -69,11 +74,20 @@ ${validConfigExample}
|
|
|
69
74
|
}
|
|
70
75
|
const PluginSchema = createPluginSchema(false);
|
|
71
76
|
const ThemeSchema = createPluginSchema(true);
|
|
72
|
-
const PresetSchema = utils_validation_1.Joi.alternatives()
|
|
77
|
+
const PresetSchema = utils_validation_1.Joi.alternatives()
|
|
78
|
+
.try(utils_validation_1.Joi.string(), utils_validation_1.Joi.array()
|
|
79
|
+
.items(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required())
|
|
80
|
+
.length(2), utils_validation_1.Joi.any().valid(false, null))
|
|
81
|
+
.messages({
|
|
82
|
+
'alternatives.types': `{#label} does not look like a valid preset config. A preset config entry should be one of:
|
|
83
|
+
- A tuple of [presetName, options], like \`["classic", \\{ blog: false \\}]\`, or
|
|
84
|
+
- A simple string, like \`"classic"\``,
|
|
85
|
+
});
|
|
73
86
|
const LocaleConfigSchema = utils_validation_1.Joi.object({
|
|
74
87
|
label: utils_validation_1.Joi.string(),
|
|
75
88
|
htmlLang: utils_validation_1.Joi.string(),
|
|
76
89
|
direction: utils_validation_1.Joi.string().equal('ltr', 'rtl').default('ltr'),
|
|
90
|
+
calendar: utils_validation_1.Joi.string(),
|
|
77
91
|
});
|
|
78
92
|
const I18N_CONFIG_SCHEMA = utils_validation_1.Joi.object({
|
|
79
93
|
defaultLocale: utils_validation_1.Joi.string().required(),
|
|
@@ -129,22 +143,34 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
129
143
|
themes: utils_validation_1.Joi.array().items(ThemeSchema).default(exports.DEFAULT_CONFIG.themes),
|
|
130
144
|
presets: utils_validation_1.Joi.array().items(PresetSchema).default(exports.DEFAULT_CONFIG.presets),
|
|
131
145
|
themeConfig: utils_validation_1.Joi.object().unknown().default(exports.DEFAULT_CONFIG.themeConfig),
|
|
132
|
-
scripts: utils_validation_1.Joi.array()
|
|
146
|
+
scripts: utils_validation_1.Joi.array()
|
|
147
|
+
.items(utils_validation_1.Joi.string(), utils_validation_1.Joi.object({
|
|
133
148
|
src: utils_validation_1.Joi.string().required(),
|
|
134
149
|
async: utils_validation_1.Joi.bool(),
|
|
135
150
|
defer: utils_validation_1.Joi.bool(),
|
|
136
151
|
})
|
|
137
152
|
// See https://github.com/facebook/docusaurus/issues/3378
|
|
138
|
-
.unknown())
|
|
153
|
+
.unknown())
|
|
154
|
+
.messages({
|
|
155
|
+
'array.includes': '{#label} is invalid. A script must be a plain string (the src), or an object with at least a "src" property.',
|
|
156
|
+
})
|
|
157
|
+
.default(exports.DEFAULT_CONFIG.scripts),
|
|
139
158
|
ssrTemplate: utils_validation_1.Joi.string(),
|
|
140
|
-
stylesheets: utils_validation_1.Joi.array()
|
|
159
|
+
stylesheets: utils_validation_1.Joi.array()
|
|
160
|
+
.items(utils_validation_1.Joi.string(), utils_validation_1.Joi.object({
|
|
141
161
|
href: utils_validation_1.Joi.string().required(),
|
|
142
162
|
type: utils_validation_1.Joi.string(),
|
|
143
|
-
}).unknown())
|
|
144
|
-
|
|
163
|
+
}).unknown())
|
|
164
|
+
.messages({
|
|
165
|
+
'array.includes': '{#label} is invalid. A stylesheet must be a plain string (the href), or an object with at least a "href" property.',
|
|
166
|
+
})
|
|
167
|
+
.default(exports.DEFAULT_CONFIG.stylesheets),
|
|
168
|
+
clientModules: utils_validation_1.Joi.array()
|
|
169
|
+
.items(utils_validation_1.Joi.string())
|
|
170
|
+
.default(exports.DEFAULT_CONFIG.clientModules),
|
|
145
171
|
tagline: utils_validation_1.Joi.string().allow('').default(exports.DEFAULT_CONFIG.tagline),
|
|
146
|
-
titleDelimiter: utils_validation_1.Joi.string().default(
|
|
147
|
-
noIndex: utils_validation_1.Joi.bool().default(
|
|
172
|
+
titleDelimiter: utils_validation_1.Joi.string().default(exports.DEFAULT_CONFIG.titleDelimiter),
|
|
173
|
+
noIndex: utils_validation_1.Joi.bool().default(exports.DEFAULT_CONFIG.noIndex),
|
|
148
174
|
webpack: utils_validation_1.Joi.object({
|
|
149
175
|
jsLoader: utils_validation_1.Joi.alternatives()
|
|
150
176
|
.try(utils_validation_1.Joi.string().equal('babel'), utils_validation_1.Joi.function())
|
|
@@ -170,7 +196,7 @@ function validateConfig(config) {
|
|
|
170
196
|
? `${accumulatedErr}${err.message}\n`
|
|
171
197
|
: accumulatedErr, '');
|
|
172
198
|
formattedError = unknownFields
|
|
173
|
-
? `${formattedError}These field(s) (${unknownFields}) are not recognized in ${utils_1.DEFAULT_CONFIG_FILE_NAME}.\nIf you still want these fields to be in your configuration, put them in the "customFields" field.\nSee https://docusaurus.io/docs/docusaurus
|
|
199
|
+
? `${formattedError}These field(s) (${unknownFields}) are not recognized in ${utils_1.DEFAULT_CONFIG_FILE_NAME}.\nIf you still want these fields to be in your configuration, put them in the "customFields" field.\nSee https://docusaurus.io/docs/api/docusaurus-config/#customfields`
|
|
174
200
|
: formattedError;
|
|
175
201
|
throw new Error(formattedError);
|
|
176
202
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare type HostPortOptions = {
|
|
8
|
+
host?: string;
|
|
9
|
+
port?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getHostPort(options: HostPortOptions): Promise<{
|
|
12
|
+
host: string;
|
|
13
|
+
port: number | null;
|
|
14
|
+
}>;
|