swc-plugin-add-display-name 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Automatically add `displayName` to *top-level* React *functional* components.
|
|
4
4
|
- ✅ `const Component = () => <jsx />`
|
|
5
5
|
- ✅ `function Component() { return <jsx /> }`
|
|
6
|
+
- ✅ `const Component = () => jsx("div", { children: "hello" })` (Compiled JSX code)
|
|
7
|
+
- ✅ `const Component = () => React.createElement("div", null, "hello")` (Compiled or hand-written JSX code)
|
|
6
8
|
- ❌ `const Context = createContext()`
|
|
7
9
|
|
|
8
10
|
> If you have other situations that needs to add `displayName`, feel free to open an issue or PR!
|
|
@@ -83,6 +85,15 @@ export function Component() { return <div />; }
|
|
|
83
85
|
Component.displayName = "Component";
|
|
84
86
|
```
|
|
85
87
|
|
|
88
|
+
```tsx
|
|
89
|
+
// Before
|
|
90
|
+
export const Component = () => jsx("div", { children: "hello" });
|
|
91
|
+
|
|
92
|
+
// After
|
|
93
|
+
export const Component = () => jsx("div", { children: "hello" });
|
|
94
|
+
Component.displayName = "Component";
|
|
95
|
+
```
|
|
96
|
+
|
|
86
97
|
## License
|
|
87
98
|
|
|
88
99
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swc-plugin-add-display-name",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An SWC plugin to add displayName to React components",
|
|
5
5
|
"author": "hjkcai <huajingkun1214@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"prepublishOnly": "cargo build-wasi --release"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@swc/core": "^1.
|
|
19
|
+
"@swc/core": "^1.14.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@swc/cli": "^0.6.0",
|
|
23
|
-
"@swc/core": "^1.
|
|
23
|
+
"@swc/core": "^1.14.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
Binary file
|