Skip to content

Commit 70b71e7

Browse files
author
James Halliday
committed
packageFilter should have been giving the pkgfile as an argument, fixed
1 parent caca9f9 commit 70b71e7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/async.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = function resolve (x, opts, cb) {
7676
catch (err) {}
7777

7878
if (opts.packageFilter) {
79-
pkg = opts.packageFilter(pkg, x);
79+
pkg = opts.packageFilter(pkg, pkgfile);
8080
}
8181
if (opts.pathFilter && remainder) {
8282
var newRemainder = opts.pathFilter(pkg, x, remainder);
@@ -129,7 +129,7 @@ module.exports = function resolve (x, opts, cb) {
129129
catch (err) {}
130130

131131
if (opts.packageFilter) {
132-
pkg = opts.packageFilter(pkg, x);
132+
pkg = opts.packageFilter(pkg, pkgfile);
133133
}
134134

135135
if (pkg.main) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "resolve",
33
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"repository": {
66
"type": "git",
77
"url": "git://github.com/substack/node-resolve.git"

readme.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ options are:
107107

108108
* opts.isFile - function to synchronously test whether a file exists
109109

110-
* opts.packageFilter - transform the parsed package.json contents before looking
111-
at the "main" field
110+
* `opts.packageFilter(pkg, pkgfile)` - transform the parsed package.json
111+
* contents before looking at the "main" field
112112

113113
* opts.paths - require.paths array to use if nothing is found on the normal
114114
node_modules recursive walk (probably don't use this)

0 commit comments

Comments
 (0)