File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ module.exports = function (x, options) {
5050 var rfile = path . relative ( pkg . dir , x ) ;
5151 var r = opts . pathFilter ( pkg . pkg , x , rfile ) ;
5252 if ( r ) {
53- x = path . resolve ( pkg . dir , r ) ;
53+ x = path . resolve ( pkg . dir , r ) ; // eslint-disable-line no-param-reassign
5454 }
5555 }
5656
@@ -67,9 +67,11 @@ module.exports = function (x, options) {
6767 }
6868
6969 function loadpkg ( dir ) {
70- if ( dir === '' || dir === '/' || ( / [ / \\ ] n o d e _ m o d u l e s [ / \\ ] * $ / ) . test ( dir ) ) {
71- return null ;
70+ if ( dir === '' || dir === '/' ) return ;
71+ if ( process . platform === 'win32' && ( / ^ \w : [ / \\ ] * $ / ) . test ( dir ) ) {
72+ return ;
7273 }
74+ if ( / [ / \\ ] n o d e _ m o d u l e s [ / \\ ] * $ / . test ( dir ) ) return ;
7375
7476 var pkgfile = path . join ( dir , 'package.json' ) ;
7577
Original file line number Diff line number Diff line change @@ -115,6 +115,12 @@ options are:
115115
116116* ` opts.packageFilter(pkg, pkgfile) ` - transform the parsed package.json contents before looking at the "main" field
117117
118+ * ` opts.pathFilter(pkg, path, relativePath) ` - transform a path within a package
119+ * pkg - package data
120+ * path - the path being resolved
121+ * relativePath - the path relative from the package.json location
122+ * returns - a relative path that will be joined from the package.json location
123+
118124* opts.paths - require.paths array to use if nothing is found on the normal ` node_modules ` recursive walk (probably don't use this)
119125
120126* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: ` "node_modules" `
You can’t perform that action at this time.
0 commit comments