11import { extend , isArray } from '@vue/shared'
22import { AppConfig } from '../apiCreateApp'
33import { mergeDataOption } from './data'
4- import { DeprecationTypes , warnDeprecation } from './compatConfig'
4+ import {
5+ DeprecationTypes ,
6+ softAssertCompatEnabled ,
7+ warnDeprecation
8+ } from './compatConfig'
59import { isCopyingConfig } from './global'
610
711// legacy config warnings
@@ -33,7 +37,7 @@ export type LegacyConfig = {
3337}
3438
3539// dev only
36- export function installLegacyConfigProperties ( config : AppConfig ) {
40+ export function installLegacyConfigWarnings ( config : AppConfig ) {
3741 const legacyConfigOptions : Record < string , DeprecationTypes > = {
3842 silent : DeprecationTypes . CONFIG_SILENT ,
3943 devtools : DeprecationTypes . CONFIG_DEVTOOLS ,
@@ -57,11 +61,27 @@ export function installLegacyConfigProperties(config: AppConfig) {
5761 }
5862 } )
5963 } )
64+ }
6065
61- // Internal merge strats which are no longer needed in v3, but we need to
62- // expose them because some v2 plugins will reuse these internal strats to
63- // merge their custom options.
64- extend ( config . optionMergeStrategies , legacyOptionMergeStrats )
66+ export function installLegacyOptionMergeStrats ( config : AppConfig ) {
67+ config . optionMergeStrategies = new Proxy ( { } as any , {
68+ get ( target , key ) {
69+ if ( key in target ) {
70+ return target [ key ]
71+ }
72+ if (
73+ key in legacyOptionMergeStrats &&
74+ softAssertCompatEnabled (
75+ DeprecationTypes . CONFIG_OPTION_MERGE_STRATS ,
76+ null
77+ )
78+ ) {
79+ return legacyOptionMergeStrats [
80+ key as keyof typeof legacyOptionMergeStrats
81+ ]
82+ }
83+ }
84+ } )
6585}
6686
6787export const legacyOptionMergeStrats = {
0 commit comments