Commit graph

10130 commits

Author SHA1 Message Date
Justin Braithwaite
db91fbf407
Prevent NEXT_PHASE env change in workers (#28941)
`process.env.NEXT_PHASE` was moved in https://github.com/vercel/next.js/pull/20900 to be set during `staticCheckSpan.traceAsyncFn`. I believe this to be a mistake, the NEXT_PHASE should be set earlier in the code execution.

On a personal note, this impacts an application I am developing where we rely on the environment variable `NEXT_PHASE` to be set but is `undefined` when we check it.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-16 00:17:42 -06:00
Nishan
12597f2822
fix: add .web.jsx extension support (#32076)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-15 23:50:23 -06:00
Michiel Van Gendt
d7062dddcc
Include message body in redirect responses (#31886)
# Description

The redirect responses do not contain a message body. This is in conflict with the RFCs (below) and causes Traefik (a reverse proxy) to invalidate the responses. In this pull request, I add a response body to the redirect responses. 

This PR is similar to https://github.com/vercel/next.js/pull/25257, it appears that there are some other locations where redirection is handled incorrectly in next.js.

# References
- https://datatracker.ietf.org/doc/html/rfc7230#section-3.3

> All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses must not include a message-body. All other responses do include a message-body, although the body may be of zero length.

- https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3

> The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-16 05:41:43 +00:00
Clecio de Almeida
0f5600ed7d
fix: setup prismic image host (#31589)
I was following this example and had an error to display prismic's image, it's because we need to configure the host image in `next.config.js`

Here's the docs about it https://nextjs.org/docs/messages/next-image-unconfigured-host



## Bug

Don't have issue yet
- [ ] 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 `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-16 04:48:22 +00:00
Madison Dickson
0794cc07c0
Include mention of the onError Prop for next/script (#31945)
* Include mention of the onError Prop

None of the documentation includes this, despite being written into the code.
Would be good to mention the function signature change somewhere between v11 and v12 that now includes the error object. (Was confused when my TS definitions were complaining about my onError handler, reading the repo's code while using the v11.1.x version in my project)

* Update docs/basic-features/script.md

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

* Update docs/basic-features/script.md

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

* lint-fix

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-15 22:38:01 -06:00
Hannes Bornö
b0bd0eefc6
next-swc: Emit errors and add tests to next-ssg (#32254)
## 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 `yarn lint`
2021-12-16 04:26:41 +00:00
JJ Kasper
f221f8857d
v12.0.8-canary.7 2021-12-15 13:31:38 -06:00
Tim Neutkens
048d89c63a
Ensure experimental SWC options invalidate the cache (#32540) 2021-12-15 12:54:25 -06:00
Rich Haines
dda0afd3a4
Added docs issue template (#32488)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-15 16:18:28 +01:00
Jorrit Schippers
f441a58da7
Remove unused classnames dependency from react-dev-overlay (#32487)
It seems that the classnames dependency is not referenced in the react-dev-overlay code.
2021-12-15 14:54:26 +00:00
JJ Kasper
5d606ebae4
Ensure image-optimizer is traced for standalone mode (#32522)
This ensures we trace the `image-optimizer` for the standalone output mode as previously this was always ignored under the assumption image optimizing would be handled at the CDN level in standalone mode. 

## Bug

- [x] 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 `yarn lint`

Fixes: https://github.com/vercel/next.js/issues/32513
2021-12-15 14:19:16 +00:00
Javi Velasco
3da1f17d5a
[middleware] Fix hydration for rewrites to dynamic pages (#32534)
Fixes #32302 

This PR fixes an issue on hydration where we rewrote using a middleware to a dynamic path. In such cases we need to run preflight to find out the middleware operation metadata.

## Bug

- [X] Related issues linked using `fixes #number`
- [X] Integration tests added
- [X] Errors have helpful link attached, see `contributing.md`
2021-12-15 13:33:13 +00:00
Shu Ding
e75361fd03
Fix server data cache key (#32506)
Currently we are using `location.href` which doesn't align with the other flight request's cache key (`pathname + search`). This fix unifies it.

## 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 `yarn lint`
2021-12-14 19:52:37 +00:00
Balázs Orbán
e8977bc364
chore: lock stale & closed issues sooner 2021-12-14 18:06:39 +01:00
Tim Neutkens
12bb1b1da2 v12.0.8-canary.6 2021-12-14 18:05:17 +01:00
JJ Kasper
2a5c21b65c
Update to filter loader specific files from traces (#32267)
* Update to filter loader specific files from traces

* remove debug log
2021-12-14 10:41:10 -06:00
Ismail Ghallou
797e260e1e
doc: update remark import (#32481)
## 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
- [x] 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 `yarn lint`
2021-12-14 11:01:44 +00:00
Tobias Koppers
f7153b13e9
upgrade webpack and watchpack (#32173)
Co-authored-by: sokra <sokra@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-14 11:48:49 +01:00
Jiachi Liu
cbe1844e02
test: add timeout for dev entries to avoid hard navigation (#32476) 2021-12-14 11:37:42 +01:00
Tobias Koppers
ee220730db
fixes to allow lazy compilation for import() (#32441) 2021-12-14 11:33:04 +01:00
Jiachi Liu
67545bd654
Add vitals and rsc to npm files (#32472) 2021-12-14 11:30:14 +01:00
Shu Ding
8f9aed687a
Fixes for inline embedding data in the web runtime (#32471)
* fix missing renderToString

* workaround tee

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-14 00:48:36 +01:00
Jiachi Liu
0ad4ad6dcd
Update react version to rc in react-18 doc (#32473)
* Update react version to rc in react-18 doc

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-12-14 00:09:33 +01:00
Oriol Collell
eba9da09eb
Fixes #32338 missing Document components trigger an error for production builds (#32345)
* Only validate _document subcomponents in dev environment

* Replace error by a warning

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-13 16:47:34 -06:00
Jiachi Liu
10d814d31a
Fix dynamic routes with pages under index folder (#32440)
Fixes incorrect generated manifest and generated directory for `index/[...dynamic]` pages

Too much normalizing adding extra `index/` prefix to `index/[...dynamic]` routes which lead to the incorrected generated routes like `.next/server/pages/index/index/index/[...dynamic]`

## Bug

Fixes https://github.com/vercel/customer-issues/issues/146

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-12-13 20:36:31 +00:00
JJ Kasper
48cee5485a
v12.0.8-canary.5 2021-12-13 13:07:44 -06:00
Javi Velasco
59f7676966
Fix running server with Polyfilled fetch (#32368)
**Note**: This PR is applying again changes landed #31935 that were reverted from an investigation.

This PR fixes #30398

By default Next will polyfill some fetch APIs (Request, Response, Header and fetch) only if fetch is not found in the global scope in certain entry points. If we have a custom server which is adding a global fetch (and only fetch) at the very top then the rest of APIs will not be polyfilled.

This PR adds a test on the custom server where we can add a custom polyfill for fetch with an env variable. This reproduces the issue since next-server.js will be required without having a polyfill for Response which makes it fail on requiring NextResponse. Then we remove the code that checks for subrequests to happen within the **sandbox** so that we don't need to polyfill `next-server` anymore.

The we also introduce an improvement on how we handle relative requests. Since #31858 introduced a `port` and `hostname` options for the server, we can always pass absolute URLs to the Middleware so we can always use the original `nextUrl` to pass it to fetch. This brings a lot of simplification for `NextURL` since we don't have to consider relative URLs no more.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-12-13 18:30:24 +00:00
Thomas Knickman
c658fd3276
chore(blog-starter): update tailwindcss to v3 (#32398)
Updates the [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) example to use the new [tailwindcss v3](https://tailwindcss.com/blog/tailwindcss-v3) by following the [upgrade guide](https://tailwindcss.com/docs/upgrade-guide).

Thanks!

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-13 15:25:45 +00:00
xiaohai
d66579409e
docs: remove empty example link (#32439)
https://github.com/vercel/next.js/tree/canary/examples/custom-server 
This example has been moved to the documentation


## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-13 15:19:39 +00:00
Donny/강동윤
4c8415091c
Update jsx transform of swc (#32383)
## 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 `yarn lint`


This PR applies

 - https://github.com/swc-project/swc/pull/2741

This fixes `development` mode of jsx.
2021-12-13 14:24:32 +00:00
JJ Kasper
ca8fd316f1
Update docker image to leverage output traces (#32258)
This updates our docker example to leverage the output traces and standalone build to reduce the resulting docker image quite a bit. 

docker image size before: `272MB`
docker image size after: `121MB`
node-14:alpine size (base image): `118MB`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

x-ref: https://github.com/vercel/next.js/pull/32255
x-ref: https://github.com/vercel/next.js/issues/32252
x-ref: https://github.com/vercel/next.js/issues/30822
2021-12-13 13:11:12 +00:00
Shu Ding
438ee9618f
Inline server data response with partial hydration (#32330)
This PR implements the basic inline embedded server response data (#30994) for RSC, as well as partial hydration (#31338) for RSC and React 18 SSR streaming.

For #30994, `renderTargetSuffix` is passed to the `bodyResult` resolver so the stream can inject corresponding hydration scripts and the closing body tag at the correct time. The expected behavior should be _prefix_, _body shell_, _suffix scripts_, _stream and inlined data_, _close body_.

For #31338, we have to force turn on `disableOptimizedLoading` when `concurrentFeatures` is enabled to opt-out of deferred script tags.

## Bug

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

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] 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 `yarn lint`
2021-12-13 10:48:18 +00:00
Aryan Beezadhur
e63322f432
Update Dockerfile (#32299)
Update `Dockerfile` to match [Next.js docs](https://nextjs.org/docs/deployment#docker-image).
2021-12-12 20:52:34 +00:00
Nikita Brancatisano
4f1d95b963
Updated to working example (#32256)
## Bug

Since the MDX update to v2 the example stopped working and it renders a raw .md page in the "Posts" route. 

![image](https://user-images.githubusercontent.com/33670112/145102450-caba33b2-246b-4809-ab96-a787aae16df0.png)

This fixes the issue and upgrades the `--example blog`
2021-12-12 20:43:41 +00:00
Jiachi Liu
59a4432318
Rename experimental vital hook (#32343)
* Rename vital hook

* update taskfile

* disable hook rule for unstable prefix

* rename at exports

* fix typing

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-12 21:14:12 +01:00
Stephen Gheysens
adbe237d0c
Updated link to Local Images (#32427)
Local Images is on the Image Optimization page under the Basic Features docs



## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-12-12 20:12:26 +00:00
Balázs Orbán
ac82da2250
chore: remove duplicate example (#32391)
Removes the `with-typescript-eslint-jest` example in favour of the more up-to-date `with-jest` and `with-jest-babel` examples, that also support TypeScript etc.

Related #23841


## 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 `yarn lint`
2021-12-11 21:08:29 +00:00
Artur Parkhisenko
37d1100825
Change using-preact example dependencies and docs (#30394)
* change use-preact dependencies

* change stackblitz url to use https protocol

* change deprecated thing from the webpack5 doc
2021-12-11 15:19:49 +01:00
Jiachi Liu
0f96308419
test: add wait timeout between clicks for rsc link (#32376)
Stabilize flaky test

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-10 20:13:56 +00:00
JJ Kasper
83e661031c
v12.0.8-canary.4 2021-12-10 10:08:40 -06:00
Donny/강동윤
6015f3c332
fix(next-swc/styled-jsx): Fix nth (#32358)
## 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 `yarn lint`
2021-12-10 13:22:09 +00:00
Jiachi Liu
c21806e54f
fix unstable_useRefreshRoot typing (#32364)
align with re-exports in entry file
2021-12-10 12:45:55 +00:00
Donny/강동윤
7df7c5e805
Upate swc (#32365)
## 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 `yarn lint`


This PR applies

 - https://github.com/swc-project/swc/pull/3000

This is a patch for self-referencing typescript enums.

 - https://github.com/swc-project/swc/pull/3003

This is a fix for source map shifting.
2021-12-10 11:42:10 +00:00
Jiachi Liu
6f8cf675d3
Add unstable_useRefreshRoot (#32342)
## Feature

Resolves #32332

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] 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`
2021-12-10 10:22:31 +00:00
JJ Kasper
55d8a14e8a
Fix flakey next/link react streaming test (#32351)
x-ref: https://github.com/vercel/next.js/runs/4477101349?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/4475354509?check_suite_focus=true
x-ref: https://github.com/vercel/next.js/runs/4474805941?check_suite_focus=true
2021-12-10 07:43:55 +00:00
Jordan Pittman
4d4f309301
Update example for Tailwind v3 (#32339)
# Update example for Tailwind v3

I updated the example used by the [official docs](https://tailwindcss.com/docs/guides/nextjs) to reference Tailwind v3 with the necessary changes. I _did not_ update the emotion example because it's using the xwind package which will likely need to be updated first.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-09 22:42:42 +00:00
JJ Kasper
93ef28bbbc
Update only fetch all tags for publish commits (#32337)
* Update only fetch all tags for publish commits

* still fetch before yarn

* Revert "still fetch before yarn"

This reverts commit 7107f4e80f0713e74c3e56668fa585eff42b58d9.

* lint-fix

* explicitly pass commit sha

* lint-fix

* update check

* remove space in args

* Use specific argv index

* apply suggestions
2021-12-09 16:36:18 -06:00
Pieter Bogaerts
0b1c9ec47d
Compile escape-string-regexp (#32310)
* Update index.js

* Update taskfile.js

* Revert "Update index.js"

This reverts commit 8106c076f92e961cdaeb0431812f676ea219b1ee.

* update compiled

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-09 13:31:53 -06:00
JJ Kasper
3ca0ac7f74
Update AMP validation tests (#32327) 2021-12-09 12:27:38 -06:00
Delba de Oliveira
602907afd0
Update Next.js version in api rate limits example (#32326)
## 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 `yarn lint`
2021-12-09 16:19:48 +00:00