SpiderNode: Node.js on SpiderMonkey
Right now we're focused on using this project in the Positron project. This means that we will need to finish SpiderShim to the extent necessary for Node.js to work. In the future, we may look into finishing implementing the features of the V8 API that Node.js does not use, in order to provide a V8 API shim layer out of the box in SpiderMonkey. The SpiderShim code is being developed with that long term goal in mind.
How it works
To enable building and running Node.js with SpiderMonkey, a V8 API shim (SpiderShim) is created on top of the SpiderMonkey API. This is based on Microsoft's node-chakracore, but it doesn't share much code with it besides the build system integration.
This is a work in progress. Node can now be successfully built on top of SpiderMonkey, and the very basics seem to work, but there are probably still a lot of issues to discover and fix.
We have implemented a fair portion of the V8 API. More specifically these tests are currently passing. Many of those tests have been ported from the V8 API tests.
How to build
Before building please make sure you have the prerequisites for building Node.js as documented here.
Building on any OS other than Linux or OS X has not been tested.
$ ./configure [options] ... $ make ... $ ./node -e 'console.log("hello from " + process.jsEngine)' hello from spidermonkey
options is zero or more of:
--debug: Also build in debug mode. The default build configuration is release.
--enable-gczeal: Enable SpiderMonkey gc-zeal support. This is useful for debugging GC rooting correctness issues.
--with-external-spidermonkey-debug: Enable building against an out-of-tree SpiderMonkey. Expects a path to a built SpiderMonkey object directory (in release and debug modes, respectively)
If you build against an out-of-tree SpiderMonkey, you must include the SpiderMonkey library path in LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on Mac) when running Node, i.e.:
$ LD_LIBRARY_PATH=path/to/obj-dir/dist/bin ./node -e 'console.log("hello from " + process.jsEngine)'
To run the API tests, do: