Skip to content

Commit 1459076

Browse files
authored
Merge pull request #313 from reactjs/sync-6d965422
Sync with reactjs.org @ 6d96542
2 parents 45c988c + 8947f96 commit 1459076

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+925
-553
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.16.1
1+
12.22.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repo contains the source code and documentation powering [reactjs.org](http
88

99
1. Git
1010
1. Node: any 12.x version starting with v12.0.0 or greater
11-
1. Yarn: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
11+
1. Yarn v1: See [Yarn website for installation instructions](https://yarnpkg.com/lang/en/docs/install/)
1212
1. A fork of the repo (for any contributions)
1313
1. A clone of the [reactjs.org repo](https://github.com/reactjs/reactjs.org) on your local machine
1414

beta/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ yarn-error.log*
3333

3434
# vercel
3535
.vercel
36+
37+
# external fonts
38+
public/fonts/Optimistic_Display_W_Lt.woff2
39+
public/fonts/Optimistic_Display_W_Md.woff2
40+
public/fonts/Optimistic_Display_W_Bd.woff2

beta/next.config.js

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,30 @@ const path = require('path');
66
const {remarkPlugins} = require('./plugins/markdownToHtml');
77
const redirects = require('./src/redirects.json');
88

9-
module.exports = {
9+
/**
10+
* @type {import('next').NextConfig}
11+
**/
12+
const nextConfig = {
1013
pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'],
1114
experimental: {
1215
plugins: true,
13-
// TODO: this doesn't work because https://github.com/vercel/next.js/issues/30714
14-
concurrentFeatures: false,
1516
scrollRestoration: true,
17+
legacyBrowsers: false,
18+
browsersListForSwc: true,
1619
},
1720
async redirects() {
1821
return redirects.redirects;
1922
},
20-
rewrites() {
21-
return [
22-
{
23-
source: '/feed.xml',
24-
destination: '/_next/static/feed.xml',
25-
},
26-
];
27-
},
23+
// TODO: this causes extra router.replace() on every page.
24+
// Let's disable until we figure out what's going on.
25+
// rewrites() {
26+
// return [
27+
// {
28+
// source: '/feed.xml',
29+
// destination: '/_next/static/feed.xml',
30+
// },
31+
// ];
32+
// },
2833
webpack: (config, {dev, isServer, ...options}) => {
2934
if (process.env.ANALYZE) {
3035
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
@@ -38,6 +43,27 @@ module.exports = {
3843
);
3944
}
4045

46+
// Don't bundle the shim unnecessarily.
47+
config.resolve.alias['use-sync-external-store/shim'] = 'react';
48+
49+
const {IgnorePlugin} = require('webpack');
50+
config.plugins.push(
51+
new IgnorePlugin({
52+
checkResource(resource, context) {
53+
if (
54+
/\/eslint\/lib\/rules$/.test(context) &&
55+
/\.\/[\w-]+(\.js)?$/.test(resource)
56+
) {
57+
// Skips imports of built-in rules that ESLint
58+
// tries to carry into the bundle by default.
59+
// We only want the engine and the React rules.
60+
return true;
61+
}
62+
return false;
63+
},
64+
})
65+
);
66+
4167
// Add our custom markdown loader in order to support frontmatter
4268
// and layout
4369
config.module.rules.push({
@@ -57,3 +83,5 @@ module.exports = {
5783
return config;
5884
},
5985
};
86+
87+
module.exports = nextConfig;

beta/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"analyze": "ANALYZE=true next build",
88
"dev": "next",
9-
"build": "next build && node ./scripts/generateRSS.js && node ./scripts/generateRedirects.js",
9+
"build": "next build && node ./scripts/generateRSS.js && node ./scripts/generateRedirects.js && node ./scripts/downloadFonts.js",
1010
"lint": "next lint",
1111
"lint:fix": "next lint --fix",
1212
"format:source": "prettier --config .prettierrc --write \"{plugins,src}/**/*.{js,ts,jsx,tsx,css}\"",
@@ -22,7 +22,7 @@
2222
"check-all": "npm-run-all prettier lint:fix tsc"
2323
},
2424
"dependencies": {
25-
"@codesandbox/sandpack-react": "v0.14.3-experimental.1",
25+
"@codesandbox/sandpack-react": "v0.19.8-experimental.4",
2626
"@docsearch/css": "3.0.0-alpha.41",
2727
"@docsearch/react": "3.0.0-alpha.41",
2828
"@headlessui/react": "^1.3.0",
@@ -33,23 +33,24 @@
3333
"debounce": "^1.2.1",
3434
"ga-lite": "^2.1.4",
3535
"github-slugger": "^1.3.0",
36-
"next": "^12.0.10",
36+
"next": "12.1.7-canary.11",
3737
"parse-numeric-range": "^1.2.0",
38-
"react": "experimental",
38+
"react": "0.0.0-experimental-82c64e1a4-20220520",
3939
"react-collapsed": "3.1.0",
40-
"react-dom": "experimental",
40+
"react-dom": "0.0.0-experimental-82c64e1a4-20220520",
4141
"scroll-into-view-if-needed": "^2.2.25"
4242
},
4343
"devDependencies": {
4444
"@mdx-js/loader": "^1.6.16",
4545
"@types/body-scroll-lock": "^2.6.1",
4646
"@types/classnames": "^2.2.10",
47+
"@types/debounce": "^1.2.1",
4748
"@types/github-slugger": "^1.3.0",
4849
"@types/mdx-js__react": "^1.5.2",
4950
"@types/node": "^14.6.4",
5051
"@types/parse-numeric-range": "^0.0.1",
51-
"@types/react": "^16.9.46",
52-
"@types/react-dom": "^16.9.8",
52+
"@types/react": "^18.0.9",
53+
"@types/react-dom": "^18.0.5",
5354
"@typescript-eslint/eslint-plugin": "2.x",
5455
"@typescript-eslint/parser": "2.x",
5556
"asyncro": "^3.0.0",

beta/patches/@codesandbox+sandpack-react+0.14.3-experimental.1.patch renamed to beta/patches/@codesandbox+sandpack-react+0.19.8-experimental.4.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/node_modules/@codesandbox/sandpack-react/dist/esm/index.js b/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
2-
index 4acfc3a..d00e57d 100644
2+
index ced9bd3..7e5e366 100644
33
--- a/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
44
+++ b/node_modules/@codesandbox/sandpack-react/dist/esm/index.js
55
@@ -566,17 +566,16 @@ var REACT_TEMPLATE = {

beta/scripts/downloadFonts.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*/
4+
5+
const {execSync} = require('child_process');
6+
7+
// So that we don't need to check them into the repo.
8+
// Serving them from the same domain is better for perf so do this on deploy.
9+
execSync(
10+
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Lt.woff2 --output public/fonts/Optimistic_Display_W_Lt.woff2'
11+
);
12+
execSync(
13+
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Md.woff2 --output public/fonts/Optimistic_Display_W_Md.woff2'
14+
);
15+
execSync(
16+
'curl https://conf.reactjs.org/fonts/Optimistic_Display_W_Bd.woff2 --output public/fonts/Optimistic_Display_W_Bd.woff2'
17+
);

beta/src/components/Layout/Feedback.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import * as React from 'react';
66
import {useRouter} from 'next/router';
7-
// @ts-ignore
8-
import galite from 'ga-lite';
7+
import {ga} from '../../utils/analytics';
98

109
export function Feedback({onSubmit = () => {}}: {onSubmit?: () => void}) {
1110
const {pathname} = useRouter();
@@ -48,7 +47,7 @@ const thumbsDownIcon = (
4847
function sendGAEvent(isPositive: boolean) {
4948
// Fragile. Don't change unless you've tested the network payload
5049
// and verified that the right events actually show up in GA.
51-
galite(
50+
ga(
5251
'send',
5352
'event',
5453
'button',

beta/src/components/Layout/Nav/MobileNav.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ export function MobileNav() {
5757
API
5858
</TabButton>
5959
</div>
60-
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} />
60+
{/* No fallback UI so need to be careful not to suspend directly inside. */}
61+
<React.Suspense fallback={null}>
62+
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} />
63+
</React.Suspense>
6164
</>
6265
);
6366
}

beta/src/components/Layout/Page.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ export function Page({routeTree, children}: PageProps) {
2626
<Sidebar />
2727
</div>
2828

29-
<div className="flex flex-1 w-full h-full self-stretch">
30-
<div className="w-full min-w-0">
31-
<main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around">
32-
{children}
33-
<Footer />
34-
</main>
29+
{/* No fallback UI so need to be careful not to suspend directly inside. */}
30+
<React.Suspense fallback={null}>
31+
<div className="flex flex-1 w-full h-full self-stretch">
32+
<div className="w-full min-w-0">
33+
<main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around">
34+
{children}
35+
<Footer />
36+
</main>
37+
</div>
3538
</div>
36-
</div>
39+
</React.Suspense>
3740
</div>
3841
</SidebarContext.Provider>
3942
</MenuProvider>

0 commit comments

Comments
 (0)