@bundlekit/plugin-react 0.0.1 → 0.0.3

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.
Files changed (2) hide show
  1. package/README.md +94 -0
  2. package/package.json +9 -3
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @bundlekit/plugin-react
2
+
3
+ React 构建插件,为 BundleKit 提供 React 项目模板和构建支持。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install -D @bundlekit/plugin-react
9
+ # 或
10
+ pnpm add -D @bundlekit/plugin-react
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ### 自动配置
16
+
17
+ 在 `@bundlekit/cli` 创建项目时选择 React 模板,插件会自动配置:
18
+
19
+ ```bash
20
+ bc create my-app -t react-ts
21
+ ```
22
+
23
+ ### 手动配置
24
+
25
+ 在 `.bundlekitrc.ts` 中添加插件:
26
+
27
+ ```typescript
28
+ export default defineConfig({
29
+ plugins: ['@bundlekit/plugin-react'],
30
+ });
31
+ ```
32
+
33
+ ## 功能特性
34
+
35
+ - ✅ React 18+ 支持
36
+ - ✅ TypeScript / JavaScript 模板
37
+ - ✅ JSX/TSX 自动转换
38
+ - ✅ 热模块替换(HMR)
39
+ - ✅ SSR 支持
40
+
41
+ ## 模板选项
42
+
43
+ | 模板 | 说明 |
44
+ |------|------|
45
+ | `react-ts` | React + TypeScript |
46
+ | `react-js` | React + JavaScript |
47
+
48
+ ## 生成的项目结构
49
+
50
+ ```
51
+ my-app/
52
+ ├── src/
53
+ │ ├── index.tsx # 应用入口
54
+ │ ├── App.tsx # 根组件
55
+ │ ├── entry-client.tsx # SSR 客户端入口(可选)
56
+ │ └── entry-server.tsx # SSR 服务端入口(可选)
57
+ ├── public/
58
+ │ └── index.html # HTML 模板
59
+ ├── mock/
60
+ │ └── index.ts # Mock 数据
61
+ └── .bundlekitrc.ts # 构建配置
62
+ ```
63
+
64
+ ## SSR 支持
65
+
66
+ 创建 SSR 项目:
67
+
68
+ ```bash
69
+ bc create my-app -t react-ts --ssr
70
+ ```
71
+
72
+ 生成的配置:
73
+
74
+ ```typescript
75
+ export default defineConfig({
76
+ config: {
77
+ production: {
78
+ entry: 'src/entry-client.tsx',
79
+ ssr: {
80
+ entry: 'src/entry-server.tsx',
81
+ output: { dir: 'dist/server', filename: 'server.cjs' },
82
+ },
83
+ },
84
+ },
85
+ });
86
+ ```
87
+
88
+ ## 文档
89
+
90
+ 完整文档请访问 [https://bundlekit.harhao.workers.dev](https://bundlekit.harhao.workers.dev)
91
+
92
+ ## License
93
+
94
+ ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundlekit/plugin-react",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "React plugin for bundlekit - provides React build support and project templates",
5
5
  "main": "./index.ts",
6
6
  "type": "module",
@@ -15,9 +15,15 @@
15
15
  "bundlekit"
16
16
  ],
17
17
  "author": "harhao@163.com",
18
- "license": "ISC",
18
+ "license": "MIT",
19
+ "website": "https://bundlekit.harhao.workers.dev",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/Harhao/bundlekit.git",
23
+ "directory": "packages/bundlekit-plugin-react"
24
+ },
19
25
  "dependencies": {
20
- "@bundlekit/shared-utils": "0.0.1"
26
+ "@bundlekit/shared-utils": "0.0.3"
21
27
  },
22
28
  "publishConfig": {
23
29
  "registry": "https://registry.npmjs.org/",