Skip to content

Commit

Permalink
fix: fixed --ignore in cases like --transitiveOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkr00t committed Feb 28, 2018
1 parent 88f1046 commit 431a72f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ const buildModuleDepsChains = (modules, name) => {
}, []);
};

const postProcessModules = modules => {
const postProcessModules = (modules, ignore) => {
return Object.keys(modules).reduce((acc, name) => {
if (mm.isMatch(name, ignore)) {
return acc;
}

const module = modules[name];
if (module.type === "module") {
module.locations = Array.from(new Set(module.locations));
Expand All @@ -242,7 +246,7 @@ const postProcessModules = modules => {
}

module.reasons = module.reasons.filter(
reason => !!modules[reason.moduleName]
reason => !mm.isMatch(reason.clearName || reason.moduleName, ignore)
);

if (module.reasons.length) {
Expand All @@ -257,12 +261,7 @@ module.exports = function analyze(
ignore /*: Array<string> */ = []
) {
const rawModules = flattenChunks(stats);
const modules = pickFromModules(rawModules).filter(
m =>
!mm.isMatch(
m.clearName || m.name,
[].concat(DEFAULT_IGNORE).concat(ignore)
)
);
return toArray(postProcessModules(joinModules(modules)));
const ignorePatterns = [].concat(DEFAULT_IGNORE).concat(ignore);
const modules = pickFromModules(rawModules);
return toArray(postProcessModules(joinModules(modules), ignorePatterns));
};

0 comments on commit 431a72f

Please sign in to comment.