This commit is contained in:
2026-11-29 08:33:05 +08:00
parent 6377409adc
commit 853c947a25
4 changed files with 106 additions and 15 deletions
+18 -12
View File
@@ -13,22 +13,13 @@
"docs/[^.]*",
"doc/[^.]*"
],
"module": "index.js",
"typings": "index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs.js"
}
},
"./index.css": "./dist/index.css"
},
"scripts": {
"build": "tsc --project tsconfig.build.json"
"build": "vite build && tsc --project tsconfig.build.json"
},
"dependencies": {
"@floating-ui/react": "^0.27.20",
@@ -37,7 +28,22 @@
"devDependencies": {
"@types/node": "^26.6.6",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0"
"@types/react-dom": "^19.3.0",
"@babel/core": "^7.29.13",
"@eslint/js": "^10.0.1",
"@rolldown/plugin-babel": "^0.3.1",
"@types/babel__core": "^7.20.5",
"@vitejs/devtools": "^0.8.3",
"@vitejs/devtools-rolldown": "^0.8.3",
"@vitejs/devtools-vite": "^0.8.3",
"@vitejs/plugin-react": "^6.3.0",
"babel-plugin-react-compiler": "^1.0.0",
"eslint": "^10.15.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.8",
"globals": "^17.14.0",
"typescript": "~6.0.3",
"typescript-eslint": "^8.73.0"
},
"peerDependencies": {
"react": "^19.3.1",
+5 -3
View File
@@ -9,10 +9,12 @@
"module": "esnext",
// 所有项目必须开,兼容 es 和 cjs 导入,允许 import React from 'react' ,而非 import * as React 。
"esModuleInterop": true,
// 允许导入 ts,tsx 扩展名,include 里可以省略后缀。
// 允许导入 ts,tsx 扩展名。
"allowImportingTsExtensions": true,
// 允许 js,jsx 扩展名,include 里可以省略后缀。
// 允许导入 js,jsx 扩展名。
"allowJs": true,
// 允许导入 json 模块,而不只是 ts,js,css 。
"resolveJsonModule": true,
// 启用装饰器,也就是 @XXX 注解。
"experimentalDecorators": true,
// 发射装饰器元数据。
@@ -37,7 +39,7 @@
"incremental": true
},
// 本配置文件的作用范围,包含根目录下的一切文件,包括 vite.config.ts 等配置文件
"include": ["**/*.ts",],
"include": ["**/*.ts", "*/*.tsx"],
// 本配置文件排除的范围。
"exclude": [
"node_modules",
+38
View File
@@ -0,0 +1,38 @@
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import babel from "@rolldown/plugin-babel";
import { defineConfig } from "vite";
import { resolve } from "path";
import pkg from "./package.json" with { type: "json" };
// https://vite.dev/config/
export default defineConfig({
devtools: {
// Remove this `apply` property to enable devtools for build as well
// apply: 'serve',
},
plugins: [react(), babel({ presets: [reactCompilerPreset()] })],
build: {
// Must write, vite/css-minify cannot recognize some ruler
cssMinify: false,
lib: {
entry: resolve(import.meta.dirname, "src/index.ts"),
name: "ui-react",
formats: ["es"],
fileName: (format) => {
return `index.${format}.js`;
},
cssFileName: "index",
},
rolldownOptions: {
external: ["react/jsx-runtime", ...Object.keys(pkg.peerDependencies)],
output: {
// 为 UMD 构建提供 global 变量
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
},
});
+45
View File
@@ -93,6 +93,18 @@ importers:
specifier: ^5.4.0
version: 5.4.0(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
devDependencies:
'@babel/core':
specifier: ^7.29.13
version: 7.29.13
'@eslint/js':
specifier: ^10.0.1
version: 10.0.1(eslint@10.15.0)
'@rolldown/plugin-babel':
specifier: ^0.3.1
version: 0.3.2(@babel/core@7.29.13)(rolldown@1.3.4)(vite@8.4.0)
'@types/babel__core':
specifier: ^7.20.5
version: 7.20.5
'@types/node':
specifier: ^26.6.6
version: 26.6.11
@@ -102,6 +114,39 @@ importers:
'@types/react-dom':
specifier: ^19.3.0
version: 19.3.0(@types/react@19.3.3)
'@vitejs/devtools':
specifier: ^0.8.3
version: 0.8.3(@vitejs/devtools-rolldown@0.8.3)(@vitejs/devtools-vite@0.8.3)(crossws@0.4.17(srvx@1.0.8))(srvx@1.0.8)(vite@8.4.0)
'@vitejs/devtools-rolldown':
specifier: ^0.8.3
version: 0.8.3(@devframes/agentic@1.4.0)(cac@7.1.1)(crossws@0.4.17(srvx@1.0.8))(srvx@1.0.8)(vite@8.4.0)
'@vitejs/devtools-vite':
specifier: ^0.8.3
version: 0.8.3(@devframes/agentic@1.4.0)(cac@7.1.1)(crossws@0.4.17(srvx@1.0.8))(srvx@1.0.8)(vite@8.4.0)
'@vitejs/plugin-react':
specifier: ^6.3.0
version: 6.3.0(@rolldown/plugin-babel@0.3.2(@babel/core@7.29.13)(rolldown@1.3.4)(vite@8.4.0))(babel-plugin-react-compiler@1.0.0)(vite@8.4.0)
babel-plugin-react-compiler:
specifier: ^1.0.0
version: 1.0.0
eslint:
specifier: ^10.15.0
version: 10.15.0
eslint-plugin-react-hooks:
specifier: ^7.1.1
version: 7.1.1(eslint@10.15.0)
eslint-plugin-react-refresh:
specifier: ^0.5.8
version: 0.5.8(eslint@10.15.0)
globals:
specifier: ^17.14.0
version: 17.14.0
typescript:
specifier: ~6.0.3
version: 6.0.3
typescript-eslint:
specifier: ^8.73.0
version: 8.74.0(eslint@10.15.0)(typescript@6.0.3)
packages: