Skip to content

Commit 717862d

Browse files
authored
Merge branch 'canary' into cms-builder-io-example
2 parents 9987445 + 0425763 commit 717862d

File tree

265 files changed

+19500
-18209
lines changed

Some content is hidden

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

265 files changed

+19500
-18209
lines changed

.eslintignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ node_modules
22
**/.next/**
33
**/_next/**
44
**/dist/**
5+
e2e-tests/**
6+
examples/with-eslint/**
57
examples/with-typescript-eslint-jest/**
68
examples/with-kea/**
79
packages/next/bundles/webpack/packages/*.runtime.js
@@ -15,6 +17,7 @@ packages/next-codemod/transforms/__tests__/**/*
1517
packages/next-codemod/**/*.js
1618
packages/next-codemod/**/*.d.ts
1719
packages/next-env/**/*.d.ts
20+
packages/create-next-app/templates/**
1821
test/integration/async-modules/**
22+
test/integration/eslint/**
1923
test-timings.json
20-
packages/next/lib/regexr/**/*

docs/api-reference/next.config.js/basepath.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ description: Learn more about setting a base path in Next.js
44

55
# Base Path
66

7-
> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
7+
<details>
8+
<summary><b>Version History</b></summary>
9+
10+
| Version | Changes |
11+
| -------- | ---------------- |
12+
| `v9.5.0` | Base Path added. |
13+
14+
</details>
815

916
To deploy a Next.js application under a sub-path of a domain you can use the `basePath` config option.
1017

docs/api-reference/next.config.js/custom-webpack-config.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Before continuing to add custom webpack configuration to your application make s
1515

1616
Some commonly asked for features are available as plugins:
1717

