Skip to content

Commit

Permalink
Merge branch 'canary' into update-styled-jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Oct 23, 2021
2 parents e77f184 + 7dbbc9d commit 545b176
Show file tree
Hide file tree
Showing 72 changed files with 825 additions and 253 deletions.
46 changes: 29 additions & 17 deletions docs/api-reference/next/image.md
Expand Up @@ -16,7 +16,7 @@ description: Enable Image Optimization with the built-in Image component.

| Version | Changes |
| --------- | ------------------------------------------------------------------------------------------------- |
| `v12.0.0` | `formats` configuration added.<br/>AVIF format added.<br/>Wrapper `<div>` changed to `<span>`. |
| `v12.0.0` | `formats` configuration added.<br/>AVIF support added.<br/>Wrapper `<div>` changed to `<span>`. |
| `v11.1.0` | `onLoadingComplete` and `lazyBoundary` props added. |
| `v11.0.0` | `src` prop support for static import.<br/>`placeholder` prop added.<br/>`blurDataURL` prop added. |
| `v10.0.5` | `loader` prop added. |
Expand Down Expand Up @@ -314,6 +314,34 @@ module.exports = {
}
```

### Acceptable Formats

The default [Image Optimization API](#loader-configuration) will automatically detect the browser's supported image formats via the request's `Accept` header.

If the `Accept` head matches more than one of the configured formats, the first match in the array is used. Therefore, the array order matters. If there is no match, the Image Optimization API will fallback to the original image's format.

If no configuration is provided, the default below is used.

```js
module.exports = {
images: {
formats: ['image/webp'],
},
}
```

You can enable AVIF support with the following configuration.

```js
module.exports = {
images: {
formats: ['image/avif', 'image/webp'],
},
}
```

> Note: AVIF generally takes 20% longer to encode but it compresses 20% smaller compared to WebP. This means that the first time an image is requested, it will typically be slower and then subsequent requests that are cached will be faster.
## Caching Behavior

The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider's documentation.
Expand Down Expand Up @@ -356,22 +384,6 @@ module.exports = {
}
```

### Acceptable Formats

The default [Image Optimization API](#loader-configuration) will automatically detect the browser's supported image formats via the request's `Accept` header.

If the `Accept` matches more than one of the configured formats, the first match in the array is used. Therefore, the array order matters. If there is no match, the Image Optimization API will fallback to the original image's format.

If no configuration is provided, the default below is used.

```js
module.exports = {
images: {
formats: ['image/avif', 'image/webp'],
},
}
```

## Related

For an overview of the Image component features and usage guidelines, see:
Expand Down
2 changes: 1 addition & 1 deletion errors/invalid-images-config.md
Expand Up @@ -26,7 +26,7 @@ module.exports = {
// minimumCacheTTL is in seconds, must be integer 0 or more
minimumCacheTTL: 60,
// ordered list of acceptable optimized image formats (mime types)
formats: ['image/avif', 'image/webp'],
formats: ['image/webp'],
},
}
```
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -17,5 +17,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "11.1.3-canary.94"
"version": "11.1.3-canary.96"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -161,7 +161,7 @@
},
"resolutions": {
"browserslist": "4.16.6",
"caniuse-lite": "1.0.30001228"
"caniuse-lite": "1.0.30001271"
},
"engines": {
"node": ">=12.22.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "11.1.3-canary.94",
"@next/eslint-plugin-next": "11.1.3-canary.96",
"@rushstack/eslint-patch": "^1.0.6",
"@typescript-eslint/parser": "^4.20.0",
"eslint-import-resolver-node": "^0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "11.1.3-canary.94",
"version": "11.1.3-canary.96",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down

0 comments on commit 545b176

Please sign in to comment.