Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: React 18 #7102

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ec606d2
use hydrateroot api from `react-dom/client`
seyoon20087 Mar 30, 2022
729ee17
determine react 18 install status
seyoon20087 Mar 31, 2022
59e7bb1
Update package.json
seyoon20087 Apr 1, 2022
5df873e
Add React 18 support
seyoon20087 Apr 2, 2022
88103bc
Merge branch 'facebook:main' into react-18-support
seyoon20087 Apr 2, 2022
3a4fa92
Throw error if using React <= 17
seyoon20087 Apr 2, 2022
acd9604
update peer deps of react and react-dom to 18.x
seyoon20087 Apr 2, 2022
9a13631
update types
seyoon20087 Apr 2, 2022
3c891f2
update remaining packages
seyoon20087 Apr 2, 2022
594b5b3
update lockfile
seyoon20087 Apr 2, 2022
20a806b
refactor
Josh-Cena Apr 3, 2022
d830c4e
Create .npmrc
seyoon20087 Apr 7, 2022
831ffd3
create .npmrc using node api
seyoon20087 Apr 7, 2022
5999bd4
update index.ts
seyoon20087 Apr 7, 2022
2b639d0
update index.ts
seyoon20087 Apr 7, 2022
594c318
migrate to renderToPipeableStream API (new)
seyoon20087 Apr 8, 2022
9fcf835
use pre-compiled mdx packages
seyoon20087 Apr 8, 2022
159a426
fix test issue
seyoon20087 Apr 8, 2022
8aba9cb
move compiled mdx packages to core
seyoon20087 Apr 8, 2022
9fa30b5
fix jest issue
seyoon20087 Apr 9, 2022
6521e63
update ignore files
seyoon20087 Apr 9, 2022
61fcc75
fix jest issue
seyoon20087 Apr 9, 2022
2fca487
update ignore files
seyoon20087 Apr 9, 2022
a1d22ff
Move MDX packages to seperate package
seyoon20087 Apr 9, 2022
0d0ed9c
Move MDX packages to seperate package
seyoon20087 Apr 9, 2022
143bb71
fix yarn berry build issue
seyoon20087 Apr 9, 2022
235054c
Update github workflow file
seyoon20087 Apr 9, 2022
8c07440
use explicit import -- may fix integration with pnpm
seyoon20087 Apr 9, 2022
fa3de6d
Merge branch 'main' into react-18-support
seyoon20087 Apr 9, 2022
6427dca
fix package.json
seyoon20087 Apr 9, 2022
068703e
Merge branch 'main' into react-18-support
seyoon20087 Apr 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ignorePaths": [
"CHANGELOG.md",
"packages/docusaurus-theme-translations/locales",
"packages/docusaurus-mdx-packages",
"package.json",
"yarn.lock",
"project-words.txt",
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ packages/docusaurus/lib/
packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/stylelint-copyright/lib/
packages/docusaurus-mdx-packages
copyUntypedFiles.mjs

