Skip to content

Commit 978edb4

Browse files
committed
🐛 fix test
1 parent dcddf37 commit 978edb4

File tree

4 files changed

+241
-6
lines changed

4 files changed

+241
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Components({
106106
* const MikForm: typeof import('formik')['Form']
107107
*
108108
* **/
109-
{ name: 'MikForm', from: 'formik', type: 'Export', orignalName: 'Form' }
109+
{ name: 'MikForm', from: 'formik', type: 'Export', orignalName: 'Form' },
110110
/**
111111
* in App.tsx
112112
* import XXX fro

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "playground",
33
"type": "module",
4-
"private": true,
54
"version": "0.0.0",
5+
"private": true,
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
// Vitest Snapshot v1
2+
3+
exports[`generate components.d.ts 1`] = `
4+
"/* generated by unplugin-react-components */
5+
export {}
6+
declare global{
7+
const A: typeof import('./A')['A']
8+
const App: typeof import('./App')['App']
9+
const AntAffix: typeof import('antd')['Affix']
10+
const AntAlert: typeof import('antd')['Alert']
11+
const AntAnchor: typeof import('antd')['Anchor']
12+
const AntAutoComplete: typeof import('antd')['AutoComplete']
13+
const AntAvatar: typeof import('antd')['Avatar']
14+
const AntBackTop: typeof import('antd')['BackTop']
15+
const AntBadge: typeof import('antd')['Badge']
16+
const AntBreadcrumb: typeof import('antd')['Breadcrumb']
17+
const AntButton: typeof import('antd')['Button']
18+
const AntCalendar: typeof import('antd')['Calendar']
19+
const AntCard: typeof import('antd')['Card']
20+
const AntCarousel: typeof import('antd')['Carousel']
21+
const AntCascader: typeof import('antd')['Cascader']
22+
const AntCheckbox: typeof import('antd')['Checkbox']
23+
const AntCol: typeof import('antd')['Col']
24+
const AntCollapse: typeof import('antd')['Collapse']
25+
const AntComment: typeof import('antd')['Comment']
26+
const AntConfigProvider: typeof import('antd')['ConfigProvider']
27+
const AntDatePicker: typeof import('antd')['DatePicker']
28+
const AntDescriptions: typeof import('antd')['Descriptions']
29+
const AntDivider: typeof import('antd')['Divider']
30+
const AntDrawer: typeof import('antd')['Drawer']
31+
const AntDropdown: typeof import('antd')['Dropdown']
32+
const AntEmpty: typeof import('antd')['Empty']
33+
const AntForm: typeof import('antd')['Form']
34+
const AntGrid: typeof import('antd')['Grid']
35+
const AntImage: typeof import('antd')['Image']
36+
const AntInput: typeof import('antd')['Input']
37+
const AntInputNumber: typeof import('antd')['InputNumber']
38+
const AntLayout: typeof import('antd')['Layout']
39+
const AntList: typeof import('antd')['List']
40+
const AntMentions: typeof import('antd')['Mentions']
41+
const AntMenu: typeof import('antd')['Menu']
42+
const AntModal: typeof import('antd')['Modal']
43+
const AntPageHeader: typeof import('antd')['PageHeader']
44+
const AntPagination: typeof import('antd')['Pagination']
45+
const AntPopconfirm: typeof import('antd')['Popconfirm']
46+
const AntPopover: typeof import('antd')['Popover']
47+
const AntProgress: typeof import('antd')['Progress']
48+
const AntRadio: typeof import('antd')['Radio']
49+
const AntRate: typeof import('antd')['Rate']
50+
const AntResult: typeof import('antd')['Result']
51+
const AntRow: typeof import('antd')['Row']
52+
const AntSegmented: typeof import('antd')['Segmented']
53+
const AntSelect: typeof import('antd')['Select']
54+
const AntSkeleton: typeof import('antd')['Skeleton']
55+
const AntSlider: typeof import('antd')['Slider']
56+
const AntSpace: typeof import('antd')['Space']
57+
const AntSpin: typeof import('antd')['Spin']
58+
const AntStatistic: typeof import('antd')['Statistic']
59+
const AntSteps: typeof import('antd')['Steps']
60+
const AntSwitch: typeof import('antd')['Switch']
61+
const AntTable: typeof import('antd')['Table']
62+
const AntTabs: typeof import('antd')['Tabs']
63+
const AntTag: typeof import('antd')['Tag']
64+
const AntTimePicker: typeof import('antd')['TimePicker']
65+
const AntTimeline: typeof import('antd')['Timeline']
66+
const AntTooltip: typeof import('antd')['Tooltip']
67+
const AntTransfer: typeof import('antd')['Transfer']
68+
const AntTree: typeof import('antd')['Tree']
69+
const AntTreeSelect: typeof import('antd')['TreeSelect']
70+
const AntTypography: typeof import('antd')['Typography']
71+
const AntUpload: typeof import('antd')['Upload']
72+
const Affix: typeof import('antd')['Affix']
73+
const Alert: typeof import('antd')['Alert']
74+
const Anchor: typeof import('antd')['Anchor']
75+
const AutoComplete: typeof import('antd')['AutoComplete']
76+
const Avatar: typeof import('antd')['Avatar']
77+
const BackTop: typeof import('antd')['BackTop']
78+
const Badge: typeof import('antd')['Badge']
79+
const Breadcrumb: typeof import('antd')['Breadcrumb']
80+
const Button: typeof import('antd')['Button']
81+
const Calendar: typeof import('antd')['Calendar']
82+
const Card: typeof import('antd')['Card']
83+
const Carousel: typeof import('antd')['Carousel']
84+
const Cascader: typeof import('antd')['Cascader']
85+
const Checkbox: typeof import('antd')['Checkbox']
86+
const Col: typeof import('antd')['Col']
87+
const Collapse: typeof import('antd')['Collapse']
88+
const Comment: typeof import('antd')['Comment']
89+
const ConfigProvider: typeof import('antd')['ConfigProvider']
90+
const DatePicker: typeof import('antd')['DatePicker']
91+
const Descriptions: typeof import('antd')['Descriptions']
92+
const Divider: typeof import('antd')['Divider']
93+
const Drawer: typeof import('antd')['Drawer']
94+
const Dropdown: typeof import('antd')['Dropdown']
95+
const Empty: typeof import('antd')['Empty']
96+
const Form: typeof import('antd')['Form']
97+
const Grid: typeof import('antd')['Grid']
98+
const Image: typeof import('antd')['Image']
99+
const Input: typeof import('antd')['Input']
100+
const InputNumber: typeof import('antd')['InputNumber']
101+
const Layout: typeof import('antd')['Layout']
102+
const List: typeof import('antd')['List']
103+
const Mentions: typeof import('antd')['Mentions']
104+
const Menu: typeof import('antd')['Menu']
105+
const Modal: typeof import('antd')['Modal']
106+
const PageHeader: typeof import('antd')['PageHeader']
107+
const Pagination: typeof import('antd')['Pagination']
108+
const Popconfirm: typeof import('antd')['Popconfirm']
109+
const Popover: typeof import('antd')['Popover']
110+
const Progress: typeof import('antd')['Progress']
111+
const Radio: typeof import('antd')['Radio']
112+
const Rate: typeof import('antd')['Rate']
113+
const Result: typeof import('antd')['Result']
114+
const Row: typeof import('antd')['Row']
115+
const Segmented: typeof import('antd')['Segmented']
116+
const Select: typeof import('antd')['Select']
117+
const Skeleton: typeof import('antd')['Skeleton']
118+
const Slider: typeof import('antd')['Slider']
119+
const Space: typeof import('antd')['Space']
120+
const Spin: typeof import('antd')['Spin']
121+
const Statistic: typeof import('antd')['Statistic']
122+
const Steps: typeof import('antd')['Steps']
123+
const Switch: typeof import('antd')['Switch']
124+
const Table: typeof import('antd')['Table']
125+
const Tabs: typeof import('antd')['Tabs']
126+
const Tag: typeof import('antd')['Tag']
127+
const TimePicker: typeof import('antd')['TimePicker']
128+
const Timeline: typeof import('antd')['Timeline']
129+
const Tooltip: typeof import('antd')['Tooltip']
130+
const Transfer: typeof import('antd')['Transfer']
131+
const Tree: typeof import('antd')['Tree']
132+
const TreeSelect: typeof import('antd')['TreeSelect']
133+
const Typography: typeof import('antd')['Typography']
134+
const Upload: typeof import('antd')['Upload']
135+
}"
136+
`;
137+
138+
exports[`ignore local components 1`] = `
139+
"import { Progress as _unplugin_react_Progress_0 } from 'antd'
140+
import 'antd/es/progress/style/index.css'
141+
import { Tooltip as _unplugin_react_Tooltip_1 } from 'antd'
142+
import 'antd/es/tooltip/style/index.css'
143+
144+
import { jsxDEV as _jsxDEV } from \\"react/jsx-dev-runtime\\";
145+
function App() {
146+
return /*#__PURE__*/_jsxDEV(\\"div\\", {
147+
className: \\"App\\",
148+
children: [/*#__PURE__*/_jsxDEV(A, {
149+
variant: 'contained',
150+
children: \\"hi mui\\"
151+
}, void 0, false, {
152+
fileName: _jsxFileName,
153+
lineNumber: 6,
154+
columnNumber: 7
155+
}, this), /*#__PURE__*/_jsxDEV(_unplugin_react_Progress_0, {
156+
percent: 30
157+
}, void 0, false, {
158+
fileName: _jsxFileName,
159+
lineNumber: 7,
160+
columnNumber: 7
161+
}, this), /*#__PURE__*/_jsxDEV(A, {}, void 0, false, {
162+
fileName: _jsxFileName,
163+
lineNumber: 8,
164+
columnNumber: 7
165+
}, this), /*#__PURE__*/_jsxDEV(_unplugin_react_Tooltip_1, {
166+
title: \\"prompt text\\",
167+
children: /*#__PURE__*/_jsxDEV(\\"span\\", {
168+
children: \\"Tooltip will show on mouse enter.\\"
169+
}, void 0, false, {
170+
fileName: _jsxFileName,
171+
lineNumber: 10,
172+
columnNumber: 9
173+
}, this)
174+
}, void 0, false, {
175+
fileName: _jsxFileName,
176+
lineNumber: 9,
177+
columnNumber: 7
178+
}, this)]
179+
}, void 0, true, {
180+
fileName: _jsxFileName,
181+
lineNumber: 5,
182+
columnNumber: 5
183+
}, this);
184+
}
185+
_c = App;
186+
export default App;"
187+
`;
188+
189+
exports[`play with resolver 1`] = `
190+
"import { A as _unplugin_react_A_0 } from 'D:/Dev/unplugin/unplugin-react-components/test/fixtures/A.tsx'
191+
import { Progress as _unplugin_react_Progress_1 } from 'antd'
192+
import 'antd/es/progress/style/index.css'
193+
import { Tooltip as _unplugin_react_Tooltip_2 } from 'antd'
194+
import 'antd/es/tooltip/style/index.css'
195+
196+
import { jsxDEV as _jsxDEV } from \\"react/jsx-dev-runtime\\";
197+
function App() {
198+
return /*#__PURE__*/_jsxDEV(\\"div\\", {
199+
className: \\"App\\",
200+
children: [/*#__PURE__*/_jsxDEV(_unplugin_react_A_0, {
201+
variant: 'contained',
202+
children: \\"hi mui\\"
203+
}, void 0, false, {
204+
fileName: _jsxFileName,
205+
lineNumber: 6,
206+
columnNumber: 7
207+
}, this), /*#__PURE__*/_jsxDEV(_unplugin_react_Progress_1, {
208+
percent: 30
209+
}, void 0, false, {
210+
fileName: _jsxFileName,
211+
lineNumber: 7,
212+
columnNumber: 7
213+
}, this), /*#__PURE__*/_jsxDEV(_unplugin_react_A_0, {}, void 0, false, {
214+
fileName: _jsxFileName,
215+
lineNumber: 8,
216+
columnNumber: 7
217+
}, this), /*#__PURE__*/_jsxDEV(_unplugin_react_Tooltip_2, {
218+
title: \\"prompt text\\",
219+
children: /*#__PURE__*/_jsxDEV(\\"span\\", {
220+
children: \\"Tooltip will show on mouse enter.\\"
221+
}, void 0, false, {
222+
fileName: _jsxFileName,
223+
lineNumber: 10,
224+
columnNumber: 9
225+
}, this)
226+
}, void 0, false, {
227+
fileName: _jsxFileName,
228+
lineNumber: 9,
229+
columnNumber: 7
230+
}, this)]
231+
}, void 0, true, {
232+
fileName: _jsxFileName,
233+
lineNumber: 5,
234+
columnNumber: 5
235+
}, this);
236+
}
237+
_c = App;
238+
export default App;"
239+
`;

test/fixtures/App.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { useState } from 'react'
2-
31
export function App() {
4-
const [state, setState] = useState()
5-
62
return (
73
<div>
84
hi

0 commit comments

Comments
 (0)