@docusaurus/core 0.0.0-4820 → 0.0.0-4824
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/App.d.ts +1 -1
- package/lib/client/App.js +1 -1
- package/lib/client/PendingNavigation.js +1 -1
- package/lib/client/{client-lifecycles-dispatcher.d.ts → clientLifecyclesDispatcher.d.ts} +0 -0
- package/lib/client/{client-lifecycles-dispatcher.js → clientLifecyclesDispatcher.js} +0 -0
- package/lib/client/docusaurus.d.ts +3 -3
- package/lib/client/docusaurus.js +2 -1
- package/lib/client/exports/Interpolate.js +15 -34
- package/package.json +12 -12
package/lib/client/App.d.ts
CHANGED
package/lib/client/App.js
CHANGED
|
@@ -14,7 +14,7 @@ import BaseUrlIssueBanner from './BaseUrlIssueBanner';
|
|
|
14
14
|
import SiteMetadataDefaults from './SiteMetadataDefaults';
|
|
15
15
|
import Root from '@theme/Root';
|
|
16
16
|
import SiteMetadata from '@theme/SiteMetadata';
|
|
17
|
-
import './
|
|
17
|
+
import './clientLifecyclesDispatcher';
|
|
18
18
|
// TODO, quick fix for CSS insertion order
|
|
19
19
|
import ErrorBoundary from '@docusaurus/ErrorBoundary';
|
|
20
20
|
import Error from '@theme/Error';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { Route, withRouter } from 'react-router-dom';
|
|
9
9
|
import nprogress from 'nprogress';
|
|
10
|
-
import clientLifecyclesDispatcher from './
|
|
10
|
+
import clientLifecyclesDispatcher from './clientLifecyclesDispatcher';
|
|
11
11
|
import preload from './preload';
|
|
12
12
|
import normalizeLocation from './normalizeLocation';
|
|
13
13
|
import './nprogress.css';
|
|
File without changes
|
|
File without changes
|
|
@@ -15,8 +15,8 @@ declare global {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
declare const
|
|
18
|
+
declare const _default: Readonly<{
|
|
19
19
|
prefetch: (routePath: string) => boolean;
|
|
20
20
|
preload: (routePath: string) => boolean;
|
|
21
|
-
}
|
|
22
|
-
export default
|
|
21
|
+
}>;
|
|
22
|
+
export default _default;
|
package/lib/client/docusaurus.js
CHANGED
|
@@ -5,48 +5,29 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { isValidElement } from 'react';
|
|
8
|
-
/*
|
|
9
|
-
Minimal implementation of a React interpolate component.
|
|
10
|
-
We don't ship a markdown parser nor a feature-complete i18n library on purpose.
|
|
11
|
-
More details here: https://github.com/facebook/docusaurus/pull/4295
|
|
12
|
-
*/
|
|
13
|
-
const ValueFoundMarker = '{}'; // does not care much
|
|
14
8
|
export function interpolate(text, values) {
|
|
15
|
-
const elements = [];
|
|
16
|
-
const processedText = text.replace(
|
|
17
9
|
// eslint-disable-next-line prefer-named-capture-group
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return ValueFoundMarker;
|
|
10
|
+
const segments = text.split(/(\{\w+\})/).map((seg, index) => {
|
|
11
|
+
// Odd indices (1, 3, 5...) of the segments are (potentially) interpolatable
|
|
12
|
+
if (index % 2 === 1) {
|
|
13
|
+
const value = values?.[seg.slice(1, -1)];
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
// No match: add warning? There's no way to "escape" interpolation though
|
|
27
18
|
}
|
|
28
|
-
return
|
|
19
|
+
return seg;
|
|
29
20
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
if (segments.some((seg) => isValidElement(seg))) {
|
|
22
|
+
return segments
|
|
23
|
+
.map((seg, index) => isValidElement(seg) ? React.cloneElement(seg, { key: index }) : seg)
|
|
24
|
+
.filter((seg) => seg !== '');
|
|
33
25
|
}
|
|
34
|
-
|
|
35
|
-
if (elements.every((el) => typeof el === 'string')) {
|
|
36
|
-
return processedText
|
|
37
|
-
.split(ValueFoundMarker)
|
|
38
|
-
.reduce((str, value, index) => str.concat(value).concat(elements[index] ?? ''), '');
|
|
39
|
-
}
|
|
40
|
-
// JSX interpolation: returns ReactNode
|
|
41
|
-
return processedText.split(ValueFoundMarker).map((value, index) => (<React.Fragment key={index}>
|
|
42
|
-
{value}
|
|
43
|
-
{elements[index]}
|
|
44
|
-
</React.Fragment>));
|
|
26
|
+
return segments.join('');
|
|
45
27
|
}
|
|
46
28
|
export default function Interpolate({ children, values, }) {
|
|
47
29
|
if (typeof children !== 'string') {
|
|
48
|
-
|
|
49
|
-
throw new Error('The Docusaurus <Interpolate> component only accept simple string values');
|
|
30
|
+
throw new Error(`The Docusaurus <Interpolate> component only accept simple string values. Received: ${isValidElement(children) ? 'React element' : typeof children}`);
|
|
50
31
|
}
|
|
51
32
|
return <>{interpolate(children, values)}</>;
|
|
52
33
|
}
|
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-4824",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.8",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.8",
|
|
43
43
|
"@babel/traverse": "^7.17.3",
|
|
44
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
45
|
-
"@docusaurus/logger": "0.0.0-
|
|
46
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
44
|
+
"@docusaurus/cssnano-preset": "0.0.0-4824",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4824",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4824",
|
|
47
47
|
"@docusaurus/react-loadable": "5.5.2",
|
|
48
|
-
"@docusaurus/utils": "0.0.0-
|
|
49
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
50
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
48
|
+
"@docusaurus/utils": "0.0.0-4824",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4824",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4824",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.4",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.4",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"core-js": "^3.21.1",
|
|
64
64
|
"css-loader": "^6.7.1",
|
|
65
65
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
66
|
-
"cssnano": "^5.1.
|
|
66
|
+
"cssnano": "^5.1.7",
|
|
67
67
|
"del": "^6.0.0",
|
|
68
68
|
"detect-port": "^1.3.0",
|
|
69
69
|
"escape-html": "^1.0.3",
|
|
@@ -98,15 +98,15 @@
|
|
|
98
98
|
"update-notifier": "^5.1.0",
|
|
99
99
|
"url-loader": "^4.1.1",
|
|
100
100
|
"wait-on": "^6.0.1",
|
|
101
|
-
"webpack": "^5.70.
|
|
101
|
+
"webpack": "^5.70.1",
|
|
102
102
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
103
103
|
"webpack-dev-server": "^4.7.4",
|
|
104
104
|
"webpack-merge": "^5.8.0",
|
|
105
105
|
"webpackbar": "^5.0.2"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
109
|
-
"@docusaurus/types": "0.0.0-
|
|
108
|
+
"@docusaurus/module-type-aliases": "0.0.0-4824",
|
|
109
|
+
"@docusaurus/types": "0.0.0-4824",
|
|
110
110
|
"@types/detect-port": "^1.3.2",
|
|
111
111
|
"@types/nprogress": "^0.2.0",
|
|
112
112
|
"@types/react-dom": "^17.0.14",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"engines": {
|
|
128
128
|
"node": ">=14"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "df5c106704eff281605d60327f62ecf65dfda2fd"
|
|
131
131
|
}
|