Node is already doing this .
By "this" I mean creating machine executable binary code. He does this using a JIT pattern . Moreover, after I talk about what other Googling can look for ...
OS-native executable file ... If the binary file instead of the source, you mean the native OS executable, yes. NW.JS and Electron both do stellar work.
Use binary files in node.js scripts ... If a binary is a source file, you mean the ability to compile part of your script into a binary, so it’s difficult or impossible to use, or you want something at machine speed, yes. They are called C / C ++ Addons . You can distribute the binary (for your specific OS) and name it the same as with any other var n = require ("blah");
Node uses Just In Time binaries
Out of the box, Node pre-compiles your scripts on its own and creates a cached V8 machine code (I think it is an “executable” - it uses the real machine code specific to the Node processor), which is then executed with every event that it processes.
Here is a Google link that explains that the V8 engine actually compiles to real machine code, not to a virtual machine.
JavaScript Javascript V8 Design
This compilation is done when your application loads first.
It caches these bits of code as “modules” as soon as you call the require ('module') statement.
It does not wait for your application to be processed, but pre-compiles each module as necessary.
Everything inside the request is compiled and put into memory, including variables and active state. Again, contrary to many popular blog articles , this runs as separate machine code processes. There is no virtual machine, and nothing is interpreted. The JavaScript source is essentially compiled into an in-memory executable.
This is why each module can simply refer to the same requirement, rather than create a bunch of overhead; it simply refers to a pre-compiled and existing object in memory, and not to the “re-requirement” of the entire module.
You can force it to recompile any module at any time . Less well known is that you can really easily recompile these objects, which allows you to “reload” pieces of your application without reloading the whole thing.
A great example of using this is to create self-modifying code, that is, a strategy template that loads strategies from folders, for example, and as soon as a new folder is added, your own code can recompile the folders into create a strategy template, create a file "strategyRouter.js" and then invalidate the Node cache for your router, which forces Node to recompile only this module, which is then used for future client requests.
End result: Node can reload routes or strategies as soon as you release a new file or folder into your application. No need to restart the application, no need to separate operations without state and state: just write the answers like regular Node modules and ask them to recompile when they change.
Note. . Before people say that self-modifying code is just as bad or worse than eval , which is terrible for debugging and impossible to maintain, note that Node itself does this, and so many popular Node frameworks do. I do not explain the original research, I explain the design capabilities of the Google V8 Engine (and therefore Node), as this issue requires of us. Please do not shoot people who are R FM, or people will stop R'ing and save for themselves.
"Unix was not designed to prevent its users from doing stupid things, as that would also prevent them from doing smart things." - Doug Gwyn
Angular 2, Meteor, the new openource Node based on the Light Table IDE and many other frameworks in this direction to further remove the developer from the code and bring it closer to the application.
How to recompile (hot reboot) the required Node module?
Actually it is very simple ... Here is a npm hot reboot, for alternatives just google "node requires a hot reboot"
https://www.npmjs.com/package/hot-reload
What if I want to create my own framework and hot reboot in a new way?
This, like many things in Node, is surprisingly easy. Node is like jQuery for servers !; D
stack overflow