diff --git a/packages/gatsby-plugin-manifest/src/gatsby-node.js b/packages/gatsby-plugin-manifest/src/gatsby-node.js index f1504230109d9..ef7bac75aaa1f 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-node.js @@ -58,8 +58,49 @@ async function checkCache(cache, icon, srcIcon, srcIconDigest, callback) { } } +if (process.env.GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION) { + exports.pluginOptionsSchema = ({ Joi }) => { + Joi.object({ + name: Joi.string(), + short_name: Joi.string(), + description: Joi.string(), + lang: Joi.string(), + localize: Joi.array().items( + Joi.object({ + start_url: Joi.string(), + name: Joi.string(), + short_name: Joi.string(), + description: Joi.string(), + lang: Joi.string(), + }) + ), + start_url: Joi.string(), + background_color: Joi.string(), + theme_color: Joi.string(), + display: Joi.string(), + legacy: Joi.boolean(), + include_favicon: Joi.boolean(), + icon: Joi.string(), + theme_color_in_head: Joi.boolean(), + crossOrigin: Joi.string().valid(`use-credentials`, `anonymous`), + cache_busting_mode: Joi.string().valid(`query`, `name`, `none`), + icons: Joi.array().items( + Joi.object({ + src: Joi.string(), + sizes: Joi.string(), + type: Joi.string(), + }) + ), + icon_options: Joi.object({ + purpose: Joi.string(), + }), + }) + } +} + /** * Setup pluginOption defaults + * TODO: Remove once pluginOptionsSchema is stable */ exports.onPreInit = (_, pluginOptions) => { pluginOptions.cache_busting_mode = pluginOptions.cache_busting_mode ?? `query`