@docusaurus/core 4.0.0-canary-6899 → 4.0.0-canary-6902
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/commands/build/buildLocale.js +0 -1
- package/lib/commands/start/webpack.js +0 -1
- package/lib/server/configValidation.js +10 -33
- package/lib/ssg/ssgRenderer.js +1 -1
- package/lib/webpack/base.d.ts +2 -3
- package/lib/webpack/base.js +2 -2
- package/lib/webpack/client.d.ts +3 -5
- package/lib/webpack/client.js +3 -6
- package/lib/webpack/server.js +0 -1
- package/package.json +14 -14
|
@@ -128,7 +128,6 @@ async function getBuildClientConfig({ props, cliOptions, configureWebpackUtils,
|
|
|
128
128
|
const result = await (0, client_1.createBuildClientConfig)({
|
|
129
129
|
props,
|
|
130
130
|
minify: cliOptions.minify ?? true,
|
|
131
|
-
faster: props.siteConfig.future.faster,
|
|
132
131
|
configureWebpackUtils,
|
|
133
132
|
});
|
|
134
133
|
let { config } = result;
|
|
@@ -106,7 +106,6 @@ async function getStartClientConfig({ props, minify, poll, configureWebpackUtils
|
|
|
106
106
|
let { clientConfig: config } = await (0, client_1.createStartClientConfig)({
|
|
107
107
|
props,
|
|
108
108
|
minify,
|
|
109
|
-
faster: props.siteConfig.future.faster,
|
|
110
109
|
poll,
|
|
111
110
|
configureWebpackUtils,
|
|
112
111
|
});
|
|
@@ -46,13 +46,11 @@ exports.DEFAULT_STORAGE_CONFIG = {
|
|
|
46
46
|
namespace: false,
|
|
47
47
|
};
|
|
48
48
|
exports.DEFAULT_FASTER_CONFIG = {
|
|
49
|
-
swcJsMinimizer: false,
|
|
50
49
|
rspackBundler: false,
|
|
51
50
|
rspackPersistentCache: false,
|
|
52
51
|
};
|
|
53
52
|
// When using the "faster: true" shortcut
|
|
54
53
|
exports.DEFAULT_FASTER_CONFIG_TRUE = {
|
|
55
|
-
swcJsMinimizer: true,
|
|
56
54
|
rspackBundler: true,
|
|
57
55
|
rspackPersistentCache: true,
|
|
58
56
|
};
|
|
@@ -60,14 +58,12 @@ exports.DEFAULT_FUTURE_V4_CONFIG = {
|
|
|
60
58
|
useCssCascadeLayers: false,
|
|
61
59
|
siteStorageNamespacing: false,
|
|
62
60
|
fasterByDefault: false,
|
|
63
|
-
mdx1CompatDisabledByDefault: false,
|
|
64
61
|
};
|
|
65
62
|
// When using the "v4: true" shortcut
|
|
66
63
|
exports.DEFAULT_FUTURE_V4_CONFIG_TRUE = {
|
|
67
64
|
useCssCascadeLayers: true,
|
|
68
65
|
siteStorageNamespacing: true,
|
|
69
66
|
fasterByDefault: true,
|
|
70
|
-
mdx1CompatDisabledByDefault: true,
|
|
71
67
|
};
|
|
72
68
|
exports.DEFAULT_FUTURE_CONFIG = {
|
|
73
69
|
v4: exports.DEFAULT_FUTURE_V4_CONFIG,
|
|
@@ -79,11 +75,6 @@ const DEFAULT_MARKDOWN_HOOKS = {
|
|
|
79
75
|
onBrokenMarkdownImages: 'throw',
|
|
80
76
|
onUnusedMarkdownDirectives: 'warn',
|
|
81
77
|
};
|
|
82
|
-
const DEFAULT_MARKDOWN_MDX1COMPAT = {
|
|
83
|
-
comments: true,
|
|
84
|
-
admonitions: true,
|
|
85
|
-
headingIds: true,
|
|
86
|
-
};
|
|
87
78
|
const DEFAULT_MARKDOWN_CONFIG = {
|
|
88
79
|
// TODO Docusaurus v5: change this to "detect"?
|
|
89
80
|
// we probably need stable CommonMark support first
|
|
@@ -93,7 +84,11 @@ const DEFAULT_MARKDOWN_CONFIG = {
|
|
|
93
84
|
emoji: true,
|
|
94
85
|
preprocessor: undefined,
|
|
95
86
|
parseFrontMatter: utils_1.DEFAULT_PARSE_FRONT_MATTER,
|
|
96
|
-
mdx1Compat:
|
|
87
|
+
mdx1Compat: {
|
|
88
|
+
comments: false,
|
|
89
|
+
admonitions: false,
|
|
90
|
+
headingIds: false,
|
|
91
|
+
},
|
|
97
92
|
anchors: {
|
|
98
93
|
maintainCase: false,
|
|
99
94
|
},
|
|
@@ -198,7 +193,6 @@ const I18N_CONFIG_SCHEMA = utils_validation_1.Joi.object({
|
|
|
198
193
|
// the future.v4.fasterByDefault flag
|
|
199
194
|
const FASTER_CONFIG_SCHEMA = utils_validation_1.Joi.alternatives()
|
|
200
195
|
.try(utils_validation_1.Joi.object({
|
|
201
|
-
swcJsMinimizer: utils_validation_1.Joi.boolean(),
|
|
202
196
|
rspackBundler: utils_validation_1.Joi.boolean(),
|
|
203
197
|
rspackPersistentCache: utils_validation_1.Joi.boolean(),
|
|
204
198
|
swcJsLoader: utils_validation_1.Joi.any()
|
|
@@ -215,7 +209,6 @@ const FUTURE_V4_SCHEMA = utils_validation_1.Joi.alternatives()
|
|
|
215
209
|
useCssCascadeLayers: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FUTURE_V4_CONFIG.useCssCascadeLayers),
|
|
216
210
|
siteStorageNamespacing: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FUTURE_V4_CONFIG.siteStorageNamespacing),
|
|
217
211
|
fasterByDefault: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FUTURE_V4_CONFIG.fasterByDefault),
|
|
218
|
-
mdx1CompatDisabledByDefault: utils_validation_1.Joi.boolean().default(exports.DEFAULT_FUTURE_V4_CONFIG.mdx1CompatDisabledByDefault),
|
|
219
212
|
}), utils_validation_1.Joi.boolean()
|
|
220
213
|
.required()
|
|
221
214
|
.custom((bool) => bool ? exports.DEFAULT_FUTURE_V4_CONFIG_TRUE : exports.DEFAULT_FUTURE_V4_CONFIG))
|
|
@@ -372,14 +365,11 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
372
365
|
.arity(1)
|
|
373
366
|
.optional()
|
|
374
367
|
.default(() => exports.DEFAULT_CONFIG.markdown.preprocessor),
|
|
375
|
-
// Individual boolean defaults are not set here on purpose
|
|
376
|
-
// They are resolved in postProcessDocusaurusConfig based on
|
|
377
|
-
// the future.v4.mdx1CompatDisabledByDefault flag
|
|
378
368
|
mdx1Compat: utils_validation_1.Joi.object({
|
|
379
|
-
comments: utils_validation_1.Joi.boolean(),
|
|
380
|
-
admonitions: utils_validation_1.Joi.boolean(),
|
|
381
|
-
headingIds: utils_validation_1.Joi.boolean(),
|
|
382
|
-
}).default(
|
|
369
|
+
comments: utils_validation_1.Joi.boolean().default(exports.DEFAULT_CONFIG.markdown.mdx1Compat.comments),
|
|
370
|
+
admonitions: utils_validation_1.Joi.boolean().default(exports.DEFAULT_CONFIG.markdown.mdx1Compat.admonitions),
|
|
371
|
+
headingIds: utils_validation_1.Joi.boolean().default(exports.DEFAULT_CONFIG.markdown.mdx1Compat.headingIds),
|
|
372
|
+
}).default(exports.DEFAULT_CONFIG.markdown.mdx1Compat),
|
|
383
373
|
remarkRehypeOptions:
|
|
384
374
|
// add proper external options validation?
|
|
385
375
|
// Not sure if it's a good idea, validation is likely to become stale
|
|
@@ -399,19 +389,13 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
399
389
|
.try(utils_validation_1.Joi.string().equal('ignore', 'log', 'warn', 'throw'), utils_validation_1.Joi.function())
|
|
400
390
|
.default(exports.DEFAULT_CONFIG.markdown.hooks.onUnusedMarkdownDirectives),
|
|
401
391
|
}).default(exports.DEFAULT_CONFIG.markdown.hooks),
|
|
402
|
-
}).default(
|
|
403
|
-
...exports.DEFAULT_CONFIG.markdown,
|
|
404
|
-
mdx1Compat: {
|
|
405
|
-
// erased on purpose, filled using postprocessing
|
|
406
|
-
},
|
|
407
|
-
}),
|
|
392
|
+
}).default(exports.DEFAULT_CONFIG.markdown),
|
|
408
393
|
}).messages({
|
|
409
394
|
'docusaurus.configValidationWarning': 'Docusaurus config validation warning. Field {#label}: {#warningMessage}',
|
|
410
395
|
});
|
|
411
396
|
// Expressing this kind of logic in Joi is a pain
|
|
412
397
|
// We also want to decouple logic from Joi: easier to remove it later!
|
|
413
398
|
function postProcessDocusaurusConfig(config) {
|
|
414
|
-
var _a;
|
|
415
399
|
// Resolve storage.namespace based on the v4 future flag
|
|
416
400
|
// undefined means "not explicitly set by user"
|
|
417
401
|
if (config.storage.namespace === undefined) {
|
|
@@ -429,13 +413,6 @@ function postProcessDocusaurusConfig(config) {
|
|
|
429
413
|
config.future.faster[key] = fasterDefault;
|
|
430
414
|
}
|
|
431
415
|
}
|
|
432
|
-
// Resolve mdx1Compat config based on the v4.mdx1CompatDisabledByDefault flag
|
|
433
|
-
// undefined means "not explicitly set by user"
|
|
434
|
-
const mdx1CompatDefault = !config.future.v4.mdx1CompatDisabledByDefault;
|
|
435
|
-
const mdx1CompatKeys = Object.keys(DEFAULT_MARKDOWN_MDX1COMPAT);
|
|
436
|
-
for (const key of mdx1CompatKeys) {
|
|
437
|
-
(_a = config.markdown.mdx1Compat)[key] ?? (_a[key] = mdx1CompatDefault);
|
|
438
|
-
}
|
|
439
416
|
if (config.onBrokenMarkdownLinks) {
|
|
440
417
|
logger_1.default.warn `The code=${'siteConfig.onBrokenMarkdownLinks'} config option is deprecated and will be removed in Docusaurus v4.
|
|
441
418
|
Please migrate and move this option to code=${'siteConfig.markdown.hooks.onBrokenMarkdownLinks'} instead.`;
|
package/lib/ssg/ssgRenderer.js
CHANGED
|
@@ -41,7 +41,7 @@ async function loadSSGRenderer({ params, }) {
|
|
|
41
41
|
logger_1.PerfLogger.async('Load App renderer', () => loadAppRenderer({
|
|
42
42
|
serverBundlePath: params.serverBundlePath,
|
|
43
43
|
})),
|
|
44
|
-
logger_1.PerfLogger.async('Load HTML minifier', () => (0, bundler_1.getHtmlMinifier)(
|
|
44
|
+
logger_1.PerfLogger.async('Load HTML minifier', () => (0, bundler_1.getHtmlMinifier)()),
|
|
45
45
|
logger_1.PerfLogger.async('Compile SSG template', () => (0, ssgTemplate_1.compileSSGTemplate)(params.ssgTemplateContent)),
|
|
46
46
|
]);
|
|
47
47
|
return {
|
package/lib/webpack/base.d.ts
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { Configuration } from 'webpack';
|
|
8
|
-
import type { ConfigureWebpackUtils,
|
|
8
|
+
import type { ConfigureWebpackUtils, Props } from '@docusaurus/types';
|
|
9
9
|
export declare const clientDir: string;
|
|
10
10
|
export declare function excludeJS(modulePath: string): boolean;
|
|
11
|
-
export declare function createBaseConfig({ props, isServer, minify,
|
|
11
|
+
export declare function createBaseConfig({ props, isServer, minify, configureWebpackUtils, }: {
|
|
12
12
|
props: Props;
|
|
13
13
|
isServer: boolean;
|
|
14
14
|
minify: boolean;
|
|
15
|
-
faster: FasterConfig;
|
|
16
15
|
configureWebpackUtils: ConfigureWebpackUtils;
|
|
17
16
|
}): Promise<Configuration>;
|
package/lib/webpack/base.js
CHANGED
|
@@ -41,7 +41,7 @@ function excludeJS(modulePath) {
|
|
|
41
41
|
return (modulePath.includes('node_modules') &&
|
|
42
42
|
!/docusaurus(?:(?!node_modules).)*\.jsx?$/.test(modulePath));
|
|
43
43
|
}
|
|
44
|
-
async function createBaseConfig({ props, isServer, minify,
|
|
44
|
+
async function createBaseConfig({ props, isServer, minify, configureWebpackUtils, }) {
|
|
45
45
|
const { outDir, siteDir, siteConfig, siteConfigPath, baseUrl, generatedFilesDir, routesPaths, siteMetadata, plugins, } = props;
|
|
46
46
|
const totalPages = routesPaths.length;
|
|
47
47
|
const isProd = process.env.NODE_ENV === 'production';
|
|
@@ -172,7 +172,7 @@ async function createBaseConfig({ props, isServer, minify, faster, configureWebp
|
|
|
172
172
|
// used for static site generation
|
|
173
173
|
minimize: minimizeEnabled,
|
|
174
174
|
minimizer: minimizeEnabled
|
|
175
|
-
? await (0, bundler_1.getMinimizers)({
|
|
175
|
+
? await (0, bundler_1.getMinimizers)({ currentBundler: props.currentBundler })
|
|
176
176
|
: undefined,
|
|
177
177
|
splitChunks: isServer
|
|
178
178
|
? false
|
package/lib/webpack/client.d.ts
CHANGED
|
@@ -4,21 +4,19 @@
|
|
|
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 type { ConfigureWebpackUtils,
|
|
7
|
+
import type { ConfigureWebpackUtils, Props } from '@docusaurus/types';
|
|
8
8
|
import type { Configuration } from 'webpack';
|
|
9
|
-
export declare function createStartClientConfig({ props, minify, poll,
|
|
9
|
+
export declare function createStartClientConfig({ props, minify, poll, configureWebpackUtils, }: {
|
|
10
10
|
props: Props;
|
|
11
11
|
minify: boolean;
|
|
12
12
|
poll: number | boolean | undefined;
|
|
13
|
-
faster: FasterConfig;
|
|
14
13
|
configureWebpackUtils: ConfigureWebpackUtils;
|
|
15
14
|
}): Promise<{
|
|
16
15
|
clientConfig: Configuration;
|
|
17
16
|
}>;
|
|
18
|
-
export declare function createBuildClientConfig({ props, minify,
|
|
17
|
+
export declare function createBuildClientConfig({ props, minify, configureWebpackUtils, }: {
|
|
19
18
|
props: Props;
|
|
20
19
|
minify: boolean;
|
|
21
|
-
faster: FasterConfig;
|
|
22
20
|
configureWebpackUtils: ConfigureWebpackUtils;
|
|
23
21
|
}): Promise<{
|
|
24
22
|
config: Configuration;
|
package/lib/webpack/client.js
CHANGED
|
@@ -20,12 +20,11 @@ const ForceTerminatePlugin_1 = tslib_1.__importDefault(require("./plugins/ForceT
|
|
|
20
20
|
const DevHtmlPlugin_1 = tslib_1.__importDefault(require("./plugins/DevHtmlPlugin"));
|
|
21
21
|
const StaticDirectoriesCopyPlugin_1 = require("./plugins/StaticDirectoriesCopyPlugin");
|
|
22
22
|
const dev_html_template_1 = require("./templates/dev.html.template");
|
|
23
|
-
async function createBaseClientConfig({ props, hydrate, minify,
|
|
23
|
+
async function createBaseClientConfig({ props, hydrate, minify, configureWebpackUtils, }) {
|
|
24
24
|
const baseConfig = await (0, base_1.createBaseConfig)({
|
|
25
25
|
props,
|
|
26
26
|
isServer: false,
|
|
27
27
|
minify,
|
|
28
|
-
faster,
|
|
29
28
|
configureWebpackUtils,
|
|
30
29
|
});
|
|
31
30
|
const ProgressBarPlugin = await (0, bundler_1.getProgressBarPlugin)({
|
|
@@ -57,13 +56,12 @@ async function createBaseClientConfig({ props, hydrate, minify, faster, configur
|
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
// client config when running "docusaurus start"
|
|
60
|
-
async function createStartClientConfig({ props, minify, poll,
|
|
59
|
+
async function createStartClientConfig({ props, minify, poll, configureWebpackUtils, }) {
|
|
61
60
|
const { siteConfig, headTags, preBodyTags, postBodyTags } = props;
|
|
62
61
|
const clientConfig = (0, webpack_merge_1.default)(await createBaseClientConfig({
|
|
63
62
|
props,
|
|
64
63
|
minify,
|
|
65
64
|
hydrate: false,
|
|
66
|
-
faster,
|
|
67
65
|
configureWebpackUtils,
|
|
68
66
|
}), {
|
|
69
67
|
watchOptions: {
|
|
@@ -92,7 +90,7 @@ async function createStartClientConfig({ props, minify, poll, faster, configureW
|
|
|
92
90
|
return { clientConfig };
|
|
93
91
|
}
|
|
94
92
|
// client config when running "docusaurus build"
|
|
95
|
-
async function createBuildClientConfig({ props, minify,
|
|
93
|
+
async function createBuildClientConfig({ props, minify, configureWebpackUtils, }) {
|
|
96
94
|
// Apply user webpack config.
|
|
97
95
|
const { generatedFilesDir, siteConfig } = props;
|
|
98
96
|
const router = siteConfig.future.experimental_router;
|
|
@@ -103,7 +101,6 @@ async function createBuildClientConfig({ props, minify, faster, configureWebpack
|
|
|
103
101
|
const config = (0, webpack_merge_1.default)(await createBaseClientConfig({
|
|
104
102
|
props,
|
|
105
103
|
minify,
|
|
106
|
-
faster,
|
|
107
104
|
configureWebpackUtils,
|
|
108
105
|
hydrate,
|
|
109
106
|
}), {
|
package/lib/webpack/server.js
CHANGED
|
@@ -18,7 +18,6 @@ async function createServerConfig({ props, configureWebpackUtils, }) {
|
|
|
18
18
|
props,
|
|
19
19
|
isServer: true,
|
|
20
20
|
minify: false,
|
|
21
|
-
faster: props.siteConfig.future.faster,
|
|
22
21
|
configureWebpackUtils,
|
|
23
22
|
});
|
|
24
23
|
const ProgressBarPlugin = await (0, bundler_1.getProgressBarPlugin)({
|
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": "4.0.0-canary-
|
|
4
|
+
"version": "4.0.0-canary-6902",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/babel": "4.0.0-canary-
|
|
37
|
-
"@docusaurus/bundler": "4.0.0-canary-
|
|
38
|
-
"@docusaurus/fs": "4.0.0-canary-
|
|
39
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
40
|
-
"@docusaurus/logger": "4.0.0-canary-
|
|
41
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
42
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
43
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
44
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
36
|
+
"@docusaurus/babel": "4.0.0-canary-6902",
|
|
37
|
+
"@docusaurus/bundler": "4.0.0-canary-6902",
|
|
38
|
+
"@docusaurus/fs": "4.0.0-canary-6902",
|
|
39
|
+
"@docusaurus/glob": "4.0.0-canary-6902",
|
|
40
|
+
"@docusaurus/logger": "4.0.0-canary-6902",
|
|
41
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6902",
|
|
42
|
+
"@docusaurus/utils": "4.0.0-canary-6902",
|
|
43
|
+
"@docusaurus/utils-common": "4.0.0-canary-6902",
|
|
44
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6902",
|
|
45
45
|
"boxen": "^9.0.0",
|
|
46
46
|
"cli-table3": "^0.6.5",
|
|
47
47
|
"combine-promises": "^1.2.0",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"webpack-merge": "^6.0.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@docusaurus/module-type-aliases": "4.0.0-canary-
|
|
76
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
75
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-6902",
|
|
76
|
+
"@docusaurus/types": "4.0.0-canary-6902",
|
|
77
77
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
78
78
|
"@types/escape-html": "^1.0.4",
|
|
79
79
|
"@types/history": "^4.7.11",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"utility-types": "^3.11.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"@docusaurus/faster": "4.0.0-canary-
|
|
90
|
+
"@docusaurus/faster": "4.0.0-canary-6902",
|
|
91
91
|
"@mdx-js/react": "^3.1.1",
|
|
92
92
|
"react": "^19.3.0",
|
|
93
93
|
"react-dom": "^19.3.0"
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"engines": {
|
|
101
101
|
"node": ">=24.21"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c766d1c821e77b08a081823914f5f714d9d29f9f"
|
|
104
104
|
}
|