@docusaurus/core 0.0.0-5047 → 0.0.0-5048
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 +3 -1
- package/lib/client/ClientLifecyclesDispatcher.js +1 -1
- package/lib/client/docusaurus.js +1 -1
- package/lib/client/exports/isInternalUrl.js +1 -1
- package/lib/client/exports/useGlobalData.js +0 -3
- package/lib/client/prefetch.js +2 -2
- package/lib/client/serverEntry.js +2 -2
- package/lib/server/configValidation.js +2 -2
- package/lib/server/translations/translationsExtractor.js +2 -2
- package/package.json +10 -10
package/bin/beforeCli.mjs
CHANGED
|
@@ -16,7 +16,9 @@ import updateNotifier from 'update-notifier';
|
|
|
16
16
|
import boxen from 'boxen';
|
|
17
17
|
import {DOCUSAURUS_VERSION} from '@docusaurus/utils';
|
|
18
18
|
|
|
19
|
-
const packageJson =
|
|
19
|
+
const packageJson = /** @type {import("../package.json")} */ (
|
|
20
|
+
createRequire(import.meta.url)('../package.json')
|
|
21
|
+
);
|
|
20
22
|
/** @type {Record<string, any>} */
|
|
21
23
|
let sitePkg;
|
|
22
24
|
try {
|
|
@@ -8,7 +8,7 @@ import { useLayoutEffect } from 'react';
|
|
|
8
8
|
import clientModules from '@generated/client-modules';
|
|
9
9
|
export function dispatchLifecycleAction(lifecycleAction, ...args) {
|
|
10
10
|
const callbacks = clientModules.map((clientModule) => {
|
|
11
|
-
const lifecycleFunction = (clientModule
|
|
11
|
+
const lifecycleFunction = (clientModule.default?.[lifecycleAction] ??
|
|
12
12
|
clientModule[lifecycleAction]);
|
|
13
13
|
return lifecycleFunction?.(...args);
|
|
14
14
|
});
|
package/lib/client/docusaurus.js
CHANGED
|
@@ -42,7 +42,7 @@ const docusaurus = {
|
|
|
42
42
|
// In some cases, webpack might decide to optimize further, leading to
|
|
43
43
|
// the chunk assets being merged to another chunk. In this case, we can
|
|
44
44
|
// safely filter it out and don't need to load it.
|
|
45
|
-
if (chunkAsset &&
|
|
45
|
+
if (chunkAsset && !chunkAsset.includes('undefined')) {
|
|
46
46
|
return prefetchHelper(chunkAsset);
|
|
47
47
|
}
|
|
48
48
|
return Promise.resolve();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export function hasProtocol(url) {
|
|
8
|
-
return /^(?:\w*:|\/\/)/.test(url)
|
|
8
|
+
return /^(?:\w*:|\/\/)/.test(url);
|
|
9
9
|
}
|
|
10
10
|
export default function isInternalUrl(url) {
|
|
11
11
|
return typeof url !== 'undefined' && !hasProtocol(url);
|
|
@@ -8,9 +8,6 @@ import useDocusaurusContext from './useDocusaurusContext';
|
|
|
8
8
|
import { DEFAULT_PLUGIN_ID } from './constants';
|
|
9
9
|
export default function useGlobalData() {
|
|
10
10
|
const { globalData } = useDocusaurusContext();
|
|
11
|
-
if (!globalData) {
|
|
12
|
-
throw new Error('Docusaurus global data not found.');
|
|
13
|
-
}
|
|
14
11
|
return globalData;
|
|
15
12
|
}
|
|
16
13
|
export function useAllPluginInstancesData(pluginName, options = {}) {
|
package/lib/client/prefetch.js
CHANGED
|
@@ -84,9 +84,9 @@ async function doRender(locals) {
|
|
|
84
84
|
// Using readJSON seems to fail for users of some plugins, possibly because of
|
|
85
85
|
// the eval sandbox having a different `Buffer` instance (native one instead
|
|
86
86
|
// of polyfilled one)
|
|
87
|
-
const manifest = await fs
|
|
87
|
+
const manifest = (await fs
|
|
88
88
|
.readFile(manifestPath, 'utf-8')
|
|
89
|
-
.then(JSON.parse);
|
|
89
|
+
.then(JSON.parse));
|
|
90
90
|
// Get all required assets for this particular page based on client
|
|
91
91
|
// manifest information.
|
|
92
92
|
const modulesToBeLoaded = [...manifest.entrypoints, ...Array.from(modules)];
|
|
@@ -65,7 +65,7 @@ function createPluginSchema(theme) {
|
|
|
65
65
|
[function myPlugin() { },options]
|
|
66
66
|
],
|
|
67
67
|
};`;
|
|
68
|
-
error.message = ` => Bad Docusaurus ${theme ? 'theme' : 'plugin'} value
|
|
68
|
+
error.message = ` => Bad Docusaurus ${theme ? 'theme' : 'plugin'} value ${error.path.reduce((acc, cur) => typeof cur === 'string' ? `${acc}.${cur}` : `${acc}[${cur}]`)}.
|
|
69
69
|
${validConfigExample}
|
|
70
70
|
`;
|
|
71
71
|
});
|
|
@@ -189,7 +189,7 @@ function validateConfig(config) {
|
|
|
189
189
|
if (error) {
|
|
190
190
|
const unknownFields = error.details.reduce((formattedError, err) => {
|
|
191
191
|
if (err.type === 'object.unknown') {
|
|
192
|
-
return `${formattedError}"${err.path}",`;
|
|
192
|
+
return `${formattedError}"${err.path.reduce((acc, cur) => typeof cur === 'string' ? `${acc}.${cur}` : `${acc}[${cur}]`)}",`;
|
|
193
193
|
}
|
|
194
194
|
return formattedError;
|
|
195
195
|
}, '');
|
|
@@ -118,7 +118,7 @@ https://github.com/pugjs/babel-walk
|
|
|
118
118
|
*/
|
|
119
119
|
function extractSourceCodeAstTranslations(ast, sourceCodeFilePath) {
|
|
120
120
|
function sourceWarningPart(node) {
|
|
121
|
-
return `File: ${sourceCodeFilePath} at line ${node.loc?.start.line}
|
|
121
|
+
return `File: ${sourceCodeFilePath} at line ${node.loc?.start.line ?? '?'}
|
|
122
122
|
Full code: ${(0, generator_1.default)(node).code}`;
|
|
123
123
|
}
|
|
124
124
|
const translations = {};
|
|
@@ -207,7 +207,7 @@ ${sourceWarningPart(path.node)}`);
|
|
|
207
207
|
if (isJSXText || isJSXExpressionContainer) {
|
|
208
208
|
message = isJSXText
|
|
209
209
|
? singleChildren.node.value.trim().replace(/\s+/g, ' ')
|
|
210
|
-
: singleChildren.get('expression').evaluate().value;
|
|
210
|
+
: String(singleChildren.get('expression').evaluate().value);
|
|
211
211
|
translations[id ?? message] = {
|
|
212
212
|
message,
|
|
213
213
|
...(description && { description }),
|
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": "0.0.0-
|
|
4
|
+
"version": "0.0.0-5048",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@babel/runtime": "^7.18.0",
|
|
44
44
|
"@babel/runtime-corejs3": "^7.18.0",
|
|
45
45
|
"@babel/traverse": "^7.18.0",
|
|
46
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
47
|
-
"@docusaurus/logger": "0.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
46
|
+
"@docusaurus/cssnano-preset": "0.0.0-5048",
|
|
47
|
+
"@docusaurus/logger": "0.0.0-5048",
|
|
48
|
+
"@docusaurus/mdx-loader": "0.0.0-5048",
|
|
49
49
|
"@docusaurus/react-loadable": "5.5.2",
|
|
50
|
-
"@docusaurus/utils": "0.0.0-
|
|
51
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
52
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
50
|
+
"@docusaurus/utils": "0.0.0-5048",
|
|
51
|
+
"@docusaurus/utils-common": "0.0.0-5048",
|
|
52
|
+
"@docusaurus/utils-validation": "0.0.0-5048",
|
|
53
53
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.4",
|
|
54
54
|
"@svgr/webpack": "^6.2.1",
|
|
55
55
|
"autoprefixer": "^10.4.7",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"webpackbar": "^5.0.2"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
111
|
-
"@docusaurus/types": "0.0.0-
|
|
110
|
+
"@docusaurus/module-type-aliases": "0.0.0-5048",
|
|
111
|
+
"@docusaurus/types": "0.0.0-5048",
|
|
112
112
|
"@types/detect-port": "^1.3.2",
|
|
113
113
|
"@types/react-dom": "^18.0.4",
|
|
114
114
|
"@types/react-router-config": "^5.0.6",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"engines": {
|
|
129
129
|
"node": ">=14"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "f5680d2f2633fbd6594972ae1f4c1ddb1467f9ac"
|
|
132
132
|
}
|