@docusaurus/core 2.0.0-beta.ff31de0ff → 2.0.0-rc.1
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/README.md +1 -0
- package/bin/beforeCli.mjs +140 -0
- package/bin/docusaurus.mjs +221 -0
- package/lib/babel/preset.d.ts +8 -3
- package/lib/babel/preset.js +10 -8
- package/lib/client/App.d.ts +2 -3
- package/lib/client/App.js +31 -28
- package/lib/client/BaseUrlIssueBanner/index.d.ts +27 -0
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.js → BaseUrlIssueBanner/index.js} +25 -14
- package/lib/client/{baseUrlIssueBanner → BaseUrlIssueBanner}/styles.module.css +0 -0
- package/lib/client/ClientLifecyclesDispatcher.d.ts +16 -0
- package/lib/client/ClientLifecyclesDispatcher.js +39 -0
- package/lib/client/LinksCollector.d.ts +3 -3
- package/lib/client/LinksCollector.js +8 -13
- package/lib/client/PendingNavigation.d.ts +17 -3
- package/lib/client/PendingNavigation.js +47 -72
- package/lib/client/{baseUrlIssueBanner/BaseUrlIssueBanner.d.ts → SiteMetadataDefaults.d.ts} +1 -2
- package/lib/client/SiteMetadataDefaults.js +21 -0
- package/lib/{choosePort.d.ts → client/browserContext.d.ts} +5 -5
- package/lib/client/browserContext.js +22 -0
- package/lib/client/clientEntry.js +14 -9
- package/lib/client/docusaurus.d.ts +12 -6
- package/lib/client/docusaurus.js +30 -43
- package/lib/client/docusaurusContext.d.ts +12 -0
- package/lib/client/docusaurusContext.js +25 -0
- package/lib/client/exports/BrowserOnly.d.ts +3 -5
- package/lib/client/exports/BrowserOnly.js +14 -7
- package/lib/client/exports/ComponentCreator.d.ts +6 -2
- package/lib/client/exports/ComponentCreator.js +75 -42
- package/lib/client/exports/ErrorBoundary.d.ts +18 -0
- package/lib/client/exports/ErrorBoundary.js +37 -0
- package/lib/client/exports/ExecutionEnvironment.js +7 -8
- package/lib/client/exports/Head.d.ts +2 -3
- package/lib/client/exports/Head.js +3 -4
- package/lib/client/exports/Interpolate.d.ts +2 -2
- package/lib/client/exports/Interpolate.js +20 -49
- package/lib/client/exports/Link.d.ts +4 -10
- package/lib/client/exports/Link.js +44 -38
- package/lib/client/exports/Translate.d.ts +1 -1
- package/lib/client/exports/Translate.js +14 -9
- package/lib/client/exports/constants.js +1 -11
- package/lib/client/exports/isInternalUrl.js +1 -1
- package/lib/client/exports/renderRoutes.d.ts +1 -2
- package/lib/client/exports/renderRoutes.js +1 -2
- package/lib/client/exports/router.d.ts +1 -1
- package/lib/client/exports/router.js +1 -1
- package/lib/client/exports/useBaseUrl.js +11 -14
- package/lib/client/exports/useDocusaurusContext.d.ts +2 -3
- package/lib/client/exports/useDocusaurusContext.js +3 -9
- package/lib/client/exports/useGlobalData.d.ts +4 -3
- package/lib/client/exports/useGlobalData.js +8 -15
- package/lib/{server/versions/__tests/index.test.d.ts → client/exports/useIsBrowser.d.ts} +1 -1
- package/lib/client/exports/useIsBrowser.js +11 -0
- package/lib/client/exports/useRouteContext.d.ts +8 -0
- package/lib/client/exports/useRouteContext.js +15 -0
- package/lib/client/flat.d.ts +12 -2
- package/lib/client/flat.js +19 -15
- package/lib/client/normalizeLocation.d.ts +2 -5
- package/lib/client/normalizeLocation.js +14 -10
- package/lib/client/prefetch.d.ts +1 -2
- package/lib/client/prefetch.js +12 -32
- package/lib/client/preload.d.ts +3 -4
- package/lib/client/preload.js +5 -12
- package/lib/client/routeContext.d.ts +13 -0
- package/lib/client/routeContext.js +31 -0
- package/lib/client/serverEntry.d.ts +10 -0
- package/lib/client/serverEntry.js +109 -136
- package/lib/client/theme-fallback/Error/index.d.ts +10 -0
- package/lib/client/theme-fallback/Error/index.js +45 -0
- package/lib/client/theme-fallback/Layout/index.d.ts +10 -0
- package/lib/client/theme-fallback/Layout/index.js +2 -26
- package/lib/client/theme-fallback/Loading/index.d.ts +9 -0
- package/lib/client/theme-fallback/Loading/index.js +50 -116
- package/lib/client/{exports/context.js → theme-fallback/NotFound/index.d.ts} +2 -2
- package/lib/client/theme-fallback/NotFound/index.js +19 -18
- package/lib/client/theme-fallback/Root/index.d.ts +10 -0
- package/lib/client/theme-fallback/Root/index.js +2 -6
- package/lib/{server/html-tags/htmlTags.d.ts → client/theme-fallback/SiteMetadata/index.d.ts} +2 -1
- package/lib/client/theme-fallback/SiteMetadata/index.js +10 -0
- package/lib/commands/build.d.ts +6 -2
- package/lib/commands/build.js +81 -64
- package/lib/commands/clear.d.ts +7 -1
- package/lib/commands/clear.js +34 -21
- package/lib/commands/deploy.d.ts +5 -2
- package/lib/commands/deploy.js +102 -81
- package/lib/commands/external.d.ts +2 -2
- package/lib/commands/external.js +9 -11
- package/lib/commands/serve.d.ts +8 -2
- package/lib/commands/serve.js +40 -20
- package/lib/commands/start.d.ts +9 -2
- package/lib/commands/start.js +111 -101
- package/lib/commands/swizzle/actions.d.ts +23 -0
- package/lib/commands/swizzle/actions.js +106 -0
- package/lib/commands/swizzle/common.d.ts +33 -0
- package/lib/commands/swizzle/common.js +56 -0
- package/lib/commands/swizzle/components.d.ts +29 -0
- package/lib/commands/swizzle/components.js +200 -0
- package/lib/commands/swizzle/config.d.ts +10 -0
- package/lib/commands/swizzle/config.js +84 -0
- package/lib/{server/client-modules/index.d.ts → commands/swizzle/context.d.ts} +2 -2
- package/lib/commands/swizzle/context.js +24 -0
- package/lib/commands/swizzle/index.d.ts +8 -0
- package/lib/commands/swizzle/index.js +119 -0
- package/lib/commands/swizzle/prompts.d.ts +12 -0
- package/lib/commands/swizzle/prompts.js +110 -0
- package/lib/{client/exports/context.d.ts → commands/swizzle/tables.d.ts} +3 -4
- package/lib/commands/swizzle/tables.js +113 -0
- package/lib/commands/swizzle/themes.d.ts +20 -0
- package/lib/commands/swizzle/themes.js +106 -0
- package/lib/commands/writeHeadingIds.d.ts +2 -6
- package/lib/commands/writeHeadingIds.js +22 -81
- package/lib/commands/writeTranslations.d.ts +4 -5
- package/lib/commands/writeTranslations.js +48 -28
- package/lib/index.d.ts +9 -9
- package/lib/index.js +14 -14
- package/lib/server/brokenLinks.d.ts +4 -17
- package/lib/server/brokenLinks.js +67 -56
- package/lib/server/clientModules.d.ts +12 -0
- package/lib/server/clientModules.js +20 -0
- package/lib/server/config.d.ts +5 -2
- package/lib/server/config.js +29 -6
- package/lib/server/configValidation.d.ts +5 -3
- package/lib/server/configValidation.js +105 -44
- package/lib/server/getHostPort.d.ts +14 -0
- package/lib/server/getHostPort.js +79 -0
- package/lib/server/htmlTags.d.ts +12 -0
- package/lib/server/htmlTags.js +62 -0
- package/lib/server/i18n.d.ts +3 -13
- package/lib/server/i18n.js +21 -55
- package/lib/server/index.d.ts +28 -6
- package/lib/server/index.js +86 -173
- package/lib/server/plugins/configs.d.ts +51 -0
- package/lib/server/plugins/configs.js +101 -0
- package/lib/server/plugins/index.d.ts +10 -10
- package/lib/server/plugins/index.js +76 -128
- package/lib/server/plugins/init.d.ts +6 -9
- package/lib/server/plugins/init.js +44 -109
- package/lib/server/plugins/moduleShorthand.d.ts +9 -0
- package/lib/server/plugins/moduleShorthand.js +46 -0
- package/lib/server/plugins/pluginIds.d.ts +6 -2
- package/lib/server/plugins/pluginIds.js +12 -7
- package/lib/server/plugins/presets.d.ts +12 -0
- package/lib/server/plugins/presets.js +49 -0
- package/lib/server/plugins/routeConfig.d.ts +11 -0
- package/lib/server/plugins/routeConfig.js +54 -0
- package/lib/server/plugins/synthetic.d.ts +20 -0
- package/lib/server/plugins/synthetic.js +111 -0
- package/lib/server/routes.d.ts +39 -7
- package/lib/server/routes.js +182 -95
- package/lib/server/siteMetadata.d.ts +12 -0
- package/lib/server/siteMetadata.js +81 -0
- package/lib/server/translations/translations.d.ts +16 -22
- package/lib/server/translations/translations.js +41 -73
- package/lib/server/translations/translationsExtractor.d.ts +10 -5
- package/lib/server/translations/translationsExtractor.js +158 -122
- package/lib/server/utils.d.ts +9 -3
- package/lib/server/utils.js +7 -9
- package/lib/webpack/aliases/index.d.ts +34 -0
- package/lib/webpack/aliases/index.js +106 -0
- package/lib/webpack/base.d.ts +3 -4
- package/lib/webpack/base.js +56 -58
- package/lib/webpack/client.d.ts +3 -3
- package/lib/webpack/client.js +12 -19
- package/lib/webpack/plugins/ChunkAssetPlugin.d.ts +13 -3
- package/lib/webpack/plugins/ChunkAssetPlugin.js +24 -17
- package/lib/webpack/plugins/CleanWebpackPlugin.d.ts +6 -25
- package/lib/webpack/plugins/CleanWebpackPlugin.js +34 -18
- package/lib/webpack/plugins/LogPlugin.d.ts +1 -1
- package/lib/webpack/plugins/LogPlugin.js +4 -5
- package/lib/webpack/plugins/WaitPlugin.d.ts +3 -3
- package/lib/webpack/plugins/WaitPlugin.js +1 -1
- package/lib/webpack/server.d.ts +5 -5
- package/lib/webpack/server.js +23 -8
- package/lib/{client → webpack}/templates/index.html.template.ejs +0 -0
- package/lib/webpack/templates/ssr.html.template.d.ts +8 -0
- package/lib/{client → webpack}/templates/ssr.html.template.js +5 -4
- package/lib/webpack/utils.d.ts +16 -31
- package/lib/webpack/utils.js +63 -183
- package/package.json +83 -77
- package/bin/docusaurus.js +0 -326
- package/lib/.tsbuildinfo +0 -5682
- package/lib/choosePort.js +0 -105
- package/lib/client/.eslintrc.js +0 -29
- package/lib/client/.tsbuildinfo +0 -4127
- package/lib/client/client-lifecycles-dispatcher.d.ts +0 -12
- package/lib/client/client-lifecycles-dispatcher.js +0 -27
- package/lib/client/nprogress.css +0 -36
- package/lib/commands/buildRemoteBranchUrl.d.ts +0 -7
- package/lib/commands/buildRemoteBranchUrl.js +0 -27
- package/lib/commands/commandUtils.d.ts +0 -3
- package/lib/commands/commandUtils.js +0 -21
- package/lib/commands/swizzle.d.ts +0 -9
- package/lib/commands/swizzle.js +0 -245
- package/lib/constants.d.ts +0 -18
- package/lib/constants.js +0 -23
- package/lib/server/client-modules/index.js +0 -14
- package/lib/server/duplicateRoutes.d.ts +0 -10
- package/lib/server/duplicateRoutes.js +0 -38
- package/lib/server/html-tags/htmlTags.js +0 -39
- package/lib/server/html-tags/index.d.ts +0 -9
- package/lib/server/html-tags/index.js +0 -43
- package/lib/server/loadSetup.d.ts +0 -9
- package/lib/server/loadSetup.js +0 -25
- package/lib/server/presets/index.d.ts +0 -11
- package/lib/server/presets/index.js +0 -48
- package/lib/server/themes/alias.d.ts +0 -8
- package/lib/server/themes/alias.js +0 -39
- package/lib/server/themes/index.d.ts +0 -8
- package/lib/server/themes/index.js +0 -35
- package/lib/server/versions/__fixtures__/dummy-plugin.js +0 -0
- package/lib/server/versions/__fixtures__/package.json +0 -3
- package/lib/server/versions/__tests/index.test.js +0 -25
- package/lib/server/versions/index.d.ts +0 -10
- package/lib/server/versions/index.js +0 -50
- package/lib/webpack/react-dev-utils-webpack5/README.md +0 -11
- package/lib/webpack/react-dev-utils-webpack5/evalSourceMapMiddleware.js +0 -57
- package/lib/webpack/react-dev-utils-webpack5/formatWebpackMessages.js +0 -138
- package/lib/webpack/react-dev-utils-webpack5/webpackHotDevClient.js +0 -285
- package/lib/webpack/sharedModuleAliases.d.ts +0 -10
- package/lib/webpack/sharedModuleAliases.js +0 -18
- package/tsconfig.client.json +0 -13
- package/tsconfig.json +0 -13
|
@@ -0,0 +1,51 @@
|
|
|
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, PluginModule, PluginOptions } from '@docusaurus/types';
|
|
8
|
+
declare type ImportedPluginModule = PluginModule & {
|
|
9
|
+
default?: PluginModule;
|
|
10
|
+
};
|
|
11
|
+
export declare type NormalizedPluginConfig = {
|
|
12
|
+
/**
|
|
13
|
+
* The default export of the plugin module, or alternatively, what's provided
|
|
14
|
+
* in the config file as inline plugins. Note that if a file is like:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* export default plugin() {...}
|
|
18
|
+
* export validateOptions() {...}
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Then the static methods may not exist here. `pluginModule.module` will
|
|
22
|
+
* always take priority.
|
|
23
|
+
*/
|
|
24
|
+
plugin: PluginModule;
|
|
25
|
+
/** Options as they are provided in the config, not validated yet. */
|
|
26
|
+
options: PluginOptions;
|
|
27
|
+
/** Only available when a string is provided in config. */
|
|
28
|
+
pluginModule?: {
|
|
29
|
+
/**
|
|
30
|
+
* Raw module name as provided in the config. Shorthands have been resolved,
|
|
31
|
+
* so at least it's directly `require.resolve`able.
|
|
32
|
+
*/
|
|
33
|
+
path: string;
|
|
34
|
+
/** Whatever gets imported with `require`. */
|
|
35
|
+
module: ImportedPluginModule;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Different from `pluginModule.path`, this one is always an absolute path,
|
|
39
|
+
* used to resolve relative paths returned from lifecycles. If it's an inline
|
|
40
|
+
* plugin, it will be path to the config file.
|
|
41
|
+
*/
|
|
42
|
+
entryPath: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Reads the site config's `presets`, `themes`, and `plugins`, imports them, and
|
|
46
|
+
* normalizes the return value. Plugin configs are ordered, mostly for theme
|
|
47
|
+
* alias shadowing. Site themes have the highest priority, and preset plugins
|
|
48
|
+
* are the lowest.
|
|
49
|
+
*/
|
|
50
|
+
export declare function loadPluginConfigs(context: LoadContext): Promise<NormalizedPluginConfig[]>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
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.loadPluginConfigs = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const module_1 = require("module");
|
|
12
|
+
const import_fresh_1 = tslib_1.__importDefault(require("import-fresh"));
|
|
13
|
+
const presets_1 = require("./presets");
|
|
14
|
+
const moduleShorthand_1 = require("./moduleShorthand");
|
|
15
|
+
async function normalizePluginConfig(pluginConfig, configPath, pluginRequire) {
|
|
16
|
+
// plugins: ["./plugin"]
|
|
17
|
+
if (typeof pluginConfig === 'string') {
|
|
18
|
+
const pluginModuleImport = pluginConfig;
|
|
19
|
+
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
20
|
+
const pluginModule = (0, import_fresh_1.default)(pluginPath);
|
|
21
|
+
return {
|
|
22
|
+
plugin: pluginModule.default ?? pluginModule,
|
|
23
|
+
options: {},
|
|
24
|
+
pluginModule: {
|
|
25
|
+
path: pluginModuleImport,
|
|
26
|
+
module: pluginModule,
|
|
27
|
+
},
|
|
28
|
+
entryPath: pluginPath,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
// plugins: [() => {...}]
|
|
32
|
+
if (typeof pluginConfig === 'function') {
|
|
33
|
+
return {
|
|
34
|
+
plugin: pluginConfig,
|
|
35
|
+
options: {},
|
|
36
|
+
entryPath: configPath,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// plugins: [
|
|
40
|
+
// ["./plugin",options],
|
|
41
|
+
// ]
|
|
42
|
+
if (typeof pluginConfig[0] === 'string') {
|
|
43
|
+
const pluginModuleImport = pluginConfig[0];
|
|
44
|
+
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
45
|
+
const pluginModule = (0, import_fresh_1.default)(pluginPath);
|
|
46
|
+
return {
|
|
47
|
+
plugin: pluginModule.default ?? pluginModule,
|
|
48
|
+
options: pluginConfig[1],
|
|
49
|
+
pluginModule: {
|
|
50
|
+
path: pluginModuleImport,
|
|
51
|
+
module: pluginModule,
|
|
52
|
+
},
|
|
53
|
+
entryPath: pluginPath,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// plugins: [
|
|
57
|
+
// [() => {...}, options],
|
|
58
|
+
// ]
|
|
59
|
+
return {
|
|
60
|
+
plugin: pluginConfig[0],
|
|
61
|
+
options: pluginConfig[1],
|
|
62
|
+
entryPath: configPath,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Reads the site config's `presets`, `themes`, and `plugins`, imports them, and
|
|
67
|
+
* normalizes the return value. Plugin configs are ordered, mostly for theme
|
|
68
|
+
* alias shadowing. Site themes have the highest priority, and preset plugins
|
|
69
|
+
* are the lowest.
|
|
70
|
+
*/
|
|
71
|
+
async function loadPluginConfigs(context) {
|
|
72
|
+
const preset = await (0, presets_1.loadPresets)(context);
|
|
73
|
+
const { siteConfig, siteConfigPath } = context;
|
|
74
|
+
const pluginRequire = (0, module_1.createRequire)(siteConfigPath);
|
|
75
|
+
function normalizeShorthand(pluginConfig, pluginType) {
|
|
76
|
+
if (typeof pluginConfig === 'string') {
|
|
77
|
+
return (0, moduleShorthand_1.resolveModuleName)(pluginConfig, pluginRequire, pluginType);
|
|
78
|
+
}
|
|
79
|
+
else if (Array.isArray(pluginConfig) &&
|
|
80
|
+
typeof pluginConfig[0] === 'string') {
|
|
81
|
+
return [
|
|
82
|
+
(0, moduleShorthand_1.resolveModuleName)(pluginConfig[0], pluginRequire, pluginType),
|
|
83
|
+
pluginConfig[1] ?? {},
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
return pluginConfig;
|
|
87
|
+
}
|
|
88
|
+
preset.plugins = preset.plugins.map((plugin) => normalizeShorthand(plugin, 'plugin'));
|
|
89
|
+
preset.themes = preset.themes.map((theme) => normalizeShorthand(theme, 'theme'));
|
|
90
|
+
const standalonePlugins = siteConfig.plugins.map((plugin) => normalizeShorthand(plugin, 'plugin'));
|
|
91
|
+
const standaloneThemes = siteConfig.themes.map((theme) => normalizeShorthand(theme, 'theme'));
|
|
92
|
+
const pluginConfigs = [
|
|
93
|
+
...preset.plugins,
|
|
94
|
+
...preset.themes,
|
|
95
|
+
// Site config should be the highest priority.
|
|
96
|
+
...standalonePlugins,
|
|
97
|
+
...standaloneThemes,
|
|
98
|
+
].filter((x) => Boolean(x));
|
|
99
|
+
return Promise.all(pluginConfigs.map((pluginConfig) => normalizePluginConfig(pluginConfig, context.siteConfigPath, pluginRequire)));
|
|
100
|
+
}
|
|
101
|
+
exports.loadPluginConfigs = loadPluginConfigs;
|
|
@@ -4,15 +4,15 @@
|
|
|
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 { LoadContext,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import type { LoadContext, RouteConfig, GlobalData, LoadedPlugin } from '@docusaurus/types';
|
|
8
|
+
/**
|
|
9
|
+
* Initializes the plugins, runs `loadContent`, `translateContent`,
|
|
10
|
+
* `contentLoaded`, and `translateThemeConfig`. Because `contentLoaded` is
|
|
11
|
+
* side-effect-ful (it generates temp files), so is this function. This function
|
|
12
|
+
* would also mutate `context.siteConfig.themeConfig` to translate it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadPlugins(context: LoadContext): Promise<{
|
|
15
|
+
plugins: LoadedPlugin[];
|
|
15
16
|
pluginsRouteConfigs: RouteConfig[];
|
|
16
|
-
globalData:
|
|
17
|
-
themeConfigTranslated: ThemeConfig;
|
|
17
|
+
globalData: GlobalData;
|
|
18
18
|
}>;
|
|
@@ -6,153 +6,101 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.loadPlugins =
|
|
9
|
+
exports.loadPlugins = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const utils_1 = require("@docusaurus/utils");
|
|
12
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
12
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
13
|
+
const utils_1 = require("@docusaurus/utils");
|
|
14
|
+
const init_1 = require("./init");
|
|
15
|
+
const synthetic_1 = require("./synthetic");
|
|
18
16
|
const translations_1 = require("../translations/translations");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return -1;
|
|
28
|
-
}
|
|
29
|
-
// Higher priority get placed first.
|
|
30
|
-
if (a.priority || b.priority) {
|
|
31
|
-
const priorityA = a.priority || 0;
|
|
32
|
-
const priorityB = b.priority || 0;
|
|
33
|
-
const score = priorityB - priorityA;
|
|
34
|
-
if (score !== 0) {
|
|
35
|
-
return score;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return a.path.localeCompare(b.path);
|
|
39
|
-
});
|
|
40
|
-
routeConfigs.forEach((routeConfig) => {
|
|
41
|
-
var _a;
|
|
42
|
-
(_a = routeConfig.routes) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.path.localeCompare(b.path));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
exports.sortConfig = sortConfig;
|
|
46
|
-
async function loadPlugins({ pluginConfigs, context, }) {
|
|
17
|
+
const routeConfig_1 = require("./routeConfig");
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the plugins, runs `loadContent`, `translateContent`,
|
|
20
|
+
* `contentLoaded`, and `translateThemeConfig`. Because `contentLoaded` is
|
|
21
|
+
* side-effect-ful (it generates temp files), so is this function. This function
|
|
22
|
+
* would also mutate `context.siteConfig.themeConfig` to translate it.
|
|
23
|
+
*/
|
|
24
|
+
async function loadPlugins(context) {
|
|
47
25
|
// 1. Plugin Lifecycle - Initialization/Constructor.
|
|
48
|
-
const plugins = init_1.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const localizedTranslationFiles = await Promise.all(translationFiles.map((translationFile) => translations_1.localizePluginTranslationFile({
|
|
62
|
-
locale: context.i18n.currentLocale,
|
|
63
|
-
siteDir: context.siteDir,
|
|
26
|
+
const plugins = await (0, init_1.initPlugins)(context);
|
|
27
|
+
plugins.push((0, synthetic_1.createBootstrapPlugin)(context), (0, synthetic_1.createMDXFallbackPlugin)(context));
|
|
28
|
+
// 2. Plugin Lifecycle - loadContent.
|
|
29
|
+
// Currently plugins run lifecycle methods in parallel and are not
|
|
30
|
+
// order-dependent. We could change this in future if there are plugins which
|
|
31
|
+
// need to run in certain order or depend on others for data.
|
|
32
|
+
// This would also translate theme config and content upfront, given the
|
|
33
|
+
// translation files that the plugin declares.
|
|
34
|
+
const loadedPlugins = await Promise.all(plugins.map(async (plugin) => {
|
|
35
|
+
const content = await plugin.loadContent?.();
|
|
36
|
+
const rawTranslationFiles = (await plugin.getTranslationFiles?.({ content })) ?? [];
|
|
37
|
+
const translationFiles = await Promise.all(rawTranslationFiles.map((translationFile) => (0, translations_1.localizePluginTranslationFile)({
|
|
38
|
+
localizationDir: context.localizationDir,
|
|
64
39
|
translationFile,
|
|
65
|
-
plugin
|
|
40
|
+
plugin,
|
|
66
41
|
})));
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
42
|
+
const translatedContent = plugin.translateContent?.({ content, translationFiles }) ?? content;
|
|
43
|
+
const translatedThemeConfigSlice = plugin.translateThemeConfig?.({
|
|
44
|
+
themeConfig: context.siteConfig.themeConfig,
|
|
45
|
+
translationFiles,
|
|
46
|
+
});
|
|
47
|
+
// Side-effect to merge theme config translations. A plugin should only
|
|
48
|
+
// translate its own slice of theme config and should make no assumptions
|
|
49
|
+
// about other plugins' keys, so this is safe to run in parallel.
|
|
50
|
+
Object.assign(context.siteConfig.themeConfig, translatedThemeConfigSlice);
|
|
51
|
+
return { ...plugin, content: translatedContent };
|
|
71
52
|
}));
|
|
72
|
-
const allContent = lodash_1.chain(
|
|
73
|
-
.groupBy((item) => item.
|
|
74
|
-
.mapValues((nameItems) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.value();
|
|
79
|
-
})
|
|
53
|
+
const allContent = lodash_1.default.chain(loadedPlugins)
|
|
54
|
+
.groupBy((item) => item.name)
|
|
55
|
+
.mapValues((nameItems) => lodash_1.default.chain(nameItems)
|
|
56
|
+
.groupBy((item) => item.options.id)
|
|
57
|
+
.mapValues((idItems) => idItems[0].content)
|
|
58
|
+
.value())
|
|
80
59
|
.value();
|
|
81
60
|
// 3. Plugin Lifecycle - contentLoaded.
|
|
82
61
|
const pluginsRouteConfigs = [];
|
|
83
62
|
const globalData = {};
|
|
84
|
-
await Promise.all(
|
|
85
|
-
var _a, _b, _c;
|
|
63
|
+
await Promise.all(loadedPlugins.map(async ({ content, ...plugin }) => {
|
|
86
64
|
if (!plugin.contentLoaded) {
|
|
87
65
|
return;
|
|
88
66
|
}
|
|
89
|
-
const pluginId =
|
|
90
|
-
//
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
await fs_extra_1.default.ensureDir(path_1.default.dirname(modulePath));
|
|
97
|
-
await utils_1.generate(dataDir, name, data);
|
|
98
|
-
return modulePath;
|
|
99
|
-
};
|
|
100
|
-
// the plugins global data are namespaced to avoid data conflicts:
|
|
101
|
-
// - by plugin name
|
|
102
|
-
// - by plugin id (allow using multiple instances of the same plugin)
|
|
103
|
-
const setGlobalData = (data) => {
|
|
104
|
-
var _a;
|
|
105
|
-
globalData[plugin.name] = (_a = globalData[plugin.name]) !== null && _a !== void 0 ? _a : {};
|
|
106
|
-
globalData[plugin.name][pluginId] = data;
|
|
67
|
+
const pluginId = plugin.options.id;
|
|
68
|
+
// Plugins data files are namespaced by pluginName/pluginId
|
|
69
|
+
const dataDir = path_1.default.join(context.generatedFilesDir, plugin.name, pluginId);
|
|
70
|
+
const pluginRouteContextModulePath = path_1.default.join(dataDir, `${(0, utils_1.docuHash)('pluginRouteContextModule')}.json`);
|
|
71
|
+
const pluginRouteContext = {
|
|
72
|
+
name: plugin.name,
|
|
73
|
+
id: pluginId,
|
|
107
74
|
};
|
|
75
|
+
await (0, utils_1.generate)('/', pluginRouteContextModulePath, JSON.stringify(pluginRouteContext, null, 2));
|
|
108
76
|
const actions = {
|
|
109
|
-
addRoute
|
|
110
|
-
|
|
111
|
-
|
|
77
|
+
addRoute(initialRouteConfig) {
|
|
78
|
+
// Trailing slash behavior is handled generically for all plugins
|
|
79
|
+
const finalRouteConfig = (0, routeConfig_1.applyRouteTrailingSlash)(initialRouteConfig, context.siteConfig);
|
|
80
|
+
pluginsRouteConfigs.push({
|
|
81
|
+
...finalRouteConfig,
|
|
82
|
+
context: {
|
|
83
|
+
...(finalRouteConfig.context && { data: finalRouteConfig.context }),
|
|
84
|
+
plugin: pluginRouteContextModulePath,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
async createData(name, data) {
|
|
89
|
+
const modulePath = path_1.default.join(dataDir, name);
|
|
90
|
+
await (0, utils_1.generate)(dataDir, name, data);
|
|
91
|
+
return modulePath;
|
|
92
|
+
},
|
|
93
|
+
setGlobalData(data) {
|
|
94
|
+
var _a;
|
|
95
|
+
globalData[_a = plugin.name] ?? (globalData[_a] = {});
|
|
96
|
+
globalData[plugin.name][pluginId] = data;
|
|
97
|
+
},
|
|
112
98
|
};
|
|
113
|
-
|
|
114
|
-
await plugin.contentLoaded({
|
|
115
|
-
content: translatedContent,
|
|
116
|
-
actions,
|
|
117
|
-
allContent,
|
|
118
|
-
});
|
|
119
|
-
}));
|
|
120
|
-
// 4. Plugin Lifecycle - routesLoaded.
|
|
121
|
-
// Currently plugins run lifecycle methods in parallel and are not order-dependent.
|
|
122
|
-
// We could change this in future if there are plugins which need to
|
|
123
|
-
// run in certain order or depend on others for data.
|
|
124
|
-
await Promise.all(contentLoadedTranslatedPlugins.map(async ({ plugin }) => {
|
|
125
|
-
if (!plugin.routesLoaded) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
// TODO remove this deprecated lifecycle soon
|
|
129
|
-
// deprecated since alpha-60
|
|
130
|
-
// TODO, 1 user reported usage of this lifecycle! https://github.com/facebook/docusaurus/issues/3918
|
|
131
|
-
console.error(chalk_1.default.red('plugin routesLoaded lifecycle is deprecated. If you think we should keep this lifecycle, please report here: https://github.com/facebook/docusaurus/issues/3918'));
|
|
132
|
-
return plugin.routesLoaded(pluginsRouteConfigs);
|
|
99
|
+
await plugin.contentLoaded({ content, actions, allContent });
|
|
133
100
|
}));
|
|
134
101
|
// Sort the route config. This ensures that route with nested
|
|
135
102
|
// routes are always placed last.
|
|
136
|
-
sortConfig(pluginsRouteConfigs);
|
|
137
|
-
|
|
138
|
-
function translateThemeConfig(untranslatedThemeConfig) {
|
|
139
|
-
return contentLoadedTranslatedPlugins.reduce((currentThemeConfig, { plugin, translationFiles }) => {
|
|
140
|
-
var _a;
|
|
141
|
-
const translatedThemeConfigSlice = (_a = plugin.translateThemeConfig) === null || _a === void 0 ? void 0 : _a.call(plugin, {
|
|
142
|
-
themeConfig: currentThemeConfig,
|
|
143
|
-
translationFiles,
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
...currentThemeConfig,
|
|
147
|
-
...translatedThemeConfigSlice,
|
|
148
|
-
};
|
|
149
|
-
}, untranslatedThemeConfig);
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
plugins,
|
|
153
|
-
pluginsRouteConfigs,
|
|
154
|
-
globalData,
|
|
155
|
-
themeConfigTranslated: translateThemeConfig(context.siteConfig.themeConfig),
|
|
156
|
-
};
|
|
103
|
+
(0, routeConfig_1.sortConfig)(pluginsRouteConfigs, context.siteConfig.baseUrl);
|
|
104
|
+
return { plugins: loadedPlugins, pluginsRouteConfigs, globalData };
|
|
157
105
|
}
|
|
158
106
|
exports.loadPlugins = loadPlugins;
|
|
@@ -4,12 +4,9 @@
|
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
pluginConfigs: PluginConfig[];
|
|
14
|
-
context: LoadContext;
|
|
15
|
-
}): InitPlugin[];
|
|
7
|
+
import type { LoadContext, InitializedPlugin } from '@docusaurus/types';
|
|
8
|
+
/**
|
|
9
|
+
* Runs the plugin constructors and returns their return values. It would load
|
|
10
|
+
* plugin configs from `plugins`, `themes`, and `presets`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function initPlugins(context: LoadContext): Promise<InitializedPlugin[]>;
|
|
@@ -6,102 +6,46 @@
|
|
|
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 = void 0;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
10
|
-
const module_1 =
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const versions_1 = require("../versions");
|
|
14
|
-
const pluginIds_1 = require("./pluginIds");
|
|
11
|
+
const module_1 = require("module");
|
|
12
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
13
|
+
const utils_1 = require("@docusaurus/utils");
|
|
15
14
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (typeof pluginConfig === 'string') {
|
|
20
|
-
const pluginModuleImport = pluginConfig;
|
|
21
|
-
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
22
|
-
const pluginModule = import_fresh_1.default(pluginPath);
|
|
23
|
-
return {
|
|
24
|
-
plugin: (_a = pluginModule === null || pluginModule === void 0 ? void 0 : pluginModule.default) !== null && _a !== void 0 ? _a : pluginModule,
|
|
25
|
-
options: {},
|
|
26
|
-
pluginModule: {
|
|
27
|
-
path: pluginModuleImport,
|
|
28
|
-
module: pluginModule,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
// plugins: [function plugin() { }]
|
|
33
|
-
if (typeof pluginConfig === 'function') {
|
|
34
|
-
return {
|
|
35
|
-
plugin: pluginConfig,
|
|
36
|
-
options: {},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(pluginConfig)) {
|
|
40
|
-
// plugins: [
|
|
41
|
-
// ['./plugin',options],
|
|
42
|
-
// ]
|
|
43
|
-
if (typeof pluginConfig[0] === 'string') {
|
|
44
|
-
const pluginModuleImport = pluginConfig[0];
|
|
45
|
-
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
46
|
-
const pluginModule = import_fresh_1.default(pluginPath);
|
|
47
|
-
return {
|
|
48
|
-
plugin: (_b = pluginModule === null || pluginModule === void 0 ? void 0 : pluginModule.default) !== null && _b !== void 0 ? _b : pluginModule,
|
|
49
|
-
options: (_c = pluginConfig[1]) !== null && _c !== void 0 ? _c : {},
|
|
50
|
-
pluginModule: {
|
|
51
|
-
path: pluginModuleImport,
|
|
52
|
-
module: pluginModule,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
// plugins: [
|
|
57
|
-
// [function plugin() { },options],
|
|
58
|
-
// ]
|
|
59
|
-
if (typeof pluginConfig[0] === 'function') {
|
|
60
|
-
return {
|
|
61
|
-
plugin: pluginConfig[0],
|
|
62
|
-
options: (_d = pluginConfig[1]) !== null && _d !== void 0 ? _d : {},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
throw new Error(`Unexpected: cant load plugin for plugin config = ${JSON.stringify(pluginConfig)}`);
|
|
67
|
-
}
|
|
15
|
+
const siteMetadata_1 = require("../siteMetadata");
|
|
16
|
+
const pluginIds_1 = require("./pluginIds");
|
|
17
|
+
const configs_1 = require("./configs");
|
|
68
18
|
function getOptionValidationFunction(normalizedPluginConfig) {
|
|
69
|
-
var _a, _b, _c, _d;
|
|
70
19
|
if (normalizedPluginConfig.pluginModule) {
|
|
71
|
-
//
|
|
72
|
-
return (
|
|
73
|
-
|
|
74
|
-
else {
|
|
75
|
-
return normalizedPluginConfig.plugin.validateOptions;
|
|
20
|
+
// Support both CommonJS and ES modules
|
|
21
|
+
return (normalizedPluginConfig.pluginModule.module.default?.validateOptions ??
|
|
22
|
+
normalizedPluginConfig.pluginModule.module.validateOptions);
|
|
76
23
|
}
|
|
24
|
+
return normalizedPluginConfig.plugin.validateOptions;
|
|
77
25
|
}
|
|
78
26
|
function getThemeValidationFunction(normalizedPluginConfig) {
|
|
79
|
-
var _a, _b;
|
|
80
27
|
if (normalizedPluginConfig.pluginModule) {
|
|
81
|
-
//
|
|
82
|
-
return (
|
|
83
|
-
|
|
84
|
-
else {
|
|
85
|
-
return normalizedPluginConfig.plugin.validateThemeConfig;
|
|
28
|
+
// Support both CommonJS and ES modules
|
|
29
|
+
return (normalizedPluginConfig.pluginModule.module.default?.validateThemeConfig ??
|
|
30
|
+
normalizedPluginConfig.pluginModule.module.validateThemeConfig);
|
|
86
31
|
}
|
|
32
|
+
return normalizedPluginConfig.plugin.validateThemeConfig;
|
|
87
33
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
const pluginPath = pluginRequire.resolve(
|
|
100
|
-
return
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return { type: 'local' };
|
|
34
|
+
/**
|
|
35
|
+
* Runs the plugin constructors and returns their return values. It would load
|
|
36
|
+
* plugin configs from `plugins`, `themes`, and `presets`.
|
|
37
|
+
*/
|
|
38
|
+
async function initPlugins(context) {
|
|
39
|
+
// We need to resolve plugins from the perspective of the site config, as if
|
|
40
|
+
// we are using `require.resolve` on those module names.
|
|
41
|
+
const pluginRequire = (0, module_1.createRequire)(context.siteConfigPath);
|
|
42
|
+
const pluginConfigs = await (0, configs_1.loadPluginConfigs)(context);
|
|
43
|
+
async function doGetPluginVersion(normalizedPluginConfig) {
|
|
44
|
+
if (normalizedPluginConfig.pluginModule?.path) {
|
|
45
|
+
const pluginPath = pluginRequire.resolve(normalizedPluginConfig.pluginModule.path);
|
|
46
|
+
return (0, siteMetadata_1.getPluginVersion)(pluginPath, context.siteDir);
|
|
104
47
|
}
|
|
48
|
+
return { type: 'local' };
|
|
105
49
|
}
|
|
106
50
|
function doValidateThemeConfig(normalizedPluginConfig) {
|
|
107
51
|
const validateThemeConfig = getThemeValidationFunction(normalizedPluginConfig);
|
|
@@ -111,12 +55,9 @@ function initPlugins({ pluginConfigs, context, }) {
|
|
|
111
55
|
themeConfig: context.siteConfig.themeConfig,
|
|
112
56
|
});
|
|
113
57
|
}
|
|
114
|
-
|
|
115
|
-
return context.siteConfig.themeConfig;
|
|
116
|
-
}
|
|
58
|
+
return context.siteConfig.themeConfig;
|
|
117
59
|
}
|
|
118
60
|
function doValidatePluginOptions(normalizedPluginConfig) {
|
|
119
|
-
var _a;
|
|
120
61
|
const validateOptions = getOptionValidationFunction(normalizedPluginConfig);
|
|
121
62
|
if (validateOptions) {
|
|
122
63
|
return validateOptions({
|
|
@@ -124,37 +65,31 @@ function initPlugins({ pluginConfigs, context, }) {
|
|
|
124
65
|
options: normalizedPluginConfig.options,
|
|
125
66
|
});
|
|
126
67
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
};
|
|
134
|
-
}
|
|
68
|
+
// Important to ensure all plugins have an id
|
|
69
|
+
// as we don't go through the Joi schema that adds it
|
|
70
|
+
return {
|
|
71
|
+
...normalizedPluginConfig.options,
|
|
72
|
+
id: normalizedPluginConfig.options.id ?? utils_1.DEFAULT_PLUGIN_ID,
|
|
73
|
+
};
|
|
135
74
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (!pluginConfig) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
const normalizedPluginConfig = normalizePluginConfig(pluginConfig, pluginRequire);
|
|
142
|
-
const pluginVersion = doGetPluginVersion(normalizedPluginConfig);
|
|
75
|
+
async function initializePlugin(normalizedPluginConfig) {
|
|
76
|
+
const pluginVersion = await doGetPluginVersion(normalizedPluginConfig);
|
|
143
77
|
const pluginOptions = doValidatePluginOptions(normalizedPluginConfig);
|
|
144
78
|
// Side-effect: merge the normalized theme config in the original one
|
|
145
79
|
context.siteConfig.themeConfig = {
|
|
146
80
|
...context.siteConfig.themeConfig,
|
|
147
81
|
...doValidateThemeConfig(normalizedPluginConfig),
|
|
148
82
|
};
|
|
149
|
-
const pluginInstance = normalizedPluginConfig.plugin(context, pluginOptions);
|
|
83
|
+
const pluginInstance = await normalizedPluginConfig.plugin(context, pluginOptions);
|
|
150
84
|
return {
|
|
151
85
|
...pluginInstance,
|
|
152
86
|
options: pluginOptions,
|
|
153
87
|
version: pluginVersion,
|
|
88
|
+
path: path_1.default.dirname(normalizedPluginConfig.entryPath),
|
|
154
89
|
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
pluginIds_1.ensureUniquePluginInstanceIds(plugins);
|
|
90
|
+
}
|
|
91
|
+
const plugins = await Promise.all(pluginConfigs.map(initializePlugin));
|
|
92
|
+
(0, pluginIds_1.ensureUniquePluginInstanceIds)(plugins);
|
|
158
93
|
return plugins;
|
|
159
94
|
}
|
|
160
|
-
exports.
|
|
95
|
+
exports.initPlugins = initPlugins;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/// <reference types="node" />
|
|
8
|
+
export declare function getNamePatterns(moduleName: string, moduleType: 'preset' | 'theme' | 'plugin'): string[];
|
|
9
|
+
export declare function resolveModuleName(moduleName: string, moduleRequire: NodeRequire, moduleType: 'preset' | 'theme' | 'plugin'): string;
|