modulr
Resolves and concatenates CommonJS module dependencies for use in the browser. It's a port of modulr
from Ruby to node.js and is based on module-grapher
, a node module which resolves dependencies through recursive static analysis.
Install
modulr
is available as an NPM module.
$ npm install modulr
Usage
modulr
accepts the main module's identifier and an optional config object as arguments which get passed to module-grapher
. It outputs a small runtime and the concatenated modules sources as a string.
require('modulr').build('foo', {
paths: ['./lib', './vendor'],
root: 'path/to/package/root/'
}, callback);
modulr
can also accepts a CommonJS package or its package.json
file as argument. I which case it uses the JSON file's main
value as entry point, the custom builder_path
property to set search paths, and the package's dir as root.
require('modulr').buildFromPackage('path/to/package', callback);
License
Your choice of MIT or Apache, Version 2.0 licenses. module-grapher
is copyright 2010 Tobie Langel.