@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.
Files changed (171) hide show
  1. package/bin/beforeCli.mjs +14 -12
  2. package/bin/docusaurus.mjs +41 -93
  3. package/lib/babel/preset.js +2 -2
  4. package/lib/client/.eslintrc.js +2 -3
  5. package/lib/client/App.d.ts +1 -1
  6. package/lib/client/App.js +15 -7
  7. package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → BaseUrlIssueBanner/index.d.ts} +10 -5
  8. package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +14 -9
  9. package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
  10. package/lib/client/ClientLifecyclesDispatcher.d.ts +16 -0
  11. package/lib/client/ClientLifecyclesDispatcher.js +34 -0
  12. package/lib/client/LinksCollector.d.ts +1 -1
  13. package/lib/client/LinksCollector.js +4 -5
  14. package/lib/client/PendingNavigation.d.ts +8 -17
  15. package/lib/client/PendingNavigation.js +39 -70
  16. package/lib/{server/loadSetup.d.ts → client/SiteMetadataDefaults.d.ts} +2 -2
  17. package/lib/client/SiteMetadataDefaults.js +19 -0
  18. package/lib/client/{exports/browserContext.d.ts → browserContext.d.ts} +0 -0
  19. package/lib/client/{exports/browserContext.js → browserContext.js} +0 -0
  20. package/lib/client/clientEntry.js +3 -4
  21. package/lib/client/docusaurus.d.ts +5 -5
  22. package/lib/client/docusaurus.js +26 -33
  23. package/lib/client/{exports/docusaurusContext.d.ts → docusaurusContext.d.ts} +0 -0
  24. package/lib/client/{exports/docusaurusContext.js → docusaurusContext.js} +0 -0
  25. package/lib/client/exports/BrowserOnly.d.ts +3 -4
  26. package/lib/client/exports/BrowserOnly.js +2 -2
  27. package/lib/client/exports/ComponentCreator.js +65 -40
  28. package/lib/client/exports/ErrorBoundary.d.ts +2 -2
  29. package/lib/client/exports/ErrorBoundary.js +4 -5
  30. package/lib/client/exports/Interpolate.d.ts +1 -1
  31. package/lib/client/exports/Interpolate.js +18 -41
  32. package/lib/client/exports/Link.d.ts +3 -15
  33. package/lib/client/exports/Link.js +24 -30
  34. package/lib/client/exports/Translate.d.ts +2 -2
  35. package/lib/client/exports/Translate.js +3 -3
  36. package/lib/client/exports/useBaseUrl.js +8 -9
  37. package/lib/client/exports/useDocusaurusContext.js +1 -1
  38. package/lib/client/exports/useGlobalData.d.ts +4 -3
  39. package/lib/client/exports/useGlobalData.js +5 -5
  40. package/lib/client/exports/useIsBrowser.js +1 -1
  41. package/lib/{server/client-modules/index.d.ts → client/exports/useRouteContext.d.ts} +2 -2
  42. package/lib/client/exports/useRouteContext.js +15 -0
  43. package/lib/client/flat.d.ts +12 -2
  44. package/lib/client/flat.js +12 -5
  45. package/lib/client/normalizeLocation.js +13 -8
  46. package/lib/client/prefetch.js +10 -28
  47. package/lib/client/preload.d.ts +1 -3
  48. package/lib/client/preload.js +5 -11
  49. package/lib/client/routeContext.d.ts +13 -0
  50. package/lib/client/routeContext.js +31 -0
  51. package/lib/client/serverEntry.js +19 -18
  52. package/lib/client/theme-fallback/Error/index.js +7 -1
  53. package/lib/client/theme-fallback/Layout/index.d.ts +1 -1
  54. package/lib/client/theme-fallback/Layout/index.js +2 -17
  55. package/lib/client/theme-fallback/Loading/index.js +2 -0
  56. package/lib/client/theme-fallback/NotFound/index.js +13 -5
  57. package/lib/client/theme-fallback/Root/index.d.ts +4 -4
  58. package/lib/client/theme-fallback/Root/index.js +2 -1
  59. package/lib/{server/html-tags/htmlTags.d.ts → client/theme-fallback/SiteMetadata/index.d.ts} +2 -1
  60. package/lib/client/theme-fallback/SiteMetadata/index.js +10 -0
  61. package/lib/commands/build.d.ts +6 -2
  62. package/lib/commands/build.js +48 -30
  63. package/lib/commands/clear.d.ts +1 -1
  64. package/lib/commands/clear.js +6 -5
  65. package/lib/commands/deploy.d.ts +5 -5
  66. package/lib/commands/deploy.js +21 -45
  67. package/lib/commands/external.d.ts +1 -1
  68. package/lib/commands/external.js +6 -11
  69. package/lib/commands/serve.d.ts +7 -2
  70. package/lib/commands/serve.js +18 -19
  71. package/lib/commands/start.d.ts +8 -2
  72. package/lib/commands/start.js +33 -30
  73. package/lib/commands/swizzle/actions.d.ts +2 -2
  74. package/lib/commands/swizzle/actions.js +10 -10
  75. package/lib/commands/swizzle/common.d.ts +3 -3
  76. package/lib/commands/swizzle/common.js +8 -9
  77. package/lib/commands/swizzle/components.js +48 -13
  78. package/lib/commands/swizzle/config.js +21 -15
  79. package/lib/commands/swizzle/context.js +6 -12
  80. package/lib/commands/swizzle/index.d.ts +2 -2
  81. package/lib/commands/swizzle/index.js +5 -4
  82. package/lib/commands/swizzle/prompts.js +2 -2
  83. package/lib/commands/swizzle/tables.js +10 -13
  84. package/lib/commands/swizzle/themes.js +9 -8
  85. package/lib/commands/writeHeadingIds.d.ts +2 -9
  86. package/lib/commands/writeHeadingIds.js +11 -69
  87. package/lib/commands/writeTranslations.d.ts +3 -4
  88. package/lib/commands/writeTranslations.js +10 -14
  89. package/lib/index.d.ts +9 -10
  90. package/lib/index.js +18 -19
  91. package/lib/server/brokenLinks.d.ts +3 -16
  92. package/lib/server/brokenLinks.js +37 -31
  93. package/lib/server/clientModules.d.ts +12 -0
  94. package/lib/server/clientModules.js +20 -0
  95. package/lib/server/config.d.ts +5 -2
  96. package/lib/server/config.js +14 -9
  97. package/lib/server/configValidation.d.ts +1 -1
  98. package/lib/server/configValidation.js +39 -13
  99. package/lib/server/getHostPort.d.ts +14 -0
  100. package/lib/{choosePort.js → server/getHostPort.js} +24 -41
  101. package/lib/server/htmlTags.d.ts +12 -0
  102. package/lib/server/htmlTags.js +62 -0
  103. package/lib/server/i18n.d.ts +2 -11
  104. package/lib/server/i18n.js +7 -28
  105. package/lib/server/index.d.ts +28 -13
  106. package/lib/server/index.js +62 -229
  107. package/lib/server/plugins/configs.d.ts +51 -0
  108. package/lib/server/plugins/configs.js +101 -0
  109. package/lib/server/plugins/index.d.ts +9 -8
  110. package/lib/server/plugins/index.js +65 -132
  111. package/lib/server/plugins/init.d.ts +6 -15
  112. package/lib/server/plugins/init.js +25 -83
  113. package/lib/server/{moduleShorthand.d.ts → plugins/moduleShorthand.d.ts} +0 -0
  114. package/lib/server/{moduleShorthand.js → plugins/moduleShorthand.js} +0 -0
  115. package/lib/server/plugins/pluginIds.d.ts +4 -0
  116. package/lib/server/plugins/pluginIds.js +6 -4
  117. package/lib/server/plugins/presets.d.ts +12 -0
  118. package/lib/server/{presets/index.js → plugins/presets.js} +21 -20
  119. package/lib/server/plugins/{applyRouteTrailingSlash.d.ts → routeConfig.d.ts} +3 -1
  120. package/lib/server/plugins/routeConfig.js +54 -0
  121. package/lib/server/plugins/synthetic.d.ts +20 -0
  122. package/lib/server/plugins/synthetic.js +112 -0
  123. package/lib/server/routes.d.ts +39 -7
  124. package/lib/server/routes.js +169 -102
  125. package/lib/server/siteMetadata.d.ts +12 -0
  126. package/lib/server/siteMetadata.js +81 -0
  127. package/lib/server/translations/translations.d.ts +5 -14
  128. package/lib/server/translations/translations.js +23 -39
  129. package/lib/server/translations/translationsExtractor.d.ts +2 -2
  130. package/lib/server/translations/translationsExtractor.js +16 -19
  131. package/lib/server/utils.js +1 -1
  132. package/lib/webpack/aliases/index.d.ts +34 -0
  133. package/lib/webpack/aliases/index.js +106 -0
  134. package/lib/webpack/base.d.ts +0 -1
  135. package/lib/webpack/base.js +12 -30
  136. package/lib/webpack/client.js +7 -8
  137. package/lib/webpack/plugins/ChunkAssetPlugin.js +7 -7
  138. package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +2 -2
  139. package/lib/webpack/plugins/CleanWebpackPlugin.js +2 -2
  140. package/lib/webpack/plugins/LogPlugin.js +2 -2
  141. package/lib/webpack/plugins/WaitPlugin.d.ts +2 -2
  142. package/lib/webpack/plugins/WaitPlugin.js +3 -3
  143. package/lib/webpack/server.d.ts +2 -2
  144. package/lib/webpack/server.js +10 -8
  145. package/lib/webpack/utils.d.ts +9 -3
  146. package/lib/webpack/utils.js +20 -25
  147. package/package.json +38 -41
  148. package/lib/choosePort.d.ts +0 -11
  149. package/lib/client/client-lifecycles-dispatcher.d.ts +0 -9
  150. package/lib/client/client-lifecycles-dispatcher.js +0 -23
  151. package/lib/client/nprogress.css +0 -36
  152. package/lib/commands/commandUtils.d.ts +0 -9
  153. package/lib/commands/commandUtils.js +0 -21
  154. package/lib/server/client-modules/index.js +0 -12
  155. package/lib/server/duplicateRoutes.d.ts +0 -10
  156. package/lib/server/duplicateRoutes.js +0 -42
  157. package/lib/server/html-tags/htmlTags.js +0 -38
  158. package/lib/server/html-tags/index.d.ts +0 -9
  159. package/lib/server/html-tags/index.js +0 -43
  160. package/lib/server/loadSetup.js +0 -25
  161. package/lib/server/plugins/applyRouteTrailingSlash.js +0 -19
  162. package/lib/server/presets/index.d.ts +0 -11
  163. package/lib/server/themes/alias.d.ts +0 -9
  164. package/lib/server/themes/alias.js +0 -48
  165. package/lib/server/themes/index.d.ts +0 -12
  166. package/lib/server/themes/index.js +0 -47
  167. package/lib/server/versions/__fixtures__/dummy-plugin.d.ts +0 -0
  168. package/lib/server/versions/__fixtures__/dummy-plugin.js +0 -0
  169. package/lib/server/versions/__fixtures__/package.json +0 -3
  170. package/lib/server/versions/index.d.ts +0 -9
  171. 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.transformMarkdownContent = exports.transformMarkdownHeadingLine = void 0;
