@design-parity/known-differences

中文文档
1.18.0发布于 2026/11/07Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 3454

The compose-preview-known-differences/v1 acceptance engine: document ladder, gates, separated-plane scorer and a dependency-free PNG reader. One module per entry point, with no dependencies.

原始使用文档

@design-parity/known-differences

The compose-preview-known-differences/v1 acceptance engine: the document ladder, the gates, the separated-plane scorer, and a dependency-free PNG reader and writer. It is the code that decides whether a candidate render's difference from its reference is an accepted, known difference.

One module per entry point, and no dependencies:

import { evaluateKnownDifferences } from "@design-parity/known-differences/known-differences";
import { scoreComparison } from "@design-parity/known-differences/known-difference-score";
import { decodePng } from "@design-parity/known-differences/png-lite";
Entry pointWhat it is
known-differencesThe document ladder, the gates and the acceptance result.
known-difference-planePlane resolution and tag-index projection.
known-difference-resampleCropping and resampling to a common frame.
known-difference-scoreThe separated-plane scorer.
known-difference-tuningThe scorer's constants, including SCORE_VERSION.
png-lite, png-write, inflate-lite, sha256-liteDependency-free PNG decode and encode, inflate, and SHA-256.
schema/known-differences.schema.jsonThe JSON Schema of the committed known-difference document.

Changing the engine

This package is the one copy of the engine; compose-ai-tools and compose-preview-server depend on it rather than keeping their own. The tests and the conformance cases live beside it:

  • test/conformance/*.test.mjs are the engine's own node --test suites, run against the built dist/ by npm run test:conformance (and by the root npm test).
  • test/conformance/fixtures/known-differences/ is the 1,141-file conformance corpus, generated by test/conformance/build-known-difference-fixtures.mjs. Edit the generator, regenerate, and commit both: known-differences.test.mjs fails if the committed tree differs from what the generator writes.
  • packages/diff/test/known-differences-conformance.test.ts runs the same corpus through @design-parity/diff's adapter.
npm run build --workspace @design-parity/known-differences
node packages/known-differences/test/conformance/build-known-difference-fixtures.mjs
npm run test:conformance --workspace @design-parity/known-differences

The modules came from compose-ai-tools' scripts/design-artifacts/ and keep the form they were vendored in: a // @ts-nocheck line and .js specifiers. They are untyped JavaScript, so scripts/widen-declarations.mjs corrects the declarations TypeScript emits for them, and test/declarations.test.ts checks the result.

版本与发布记录

@design-parity/known-differences 共发布 20 个版本,首次发布于 2026/10/06;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.18.0latest2026/11/074 天前
1.17.02026/10/2617 天前
1.16.12026/10/1824 天前
1.16.02026/10/1726 天前
1.15.02026/10/1528 天前
1.14.12026/10/1230 天前

关于 @design-parity/known-differences 的常见问题

@design-parity/known-differences 是什么?

The compose-preview-known-differences/v1 acceptance engine: document ladder, gates, separated-plane scorer and a dependency-free PNG reader. One module per entry point, with no dependencies.

如何安装 @design-parity/known-differences?

在项目目录运行 npm install @design-parity/known-differences,或使用 pnpm add / yarn add / bun add。

@design-parity/known-differences 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@design-parity/known-differences 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@design-parity/known-differences 可以商用吗?

@design-parity/known-differences 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@design-parity/known-differences 的下载量有多少?

根据 npm 官方下载统计,@design-parity/known-differences 在 2026/10/12 – 2026/11/10 这 30 天内被下载 3,454 次,日均约 115 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@design-parity/known-differences 还在维护吗?

最新版本 1.18.0 发布于 2026/11/07(4 天前);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/10/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。