lib/Analyzer.js
function Analyzer(config, state) {
	config = config || {};

	this.state = state;

	this.config = extend(true, {
		finders: {
			styl : [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:@import|@require)\s+['"](.+?)['"](?:$|;)/gm,
						exclude: ['nib']
					}
				}
			],

			coffee: [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*(?:\()?['"]([^'"]+)['"](?:\))?/gm
					}
				}
			],

			cjsx: [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*(?:\()?['"]([^'"]+)['"](?:\))?/gm
					}
				}
			],

			js: [
				{
					name: 'regex',
					config: {
						pattern: [
							/^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*\(?['"]([^'"]+)['"]\)?/gm,
							/\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/gm
						]
					}
				}
			],

			jsx: [
				{
					name: 'regex',
					config: {
						pattern: [
							/^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*\(?['"]([^'"]+)['"]\)?/gm,
							/\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/gm
						]
					}
				}
			]
		},

		resolvers: {
			styl : [
				{
					name: 'basic',
					config: {
						extensions: [
							'styl',
							'css'
						]
					}
				}
			],

			coffee: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],


			cjsx: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],

			js: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],

			jsx: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			]
		}
	}, config);

	this.finders = {};
	this.resolvers = {};

	this.createFinders();
	this.createResolvers();
}
function Analyzer(config, state) {
	config = config || {};

	this.state = state;

	this.config = extend(true, {
		finders: {
			styl : [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:@import|@require)\s+['"](.+?)['"](?:$|;)/gm,
						exclude: ['nib']
					}
				}
			],

			coffee: [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*(?:\()?['"]([^'"]+)['"](?:\))?/gm
					}
				}
			],

			cjsx: [
				{
					name: 'regex',
					config: {
						pattern: /^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*(?:\()?['"]([^'"]+)['"](?:\))?/gm
					}
				}
			],

			js: [
				{
					name: 'regex',
					config: {
						pattern: [
							/^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*\(?['"]([^'"]+)['"]\)?/gm,
							/\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/gm
						]
					}
				}
			],

			jsx: [
				{
					name: 'regex',
					config: {
						pattern: [
							/^\s*(?:.+?\s*[=\:\(\{\;])?\s*require\s*\(?['"]([^'"]+)['"]\)?/gm,
							/\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/gm
						]
					}
				}
			]
		},

		resolvers: {
			styl : [
				{
					name: 'basic',
					config: {
						extensions: [
							'styl',
							'css'
						]
					}
				}
			],

			coffee: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],


			cjsx: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],

			js: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			],

			jsx: [
				{
					name: 'common-js',
					config: {
						extensions: [
							'coffee',
							'js',
							'cjsx',
							'jsx'
						]
					}
				}
			]
		}
	}, config);

	this.finders = {};
	this.resolvers = {};

	this.createFinders();
	this.createResolvers();
}
This class finds and resolves all the dependencies
within a set of source files. In order to do
so finders' and resolvers' strategies are used
and the results are collected.

The state of the analyzer is externalized in order
to preserve the dependencies graph within different
instances of the analyzer.

@description
The configuration of the analyzer has the following
structure:

<pre><code>
{
finders: {
fileExt: [
{
name: 'finder-name',
config: {
// Finder configuration
}
}
],

fileExt2: [
//...
]
},

resolvers: {
fileExt: [
{
name: 'resolver-name',
config: {
// Resolver configuration
}
}
],

fileExt2: [
//...
]
}
}
</code></pre>

If multiple resolvers/finders are specified
their result will be aggregated.

@class Analyzer
@param {Object} config The configuration of this
analyzer instance
@param {AnalyzerState} state The state to be used
in the analysis