@docusaurus/core 0.0.0-5858 → 0.0.0-5861

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 (47) hide show
  1. package/lib/commands/build.d.ts +2 -2
  2. package/lib/commands/build.js +6 -6
  3. package/lib/commands/deploy.d.ts +2 -2
  4. package/lib/commands/deploy.js +2 -2
  5. package/lib/commands/external.js +2 -2
  6. package/lib/commands/serve.d.ts +2 -2
  7. package/lib/commands/{start.d.ts → start/start.d.ts} +3 -3
  8. package/lib/commands/start/start.js +47 -0
  9. package/lib/commands/start/utils.d.ts +31 -0
  10. package/lib/commands/start/utils.js +88 -0
  11. package/lib/commands/start/watcher.d.ts +42 -0
  12. package/lib/commands/start/watcher.js +78 -0
  13. package/lib/commands/start/webpack.d.ts +15 -0
  14. package/lib/commands/start/webpack.js +133 -0
  15. package/lib/commands/swizzle/context.js +2 -2
  16. package/lib/commands/writeHeadingIds.js +2 -2
  17. package/lib/commands/writeTranslations.d.ts +2 -2
  18. package/lib/commands/writeTranslations.js +2 -2
  19. package/lib/index.d.ts +1 -1
  20. package/lib/index.js +1 -1
  21. package/lib/server/brokenLinks.js +2 -2
  22. package/lib/server/codegen/codegen.d.ts +20 -0
  23. package/lib/server/codegen/codegen.js +65 -0
  24. package/lib/server/codegen/codegenRoutes.d.ts +49 -0
  25. package/lib/server/codegen/codegenRoutes.js +190 -0
  26. package/lib/server/i18n.d.ts +2 -2
  27. package/lib/server/plugins/actions.d.ts +19 -0
  28. package/lib/server/plugins/actions.js +61 -0
  29. package/lib/server/plugins/plugins.d.ts +27 -0
  30. package/lib/server/plugins/plugins.js +228 -0
  31. package/lib/server/plugins/routeConfig.d.ts +1 -1
  32. package/lib/server/plugins/routeConfig.js +4 -4
  33. package/lib/server/routes.d.ts +4 -45
  34. package/lib/server/routes.js +15 -166
  35. package/lib/server/{index.d.ts → site.d.ts} +12 -4
  36. package/lib/server/site.js +167 -0
  37. package/lib/server/translations/translations.d.ts +3 -0
  38. package/lib/server/translations/translations.js +7 -1
  39. package/lib/server/utils.d.ts +0 -2
  40. package/lib/server/utils.js +1 -9
  41. package/lib/utils.d.ts +1 -0
  42. package/lib/utils.js +14 -3
  43. package/package.json +11 -10
  44. package/lib/commands/start.js +0 -242
  45. package/lib/server/index.js +0 -154
  46. package/lib/server/plugins/index.d.ts +0 -18
  47. package/lib/server/plugins/index.js +0 -106
@@ -12,7 +12,7 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
12
12
  const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
13
13
  const react_router_config_1 = require("react-router-config");
14
14
  const utils_1 = require("@docusaurus/utils");
