refactor: 插件画布桥迁到 src/plugin-canvas-bridge.js(app.js −51 / Workbench −51)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s

app.js 与 Workbench 的行数棘轮都是零余量(8,911 / 2,505),再改一行就红。桥本身不需要 React
(只读 refs + 调已有命令),适合按 ctx + 注入搬出。

- 新增 src/plugin-canvas-bridge.js:getNodes / getSelectedNode / getNodeImage / createNode /
  screenToWorld / createImageNode / setNodeImage / saveNodeImage 全部迁出,内部持有
  src/image-writeback 实例;依赖(findSpot/placeAtDrop/addPluginNode/uid/cloneNodeDefaults/
  gallerySync/imgRefWrite/ensureTier/pluginPreview/shrinkDataUrl/showToast…)由 app.js 注入。
- app.js 只保留 20 行装配:wPluginCanvasBridge / wImageWriteback 由工厂返回,卸载置空。
- 棘轮:MAX_APP_JS_LINES 8,911→8,860(−51)、MAX_WORKBENCH_LINES 2,505→2,454(−51),按 B3 记账。
- 顺带删两个从未被引用的工厂导出(IWBStorageRuntimeFactory / IWBRuntimeMetricsFactory),
  global 写入口 122→121(+1 新模块,−2 死导出)。
- scripts/perf-baseline.js 改用 npm run build(含 copy-plugins):只跑 build.js 会缺 plugins/,
  图库面板相关 e2e 会假红。

验证:test:unit 140 文件、e2e 冒烟 33/33、lint/typecheck/facts/ratchet/boundary 全绿。
This commit is contained in:
qiqi committed 2026-12-02 11:19:51 +08:00
1 parent 8c47ef75fe
commit 29d8c22d53
12 files changed
+173 -85

No files matched your search

+1
View File
@@ -149,6 +149,7 @@ const sourceModules = [
'ui-gen-config-panel.js',
'canvas-webview.js',
'plugin-api-images.js',
'plugin-canvas-bridge.js',
'plugin-files-policy.js',
'image-prompt-cover.js',
]
+2 -1
View File
@@ -42,7 +42,8 @@ function ping (base) {
async function main () {
console.log('== 1/3 构建 dist')
const build = spawn(process.execPath, [path.join(root, 'scripts', 'build.js')], { cwd: root, stdio: 'inherit' })
// 用 npm run build(build.js + copy-plugins):少了插件,页面 DOM 与真机不一致,帧数据会偏
const build = spawn('npm', ['run', 'build'], { cwd: root, stdio: 'inherit' })
const buildCode = await new Promise((resolve) => build.on('exit', (c) => resolve(c == null ? 1 : c)))
if (buildCode !== 0) { console.error('[perf] 构建失败'); return buildCode }