[package]
name = "cross_usb"
version = "0.3.0"
authors = ["G2-Games <ke0bhogsg@gmail.com>"]
repository = "https://github.com/G2-Games/cross-usb"
documentation = "https://docs.rs/cross_usb"

description = """
A Rust USB library which works seamlessly across both native and WASM targets
"""

keywords = ["usb", "wasm", "web-usb"]
categories = ["wasm", "web-programming", "hardware-support"]
readme = "README.md"
license = "AGPL-3.0"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
thiserror = "1.0.56"

[dev-dependencies]
tokio-test = "0.4.3"

# Wasm deps
[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"

[target.'cfg(target_family = "wasm")'.dependencies.web-sys]
version = "0.3"
features = [
    "Window",
    "Navigator",
    "Usb",
    "UsbDevice",
    "UsbInterface",
    "UsbRecipient",
    "UsbRequestType",
    "UsbControlTransferParameters",
    "UsbDeviceRequestOptions",
    "UsbInTransferResult",
    "UsbOutTransferResult",
]

# Non-wasm deps
[target.'cfg(not(target_family = "wasm"))'.dependencies]
nusb = "0.1"

[profile.release]
lto = true
strip = true
opt-level = "z"
codegen-units = 1

[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
dwarf-debug-info = true

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "x86_64-apple-darwin", "aarch64-apple-darwin", "wasm32-unknown-unknown"]