Replies: 5 comments 27 replies
-
I'm not sure too many companies are using private Babel plugins, and I can't think of any of mine that I would want private. I have some that are inside a monorepo, but if I needed them compiled I would just publish them. If you broadened the scope to Rust N-API plugins, then I can see value here because the 'napi-rs' GitHub actions/workflow seems quite complex. If companies want to improve performance of their services, writing Rust napi plugins is a great way to do so. Things I would like:
Searches codebase for plugins and adds builds for each. Vercel charges for this.
The biggest pain point with cloud CIs is having to commit+push+wait for tweaks until things work. So I'd like a cli that runs everything locally.
Rust builds are super slow. Building swc is very slow. I think incremental Rust compilation is not available yet, but maybe making linking against precompiled 'rlibs' easy - if I am understanding how this works correctly. I really like 'napi-rs' approach of publishing binaries to npm as optional deps. |
Beta Was this translation helpful? Give feedback.
-
Thank you @kdy1 for starting this discussion Here are some questions that came to my mind:
|
Beta Was this translation helpful? Give feedback.
-
Could x-compilation be achieved using a open-source GitHub Action or CircleCI Orb? |
Beta Was this translation helpful? Give feedback.
-
@jantimon pointed me to this issue quite a while ago, and I haven't found time to reply until now. So sorry if this is already outdated and of no interest anymore 🙈 Have you considered use wasmtime::{Engine, Linker, Module, Store};
use wasmtime_wasi::WasiCtxBuilder;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// This is the WASM equivalent of booting up a new V8 platform. Usually one engine is enough
let engine = Engine::default();
let mut linker = Linker::new(&engine);
wasmtime_wasi::add_to_linker(&mut linker, |s| s)?;
let wasi = WasiCtxBuilder::new()
.inherit_stdio()
.inherit_args()?
.build();
// The "Store" defines the interfaes to the outside. E.g. access to file system, stdio, if necessary. In this case it's WASI
let mut store = Store::new(&engine, wasi);
// Creating a new instance or "isolate", linked with the imports to WASI
// The &str "main" notes the entry point we want to call
let module = Module::from_file(&engine, "hello-wasm.wasm")?;
linker.module(&mut store, "main", &module)?;
linker
.get_default(&mut store, "main")?
.typed::<(), (), _>(&store)?
.call(&mut store, ())?;
Ok(())
} There are simpler ways if no WASI context is necessary. I collected some of them in a presentation I did a while ago. Theoretically, this would also be a way to create plugins in other languages that compile to I can't say if introducing a WASM runtime will meet your performance goals, though. I've been using it in a project where we need to modify data on request/response, but I have no details or numbers. It's definitely better than "good enough performance" 😅 |
Beta Was this translation helpful? Give feedback.
-
I believe this is superseded by #3540 now we waonly requires single wasm binary for the plugin instead of per-platform compliation. |
Beta Was this translation helpful? Give feedback.
-
While trying to find an easy for publishing a rust-based plugin, I found that it's almost impossible and I finally found that the only way to make it comfortable is building a service.
This image illustrates what I wanted to avoid if possible.
So, I'm considering a service which does all required tasks. It will be free for open-source projects, and it will not be free for if it's not FOSS. The service will make your swc plugin source code into binaries for each platform. If companies decide to use their own CI, there's no restriction.
How do you think about this? I want to hear many opinions from various people.
If you have any other way to ease publishing, please tell me.
Beta Was this translation helpful? Give feedback.
All reactions