Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wasm): add support for the stable target wasm32-wasip2 #2453

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brooksmtownsend
Copy link

@brooksmtownsend brooksmtownsend commented Oct 21, 2024

Fixes #2294

Depends on servo/rust-url#983

This PR, in order of commits:

  • Adds target conditionals to separate the compilation of reqwest in the general wasm32 OS and the wasm32-wasip2 target (which is now a tier 2 target and Rust stable in 1.82)
  • Adds .vscode to the .gitignore (I can remove this if it's undesired)
  • Adds wasm32-wasip2 implementations for reqwest so that you can compile WebAssembly components and make outgoing requests that compile down to wasi:http bindings
    - This commit also adds a patch for crates.io that depends on fix: support wasm32-wasip2 on the stable channel servo/rust-url#983, which is why this PR is a draft. There is no significant functionality change upstream to make the wasm32-wasip2 target work for the url crate, just a change to remove an unstable feature flag.
  • Adds an example wasm_component to illustrate how this crate can be used in the context of a wasm32-wasip2 program.

I've attempted to bring over the minimal implementations into the wasm32-wasip2 code, e.g. no multipart support, to keep the review focused and simple to start. If any of these need to be added, I'm happy to add follow-up commits after the review.

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

refactor(wasm): add wasm mod

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
@brooksmtownsend brooksmtownsend force-pushed the feat/wasi-p2-component-stable-blocking branch from 1379d90 to 7edd47e Compare October 22, 2024 13:12
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

cleanup extraneous comment

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

feat: give back incoming body too

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

deps(url): remove patch

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

example cleanup extra blocking feature

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

use body example

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>

deps(url): remove patch

Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
@brooksmtownsend brooksmtownsend force-pushed the feat/wasi-p2-component-stable-blocking branch from 7edd47e to 3b3c99e Compare November 4, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support WebAssembly Component bindings, aka wasip2, in addition to javascript bindings
1 participant