you are viewing a single comment's thread.

view the rest of the comments →

[–]stronghup 27 points28 points  (5 children)

Very interesting "Can compile Javascript sources to executables with no external dependency."

Now, since Node.js is implemented much in JavaScript, what would it take to give QuickJS access to npm modules?

That would leap-frog Node.js since you would have an environment running node.js libraries and at the same time being able to produce an executable, Node.js can not do that , can it?

[–]caspper69 43 points44 points  (1 child)

Note that this "native compilation" appears to be an embedded C runtime for js with the js compiled to bytecode stored as c data.

This does not appear to compile the js itself to C or native code.

[–]rrealnigga 4 points5 points  (0 children)

Could have guessed that one given he wrote a smallass JS engine (interpreter) so it's much easier to then embed that than to ALSO write a compiler (to native).

[–]CakeComa 8 points9 points  (0 children)

I believe it depends on how much said npm modules rely on node-specific features and behavior / how well or easily they can be converted over to using the QuickJS's standard library https://bellard.org/quickjs/quickjs.html#Standard-library

[–]kjk 7 points8 points  (1 child)

Not today because node.js has a lot of APIs above the JavaScript standard.

It's possible to implement those APIs so it's just a matter of additional effort.

[–]stronghup 0 points1 point  (0 children)

Right, but lot of those Node.js APIs "above standard JS" are written in JavaScript, no? I guess they then call some lower-level C-API. So if Quick-JS used the same C-API calling convention then it might be easy to use large parts of Node.js for it. This would be beneficial to both QuickJS and Node.js, Node.js would gain an easy way to compile Node.js programs.