新增能力:将 DOCX 发布验收拆分为四套独立 140,支持真实语料冻结、指纹复用、失败与基础设施错误独立统计,并为表格换行、全 JSON 围栏、代码连续性和长文档分页建立通用门禁。 问题修复:冻结 Paged.js 分片前的逻辑表格列轨并传递打印几何,统一 Markdown 表格换行、代码、段落与 OOXML 翻译;改进 PDF 文本流排序、语义块映射、颜色与栅格比较,消除窄字符重叠和跨行范围符号误报。 兼容与部署:版本统一为 0.6.2;正式 Docker 镜像内置固定 Chromium、Pandoc 3.9.0.2 和 Serif/Sans/Mono 字体;Desktop NSIS 与 ZIP 继续直接内置字体,无需系统字体安装。 验证结果:合成基线与长庆严格 280/280,M4N 140/140;健康数据残余误报 6/115(5.22%),均核查为重复表头自动对齐/取样误报且基础设施错误为 0。全项目测试、类型检查、生产构建和 git diff --check 通过;正式 Docker、NSIS、ZIP、离线镜像、部署包、清单及 SHA-256 均已生成并校验。
76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
import { readFile } from "node:fs/promises";
|
||
import { dirname, join, resolve } from "node:path";
|
||
import { fileURLToPath } from "node:url";
|
||
import {
|
||
buildFontPack,
|
||
verifyFontPack
|
||
} from "../packages/font-pack-builder/dist/index.js";
|
||
import { discoverFontPacks } from "../packages/font-pack-registry/dist/index.js";
|
||
|
||
const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||
const bundlePath = join(repositoryRoot, "font-packs", "bundle.json");
|
||
const bundle = JSON.parse(await readFile(bundlePath, "utf8"));
|
||
const outputRoot = join(repositoryRoot, "output", "font-packs", "root");
|
||
const appVersion = process.env.npm_package_version || "0.6.2";
|
||
|
||
if (
|
||
bundle.schemaVersion !== 1 ||
|
||
!Array.isArray(bundle.packs) ||
|
||
bundle.packs.length === 0
|
||
) {
|
||
throw new Error("字体包集合清单无效");
|
||
}
|
||
|
||
const identities = new Set();
|
||
const reports = [];
|
||
for (const pack of bundle.packs) {
|
||
const identity = `${pack.id}@${pack.version}`;
|
||
if (identities.has(identity)) {
|
||
throw new Error(`字体包集合存在重复项:${identity}`);
|
||
}
|
||
identities.add(identity);
|
||
const reportPath = join(
|
||
repositoryRoot,
|
||
"output",
|
||
"font-packs",
|
||
`${pack.id}-build-report.json`
|
||
);
|
||
const built = await buildFontPack({
|
||
recipePath: resolve(repositoryRoot, pack.recipe),
|
||
sourceRoot: resolve(repositoryRoot, pack.sourceRoot),
|
||
outputRoot,
|
||
reportPath
|
||
});
|
||
const verified = await verifyFontPack({
|
||
root: outputRoot,
|
||
appVersion,
|
||
packId: pack.id,
|
||
packVersion: pack.version
|
||
});
|
||
reports.push({ identity, built, verified });
|
||
}
|
||
|
||
const registry = await discoverFontPacks({
|
||
roots: [outputRoot],
|
||
appVersion
|
||
});
|
||
const errors = registry.diagnostics.filter((item) => item.severity === "error");
|
||
if (errors.length > 0) {
|
||
throw new Error(
|
||
`字体包集合注册失败:${errors.map((item) => `${item.code} ${item.message}`).join(";")}`
|
||
);
|
||
}
|
||
const actualIdentities = registry.packs
|
||
.map((pack) => `${pack.id}@${pack.version}`)
|
||
.sort();
|
||
const expectedIdentities = [...identities].sort();
|
||
if (JSON.stringify(actualIdentities) !== JSON.stringify(expectedIdentities)) {
|
||
throw new Error(
|
||
`字体包输出根目录包含清单外内容:期望 ${expectedIdentities.join(", ")},实际 ${actualIdentities.join(", ")}`
|
||
);
|
||
}
|
||
|
||
process.stdout.write(
|
||
`${JSON.stringify({ appVersion, outputRoot, registryFingerprint: registry.fingerprint, reports }, null, 2)}\n`
|
||
);
|