Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use the CommonJS libraries yet?

I am interested in getting started with CommonJS.

With JavaScript frameworks getting faster all the time, and parsing engines and compilers making JavaScript incredibly quick, it is surprising that a project such as CommonJS has not been initiated sooner.

What steps are involved in getting a test project up and running with what has been created so far?

like image 998
Jon Winstanley Avatar asked Dec 01 '09 22:12

Jon Winstanley


2 Answers

It really depends on what you're actually looking to do. Persevere, for example, is a JSON database that is built on top of Rhino but is capable of working with CommonJS modules and is being built up around JSGI (the web server interface) going forward.

Narwhal is a fairly robust library of JavaScript and is specifically looking to track the CommonJS standard as it evolves. Narwhal runs on top of Rhino by default, but you can also install JavaScriptCore (and possibly v8) as additional "engines". JSC is very fast.

There are various web frameworks available (including Helma NG).

Node.js has been getting a lot of attention as a fast, v8-based, event-driven network services stack for JS. Node recently changed to use CommonJS modules.

SproutCore has a branch ("tiki") that is built on CommonJS modules. I, personally, am using that now for Bespin of which the client side is entirely CommonJS modules. (Ironically, the server side is currently in Python, but we do have plans to migrate to CommonJS on the server as well.)

The thing to remember about CommonJS is that it's an API spec. It's possible for there to be many implementations. Thus far, the only part of the spec that is widely supported are the modules... the rest is still baking, but coming along nicely.

CommonJS is not yet to the level of interop of, say, CPython/Jython/IronPython, but it certainly has that potential going forward.

like image 70
Kevin Dangoor Avatar answered Sep 28 '22 20:09

Kevin Dangoor


What steps are involved in getting a test project up and running with what has been created so far?

I found the Narhwal quick start to be the fastest way to get up and running.

like image 45
Jeff Hammerbacher Avatar answered Sep 28 '22 19:09

Jeff Hammerbacher