Skip to content

Commit 89cba98

Browse files
committed
Fix module-not-found crash, changelog
1 parent d5a8a03 commit 89cba98

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.1.0
2+
3+
* Add `external` option that allows the user to whitelist specific external
4+
modules to be included in with documentation.
5+
16
## 1.0.7
27

38
* Fixes sorting order of documentation

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var mdeps = require('module-deps'),
2020
* @name documentation
2121
* @param {Array<String>|String} indexes files to process
2222
* @param {Object} options options
23+
* @param {Array<string>} options.external a string regex / glob match pattern
24+
* that defines what external modules will be whitelisted and included in the
25+
* generated documentation.
2326
* @return {Object} stream of output
2427
*/
2528
module.exports = function (indexes, options) {

lib/module-filters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ module.exports = {
3030
// grab the path of the top-level node_modules directory.
3131
var topNodeModules = path.join(path.dirname(index), 'node_modules');
3232
return function matchGlob(file, pkg) {
33+
// if a module is not found, don't include it.
34+
if (!file || !pkg) return false;
3335
// if package.json specifies a 'main' script, strip that path off
3436
// the file to get the module's directory.
3537
// otherwise, just use the dirname of the file.

test/fixture/external.input.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
require('external');
22
require('external2');
3+
require('module-not-found');

0 commit comments

Comments
 (0)