diff --git a/docs/standards/architecture-current-state.md b/docs/standards/architecture-current-state.md index 6f87b2e..347a206 100644 --- a/docs/standards/architecture-current-state.md +++ b/docs/standards/architecture-current-state.md @@ -22,7 +22,7 @@ - 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob__`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。 - 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。 - 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。 -- `app.js` = 单 IIFE **8,323 行**(**双层预算**:绝对上限 8,329 / 占总源码 ≤ 40%,现 **26.2%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,174 行**(上限 **2,179**,余量 5;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **117** 个模块 / 23,462 行,`sourceModules` 117 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 +- `app.js` = 单 IIFE **8,323 行**(**双层预算**:绝对上限 8,329 / 占总源码 ≤ 40%,现 **26.2%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,174 行**(上限 **2,179**,余量 5;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **117** 个模块 / 23,482 行,`sourceModules` 117 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。 - 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。 ## 2. 门禁与环境现状 diff --git a/scripts/boot-splash.js b/scripts/boot-splash.js new file mode 100644 index 0000000..6df7891 --- /dev/null +++ b/scripts/boot-splash.js @@ -0,0 +1,73 @@ +'use strict' +// 静态启动屏(v3.26.109):内联进 index.html,不依赖任何脚本就能出画面。 +// 为什么:资料目录放在局域网时,app.js 要等「存储装载」完成才渲染 React, +// 那段时间原本是纯白板(实测 15s)。 + +const css = `` + +const markup = `
+ +
生图工作台
+
+
正在启动…
+
` + +// 轮询进度总线:真实百分比(IWBBootProgress 就绪后),之前显示已等待秒数 +const script = `` + +module.exports = { css, markup, script } diff --git a/scripts/build.js b/scripts/build.js index ab771f6..f5eff78 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -230,23 +230,31 @@ const swWithVersion = swSource.replace(/__IWB_VERSION__/, version) if (swWithVersion === swSource) throw new Error('__IWB_VERSION__ marker not found in sw.js') fs.writeFileSync(path.join(dist, 'sw.js'), swWithVersion) -const html = ` - - - - -无限画布 - - - - -
- - - - - -` +const bootSplash = require('./boot-splash') +const html = [ + '', + '', + '', + '', + '', + '无限画布', + '', + '', + // v3.26.109:静态加载屏内联在 index.html 里。资料目录在局域网时,app.js 要等存储装载完 + // 才渲染 React,那段时间原本是纯白板(实测 15s);这段 HTML/CSS 不依赖任何脚本就能出画面。 + bootSplash.css, + '', + '', + '
', + bootSplash.markup, + bootSplash.script, + '', + '', + '', + '', + '', + '' +].join('\n') fs.writeFileSync(path.join(dist, 'index.html'), html) fs.writeFileSync(path.join(dist, 'version.json'), JSON.stringify({ version, packageVersion: pkg.version, commit: gitSha }, null, 2) + '\n') // 导航 logo 用真实应用图标(v3.25.61;缺失不阻塞构建) diff --git a/scripts/check-dist.js b/scripts/check-dist.js index 17fa50f..3c23084 100644 --- a/scripts/check-dist.js +++ b/scripts/check-dist.js @@ -41,9 +41,10 @@ if (!fs.existsSync(htmlPath)) fail('dist/index.html 不存在') const html = fs.readFileSync(htmlPath, 'utf8') if (!html.includes('app.js?v=')) fail('dist/index.html 缺少 app.js?v=') const scriptCount = (html.match(/