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

Possibility of compiling on stable Rust? #117

Closed
alexcrichton opened this issue Jan 16, 2019 · 10 comments
Closed

Possibility of compiling on stable Rust? #117

alexcrichton opened this issue Jan 16, 2019 · 10 comments
Assignees

Comments

@alexcrichton
Copy link

Hello! Over in the wasm-bindgen project we've got a new proposal which partly entails eventually having a JS parser built into our tooling. The JS parser would need to basically compile ES module syntax to either CommonJS or "linked manually with no modules" style syntax. The swc project seems like it perfectly fits the bill in terms of use cases here!

One hesitation that we'd currently have from using swc is that it looks like it currently requires nightly Rust and also isn't published much on crates.io. I'm curious if y'all have an idea about whether it's feasible in the near-term to compile on stable (and as a bit of a stretch goal publish on crates.io too). That'd make swc a strong possibility for us to use in wasm-bindgen as a dependency!

We're mostly just evaluating our options right now, so "not any time soon" is a totally valid answer too!

@kdy1
Copy link
Member

kdy1 commented Jan 17, 2019

I removed some unused features and checked which crate depends on which feature.

swc_common:

  • specialization

swc_ecma_parser:

  • box_syntax
  • box_patterns
  • specialization
  • never_type

  • Removing uses of never_type will be easy
  • Removing box_syntax will be easy
  • Removing box_pattern may be tricky, but possible
  • Specialization can be replaced with hand-written folder / visitor.
    But lots of work is required

So I think it's possible and I'd like to do it, but I'm not sure how much time it would take.

@kdy1 kdy1 self-assigned this Jan 17, 2019
@kdy1
Copy link
Member

kdy1 commented Jan 17, 2019

cc @alexcrichton
Currently swc depends on rustc-ap-* crates, but I think those crates will never be stabilized, is this correct? Then we should copy some code into swc..

Only hygiene and error reporting is used by swc, so it would not be too hard.

@alexcrichton
Copy link
Author

Oh wow thanks for the speedy responses, this looks great!

I was trying to give this a spin locally with a few path dependencies, but it looks like dependencies like scoped-tls still have the nightly feature enabled. Do I need to disabled some features of swc or something like that though?

@kdy1
Copy link
Member

kdy1 commented Jan 18, 2019

@alexcrichton Fixed it. I made a mistake while inlining rustc-ap crates.
It would work after a cargo update

@alexcrichton
Copy link
Author

It got farther! I think though swc_macros_common still uses some nightly features?

@kdy1
Copy link
Member

kdy1 commented Jan 19, 2019

Oh, my mistake..
I fixed and verified that stable rustc can build swc_ecma_parser

I guess you should run cargo update.

https://github.com/kdy1/swc-stable-rust

@alexcrichton
Copy link
Author

alexcrichton commented Jan 22, 2019

Ok great, thanks! Our use case will also need to write out the JS file after transforming it, does that mean that we would need the swc_ecma_codegen crate as well?

@kdy1
Copy link
Member

kdy1 commented Jan 23, 2019

@alexcrichton Yes. I published swc_ecma_codgen v0.5.1 which can be built with stable rustc.

@alexcrichton
Copy link
Author

Awesome, thanks again so much for your help!

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 31, 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 31, 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

3 participants