1
1
import { extend , isArray } from '@vue/shared'
2
2
import { AppConfig } from '../apiCreateApp'
3
3
import { mergeDataOption } from './data'
4
- import { DeprecationTypes , warnDeprecation } from './compatConfig'
4
+ import {
5
+ DeprecationTypes ,
6
+ softAssertCompatEnabled ,
7
+ warnDeprecation
8
+ } from './compatConfig'
5
9
import { isCopyingConfig } from './global'
6
10
7
11
// legacy config warnings
@@ -33,7 +37,7 @@ export type LegacyConfig = {
33
37
}
34
38
35
39
// dev only
36
- export function installLegacyConfigProperties ( config : AppConfig ) {
40
+ export function installLegacyConfigWarnings ( config : AppConfig ) {
37
41
const legacyConfigOptions : Record < string , DeprecationTypes > = {
38
42
silent : DeprecationTypes . CONFIG_SILENT ,
39
43
devtools : DeprecationTypes . CONFIG_DEVTOOLS ,
@@ -57,11 +61,27 @@ export function installLegacyConfigProperties(config: AppConfig) {
57
61
}
58
62
} )
59
63
} )
64
+ }
60
65
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
+ } )
65
85
}
66
86
67
87
export const legacyOptionMergeStrats = {
0 commit comments