Commit graph

4347 commits

Author SHA1 Message Date
Tim Neutkens
ad6ef01edc v12.0.5-canary.6 2021-11-20 20:27:02 +01:00
Donny/강동윤
3146ed37f8
Update swc (#31639)
The purpose of this PR is to apply

 - https://github.com/swc-project/swc/pull/2779
   - Fixes #31291.
   - Not sure if it's fully fixed, but fixes some bugs related to #31391 

 - https://github.com/swc-project/swc/pull/2818
   - Fixes #31627


I'll undraft this PR once https://github.com/swc-project/swc/pull/2818 is fixed.
2021-11-20 19:25:52 +00:00
Kiko Beats
f52211bad3
fix(middleware): consider localhost variations (#31603)
Since `localhost` is actually an alias for `127.0.0.1` that points to loopback, we should take that into consideration at `NextURL` when we handle local URLs.

The implementation is based on [is-localhost-url](https://github.com/Kikobeats/is-localhost-url); I added some tests over local URLs variations present at the library to ensure other variations are working fine.

Additionally, I refactor some things over the code to avoid doing the same twice and added some legibility that is always welcome when you are working with URLs stuff.

 closes https://github.com/vercel/next.js/issues/31533
2021-11-19 21:24:22 +00:00
JJ Kasper
9652bdd653
v12.0.5-canary.5 2021-11-19 14:44:42 -06:00
Mateusz Burzyński
9ba31bbd77
Remove outdated comment about string children being deprecated in next/link (#30606)
* Bring back accidentally lost deprecation warning for using string as a children for `next/link`

* Wrap warning with the env check

* Remove warning, just go with removed comment about deprecation
2021-11-19 13:58:33 -06:00
JJ Kasper
e8ca334d42
Fix non-concurrent function _document (#31628)
This ensures functional `_document` is rendered correctly when not using concurrent mode. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/31593
x-ref: https://github.com/vercel/next.js/pull/30156
2021-11-19 19:41:19 +00:00
Jiachi Liu
dab7b40618
Add types for geo lat and long (#31624)
Fixes #31620

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-19 17:09:52 +00:00
Gerald Monaco
ab712ef310
Move root div to an app wrapper (#31596)
Extracted from #31223.

We need to move the root `<div id="__next">` wrapper to be rendered as part of the page content, rather than the`Document`, so that flush effects (like styles) are flushed before (or after) the div, rather than inside, where they would cause hydration mismatches.
2021-11-19 08:16:05 +00:00
Hannes Bornö
1d2ac3b225
Implement SWC port of next-page-disallow-re-export-all-exports (#31582)
Fixes #30810

Added tests similar to the fixture ones, but the output is stderr. That way the test can make sure the error message and span is correct. Let me know if you think this is a bad idea.
2021-11-19 00:11:25 +00:00
jj@jjsweb.site
a363a4ff6c
v12.0.5-canary.4 2021-11-18 16:30:23 -06:00
JJ Kasper
1d9007307f
Fix accessing router before ready for HMR ping (#31588)
* Fix accessing router before ready for HMR ping

* update test name

* lint-fix
2021-11-18 16:23:21 -06:00
Gerald Monaco
9f7c774665
Minor simplifications to renderToWebStream (#31553)
Simplifies `renderToWebStream` a little bit for #31223
2021-11-18 19:46:15 +00:00
Javi Velasco
5a3d558c9f
Fix HMR for middleware #30791 (#31548)
Fixes #30791

The issue is that with Middleware we are introducing client compilation on a new layer. When a middleware changes (or is dropped after some time), Webpack reorganizes non-user modules as they are duplicated across different layer. This is currently triggering a full reload.

This also brings tests for HMR:
- Refresh on a Middleware change
- HMR works after a middleware compilation change.

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2021-11-18 18:23:52 +00:00
jj@jjsweb.site
01cf08e288
v12.0.5-canary.3 2021-11-18 09:25:26 -06:00
jj@jjsweb.site
2a5e605ab3
v12.0.5-canary.2 2021-11-17 20:33:04 -06:00
JJ Kasper
be2e863dde
Re-add native package folders and ensure wasm artifacts are downloaded (#31561)
* Re-add native package folders and update publish-native

* update jobs

* ensure wasm-binaries are downloaded

* only build-wasm on release
2021-11-17 20:23:02 -06:00
jj@jjsweb.site
eaf6e27deb
v12.0.5-canary.1 2021-11-17 17:15:04 -06:00
JJ Kasper
36d3198e39
Fix unhandled rejection on route change in dev (#31554)
This ensures we properly catch the rejection on route change failure in development so the dev overlay doesn't flash with the unhandled rejection. A test case isn't able to be added for this specific scenario as the unhandled rejection is fired right before the page is navigated so we can't consistently check if the rejection was unhandled or not. 

## 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/issues/28560
2021-11-17 21:33:56 +00:00
Steven
44b4dbcd41
Adjust AVIF size so that its smaller than WebP size (#31494)
Generally, AVIF quality can be lower compared to WebP so we can adjust this for the user so that it looks roughly the same depending on if the browser supports AVIF or WebP.

- Fixes #31254 
- Related to https://github.com/lovell/sharp/issues/2850
2021-11-17 20:31:16 +00:00
Gerald Monaco
0cf7061859
Make missing Document components an error (#31505)
* Make missing document components an error

* Fix broken tests
2021-11-17 13:34:16 -06:00
Keen Yee Liau
9ab1709175
telemetry: track usage of 'optimizeFonts' (#31522)
`optimizeFonts` is enabled by default, but the Aurora team would like
to find out how many users explicitly turn it off.
2021-11-17 13:33:37 -06:00
Maia Teegarden
b80c378975
Add/wasm build (#31470) 2021-11-17 20:01:02 +01:00
Donny/강동윤
2df861ac12
Update swc (#31540)
This PR applies
 - https://github.com/swc-project/swc/pull/2784

Closes #31479
2021-11-17 16:51:00 +00:00
Jiachi Liu
055e28ef81
Ensure only one doctype is rendered (#31534)
React-dom renders doctype automatically when `<html>` is detected. We should append `DOCTYPE` prefix only when necessary.
x-ref: https://github.com/facebook/react/pull/21680

## Bug

![image](https://user-images.githubusercontent.com/4800338/142215292-4af4a61d-2d75-48ae-a31a-0af641c72dcf.png)

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-17 14:57:48 +00:00
Steven
d87dc2b5a0
Add detection for Google-PageRenderer bot (#31521)
- Fixes https://github.com/vercel/next.js/discussions/31482
2021-11-17 03:49:37 +00:00
jj@jjsweb.site
2ad9dac873
v12.0.5-canary.0 2021-11-16 16:48:33 -06:00
Shu Ding
4ea7d7b177
Refactor the middleware SSR loader (#31508)
Initial step for #31506, to move the adapter logic out of the loader output string so it will be easier to reuse code in the future. Also, more options are passed to the loader to align with the serverless loader.

## 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-11-16 20:43:57 +00:00
Jiachi Liu
55ab4f06b7
Use _error for development in streaming (#31466)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-16 20:18:57 +01:00
Kiko Beats
593d943cd0
NextResponse: add .json static method (#31483)
closes: https://github.com/vercel/next.js/issues/31196

This new API was suggested in a previous version of this feature:
https://github.com/vercel/next.js/pull/31024#discussion_r745035448

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-16 18:38:47 +00:00
Tobias Koppers
bf973165fe
update webpack (#31455)
https://github.com/webpack/webpack/releases/tag/v5.64.1
2021-11-16 17:28:42 +00:00
Tobias Koppers
b79591cdaf
simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used.
2021-11-16 15:57:30 +00:00
Javi Velasco
9375485969
Remove TextEncoder and TextDecoder wrappers (#31490)
This PR removes the class wrapper that we have for `TextEncoder` and `TextDecoder`. Since this is merged we will be using directly the Node version in the sandbox.
2021-11-16 14:12:22 +00:00
stefanprobst
f195650f74
fix: allow next lint without eslint-config-next installed (#29823) 2021-11-16 14:07:31 +01:00
Yamagishi Kazutoshi
32f0c9a403
Support ESLint v8 (#29865)
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-16 10:18:27 +01:00
Heyang Zhou
a39a8969d3
Add a swc transform for removal of console.* calls. (#31449) 2021-11-16 10:18:05 +01:00
jj@jjsweb.site
abd87a515e
v12.0.4 2021-11-15 14:43:54 -06:00
jj@jjsweb.site
b204640008
v12.0.4-canary.15 2021-11-15 14:07:57 -06:00
Kiko Beats
b51a020941
middleware: add request referrer support (#31343)
closes: https://github.com/vercel/next.js/issues/30353

According with spec, `'about:client'` is the default value is the user doesn't provide it.

It needs to add a test there, looks like there no unit tests for these classes 🤔
2021-11-15 19:52:44 +00:00
jj@jjsweb.site
66d9b4e14a
v12.0.4-canary.14 2021-11-15 12:54:42 -06:00
Jiachi Liu
ef5795327a
Close stream when fatal error occurs (#31164)
* support custom 500 error in streaming

* remove unused imports
2021-11-15 11:49:50 -06:00
Steven
eb0bd63af4
Fix basePath replacing server-side and normalizeLocalePath() when path is empty string (#30978)
This fixes our `basePath` detection/replacing server-side as we were incorrectly considering `/docss` a match for a `basePath` of `/docs` which caused us to have an unexpected value in the `normalizeLocalePath` function. 

- Fixes #22429
- Regression introduced in #17757 
- Fixes: https://github.com/vercel/next.js/issues/31423

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-15 17:33:21 +00:00
Tim Neutkens
2d9ac399c1
Remove moment locale replace from craCompat as it's a default in Next.js 12 (#31431) 2021-11-15 10:36:53 -06:00
Shu Ding
16d56e2c49
Refactor server/render for SSR streaming (#31231)
Initial step to refactor the rendering logic by decoupling the handler and renderer:
1. Delegate Flight rendering to server/render
2. Reuse the piper glue code for both Fizz and Flight streams
3. Add buffering for ReadableStream

In 1), this PR also makes sure that gSSP/gSP are correctly executed before the Flight stream and `pageProps` and `router` are correctly delivered to the component.

Related to #30994.

## 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-11-15 15:29:34 +00:00
Byron
8c547139e4
add filename to babel warning about anonymous function default exports (#31322)
fixes #29667

I didn't add an integration test, but I can take a stab at it if you point me in the right direction!
2021-11-15 14:01:20 +00:00
Tim Neutkens
e5171758d3 v12.0.4-canary.13 2021-11-15 14:19:55 +01:00
Tim Neutkens
9da8d65632
Add minify debug env var to investigate minifier bugs (#31417) 2021-11-15 14:15:18 +01:00
Tobias Koppers
644d361c98
show (middleware only) when a middleware is added to the compiler (#31409)
## 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-11-15 09:20:27 +00:00
Tim Neutkens
8c84b4a1b6 v12.0.4-canary.12 2021-11-15 09:42:05 +01:00
Donny/강동윤
6fd44383f3
Update swc & fix styled-jsx (#31407) 2021-11-15 09:27:45 +01:00
Tim Neutkens
950eb0f489 v12.0.4-canary.11 2021-11-13 18:26:43 +01:00