Commit graph

4843 commits

Author SHA1 Message Date
David Ramos
36a6e436b3
Don't swallow test failures caused by POSIX signals (#32688)
* Don't swallow test failures caused by POSIX signals

* Update tests to not import() inside jest

* Update tests

* apply suggestion

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-21 12:52:07 -06:00
Kiko Beats
0eba5b2558
web runtime: add AbortController & AbortSignal (#32089)
It adds AbortController and AbortSignal Web runtimes APIs to be used by the user at Edge Functions.

For doing that it delegates into `abort-controller` dependency that has been frozen to prevent any modification.

Co-authored-by: Zhang Zhi <20026577+fytriht@users.noreply.github.com>
2021-12-21 17:12:53 +00:00
JJ Kasper
3667eba385
Pre-compile more dependencies continued (#32679) 2021-12-21 16:13:45 +01:00
Steven
738a964ead
Fix style reset on image with placeholder=blur (#32680)
This PR is a follow up to PR #32623 to fix the remaining blur styles.

These are unlikely to be overridden by the user but this PR is necessary to make `placeholder=empty` (default behavior) and `placeholder=blur` end up with the same inline styles on the loaded image.

Related to https://github.com/vercel/next.js/issues/18398#issuecomment-997114428
2021-12-20 17:49:35 +00:00
JJ Kasper
725f6b44d6
v12.0.8-canary.11 2021-12-20 09:28:17 -06:00
Hannes Bornö
802f4dcf5d
next-swc: styled-jsx error checking and reporting updated (invalid-styled-jsx-children.md) (#31940)
Co-authored-by: Hannes Lund <hannes.lund.2@consultant.volvo.com>
2021-12-20 16:17:37 +01:00
Jiachi Liu
b3b92b610f
Upgrade react 18 to rc, drop prerelease warning (#32619)
### Enhancement

* Auto enable reactRoot API for react 18 since the legacy render in `react-dom` is dropped
* Remove prelrease warning
2021-12-20 13:43:42 +00:00
JJ Kasper
e8408c7086
Pre-compile more dependencies (#32627)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-20 14:01:35 +01:00
Donny/강동윤
026dd4cea0
chore: Update swc (#32664)
## 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`


Fixes https://github.com/vercel/next.js/issues/30800
2021-12-20 10:55:26 +00:00
Balázs Orbán
6ffa2baa4d
fix(next/jest): do not watch .next folder (#32659)
`jest --watch` looks for [changes in dotfiles and folders by default](https://github.com/facebook/jest/pull/10075), which resulted in the tests being re-run when navigating between pages with `next dev`.

Fixes #32650

## 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-19 19:03:54 +00:00
Shu Ding
8b12b174e5
Fix writing strings to the writable stream writer (#32637)
Only chunks are allowed to write to writable. This fixes the following error in the web runtime:

```
Uncaught (in promise) TypeError: This TransformStream is being used as a byte stream, but received a string on its
writable side. If you wish to write a string, you'll probably want to explicitly UTF-8-encode it with TextEncoder.
```

It doesn't fail in the Node.js sandbox since we polyfilled this case (which should be reverted back later).

## 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-18 18:39:36 +00:00
JJ Kasper
3e83205eab
v12.0.8-canary.10 2021-12-17 20:24:59 -06:00
Steven
079c4be439
Fix style.filter on image with placeholder=blur (#32623)
Fixes https://github.com/vercel/next.js/issues/18398#issuecomment-995871025
2021-12-18 02:08:48 +00:00
Jiachi Liu
b58a3f0b9d
Add options to defaultGetInitialProps and upgrade styled-jsx-with-csp example (#32594)
x-ref: https://github.com/vercel/styled-jsx/issues/763

* Add 2nd arg `options` to `docCtx.defaultGetInitialProps` to make customization easier
* Upgrade styled-jsx to fit typing
* Update styled-jsx csp example
2021-12-17 23:27:56 +00:00
Jiachi Liu
bb6d4d71fd
Move fs API for inc cache to node server (#32604)
Move fs API for incremental cache to node-server, leave a small group of mock file system for base server
2021-12-17 22:56:26 +00:00
JJ Kasper
d7811d3207
v12.0.8-canary.9 2021-12-17 15:47:01 -06:00
Antoine Apollis
83b04c8983
Feat/14701 full reload notification (#28866)
## 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 issue: #14701
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`

<details>

<summary>Screenshot</summary>

<img width="1388" alt="Screen Shot 2021-12-17 at 2 07 04 PM" src="https://user-images.githubusercontent.com/22380829/146602057-9675455d-cf10-435a-b121-bc462a87fbf3.png">


</details>

Closes: https://github.com/vercel/next.js/issues/14701


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-17 21:24:13 +00:00
JuanM04
59c1f0393c
Upgraded next-env dependencies (#32613)
Old PR: #32197

I forgot I had that PR open and I removed my fork. So, I've reopened this PR to solve the merging conflicts

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-12-17 20:52:28 +00:00
JJ Kasper
f61e3566bf
Ensure AMP optimizer is only excluded from trace when not used (#32577) 2021-12-17 13:57:03 -06:00
Shu Ding
346670ca6c
Fix ReadableStream.pipeTo() being unimplemented in the web runtime (#32602)
Currently we are using a TransformStream to process the forwarded stream for the inlined data, but unfortunately the `pipeTo` method is not implemented in the web runtime. This PR changes it to a naive way of doing so.

## 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-17 12:27:53 +00:00
Jared Palmer
ed022eda0f
Add turbo / improve Rust build caching in GitHub Actions (#31464)
Implements Turborepo for the Next.js repository and leverage it for native build caching.

Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
2021-12-16 20:10:45 +00:00
Tim Neutkens
e90f0aec7a v12.0.8-canary.8 2021-12-16 14:50:34 +01:00
Donny/강동윤
99f9be585b
Update swc (#32566)
## 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 applies

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

Fixes https://github.com/vercel/next.js/issues/32553

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

Fixes https://github.com/vercel/next.js/issues/32470
2021-12-16 13:48:03 +00:00
Donny/강동윤
47cd07bb75
fix(next-swc/styled-jsx): Fix interpolation in media query (#32490)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-16 12:23:31 +01:00
Ben
04fbc663f9
Check stack property for page export exceptions (#32289)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-16 09:41:45 +01:00
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
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
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
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
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
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
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
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
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
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
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
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