diff --git a/.gitignore b/.gitignore index 2fea1096..3c08feb9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ tests/output .env # Keep Wasm files for testing -!tests/fixtures/*.wasm +!crates/wash/tests/fixtures/*.wasm # Ignore IDE specific files .vscode diff --git a/Cargo.toml b/Cargo.toml index e2affd29..bfaccf6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,17 @@ -[package] -name = "wash" -categories = ["wasm", "command-line-utilities"] -description = "The Wasm Shell (wash) for developing and publishing Wasm components" -keywords = ["webassembly", "wasm", "component", "wash", "cli"] -readme = "README.md" -license = "Apache-2.0" -repository = "https://github.com/wasmcloud/wash" -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -version.workspace = true - -[lints] -workspace = true - [workspace] +resolver = "3" +default-members = ["crates/wash"] members = [ "crates/wash-runtime", + "crates/wash", + "crates/wasi", ] -package.authors = ["The wasmCloud Team"] -package.edition = "2024" -package.rust-version = "1.91.0" -package.version = "2.0.0-rc.6" + +[workspace.package] +authors = ["The wasmCloud Team"] +edition = "2024" +rust-version = "1.91.0" +version = "2.0.0-rc.6" [workspace.lints.rust] warnings = 'deny' # Treat all warnings as errors @@ -51,66 +41,6 @@ trivially_copy_pass_by_ref = 'deny' uninit_vec = 'deny' unnecessary_box_returns = 'deny' -[lib] -name = "wash" -path = "crates/wash/src/lib.rs" - -[[bin]] -name = "wash" -path = "src/main.rs" - -[badges] -maintenance = { status = "actively-developed" } - -[features] -# TODO: Many opportunities to gate the build by features - -[dependencies] -anyhow = { workspace = true } -async-trait = { workspace = true } -bytes = { workspace = true } -chrono = { workspace = true } -clap = { workspace = true, features = ["derive", "env", "help", "color", "suggestions", "wrap_help", "cargo", "string"] } -clap_complete = { workspace = true } -clap-markdown = { workspace = true } -ctrlc = { workspace = true } -dialoguer = { workspace = true, features = ["editor", "password", "zeroize", "fuzzy-select", "fuzzy-matcher"] } -etcetera = { workspace = true } -figment = { workspace = true, features = ["json", "env", "yaml", "toml"] } -flate2 = { workspace = true, features = ["rust_backend"] } -humantime = { workspace = true } -opentelemetry = { workspace = true } -opentelemetry_sdk = { workspace = true } -opentelemetry-semantic-conventions = { workspace = true, features = ["semconv_experimental"] } -opentelemetry-otlp = { workspace = true, features = ["grpc-tonic", "trace", "logs"] } -opentelemetry-appender-tracing = { workspace = true } -reqwest = { workspace = true, features = ["json", "rustls-tls"] } -rustls = { workspace = true } -semver = { workspace = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true, features = ["std"] } -serde_yaml_ng = { workspace = true } -tar = { workspace = true } -tempfile = { workspace = true } -tokio = { workspace = true, features = ["full"] } -tracing = { workspace = true, features = ["attributes"] } -tracing-subscriber = { workspace = true, features = ["env-filter", "ansi", "time", "json"] } -tracing-opentelemetry = { workspace = true } -url = { workspace = true } -uuid = { workspace = true } -wasm-metadata = { workspace = true } -wasm-pkg-client = { workspace = true } -wasm-pkg-core = { workspace = true } -wash-runtime = { workspace = true, features = ["washlet", "oci", "wasi-config", "wasi-logging", "wasi-blobstore", "wasi-keyvalue"] } -wasmtime = { workspace = true } -wasmtime-wasi = { workspace = true } -wit-component = { workspace = true } - -# Enable WebGPU support on non-Windows platforms -# WebGPU is disabled on Windows due to dependency version conflicts with the windows crate -[target.'cfg(not(target_os = "windows"))'.dependencies] -wash-runtime = { workspace = true, features = ["wasi-webgpu"] } - [workspace.dependencies] anyhow = { version = "1.0.98", default-features = false } async-nats = { version = "0.44", default-features = false } @@ -205,24 +135,6 @@ test-log = { version = "0.2", default-features = false, features = ["trace"] } wiggle = { version = "=41.0.0", default-features = false } windows-sys = "0.60.0" -[build-dependencies] -anyhow = { workspace = true, default-features = true } -tonic-prost-build = { workspace = true, default-features = true } -pbjson-build = { workspace = true, default-features = true } - - -[dev-dependencies] -bytes = { version = "1", default-features = false } -http = { version = "1.3.1", default-features = false } -http-body-util = { version = "0.1.3", default-features = false } -rcgen = { version = "0.13", default-features = false, features = ["crypto", "ring", "pem"] } -scopeguard = { version = "1.2", default-features = false } -tempfile = { version = "3.0", default-features = false } -tokio = { version = "1.45.1", default-features = false, features = ["full"] } -reqwest = { workspace = true, features = ["json"] } -wash-runtime = { workspace = true, features = ["wasi-keyvalue", "wasi-blobstore"] } -wat = { workspace = true } - [workspace.metadata.cargo-machete] ignored = [ # Used in build.rs @@ -234,10 +146,6 @@ ignored = [ "tonic-prost", ] -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/{name}-v{version}/wash-{ target }{ binary-ext }" -pkg-fmt = "bin" - # this section is required for testing `wash-wasi`, it should be removed before release [patch.crates-io] wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", tag = "v41.0.1" } diff --git a/crates/wash/Cargo.toml b/crates/wash/Cargo.toml new file mode 100644 index 00000000..d47011d4 --- /dev/null +++ b/crates/wash/Cargo.toml @@ -0,0 +1,94 @@ +[package] +name = "wash" +categories = ["wasm", "command-line-utilities"] +description = "The Wasm Shell (wash) for developing and publishing Wasm components" +keywords = ["webassembly", "wasm", "component", "wash", "cli"] +readme = "README.md" +license = "Apache-2.0" +repository = "https://github.com/wasmcloud/wash" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +version.workspace = true + +[lints] +workspace = true + +[lib] +name = "wash" +path = "src/lib.rs" + +[[bin]] +name = "wash" +path = "src/main.rs" + +[badges] +maintenance = { status = "actively-developed" } + +[dependencies] +anyhow = { workspace = true } +async-trait = { workspace = true } +bytes = { workspace = true } +chrono = { workspace = true } +clap = { workspace = true, features = ["derive", "env", "help", "color", "suggestions", "wrap_help", "cargo", "string"] } +clap_complete = { workspace = true } +clap-markdown = { workspace = true } +ctrlc = { workspace = true } +dialoguer = { workspace = true, features = ["editor", "password", "zeroize", "fuzzy-select", "fuzzy-matcher"] } +etcetera = { workspace = true } +figment = { workspace = true, features = ["json", "env", "yaml", "toml"] } +flate2 = { workspace = true, features = ["rust_backend"] } +humantime = { workspace = true } +opentelemetry = { workspace = true } +opentelemetry_sdk = { workspace = true } +opentelemetry-semantic-conventions = { workspace = true, features = ["semconv_experimental"] } +opentelemetry-otlp = { workspace = true, features = ["grpc-tonic", "trace", "logs"] } +opentelemetry-appender-tracing = { workspace = true } +reqwest = { workspace = true, features = ["json", "rustls-tls"] } +rustls = { workspace = true } +semver = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["std"] } +serde_yaml_ng = { workspace = true } +tar = { workspace = true } +tempfile = { workspace = true } +tokio = { workspace = true, features = ["full"] } +tracing = { workspace = true, features = ["attributes"] } +tracing-subscriber = { workspace = true, features = ["env-filter", "ansi", "time", "json"] } +tracing-opentelemetry = { workspace = true } +url = { workspace = true } +uuid = { workspace = true } +wasm-metadata = { workspace = true } +wasm-pkg-client = { workspace = true } +wasm-pkg-core = { workspace = true } +wash-runtime = { workspace = true, features = ["washlet", "oci", "wasi-config", "wasi-logging", "wasi-blobstore", "wasi-keyvalue"] } +wasmtime = { workspace = true } +wasmtime-wasi = { workspace = true } +wit-component = { workspace = true } + +# Enable WebGPU support on non-Windows platforms +# WebGPU is disabled on Windows due to dependency version conflicts with the windows crate +[target.'cfg(not(target_os = "windows"))'.dependencies] +wash-runtime = { workspace = true, features = ["wasi-webgpu"] } + + +[build-dependencies] +anyhow = { workspace = true, default-features = true } +tonic-prost-build = { workspace = true, default-features = true } +pbjson-build = { workspace = true, default-features = true } + +[dev-dependencies] +bytes = { version = "1", default-features = false } +http = { version = "1.3.1", default-features = false } +http-body-util = { version = "0.1.3", default-features = false } +rcgen = { version = "0.13", default-features = false, features = ["crypto", "ring", "pem"] } +scopeguard = { version = "1.2", default-features = false } +tempfile = { version = "3.0", default-features = false } +tokio = { version = "1.45.1", default-features = false, features = ["full"] } +reqwest = { workspace = true, features = ["json"] } +wash-runtime = { workspace = true, features = ["wasi-keyvalue", "wasi-blobstore"] } +wat = { workspace = true } + +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/{name}-v{version}/wash-{ target }{ binary-ext }" +pkg-fmt = "bin" diff --git a/crates/wash/README.md b/crates/wash/README.md new file mode 100644 index 00000000..456172b8 --- /dev/null +++ b/crates/wash/README.md @@ -0,0 +1,9 @@ +# wash + +The Wasm Shell (wash) for developing and publishing Wasm components. + +For installation instructions, usage, and documentation, see the [main README](../../README.md). + +## License + +This project is licensed under the Apache License 2.0 - see the [LICENSE](../../LICENSE) file for details. diff --git a/src/main.rs b/crates/wash/src/main.rs similarity index 100% rename from src/main.rs rename to crates/wash/src/main.rs diff --git a/crates/wash/tests/common.rs b/crates/wash/tests/common.rs deleted file mode 100644 index 9a80357b..00000000 --- a/crates/wash/tests/common.rs +++ /dev/null @@ -1,9 +0,0 @@ -use anyhow::Result; - -/// Find an available port by binding to a random port (0) and returning the assigned port. -pub async fn find_available_port() -> Result { - use tokio::net::TcpListener; - let listener = TcpListener::bind("127.0.0.1:0").await?; - let addr = listener.local_addr()?; - Ok(addr.port()) -} diff --git a/tests/fixtures/blobby.wasm b/crates/wash/tests/fixtures/blobby.wasm similarity index 100% rename from tests/fixtures/blobby.wasm rename to crates/wash/tests/fixtures/blobby.wasm diff --git a/tests/fixtures/blobstore_filesystem.wasm b/crates/wash/tests/fixtures/blobstore_filesystem.wasm similarity index 100% rename from tests/fixtures/blobstore_filesystem.wasm rename to crates/wash/tests/fixtures/blobstore_filesystem.wasm diff --git a/tests/fixtures/component.wasm b/crates/wash/tests/fixtures/component.wasm similarity index 100% rename from tests/fixtures/component.wasm rename to crates/wash/tests/fixtures/component.wasm diff --git a/tests/fixtures/http_blobstore.wasm b/crates/wash/tests/fixtures/http_blobstore.wasm similarity index 100% rename from tests/fixtures/http_blobstore.wasm rename to crates/wash/tests/fixtures/http_blobstore.wasm diff --git a/tests/fixtures/http_counter.wasm b/crates/wash/tests/fixtures/http_counter.wasm similarity index 100% rename from tests/fixtures/http_counter.wasm rename to crates/wash/tests/fixtures/http_counter.wasm diff --git a/tests/fixtures/http_hello_world_rust.wasm b/crates/wash/tests/fixtures/http_hello_world_rust.wasm similarity index 100% rename from tests/fixtures/http_hello_world_rust.wasm rename to crates/wash/tests/fixtures/http_hello_world_rust.wasm diff --git a/tests/fixtures/http_keyvalue_counter.wasm b/crates/wash/tests/fixtures/http_keyvalue_counter.wasm similarity index 100% rename from tests/fixtures/http_keyvalue_counter.wasm rename to crates/wash/tests/fixtures/http_keyvalue_counter.wasm diff --git a/tests/fixtures/http_webgpu.wasm b/crates/wash/tests/fixtures/http_webgpu.wasm similarity index 100% rename from tests/fixtures/http_webgpu.wasm rename to crates/wash/tests/fixtures/http_webgpu.wasm diff --git a/tests/fixtures/inter_component_call_callee.wasm b/crates/wash/tests/fixtures/inter_component_call_callee.wasm similarity index 100% rename from tests/fixtures/inter_component_call_callee.wasm rename to crates/wash/tests/fixtures/inter_component_call_callee.wasm diff --git a/tests/fixtures/inter_component_call_caller.wasm b/crates/wash/tests/fixtures/inter_component_call_caller.wasm similarity index 100% rename from tests/fixtures/inter_component_call_caller.wasm rename to crates/wash/tests/fixtures/inter_component_call_caller.wasm diff --git a/tests/fixtures/inter_component_call_middleware.wasm b/crates/wash/tests/fixtures/inter_component_call_middleware.wasm similarity index 100% rename from tests/fixtures/inter_component_call_middleware.wasm rename to crates/wash/tests/fixtures/inter_component_call_middleware.wasm diff --git a/tests/integration_http_counter_with_blobstore_fs.rs b/crates/wash/tests/integration_http_counter_with_blobstore_fs.rs similarity index 100% rename from tests/integration_http_counter_with_blobstore_fs.rs rename to crates/wash/tests/integration_http_counter_with_blobstore_fs.rs diff --git a/tests/integration_inter_component_call.rs b/crates/wash/tests/integration_inter_component_call.rs similarity index 100% rename from tests/integration_inter_component_call.rs rename to crates/wash/tests/integration_inter_component_call.rs diff --git a/tests/integration_plugins.rs b/crates/wash/tests/integration_plugins.rs similarity index 100% rename from tests/integration_plugins.rs rename to crates/wash/tests/integration_plugins.rs diff --git a/tests/integration_wit.rs b/crates/wash/tests/integration_wit.rs similarity index 100% rename from tests/integration_wit.rs rename to crates/wash/tests/integration_wit.rs diff --git a/wit/deps/wasi-cli-0.2.0/package.wit b/crates/wash/wit/deps/wasi-cli-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-cli-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-cli-0.2.0/package.wit diff --git a/wit/deps/wasi-clocks-0.2.0/package.wit b/crates/wash/wit/deps/wasi-clocks-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-clocks-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-clocks-0.2.0/package.wit diff --git a/wit/deps/wasi-filesystem-0.2.0/package.wit b/crates/wash/wit/deps/wasi-filesystem-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-filesystem-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-filesystem-0.2.0/package.wit diff --git a/wit/deps/wasi-http-0.2.0/package.wit b/crates/wash/wit/deps/wasi-http-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-http-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-http-0.2.0/package.wit diff --git a/wit/deps/wasi-io-0.2.0/package.wit b/crates/wash/wit/deps/wasi-io-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-io-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-io-0.2.0/package.wit diff --git a/wit/deps/wasi-logging-0.1.0-draft/package.wit b/crates/wash/wit/deps/wasi-logging-0.1.0-draft/package.wit similarity index 100% rename from wit/deps/wasi-logging-0.1.0-draft/package.wit rename to crates/wash/wit/deps/wasi-logging-0.1.0-draft/package.wit diff --git a/wit/deps/wasi-random-0.2.0/package.wit b/crates/wash/wit/deps/wasi-random-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-random-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-random-0.2.0/package.wit diff --git a/wit/deps/wasi-sockets-0.2.0/package.wit b/crates/wash/wit/deps/wasi-sockets-0.2.0/package.wit similarity index 100% rename from wit/deps/wasi-sockets-0.2.0/package.wit rename to crates/wash/wit/deps/wasi-sockets-0.2.0/package.wit diff --git a/wit/world.wit b/crates/wash/wit/world.wit similarity index 100% rename from wit/world.wit rename to crates/wash/wit/world.wit diff --git a/wkg.lock b/crates/wash/wkg.lock similarity index 100% rename from wkg.lock rename to crates/wash/wkg.lock