|
1 | 1 | import * as t from '@babel/types'; |
2 | | -import htmlTags from 'html-tags'; |
3 | | -import svgTags from 'svg-tags'; |
4 | 2 | import { type NodePath } from '@babel/traverse'; |
| 3 | +import { isHTMLTag, isSVGTag } from '@vue/shared'; |
5 | 4 | import type { State } from './interface'; |
6 | 5 | import SlotFlags from './slotFlags'; |
7 | | - |
8 | 6 | export const JSX_HELPER_KEY = 'JSX_HELPER_KEY'; |
9 | 7 | export const FRAGMENT = 'Fragment'; |
10 | 8 | export const KEEP_ALIVE = 'KeepAlive'; |
@@ -60,8 +58,8 @@ export const checkIsComponent = ( |
60 | 58 | return ( |
61 | 59 | !state.opts.isCustomElement?.(tag) && |
62 | 60 | shouldTransformedToSlots(tag) && |
63 | | - !htmlTags.includes(tag as htmlTags.htmlTags) && |
64 | | - !svgTags.includes(tag) |
| 61 | + !isHTMLTag(tag) && |
| 62 | + !isSVGTag(tag) |
65 | 63 | ); |
66 | 64 | }; |
67 | 65 |
|
@@ -99,10 +97,7 @@ export const getTag = ( |
99 | 97 | const namePath = path.get('openingElement').get('name'); |
100 | 98 | if (namePath.isJSXIdentifier()) { |
101 | 99 | const { name } = namePath.node; |
102 | | - if ( |
103 | | - !htmlTags.includes(name as htmlTags.htmlTags) && |
104 | | - !svgTags.includes(name) |
105 | | - ) { |
| 100 | + if (!isHTMLTag(name) && !isSVGTag(name)) { |
106 | 101 | return name === FRAGMENT |
107 | 102 | ? createIdentifier(state, FRAGMENT) |
108 | 103 | : path.scope.hasBinding(name) |
|
0 commit comments