packages/create-docusaurus/lib/*
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ jobs:
yarn config set unsafeHttpWhitelist --json '["localhost"]'
yarn config set enableGlobalCache true

# Make PnP as strict as possible
# https://yarnpkg.com/features/pnp#fallback-mode
yarn config set pnpFallbackMode none
# Link dependencies to node_modules to prevent issues resolving dependencies
# https://yarnpkg.com/configuration/yarnrc#pnpFallbackMode
yarn config set pnpFallbackMode all

yarn install
working-directory: ../test-website
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ packages/docusaurus-*/lib/*
packages/docusaurus-*/lib-next/
packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/*/docusaurus.config.js
packages/docusaurus-mdx-packages
packages/stylelint-copyright/lib/
__fixtures__

Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"netlify-cli": "^9.16.4",
"nodemon": "^2.0.15",
"prettier": "^2.6.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-test-renderer": "^18.0.0",
"remark-parse": "^8.0.2",
"rimraf": "^3.0.2",
"sharp": "^0.30.3",
Expand All @@ -111,5 +111,8 @@
"stylelint-config-standard": "^25.0.0",
"typescript": "^4.6.3",
"unified": "^9.2.2"
},
"resolutions": {
"@types/react-dom": "^18.0.0"
}
}
1 change: 1 addition & 0 deletions packages/create-docusaurus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export default async function init(
cliOptions.packageManager,
cliOptions.skipInstall,
);

if (!cliOptions.skipInstall) {
shell.cd(dest);
logger.info`Installing dependencies with name=${pkgManager}...`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
Expand Down
5 changes: 2 additions & 3 deletions packages/create-docusaurus/templates/classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
seyoon20087 marked this conversation as resolved.
Show resolved Hide resolved
"clsx": "^1.1.1",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.18"
Expand Down
5 changes: 2 additions & 3 deletions packages/create-docusaurus/templates/facebook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-mdx-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"@babel/parser": "^7.17.9",
"@babel/traverse": "^7.17.9",
"@docusaurus/logger": "2.0.0-beta.18",
"@docusaurus/mdx-packages": "2.0.0-beta.18",
"@docusaurus/utils": "2.0.0-beta.18",
"@mdx-js/mdx": "^1.6.22",
"escape-html": "^1.0.3",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.1",
Expand All @@ -48,8 +48,8 @@
"unist-util-remove-position": "^3.0.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-mdx-loader/src/deps.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// TODO Types provided by MDX 2.0 https://github.com/mdx-js/mdx/blob/main/packages/mdx/types/index.d.ts
declare module '@mdx-js/mdx' {
declare module '@docusaurus/mdx-packages/mdx' {
import type {Processor} from 'unified';
import type {RemarkOrRehypePlugin} from '@docusaurus/mdx-loader';

Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-mdx-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import fs from 'fs-extra';
import {createCompiler} from '@mdx-js/mdx';
import {createCompiler} from '@docusaurus/mdx-packages/mdx';
import logger from '@docusaurus/logger';
import emoji from 'remark-emoji';
import {
Expand Down Expand Up @@ -234,7 +234,7 @@ ${assets ? `export const assets = ${createAssetsExportCode(assets)};` : ''}
const code = `
${pragma}
import React from 'react';
import { mdx } from '@mdx-js/react';
import { mdx } from '@docusaurus/mdx-packages/react/index.js';

${exportsCode}
${result}
Expand Down
5,628 changes: 5,628 additions & 0 deletions packages/docusaurus-mdx-packages/mdx/index.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions packages/docusaurus-mdx-packages/mdx/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@mdx-js/mdx",
"main": "index.js",
"license": "MIT"
}
15 changes: 15 additions & 0 deletions packages/docusaurus-mdx-packages/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docusaurus/mdx-packages",
"version": "2.0.0-beta.18",
"scripts": {
"build": "exit 0"
},
"repository": {
"directory": "packages/docusaurus-mdx-packages",
"type": "git",
"url": "https://github.com/facebook/docusaurus.git"
},
"publishConfig": {
"access": "public"
}
}
1 change: 1 addition & 0 deletions packages/docusaurus-mdx-packages/react/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/docusaurus-mdx-packages/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@mdx-js/react",
"main": "index.js",
"license": "MIT",
"peerDependencies": {
"react": ">= 16.14.0"
}
}
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-client-redirects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"escape-string-regexp": "^4.0.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"utility-types": "^3.10.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-google-gtag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
},
"peerDependencies": {
"jimp": "*",
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"peerDependenciesMeta": {
"jimp": {
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"fs-extra": "^10.0.1"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-sitemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@docusaurus/types": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-preset-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@docusaurus/theme-search-algolia": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
6 changes: 3 additions & 3 deletions packages/docusaurus-theme-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
"@types/rtlcss": "^3.1.3",
"cross-env": "^7.0.3",
"fs-extra": "^10.0.1",
"react-test-renderer": "^17.0.2",
"react-test-renderer": "^18.0.0",
"utility-types": "^3.10.0"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"lodash": "^4.17.21"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-live-codeblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"@types/buble": "^0.20.1"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-search-algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"@docusaurus/module-type-aliases": "2.0.0-beta.18"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",
"react-dom": "^16.8.4 || ^17.0.0"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"engines": {
"node": ">=14"
Expand Down
Loading