| 387 | } |
| 388 | |
| 389 | export const getDeprecatedConfig = () => { |
| 390 | const deprecated: Record<string, {css: string[]}> = {}; |
| 391 | const baseConfig = config.getConfig(); |
| 392 | modules.forEach((plugin) => { |
| 393 | if (!plugin.decorateConfig) { |
| 394 | return; |
| 395 | } |
| 396 | // We need to clone config in case of plugin modifies config directly. |
| 397 | let configTmp: configOptions; |
| 398 | try { |
| 399 | configTmp = plugin.decorateConfig(JSON.parse(JSON.stringify(baseConfig))); |
| 400 | } catch (e) { |
| 401 | notify('Plugin error!', `"${plugin._name}" has encountered an error. Check Developer Tools for details.`, { |
| 402 | error: e |
| 403 | }); |
| 404 | return; |
| 405 | } |
| 406 | const pluginCSSDeprecated = config.getDeprecatedCSS(configTmp); |
| 407 | if (pluginCSSDeprecated.length === 0) { |
| 408 | return; |
| 409 | } |
| 410 | deprecated[plugin._name] = {css: pluginCSSDeprecated}; |
| 411 | }); |
| 412 | return deprecated; |
| 413 | }; |
| 414 | |
| 415 | export const decorateMenu = (tpl: any) => { |
| 416 | return decorateObject(tpl, 'decorateMenu'); |