MCPcopy
hub / github.com/vuejs/core / isCompatEnabled

Function isCompatEnabled

packages/runtime-core/src/compat/compatConfig.ts:566–588  ·  view source on GitHub ↗
(
  key: DeprecationTypes,
  instance: ComponentInternalInstance | null,
  enableForBuiltIn = false,
)

Source from the content-addressed store, hash-verified

564}
565
566export function isCompatEnabled(
567 key: DeprecationTypes,
568 instance: ComponentInternalInstance | null,
569 enableForBuiltIn = false,
570): boolean {
571 // skip compat for built-in components
572 if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
573 return false
574 }
575
576 const rawMode = getCompatConfigForKey('MODE', instance) || 2
577 const val = getCompatConfigForKey(key, instance)
578
579 const mode = isFunction(rawMode)
580 ? rawMode(instance && instance.type)
581 : rawMode
582
583 if (mode === 2) {
584 return val !== false
585 } else {
586 return val === true || val === 'suppress-warning'
587 }
588}
589
590/**
591 * Use this for features that are completely removed in non-compat build.

Callers 15

applyOptionsFunction · 0.90
createWatcherFunction · 0.90
resolveMergedOptionsFunction · 0.90
mergeDataFnFunction · 0.90
normalizeObjectSlotsFunction · 0.90
normalizeVNodeSlotsFunction · 0.90
componentUpdateFnFunction · 0.90
unmountComponentFunction · 0.90
renderComponentRootFunction · 0.90
resolvePropValueFunction · 0.90
applySingletonPrototypeFunction · 0.90

Calls 2

isFunctionFunction · 0.90
getCompatConfigForKeyFunction · 0.85

Tested by

no test coverage detected