18-
- [@zeit/next-less](https://github.com/vercel/next-plugins/tree/master/packages/next-less)
1918
- [@next/mdx](https://github.com/vercel/next.js/tree/canary/packages/next-mdx)
2019
- [@next/bundle-analyzer](https://github.com/vercel/next.js/tree/canary/packages/next-bundle-analyzer)
2120

docs/api-reference/next.config.js/headers.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@ description: Add custom HTTP headers to your Next.js app.
44

55
# Headers
66

7-
> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
8-
97
<details open>
108
<summary><b>Examples</b></summary>
119
<ul>
1210
<li><a href="https://github.com/vercel/next.js/tree/canary/examples/headers">Headers</a></li>
1311
</ul>
1412
</details>
1513

14+
<details>
15+
<summary><b>Version History</b></summary>
16+
17+
| Version | Changes |
18+
| --------- | -------------- |
19+
| `v10.2.0` | `has` added. |
20+
| `v9.5.0` | Headers added. |
21+
22+
</details>
23+
1624
Headers allow you to set custom HTTP headers for an incoming request path.
1725

1826
To set custom HTTP headers you can use the `headers` key in `next.config.js`:
@@ -173,8 +181,6 @@ module.exports = {
173181

174182
## Header, Cookie, and Query Matching
175183

176-
Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
177-
178184
To only apply a header when either header, cookie, or query values also match the `has` field can be used. Both the `source` and all `has` items must match for the header to be applied.
179185

180186
`has` items have the following fields:

docs/api-reference/next.config.js/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = (phase, { defaultConfig }) => {
4444
}
4545
```
4646

47-
The commented lines are the place where you can put the configs allowed by `next.config.js`, which are defined [here](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/config-shared.ts#L33).
47+
The commented lines are the place where you can put the configs allowed by `next.config.js`, which are defined [here](https://github.com/vercel/next.js/blob/canary/packages/next/next-server/server/config-shared.ts#L68).
4848

4949
However, none of the configs are required, and it's not necessary to understand what each config does. Instead, search for the features you need to enable or modify in this section and they will show you what to do.
5050

docs/api-reference/next.config.js/redirects.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@ description: Add redirects to your Next.js app.
44

55
# Redirects
66

7-
> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
8-
97
<details open>
108
<summary><b>Examples</b></summary>
119
<ul>
1210
<li><a href="https://github.com/vercel/next.js/tree/canary/examples/redirects">Redirects</a></li>
1311
</ul>
1412
</details>
1513

14+
<details>
15+
<summary><b>Version History</b></summary>
16+
17+
| Version | Changes |
18+
| --------- | ---------------- |
19+
| `v10.2.0` | `has` added. |
20+
| `v9.5.0` | Redirects added. |
21+
22+
</details>
23+
1624
Redirects allow you to redirect an incoming request path to a different destination path.
1725

1826
Redirects are only available on the Node.js environment and do not affect client-side routing.
@@ -117,8 +125,6 @@ module.exports = {
117125

118126
## Header, Cookie, and Query Matching
119127

120-
Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
121-
122128
To only match a redirect when header, cookie, or query values also match the `has` field can be used. Both the `source` and all `has` items must match for the redirect to be applied.
123129

124130
`has` items have the following fields:

docs/api-reference/next.config.js/rewrites.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,27 @@ description: Add rewrites to your Next.js app.
44

55
# Rewrites
66

7-
> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
8-
97
<details open>
108
<summary><b>Examples</b></summary>
119
<ul>
1210
<li><a href="https://github.com/vercel/next.js/tree/canary/examples/rewrites">Rewrites</a></li>
1311
</ul>
1412
</details>
1513

14+
<details>
15+
<summary><b>Version History</b></summary>
16+
17+
| Version | Changes |
18+
| --------- | --------------- |
19+
| `v10.2.0` | `has` added. |
20+
| `v9.5.0` | Rewrites added. |
21+
22+
</details>
23+
1624
Rewrites allow you to map an incoming request path to a different destination path.
1725

26+
Rewrites act as a URL proxy and mask the destination path, making it appear the user hasn't changed their location on the site. In contrast, [redirects](/docs/api-reference/next.config.js/redirects.md) will reroute to a new page a show the URL changes.
27+
1828
Rewrites are only available on the Node.js environment and do not affect client-side routing.
1929

2030
To use rewrites you can use the `rewrites` key in `next.config.js`:
@@ -197,8 +207,6 @@ module.exports = {
197207

198208
## Header, Cookie, and Query Matching
199209

200-
Note: this feature is still experimental and not covered by semver and is to be used at your own risk until it is made stable.
201-
202210
To only match a rewrite when header, cookie, or query values also match the `has` field can be used. Both the `source` and all `has` items must match for the rewrite to be applied.
203211

204212
`has` items have the following fields:
@@ -319,7 +327,7 @@ module.exports = {
319327
}
320328
```
321329

322-
See additional information on incremental adoption [in the docs here](https://nextjs.org/docs/migrating/incremental-adoption).
330+
See additional information on incremental adoption [in the docs here](/docs/migrating/incremental-adoption.md).
323331

324332
### Rewrites with basePath support
325333

docs/api-reference/next.config.js/trailing-slash.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ description: Configure Next.js pages to resolve with or without a trailing slash
44

55
# Trailing Slash
66

7-
> This feature was introduced in [Next.js 9.5](https://nextjs.org/blog/next-9-5) and up. If you’re using older versions of Next.js, please upgrade before trying it out.
7+
<details>
8+
<summary><b>Version History</b></summary>
9+
10+
| Version | Changes |
11+
| -------- | --------------------- |
12+
| `v9.5.0` | Trailing Slash added. |
13+
14+
</details>
815

916
By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash. For example `/about/` will redirect to `/about`. You can configure this behavior to act the opposite way, where urls without trailing slashes are redirected to their counterparts with trailing slashes.
1017

docs/api-reference/next/router.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default ActiveLink
4141

4242
The following is the definition of the `router` object returned by both [`useRouter`](#useRouter) and [`withRouter`](#withRouter):
4343

44-
- `pathname`: `String` - Current route. That is the path of the page in `/pages`
44+
- `pathname`: `String` - Current route. That is the path of the page in `/pages`, the configured `basePath` or `locale` is not included.
4545
- `query`: `Object` - The query string parsed to an object. It will be an empty object during prerendering if the page doesn't have [data fetching requirements](/docs/basic-features/data-fetching.md). Defaults to `{}`
4646
- `asPath`: `String` - The path (including the query) shown in the browser without the configured `basePath` or `locale`.
4747
- `isFallback`: `boolean` - Whether the current page is in [fallback mode](/docs/basic-features/data-fetching.md#fallback-pages).
@@ -74,6 +74,7 @@ router.push(url, as, options)
7474
- `options` - Optional object with the following configuration options:
7575
- `scroll` - Optional boolean, controls scrolling to the top of the page after navigation. Defaults to `true`
7676
- [`shallow`](/docs/routing/shallow-routing.md): Update the path of the current page without rerunning [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation), [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering) or [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md). Defaults to `false`
77+
- `locale` - Optional string, indicates locale of the new page
7778

7879
> You don't need to use `router.push` for external URLs. [window.location](https://developer.mozilla.org/en-US/docs/Web/API/Window/location) is better suited for those cases.
7980

docs/api-routes/response-helpers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function handler(req, res) {
2323
The included helpers are:
2424

2525
- `res.status(code)` - A function to set the status code. `code` must be a valid [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
26-
- `res.json(json)` - Sends a JSON response. `json` must be a valid JSON object
26+
- `res.json(body)` - Sends a JSON response. `body` must be a [serialiazable object](https://developer.mozilla.org/en-US/docs/Glossary/Serialization)
2727
- `res.send(body)` - Sends the HTTP response. `body` can be a `string`, an `object` or a `Buffer`
2828
- `res.redirect([status,] path)` - Redirects to a specified path or URL. `status` must be a valid [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). If not specified, `status` defaults to "307" "Temporary redirect".
2929

0 commit comments

Comments
 (0)