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

Function resolveMergedOptions

packages/runtime-core/src/componentOptions.ts:927–967  ·  view source on GitHub ↗
(
  instance: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

925 * instances.
926 */
927export function resolveMergedOptions(
928 instance: ComponentInternalInstance,
929): MergedComponentOptions {
930 const base = instance.type as ComponentOptions
931 const { mixins, extends: extendsOptions } = base
932 const {
933 mixins: globalMixins,
934 optionsCache: cache,
935 config: { optionMergeStrategies },
936 } = instance.appContext
937 const cached = cache.get(base)
938
939 let resolved: MergedComponentOptions
940
941 if (cached) {
942 resolved = cached
943 } else if (!globalMixins.length && !mixins && !extendsOptions) {
944 if (
945 __COMPAT__ &&
946 isCompatEnabled(DeprecationTypes.PRIVATE_APIS, instance)
947 ) {
948 resolved = extend({}, base) as MergedComponentOptions
949 resolved.parent = instance.parent && instance.parent.proxy
950 resolved.propsData = instance.vnode.props
951 } else {
952 resolved = base as MergedComponentOptions
953 }
954 } else {
955 resolved = {}
956 if (globalMixins.length) {
957 globalMixins.forEach(m =>
958 mergeOptions(resolved, m, optionMergeStrategies, true),
959 )
960 }
961 mergeOptions(resolved, base, optionMergeStrategies)
962 }
963 if (isObject(base)) {
964 cache.set(base, resolved)
965 }
966 return resolved
967}
968
969export function mergeOptions(
970 to: any,

Callers 5

finishComponentSetupFunction · 0.90
getFunction · 0.90
applyOptionsFunction · 0.85

Calls 6

isCompatEnabledFunction · 0.90
isObjectFunction · 0.90
mergeOptionsFunction · 0.85
forEachMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected