I don't mean just bundling the runtime like nexe. I mean full on amd64 or arm64 machine code that can be executed without a runtime or with parts of the runtime compiled together for memory management among other things.
Compile JavaScript to a Assembly, AST, C, and executable using Facebook's shermes
open source - Proper way to "compile" a javascript project? - Software Engineering Stack Exchange
Compile Javascript (LLVM Frontend)
This is closed source?
More on reddit.comWhat is the state of the compile-to-JS language ecosystem?
Videos
As far as I know, there are no static compilers for JavaScript. It is certainly theoretically possible; however, a static compilation of JavaScript would need a very heavyweight runtime to support all of its features (such as dynamic typing and eval). As a small aside, when presented with the need to statically compile Python (another dynamic language), the PyPy developers ended up creating a language which was a very restricted subset of Python (called RPython), void of some of Python's more dynamic features, that was capable of being statically compiled.
If you're asking this for the purpose of creating a standalone executable from JavaScript code, I'm sure there must be wrappers which essentially would create an executable containing your script and an embedded JavaScript VM (sadly, I don't know any offhand).
It's definitely doable, although the only way I know how to do it at the moment is a two step process...
- Compile the javascript to Java using Mozilla Rhino JSC.
- Compile the resulting java class file to executable using something like GNU's GCJ.
Why would you want to, though? What advantage do you expect to find?