I’ll try and explain that relationship in this post, and explain how Node-ChakraCore fits into the picture.
What’s the relationship between Node and V8
Embedders can access the values used inside V8, for example to add custom APIs. Chrome adds APIs for the DOM and Web Workers. Node allows programs to access the file system. Both provide
console.log that JS developers are used to, instead it provides a minimal set of custom APIs. For example, you can use
You can find the source code and full set of D8 commands here. This is an example, adding the
There’s also a simpler Hello World example showing how to embed V8 in a C++ app.
How does Node-ChakraCore fit into the picture
However, the Node codebase depends on V8’s APIs:
V8 APIs Node ==========> V8
Because of this, Node-ChakraCore needs to translate between the V8 instructions and ChakraCores’s API. That’s what ChakraShim does:
V8 APIs ChakraCore APIs Node ===========> ChakraShim ==================> ChakraCore
This way, Node can use the V8 API without being aware that it’s using ChakraCore under the hood.