Commit graph

11654 commits

Author SHA1 Message Date
JJ Kasper
cb2ba0c75d
Fix invalid config warning for runtime config (#38122) 2022-06-28 15:54:45 -05:00
Steven
1feaac0398
Remove unused layoutRaw config (#38120)
Removes the `layoutRaw` experimental config which was forgotten in a previous PR #38006
2022-06-28 19:19:46 +00:00
Maia Teegarden
5d60ea94af
Add more code ownership paths for padmaia (#38121) 2022-06-28 13:54:12 -05:00
Steven
350d4cb879
Update next/future/image docs to mention the difference with next/image (#38108)
This PR update the `next/future/image` docs to mention the difference with `next/image`
2022-06-28 15:43:30 +00:00
Edward Thomson
dd1492d3a0
Update middleware upgrade guide w/ more rationale (#38074)
* Update middleware upgrade guide w/ more rationale

The API changes for GA are general improvements.

Our middleware upgrade guide is very helpful about describing the changes
that were made and how to react to them; include some additional "why" to
rationalize these changes.

* Update middleware-upgrade-guide.md

Avoid words like "simple" and "easy"

* Update middleware-upgrade-guide.md

Clarify the issues around "security" with responses - the previous verbiage made it sound like there was a security vulnerability; there was not.

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>

* Apply suggestions from code review

* Update errors/middleware-upgrade-guide.md

* Update errors/middleware-upgrade-guide.md

Co-authored-by: Balázs Orbán <info@balazsorban.com>

* Apply suggestions from code review

* Update canary -> latest

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-28 10:31:47 -05:00
JJ Kasper
8e161e1855
Middleware docs update (#38111)
* Initial outline added for middleware docs

* Feedback changes - not included new user agent yet

* edge api routes docs

* middleware page some cleanup

* moved api stuff to next server, added useragent

* waitUntil example added

* Updated env vars section

* Added cookies on the request object example

* fixed naming

* fixed import typo

* Amy feedback

* Update docs/advanced-features/middleware.md

Co-authored-by: Amy Burns <amy.burns@vercel.com>

* first commit

* more fixes

* re-structuring based on feedback

* changes to middleware.md

* updates to edge-api-routes

* code typo

* Update docs/advanced-features/middleware.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* Update edge-api-routes.md

* Update Edge Runtime API docs

* Clarify API docs

* Update

* Update docs/advanced-features/middleware.md

* Update switchable runtime docs

* Update response

* experimental-edge

* Update docs/advanced-features/middleware.md

* Add example of forwarding headers and address comments

* Add proxying headers to middleware upgrade guide

* Apply suggestions from code review

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>

* fix middleware directory spec

* localization explanation

* update detecting runtime

* Update docs/advanced-features/react-18/switchable-runtime.md

Co-authored-by: Balázs Orbán <info@balazsorban.com>

* fix prettier issues

* table fix

* Update docs/advanced-features/react-18/switchable-runtime.md

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>

* Update docs/api-routes/edge-api-routes.md

Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>

* lint-fix

Co-authored-by: molebox <hello@richardhaines.dev>
Co-authored-by: Amy Burns <amy.burns@vercel.com>
Co-authored-by: Ismael Rumzan <ismael.rumzan@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Jeff Escalante <jescalan@users.noreply.github.com>
Co-authored-by: Ismael <ismael@vercel.com>
2022-06-28 10:22:48 -05:00
JJ Kasper
632feb6b73
v12.2.0 2022-06-28 09:21:07 -05:00
JJ Kasper
ed35138edc
v12.1.7-canary.52 2022-06-28 08:35:37 -05:00
Dom Sip
a90349d519
Update middleware-upgrade-guide to be consistent (#38102)
Update middleware-upgrade-guide.md

Ensure that before and after examples are consistent
2022-06-28 14:48:57 +02:00
Kiko Beats
9cc1c3c576
Upgrade Edge Runtime (#38105) 2022-06-28 07:48:23 -05:00
JJ Kasper
3eb9caeb6a
v12.1.7-canary.51 2022-06-27 23:35:41 -05:00
JJ Kasper
d959d283fb
Ensure client cache keys match between prefetch and transition (#38089)
* Ensure client cache keys match between prefetch and transition

* handle some middleware cases

* lint-fix

* fix lint rename
2022-06-27 23:32:59 -05:00
JJ Kasper
a72e136c79
Ensure history navigation is correct after query update (#38086) 2022-06-27 21:08:08 -05:00
Steven
edf4ea3944
Update image tests from placeholder.com to *.vercel.app (#38081)
Fixes flaky tests when placeholder.com is down

https://github.com/vercel/next.js/pull/38080#issuecomment-1168036939
2022-06-28 01:20:59 +00:00
Steven
0cb1253638
Remove unnecessary <noscript> from next/future/image (#38080)
We don't need to include `<noscript>` for `next/future/image` since it uses native lazy loading instead of the `IntersectionObserver` (https://github.com/vercel/next.js/pull/37927).

The only case when we still need `<noscript>` is for `placeholder="blur"` because it requires client-side JS to switch the from blur image to final image on load.
2022-06-28 00:58:50 +00:00
JJ Kasper
52763de94a
v12.1.7-canary.50 2022-06-27 18:52:05 -05:00
JJ Kasper
58033c4a3c
Fix resolving dynamic routes when on returns a redirect (#38079)
* Fix resolving dynamic routes when on returns a redirect

* Update fix and add test case
2022-06-27 18:47:32 -05:00
Javi Velasco
ca621ced66
Add init to some NextResponse methods (#38071)
* Add `init` to some `NextResponse` methods

* Add NextResponse.redirect test and fix headers

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-27 18:39:00 -05:00
Ali Yusuf
d7e83704bf
fix(next): bind new stream functions with base incomingMessage object (#37806)
Closes: #37805

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-06-27 20:56:14 +00:00
JJ Kasper
7e3355dd9f
v12.1.7-canary.49 2022-06-27 15:12:26 -05:00
JJ Kasper
40cf3ce63a
Add error for renaming of unstable_revalidate (#38070)
* Add error for renaming of unstable_revalidate

* update test

* run test for dev too
2022-06-27 14:28:41 -05:00
JJ Kasper
e3fb62b6bf
Add invariant with debug information when failing to load static file (#38075) 2022-06-27 14:15:09 -05:00
Balázs Orbán
77f9a6a72f
feat(cli): report eslint-config-next version in next info (#38062)
* feat: report `eslint-config-next` version in `next info`

* update test
2022-06-27 14:04:47 -05:00
Kiko Beats
5819dd5540
Upgrade Edge Runtime (#38069)
This new version renamed `globalThis.Edge` into `globalThis.EdgeRuntime`.
2022-06-27 18:44:02 +00:00
Gal Schlezinger
da07c72460
[middleware] avoid fetching a chunk for api endpoints on middleware redirect (#37949)
avoid fetching a chunk for api endpoints on middleware redirect.
This still makes a request to the data endpoint, not sure if this is a good idea,
but a rewrite _can_ happen from that data request.

## Related

- Fixes #37944
- Fixes https://github.com/vercel/next.js/issues/37783



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-27 18:18:42 +00:00
Houssein Djirdeh
82dce6ce8e
[Script] Allow next/script to be placed in _document body (#37894)
Fixes https://github.com/vercel/next.js/issues/37741. Allows `next/script` to be placed inside of `_document` body in addition to `Head`.

## Bug

- [X] Related issues linked using `fixes #number`
- [X] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-06-27 17:56:53 +00:00
Javi Velasco
0f33c0cbf5
Rephrase middleware location (#38073)
It is possible that users that are defining `src/pages` in their project confuse the "project root" to locate middleware with the actual project root instead of `src/middleware` so this PR rephrases the migration guide to make explicit that the it should be located **next** to the `pages` folder.
2022-06-27 17:13:19 +00:00
Steven
5ea3f6c4ab
Remove layout raw image experiment (#38006)
This PR removes experimental `layout="raw"` from `next/image` since it was moved to `next/future/image` in #37927
2022-06-27 15:11:15 +00:00
stefanprobst
42e214e508
chore: make experimental images options optional (#38030)
this makes all `experimental.images` options optional, so they can be toggled individually.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-27 01:23:39 +00:00
Jiachi Liu
a5f8382ee3
Rename page runtime edge to experimental-edge (#38041)
* Rename page runtime edge to experimental-edge

* fix ut

* fix lint

* PageRuntime -> ServerRuntime

* rename constant
2022-06-26 20:02:24 -05:00
JJ Kasper
252d3b72f4
Ensure we do not ignore module not found errors during build (#38026)
* Ensure we do not ignore module not found errors during build

* lint-fix
2022-06-26 19:34:58 -05:00
Max Proske
1648064d0e
Convert analyze-bundles example to TypeScript (#38040)
Converted Next.js Bundle Analyzer example over to TypeScript to align with the Examples guide.

I also replaced `faker` with `@faker-js/faker`. Faker has been forked and maintained [here](https://github.com/faker-js/faker) after the original author [deleted](https://www.theverge.com/2022/1/9/22874949/developer-corrupts-open-source-libraries-projects-affected) the library.

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-27 00:32:37 +00:00
Max Proske
1d5dd1bad3
Convert amp-story example to TypeScript (#38038)
Converted AMP Story example over to TypeScript to align with the Examples guide.

Note: Requires `v12.1.7-canary.41` or newer to build https://github.com/vercel/next.js/pull/37744#issuecomment-1159573754

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-27 00:26:34 +00:00
Steven Tey
8019cf002a
Added ESLint upgrade instructions to middleware upgrade guide (#38008)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-06-27 00:20:36 +00:00
Radu Nemerenco
83ac913950
fix(38043): replace double slashes with hashtag for comment lines in … (#38044)
…env example files



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-27 00:04:05 +00:00
Balázs Orbán
f0b7457666
chore: compile issue validator action (#37990)
Ref:

https://github.com/vercel/next.js/runs/7042041627?check_suite_focus=true
https://github.com/vercel/next.js/runs/7042041634?check_suite_focus=true

https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#commit-tag-and-push-your-action-to-github

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-26 21:39:19 +00:00
M. Zakiyuddin Munziri
2833904b6f
Fix typo for rewrites/redirects to rewrite/redirect (#38016)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-26 16:17:34 -05:00
Jiachi Liu
948f736fac
chore: rename middleware ssr loader and flight manifest to edge related (#38042)
middleware-ssr-loader -> edge-ssr-loader
middleware-flight-manifest -> flight-manifest
2022-06-26 21:01:26 +00:00
Lee Robinson
dbfd594e8c
Add SWC plugins to version history in docs. (#38039) 2022-06-26 18:39:27 +00:00
Gal Schlezinger
22206651a6
[eslint-plugin-next] remove no-server-import-in-page rule (#38028)
This rule was good and kinda made sense when we had nested Middleware.
Now that we have a single Middleware, one might extract logic into different places
and I don't think we should limit importing `NextResponse` or `NextRequest`.

## Related

- Closes #36239
- Closes #37309



## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-06-26 12:43:15 +00:00
Max Proske
d57342a94e
Convert amp-first example to TypeScript (#38029)
Converted AMP First Boilerplate example over to TypeScript to match the Contribution guidelines.

Note: Requires `v12.1.7-canary.41` or newer to build https://github.com/vercel/next.js/pull/37744#issuecomment-1159573754

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm lint`
- [X] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-26 11:43:36 +00:00
Mikis Woodwinter
2b451ee69a
feat(cli): allow configuration of http-server's timeout configuration (#35827)
* feat: add keep-alive timeout params for next-start

* feat: add keep-alive timeout args to next-cli's start

* docs: add docs for keep-alive timeouts

* docs: fix grammar & typos

* refactor: handle NaN for args

* test: add tests for timeout args

* revert: remove headersTimeout option

* fix: remove input validation for keepAliveTimeout arg

* feat: add input-range validation for keepAliveTimeout arg

* Error and tests for range validation

* Make sure timeout actually changes

* Fix error messsage

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
Co-authored-by: Steven <steven@ceriously.com>
2022-06-26 13:26:51 +02:00
Aleksa Cukovic
bcd8de3262
Add *.tsbuildinfo to .gitignore of examples that use typescript (#38005)
I added ` *.tsbuildinfo` to gitignores of examples that use typescript and don't already have it. By use typescript I mean have `tsconfig` somewhere in their directory tree. 

I used the following script to update the files:

```bash
#!/bin/bash

set -eou pipefail

cd examples
examples=`git ls-files . | grep tsconfig | xargs dirname | grep -v "/"`

for example in $examples; do
    if ! grep -q tsbuildinfo $example/.gitignore; then
        gitignore="$example/.gitignore"
        echo $gitignore
        tail -c1 $gitignore | read -r _ || echo >> $gitignore
        echo -e "\n# typescript\n*.tsbuildinfo" >> $gitignore
    fi
done
```
2022-06-26 11:17:44 +00:00
JJ Kasper
6781a52559
Fix invalid warning for existing experimental flag (#38027) 2022-06-25 23:05:02 -05:00
Luis Alvarez D
02b9e8bd46
Update .gitignore to include @next/swc-wasm-nodejs (#38025)
Updated gitignore
2022-06-25 22:53:54 -05:00
william-keller
2997ff0711
Fixing bug - Can't resolve 'prop-types' (#38021)
## Bugfix

- Missing package dependency in package.json causing -> Can't resolve 'prop-types'
2022-06-26 03:12:55 +00:00
Sukka
c85c41043d
fix(#37981): handle legacy link behavior with number type children (#38013)
## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes #37981.

When handling the legacy link behavior on the current version of Next.js, it only wraps single string child in `<a>` tag. The PR fixes the issue by also wrap single number child in `<a>` tag, too.
2022-06-25 20:07:40 +00:00
JJ Kasper
a148d1426d
Add note about skipping upstream cache during revalidation (#38014)
This adds a note about ensuring requests during a revalidation don't leverage an upstream cache as it will fail to pull fresh data to update the ISR cache with if configured. 

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)

Fixes: https://github.com/vercel/next.js/issues/35523#issuecomment-1154687543
x-ref: https://github.com/vercel/next.js/issues/35195


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-06-25 16:26:12 +00:00
JJ Kasper
f4fb3e0377
Fix eslint-config-next peer dep issue (#38009)
It seems `npm` fails to resolve the `next` `peerDependencies` field for `eslint-config-next` and this field isn't necessarily needed so this removes it to ensure upgrading doesn't require the `--force` flag.  

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

Fixes: https://github.com/vercel/next.js/pull/38008#discussion_r906629793
2022-06-25 12:08:14 +00:00
Damien Simonin Feugas
cb882b7e70
fix: hardcoded protocol in request url (#37925)
* fix: hardcoded protocol in request url

* test: covers custom server using https

* Apply suggestions from code review

* fix test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-24 19:31:23 -05:00