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§
- Workbook
Editor - 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
Resulterrors. - read_
workbook - Read an in-memory XLSX/XLSM buffer, returning a JSON string shaped like xlsx@0.18.5’s
WorkBook({SheetNames, Sheets}; eachWorkSheeta sparse{"A1": {t,v,f,fmtId}, ..., "!ref": "A1:C3", "!merges": [...], "!hiddenRows": [...], "!hiddenCols": [...] }object, plus workbook-level"!numFmts"/"!date1904"and, when present,Workbook.Names— seepackages/xlsx/src/index.d.ts’sWorkBook/WorkSheettypes). The JS side (packages/xlsx/src/index.cjs’sread()) doesJSON.parseon the result — noserde/serde_jsondependency needed for a shape this small; reuseselixcee::diagnostics::json_string’s existing hand-rolled escaper (src/diagnostics.rs) rather than duplicating a JSON writer or adding a dependency.