Commit graph

2711 commits

Author SHA1 Message Date
JJ Kasper
7cb68f7981
Re-add domain locale redirect handling (#18274) 2020-10-27 04:45:39 -04:00
JJ Kasper
4026d9bea0
Remove unstable_ prefix from unstable_redirect (#18282) 2020-10-27 04:37:27 -04:00
Joe Haddad
2972c0685b
Improve type for GSP return type (#18285) 2020-10-27 06:37:44 +00:00
JJ Kasper
4782bda3e3
Add support for notFound in getServerSideProps (#18241)
This is a follow-up to https://github.com/vercel/next.js/pull/17755 which adds support for returning `notFound` to `getServerSideProps` also
2020-10-27 05:42:12 +00:00
Tasuku Uno
3f22490a59
Fix browser back issue of redirects from getServerSideProps / getStaticProps (#17741)
* Fix test without expect for redirects from getStaticProps/getServerSideProps

* Fix browser back issue of redirects from getServerSideProps / getStaticProps
2020-10-27 00:14:23 -05:00
Joe Haddad
d2e7f3c769
v9.5.6-canary.16 2020-10-27 00:06:15 -04:00
JJ Kasper
5a8398e34d
Remove unstable_ prefix from unstable_blocking (#18276)
This removes the `unstable_` prefix to prepare for stabilizing the feature
2020-10-27 04:01:37 +00:00
Joe Haddad
31a011d6a5
Adjust configuration option placement (#18279) 2020-10-27 03:36:31 +00:00
Steven
9d838df766 v9.5.6-canary.15 2020-10-26 16:08:48 -04:00
Steven
3a169fbbf0
Separate config into deviceSizes and iconSizes (#18267)
This separates the `next.config.js` property `images.sizes` into to properties: `images.deviceSizes` and `images.iconSizes`.

The purpose is for images that are not intended to take up the majority of the viewport.


Related to #18122
2020-10-26 20:07:52 +00:00
JJ Kasper
b90e17e029
Add config limit checks for image optimizer (#18217)
This adds checks to ensure that less than 50 domain and size items are configured and no sizes are less than 0 or greater than 10,000 

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

Co-authored-by: Steven <steven@ceriously.com>
2020-10-26 11:42:44 -04:00
Steven
61fab923eb
Fix Image srcset to ensure the component's width is the largest possible image (#18236)
There was a bug when the user defines a width on the Image component, but a larger size image is requested.

This is because the browser uses the `srcset` to decide which image size to request and we had the srcset basically hardcoded.

This PR fixes the behavior so that the `srcset` will never be larger than the `width` defined on the component.

It also fixes a bug where the preload srcset did not match the img srcset.

- Related to #18147 
- Related to #18122
2020-10-26 14:29:52 +00:00
JJ Kasper
9c65c994cc
Add next/image default loader errors (#18152)
* Add next/image default loader errors

* Add domains check

* Apply suggestions from PR

* Update test
2020-10-25 00:22:47 -05:00
Steven
33eac8acfa
Image Optimization API should 404 when loader is not default (#18211)
We currently always accept requests to the new `/_next/image` endpoint, even when it should not be used.

Instead, we should check to see if the default loader is used as a signal to enable this API.

Other loaders (such as cloudinary) will not go through the Next.js API so there is no need to expose this, instead we 404.

- Analogous to https://github.com/vercel/vercel/pull/5321
- Related to #18122
2020-10-25 04:54:22 +00:00
Tim Neutkens
6d3b065884 v9.5.6-canary.14 2020-10-24 22:32:10 +02:00
Tim Neutkens
9508322381
Update use-subscription to account for React 17 peerDependency (#18199) 2020-10-24 22:31:26 +02:00
JJ Kasper
ebee2bafa9
Ensure 404 with SSG is rendered correctly with notFound (#18205)
This ensures a custom `/404` page with `getStaticProps` works correctly when leveraging the new `unstable_notFound` support in `getStaticProps`

Closes: https://github.com/vercel/next.js/issues/18196
x-ref: https://github.com/vercel/next.js/pull/17755
2020-10-24 19:22:48 +00:00
Giuseppe
299fba162a
Bump styled-jsx to 3.3.1 (#18200)
* Adds React 17 as a peer dependency
2020-10-24 16:59:24 +00:00
Tim Neutkens
58c161c99b
Fix flashing of no-src image when using next/image (#18195)
Solves on of the issues in https://github.com/vercel/next.js/issues/18122
2020-10-24 15:23:42 +00:00
Steven
301c029e48
Add support for string width/height on Image component (#18178)
For many users refactoring from `<img>` to `<Image>`, we can often support their properties as-is.
The exception was width/height.

This PR allows the `<Image>` component to accept strings for `width` and `height` just like `<img>`.

Related to #18122
2020-10-24 02:01:15 +00:00
Steven
0dff7def7a
Bypass image optimization for vector images (#18179)
Previously, vector images like svg were being converted to webp and resized.

However, vector images already handle any size so we can bypass the same we do for animated images.

Related to #18122
2020-10-24 01:26:52 +00:00
Steven
debe4e2348 v9.5.6-canary.13 2020-10-23 10:49:01 -04:00
Steven
a12eeea18d
Add w param (#18151)
Add missing `w` param for [old browsers](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset#Browser_compatibility) like IE that dont support `srcset` (@styfle)
2020-10-23 14:23:16 +00:00
Yamagishi Kazutoshi
f1005ca661
Pass quality param of image component to preload (#18158)
If give the `priority` and `quality` attributes to an Image Component, the `quality` attribute will not be given to the preload and a warning will be displayed to the devtool.

![screenshot on devtool](https://user-images.githubusercontent.com/12539/96960307-0837e000-153d-11eb-8c01-e15afd40e04f.png)
2020-10-23 06:36:54 +00:00
JJ Kasper
4442fe2faf
Update redirect query encoding (#18149)
* Update redirect query encoding

* Add additional tests
2020-10-22 18:45:43 -05:00
Steven
ac8a0c4836
Update Image Optimization API to prevent upscaling image (#18147)
The `w` parameter in the Image Optimization API is the requested size of the image and should only be resized if the source image is larger than the requested size. This PR fixes the behavior to prevent accidental upscaling, for example icon images.
2020-10-22 20:39:24 +00:00
Steven
07adc8ef26
Change Image component lazy=true to loading=lazy (#18138)
This PR updates the `<Image>` component to follow the same property naming as native `<img>`.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#attr-loading

This currently allows two values,`loading=lazy` and `loading=eager`, but there might be new values added in a future spec.

cc @atcastle
2020-10-22 18:59:42 +00:00
JJ Kasper
fe4d16c7f4
v9.5.6-canary.12 2020-10-22 11:40:26 -05:00
JJ Kasper
9bbfa0e8d2
Add locale false handling (#18115)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-22 17:08:01 +02:00
Tim Neutkens
9fb1e60504
Make lazy-loading the default for next/image (#18123)
Co-authored-by: Steven <steven@ceriously.com>
2020-10-22 16:55:51 +02:00
JJ Kasper
81e667bfae
Update fallback 404 handling to prevent reload loop (#18119)
This updates the fallback 404 handling to render the correct 404 page on the client when a 404 is returned from fetching the data route on a fallback page on the client. This prevents us from having to rely on a cache to be updated by the time we reload the page to prevent non-stop reloading. 

This also adds handling in serverless mode to ensure the correct 404 page is rendered when leveraging fallback: 'blocking' mode. 

Additional tests for the fallback: 'blocking' 404 handling will be added in a follow-up where returning notFound from `getServerSideProps` is also added.
2020-10-22 14:54:38 +00:00
Tim Neutkens
4af3611721 v9.5.6-canary.11 2020-10-21 22:10:36 +02:00
Steven
755934d0fc
Fix merge conflict (#18106) 2020-10-21 21:55:02 +02:00
Steven
3f07e554f4
Fix Image component defaults & remove autoOptimize (#18101) 2020-10-21 21:39:12 +02:00
Alex Castle
1a8cb7e1a0
Image Component: Support for Akamai image CDN (#18100) 2020-10-21 21:31:28 +02:00
Tim Neutkens
548d19398f v9.5.6-canary.10 2020-10-21 20:51:35 +02:00
Tim Neutkens
ea29bb3e4c
Fix precompiled code (#18093)
Solves the build failure we're seeing on PRs
2020-10-21 18:43:39 +00:00
Tim Neutkens
71f3e8db7b
Upgrade @ampproject/toolbox-optimizer (#18087)
Fixes #18044
Related to #17416
2020-10-21 18:04:31 +02:00
Ludovico Fischer
6212823735
Upgrade to Chokidar 3. (#17558)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-10-21 15:23:20 +02:00
Tim Neutkens
f232387883
Update peerdependency to account for React 17 (#18089) 2020-10-21 15:23:03 +02:00
Ludovico Fischer
b89d417b37
Update to PostCSS 8. (#17415)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-21 12:31:07 +02:00
Steven
80bf81a3cf
Move sharp to optionalDependencies (#18068)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-10-21 12:21:42 +02:00
Tasuku Uno
9dfc9ebc8a
Fix css dependency in /_error (#17301) 2020-10-21 12:11:18 +02:00
Steven
e8f402adfa
Add unsized property to Image component (#18059)
Implements the `unsized` property from RFC #16832

cc @atcastle
2020-10-21 10:03:31 +00:00
JJ Kasper
2ab34451b7
Pass locales to getStaticPaths for i18n (#18077)
This makes sure the `locales` are passed to `getStaticPaths` and also disables the removing the default locale from the path when the default locale is the preferred header. It also updates tests to ensure the domain redirects are working as expected.  

x-ref: https://github.com/vercel/next.js/pull/17370
2020-10-21 09:35:01 +00:00
JJ Kasper
91eb984d58
v9.5.6-canary.9 2020-10-20 15:35:36 -05:00
Felipe Flores
d4f53ec2bc
Update resolve-url-loader to fix vulnerability (#18064)
Bump resolve-url-loader version to fix vulnerability. 

Fixes #18048
Related #18044
2020-10-20 20:26:38 +00:00
JJ Kasper
48a95d5804
v9.5.6-canary.8 2020-10-20 12:09:36 -05:00
JJ Kasper
4d85d4985b
Ensure root index GSP page's revalidate is recorded (#18053) 2020-10-20 18:49:25 +02:00
Tim Neutkens
fdc4eb80d8 v9.5.6-canary.7 2020-10-20 18:46:34 +02:00