forked from kubesphere/kube-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.plugin.import.js
43 lines (40 loc) · 1.06 KB
/
babel.plugin.import.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const GROUPS = {
Checkbox: "Checkbox",
CheckboxGroup: "Checkbox",
Input: "Input",
InputSearch: "Input",
InputPassword: "Input",
Columns: "Layout",
Column: "Layout",
Level: "Layout",
LevelLeft: "Layout",
LevelRight: "Layout",
LevelItem: "Layout",
Radio: "Radio",
RadioGroup: "Radio",
RadioButton: "Radio",
};
const NO_STYLES = ["LocaleProvider"];
module.exports = ({ moduleType = "esm" } = {}) => {
const packageName = "@kube-design/components";
return {
libraryName: packageName,
camel2DashComponentName: false,
customName: (name) => {
if (GROUPS[name]) {
return `${packageName}/${moduleType}/components/${GROUPS[name]}/${name}`;
}
return `${packageName}/${moduleType}/components/${name}`;
},
style: (name) => {
const endName = name.split("/").pop();
if (NO_STYLES.includes(endName)) {
return false;
}
if (GROUPS[endName]) {
return `${packageName}/${moduleType}/components/${GROUPS[endName]}/styles.scss`;
}
return `${name}/styles.scss`;
},
};
};