+48
-9
lines changedFilter options
+48
-9
lines changed Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ export const enum DeprecationTypes {
26
26
CONFIG_PRODUCTION_TIP = 'CONFIG_PRODUCTION_TIP',
27
27
CONFIG_IGNORED_ELEMENTS = 'CONFIG_IGNORED_ELEMENTS',
28
28
CONFIG_WHITESPACE = 'CONFIG_WHITESPACE',
29
+
CONFIG_OPTION_MERGE_STRATS = 'CONFIG_OPTION_MERGE_STRATS',
29
30
30
31
INSTANCE_SET = 'INSTANCE_SET',
31
32
INSTANCE_DELETE = 'INSTANCE_DELETE',
@@ -174,6 +175,12 @@ export const deprecationData: Record<DeprecationTypes, DeprecationData> = {
174
175
`\`config.compilerOptions.whitespace\`.`
175
176
},
176
177
178
+
[DeprecationTypes.CONFIG_OPTION_MERGE_STRATS]: {
179
+
message:
180
+
`config.optionMergeStrategies no longer exposes internal strategies. ` +
181
+
`Use custom merge functions instead.`
182
+
},
183
+
177
184
[DeprecationTypes.INSTANCE_SET]: {
178
185
message:
179
186
`vm.$set() has been removed as it is no longer needed in Vue 3. ` +
Original file line number Diff line number Diff line change
@@ -41,7 +41,8 @@ import { Directive } from '../directives'
41
41
import { nextTick } from '../scheduler'
42
42
import { version } from '..'
43
43
import {
44
-
installLegacyConfigProperties,
44
+
installLegacyConfigWarnings,
45
+
installLegacyOptionMergeStrats,
45
46
LegacyConfig,
46
47
legacyOptionMergeStrats
47
48
} from './globalConfig'
@@ -327,6 +328,7 @@ export function installAppCompatProperties(
327
328
render: RootRenderFunction
328
329
) {
329
330
installFilterMethod(app, context)
331
+
installLegacyOptionMergeStrats(app.config)
330
332
331
333
if (!singletonApp) {
332
334
// this is the call of creating the singleton itself so the rest is
@@ -337,7 +339,7 @@ export function installAppCompatProperties(
337
339
installCompatMount(app, context, render)
338
340
installLegacyAPIs(app)
339
341
applySingletonAppMutations(app)
340
-
if (__DEV__) installLegacyConfigProperties(app.config)
342
+
if (__DEV__) installLegacyConfigWarnings(app.config)
341
343
}
342
344
343
345
function installFilterMethod(app: App, context: AppContext) {
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
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 = {
Original file line number Diff line number Diff line change
@@ -321,6 +321,7 @@ Features that start with `COMPILER_` are compiler-specific: if you are using the
321
321
| GLOBAL_OBSERVABLE | ● | `Vue.observable` removed (use `reactive`) | [link](https://v3.vuejs.org/api/basic-reactivity.html) |
322
322
| CONFIG_KEY_CODES | ● | config.keyCodes rmeoved | [link](https://v3.vuejs.org/guide/migration/keycode-modifiers.html) |
323
323
| CONFIG_WHITESPACE | ● | In Vue 3 whitespace defaults to `"condense"` | |
324
+
| CONFIG_OPTION_MERGE_STRATS | ● | Vue 3 no longer exposes internal option merge strats | |
324
325
| INSTANCE_SET | ● | `vm.$set` removed (no longer needed) | |
325
326
| INSTANCE_DELETE | ● | `vm.$delete` removed (no longer needed) | |
326
327
| INSTANCE_EVENT_EMITTER | ● | `vm.$on`, `vm.$off`, `vm.$once` removed | [link](https://v3.vuejs.org/guide/migration/events-api.html) |
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1
1
import Vue from '@vue/compat'
2
-
import { toggleDeprecationWarning } from '../../runtime-core/src/compat/compatConfig'
2
+
import {
3
+
DeprecationTypes,
4
+
toggleDeprecationWarning
5
+
} from '../../runtime-core/src/compat/compatConfig'
3
6
import { createApp } from '../src/esm-index'
4
7
import { triggerEvent } from './utils'
5
8
@@ -74,3 +77,9 @@ test('singleton config should affect apps created with createApp()', () => {
74
77
}).mount(el)
75
78
expect(el.innerHTML).toBe(`<v-foo></v-foo><foo></foo>`)
76
79
})
80
+
81
+
test('config.optionMergeStrategies', () => {
82
+
toggleDeprecationWarning(true)
83
+
expect(typeof Vue.config.optionMergeStrategies.created).toBe('function')
84
+
expect(DeprecationTypes.CONFIG_OPTION_MERGE_STRATS).toHaveBeenWarned()
85
+
})
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4