0.11.0 • Published 12 years ago

module-grapher v0.11.0

Weekly downloads
9
License
-
Repository
github
Last release
12 years ago

This repository is no longer maintained.

module-grapher

module-grapher resolves CommonJS module dependencies through recursive static analysis.

Although itself a node.js program, module-grapher's main target is client-side code.

While it can be used to build dependency graphs of node programs, it is unaware of node's special node_modules directory or NPM's nested package dependencies conventions. In fact, module-grapher is totally unaware of packages at large (it supports search paths, however). Programs relying on external packages will need to install them via a package manager like Kris Zyp's excellent CPM. module-grapher is designed to resolve module dependencies, not package dependencies.

In the future, module-grapher might become package-aware to handle cases where multiple versions of the same package are required, but this is not currently a priority.

module-grapher supports CoffeeScript and can be easily extended to support other languages which compile to JavaScript.

Install

module-grapher is available as an NPM module.

$ npm install module-grapher

Usage

module-grapher accepts an filepath, source code or module identifier as input.

To get dependencies from a module:

require('module-grapher').graph('foo', {
  paths: ['./lib', './vendor'], // defaults to the equivalent of ['.']
  root: 'path/to/package/root/' // defaults to process.cwd()
}, callback);

Other options include:

  • extensions (defaults to ['.js', '.coffee']): an array of supported extensions.
  • allowDirModules: Also search for modules in the index file of the directory named after them. So look for module foo/bar not only in foo/bar.js but also in foo/bar/index.js. Defaults to false.
  • allowMissingModules: don't throw when a module is missing. Just mark it as such. Defaults to false.
  • allowDynamicModuleIdentifiers: don't throw when the identifier of module isn't a string. Defaults to false.

License

Your choice of MIT or Apache, Version 2.0 licenses. module-grapher is copyright 2010 Tobie Langel.

0.11.0

12 years ago

0.10.4

13 years ago

0.10.3

13 years ago

0.10.2

14 years ago

0.10.1

14 years ago

0.10.0

14 years ago

0.9.1

14 years ago

0.9.0

14 years ago

0.7.0

14 years ago

0.6.0

14 years ago

0.5.2

14 years ago

0.5.1

14 years ago

0.5.0

14 years ago

0.4.3

14 years ago

0.4.2

14 years ago

0.4.1

14 years ago

0.4.0

14 years ago

0.3.1

14 years ago

0.3.0

14 years ago

0.8.0

14 years ago