/** * @typedef {'wasm' | 'native' | 'webworker'} EngineType */ /** * Main compiler class that provides a unified interface. */ export class Compiler { /** * @param {object} options * @param {EngineType} options.engine - The compiler engine to use. * @param {string} [options.nativePath='openscad'] - Path to the native executable. * @param {string} [options.fileType='stl'] - Output file type (e.g., 'stl', 'amf'). * @param {object} [options.args] - Optional: { fast: [...], full: [...] } extra args for each mode. */ constructor({ engine, nativePath, fileType, args }?: { engine: EngineType; nativePath?: string; fileType?: string; args?: object; }); engine: EngineType; nativePath: string; fileType: string; args: any; /** * Compiles OpenSCAD code to a string (STL or other file type). * @param {string} scadCode - The OpenSCAD code to compile. * @param {string} [mode='fast'] - Compilation mode ('fast', 'full', etc.). * @returns {EventEmitter} Emits output events. */ compile(scadCode: string, mode?: string): EventEmitter; /** * Gets the date-style version of the underlying OpenSCAD engine. * @returns {Promise} Resolves with the date-style version string, or null if not found. */ getVersion(): Promise; getDefaultFastArgs(): string[]; getDefaultArgs(): any[]; /** * Generates the OpenSCAD scene graph (CSG) as raw file output (no JSON conversion). * @param {string} scadCode - The OpenSCAD code to compile. * @returns {Promise} A promise that resolves with the raw CSG file Buffer. */ getSceneGraph(scadCode: string): Promise; /** * Compiles the model to STL and returns its physical dimensions and properties. * @param {string} scadCode - The OpenSCAD code to compile. * @returns {Promise} A promise resolving with the dimension information. */ getDimensions(scadCode: string): Promise; /** * Generates a PNG preview of the model using OpenSCAD's autocenter/viewall flags. * @param {string} scadCode - The OpenSCAD code. * @param {object} [options] - Preview options. * @param {string} [options.camera] - Optional camera string to override auto view. * @param {string} [options.imgsize='1024,768'] - Image dimensions. * @returns {Promise} Resolves with the PNG image buffer. */ getPreview(scadCode: string, options?: { camera?: string; imgsize?: string; }): Promise; } export type EngineType = "wasm" | "native" | "webworker";