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

Online repl #50

Closed
kdy1 opened this issue Nov 14, 2018 · 25 comments
Closed

Online repl #50

kdy1 opened this issue Nov 14, 2018 · 25 comments
Assignees

Comments

@kdy1
Copy link
Member

kdy1 commented Nov 14, 2018

ratel-rust have one, and it looks great

@kdy1
Copy link
Member Author

kdy1 commented Nov 16, 2018

It would be really hard as swc depends on rustc-ap crates.
Some rustc-ap crates can't be compiled as wasm.

cargo build --release --target wasm32-unknown-emscripten
   Compiling darling_core v0.7.0
   Compiling pmutil v0.2.0
   Compiling swc_atoms v0.1.0 (https://github.com/swc-project/swc.git#67daa279)
   Compiling sourcemap v2.2.1
   Compiling rustc-ap-rustc_data_structures v297.0.0
error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:195:21
    |
195 |                     os::F_WRLCK
    |                     ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:197:21
    |
197 |                     os::F_RDLCK
    |                     ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:200:29
    |
200 |                 let flock = os::flock {
    |                             ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:208:37
    |
208 |                 let cmd = if wait { os::F_SETLKW } else { os::F_SETLK };
    |                                     ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:208:59
    |
208 |                 let cmd = if wait { os::F_SETLKW } else { os::F_SETLK };
    |                                                           ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:224:29
    |
224 |                 let flock = os::flock {
    |                             ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:229:29
    |
229 |                     l_type: os::F_UNLCK,
    |                             ^^ Use of undeclared type or module `os`

error[E0433]: failed to resolve. Use of undeclared type or module `os`
   --> /Users/kdy1/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_data_structures-297.0.0/flock.rs:233:42
    |
233 |                     libc::fcntl(self.fd, os::F_SETLK, &flock);
    |                                          ^^ Use of undeclared type or module `os`

error: aborting due to 8 previous errors

@Skalman
Copy link

Skalman commented Nov 30, 2019

Unfortunate that compiling to Webassembly seems difficult.

More search terms: Playground
Ref: #106

@dsherret
Copy link
Contributor

dsherret commented Mar 9, 2020

Is it possible to do this now? I think so, right? I am using swc in a playground for dprint.

@kdy1
Copy link
Member Author

kdy1 commented Mar 9, 2020

@dsherret It's possible. But I'm not sure about the roadmap. I was too busy due to corona 19. And now, I have lots of bugs to fix.

@monoclex
Copy link

What's the status on this? I'd like to see swc be able to be compiled to wasm.

My usecase is that I've got a project that makes use of typescript that runs on Cloudflare Workers, and often running the typescript compiler on imports takes longer than 50ms, which is hitting the limits of a cloudflare worker. To get under the limit without using regex hacks, I'd like to use rust and swc to compile to wasm and then run that in a cloudflare worker.

@kdy1
Copy link
Member Author

kdy1 commented Sep 18, 2020

It's absolutely doable. I just do not have enough time.
I'll setup auto deployment for wasm anyway.

@9oelM
Copy link
Contributor

9oelM commented Dec 26, 2020

Now that @swc/wasm-web is successfully published, it should be duly possible to make an online repl. I'm happy to work on this. Can I do this?

@kdy1
Copy link
Member Author

kdy1 commented Dec 26, 2020

@9oelM Of course. Thanks a lot!
I always wanted an online repl but I had too many bugs to fix.

@9oelM
Copy link
Contributor

9oelM commented Dec 26, 2020

Alright I find some problems with that while trying to bootstrap the project with @swc/wasm-web. I will file some issues.

@9oelM
Copy link
Contributor

9oelM commented Dec 26, 2020

#1291

@9oelM
Copy link
Contributor

9oelM commented Dec 26, 2020

https://9oelm.github.io/swc-wasm-demo/
https://github.com/9oelM/swc-wasm-demo

@kdy1

how should I move it into this repo?

Also, what else should I add more to this?

@kdy1
Copy link
Member Author

kdy1 commented Dec 26, 2020

Wow, cool!

I think it would be great if it's integrated with the website, just like babel's one.
But it would need some design work and using react

So for now, uploading it to https://swc.rs/repl would be enough.
Can you make a pr to the public directory at https://github.com/swc-project/website/tree/master/website/static ? (with repl directory)

@9oelM
Copy link
Contributor

9oelM commented Dec 26, 2020

Yeah. I'm not a designer so perhaps somebody else could help later on the design 😂

Okay. I will do that soon. I'm recently busy with work stuffs, so I will do it in a few weeks.

Thank you!

FYI, this demo project already uses React :)

@kdy1
Copy link
Member Author

kdy1 commented Dec 26, 2020

@9oelM Sounds great. I hope I can do some design work...

@Danue1
Copy link

Danue1 commented Jun 25, 2021

Are we ready to make swc available on the web?

@kdy1
Copy link
Member Author

kdy1 commented Jun 25, 2021

I think so, swc has @swc/wasm-web.

@9oelM
Copy link
Contributor

9oelM commented Jun 29, 2021

Sorry i've been busy last few months. I will start working on it (basically porting what we have already on https://9oelm.github.io/swc-wasm-demo/). Btw, @kdy1 do you want it to be included in https://github.com/swc-project/website or make a separate repl website (although we discussed it few months ago)? I think it makes sense to include it together inside https://github.com/swc-project/website

@kdy1
Copy link
Member Author

kdy1 commented Jun 29, 2021

I also think website is a proper repository to store repl.

@9oelM
Copy link
Contributor

9oelM commented Jun 29, 2021

Ok. then I will make one more page in the Docusaurus website.

@kdy1
Copy link
Member Author

kdy1 commented Jun 29, 2021

Thanks a lot!

@9oelM
Copy link
Contributor

9oelM commented Jul 6, 2021

@kdy1 i think we can close this and open other issues for further improvements

@kdy1
Copy link
Member Author

kdy1 commented Jul 6, 2021

Yes, you are right.

@kdy1 kdy1 closed this as completed Jul 6, 2021
@kdy1
Copy link
Member Author

kdy1 commented Jul 6, 2021

Thanks!

@Danue1
Copy link

Danue1 commented Jul 7, 2021

Respectful!

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 23, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

7 participants