Skip to content

Commit 64d73e2

Browse files
committed
[docs] Upgrade to next 9 (mui#18441)
1 parent 23959df commit 64d73e2

File tree

498 files changed

+995
-817
lines changed

Some content is hidden

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

498 files changed

+995
-817
lines changed

docs/babel.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module.exports = {
3131
presets: [
3232
// backport of https://github.com/zeit/next.js/pull/9511
3333
['next/babel', { 'transform-runtime': { corejs: 2, version: transformRuntimeVersion } }],
34-
'@zeit/next-typescript/babel',
3534
],
3635
plugins: [
3736
'babel-plugin-optimize-clsx',

docs/next-env.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />

docs/next.config.js

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const webpack = require('webpack');
22
const path = require('path');
33
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
4-
const withTypescript = require('@zeit/next-typescript');
54
const pkg = require('../package.json');
65
const { findPages } = require('./src/modules/utils/find');
7-
const { LANGUAGES_SSR } = require('./src/modules/constants');
6+
const { LANGUAGES, LANGUAGES_SSR } = require('./src/modules/constants');
87

98
const workspaceRoot = path.join(__dirname, '../');
109

@@ -13,7 +12,7 @@ const workspaceRoot = path.join(__dirname, '../');
1312
*/
1413
const reactMode = 'legacy';
1514

16-
module.exports = withTypescript({
15+
module.exports = {
1716
webpack: (config, options) => {
1817
const plugins = config.plugins.concat([
1918
new webpack.DefinePlugin({
@@ -138,7 +137,7 @@ module.exports = withTypescript({
138137

139138
pages2.forEach(page => {
140139
if (!page.children) {
141-
map[`${prefix}${page.pathname}`] = {
140+
map[`${prefix}${page.pathname.replace(/^\/api-docs\/(.*)/, '/api/$1')}`] = {
142141
page: page.pathname,
143142
query: {
144143
userLanguage,
@@ -153,19 +152,25 @@ module.exports = withTypescript({
153152

154153
// We want to speed-up the build of pull requests.
155154
if (process.env.PULL_REQUEST === 'true') {
155+
// eslint-disable-next-line no-console
156+
console.log('Considering only English for SSR');
156157
traverse(pages, 'en');
157158
} else {
159+
// eslint-disable-next-line no-console
160+
console.log('Considering various locales for SSR');
158161
LANGUAGES_SSR.forEach(userLanguage => {
159162
traverse(pages, userLanguage);
160163
});
161164
}
162165

163166
return map;
164167
},
165-
onDemandEntries: {
166-
// Period (in ms) where the server will keep pages in the buffer
167-
maxInactiveAge: 120 * 1e3, // default 25s
168-
// Number of pages that should be kept simultaneously without being disposed
169-
pagesBufferLength: 3, // default 2
168+
experimental: {
169+
async rewrites() {
170+
return [
171+
{ source: `/:lang(${LANGUAGES.join('|')})?/:rest`, destination: '/:rest' },
172+
{ source: '/api/:rest*', destination: '/api-docs/:rest*' },
173+
];
174+
},
170175
},
171-
});
176+
};

docs/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"scripts": {
88
"build": "rimraf .next && cross-env NODE_ENV=production next build",
99
"build-sw": "node ./scripts/buildServiceWorker.js",
10-
"dev": "rimraf ./node_modules/.cache/babel-loader && cross-env NODE_ENV=development node src/server.js",
10+
"dev": "rimraf ./node_modules/.cache/babel-loader && next dev",
1111
"deploy": "git push material-ui-docs master:latest",
12-
"export": "rimraf docs/export && next export --threads=3 --concurrency=5 -o export && yarn build-sw && cpy \"cdn/*\" export",
13-
"icons": "rimraf static/icons/* && node ./scripts/buildIcons.js",
12+
"export": "rimraf docs/export && next export --threads=3 -o export && yarn build-sw",
13+
"icons": "rimraf public/static/icons/* && node ./scripts/buildIcons.js",
1414
"start": "next start",
1515
"typescript": "tsc -p tsconfig.json",
1616
"typescript:transpile": "node scripts/formattedTSDemos",
@@ -45,7 +45,6 @@
4545
"@types/react-virtualized": "^9.21.4",
4646
"@types/react-window": "^1.7.0",
4747
"@types/styled-components": "5.0.1",
48-
"@zeit/next-typescript": "^1.1.1",
4948
"accept-language": "^3.0.18",
5049
"address": "^1.0.3",
5150
"ast-types": "^0.13.2",
@@ -84,7 +83,7 @@
8483
"marked": "^0.8.0",
8584
"material-table": "^1.50.0",
8685
"material-ui-popup-state": "^1.4.1",
87-
"next": "8.1.0",
86+
"next": "9.1.4",
8887
"notistack": "^0.9.3",
8988
"nprogress": "^0.2.0",
9089
"postcss": "^7.0.18",

docs/pages/_app.js

+15-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import 'docs/src/modules/components/bootstrap';
33
// --- Post bootstrap -----
44
import React from 'react';
5-
import App, { Container } from 'next/app';
5+
import App from 'next/app';
66
import find from 'lodash/find';
77
import { Provider as ReduxProvider, useDispatch, useSelector } from 'react-redux';
88
import { loadCSS } from 'fg-loadcss/src/loadCSS';
@@ -292,7 +292,6 @@ function AppWrapper(props) {
292292
// See `_rewriteUrlForNextExport` on Next.js side.
293293
pathname = pathname.replace(/\/$/, '');
294294
}
295-
// console.log(pages, { ...router, pathname })
296295
const activePage = findActivePage(pages, pathname);
297296

298297
let fonts = ['https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap'];
@@ -304,22 +303,20 @@ function AppWrapper(props) {
304303

305304
return (
306305
<ReactMode>
307-
<Container>
308-
<NextHead>
309-
{fonts.map(font => (
310-
<link rel="stylesheet" href={font} key={font} />
311-
))}
312-
</NextHead>
313-
<ReduxProvider store={redux}>
314-
<PageContext.Provider value={{ activePage, pages, versions: pageProps.versions }}>
315-
<StylesProvider jss={jss}>
316-
<ThemeProvider>{children}</ThemeProvider>
317-
</StylesProvider>
318-
</PageContext.Provider>
319-
<PersistState />
320-
<LanguageNegotiation />
321-
</ReduxProvider>
322-
</Container>
306+
<NextHead>
307+
{fonts.map(font => (
308+
<link rel="stylesheet" href={font} key={font} />
309+
))}
310+
</NextHead>
311+
<ReduxProvider store={redux}>
312+
<PageContext.Provider value={{ activePage, pages, versions: pageProps.versions }}>
313+
<StylesProvider jss={jss}>
314+
<ThemeProvider>{children}</ThemeProvider>
315+
</StylesProvider>
316+
</PageContext.Provider>
317+
<PersistState />
318+
<LanguageNegotiation />
319+
</ReduxProvider>
323320
<GoogleAnalytics key={router.route} />
324321
</ReactMode>
325322
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const useStyles = makeStyles(theme => ({
9595
}));
9696

9797
const GettingStartedLink = React.forwardRef((props, ref) => {
98-
return <Link href="/getting-started/installation" naked prefetch ref={ref} {...props} />;
98+
return <Link href="/getting-started/installation" naked ref={ref} {...props} />;
9999
});
100100

101101
export default function HomePage() {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)