(code: string, s: MagicString, ctx: Context, sfcPath: string)
| 35 | } |
| 36 | |
| 37 | export default async function transformComponent(code: string, s: MagicString, ctx: Context, sfcPath: string) { |
| 38 | let no = 0 |
| 39 | |
| 40 | const results = resolveVue3(code, s, ctx.options.transformerUserResolveFunctions) |
| 41 | |
| 42 | for (const { rawName, replace } of results) { |
| 43 | debug(`| ${rawName}`) |
| 44 | const name = pascalCase(rawName) |
| 45 | ctx.updateUsageMap(sfcPath, [name]) |
| 46 | const component = await ctx.findComponent(name, 'component', [sfcPath]) |
| 47 | if (component) { |
| 48 | const varName = `__unplugin_components_${no}` |
| 49 | s.prepend(`${stringifyComponentImport({ ...component, as: varName }, ctx)};\n`) |
| 50 | no += 1 |
| 51 | replace(varName) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | debug(`^ (${no})`) |
| 56 | } |
no test coverage detected
searching dependent graphs…