Skip to content

Commit

Permalink
Merge branch 'vercel:canary' into canary
Browse files Browse the repository at this point in the history
  • Loading branch information
jackromo888 authored Oct 12, 2022
2 parents 519b8f9 + 629fa8a commit 6cb8c7e
Show file tree
Hide file tree
Showing 437 changed files with 10,748 additions and 1,479 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ jobs:
name: Test Unit
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 5
timeout-minutes: 10
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
name: Test Development
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 20
timeout-minutes: 25
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js --type development --timings -g ${{ matrix.group }}/2
Expand Down Expand Up @@ -343,7 +343,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js --type development --timings -g ${{ matrix.group }}/2
Expand All @@ -364,7 +364,7 @@ jobs:
name: Test Development (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 20
timeout-minutes: 25
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -405,7 +405,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npx @replayio/playwright install chromium
Expand Down Expand Up @@ -484,7 +484,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
Expand Down Expand Up @@ -545,7 +545,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js --type production --timings -g ${{ matrix.group }}/2
Expand Down Expand Up @@ -595,7 +595,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js --type production --timings -g ${{ matrix.group }}/2
Expand All @@ -606,7 +606,7 @@ jobs:
name: Test Production (E2E)
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 25
timeout-minutes: 30
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -647,7 +647,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: NEXT_TEST_MODE=start node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
Expand Down Expand Up @@ -698,7 +698,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: NEXT_TEST_MODE=start node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
Expand All @@ -709,7 +709,7 @@ jobs:
name: Test Integration
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 20
timeout-minutes: 25
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -771,7 +771,7 @@ jobs:
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/20
Expand All @@ -791,7 +791,7 @@ jobs:
name: Test Electron
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 5
timeout-minutes: 10
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand Down Expand Up @@ -847,7 +847,7 @@ jobs:
name: Test Firefox (production)
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 5
timeout-minutes: 10
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
Expand Down Expand Up @@ -882,7 +882,7 @@ jobs:
name: Test Safari (production)
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 10
timeout-minutes: 15
env:
BROWSER_NAME: 'safari'
NEXT_TEST_MODE: 'start'
Expand Down Expand Up @@ -928,7 +928,7 @@ jobs:
name: Test Safari 10.1 (nav)
runs-on: ubuntu-latest
needs: [build, build-native-test]
timeout-minutes: 5
timeout-minutes: 10
env:
BROWSERSTACK: true
LEGACY_SAFARI: true
Expand Down Expand Up @@ -975,7 +975,7 @@ jobs:
name: Test Firefox Node.js 18
runs-on: ubuntu-latest
needs: [build, testFirefox, build-native-test]
timeout-minutes: 5
timeout-minutes: 10
env:
BROWSER_NAME: 'firefox'
NEXT_TELEMETRY_DISABLED: 1
Expand Down Expand Up @@ -1081,7 +1081,7 @@ jobs:
name: Install pnpm

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
name: Install playwright dependencies

- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
Expand Down Expand Up @@ -1248,7 +1248,7 @@ jobs:
test-wasm:
name: Test the wasm build
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15
needs: [build, build-native-test, build-wasm-dev]

steps:
Expand Down Expand Up @@ -1283,7 +1283,7 @@ jobs:
check-latest: true

- run: npm i -g playwright-chromium@1.22.2 && npx playwright install-deps
timeout-minutes: 5
timeout-minutes: 10
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node ./scripts/setup-wasm.mjs
Expand Down Expand Up @@ -1361,6 +1361,7 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: >-
set -e &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add aarch64-unknown-linux-gnu &&
Expand Down Expand Up @@ -1412,6 +1413,7 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: >-
set -e &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" && if [ ! -f $(dirname $(which yarn))/pnpm ]; then ln -s $(which yarn) $(dirname $(which yarn))/pnpm;fi &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
Expand Down
10 changes: 10 additions & 0 deletions bench/minimal-server/benchmark-app/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'

export default function Root({ children }) {
return (
<html>
<head></head>
<body>{children}</body>
</html>
)
}
5 changes: 5 additions & 0 deletions bench/minimal-server/benchmark-app/app/rsc/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react'

export default function page() {
return <div>hello</div>
}
5 changes: 5 additions & 0 deletions bench/minimal-server/benchmark-app/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
experimental: {
appDir: true,
},
}
14 changes: 14 additions & 0 deletions bench/minimal-server/benchmark-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "stats-app",
"private": true,
"license": "MIT",
"dependencies": {
"webpack-bundle-analyzer": "^4.6.1",
"webpack-stats-plugin": "^1.1.0"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
}
9 changes: 9 additions & 0 deletions bench/minimal-server/benchmark-app/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react'

