feat(wasm): examples/wasm-viewer, an HDF5/NetCDF-4 viewer page

Drop a file (or pass ?file=<url>&path=<object>), browse the tree lazily,
see a dataset's type, shape, max shape and attributes, and page through
its values as 50x12 hyperslab windows (leading dims of 3-D+ data held
at chosen indices). build.sh produces pkg/ (not committed) with
wasm-bindgen --target web and checks the CLI matches the crate version.

test/run.sh builds it and runs test.mjs under Node against the h5py/
netCDF4 fixture (250 checks: every dataset whole and as a strided
hyperslab, listings, attributes, error paths, the page's DOM-free
helpers), then browser.sh renders the page in headless Chromium for
eight objects and checks the DOM. The fixture gains LZ4 (read) and Zstd
(refused: links C) datasets and a compound attribute (value null plus
its type). ci-test.sh runs it when node and wasm-bindgen exist; the CI
container has neither, so CI relies on the native h5py_interop test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-26 00:05:34 -05:00
co-authored by Claude Opus 5.5
parent a42b646689
commit 1abd93e0f8
11 changed files with 800 additions and 1 deletions
+7 -1
View File
@@ -130,7 +130,13 @@ fn check_attr(file: &str, path: &str, name: &str, got: &AttrValue, want: &Value)
.collect();
assert_eq!(v, &w, "{ctx}");
}
AttrValue::Raw { datatype, .. } => panic!("{ctx}: undecoded {datatype:?}"),
AttrValue::Raw { datatype, .. } => {
let want = want["raw"]
.as_str()
.unwrap_or_else(|| panic!("{ctx}: undecoded {datatype:?}"));
let d = clawhdf5_wasm::core::describe(datatype);
assert!(d.contains(want), "{ctx}: {d}");
}
}
}