@cfp-studio/plugin-react 17.1.0 → 17.2.1
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 +42 -0
- package/dist/index.d.mts +5760 -4
- package/dist/index.mjs +1 -141
- package/package.json +41 -18
- package/preview/index.tsx +0 -1
- package/preview/root.ts +0 -1
- package/preview/tsconfig.json +9 -9
- package/types/csstype/LICENSE +19 -0
- package/types/csstype/README.md +277 -0
- package/types/csstype/index.d.ts +21297 -0
- package/types/csstype/index.js.flow +6612 -0
- package/types/csstype/package.json +66 -0
- package/types/prop-types/LICENSE +21 -0
- package/types/prop-types/README.md +15 -0
- package/types/prop-types/index.d.ts +131 -0
- package/types/prop-types/package.json +36 -0
- package/types/react/LICENSE +21 -0
- package/types/react/README.md +15 -0
- package/types/react/canary.d.ts +166 -0
- package/types/react/experimental.d.ts +132 -0
- package/types/react/global.d.ts +160 -0
- package/types/react/index.d.ts +4553 -0
- package/types/react/jsx-dev-runtime.d.ts +45 -0
- package/types/react/jsx-runtime.d.ts +36 -0
- package/types/react/package.json +206 -0
- package/types/react/ts5.0/canary.d.ts +166 -0
- package/types/react/ts5.0/experimental.d.ts +132 -0
- package/types/react/ts5.0/global.d.ts +160 -0
- package/types/react/ts5.0/index.d.ts +4540 -0
- package/types/react/ts5.0/jsx-dev-runtime.d.ts +44 -0
- package/types/react/ts5.0/jsx-runtime.d.ts +35 -0
- package/types/react-dom/LICENSE +21 -0
- package/types/react-dom/README.md +16 -0
- package/types/react-dom/canary.d.ts +184 -0
- package/types/react-dom/client.d.ts +72 -0
- package/types/react-dom/experimental.d.ts +36 -0
- package/types/react-dom/index.d.ts +150 -0
- package/types/react-dom/package.json +88 -0
- package/types/react-dom/server.d.ts +126 -0
- package/types/react-dom/test-utils/index.d.ts +402 -0
- package/dist/index.d.ts +0 -12
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @cfp-studio/plugin-react
|
|
2
|
+
|
|
3
|
+
React 框架的 CFP Studio 插件,支持 React 组件/Story 静态分析、属性/类型提取、预览渲染、CSF/Storybook 兼容等。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
- 自动检测并适配 React 16/17/18+ 项目
|
|
7
|
+
- 支持 React 组件/Story 的批量静态分析与属性/类型提取
|
|
8
|
+
- 兼容 CSF/Storybook 规范,支持 args/参数提取
|
|
9
|
+
- 支持 preview 目录下自定义 Wrapper、ErrorBoundary、不同 React 版本渲染器
|
|
10
|
+
- 内置丰富的 E2E/单元测试用例,覆盖多种工程模板
|
|
11
|
+
|
|
12
|
+
## 架构与工作原理
|
|
13
|
+
- 通过 `FrameworkPluginFactory` 实现插件注册与兼容性检测
|
|
14
|
+
- 使用 `@cfp-studio/analyzer-react` 进行 TS/JSX 类型分析
|
|
15
|
+
- `react-js-imports-plugin` 自动为 .js 文件注入 React 导入,兼容 React 17+ 新写法
|
|
16
|
+
- `preview/` 目录下为前端渲染入口,支持多 React 版本渲染、错误边界、根容器自定义
|
|
17
|
+
- 支持多种 React 工程模板(apps/ 下有多种测试工程)
|
|
18
|
+
|
|
19
|
+
## 主要 API/模块
|
|
20
|
+
- `src/index.ts`:插件主入口,注册工厂与分析器
|
|
21
|
+
- `src/react-js-imports-plugin.ts`:自动注入 React 导入
|
|
22
|
+
- `preview/index.tsx`:前端渲染入口
|
|
23
|
+
- `preview/render-16.tsx`、`render-18.tsx`:多版本渲染器
|
|
24
|
+
- `tests/`、`apps/`:丰富的测试与模板
|
|
25
|
+
|
|
26
|
+
## 用法示例
|
|
27
|
+
```ts
|
|
28
|
+
import { reactFrameworkPlugin } from '@cfp-studio/plugin-react';
|
|
29
|
+
// 传入 core/Previewer 或 createChromelessWorkspace 等集成
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 依赖
|
|
33
|
+
- `react`、`@cfp-studio/*`、`typescript`、`vite`、`esbuild-plugin-polyfill-node`
|
|
34
|
+
- 测试:`vitest`、`@playwright/test`
|
|
35
|
+
|
|
36
|
+
## 构建
|
|
37
|
+
```sh
|
|
38
|
+
pnpm build
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 许可证
|
|
42
|
+
MIT
|