Comments (25)
Thanks!
from swc.
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.
Unfortunate that compiling to Webassembly seems difficult.
More search terms: Playground
Ref: #106
from swc.
Is it possible to do this now? I think so, right? I am using swc in a playground for dprint.
from swc.
@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.
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.
It's absolutely doable. I just do not have enough time.
I'll setup auto deployment for wasm anyway.
from swc.
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.
@9oelM Of course. Thanks a lot!
I always wanted an online repl but I had too many bugs to fix.
from swc.
Alright I find some problems with that while trying to bootstrap the project with @swc/wasm-web
. I will file some issues.
from swc.
from swc.
https://9oelm.github.io/swc-wasm-demo/
https://github.com/9oelM/swc-wasm-demo
how should I move it into this repo?
Also, what else should I add more to this?
from swc.
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.
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.
@9oelM Sounds great. I hope I can do some design work...
from swc.
Are we ready to make swc available on the web?
from swc.
I think so, swc has @swc/wasm-web
.
from swc.
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.
I also think website is a proper repository to store repl.
from swc.
Ok. then I will make one more page in the Docusaurus website.
from swc.
Thanks a lot!
from swc.
@kdy1 i think we can close this and open other issues for further improvements
from swc.
Yes, you are right.
from swc.
Respectful!
from swc.
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)
- `decorator` of method in hoc lead to runtime error after compilation HOT 1
- Fast TS has a bug related to ASI HOT 2
- minifier: incorrectly alters function length by removing the initializer values.
- How to set env values in .swcrc - @swc/jest HOT 2
- unreachable error occurred by non-block TypeScript type statement
- compilation doesn't omit import that is not used in runtime if typescript alias is created from imported type HOT 1
- @swc/core removes the abstract declaration of the class, but the abstract declaration of the field is still there
- The strip-type-only mode does not handle some export declare declarations
- Fail to parse import attributes in TSTypeAlias
- `NestJS` application initialised twice with `SWC` HOT 2
- add `/*#__PURE__*/` for ts enum HOT 2
- SWC generate invalid source map when inputSourceMap is provided HOT 7
- Unexpected crash when compiling a TypeScript class with a private readonly constructor parameter and JSX within the constructor.
- The strip-type-only mode does not handle export overloads functions
- Provide AST count information without a separate visitor pass HOT 2
- Add LICENSE to @swc/wasm-typescript HOT 2
- HTML is modified through swc_html-visit and the generated HTML string from swc_html-codegen is used to convert " to " HOT 1
- HTML is modified through swc_html-visit and the generated HTML string from swc_html-codegen is used to convert " to " HOT 4
- @swc/wasm-typescript transform mode should no perform import elision HOT 3
- failed to read input source map - @swc/jest + yarn PnP workspaces HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swc.