Skip to content

Commit

Permalink
feat: Add wasm support for playground (#1082)
Browse files Browse the repository at this point in the history
**Description:**

This PR implements checker behaviors for `wasm` binding. By supporting wasm, implementing playground will become very easy. I also implemented PoC of playground and it works well. I'll contribute on that when this PR is ready and merged.

Due to the constraints of wasm, there is a few APIs that should not be used. Below is the list.

- `std::time::Instant`
- `mimalloc_rust` from `swc_node_base`
- All file-system related APIs.

We dropped some code to avoid use of the APIs, and this PR contains those changes. I marked this PR as draft; we have to manage them somehow before merge it.

**Related issue:**

 - #300
 - #1021
  • Loading branch information
AcrylicShrimp authored Oct 6, 2023
1 parent 105ff10 commit bec48ce
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 108 deletions.
149 changes: 55 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions crates/binding_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ edition = "2021"
crate-type = ["cdylib", "rlib"]

[dependencies]
anyhow = "1"
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.5"
wasm-bindgen = { version = "0.2.87", features = ["serde"] }
stc_ts_env = { path = "../stc_ts_env" }
stc_ts_errors = { path = "../stc_ts_errors" }
stc_ts_file_analyzer = { path = "../stc_ts_file_analyzer" }
stc_ts_type_checker = { path = "../stc_ts_type_checker" }
swc_common = { version = "0.29.37", features = ["tty-emitter"] }
swc_ecma_ast = "0.100.2"
swc_ecma_loader = "0.41.39"
swc_ecma_parser = "0.130.5"
Loading

0 comments on commit bec48ce

Please sign in to comment.