@docusaurus/core 3.0.0-beta.0 → 3.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.
|
@@ -23,8 +23,8 @@ if (ExecutionEnvironment.canUseDOM) {
|
|
|
23
23
|
<App />
|
|
24
24
|
</BrowserRouter>
|
|
25
25
|
</HelmetProvider>);
|
|
26
|
-
const onRecoverableError = (error) => {
|
|
27
|
-
console.error('Docusaurus React Root onRecoverableError:', error);
|
|
26
|
+
const onRecoverableError = (error, errorInfo) => {
|
|
27
|
+
console.error('Docusaurus React Root onRecoverableError:', error, errorInfo);
|
|
28
28
|
};
|
|
29
29
|
const renderApp = () => {
|
|
30
30
|
if (hydrate) {
|
package/lib/server/config.js
CHANGED
|
@@ -10,13 +10,12 @@ exports.loadSiteConfig = void 0;
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
-
const import_fresh_1 = tslib_1.__importDefault(require("import-fresh"));
|
|
14
13
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
15
14
|
const utils_1 = require("@docusaurus/utils");
|
|
16
15
|
const configValidation_1 = require("./configValidation");
|
|
17
16
|
async function findConfig(siteDir) {
|
|
18
17
|
// We could support .mjs, .ts, etc. in the future
|
|
19
|
-
const candidates = ['.js', '.cjs'].map((ext) => utils_1.DEFAULT_CONFIG_FILE_NAME + ext);
|
|
18
|
+
const candidates = ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs'].map((ext) => utils_1.DEFAULT_CONFIG_FILE_NAME + ext);
|
|
20
19
|
const configPath = await (0, utils_1.findAsyncSequential)(candidates.map((file) => path_1.default.join(siteDir, file)), fs_extra_1.default.pathExists);
|
|
21
20
|
if (!configPath) {
|
|
22
21
|
logger_1.default.error('No config file found.');
|
|
@@ -33,7 +32,7 @@ async function loadSiteConfig({ siteDir, customConfigFilePath, }) {
|
|
|
33
32
|
if (!(await fs_extra_1.default.pathExists(siteConfigPath))) {
|
|
34
33
|
throw new Error(`Config file at "${siteConfigPath}" not found.`);
|
|
35
34
|
}
|
|
36
|
-
const importedConfig = (0,
|
|
35
|
+
const importedConfig = await (0, utils_1.loadFreshModule)(siteConfigPath);
|
|
37
36
|
const loadedConfig = typeof importedConfig === 'function'
|
|
38
37
|
? await importedConfig()
|
|
39
38
|
: await importedConfig;
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.loadPluginConfigs = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
10
|
const module_1 = require("module");
|
|
12
|
-
const
|
|
11
|
+
const utils_1 = require("@docusaurus/utils");
|
|
13
12
|
const presets_1 = require("./presets");
|
|
14
13
|
const moduleShorthand_1 = require("./moduleShorthand");
|
|
15
14
|
async function normalizePluginConfig(pluginConfig, configPath, pluginRequire) {
|
|
@@ -17,7 +16,7 @@ async function normalizePluginConfig(pluginConfig, configPath, pluginRequire) {
|
|
|
17
16
|
if (typeof pluginConfig === 'string') {
|
|
18
17
|
const pluginModuleImport = pluginConfig;
|
|
19
18
|
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
20
|
-
const pluginModule = (0,
|
|
19
|
+
const pluginModule = (await (0, utils_1.loadFreshModule)(pluginPath));
|
|
21
20
|
return {
|
|
22
21
|
plugin: pluginModule.default ?? pluginModule,
|
|
23
22
|
options: {},
|
|
@@ -42,7 +41,7 @@ async function normalizePluginConfig(pluginConfig, configPath, pluginRequire) {
|
|
|
42
41
|
if (typeof pluginConfig[0] === 'string') {
|
|
43
42
|
const pluginModuleImport = pluginConfig[0];
|
|
44
43
|
const pluginPath = pluginRequire.resolve(pluginModuleImport);
|
|
45
|
-
const pluginModule = (0,
|
|
44
|
+
const pluginModule = (await (0, utils_1.loadFreshModule)(pluginPath));
|
|
46
45
|
return {
|
|
47
46
|
plugin: pluginModule.default ?? pluginModule,
|
|
48
47
|
options: pluginConfig[1],
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.loadPresets = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
10
|
const module_1 = require("module");
|
|
12
|
-
const
|
|
11
|
+
const utils_1 = require("@docusaurus/utils");
|
|
13
12
|
const moduleShorthand_1 = require("./moduleShorthand");
|
|
14
13
|
/**
|
|
15
14
|
* Calls preset functions, aggregates each of their return values, and returns
|
|
@@ -19,15 +18,10 @@ async function loadPresets(context) {
|
|
|
19
18
|
// We need to resolve plugins from the perspective of the site config, as if
|
|
20
19
|
// we are using `require.resolve` on those module names.
|
|
21
20
|
const presetRequire = (0, module_1.createRequire)(context.siteConfigPath);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const themes = [];
|
|
25
|
-
presets.forEach((presetItem) => {
|
|
21
|
+
const presets = context.siteConfig.presets.filter((p) => !!p);
|
|
22
|
+
async function loadPreset(presetItem) {
|
|
26
23
|
let presetModuleImport;
|
|
27
24
|
let presetOptions = {};
|
|
28
|
-
if (!presetItem) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
25
|
if (typeof presetItem === 'string') {
|
|
32
26
|
presetModuleImport = presetItem;
|
|
33
27
|
}
|
|
@@ -35,15 +29,14 @@ async function loadPresets(context) {
|
|
|
35
29
|
[presetModuleImport, presetOptions] = presetItem;
|
|
36
30
|
}
|
|
37
31
|
const presetName = (0, moduleShorthand_1.resolveModuleName)(presetModuleImport, presetRequire, 'preset');
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
32
|
+
const presetPath = presetRequire.resolve(presetName);
|
|
33
|
+
const presetModule = (await (0, utils_1.loadFreshModule)(presetPath));
|
|
34
|
+
const presetFunction = presetModule.default ?? presetModule;
|
|
35
|
+
return presetFunction(context, presetOptions);
|
|
36
|
+
}
|
|
37
|
+
const loadedPresets = await Promise.all(presets.map(loadPreset));
|
|
38
|
+
const plugins = loadedPresets.flatMap((preset) => preset.plugins ?? []);
|
|
39
|
+
const themes = loadedPresets.flatMap((preset) => preset.themes ?? []);
|
|
47
40
|
return { plugins, themes };
|
|
48
41
|
}
|
|
49
42
|
exports.loadPresets = loadPresets;
|
|
@@ -10,7 +10,6 @@ exports.loadSiteMetadata = exports.getPluginVersion = 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"));
|
|
13
|
-
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
14
13
|
const utils_1 = require("@docusaurus/utils");
|
|
15
14
|
async function getPackageJsonVersion(packageJsonPath) {
|
|
16
15
|
if (await fs_extra_1.default.pathExists(packageJsonPath)) {
|
|
@@ -60,10 +59,9 @@ function checkDocusaurusPackagesVersion(siteMetadata) {
|
|
|
60
59
|
versionInfo.name?.startsWith('@docusaurus/') &&
|
|
61
60
|
versionInfo.version &&
|
|
62
61
|
versionInfo.version !== docusaurusVersion) {
|
|
63
|
-
|
|
64
|
-
logger_1.default.error `Invalid name=${plugin} version number=${versionInfo.version}.
|
|
62
|
+
throw new Error(`Invalid name=${plugin} version number=${versionInfo.version}.
|
|
65
63
|
All official @docusaurus/* packages should have the exact same version as @docusaurus/core (number=${docusaurusVersion}).
|
|
66
|
-
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file
|
|
64
|
+
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file?`);
|
|
67
65
|
}
|
|
68
66
|
});
|
|
69
67
|
}
|
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-rc.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -43,13 +43,13 @@
|
|
|
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.0.0-
|
|
47
|
-
"@docusaurus/logger": "3.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "3.0.0-
|
|
46
|
+
"@docusaurus/cssnano-preset": "3.0.0-rc.1",
|
|
47
|
+
"@docusaurus/logger": "3.0.0-rc.1",
|
|
48
|
+
"@docusaurus/mdx-loader": "3.0.0-rc.1",
|
|
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-rc.1",
|
|
51
|
+
"@docusaurus/utils-common": "3.0.0-rc.1",
|
|
52
|
+
"@docusaurus/utils-validation": "3.0.0-rc.1",
|
|
53
53
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.7",
|
|
54
54
|
"@svgr/webpack": "^6.5.1",
|
|
55
55
|
"autoprefixer": "^10.4.14",
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
"html-minifier-terser": "^7.2.0",
|
|
77
77
|
"html-tags": "^3.3.1",
|
|
78
78
|
"html-webpack-plugin": "^5.5.3",
|
|
79
|
-
"import-fresh": "^3.3.0",
|
|
80
79
|
"leven": "^3.1.0",
|
|
81
80
|
"lodash": "^4.17.21",
|
|
82
81
|
"mini-css-extract-plugin": "^2.7.6",
|
|
@@ -106,8 +105,8 @@
|
|
|
106
105
|
"webpackbar": "^5.0.2"
|
|
107
106
|
},
|
|
108
107
|
"devDependencies": {
|
|
109
|
-
"@docusaurus/module-type-aliases": "3.0.0-
|
|
110
|
-
"@docusaurus/types": "3.0.0-
|
|
108
|
+
"@docusaurus/module-type-aliases": "3.0.0-rc.1",
|
|
109
|
+
"@docusaurus/types": "3.0.0-rc.1",
|
|
111
110
|
"@types/detect-port": "^1.3.3",
|
|
112
111
|
"@types/react-dom": "^18.2.7",
|
|
113
112
|
"@types/react-router-config": "^5.0.7",
|
|
@@ -125,7 +124,7 @@
|
|
|
125
124
|
"react-dom": "^18.0.0"
|
|
126
125
|
},
|
|
127
126
|
"engines": {
|
|
128
|
-
"node": ">=
|
|
127
|
+
"node": ">=18.0"
|
|
129
128
|
},
|
|
130
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "a51cc6fd7660d47ea08349f723cec9c017af0b4e"
|
|
131
130
|
}
|