Skip to content

Commit

Permalink
Merge branch 'canary' into fix-dedupe-next-image-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Apr 12, 2021
2 parents 8f33102 + 25ca1b5 commit dce241b
Show file tree
Hide file tree
Showing 36 changed files with 864 additions and 43 deletions.
2 changes: 1 addition & 1 deletion examples/with-redux-toolkit-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This example shows how to integrate Next.js with [Redux Toolkit](https://redux-toolkit.js.org).

The **Redux Toolkit** is intended to be the standard way to write Redux logic (create actions and reducers, setup the store with some default middlewares like redux devtools extension). This example demonstrates each of these features with Next.js
The **Redux Toolkit** is a standardized way to write Redux logic (create actions and reducers, setup the store with some default middlewares like redux devtools extension). This example demonstrates each of these features with Next.js

## Deploy your own

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "10.1.4-canary.4"
"version": "10.1.4-canary.6"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-google-analytics"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-sentry"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
28 changes: 10 additions & 18 deletions packages/next/next-server/server/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,9 @@ export async function shouldLoadWithWebpack5(
if (!path?.length) {
// Uncomment to add auto-enable when there is no next.config.js
// Use webpack 5 by default in new apps:
// return {
// enabled: true,
// reason: 'no-config',
// }
return {
enabled: false,
reason: 'no-future-flag',
enabled: true,
reason: 'no-config',
}
}

Expand All @@ -84,20 +80,16 @@ export async function shouldLoadWithWebpack5(

// Uncomment to add auto-enable when there is no custom webpack config
// The user isn't configuring webpack
// if (!userConfig.webpack) {
// return {
// enabled: true,
// reason: 'no-webpack-config',
// }
// }

// return {
// enabled: false,
// reason: 'webpack-config',
// }
if (!userConfig.webpack) {
return {
enabled: true,
reason: 'no-webpack-config',
}
}

return {
enabled: false,
reason: 'no-future-flag',
reason: 'webpack-config',
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/next/next-server/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ export default class Server {
// we don't modify the URL for _next/data request but still
// call render so we special case this to prevent an infinite loop
if (
!this.minimalMode &&
!query._nextDataReq &&
(url.match(/^\/_next\//) ||
(this.hasStaticDir && url.match(/^\/static\//)))
Expand Down
12 changes: 6 additions & 6 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -62,10 +62,10 @@
"dependencies": {
"@babel/runtime": "7.12.5",
"@hapi/accept": "5.0.1",
"@next/env": "10.1.4-canary.4",
"@next/polyfill-module": "10.1.4-canary.4",
"@next/react-dev-overlay": "10.1.4-canary.4",
"@next/react-refresh-utils": "10.1.4-canary.4",
"@next/env": "10.1.4-canary.6",
"@next/polyfill-module": "10.1.4-canary.6",
"@next/react-dev-overlay": "10.1.4-canary.6",
"@next/react-refresh-utils": "10.1.4-canary.6",
"@opentelemetry/api": "0.14.0",
"assert": "2.0.0",
"ast-types": "0.13.2",
Expand Down Expand Up @@ -148,7 +148,7 @@
"@babel/preset-typescript": "7.12.7",
"@babel/traverse": "^7.12.10",
"@babel/types": "7.12.12",
"@next/polyfill-nomodule": "10.1.4-canary.4",
"@next/polyfill-nomodule": "10.1.4-canary.6",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
"@taskr/watch": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "10.1.4-canary.4",
"version": "10.1.4-canary.6",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down
3 changes: 1 addition & 2 deletions test/integration/build-output/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ describe('Build Output', () => {
expect(stdout).toContain('○ /')
})

// TODO: Bring back with webpack 5 auto-enable
it.skip('should not deviate from snapshot', async () => {
it('should not deviate from snapshot', async () => {
console.log(stdout)

const parsePageSize = (page) =>
Expand Down
5 changes: 3 additions & 2 deletions test/integration/next-plugins/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Next.js plugins', () => {
try {
await check(
() => output,
/Next.js plugin versions must match the Next.js version being used/
/Next\.js plugin versions must match the Next\.js version being used/
)
} finally {
if (app) {
Expand Down Expand Up @@ -160,7 +160,8 @@ describe('Next.js plugins', () => {
expect(stdout).toMatch(/loaded plugin: @next\/plugin-google-analytics/i)
})

it('should expose a plugins config', async () => {
// TODO: investigate why this fails. Potentially build cache related.
it.skip('should expose a plugins config', async () => {
const browser = await webdriver(appPort, '/')
expect(await browser.eval('window.initClientConfig')).toBe('world')
})
Expand Down
13 changes: 13 additions & 0 deletions test/integration/required-server-files-ssr-404/lib/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let curConfig

const idk = Math.random()

export default () => {
console.log('returning config', idk, curConfig)
return curConfig
}

export function setConfig(configValue) {
curConfig = configValue
console.log('set config', idk, configValue)
}
12 changes: 12 additions & 0 deletions test/integration/required-server-files-ssr-404/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
// ensure incorrect target is overridden by env
target: 'serverless',
rewrites() {
return [
{
source: '/some-catch-all/:path*',
destination: '/',
},
]
},
}
3 changes: 3 additions & 0 deletions test/integration/required-server-files-ssr-404/pages/404.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function NotFound() {
return 'custom 404'
}
18 changes: 18 additions & 0 deletions test/integration/required-server-files-ssr-404/pages/[slug].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const getStaticProps = () => {
return {
props: {
hello: 'world',
},
}
}

export const getStaticPaths = () => {
return {
paths: [],
fallback: true,
}
}

export default function Page(props) {
return <p id="slug-page">[slug] page</p>
}
17 changes: 17 additions & 0 deletions test/integration/required-server-files-ssr-404/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import App from 'next/app'
import { setConfig } from '../lib/config'

setConfig({ hello: 'world' })

function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}

MyApp.getInitialProps = async (appContext) => {
// calls page's `getInitialProps` and fills `appProps.pageProps`
const appProps = await App.getInitialProps(appContext)

return { ...appProps }
}

export default MyApp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default (req, res) => {
console.log(req.url, 'query', req.query)
res.json({
url: req.url,
query: req.query,
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useRouter } from 'next/router'

export const getStaticProps = ({ params }) => {
return {
props: {
hello: 'world',
params: params || null,
random: Math.random(),
},
}
}

export const getStaticPaths = () => {
return {
paths: ['/catch-all/hello'],
fallback: true,
}
}

export default function Page(props) {
const router = useRouter()
return (
<>
<p id="catch-all">optional catch-all page</p>
<p id="router">{JSON.stringify(router)}</p>
<p id="props">{JSON.stringify(props)}</p>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useRouter } from 'next/router'

export const getServerSideProps = ({ params }) => {
return {
props: {
hello: 'world',
slug: params.slug,
random: Math.random(),
},
}
}

export default function Page(props) {
const router = useRouter()
return (
<>
<p id="dynamic">dynamic page</p>
<p id="slug">{props.slug}</p>
<p id="router">{JSON.stringify(router)}</p>
<p id="props">{JSON.stringify(props)}</p>
</>
)
}
14 changes: 14 additions & 0 deletions test/integration/required-server-files-ssr-404/pages/errors/gip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function Page(props) {
return <p>here comes an error</p>
}

Page.getInitialProps = ({ query }) => {
if (query.crash) {
throw new Error('gip hit an oops')
}
return {
hello: 'world',
}
}

export default Page
Loading

0 comments on commit dce241b

Please sign in to comment.