Skip to content

Commit d92c50a

Browse files
authored
feat: auto import css plugin (#2613)
* feat: add * feat: 修复类型问题,修改测试用例 * feat: 修复类型问题,修改测试用例 * feat: 树摇支持按需引入 css * feat: 增加说明文件 * chore: delete .vite * chore: merge branch 'V3.0' into feat/taro-plugin # Conflicts: # pnpm-lock.yaml * chore: merge branch 'V3.0' into feat/taro-plugin # Conflicts: # pnpm-lock.yaml * chore: merge branch 'V3.0' into feat/taro-plugin # Conflicts: # pnpm-lock.yaml * chore: merge branch 'V3.0' into feat/taro-plugin # Conflicts: # pnpm-lock.yaml * chore: merge branch 'V3.0' into feat/taro-plugin # Conflicts: # pnpm-lock.yaml * test: merge # Conflicts: # pnpm-lock.yaml * test: merge # Conflicts: # pnpm-lock.yaml * test: merge # Conflicts: # pnpm-lock.yaml * test: merge # Conflicts: # pnpm-lock.yaml * chore: update package
1 parent bec0315 commit d92c50a

27 files changed

+7564
-63
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
.idea
44
.eslintcache
5+
.vite
56
/dist
67
/dist-demo
78
/libs

.vite/deps_temp_67a06ddd/package.json

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
end_of_line = lf
6+
insert_final_newline = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
*.log
5+
.vercel
6+
.eslintcache

packages/nutui-auto-import/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright © 2024-PRESENT 三咲智子 (https://github.com/sxzz)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# @nutui/nutui-react-auto-import
2+
3+
按需引入组件的样式文件。
4+
5+
支持情况参考 [https://unplugin.unjs.io/guide/](https://unplugin.unjs.io/guide/)
6+
7+
## 使用方式
8+
9+
vite
10+
11+
```js
12+
import NutUIAutoImport from '@nutui/nutui-react-auto-import/vite'
13+
import { defineConfig } from 'vite'
14+
15+
export default defineConfig({
16+
plugins: [
17+
NutUIAutoImport({
18+
libraryName: '@nutui/nutui-react',
19+
style: 'css',
20+
}),
21+
],
22+
})
23+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-react"]
3+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"name": "@nutui/nutui-react-auto-import",
3+
"version": "0.0.1",
4+
"packageManager": "[email protected]",
5+
"description": "NutUI React 组件的自动导入插件,支持多种构建工具如 Vite、Webpack、Rollup 等。",
6+
"type": "module",
7+
"keywords": [
8+
"unplugin",
9+
"rollup",
10+
"vite",
11+
"esbuild",
12+
"webpack"
13+
],
14+
"license": "MIT",
15+
"homepage": "https://github.com/jdf2e/nutui-react.git",
16+
"bugs": {
17+
"url": "https://github.com/jdf2e/nutui-react.git"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/jdf2e/nutui-react.git"
22+
},
23+
"author": "oasis",
24+
"files": [
25+
"dist"
26+
],
27+
"main": "./dist/index.js",
28+
"module": "./dist/index.js",
29+
"types": "./dist/index.d.ts",
30+
"exports": {
31+
".": {
32+
"require": "./dist/index.cjs",
33+
"import": "./dist/index.js"
34+
},
35+
"./vite": {
36+
"require": "./dist/vite.cjs",
37+
"import": "./dist/vite.js"
38+
},
39+
"./webpack": {
40+
"require": "./dist/webpack.cjs",
41+
"import": "./dist/webpack.js"
42+
},
43+
"./rspack": {
44+
"require": "./dist/rspack.cjs",
45+
"import": "./dist/rspack.js"
46+
},
47+
"./rollup": {
48+
"require": "./dist/rollup.cjs",
49+
"import": "./dist/rollup.js"
50+
},
51+
"./rolldown": {
52+
"require": "./dist/rolldown.cjs",
53+
"import": "./dist/rolldown.js"
54+
},
55+
"./esbuild": {
56+
"require": "./dist/esbuild.cjs",
57+
"import": "./dist/esbuild.js"
58+
},
59+
"./api": {
60+
"require": "./dist/api.cjs",
61+
"import": "./dist/api.js"
62+
},
63+
"./*": [
64+
"./*",
65+
"./*.d.ts"
66+
]
67+
},
68+
"typesVersions": {
69+
"*": {
70+
"*": [
71+
"./dist/*",
72+
"./*"
73+
]
74+
}
75+
},
76+
"publishConfig": {
77+
"access": "public"
78+
},
79+
"scripts": {
80+
"lint": "eslint --cache .",
81+
"lint:fix": "pnpm run lint --fix",
82+
"build": "tsup",
83+
"dev": "tsup --watch",
84+
"test": "vitest",
85+
"typecheck": "tsc --noEmit",
86+
"release": "bumpp && pnpm publish",
87+
"prepublishOnly": "pnpm run build"
88+
},
89+
"dependencies": {
90+
"@rollup/pluginutils": "^5.1.1",
91+
"@types/babel__traverse": "^7.20.6",
92+
"estree-walker": "^3.0.3",
93+
"magic-string": "^0.30.11",
94+
"unplugin": "^1.14.1"
95+
},
96+
"devDependencies": {
97+
"@nutui/nutui-react": "^2.6.22",
98+
"@babel/core": "^7.25.8",
99+
"@babel/preset-react": "^7.25.7",
100+
"@rollup/plugin-babel": "^6.0.4",
101+
"@sxzz/eslint-config": "^4.2.0",
102+
"@sxzz/prettier-config": "^2.0.2",
103+
"@sxzz/test-utils": "^0.3.2",
104+
"@types/node": "^22.5.5",
105+
"bumpp": "^9.5.2",
106+
"eslint": "^9.11.0",
107+
"fast-glob": "^3.3.2",
108+
"prettier": "^3.3.3",
109+
"tsup": "^8.3.0",
110+
"tsx": "^4.19.1",
111+
"typescript": "^5.6.2",
112+
"vite": "^5.4.7",
113+
"vitest": "^2.1.1"
114+
},
115+
"engines": {
116+
"node": ">=18.12.0"
117+
}
118+
}

0 commit comments

Comments
 (0)