最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is it possible to use the CommonJS libraries yet? - Stack Overflow

programmeradmin4浏览0评论

I am interested in getting started with CommonJS.

With JavaScript frameworks getting faster all the time, and parsing engines and pilers 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?

I am interested in getting started with CommonJS.

With JavaScript frameworks getting faster all the time, and parsing engines and pilers 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?

Share Improve this question asked Dec 1, 2009 at 22:25 Jon WinstanleyJon Winstanley 23.3k22 gold badges79 silver badges120 bronze badges
Add a ment  | 

5 Answers 5

Reset to default 12

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 ing along nicely.

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

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.

Have you tried starting here?

What are you stuck on?

It's gelling. You're early, unless you like living on the edge.

By the way, your wikipedia link has links to the projects that use CommonJS. You had the answer before you got here.

I just started using Node.js at home. It works and seems great. The only issue I've encountered so far is that Windows support seems somewhat distant.

I believe Rhino works with Windows since it's a Javascript interpreter written in Java, but that also means it's slower than the Javascript-C implementations like V8. I don't think Rhino itself implements the CommonJS specification, but you can run something like Narwahl on top of it - as was mentioned by Kevin and Jeff.

I just did a quick job of installing Rhino, Ant (to build Rhino) and trying to get Narwhal running with Windows, but wasn't successful.

I suggest trying Node.js on a Linux box since that was my environment and it worked flawlessly.

发布评论

评论列表(0)

  1. 暂无评论