Skip to content

Commit 2a9a037

Browse files
authored
fix(antdv): fix resolver matches, fix unplugin#228 (unplugin#230)
1 parent 65806b8 commit 2a9a037

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/core/resolvers/antdv.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,19 @@ function getSideEffects(compName: string, options: AntDesignVueResolverOptions):
216216
return `ant-design-vue/es/${styleDir}/style/css`
217217
}
218218
}
219+
const primitiveNames = ['Affix', 'Anchor', 'AnchorLink', 'AutoComplete', 'AutoCompleteOptGroup', 'AutoCompleteOption', 'Alert', 'Avatar', 'AvatarGroup', 'BackTop', 'Badge', 'BadgeRibbon', 'Breadcrumb', 'BreadcrumbItem', 'BreadcrumbSeparator', 'Button', 'ButtonGroup', 'Calendar', 'Card', 'CardGrid', 'CardMeta', 'Collapse', 'CollapsePanel', 'Carousel', 'Cascader', 'Checkbox', 'CheckboxGroup', 'Col', 'Comment', 'ConfigProvider', 'DatePicker', 'MonthPicker', 'WeekPicker', 'RangePicker', 'QuarterPicker', 'Descriptions', 'DescriptionsItem', 'Divider', 'Dropdown', 'DropdownButton', 'Drawer', 'Empty', 'Form', 'FormItem', 'FormItemRest', 'Grid', 'Input', 'InputGroup', 'InputPassword', 'InputSearch', 'Textarea', 'Image', 'ImagePreviewGroup', 'InputNumber', 'Layout', 'LayoutHeader', 'LayoutSider', 'LayoutFooter', 'LayoutContent', 'List', 'ListItem', 'ListItemMeta', 'Menu', 'MenuDivider', 'MenuItem', 'MenuItemGroup', 'SubMenu', 'Mentions', 'MentionsOption', 'Modal', 'Statistic', 'StatisticCountdown', 'PageHeader', 'Pagination', 'Popconfirm', 'Popover', 'Progress', 'Radio', 'RadioButton', 'RadioGroup', 'Rate', 'Result', 'Row', 'Select', 'SelectOptGroup', 'SelectOption', 'Skeleton', 'SkeletonButton', 'SkeletonAvatar', 'SkeletonInput', 'SkeletonImage', 'Slider', 'Space', 'Spin', 'Steps', 'Step', 'Switch', 'Table', 'TableColumn', 'TableColumnGroup', 'TableSummary', 'TableSummaryRow', 'TableSummaryCell', 'Transfer', 'Tree', 'TreeNode', 'DirectoryTree', 'TreeSelect', 'TreeSelectNode', 'Tabs', 'TabPane', 'Tag', 'CheckableTag', 'TimePicker', 'TimeRangePicker', 'Timeline', 'TimelineItem', 'Tooltip', 'Typography', 'TypographyLink', 'TypographyParagraph', 'TypographyText', 'TypographyTitle', 'Upload', 'UploadDragger', 'LocaleProvider']
220+
const prefix = 'A'
221+
222+
let antdvNames: Set<string>
223+
224+
function genAntdNames(primitiveNames: string[]): void {
225+
antdvNames = new Set(primitiveNames.map(name => `${prefix}${name}`))
226+
}
227+
genAntdNames(primitiveNames)
228+
229+
function isAntdv(compName: string): boolean {
230+
return antdvNames.has(compName)
231+
}
219232

220233
/**
221234
* Resolver for Ant Design Vue
@@ -238,8 +251,9 @@ export function AntDesignVueResolver(options: AntDesignVueResolverOptions = {}):
238251
}
239252
}
240253

241-
if (name.match(/^A[A-Z]/) && !options?.exclude?.includes(name)) {
254+
if (isAntdv(name) && !options?.exclude?.includes(name)) {
242255
const importName = name.slice(1)
256+
243257
return {
244258
importName,
245259
path: 'ant-design-vue/es',

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy