5
5
isRuntimeOnly
6
6
} from '../component'
7
7
import { warn } from '../warning'
8
- import { getCompatConfig } from './compatConfig'
8
+ import { getCompatConfigForKey , isCompatEnabled } from './compatConfig'
9
9
10
10
export const enum DeprecationTypes {
11
11
GLOBAL_MOUNT = 'GLOBAL_MOUNT' ,
@@ -203,10 +203,10 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
203
203
`Components with inheritAttrs: false will no longer auto-inherit ` +
204
204
`class/style on its root element. If your code relies on this behavior, ` +
205
205
`you may see broken styling and need to adjust your CSS. Otherwise, ` +
206
- `you can suppress this warning with:` +
206
+ `you can disable the compat behavior and suppress this warning with:` +
207
207
`\n\n configureCompat({ ${
208
208
DeprecationTypes . INSTANCE_ATTRS_CLASS_STYLE
209
- } : { warning: false }} )\n`,
209
+ } : false )\n`,
210
210
link : `https://v3.vuejs.org/guide/migration/attrs-includes-class-style.html`
211
211
} ,
212
212
@@ -238,9 +238,7 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
238
238
`trigger on array mutation unless the "deep" option is specified. ` +
239
239
`If current usage is intended, you can disable the compat behavior and ` +
240
240
`suppress this warning with:` +
241
- `\n\n configureCompat({ ${
242
- DeprecationTypes . WATCH_ARRAY
243
- } : { enabled: false }})\n`,
241
+ `\n\n configureCompat({ ${ DeprecationTypes . WATCH_ARRAY } : false })\n` ,
244
242
link : `https://v3.vuejs.org/guide/migration/watch.html`
245
243
} ,
246
244
@@ -273,7 +271,7 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
273
271
`you can disable the compat behavior and suppress this warning with:` +
274
272
`\n\n configureCompat({ ${
275
273
DeprecationTypes . ATTR_FALSE_VALUE
276
- } : { enabled: false } })\n`,
274
+ } : false })\n`,
277
275
link : `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
278
276
} ,
279
277
@@ -288,7 +286,7 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
288
286
`you can disable the compat behavior and suppress this warning with:` +
289
287
`\n\n configureCompat({ ${
290
288
DeprecationTypes . ATTR_ENUMERATED_COERSION
291
- } : { enabled: false } })\n`,
289
+ } : false })\n`,
292
290
link : `https://v3.vuejs.org/guide/migration/attribute-coercion.html`
293
291
} ,
294
292
@@ -304,7 +302,7 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
304
302
`warning with:` +
305
303
`\n\n configureCompat({ ${
306
304
DeprecationTypes . TRANSITION_GROUP_ROOT
307
- } : { enabled: false } })\n`,
305
+ } : false })\n`,
308
306
link : `https://v3.vuejs.org/guide/migration/transition-group.html`
309
307
} ,
310
308
@@ -335,7 +333,7 @@ const deprecationData: Record<DeprecationTypes, DeprecationData> = {
335
333
`then disable compat for legacy async components with:` +
336
334
`\n\n configureCompat({ ${
337
335
DeprecationTypes . COMPONENT_ASYNC
338
- } : { enabled: false } })\n`
336
+ } : false })\n`
339
337
)
340
338
} ,
341
339
link : `https://v3.vuejs.org/guide/migration/functional-components.html`
@@ -354,12 +352,8 @@ export function warnDeprecation(key: DeprecationTypes, ...args: any[]) {
354
352
}
355
353
356
354
// check user config
357
- const config = getCompatConfig ( key )
358
- if (
359
- config &&
360
- ( config . warning === false ||
361
- ( config . enabled === false && config . warning !== true ) )
362
- ) {
355
+ const config = getCompatConfigForKey ( key )
356
+ if ( config === 'suppress-warning' ) {
363
357
return
364
358
}
365
359
@@ -391,4 +385,10 @@ export function warnDeprecation(key: DeprecationTypes, ...args: any[]) {
391
385
typeof message === 'function' ? message ( ...args ) : message
392
386
} ${ link ? `\n Details: ${ link } ` : `` } `
393
387
)
388
+ if ( ! isCompatEnabled ( key ) ) {
389
+ console . error (
390
+ `^ The above deprecation's compat behavior is disabled and will likely ` +
391
+ `lead to runtime errors.`
392
+ )
393
+ }
394
394
}
0 commit comments