( instance: ComponentInternalInstance, isSSR: boolean, skipOptions?: boolean, )
| 991 | export const isRuntimeOnly = (): boolean => !compile |
| 992 | |
| 993 | export function finishComponentSetup( |
| 994 | instance: ComponentInternalInstance, |
| 995 | isSSR: boolean, |
| 996 | skipOptions?: boolean, |
| 997 | ): void { |
| 998 | const Component = instance.type as ComponentOptions |
| 999 | |
| 1000 | if (__COMPAT__) { |
| 1001 | convertLegacyRenderFn(instance) |
| 1002 | |
| 1003 | if (__DEV__ && Component.compatConfig) { |
| 1004 | validateCompatConfig(Component.compatConfig) |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | // template / render function normalization |
| 1009 | // could be already set when returned from setup() |
| 1010 | if (!instance.render) { |
| 1011 | // only do on-the-fly compile if not in SSR - SSR on-the-fly compilation |
| 1012 | // is done by server-renderer |
| 1013 | if (!isSSR && compile && !Component.render) { |
| 1014 | const template = |
| 1015 | (__COMPAT__ && |
| 1016 | instance.vnode.props && |
| 1017 | instance.vnode.props['inline-template']) || |
| 1018 | Component.template || |
| 1019 | (__FEATURE_OPTIONS_API__ && resolveMergedOptions(instance).template) |
| 1020 | if (template) { |
| 1021 | if (__DEV__) { |
| 1022 | startMeasure(instance, `compile`) |
| 1023 | } |
| 1024 | const { isCustomElement, compilerOptions } = instance.appContext.config |
| 1025 | const { delimiters, compilerOptions: componentCompilerOptions } = |
| 1026 | Component |
| 1027 | const finalCompilerOptions: CompilerOptions = extend( |
| 1028 | extend( |
| 1029 | { |
| 1030 | isCustomElement, |
| 1031 | delimiters, |
| 1032 | }, |
| 1033 | compilerOptions, |
| 1034 | ), |
| 1035 | componentCompilerOptions, |
| 1036 | ) |
| 1037 | if (__COMPAT__) { |
| 1038 | // pass runtime compat config into the compiler |
| 1039 | finalCompilerOptions.compatConfig = Object.create(globalCompatConfig) |
| 1040 | if (Component.compatConfig) { |
| 1041 | // @ts-expect-error types are not compatible |
| 1042 | extend(finalCompilerOptions.compatConfig, Component.compatConfig) |
| 1043 | } |
| 1044 | } |
| 1045 | Component.render = compile(template, finalCompilerOptions) |
| 1046 | if (__DEV__) { |
| 1047 | endMeasure(instance, `compile`) |
| 1048 | } |
| 1049 | } |
| 1050 | } |
no test coverage detected