Commit graph

4307 commits

Author SHA1 Message Date
Tim Neutkens
bd53816aff v11.1.3-canary.71 2021-10-15 09:17:45 +02:00
JJ Kasper
75748caf7f
Migrate server-sent events HMR connection to WebSocket (#29903)
This replaces the server-sent events HMR connection with a WebSocket connection to prevent hitting browser connection limits, allow sending events back from the browser, and overall better performance. 

This approach sets up the the `upgrade` event listener on the server immediately when created via `next dev` and on the first request using `req.socket.server` when created via a custom server. In a follow-up PR we can push the files changed via the WebSocket as well. 

x-ref: https://github.com/vercel/next.js/issues/10061
x-ref: https://github.com/vercel/next.js/issues/8064
x-ref: https://github.com/vercel/next.js/issues/4495

## 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
2021-10-15 07:09:54 +00:00
Denis Homolík
ea0cdc5a36
Add revalidate to the GetStaticPropsResult (#29919)
Fixes #28687

According to the answer in #28687, `GetStaticPropsResult` should allow specifying `revalidate` next to the `notFound: true`. Right now it's missing in the types def and allows to return any type. Also this may lead to confusion, that `revalidate` can't be used with the `notFound: true`

Example:
```ts
export const getStaticProps: GetStaticProps = async ({ locale }) => {
  const data = await fetchData();

  if (!data) {
    return {
      notFound: true,
      revalidate: new Date() // ts doesn't know the revalidate field and allows this
    };
  }

  return {
    props: { data },
    revalidate: new Date() // ts know the revalidate field, so it doesn't allow this
  };
};
```

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

- [x] Make sure the linting passes
2021-10-15 02:14:25 +00:00
Tim Neutkens
fd5522d923 v11.1.3-canary.70 2021-10-14 20:15:19 +02:00
Thibaut SABOT
ba39ee458b
upgrade strip-ansi in react-dev-overlay (#29906)
* upgrade strip-ansi in react-dev-overlay

* use the non-breaking version of strip-ansi
2021-10-14 10:57:29 -05:00
Donny/강동윤
e45d1381e5
Update swc (#29913)
## 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
2021-10-14 15:15:23 +00:00
jj@jjsweb.site
0d4d95f5c7
v11.1.3-canary.69 2021-10-14 09:38:52 -05:00
Tim Neutkens
40cf931338
Remove unused options from swc-loader (#29907)
Since this is not a swcrc option and will be removed in the future it's best to prune it from next-swc already.

## 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
2021-10-14 08:50:55 +00:00
JJ Kasper
6f3c338745
Update to latest @vercel/nft (#29902)
This updates to the latest version of `@vercel/nft` which includes better shared caching between runs. 

x-ref: https://github.com/vercel/nft/pull/239
x-ref: https://github.com/vercel/nft/pull/238
x-ref: https://github.com/vercel/nft/pull/237
2021-10-14 06:12:33 +00:00
Kara
5760ceac86
Refactor Document to prep for classic streaming (#29834)
This refactor is the first of a few changes to support "classic" (two-part)
streaming. This one should be a noop that doesn't actually change the behavior.
It re-organizes the way that functions are wrapped in Document Head/NextScript
so anything that will be part of the second flush can be separated out from the
first flush. It also adds the structure for a useMaybeDeferContent hook, but
currently always assumes that nothing should be deferred.

The next PRs will actually implement streaming.
2021-10-13 17:07:18 -05:00
Tim Neutkens
d62253406b
Enable esmExternals by default (#29878)
## 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
2021-10-13 21:11:52 +00:00
Tim Neutkens
d1d7a951d5 v11.1.3-canary.68 2021-10-13 18:56:20 +02:00
Donny/강동윤
bf9e998ae3
Update swc & Improve CI time (#29884)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-13 18:55:35 +02:00
Tobias Koppers
f530b0d312
only listen to drain even once (#29885)
gets rid of `(node:670) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 drain listeners added to [WriteStream]. Use emitter.setMaxListeners() to increase limit`
2021-10-13 16:29:52 +00:00
Tim Neutkens
a002f612c3
Add experimental option to enable fullySpecified (#29880) 2021-10-13 17:23:50 +02:00
Tobias Koppers
ecd31ab62f
update webpack (#29870) 2021-10-13 17:21:15 +02:00
Tim Neutkens
9cf49ddf43 v11.1.3-canary.67 2021-10-13 16:27:51 +02:00
Donny/강동윤
b99cfb8cfa
Update swc (#29881)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-13 16:24:31 +02:00
Tim Neutkens
96c2980c77 v11.1.3-canary.66 2021-10-13 13:49:49 +02:00
Donny/강동윤
c3971010f5
Update swc (#29866)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-13 13:45:38 +02:00
Jan Nicklas
31a701b9da
feat(jsconfig-paths-plugin): Resolve paths synchronously (#29467) 2021-10-13 12:17:54 +02:00
Genet Schneider
e40785e1e2
Avoid TypeError when comparing path param (#29821)
## Bug

Fixes a TypeError when accessing url with no path params `_next/data/<BUILD_ID>`
```
TypeError: Cannot read property 'endsWith' of undefined
  at Object.fn (/app/node_modules/next/server/next-server.ts:644:52)
  at Router.execute (/app/node_modules/next/server/router.ts:346:40)
  at Server.run (/app/node_modules/next/server/next-server.ts:1229:41)
  at Server.handleRequest (/app/node_modules/next/server/next-server.ts:489:25)
  at /app/node_modules/next/server/next.ts:47:14
```

- [ ] 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

- [x] Make sure the linting passes
2021-10-13 04:56:38 +00:00
Steven
bda4ca6ef3 v11.1.3-canary.65 2021-10-12 13:50:38 -04:00
Seraphina Orsini
c78d8fad19
Pin create-next-app to eslint@v7 (#29837)
Fixes https://github.com/vercel/next.js/issues/29770

## Description

Pins `eslint` to `v7`. This avoids issues with `v8` from both [changes to the public api](https://eslint.org/docs/8.0.0/user-guide/migrating-to-8.0.0#the-lib-entrypoint-has-been-removed) and [lack of support from rushstack](https://github.com/microsoft/rushstack/issues/2890). See https://github.com/vercel/next.js/issues/29770#issuecomment-940636627 for slightly more detail. 

Local testing showed output of next app correctly pinned to `v7`. 

<img width="495" alt="Screen Shot 2021-10-12 at 12 31 56 AM" src="https://user-images.githubusercontent.com/29002354/136892312-1571718c-882b-4235-98f4-c1b8d4c72d26.png">


### Bug Checklist

- [X] Related issues linked using `fixes #number`
- [ ] Integration tests added
   - Happy to add an integration test for pinning to v7 if we'd like, will need to be updated / removed when v8 is supported. 
- [ ] Errors have helpful link attached, see `contributing.md`
	- No errors to add links for
2021-10-12 16:02:55 +00:00
Donny/강동윤
7b3cce3f94
Update swc (#29843)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-12 16:43:45 +02:00
Steven
cc1f3b8a38
Add support for AVIF to next/image (#29683)
Add support for AVIF to `next/image`

- Fixes #27882 
- Closes #27432 

## Feature

- [x] Implements an existing feature request
- [x] Related issues linked
- [x] Integration tests added
- [x] Documentation added
- [x] Update manifest output
- [x] Warn when `sharp` is outdated
- [x] Errors & Warnings have helpful link attached
- [ ] Remove `image-size` in favor of `squoosh`/`sharp` (optional, need to benchmark)
2021-10-11 23:17:47 +00:00
Keen Yee Liau
13f68debfe
Collect feature usage for optimizeCss (#29828)
`optimizeCss` is a feature that inlines critical CSS using critters.
The Aurora team would like to gauge adoption rate for this feature.



## 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`
- [x] Integration tests added
- [ ] Documentation added
- [x] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-11 21:15:18 +00:00
Tim Neutkens
e61068bff6 v11.1.3-canary.64 2021-10-11 20:47:06 +02:00
Tobias Koppers
e679f5b7d1
allow to reload disposed client pages (#29815) 2021-10-11 20:36:01 +02:00
Tobias Koppers
a773e6fc77
handle new hmr connection as heartbeat signal (#29818)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-11 19:49:32 +02:00
Tobias Koppers
7a38bbb4d9
add summary logging option (#29814) 2021-10-11 19:31:12 +02:00
Tobias Koppers
41abf8b6c4
reduce default maxInactiveAge to 15s (#29817)
With persistent caching and other disposing fixes we can safely reduce the time before pages are disposed.

The last 2 client pages are still never disposed.
2021-10-11 17:12:16 +00:00
Tobias Koppers
d8437478c5
only schedule pages for disposing and dispose on next compile (#29816)
this avoids sending 'invalid' for pages that are removed from entries but not yet uncompiled (client still has page)
2021-10-11 16:12:48 +00:00
Tobias Koppers
1d2d41a502
hide build error when returning to old build (#29813)
In some cases, e. g. when introducing a build error and then returning to the successful build again, the build error modal stays open. That shouldn't happen
2021-10-11 15:31:22 +00:00
Tim Neutkens
e7f02d4a8e v11.1.3-canary.63 2021-10-11 16:49:37 +02:00
Tim Neutkens
bbe8cb0905 v11.1.3-canary.62 2021-10-11 15:41:06 +02:00
Tim Neutkens
0aa3aee594 v11.1.3-canary.61 2021-10-11 14:23:48 +02:00
Tim Neutkens
1653b4641f v11.1.3-canary.60 2021-10-11 13:14:30 +02:00
Tim Neutkens
205260236b v11.1.3-canary.59 2021-10-11 10:58:56 +02:00
Tim Neutkens
e7f503abd3
Pass sourcemap when swcMinify is enabled (#29794) 2021-10-11 10:57:21 +02:00
Donny/강동윤
bcb8e44b7e
Update swc (#29798)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-11 10:55:59 +02:00
Tobias Koppers
87d0fc9fd7
avoid using absolute paths in import/require (#29797)
Using absolute paths leads to unnecessary watched paths and tested paths for resolving
2021-10-11 08:52:59 +00:00
Tobias Koppers
77b65327cf
show partial compiled message and correct module count (#29795)
```
event - compiled successfully in 4.1s (1597 modules)
event - compiled client successfully in 271 ms (1076 modules)
```

instead of

```
event - compiled successfully in 4.1 s (1597 modules)
event - compiled successfully in 271 ms (1708 modules)
```

* spacing for seconds
* module count only counts modules from compilers that were running
* add a note to message when only one compiler had something to do
2021-10-11 08:14:52 +00:00
Tim Neutkens
71c013b142 v11.1.3-canary.58 2021-10-11 08:38:20 +02:00
Donny/강동윤
2874791ab1
Fix styled-jsx: Don't drop extra selectors (#29791)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-11 08:36:23 +02:00
Donny/강동윤
99fed15b8b
Update test refs (#29776) 2021-10-10 10:36:43 -05:00
Tim Neutkens
1f5ef906bd v11.1.3-canary.57 2021-10-10 13:21:34 +02:00
Tim Neutkens
23686594be v11.1.3-canary.56 2021-10-10 12:47:21 +02:00
Donny/강동윤
2cd52aed26
Fix bugs of styled-jsx and swc (#29774)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-10 12:46:44 +02:00
Tim Neutkens
2c2a4005e1 v11.1.3-canary.55 2021-10-10 08:09:00 +02:00