[Pkg-javascript-commits] [node-module-deps] 264/444: document opts.ignoreMissing

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-module-deps.

commit 0fbb9525c663cd1eff57eb1925e79ae88e95251f
Author: James Halliday <mail at substack.net>
Date:   Mon Jul 21 18:12:06 2014 -0700

    document opts.ignoreMissing
---
 index.js        |  2 ++
 readme.markdown | 24 +++++++++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/index.js b/index.js
index 972defd..bfcaf7d 100644
--- a/index.js
+++ b/index.js
@@ -60,6 +60,7 @@ Deps.prototype._transform = function (row, enc, next) {
     
     self.lookupPackage(row.file, function (err, pkg) {
         if (err && this.options.ignoreMissing) {
+            self.emit('missing', row.file, self.top);
             self.pending --;
             return next();
         }
@@ -242,6 +243,7 @@ Deps.prototype.walk = function (id, parent, cb) {
     self.resolve(id, parent, function (err, file, pkg) {
         if (err && self.options.ignoreMissing) {
             if (-- self.pending === 0) self.push(null);
+            self.emit('missing', id, parent);
             return cb(null, undefined);
         }
         if (err) return self.emit('error', err);
diff --git a/readme.markdown b/readme.markdown
index ab6a48e..0e80d14 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -63,35 +63,37 @@ Each file in `files` can be a string filename or a stream.
 
 Optionally pass in some `opts`:
 
-* opts.transform - a string or array of string transforms (see below)
+* `opts.transform` - a string or array of string transforms (see below)
 
-* opts.transformKey - an array path of strings showing where to look in the
+* `opts.transformKey` - an array path of strings showing where to look in the
 package.json for source transformations. If falsy, don't look at the
 package.json at all.
 
-* opts.resolve - custom resolve function using the
+* `opts.resolve` - custom resolve function using the
 `opts.resolve(id, parent, cb)` signature that
 [browser-resolve](https://github.com/shtylman/node-browser-resolve) has
 
-* opts.filter - a function (id) to skip resolution of some module `id` strings.
+* `opts.filter` - a function (id) to skip resolution of some module `id` strings.
 If defined, `opts.filter(id)` should return truthy for all the ids to include
 and falsey for all the ids to skip.
 
-* opts.packageFilter - transform the parsed package.json contents before using
+* `opts.packageFilter` - transform the parsed package.json contents before using
 the values. `opts.packageFilter(pkg, dir)` should return the new `pkg` object to
 use.
 
-* opts.noParse - an array of absolute paths to not parse for dependencies. Use
+* `opts.noParse` - an array of absolute paths to not parse for dependencies. Use
 this for large dependencies like jquery or threejs which take forever to parse.
 
-* opts.cache - an object mapping filenames to file objects to skip costly io
+* `opts.cache` - an object mapping filenames to file objects to skip costly io
 
-* opts.packageCache - an object mapping filenames to their parent package.json
+* `opts.packageCache` - an object mapping filenames to their parent package.json
 contents for browser fields, main entries, and transforms
 
-* opts.paths - array of global paths to search. Defaults to splitting on `':'`
+* `opts.paths` - array of global paths to search. Defaults to splitting on `':'`
 in `process.env.NODE_PATH`
 
+* `opts.ignoreMissing` - ignore files that failed to resolve
+
 # events
 
 ## d.on('transform', function (tr, file) {})
@@ -103,6 +105,10 @@ the instantiated transform stream `tr`.
 
 Every time a file is read, this event fires with the file path.
 
+## d.on('missing', function (id, parent) {})
+
+When `opts.ignoreMissing` is enabled, this event fires for each missing package.
+
 # transforms
 
 module-deps can be configured to run source transformations on files before

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git



More information about the Pkg-javascript-commits mailing list