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

Support plugins in @swc/wasm-* #3934

Open
3 of 5 tasks
kwonoj opened this issue Mar 9, 2022 · 4 comments
Open
3 of 5 tasks

Support plugins in @swc/wasm-* #3934

kwonoj opened this issue Mar 9, 2022 · 4 comments

Comments

@kwonoj
Copy link
Member

kwonoj commented Mar 9, 2022

Describe the feature

The stories around supporting plugins in SWC (#3540) did not cover wasm host version of the SWC, namely @swc/wasm and @swc/wasm-web. Currently, wasm host version of SWC lacks of any kind of plugin support including existing JS based one. This issue tracks to support plugins universally across any runtime we support, including wasm host version.

The scope of plugin support is limited to the new, experimental plugin written in wasm. I do not have conclusions if it's technically possible to support JS written plugin or not but in either case we do not aim to support it in here.

Plugin support in wasm host have working proof of concept at https://github.com/kwonoj/swc/tree/feat-plugin-js-wasm-host nowhere close to ready to be included in core. There are lots of problems need to be solved separately, however it proves main concept of let internal webassembly runtime we use can borrow host runtime's webassembly compiler if it runs on the supported platform. Notably, this means web brower & node.js.

These are known subtasks to achieve initial working experimental support.

Babel plugin or link to the feature description

#3540

Additional context

No response

@magic-akari
Copy link
Member

  • Wasm32-wasi plugin support story: likely this is upstream (browser / node) runtime issue.

Does this "story" refer to https://github.com/WebAssembly/component-model ?

@kwonoj
Copy link
Member Author

kwonoj commented Feb 29, 2024

Does this "story" refer to WebAssembly/component-model ?

No. It's about executing wasm plugin itself - when the runtime (wasmer) runs in wasm-host, it does not embed own runtime but tries to borrow host's runtime to execute wasm binary instead. So unlike native swc binary, it'll run via node.js / browser's wasm runtime. Currently we recommend to build plugin with wasi, and expose some system access (like filesystem) so to run those correctly host runtime need full support for wasi.

@kdy1
Copy link
Member

kdy1 commented Jul 29, 2024

@kwonoj Is there any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants