@@ -58,8 +58,49 @@ async function checkCache(cache, icon, srcIcon, srcIconDigest, callback) {
58
58
}
59
59
}
60
60
61
+ if ( process . env . GATSBY_EXPERIMENTAL_PLUGIN_OPTION_VALIDATION ) {
62
+ exports . pluginOptionsSchema = ( { Joi } ) => {
63
+ Joi . object ( {
64
+ name : Joi . string ( ) ,
65
+ short_name : Joi . string ( ) ,
66
+ description : Joi . string ( ) ,
67
+ lang : Joi . string ( ) ,
68
+ localize : Joi . array ( ) . items (
69
+ Joi . object ( {
70
+ start_url : Joi . string ( ) ,
71
+ name : Joi . string ( ) ,
72
+ short_name : Joi . string ( ) ,
73
+ description : Joi . string ( ) ,
74
+ lang : Joi . string ( ) ,
75
+ } )
76
+ ) ,
77
+ start_url : Joi . string ( ) ,
78
+ background_color : Joi . string ( ) ,
79
+ theme_color : Joi . string ( ) ,
80
+ display : Joi . string ( ) ,
81
+ legacy : Joi . boolean ( ) ,
82
+ include_favicon : Joi . boolean ( ) ,
83
+ icon : Joi . string ( ) ,
84
+ theme_color_in_head : Joi . boolean ( ) ,
85
+ crossOrigin : Joi . string ( ) . valid ( `use-credentials` , `anonymous` ) ,
86
+ cache_busting_mode : Joi . string ( ) . valid ( `query` , `name` , `none` ) ,
87
+ icons : Joi . array ( ) . items (
88
+ Joi . object ( {
89
+ src : Joi . string ( ) ,
90
+ sizes : Joi . string ( ) ,
91
+ type : Joi . string ( ) ,
92
+ } )
93
+ ) ,
94
+ icon_options : Joi . object ( {
95
+ purpose : Joi . string ( ) ,
96
+ } ) ,
97
+ } )
98
+ }
99
+ }
100
+
61
101
/**
62
102
* Setup pluginOption defaults
103
+ * TODO: Remove once pluginOptionsSchema is stable
63
104
*/
64
105
exports . onPreInit = ( _ , pluginOptions ) => {
65
106
pluginOptions . cache_busting_mode = pluginOptions . cache_busting_mode ?? `query`
0 commit comments