15
- const utils_2 = require("./utils");
15
+ const routes_1 = require("./routes");
16
16
  function matchRoutes(routeConfig, pathname) {
17
17
  // @ts-expect-error: React router types RouteConfig with an actual React
18
18
  // component, but we load route components with string paths.
@@ -127,7 +127,7 @@ function getBrokenLinksForPage({ pagePath, helper, }) {
127
127
  */
128
128
  function filterIntermediateRoutes(routesInput) {
129
129
  const routesWithout404 = routesInput.filter((route) => route.path !== '*');
130
- return (0, utils_2.getAllFinalRoutes)(routesWithout404);
130
+ return (0, routes_1.getAllFinalRoutes)(routesWithout404);
131
131
  }
132
132
  function getBrokenLinks({ collectedLinks, routes, }) {
133
133
  const filteredRoutes = filterIntermediateRoutes(routes);
@@ -0,0 +1,20 @@
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 { CodeTranslations, DocusaurusConfig, GlobalData, I18n, RouteConfig, SiteMetadata } from '@docusaurus/types';
8
+ type CodegenParams = {
9
+ generatedFilesDir: string;
10
+ siteConfig: DocusaurusConfig;
11
+ baseUrl: string;
12
+ clientModules: string[];
13
+ globalData: GlobalData;
14
+ i18n: I18n;
15
+ codeTranslations: CodeTranslations;
16
+ siteMetadata: SiteMetadata;
17
+ routes: RouteConfig[];
18
+ };
19
+ export declare function generateSiteFiles(params: CodegenParams): Promise<void>;
20
+ export {};
@@ -0,0 +1,65 @@
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.generateSiteFiles = void 0;
10
+ const utils_1 = require("@docusaurus/utils");
11
+ const codegenRoutes_1 = require("./codegenRoutes");
12
+ function genWarning({ generatedFilesDir }) {
13
+ return (0, utils_1.generate)(generatedFilesDir,
14
+ // cSpell:ignore DONT
15
+ 'DONT-EDIT-THIS-FOLDER', `This folder stores temp files that Docusaurus' client bundler accesses.
16
+
17
+ DO NOT hand-modify files in this folder because they will be overwritten in the
18
+ next build. You can clear all build artifacts (including this folder) with the
19
+ \`docusaurus clear\` command.
20
+ `);
21
+ }
22
+ function genSiteConfig({ generatedFilesDir, siteConfig, }) {
23
+ return (0, utils_1.generate)(generatedFilesDir, `${utils_1.DEFAULT_CONFIG_FILE_NAME}.mjs`, `/*
24
+ * AUTOGENERATED - DON'T EDIT
25
+ * Your edits in this file will be overwritten in the next build!
26
+ * Modify the docusaurus.config.js file at your site's root instead.
27
+ */
28
+ export default ${JSON.stringify(siteConfig, null, 2)};
29
+ `);
30
+ }
31
+ function genClientModules({ generatedFilesDir, clientModules, }) {
32
+ return (0, utils_1.generate)(generatedFilesDir, 'client-modules.js', `export default [
33
+ ${clientModules
34
+ // Use `require()` because `import()` is async but client modules can have CSS
35
+ // and the order matters for loading CSS.
36
+ .map((clientModule) => ` require("${(0, utils_1.escapePath)(clientModule)}"),`)
37
+ .join('\n')}
38
+ ];
39
+ `);
40
+ }
41
+ function genGlobalData({ generatedFilesDir, globalData, }) {
42
+ return (0, utils_1.generate)(generatedFilesDir, 'globalData.json', JSON.stringify(globalData, null, 2));
43
+ }
44
+ function genI18n({ generatedFilesDir, i18n, }) {
45
+ return (0, utils_1.generate)(generatedFilesDir, 'i18n.json', JSON.stringify(i18n, null, 2));
46
+ }
47
+ function genCodeTranslations({ generatedFilesDir, codeTranslations, }) {
48
+ return (0, utils_1.generate)(generatedFilesDir, 'codeTranslations.json', JSON.stringify(codeTranslations, null, 2));
49
+ }
50
+ function genSiteMetadata({ generatedFilesDir, siteMetadata, }) {
51
+ return (0, utils_1.generate)(generatedFilesDir, 'site-metadata.json', JSON.stringify(siteMetadata, null, 2));
52
+ }
53
+ async function generateSiteFiles(params) {
54
+ await Promise.all([
55
+ genWarning(params),
56
+ genClientModules(params),
57
+ genSiteConfig(params),
58
+ (0, codegenRoutes_1.generateRouteFiles)(params),
59
+ genGlobalData(params),
60
+ genSiteMetadata(params),
61
+ genI18n(params),
62
+ genCodeTranslations(params),
63
+ ]);
64
+ }
65
+ exports.generateSiteFiles = generateSiteFiles;
@@ -0,0 +1,49 @@
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 { RouteConfig, RouteChunkNames } from '@docusaurus/types';
8
+ type RoutesCode = {
9
+ /** Serialized routes config that can be directly emitted into temp file. */
10
+ routesConfig: string;
11
+ /** @see {ChunkNames} */
12
+ routesChunkNames: RouteChunkNames;
13
+ /**
14
+ * A map from chunk name to module paths. Module paths would have backslash
15
+ * escaped already, so they can be directly printed.
16
+ */
17
+ registry: {
18
+ [chunkName: string]: string;
19
+ };
20
+ };
21
+ /**
22
+ * Generates a unique chunk name that can be used in the chunk registry.
23
+ *
24
+ * @param modulePath A path to generate chunk name from. The actual value has no
25
+ * semantic significance.
26
+ * @param prefix A prefix to append to the chunk name, to avoid name clash.
27
+ * @param preferredName Chunk names default to `modulePath`, and this can supply
28
+ * a more human-readable name.
29
+ * @param shortId When `true`, the chunk name would only be a hash without any
30
+ * other characters. Useful for bundle size. Defaults to `true` in production.
31
+ */
32
+ export declare function genChunkName(modulePath: string, prefix?: string, preferredName?: string, shortId?: boolean): string;
33
+ /**
34
+ * Routes are prepared into three temp files:
35
+ *
36
+ * - `routesConfig`, the route config passed to react-router. This file is kept
37
+ * minimal, because it can't be code-splitted.
38
+ * - `routesChunkNames`, a mapping from route paths (hashed) to code-splitted
39
+ * chunk names.
40
+ * - `registry`, a mapping from chunk names to options for react-loadable.
41
+ */
42
+ export declare function generateRoutesCode(routeConfigs: RouteConfig[]): RoutesCode;
43
+ type GenerateRouteFilesParams = {
44
+ generatedFilesDir: string;
45
+ routes: RouteConfig[];
46
+ baseUrl: string;
47
+ };
48
+ export declare function generateRouteFiles({ generatedFilesDir, routes, }: GenerateRouteFilesParams): Promise<void>;
49
+ export {};
@@ -0,0 +1,190 @@
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.generateRouteFiles = exports.generateRoutesCode = exports.genChunkName = void 0;
10
+ const tslib_1 = require("tslib");
11
+ const querystring_1 = tslib_1.__importDefault(require("querystring"));
12
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
13
+ const utils_1 = require("@docusaurus/utils");
14
+ /** Indents every line of `str` by one level. */
15
+ function indent(str) {
16
+ return ` ${str.replace(/\n/g, `\n `)}`;
17
+ }
18
+ const chunkNameCache = new Map();
19
+ const chunkNameCount = new Map();
20
+ /**
21
+ * Generates a unique chunk name that can be used in the chunk registry.
22
+ *
23
+ * @param modulePath A path to generate chunk name from. The actual value has no
24
+ * semantic significance.
25
+ * @param prefix A prefix to append to the chunk name, to avoid name clash.
26
+ * @param preferredName Chunk names default to `modulePath`, and this can supply
27
+ * a more human-readable name.
28
+ * @param shortId When `true`, the chunk name would only be a hash without any
29
+ * other characters. Useful for bundle size. Defaults to `true` in production.
30
+ */
31
+ function genChunkName(modulePath, prefix, preferredName, shortId = process.env.NODE_ENV === 'production') {
32
+ let chunkName = chunkNameCache.get(modulePath);
33
+ if (!chunkName) {
34
+ if (shortId) {
35
+ chunkName = (0, utils_1.simpleHash)(modulePath, 8);
36
+ }
37
+ else {
38
+ let str = modulePath;
39
+ if (preferredName) {
40
+ const shortHash = (0, utils_1.simpleHash)(modulePath, 3);
41
+ str = `${preferredName}${shortHash}`;
42
+ }
43
+ const name = (0, utils_1.docuHash)(str);
44
+ chunkName = prefix ? `${prefix}---${name}` : name;
45
+ }
46
+ const seenCount = (chunkNameCount.get(chunkName) ?? 0) + 1;
47
+ if (seenCount > 1) {
48
+ chunkName += seenCount.toString(36);
49
+ }
50
+ chunkNameCache.set(modulePath, chunkName);
51
+ chunkNameCount.set(chunkName, seenCount);
52
+ }
53
+ return chunkName;
54
+ }
55
+ exports.genChunkName = genChunkName;
56
+ /**
57
+ * Takes a piece of route config, and serializes it into raw JS code. The shape
58
+ * is the same as react-router's `RouteConfig`. Formatting is similar to
59
+ * `JSON.stringify` but without all the quotes.
60
+ */
61
+ function serializeRouteConfig({ routePath, routeHash, exact, subroutesCodeStrings, props, }) {
62
+ const parts = [
63
+ `path: '${routePath}'`,
64
+ `component: ComponentCreator('${routePath}', '${routeHash}')`,
65
+ ];
66
+ if (exact) {
67
+ parts.push(`exact: true`);
68
+ }
69
+ if (subroutesCodeStrings) {
70
+ parts.push(`routes: [
71
+ ${indent(subroutesCodeStrings.join(',\n'))}
72
+ ]`);
73
+ }
74
+ Object.entries(props).forEach(([propName, propValue]) => {
75
+ const isIdentifier = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u.test(propName);
76
+ const key = isIdentifier ? propName : JSON.stringify(propName);
77
+ parts.push(`${key}: ${JSON.stringify(propValue)}`);
78
+ });
79
+ return `{
80
+ ${indent(parts.join(',\n'))}
81
+ }`;
82
+ }
83
+ const isModule = (value) => typeof value === 'string' ||
84
+ (typeof value === 'object' &&
85
+ // eslint-disable-next-line no-underscore-dangle
86
+ !!value?.__import);
87
+ /**
88
+ * Takes a {@link Module} (which is nothing more than a path plus some metadata
89
+ * like query) and returns the string path it represents.
90
+ */
91
+ function getModulePath(target) {
92
+ if (typeof target === 'string') {
93
+ return target;
94
+ }
95
+ const queryStr = target.query ? `?${querystring_1.default.stringify(target.query)}` : '';
96
+ return `${target.path}${queryStr}`;
97
+ }
98
+ function genChunkNames(routeModule, prefix, name, res) {
99
+ if (isModule(routeModule)) {
100
+ // This is a leaf node, no need to recurse
101
+ const modulePath = getModulePath(routeModule);
102
+ const chunkName = genChunkName(modulePath, prefix, name);
103
+ res.registry[chunkName] = (0, utils_1.escapePath)(modulePath);
104
+ return chunkName;
105
+ }
106
+ if (Array.isArray(routeModule)) {
107
+ return routeModule.map((val, index) => genChunkNames(val, `${index}`, name, res));
108
+ }
109
+ return lodash_1.default.mapValues(routeModule, (v, key) => genChunkNames(v, key, name, res));
110
+ }
111
+ /**
112
+ * This is the higher level overview of route code generation. For each route
113
+ * config node, it returns the node's serialized form, and mutates `registry`,
114
+ * `routesPaths`, and `routesChunkNames` accordingly.
115
+ */
116
+ function genRouteCode(routeConfig, res) {
117
+ const { path: routePath, component, modules = {}, context, routes: subroutes, priority, exact, ...props } = routeConfig;
118
+ if (typeof routePath !== 'string' || !component) {
119
+ throw new Error(`Invalid route config: path must be a string and component is required.
120
+ ${JSON.stringify(routeConfig)}`);
121
+ }
122
+ const routeHash = (0, utils_1.simpleHash)(JSON.stringify(routeConfig), 3);
123
+ res.routesChunkNames[`${routePath}-${routeHash}`] = {
124
+ // Avoid clash with a prop called "component"
125
+ ...genChunkNames({ __comp: component }, 'component', component, res),
126
+ ...(context &&
127
+ genChunkNames({ __context: context }, 'context', routePath, res)),
128
+ ...genChunkNames(modules, 'module', routePath, res),
129
+ };
130
+ return serializeRouteConfig({
131
+ routePath: routePath.replace(/'/g, "\\'"),
132
+ routeHash,
133
+ subroutesCodeStrings: subroutes?.map((r) => genRouteCode(r, res)),
134
+ exact,
135
+ props,
136
+ });
137
+ }
138
+ /**
139
+ * Routes are prepared into three temp files:
140
+ *
141
+ * - `routesConfig`, the route config passed to react-router. This file is kept
142
+ * minimal, because it can't be code-splitted.
143
+ * - `routesChunkNames`, a mapping from route paths (hashed) to code-splitted
144
+ * chunk names.
145
+ * - `registry`, a mapping from chunk names to options for react-loadable.
146
+ */
147
+ function generateRoutesCode(routeConfigs) {
148
+ const res = {
149
+ // To be written by `genRouteCode`
150
+ routesConfig: '',
151
+ routesChunkNames: {},
152
+ registry: {},
153
+ };
154
+ // `genRouteCode` would mutate `res`
155
+ const routeConfigSerialized = routeConfigs
156
+ .map((r) => genRouteCode(r, res))
157
+ .join(',\n');
158
+ res.routesConfig = `import React from 'react';
159
+ import ComponentCreator from '@docusaurus/ComponentCreator';
160
+
161
+ export default [
162
+ ${indent(routeConfigSerialized)},
163
+ {
164
+ path: '*',
165
+ component: ComponentCreator('*'),
166
+ },
167
+ ];
168
+ `;
169
+ return res;
170
+ }
171
+ exports.generateRoutesCode = generateRoutesCode;
172
+ const genRegistry = ({ generatedFilesDir, registry, }) => (0, utils_1.generate)(generatedFilesDir, 'registry.js', `export default {
173
+ ${Object.entries(registry)
174
+ .sort((a, b) => a[0].localeCompare(b[0]))
175
+ .map(([chunkName, modulePath]) =>
176
+ // modulePath is already escaped by escapePath
177
+ ` "${chunkName}": [() => import(/* webpackChunkName: "${chunkName}" */ "${modulePath}"), "${modulePath}", require.resolveWeak("${modulePath}")],`)
178
+ .join('\n')}};
179
+ `);
180
+ const genRoutesChunkNames = ({ generatedFilesDir, routesChunkNames, }) => (0, utils_1.generate)(generatedFilesDir, 'routesChunkNames.json', JSON.stringify(routesChunkNames, null, 2));
181
+ const genRoutes = ({ generatedFilesDir, routesConfig, }) => (0, utils_1.generate)(generatedFilesDir, 'routes.js', routesConfig);
182
+ async function generateRouteFiles({ generatedFilesDir, routes, }) {
183
+ const { registry, routesChunkNames, routesConfig } = generateRoutesCode(routes);
184
+ await Promise.all([
185
+ genRegistry({ generatedFilesDir, registry }),
186
+ genRoutesChunkNames({ generatedFilesDir, routesChunkNames }),
187
+ genRoutes({ generatedFilesDir, routesConfig }),
188
+ ]);
189
+ }
190
+ exports.generateRouteFiles = generateRouteFiles;
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import type { I18n, DocusaurusConfig, I18nLocaleConfig } from '@docusaurus/types';
8
- import type { LoadContextOptions } from './index';
8
+ import type { LoadContextParams } from './site';
9
9
  export declare function getDefaultLocaleConfig(locale: string): I18nLocaleConfig;
10
- export declare function loadI18n(config: DocusaurusConfig, options: Pick<LoadContextOptions, 'locale'>): Promise<I18n>;
10
+ export declare function loadI18n(config: DocusaurusConfig, options: Pick<LoadContextParams, 'locale'>): Promise<I18n>;
@@ -0,0 +1,19 @@
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, PluginContentLoadedActions, RouteConfig } from '@docusaurus/types';
8
+ type PluginActionUtils = {
9
+ getRoutes: () => RouteConfig[];
10
+ getGlobalData: () => unknown;
11
+ getActions: () => PluginContentLoadedActions;
12
+ };
13
+ export declare function createPluginActionsUtils({ plugin, generatedFilesDir, baseUrl, trailingSlash, }: {
14
+ plugin: LoadedPlugin;
15
+ generatedFilesDir: string;
16
+ baseUrl: string;
17
+ trailingSlash: boolean | undefined;
18
+ }): Promise<PluginActionUtils>;
19
+ export {};
@@ -0,0 +1,61 @@
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.createPluginActionsUtils = void 0;
10
+ const tslib_1 = require("tslib");
11
+ const path_1 = tslib_1.__importDefault(require("path"));
12
+ const utils_1 = require("@docusaurus/utils");
13
+ const routeConfig_1 = require("./routeConfig");
14
+ // TODO refactor historical action system and make this side-effect-free
15
+ // If the function were pure, we could more easily compare previous/next values
16
+ // on site reloads, and bail-out of the reload process earlier
17
+ // Particularly, createData() modules should rather be declarative
18
+ async function createPluginActionsUtils({ plugin, generatedFilesDir, baseUrl, trailingSlash, }) {
19
+ const pluginId = plugin.options.id;
20
+ // Plugins data files are namespaced by pluginName/pluginId
21
+ const dataDir = path_1.default.join(generatedFilesDir, plugin.name, pluginId);
22
+ const pluginRouteContext = {
23
+ name: plugin.name,
24
+ id: pluginId,
25
+ };
26
+ const pluginRouteContextModulePath = path_1.default.join(dataDir, `${(0, utils_1.docuHash)('pluginRouteContextModule')}.json`);
27
+ await (0, utils_1.generate)('/', pluginRouteContextModulePath, JSON.stringify(pluginRouteContext, null, 2));
28
+ const routes = [];
29
+ let globalData;
30
+ const actions = {
31
+ addRoute(initialRouteConfig) {
32
+ // Trailing slash behavior is handled generically for all plugins
33
+ const finalRouteConfig = (0, routeConfig_1.applyRouteTrailingSlash)(initialRouteConfig, {
34
+ baseUrl,
35
+ trailingSlash,
36
+ });
37
+ routes.push({
38
+ ...finalRouteConfig,
39
+ context: {
40
+ ...(finalRouteConfig.context && { data: finalRouteConfig.context }),
41
+ plugin: pluginRouteContextModulePath,
42
+ },
43
+ });
44
+ },
45
+ async createData(name, data) {
46
+ const modulePath = path_1.default.join(dataDir, name);
47
+ await (0, utils_1.generate)(dataDir, name, data);
48
+ return modulePath;
49
+ },
50
+ setGlobalData(data) {
51
+ globalData = data;
52
+ },
53
+ };
54
+ return {
55
+ // Some variables are mutable, so we expose a getter instead of the value
56
+ getRoutes: () => routes,
57
+ getGlobalData: () => globalData,
58
+ getActions: () => actions,
59
+ };
60
+ }
61
+ exports.createPluginActionsUtils = createPluginActionsUtils;
@@ -0,0 +1,27 @@
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 { LoadContext, RouteConfig, GlobalData, LoadedPlugin } from '@docusaurus/types';
8
+ import type { PluginIdentifier } from '@docusaurus/types/src/plugin';
9
+ export type LoadPluginsResult = {
10
+ plugins: LoadedPlugin[];
11
+ routes: RouteConfig[];
12
+ globalData: GlobalData;
13
+ };
14
+ export declare function mergeGlobalData(...globalDataList: GlobalData[]): GlobalData;
15
+ /**
16
+ * Initializes the plugins and run their lifecycle functions.
17
+ */
18
+ export declare function loadPlugins(context: LoadContext): Promise<LoadPluginsResult>;
19
+ export declare function getPluginByIdentifier({ plugins, pluginIdentifier, }: {
20
+ pluginIdentifier: PluginIdentifier;
21
+ plugins: LoadedPlugin[];
22
+ }): LoadedPlugin;
23
+ export declare function reloadPlugin({ pluginIdentifier, plugins: previousPlugins, context, }: {
24
+ pluginIdentifier: PluginIdentifier;
25
+ plugins: LoadedPlugin[];
26
+ context: LoadContext;
27
+ }): Promise<LoadPluginsResult>;