mirror of
https://github.com/visioncortex/vtracer.git
synced 2026-09-12 07:06:03 -07:00
749f0df0bd
New nodejs/ package: a wasm-bindgen crate (vtracer-wasm) built with wasm-pack that wraps the vtracer framework, plus a thin JS layer for file I/O. Image decoding (png/jpeg/gif/bmp via the image crate) runs in wasm too, so the package has zero native dependencies — no sharp, no node-gyp. No separate general-purpose wasm crate: the Node package directly owns and wraps the wasm. Excluded from the cargo workspace (wasm-bindgen cdylib), built with wasm-pack. JS API (camelCase options): convertBuffer, convertPixels, convertFile, convertFileSync — each taking an Options object (preset, colorMode, hierarchical/cutout mosaic, mode, palette, maxColors, optimize, ...). Ships index.d.ts types and a node smoke test. README updated. Verified: builds to wasm32-unknown-unknown; `node test.js` passes; output matches the CLI/Python bindings (253 paths on the tank sample).
28 lines
913 B
TOML
28 lines
913 B
TOML
[package]
|
|
name = "vtracer-wasm"
|
|
description = "WebAssembly core for the vtracer Node.js package."
|
|
version = "1.0.0-alpha.1"
|
|
authors = ["Chris Tsang <tyt2y7@gmail.com>"]
|
|
edition = "2021"
|
|
license = "MIT OR Apache-2.0"
|
|
repository = "https://github.com/visioncortex/vtracer/"
|
|
|
|
# Not the core workspace: this is a wasm-bindgen cdylib built with wasm-pack as
|
|
# the Node package's native core. The Node layer does file I/O; image decoding
|
|
# happens here in wasm, so the package has no native dependency.
|
|
|
|
[lib]
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
vtracer = { version = "1.0.0-alpha.1", path = "../crates/vtracer" }
|
|
wasm-bindgen = "0.2"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde-wasm-bindgen = "0.6"
|
|
# Pure-Rust decoders that compile to wasm32-unknown-unknown.
|
|
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "bmp"] }
|
|
|
|
[profile.release]
|
|
opt-level = "s"
|
|
lto = true
|