diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 52a0ed3..7e83458 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序 node --check app.js 与 dist/app.js 语法 check-dist.js 产物体检 lint ESLint(src/ + app.js,正确性规则) -test:unit 123 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底)) +test:unit 124 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底)) test relay-task-graph-fixture + iwb-v32-web-test test:facts 事实基线守门(见 §5) typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js) diff --git a/docs/standards/plugin-theme.md b/docs/standards/plugin-theme.md index 89d9a5d..10db4f9 100644 --- a/docs/standards/plugin-theme.md +++ b/docs/standards/plugin-theme.md @@ -17,6 +17,8 @@ 1. **只用变量**:`--iwb-plugin-*` 或 `--iwb-*`,禁止写死 `#hex` / `rgba()`。 (守门测试 `tests/plugin-theme-contract-test.js` 会卡) +1.5. **尺寸只许闭集**:字号 11/12/13/14/15/17/20/24、圆角 6/8/10/12/14/999、间距 0/2/4/6/8/10/12/16/20/24/32/40/48/64;散值由 `tests/plugin-scale-contract-test.js` 棘轮拦截(只降不升)。 + 2. **面板根不画底色**:宿主已给 `--iwb-plugin-surface`;插件根容器只写 `background: var(--iwb-plugin-surface)`。 3. **卡片才用 card**:列表项/卡片用 `--iwb-plugin-card`,这样「浅灰底 + 白卡片」的层次才成立。 4. **文字层级**:主文字 `--iwb-plugin-text`,次要 `--iwb-plugin-text2`,品牌 `--iwb-plugin-brand`(底色上的字用 `--iwb-plugin-on-brand`,宿主按对比度自动黑/白)。 diff --git a/docs/standards/ui-change-checklist.md b/docs/standards/ui-change-checklist.md new file mode 100644 index 0000000..13e8f78 --- /dev/null +++ b/docs/standards/ui-change-checklist.md @@ -0,0 +1,65 @@ +# UI 改动约束清单(Design Token 落地版) + +> 适用范围:所有界面调整(宿主 `style.css` / `src/ui-*.js`、`plugins/**`、`site/**`)。 +> 唯一数值来源:[design-tokens.md](./design-tokens.md);插件契约:[plugin-theme.md](./plugin-theme.md)。 + +## 1. 写前:先查表,不许临场编值 + +| 要改什么 | 必须用 | 禁止 | +| --- | --- | --- | +| 灰/表面/文字/边框色 | `--iwb-plugin-*`(插件面板)或 `--iwb-color-*`(宿主) | `#hex`、`rgba()`(`var(--x,#hex)` 兜底除外) | +| 间距 | `--iwb-space-2/4/6/8/10/12/16/20/24/32/40/48/64` | 13/14/18/22 等非档位值 | +| 字号 | `--iwb-font-xs…display`(11/12/13/14/15/17/20/24) | 半像素字号(10.5/11.5/12.5/13.5) | +| 圆角 | `--iwb-radius-chip/control/card/panel/popover/full`(6/8/10/12/14/999) | 7/9/11/13 等散值 | +| 阴影 | `--iwb-elevation-1..4` | 自定义 `0 4px 16px rgba(...)` | +| 层级 | `--iwb-z-*` | 9999/4000 等裸数字 | +| 动效 | `--iwb-dur-*` / `--iwb-ease-*` | 200ms/0.3s 混用 | + +插件额外规则: + +- 面板根 `--iwb-plugin-surface`、卡片 `--iwb-plugin-card`、输入框/内嵌 `--iwb-plugin-inset`、hover `--iwb-plugin-hover` +- 高饱和强调色允许写死(chroma ≥ 24);灰色必须 token +- 只有 `manifest.skin = "private"` 才可整套私有配色,且不得引用宿主颜色 token +- 内容色(画布白底、画笔色)必须行内 `/*iwb:content*/` + +## 2. 写中:三条机械规则 + +1. **不改 token 定义**:要新值,先按 `design-tokens.md §5.1` 提 RFC(用途 / 消费者 ≥2 / 亮暗值 / 替代方案 / 弃用计划),先改规范再改代码。 +2. **只引用 L2**:组件/插件只消费 L2;需要 L1 说明层选错了。 +3. **例外登记,不做文件豁免**:只能行内 `/*iwb:raw-until=<版本>*/`(必须带到期版本)或 `/*iwb:content*/`,禁止整文件白名单。 + +## 3. 写后:四道闸门(缺一不可合并/发版) + +| 闸门 | 命令 | 拦什么 | +| --- | --- | --- | +| Token 快照 | `npm run tokens:check` | `design-tokens.css` 与 `derive()` 漂移 | +| 新增行 lint | `npm run lint:tokens` | 新增行写死字号/圆角/间距/颜色/z-index | +| 插件契约 | `node tests/plugin-theme-contract-test.js` | 插件写死灰色、私有皮肤违规 | +| 插件尺度棘轮 | `node tests/plugin-scale-contract-test.js` | 插件字号/圆角/间距散值只降不升 | +| 视觉回归 | `npm run test:visual` | 亮/暗截图与基线像素 diff | + +> `npm run verify:ci` 已串起前四道(构建、快照、lint、单测);`test:visual` 在改动浮层/面板时必跑。 + +## 4. 视觉验证流程(防止“测试过但变丑”) + +1. 静态 HTML + Playwright 截图(亮/暗两套,固定视口) +2. 与上一版基线叠图对比,确认只有预期区域变化 +3. 真机截图复核 +4. 再 bump 版本 / 上市场 + +## 5. 违规处理 + +- CI 红 → 不合并、不发版 +- **禁止“为了过测试改语义”**:不得把 `color` 换成 `border` token 糊弄测试(历史事故,见 `promptlib-style-baseline.md`) +- 测试与视觉冲突时:改测试规则或补 token,不改视觉语义 +- 每版发布前跑 `node scripts/token-audit.js --json`,散值数量只能降不能升 + +## 6. 复核命令 + +```bash +node scripts/token-audit.js # 宿主 token 现状 +node scripts/token-audit.js --plugins # 插件写死色/散值清单(按文件) +node scripts/token-audit.js --contrast # 对比度矩阵 +node scripts/token-lint.js --file style.css +npm run test:visual +``` diff --git a/package.json b/package.json index d12abcd..80de094 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "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/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-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/storage-config-shape-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/image-blob-store-test.js && node tests/image-preview-derive-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/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/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/design-token-ratchet-test.js && node tests/theme-contrast-test.js", + "test:unit": "node tests/plugin-archive-test.js && node tests/plugin-files-policy-test.js && node tests/theme-plugin-tokens-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/storage-config-shape-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/image-blob-store-test.js && node tests/image-preview-derive-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/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/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", "test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js", "test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js", "plugins:gc": "node scripts/plugins-publish.mjs --gc", diff --git a/scripts/token-audit.js b/scripts/token-audit.js index f077262..b0d7495 100644 --- a/scripts/token-audit.js +++ b/scripts/token-audit.js @@ -33,6 +33,53 @@ function walk (dir, out) { } const pluginFiles = walk(path.join(ROOT, 'plugins'), []) +/* ---------- 插件专项(--plugins):写死灰 / 半像素 / 散值 ---------- */ +if (process.argv.includes('--plugins')) { + const FONT = new Set([11, 12, 13, 14, 15, 17, 20, 24]) + const RADIUS = new Set([6, 8, 10, 12, 14, 999]) + const SPACE = new Set([0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 64]) + const hexToRgb = (h) => { + let v = h.replace('#', '') + if (v.length === 3) v = v.split('').map((c) => c + c).join('') + if (v.length !== 6) return null + return [parseInt(v.slice(0, 2), 16), parseInt(v.slice(2, 4), 16), parseInt(v.slice(4, 6), 16)] + } + const chroma = (h) => { const c = hexToRgb(h); return c ? Math.max(...c) - Math.min(...c) : 0 } + const rows = [] + for (const f of pluginFiles.filter((x) => /\.css$/i.test(x))) { + const src = read(f) + const rel = path.relative(ROOT, f).split(path.sep).join('/') + const r = { file: rel, font: 0, radius: 0, space: 0, color: 0, gray: 0 } + for (const m of src.matchAll(/([a-z-]+)\s*:\s*([^;{}]+)/g)) { + const prop = m[1].toLowerCase() + const val = m[2].trim() + if (val.includes('var(')) continue + if (prop === 'font-size') { + const px = /([0-9.]+)px/.exec(val); if (px && !FONT.has(Number(px[1]))) r.font++ + } else if (prop === 'border-radius') { + for (const px of val.matchAll(/([0-9.]+)px/g)) if (!RADIUS.has(Number(px[1]))) r.radius++ + } else if (/^(gap|row-gap|column-gap)$/.test(prop) || /^(padding|margin)/.test(prop)) { + for (const px of val.matchAll(/([0-9.]+)px/g)) if (!SPACE.has(Number(px[1]))) r.space++ + } else if (/^(color|background(-color)?|border(-color)?)$/.test(prop)) { + for (const hx of val.matchAll(/#[0-9a-f]{3,8}/gi)) { + r.color++ + if (chroma(hx[0]) < 24) r.gray++ + } + } + } + if (r.font || r.radius || r.space || r.color) rows.push(r) + } + rows.sort((a, b) => (b.gray + b.font + b.radius + b.space) - (a.gray + a.font + a.radius + a.space)) + const sum = (k) => rows.reduce((n, r) => n + r[k], 0) + console.log('## 插件样式审计(--plugins)' + '\n') + console.log('| 文件 | 中性色写死 | 半/散字号 | 散圆角 | 散间距 |' + '\n' + '|---|---|---|---|---|') + for (const r of rows.slice(0, 20)) console.log('| ' + r.file + ' | ' + r.gray + ' | ' + r.font + ' | ' + r.radius + ' | ' + r.space + ' |') + console.log('\n' + '- 合计:中性色写死 **' + sum('gray') + '** 处(另有强调色写死 ' + (sum('color') - sum('gray')) + ' 处,允许)') + console.log('- 散字号 **' + sum('font') + '** / 散圆角 **' + sum('radius') + '** / 散间距 **' + sum('space') + '**', '(棘轮:只降不升,见 tests/plugin-scale-contract-test.js)') + process.exit(0) +} + + const count = (re, src) => (src.match(re) || []).length const uniqSorted = (arr, numeric) => Array.from(new Set(arr)).sort(numeric ? (a, b) => a - b : undefined) diff --git a/tests/fixtures/plugin-scale-baseline.json b/tests/fixtures/plugin-scale-baseline.json new file mode 100644 index 0000000..db89d26 --- /dev/null +++ b/tests/fixtures/plugin-scale-baseline.json @@ -0,0 +1,19 @@ +{ + "files": { + "plugins/gallery/styles.css": { + "font": 1, + "radius": 1, + "space": 3 + }, + "plugins/grouplib/styles.css": { + "font": 0, + "radius": 0, + "space": 1 + }, + "plugins/promptlib/styles.css": { + "font": 40, + "radius": 12, + "space": 40 + } + } +} diff --git a/tests/plugin-scale-contract-test.js b/tests/plugin-scale-contract-test.js new file mode 100644 index 0000000..86b2e7a --- /dev/null +++ b/tests/plugin-scale-contract-test.js @@ -0,0 +1,77 @@ +'use strict' +// 插件尺度契约棘轮(2026-11-23) +// 目的:插件 CSS 的字号 / 圆角 / 间距散值「只降不升」。 +// 规则(docs/standards/design-tokens.md): +// 字号 11/12/13/14/15/17/20/24;圆角 6/8/10/12/14/999;间距 0/2/4/6/8/10/12/16/20/24/32/40/48/64 +// 存量不一次清零(会逼人加白名单),用基线棘轮:新增文件必须干净,存量文件计数不得增加。 +// 迁移时刻意下调后基线不会自动降 —— 用 --update 重新生成(人工确认)。 +const fs = require('fs') +const path = require('path') +const assert = require('assert') + +const ROOT = path.join(__dirname, '..') +const PLUGINS = path.join(ROOT, 'plugins') +const BASELINE = path.join(__dirname, 'fixtures', 'plugin-scale-baseline.json') + +const FONT = new Set([11, 12, 13, 14, 15, 17, 20, 24]) +const RADIUS = new Set([6, 8, 10, 12, 14, 999]) +const SPACE = new Set([0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 40, 48, 64]) + +function walk (dir, out) { + let ents = [] + try { ents = fs.readdirSync(dir, { withFileTypes: true }) } catch (e) { return out } + for (const e of ents) { + const p = path.join(dir, e.name) + if (e.isDirectory()) walk(p, out) + else if (e.name.endsWith('.css')) out.push(p) + } + return out +} + +function scan () { + const res = {} + for (const f of walk(PLUGINS, [])) { + const rel = path.relative(ROOT, f).split(path.sep).join('/') + const src = fs.readFileSync(f, 'utf8') + const r = { font: 0, radius: 0, space: 0 } + for (const m of src.matchAll(/([a-z-]+)\s*:\s*([^;{}]+)/g)) { + const prop = m[1].toLowerCase() + const val = m[2].trim() + if (val.includes('var(')) continue + if (prop === 'font-size') { + const px = /([0-9.]+)px/.exec(val) + if (px && !FONT.has(Number(px[1]))) r.font++ + } else if (prop === 'border-radius') { + for (const px of val.matchAll(/([0-9.]+)px/g)) if (!RADIUS.has(Number(px[1]))) r.radius++ + } else if (/^(gap|row-gap|column-gap)$/.test(prop) || /^(padding|margin)/.test(prop)) { + for (const px of val.matchAll(/([0-9.]+)px/g)) if (!SPACE.has(Number(px[1]))) r.space++ + } + } + if (r.font || r.radius || r.space) res[rel] = r + } + return res +} + +const current = scan() + +if (process.argv.includes('--update')) { + fs.mkdirSync(path.dirname(BASELINE), { recursive: true }) + fs.writeFileSync(BASELINE, JSON.stringify({ files: current }, null, 2) + '\n') + console.log('plugin scale baseline updated:' + Object.keys(current).length + ' 个文件') + process.exit(0) +} + +const baseline = fs.existsSync(BASELINE) ? JSON.parse(fs.readFileSync(BASELINE, 'utf8')).files || {} : {} +const bad = [] +for (const [file, cur] of Object.entries(current)) { + const base = baseline[file] || { font: 0, radius: 0, space: 0 } + for (const k of ['font', 'radius', 'space']) { + if (cur[k] > (base[k] || 0)) bad.push(file + ' → ' + k + ' ' + (base[k] || 0) + ' → ' + cur[k]) + } +} +if (bad.length) { + assert.fail('插件尺度散值不得增加(字号/圆角/间距用 design-tokens 闭集):\n' + bad.slice(0, 20).join('\n') + + '\n迁移完成后可运行 node tests/plugin-scale-contract-test.js --update 更新基线。') +} +const total = Object.values(current).reduce((n, r) => n + r.font + r.radius + r.space, 0) +console.log('plugin scale contract checks passed(' + Object.keys(current).length + ' 个插件样式文件,存量散值 ' + total + ' 处,未增加)')