chore: update

This commit is contained in:
zhiyuanzmj 2025-05-24 07:22:09 +08:00
parent 066532d823
commit a9545418e7
2 changed files with 6 additions and 8 deletions

View File

@ -120,10 +120,7 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
}); });
} }
const vueImportMap: Record< const vueImportMap: Record<string, t.Identifier[]> = {};
string,
(t.MemberExpression | t.Identifier)[]
> = {};
state.set('vueImportMap', vueImportMap); state.set('vueImportMap', vueImportMap);
path.node.body.forEach((statement) => { path.node.body.forEach((statement) => {
if (t.isImportDeclaration(statement)) { if (t.isImportDeclaration(statement)) {

View File

@ -38,10 +38,11 @@ export const shouldTransformedToSlots = (tag: string, state?: State) => {
if (state) { if (state) {
const vueImportMap = state.get('vueImportMap'); const vueImportMap = state.get('vueImportMap');
for (const name of [FRAGMENT, KEEP_ALIVE]) { for (const name of [FRAGMENT, KEEP_ALIVE]) {
if (vueImportMap[name]) { if (
if (vueImportMap[name].some((id: t.Identifier) => id.name === tag)) { vueImportMap[name] &&
return false; vueImportMap[name].some((id: t.Identifier) => id.name === tag)
} ) {
return false;
} }
} }
} }