mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-05-24 19:24:24 +08:00
chore: update
This commit is contained in:
parent
066532d823
commit
a9545418e7
@ -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)) {
|
||||||
|
@ -38,13 +38,14 @@ 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] &&
|
||||||
|
vueImportMap[name].some((id: t.Identifier) => id.name === tag)
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return !(tag.match(RegExp(`^_?${FRAGMENT}\\d*$`)) || tag === KEEP_ALIVE);
|
return !(tag.match(RegExp(`^_?${FRAGMENT}\\d*$`)) || tag === KEEP_ALIVE);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user