Skip to content

Development

Prerequisites

  • Node 22+
  • Rust (stable) + cargo
  • Tauri CLI v2 (npm install installs it as a dev dependency)
  • For the desktop app on Linux: libwebkit2gtk-4.1-dev, libappindicator3-dev, librsvg2-dev
  • For rebuilding the WASM parser: wasm-pack and the wasm32-unknown-unknown target
cargo install wasm-pack
rustup target add wasm32-unknown-unknown

Running

npm install

npm run tauri dev    # desktop app — Rust + frontend hot-reload
npm run dev:web      # browser version at http://localhost:5301

Type checking

npx tsc --noEmit     # TypeScript
cargo check          # Rust (run from src-tauri/)
cargo test           # parser tests (run from packages/parsers/)

Generating test files

python3 scripts/generate_stdf.py        # synthetic STDF — 3 wafers, 4 tests
python3 scripts/generate_stdf_large.py  # large STDF — 25 wafers, 50 tests, ~10k dies/wafer
python3 scripts/generate_atdf.py        # synthetic ATDF — same structure
python3 scripts/generate_parquet.py     # synthetic Parquet (requires pyarrow) — 3 wafers, 10 tests; --large, --correlated, --codec also available

Files land in ~/.cache/wafertools/fixtures/ — override with WAFERTOOLS_FIXTURES, or pass a path as the first argument. Not /tmp: that is a RAM-backed tmpfs on systemd distros, and these files are large (the STDF one is 341 MB).

Architecture

src/
  main.ts          — app entry: file open, two-pass test selector, renderWafers, map/gallery view
  platform.ts      — platform adapter: Tauri IPC (desktop) or WASM-in-a-Worker (browser)
  parserWorker.ts  — web-only module worker running the WASM parsers off the UI thread
  mappingUI.ts     — CSV/JSON/Parquet column mapping overlay
  multiFileUI.ts   — multi-file rename and append confirmation
  testSelectorUI.ts — test selector overlay for large STDF/ATDF files
  types.ts         — shared types: ParsedFile, WaferData, TestDef, LotMeta

packages/parsers/  — shared Rust crate, compiles for native Tauri and WASM
  src/types.rs     — DieResult, WaferData, ParsedStdf, LotMeta, TestDef
  src/parse_stdf.rs — STDF V4 binary parser; includes first-pass scan and filtered parse
  src/parse_atdf.rs — ATDF ASCII parser; includes first-pass scan and filtered parse
  src/parse_csv.rs  — CSV/TSV parser with column mapping
  src/parse_json.rs — JSON array parser with column mapping
  src/parse_parquet.rs — Parquet parser (row-oriented, no arrow dep) with the same column mapping
  src/read_file.rs  — read_bytes / read_text with transparent .gz decompression

src-tauri/src/commands/  — thin Tauri async wrappers over packages/parsers
  parse_stdf.rs      — parse_stdf(path)
  parse_atdf.rs      — parse_atdf(path)
  parse_csv.rs       — csv_headers(path), parse_csv(path, mapping)
  parse_json.rs      — json_headers(path), parse_json(path, mapping)
  parse_parquet.rs   — parquet_headers(path), parse_parquet(path, mapping)
  stdf_test_names.rs — stdf_test_names(path) — first-pass test name scan
  atdf_test_names.rs — atdf_test_names(path) — first-pass test name scan
  parse_stdf_filtered.rs — parse_stdf_filtered(path, selected) — filtered parse
  parse_atdf_filtered.rs — parse_atdf_filtered(path, selected) — filtered parse
  extract_archive.rs — extract_archive(path), cleanup_extract()
  write_temp_html.rs — write_temp_html(html)

Building and publishing the WASM parser

The parsers compile to @wafertools/testdata-parser on npm. The package is consumed by both the tsmap web version and can be used independently.

Test a change against the web build without publishing anything, via a local link (from the repo root — this builds packages/parsers/pkg/ and symlinks node_modules/@wafertools/testdata-parser to it):

npm run parser:link    # build (dev/unoptimized) + link
npm run parser:build   # rerun after each Rust edit
npm run dev:web        # picks up the linked build immediately
npm run parser:unlink  # restore the published package — required before any release

To actually publish:

cd packages/parsers

# Build
wasm-pack build --target web -s wafertools --no-default-features --features wasm

# Publish
cd pkg
npm publish --access public

After publishing a new version:

# from repo root
npm install @wafertools/testdata-parser@latest
npx tsc --noEmit

Building for deployment

npm run build:web   # outputs to dist/ — deploy to any static host

The CI workflow (.github/workflows/deploy.yml) builds and deploys to GitHub Pages automatically on every push to main.