Remove OpenSCAD from the web port

Web FreeCAD does not implement OpenSCAD. Drop the module end to end
instead of keeping a blocked or placeholder shell:

- delete the parity-matrix row and regenerate the module registry
  (31 modules, OpenSCAD absent)
- remove the OpenSCAD-only frontend modules (worker, facades, slice,
  mesh backend, desktop/preferences tasks) and strip the OpenSCAD
  branches from the dispatchers, shells, storage and router
- neutralise the two shared owners that outlived the module:
  openscad-desktop-view -> scene-viewport (SceneViewport) and
  openscad-desktop-adapter -> scene-document (SceneDocument), so Part,
  Mesh and the other consumers keep working
- drop the FreeCADWebOpenSCADRuntimeProbe target and
  FREECAD_WEB_ENABLE_OPENSCAD option from the kernel CMake;
  BUILD_OPENSCAD stays in the forced-off list
- delete web/openscad.html, its Vite input, the kernel artifacts and
  the 17 OpenSCAD tool entry points

AGENTS.md records the removal rule. tsc --noEmit is clean and
grep -ri openscad web/src is empty.

Also carry the Boost pthread guard: under Emscripten a plain -lpthread
implies -sUSE_PTHREADS=1 and therewith --shared-memory, which the
non-atomics VTK archives cannot link against.

Validation NOT_RUN / PARTIAL_FAILED, Acceptance NOT_CLAIMED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 06:53:03 +08:00
parent acf222bb03
commit 65f59aba25
46 changed files with 19768 additions and 178 deletions

View File

@@ -0,0 +1,50 @@
import assert from "node:assert/strict";
import fs from "node:fs";
import { registerHooks } from "node:module";
import { fileURLToPath } from "node:url";
import ts from "../web/node_modules/typescript/lib/typescript.js";
const hooks = registerHooks({
resolve(specifier, context, next) {
if (specifier.endsWith("?worker&url"))
return { url: `data:text/javascript,export default ${JSON.stringify(specifier)}`, shortCircuit: true };
if (specifier.startsWith(".") && specifier.endsWith(".js") && context.parentURL?.includes("/web/src/"))
return next(specifier.slice(0, -3) + ".ts", context);
return next(specifier, context);
},
load(url, context, next) {
if (url.endsWith(".ts")) return { format: "module", shortCircuit: true,
source: ts.transpileModule(fs.readFileSync(fileURLToPath(url), "utf8"), {
compilerOptions: { target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.ESNext },
}).outputText };
return next(url, context);
},
});
const { DesktopCommandDispatcher } = await import("../web/src/desktop-command-dispatcher.ts");
const index = JSON.parse(fs.readFileSync("web/public/api/desktop-command-routes.json", "utf8"));
globalThis.fetch = async () => ({ ok: true, json: async () => index });
const calls = [];
const dispatcher = new DesktopCommandDispatcher({ request: async (...args) => {
calls.push(args);
return { kind: "error", requestId: "native-boundary", error: { code: "test_boundary" } };
} });
for (const command of ["Part_CheckGeometry", "Part_Builder"]) {
const record = { id: `Part:desktop:${command}`, module: "Part", command };
for (const args of [{}, { activeTask: true }, { selection: [{ documentId: "Other", object: "Box" }] }]) {
const response = await dispatcher.execute(record, args, "Current");
assert.equal(response.kind, "error");
assert.equal(response.error.code, "invalid_request");
}
assert.equal(calls.length, command === "Part_Builder" ? 1 : 0);
const args = command === "Part_CheckGeometry"
? { selection: [{ documentId: "Current", object: "Box" }] }
: { points: [[0, 0, 0], [1, 0, 0], [0, 1, 0]] };
await dispatcher.execute(record, args, "Current");
const [module, route, payload, document] = calls.at(-1);
assert.equal(module, "Part");
assert.equal(route, "part.pythonFamilyBatch");
assert.equal(document, "Current");
assert.equal(payload.records[0].apiId, `Part:desktop:${command}`);
}
console.log("PASS: six invalid alias requests rejected before Worker dispatch; two valid requests preserve canonical Part routing. No native business acceptance claimed.");
hooks.deregister();