@docusaurus/core 3.3.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/docusaurus.mjs +13 -12
- 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/clientEntry.js +7 -3
- 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/Link.js +26 -5
- package/lib/client/exports/Translate.d.ts +0 -2
- package/lib/client/exports/useBaseUrl.d.ts +8 -1
- package/lib/client/exports/useBaseUrl.js +11 -3
- 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 +36 -23
- 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 +16 -6
- package/lib/commands/start/start.js +1 -2
- package/lib/commands/start/utils.d.ts +3 -2
- package/lib/commands/start/utils.js +9 -5
- package/lib/commands/start/watcher.js +5 -6
- package/lib/commands/start/webpack.js +4 -5
- 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 +19 -8
- 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 +10 -3
- package/lib/server/clientModules.js +1 -2
- package/lib/server/codegen/codegen.d.ts +2 -1
- package/lib/server/codegen/codegen.js +5 -2
- package/lib/server/codegen/codegenRoutes.d.ts +1 -0
- package/lib/server/codegen/codegenRoutes.js +22 -9
- package/lib/server/config.js +1 -2
- package/lib/server/configValidation.d.ts +4 -1
- package/lib/server/configValidation.js +30 -2
- package/lib/server/getHostPort.js +1 -2
- package/lib/server/htmlTags.d.ts +5 -2
- package/lib/server/htmlTags.js +16 -8
- package/lib/server/i18n.js +39 -11
- package/lib/server/plugins/actions.js +1 -2
- package/lib/server/plugins/configs.js +1 -2
- package/lib/server/plugins/init.d.ts +11 -0
- package/lib/server/plugins/init.js +42 -7
- 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 +17 -10
- package/lib/server/siteMetadata.js +3 -4
- package/lib/server/storage.d.ts +13 -0
- package/lib/server/storage.js +35 -0
- 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 +4 -1
- package/lib/ssg.js +10 -3
- package/lib/templates/templates.d.ts +3 -0
- package/lib/templates/templates.js +27 -3
- package/lib/webpack/aliases/index.js +4 -5
- package/lib/webpack/base.js +4 -4
- package/lib/webpack/client.js +13 -22
- package/lib/webpack/configure.d.ts +25 -0
- package/lib/webpack/configure.js +99 -0
- package/lib/webpack/minification.js +1 -2
- package/lib/webpack/plugins/ForceTerminatePlugin.d.ts +10 -0
- package/lib/webpack/plugins/ForceTerminatePlugin.js +25 -0
- package/lib/webpack/plugins/StaticDirectoriesCopyPlugin.d.ts +11 -0
- package/lib/webpack/plugins/StaticDirectoriesCopyPlugin.js +38 -0
- package/lib/webpack/server.js +1 -29
- package/lib/webpack/utils.d.ts +1 -24
- package/lib/webpack/utils.js +8 -87
- package/package.json +10 -10
|
@@ -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");
|
|
@@ -21,6 +24,7 @@ const translations_1 = require("./translations/translations");
|
|
|
21
24
|
const utils_2 = require("../utils");
|
|
22
25
|
const codegen_1 = require("./codegen/codegen");
|
|
23
26
|
const routes_1 = require("./routes");
|
|
27
|
+
const storage_1 = require("./storage");
|
|
24
28
|
/**
|
|
25
29
|
* Loading context is the very first step in site building. Its params are
|
|
26
30
|
* directly acquired from CLI options. It mainly loads `siteConfig` and the i18n
|
|
@@ -53,9 +57,11 @@ async function loadContext(params) {
|
|
|
53
57
|
const localizationDir = path_1.default.resolve(siteDir, i18n.path, i18n.localeConfigs[i18n.currentLocale].path);
|
|
54
58
|
const siteConfig = { ...initialSiteConfig, baseUrl };
|
|
55
59
|
const codeTranslations = await (0, translations_1.loadSiteCodeTranslations)({ localizationDir });
|
|
60
|
+
const siteStorage = (0, storage_1.createSiteStorage)(siteConfig);
|
|
56
61
|
return {
|
|
57
62
|
siteDir,
|
|
58
63
|
siteVersion,
|
|
64
|
+
siteStorage,
|
|
59
65
|
generatedFilesDir,
|
|
60
66
|
localizationDir,
|
|
61
67
|
siteConfig,
|
|
@@ -66,11 +72,13 @@ async function loadContext(params) {
|
|
|
66
72
|
codeTranslations,
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
|
-
exports.loadContext = loadContext;
|
|
70
75
|
function createSiteProps(params) {
|
|
71
76
|
const { plugins, routes, context } = params;
|
|
72
|
-
const { generatedFilesDir, siteDir, siteVersion, siteConfig, siteConfigPath, outDir, baseUrl, i18n, localizationDir, codeTranslations: siteCodeTranslations, } = context;
|
|
73
|
-
const { headTags, preBodyTags, postBodyTags } = (0, htmlTags_1.loadHtmlTags)(
|
|
77
|
+
const { generatedFilesDir, siteDir, siteVersion, siteConfig, siteConfigPath, siteStorage, outDir, baseUrl, i18n, localizationDir, codeTranslations: siteCodeTranslations, } = context;
|
|
78
|
+
const { headTags, preBodyTags, postBodyTags } = (0, htmlTags_1.loadHtmlTags)({
|
|
79
|
+
plugins,
|
|
80
|
+
router: siteConfig.future.experimental_router,
|
|
81
|
+
});
|
|
74
82
|
const siteMetadata = (0, siteMetadata_1.createSiteMetadata)({ plugins, siteVersion });
|
|
75
83
|
const codeTranslations = {
|
|
76
84
|
...(0, translations_1.getPluginsDefaultCodeTranslations)({ plugins }),
|
|
@@ -83,6 +91,7 @@ function createSiteProps(params) {
|
|
|
83
91
|
siteConfigPath,
|
|
84
92
|
siteMetadata,
|
|
85
93
|
siteVersion,
|
|
94
|
+
siteStorage,
|
|
86
95
|
siteDir,
|
|
87
96
|
outDir,
|
|
88
97
|
baseUrl,
|
|
@@ -101,13 +110,14 @@ function createSiteProps(params) {
|
|
|
101
110
|
// TODO global data should be part of site props?
|
|
102
111
|
async function createSiteFiles({ site, globalData, }) {
|
|
103
112
|
return utils_2.PerfLogger.async('Create site files', async () => {
|
|
104
|
-
const { props: { plugins, generatedFilesDir, siteConfig, siteMetadata, i18n, codeTranslations, routes, baseUrl, }, } = site;
|
|
113
|
+
const { props: { plugins, generatedFilesDir, siteConfig, siteMetadata, siteStorage, i18n, codeTranslations, routes, baseUrl, }, } = site;
|
|
105
114
|
const clientModules = (0, clientModules_1.getAllClientModules)(plugins);
|
|
106
115
|
await (0, codegen_1.generateSiteFiles)({
|
|
107
116
|
generatedFilesDir,
|
|
108
117
|
clientModules,
|
|
109
118
|
siteConfig,
|
|
110
119
|
siteMetadata,
|
|
120
|
+
siteStorage,
|
|
111
121
|
i18n,
|
|
112
122
|
codeTranslations,
|
|
113
123
|
globalData,
|
|
@@ -125,7 +135,7 @@ async function createSiteFiles({ site, globalData, }) {
|
|
|
125
135
|
async function loadSite(params) {
|
|
126
136
|
const context = await utils_2.PerfLogger.async('Load context', () => loadContext(params));
|
|
127
137
|
const { plugins, routes, globalData } = await (0, plugins_1.loadPlugins)(context);
|
|
128
|
-
const props =
|
|
138
|
+
const props = createSiteProps({ plugins, routes, globalData, context });
|
|
129
139
|
const site = { props, params };
|
|
130
140
|
await createSiteFiles({
|
|
131
141
|
site,
|
|
@@ -133,21 +143,19 @@ async function loadSite(params) {
|
|
|
133
143
|
});
|
|
134
144
|
return site;
|
|
135
145
|
}
|
|
136
|
-
exports.loadSite = loadSite;
|
|
137
146
|
async function reloadSite(site) {
|
|
138
147
|
// TODO this can be optimized, for example:
|
|
139
148
|
// - plugins loading same data as before should not recreate routes/bundles
|
|
140
149
|
// - codegen does not need to re-run if nothing changed
|
|
141
150
|
return loadSite(site.params);
|
|
142
151
|
}
|
|
143
|
-
exports.reloadSite = reloadSite;
|
|
144
152
|
async function reloadSitePlugin(site, pluginIdentifier) {
|
|
145
153
|
const { plugins, routes, globalData } = await (0, plugins_1.reloadPlugin)({
|
|
146
154
|
pluginIdentifier,
|
|
147
155
|
plugins: site.props.plugins,
|
|
148
156
|
context: site.props,
|
|
149
157
|
});
|
|
150
|
-
const newProps =
|
|
158
|
+
const newProps = createSiteProps({
|
|
151
159
|
plugins,
|
|
152
160
|
routes,
|
|
153
161
|
globalData,
|
|
@@ -161,4 +169,3 @@ async function reloadSitePlugin(site, pluginIdentifier) {
|
|
|
161
169
|
await createSiteFiles({ site: newSite, globalData });
|
|
162
170
|
return newSite;
|
|
163
171
|
}
|
|
164
|
-
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { DocusaurusConfig, SiteStorage } from '@docusaurus/types';
|
|
8
|
+
type PartialFuture = Pick<DocusaurusConfig['future'], 'experimental_storage'>;
|
|
9
|
+
type PartialConfig = Pick<DocusaurusConfig, 'url' | 'baseUrl'> & {
|
|
10
|
+
future: PartialFuture;
|
|
11
|
+
};
|
|
12
|
+
export declare function createSiteStorage(config: PartialConfig): SiteStorage;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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.createSiteStorage = createSiteStorage;
|
|
10
|
+
const utils_1 = require("@docusaurus/utils");
|
|
11
|
+
const utils_common_1 = require("@docusaurus/utils-common");
|
|
12
|
+
function automaticNamespace(config) {
|
|
13
|
+
const normalizedUrl = (0, utils_common_1.addTrailingSlash)((0, utils_1.normalizeUrl)([config.url, config.baseUrl]));
|
|
14
|
+
return (0, utils_1.simpleHash)(normalizedUrl, 3);
|
|
15
|
+
}
|
|
16
|
+
function getNamespaceString(config) {
|
|
17
|
+
if (config.future.experimental_storage.namespace === true) {
|
|
18
|
+
return automaticNamespace(config);
|
|
19
|
+
}
|
|
20
|
+
else if (config.future.experimental_storage.namespace === false) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return config.future.experimental_storage.namespace;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function createSiteStorage(config) {
|
|
28
|
+
const { type } = config.future.experimental_storage;
|
|
29
|
+
const namespaceString = getNamespaceString(config);
|
|
30
|
+
const namespace = namespaceString ? `-${namespaceString}` : '';
|
|
31
|
+
return {
|
|
32
|
+
type,
|
|
33
|
+
namespace,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -6,7 +6,15 @@
|
|
|
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.readCodeTranslationFileContent = readCodeTranslationFileContent;
|
|
10
|
+
exports.writeCodeTranslations = writeCodeTranslations;
|
|
11
|
+
exports.writePluginTranslations = writePluginTranslations;
|
|
12
|
+
exports.localizePluginTranslationFile = localizePluginTranslationFile;
|
|
13
|
+
exports.mergeCodeTranslations = mergeCodeTranslations;
|
|
14
|
+
exports.loadPluginsDefaultCodeTranslationMessages = loadPluginsDefaultCodeTranslationMessages;
|
|
15
|
+
exports.getPluginsDefaultCodeTranslations = getPluginsDefaultCodeTranslations;
|
|
16
|
+
exports.applyDefaultCodeTranslations = applyDefaultCodeTranslations;
|
|
17
|
+
exports.loadSiteCodeTranslations = loadSiteCodeTranslations;
|
|
10
18
|
const tslib_1 = require("tslib");
|
|
11
19
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
20
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
@@ -85,7 +93,6 @@ function getCodeTranslationsFilePath(context) {
|
|
|
85
93
|
async function readCodeTranslationFileContent(context) {
|
|
86
94
|
return readTranslationFileContent(getCodeTranslationsFilePath(context));
|
|
87
95
|
}
|
|
88
|
-
exports.readCodeTranslationFileContent = readCodeTranslationFileContent;
|
|
89
96
|
async function writeCodeTranslations(context, content, options) {
|
|
90
97
|
return writeTranslationFileContent({
|
|
91
98
|
filePath: getCodeTranslationsFilePath(context),
|
|
@@ -93,7 +100,6 @@ async function writeCodeTranslations(context, content, options) {
|
|
|
93
100
|
options,
|
|
94
101
|
});
|
|
95
102
|
}
|
|
96
|
-
exports.writeCodeTranslations = writeCodeTranslations;
|
|
97
103
|
// We ask users to not provide any extension on purpose:
|
|
98
104
|
// maybe some day we'll want to support multiple FS formats?
|
|
99
105
|
// (json/yaml/toml/xml...)
|
|
@@ -124,7 +130,6 @@ async function writePluginTranslations({ localizationDir, plugin, translationFil
|
|
|
124
130
|
options,
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
|
-
exports.writePluginTranslations = writePluginTranslations;
|
|
128
133
|
async function localizePluginTranslationFile({ localizationDir, plugin, translationFile, }) {
|
|
129
134
|
const filePath = getPluginTranslationFilePath({
|
|
130
135
|
plugin,
|
|
@@ -144,23 +149,19 @@ async function localizePluginTranslationFile({ localizationDir, plugin, translat
|
|
|
144
149
|
}
|
|
145
150
|
return translationFile;
|
|
146
151
|
}
|
|
147
|
-
exports.localizePluginTranslationFile = localizePluginTranslationFile;
|
|
148
152
|
function mergeCodeTranslations(codeTranslations) {
|
|
149
153
|
return codeTranslations.reduce((allCodeTranslations, current) => ({
|
|
150
154
|
...allCodeTranslations,
|
|
151
155
|
...current,
|
|
152
156
|
}), {});
|
|
153
157
|
}
|
|
154
|
-
exports.mergeCodeTranslations = mergeCodeTranslations;
|
|
155
158
|
async function loadPluginsDefaultCodeTranslationMessages(plugins) {
|
|
156
159
|
const pluginsMessages = await Promise.all(plugins.map((plugin) => plugin.getDefaultCodeTranslationMessages?.() ?? {}));
|
|
157
160
|
return mergeCodeTranslations(pluginsMessages);
|
|
158
161
|
}
|
|
159
|
-
exports.loadPluginsDefaultCodeTranslationMessages = loadPluginsDefaultCodeTranslationMessages;
|
|
160
162
|
function getPluginsDefaultCodeTranslations({ plugins, }) {
|
|
161
163
|
return mergeCodeTranslations(plugins.map((p) => p.defaultCodeTranslations));
|
|
162
164
|
}
|
|
163
|
-
exports.getPluginsDefaultCodeTranslations = getPluginsDefaultCodeTranslations;
|
|
164
165
|
function applyDefaultCodeTranslations({ extractedCodeTranslations, defaultCodeMessages, }) {
|
|
165
166
|
const unusedDefaultCodeMessages = lodash_1.default.difference(Object.keys(defaultCodeMessages), Object.keys(extractedCodeTranslations));
|
|
166
167
|
if (unusedDefaultCodeMessages.length > 0) {
|
|
@@ -172,10 +173,8 @@ Please report this Docusaurus issue. name=${unusedDefaultCodeMessages}`;
|
|
|
172
173
|
message: defaultCodeMessages[messageId] ?? messageTranslation.message,
|
|
173
174
|
}));
|
|
174
175
|
}
|
|
175
|
-
exports.applyDefaultCodeTranslations = applyDefaultCodeTranslations;
|
|
176
176
|
async function loadSiteCodeTranslations({ localizationDir, }) {
|
|
177
177
|
const codeTranslationFileContent = (await readCodeTranslationFileContent({ localizationDir })) ?? {};
|
|
178
178
|
// We only need key->message for code translations
|
|
179
179
|
return lodash_1.default.mapValues(codeTranslationFileContent, (value) => value.message);
|
|
180
180
|
}
|
|
181
|
-
exports.loadSiteCodeTranslations = loadSiteCodeTranslations;
|
|
@@ -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.globSourceCodeFilePaths = globSourceCodeFilePaths;
|
|
10
|
+
exports.extractSiteSourceCodeTranslations = extractSiteSourceCodeTranslations;
|
|
11
|
+
exports.extractAllSourceCodeFileTranslations = extractAllSourceCodeFileTranslations;
|
|
12
|
+
exports.extractSourceCodeFileTranslations = extractSourceCodeFileTranslations;
|
|
10
13
|
const tslib_1 = require("tslib");
|
|
11
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
15
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
@@ -50,7 +53,6 @@ async function globSourceCodeFilePaths(dirPaths) {
|
|
|
50
53
|
const filePaths = await (0, utils_2.safeGlobby)(dirPaths);
|
|
51
54
|
return filePaths.filter(isTranslatableSourceCodePath);
|
|
52
55
|
}
|
|
53
|
-
exports.globSourceCodeFilePaths = globSourceCodeFilePaths;
|
|
54
56
|
async function getSourceCodeFilePaths(siteDir, plugins) {
|
|
55
57
|
const sitePaths = getSiteSourceCodeFilePaths(siteDir);
|
|
56
58
|
// The getPathsToWatch() generally returns the js/jsx/ts/tsx/md/mdx file paths
|
|
@@ -76,7 +78,6 @@ async function extractSiteSourceCodeTranslations(siteDir, plugins, babelOptions,
|
|
|
76
78
|
logSourceCodeFileTranslationsWarnings(sourceCodeFilesTranslations);
|
|
77
79
|
return toTranslationFileContent(sourceCodeFilesTranslations);
|
|
78
80
|
}
|
|
79
|
-
exports.extractSiteSourceCodeTranslations = extractSiteSourceCodeTranslations;
|
|
80
81
|
function logSourceCodeFileTranslationsWarnings(sourceCodeFilesTranslations) {
|
|
81
82
|
sourceCodeFilesTranslations.forEach(({ sourceCodeFilePath, warnings }) => {
|
|
82
83
|
if (warnings.length > 0) {
|
|
@@ -87,7 +88,6 @@ function logSourceCodeFileTranslationsWarnings(sourceCodeFilesTranslations) {
|
|
|
87
88
|
async function extractAllSourceCodeFileTranslations(sourceCodeFilePaths, babelOptions) {
|
|
88
89
|
return Promise.all(sourceCodeFilePaths.flatMap((sourceFilePath) => extractSourceCodeFileTranslations(sourceFilePath, babelOptions)));
|
|
89
90
|
}
|
|
90
|
-
exports.extractAllSourceCodeFileTranslations = extractAllSourceCodeFileTranslations;
|
|
91
91
|
async function extractSourceCodeFileTranslations(sourceCodeFilePath, babelOptions) {
|
|
92
92
|
try {
|
|
93
93
|
const code = await fs_extra_1.default.readFile(sourceCodeFilePath, 'utf8');
|
|
@@ -107,7 +107,6 @@ async function extractSourceCodeFileTranslations(sourceCodeFilePath, babelOption
|
|
|
107
107
|
throw err;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
exports.extractSourceCodeFileTranslations = extractSourceCodeFileTranslations;
|
|
111
110
|
/*
|
|
112
111
|
Need help understanding this?
|
|
113
112
|
|
package/lib/server/utils.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.safeGlobby =
|
|
9
|
+
exports.safeGlobby = safeGlobby;
|
|
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");
|
|
@@ -18,4 +18,3 @@ async function safeGlobby(patterns, options) {
|
|
|
18
18
|
const globPaths = patterns.map((dirPath) => (0, utils_1.posixPath)(path_1.default.relative(process.cwd(), dirPath)));
|
|
19
19
|
return (0, utils_1.Globby)(globPaths, options);
|
|
20
20
|
}
|
|
21
|
-
exports.safeGlobby = safeGlobby;
|
package/lib/ssg.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
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 path="../src/deps.d.ts" />
|
|
8
7
|
import type { AppRenderer, SiteCollectedData } from './common';
|
|
9
8
|
import type { Manifest } from 'react-loadable-ssr-addon-v5-slorber';
|
|
10
9
|
import type { SSRTemplateCompiled } from './templates/templates';
|
|
@@ -30,3 +29,7 @@ export declare function generateStaticFiles({ pathnames, renderer, params, }: {
|
|
|
30
29
|
}): Promise<{
|
|
31
30
|
collectedData: SiteCollectedData;
|
|
32
31
|
}>;
|
|
32
|
+
export declare function generateHashRouterEntrypoint({ content, params, }: {
|
|
33
|
+
content: string;
|
|
34
|
+
params: SSGParams;
|
|
35
|
+
}): Promise<void>;
|
package/lib/ssg.js
CHANGED
|
@@ -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.loadAppRenderer = loadAppRenderer;
|
|
10
|
+
exports.generateStaticFiles = generateStaticFiles;
|
|
11
|
+
exports.generateHashRouterEntrypoint = generateHashRouterEntrypoint;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
14
|
const module_1 = require("module");
|
|
@@ -49,7 +51,6 @@ async function loadAppRenderer({ serverBundlePath, }) {
|
|
|
49
51
|
}
|
|
50
52
|
return serverEntry.default;
|
|
51
53
|
}
|
|
52
|
-
exports.loadAppRenderer = loadAppRenderer;
|
|
53
54
|
function pathnameToFilename({ pathname, trailingSlash, }) {
|
|
54
55
|
const outputFileName = pathname.replace(/^[/\\]/, ''); // Remove leading slashes for webpack-dev-server
|
|
55
56
|
// Paths ending with .html are left untouched
|
|
@@ -92,7 +93,6 @@ async function generateStaticFiles({ pathnames, renderer, params, }) {
|
|
|
92
93
|
.value();
|
|
93
94
|
return { collectedData };
|
|
94
95
|
}
|
|
95
|
-
exports.generateStaticFiles = generateStaticFiles;
|
|
96
96
|
async function generateStaticFile({ pathname, renderer, params, }) {
|
|
97
97
|
try {
|
|
98
98
|
// This only renders the app HTML
|
|
@@ -133,6 +133,13 @@ It might also require to wrap your client code in ${logger_1.default.code('useEf
|
|
|
133
133
|
}
|
|
134
134
|
return parts.join('\n');
|
|
135
135
|
}
|
|
136
|
+
async function generateHashRouterEntrypoint({ content, params, }) {
|
|
137
|
+
await writeStaticFile({
|
|
138
|
+
pathname: '/',
|
|
139
|
+
content,
|
|
140
|
+
params,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
136
143
|
async function writeStaticFile({ content, pathname, params, }) {
|
|
137
144
|
function removeBaseUrl(p, baseUrl) {
|
|
138
145
|
return baseUrl === '/' ? p : p.replace(new RegExp(`^${baseUrl}`), '/');
|
|
@@ -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.compileSSRTemplate = compileSSRTemplate;
|
|
10
|
+
exports.renderSSRTemplate = renderSSRTemplate;
|
|
11
|
+
exports.renderHashRouterTemplate = renderHashRouterTemplate;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const eta = tslib_1.__importStar(require("eta"));
|
|
12
14
|
const react_loadable_ssr_addon_v5_slorber_1 = require("react-loadable-ssr-addon-v5-slorber");
|
|
@@ -16,7 +18,6 @@ async function compileSSRTemplate(template) {
|
|
|
16
18
|
});
|
|
17
19
|
return (data) => compiledTemplate(data, eta.defaultConfig);
|
|
18
20
|
}
|
|
19
|
-
exports.compileSSRTemplate = compileSSRTemplate;
|
|
20
21
|
/**
|
|
21
22
|
* Given a list of modules that were SSR an d
|
|
22
23
|
* @param modules
|
|
@@ -60,4 +61,27 @@ function renderSSRTemplate({ params, result, }) {
|
|
|
60
61
|
};
|
|
61
62
|
return ssrTemplate(data);
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
function renderHashRouterTemplate({ params, }) {
|
|
65
|
+
const {
|
|
66
|
+
// baseUrl,
|
|
67
|
+
headTags, preBodyTags, postBodyTags, manifest, DOCUSAURUS_VERSION, ssrTemplate, } = params;
|
|
68
|
+
const { scripts, stylesheets } = getScriptsAndStylesheets({
|
|
69
|
+
manifest,
|
|
70
|
+
modules: [],
|
|
71
|
+
});
|
|
72
|
+
const data = {
|
|
73
|
+
appHtml: '',
|
|
74
|
+
baseUrl: './',
|
|
75
|
+
htmlAttributes: '',
|
|
76
|
+
bodyAttributes: '',
|
|
77
|
+
headTags,
|
|
78
|
+
preBodyTags,
|
|
79
|
+
postBodyTags,
|
|
80
|
+
metaAttributes: [],
|
|
81
|
+
scripts,
|
|
82
|
+
stylesheets,
|
|
83
|
+
noIndex: false,
|
|
84
|
+
version: DOCUSAURUS_VERSION,
|
|
85
|
+
};
|
|
86
|
+
return ssrTemplate(data);
|
|
87
|
+
}
|
|
@@ -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.sortAliases = sortAliases;
|
|
10
|
+
exports.createAliasesForTheme = createAliasesForTheme;
|
|
11
|
+
exports.loadThemeAliases = loadThemeAliases;
|
|
12
|
+
exports.loadDocusaurusAliases = loadDocusaurusAliases;
|
|
10
13
|
const tslib_1 = require("tslib");
|
|
11
14
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
15
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -30,7 +33,6 @@ function sortAliases(aliases) {
|
|
|
30
33
|
alias1.includes(`${alias2}/`) ? -1 : alias2.includes(`${alias1}/`) ? 1 : 0);
|
|
31
34
|
return Object.fromEntries(entries);
|
|
32
35
|
}
|
|
33
|
-
exports.sortAliases = sortAliases;
|
|
34
36
|
async function createAliasesForTheme(themePath, addOriginalAlias) {
|
|
35
37
|
if (!(await fs_extra_1.default.pathExists(themePath))) {
|
|
36
38
|
return {};
|
|
@@ -52,7 +54,6 @@ async function createAliasesForTheme(themePath, addOriginalAlias) {
|
|
|
52
54
|
});
|
|
53
55
|
return sortAliases(aliases);
|
|
54
56
|
}
|
|
55
|
-
exports.createAliasesForTheme = createAliasesForTheme;
|
|
56
57
|
async function createThemeAliases(themePaths, userThemePaths) {
|
|
57
58
|
const aliases = {};
|
|
58
59
|
for (const themePath of themePaths) {
|
|
@@ -84,7 +85,6 @@ function loadThemeAliases({ siteDir, plugins, }) {
|
|
|
84
85
|
const userTheme = path_1.default.resolve(siteDir, utils_1.THEME_PATH);
|
|
85
86
|
return createThemeAliases([ThemeFallbackDir, ...pluginThemes], [userTheme]);
|
|
86
87
|
}
|
|
87
|
-
exports.loadThemeAliases = loadThemeAliases;
|
|
88
88
|
/**
|
|
89
89
|
* Note: a `@docusaurus` alias would also catch `@docusaurus/theme-common`, so
|
|
90
90
|
* instead of naively aliasing this to `client/exports`, we use fine-grained
|
|
@@ -103,4 +103,3 @@ async function loadDocusaurusAliases() {
|
|
|
103
103
|
});
|
|
104
104
|
return aliases;
|
|
105
105
|
}
|
|
106
|
-
exports.loadDocusaurusAliases = loadDocusaurusAliases;
|
package/lib/webpack/base.js
CHANGED
|
@@ -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.clientDir = void 0;
|
|
10
|
+
exports.excludeJS = excludeJS;
|
|
11
|
+
exports.createBaseConfig = createBaseConfig;
|
|
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"));
|
|
@@ -32,7 +34,6 @@ function excludeJS(modulePath) {
|
|
|
32
34
|
!/docusaurus(?:(?!node_modules).)*\.jsx?$/.test(modulePath) &&
|
|
33
35
|
!LibrariesToTranspileRegex.test(modulePath));
|
|
34
36
|
}
|
|
35
|
-
exports.excludeJS = excludeJS;
|
|
36
37
|
async function createBaseConfig({ props, isServer, minify, }) {
|
|
37
38
|
const { outDir, siteDir, siteConfig, siteConfigPath, baseUrl, generatedFilesDir, routesPaths, siteMetadata, plugins, } = props;
|
|
38
39
|
const totalPages = routesPaths.length;
|
|
@@ -79,7 +80,7 @@ async function createBaseConfig({ props, isServer, minify, }) {
|
|
|
79
80
|
chunkFilename: isProd
|
|
80
81
|
? 'assets/js/[name].[contenthash:8].js'
|
|
81
82
|
: '[name].js',
|
|
82
|
-
publicPath: baseUrl,
|
|
83
|
+
publicPath: siteConfig.future.experimental_router === 'hash' ? 'auto' : baseUrl,
|
|
83
84
|
hashFunction: 'xxhash64',
|
|
84
85
|
},
|
|
85
86
|
// Don't throw warning when asset created is over 250kb
|
|
@@ -212,4 +213,3 @@ async function createBaseConfig({ props, isServer, minify, }) {
|
|
|
212
213
|
],
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
|
-
exports.createBaseConfig = createBaseConfig;
|
package/lib/webpack/client.js
CHANGED
|
@@ -6,10 +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.createStartClientConfig = createStartClientConfig;
|
|
10
|
+
exports.createBuildClientConfig = createBuildClientConfig;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
-
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
13
13
|
const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
|
|
14
14
|
const webpackbar_1 = tslib_1.__importDefault(require("webpackbar"));
|
|
15
15
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
@@ -18,21 +18,9 @@ const react_loadable_ssr_addon_v5_slorber_1 = tslib_1.__importDefault(require("r
|
|
|
18
18
|
const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
|
|
19
19
|
const base_1 = require("./base");
|
|
20
20
|
const ChunkAssetPlugin_1 = tslib_1.__importDefault(require("./plugins/ChunkAssetPlugin"));
|
|
21
|
-
const utils_1 = require("./utils");
|
|
22
21
|
const CleanWebpackPlugin_1 = tslib_1.__importDefault(require("./plugins/CleanWebpackPlugin"));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ForceTerminatePlugin {
|
|
26
|
-
apply(compiler) {
|
|
27
|
-
compiler.hooks.done.tap('client:done', (stats) => {
|
|
28
|
-
if (stats.hasErrors()) {
|
|
29
|
-
const errorsWarnings = stats.toJson('errors-warnings');
|
|
30
|
-
logger_1.default.error(`Client bundle compiled with errors therefore further build is impossible.\n${(0, utils_1.formatStatsErrorMessage)(errorsWarnings)}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
22
|
+
const ForceTerminatePlugin_1 = tslib_1.__importDefault(require("./plugins/ForceTerminatePlugin"));
|
|
23
|
+
const StaticDirectoriesCopyPlugin_1 = require("./plugins/StaticDirectoriesCopyPlugin");
|
|
36
24
|
async function createBaseClientConfig({ props, hydrate, minify, }) {
|
|
37
25
|
const baseConfig = await (0, base_1.createBaseConfig)({ props, isServer: false, minify });
|
|
38
26
|
return (0, webpack_merge_1.default)(baseConfig, {
|
|
@@ -54,7 +42,8 @@ async function createBaseClientConfig({ props, hydrate, minify, }) {
|
|
|
54
42
|
new webpackbar_1.default({
|
|
55
43
|
name: 'Client',
|
|
56
44
|
}),
|
|
57
|
-
|
|
45
|
+
await (0, StaticDirectoriesCopyPlugin_1.createStaticDirectoriesCopyPlugin)({ props }),
|
|
46
|
+
].filter(Boolean),
|
|
58
47
|
});
|
|
59
48
|
}
|
|
60
49
|
// client config when running "docusaurus start"
|
|
@@ -89,15 +78,18 @@ async function createStartClientConfig({ props, minify, poll, }) {
|
|
|
89
78
|
});
|
|
90
79
|
return { clientConfig };
|
|
91
80
|
}
|
|
92
|
-
exports.createStartClientConfig = createStartClientConfig;
|
|
93
81
|
// client config when running "docusaurus build"
|
|
94
82
|
async function createBuildClientConfig({ props, minify, bundleAnalyzer, }) {
|
|
95
83
|
// Apply user webpack config.
|
|
96
|
-
const { generatedFilesDir } = props;
|
|
84
|
+
const { generatedFilesDir, siteConfig } = props;
|
|
85
|
+
const router = siteConfig.future.experimental_router;
|
|
86
|
+
// With the hash router, we don't hydrate the React app, even in build mode!
|
|
87
|
+
// This is because it will always be a client-rendered React app
|
|
88
|
+
const hydrate = router !== 'hash';
|
|
97
89
|
const clientManifestPath = path_1.default.join(generatedFilesDir, 'client-manifest.json');
|
|
98
|
-
const config = (0, webpack_merge_1.default)(await createBaseClientConfig({ props, minify, hydrate
|
|
90
|
+
const config = (0, webpack_merge_1.default)(await createBaseClientConfig({ props, minify, hydrate }), {
|
|
99
91
|
plugins: [
|
|
100
|
-
new
|
|
92
|
+
new ForceTerminatePlugin_1.default(),
|
|
101
93
|
// Remove/clean build folders before building bundles.
|
|
102
94
|
new CleanWebpackPlugin_1.default({ verbose: false }),
|
|
103
95
|
// Visualize size of webpack output files with an interactive zoomable
|
|
@@ -111,4 +103,3 @@ async function createBuildClientConfig({ props, minify, bundleAnalyzer, }) {
|
|
|
111
103
|
});
|
|
112
104
|
return { config, clientManifestPath };
|
|
113
105
|
}
|
|
114
|
-
exports.createBuildClientConfig = createBuildClientConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { Configuration, RuleSetRule } from 'webpack';
|
|
8
|
+
import type { Plugin, LoadedPlugin } from '@docusaurus/types';
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to modify webpack config
|
|
11
|
+
* @param configureWebpack a webpack config or a function to modify config
|
|
12
|
+
* @param config initial webpack config
|
|
13
|
+
* @param isServer indicates if this is a server webpack configuration
|
|
14
|
+
* @param jsLoader custom js loader config
|
|
15
|
+
* @param content content loaded by the plugin
|
|
16
|
+
* @returns final/ modified webpack config
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyConfigureWebpack(configureWebpack: NonNullable<Plugin['configureWebpack']>, config: Configuration, isServer: boolean, jsLoader: 'babel' | ((isServer: boolean) => RuleSetRule) | undefined, content: unknown): Configuration;
|
|
19
|
+
export declare function applyConfigurePostCss(configurePostCss: NonNullable<Plugin['configurePostCss']>, config: Configuration): Configuration;
|
|
20
|
+
export declare function executePluginsConfigureWebpack({ plugins, config, isServer, jsLoader, }: {
|
|
21
|
+
plugins: LoadedPlugin[];
|
|
22
|
+
config: Configuration;
|
|
23
|
+
isServer: boolean;
|
|
24
|
+
jsLoader: 'babel' | ((isServer: boolean) => RuleSetRule) | undefined;
|
|
25
|
+
}): Configuration;
|