From 6f44b12814b8b8c3082af581672a3b21b721437b Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Mon, 30 Jun 2025 16:23:58 -0700
Subject: [PATCH 1/3] rename root `component-init` crate to
`component-init-transform`
and move it to a child directory.
This leave the `component-init` crate name available for a guest crate
that creates a nice DX for this feature.
---
Cargo.lock | 20 ++++++++++----------
Cargo.toml | 17 +++--------------
transform/Cargo.toml | 11 +++++++++++
{src => transform/src}/lib.rs | 0
wasmtime/Cargo.toml | 2 +-
wasmtime/src/lib.rs | 8 ++++----
6 files changed, 29 insertions(+), 29 deletions(-)
create mode 100644 transform/Cargo.toml
rename {src => transform/src}/lib.rs (100%)
diff --git a/Cargo.lock b/Cargo.lock
index 7fed6b2..6ebb638 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -354,24 +354,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
-name = "component-init"
+name = "component-init-cli"
version = "0.1.0"
dependencies = [
"anyhow",
- "async-trait",
- "futures",
- "wasm-encoder 0.235.0",
- "wasmparser 0.235.0",
+ "clap",
+ "component-init-wasmtime",
+ "tokio",
]
[[package]]
-name = "component-init-cli"
+name = "component-init-transform"
version = "0.1.0"
dependencies = [
"anyhow",
- "clap",
- "component-init-wasmtime",
- "tokio",
+ "async-trait",
+ "futures",
+ "wasm-encoder 0.235.0",
+ "wasmparser 0.235.0",
]
[[package]]
@@ -380,7 +380,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"async-trait",
- "component-init",
+ "component-init-transform",
"test-programs-artifacts",
"tokio",
"wasmtime",
diff --git a/Cargo.toml b/Cargo.toml
index 38503a9..ab54305 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[workspace]
-members = ["cli", "wasmtime", "test-programs", "test-programs/artifacts"]
+members = ["cli", "transform", "wasmtime", "test-programs", "test-programs/artifacts"]
+resolver = "3"
[workspace.package]
version = "0.1.0"
@@ -9,7 +10,7 @@ edition = "2024"
anyhow = "1.0.89"
async-trait = "0.1.83"
clap = { version = "4", features = ["derive"] }
-component-init = { path = "." }
+component-init-transform = { path = "./transform" }
component-init-wasmtime = { path = "./wasmtime" }
futures = "0.3.31"
test-programs = { path = "./test-programs" }
@@ -22,15 +23,3 @@ wasmtime-wasi = "34.0.1"
wasmtime-wasi-http = "34.0.1"
wat = "1.235.0"
wit-bindgen = "0.43.0"
-
-[package]
-name = "component-init"
-version.workspace = true
-edition.workspace = true
-
-[dependencies]
-anyhow.workspace = true
-async-trait.workspace = true
-futures.workspace = true
-wasm-encoder.workspace = true
-wasmparser.workspace = true
diff --git a/transform/Cargo.toml b/transform/Cargo.toml
new file mode 100644
index 0000000..ffef3ba
--- /dev/null
+++ b/transform/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "component-init-transform"
+version.workspace = true
+edition.workspace = true
+
+[dependencies]
+anyhow.workspace = true
+async-trait.workspace = true
+futures.workspace = true
+wasm-encoder.workspace = true
+wasmparser.workspace = true
diff --git a/src/lib.rs b/transform/src/lib.rs
similarity index 100%
rename from src/lib.rs
rename to transform/src/lib.rs
diff --git a/wasmtime/Cargo.toml b/wasmtime/Cargo.toml
index a41e953..4da06e7 100644
--- a/wasmtime/Cargo.toml
+++ b/wasmtime/Cargo.toml
@@ -6,7 +6,7 @@ edition.workspace = true
[dependencies]
anyhow.workspace = true
async-trait.workspace = true
-component-init.workspace = true
+component-init-transform.workspace = true
wasmtime.workspace = true
[dev-dependencies]
diff --git a/wasmtime/src/lib.rs b/wasmtime/src/lib.rs
index 7afc2ac..5499d5b 100644
--- a/wasmtime/src/lib.rs
+++ b/wasmtime/src/lib.rs
@@ -1,12 +1,12 @@
-use anyhow::{Context, Result, anyhow};
-use component_init::Invoker;
+use anyhow::{anyhow, Context, Result};
+use component_init_transform::Invoker;
use wasmtime::{
- Config, Engine, Store,
component::{Component, ComponentNamedList, Instance, Lift, Linker},
+ Config, Engine, Store,
};
pub async fn initialize(component: &[u8]) -> Result> {
- component_init::initialize(component, |instrumented| {
+ component_init_transform::initialize(component, |instrumented| {
Box::pin(async move {
let i = invoker(instrumented)
.await
From 9dd4bb28ac94d592d68696c59c8d856aed877a69 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Mon, 30 Jun 2025 21:44:13 -0700
Subject: [PATCH 2/3] nightly fmt
---
wasmtime/src/lib.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wasmtime/src/lib.rs b/wasmtime/src/lib.rs
index 5499d5b..32bbdc9 100644
--- a/wasmtime/src/lib.rs
+++ b/wasmtime/src/lib.rs
@@ -1,8 +1,8 @@
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use component_init_transform::Invoker;
use wasmtime::{
- component::{Component, ComponentNamedList, Instance, Lift, Linker},
Config, Engine, Store,
+ component::{Component, ComponentNamedList, Instance, Lift, Linker},
};
pub async fn initialize(component: &[u8]) -> Result> {
From a0ed6dead2de4d081c5bddfa7ad4b745be66b901 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Mon, 30 Jun 2025 21:48:13 -0700
Subject: [PATCH 3/3] cargo doc needs wasm32-wasip2 installed because
test-programs-artifacts build.rs uses it
---
.github/workflows/ci.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 877efb9..4673605 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -38,6 +38,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
+ target: wasm32-wasip2
- name: Format
run: cargo fmt --all -- --check
- name: Docs