(options)
| 6 | * @returns {import('../types').NormalizedPluginOptions} Normalized plugin options. |
| 7 | */ |
| 8 | const normalizeOptions = (options) => { |
| 9 | d(options, 'exclude', /node_modules/i); |
| 10 | d(options, 'include', /\.([cm]js|[jt]sx?|flow)$/i); |
| 11 | d(options, 'forceEnable'); |
| 12 | d(options, 'library'); |
| 13 | |
| 14 | n(options, 'overlay', (overlay) => { |
| 15 | /** @type {import('../types').NormalizedErrorOverlayOptions} */ |
| 16 | const defaults = { |
| 17 | entry: require.resolve('../../client/ErrorOverlayEntry'), |
| 18 | module: require.resolve('../../overlay'), |
| 19 | sockIntegration: 'wds', |
| 20 | }; |
| 21 | |
| 22 | if (overlay === false) { |
| 23 | return false; |
| 24 | } |
| 25 | if (typeof overlay === 'undefined' || overlay === true) { |
| 26 | return defaults; |
| 27 | } |
| 28 | |
| 29 | d(overlay, 'entry', defaults.entry); |
| 30 | d(overlay, 'module', defaults.module); |
| 31 | d(overlay, 'sockIntegration', defaults.sockIntegration); |
| 32 | |
| 33 | return overlay; |
| 34 | }); |
| 35 | |
| 36 | return options; |
| 37 | }; |
| 38 | |
| 39 | module.exports = normalizeOptions; |
no test coverage detected
searching dependent graphs…