[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"]
backend = []
coredump = ["wasm-coredump-builder"]
sys = ["compiler", "dep:wasmer-vm"]
v8 = ["backend", "wasmer/v8"]
wast = ["wasmer-wast"]
host-net = ["virtual-net/host-net"]
wat = ["wasmer/wat"]
compiler = [
  "backend",
  "wasmer/compiler",
  "wasmer-compiler/translator",
  "wasmer-compiler/compiler",
  "sys",
]
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",
  "wasmer/singlepass",
  "wasmer-c-api-imports?/singlepass",
]
cranelift = [
  "wasmer-compiler-cranelift",
  "compiler",
  "wasmer/cranelift",
  "wasmer-c-api-imports?/cranelift",
]
llvm = [
  "wasmer-compiler-llvm",
  "compiler",
  "wasmer/llvm",
  "wasmer-c-api-imports?/llvm",
]
disable-all-logging = [
  "wasmer-wasix/disable-all-logging",
  "log/release_max_level_off",
]
headless = ["dep:wasmer-vm", "wasmer/sys"]
headless-minimal = ["headless", "disable-all-logging"]
telemetry = []
napi-v8 = ["dep:wasmer-napi"]
wasm-c-api = ["dep:wasmer-c-api-imports"]

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

tokio-subscriber = ["dep:console-subscriber", "tokio/tracing"]

[dependencies]
# Repo-local dependencies.

wasmer = { version = "=7.2.0", path = "../api", default-features = false, features = [
  "headless",
] }
wasmer-compiler = { version = "=7.2.0", path = "../compiler", features = [
  "compiler",
], optional = true }
wasmer-compiler-cranelift = { version = "=7.2.0", path = "../compiler-cranelift", optional = true }
wasmer-compiler-singlepass = { version = "=7.2.0", path = "../compiler-singlepass", optional = true }
wasmer-compiler-llvm = { version = "=7.2.0", path = "../compiler-llvm", optional = true }
wasmer-package.workspace = true
wasmer-vm = { version = "=7.2.0", path = "../vm", optional = true }
wasmer-wasix = { path = "../wasix", version = "=0.702.0", features = [
  "logging",
  "host-fs",
  "ctrlc",
  "sys",
], default-features = false }
wasmer-wast = { version = "=7.2.0", path = "../../tests/lib/wast", optional = true }
wasmer-types = { version = "=7.2.0", path = "../types", features = [
  "enable-serde",
  "detect-wasm-features",
] }
wasmer-napi = { version = "0.702.0", path = "../napi", optional = true }
wasmer-c-api-imports = { version = "=7.2.0", path = "../c-api-imports", optional = true, default-features = false }
virtual-fs = { version = "0.702.0", path = "../virtual-fs", default-features = false, features = [
  "host-fs",
] }
virtual-net = { version = "0.702.0", path = "../virtual-net" }
virtual-mio = { version = "0.702.0", path = "../virtual-io" }

# Wasmer-owned dependencies.

webc.workspace = true
wasmer-backend-api = { version = "=0.702.0", path = "../backend-api" }
wasmer-sdk = { version = "=7.2.0", path = "../sdk" }
wasmer-config = { version = "0.702.0", path = "../config" }

shared-buffer = { workspace = true, optional = true }
rkyv = { workspace = true, optional = true }

# Third-party dependencies.

http.workspace = true
colored.workspace = true
anyhow.workspace = true
bytesize.workspace = true
cfg-if.workspace = true
tempfile.workspace = true
serde.workspace = true
serde_json.workspace = true
dirs.workspace = true
path-clean.workspace = true
target-lexicon = { workspace = true, features = ["std"] }
indexmap.workspace = true
walkdir.workspace = true
regex.workspace = true
toml.workspace = true
url.workspace = true
libc.workspace = true
parking_lot.workspace = true
dialoguer.workspace = true
hex.workspace = true
flate2.workspace = true
cargo_metadata.workspace = true
tar.workspace = true
bytes.workspace = true
thiserror.workspace = true
log.workspace = true
semver.workspace = true
pathdiff.workspace = true
sha2.workspace = true
object.workspace = true
wasm-coredump-builder = { workspace = true, optional = true }
tracing.workspace = true
tracing-subscriber = { workspace = true, features = [
  "env-filter",
  "fmt",
  "json",
  "ansi",
] }
async-trait.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
once_cell.workspace = true
indicatif.workspace = true
opener.workspace = true
normpath.workspace = true
hyper = { workspace = true, features = ["server"] }
hyper-util = { workspace = true, features = [
  "tokio",
  "server",
  "server-graceful",
] }
http-body-util.workspace = true
futures.workspace = true
humantime.workspace = true
interfaces = { workspace = true, optional = true }

uuid = { workspace = true, features = ["v4"] }
time = { workspace = true, features = ["macros", "parsing"] }
serde_yaml.workspace = true
base64.workspace = true
comfy-table.workspace = true
git-version.workspace = true
itertools.workspace = true
enum-iterator.workspace = true

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

clap_complete.workspace = true
clap_mangen.workspace = true
zip = { workspace = true, features = ["deflate"] }
console.workspace = true
dotenvy.workspace = true
lzma-rs.workspace = true

console-subscriber = { workspace = true, optional = true }

# 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 = { workspace = true, default-features = true, features = [
  "derive",
  "env",
] }
[target.'cfg(target_family = "wasm")'.dependencies]
clap = { workspace = true, 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",
  "json",
  "multipart",
  "gzip",
  "zstd",
] }

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


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

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


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

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

[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.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"]
features = ["wasmer/cranelift"]