export interface OpenScadFS { mkdir(path: string): void; writeFile(path: string, data: string): void; readFile(path: string, opts: { encoding: 'utf8'; }): string; } export interface OpenScadInstance { FS: OpenScadFS; callMain(args: string[]): number; } export interface OpenScadModule { createOpenSCAD(opts: { noInitialRun: boolean; print: (text: string) => void; printErr: (text: string) => void; }): Promise<{ getInstance(): Promise; }>; } /** Loads (and caches) the openscad-wasm ES module from a CDN URL. */ export declare function loadOpenScadModule(wasmUrl?: string): Promise; export interface WorkerFile { fsPath: string; text: string; } export interface RunPassOptions { onLog?: (text: string) => void; args?: string[]; outFile?: string; } /** * Runs one OpenSCAD render pass in a fresh WASM instance. Each pass needs * its own instance — openscad-wasm@0.0.4's Emscripten runtime exits after * the first callMain(), so a second callMain() on a reused instance throws. * * @param mod openscad-wasm module, from loadOpenScadModule(). * @param files Written into the WASM virtual FS before running (parent * directories created as needed). * @param entryFsPath Which written file to render. * @returns OFF text, or null if the pass produced no geometry, or failed. */ export declare function runOpenScadPass(mod: OpenScadModule, files: WorkerFile[], entryFsPath: string, opts?: RunPassOptions): Promise; /** * Forces a `.scad` file's default trailing call (matched by * `defaultCallPattern`, a regex source) to a different module invocation — * the one piece of project-specific logic multi-part/multi-color rendering * needs, generalized so it's data a project passes in rather than a custom * worker it writes. No match is a no-op (returns entryText unchanged). */ export declare function forceCall(entryText: string, defaultCallPattern: string, call: string): string; export declare function fetchText(url: string): Promise; /** A `[+12.3s] message` logger tied to a Worker's postMessage. */ export declare function makeLogger(postMessage: (msg: { type: 'log'; text: string; }) => void): (text: string) => void;