emscripten-core / emscripten-core/emscripten
Postprocessing JS
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
The current JS that emscripten generates uses some old conventions + often generates unused code; I have seen a few issues going around offering manual updates of some of these things.
I wanted to note that a combination of tools like [`lebab`](https://github.com/lebab/lebab), `eslint` and `rollup` could be used in a post processing step to tidy up the `.js` files that emscripten emits.
In particular, with the default `eslint` and `rollup` configs I just ran on a generated file called `swipl.js`
```ts
lebab --replace swipl.js --transform arrow,arrow-return,for-of,arg-rest,arg-spread,obj-method,obj-shorthand,no-strict,exponent,multi-var,let,class,commonjs,template,default-param,destruct-param,includes
eslint swipl.js
rollup swipl.js -o out.js
```
The `out.js` was about 10% smaller on the project I tried and has various code smells removed such as limiting the use of `var`, removing unused variables etc.
Contributor guide
Assessment
This issue has not been assessed yet.