import { isFunction , isObject } from '@vue/shared' ; import { Component , ComponentInternalInstance } from '../component' ; import { checkCompatEnabled , DeprecationTypes , softAssertCompatEnabled } from './compatConfig' ; import { convertLegacyAsyncComponent } from './componentAsync' ; import { convertLegacyFunctionalComponent } from './componentFunctional' ; export function convertLegacyComponent ( comp , instance ) { if ( comp . __isBuiltIn ) { return comp ; } if ( isFunction ( comp ) && comp . cid ) { comp = comp . options ; } if ( isFunction ( comp ) && checkCompatEnabled ( DeprecationTypes . COMPONENT_ASYNC , instance , comp ) ) { return convertLegacyAsyncComponent ( comp ) ; } if ( isObject ( comp ) && comp . functional && softAssertCompatEnabled ( DeprecationTypes . COMPONENT_FUNCTIONAL , instance , comp ) ) { return convertLegacyFunctionalComponent ( comp ) ; } return comp ; }