[Pkg-javascript-devel] RFC: nodejs and commonjs javascript modules

Jérémy Lal jerry at edagames.com
Sun Feb 7 23:48:15 UTC 2010


Hi,
Node.js, an event-based server-side javascript engine using libv8,
is being packaged for debian (nodejs):
- it uses javascript libraries and tries to follow CommonJS conventions
- some modules could work for other server-side js engines, or even javascript clients.
- other modules are strongly bound to Node.js, they are not the subject of this email.
- this raises the question : instead of packaging nodejs-only modules,
would it be smarter to package CommonJS modules ?

A typical example would be JSON-template[0], which has been patched[1] to
follow CommonJS modules specification[2], and is a pure javascript library.
It is usable as a Node.js module, but could be also used as a client-side module,
or anything else that executes javascript.
So instead of packaging a nodejs-module-jsontemplate, one would rather package a
libjs-jsontemplate that could be used by server-side AND client-side javascript.
This library would be as usual installed as :
/usr/share/javascript/jsontemplate
and there should be some place like /usr/share/common-javascript which would hold
links to /usr/share/javascript when possible.

I'm certainly not right about this, Node.js is not the only concern here,
and i'd be glad to hear suggestions.

Regards,
Jérémy Lal

[0]
http://code.google.com/p/json-template/
[1]
http://github.com/andychu/json-template
[2]
http://commonjs.org/specs/modules/1.0.html



More information about the Pkg-javascript-devel mailing list