wechen-agent-editor-v1 1.0.5 → 1.0.6

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 CHANGED
@@ -23,10 +23,40 @@ npm install wechen-agent-editor-v1
23
23
 
24
24
  ### 宿主 `npm install wechen-agent-editor-v1` 报 `ERESOLVE`
25
25
 
26
- 若日志里冲突来自 **其它包**(例如 **`@ant-design/pro-chat` `antd-style` 版本**、**`@ahooksjs/use-request` React 18**),属于 **宿主项目原有依赖树** 与 npm 严格 peer 解析叠加,**不一定与本包 peer 声明有关**。
26
+ npm 7+ 会对 **整棵依赖树**做严格 peer 校验;安装 **`wechen-agent-editor-v1`** 往往只是 **触发一次完整解析**,冲突可能来自 **宿主里早已存在的包**,**不一定与本包 `peerDependencies` 声明矛盾**。
27
27
 
28
- - **临时安装**:`npm install wechen-agent-editor-v1@<version> --legacy-peer-deps`(或在宿主项目根目录 `.npmrc` **`legacy-peer-deps=true`**)。
29
- - **根治**:在宿主侧 **升级 / 对齐** 冲突链上的包(如升级 `pro-chat`、或按官方说明统一 `antd-style` 大版本),再去掉 `--legacy-peer-deps`。
28
+ **与本 issue 一致的两类典型冲突**(看 `npm install` 日志里 **While resolving …** 指向谁):
29
+
30
+ | 类型 | 常见表现 | 建议先做的排查 |
31
+ |------|----------|----------------|
32
+ | **`@ant-design/pro-chat` ↔ `antd-style`** | 例如 pro-chat 声明 **`antd-style@^3`**,宿主已用 **`antd-style@^4`** | 在 [npm @ant-design/pro-chat](https://www.npmjs.com/package/@ant-design/pro-chat?activeTab=versions) 查各版本 **peerDependencies**;宿主执行 **`npm ls @ant-design/pro-chat antd-style`** |
33
+ | **`@ahooksjs/use-request`(经 `ahooks` / `@umijs/plugins`)↔ React 18** | peer 仍写 **`react@^16 \|\| ^17`** 等 | **`npm why @ahooksjs/use-request`**;**`npm ls ahooks react`**;按 Umi / ahooks 官方说明 **升级 ahooks 或相关插件** |
34
+
35
+ **「临时 unblock」与「根治」**(勿与下文「多份 React」混淆——那是 **安装成功后运行时** 的问题):
36
+
37
+ | 阶段 | 做法 | 说明 |
38
+ |------|------|------|
39
+ | **临时** | `npm install wechen-agent-editor-v1@<version> --legacy-peer-deps`,或宿主根目录 **`.npmrc`**:`legacy-peer-deps=true` | 仅放宽 **peer 解析**,**不替代**你在 `package.json` 里对本包要求的 **`react` / `@xyflow/react` / …** 的显式声明;上线前请在宿主跑 **`npm run build`**(或 `max build`)并记录技术债 |
40
+ | **根治** | **升级** `@ant-design/pro-chat` 等到与 **`antd-style@4`** 兼容的组合;或 **升级 ahooks / Umi 链** 与 React 18 一致;必要时再用 **`overrides`**(见下折叠示例) | 对齐后应 **去掉** `legacy-peer-deps`,避免长期掩盖不兼容 |
41
+
42
+ **与「排查:第一次从组件库拖入正常…」的区别**:本节解决 **`npm install` 失败(ERESOLVE)**;该小节解决 **装得上但画布异常**(多为 **多份 `react` / `@xyflow/react`** 或样式未进包)。
43
+
44
+ <details>
45
+ <summary><strong>可选:<code>package.json</code> <code>overrides</code> 示例(npm)</strong> — 仅作参考,须按宿主实际包名与版本调整;优先升级上游</summary>
46
+
47
+ `overrides` 会 **强制子依赖解析版本**,可能掩盖真实不兼容;合并前请在 **关键页面 + CI build** 验证。
48
+
49
+ ```json
50
+ {
51
+ "overrides": {
52
+ "@ahooksjs/use-request": "^2.0.0"
53
+ }
54
+ }
55
+ ```
56
+
57
+ 上例中的版本号 **仅为占位**——请替换为你们团队已在 **React 18 + 当前 Umi** 下验证过的版本。涉及 **`@ant-design/pro-chat` 与 `antd-style`** 时,更稳妥的路径通常是 **升级 pro-chat** 或按官方矩阵统一 `antd-style` 大版本,而不是长期用 overrides「硬拧」peer。
58
+
59
+ </details>
30
60
 
31
61
  ### Umi Max(`@umijs/max`)/ Ant Design Pro 类宿主适配清单
32
62
 
@@ -38,13 +68,13 @@ npm install wechen-agent-editor-v1
38
68
  {
39
69
  "@xyflow/react": "^12.3.6",
40
70
  "@monaco-editor/react": "^4.6.0",
41
- "wechen-agent-editor-v1": "^1.0.4"
71
+ "wechen-agent-editor-v1": "^1.0.6"
42
72
  }
43
73
  ```
44
74
 
45
75
  宿主已声明的 **`react`、`react-dom`、`antd`、`monaco-editor`** 请保持 **单版本**;**`@monaco-editor/react` 与 `monaco-editor` 主版本** 请对照 [@monaco-editor/react 说明](https://github.com/suren-atoyan/monaco-react) 与当前 `monaco-editor` 一致。
46
76
 
47
- 2. **`npm install` 仍 `ERESOLVE`**:多为 **`@ant-design/pro-chat` 要求 `antd-style@^3`** 与宿主 **`antd-style@^4`**、或 **`ahooks` / `@ahooksjs/use-request` React 18** 的已知冲突。处理顺序建议:**升级 `@ant-design/pro-chat` 到支持 `antd-style@4` 的版本**或调整 **`ahooks` / Umi 插件链** → 最后再在宿主根目录 **`.npmrc`** 增加 **`legacy-peer-deps=true`** 并记录技术债。
77
+ 2. **`npm install` 仍 `ERESOLVE`**:与上文 **「宿主 `npm install wechen-agent-editor-v1` `ERESOLVE`」** 同源;典型顺序仍是 **升级 `@ant-design/pro-chat`(或统一 `antd-style` 大版本)****升级 / 调整 `ahooks` Umi 插件链** → 最后再 **`.npmrc`**:`legacy-peer-deps=true`(并记录技术债)。
48
78
 
49
79
  3. **Umi / MFSU**:若开发态 **Monaco 或 xyflow** 白屏、热更新异常,可在 **`.umirc.ts` / `config/config.ts`** 中尝试将 **`monaco-editor`、`@monaco-editor/react`** 加入 **`mfsu.exclude`**(以你项目 Umi 4 文档为准),或暂时关闭 MFSU 做对照。
50
80
 
@@ -61,7 +91,7 @@ npm install wechen-agent-editor-v1
61
91
 
62
92
  ### 从包导入(ESM)
63
93
 
64
- 本包以 **ESM** 发布(`package.json` 的 `exports["."].import`)。构建会把 **React Flow 全局样式**打进 **`dist/style.css`**,并由 **`dist/index.js`** 自动 `import`;宿主 **只 import 本包即可**,无需再写 `@xyflow/react/dist/style.css`。典型写法:
94
+ 本包以 **ESM** 发布(`package.json` 的 `exports["."].import`)。构建会把 **React Flow 全局样式**打进 **`dist/style.css`**;自 **1.0.6** 起,**`npm run build`** 产出的 **`dist/index.js`** 会在文件首行包含 **`import './style.css'`**(由 `vite.config.ts` 在构建收尾写入),以便宿主打包器随主入口拉取 Flow 全局样式。若你的打包链 **不处理** 依赖包内的该 `import`,请仍使用兜底:**`import "wechen-agent-editor-v1/style.css"`**。宿主 **无需**再写 `@xyflow/react/dist/style.css`。典型写法:
65
95
 
66
96
  ```ts
67
97
  import {
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import './style.css';
1
2
  import { jsx as s, Fragment as u1, jsxs as M } from "react/jsx-runtime";
2
3
  import { BezierEdge as fi, Handle as s1, Position as v1, ReactFlowProvider as ui, useReactFlow as hi, useNodesState as mi, useEdgesState as pi, addEdge as gi, reconnectEdge as zi, ReactFlow as Oi, Background as wi, Controls as Ei } from "@xyflow/react";
3
4
  import { Input as E4, Empty as X, Typography as M1, List as S1, Space as h1, Button as O1, Switch as Vi, Segmented as Ni, Form as G, Select as D1, InputNumber as Mi, Card as Hi, Layout as w1 } from "antd";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechen-agent-editor-v1",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Wechen Agent:可执行的 AI 流程编排编辑器(React Flow),节点即模块、边即执行顺序;Monaco + Ant Design,面向 npm",
5
5
  "license": "MIT",
6
6
  "keywords": [