1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//! # IFC-Lite WebAssembly Bindings
//!
//! JavaScript/TypeScript API for IFC-Lite built with [wasm-bindgen](https://docs.rs/wasm-bindgen).
//!
//! ## Overview
//!
//! This crate provides WebAssembly bindings for IFC-Lite, enabling high-performance
//! IFC parsing and geometry processing in web browsers.
//!
//! ## Features
//!
//! - **Zero-Copy Buffers**: Direct GPU buffer access without data copying
//! - **Streaming Parse**: Event-based parsing with progress callbacks
//! - **Small Bundle**: ~60 KB WASM binary, ~20 KB gzipped
//!
//! ## JavaScript Usage
//!
//! ```javascript
//! import init, { IfcAPI, version } from 'ifc-lite-wasm';
//!
//! // Initialize WASM
//! await init();
//!
//! // Create API instance
//! const api = new IfcAPI();
//!
//! // Parse IFC file
//! const buffer = await fetch('model.ifc').then(r => r.arrayBuffer());
//! const result = api.parse(new Uint8Array(buffer));
//!
//! console.log(`Parsed ${result.entityCount} entities`);
//! console.log(`Version: ${version()}`);
//! ```
//!
//! ## Streaming Parse
//!
//! ```javascript
//! const result = await api.parseStreaming(data, (event) => {
//! if (event.type === 'progress') {
//! console.log(`Progress: ${event.percent}%`);
//! }
//! });
//! ```
use *;
// The crate's panic hook (console report + analytics location stash — see
// utils.rs). Kept as the ONLY way a hook is installed here: installing
// `console_error_panic_hook::set_once` directly would silently drop the
// location stash the viewer's error tracking relies on (#1196, #2527).
pub use set_panic_hook;
// Observability seam for the wasm32 test leg only (tests/panic_stash.rs).
pub use stash_location_parts;
// Threaded build (off by default): exposes `initThreadPool(n)` to JS and makes
// the geometry crate's `par_iter` element loops parallel in WASM. Built as a
// SEPARATE bundle (atomics/shared-memory flags) via `build-wasm.sh BUILD_THREADED=1`;
// requires cross-origin isolation at runtime. See
// docs/architecture/csg-threading-design.md.
pub use init_thread_pool;
pub use IfcAPI;
pub use set_panic_hook as init_panic_hook;
pub use ;
/// Initialize the WASM module.
///
/// This function is called automatically when the WASM module is loaded.
/// It sets up panic hooks for better error messages in the browser console.
/// Get the version of IFC-Lite.
///
/// # Returns
///
/// Version string (e.g., "0.1.0")
///
/// # Example
///
/// ```javascript
/// console.log(`IFC-Lite version: ${version()}`);
/// ```