CommonJS now passes all of the Modules 1.0 unit tests.
env = CommonJS::Environment.new(:path => '/path/to/lib/dir') env.require('foo.js')
By default, all you get with a bare commonjs environment is the Modules API
The plan however, is to allow you to extend your commonjs environment to have whatever native interfaces you want in it. So for example, if you want to allow filesystem access, as well as access to the process information, you would say:
env.modules :filesystem, :process
- The Ruby Racer (V8) - [https://github.com/cowboyd/therubyracer]
- The Ruby Rhino (JRuby) - [https://github.com/cowboyd/therubyrhino]