@docusaurus/core 0.0.0-5979 → 0.0.0-5982
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/lib/babel/preset.js +1 -1
- package/lib/client/App.d.ts +0 -2
- package/lib/client/BaseUrlIssueBanner/index.d.ts +0 -1
- package/lib/client/BrokenLinksContext.d.ts +0 -1
- package/lib/client/SiteMetadataDefaults.d.ts +0 -1
- package/lib/client/exports/BrowserOnly.d.ts +0 -2
- package/lib/client/exports/ErrorBoundary.d.ts +0 -1
- package/lib/client/exports/Head.d.ts +0 -2
- package/lib/client/exports/Interpolate.d.ts +0 -1
- package/lib/client/exports/Link.d.ts +0 -1
- package/lib/client/exports/Translate.d.ts +0 -2
- package/lib/client/exports/useBaseUrl.d.ts +0 -1
- package/lib/client/exports/useBrokenLinks.d.ts +0 -1
- package/lib/client/hasHydratedDataAttribute.d.ts +0 -1
- package/lib/client/theme-fallback/Error/index.d.ts +0 -2
- package/lib/client/theme-fallback/Layout/index.d.ts +0 -2
- package/lib/client/theme-fallback/Loading/index.d.ts +0 -1
- package/lib/client/theme-fallback/NotFound/index.d.ts +0 -1
- package/lib/client/theme-fallback/Root/index.d.ts +0 -2
- package/lib/client/theme-fallback/SiteMetadata/index.d.ts +0 -1
- package/lib/commands/build.js +1 -2
- package/lib/commands/clear.js +1 -2
- package/lib/commands/deploy.js +1 -2
- package/lib/commands/external.js +1 -2
- package/lib/commands/serve.js +1 -2
- package/lib/commands/start/start.js +1 -2
- package/lib/commands/start/utils.js +2 -3
- package/lib/commands/start/watcher.js +5 -6
- package/lib/commands/start/webpack.js +1 -2
- package/lib/commands/swizzle/actions.js +4 -4
- package/lib/commands/swizzle/common.js +7 -7
- package/lib/commands/swizzle/components.js +5 -6
- package/lib/commands/swizzle/config.js +2 -3
- package/lib/commands/swizzle/context.js +1 -2
- package/lib/commands/swizzle/index.js +1 -2
- package/lib/commands/swizzle/prompts.js +4 -5
- package/lib/commands/swizzle/tables.js +2 -3
- package/lib/commands/swizzle/themes.js +5 -6
- package/lib/commands/writeHeadingIds.js +1 -2
- package/lib/commands/writeTranslations.js +1 -2
- package/lib/server/brokenLinks.js +1 -2
- package/lib/server/clientModules.js +1 -2
- package/lib/server/codegen/codegen.js +1 -2
- package/lib/server/codegen/codegenRoutes.js +4 -5
- package/lib/server/config.js +1 -2
- package/lib/server/configValidation.js +2 -2
- package/lib/server/getHostPort.js +1 -2
- package/lib/server/htmlTags.js +1 -2
- package/lib/server/i18n.js +2 -3
- package/lib/server/plugins/actions.js +1 -2
- package/lib/server/plugins/configs.js +1 -2
- package/lib/server/plugins/init.js +1 -2
- package/lib/server/plugins/moduleShorthand.d.ts +0 -1
- package/lib/server/plugins/moduleShorthand.js +2 -3
- package/lib/server/plugins/pluginIds.js +1 -2
- package/lib/server/plugins/plugins.js +2 -3
- package/lib/server/plugins/pluginsUtils.js +7 -8
- package/lib/server/plugins/presets.js +1 -2
- package/lib/server/plugins/routeConfig.js +2 -3
- package/lib/server/plugins/synthetic.js +2 -3
- package/lib/server/routes.js +2 -3
- package/lib/server/site.js +4 -5
- package/lib/server/siteMetadata.js +3 -4
- package/lib/server/storage.js +1 -2
- package/lib/server/translations/translations.js +9 -10
- package/lib/server/translations/translationsExtractor.js +4 -5
- package/lib/server/utils.js +1 -2
- package/lib/ssg.d.ts +0 -1
- package/lib/ssg.js +3 -4
- package/lib/templates/templates.js +3 -4
- package/lib/webpack/aliases/index.js +4 -5
- package/lib/webpack/base.js +3 -3
- package/lib/webpack/client.js +2 -3
- package/lib/webpack/configure.js +3 -4
- package/lib/webpack/minification.js +1 -2
- package/lib/webpack/plugins/StaticDirectoriesCopyPlugin.js +1 -2
- package/lib/webpack/server.js +1 -1
- package/lib/webpack/utils.d.ts +1 -2
- package/lib/webpack/utils.js +8 -8
- package/package.json +10 -10
|
@@ -6,7 +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.
|
|
9
|
+
exports.pluginToThemeName = pluginToThemeName;
|
|
10
|
+
exports.getPluginByThemeName = getPluginByThemeName;
|
|
11
|
+
exports.getThemeNames = getThemeNames;
|
|
12
|
+
exports.getThemeName = getThemeName;
|
|
13
|
+
exports.getThemePath = getThemePath;
|
|
10
14
|
const tslib_1 = require("tslib");
|
|
11
15
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
16
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
@@ -20,7 +24,6 @@ function pluginToThemeName(plugin) {
|
|
|
20
24
|
}
|
|
21
25
|
return undefined;
|
|
22
26
|
}
|
|
23
|
-
exports.pluginToThemeName = pluginToThemeName;
|
|
24
27
|
function getPluginByThemeName(plugins, themeName) {
|
|
25
28
|
const plugin = plugins.find((p) => pluginToThemeName(p) === themeName);
|
|
26
29
|
if (!plugin) {
|
|
@@ -28,7 +31,6 @@ function getPluginByThemeName(plugins, themeName) {
|
|
|
28
31
|
}
|
|
29
32
|
return plugin;
|
|
30
33
|
}
|
|
31
|
-
exports.getPluginByThemeName = getPluginByThemeName;
|
|
32
34
|
function getThemeNames(plugins) {
|
|
33
35
|
const themeNames = lodash_1.default.uniq(
|
|
34
36
|
// The fact that getThemePath is attached to the plugin instance makes
|
|
@@ -46,7 +48,6 @@ function getThemeNames(plugins) {
|
|
|
46
48
|
(t) => t.includes('@docusaurus'),
|
|
47
49
|
], ['desc', 'desc', 'desc']);
|
|
48
50
|
}
|
|
49
|
-
exports.getThemeNames = getThemeNames;
|
|
50
51
|
// Returns a valid value if recovering is possible
|
|
51
52
|
function handleInvalidThemeName({ themeNameParam, themeNames, }) {
|
|
52
53
|
// Trying to recover invalid value
|
|
@@ -84,7 +85,6 @@ async function getThemeName({ themeNameParam, themeNames, list, }) {
|
|
|
84
85
|
? validateThemeName({ themeNameParam, themeNames })
|
|
85
86
|
: (0, prompts_1.askThemeName)(themeNames);
|
|
86
87
|
}
|
|
87
|
-
exports.getThemeName = getThemeName;
|
|
88
88
|
function getThemePath({ plugins, themeName, typescript, }) {
|
|
89
89
|
const pluginInstance = getPluginByThemeName(plugins, themeName);
|
|
90
90
|
const themePath = typescript
|
|
@@ -103,4 +103,3 @@ function getThemePath({ plugins, themeName, typescript, }) {
|
|
|
103
103
|
}
|
|
104
104
|
return themePath;
|
|
105
105
|
}
|
|
106
|
-
exports.getThemePath = getThemePath;
|
|
@@ -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.writeHeadingIds =
|
|
9
|
+
exports.writeHeadingIds = writeHeadingIds;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -48,4 +48,3 @@ async function writeHeadingIds(siteDirParam = '.', files = [], options = {}) {
|
|
|
48
48
|
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.`;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
exports.writeHeadingIds = writeHeadingIds;
|
|
@@ -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.writeTranslations =
|
|
9
|
+
exports.writeTranslations = writeTranslations;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -82,4 +82,3 @@ Available locales are: ${context.i18n.locales.join(',')}.`);
|
|
|
82
82
|
await writePluginTranslationFiles({ localizationDir, plugin, options });
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
|
-
exports.writeTranslations = writeTranslations;
|
|
@@ -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 =
|
|
9
|
+
exports.handleBrokenLinks = handleBrokenLinks;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -281,4 +281,3 @@ async function handleBrokenLinks({ collectedLinks, onBrokenLinks, onBrokenAnchor
|
|
|
281
281
|
});
|
|
282
282
|
reportBrokenLinks({ brokenLinks, onBrokenLinks, onBrokenAnchors });
|
|
283
283
|
}
|
|
284
|
-
exports.handleBrokenLinks = handleBrokenLinks;
|
|
@@ -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.getAllClientModules =
|
|
9
|
+
exports.getAllClientModules = getAllClientModules;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
/**
|
|
@@ -17,4 +17,3 @@ function getAllClientModules(plugins) {
|
|
|
17
17
|
return plugins.flatMap((plugin) => plugin.getClientModules?.().map((p) => path_1.default.resolve(plugin.path, p)) ??
|
|
18
18
|
[]);
|
|
19
19
|
}
|
|
20
|
-
exports.getAllClientModules = getAllClientModules;
|
|
@@ -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.generateSiteFiles =
|
|
9
|
+
exports.generateSiteFiles = generateSiteFiles;
|
|
10
10
|
const utils_1 = require("@docusaurus/utils");
|
|
11
11
|
const codegenRoutes_1 = require("./codegenRoutes");
|
|
12
12
|
function genWarning({ generatedFilesDir }) {
|
|
@@ -66,4 +66,3 @@ async function generateSiteFiles(params) {
|
|
|
66
66
|
genCodeTranslations(params),
|
|
67
67
|
]);
|
|
68
68
|
}
|
|
69
|
-
exports.generateSiteFiles = generateSiteFiles;
|
|
@@ -6,7 +6,10 @@
|
|
|
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.genChunkName = genChunkName;
|
|
10
|
+
exports.generateRoutesCode = generateRoutesCode;
|
|
11
|
+
exports.generateRoutePropFilename = generateRoutePropFilename;
|
|
12
|
+
exports.generateRouteFiles = generateRouteFiles;
|
|
10
13
|
const tslib_1 = require("tslib");
|
|
11
14
|
const querystring_1 = tslib_1.__importDefault(require("querystring"));
|
|
12
15
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -53,7 +56,6 @@ function genChunkName(modulePath, prefix, preferredName, shortId = process.env.N
|
|
|
53
56
|
}
|
|
54
57
|
return chunkName;
|
|
55
58
|
}
|
|
56
|
-
exports.genChunkName = genChunkName;
|
|
57
59
|
/**
|
|
58
60
|
* Takes a piece of route config, and serializes it into raw JS code. The shape
|
|
59
61
|
* is the same as react-router's `RouteConfig`. Formatting is similar to
|
|
@@ -169,7 +171,6 @@ ${indent(routeConfigSerialized)},
|
|
|
169
171
|
`;
|
|
170
172
|
return res;
|
|
171
173
|
}
|
|
172
|
-
exports.generateRoutesCode = generateRoutesCode;
|
|
173
174
|
const genRegistry = ({ generatedFilesDir, registry, }) => (0, utils_1.generate)(generatedFilesDir, 'registry.js', `export default {
|
|
174
175
|
${Object.entries(registry)
|
|
175
176
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
@@ -193,7 +194,6 @@ function generateRoutePropFilename(route) {
|
|
|
193
194
|
// same component.
|
|
194
195
|
{ hashExtra: route.component })}.json`;
|
|
195
196
|
}
|
|
196
|
-
exports.generateRoutePropFilename = generateRoutePropFilename;
|
|
197
197
|
async function generateRoutePropModule({ generatedFilesDir, route, plugin, }) {
|
|
198
198
|
ensureNoPropsConflict(route);
|
|
199
199
|
const moduleContent = JSON.stringify(route.props);
|
|
@@ -270,4 +270,3 @@ async function generateRouteFiles({ generatedFilesDir, routes: initialRoutes, })
|
|
|
270
270
|
genRoutes({ generatedFilesDir, routesConfig }),
|
|
271
271
|
]);
|
|
272
272
|
}
|
|
273
|
-
exports.generateRouteFiles = generateRouteFiles;
|
package/lib/server/config.js
CHANGED
|
@@ -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.loadSiteConfig =
|
|
9
|
+
exports.loadSiteConfig = loadSiteConfig;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
@@ -39,4 +39,3 @@ async function loadSiteConfig({ siteDir, customConfigFilePath, }) {
|
|
|
39
39
|
const siteConfig = (0, configValidation_1.validateConfig)(loadedConfig, path_1.default.relative(siteDir, siteConfigPath));
|
|
40
40
|
return { siteConfig, siteConfigPath };
|
|
41
41
|
}
|
|
42
|
-
exports.loadSiteConfig = loadSiteConfig;
|
|
@@ -6,7 +6,8 @@
|
|
|
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.ConfigSchema = exports.DEFAULT_CONFIG = exports.DEFAULT_MARKDOWN_CONFIG = exports.DEFAULT_FUTURE_CONFIG = exports.DEFAULT_STORAGE_CONFIG = exports.DEFAULT_I18N_CONFIG = void 0;
|
|
10
|
+
exports.validateConfig = validateConfig;
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
12
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
12
13
|
const utils_common_1 = require("@docusaurus/utils-common");
|
|
@@ -301,4 +302,3 @@ function validateConfig(config, siteConfigPath) {
|
|
|
301
302
|
return value;
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
|
-
exports.validateConfig = validateConfig;
|
|
@@ -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.getHostPort =
|
|
9
|
+
exports.getHostPort = getHostPort;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -79,4 +79,3 @@ async function getHostPort(options) {
|
|
|
79
79
|
const port = await choosePort(host, basePort);
|
|
80
80
|
return { host, port };
|
|
81
81
|
}
|
|
82
|
-
exports.getHostPort = getHostPort;
|
package/lib/server/htmlTags.js
CHANGED
|
@@ -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 =
|
|
9
|
+
exports.loadHtmlTags = loadHtmlTags;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const html_tags_1 = tslib_1.__importDefault(require("html-tags"));
|
|
@@ -68,4 +68,3 @@ function loadHtmlTags({ plugins, router, }) {
|
|
|
68
68
|
.join('\n')
|
|
69
69
|
.trim())));
|
|
70
70
|
}
|
|
71
|
-
exports.loadHtmlTags = loadHtmlTags;
|
package/lib/server/i18n.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
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.getDefaultLocaleConfig = getDefaultLocaleConfig;
|
|
10
|
+
exports.loadI18n = loadI18n;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
13
|
const rtl_detect_1 = require("rtl-detect");
|
|
@@ -71,7 +72,6 @@ function getDefaultLocaleConfig(locale) {
|
|
|
71
72
|
throw new Error(`Docusaurus couldn't get default locale config for ${locale}`, { cause: e });
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
exports.getDefaultLocaleConfig = getDefaultLocaleConfig;
|
|
75
75
|
async function loadI18n(config, options) {
|
|
76
76
|
const { i18n: i18nConfig } = config;
|
|
77
77
|
const currentLocale = options.locale ?? i18nConfig.defaultLocale;
|
|
@@ -97,4 +97,3 @@ Note: Docusaurus only support running one locale at a time.`;
|
|
|
97
97
|
localeConfigs,
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
exports.loadI18n = loadI18n;
|
|
@@ -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.createPluginActionsUtils =
|
|
9
|
+
exports.createPluginActionsUtils = createPluginActionsUtils;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -67,4 +67,3 @@ async function createPluginActionsUtils({ plugin, generatedFilesDir, baseUrl, tr
|
|
|
67
67
|
getActions: () => actions,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
exports.createPluginActionsUtils = createPluginActionsUtils;
|
|
@@ -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.loadPluginConfigs =
|
|
9
|
+
exports.loadPluginConfigs = loadPluginConfigs;
|
|
10
10
|
const module_1 = require("module");
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
const presets_1 = require("./presets");
|
|
@@ -97,4 +97,3 @@ async function loadPluginConfigs(context) {
|
|
|
97
97
|
].filter((x) => Boolean(x));
|
|
98
98
|
return Promise.all(pluginConfigs.map((pluginConfig) => normalizePluginConfig(pluginConfig, context.siteConfigPath, pluginRequire)));
|
|
99
99
|
}
|
|
100
|
-
exports.loadPluginConfigs = loadPluginConfigs;
|
|
@@ -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.initPlugins =
|
|
9
|
+
exports.initPlugins = initPlugins;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const module_1 = require("module");
|
|
12
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -96,4 +96,3 @@ Note that even inline/anonymous plugin functions require a 'name' property.`);
|
|
|
96
96
|
(0, pluginIds_1.ensureUniquePluginInstanceIds)(plugins);
|
|
97
97
|
return plugins;
|
|
98
98
|
}
|
|
99
|
-
exports.initPlugins = initPlugins;
|
|
@@ -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
|
-
/// <reference types="node" />
|
|
8
7
|
export declare function getNamePatterns(moduleName: string, moduleType: 'preset' | 'theme' | 'plugin'): string[];
|
|
9
8
|
export declare function resolveModuleName(moduleName: string, moduleRequire: NodeRequire, moduleType: 'preset' | 'theme' | 'plugin'): string;
|
|
@@ -6,7 +6,8 @@
|
|
|
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.getNamePatterns = getNamePatterns;
|
|
10
|
+
exports.resolveModuleName = resolveModuleName;
|
|
10
11
|
function getNamePatterns(moduleName, moduleType) {
|
|
11
12
|
if (moduleName.startsWith('@')) {
|
|
12
13
|
// Pure scope: `@scope` => `@scope/docusaurus-plugin`
|
|
@@ -25,7 +26,6 @@ function getNamePatterns(moduleName, moduleType) {
|
|
|
25
26
|
`docusaurus-${moduleType}-${moduleName}`,
|
|
26
27
|
];
|
|
27
28
|
}
|
|
28
|
-
exports.getNamePatterns = getNamePatterns;
|
|
29
29
|
function resolveModuleName(moduleName, moduleRequire, moduleType) {
|
|
30
30
|
const modulePatterns = getNamePatterns(moduleName, moduleType);
|
|
31
31
|
const module = modulePatterns.find((m) => {
|
|
@@ -43,4 +43,3 @@ ${modulePatterns.map((m) => `- ${m}`).join('\n')}`);
|
|
|
43
43
|
}
|
|
44
44
|
return module;
|
|
45
45
|
}
|
|
46
|
-
exports.resolveModuleName = resolveModuleName;
|
|
@@ -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.ensureUniquePluginInstanceIds =
|
|
9
|
+
exports.ensureUniquePluginInstanceIds = ensureUniquePluginInstanceIds;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -27,4 +27,3 @@ function ensureUniquePluginInstanceIds(plugins) {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
exports.ensureUniquePluginInstanceIds = ensureUniquePluginInstanceIds;
|
|
@@ -6,7 +6,8 @@
|
|
|
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.loadPlugins = loadPlugins;
|
|
10
|
+
exports.reloadPlugin = reloadPlugin;
|
|
10
11
|
const init_1 = require("./init");
|
|
11
12
|
const synthetic_1 = require("./synthetic");
|
|
12
13
|
const translations_1 = require("../translations/translations");
|
|
@@ -152,7 +153,6 @@ async function loadPlugins(context) {
|
|
|
152
153
|
return { plugins, routes, globalData };
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
|
-
exports.loadPlugins = loadPlugins;
|
|
156
156
|
async function reloadPlugin({ pluginIdentifier, plugins: previousPlugins, context, }) {
|
|
157
157
|
return utils_1.PerfLogger.async(`Reload plugin ${(0, pluginsUtils_1.formatPluginName)(pluginIdentifier)}`, async () => {
|
|
158
158
|
const previousPlugin = (0, pluginsUtils_1.getPluginByIdentifier)({
|
|
@@ -184,4 +184,3 @@ async function reloadPlugin({ pluginIdentifier, plugins: previousPlugins, contex
|
|
|
184
184
|
return { plugins, routes, globalData };
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
exports.reloadPlugin = reloadPlugin;
|
|
@@ -6,7 +6,13 @@
|
|
|
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.getPluginByIdentifier = getPluginByIdentifier;
|
|
10
|
+
exports.aggregateAllContent = aggregateAllContent;
|
|
11
|
+
exports.toPluginRoute = toPluginRoute;
|
|
12
|
+
exports.aggregateRoutes = aggregateRoutes;
|
|
13
|
+
exports.aggregateGlobalData = aggregateGlobalData;
|
|
14
|
+
exports.mergeGlobalData = mergeGlobalData;
|
|
15
|
+
exports.formatPluginName = formatPluginName;
|
|
10
16
|
const tslib_1 = require("tslib");
|
|
11
17
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
18
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -17,7 +23,6 @@ function getPluginByIdentifier({ plugins, pluginIdentifier, }) {
|
|
|
17
23
|
}
|
|
18
24
|
return plugin;
|
|
19
25
|
}
|
|
20
|
-
exports.getPluginByIdentifier = getPluginByIdentifier;
|
|
21
26
|
function aggregateAllContent(loadedPlugins) {
|
|
22
27
|
return lodash_1.default.chain(loadedPlugins)
|
|
23
28
|
.groupBy((item) => item.name)
|
|
@@ -27,15 +32,12 @@ function aggregateAllContent(loadedPlugins) {
|
|
|
27
32
|
.value())
|
|
28
33
|
.value();
|
|
29
34
|
}
|
|
30
|
-
exports.aggregateAllContent = aggregateAllContent;
|
|
31
35
|
function toPluginRoute({ plugin, route, }) {
|
|
32
36
|
return { plugin: { name: plugin.name, id: plugin.options.id }, ...route };
|
|
33
37
|
}
|
|
34
|
-
exports.toPluginRoute = toPluginRoute;
|
|
35
38
|
function aggregateRoutes(loadedPlugins) {
|
|
36
39
|
return loadedPlugins.flatMap((plugin) => plugin.routes.map((route) => toPluginRoute({ plugin, route })));
|
|
37
40
|
}
|
|
38
|
-
exports.aggregateRoutes = aggregateRoutes;
|
|
39
41
|
function aggregateGlobalData(loadedPlugins) {
|
|
40
42
|
const globalData = {};
|
|
41
43
|
loadedPlugins.forEach((plugin) => {
|
|
@@ -47,7 +49,6 @@ function aggregateGlobalData(loadedPlugins) {
|
|
|
47
49
|
});
|
|
48
50
|
return globalData;
|
|
49
51
|
}
|
|
50
|
-
exports.aggregateGlobalData = aggregateGlobalData;
|
|
51
52
|
function mergeGlobalData(...globalDataList) {
|
|
52
53
|
const result = {};
|
|
53
54
|
const allPluginIdentifiers = globalDataList.flatMap((gd) => Object.keys(gd).flatMap((name) => Object.keys(gd[name]).map((id) => ({ name, id }))));
|
|
@@ -61,7 +62,6 @@ function mergeGlobalData(...globalDataList) {
|
|
|
61
62
|
});
|
|
62
63
|
return result;
|
|
63
64
|
}
|
|
64
|
-
exports.mergeGlobalData = mergeGlobalData;
|
|
65
65
|
// This is primarily useful for colored logging purpose
|
|
66
66
|
// Do not rely on this for logic
|
|
67
67
|
function formatPluginName(plugin) {
|
|
@@ -76,4 +76,3 @@ function formatPluginName(plugin) {
|
|
|
76
76
|
const formattedId = logger_1.default.subdue(id);
|
|
77
77
|
return `${formattedName}@${formattedId}`;
|
|
78
78
|
}
|
|
79
|
-
exports.formatPluginName = formatPluginName;
|
|
@@ -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.loadPresets =
|
|
9
|
+
exports.loadPresets = loadPresets;
|
|
10
10
|
const module_1 = require("module");
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
const moduleShorthand_1 = require("./moduleShorthand");
|
|
@@ -39,4 +39,3 @@ async function loadPresets(context) {
|
|
|
39
39
|
const themes = loadedPresets.flatMap((preset) => preset.themes ?? []);
|
|
40
40
|
return { plugins, themes };
|
|
41
41
|
}
|
|
42
|
-
exports.loadPresets = loadPresets;
|
|
@@ -6,7 +6,8 @@
|
|
|
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.applyRouteTrailingSlash = applyRouteTrailingSlash;
|
|
10
|
+
exports.sortRoutes = sortRoutes;
|
|
10
11
|
const utils_common_1 = require("@docusaurus/utils-common");
|
|
11
12
|
/** Recursively applies trailing slash config to all nested routes. */
|
|
12
13
|
function applyRouteTrailingSlash(route, params) {
|
|
@@ -18,7 +19,6 @@ function applyRouteTrailingSlash(route, params) {
|
|
|
18
19
|
}),
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
exports.applyRouteTrailingSlash = applyRouteTrailingSlash;
|
|
22
22
|
function sortRoutes(routesToSort, baseUrl) {
|
|
23
23
|
const routeConfigs = [...routesToSort];
|
|
24
24
|
// Sort the route config. This ensures that route with nested
|
|
@@ -71,4 +71,3 @@ function sortRoutes(routesToSort, baseUrl) {
|
|
|
71
71
|
});
|
|
72
72
|
return routeConfigs;
|
|
73
73
|
}
|
|
74
|
-
exports.sortRoutes = sortRoutes;
|
|
@@ -6,7 +6,8 @@
|
|
|
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.createBootstrapPlugin = createBootstrapPlugin;
|
|
10
|
+
exports.createMDXFallbackPlugin = createMDXFallbackPlugin;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
13
|
/**
|
|
@@ -50,7 +51,6 @@ function createBootstrapPlugin({ siteDir, siteConfig, }) {
|
|
|
50
51
|
},
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
exports.createBootstrapPlugin = createBootstrapPlugin;
|
|
54
54
|
/**
|
|
55
55
|
* Configure Webpack fallback mdx loader for md/mdx files out of content-plugin
|
|
56
56
|
* folders. Adds a "fallback" mdx loader for mdx files that are not processed by
|
|
@@ -106,4 +106,3 @@ function createMDXFallbackPlugin({ siteDir, siteConfig, }) {
|
|
|
106
106
|
},
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
exports.createMDXFallbackPlugin = createMDXFallbackPlugin;
|
package/lib/server/routes.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
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.handleDuplicateRoutes = handleDuplicateRoutes;
|
|
10
|
+
exports.getRoutesPaths = getRoutesPaths;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
13
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -28,7 +29,6 @@ function handleDuplicateRoutes(routes, onDuplicateRoutes) {
|
|
|
28
29
|
This could lead to non-deterministic routing behavior.`;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
exports.handleDuplicateRoutes = handleDuplicateRoutes;
|
|
32
32
|
/**
|
|
33
33
|
* Old stuff
|
|
34
34
|
* As far as I understand, this is what permits to SSG the 404.html file
|
|
@@ -50,4 +50,3 @@ function getRoutesPaths(routeConfigs, baseUrl) {
|
|
|
50
50
|
...(0, utils_1.flattenRoutes)(routeConfigs).map((r) => r.path),
|
|
51
51
|
];
|
|
52
52
|
}
|
|
53
|
-
exports.getRoutesPaths = getRoutesPaths;
|
package/lib/server/site.js
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
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.loadContext = loadContext;
|
|
10
|
+
exports.loadSite = loadSite;
|
|
11
|
+
exports.reloadSite = reloadSite;
|
|
12
|
+
exports.reloadSitePlugin = reloadSitePlugin;
|
|
10
13
|
const tslib_1 = require("tslib");
|
|
11
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
15
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -69,7 +72,6 @@ async function loadContext(params) {
|
|
|
69
72
|
codeTranslations,
|
|
70
73
|
};
|
|
71
74
|
}
|
|
72
|
-
exports.loadContext = loadContext;
|
|
73
75
|
function createSiteProps(params) {
|
|
74
76
|
const { plugins, routes, context } = params;
|
|
75
77
|
const { generatedFilesDir, siteDir, siteVersion, siteConfig, siteConfigPath, siteStorage, outDir, baseUrl, i18n, localizationDir, codeTranslations: siteCodeTranslations, } = context;
|
|
@@ -141,14 +143,12 @@ async function loadSite(params) {
|
|
|
141
143
|
});
|
|
142
144
|
return site;
|
|
143
145
|
}
|
|
144
|
-
exports.loadSite = loadSite;
|
|
145
146
|
async function reloadSite(site) {
|
|
146
147
|
// TODO this can be optimized, for example:
|
|
147
148
|
// - plugins loading same data as before should not recreate routes/bundles
|
|
148
149
|
// - codegen does not need to re-run if nothing changed
|
|
149
150
|
return loadSite(site.params);
|
|
150
151
|
}
|
|
151
|
-
exports.reloadSite = reloadSite;
|
|
152
152
|
async function reloadSitePlugin(site, pluginIdentifier) {
|
|
153
153
|
const { plugins, routes, globalData } = await (0, plugins_1.reloadPlugin)({
|
|
154
154
|
pluginIdentifier,
|
|
@@ -169,4 +169,3 @@ async function reloadSitePlugin(site, pluginIdentifier) {
|
|
|
169
169
|
await createSiteFiles({ site: newSite, globalData });
|
|
170
170
|
return newSite;
|
|
171
171
|
}
|
|
172
|
-
exports.reloadSitePlugin = reloadSitePlugin;
|
|
@@ -6,7 +6,9 @@
|
|
|
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.loadSiteVersion = loadSiteVersion;
|
|
10
|
+
exports.loadPluginVersion = loadPluginVersion;
|
|
11
|
+
exports.createSiteMetadata = createSiteMetadata;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -25,7 +27,6 @@ async function loadPackageJsonName(packageJsonPath) {
|
|
|
25
27
|
async function loadSiteVersion(siteDir) {
|
|
26
28
|
return loadPackageJsonVersion(path_1.default.join(siteDir, 'package.json'));
|
|
27
29
|
}
|
|
28
|
-
exports.loadSiteVersion = loadSiteVersion;
|
|
29
30
|
async function loadPluginVersion(pluginPath, siteDir) {
|
|
30
31
|
let potentialPluginPackageJsonDirectory = path_1.default.dirname(pluginPath);
|
|
31
32
|
while (potentialPluginPackageJsonDirectory !== '/') {
|
|
@@ -50,7 +51,6 @@ async function loadPluginVersion(pluginPath, siteDir) {
|
|
|
50
51
|
// script in the parent directory of the site.
|
|
51
52
|
return { type: 'local' };
|
|
52
53
|
}
|
|
53
|
-
exports.loadPluginVersion = loadPluginVersion;
|
|
54
54
|
/**
|
|
55
55
|
* We want all `@docusaurus/*` packages to have the exact same version!
|
|
56
56
|
* @see https://github.com/facebook/docusaurus/issues/3371
|
|
@@ -80,4 +80,3 @@ function createSiteMetadata({ siteVersion, plugins, }) {
|
|
|
80
80
|
checkDocusaurusPackagesVersion(siteMetadata);
|
|
81
81
|
return siteMetadata;
|
|
82
82
|
}
|
|
83
|
-
exports.createSiteMetadata = createSiteMetadata;
|
package/lib/server/storage.js
CHANGED
|
@@ -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.createSiteStorage =
|
|
9
|
+
exports.createSiteStorage = createSiteStorage;
|
|
10
10
|
const utils_1 = require("@docusaurus/utils");
|
|
11
11
|
const utils_common_1 = require("@docusaurus/utils-common");
|
|
12
12
|
function automaticNamespace(config) {
|
|
@@ -33,4 +33,3 @@ function createSiteStorage(config) {
|
|
|
33
33
|
namespace,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
exports.createSiteStorage = createSiteStorage;
|