-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Bundle everything into the npm module #1260
Comments
Is that possible to compile Ruby as WASM? |
Yes it is! But only with Ruby 3.2. So in the future that’ll be a great
solution.
…On Fri, Jul 22, 2022 at 9:12 PM JounQin ***@***.***> wrote:
Is that possible to compile Ruby as WASM?
—
Reply to this email directly, view it on GitHub
<#1260 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABG3P3XOVU4TR7GWDE5IYATVVNBGLANCNFSM54MJACEA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Why not try it out right now? https://www.ruby-lang.org/en/news/2022/04/03/ruby-3-2-0-preview1-released/ Is there anything preventing us? When it's already compiled into WASM, no ruby runtime is required. |
Right... I don't know what I was talking about. I will try this! |
Besides, in case of handling asynchronous due to WASM, you can try https://github.com/un-ts/synckit to turn it synchronously again! |
So this now works in https://github.com/ruby-syntax-tree/node-syntax-tree. Except that it doesn't support RBS yet, because it's very difficult to compile non-bundled native extensions: https://twitter.com/kateinoigakukun/status/1555202638064799750?s=20&t=9wXaP7QoPngehSIujvUGFw. The other difficulty is that loading WASM requires an async call, so we still are blocked on that. Fortunately that's changing in v3 of prettier prettier/prettier#13142. I think the answer for now is going to be waiting for prettier v3 and waiting on/working on support for non-bundled native extensions for WASI. |
@kddnewton Did you tried this one? Of course waiting for |
@JounQin I did! I couldn't get it to work. To be honest I'm not sure what I was doing wrong, but it would just hang no matter what I tried. |
@kddnewton Can you provide a branch so I can offer some help? At least you can try And the problem may be fixed by un-ts/synckit#94 |
@JounQin sure! The branch is here: https://github.com/prettier/plugin-ruby/tree/synckit. |
I haven't looked into details yet, but the root issue could be 23f2089#diff-598b75d6dc772eb13aa7141f35bb93046ae26c58a97e8647ecf7f74aec8ae93fR2 It does not need/should be called immediately - const parseSync = createSyncFn(require.resolve("./worker"))();
+ const parseSync = createSyncFn(require.resolve("./worker")); I'll clone and check quickly. |
Nice, now I'm just getting some cloning errors. |
Okay @JounQin we're back to hanging now |
See
Besides, you'd better upgrade to |
f1d1937#diff-a19812fe5175f5ae8fccdf2c9400b66ea4408f519c4208fded5ae4c3365cac4dR1 - const { runAsWorker } = require("synckit/lib/index.cjs");
+ const { runAsWorker } = require("synckit"); |
What command should I run for debugging your issue? |
@JounQin that's starting to work! |
@kddnewton Any progress or how could I help to achieve this? |
Yes please! If you could help me get https://github.com/ruby-syntax-tree/node-syntax-tree to compile the RBS plugin as well - which is the only blocker, then I could ship this using the WASM code and it would be totally good to go. |
Moving this issue over to |
I saw ruby-syntax-tree/node-syntax-tree#43 is marked as completed, but https://github.com/ruby-syntax-tree/node-syntax-tree itself is archived, is this supported already? @kddnewton |
Not really - I'm just giving up on that possibility to be honest. The issue is RBS compilation into WASM. If someone figures that out, we can make it happen. But at the same time I'm working on replacing the backend of syntax tree to use prism, so we'll be using a different form of compilation for that. |
I'd like to give it a try when I'm free. Can you assign this issue to me and reopen it? Reference https://ruby.github.io/ruby.wasm |
Done |
Is the current opinion that we should stop using this plugin? |
@alan-pie I'm not sure what you mean. This is an enhancement, the plugin itself functions just fine. |
It was in reference to your recommendation in the comment here: |
There're 3 options, dropping is the worst, I'm going to add this feature while I'm focusing on other projects these days. Plaese be patient, or even better, join to help. |
See this issue: #1232 for details.
I'm not entirely sure how to solve this, but I know it will involve adding a
prepublishOnly
step to thepackage.json
that's going to use bundler to dump all of the necessary files into the package somehow.The text was updated successfully, but these errors were encountered: