Comparing version 0.3.1 to 0.3.4
@@ -31,2 +31,16 @@ 'use strict'; | ||
} | ||
/** | ||
* Replace alias found inside tree with alias | ||
* @param {Object} tree | ||
* @param {Object} alias list | ||
*/ | ||
function convertAliases(tree, aliases) { | ||
Object.keys(tree).forEach(function (id) { | ||
tree[id].forEach(function (moduleName, i, array) { | ||
if (aliases[moduleName]) { | ||
array[i] = aliases[moduleName]; | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -78,2 +92,3 @@ /** | ||
mergeTrees(tree, requirejs.getShimDepsFromConfig(this.opts.requireConfig, this.opts.exclude)); | ||
convertAliases(tree, requirejs.getPathsFromConfig(this.opts.requireConfig, this.opts.exclude)); | ||
} | ||
@@ -138,2 +153,2 @@ | ||
graph.image(this.tree, opts, callback); | ||
}; | ||
}; |
@@ -9,3 +9,2 @@ 'use strict'; | ||
util = require('util'), | ||
parse = require('./parse'), | ||
amdetective = require('amdetective'), | ||
@@ -35,25 +34,3 @@ colors = require('colors'), | ||
AMD.prototype.normalize = function (filename) { | ||
var id = this.replaceBackslashInPath(path.relative(this.baseDir, filename).replace(this.extRegEx, '')); | ||
try { | ||
if (fs.existsSync(filename)) { | ||
var content = this.getFileSource(filename), | ||
def = parse(id, filename, content); | ||
if (def) { | ||
var match = def.match(/define\("([^\"]+)"/); | ||
if (match) { | ||
return match[1]; | ||
} | ||
} | ||
} | ||
} catch (e) { | ||
if (this.opts.breakOnError) { | ||
console.log(String('\nError while parsing file: ' + filename).red); | ||
throw e; | ||
} | ||
} | ||
return id; | ||
return this.replaceBackslashInPath(path.relative(this.baseDir, filename).replace(this.extRegEx, '')); | ||
}; | ||
@@ -64,3 +41,3 @@ | ||
* @param {String} filename | ||
* @return {Object} | ||
* @return {Array} | ||
*/ | ||
@@ -75,23 +52,26 @@ AMD.prototype.parseFile = function (filename) { | ||
if (src.indexOf('define(') >= 0 || src.indexOf('require(') >= 0) { | ||
parse.findDependencies(filename, src).filter(function (id) { | ||
// Ignore RequireJS IDs and plugins | ||
return id !== 'require' && id !== 'exports' && id !== 'module' && !id.match(/\.?\w\!/); | ||
}).map(function (id) { | ||
// Only resolve relative module identifiers (if the first term is "." or "..") | ||
if (id.charAt(0) !== '.') { | ||
return id; | ||
} | ||
amdetective(src).map(function (obj) { | ||
return typeof(obj) === 'string' ? [obj] : obj.deps; | ||
}).filter(function (deps) { | ||
deps.filter(function (id) { | ||
// Ignore RequireJS IDs and plugins | ||
return id !== 'require' && id !== 'exports' && id !== 'module' && !id.match(/\.?\w\!/); | ||
}).map(function (id) { | ||
// Only resolve relative module identifiers (if the first term is "." or "..") | ||
if (id.charAt(0) !== '.') { | ||
return id; | ||
} | ||
var depFilename = this.resolve(path.dirname(filename), id); | ||
var depFilename = path.resolve(path.dirname(filename), id); | ||
if (depFilename) { | ||
return this.normalize(depFilename); | ||
} | ||
}, this).filter(function (id) { | ||
if (!this.isExcluded(id) && dependencies.indexOf(id) < 0) { | ||
dependencies.push(id); | ||
} | ||
if (depFilename) { | ||
return this.normalize(depFilename); | ||
} | ||
}, this).forEach(function (id) { | ||
if (!this.isExcluded(id) && dependencies.indexOf(id) < 0) { | ||
dependencies.push(id); | ||
} | ||
}, this); | ||
}, this); | ||
return dependencies; | ||
@@ -113,16 +93,26 @@ } | ||
AMD.prototype.addOptimizedModules = function (filename) { | ||
var self = this; | ||
var self = this, | ||
anonymousRequire = []; | ||
amdetective(this.getFileSource(filename)) | ||
.filter(function(obj) { | ||
var id = obj.name; | ||
var id = obj.name || obj; | ||
return id !== 'require' && id !== 'exports' && id !== 'module' && !id.match(/\.?\w\!/) && !self.isExcluded(id); | ||
}) | ||
.forEach(function (obj) { | ||
if (!self.isExcluded(obj.name)) { | ||
self.tree[obj.name] = obj.deps.filter(function(id) { | ||
return id !== 'require' && id !== 'exports' && id !== 'module' && !id.match(/\.?\w\!/) && !self.isExcluded(id); | ||
}); | ||
} | ||
if (typeof(obj) === 'string') { | ||
anonymousRequire.push(obj); | ||
return; | ||
} | ||
if (!self.isExcluded(obj.name)) { | ||
self.tree[obj.name] = obj.deps.filter(function(id) { | ||
return id !== 'require' && id !== 'exports' && id !== 'module' && !id.match(/\.?\w\!/) && !self.isExcluded(id); | ||
}); | ||
} | ||
}); | ||
if (anonymousRequire.length > 0) { | ||
this.tree[this.opts.mainRequireModule || ''] = anonymousRequire; | ||
} | ||
}; | ||
@@ -129,0 +119,0 @@ |
@@ -11,3 +11,2 @@ 'use strict'; | ||
commondir = require('commondir'), | ||
resolve = require('resolve'), | ||
finder = require('walkdir'), | ||
@@ -46,22 +45,2 @@ coffee = require('coffee-script'); | ||
/** | ||
* Resolve the given `id` to a filename. | ||
* @param {String} dir | ||
* @param {String} id | ||
* @return {String} | ||
*/ | ||
Base.prototype.resolve = function (dir, id) { | ||
try { | ||
return resolve.sync(id, { | ||
basedir: dir | ||
}); | ||
} catch (e) { | ||
if (this.opts.breakOnError) { | ||
console.log(String('\nError while resolving module from: ' + id).red); | ||
throw e; | ||
} | ||
return id; | ||
} | ||
}; | ||
/** | ||
* Get the most common dir from the `src`. | ||
@@ -68,0 +47,0 @@ * @param {Array} src |
@@ -9,2 +9,3 @@ 'use strict'; | ||
util = require('util'), | ||
resolve = require('resolve'), | ||
detective = require('detective'), | ||
@@ -29,2 +30,22 @@ colors = require('colors'), | ||
/** | ||
* Resolve the given `id` to a filename. | ||
* @param {String} dir | ||
* @param {String} id | ||
* @return {String} | ||
*/ | ||
Base.prototype.resolve = function (dir, id) { | ||
try { | ||
return resolve.sync(id, { | ||
basedir: dir | ||
}); | ||
} catch (e) { | ||
if (this.opts.breakOnError) { | ||
console.log(String('\nError while resolving module from: ' + id).red); | ||
throw e; | ||
} | ||
return id; | ||
} | ||
}; | ||
/** | ||
* Normalize a module file path and return a proper identificator. | ||
@@ -45,3 +66,3 @@ * @param {String} filename | ||
* @param {String} filename | ||
* @return {Object} | ||
* @return {Array} | ||
*/ | ||
@@ -48,0 +69,0 @@ CJS.prototype.parseFile = function (filename) { |
@@ -17,6 +17,6 @@ 'use strict'; | ||
config = parse.findConfig(filename, fs.readFileSync(filename, 'utf8')), | ||
excludeRegex = exclude ? new RegExp(exclude) : false, | ||
isIncluded = function (key) { | ||
return !(excludeRegex && key.match(excludeRegex)); | ||
}; | ||
excludeRegex = exclude ? new RegExp(exclude) : false, | ||
isIncluded = function (key) { | ||
return !(excludeRegex && key.match(excludeRegex)); | ||
}; | ||
@@ -34,2 +34,24 @@ if (config.shim) { | ||
return deps; | ||
}; | ||
}; | ||
/** | ||
* Read path definitions from RequireJS config. | ||
* @param {String} filename | ||
* @param {String} [exclude] | ||
*/ | ||
module.exports.getPathsFromConfig = function (filename, exclude) { | ||
var paths = {}, | ||
config = parse.findConfig(filename, fs.readFileSync(filename, 'utf8')), | ||
excludeRegex = exclude ? new RegExp(exclude) : false, | ||
isIncluded = function (key) { | ||
return !(excludeRegex && key.match(excludeRegex)); | ||
}; | ||
if (config.paths) { | ||
Object.keys(config.paths).filter(isIncluded).forEach(function (key) { | ||
paths[key] = config.paths[key]; | ||
}); | ||
} | ||
return paths; | ||
}; |
{ | ||
"name": "madge", | ||
"version": "0.2.0", | ||
"version": "0.3.2", | ||
"dependencies": { | ||
"amdetective": { | ||
"version": "0.0.1", | ||
"from": "amdetective@0.0.1", | ||
"resolved": "https://registry.npmjs.org/amdetective/-/amdetective-0.0.1.tgz", | ||
"version": "0.0.2", | ||
"from": "amdetective@0.0.2", | ||
"resolved": "https://registry.npmjs.org/amdetective/-/amdetective-0.0.2.tgz", | ||
"dependencies": { | ||
"esprima": { | ||
"version": "1.0.4", | ||
"from": "esprima@~1.0.4", | ||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz" | ||
"version": "1.2.2", | ||
"from": "esprima@~1.2.2", | ||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz" | ||
} | ||
@@ -54,558 +54,2 @@ } | ||
}, | ||
"grunt": { | ||
"version": "0.4.4", | ||
"from": "grunt@0.4.4", | ||
"resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.4.tgz", | ||
"dependencies": { | ||
"async": { | ||
"version": "0.1.22", | ||
"from": "async@~0.1.22", | ||
"resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz" | ||
}, | ||
"colors": { | ||
"version": "0.6.2", | ||
"from": "colors@~0.6.2", | ||
"resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz" | ||
}, | ||
"dateformat": { | ||
"version": "1.0.2-1.2.3", | ||
"from": "dateformat@1.0.2-1.2.3", | ||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz" | ||
}, | ||
"eventemitter2": { | ||
"version": "0.4.13", | ||
"from": "eventemitter2@~0.4.13", | ||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.13.tgz" | ||
}, | ||
"findup-sync": { | ||
"version": "0.1.3", | ||
"from": "findup-sync@~0.1.2", | ||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", | ||
"dependencies": { | ||
"glob": { | ||
"version": "3.2.9", | ||
"from": "glob@~3.2.9", | ||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.9.tgz", | ||
"dependencies": { | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@2", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"lodash": { | ||
"version": "2.4.1", | ||
"from": "lodash@~2.4.1", | ||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" | ||
} | ||
} | ||
}, | ||
"glob": { | ||
"version": "3.1.21", | ||
"from": "glob@~3.1.21", | ||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", | ||
"dependencies": { | ||
"graceful-fs": { | ||
"version": "1.2.3", | ||
"from": "graceful-fs@~1.2.0", | ||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz" | ||
}, | ||
"inherits": { | ||
"version": "1.0.0", | ||
"from": "inherits@1", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"hooker": { | ||
"version": "0.2.3", | ||
"from": "hooker@~0.2.3", | ||
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz" | ||
}, | ||
"iconv-lite": { | ||
"version": "0.2.11", | ||
"from": "iconv-lite@~0.2.11", | ||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz" | ||
}, | ||
"minimatch": { | ||
"version": "0.2.14", | ||
"from": "minimatch@~0.2.12", | ||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", | ||
"dependencies": { | ||
"lru-cache": { | ||
"version": "2.5.0", | ||
"from": "lru-cache@2", | ||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
"sigmund": { | ||
"version": "1.0.0", | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"nopt": { | ||
"version": "1.0.10", | ||
"from": "nopt@~1.0.10", | ||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", | ||
"dependencies": { | ||
"abbrev": { | ||
"version": "1.0.4", | ||
"from": "abbrev@1", | ||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz" | ||
} | ||
} | ||
}, | ||
"rimraf": { | ||
"version": "2.2.6", | ||
"from": "rimraf@~2.2.0", | ||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.6.tgz" | ||
}, | ||
"lodash": { | ||
"version": "0.9.2", | ||
"from": "lodash@~0.9.2", | ||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz" | ||
}, | ||
"underscore.string": { | ||
"version": "2.2.1", | ||
"from": "underscore.string@~2.2.1", | ||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz" | ||
}, | ||
"which": { | ||
"version": "1.0.5", | ||
"from": "which@~1.0.5", | ||
"resolved": "https://registry.npmjs.org/which/-/which-1.0.5.tgz" | ||
}, | ||
"js-yaml": { | ||
"version": "2.0.5", | ||
"from": "js-yaml@~2.0.5", | ||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", | ||
"dependencies": { | ||
"argparse": { | ||
"version": "0.1.15", | ||
"from": "argparse@~ 0.1.11", | ||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.15.tgz", | ||
"dependencies": { | ||
"underscore": { | ||
"version": "1.4.4", | ||
"from": "underscore@~1.4.3", | ||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz" | ||
}, | ||
"underscore.string": { | ||
"version": "2.3.3", | ||
"from": "underscore.string@~2.3.1", | ||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz" | ||
} | ||
} | ||
}, | ||
"esprima": { | ||
"version": "1.0.4", | ||
"from": "esprima@~ 1.0.2", | ||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz" | ||
} | ||
} | ||
}, | ||
"exit": { | ||
"version": "0.1.2", | ||
"from": "exit@~0.1.1", | ||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" | ||
}, | ||
"getobject": { | ||
"version": "0.1.0", | ||
"from": "getobject@~0.1.0", | ||
"resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz" | ||
}, | ||
"grunt-legacy-util": { | ||
"version": "0.1.2", | ||
"from": "grunt-legacy-util@~0.1.2", | ||
"resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.1.2.tgz" | ||
} | ||
} | ||
}, | ||
"grunt-cli": { | ||
"version": "0.1.8", | ||
"from": "grunt-cli@0.1.8", | ||
"resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-0.1.8.tgz", | ||
"dependencies": { | ||
"nopt": { | ||
"version": "1.0.10", | ||
"from": "nopt@~1.0.10", | ||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", | ||
"dependencies": { | ||
"abbrev": { | ||
"version": "1.0.4", | ||
"from": "abbrev@1", | ||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz" | ||
} | ||
} | ||
}, | ||
"findup-sync": { | ||
"version": "0.1.3", | ||
"from": "findup-sync@~0.1.0", | ||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", | ||
"dependencies": { | ||
"glob": { | ||
"version": "3.2.9", | ||
"from": "glob@~3.2.9", | ||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.9.tgz", | ||
"dependencies": { | ||
"minimatch": { | ||
"version": "0.2.14", | ||
"from": "minimatch@~0.2.11", | ||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", | ||
"dependencies": { | ||
"lru-cache": { | ||
"version": "2.5.0", | ||
"from": "lru-cache@2", | ||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
"sigmund": { | ||
"version": "1.0.0", | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@2", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"lodash": { | ||
"version": "2.4.1", | ||
"from": "lodash@~2.4.1", | ||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" | ||
} | ||
} | ||
}, | ||
"resolve": { | ||
"version": "0.3.1", | ||
"from": "resolve@~0.3.1", | ||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-0.3.1.tgz" | ||
} | ||
} | ||
}, | ||
"grunt-contrib-jshint": { | ||
"version": "0.10.0", | ||
"from": "grunt-contrib-jshint@0.10.0", | ||
"resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.10.0.tgz", | ||
"dependencies": { | ||
"jshint": { | ||
"version": "2.5.0", | ||
"from": "jshint@~2.5.0", | ||
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.5.0.tgz", | ||
"dependencies": { | ||
"shelljs": { | ||
"version": "0.1.4", | ||
"from": "shelljs@0.1.x", | ||
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz" | ||
}, | ||
"underscore": { | ||
"version": "1.4.4", | ||
"from": "underscore@1.4.x", | ||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz" | ||
}, | ||
"cli": { | ||
"version": "0.4.5", | ||
"from": "cli@0.4.x", | ||
"resolved": "https://registry.npmjs.org/cli/-/cli-0.4.5.tgz", | ||
"dependencies": { | ||
"glob": { | ||
"version": "3.2.9", | ||
"from": "glob@>= 3.1.4", | ||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.9.tgz", | ||
"dependencies": { | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@2", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"minimatch": { | ||
"version": "0.2.14", | ||
"from": "minimatch@0.x.x", | ||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", | ||
"dependencies": { | ||
"lru-cache": { | ||
"version": "2.5.0", | ||
"from": "lru-cache@2", | ||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
"sigmund": { | ||
"version": "1.0.0", | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"htmlparser2": { | ||
"version": "3.3.0", | ||
"from": "htmlparser2@3.3.x", | ||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz", | ||
"dependencies": { | ||
"domhandler": { | ||
"version": "2.1.0", | ||
"from": "domhandler@2.1", | ||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.1.0.tgz" | ||
}, | ||
"domutils": { | ||
"version": "1.1.6", | ||
"from": "domutils@1.1", | ||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.1.6.tgz" | ||
}, | ||
"domelementtype": { | ||
"version": "1.1.1", | ||
"from": "domelementtype@1", | ||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.1.tgz" | ||
}, | ||
"readable-stream": { | ||
"version": "1.0.27-1", | ||
"from": "readable-stream@1.0", | ||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.27-1.tgz", | ||
"dependencies": { | ||
"core-util-is": { | ||
"version": "1.0.1", | ||
"from": "core-util-is@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" | ||
}, | ||
"isarray": { | ||
"version": "0.0.1", | ||
"from": "isarray@0.0.1", | ||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" | ||
}, | ||
"string_decoder": { | ||
"version": "0.10.25-1", | ||
"from": "string_decoder@~0.10.x", | ||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.25-1.tgz" | ||
}, | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@~2.0.1", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"console-browserify": { | ||
"version": "0.1.6", | ||
"from": "console-browserify@0.1.x", | ||
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-0.1.6.tgz" | ||
}, | ||
"exit": { | ||
"version": "0.1.2", | ||
"from": "exit@0.1.x", | ||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" | ||
}, | ||
"strip-json-comments": { | ||
"version": "0.1.1", | ||
"from": "strip-json-comments@0.1.x", | ||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.1.tgz" | ||
} | ||
} | ||
}, | ||
"hooker": { | ||
"version": "0.2.3", | ||
"from": "hooker@~0.2.3", | ||
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz" | ||
} | ||
} | ||
}, | ||
"grunt-mocha-test": { | ||
"version": "0.10.2", | ||
"from": "grunt-mocha-test@0.10.2", | ||
"resolved": "https://registry.npmjs.org/grunt-mocha-test/-/grunt-mocha-test-0.10.2.tgz", | ||
"dependencies": { | ||
"mocha": { | ||
"version": "1.18.2", | ||
"from": "mocha@~1.18.0", | ||
"resolved": "https://registry.npmjs.org/mocha/-/mocha-1.18.2.tgz", | ||
"dependencies": { | ||
"commander": { | ||
"version": "2.0.0", | ||
"from": "commander@2.0.0", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.0.0.tgz" | ||
}, | ||
"growl": { | ||
"version": "1.7.0", | ||
"from": "growl@1.7.x", | ||
"resolved": "https://registry.npmjs.org/growl/-/growl-1.7.0.tgz" | ||
}, | ||
"jade": { | ||
"version": "0.26.3", | ||
"from": "jade@0.26.3", | ||
"resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", | ||
"dependencies": { | ||
"commander": { | ||
"version": "0.6.1", | ||
"from": "commander@0.6.1", | ||
"resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz" | ||
}, | ||
"mkdirp": { | ||
"version": "0.3.0", | ||
"from": "mkdirp@0.3.0", | ||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz" | ||
} | ||
} | ||
}, | ||
"diff": { | ||
"version": "1.0.7", | ||
"from": "diff@1.0.7", | ||
"resolved": "https://registry.npmjs.org/diff/-/diff-1.0.7.tgz" | ||
}, | ||
"debug": { | ||
"version": "0.8.0", | ||
"from": "debug@*", | ||
"resolved": "https://registry.npmjs.org/debug/-/debug-0.8.0.tgz" | ||
}, | ||
"mkdirp": { | ||
"version": "0.3.5", | ||
"from": "mkdirp@0.3.5", | ||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" | ||
}, | ||
"glob": { | ||
"version": "3.2.3", | ||
"from": "glob@3.2.3", | ||
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.3.tgz", | ||
"dependencies": { | ||
"minimatch": { | ||
"version": "0.2.14", | ||
"from": "minimatch@~0.2.11", | ||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", | ||
"dependencies": { | ||
"lru-cache": { | ||
"version": "2.5.0", | ||
"from": "lru-cache@2", | ||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" | ||
}, | ||
"sigmund": { | ||
"version": "1.0.0", | ||
"from": "sigmund@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" | ||
} | ||
} | ||
}, | ||
"graceful-fs": { | ||
"version": "2.0.3", | ||
"from": "graceful-fs@~2.0.0", | ||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz" | ||
}, | ||
"inherits": { | ||
"version": "2.0.1", | ||
"from": "inherits@2", | ||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"hooker": { | ||
"version": "0.2.3", | ||
"from": "hooker@~0.2.3", | ||
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz" | ||
}, | ||
"fs-extra": { | ||
"version": "0.8.1", | ||
"from": "fs-extra@~0.8.1", | ||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.8.1.tgz", | ||
"dependencies": { | ||
"ncp": { | ||
"version": "0.4.2", | ||
"from": "ncp@~0.4.2", | ||
"resolved": "https://registry.npmjs.org/ncp/-/ncp-0.4.2.tgz" | ||
}, | ||
"mkdirp": { | ||
"version": "0.3.5", | ||
"from": "mkdirp@0.3.x", | ||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" | ||
}, | ||
"jsonfile": { | ||
"version": "1.1.1", | ||
"from": "jsonfile@~1.1.0", | ||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-1.1.1.tgz" | ||
}, | ||
"rimraf": { | ||
"version": "2.2.6", | ||
"from": "rimraf@~2.2.0", | ||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.6.tgz" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"grunt-release": { | ||
"version": "0.7.0", | ||
"from": "grunt-release@0.7.0", | ||
"resolved": "https://registry.npmjs.org/grunt-release/-/grunt-release-0.7.0.tgz", | ||
"dependencies": { | ||
"shelljs": { | ||
"version": "0.1.4", | ||
"from": "shelljs@~0.1.2", | ||
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz" | ||
}, | ||
"semver": { | ||
"version": "2.0.11", | ||
"from": "semver@~2.0.10", | ||
"resolved": "https://registry.npmjs.org/semver/-/semver-2.0.11.tgz" | ||
}, | ||
"superagent": { | ||
"version": "0.15.7", | ||
"from": "superagent@~0.15.4", | ||
"resolved": "https://registry.npmjs.org/superagent/-/superagent-0.15.7.tgz", | ||
"dependencies": { | ||
"qs": { | ||
"version": "0.6.5", | ||
"from": "qs@0.6.5", | ||
"resolved": "https://registry.npmjs.org/qs/-/qs-0.6.5.tgz" | ||
}, | ||
"formidable": { | ||
"version": "1.0.14", | ||
"from": "formidable@1.0.14", | ||
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.14.tgz" | ||
}, | ||
"mime": { | ||
"version": "1.2.5", | ||
"from": "mime@1.2.5", | ||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.5.tgz" | ||
}, | ||
"emitter-component": { | ||
"version": "1.0.0", | ||
"from": "emitter-component@1.0.0", | ||
"resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.0.0.tgz" | ||
}, | ||
"methods": { | ||
"version": "0.0.1", | ||
"from": "methods@0.0.1", | ||
"resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz" | ||
}, | ||
"cookiejar": { | ||
"version": "1.3.0", | ||
"from": "cookiejar@1.3.0", | ||
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-1.3.0.tgz" | ||
}, | ||
"debug": { | ||
"version": "0.7.4", | ||
"from": "debug@~0.7.2", | ||
"resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz" | ||
}, | ||
"reduce-component": { | ||
"version": "1.0.1", | ||
"from": "reduce-component@1.0.1", | ||
"resolved": "https://registry.npmjs.org/reduce-component/-/reduce-component-1.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"q": { | ||
"version": "1.0.1", | ||
"from": "q@~1.0.0", | ||
"resolved": "https://registry.npmjs.org/q/-/q-1.0.1.tgz" | ||
} | ||
} | ||
}, | ||
"resolve": { | ||
@@ -616,7 +60,2 @@ "version": "0.2.3", | ||
}, | ||
"should": { | ||
"version": "3.3.1", | ||
"from": "should@*", | ||
"resolved": "https://registry.npmjs.org/should/-/should-3.3.1.tgz" | ||
}, | ||
"uglify-js": { | ||
@@ -623,0 +62,0 @@ "version": "1.2.6", |
{ | ||
"name": "madge", | ||
"version": "0.3.1", | ||
"version": "0.3.4", | ||
"author": "Patrik Henningsson <patrik.henningsson@gmail.com>", | ||
@@ -41,3 +41,3 @@ "repository": "git://github.com/pahen/node-madge", | ||
"coffee-script": "1.3.3", | ||
"amdetective": "0.0.1" | ||
"amdetective": "0.0.2" | ||
}, | ||
@@ -44,0 +44,0 @@ "devDependencies": { |
@@ -5,3 +5,3 @@ # MaDGe - Module Dependency Graph | ||
Create graphs from your [CommonJS](http://nodejs.org/api/modules.html) or [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) module dependencies. Could also be useful for finding circular dependencies in your code. Tested on [Node.js](http://nodejs.org/) and [RequireJS](http://requirejs.org/) projects. Dependencies are calculated using static code analysis. CommonJS dependencies are found using James Halliday's [detective](https://github.com/substack/node-detective) and for AMD I'm using some parts copied from James Burke's [RequireJS](https://github.com/jrburke/requirejs) (both are using [UglifyJS](https://github.com/mishoo/UglifyJS)). Modules written in [CoffeeScript](http://coffeescript.org/) with extension .coffee are supported and will automatically be compiled on-the-fly. | ||
Create graphs from your [CommonJS](http://nodejs.org/api/modules.html) or [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) module dependencies. Could also be useful for finding circular dependencies in your code. Tested on [Node.js](http://nodejs.org/) and [RequireJS](http://requirejs.org/) projects. Dependencies are calculated using static code analysis. CommonJS dependencies are found using James Halliday's [detective](https://github.com/substack/node-detective) and for AMD I'm using [amdetective](https://www.npmjs.org/package/amdetective). Modules written in [CoffeeScript](http://coffeescript.org/) with extension .coffee are supported and will automatically be compiled on-the-fly. | ||
@@ -67,3 +67,4 @@ ## Examples | ||
- {Boolean} **optimized**. True if the parser should read modules from a optimized file (r.js). Defaults to false. | ||
- {String} **requireConfig**. Path to RequireJS config used to find shim dependencies. Not used by default. | ||
- {String} **mainRequireModule**. Name of the module if parsing an optimized file (r.js), where the main file used `require()` instead of `define`. Defaults to `''`. | ||
- {String} **requireConfig**. Path to RequireJS config used to find shim dependencies and path aliases. Not used by default. | ||
- {Function} **onParseFile**. Function to be called when parsing a file (argument will be an object with "filename" and "src" property set). | ||
@@ -137,4 +138,5 @@ - {Function} **onAddModule** . Function to be called when adding a module to the module tree (argument will be an object with "id" and "dependencies" property set). | ||
-C, --config <filename> provide a config file | ||
-R, --require-config <filename> include shim dependencies found in RequireJS config file | ||
-R, --require-config <filename> include shim dependencies and path aliases found in RequireJS config file | ||
-O, --optimized if given file is optimized with r.js | ||
-M --main-require-module name of the primary RequireJS module, if it's included with `require()` | ||
-j --json output dependency tree in json | ||
@@ -232,2 +234,11 @@ | ||
## v0.3.4 (Septemper 04, 2014) | ||
Correctly detect circular dependencies when using path aliases in RequireJS config (Thanks to Nicolas Ramz). | ||
## v0.3.3 (July 11, 2014) | ||
Fixed bug with relative paths in AMD not handled properly when checking for cyclic dependencies. | ||
## v0.3.2 (June 25, 2014) | ||
Handle anonymous require() as entry in the RequireJS optimized file (Thanks to Benjamin Horsleben). | ||
## v0.3.1 (June 03, 2014) | ||
@@ -234,0 +245,0 @@ Apply exclude to RequireJS shim dependencies (Thanks to Michael White). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
320
70280
1614
+ Addedamdetective@0.0.2(transitive)
+ Addedesprima@1.2.5(transitive)
- Removedamdetective@0.0.1(transitive)
- Removedesprima@1.0.4(transitive)
Updatedamdetective@0.0.2