packagestyle
is java package style module loader.
npm install -g packagestyle
or
npm install -g packagestyle
or
git clone git@github.com:iolo/node-packagestyle.git
/your_project_dir
/bin
/main.js /* this is main module */
/lib
/hello
/world.js
/foo
/bar.js
// NOTE: GLOBAL to declare global variable
require('packagestyle').imports('../lib/hello', GLOBAL);
hello.world.greet('iolo');
// NOTE: no require!!!
var puts = hello.foo.bar.puts;
exports.greet = function(name) {
puts('hello,' + name);
};
exports.puts = function(msg) {
console.log(msg);
};
may the source be with you...