import { AppConfig } from '../apiCreateApp' ; import { DeprecationTypes , softAssertCompatEnabled , warnDeprecation } from './compatConfig' ; import { isCopyingConfig } from './global' ; import { internalOptionMergeStrats } from '../componentOptions' ; export type LegacyConfig = { deprecated silent ? : boolean ; deprecated devtools ? : boolean ; deprecated ignoredElements ? : ( string | RegExp ) [ ] ; deprecated keyCodes ? : Record < string , number | number [ ] > ; deprecated productionTip ? : boolean ; } ; export function installLegacyConfigWarnings ( config ) { const legacyConfigOptions = { silent : DeprecationTypes . CONFIG_SILENT , devtools : DeprecationTypes . CONFIG_DEVTOOLS , ignoredElements : DeprecationTypes . CONFIG_IGNORED_ELEMENTS , keyCodes : DeprecationTypes . CONFIG_KEY_CODES , productionTip : DeprecationTypes . CONFIG_PRODUCTION_TIP } ; Object . keys ( legacyConfigOptions ) . forEach ( key => { let val = ( config as any ) [ key ] ; Object . defineProperty ( config , key , { enumerable : true , get ( ) { return val ; } , set ( newVal ) { if ( ! isCopyingConfig ) { warnDeprecation ( legacyConfigOptions [ key ] , null ) ; } val = newVal ; } } ) ; } ) ; } export function installLegacyOptionMergeStrats ( config ) { config . optionMergeStrategies = new Proxy ( { } as any , { get ( target , key ) { if ( key in target ) { return target [ key ] ; } if ( key in internalOptionMergeStrats && softAssertCompatEnabled ( DeprecationTypes . CONFIG_OPTION_MERGE_STRATS , null ) ) { return internalOptionMergeStrats [ key as keyof typeof internalOptionMergeStrats ] ; } } } ) ; }