export default function page() {
return <div> hello world </div>
}

export async function getServerSideProps() {
return {}
}
7 changes: 7 additions & 0 deletions bench/minimal-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "next-minimal-server",
"description": "Minimal server for Next.js for benchmarking/perf analysis purposes.",
"scripts": {
"start": "node start.js"
}
}
40 changes: 40 additions & 0 deletions bench/minimal-server/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
process.env.__NEXT_REACT_CHANNEL = 'exp'
process.env.NODE_ENV = 'production'

require('../../test/lib/react-channel-require-hook')

console.time('next-cold-start')
const NextServer = require('next/dist/server/next-server').default
const path = require('path')

const appDir = path.join(__dirname, 'benchmark-app')
const distDir = '.next'

const compiledConfig = require(path.join(
appDir,
distDir,
'required-server-files.json'
)).config

process.chdir(appDir)

const nextServer = new NextServer({
conf: compiledConfig,
dir: appDir,
distDir,
minimalMode: true,
customServer: false,
})

const requestHandler = nextServer.getRequestHandler()

require('http')
.createServer((req, res) => {
console.time('next-request')
return requestHandler(req, res).finally(() => {
console.timeEnd('next-request')
})
})
.listen(3000, () => {
console.timeEnd('next-cold-start')
})
49 changes: 49 additions & 0 deletions docs/advanced-features/codemods.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,55 @@ Codemods are transformations that run on your codebase programmatically. This al
- `--dry` Do a dry-run, no code will be edited
- `--print` Prints the changed output for comparison

## Next.js 13

### `next-image-to-legacy-image`

Safely migrates existing Next.js 10, 11, 12 applications importing `next/image` to the renamed `next/legacy/image` import in Next.js 13.

For example:

```jsx
import Image1 from 'next/image'
import Image2 from 'next/future/image'

export default function Home() {
return (
<div>
<Image1 src="/test.jpg" width="200" height="300" />
<Image2 src="/test.png" width="500" height="400" />
</div>
)
}
```

Transforms into:

```jsx
import Image1 from 'next/legacy/image'
import Image2 from 'next/image'

export default function Home() {
return (
<div>
<Image1 src="/test.jpg" width="200" height="300" />
<Image2 src="/test.png" width="500" height="400" />
</div>
)
}
```

### `next-image-experimental` (experimental)

Dangerously migrates from `next/legacy/image` to the new `next/image` by adding inline styles and removing unused props.

- Removes `layout` prop and adds `style`
- Removes `objectFit` prop and adds `style`
- Removes `objectPosition` prop and adds `style`
- Removes `lazyBoundary` prop
- Removes `lazyRoot` prop
- TODO: handle `loader`

## Next.js 11

### `cra-to-next` (experimental)
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced-features/security-headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ const ContentSecurityPolicy = `

When a directive uses a keyword such as `self`, wrap it in single quotes `''`.

In the header's value, replace the new line with an empty string.
In the header's value, replace the new line with a space.

```jsx
```js
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim()
Expand Down
5 changes: 5 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ description: Learn how to upgrade Next.js.

# Upgrade Guide

## Upgrading from 12 to 13

The `next/image` import was renamed to `next/legacy/image`. The `next/future/image` import was renamed to `next/image`.
A [codemod is available](/docs/advanced-features/codemods.md#next-image-to-legacy-image) to safely and automatically rename your imports.

## Upgrading to 12.2

If you were using Middleware prior to `12.2`, please see the [upgrade guide](https://nextjs.org/docs/messages/middleware-upgrade-guide) for more information.
Expand Down
Loading

0 comments on commit 6cb8c7e

Please sign in to comment.