Commit graph

8637 commits

Author SHA1 Message Date
Alex Castle
277061943a
Don't emit duplicate image files (#26843)
fixes #26607

This change makes it so the image loader plugin only emits a file while processing an image import for the client. The final generated image URL was already the same in SSR and CSR anyway, so this change doesn't have any functional impact.

I also changed the name of the static page in the image component tests, since it was causing some conflicts with the static assets folder.
2021-07-02 11:27:32 +00:00
Paul van den Dool
9039afe75b
Update to environment-variable.md (#26863)
## 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes

## Why the change
I lost quite a few hours figuring out why my environment variable was `undefined` in the browser.
I read about the built-in support and was like: "Oh nice" and didn't read much further. I missed the part about how you need to prefix your variables with `NEXT_PUBLIC_` in order to expose them to the browser.
I think a hint to this in the anchor link to that section will make it more discoverable as it's then mentioned near the top and will save people who are like me some time and a headache.
2021-07-02 10:35:53 +00:00
Tim Neutkens
270487d797
Make sure 404 pages do not get cached by a CDN when using next start (#24983)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-07-02 10:40:13 +02:00
JJ Kasper
138b9ddf99
v11.0.2-canary.4 2021-07-01 17:45:55 -05:00
Steven
acd0fabf83
Update publish-canary script to include checkout (#26840)
* Update `publish-canary` script to include checkout

* Update contrib with publishing section
2021-07-01 17:19:14 -05:00
Steven
03b61778ba
Fix immutable header for image with static import & unoptimized (#26836)
Fixes #26587
2021-07-01 22:14:42 +00:00
Steven
0562cc77bc
Add additional tests for image type detection (#26832)
Adding additional tests. Follow up to #26705
2021-07-01 20:53:26 +00:00
Artur Sedlukha
748b005cda
Fix using-preact example deps (#26821)
Fix after https://github.com/vercel/next.js/pull/26133
2021-07-01 20:20:20 +00:00
Joachim Viide
d670198e7c
Add "Vary: Accept" header to /_next/image responses (#26788)
This pull request adds "Vary: Accept" header to responses from the image optimizer (i.e. the /_next/image endpoint).

The image optimizer prefers re-encoding JPG files to WebP, but some browsers (such as Safari 14 on Catalina) do not yet support WebP. In such cases the optimizer uses the Accept header sent by the browser to send out a JPG response. Thus the optimizer's response may depend on the Accept header.

Potential caching proxies can be informed of this fact by adding "Vary: Accept" to the response headers. Otherwise WebP data may be served to browsers that do not support it, for example in the following scenario:
 * A browser that supports WebP requests the JPG. The optimizer re-encodes it to WebP. The proxy caches the WebP data.
 * After this another browser that doesn't support WebP requests the JPG. The proxy sends the WebP data to the browser.

- [x] Integration tests added
- [x] Make sure the linting passes
2021-07-01 19:59:16 +00:00
Steven
93f625428b
Add onLoadingComplete() prop to Image component (#26824)
This adds a new prop, `onLoadingComplete()`, to handle the most common use case of `ref`.

I also added docs and a warning when using `ref` so we recommend the new prop instead.
 
- Fixes #18398 
- Fixes #22482
2021-07-01 18:51:20 +00:00
JJ Kasper
3c994abc29
Update snapshot for font-optimization test (#26823)
This fixes the `font-optimization` test failing from the links/content changing slightly in the snapshot. 

## 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-01 17:10:01 +00:00
Jiachi Liu
e89b8e466a
fix: detect loop in client error page (#26567)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-07-01 13:54:54 +02:00
JJ Kasper
612889dfeb
Update repo scripts to separate folder (#26787) 2021-07-01 13:41:27 +02:00
D. Kasi Pavan Kumar
b508d90449
examples: fix typo lunixlinux (#26796)
## 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

- [x] Make sure the linting passes
2021-07-01 06:20:35 +00:00
JJ Kasper
72318a7ba9
Update codeowners to add new maintainers (#26770) 2021-06-30 19:27:50 -05:00
Jiachi Liu
c51598268a
Leverage blocked page for _error (#26748)
## Enhance

simplify detection for visiting `_error`

x-ref: #26610
2021-07-01 00:08:36 +00:00
JJ Kasper
be60ef525f
Stabilize relay-analytics test (#26782) 2021-06-30 17:52:40 -05:00
JJ Kasper
010a31cf41
Update azure tests (#26779) 2021-06-30 17:03:43 -05:00
Nils Schönwald
551b6149ce
Fix blurred image position when using objectPosition (#26590)
## Bug

fixes #26309

## Documentation / Examples

see #26309

- [ ] Make sure the linting passes
2021-06-30 21:58:26 +00:00
Steven
2373320fc8
Add upstream max-age to optimized image (#26739)
This solves the main use case from Issue #19914.

Previously, we would set the `Cache-Control` header to a constant and rely on the server cache. This would mean the browser would always request the image and the server could response with 304 Not Modified to omit the response body.

This PR changes the behavior such that the `max-age` will propagate from the upstream server to the Next.js Image Optimization Server and allow browser caching. ("upstream" meaning external server or just an internal route to an image)

This PR does not change the `max-age` for static imports which will remain `public, max-age=315360000, immutable`.

#### Pros:
- Fewer HTTP requests after initial browser visit
- User configurable `max-age` via the upstream image `Cache-Control` header

#### Cons:
- ~~Might be annoying for `next dev` when modifying a source image~~ (solved: use `max-age=0` for dev)
- Might cause browser to cache longer than expected (up to 2x longer than the server cache if requested in the last second before expiration)

## Bug

- [x] Related issues linked using `fixes #number`
2021-06-30 21:26:20 +00:00
JJ Kasper
b046a0595e
Disable build-output size specific tests (#26769)
* Disable build-output size specific tests

* remove size-limit test

* lint-fix
2021-06-30 15:49:49 -05:00
Jiachi Liu
ddc0e793fc
Support new hydrate API in latest react 18 alpha release (#26664)
* fix: react 18 new hydration API

* support react 18

* compat latest react only, fix resolved version

* fix tests

* Some changes based on https://github.com/reactwg/react-18/discussions/5

* fix test

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-06-30 17:03:32 +02:00
Tim Neutkens
5b9ad8da90
Move next-server directory files to server directory (#26756)
* Move next-server directory files to server directory

* Update tests

* Update paths in other places
2021-06-30 13:44:40 +02:00
Tim Neutkens
136b754396
Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
Tim Neutkens
f5958fdc4f
Simplify stats action (#26751) 2021-06-30 11:41:55 +02:00
Tim Neutkens
bb42c86c82 Update PR labeler action 2021-06-30 11:40:30 +02:00
Gerald Monaco
9ab916ac99
Simplify next-dev-server implementation (#26230)
`next-dev-server` having its own implementations of `renderToHTML` and `renderErrorToHTML` has historically made reasoning about streaming hard, as it adds additional places where status codes are explicitly set and the full HTML is blocked on.

Instead, this PR simplifies things considerably by moving the majority of the custom logic for e.g. hot reloading and on-demand compilation to when we're resolving the page to be loaded, rather than upfront when handling the request. It also cleans up a few other details (e.g. default error page rendering) that managed to creep into the base implementation over time.

One unfortunate side effect is that this makes compilation errors slightly more difficult. Previously, we'd render them directly. Now, we have to rethrow them. But since they've already been logged (by the watch pipeline), we have to make sure they don't get logged again.
2021-06-29 23:02:10 +00:00
Soham Shah
46a85b4e6f
update with-redux-toolkit-typescript (#26714)
## Bug

- [X] Related issues linked using `fixes #26713 `

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

- [X] Make sure the linting passes

## Screenshots

After this small change the warning disappears.
![image](https://user-images.githubusercontent.com/47717492/123749377-fd56fb80-d8d2-11eb-8b70-dbb7f6f16050.png)
2021-06-29 14:52:03 +00:00
Houssein Djirdeh
15afd97729
[ESLint] Adds --max-warnings flag to next lint (#26697)
Adds `--max-warnings` flag to `next lint` to enable setting of a maximum warning threshold.

Fixes #26671
2021-06-29 10:12:23 +00:00
hiro
956bc2f387
Fix typo on "occured" to "occurred" (#26709)
* fix: typo occured -> occurred

* fix: typo occured -> occurred

* fix: typo occured -> occurred

* fix: typo occured -> occurred

* lint-fix


Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-28 23:02:20 -05:00
Lee Robinson
1dd6eeb598
Update layouts example to persist state across client-side transitions. (#26706)
* Update layouts example

* Update examples/layout-component/components/layout.js

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-28 22:19:15 -05:00
Steven
eabecf3d0a
Fix image content type octet stream 400 (#26705)
Fixes #23523 by adding image content type detection

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-06-28 23:52:04 +00:00
JJ Kasper
d11589d677
v11.0.2-canary.3 2021-06-28 10:50:14 -05:00
JJ Kasper
5b2c845e57
Ensure API routes are not available under the locale (#26629)
This ensures API routes are not available under the locale path since API routes don't need to be localized and we don't provide the locale to the API in any way currently so the user wouldn't be aware if the localized API route was visited instead of the non-localized. 

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

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-06-28 13:56:40 +00:00
Jiachi Liu
c5751fa6c3
fix: next dynamic with jest (#26614)
Fixes #19862

Avoid executing `webpack` property on `loadableGenerated` of loadable component compiled from `next/dynamic` when `require.resolveWeak` is unavailable due to jest runtime missing `require.resolveWeak`.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] unit tests added
2021-06-28 13:23:14 +00:00
JJ Kasper
c2f0653bd3
Correct statusCode when visiting _error directly (#26610)
This fixes non-stop reloading when visiting `_error` directly in development caused by the `statusCode` being 200 unexpectedly while HMR returns the page as `invalid` which triggers `on-demand-entries` to reload the page. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/8036
x-ref: https://github.com/vercel/next.js/pull/8033
2021-06-28 12:50:53 +00:00
JJ Kasper
ae0dbe5e2c
Fix GSP redirect cache error (#26627)
This makes sure we don't attempt flushing cache info to disk for `getStaticProps` `redirect` items with `revalidate`

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

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
2021-06-28 12:23:23 +00:00
Lee Robinson
e8a9bd1996
Update next/image docs for relative parent with layout=fill. (#26615)
https://github.com/vercel/next.js/discussions/18739#discussioncomment-435925
2021-06-25 18:50:10 +00:00
Vadorequest
6f42096233
Add link to live demo already hosted (#25718)
* Add link to live demo already hosted

To make it easier for people to simply see the live example without having to deploy a whole new project

* update link


Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-06-25 11:52:54 -05:00
Peter Mekhaeil
22d1771c29
Enable Alex documentation linting for docs (#26598) 2021-06-25 11:40:50 -05:00
Tim Neutkens
170dc0dc33
Add check for ObjectExpression when iterating on <link> tags for font optimization (#26608)
Fixes #26547



## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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-06-25 14:51:53 +00:00
Tim Neutkens
2f03bfa66c v11.0.2-canary.2 2021-06-25 14:01:34 +02:00
Tim Neutkens
634de3c45e
Add trace url on bootup (#26594)
* Add trace url on bootup

* Update whitelist -> accesslist

* Add name to webpack-invalidated
2021-06-25 13:55:46 +02:00
Tim Neutkens
4da94a3f53 v11.0.2-canary.1 2021-06-25 11:12:59 +02:00
John
bbedbb7203
fix with-loading example for next 11 (#26569)
## Documentation / Examples

- [X] Make sure the linting passes

This PR updates the with-loading example to follow the documentation of router events for next 11
2021-06-24 18:16:54 +00:00
JJ Kasper
18a333e672
Separate node polyfill test from basic suite (#26550)
* Separate node polyfill test from basic suite

* update test
2021-06-24 13:11:09 -05:00
JJ Kasper
3cd4f34dc8
Add comment to not edit in next-env file (#26573)
This adds a comment to the generated `next-env.d.ts` to mention it should not be edited pointing to the documentation which contains an example of adding custom types separately. 

x-ref: https://github.com/vercel/next.js/issues/26560

## Documentation / Examples

- [x] Make sure the linting passes
2021-06-24 15:32:46 +00:00
Tim Neutkens
77895fd0d0
Add logging when a custom babelrc is loaded (#26570)
Partially solves #26539 by adding back the log output when a config file is used



## 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-06-24 14:51:48 +00:00
Jiachi Liu
650ebed77e
doc: prettify docs for next script (#26572)
x-ref: https://github.com/vercel/next.js/pull/26518#issuecomment-867566010

## Documentation / Examples

- [x] Make sure the linting passes
2021-06-24 13:41:55 +00:00
Pranav P
0b79b6d73d
tailwind examps upgraded to v2.2 (#26549)
## Documentation / Examples

- [x] Make sure the linting passes
2021-06-24 12:05:17 +00:00