Commit graph

4287 commits

Author SHA1 Message Date
JJ Kasper
6b89fbf12d
Ensure asPath is correctly normalized in minimalMode with i18n (#31281)
This ensures the `asPath` and `req.url` values are normalized correctly for fallback pages with i18n in minimal mode. This also copies the minimal mode test suite to run against i18n as well. This also fixes an issue where rewrite params weren't passed correctly on the client when no params were already used in the destination. 

The provided reproduction has been deployed against this patch [here](https://nextjs-error-repro-9zdu3sp5r-ijjk-testing.vercel.app/page/test-page) show it working. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/27563
Fixes: https://github.com/vercel/next.js/issues/30203
2021-11-11 20:11:50 +00:00
Jiachi Liu
6abc6699e9
Upgrade webpack (#31313)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-11 19:02:27 +00:00
Tim Neutkens
c4558c913f
Output where preference is saved (#31305)
Fixes #31241



## 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-11 16:48:00 +00:00
Tim Neutkens
fbe366f465 v12.0.4-canary.8 2021-11-11 16:36:38 +01:00
Tim Neutkens
7aabcda66e v12.0.4-canary.7 2021-11-11 16:31:33 +01:00
Tim Neutkens
9faf14e0b7
next/jest: Ensure typeof window is not transformed in jsdom environment (#31304)
Found that when the target is `jsdom` instead of `node` the "typeof window" transform is incorrect. This was causing an unexpected failure in on of the tests for vercel.com.


## 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-11 15:05:32 +00:00
Tim Neutkens
0ae94488f3 v12.0.4-canary.6 2021-11-11 12:06:30 +01:00
Donny/강동윤
46e1cbc95e
Update swc for jsc.paths (#31290)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-11 11:55:44 +01:00
Tim Neutkens
2800a2b1c0
Ensure next/jest is published (#31296)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-11 11:48:12 +01:00
ihmpavel
bd8003850b
Fix typo in next build log (#31295)
## 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-11 10:38:53 +00:00
Tim Neutkens
dfff685207 v12.0.4-canary.5 2021-11-11 09:21:54 +01:00
vordgi
ae1d271f9a
bugfix/i18n Do not support the second locale in the pathname (#31229)
## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added

Fixes: https://github.com/vercel/next.js/issues/31228
2021-11-11 02:29:20 +00:00
ericbiewener
c791da0977
correctly assess node equality when nonce attribute is present (#27573)
* add isEqualNode function

* add test

* trying to make integration test work

* revert

* Update test/unit/is-equal-node.unit.test.js

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

* Revert "revert"

This reverts commit d67b9971068d18efcf839666a3a17619fd914fc3.

* Fix tests

* Use TS for unit test

* Revert waitfor

* Start tests with "should"

* Fix lint

* Use cloneNode()

Co-authored-by: Eric Biewener <eric.biewener0@walmart.com>
Co-authored-by: Steven <steven@ceriously.com>
2021-11-10 19:31:32 -06:00
Tim Neutkens
0196b03621
Experimental next/jest config helper (#31246)
* Experimental next/jest config helper

Co-Authored-By: Maia Teegarden <dev@padmaia.rocks>

* Ensure useTypescript is provided

* Move experimental warning to next/jest

* Remove unused code

* Remove unused imports

Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
2021-11-10 16:16:15 -08:00
Stefano Rainieri
52139a41e9
fix: replaced useless let (#31239)
## 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-11 00:14:38 +00:00
Jiachi Liu
edb5060fc0
Fix process.env overriden in web runtime (#31261)
Fixes #31258

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-10 18:57:27 +00:00
Donny/강동윤
fd9593542a
Update swc minifier (#31242)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-10 17:39:34 +01:00
Tobias Koppers
9c4c7123b6
run middleware parser handler only for middleware modules (#31219)
## 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-10 15:31:46 +00:00
Donny/강동윤
24f7c21736
Update swc (#31233)
## 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/2699

Fixes https://github.com/vercel/next.js/issues/30839
2021-11-10 09:06:04 +00:00
jj@jjsweb.site
7087adba12
v12.0.4-canary.4 2021-11-09 15:47:35 -06:00
Tobias Koppers
8c8642898f
upgrade webpack (#31034)
* upgrade webpack

* ⚙ Update compiled files

Co-authored-by: sokra <sokra@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-09 22:34:53 +01:00
Genet Schneider
e3135ccde6
Support assetPrefix specific protocol (#31213)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-09 15:26:55 -06:00
Filip Skokan
0985b0b472
share collections in middleware vm context (#31043)
When libraries are required outside of the middleware function context and they do checks such as `a instanceof Uint8Array` since the constructors are different between the two contexts they'll always yield false.

This is a problem for libraries validating user input as well as the WebCryptoAPI polyfill used outside of Edge Functions.

- Fixes #30477
- Fixes #30911

This is only a problem for the sandbox runtime, not when ran inside an Edge Function.
2021-11-09 19:57:19 +00:00
Hiroshi Ogawa
764e29c170
fix(31013): add base path to preflight request url (#31101)
Fixes https://github.com/vercel/next.js/issues/31013

My understanding is that there are currently two functions `Router.change` and `Router.prefetch` leading to `Router._preflightRequest` and they pass `options.as` URL differently regarding base path.
In this PR, such difference will be handled in `Router._preflightRequest` to add base path before actually fetching.
Thanks for the review!

P.S.
Since middleware feature is a relatively new, official maintainers might not want external contributions around this area at this stage.
I totally understand such situation, so please let me know if that's the case. I can look for other issues to investigate instead.


## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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-09 19:03:05 +00:00
Tim Neutkens
3e8b2dcb6c
Disable styled-components displayName in production (#31216)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-09 12:24:01 -06:00
Kiko Beats
0bcb7149dc
fix(middleware): expose CryptoKey and globalThis.CryptoKey (#31193)
closes https://github.com/vercel/next.js/issues/30475
2021-11-09 17:39:29 +00:00
JJ Kasper
eb7b40171a
Add initial standalone build handling (#31003)
* Add initial standalone handling

* apply suggestions

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
2021-11-09 11:03:20 -06:00
Tim Neutkens
31985c5cae v12.0.4-canary.3 2021-11-09 17:18:40 +01:00
Tim Neutkens
b5b315ae04
Add test for styled-components SWC transform disabled (#31214)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-09 17:18:04 +01:00
Tim Neutkens
bcf25289de v12.0.4-canary.2 2021-11-09 15:42:12 +01:00
Tim Neutkens
1941eedd7a Add webpack5 types to right files 2021-11-09 15:40:13 +01:00
Tim Neutkens
14aac0859f
Add all cases where webpack5 type is used (#31206) 2021-11-09 15:18:40 +01:00
Spencer Elliott
a1e76fb966
Use require.resolve to detect "framework" packages (fix pnpm) (#21048)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-09 14:42:23 +01:00
Tim Neutkens
a0a08ae9e5 v12.0.4-canary.1 2021-11-09 12:49:23 +01:00
Donny/강동윤
54ca8f41ce
next-swc: Add displayNameAndId of styled-components (#31189)
## 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`




Related to: https://github.com/vercel/next.js/issues/30802
2021-11-09 10:05:31 +00:00
Javi Velasco
5fc4325aa6
Fix middleware i18n rewrites (#31174)
Fixes #30897

This PR fixes the linked issue where rewrites are not being applied for locale. It adds the corresponding test but also, as it was added in debugging process, it introduces a helper to read/write into the `request` object.

We are currently writing directly into the request by casting to `any` and then using flags like `_nextRewrote`. Instead, this PR puts all of this metadata under a symbol so it is not directly accessible. This also allows to have a single place where all of this metadata is listed so we can add comments describing the purpose of each flag.

In the same way, there is metadata written in the querystring. This is adding some types for it in order to throw some visibility on where is this metadata accessed. In an upcoming PR we can move all of it to the `request` object if possible to simplify the system.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-11-09 01:28:39 +00:00
Shu Ding
91a6e3af3a
Do not hide body when concurrentFeatures is enabled (#31187)
When Fizz is enabled, we want to always show the content of body even before it's loaded. Please hide whitespace changes when reviewing this PR.

## 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-09 00:45:44 +00:00
Shu Ding
960298b344
Fix useId mismatches on hydration (#31102)
Fixes #30876.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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-08 23:32:06 +00:00
Tim Neutkens
9fe0fda5b4
Add input/output test for 30091 (#31166)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-08 20:40:27 +01:00
Tim Neutkens
9d7900c209
Update reason message for isolatedModules and esModuleInterop (#31150)
This is still required with SWC. The message just wasn't updated.

Fixes #31149



## 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-08 19:16:34 +00:00
Tobias Koppers
283af4e69b
use loader-utils 2 for resolve-url-loader to fix ./data: urls in sass (#31134)
upgrade to loader-utils 3.1.2 for hash fix

fixes #31016
fixes #30998
2021-11-08 18:37:25 +00:00
Furkan MT
58755e6d25
fixes #31060: NullReferenceException (#31061)
* fix(#31060): NullReferenceException

Related Issue: https://github.com/vercel/next.js/issues/31060

* Type 'undefined' is not assignable to type 'Element | null'

Co-authored-by: Steven <steven@ceriously.com>
2021-11-08 12:53:49 -05:00
Othmane KINANE
39ef77cbe6
fix: support --cache-strategy ESLint argument (fixes #29926) (#29928)
* fix: support --cache-strategy ESLint argument

* add integration tests for --cache-strategy

* fix: add cacheStrategy to eslintOptions

* minor adjustments in next lint help message for --cache-strategy

Co-authored-by: Steven <steven@ceriously.com>
2021-11-08 12:17:42 -05:00
Maia Teegarden
bc88831619
Add next-swc jest transform (#30993)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-11-08 17:35:04 +01:00
Steven
83cd45215a
Add warning when image has unused sizes prop (#31064)
- Related to https://twitter.com/jaffathecake/status/1456579637987979265
- Closes #30640
2021-11-08 16:34:30 +00:00
jj@jjsweb.site
2a801809bb
v12.0.4-canary.0 2021-11-08 09:52:15 -06:00
Tim Neutkens
9db80fece5
Add webpack5 namespace to fix type errors (#31140) 2021-11-08 16:19:33 +01:00
Kitty Giraudel
3ceb9c5673
Give priority to document.title over h1 when announcing page change (#31147)
## Improvement

This pull-request should address https://github.com/vercel/next.js/issues/24021, improving the page change announcement for assistive technologies by giving priority to `document.title` over `h1`. Interestingly, it would also improve a potential performance bottleneck by skipping calls to `innerText` on the main `h1` raised in [this comment](https://github.com/vercel/next.js/pull/20428#issuecomment-962537038).
2021-11-08 14:58:21 +00:00
Shu Ding
feed67ee36
Enable code splitting for the web runtime build (#31090)
When using the web runtime with SSR streaming, this PR significantly improves the build speed for large applications when there're large modules shared by most pages.

With another optimization, `react-dom` will now be excluded in the web runtime build if it's imported in the application. It will only take effect in the client bundle.

## 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-08 12:41:49 +00:00
Jiachi Liu
cfb8cc841e
Change .web extension of document page to part of path (#31116)
Fixes: #31104

This effecting users who are using expo with next (`@expo/next-adapter`) since react-native use `.web`, `.ios` and `.android` to identify platform. [Reference](https://docs.expo.dev/guides/using-electron/#%F0%9F%A7%B8-behavior)

Change `document.web.js` to `document-web.js` as fallback page in web runtime
2021-11-07 22:14:50 +00:00