@docusaurus/core 3.3.2 → 3.4.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/lib/client/clientEntry.js +7 -3
- package/lib/client/exports/Link.js +12 -2
- package/lib/client/exports/useBaseUrl.d.ts +8 -0
- package/lib/client/exports/useBaseUrl.js +11 -3
- package/lib/commands/build.js +35 -21
- package/lib/commands/serve.js +15 -4
- package/lib/commands/start/utils.d.ts +3 -2
- package/lib/commands/start/utils.js +7 -2
- package/lib/commands/start/webpack.js +3 -3
- package/lib/server/brokenLinks.js +9 -1
- package/lib/server/codegen/codegen.d.ts +2 -1
- package/lib/server/codegen/codegen.js +4 -0
- package/lib/server/codegen/codegenRoutes.d.ts +1 -0
- package/lib/server/codegen/codegenRoutes.js +20 -6
- package/lib/server/configValidation.d.ts +4 -1
- package/lib/server/configValidation.js +29 -1
- package/lib/server/htmlTags.d.ts +5 -2
- package/lib/server/htmlTags.js +15 -6
- package/lib/server/i18n.js +37 -8
- package/lib/server/site.js +13 -5
- package/lib/server/storage.d.ts +13 -0
- package/lib/server/storage.js +36 -0
- package/lib/ssg.d.ts +4 -0
- package/lib/ssg.js +9 -1
- package/lib/templates/templates.d.ts +3 -0
- package/lib/templates/templates.js +26 -1
- package/lib/webpack/base.js +1 -1
- package/lib/webpack/client.js +10 -18
- package/lib/webpack/configure.d.ts +25 -0
- package/lib/webpack/configure.js +100 -0
- 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 +39 -0
- package/lib/webpack/server.js +0 -28
- package/lib/webpack/utils.d.ts +0 -22
- package/lib/webpack/utils.js +1 -80
- package/package.json +10 -10
package/lib/webpack/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.getHttpsConfig = exports.compile = exports.
|
|
9
|
+
exports.getHttpsConfig = exports.compile = exports.getCustomizableJSLoader = exports.getBabelOptions = exports.getCustomBabelConfigFilePath = exports.getStyleLoaders = exports.printStatsWarnings = exports.formatStatsErrorMessage = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -14,7 +14,6 @@ const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
|
14
14
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
15
15
|
const utils_1 = require("@docusaurus/utils");
|
|
16
16
|
const mini_css_extract_plugin_1 = tslib_1.__importDefault(require("mini-css-extract-plugin"));
|
|
17
|
-
const webpack_merge_1 = require("webpack-merge");
|
|
18
17
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
19
18
|
const formatWebpackMessages_1 = tslib_1.__importDefault(require("react-dev-utils/formatWebpackMessages"));
|
|
20
19
|
function formatStatsErrorMessage(statsJson) {
|
|
@@ -134,84 +133,6 @@ const getCustomizableJSLoader = (jsLoader = 'babel') => ({ isServer, babelOption
|
|
|
134
133
|
? getDefaultBabelLoader({ isServer, babelOptions })
|
|
135
134
|
: jsLoader(isServer);
|
|
136
135
|
exports.getCustomizableJSLoader = getCustomizableJSLoader;
|
|
137
|
-
/**
|
|
138
|
-
* Helper function to modify webpack config
|
|
139
|
-
* @param configureWebpack a webpack config or a function to modify config
|
|
140
|
-
* @param config initial webpack config
|
|
141
|
-
* @param isServer indicates if this is a server webpack configuration
|
|
142
|
-
* @param jsLoader custom js loader config
|
|
143
|
-
* @param content content loaded by the plugin
|
|
144
|
-
* @returns final/ modified webpack config
|
|
145
|
-
*/
|
|
146
|
-
function applyConfigureWebpack(configureWebpack, config, isServer, jsLoader, content) {
|
|
147
|
-
// Export some utility functions
|
|
148
|
-
const utils = {
|
|
149
|
-
getStyleLoaders,
|
|
150
|
-
getJSLoader: (0, exports.getCustomizableJSLoader)(jsLoader),
|
|
151
|
-
};
|
|
152
|
-
if (typeof configureWebpack === 'function') {
|
|
153
|
-
const { mergeStrategy, ...res } = configureWebpack(config, isServer, utils, content) ?? {};
|
|
154
|
-
const customizeRules = mergeStrategy ?? {};
|
|
155
|
-
return (0, webpack_merge_1.mergeWithCustomize)({
|
|
156
|
-
customizeArray: (0, webpack_merge_1.customizeArray)(customizeRules),
|
|
157
|
-
customizeObject: (0, webpack_merge_1.customizeObject)(customizeRules),
|
|
158
|
-
})(config, res);
|
|
159
|
-
}
|
|
160
|
-
return config;
|
|
161
|
-
}
|
|
162
|
-
exports.applyConfigureWebpack = applyConfigureWebpack;
|
|
163
|
-
function applyConfigurePostCss(configurePostCss, config) {
|
|
164
|
-
// Not ideal heuristic but good enough for our use-case?
|
|
165
|
-
function isPostCssLoader(loader) {
|
|
166
|
-
return !!loader?.options?.postcssOptions;
|
|
167
|
-
}
|
|
168
|
-
// Does not handle all edge cases, but good enough for now
|
|
169
|
-
function overridePostCssOptions(entry) {
|
|
170
|
-
if (isPostCssLoader(entry)) {
|
|
171
|
-
entry.options.postcssOptions = configurePostCss(entry.options.postcssOptions);
|
|
172
|
-
}
|
|
173
|
-
else if (Array.isArray(entry.oneOf)) {
|
|
174
|
-
entry.oneOf.forEach((r) => {
|
|
175
|
-
if (r) {
|
|
176
|
-
overridePostCssOptions(r);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
else if (Array.isArray(entry.use)) {
|
|
181
|
-
entry.use
|
|
182
|
-
.filter((u) => typeof u === 'object')
|
|
183
|
-
.forEach((rule) => overridePostCssOptions(rule));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
config.module?.rules?.forEach((rule) => overridePostCssOptions(rule));
|
|
187
|
-
return config;
|
|
188
|
-
}
|
|
189
|
-
exports.applyConfigurePostCss = applyConfigurePostCss;
|
|
190
|
-
// Plugin Lifecycle - configurePostCss()
|
|
191
|
-
function executePluginsConfigurePostCss({ plugins, config, }) {
|
|
192
|
-
let resultConfig = config;
|
|
193
|
-
plugins.forEach((plugin) => {
|
|
194
|
-
const { configurePostCss } = plugin;
|
|
195
|
-
if (configurePostCss) {
|
|
196
|
-
resultConfig = applyConfigurePostCss(configurePostCss.bind(plugin), resultConfig);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
return resultConfig;
|
|
200
|
-
}
|
|
201
|
-
exports.executePluginsConfigurePostCss = executePluginsConfigurePostCss;
|
|
202
|
-
// Plugin Lifecycle - configureWebpack()
|
|
203
|
-
function executePluginsConfigureWebpack({ plugins, config, isServer, jsLoader, }) {
|
|
204
|
-
let resultConfig = config;
|
|
205
|
-
plugins.forEach((plugin) => {
|
|
206
|
-
const { configureWebpack } = plugin;
|
|
207
|
-
if (configureWebpack) {
|
|
208
|
-
resultConfig = applyConfigureWebpack(configureWebpack.bind(plugin), // The plugin lifecycle may reference `this`.
|
|
209
|
-
resultConfig, isServer, jsLoader, plugin.content);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
return resultConfig;
|
|
213
|
-
}
|
|
214
|
-
exports.executePluginsConfigureWebpack = executePluginsConfigureWebpack;
|
|
215
136
|
function compile(config) {
|
|
216
137
|
return new Promise((resolve, reject) => {
|
|
217
138
|
const compiler = (0, webpack_1.default)(config);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@babel/runtime": "^7.22.6",
|
|
44
44
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
45
45
|
"@babel/traverse": "^7.22.8",
|
|
46
|
-
"@docusaurus/cssnano-preset": "3.
|
|
47
|
-
"@docusaurus/logger": "3.
|
|
48
|
-
"@docusaurus/mdx-loader": "3.
|
|
49
|
-
"@docusaurus/utils": "3.
|
|
50
|
-
"@docusaurus/utils-common": "3.
|
|
51
|
-
"@docusaurus/utils-validation": "3.
|
|
46
|
+
"@docusaurus/cssnano-preset": "3.4.0",
|
|
47
|
+
"@docusaurus/logger": "3.4.0",
|
|
48
|
+
"@docusaurus/mdx-loader": "3.4.0",
|
|
49
|
+
"@docusaurus/utils": "3.4.0",
|
|
50
|
+
"@docusaurus/utils-common": "3.4.0",
|
|
51
|
+
"@docusaurus/utils-validation": "3.4.0",
|
|
52
52
|
"autoprefixer": "^10.4.14",
|
|
53
53
|
"babel-loader": "^9.1.3",
|
|
54
54
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
@@ -103,8 +103,8 @@
|
|
|
103
103
|
"webpackbar": "^5.0.2"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@docusaurus/module-type-aliases": "3.
|
|
107
|
-
"@docusaurus/types": "3.
|
|
106
|
+
"@docusaurus/module-type-aliases": "3.4.0",
|
|
107
|
+
"@docusaurus/types": "3.4.0",
|
|
108
108
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
109
109
|
"@types/detect-port": "^1.3.3",
|
|
110
110
|
"@types/react-dom": "^18.2.7",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"engines": {
|
|
125
125
|
"node": ">=18.0"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "49e9a2143274a8dd795659b417b470bc42abbd6e"
|
|
128
128
|
}
|