grain icon indicating copy to clipboard operation
grain copied to clipboard

Feature Request: Webpack plugin

Open jcguarinpenaranda opened this issue 7 years ago • 5 comments

The Grain Lang looks awesome! It would be awesome too to have a Webpack plugin that compiles the .gr files to .wasm, so then we can use them in Javascript using something like the wasm-loader plugin

jcguarinpenaranda avatar Aug 10 '18 09:08 jcguarinpenaranda

Totally! This is something we've talked about but haven't officially created an issue. We'll use this one to track progress.

ospencer avatar Aug 10 '18 13:08 ospencer

I experimented with one here https://github.com/z0w0/grain-loader as I thought it would be a nice way to understand how the runtime is implemented. It's nowhere near usable though (see the Caveats readme section).

It's kind of limited by the way I chose to implement it and the fact that there's no static linking (#28), at the moment. However, it is working currently, even if it is the most rudimentary program ever :) There are some other options I mentioned in the Alternative implementations section of the readme that might play better with the current compiler implementation.

z0w0 avatar Oct 24 '20 01:10 z0w0

Wow! Would you want to turn the Caveats into issues here in the Grain repo? If not, we can try to translate them into actionable things to work on.

phated avatar Oct 26 '20 20:10 phated

Sure! I think with #406 resolved and #407 merged, the caveats would be sorted out. However, even though the Webpack loader tries to follow module resolution as closely to the runtime's locator implementation as possible, having it consistently match through some sort of static linking #28 would also simplify it.

Last thing might be having an easy way to install the CLI consistently - currently the loader just uses a configured location of Grain locally, but it would be cool to have the loader bundle with the CLI. Having the @grain/cli built and available on NPM might be one way to go about it, in a way similar to #406 - but not sure if that's the best route to take, so have held off on an issue for now.

z0w0 avatar Oct 27 '20 10:10 z0w0

Since we've removed js runner I don't think that this would be too difficult, the cli contains most of the code needed for each individual piece here it is just about packaging it together into a web pack plugin. I don't know if this is something that we should officially maintain though or at least maybe this is another repo that we link too through the awesome-grain repo.

spotandjake avatar Nov 26 '24 23:11 spotandjake