[package]
name = "wasmer-cli"
description = "Wasmer CLI"
categories = ["wasm", "command-line-interface"]
keywords = ["wasm", "webassembly", "cli"]
readme = "README.md"
default-run = "wasmer"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[[bin]]
name = "wasmer"
path = "src/bin/wasmer.rs"
doc = false
required-features = ["backend"]

[[bin]]
name = "wasmer-headless"
path = "src/bin/wasmer_headless.rs"
doc = false
required-features = ["headless"]

[features]
# Don't add the compiler features in default, please add them on the Makefile
# since we might want to autoconfigure them depending on the availability on the host.
default = [
	"sys",
	"wat",
	"wast",
	"journal",
	"wasmer-artifact-create",
	"static-artifact-create",
]

# # Tun-tap client for connecting to Wasmer Edge VPNs
# tun-tap = [
# 	"dep:tun-tap",
# 	"virtual-net/tokio-tungstenite",
# 	"tokio-tungstenite",
# 	"mio",
# 	"mac_address",
# 	"dep:interfaces",
# ]
journal = ["wasmer-wasix/journal"]
fuse = ["dep:fuser", "dep:time01", "dep:shared-buffer", "dep:rkyv"]
backend = []
coredump = ["wasm-coredump-builder"]
sys = ["compiler", "wasmer-vm"]
v8 = ["backend", "wasmer/v8"]
wamr = ["backend", "wasmer/wamr"]
wasmi = ["backend", "wasmer/wasmi"]
jsc = ["backend", "wasmer/jsc", "wasmer/std"]
wast = ["wasmer-wast"]
host-net = ["virtual-net/host-net"]
wat = ["wasmer/wat"]
compiler = [
	"backend",
	"wasmer/compiler",
	"wasmer-compiler/translator",
	"wasmer-compiler/compiler",
]
wasmer-artifact-create = [
	"compiler",
	"wasmer/wasmer-artifact-load",
	"wasmer/wasmer-artifact-create",
	"wasmer-compiler/wasmer-artifact-load",
	"wasmer-compiler/wasmer-artifact-create",
]
static-artifact-create = [
	"compiler",
	"wasmer/static-artifact-load",
	"wasmer/static-artifact-create",
	"wasmer-compiler/static-artifact-load",
	"wasmer-compiler/static-artifact-create",
]
wasmer-artifact-load = [
	"compiler",
	"wasmer/wasmer-artifact-load",
	"wasmer-compiler/wasmer-artifact-load",
]
static-artifact-load = [
	"compiler",
	"wasmer/static-artifact-load",
	"wasmer-compiler/static-artifact-load",
]
singlepass = ["wasmer-compiler-singlepass", "compiler"]
cranelift = ["wasmer-compiler-cranelift", "compiler"]
llvm = ["wasmer-compiler-llvm", "compiler"]
disable-all-logging = [
	"wasmer-wasix/disable-all-logging",
	"log/release_max_level_off",
]
headless = []
headless-minimal = ["headless", "disable-all-logging"]
telemetry = []

# Optional
enable-serde = [
	"wasmer/enable-serde",
	"wasmer-vm/enable-serde",
	"wasmer-compiler/enable-serde",
	"wasmer-wasix/enable-serde",
]

[dependencies]
# Repo-local dependencies.

wasmer = { version = "=5.0.4", path = "../api", default-features = false }
wasmer-compiler = { version = "=5.0.4", path = "../compiler", features = [
	"compiler",
], optional = true }
wasmer-compiler-cranelift = { version = "=5.0.4", path = "../compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=5.0.4", path = "../compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=5.0.4", path = "../compiler-llvm", optional = true }
wasmer-package.workspace = true

wasmer-vm = { version = "=5.0.4", path = "../vm", optional = true }
wasmer-wasix = { path = "../wasix", version = "=0.34.0", features = [
	"logging",
	"webc_runner_rt_wcgi",
	"webc_runner_rt_dcgi",
	"webc_runner_rt_dproxy",
	"host-fs",
	"ctrlc",
] }
wasmer-wast = { version = "=5.0.4", path = "../../tests/lib/wast", optional = true }
wasmer-types = { version = "=5.0.4", path = "../types", features = [
	"enable-serde",
] }
virtual-fs = { version = "0.20.0", path = "../virtual-fs", default-features = false, features = [
	"host-fs",
] }
virtual-net = { version = "0.14.0", path = "../virtual-net" }
virtual-mio = { version = "0.7.0", path = "../virtual-io" }

# Wasmer-owned dependencies.

webc = { workspace = true }
wasmer-backend-api = { version = "=0.4.0", path = "../backend-api" }
lazy_static = "1.4.0"

# Used by the mount command

shared-buffer = { workspace = true, optional = true }
rkyv = { workspace = true, optional = true }
fuser = { version = "0.14.0", optional = true }
time01 = { package = "time", version = "0.1.45", optional = true }


# Third-party dependencies.

http.workspace = true
is-terminal = "0.4.7"
colored = "2.0"
anyhow = "1.0"
bytesize = "1.0"
cfg-if = "1.0"
tempfile = "3.6.0"
serde = { version = "1.0.147", features = ["derive"] }
dirs = "4.0"
serde_json = { version = "1.0" }
target-lexicon = { version = "0.12", features = ["std"] }
wasmer-config = { version = "0.12.0", path = "../config" }
indexmap = "1.9.2"
walkdir = "2.3.2"
regex = "1.6.0"
toml.workspace = true
url = "2.3.1"
libc.workspace = true
parking_lot = "0.12"
dialoguer = "0.11.0"
hex = "0.4.3"
flate2 = "1.0.25"
cargo_metadata = "0.15.2"
tar = "0.4.40"
bytes = "1"
thiserror = "1.0.37"
log = "0.4.17"
semver = "1.0.14"
pathdiff = "0.2.1"
sha2 = "0.10.6"
object = { workspace = true }
wasm-coredump-builder = { version = "0.1.11", optional = true }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3", features = [
	"env-filter",
	"fmt",
	"json",
] }
async-trait = "0.1.68"
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
once_cell = "1.17.1"
indicatif = "0.17.5"
opener = "0.6.1"
normpath = "=1.1.1"
hyper = { workspace = true, features = ["server"] }
hyper-util = { version = "0.1.5", features = ["tokio"] }
http-body-util = "0.1.1"
futures = "0.3.29"
humantime = "2.1.0"
interfaces = { version = "0.0.9", optional = true }

uuid = { version = "1.3.0", features = ["v4"] }
time = { workspace = true, features = ["macros"] }
serde_yaml = { workspace = true }
comfy-table = "7.0.1"


# Used by tuntap and connect
futures-util = { workspace = true }
mio = { workspace = true, optional = true }
tokio-tungstenite = { version = "0.21.0", features = [
	"rustls-tls-webpki-roots",
	"stream",
], optional = true }
mac_address = { version = "1.1.5", optional = true }
#tun-tap = { version = "0.1.4", features = ["tokio"], optional = true }

clap_complete = "4.5.2"
clap_mangen = "0.2.20"
zip = { version = "2.1.3", default-features = false, features = ["deflate"] }
console = "0.15.8"
dotenvy = "0.15.7"
lzma-rs = "0.3.0"

# NOTE: Must use different features for clap because the "color" feature does not
# work on wasi due to the anstream dependency not compiling.
[target.'cfg(not(target_family = "wasm"))'.dependencies]
clap = { version = "4.4.0", features = ["derive", "env"] }
[target.'cfg(target_family = "wasm")'.dependencies]
clap = { version = "4.4.0", default-features = false, features = [
	"std",
	"help",
	"usage",
	"error-context",
	"suggestions",
	"derive",
	"env",
] }

[target.'cfg(not(any(target_arch = "riscv64", target_arch = "loongarch64")))'.dependencies]
reqwest = { workspace = true, default-features = false, features = [
	"rustls-tls",
	"json",
	"multipart",
	"gzip",
] }

[target.'cfg(any(target_arch = "riscv64", target_arch = "loongarch64"))'.dependencies]
reqwest = { workspace = true, default-features = false, features = [
	"native-tls",
	"json",
	"multipart",
] }


[build-dependencies]
chrono = { version = "0.4.38", default-features = false, features = [
	"std",
	"clock",
] }

[target.'cfg(target_os = "linux")'.dependencies]
unix_mode = "0.1.3"


[dev-dependencies]
assert_cmd = "2.0.11"
predicates = "3.0.3"
pretty_assertions.workspace = true

[target.'cfg(target_os = "windows")'.dependencies]
colored = "2.0.0"

[package.metadata.binstall]
pkg-fmt = "tgz"

[package.metadata.binstall.overrides.aarch64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-darwin-arm64.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-darwin-amd64.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.aarch64-unknown-linux-gnu]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-aarch64.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.riscv64gc-unknown-linux-gnu]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-riscv64gc.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.x86_64-unknown-linux-gnu]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-amd64.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.x86_64-unknown-linux-musl]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-linux-musl-amd64.{ archive-format }"
bin-dir = "bin/{ bin }"

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-windows-amd64.{ archive-format }"
bin-dir = "bin/{ bin }.exe"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]