Files
FreeCADWasmDev/web/src/format-runtime.ts
wangdequan 65f59aba25 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>
2026-11-15 06:53:03 +08:00

32 lines
2.9 KiB
TypeScript

export interface FormatRuntimeIndex {
schema: "freecad-web-format-runtime-index/v1";
source: { inventory: string; inventoryRecords: number; inventorySha256: string };
fields: { modules: string[]; directions: string[]; kinds: string[] };
records: [string, number, number, string, number, number][];
}
export interface FormatRuntimeRecord { id: string; module: string; kind: string; name: string; direction: string; evidenceCount: number; }
export function decodeFormatRuntimeRecord(index: FormatRuntimeIndex, row: FormatRuntimeIndex["records"][number]): FormatRuntimeRecord {
return { id: row[0], module: index.fields.modules[row[1]] ?? "", kind: index.fields.kinds[row[2]] ?? "", name: row[3], direction: index.fields.directions[row[4]] ?? "", evidenceCount: row[5] };
}
export function createFormatRuntimeLookup(index: FormatRuntimeIndex): Map<string, FormatRuntimeRecord> {
return new Map(index.records.map((row) => { const record = decodeFormatRuntimeRecord(index, row); return [record.id, record] as const; }));
}
export interface FormatActionRoute { module: string; command: string; worker?: string; reason: string; }
export function resolveFormatAction(record: FormatRuntimeRecord): FormatActionRoute | undefined {
if (record.kind !== "extension") return undefined;
if (record.module === "Import" && [".step", ".stp", ".iges", ".igs"].includes(record.name) && record.direction === "import") return { module: "Import", command: "import.step", reason: "native Import STEP/IGES route" };
if (record.module === "Part" && [".brep", ".brp"].includes(record.name)) return { module: "Part", command: "part.importExport", worker: "part.worker.ts", reason: "native Part BREP route" };
if (record.module === "Part" && record.name === ".fcstd") return { module: "Part", command: "part.saveReopen", worker: "part-save.worker.ts", reason: "native Part FCStd round-trip route" };
if (record.module === "Mesh" && [".stl", ".obj", ".ply", ".off", ".3mf", ".amf"].includes(record.name)) return { module: "Mesh", command: "mesh.importExport", reason: "native Mesh import/export route" };
if (record.module === "TechDraw" && [".svg", ".dxf"].includes(record.name)) return { module: "TechDraw", command: "techdraw.nativeImportExport", worker: "techdraw-native.worker.ts", reason: "native TechDraw projection route" };
if (record.module === "Draft" && [".svg", ".dxf"].includes(record.name)) return { module: "Draft", command: "draft.formatBatch", worker: "draft.worker.ts", reason: "native Draft geometry format route" };
if (record.module === "Spreadsheet" && record.name === ".fcstd") return { module: "Spreadsheet", command: "spreadsheet.saveReopen", worker: "spreadsheet-save.worker.ts", reason: "native Spreadsheet FCStd route" };
if (record.module === "Spreadsheet" && record.name.toLowerCase() === ".csv") return { module: "Spreadsheet", command: "spreadsheet.importExportCsv", worker: "spreadsheet.worker.ts", reason: "native Spreadsheet CSV import/export route" };
return undefined;
}