@@ -20,25 +20,29 @@ module.exports = function nodeModulesPaths(start, opts) {
2020 }
2121 }
2222
23- var prefix = '/' ;
24- if ( ( / ^ ( [ A - Z a - z ] : ) / ) . test ( absoluteStart ) ) {
25- prefix = '' ;
26- } else if ( ( / ^ \\ \\ / ) . test ( absoluteStart ) ) {
27- prefix = '\\\\' ;
28- }
23+ var dirs = [ ] ;
2924
30- var paths = [ absoluteStart ] ;
31- var parsed = parse ( absoluteStart ) ;
32- while ( parsed . dir !== paths [ paths . length - 1 ] ) {
33- paths . push ( parsed . dir ) ;
34- parsed = parse ( parsed . dir ) ;
35- }
25+ if ( ! opts || ! opts . skipNodeModules ) {
26+ var prefix = '/' ;
27+ if ( ( / ^ ( [ A - Z a - z ] : ) / ) . test ( absoluteStart ) ) {
28+ prefix = '' ;
29+ } else if ( ( / ^ \\ \\ / ) . test ( absoluteStart ) ) {
30+ prefix = '\\\\' ;
31+ }
3632
37- var dirs = paths . reduce ( function ( dirs , aPath ) {
38- return dirs . concat ( modules . map ( function ( moduleDir ) {
39- return path . join ( prefix , aPath , moduleDir ) ;
40- } ) ) ;
41- } , [ ] ) ;
33+ var paths = [ absoluteStart ] ;
34+ var parsed = parse ( absoluteStart ) ;
35+ while ( parsed . dir !== paths [ paths . length - 1 ] ) {
36+ paths . push ( parsed . dir ) ;
37+ parsed = parse ( parsed . dir ) ;
38+ }
39+
40+ dirs = paths . reduce ( function ( dirs , aPath ) {
41+ return dirs . concat ( modules . map ( function ( moduleDir ) {
42+ return path . join ( prefix , aPath , moduleDir ) ;
43+ } ) ) ;
44+ } , [ ] ) ;
45+ }
4246
4347 return opts && opts . paths ? dirs . concat ( opts . paths ) : dirs ;
4448} ;
0 commit comments