9
+ exports.writeHeadingIds = void 0;
10
10
  const tslib_1 = require("tslib");
11
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
12
- const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
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 = transformMarkdownLines(content.split('\n'), options).join('\n');
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 pluginConfigs = await (0, server_1.loadPluginConfigs)(context);
89
- const plugins = await (0, init_1.default)({
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 !== null && files !== void 0 ? files : (await getPathsToWatch(siteDir)), {
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.default = writeHeadingIds;
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 { ConfigOptions } from '@docusaurus/types';
7
+ import { type LoadContextOptions } from '../server';
8
8
  import { type WriteTranslationsOptions } from '../server/translations/translations';
9
- export default function writeTranslations(siteDir: string, options: WriteTranslationsOptions & ConfigOptions & {
10
- locale?: string;
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 = (0, tslib_1.__importDefault)(require("path"));
11
+ const path_1 = tslib_1.__importDefault(require("path"));
11
12
  const server_1 = require("../server");
12
- const init_1 = (0, tslib_1.__importDefault)(require("../server/plugins/init"));
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 ((_a = plugin.loadContent) === null || _a === void 0 ? void 0 : _a.call(plugin));
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
- var _a;
52
- const context = await (0, server_1.loadContext)(siteDir, {
53
- customConfigFilePath: options.config,
51
+ const context = await (0, server_1.loadContext)({
52
+ siteDir,
53
+ config: options.config,
54
54
  locale: options.locale,
55
55
  });
56
- const pluginConfigs = await (0, server_1.loadPluginConfigs)(context);
57
- const plugins = await (0, init_1.default)({
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.default = writeTranslations;
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
- import build from './commands/build';
8
- import clear from './commands/clear';
9
- import deploy from './commands/deploy';
10
- import externalCommand from './commands/external';
11
- import serve from './commands/serve';
12
- import start from './commands/start';
13
- import swizzle from './commands/swizzle';
14
- import writeHeadingIds from './commands/writeHeadingIds';
15
- import writeTranslations from './commands/writeTranslations';
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
- const tslib_1 = require("tslib");
11
- const build_1 = (0, tslib_1.__importDefault)(require("./commands/build"));
12
- exports.build = build_1.default;
13
- const clear_1 = (0, tslib_1.__importDefault)(require("./commands/clear"));
14
- exports.clear = clear_1.default;
15
- const deploy_1 = (0, tslib_1.__importDefault)(require("./commands/deploy"));
16
- exports.deploy = deploy_1.default;
17
- const external_1 = (0, tslib_1.__importDefault)(require("./commands/external"));
18
- exports.externalCommand = external_1.default;
19
- const serve_1 = (0, tslib_1.__importDefault)(require("./commands/serve"));
20
- exports.serve = serve_1.default;
21
- const start_1 = (0, tslib_1.__importDefault)(require("./commands/start"));
22
- exports.start = start_1.default;
23
- const swizzle_1 = (0, tslib_1.__importDefault)(require("./commands/swizzle"));
24
- exports.swizzle = swizzle_1.default;
25
- const writeHeadingIds_1 = (0, tslib_1.__importDefault)(require("./commands/writeHeadingIds"));
26
- exports.writeHeadingIds = writeHeadingIds_1.default;
27
- const writeTranslations_1 = (0, tslib_1.__importDefault)(require("./commands/writeTranslations"));
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: Record<string, string[]>;
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 = 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
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
13
- const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
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 = (0, tslib_1.__importDefault)(require("path"));
17
- const combine_promises_1 = (0, tslib_1.__importDefault)(require("combine-promises"));
18
- function toReactRouterRoutes(routes) {
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
- // but matchRoutes does not do this resolving internally
29
- // we must resolve the links before using matchRoutes
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
- .map((l) => (0, react_router_config_1.matchRoutes)(toReactRouterRoutes(routes), l))
38
- .reduce((prev, cur) => prev.concat(cur));
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", that do not have subroutes.
47
- * We also need to remove the match all 404 route
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 `\n- On source page path = ${pagePath}:\n -> linking to ${brokenLinks
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 `\n\nIt looks like some of the broken links we found appear in many pages of your site.\nMaybe those broken links appear on all pages through your site layout?\nWe recommend that you check your theme configuration for such links (particularly, theme navbar and footer).\nFrequent broken links are linking to:\n- ${frequentLinks.join(`\n- `)}\n`;
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 (`Docusaurus found broken links!\n\nPlease check the pages of your site in the list below, and make sure you don't reference any path that does not exist.\nNote: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.${getLayoutBrokenLinksHelpMessage()}` +
91
- `\n\nExhaustive list of all broken links found:\n${Object.entries(allBrokenLinks)
92
- .map(([pagePath, brokenLinks]) => pageBrokenLinksMessage(pagePath, brokenLinks))
93
- .join('\n')}
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;
@@ -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 { DocusaurusConfig } from '@docusaurus/types';
8
- export default function loadConfig(configPath: string): Promise<DocusaurusConfig>;
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'>>;
@@ -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 fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
11
- const import_fresh_1 = (0, tslib_1.__importDefault)(require("import-fresh"));
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 loadConfig(configPath) {
14
- if (!(await fs_extra_1.default.pathExists(configPath))) {
15
- throw new Error(`Config file at "${configPath}" not found.`);
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)(configPath);
18
- const loadedConfig = importedConfig instanceof Function
21
+ const importedConfig = (0, import_fresh_1.default)(siteConfigPath);
22
+ const loadedConfig = typeof importedConfig === 'function'
19
23
  ? await importedConfig()
20
24
  : await importedConfig;
21
- return (0, configValidation_1.validateConfig)(loadedConfig);
25
+ const siteConfig = (0, configValidation_1.validateConfig)(loadedConfig);
26
+ return { siteConfig, siteConfigPath };
22
27
  }
23
- exports.default = loadConfig;
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.STATIC_DIR_NAME],
35
+ staticDirectories: [utils_1.DEFAULT_STATIC_DIR_NAME],
33
36
  };
34
- function createPluginSchema(theme = false) {
37
+ function createPluginSchema(theme) {
35
38
  return (utils_validation_1.Joi.alternatives()
36
- .try(utils_validation_1.Joi.function(), utils_validation_1.Joi.array().ordered(utils_validation_1.Joi.function().required(), utils_validation_1.Joi.object().required()), utils_validation_1.Joi.string(), 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.bool().equal(false))
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().try(utils_validation_1.Joi.string(), utils_validation_1.Joi.array().items(utils_validation_1.Joi.string().required(), utils_validation_1.Joi.object().required()).length(2));
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().items(utils_validation_1.Joi.string(), utils_validation_1.Joi.object({
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().items(utils_validation_1.Joi.string(), utils_validation_1.Joi.object({
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
- clientModules: utils_validation_1.Joi.array().items(utils_validation_1.Joi.string()),
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(false),
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.config.js/#customfields`
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
+ }>;