Commit graph

9419 commits

Author SHA1 Message Date
Tobias Koppers
b5d7a91f6c
add trace-to-tree script to allow to visualize traces on the commandline (#29942)
![image](https://user-images.githubusercontent.com/1365881/137498172-18e20f48-77df-4a26-9004-9baeb44893fb.png)
2021-10-15 14:25:56 +00:00
Tim Neutkens
32029ef5e9 v11.1.3-canary.74 2021-10-15 12:45:39 +02:00
Tim Neutkens
e7aa36f133 v11.1.3-canary.73 2021-10-15 12:10:26 +02:00
Tim Neutkens
b24036b7e0 v11.1.3-canary.72 2021-10-15 12:09:30 +02:00
Donny/강동윤
9375c7fe52
Update swc (#29938)
Co-authored-by: kdy1 <kdy1@users.noreply.github.com>
2021-10-15 11:39:09 +02:00
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
JJ Kasper
665b29ec8a
Add native build caching to main workflow also (#29920) 2021-10-14 11:39:57 -05: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
JJ Kasper
c2b5f15c93
Update typo in response helpers doc (#29899)
Fixes typo per https://github.com/vercel/next.js/pull/29462#discussion_r728604242

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-14 04:23:47 +00:00
Steven
fcc8380642
Update docs for image caching behavior (#29895)
Revises docs to explain that the maximum of the header and config is used.
2021-10-14 00:01:17 +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
Angelo P
541259d992
Update testing based on Failed to parse src "test-file-stub" on `next… (#29039)
…/image` Error

While learning how to test next.js applications I came across this error when testing components using next/image with an image import

eg: 
```
// /quiz-hero
import Image from 'next/image';
import quizImage from '../../public/undraw-quiz.svg';

// In render 
<Image
              height='91'
              width='198'
              layout='fixed'
              src={quizImage}
              alt='QuizImage'
            />
```

### Error -> 
Failed to parse src "test-file-stub" on `next/image`, if using relative image it must start with a leading slash "/" or be an absolute URL (http:// or https://)

This is fixed by adding a "/" to the beginning of your file-stub module export string. 

This is not an error when you're awaiting an image using async waitFor, But comes up as an error when you're testing a component that holds another component with a "next/image" import.
eg: 
```
// quizHero.test.tsx works like this without change.
const image = await waitFor(() => screen.findByAltText('QuizImage')); 

// but index.test.tsx fails rendering the homepage without the change.
render(<Home />); // Error: Failed to parse src "test-file-stub" on `next/image`...

// with change to __mocks__/fileMock
quizHero.test.tsx //test pass
index.test.tsx //test pass
```
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order to make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

possibly related to -> #26749

## Feature

- [X] Documentation added

## Documentation / Examples

- [X] Make sure the linting passes
2021-10-13 15:13:24 +00:00
Rich Haines
eed43115ec
Added more examples to Response Helpers page (#29462)
## Bug

- [x] Related issues linked using Fixes: https://github.com/vercel/front/issues/11154
- [ ] 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
- [x] 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 14:58:18 +00: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
Tobias Koppers
7cb5577e48
make test directories more unique (#29864)
I wouldn't believe it, but it actually happens that the first two test cases try to create their test directory at the same millisecond, resulting in a shared directory, which leads to conflicts.
2021-10-13 08:13:15 +00: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
Mike Osterhout
3910c3890e
Update typescript version (#29854)
Resolves  message using `yarn dev` 

```
warn  - Minimum recommended TypeScript version is v4.3.2, older versions can potentially be incompatible with Next.js. Detected: 4.0.8
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-10-13 03:52:55 +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
Phattarapol L
5d992a6a28
Add Scss variables section to Built-in CSS Support document (#29822)
## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-12 14:33:12 +00:00
Max Schmitt
ca062db2a4
docs(testing): added Playwright guide (#29832)
Blocked by https://github.com/vercel/next.js/pull/29426
2021-10-12 14:21:54 +00:00
Steven
f6d99c3d74
Add rich to codeowners for docs (#29848) 2021-10-12 09:55:00 -04: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
Tobias Koppers
ad565c4087
avoid running multiple test from the same directory in parallel (#29830) 2021-10-11 21:23:33 +02: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