File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,31 @@ DynamicCache.prototype.update = function (cb) {
37
37
this . _queue = [ ] ;
38
38
}
39
39
} . bind ( this ) ;
40
+
40
41
var getDeps = function ( filename ) {
41
- if ( this . _files [ filename ] ) {
42
- return [ [ filename ] ] . concat ( this . _files [ filename ] . map ( getDeps ) ) . reduce ( function ( a , b ) {
43
- return a . concat ( b ) ;
44
- } ) ;
45
- } else {
46
- return [ filename ] ;
42
+ var dependencies = this . _files [ filename ] ;
43
+ var dependenciesSet = { } ;
44
+
45
+ dependenciesSet [ filename ] = true ;
46
+
47
+ var getSubDeps = function ( deps ) {
48
+ deps . forEach ( function ( dep , index ) {
49
+ if ( ! dependenciesSet [ dep ] ) {
50
+ dependenciesSet [ dep ] = true ;
51
+ var subDeps = this . _files [ deps [ index ] ] ;
52
+ if ( subDeps ) {
53
+ getSubDeps ( subDeps ) ;
54
+ }
55
+ }
56
+ } , this ) ;
57
+ } . bind ( this )
58
+
59
+ if ( dependencies ) {
60
+ getSubDeps ( dependencies ) ;
47
61
}
62
+ return Object . keys ( dependenciesSet ) ;
48
63
} . bind ( this ) ;
64
+
49
65
files . forEach ( function ( filename ) {
50
66
fs . stat ( filename , function ( err , stats ) {
51
67
if ( err || stats . mtime . getTime ( ) !== this . _time [ filename ] ) {
You can’t perform that action at this time.
0 commit comments