Files
workinf_Blender_Wasm/tools/web/check-web-engine-command-registry.mjs
mes123456 e2e81c7c00
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): classify and route complete Blender inventory
2026-09-06 21:10:31 +08:00

17 lines
1.2 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
const protocol = fs.readFileSync(new URL("../../web/protocol/web-engine.ts", import.meta.url), "utf8");
const registry = fs.readFileSync(new URL("../../web/protocol/web-engine-capabilities.ts", import.meta.url), "utf8");
const commandUnion = protocol.split("export type WebEngineEditCommand =", 2)[1]?.split("/** JSON values", 1)[0] ?? "";
const commands = new Set([...commandUnion.matchAll(/type:\s*"([A-Za-z0-9]+)"/gu)].map((match) => match[1]));
commands.add("moveNLAStrip");
const registered = new Set([...registry.matchAll(/^ ([A-Za-z0-9]+): \{/gmu)].map((match) => match[1]));
registered.delete("listBlenderOperators");
registered.delete("invokeBlenderOperator");
const missing = [...commands].filter((command) => !registered.has(command)).sort();
const stale = [...registered].filter((command) => !commands.has(command)).sort();
assert.deepEqual(missing, [], `WebEngine edit commands missing capabilities: ${missing.join(",")}`);
assert.deepEqual(stale, [], `WebEngine capabilities without edit commands: ${stale.join(",")}`);
process.stdout.write(`web-engine-command-registry-ok commands=${commands.size}\n`);