Skip to content

Commit

Permalink
feat: auto import css plugin (#2613)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
oasis-cloud authored Nov 10, 2024
1 parent bec0315 commit d92c50a
Show file tree
Hide file tree
Showing 27 changed files with 7,564 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
.idea
.eslintcache
.vite
/dist
/dist-demo
/libs
Expand Down
3 changes: 0 additions & 3 deletions .vite/deps_temp_67a06ddd/package.json

This file was deleted.

6 changes: 6 additions & 0 deletions packages/nutui-auto-import/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
indent_size = 2
end_of_line = lf
insert_final_newline = true
1 change: 1 addition & 0 deletions packages/nutui-auto-import/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
6 changes: 6 additions & 0 deletions packages/nutui-auto-import/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.DS_Store
dist
*.log
.vercel
.eslintcache
21 changes: 21 additions & 0 deletions packages/nutui-auto-import/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright © 2024-PRESENT 三咲智子 (https://github.com/sxzz)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions packages/nutui-auto-import/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# @nutui/nutui-react-auto-import

按需引入组件的样式文件。

支持情况参考 [https://unplugin.unjs.io/guide/](https://unplugin.unjs.io/guide/)

## 使用方式

vite

```js
import NutUIAutoImport from '@nutui/nutui-react-auto-import/vite'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
NutUIAutoImport({
libraryName: '@nutui/nutui-react',
style: 'css',
}),
],
})
```
3 changes: 3 additions & 0 deletions packages/nutui-auto-import/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-react"]
}
118 changes: 118 additions & 0 deletions packages/nutui-auto-import/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"name": "@nutui/nutui-react-auto-import",
"version": "0.0.1",
"packageManager": "pnpm@9.11.0",
"description": "NutUI React 组件的自动导入插件,支持多种构建工具如 Vite、Webpack、Rollup 等。",
"type": "module",
"keywords": [
"unplugin",
"rollup",
"vite",
"esbuild",
"webpack"
],
"license": "MIT",
"homepage": "https://github.com/jdf2e/nutui-react.git",
"bugs": {
"url": "https://github.com/jdf2e/nutui-react.git"
},
"repository": {
"type": "git",
"url": "https://github.com/jdf2e/nutui-react.git"
},
"author": "oasis",
"files": [
"dist"
],
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.js"
},
"./vite": {
"require": "./dist/vite.cjs",
"import": "./dist/vite.js"
},
"./webpack": {
"require": "./dist/webpack.cjs",
"import": "./dist/webpack.js"
},
"./rspack": {
"require": "./dist/rspack.cjs",
"import": "./dist/rspack.js"
},
"./rollup": {
"require": "./dist/rollup.cjs",
"import": "./dist/rollup.js"
},
"./rolldown": {
"require": "./dist/rolldown.cjs",
"import": "./dist/rolldown.js"
},
"./esbuild": {
"require": "./dist/esbuild.cjs",
"import": "./dist/esbuild.js"
},
"./api": {
"require": "./dist/api.cjs",
"import": "./dist/api.js"
},
"./*": [
"./*",
"./*.d.ts"
]
},
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./*"
]
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"lint": "eslint --cache .",
"lint:fix": "pnpm run lint --fix",
"build": "tsup",
"dev": "tsup --watch",
"test": "vitest",
"typecheck": "tsc --noEmit",
"release": "bumpp && pnpm publish",
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@rollup/pluginutils": "^5.1.1",
"@types/babel__traverse": "^7.20.6",
"estree-walker": "^3.0.3",
"magic-string": "^0.30.11",
"unplugin": "^1.14.1"
},
"devDependencies": {
"@nutui/nutui-react": "^2.6.22",
"@babel/core": "^7.25.8",
"@babel/preset-react": "^7.25.7",
"@rollup/plugin-babel": "^6.0.4",
"@sxzz/eslint-config": "^4.2.0",
"@sxzz/prettier-config": "^2.0.2",
"@sxzz/test-utils": "^0.3.2",
"@types/node": "^22.5.5",
"bumpp": "^9.5.2",
"eslint": "^9.11.0",
"fast-glob": "^3.3.2",
"prettier": "^3.3.3",
"tsup": "^8.3.0",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"vite": "^5.4.7",
"vitest": "^2.1.1"
},
"engines": {
"node": ">=18.12.0"
}
}
Loading

0 comments on commit d92c50a

Please sign in to comment.