@docusaurus/core 3.0.0-alpha.0 → 3.0.0-beta.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/beforeCli.mjs +10 -1
- package/lib/client/App.js +2 -0
- package/lib/client/hasHydratedDataAttribute.d.ts +8 -0
- package/lib/client/hasHydratedDataAttribute.js +17 -0
- package/lib/commands/deploy.js +8 -0
- package/lib/server/configValidation.js +4 -0
- package/lib/server/index.js +4 -2
- package/lib/webpack/plugins/CleanWebpackPlugin.js +8 -0
- package/lib/webpack/utils.js +5 -1
- package/package.json +42 -42
package/bin/beforeCli.mjs
CHANGED
|
@@ -141,7 +141,16 @@ export default async function beforeCli() {
|
|
|
141
141
|
margin: 1,
|
|
142
142
|
align: 'center',
|
|
143
143
|
borderColor: 'yellow',
|
|
144
|
-
borderStyle:
|
|
144
|
+
borderStyle: {
|
|
145
|
+
topLeft: ' ',
|
|
146
|
+
topRight: ' ',
|
|
147
|
+
bottomLeft: ' ',
|
|
148
|
+
bottomRight: ' ',
|
|
149
|
+
top: '-',
|
|
150
|
+
bottom: '-',
|
|
151
|
+
left: ' ',
|
|
152
|
+
right: ' ',
|
|
153
|
+
},
|
|
145
154
|
};
|
|
146
155
|
|
|
147
156
|
const docusaurusUpdateMessage = boxen(
|
package/lib/client/App.js
CHANGED
|
@@ -20,6 +20,7 @@ import SiteMetadataDefaults from './SiteMetadataDefaults';
|
|
|
20
20
|
// TODO, quick fix for CSS insertion order
|
|
21
21
|
// eslint-disable-next-line import/order
|
|
22
22
|
import ErrorBoundary from '@docusaurus/ErrorBoundary';
|
|
23
|
+
import HasHydratedDataAttribute from './hasHydratedDataAttribute';
|
|
23
24
|
export default function App() {
|
|
24
25
|
const routeElement = renderRoutes(routes);
|
|
25
26
|
const location = useLocation();
|
|
@@ -34,6 +35,7 @@ export default function App() {
|
|
|
34
35
|
{routeElement}
|
|
35
36
|
</PendingNavigation>
|
|
36
37
|
</Root>
|
|
38
|
+
<HasHydratedDataAttribute />
|
|
37
39
|
</BrowserContextProvider>
|
|
38
40
|
</DocusaurusContextProvider>
|
|
39
41
|
</ErrorBoundary>);
|
|
@@ -0,0 +1,8 @@
|
|
|
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="react" />
|
|
8
|
+
export default function HasHydratedDataAttribute(): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 React from 'react';
|
|
8
|
+
import Head from '@docusaurus/Head';
|
|
9
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
|
+
// See https://github.com/facebook/docusaurus/pull/9256
|
|
11
|
+
// Docusaurus adds a <html data-has-hydrated="true"> after hydration
|
|
12
|
+
export default function HasHydratedDataAttribute() {
|
|
13
|
+
const isBrowser = useIsBrowser();
|
|
14
|
+
return (<Head>
|
|
15
|
+
<html data-has-hydrated={isBrowser}/>
|
|
16
|
+
</Head>);
|
|
17
|
+
}
|
package/lib/commands/deploy.js
CHANGED
|
@@ -151,6 +151,14 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
|
|
|
151
151
|
throw err;
|
|
152
152
|
}
|
|
153
153
|
shellExecLog('git add --all');
|
|
154
|
+
const gitUserName = process.env.GIT_USER_NAME;
|
|
155
|
+
if (gitUserName) {
|
|
156
|
+
shellExecLog(`git config user.name "${gitUserName}"`);
|
|
157
|
+
}
|
|
158
|
+
const gitUserEmail = process.env.GIT_USER_EMAIL;
|
|
159
|
+
if (gitUserEmail) {
|
|
160
|
+
shellExecLog(`git config user.email "${gitUserEmail}"`);
|
|
161
|
+
}
|
|
154
162
|
const commitMessage = process.env.CUSTOM_COMMIT_MESSAGE ??
|
|
155
163
|
`Deploy website - based on ${currentCommit}`;
|
|
156
164
|
const commitResults = shellExecLog(`git commit -m "${commitMessage}"`);
|
|
@@ -36,6 +36,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
36
36
|
baseUrlIssueBanner: true,
|
|
37
37
|
staticDirectories: [utils_1.DEFAULT_STATIC_DIR_NAME],
|
|
38
38
|
markdown: {
|
|
39
|
+
format: 'mdx',
|
|
39
40
|
mermaid: false,
|
|
40
41
|
preprocessor: undefined,
|
|
41
42
|
mdx1Compat: {
|
|
@@ -210,6 +211,9 @@ exports.ConfigSchema = utils_validation_1.Joi.object({
|
|
|
210
211
|
.optional(),
|
|
211
212
|
}).optional(),
|
|
212
213
|
markdown: utils_validation_1.Joi.object({
|
|
214
|
+
format: utils_validation_1.Joi.string()
|
|
215
|
+
.equal('mdx', 'md', 'detect')
|
|
216
|
+
.default(exports.DEFAULT_CONFIG.markdown.format),
|
|
213
217
|
mermaid: utils_validation_1.Joi.boolean().default(exports.DEFAULT_CONFIG.markdown.mermaid),
|
|
214
218
|
preprocessor: utils_validation_1.Joi.function()
|
|
215
219
|
.arity(1)
|
package/lib/server/index.js
CHANGED
|
@@ -102,14 +102,16 @@ export default ${JSON.stringify(siteConfig, null, 2)};
|
|
|
102
102
|
${clientModules
|
|
103
103
|
// Use `require()` because `import()` is async but client modules can have CSS
|
|
104
104
|
// and the order matters for loading CSS.
|
|
105
|
-
.map((clientModule) => ` require(
|
|
105
|
+
.map((clientModule) => ` require("${(0, utils_1.escapePath)(clientModule)}"),`)
|
|
106
106
|
.join('\n')}
|
|
107
107
|
];
|
|
108
108
|
`);
|
|
109
109
|
const genRegistry = (0, utils_1.generate)(generatedFilesDir, 'registry.js', `export default {
|
|
110
110
|
${Object.entries(registry)
|
|
111
111
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
112
|
-
.map(([chunkName, modulePath]) =>
|
|
112
|
+
.map(([chunkName, modulePath]) =>
|
|
113
|
+
// modulePath is already escaped by escapePath
|
|
114
|
+
` "${chunkName}": [() => import(/* webpackChunkName: "${chunkName}" */ "${modulePath}"), "${modulePath}", require.resolveWeak("${modulePath}")],`)
|
|
113
115
|
.join('\n')}};
|
|
114
116
|
`);
|
|
115
117
|
const genRoutesChunkNames = (0, utils_1.generate)(generatedFilesDir, 'routesChunkNames.json', JSON.stringify(routesChunkNames, null, 2));
|
|
@@ -30,6 +30,7 @@ const tslib_1 = require("tslib");
|
|
|
30
30
|
// Modified to optimize performance for Docusaurus specific use case
|
|
31
31
|
// More context: https://github.com/facebook/docusaurus/pull/1839
|
|
32
32
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
33
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
33
34
|
const del_1 = require("del");
|
|
34
35
|
class CleanWebpackPlugin {
|
|
35
36
|
constructor(options = {}) {
|
|
@@ -89,6 +90,13 @@ class CleanWebpackPlugin {
|
|
|
89
90
|
if (this.initialClean) {
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
93
|
+
if (
|
|
94
|
+
// eslint-disable-next-line no-restricted-properties
|
|
95
|
+
fs_extra_1.default.pathExistsSync(this.outputPath) &&
|
|
96
|
+
// eslint-disable-next-line no-restricted-properties
|
|
97
|
+
fs_extra_1.default.statSync(this.outputPath).isFile()) {
|
|
98
|
+
throw new Error(`A file '${this.outputPath}' already exists. Docusaurus needs this directory to save the build output. Either remove/change the file or choose a different build directory via '--out-dir'.`);
|
|
99
|
+
}
|
|
92
100
|
this.initialClean = true;
|
|
93
101
|
this.removeFiles(this.cleanOnceBeforeBuildPatterns);
|
|
94
102
|
}
|
package/lib/webpack/utils.js
CHANGED
|
@@ -173,7 +173,11 @@ function applyConfigurePostCss(configurePostCss, config) {
|
|
|
173
173
|
entry.options.postcssOptions = configurePostCss(entry.options.postcssOptions);
|
|
174
174
|
}
|
|
175
175
|
else if (Array.isArray(entry.oneOf)) {
|
|
176
|
-
entry.oneOf.forEach(
|
|
176
|
+
entry.oneOf.forEach((r) => {
|
|
177
|
+
if (r) {
|
|
178
|
+
overridePostCssOptions(r);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
177
181
|
}
|
|
178
182
|
else if (Array.isArray(entry.use)) {
|
|
179
183
|
entry.use
|
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.0.0-
|
|
4
|
+
"version": "3.0.0-beta.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/core": "^7.
|
|
37
|
-
"@babel/generator": "^7.
|
|
36
|
+
"@babel/core": "^7.22.9",
|
|
37
|
+
"@babel/generator": "^7.22.9",
|
|
38
38
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
39
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
40
|
-
"@babel/preset-env": "^7.
|
|
41
|
-
"@babel/preset-react": "^7.
|
|
42
|
-
"@babel/preset-typescript": "^7.
|
|
43
|
-
"@babel/runtime": "^7.
|
|
44
|
-
"@babel/runtime-corejs3": "^7.
|
|
45
|
-
"@babel/traverse": "^7.
|
|
46
|
-
"@docusaurus/cssnano-preset": "3.0.0-
|
|
47
|
-
"@docusaurus/logger": "3.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "3.0.0-
|
|
39
|
+
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
40
|
+
"@babel/preset-env": "^7.22.9",
|
|
41
|
+
"@babel/preset-react": "^7.22.5",
|
|
42
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
43
|
+
"@babel/runtime": "^7.22.6",
|
|
44
|
+
"@babel/runtime-corejs3": "^7.22.6",
|
|
45
|
+
"@babel/traverse": "^7.22.8",
|
|
46
|
+
"@docusaurus/cssnano-preset": "3.0.0-beta.0",
|
|
47
|
+
"@docusaurus/logger": "3.0.0-beta.0",
|
|
48
|
+
"@docusaurus/mdx-loader": "3.0.0-beta.0",
|
|
49
49
|
"@docusaurus/react-loadable": "5.5.2",
|
|
50
|
-
"@docusaurus/utils": "3.0.0-
|
|
51
|
-
"@docusaurus/utils-common": "3.0.0-
|
|
52
|
-
"@docusaurus/utils-validation": "3.0.0-
|
|
50
|
+
"@docusaurus/utils": "3.0.0-beta.0",
|
|
51
|
+
"@docusaurus/utils-common": "3.0.0-beta.0",
|
|
52
|
+
"@docusaurus/utils-validation": "3.0.0-beta.0",
|
|
53
53
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.7",
|
|
54
54
|
"@svgr/webpack": "^6.5.1",
|
|
55
|
-
"autoprefixer": "^10.4.
|
|
56
|
-
"babel-loader": "^9.1.
|
|
55
|
+
"autoprefixer": "^10.4.14",
|
|
56
|
+
"babel-loader": "^9.1.3",
|
|
57
57
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
58
58
|
"boxen": "^6.2.1",
|
|
59
59
|
"chalk": "^4.1.2",
|
|
@@ -63,25 +63,25 @@
|
|
|
63
63
|
"combine-promises": "^1.1.0",
|
|
64
64
|
"commander": "^5.1.0",
|
|
65
65
|
"copy-webpack-plugin": "^11.0.0",
|
|
66
|
-
"core-js": "^3.
|
|
67
|
-
"css-loader": "^6.
|
|
66
|
+
"core-js": "^3.31.1",
|
|
67
|
+
"css-loader": "^6.8.1",
|
|
68
68
|
"css-minimizer-webpack-plugin": "^4.2.2",
|
|
69
69
|
"cssnano": "^5.1.15",
|
|
70
70
|
"del": "^6.1.1",
|
|
71
71
|
"detect-port": "^1.5.1",
|
|
72
72
|
"escape-html": "^1.0.3",
|
|
73
|
-
"eta": "^2.0
|
|
73
|
+
"eta": "^2.2.0",
|
|
74
74
|
"file-loader": "^6.2.0",
|
|
75
|
-
"fs-extra": "^11.1.
|
|
76
|
-
"html-minifier-terser": "^7.
|
|
77
|
-
"html-tags": "^3.
|
|
78
|
-
"html-webpack-plugin": "^5.5.
|
|
75
|
+
"fs-extra": "^11.1.1",
|
|
76
|
+
"html-minifier-terser": "^7.2.0",
|
|
77
|
+
"html-tags": "^3.3.1",
|
|
78
|
+
"html-webpack-plugin": "^5.5.3",
|
|
79
79
|
"import-fresh": "^3.3.0",
|
|
80
80
|
"leven": "^3.1.0",
|
|
81
81
|
"lodash": "^4.17.21",
|
|
82
|
-
"mini-css-extract-plugin": "^2.7.
|
|
83
|
-
"postcss": "^8.4.
|
|
84
|
-
"postcss-loader": "^7.
|
|
82
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
83
|
+
"postcss": "^8.4.26",
|
|
84
|
+
"postcss-loader": "^7.3.3",
|
|
85
85
|
"prompts": "^2.4.2",
|
|
86
86
|
"react-dev-utils": "^12.0.1",
|
|
87
87
|
"react-helmet-async": "^1.3.0",
|
|
@@ -91,29 +91,29 @@
|
|
|
91
91
|
"react-router-config": "^5.1.1",
|
|
92
92
|
"react-router-dom": "^5.3.4",
|
|
93
93
|
"rtl-detect": "^1.0.4",
|
|
94
|
-
"semver": "^7.
|
|
94
|
+
"semver": "^7.5.4",
|
|
95
95
|
"serve-handler": "^6.1.5",
|
|
96
96
|
"shelljs": "^0.8.5",
|
|
97
|
-
"terser-webpack-plugin": "^5.3.
|
|
98
|
-
"tslib": "^2.
|
|
97
|
+
"terser-webpack-plugin": "^5.3.9",
|
|
98
|
+
"tslib": "^2.6.0",
|
|
99
99
|
"update-notifier": "^6.0.2",
|
|
100
100
|
"url-loader": "^4.1.1",
|
|
101
101
|
"wait-on": "^7.0.1",
|
|
102
|
-
"webpack": "^5.
|
|
103
|
-
"webpack-bundle-analyzer": "^4.
|
|
104
|
-
"webpack-dev-server": "^4.
|
|
105
|
-
"webpack-merge": "^5.
|
|
102
|
+
"webpack": "^5.88.1",
|
|
103
|
+
"webpack-bundle-analyzer": "^4.9.0",
|
|
104
|
+
"webpack-dev-server": "^4.15.1",
|
|
105
|
+
"webpack-merge": "^5.9.0",
|
|
106
106
|
"webpackbar": "^5.0.2"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@docusaurus/module-type-aliases": "3.0.0-
|
|
110
|
-
"@docusaurus/types": "3.0.0-
|
|
111
|
-
"@types/detect-port": "^1.3.
|
|
112
|
-
"@types/react-dom": "^18.
|
|
113
|
-
"@types/react-router-config": "^5.0.
|
|
109
|
+
"@docusaurus/module-type-aliases": "3.0.0-beta.0",
|
|
110
|
+
"@docusaurus/types": "3.0.0-beta.0",
|
|
111
|
+
"@types/detect-port": "^1.3.3",
|
|
112
|
+
"@types/react-dom": "^18.2.7",
|
|
113
|
+
"@types/react-router-config": "^5.0.7",
|
|
114
114
|
"@types/rtl-detect": "^1.0.0",
|
|
115
115
|
"@types/serve-handler": "^6.1.1",
|
|
116
|
-
"@types/update-notifier": "^6.0.
|
|
116
|
+
"@types/update-notifier": "^6.0.4",
|
|
117
117
|
"@types/wait-on": "^5.3.1",
|
|
118
118
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
119
119
|
"react-test-renderer": "^18.0.0",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=16.14"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "27a1e90d9fff88af90ecad35bea16d4d7230482a"
|
|
131
131
|
}
|