Native CommonJS modules in Rhino shell

72 views
Skip to first unread message

Hannes Wallnoefer

unread,
Apr 1, 2011, 6:55:19 AM4/1/11
to comm...@googlegroups.com, narw...@googlegroups.com
I'm currently working on adding native support for CommonJS modules to
the Rhino shell, and I'd love to get some feedback from people using
Rhino in a CommonJS context before committing to the main repository.

The current implementation is in the commonjs-shell-2 branch in my
github repository:

https://github.com/hns/rhino-opt/tree/commonjs-shell-2

This adds 3 new options to the Rhino shell:

-modules [module-uris]
Use CommonJS modules with given search path
-main [module] Set CommonJS main module id or file name
-sandbox Enable CommonJS sandbox mode

I've worked with Narwhal and Jack to make the implementation work with
real-world usage patterns and conventions (though the code is not
limited or even targeted towards Narwhal). Here's a simple script for
launching the Jack demo application:

https://gist.github.com/897609

If you try it out please let me know what you find.

Hannes

Reply all
Reply to author
Forward
0 new messages