Skip to content

Commit c4d1d22

Browse files
authored
Merge branch 'canary' into fix/standalone-optimizecss
2 parents 5fa0c15 + 8c57979 commit c4d1d22

File tree

307 files changed

+4786
-420
lines changed

Some content is hidden

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

307 files changed

+4786
-420
lines changed

.github/workflows/build_test_deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,11 +1213,11 @@ jobs:
12131213
uses: actions/cache@v2
12141214
with:
12151215
path: .turbo
1216-
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
1216+
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }}
12171217
restore-keys: |
1218-
turbo-${{ github.job }}-
1219-
turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-
1220-
turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}-
1218+
turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}
1219+
turbo-${{ github.job }}-${{ github.ref_name }}-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-
1220+
turbo-${{ github.job }}-canary-${{ matrix.settings.target }}-${{ needs.build.outputs.weekNum }}-
12211221
12221222
- name: Setup node
12231223
uses: actions/setup-node@v2

contributing.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ To develop locally:
1919
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your
2020
own GitHub account and then
2121
[clone](https://help.github.com/articles/cloning-a-repository/) it to your local device.
22+
23+
If you don't need the whole git history, you can clone with depth 1 to reduce the download size (~1.6GB):
24+
25+
```sh
26+
git clone --depth=1 https://github.com/vercel/next.js
27+
```
28+
2229
2. Create a new branch:
2330
```
2431
git checkout -b MY_BRANCH_NAME
@@ -196,6 +203,47 @@ This will use the version of `next` built inside of the Next.js monorepo and the
196203
main `yarn dev` monorepo command can be running to make changes to the local
197204
Next.js version at the same time (some changes might require re-running `yarn next-with-deps` to take effect).
198205

206+
## Updating documentation paths
207+
208+
Our documentation currently leverages a [manifest file](/docs/manifest.json) which is how documentation entries are checked.
209+
210+
When adding a new entry under an existing category you only need to add an entry with `{title: '', path: '/docs/path/to/file.md'}`. The "title" is what is shown on the sidebar.
211+
212+
When moving the location/url of an entry the "title" field can be removed from the existing entry and the ".md" extension removed from the "path", then a "redirect" field with the shape of `{permanent: true/false, destination: '/some-url'}` can be added. A new entry should be added with the "title" and "path" fields if the document was renamed within the [`docs` folder](/docs) that points to the new location in the folder e.g. `/docs/some-url.md`
213+
214+
Example of moving documentation file:
215+
216+
Before:
217+
218+
```json
219+
[
220+
{
221+
"path": "/docs/original.md",
222+
"title": "Hello world"
223+
}
224+
]
225+
```
226+
227+
After:
228+
229+
```json
230+
[
231+
{
232+
"path": "/docs/original",
233+
"redirect": {
234+
"permanent": false,
235+
"destination": "/new"
236+
}
237+
}
238+
{
239+
"path": "/docs/new.md",
240+
"title": "Hello world"
241+
},
242+
]
243+
```
244+
245+
Note: the manifest is checked automatically in the "lint" step in CI when opening a PR.
246+
199247
## Adding warning/error descriptions
200248

201249
In Next.js we have a system to add helpful links to warnings and errors.

docs/middleware.md renamed to docs/advanced-features/middleware.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: Learn how to use Middleware in Next.js to run code before a request is completed.
33
---
44

5-
# Middleware
5+
# Middleware (Beta)
66

77
<details open>
88
<summary><b>Version History</b></summary>

docs/manifest.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@
143143
]
144144
},
145145
{
146-
"title": "Middleware",
147-
"path": "/docs/middleware.md"
146+
"path": "/docs/middleware",
147+
"redirect": {
148+
"destination": "/docs/advanced-features/middleware",
149+
"permanent": true
150+
}
148151
},
149152
{
150153
"title": "Going to Production",
@@ -263,6 +266,10 @@
263266
"title": "Measuring performance",
264267
"path": "/docs/advanced-features/measuring-performance.md"
265268
},
269+
{
270+
"title": "Middleware (Beta)",
271+
"path": "/docs/advanced-features/middleware.md"
272+
},
266273
{
267274
"title": "Debugging",
268275
"path": "/docs/advanced-features/debugging.md"

examples/hello-world-esm/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel

examples/hello-world-esm/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ESM Hello World example
2+
3+
This example shows the most basic idea behind Next.js, and it's running on native [esm](https://nodejs.org/api/esm.html) mode. We have 2 pages: `pages/index.js` and `pages/about.js`. The former responds to `/` requests and the latter to `/about`. Using `next/link` you can add hyperlinks between them with universal routing capabilities. The `day` directory shows that you can have subdirectories.
4+
5+
## Deploy your own
6+
7+
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example-esm) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/hello-world-esm)
8+
9+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world-esm&project-name=hello-world-esm&repository-name=hello-world-esm)
10+
11+
## How to use
12+
13+
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
14+
15+
```bash
16+
npx create-next-app --example hello-world-esm hello-world-esm-app
17+
# or
18+
yarn create next-app --example hello-world-esm hello-world-esm-app
19+
# or
20+
pnpm create next-app -- --example hello-world-esm hello-world-esm-app
21+
```
22+
23+
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/hello-world-esm/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"private": true,
3+
"type": "module",
4+
"scripts": {
5+
"dev": "next",
6+
"build": "next build",
7+
"start": "next start"
8+
},
9+
"dependencies": {
10+
"next": "latest",
11+
"react": "^18.0.0",
12+
"react-dom": "^18.0.0"
13+
}
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function AboutPage() {
2+
return <div>About us</div>
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function DayPage() {
2+
return <div>Hello Day</div>
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Link from 'next/link'
2+
3+
export default function IndexPage() {
4+
return (
5+
<div>
6+
Hello World.{' '}
7+
<Link href="/about">
8+
<a>About</a>
9+
</Link>
10+
</div>
11+
)
12+
}

examples/with-elasticsearch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"lint": "next lint"
88
},
99
"dependencies": {
10-
"@elastic/elasticsearch": "^7.14.0",
10+
"@elastic/elasticsearch": "^8.1.0",
1111
"next": "latest",
1212
"react": "^17.0.2",
1313
"react-dom": "^17.0.2"

examples/with-supertokens/.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323
npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
26+
.pnpm-debug.log*
2627

2728
# local env files
28-
.env.local
29-
.env.development.local
30-
.env.test.local
31-
.env.production.local
29+
.env*.local
3230

3331
# vercel
3432
.vercel
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
}
5+
6+
module.exports = nextConfig

examples/with-supertokens/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
},
88
"dependencies": {
99
"next": "latest",
10-
"react": "^17.0.1",
11-
"react-dom": "^17.0.1",
12-
"supertokens-auth-react": "^0.19.0",
13-
"supertokens-node": "^9.0.0"
10+
"react": "^18.0.0",
11+
"react-dom": "^18.0.0",
12+
"supertokens-auth-react": "^0.20.2",
13+
"supertokens-node": "^9.1.1"
1414
}
1515
}

examples/with-three-js/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"start": "next start"
77
},
88
"dependencies": {
9-
"@react-three/drei": "7.6.1",
10-
"@react-three/fiber": "7.0.6",
9+
"@react-three/drei": "9.3.4",
10+
"@react-three/fiber": "8.0.10",
1111
"next": "latest",
12-
"react": "^17.0.2",
13-
"react-dom": "^17.0.2",
14-
"three": "0.128.0"
12+
"react": "^18.0.0",
13+
"react-dom": "^18.0.0",
14+
"three": "0.139.2"
1515
}
1616
}

examples/with-three-js/pages/birds.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
1-
import { Suspense } from 'react'
1+
import { Suspense, useMemo } from 'react'
22
import { Canvas } from '@react-three/fiber'
33
import { OrbitControls } from '@react-three/drei'
44
import Bird from '../components/Bird'
55

66
export default function BirdsPage() {
7-
return (
8-
<>
9-
<Canvas camera={{ position: [0, 0, 35] }}>
10-
<ambientLight intensity={2} />
11-
<pointLight position={[40, 40, 40]} />
12-
<OrbitControls />
13-
<Suspense fallback={null}>
14-
{new Array(6).fill().map((_, i) => {
15-
const x =
16-
(15 + Math.random() * 30) * (Math.round(Math.random()) ? -1 : 1)
17-
const y = -10 + Math.random() * 20
18-
const z = -5 + Math.random() * 10
19-
const bird = ['stork', 'parrot', 'flamingo'][
20-
Math.round(Math.random() * 2)
21-
]
22-
let speed = bird === 'stork' ? 0.5 : bird === 'flamingo' ? 2 : 5
23-
let factor =
24-
bird === 'stork'
25-
? 0.5 + Math.random()
26-
: bird === 'flamingo'
27-
? 0.25 + Math.random()
28-
: 1 + Math.random() - 0.5
7+
const birds = useMemo(
8+
() =>
9+
new Array(10).fill().map((_, index) => {
10+
const x =
11+
(15 + Math.random() * 30) * (Math.round(Math.random()) ? -1 : 1)
12+
const y = -10 + Math.random() * 20
13+
const z = -5 + Math.random() * 10
14+
const bird = ['stork', 'parrot', 'flamingo'][
15+
Math.round(Math.random() * 2)
16+
]
17+
const speed = bird === 'stork' ? 0.5 : bird === 'flamingo' ? 2 : 5
18+
const factor =
19+
bird === 'stork'
20+
? 0.5 + Math.random()
21+
: bird === 'flamingo'
22+
? 0.25 + Math.random()
23+
: 1 + Math.random() - 0.5
24+
25+
return {
26+
key: index,
27+
position: [x, y, z],
28+
rotation: [0, x > 0 ? Math.PI : 0, 0],
29+
speed,
30+
factor,
31+
url: `/glb/${bird}.glb`,
32+
}
33+
}),
34+
[]
35+
)
2936

30-
return (
31-
<Bird
32-
key={i}
33-
position={[x, y, z]}
34-
rotation={[0, x > 0 ? Math.PI : 0, 0]}
35-
speed={speed}
36-
factor={factor}
37-
url={`/glb/${bird}.glb`}
38-
/>
39-
)
40-
})}
41-
</Suspense>
42-
</Canvas>
43-
</>
37+
return (
38+
<Canvas camera={{ position: [0, 0, 35] }}>
39+
<ambientLight intensity={2} />
40+
<pointLight position={[40, 40, 40]} />
41+
<OrbitControls />
42+
<Suspense fallback={null}>
43+
{birds.map((props) => (
44+
<Bird {...props} key={props.key} />
45+
))}
46+
</Suspense>
47+
</Canvas>
4448
)
4549
}

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
"registry": "https://registry.npmjs.org/"
1717
}
1818
},
19-
"version": "12.1.5-canary.4"
19+
"version": "12.1.5-canary.5"
2020
}

packages/create-next-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "12.1.5-canary.4",
3+
"version": "12.1.5-canary.5",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "12.1.5-canary.4",
3+
"version": "12.1.5-canary.5",
44
"description": "ESLint configuration used by NextJS.",
55
"main": "index.js",
66
"license": "MIT",
@@ -9,7 +9,7 @@
99
"directory": "packages/eslint-config-next"
1010
},
1111
"dependencies": {
12-
"@next/eslint-plugin-next": "12.1.5-canary.4",
12+
"@next/eslint-plugin-next": "12.1.5-canary.5",
1313
"@rushstack/eslint-patch": "1.0.8",
1414
"@typescript-eslint/parser": "5.10.1",
1515
"eslint-import-resolver-node": "0.3.4",

packages/eslint-plugin-next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@next/eslint-plugin-next",
3-
"version": "12.1.5-canary.4",
3+
"version": "12.1.5-canary.5",
44
"description": "ESLint plugin for NextJS.",
55
"main": "lib/index.js",
66
"license": "MIT",

0 commit comments

Comments
 (0)