@docusaurus/core 0.0.0-5835 → 0.0.0-5836
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.
|
@@ -11,6 +11,7 @@ import Head from '@docusaurus/Head';
|
|
|
11
11
|
import ErrorBoundary from '@docusaurus/ErrorBoundary';
|
|
12
12
|
import { getErrorCausalChain } from '@docusaurus/utils-common';
|
|
13
13
|
import Layout from '@theme/Layout';
|
|
14
|
+
import { RouteContextProvider } from '../../routeContext';
|
|
14
15
|
function ErrorDisplay({ error, tryAgain }) {
|
|
15
16
|
return (<div style={{
|
|
16
17
|
display: 'flex',
|
|
@@ -42,19 +43,32 @@ function ErrorBoundaryError({ error }) {
|
|
|
42
43
|
const fullMessage = causalChain.map((e) => e.message).join('\n\nCause:\n');
|
|
43
44
|
return <p style={{ whiteSpace: 'pre-wrap' }}>{fullMessage}</p>;
|
|
44
45
|
}
|
|
46
|
+
// A bit hacky: we need to add an artificial RouteContextProvider here
|
|
47
|
+
// The goal is to be able to render the error inside the theme layout
|
|
48
|
+
// Without this, our theme classic would crash due to lack of route context
|
|
49
|
+
// See also https://github.com/facebook/docusaurus/pull/9852
|
|
50
|
+
function ErrorRouteContextProvider({ children }) {
|
|
51
|
+
return (<RouteContextProvider value={{
|
|
52
|
+
plugin: { name: 'docusaurus-core-error-boundary', id: 'default' },
|
|
53
|
+
}}>
|
|
54
|
+
{children}
|
|
55
|
+
</RouteContextProvider>);
|
|
56
|
+
}
|
|
45
57
|
export default function Error({ error, tryAgain }) {
|
|
46
58
|
// We wrap the error in its own error boundary because the layout can actually
|
|
47
59
|
// throw too... Only the ErrorDisplay component is simple enough to be
|
|
48
60
|
// considered safe to never throw
|
|
49
|
-
return (<
|
|
61
|
+
return (<ErrorRouteContextProvider>
|
|
62
|
+
<ErrorBoundary
|
|
50
63
|
// Note: we display the original error here, not the error that we
|
|
51
64
|
// captured in this extra error boundary
|
|
52
65
|
fallback={() => <ErrorDisplay error={error} tryAgain={tryAgain}/>}>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
<Head>
|
|
67
|
+
<title>Page Error</title>
|
|
68
|
+
</Head>
|
|
69
|
+
<Layout>
|
|
70
|
+
<ErrorDisplay error={error} tryAgain={tryAgain}/>
|
|
71
|
+
</Layout>
|
|
72
|
+
</ErrorBoundary>
|
|
73
|
+
</ErrorRouteContextProvider>);
|
|
60
74
|
}
|
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-5836",
|
|
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": "0.0.0-
|
|
47
|
-
"@docusaurus/logger": "0.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
46
|
+
"@docusaurus/cssnano-preset": "0.0.0-5836",
|
|
47
|
+
"@docusaurus/logger": "0.0.0-5836",
|
|
48
|
+
"@docusaurus/mdx-loader": "0.0.0-5836",
|
|
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-5836",
|
|
51
|
+
"@docusaurus/utils-common": "0.0.0-5836",
|
|
52
|
+
"@docusaurus/utils-validation": "0.0.0-5836",
|
|
53
53
|
"@svgr/webpack": "^6.5.1",
|
|
54
54
|
"autoprefixer": "^10.4.14",
|
|
55
55
|
"babel-loader": "^9.1.3",
|
|
@@ -105,8 +105,8 @@
|
|
|
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-5836",
|
|
109
|
+
"@docusaurus/types": "0.0.0-5836",
|
|
110
110
|
"@types/detect-port": "^1.3.3",
|
|
111
111
|
"@types/react-dom": "^18.2.7",
|
|
112
112
|
"@types/react-router-config": "^5.0.7",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"engines": {
|
|
126
126
|
"node": ">=18.0"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "3e0099e87cc86720ed1cbfcd3df76437ecefaf49"
|
|
129
129
|
}
|