Skip to content

Commit 0f29a37

Browse files
authored
feat: Add React 19 support to Docusaurus v3 (#10763)
1 parent f196a1e commit 0f29a37

File tree

37 files changed

+111
-85
lines changed

37 files changed

+111
-85
lines changed

.cspell.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"yarn.lock",
2727
"project-words.txt",
2828
"__snapshots__",
29+
"admin/scripts",
2930
"website/src/data/users.tsx",
3031
"website/src/data/tweets.tsx",
3132
"website/docusaurus.config.localized.json",

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Check for suspicious yarn.lock
3535
# for allowed aliases, see https://github.com/yargs/cliui/pull/139/files#r1670711112
36-
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable string-width-cjs strip-ansi-cjs wrap-ansi-cjs
36+
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable react-helmet-async string-width-cjs strip-ansi-cjs wrap-ansi-cjs
3737

3838
- name: Lint
3939
run: |

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
env:
5050
# Our website should build even with limited memory
5151
# See https://github.com/facebook/docusaurus/pull/10590
52-
NODE_OPTIONS: '--max-old-space-size=400'
52+
NODE_OPTIONS: '--max-old-space-size=450'
5353
DOCUSAURUS_PERF_LOGGER: 'true'
5454
- name: Docusaurus site CSS order
5555
run: yarn workspace website test:css-order

admin/scripts/test-release.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# This source code is licensed under the MIT license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
set -euo pipefail
8+
set -xeuo pipefail
9+
10+
rm -rf ../test-website
911

1012
CUSTOM_REGISTRY_URL="http://localhost:4873"
1113
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version")-NEW"
@@ -52,7 +54,8 @@ git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
5254
cd ..
5355

5456
# Build skeleton website with new version
55-
npm_config_registry="$CUSTOM_REGISTRY_URL" npx create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
57+
npm_config_registry="$CUSTOM_REGISTRY_URL" npx --yes --loglevel silly create-docusaurus@"$NEW_VERSION" test-website classic --javascript $EXTRA_OPTS
58+
5659

5760
# Stop Docker container
5861
if [[ -z "${KEEP_CONTAINER:-true}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then

admin/test-bad-package/README.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {version as ReactVersion} from 'react';
1212
import {version as ReactDOMVersion} from 'react-dom';
1313

1414
export function TestComponent() {
15-
const expectedVersion = 18;
15+
const expectedVersion = 19;
1616
if (!ReactVersion.startsWith(`${expectedVersion}`)) {
1717
throw new Error(
1818
`'test-bad-package/README.mdx' is rendered with bad React version: ${ReactVersion}`,

argos/tests/screenshot.spec.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,14 @@ function throwOnConsole(page: Page) {
135135
// it's already happening in main branch
136136
'Failed to load resource: the server responded with a status of 404 (Not Found)',
137137

138-
// TODO looks like legit hydration bugs to fix
139-
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=light"',
140-
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=dark"',
138+
// TODO legit hydration bugs to fix on embeds of /docs/styling-layout
139+
// useLocation() returns window.search/hash immediately :s
140+
'/docs/configuration?docusaurus-theme=light',
141+
'/docs/configuration?docusaurus-theme=dark',
142+
143+
// Warning because react-live not supporting React automatic JSX runtime
144+
// See https://github.com/FormidableLabs/react-live/issues/405
145+
'Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance',
141146

142147
// TODO weird problem related to KaTeX fonts refusing to decode?
143148
// on /docs/markdown-features/math-equations

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"prettier": "^2.8.8",
116116
"react": "^18.0.0",
117117
"react-dom": "^18.0.0",
118-
"react-helmet-async": "^1.3.0",
119118
"react-test-renderer": "^18.0.0",
120119
"rimraf": "^3.0.2",
121120
"sharp": "^0.32.3",

packages/create-docusaurus/templates/classic-typescript/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@mdx-js/react": "^3.0.0",
2121
"clsx": "^2.0.0",
2222
"prism-react-renderer": "^2.3.0",
23-
"react": "^18.0.0",
24-
"react-dom": "^18.0.0"
23+
"react": "^19.0.0",
24+
"react-dom": "^19.0.0"
2525
},
2626
"devDependencies": {
2727
"@docusaurus/module-type-aliases": "3.6.3",

packages/create-docusaurus/templates/classic/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"@mdx-js/react": "^3.0.0",
2020
"clsx": "^2.0.0",
2121
"prism-react-renderer": "^2.3.0",
22-
"react": "^18.0.0",
23-
"react-dom": "^18.0.0"
22+
"react": "^19.0.0",
23+
"react-dom": "^19.0.0"
2424
},
2525
"devDependencies": {
2626
"@docusaurus/module-type-aliases": "3.6.3",

packages/docusaurus-mdx-loader/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
"unist-util-remove-position": "^5.0.0"
5959
},
6060
"peerDependencies": {
61-
"react": "^18.0.0",
62-
"react-dom": "^18.0.0"
61+
"react": "^18.0.0 || ^19.0.0",
62+
"react-dom": "^18.0.0 || ^19.0.0"
6363
},
6464
"engines": {
6565
"node": ">=18.0"

packages/docusaurus-module-type-aliases/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@types/react": "*",
1818
"@types/react-router-config": "*",
1919
"@types/react-router-dom": "*",
20-
"react-helmet-async": "*",
20+
"react-helmet-async": "npm:@slorber/react-helmet-async@*",
2121
"react-loadable": "npm:@docusaurus/[email protected]"
2222
},
2323
"peerDependencies": {

packages/docusaurus-plugin-client-redirects/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"@docusaurus/types": "3.6.3"
3333
},
3434
"peerDependencies": {
35-
"react": "^18.0.0",
36-
"react-dom": "^18.0.0"
35+
"react": "^18.0.0 || ^19.0.0",
36+
"react-dom": "^18.0.0 || ^19.0.0"
3737
},
3838
"engines": {
3939
"node": ">=18.0"

packages/docusaurus-plugin-content-blog/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
},
5353
"peerDependencies": {
5454
"@docusaurus/plugin-content-docs": "*",
55-
"react": "^18.0.0",
56-
"react-dom": "^18.0.0"
55+
"react": "^18.0.0 || ^19.0.0",
56+
"react-dom": "^18.0.0 || ^19.0.0"
5757
},
5858
"engines": {
5959
"node": ">=18.0"

packages/docusaurus-plugin-content-docs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"shelljs": "^0.8.5"
6262
},
6363
"peerDependencies": {
64-
"react": "^18.0.0",
65-
"react-dom": "^18.0.0"
64+
"react": "^18.0.0 || ^19.0.0",
65+
"react-dom": "^18.0.0 || ^19.0.0"
6666
},
6767
"engines": {
6868
"node": ">=18.0"

packages/docusaurus-plugin-content-pages/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"webpack": "^5.88.1"
2929
},
3030
"peerDependencies": {
31-
"react": "^18.0.0",
32-
"react-dom": "^18.0.0"
31+
"react": "^18.0.0 || ^19.0.0",
32+
"react-dom": "^18.0.0 || ^19.0.0"
3333
},
3434
"engines": {
3535
"node": ">=18.0"

packages/docusaurus-plugin-debug/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"tslib": "^2.6.0"
2929
},
3030
"peerDependencies": {
31-
"react": "^18.0.0",
32-
"react-dom": "^18.0.0"
31+
"react": "^18.0.0 || ^19.0.0",
32+
"react-dom": "^18.0.0 || ^19.0.0"
3333
},
3434
"engines": {
3535
"node": ">=18.0"

packages/docusaurus-plugin-google-analytics/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"tslib": "^2.6.0"
2525
},
2626
"peerDependencies": {
27-
"react": "^18.0.0",
28-
"react-dom": "^18.0.0"
27+
"react": "^18.0.0 || ^19.0.0",
28+
"react-dom": "^18.0.0 || ^19.0.0"
2929
},
3030
"engines": {
3131
"node": ">=18.0"

packages/docusaurus-plugin-google-gtag/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"tslib": "^2.6.0"
2626
},
2727
"peerDependencies": {
28-
"react": "^18.0.0",
29-
"react-dom": "^18.0.0"
28+
"react": "^18.0.0 || ^19.0.0",
29+
"react-dom": "^18.0.0 || ^19.0.0"
3030
},
3131
"engines": {
3232
"node": ">=18.0"

packages/docusaurus-plugin-google-tag-manager/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"tslib": "^2.6.0"
2525
},
2626
"peerDependencies": {
27-
"react": "^18.0.0",
28-
"react-dom": "^18.0.0"
27+
"react": "^18.0.0 || ^19.0.0",
28+
"react-dom": "^18.0.0 || ^19.0.0"
2929
},
3030
"engines": {
3131
"node": ">=18.0"

packages/docusaurus-plugin-ideal-image/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@docusaurus/theme-translations": "3.6.3",
2727
"@docusaurus/types": "3.6.3",
2828
"@docusaurus/utils-validation": "3.6.3",
29-
"@slorber/react-ideal-image": "^0.0.12",
29+
"@slorber/react-ideal-image": "^0.0.14",
3030
"react-waypoint": "^10.3.0",
3131
"sharp": "^0.32.3",
3232
"tslib": "^2.6.0",
@@ -38,8 +38,8 @@
3838
},
3939
"peerDependencies": {
4040
"jimp": "*",
41-
"react": "^18.0.0",
42-
"react-dom": "^18.0.0"
41+
"react": "^18.0.0 || ^19.0.0",
42+
"react-dom": "^18.0.0 || ^19.0.0"
4343
},
4444
"peerDependenciesMeta": {
4545
"jimp": {

packages/docusaurus-plugin-pwa/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"fs-extra": "^11.1.0"
4646
},
4747
"peerDependencies": {
48-
"react": "^18.0.0",
49-
"react-dom": "^18.0.0"
48+
"react": "^18.0.0 || ^19.0.0",
49+
"react-dom": "^18.0.0 || ^19.0.0"
5050
},
5151
"engines": {
5252
"node": ">=18.0"

packages/docusaurus-plugin-rsdoctor/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"tslib": "^2.6.0"
2727
},
2828
"peerDependencies": {
29-
"react": "^18.0.0",
30-
"react-dom": "^18.0.0"
29+
"react": "^18.0.0 || ^19.0.0",
30+
"react-dom": "^18.0.0 || ^19.0.0"
3131
},
3232
"engines": {
3333
"node": ">=18.0"

packages/docusaurus-plugin-sitemap/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"@total-typescript/shoehorn": "^0.1.2"
3333
},
3434
"peerDependencies": {
35-
"react": "^18.0.0",
36-
"react-dom": "^18.0.0"
35+
"react": "^18.0.0 || ^19.0.0",
36+
"react-dom": "^18.0.0 || ^19.0.0"
3737
},
3838
"engines": {
3939
"node": ">=18.0"

packages/docusaurus-plugin-svgr/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"webpack": "^5.88.1"
2929
},
3030
"peerDependencies": {
31-
"react": "^18.0.0",
32-
"react-dom": "^18.0.0"
31+
"react": "^18.0.0 || ^19.0.0",
32+
"react-dom": "^18.0.0 || ^19.0.0"
3333
},
3434
"engines": {
3535
"node": ">=18.0"

packages/docusaurus-plugin-vercel-analytics/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"tslib": "^2.6.0"
2828
},
2929
"peerDependencies": {
30-
"react": "^18.0.0",
31-
"react-dom": "^18.0.0"
30+
"react": "^18.0.0 || ^19.0.0",
31+
"react-dom": "^18.0.0 || ^19.0.0"
3232
},
3333
"engines": {
3434
"node": ">=18.0"

packages/docusaurus-preset-classic/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"@docusaurus/types": "3.6.3"
3535
},
3636
"peerDependencies": {
37-
"react": "^18.0.0",
38-
"react-dom": "^18.0.0"
37+
"react": "^18.0.0 || ^19.0.0",
38+
"react-dom": "^18.0.0 || ^19.0.0"
3939
},
4040
"engines": {
4141
"node": ">=18.0"

packages/docusaurus-theme-classic/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"utility-types": "^3.10.0"
5757
},
5858
"peerDependencies": {
59-
"react": "^18.0.0",
60-
"react-dom": "^18.0.0"
59+
"react": "^18.0.0 || ^19.0.0",
60+
"react-dom": "^18.0.0 || ^19.0.0"
6161
},
6262
"engines": {
6363
"node": ">=18.0"

packages/docusaurus-theme-common/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
},
5353
"peerDependencies": {
5454
"@docusaurus/plugin-content-docs": "*",
55-
"react": "^18.0.0",
56-
"react-dom": "^18.0.0"
55+
"react": "^18.0.0 || ^19.0.0",
56+
"react-dom": "^18.0.0 || ^19.0.0"
5757
},
5858
"engines": {
5959
"node": ">=18.0"

packages/docusaurus-theme-live-codeblock/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"@types/buble": "^0.20.1"
3939
},
4040
"peerDependencies": {
41-
"react": "^18.0.0",
42-
"react-dom": "^18.0.0"
41+
"react": "^18.0.0 || ^19.0.0",
42+
"react-dom": "^18.0.0 || ^19.0.0"
4343
},
4444
"engines": {
4545
"node": ">=18.0"

packages/docusaurus-theme-mermaid/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
"react-test-renderer": "^18.0.0"
4646
},
4747
"peerDependencies": {
48-
"react": "^18.0.0",
49-
"react-dom": "^18.0.0"
48+
"react": "^18.0.0 || ^19.0.0",
49+
"react-dom": "^18.0.0 || ^19.0.0"
5050
},
5151
"engines": {
5252
"node": ">=18.0"

packages/docusaurus-theme-search-algolia/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"@docusaurus/module-type-aliases": "3.6.3"
5555
},
5656
"peerDependencies": {
57-
"react": "^18.0.0",
58-
"react-dom": "^18.0.0"
57+
"react": "^18.0.0 || ^19.0.0",
58+
"react-dom": "^18.0.0 || ^19.0.0"
5959
},
6060
"engines": {
6161
"node": ">=18.0"

packages/docusaurus-types/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"@types/react": "*",
1919
"commander": "^5.1.0",
2020
"joi": "^17.9.2",
21-
"react-helmet-async": "^1.3.0",
21+
"react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0",
2222
"utility-types": "^3.10.0",
2323
"webpack": "^5.95.0",
2424
"webpack-merge": "^5.9.0"
2525
},
2626
"peerDependencies": {
27-
"react": "^18.0.0",
28-
"react-dom": "^18.0.0"
27+
"react": "^18.0.0 || ^19.0.0",
28+
"react-dom": "^18.0.0 || ^19.0.0"
2929
}
3030
}

packages/docusaurus/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"p-map": "^4.0.0",
6161
"prompts": "^2.4.2",
6262
"react-dev-utils": "^12.0.1",
63-
"react-helmet-async": "^1.3.0",
63+
"react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0",
6464
"react-loadable": "npm:@docusaurus/[email protected]",
6565
"react-loadable-ssr-addon-v5-slorber": "^1.0.1",
6666
"react-router": "^5.3.4",
@@ -94,8 +94,8 @@
9494
},
9595
"peerDependencies": {
9696
"@mdx-js/react": "^3.0.0",
97-
"react": "^18.0.0",
98-
"react-dom": "^18.0.0"
97+
"react": "^18.0.0 || ^19.0.0",
98+
"react-dom": "^18.0.0 || ^19.0.0"
9999
},
100100
"engines": {
101101
"node": ">=18.0"

0 commit comments

Comments
 (0)