-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathngModuleFilter.js
More file actions
28 lines (25 loc) · 877 Bytes
/
ngModuleFilter.js
File metadata and controls
28 lines (25 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var through = require('through2');
var moduleInfoParser = require("./moduleInfoParser")
var FileDependenciesTracker = require("./FileDependenciesTracker");
var path = require('path');
module.exports = function (options) {
var tracker = new FileDependenciesTracker(options.appModule);
var files = [];
var stream = through.obj(function (file, enc, cb) {
moduleInfoParser(file.contents.toString()).forEach(function (moduleDep) {
tracker.register(moduleDep.name, path.dirname(file.path), moduleDep.dependencies);
});
files.push(file);
cb();
}, function (cb) {
files.
filter(function (file) {
return tracker.fileIsRequired(file.path);
}).
forEach(function (file) {
stream.push(file);
});
cb();
});
return stream;
};