Skip to main content

Crate elixcee_wasm

Crate elixcee_wasm 

Source
Expand description

wasm-bindgen bridge for @elixcee/xlsx’s XLSX.read(bytes) — a thin JSON-shaping layer over elixcee::reader::read_workbook_from_bytes. See docs/xlsx-architecture.md’s “Phase 2B-0: sync WASM/read() bridge feasibility” and “Target workspace shape” sections.

Ships from two separate wasm-pack build invocations (see packages/xlsx’s build tooling): --target nodejs for the Node entry point (fully synchronous glue — no await init(), confirmed in the Phase 2B-0 spike) and --target web for the browser entry point, where the caller inlines the compiled .wasm bytes into the shipped JS and calls wasm-bindgen’s initSync itself rather than depending on a bundler resolving a bare .wasm import (bundlers don’t do that by default — also confirmed in 2B-0). The sync-vs-async difference lives entirely in how each target’s glue loads the module, not in this crate’s Rust code — both entry points call the exact same export below.

Structs§

WorkbookEditor
Stateful JS/WASM workbook editor for calculation-oriented workflows. OOXML writing remains the responsibility of the package’s existing JS writer.

Functions§

calculate_workbook
Recalculate formula cells in an in-memory XLSX/XLSM buffer using the same Rust workbook runtime as the VM, then return the normal raw workbook JSON.
diagnose_workbook
Return a small, deterministic diagnostic summary without materializing a calculated workbook. This gives Node/browser callers a structured preflight signal while keeping read/calculation failures as ordinary Result errors.
read_workbook
Read an in-memory XLSX/XLSM buffer, returning a JSON string shaped like xlsx@0.18.5’s WorkBook ({SheetNames, Sheets}; each WorkSheet a sparse {"A1": {t,v,f,fmtId}, ..., "!ref": "A1:C3", "!merges": [...], "!hiddenRows": [...], "!hiddenCols": [...] } object, plus workbook-level "!numFmts"/"!date1904" and, when present, Workbook.Names — see packages/xlsx/src/index.d.ts’s WorkBook/WorkSheet types). The JS side (packages/xlsx/src/index.cjs’s read()) does JSON.parse on the result — no serde/serde_json dependency needed for a shape this small; reuses elixcee::diagnostics::json_string’s existing hand-rolled escaper (src/diagnostics.rs) rather than duplicating a JSON writer or adding a dependency.