From 3eff34d6d837245fa321d5c3decc6ef25c6346c7 Mon Sep 17 00:00:00 2001 From: LekoArts Date: Mon, 8 Aug 2022 13:06:41 +0200 Subject: [PATCH] use correct default --- packages/gatsby-plugin-sharp/README.md | 2 +- .../src/__tests__/__snapshots__/index.js.snap | 42 +++++++++---------- .../gatsby-plugin-sharp/src/gatsby-node.js | 2 +- .../gatsby-plugin-sharp/src/plugin-options.ts | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/gatsby-plugin-sharp/README.md b/packages/gatsby-plugin-sharp/README.md index f4b2cc082d68f..6d6cbeba925d9 100644 --- a/packages/gatsby-plugin-sharp/README.md +++ b/packages/gatsby-plugin-sharp/README.md @@ -52,7 +52,7 @@ plugins: [ - `defaults`: default values used for `gatsbyImageData` and `StaticImage` from [gatsby-plugin-image](https://www.gatsbyjs.com/plugins/gatsby-plugin-image). Available options are: `formats`,`placeholder`,`quality`,`breakpoints`,`backgroundColor`,`tracedSVGOptions`,`blurredOptions`,`jpgOptions`,`pngOptions`,`webpOptions`,`avifOptions`. For details of these, see [the reference guide](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-plugin-image). -- `failOn`: default = `error`. By default builds will fail if there is a corrupted image. Set to `none` to continue the build on error. The image will return `undefined`. You can customize this option, see [`options.failOn`](https://sharp.pixelplumbing.com/api-constructor#parameters). +- `failOn`: default = `warning`. By default builds will fail if there is a corrupted image. Set to `none` to continue the build on error. The image will return `undefined`. You can customize this option, see [`options.failOn`](https://sharp.pixelplumbing.com/api-constructor#parameters). Other options are deprecated, and should only be used for the legacy `fixed` and `fluid` functions. diff --git a/packages/gatsby-plugin-sharp/src/__tests__/__snapshots__/index.js.snap b/packages/gatsby-plugin-sharp/src/__tests__/__snapshots__/index.js.snap index 5f6d6a29e132b..ea17e500aba82 100644 --- a/packages/gatsby-plugin-sharp/src/__tests__/__snapshots__/index.js.snap +++ b/packages/gatsby-plugin-sharp/src/__tests__/__snapshots__/index.js.snap @@ -85,7 +85,7 @@ exports[`gatsby-plugin-sharp fixed correctly infers the width when only the heig "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -142,7 +142,7 @@ exports[`gatsby-plugin-sharp fixed does not warn when the requested width is equ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -185,7 +185,7 @@ exports[`gatsby-plugin-sharp fixed warns when the requested width is greater tha "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -256,7 +256,7 @@ exports[`gatsby-plugin-sharp fluid accepts srcSet breakpoints 1`] = ` "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -299,7 +299,7 @@ exports[`gatsby-plugin-sharp fluid adds pathPrefix if defined 1`] = ` "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -382,7 +382,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -464,7 +464,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -546,7 +546,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -628,7 +628,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -688,7 +688,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -752,7 +752,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -816,7 +816,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -880,7 +880,7 @@ Array [ "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -916,7 +916,7 @@ exports[`gatsby-plugin-sharp fluid does not change the arguments object it is gi "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -987,7 +987,7 @@ exports[`gatsby-plugin-sharp fluid ensure maxWidth is in srcSet breakpoints 1`] "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1082,7 +1082,7 @@ exports[`gatsby-plugin-sharp fluid infers the maxWidth if only maxHeight is give "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1125,7 +1125,7 @@ exports[`gatsby-plugin-sharp fluid keeps original file name 1`] = ` "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1189,7 +1189,7 @@ exports[`gatsby-plugin-sharp fluid prevents duplicate breakpoints 1`] = ` "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1260,7 +1260,7 @@ exports[`gatsby-plugin-sharp fluid reject any breakpoints larger than the origin "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1318,7 +1318,7 @@ exports[`gatsby-plugin-sharp queueImageResizing file name works with spaces & sp "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, @@ -1361,7 +1361,7 @@ exports[`gatsby-plugin-sharp queueImageResizing should round height when auto-ca "pluginOptions": Object { "base64Width": 20, "defaultQuality": 50, - "failOn": "error", + "failOn": "warning", "forceBase64Format": "", "lazyImageGeneration": true, "stripMetadata": true, diff --git a/packages/gatsby-plugin-sharp/src/gatsby-node.js b/packages/gatsby-plugin-sharp/src/gatsby-node.js index ee1d7e87a3dc4..e5abb86aac8ae 100644 --- a/packages/gatsby-plugin-sharp/src/gatsby-node.js +++ b/packages/gatsby-plugin-sharp/src/gatsby-node.js @@ -235,7 +235,7 @@ exports.pluginOptionsSchema = ({ Joi }) => failOnError: Joi.boolean().default(true), failOn: Joi.any() .valid(`none`, `truncated`, `error`, `warning`) - .default(`error`) + .default(`warning`) .description(`Level of sensitivity to invalid images`), defaults: Joi.object({ formats: Joi.array().items( diff --git a/packages/gatsby-plugin-sharp/src/plugin-options.ts b/packages/gatsby-plugin-sharp/src/plugin-options.ts index 7780995e2f215..ed191b67f3711 100644 --- a/packages/gatsby-plugin-sharp/src/plugin-options.ts +++ b/packages/gatsby-plugin-sharp/src/plugin-options.ts @@ -72,7 +72,7 @@ const pluginDefaults = { stripMetadata: true, lazyImageGeneration: true, defaultQuality: 50, - failOn: `error` as FailOnOptions, + failOn: `warning` as FailOnOptions, } const generalArgs: Partial = {