Commit graph

8723 commits

Author SHA1 Message Date
Janicklas Ralph
3b388c346c
Fix Script beforeInteractive on navigation (#26995)
## Bug

- [x] fixes #26342 
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`


## Documentation / Examples

- [x] Make sure the linting passes
2021-07-15 22:51:01 +00:00
JJ Kasper
7644c17f43
v11.0.2-canary.16 2021-07-15 16:42:36 -05:00
Steven
8151a7e0dc
Add minimumCacheTTL config for Image Optimization (#27200)
- Closes #23328  
- Related to #19914 
- Related to #22319 


## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [x] Errors have helpful link attached, see `contributing.md`
2021-07-15 19:55:12 +00:00
Jiachi Liu
71665b2437
Fix gsp generation with file extension (#27144)
Fixes #11831 
Fixes #12212

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-07-15 18:50:17 +00:00
Houssein Djirdeh
c46b405ba7
adds no duplicate head rule (#27179) 2021-07-15 13:04:17 -05:00
Tomas Jansson
d29a95ad63
Change pure functions to functions (#27192)
The right terminology should be used so we don't learn new developers wrong facts.

Using pure function here is plain wrong, the definition of a pure functions is as follows:

> The function return values are identical for identical arguments. The function application has no side effects. 

What you have here both have side effects, the calls to `res.setXXX`, and it isn't identical for identical arguments since you have `Date.now()`.



## 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-07-15 14:12:58 +00:00
Didi Keke
222830ad47
Fix Prop href did not match error (#27183)
Resolve Prop `href` did not match error.
2021-07-15 01:04:33 +00:00
Didi Keke
dc5bc3f2ff
Fix Prop href did not match error (#27183)
Resolve Prop `href` did not match error.
2021-07-15 01:04:05 +00:00
Didi Keke
1d08687b93
Fix Image is missing required "src" property error (#27180)
Add safety check for `CoverImage` in `/components/post-preview.js` so as to prevent error occurring in the absence of cover image for on posts listed for preview - fixes #23742.
2021-07-14 23:19:42 +00:00
Steven
437ad9ff6a
Fix css minify incorrectly duplicating variables (#27150)
Fixes #26902 

See 507963a480
2021-07-14 21:16:11 +00:00
Tim Neutkens
fdabeb7098
Use SWC to compile Next.js core server files (#27167)
- Use SWC to compile Next.js core server files
- Ensure only @babel/runtime/helpers/interopRequireDefault helper is used

Just an initial comparison to compare size difference of this change.



## 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-07-14 18:12:04 +00:00
JJ Kasper
86e3ea8e33
v11.0.2-canary.15 2021-07-14 09:16:46 -05:00
Steven
f9001b97bb
Bump babel target to Node.js 12 (#27147)
Next.js 11 supports Node.js 12 and newer. This PR updates babel to reflect this.

Follow up to PR #25761
2021-07-13 20:40:59 +00:00
Steven
52a2022da4
Revert "Update data-fetching.md" (#27148)
Reverts vercel/next.js#27018 per comment https://github.com/vercel/next.js/pull/27018#issuecomment-877548891
2021-07-13 19:53:45 +00:00
JJ Kasper
8c3c2b7ea2
Update redirect regexes to not match _next (#27143)
This updates redirects' regexes to not match `/_next` paths since this is currently unexpected and can easily cause a multi-match redirect to break loading client-side assets. This also fixes custom-routes not matching correctly when `trailingSlash: true/false` is used

## Bug

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

x-ref: https://github.com/vercel/next.js/discussions/24683
x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1626159845474000)
2021-07-13 19:38:14 +00:00
я котик пур-пур
e0ff050402
Update the "Top level .mdx pages" code sample (#27080)
The regex matches both .md and .mdx extensions, so I've added the .md extension to the description and `pageExtensions` array.

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-13 15:29:39 +00:00
JJ Kasper
8088416082
v11.0.2-canary.14 2021-07-13 09:35:56 -05:00
Lee Robinson
1a9492d51f
Update Going to Production docs to use quote. (#27131)
Will make it look a little nicer 😄
2021-07-12 23:13:52 +00:00
Lee Robinson
a93f8b6393
Fix code block in Layouts docs. (#27130)
<img width="885" alt="CleanShot 2021-07-12 at 17 58 23@2x" src="https://user-images.githubusercontent.com/9113740/125365933-c2c17a00-e33a-11eb-9d24-5970b5437a21.png">
2021-07-12 23:04:06 +00:00
JJ Kasper
ae6b0a1b39
v11.0.2-canary.13 2021-07-12 17:18:45 -05:00
JJ Kasper
9c93c0543f
Add some missing fields to the NextConfig type (#27126)
This adds some missing fields to the `NextConfig` type we expose under `next` and also adds a `NextConfigComplete` internal type that allows us to not treat all fields as optional like you would when using the type in `next.config.js`. 

## 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-07-12 21:38:57 +00:00
Steven
3b9786925d
Add jsdoc types to docs snippets (#27125)
This PR adds the JSDoc types so that VS Code and other tools can use autocompletion when editing `next.config.js`
2021-07-12 20:57:38 +00:00
Luc Leray
f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +00:00
Gerald Monaco
cb8da5778e
Replace withCoalescedInvoke with ResponseCache (#26997)
By itself, `withCoalescedInvoke` with a separate `this.incrementalCache.set(...)` isn't really suitable for streaming responses. Since streaming is asynchronous, updating the cache separately introduces a gap where another origin request for the same resource could be made.

This could potentially be addressed by moving the cache update, but then `IncrementalCache` itself would need to be made to support streaming, in addition to the many other responsibilities it has. In this case, it seemed best to just use composition to add another caching layer in front of it, which is a familiar and understandable concept. Eventually, we might want to move this cache to the HTTP layer, which will also be simpler with this change.

As an added bonus, `renderToResponseWithComponents` becomes significantly simpler, and we delete some duplication.
2021-07-12 19:47:39 +00:00
Lee Robinson
26f4794944
[docs] Layouts & Going to Production (#27021)
- Helps clear up customer confusion about how to share React state with layouts, including nested layouts
- Provides guidance on best practices before shipping your application to production

Open to any feedback!
2021-07-12 19:04:43 +00:00
Steven
9777707d67
Add test for placeholder=blur with assetPrefix (#27120)
Follow up to https://github.com/vercel/next.js/pull/27061#pullrequestreview-703527621
2021-07-12 18:58:20 +00:00
JJ Kasper
4e8c2a6aa3
v11.0.2-canary.12 2021-07-12 12:18:52 -05:00
Steven
ed19335d6e
Workaround for Node.js 16+ on Apple Silicon M1 (#27031)
This PR is a workaround for #24421 by adding an artificial delay when Apple M1 + buggy Node.js is detected.

Node.js 14 is unaffected because it M1 still reports `arch=x64`. Starting in Node.js 16, M1 reports `arch=arm64`.

V8 Bug: https://crbug.com/1224882

Node.js Issue: https://github.com/nodejs/node/issues/39327
2021-07-12 17:05:41 +00:00
Martin Šťovíček
849a79fbc2
Prevent timeout when loading routes in development (#25749)
* Prevent timeout when loading routes in development

The new route loader (https://github.com/vercel/next.js/pull/19006) will timeout
loading routes after 3.8s (MS_MAX_IDLE_DELAY), but this can easily happen when
running dev on a large app.

Fixes https://github.com/vercel/next.js/issues/25675

* Delay route loading timeout in development

* refactor: Integrate onBuildCallback into resolvePromiseWithTimeout

* refactor: Tweak for better dead-code elimination

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-12 11:26:58 -05:00
markkaylor
36d00a74b6
[examples] Use Strapi template (#27114)
- Simplifies setting up a Strapi project by using the following template: https://github.com/strapi/strapi-template-next-example
- Adds seed data
- Fixes a broken link on the cover image

- [x] Make sure the linting passes
2021-07-12 16:24:43 +00:00
Chris Barna
2958e3e837
Upgrades web-vitals to v1.1.2. (#25272)
I'm not sure if this is something that y'all want but it `web-vitals` has been integrating more browser support. The major release is because they removed the [`isFinal` flag on the Metric type](d233b7b8c3).
2021-07-12 16:18:51 +00:00
Enes Akar
655eb5cb5b
Fix tailwind error with Redis example. (#27042) 2021-07-12 10:35:50 -05:00
Tim Neutkens
92d5fc4964
Fall back to fallbackSend when send is false (#27113)
Send can result in `false` when it did not send the result so we have to fall back in that case. Shared by @timer after my PR was landed.



## 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-07-12 15:26:48 +00:00
Rishabh Poddar
08f06e7a0d
Update SuperTokens dependency version in with-supertokens example (#27110)
- Updates supertokens-auth-react to v0.15.0
- In the supertokens example, handles 401 session expired automatically (via the lib).
2021-07-12 14:54:13 +00:00
Tim Neutkens
1bcc923439
Bind sendBeacon to navigator (#26601)
Also ensures that even if the navigator.sendBeacon fails the fetch fallback is used.

Fixes #23856. This is likely, as no reproduction was provided it was not possible to verify if it actually fixes the issue.



## Bug

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

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-12 13:50:50 +00:00
Tim Neutkens
5520dd3fd9
Mention customization of next.config.js to import images (#27104)
Fixes #27094



## 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-07-12 13:16:13 +00:00
Tim Neutkens
1c8a7d55c1 v11.0.2-canary.11 2021-07-11 16:10:30 +02:00
Tim Neutkens
7c33a2179d
Add batching to zipkin reporter (#27082) 2021-07-11 14:19:16 +02:00
Tim Neutkens
ad56e81f4d v11.0.2-canary.10 2021-07-10 22:29:39 +02:00
Steven
31c3f33639
Enhance next dev performance with placeholder=blur (#27061)
This PR changes the implementation of `placeholder=blur` when using `next dev` so that it lazy loads on-demand.

This will improve the developer experience for web apps with many blurred images.
2021-07-10 20:27:14 +00:00
Tobias Koppers
7a8da9741d
add support for esm externals (#27069)
add `experimental.esmExternals: boolean | 'loose'` config option

remove `output.environment` configuration in favor of `target`

|                          | `esmExternals: false` (default) | `esmExternals: 'loose'` | `esmExternals: true` |
| ------------------------ | ------------------------------- | ----------------------- | -------------------- |
| import cjs package       | `require()`                     | `require()`             | `require()`          |
| require cjs package      | `require()`                     | `require()`             | `require()`          |
| import mixed package     | `require()` ***                 | `import()`              | `import()`           |
| require mixed package    | `require()`                     | `require()`             | `require()`          |
| import pure esm package  | `import()`                      | `import()`              | `import()`           |
| require pure esm package | Error **                        | `import()` *            | Error **             |
| import pure cjs package  | `require()`                     | `require()`             | Resolving error      |
| require pure cjs package | `require()`                     | `require()`             | `require()`          |

cjs package: Offers only CJS implementation (may not even have an `exports` field)
mixed package: Offers CJS and ESM implementation via `exports` field
pure esm package: Only offers an ESM implementation (may not even have an `exports` field)
pure cjs package: CommonJs package that prevents importing via `exports` field when `import` is used.

`*` This case will behave a bit unexpected for now, since `require` will return a Promise. So that need to be awaited. This will be fixed once the whole next.js bundle is ESM. It didn't work at all before this PR.
`**` This is a new Error when trying to require an esm package.
`***` For mixed packages we prefer the CommonJS variant to avoid a breaking change.

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-07-10 16:49:02 +00:00
JJ Kasper
6eaa6853ce
Mention running local changes inside monorepo (#27050) 2021-07-09 11:39:00 -05:00
Michiel Van Gendt
d22ecd97f4
Include message body in redirect responses (#25257)
### Description
The redirect responses from the redirect function do not contain a message body. This is in conflict with the RFCs below and causes Traefik (a reverse proxy) to invalidate the responses. In this pull request, I add a response body to the redirect responses.

### References
- https://datatracker.ietf.org/doc/html/rfc7230#section-3.3
> All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses must not include a message-body. All other responses do include a message-body, although the body may be of zero length.

- https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3
> The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).

- traefik/traefik#4456
- https://github.com/auth0/nextjs-auth0/pull/399
2021-07-09 16:32:48 +00:00
Tim Neutkens
7c56684446
Add performance tracing for next-image-loader (#27043) 2021-07-09 17:30:16 +02:00
Lee Robinson
9f1d5d7fca
Update dependencies of all CMS examples. (#27001) 2021-07-09 14:43:56 +02:00
Tim Neutkens
9468b4c5a8
Update labeler.json 2021-07-09 14:23:24 +02:00
Borek Bernard
d60c95cb57
Add newline to the end of next-env.d.ts (#27028) 2021-07-08 21:27:52 -05:00
JJ Kasper
17582014fc
v11.0.2-canary.9 2021-07-08 20:13:53 -05:00
Karl Sander
13a4d29bf1
Docs/Typo: Replace triple dot character with real dots (#27030)
This was probably automatically inserted without the original author noticing. It causes some headache when copy&pasting the filename.
2021-07-08 21:52:59 +00:00
JJ Kasper
ad3b7409c5
v11.0.2-canary.8 2021-07-08 15:44:44 -05:00