reacherhq / check-if-email-exists

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.
https://reacher.email
Other
4.31k stars 332 forks source link

Build for WASM #386

Open amaury1093 opened 4 years ago

amaury1093 commented 4 years ago

What does it take to make this lib compile to WASM?

Rationale: since browsers allow TCP connections, this should work in browser. I'd also like to try deploying this to cloudfare workers.

Right now, some deps don't compile to WASM, running wasm-pack build in core/ gives:

➜  core git:(master) wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling cfg-if v0.1.10
   Compiling log v0.4.8
   Compiling wasm-bindgen-shared v0.2.62
   Compiling bumpalo v3.3.0
   Compiling futures-core v0.3.5
   Compiling futures-sink v0.3.5
   Compiling wasm-bindgen v0.2.62
   Compiling slab v0.4.2
   Compiling once_cell v1.4.0
   Compiling lazy_static v1.4.0
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.5
   Compiling pkg-config v0.3.17
   Compiling cc v1.0.54
   Compiling smallvec v1.4.0
   Compiling pin-project-lite v0.1.5
   Compiling matches v0.1.8
   Compiling percent-encoding v2.1.0
   Compiling send_wrapper v0.4.0
   Compiling foreign-types-shared v0.1.1
   Compiling ppv-lite86 v0.2.8
   Compiling openssl v0.10.29
   Compiling gimli v0.21.0
   Compiling async-task v3.0.0
   Compiling iovec v0.1.4
   Compiling nodrop v0.1.14
   Compiling rustc-demangle v0.1.16
   Compiling match_cfg v0.1.0
   Compiling object v0.19.0
   Compiling bytes v0.5.4
   Compiling openssl-probe v0.1.2
   Compiling static_assertions v0.3.4
   Compiling ascii_utils v0.9.3
   Compiling quick-error v1.2.3
   Compiling linked-hash-map v0.5.3
   Compiling itoa v0.4.5
   Compiling base64 v0.11.0
   Compiling bufstream v0.1.4
   Compiling hostname v0.1.5
   Compiling net2 v0.2.34
error[E0432]: unresolved import `sys`
  --> /Users/amaurymartiny/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.34/src/tcp.rs:18:5
   |
18 | use sys::c;
   |     ^^^ maybe a missing crate `sys`?
-- snip --
bcomnes commented 2 years ago

Being able to call this library from a server side node or deno codebase as a wasm library would be great.

amaury1093 commented 2 years ago

Being able to call this library from a server side node or deno codebase as a wasm library would be great.

For server-side node code, there's also an alternative: #1105