feat(wasm): clawhdf5-wasm, the reader for JavaScript via wasm-bindgen
open(bytes) -> H5File with kind/list/info/attrs/attrErrors/read/ readHyperslab. Numeric data comes back in the typed array of the stored width (Int16Array for i16, BigInt64Array for i64, Float32Array for f32/f16, ...), strings and enum names as string arrays, array datatypes flattened with their dims appended to the shape. Compound, reference, opaque and VL-sequence datasets are refused with an error naming the type; nothing is returned as reinterpreted bytes. The logic is in a plain-Rust core module, tested natively: unit tests, and h5py_interop, which compares every dataset, hyperslab, listing and attribute of an h5py- and a netCDF4-written file with what libhdf5 reads back (generator shared with the Node test of the built package). No mmap, no threads; lz4 is on, zstd/szip (C) are not. A wasm-release profile (opt-level s, LTO) serves the browser build. ci-test.sh lints the crate for wasm32 and checks it builds no C. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
+9
-2
@@ -92,7 +92,8 @@ run_step "cargo clippy (fast-deflate / zlib-ng)" cargo clippy \
|
||||
no_c_in_default_build() {
|
||||
local crate found=0
|
||||
for crate in clawhdf5-format clawhdf5-io clawhdf5-filters clawhdf5 \
|
||||
clawhdf5-agent clawhdf5-ann clawhdf5-accel clawhdf5-netcdf4 clawhdf5-cli; do
|
||||
clawhdf5-agent clawhdf5-ann clawhdf5-accel clawhdf5-netcdf4 clawhdf5-cli \
|
||||
clawhdf5-wasm; do
|
||||
local c_deps
|
||||
c_deps=$(cargo tree -q -p "$crate" -e normal,build --prefix none \
|
||||
| grep -E '^([a-z0-9_-]+-sys|cc|cmake) v' | sort -u)
|
||||
@@ -107,12 +108,18 @@ no_c_in_default_build() {
|
||||
run_step "no C in the default build (core crates)" no_c_in_default_build
|
||||
|
||||
# The reader in the browser: the facade's read path must build for
|
||||
# wasm32-unknown-unknown (no mmap, no threads, no file system). Needs
|
||||
# wasm32-unknown-unknown (no mmap, no threads, no file system), and the
|
||||
# wasm-bindgen crate must build and lint there. Needs
|
||||
# `rustup target add wasm32-unknown-unknown`.
|
||||
run_step "wasm32 build (clawhdf5, no default features)" cargo build \
|
||||
-p clawhdf5 \
|
||||
--target wasm32-unknown-unknown \
|
||||
--no-default-features
|
||||
run_step "wasm32 clippy (clawhdf5-wasm)" cargo clippy \
|
||||
-p clawhdf5-wasm \
|
||||
--target wasm32-unknown-unknown \
|
||||
--all-targets \
|
||||
-- -D warnings
|
||||
|
||||
# The workspace declares a minimum Rust version (rust-version in Cargo.toml);
|
||||
# check that it really builds there, so the README badge and the manifests
|
||||
|
||||
Reference in New Issue
Block a user