raphamorim / Xwasm
Licence: mit
[Work In Progress] WebAssembly Packager and WASM tooling for modern frontend
Stars: ✭ 45
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Xwasm
I18nize React
Internationalize react apps within a lunch break
Stars: ✭ 389 (+764.44%)
Mutual labels: babel, babel-plugin
Camaro
camaro is an utility to transform XML to JSON, using Node.js binding to native XML parser pugixml, one of the fastest XML parser around.
Stars: ✭ 438 (+873.33%)
Mutual labels: emscripten, wasm
Rustynes
👾 An NES emulator by Rust and WebAssembly
Stars: ✭ 399 (+786.67%)
Mutual labels: emscripten, wasm
Babel Plugin React Remove Properties
Babel plugin for removing React properties. 💨
Stars: ✭ 327 (+626.67%)
Mutual labels: babel, babel-plugin
Htm
Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Stars: ✭ 7,299 (+16120%)
Mutual labels: babel, babel-plugin
Faster.js
faster.js is a Babel plugin that compiles idiomatic Javascript to faster, micro-optimized Javascript.
Stars: ✭ 429 (+853.33%)
Mutual labels: babel, babel-plugin
Babel Plugin Module Resolver
Custom module resolver plugin for Babel
Stars: ✭ 3,134 (+6864.44%)
Mutual labels: babel, babel-plugin
Deepminer
deepMiner webminer proxy (update for cryptoNight R)
Stars: ✭ 497 (+1004.44%)
Mutual labels: emscripten, wasm
Babel Plugin Tailwind Components
Use Tailwind with any CSS-in-JS library
Stars: ✭ 320 (+611.11%)
Mutual labels: babel, babel-plugin
Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: ✭ 878 (+1851.11%)
Mutual labels: babel, babel-plugin
Babel Plugin Css Modules Transform
Extract css class names from required css module files, so we can render it on server.
Stars: ✭ 318 (+606.67%)
Mutual labels: babel, babel-plugin
Postjss
Use the power of PostCSS in compiling with JSS
Stars: ✭ 40 (-11.11%)
Mutual labels: babel, babel-plugin
Effectfuljs
JavaScript embedded effects compiler
Stars: ✭ 287 (+537.78%)
Mutual labels: babel, babel-plugin
Edge Sql
Cloudflare Workers providing a SQL API
Stars: ✭ 429 (+853.33%)
Mutual labels: emscripten, wasm
Babel Blade
(under new management!) ⛸️Solve the Double Declaration problem with inline GraphQL. Babel plugin/macro that works with any GraphQL client!
Stars: ✭ 266 (+491.11%)
Mutual labels: babel, babel-plugin
Babel Plugin Console
Babel Plugin that adds useful build time console functions 🎮
Stars: ✭ 278 (+517.78%)
Mutual labels: babel, babel-plugin
Babel Plugin Sitrep
Log all assignments and the return value of a function with a simple comment
Stars: ✭ 442 (+882.22%)
Mutual labels: babel, babel-plugin
Babel Plugin Transform React Remove Prop Types
Remove unnecessary React propTypes from the production build. 🎈
Stars: ✭ 890 (+1877.78%)
Mutual labels: babel, babel-plugin
This repository contain tools for develop modern frontend with WebAssembly (React, Vue, Babel and etecetera).
Please don't use it in production. It's not stable yet.
Create a project with WASM in less than 5 minutes (optional)
curl -o- -L https://raw.githubusercontent.com/raphamorim/xwasm/master/scripts/create-project.sh | bash
Supported Languages
Language | Status | Notes |
---|---|---|
C++ | Under development | Still very experimental |
Rust | Under development | Test phase |
Go | On Roadmap | - |
Kotlin | On Roadmap | - |
Lua | On Roadmap | - |
Summary
xwasm
WebAssembly Packager (understand Rust/C/C++).
It will install modules/environment on demand. However you can run separate commands to install enviroment:
-
$ xwasm install cpp
(install C/C++ required dependencies [emcc]) -
$ xwasm check cpp
(check C/C++ dependencies status) -
$ xwasm install rust
(install Rust required dependencies [cargo]) -
$ xwasm check rust
(check C/C++ dependencies status)
Building with
- Create a file:
xwasm.config.js
const filesToProcess = [
{
input: 'doubler.c',
output: 'doubler.wasm',
functions: ['doubler'] // functions that you want to export
},
{
// by default output will follow input filename, in this case: "counter.wasm"
input: 'counter.rs',
functions: ['counter'] // functions that you want to export
}
]
module.exports = filesToProcess;
- Now if you run
xwasm
, it's going to load the configuration above. If you want to, you can add it before any build task. For example:
"scripts": {
"build": "xwasm && webpack",
useWasm
Installing
$ npm install use-wasm
Usage
C++ code
int _doubler(int x) {
return 2 * x;
}
JSX code with React
import React, { Fragment, Component } from 'react';
import { render } from 'react-dom';
import useWasm from 'use-wasm';
function App() {
// method will initialize null til load the "./doubler.wasm"
const { isWasmEnabled, instance } = useWasm('doubler');
return (
<Fragment>
<p>isWasmEnabled: {String(isWasmEnabled())}</p>
<p>_doubler: {String(instance && instance._doubler(2))}</p>
</Fragment>
);
}
render(<App/>, document.querySelector('#root'));
null
as initial value)
Instance loading (
Instance loaded (wasm export object as value)
TODO
- [ ] useWasm: Cache logic for fetching WASM files
- [ ] xwasm/emscripten: Cache for build
- [ ] xwasm/emscripten: Add support for Windows
- [ ] xwasm/emscripten: Add support for load different files into one export
- [ ] Write examples using Rust
References
- https://webassembly.org/getting-started/developers-guide
- https://emscripten.org/docs/compiling/WebAssembly.html
- https://developer.mozilla.org/en-US/docs/WebAssembly
- https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
- https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
- https://github.com/emscripten-core/emscripten/issues/8126
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].