(input: any, nameHint?: string)
| 1107 | } |
| 1108 | |
| 1109 | function normalizeComponent(input: any, nameHint?: string): any { |
| 1110 | try { |
| 1111 | if (!input) return null; |
| 1112 | // Unwrap module namespace with default |
| 1113 | if (input && typeof input === 'object' && 'default' in input) { |
| 1114 | const d = (input as any).default; |
| 1115 | if (d) return normalizeComponent(d, nameHint); |
| 1116 | } |
| 1117 | // If already a component-like object with render/setup/template, return as-is |
| 1118 | if (typeof input === 'object' && (input.render || input.setup || input.template || input.__isVue)) { |
| 1119 | return input; |
| 1120 | } |
| 1121 | // If provided a render function, wrap with defineComponent |
| 1122 | if (typeof input === 'function') { |
| 1123 | ensureVueGlobals(); |
| 1124 | const comp = (globalThis as any).defineComponent |
| 1125 | ? (globalThis as any).defineComponent({ |
| 1126 | name: nameHint || input.name || 'AnonymousSFC', |
| 1127 | render: input, |
| 1128 | }) |
| 1129 | : { name: nameHint || input.name || 'AnonymousSFC', render: input }; |
| 1130 | return comp; |
| 1131 | } |
| 1132 | // If object has a render function property |
| 1133 | if ((input as any)?.render && typeof (input as any).render === 'function') { |
| 1134 | ensureVueGlobals(); |
| 1135 | const comp = (globalThis as any).defineComponent |
| 1136 | ? (globalThis as any).defineComponent({ |
| 1137 | name: nameHint || (input as any).name || 'AnonymousSFC', |
| 1138 | render: (input as any).render, |
| 1139 | }) |
| 1140 | : { |
| 1141 | name: nameHint || (input as any).name || 'AnonymousSFC', |
| 1142 | render: (input as any).render, |
| 1143 | }; |
| 1144 | return comp; |
| 1145 | } |
| 1146 | } catch {} |
| 1147 | return input; |
| 1148 | } |
| 1149 | |
| 1150 | async function performResetRoot(newComponent: any): Promise<boolean> { |
| 1151 | const tStart = Date.now(); |
no test coverage detected