Commit graph

10130 commits

Author SHA1 Message Date
Tim Neutkens
41f87abdf7 v12.0.5-canary.16 2021-12-03 12:30:59 +01:00
Tim Neutkens
c1f6abbe54 v12.0.5-canary.15 2021-12-03 12:30:14 +01:00
Luis Alvarez D
647c06b339
Improve exported root definitions (#32077)
Fixes https://github.com/vercel/next.js/issues/32045

doing `export { default } from 'module'` has some unexpected results for autocompletion in TypeScript, this PR changes root definitions to have a named default export where needed.

## Bug

- [x] Related issues linked using `fixes #number`
2021-12-03 07:16:29 +00:00
Lucas Wiener
80ec93d1bb
Skip warnings for Image not rendered to the dom (#32049)
Some libraries, like react-slick, render their content to a detached element before attaching it to the dom. If the content of such libraries is Image components, they will report warnings because the display/position properties are undefined. This PR squelch the warnings for such cases.
2021-12-03 06:40:45 +00:00
Tim Neutkens
b6914198b4
Remove "yarn jest" from Next.js repo scripts (#32042)
Removes `yarn test` from the scripts as it has the wrong options. `yarn testonly` or `yarn testheadless` are the way to run tests. Fixes #32031


## 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-03 06:02:59 +00:00
Leonardo Ortiz
31d2184972
docs(Testing): Remove duplicate link (#32071)
There was two items `Use a development server`, both linking to the same URL. The last one was removed.
2021-12-03 01:07:31 +00:00
Tobias Koppers
eb65ed37b0
avoid retaining webpack config too long (#32053)
avoids keeping the webpack compiler during after webpack build build steps like SSG etc.

(review with ignore whitespace)

## 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-03 00:47:16 +00:00
JJ Kasper
5763a33a03
v12.0.5-canary.14 2021-12-02 14:55:53 -06:00
JJ Kasper
df774a9dd7
Make CI build cache key more specific (#32059) 2021-12-02 14:39:37 -06:00
keji
a016713c9e
grammatical error in alert.js (#32062)
## 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-02 20:26:34 +00:00
JJ Kasper
abe53727b0
Include page for export errors for easier debugging (#32013)
This makes sure to include the `page` for dynamic routes when they encounter an error during prerendering as we currently only include the `path`, e.g. before we would only show `/blog/first` and now we show `/blog/[slug]: /blog/first` 

## 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-02 19:31:36 +00:00
JJ Kasper
cc9e1ea3a1
Fix middleware types with skipLibCheck: false (#32025)
This ensures type checking passes correctly for middleware types when `skipLibCheck: false` is set in `tsconfig.json`. This also moves the `middleware-types` to be an isolated test to ensure it isn't relying on any monorepo dependencies. 

## 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/31992#issuecomment-984174872
2021-12-02 18:49:49 +00:00
JJ Kasper
25371dd1b0
Lock node version for CI (#32057) 2021-12-02 12:10:05 -06:00
JJ Kasper
03317c7507
Fix copying swc binary for isolated tests locally (#32026) 2021-12-02 13:40:38 +01:00
Tobias Koppers
494e37c026
add experimental.swcFileReading flag to disable file reading in swc (#31995)
automatically disable swc file reading when wasm builds are used and for virtual or yarn cache paths



## 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`


Co-authored-by: Maia Teegarden <2865858+padmaia@users.noreply.github.com>
2021-12-02 04:16:15 +00:00
Leonard Martin
5747435d87
Add note to docs about sharp memory usage on default Linux setup (#31919)
It's fairly opaque to the user that there are problems with `sharp` in an out-of-the-box Linux environment, and so if `sharp` is going to be explicitly recommended for non-Vercel production environments then I think it's a good idea to make sure people are aware of the possible issues.

My vanilla Heroku deployment was using wild amounts of memory until I found the details in the sharp docs about how to configure the memory allocator, so signposting this a bit better should help prevent issues in future.



## 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`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-12-01 20:53:04 +00:00
Eric Matthys
f225179378
fix(Link): Do not ignore onMouseEnter prop with absolute href (#32012)
Fixes #22733

Regardless of whether it's recommended that Link be used with external href values or not, they can be used and `onMouseEnter` being swallowed with an external href value is unexpected behavior.

## Bug

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-01 18:32:27 +00:00
C. T. Lin
332cd06c7d
Allow pre-release React 18 as peer (#31991) 2021-12-01 17:30:22 +01:00
Rich Haines
73d7f9458f
Updated Maedahs name in label gen config (#32005) 2021-12-01 10:20:11 -06:00
JJ Kasper
32ac918672
v12.0.5-canary.13 2021-12-01 10:07:32 -06:00
Jiachi Liu
928c77958e
Resolve streaming data for flight requests (#32010)
## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-12-01 15:48:31 +00:00
Tim Neutkens
1442b582f5
Add Rich, Maedah, and Ismael to the docs label 2021-12-01 13:18:13 +01:00
Tim Neutkens
f8d6441e41
Add next-swc to labeler 2021-12-01 12:00:30 +01:00
Shu Ding
b7fb315cd7
Ensure that external modules are not bundled into the client for RSC (#31968)
If importing an external module inside a Server Component (`.server.js`), it shouldn't be bundled into the client. Only client components should be kept.

## Bug

- [ ] 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-30 22:54:47 +00:00
Jeff
a2fa637ab3
fix(types): add missing ua types for NextRequest (#31901)
* fix(types): add missing ua type for NextRequest

add missing ua string type on NextRequest["ua"], returns full agent as string

* Update UserAgent type

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-30 15:59:02 -06:00
Kim, Harim
b290a3dc38
Fix with-mongo example by removing deprecated function (#30675)
* Remove deprecated function

* Remove useless change

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-11-30 15:50:50 -06:00
Vincent Voyer
2bd296d4ef
docs(NextRequest): req.cookie => req.cookies (#31975) 2021-11-30 15:34:17 -06:00
Delba de Oliveira
306c467c3b
Update Jest examples and docs (#31633)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: stefanprobst <stefan.probst@univie.ac.at>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2021-11-30 15:10:40 -06:00
Steven
b01a6ba665
Add TS types for NextMiddleware (#30578)
This allows TypeScript users to have type safety for middleware functions.

- Closes #30490 

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-30 20:43:40 +00:00
JJ Kasper
4410de9ff3
v12.0.5-canary.12 2021-11-30 13:33:32 -06:00
Tim Koopman
8784682a74
Escape string when converting to regexp (#31791)
fixes #31411

## Bug

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


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-30 19:15:13 +00:00
Jiachi Liu
d2cef24d5d
Fix image related link prop warning with react 18 beta (#31895)
## Bug

Fixes #31892 

react 18: requires camelcase for those props 
```
Warning: Invalid DOM property `imagesrcset`. Did you mean `imageSrcSet`
```
react 17: requires lowercase for those props

```
Warning: React does not recognize the `imageSrcSet` prop on a DOM element.
```

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


### Utils

* Add command `yarn next-react-18 test/integration/any-react-18-app/`
* Add util `withReact18`

```js
const withReact18 = require('../../react-18/test/with-react-18')

module.exports = withReact18({
  experimental: {
    concurrentFeatures: true,
  },
})
```
2021-11-30 18:37:22 +00:00
Gerald Monaco
2b5d62dcad
Stop using environment variables in pages/_document (#31946)
Since #31939 is going to move the `Document` components, we can't rely on `DefinePlugin` to provide environment variables. This PR passes them as render opts instead. We can't just force this to be bundled like e.g. `next/dynamic`, because we use it internally.
2021-11-30 17:14:28 +00:00
Donny/강동윤
12b44e279b
Update swc (#31963)
This PR applies

 - https://github.com/swc-project/swc/pull/2916
   - Closes https://github.com/vercel/next.js/issues/31757
2021-11-30 15:12:37 +00:00
Jiachi Liu
85e578a906
Enable default functional document when concurrentFeatures is enabled (#31954)
## Bug

Fixes: #31675 

Functional document without gIP should be enabled when streaming is enabled, even without rsc

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-30 12:52:14 +00:00
Lee Robinson
6e6bd2158f
Update next export documentation. (#31465) 2021-11-29 20:50:41 -06:00
Jiachi Liu
c78930111d
Removng prop writable checking in prod (#31929)
x-ref: #28498, #31784

I can repro the issue #24783 with `next-boost` 0.10.1 and it was fixed in 0.10.2 (ref: eba6d10aab). The actual case is missing setting node env to `"production"`.

React freeze element props and element itself in dev mode (ref: a724a3b578/packages/react/src/ReactElement.js (L194-L196))

Then next.js will reassign props with react development bundle while next-boost is enabled. Those operations are only happened in non-dev mode so it's good to remove now.

This PR + #31898 == revert #31784

cc @styfle @awareness481
2021-11-30 00:56:02 +00:00
Maia Teegarden
0ef87397da
Account for platform/arch not supported by napi (#31938) 2021-11-29 18:05:35 -06:00
Katie Byers
c03fa72c99
Add tracing to with-sentry example for Next.js 11 (#30401) 2021-11-29 17:02:00 -06:00
Maedah Batool
2781b8eb87
Improve Middleware Set Cookie API documentation (#31707) 2021-11-29 16:44:58 -06:00
Maia Teegarden
7be75bbf2f
Try fix (#31943) 2021-11-29 14:31:19 -08:00
JJ Kasper
3b089ae18f
v12.0.5-canary.11 2021-11-29 16:18:39 -06:00
Thibaut SABOT
922a1fd005
include no-document-import-in-page rule in plugin index (#31890)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-29 16:09:17 +01:00
Jiachi Liu
6920c0201b
Remove unpurpose test (#31898)
The test from #31784 can pass with or without the source code change in that PR.
I cannot repro it. The writable is true on build in the provided case
2021-11-29 15:03:13 +00:00
Michel Krämer
c8457e3abf
Fix disabling of built-in CSS support if there is a custom loader (#31078)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-11-29 15:19:39 +01:00
Leonardo Ortiz
0202bb0a99
Docs(React 18): remove unnecessary React import (#31900)
In the `Server Components APIs (Alpha)` code sample, importing `React` is unnecessary. People may think that having `react`'s default export imported is needed to use `Suspense`
2021-11-29 01:21:06 +00:00
Leonardo Ortiz
efd5d03a8c
Docs(React 18): add missing Suspense import (#31897)
This PR adds a missing import in React 18 documentation's sample code, where `Suspense` is used without being imported.

_(edit: fix typo)_
2021-11-29 00:46:26 +00:00
Vincent Voyer
127b92b102
docs(examples): add secure flag explanation to with-iron-session (#31896)
Following comment on the project here: https://github.com/vvo/iron-session/issues/425
2021-11-28 18:35:39 -06:00
Steven
b1be180d7d
Fix: Cannot assign to read only property 'children' (#31784)
- Closes #28498 

Co-authored-by: Jesse Jafa <12380586+awareness481@users.noreply.github.com>
2021-11-28 21:19:57 +00:00
Javi Velasco
85cc454023
Add port and hostname options to Next Server (#31858)
A middleware can work as a proxy intercepting requests and then performing a `fetch` to the destination adding headers to the request / response as a "man in the middle". When using `fetch` from a middleware we are not in the context of a browser so we can't really use relative URLs, they must be always absolute.

Now consider the previous case when middleware is running in *server mode*. Typically in order to know the host where we are fetching we can use the `request.nextUrl` which is given to the middleware but in this case the invoker (which is next-server) has no context of the hostname, nor the port. To solve this use case we must make the invoker of the middleware aware of the origin hostname and port.

This PR: 

- Introduces `hostname` and `port` as options for `NextServer`.
- Refactors types in `NextServer` and `NextDevServer` moving type only imports to the top of the file.
- Refactors `startServer` to do a best guess on the `hostname` and `port`, passing them down.
- Exposes `.port` and `.hostname` to be retrieved from the `app`.

In an upcoming PR we will pass the host guess to the middleware to solve the relative URL issue.
2021-11-28 16:48:43 +00:00