Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

dependency graph not updated after first file read #5

Closed
seansfkelley opened this issue Aug 19, 2015 · 4 comments
Closed

dependency graph not updated after first file read #5

seansfkelley opened this issue Aug 19, 2015 · 4 comments

Comments

@seansfkelley
Copy link

It appears that the dependency graph doesn't change to respect added/removed/changed import statements after the file has been read the first time. Given:

parent.test:

(That is, an empty file.)

child.test:

import parent.test

gulpfile.js:

var gulp = require('gulp');
var progeny = require('gulp-progeny');
var cache = require('gulp-cached');
var debug = require('gulp-debug');

gulp.task('test', function() {
  return gulp.src('*.test')
    .pipe(cache('test'))
    .pipe(progeny({
      regexp: new RegExp('import (.*)'),
      debug: true
    }))
    .pipe(debug());
});

gulp.task('watch', [ 'test' ], function() {
  return gulp.watch('*', [ 'test' ]);
});

(Caches files and just prints out the names.)

I get the following behavior (annotations with my actions inline):

$ gulp watch

### Run for the first time -- dependency tree looks right.

Using gulpfile ~/Documents/Programming/temp/gulpfile.js
Starting 'test'...
gulp-debug: child.test
DEP child.test
    |--parent.test
gulp-debug: parent.test
DEP parent.test
    |  NO-DEP
gulp-debug: 2 items
Finished 'test' after 37 ms
Starting 'watch'...
Finished 'watch' after 13 ms

### Trivially modify child.test (e.g. add a newline). Behaves as expected.

Starting 'test'...
gulp-debug: child.test
DEP child.test
    |--parent.test
gulp-debug: 1 items
Finished 'test' after 100 ms

### Trivially modify parent.test. Behaves as expected.

Starting 'test'...
gulp-debug: parent.test
DEP parent.test
    |  NO-DEP
gulp-debug: child.test
gulp-debug: 2 items
Finished 'test' after 5.88 ms

### Remove dependency that child.test has on parent.test. Appears to behave as expected, including updated dependency. 

Starting 'test'...
gulp-debug: child.test
DEP child.test
    |  NO-DEP
gulp-debug: 1 items
Finished 'test' after 4.87 ms

### Trivially modify parent.test again. This should not pick up child.test, but it does.

Starting 'test'...
gulp-debug: parent.test
DEP parent.test
    |  NO-DEP
gulp-debug: child.test
gulp-debug: 2 items
Finished 'test' after 8.32 ms
@HerringtonDarkholme
Copy link
Owner

Thanks for reporting! I will dig into it in my spare time.

@HerringtonDarkholme
Copy link
Owner

Fixed in acc5ab3

@HerringtonDarkholme
Copy link
Owner

However I don't think this is necessary, and probably it will incurs performance problem in large projects.
Compiling more files than needed is acceptable.

@seansfkelley
Copy link
Author

Thanks for fixing it so quickly! I would be surprised if this caused performance issues; certainly that would be trumped by the cost of compiling the extra files. I discovered this bug while cleaning some needlessly broad blocks of import statements which was kind of a bummer since it wrecked watch performance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants