Skip to content

Commit 0de7820

Browse files
authored
Merge branch 'canary' into cms-builder-io-example
2 parents 6a216e4 + fff183c commit 0de7820

File tree

32 files changed

+65463
-65028
lines changed

32 files changed

+65463
-65028
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"extends": ["plugin:jest/recommended"],
2828
"rules": {
2929
"jest/expect-expect": "off",
30-
"jest/no-disabled-tests": "off"
30+
"jest/no-disabled-tests": "off",
31+
"jest/no-conditional-expect": "off",
32+
"jest/valid-title": "off",
33+
"jest/no-interpolation-in-snapshots": "off"
3134
}
3235
},
3336
{ "files": ["**/__tests__/**"], "env": { "jest": true } },

.github/workflows/test_react_experimental.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
# needs: build
3030
env:
3131
NEXT_TELEMETRY_DISABLED: 1
32-
NEXT_PRIVATE_REACT_MODE: concurrent
3332
HEADLESS: true
3433
NEXT_PRIVATE_SKIP_SIZE_TESTS: true
34+
NEXT_PRIVATE_REACT_ROOT: 1
3535
strategy:
3636
fail-fast: false
3737
matrix:

examples/api-routes-rest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ npx create-next-app --example api-routes-rest api-routes-rest-app
1818
yarn create next-app --example api-routes-rest api-routes-rest-app
1919
```
2020

21-
### Deploy to Now
21+
### Deploy to Vercel
2222

2323
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

examples/with-mongodb-mongoose/utils/dbConnect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import mongoose from 'mongoose'
22

3-
const { MONGODB_URI } = process.env
3+
const MONGODB_URI = process.env.MONGODB_URI
44

55
if (!MONGODB_URI) {
66
throw new Error(

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"@types/http-proxy": "1.17.3",
5050
"@types/jest": "24.0.13",
5151
"@types/string-hash": "1.1.1",
52-
"@typescript-eslint/eslint-plugin": "2.17.0",
53-
"@typescript-eslint/parser": "2.17.0",
52+
"@typescript-eslint/eslint-plugin": "4.22.0",
53+
"@typescript-eslint/parser": "4.22.0",
5454
"@zeit/next-css": "1.0.2-canary.2",
5555
"@zeit/next-sass": "1.0.2-canary.2",
5656
"@zeit/next-typescript": "1.1.2-canary.0",
@@ -71,11 +71,11 @@
7171
"cross-env": "6.0.3",
7272
"cross-spawn": "6.0.5",
7373
"escape-string-regexp": "2.0.0",
74-
"eslint": "6.8.0",
75-
"eslint-plugin-import": "2.20.2",
76-
"eslint-plugin-jest": "23.13.1",
77-
"eslint-plugin-react": "7.19.0",
78-
"eslint-plugin-react-hooks": "2.3.0",
74+
"eslint": "7.24.0",
75+
"eslint-plugin-import": "2.22.1",
76+
"eslint-plugin-jest": "24.3.5",
77+
"eslint-plugin-react": "7.23.2",
78+
"eslint-plugin-react-hooks": "4.2.0",
7979
"execa": "2.0.3",
8080
"express": "4.17.0",
8181
"faunadb": "2.6.1",
@@ -87,7 +87,6 @@
8787
"image-size": "0.9.3",
8888
"is-animated": "2.0.0",
8989
"isomorphic-unfetch": "3.0.0",
90-
"jest-cli": "27.0.0-next.5",
9190
"ky": "0.19.1",
9291
"ky-universal": "0.6.0",
9392
"lerna": "4.0.0",
@@ -129,7 +128,8 @@
129128
"wait-port": "0.2.2",
130129
"web-streams-polyfill": "2.1.1",
131130
"webpack-bundle-analyzer": "4.3.0",
132-
"worker-loader": "3.0.7"
131+
"worker-loader": "3.0.7",
132+
"jest": "27.0.0-next.8"
133133
},
134134
"resolutions": {
135135
"browserslist": "4.16.1",

packages/next/build/output/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ export function startedDevelopmentServer(appUrl: string, bindAddr: string) {
1212
let previousClient: import('webpack').Compiler | null = null
1313
let previousServer: import('webpack').Compiler | null = null
1414

15-
type CompilerDiagnosticsWithFile = {
16-
errors: { file: string | undefined; message: string }[] | null
17-
warnings: { file: string | undefined; message: string }[] | null
18-
}
19-
2015
type CompilerDiagnostics = {
2116
errors: string[] | null
2217
warnings: string[] | null
@@ -44,6 +39,8 @@ type BuildStatusStore = {
4439
amp: AmpPageStatus
4540
}
4641

42+
// eslint typescript has a bug with TS enums
43+
/* eslint-disable no-shadow */
4744
enum WebpackStatusPhase {
4845
COMPILING = 1,
4946
COMPILED_WITH_ERRORS = 2,

packages/next/build/webpack-config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ export default async function getBaseWebpackConfig(
596596
async function handleExternals(
597597
context: string,
598598
request: string,
599-
getResolve: () => (context: string, request: string) => Promise<string>
599+
getResolve: () => (
600+
resolveContext: string,
601+
resolveRequest: string
602+
) => Promise<string>
600603
) {
601604
if (request === 'next') {
602605
return `commonjs ${request}`
@@ -763,8 +766,8 @@ export default async function getBaseWebpackConfig(
763766
context: string
764767
request: string
765768
getResolve: () => (
766-
context: string,
767-
request: string
769+
resolveContext: string,
770+
resolveRequest: string
768771
) => Promise<string>
769772
}) => handleExternals(context, request, getResolve)
770773
: (
@@ -1048,8 +1051,8 @@ export default async function getBaseWebpackConfig(
10481051
'process.env.__NEXT_STRICT_MODE': JSON.stringify(
10491052
config.reactStrictMode
10501053
),
1051-
'process.env.__NEXT_REACT_MODE': JSON.stringify(
1052-
config.experimental.reactMode
1054+
'process.env.__NEXT_REACT_ROOT': JSON.stringify(
1055+
config.experimental.reactRoot
10531056
),
10541057
'process.env.__NEXT_OPTIMIZE_FONTS': JSON.stringify(
10551058
config.optimizeFonts && !dev

packages/next/build/webpack/plugins/webpack-conformance-plugin/TestInterface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export interface IConformanceAnomaly {
66
stack_trace?: string
77
}
88

9+
// eslint typescript has a bug with TS enums
10+
/* eslint-disable no-shadow */
911
export enum IConformanceTestStatus {
1012
SUCCESS,
1113
FAILED,

packages/next/build/webpack/plugins/webpack-conformance-plugin/checks/granular-chunks-conformance.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* @eslint-disable no-redeclare */
12
import chalk from 'chalk'
23
import {
34
CONFORMANCE_ERROR_PREFIX,
@@ -10,11 +11,6 @@ import {
1011
} from '../TestInterface'
1112
import { deepEqual } from '../utils/utils'
1213

13-
export interface GranularChunksConformanceCheck
14-
extends IWebpackConformanceTest {
15-
granularChunksConfig: any
16-
}
17-
1814
function getWarningMessage(modifiedProp: string) {
1915
return (
2016
`${CONFORMANCE_WARNING_PREFIX}: The splitChunks config has been carefully ` +
@@ -33,7 +29,9 @@ function getErrorMessage(message: string) {
3329
)
3430
}
3531

36-
export class GranularChunksConformanceCheck {
32+
/* @eslint-disable-next-line no-redeclare */
33+
export class GranularChunksConformanceCheck implements IWebpackConformanceTest {
34+
granularChunksConfig: any
3735
constructor(granularChunksConfig: any) {
3836
this.granularChunksConfig = granularChunksConfig
3937
}

packages/next/client/index.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ export function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
494494
}
495495

496496
let reactRoot: any = null
497-
let shouldUseHydrate: boolean = typeof ReactDOM.hydrate === 'function'
497+
let shouldHydrate: boolean = typeof ReactDOM.hydrate === 'function'
498+
498499
function renderReactElement(
499500
domEl: HTMLElement,
500501
fn: (cb: () => void) => JSX.Element
@@ -504,24 +505,24 @@ function renderReactElement(
504505
performance.mark('beforeRender')
505506
}
506507

507-
const reactEl = fn(
508-
shouldUseHydrate ? markHydrateComplete : markRenderComplete
509-
)
510-
if (process.env.__NEXT_REACT_MODE !== 'legacy') {
508+
const reactEl = fn(shouldHydrate ? markHydrateComplete : markRenderComplete)
509+
if (process.env.__NEXT_REACT_ROOT) {
511510
if (!reactRoot) {
512-
const opts = { hydrate: shouldUseHydrate }
513-
reactRoot =
514-
process.env.__NEXT_REACT_MODE === 'concurrent'
515-
? (ReactDOM as any).unstable_createRoot(domEl, opts)
516-
: (ReactDOM as any).unstable_createBlockingRoot(domEl, opts)
511+
const createRootName =
512+
typeof (ReactDOM as any).unstable_createRoot === 'function'
513+
? 'unstable_createRoot'
514+
: 'createRoot'
515+
reactRoot = (ReactDOM as any)[createRootName](domEl, {
516+
hydrate: shouldHydrate,
517+
})
517518
}
518519
reactRoot.render(reactEl)
519-
shouldUseHydrate = false
520+
shouldHydrate = false
520521
} else {
521522
// The check for `.hydrate` is there to support React alternatives like preact
522-
if (shouldUseHydrate) {
523+
if (shouldHydrate) {
523524
ReactDOM.hydrate(reactEl, domEl)
524-
shouldUseHydrate = false
525+
shouldHydrate = false
525526
} else {
526527
ReactDOM.render(reactEl, domEl)
527528
}

0 commit comments

Comments
 (0)