GithubHelp home page GithubHelp logo

Online repl about swc HOT 25 CLOSED

swc-project avatar swc-project commented on August 28, 2024 1
Online repl

from swc.

Comments (25)

kdy1 avatar kdy1 commented on August 28, 2024 1

Thanks!

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

Skalman avatar Skalman commented on August 28, 2024

Unfortunate that compiling to Webassembly seems difficult.

More search terms: Playground
Ref: #106

from swc.

dsherret avatar dsherret commented on August 28, 2024

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

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

@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.

from swc.

monoclex avatar monoclex commented on August 28, 2024

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.

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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?

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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

from swc.

9oelM avatar 9oelM commented on August 28, 2024

#1291

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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?

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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)

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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 :)

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

Danue1 avatar Danue1 commented on August 28, 2024

Are we ready to make swc available on the web?

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

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

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

Thanks a lot!

from swc.

9oelM avatar 9oelM commented on August 28, 2024

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

from swc.

kdy1 avatar kdy1 commented on August 28, 2024

Yes, you are right.

from swc.

Danue1 avatar Danue1 commented on August 28, 2024

Respectful!

from swc.

swc-bot avatar swc-bot commented on August 28, 2024

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.

from swc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.