emscripten-core / emscripten-core/emscripten
Automate JS->JS dependencies
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
While working on #19097 I had an idea on how to automate JS->JS dependencies. Similiar to what I did for `__sig` attributes in #19028.
The basic idea is that rather than manual specifying `__deps` for a given JS function we could use acorn to tokenize it and then figure out which other JS symbols it depends on.
This dependency extraction process could either be done eagerly at the same time that we extract the JS symbol list prior to calling wasm-ld, or it would be done lazily, on-demand, such that we would only need to tokenize function that we actually use.
Obviously we wouldn't want to slow down the linking process too much so we would need to measure the impact.
Either way the result would be that almost all the `__deps` entries could be removed and we would end up with cleaner and easier to maintain JS codebase, with fewer dependency bugs.
If it works very well we might even be able to completely remove the need to explicit deps, but that would be stretch goal.
Contributor guide
Assessment
This issue has not been assessed yet.