diff --git a/packages/react-components/CHANGELOG.md b/packages/react-components/CHANGELOG.md
index 0e4500d..6aa36f7 100644
--- a/packages/react-components/CHANGELOG.md
+++ b/packages/react-components/CHANGELOG.md
@@ -1,5 +1,11 @@
# @farmfe/plugin-react-components
+## 1.0.3
+
+### Patch Changes
+
+- fix auto finish_components
+
## 1.0.2
### Patch Changes
diff --git a/packages/react-components/package.json b/packages/react-components/package.json
index d4cd0d3..40fcac9 100644
--- a/packages/react-components/package.json
+++ b/packages/react-components/package.json
@@ -1,6 +1,6 @@
{
"name": "@farmfe/plugin-react-components",
- "version": "1.0.2",
+ "version": "1.0.3",
"private": false,
"main": "scripts/index.js",
"types": "scripts/index.d.ts",
diff --git a/packages/react-components/playground/components.d.ts b/packages/react-components/playground/components.d.ts
deleted file mode 100644
index 03fb833..0000000
--- a/packages/react-components/playground/components.d.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-/* generated by farm_plugin_react_components */
-export {}
-declare global {
- const ComponentC: typeof import('./src/components/ComponentC')['ComponentC']
- const ComponentA: typeof import('./src/components/ComponentA')['default']
- const ComponentE: typeof import('./src/components/ComponentE')['default']
- const ComponentF: typeof import('./src/components/ComponentE')['ComponentF']
- const ComponentE: typeof import('./src/components/ComponentE')['ComponentE']
- const ComponentD: typeof import('./src/components/ComponentD')['default']
- const ComponentB: typeof import('./src/components/ComponentB')['ComponentB']
- const ArcoNotification: typeof import('@arco-design/web-react')['Notification']
- const AntDivider: typeof import('antd')['Divider']
- const AntTree: typeof import('antd')['Tree']
- const AntCollapse: typeof import('antd')['Collapse']
- const AntSpin: typeof import('antd')['Spin']
- const AntBreadcrumb: typeof import('antd')['Breadcrumb']
- const AntApp: typeof import('antd')['App']
- const AntUpload: typeof import('antd')['Upload']
- const ArcoBadge: typeof import('@arco-design/web-react')['Badge']
- const ArcoStatistic: typeof import('@arco-design/web-react')['Statistic']
- const ArcoTreeSelect: typeof import('@arco-design/web-react')['TreeSelect']
- const ArcoLayout: typeof import('@arco-design/web-react')['Layout']
- const AntProgress: typeof import('antd')['Progress']
- const ArcoCascader: typeof import('@arco-design/web-react')['Cascader']
- const Antmessage: typeof import('antd')['message']
- const ArcoTransfer: typeof import('@arco-design/web-react')['Transfer']
- const AntCheckbox: typeof import('antd')['Checkbox']
- const ArcoAnchor: typeof import('@arco-design/web-react')['Anchor']
- const ArcoTable: typeof import('@arco-design/web-react')['Table']
- const ArcoTimeline: typeof import('@arco-design/web-react')['Timeline']
- const ArcoLink: typeof import('@arco-design/web-react')['Link']
- const AntPagination: typeof import('antd')['Pagination']
- const AntSegmented: typeof import('antd')['Segmented']
- const AntAvatar: typeof import('antd')['Avatar']
- const ArcoDrawer: typeof import('@arco-design/web-react')['Drawer']
- const AntDrawer: typeof import('antd')['Drawer']
- const ArcoPagination: typeof import('@arco-design/web-react')['Pagination']
- const ArcoIcon: typeof import('@arco-design/web-react')['Icon']
- const AntCol: typeof import('antd')['Col']
- const ArcoEmpty: typeof import('@arco-design/web-react')['Empty']
- const Antnotification: typeof import('antd')['notification']
- const AntTable: typeof import('antd')['Table']
- const ArcoSpin: typeof import('@arco-design/web-react')['Spin']
- const ArcoAutoComplete: typeof import('@arco-design/web-react')['AutoComplete']
- const ArcoCalendar: typeof import('@arco-design/web-react')['Calendar']
- const AntResult: typeof import('antd')['Result']
- const ArcoMenu: typeof import('@arco-design/web-react')['Menu']
- const ArcoSelect: typeof import('@arco-design/web-react')['Select']
- const AntGrid: typeof import('antd')['Grid']
- const AntMentions: typeof import('antd')['Mentions']
- const ArcoTree: typeof import('@arco-design/web-react')['Tree']
- const ArcoCollapse: typeof import('@arco-design/web-react')['Collapse']
- const ArcoBackTop: typeof import('@arco-design/web-react')['BackTop']
- const ArcoGrid: typeof import('@arco-design/web-react')['Grid']
- const AntCalendar: typeof import('antd')['Calendar']
- const AntStatistic: typeof import('antd')['Statistic']
- const AntSwitch: typeof import('antd')['Switch']
- const ArcoRate: typeof import('@arco-design/web-react')['Rate']
- const AntTabs: typeof import('antd')['Tabs']
- const AntTransfer: typeof import('antd')['Transfer']
- const AntRate: typeof import('antd')['Rate']
- const ArcoImage: typeof import('@arco-design/web-react')['Image']
- const ArcoVerificationCode: typeof import('@arco-design/web-react')['VerificationCode']
- const AntAffix: typeof import('antd')['Affix']
- const AntTimeline: typeof import('antd')['Timeline']
- const AntSkeleton: typeof import('antd')['Skeleton']
- const ArcoResizeBox: typeof import('@arco-design/web-react')['ResizeBox']
- const ArcoBreadcrumb: typeof import('@arco-design/web-react')['Breadcrumb']
- const ArcoMessage: typeof import('@arco-design/web-react')['Message']
- const ArcoList: typeof import('@arco-design/web-react')['List']
- const AntAnchor: typeof import('antd')['Anchor']
- const AntMenu: typeof import('antd')['Menu']
- const ArcoUpload: typeof import('@arco-design/web-react')['Upload']
- const AntPopover: typeof import('antd')['Popover']
- const AntTypography: typeof import('antd')['Typography']
- const ArcoAffix: typeof import('@arco-design/web-react')['Affix']
- const ArcoPopconfirm: typeof import('@arco-design/web-react')['Popconfirm']
- const ArcoTypography: typeof import('@arco-design/web-react')['Typography']
- const ArcoInput: typeof import('@arco-design/web-react')['Input']
- const ArcoCheckbox: typeof import('@arco-design/web-react')['Checkbox']
- const AntCarousel: typeof import('antd')['Carousel']
- const AntDropdown: typeof import('antd')['Dropdown']
- const ArcoTrigger: typeof import('@arco-design/web-react')['Trigger']
- const AntModal: typeof import('antd')['Modal']
- const ArcoProgress: typeof import('@arco-design/web-react')['Progress']
- const AntTooltip: typeof import('antd')['Tooltip']
- const ArcoDropdown: typeof import('@arco-design/web-react')['Dropdown']
- const ArcoPopover: typeof import('@arco-design/web-react')['Popover']
- const ArcoSwitch: typeof import('@arco-design/web-react')['Switch']
- const AntAlert: typeof import('antd')['Alert']
- const ArcoResult: typeof import('@arco-design/web-react')['Result']
- const ArcoCarousel: typeof import('@arco-design/web-react')['Carousel']
- const ArcoWatermark: typeof import('@arco-design/web-react')['Watermark']
- const AntSteps: typeof import('antd')['Steps']
- const ArcoMentions: typeof import('@arco-design/web-react')['Mentions']
- const AntForm: typeof import('antd')['Form']
- const AntEmpty: typeof import('antd')['Empty']
- const ArcoInputNumber: typeof import('@arco-design/web-react')['InputNumber']
- const ArcoForm: typeof import('@arco-design/web-react')['Form']
- const ArcoSkeleton: typeof import('@arco-design/web-react')['Skeleton']
- const AntRow: typeof import('antd')['Row']
- const ArcoAlert: typeof import('@arco-design/web-react')['Alert']
- const ArcoTabs: typeof import('@arco-design/web-react')['Tabs']
- const AntTour: typeof import('antd')['Tour']
- const Antversion: typeof import('antd')['version']
- const ArcoPortal: typeof import('@arco-design/web-react')['Portal']
- const AntBadge: typeof import('antd')['Badge']
- const AntTag: typeof import('antd')['Tag']
- const AntDescriptions: typeof import('antd')['Descriptions']
- const AntWatermark: typeof import('antd')['Watermark']
- const ArcoTooltip: typeof import('@arco-design/web-react')['Tooltip']
- const ArcoInputTag: typeof import('@arco-design/web-react')['InputTag']
- const ArcoPageHeader: typeof import('@arco-design/web-react')['PageHeader']
- const AntCard: typeof import('antd')['Card']
- const ArcoButton: typeof import('@arco-design/web-react')['Button']
- const ArcoAvatar: typeof import('@arco-design/web-react')['Avatar']
- const AntButton: typeof import('antd')['Button']
- const AntPopconfirm: typeof import('antd')['Popconfirm']
- const Anttheme: typeof import('antd')['theme']
- const ArcoTag: typeof import('@arco-design/web-react')['Tag']
- const ArcoConfigProvider: typeof import('@arco-design/web-react')['ConfigProvider']
- const ArcoDatePicker: typeof import('@arco-design/web-react')['DatePicker']
- const AntList: typeof import('antd')['List']
- const AntSelect: typeof import('antd')['Select']
- const ArcoCard: typeof import('@arco-design/web-react')['Card']
- const ArcoColorPicker: typeof import('@arco-design/web-react')['ColorPicker']
- const ArcoComment: typeof import('@arco-design/web-react')['Comment']
- const AntLayout: typeof import('antd')['Layout']
- const ArcoSlider: typeof import('@arco-design/web-react')['Slider']
- const ArcoSteps: typeof import('@arco-design/web-react')['Steps']
- const AntSpace: typeof import('antd')['Space']
- const ArcoModal: typeof import('@arco-design/web-react')['Modal']
- const ArcoRadio: typeof import('@arco-design/web-react')['Radio']
- const AntCascader: typeof import('antd')['Cascader']
- const AntFlex: typeof import('antd')['Flex']
- const AntSlider: typeof import('antd')['Slider']
- const ArcoSpace: typeof import('@arco-design/web-react')['Space']
- const AntInput: typeof import('antd')['Input']
- const ArcoDescriptions: typeof import('@arco-design/web-react')['Descriptions']
- const AntRadio: typeof import('antd')['Radio']
- const ArcoDivider: typeof import('@arco-design/web-react')['Divider']
- const AntImage: typeof import('antd')['Image']
- const ArcoTimePicker: typeof import('@arco-design/web-react')['TimePicker']
-}
diff --git a/packages/react-components/playground/farm.config.ts b/packages/react-components/playground/farm.config.ts
index f6dca73..f9e76f1 100644
--- a/packages/react-components/playground/farm.config.ts
+++ b/packages/react-components/playground/farm.config.ts
@@ -15,7 +15,7 @@ export default defineConfig({
["@farmfe/plugin-react-components", {
dts: true,
local: true,
- filename: "./src/types/components.d.ts",
+ filename: "src/types/components.d.ts",
resolvers: [
{
module: "antd",
diff --git a/packages/react-components/playground/src/components/ComponentD.tsx b/packages/react-components/playground/src/components/ComponentD.tsx
index 71d2f3b..7219585 100644
--- a/packages/react-components/playground/src/components/ComponentD.tsx
+++ b/packages/react-components/playground/src/components/ComponentD.tsx
@@ -1,3 +1,8 @@
export default () => {
return
}
+
+const ComponentX = () => {
+ return
+}
+export { ComponentX }
diff --git a/packages/react-components/playground/src/main.tsx b/packages/react-components/playground/src/main.tsx
index a3c287d..ed4dcce 100644
--- a/packages/react-components/playground/src/main.tsx
+++ b/packages/react-components/playground/src/main.tsx
@@ -25,6 +25,7 @@ export function Main() {
+
setCount((count) => count + 1)}>arco button
setCount((count) => count + 1)}>antd button
diff --git a/packages/react-components/playground/src/types/components.d.ts b/packages/react-components/playground/src/types/components.d.ts
index 257b7ba..c86d7b6 100644
--- a/packages/react-components/playground/src/types/components.d.ts
+++ b/packages/react-components/playground/src/types/components.d.ts
@@ -1,144 +1,145 @@
/* generated by farm_plugin_react_components */
export {}
declare global {
- const ComponentE: typeof import('./../components/ComponentE')['ComponentE']
- const ComponentC: typeof import('./../components/ComponentC')['ComponentC']
const ComponentD: typeof import('./../components/ComponentD')['default']
- const ComponentA: typeof import('./../components/ComponentA')['default']
const ComponentF: typeof import('./../components/ComponentE')['ComponentF']
- const ComponentB: typeof import('./../components/ComponentB')['ComponentB']
+ const ComponentC: typeof import('./../components/ComponentC')['ComponentC']
+ const ComponentA: typeof import('./../components/ComponentA')['default']
+ const ComponentX: typeof import('./../components/ComponentD')['ComponentX']
const ComponentE: typeof import('./../components/ComponentE')['default']
+ const ComponentB: typeof import('./../components/ComponentB')['ComponentB']
+ const ComponentE: typeof import('./../components/ComponentE')['ComponentE']
+ const ArcoCheckbox: typeof import('@arco-design/web-react')['Checkbox']
+ const AntResult: typeof import('antd')['Result']
+ const AntList: typeof import('antd')['List']
+ const ArcoWatermark: typeof import('@arco-design/web-react')['Watermark']
+ const ArcoEmpty: typeof import('@arco-design/web-react')['Empty']
+ const ArcoTrigger: typeof import('@arco-design/web-react')['Trigger']
+ const ArcoSpin: typeof import('@arco-design/web-react')['Spin']
+ const ArcoPageHeader: typeof import('@arco-design/web-react')['PageHeader']
+ const AntPopconfirm: typeof import('antd')['Popconfirm']
+ const ArcoSlider: typeof import('@arco-design/web-react')['Slider']
+ const AntInput: typeof import('antd')['Input']
+ const AntRadio: typeof import('antd')['Radio']
+ const AntTooltip: typeof import('antd')['Tooltip']
+ const ArcoDropdown: typeof import('@arco-design/web-react')['Dropdown']
+ const AntSlider: typeof import('antd')['Slider']
+ const AntSpin: typeof import('antd')['Spin']
+ const ArcoMentions: typeof import('@arco-design/web-react')['Mentions']
const ArcoGrid: typeof import('@arco-design/web-react')['Grid']
+ const AntEmpty: typeof import('antd')['Empty']
+ const AntTabs: typeof import('antd')['Tabs']
const AntCard: typeof import('antd')['Card']
- const ArcoDatePicker: typeof import('@arco-design/web-react')['DatePicker']
- const AntBreadcrumb: typeof import('antd')['Breadcrumb']
- const ArcoPopover: typeof import('@arco-design/web-react')['Popover']
const AntTransfer: typeof import('antd')['Transfer']
- const ArcoResizeBox: typeof import('@arco-design/web-react')['ResizeBox']
- const ArcoTable: typeof import('@arco-design/web-react')['Table']
- const ArcoModal: typeof import('@arco-design/web-react')['Modal']
- const ArcoTimeline: typeof import('@arco-design/web-react')['Timeline']
- const AntTree: typeof import('antd')['Tree']
- const ArcoList: typeof import('@arco-design/web-react')['List']
- const Antnotification: typeof import('antd')['notification']
- const ArcoCarousel: typeof import('@arco-design/web-react')['Carousel']
- const ArcoResult: typeof import('@arco-design/web-react')['Result']
- const AntSelect: typeof import('antd')['Select']
- const AntDescriptions: typeof import('antd')['Descriptions']
- const ArcoRate: typeof import('@arco-design/web-react')['Rate']
- const ArcoLayout: typeof import('@arco-design/web-react')['Layout']
- const ArcoTypography: typeof import('@arco-design/web-react')['Typography']
- const ArcoSlider: typeof import('@arco-design/web-react')['Slider']
- const AntFlex: typeof import('antd')['Flex']
- const ArcoBadge: typeof import('@arco-design/web-react')['Badge']
- const ArcoConfigProvider: typeof import('@arco-design/web-react')['ConfigProvider']
- const ArcoDivider: typeof import('@arco-design/web-react')['Divider']
- const AntTimeline: typeof import('antd')['Timeline']
- const AntDropdown: typeof import('antd')['Dropdown']
- const ArcoNotification: typeof import('@arco-design/web-react')['Notification']
- const ArcoPagination: typeof import('@arco-design/web-react')['Pagination']
- const ArcoSelect: typeof import('@arco-design/web-react')['Select']
- const AntAffix: typeof import('antd')['Affix']
- const ArcoSpin: typeof import('@arco-design/web-react')['Spin']
- const AntProgress: typeof import('antd')['Progress']
- const AntSlider: typeof import('antd')['Slider']
+ const Antmessage: typeof import('antd')['message']
+ const AntTag: typeof import('antd')['Tag']
+ const AntUpload: typeof import('antd')['Upload']
+ const AntRow: typeof import('antd')['Row']
const AntCheckbox: typeof import('antd')['Checkbox']
+ const ArcoRate: typeof import('@arco-design/web-react')['Rate']
+ const ArcoDescriptions: typeof import('@arco-design/web-react')['Descriptions']
+ const ArcoTreeSelect: typeof import('@arco-design/web-react')['TreeSelect']
const AntForm: typeof import('antd')['Form']
- const AntPopover: typeof import('antd')['Popover']
- const Anttheme: typeof import('antd')['theme']
- const ArcoCalendar: typeof import('@arco-design/web-react')['Calendar']
- const Antversion: typeof import('antd')['version']
- const ArcoInputNumber: typeof import('@arco-design/web-react')['InputNumber']
+ const AntPagination: typeof import('antd')['Pagination']
+ const ArcoPortal: typeof import('@arco-design/web-react')['Portal']
+ const ArcoTable: typeof import('@arco-design/web-react')['Table']
const ArcoSpace: typeof import('@arco-design/web-react')['Space']
- const ArcoForm: typeof import('@arco-design/web-react')['Form']
- const ArcoAvatar: typeof import('@arco-design/web-react')['Avatar']
- const AntDivider: typeof import('antd')['Divider']
- const ArcoLink: typeof import('@arco-design/web-react')['Link']
- const AntTabs: typeof import('antd')['Tabs']
- const AntMenu: typeof import('antd')['Menu']
- const ArcoInputTag: typeof import('@arco-design/web-react')['InputTag']
- const AntAlert: typeof import('antd')['Alert']
- const AntAvatar: typeof import('antd')['Avatar']
- const AntCollapse: typeof import('antd')['Collapse']
- const AntSteps: typeof import('antd')['Steps']
- const AntMentions: typeof import('antd')['Mentions']
- const ArcoDescriptions: typeof import('@arco-design/web-react')['Descriptions']
- const AntCol: typeof import('antd')['Col']
- const ArcoAnchor: typeof import('@arco-design/web-react')['Anchor']
- const ArcoTooltip: typeof import('@arco-design/web-react')['Tooltip']
- const ArcoImage: typeof import('@arco-design/web-react')['Image']
const AntRate: typeof import('antd')['Rate']
- const ArcoDropdown: typeof import('@arco-design/web-react')['Dropdown']
- const AntResult: typeof import('antd')['Result']
- const AntTable: typeof import('antd')['Table']
- const AntInput: typeof import('antd')['Input']
- const ArcoTransfer: typeof import('@arco-design/web-react')['Transfer']
- const ArcoMenu: typeof import('@arco-design/web-react')['Menu']
- const AntSwitch: typeof import('antd')['Switch']
- const AntTooltip: typeof import('antd')['Tooltip']
- const ArcoPageHeader: typeof import('@arco-design/web-react')['PageHeader']
- const ArcoMentions: typeof import('@arco-design/web-react')['Mentions']
- const AntAnchor: typeof import('antd')['Anchor']
- const ArcoInput: typeof import('@arco-design/web-react')['Input']
- const AntCalendar: typeof import('antd')['Calendar']
- const ArcoTag: typeof import('@arco-design/web-react')['Tag']
- const ArcoProgress: typeof import('@arco-design/web-react')['Progress']
- const AntSegmented: typeof import('antd')['Segmented']
- const AntSpin: typeof import('antd')['Spin']
- const ArcoCheckbox: typeof import('@arco-design/web-react')['Checkbox']
- const ArcoAlert: typeof import('@arco-design/web-react')['Alert']
+ const AntMentions: typeof import('antd')['Mentions']
+ const AntTree: typeof import('antd')['Tree']
const AntModal: typeof import('antd')['Modal']
- const ArcoBackTop: typeof import('@arco-design/web-react')['BackTop']
- const ArcoBreadcrumb: typeof import('@arco-design/web-react')['Breadcrumb']
+ const AntWatermark: typeof import('antd')['Watermark']
+ const ArcoCalendar: typeof import('@arco-design/web-react')['Calendar']
+ const ArcoImage: typeof import('@arco-design/web-react')['Image']
const ArcoCascader: typeof import('@arco-design/web-react')['Cascader']
- const ArcoRadio: typeof import('@arco-design/web-react')['Radio']
- const AntApp: typeof import('antd')['App']
- const AntDrawer: typeof import('antd')['Drawer']
+ const Anttheme: typeof import('antd')['theme']
+ const ArcoTimePicker: typeof import('@arco-design/web-react')['TimePicker']
const ArcoDrawer: typeof import('@arco-design/web-react')['Drawer']
- const ArcoTrigger: typeof import('@arco-design/web-react')['Trigger']
- const AntSpace: typeof import('antd')['Space']
+ const AntTable: typeof import('antd')['Table']
+ const AntButton: typeof import('antd')['Button']
+ const AntSwitch: typeof import('antd')['Switch']
+ const ArcoAutoComplete: typeof import('@arco-design/web-react')['AutoComplete']
+ const ArcoDatePicker: typeof import('@arco-design/web-react')['DatePicker']
+ const ArcoTimeline: typeof import('@arco-design/web-react')['Timeline']
+ const AntCollapse: typeof import('antd')['Collapse']
+ const ArcoSwitch: typeof import('@arco-design/web-react')['Switch']
const AntTypography: typeof import('antd')['Typography']
- const AntSkeleton: typeof import('antd')['Skeleton']
- const AntList: typeof import('antd')['List']
- const AntRadio: typeof import('antd')['Radio']
const AntStatistic: typeof import('antd')['Statistic']
+ const ArcoLayout: typeof import('@arco-design/web-react')['Layout']
+ const AntSteps: typeof import('antd')['Steps']
+ const ArcoSteps: typeof import('@arco-design/web-react')['Steps']
+ const AntSkeleton: typeof import('antd')['Skeleton']
+ const ArcoProgress: typeof import('@arco-design/web-react')['Progress']
+ const ArcoAnchor: typeof import('@arco-design/web-react')['Anchor']
const ArcoButton: typeof import('@arco-design/web-react')['Button']
- const AntTag: typeof import('antd')['Tag']
+ const AntDivider: typeof import('antd')['Divider']
+ const ArcoCollapse: typeof import('@arco-design/web-react')['Collapse']
+ const ArcoPagination: typeof import('@arco-design/web-react')['Pagination']
+ const ArcoStatistic: typeof import('@arco-design/web-react')['Statistic']
+ const ArcoResult: typeof import('@arco-design/web-react')['Result']
+ const AntDropdown: typeof import('antd')['Dropdown']
+ const AntTimeline: typeof import('antd')['Timeline']
const AntBadge: typeof import('antd')['Badge']
- const ArcoCard: typeof import('@arco-design/web-react')['Card']
+ const AntCol: typeof import('antd')['Col']
+ const AntAlert: typeof import('antd')['Alert']
+ const AntPopover: typeof import('antd')['Popover']
+ const ArcoTag: typeof import('@arco-design/web-react')['Tag']
+ const AntGrid: typeof import('antd')['Grid']
+ const ArcoInputTag: typeof import('@arco-design/web-react')['InputTag']
+ const ArcoPopconfirm: typeof import('@arco-design/web-react')['Popconfirm']
const AntCascader: typeof import('antd')['Cascader']
- const ArcoCollapse: typeof import('@arco-design/web-react')['Collapse']
- const AntPopconfirm: typeof import('antd')['Popconfirm']
+ const ArcoBreadcrumb: typeof import('@arco-design/web-react')['Breadcrumb']
+ const AntApp: typeof import('antd')['App']
+ const ArcoSkeleton: typeof import('@arco-design/web-react')['Skeleton']
+ const ArcoList: typeof import('@arco-design/web-react')['List']
+ const ArcoTree: typeof import('@arco-design/web-react')['Tree']
const ArcoUpload: typeof import('@arco-design/web-react')['Upload']
- const ArcoPopconfirm: typeof import('@arco-design/web-react')['Popconfirm']
- const ArcoComment: typeof import('@arco-design/web-react')['Comment']
- const ArcoSteps: typeof import('@arco-design/web-react')['Steps']
- const AntPagination: typeof import('antd')['Pagination']
- const ArcoTabs: typeof import('@arco-design/web-react')['Tabs']
+ const AntImage: typeof import('antd')['Image']
+ const AntSelect: typeof import('antd')['Select']
+ const ArcoTooltip: typeof import('@arco-design/web-react')['Tooltip']
+ const ArcoAlert: typeof import('@arco-design/web-react')['Alert']
+ const ArcoDivider: typeof import('@arco-design/web-react')['Divider']
+ const ArcoCard: typeof import('@arco-design/web-react')['Card']
const AntCarousel: typeof import('antd')['Carousel']
- const AntWatermark: typeof import('antd')['Watermark']
- const ArcoTree: typeof import('@arco-design/web-react')['Tree']
+ const ArcoInput: typeof import('@arco-design/web-react')['Input']
+ const ArcoResizeBox: typeof import('@arco-design/web-react')['ResizeBox']
+ const ArcoBadge: typeof import('@arco-design/web-react')['Badge']
+ const AntDrawer: typeof import('antd')['Drawer']
+ const AntCalendar: typeof import('antd')['Calendar']
+ const ArcoBackTop: typeof import('@arco-design/web-react')['BackTop']
+ const AntProgress: typeof import('antd')['Progress']
const ArcoMessage: typeof import('@arco-design/web-react')['Message']
- const ArcoSkeleton: typeof import('@arco-design/web-react')['Skeleton']
- const AntEmpty: typeof import('antd')['Empty']
+ const Antversion: typeof import('antd')['version']
+ const AntSpace: typeof import('antd')['Space']
+ const ArcoNotification: typeof import('@arco-design/web-react')['Notification']
+ const AntMenu: typeof import('antd')['Menu']
+ const ArcoSelect: typeof import('@arco-design/web-react')['Select']
+ const ArcoTransfer: typeof import('@arco-design/web-react')['Transfer']
+ const AntAvatar: typeof import('antd')['Avatar']
+ const ArcoRadio: typeof import('@arco-design/web-react')['Radio']
+ const ArcoAvatar: typeof import('@arco-design/web-react')['Avatar']
+ const AntFlex: typeof import('antd')['Flex']
+ const ArcoComment: typeof import('@arco-design/web-react')['Comment']
+ const AntBreadcrumb: typeof import('antd')['Breadcrumb']
+ const ArcoMenu: typeof import('@arco-design/web-react')['Menu']
const AntTour: typeof import('antd')['Tour']
- const AntUpload: typeof import('antd')['Upload']
- const ArcoAutoComplete: typeof import('@arco-design/web-react')['AutoComplete']
- const Antmessage: typeof import('antd')['message']
+ const ArcoCarousel: typeof import('@arco-design/web-react')['Carousel']
+ const ArcoAffix: typeof import('@arco-design/web-react')['Affix']
const ArcoIcon: typeof import('@arco-design/web-react')['Icon']
- const ArcoPortal: typeof import('@arco-design/web-react')['Portal']
- const AntButton: typeof import('antd')['Button']
- const ArcoSwitch: typeof import('@arco-design/web-react')['Switch']
- const ArcoTreeSelect: typeof import('@arco-design/web-react')['TreeSelect']
- const ArcoColorPicker: typeof import('@arco-design/web-react')['ColorPicker']
- const AntGrid: typeof import('antd')['Grid']
- const AntRow: typeof import('antd')['Row']
- const AntImage: typeof import('antd')['Image']
- const ArcoEmpty: typeof import('@arco-design/web-react')['Empty']
- const ArcoWatermark: typeof import('@arco-design/web-react')['Watermark']
- const AntLayout: typeof import('antd')['Layout']
+ const AntAnchor: typeof import('antd')['Anchor']
+ const ArcoInputNumber: typeof import('@arco-design/web-react')['InputNumber']
+ const ArcoForm: typeof import('@arco-design/web-react')['Form']
const ArcoVerificationCode: typeof import('@arco-design/web-react')['VerificationCode']
- const ArcoTimePicker: typeof import('@arco-design/web-react')['TimePicker']
- const ArcoAffix: typeof import('@arco-design/web-react')['Affix']
- const ArcoStatistic: typeof import('@arco-design/web-react')['Statistic']
+ const ArcoModal: typeof import('@arco-design/web-react')['Modal']
+ const ArcoTypography: typeof import('@arco-design/web-react')['Typography']
+ const ArcoConfigProvider: typeof import('@arco-design/web-react')['ConfigProvider']
+ const ArcoPopover: typeof import('@arco-design/web-react')['Popover']
+ const AntLayout: typeof import('antd')['Layout']
+ const ArcoColorPicker: typeof import('@arco-design/web-react')['ColorPicker']
+ const AntSegmented: typeof import('antd')['Segmented']
+ const Antnotification: typeof import('antd')['notification']
+ const AntAffix: typeof import('antd')['Affix']
+ const AntDescriptions: typeof import('antd')['Descriptions']
+ const ArcoTabs: typeof import('@arco-design/web-react')['Tabs']
+ const ArcoLink: typeof import('@arco-design/web-react')['Link']
}
diff --git a/packages/react-components/src/finish_components.rs b/packages/react-components/src/finish_components.rs
new file mode 100644
index 0000000..2a96288
--- /dev/null
+++ b/packages/react-components/src/finish_components.rs
@@ -0,0 +1,42 @@
+use std::collections::HashSet;
+
+use farmfe_core::config::config_regex::ConfigRegex;
+
+use crate::find_local_components::{find_local_components, ComponentInfo};
+use crate::generate_dts::generate_dts;
+use crate::generate_dts::GenerateDtsOption;
+use crate::resolvers::{get_resolvers_result, ResolverOption};
+
+pub struct FinishComponentsParams {
+ pub root_path: String,
+ pub resolvers: Vec,
+ pub dirs: Vec,
+ pub filename: String,
+ pub local: bool,
+ pub dts: bool,
+}
+
+pub fn finish_components(params: FinishComponentsParams) -> HashSet {
+ let FinishComponentsParams {
+ root_path,
+ resolvers,
+ dirs,
+ filename,
+ local,
+ dts,
+ } = params;
+ let mut local_components = find_local_components(&root_path, dirs);
+ let resolvers_components = get_resolvers_result(&root_path, resolvers);
+ let generate_dts_option = GenerateDtsOption {
+ filename,
+ root_path: root_path.clone(),
+ components: &local_components.iter().collect::>(),
+ resolvers_components: &resolvers_components.iter().collect::>(),
+ local,
+ };
+ if dts {
+ generate_dts(generate_dts_option);
+ }
+ local_components.extend(resolvers_components);
+ local_components
+}
diff --git a/packages/react-components/src/generate_dts.rs b/packages/react-components/src/generate_dts.rs
index 8273c3c..e84dab3 100644
--- a/packages/react-components/src/generate_dts.rs
+++ b/packages/react-components/src/generate_dts.rs
@@ -94,10 +94,7 @@ fn create_file>(file_path: P) -> io::Result {
#[cfg(test)]
mod tests {
use super::*;
- use crate::{
- find_local_components::find_local_components,
- resolvers::{get_resolvers_result, ImportStyle, ResolverOption},
- };
+ use crate::{find_local_components::find_local_components, resolvers::get_resolvers_result};
use std::env;
#[test]
fn test_generate_dts() {
diff --git a/packages/react-components/src/insert_import.rs b/packages/react-components/src/insert_import.rs
index b8295b4..f9b011c 100644
--- a/packages/react-components/src/insert_import.rs
+++ b/packages/react-components/src/insert_import.rs
@@ -1,7 +1,11 @@
use farmfe_core::{config::TargetEnv, swc_common::DUMMY_SP, swc_ecma_ast::*};
use farmfe_toolkit::swc_ecma_visit::{VisitMut, VisitMutWith};
use farmfe_utils::relative;
-use std::{collections::HashSet, path::Path};
+use std::{
+ collections::HashSet,
+ path::Path,
+ sync::{Arc, Mutex},
+};
use crate::{
find_local_components::{ComponentInfo, ExportType},
@@ -9,12 +13,12 @@ use crate::{
ImportMode,
};
pub struct ImportModifier {
- pub components: HashSet,
+ components: Arc>>,
pub used_components: HashSet,
}
impl ImportModifier {
- pub fn new(components: HashSet) -> Self {
+ pub fn new(components: Arc>>) -> Self {
Self {
components,
used_components: HashSet::new(),
@@ -24,13 +28,12 @@ impl ImportModifier {
impl VisitMut for ImportModifier {
fn visit_mut_import_decl(&mut self, n: &mut ImportDecl) {
+ let mut components = self.components.lock().unwrap();
for specifier in &n.specifiers {
match specifier {
ImportSpecifier::Default(default_spec) => {
let imported_name = default_spec.local.sym.as_ref();
- self
- .components
- .retain(|c: &ComponentInfo| &c.name != imported_name);
+ components.retain(|c: &ComponentInfo| &c.name != imported_name);
}
ImportSpecifier::Named(named_spec) => {
@@ -41,8 +44,7 @@ impl VisitMut for ImportModifier {
},
None => named_spec.local.sym.as_ref(),
};
- self
- .components
+ components
.retain(|c| &c.name != imported_name || c.name != named_spec.local.sym.as_ref());
}
_ => {}
@@ -57,9 +59,9 @@ impl VisitMut for ImportModifier {
.next()
.map_or(false, |c| c.is_uppercase())
{
- let item = self.components.iter().find(|c| c.name == component_name);
+ let item = self.components.lock().unwrap().iter().find(|c| c.name == component_name).cloned();
if let Some(item) = item {
- self.used_components.insert(item.clone());
+ self.used_components.insert(item);
}
}
}
diff --git a/packages/react-components/src/lib.rs b/packages/react-components/src/lib.rs
index 303047c..9910f63 100644
--- a/packages/react-components/src/lib.rs
+++ b/packages/react-components/src/lib.rs
@@ -1,11 +1,16 @@
#![deny(clippy::all)]
#![feature(box_patterns)]
pub mod find_local_components;
+pub mod finish_components;
pub mod generate_dts;
pub mod insert_import;
pub mod resolvers;
-use std::{collections::HashSet, path::PathBuf, sync::Arc};
+use std::{
+ collections::HashSet,
+ path::PathBuf,
+ sync::{Arc, Mutex},
+};
use farmfe_core::{
config::{config_regex::ConfigRegex, Config},
@@ -21,10 +26,10 @@ use farmfe_toolkit::{
script::{codegen_module, parse_module, CodeGenCommentsConfig, ParseScriptModuleResult},
swc_ecma_visit::VisitMutWith,
};
-use find_local_components::{find_local_components, ComponentInfo};
-use generate_dts::{generate_dts, GenerateDtsOption};
+use find_local_components::ComponentInfo;
+use finish_components::{finish_components, FinishComponentsParams};
use insert_import::{ImportModifier, InsertImportModifier};
-use resolvers::{get_resolvers_result, ResolverOption};
+use resolvers::ResolverOption;
#[derive(serde::Deserialize, serde::Serialize, Clone, Debug)]
pub enum ImportMode {
@@ -49,31 +54,28 @@ pub struct Options {
#[farm_plugin]
pub struct FarmPluginReactComponents {
options: Options,
- components: HashSet,
+ components: Arc>>,
}
impl FarmPluginReactComponents {
pub fn new(config: &Config, options: String) -> Self {
let options: Options = serde_json::from_str(&options).unwrap();
- let mut components =
- find_local_components(&config.root, options.dirs.clone().unwrap_or(vec![]));
- let resolvers_components = get_resolvers_result(
- &config.root.clone(),
- options.resolvers.clone().unwrap_or(vec![]),
- );
- let local_components = components.clone();
- let generate_dts_option = GenerateDtsOption {
- root_path: config.root.clone(),
- components: &local_components.iter().collect::>(),
- filename: options.filename.clone().unwrap_or("components.d.ts".to_string()),
- resolvers_components: &resolvers_components.iter().collect::>(),
+ let resolvers = options.resolvers.clone().unwrap_or(vec![]);
+ let filename = options
+ .filename
+ .clone()
+ .unwrap_or("components.d.ts".to_string());
+ let dirs = options.dirs.clone().unwrap_or(vec![]);
+ let root_path = config.root.clone();
+ let components = finish_components(FinishComponentsParams {
+ root_path,
+ resolvers,
+ dirs,
+ filename,
local: options.local.unwrap_or(true),
- };
- let dts = options.dts.unwrap_or(true);
- if dts {
- generate_dts(generate_dts_option)
- }
- components.extend(resolvers_components);
+ dts: options.dts.unwrap_or(true),
+ });
+ let components = Arc::new(Mutex::new(components));
Self {
options,
components,
@@ -164,4 +166,28 @@ impl Plugin for FarmPluginReactComponents {
ignore_previous_source_map: false,
}))
}
+
+ fn update_finished(
+ &self,
+ context: &Arc,
+ ) -> farmfe_core::error::Result