Files
image-workbench-desktop/package.json
T
qiqi 5728efd9b4 refactor: 图片写回收口到 src/image-writeback.js(3.26.183 前置)
四个线上问题(174~182)都落在同一条链上:插件写图 → 节点数据 → 缩略图缓存 → 渲染。
旧实现分散在 app.js 插件桥与 runtime-workbench-logic,顺序靠人记,改一处漏一处就复发。

- 新增 src/image-writeback.js 三入口:
  · replaceNodeImage:引用化 → 一次 commit → saveNow → 回读校验(失败回滚旧图)→ 旧/新双 key 失效 → bump
  · replaceNodeImageSync:同步严格布尔、只改内存不落盘(blank-canvas / white-bg-800 依赖此语义)
  · createNodeImage:同步返回 id,大图后台引用化(6 个建图插件零改动)
- app.js 只做装配:删除 origImagePatch 与三个写入口旧实现;「还原替换前原图」支持引用形态
- 阈值只留一条判据:IMPORT_INLINE_MAX + wImportImage(keepOriginal);删除 182 的 200KB + 裸 wImgRefWrite 旁路
- orig 一起引用化,并补进 HISTORY_IMG_REF_FIELDS(撤销快照不再整串存旧图)
- 单测 tests/image-writeback-test.js(23 条断言)已进 test:unit
- 棘轮记账:MAX_APP_JS_LINES 8743→8911(+168)、MAX_WORKBENCH_LINES 2333→2505(+172,相对 HEAD −19)
  (174~182 修 bug 期间累计 +196 未记账,本轮把写回逻辑搬进 src 后按实测显式上调)
- 门禁修复:裁剪矩形守卫文本(cullRectsOf 已用 p = pad + extra)、事实文档数字与基线锚点、模块顺序/耦合面快照
- 文档:plugin-development.md 修正 ctx.canvasWrite 旧写法 + 新增「图片写回契约」表;
  workflow-2026-12-02.md 增加分工红线(代码改动只在 mac 侧,构建机只做流程性动作)
2026-12-02 07:40:02 +08:00

59 lines
8.1 KiB
JSON

{
"name": "image-workbench-web",
"private": true,
"version": "3.26.182",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
"tauri": "tauri",
"app:dev": "tauri dev",
"app:build": "tauri build",
"lint": "eslint src app.js",
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js",
"test:unit": "node tests/result-img-doubleclick-test.js && node tests/gallery-audit-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-test.js && node tests/design-tokens-component-doc-test.js && node tests/theme-static-snapshot-test.js && node tests/overlay-layer-test.js && node tests/settings-scope-test.js && node tests/node-scope-test.js && node tests/appearance-v2-test.js && node tests/image-prompt-cover-test.js && node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/album-task-graph-test.js && node tests/generation-endpoint-test.js && node tests/storage-config-shape-test.js && node tests/generation-default-model-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-gc-canvas-refs-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/gallery-sync-test.js && node tests/image-blob-store-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/clipboard-native-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/desktop-csp-loopback-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/plugin-data-test.js && node tests/plugin-loader-test.js && node tests/plugin-bundle-test.js && node tests/plugin-install-test.js && node tests/plugin-gallery-render-test.js && node tests/plugin-gallery-recovery-test.js && node tests/plugin-gallery-ux-test.js && node tests/plugin-grouplib-render-test.js && node tests/plugin-promptlib-render-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/image-writeback-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/plugin-theme-contract-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/native-overlay-park-test.js && node tests/ui-dock-sanitize-test.js && node tests/ui-minimap-fit-test.js && node tests/ui-workbench-hooks-test.js && node tests/plugin-scale-contract-test.js && node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js && node tests/image-file-ref-preview-test.js && node tests/icon-assets-test.js && node tests/strip-plugins-test.js && node tests/plugin-manifest-hashes-test.js && node tests/boot-progress-test.js && node tests/idb-gc-plugin-refs-test.js && node tests/canvas-v3-test.js && node tests/canvas-v3-hit-test.js && node tests/image-cache-migrate-test.js",
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
"check:plugins": "node scripts/check-plugins-sync.js",
"plugins:doctor": "node scripts/plugin-index-doctor.js",
"hooks:install": "bash scripts/install-git-hooks.sh",
"coverage:browser": "npm run build && node scripts/coverage-browser.js",
"audit:pins": "node scripts/audit-source-pins.js",
"tokens:write": "node scripts/gen-tokens.js --write",
"tokens:check": "node scripts/gen-tokens.js --check",
"audit:tokens": "node scripts/token-audit.js",
"audit:tokens:contrast": "node scripts/token-audit.js --contrast",
"test:visual": "npx playwright test _visual-tokens",
"test:visual:update": "npx playwright test _visual-tokens --update-snapshots",
"test:e2e": "npm run build && node scripts/serve-test.js",
"test:e2e:local": "node scripts/serve-test.js",
"e2e:known-red": "node scripts/e2e-known-red-report.js",
"verify:ci": "npm run build && node --check app.js && node --check dist/app.js && node scripts/check-dist.js && node scripts/ctx-menu-audit.js && npm run tokens:check && npm run lint:tokens && npm run lint && npm run typecheck && npm run test:unit && npm test && npm run test:facts && npm run test:e2e:smoke",
"verify": "npm run verify:ci && npm run test:e2e",
"coverage:e2e": "node scripts/coverage-e2e.js",
"sync:facts": "node scripts/sync-facts.js",
"sync:facts:write": "node scripts/sync-facts.js --write",
"typecheck": "tsc -p tsconfig.json",
"release:desktop": "bash scripts/release.sh",
"lint:tokens": "node scripts/token-lint.js",
"test:tokens": "node tests/design-token-ratchet-test.js && node tests/theme-contrast-test.js",
"test:e2e:smoke": "node scripts/e2e-smoke.js",
"preflight": "bash scripts/preflight.sh",
"diag:tail": "bash scripts/diag-tail.sh"
},
"devDependencies": {
"@playwright/test": "^1.64.1",
"@tauri-apps/cli": "^2.12.4",
"esbuild": "0.28.2",
"eslint": "^10.13.0",
"globals": "^17.13.0",
"jsdom": "^24.1.3",
"playwright": "^1.64.1",
"typescript": "^5.9.3"
},
"dependencies": {
"@tauri-apps/plugin-dialog": "^2.8.4",
"@tauri-apps/plugin-fs": "^2.7.1",
"@tauri-apps/plugin-http": "^2.9.0"
}
}