message: Use reduce instead of filter+map in dependency_resolver
diff: @@ -38,17 +38,27 @@ class DependencyResolver {
  return [];
  }
  - return dependencies
  - .map(dependency => {
  + return dependencies.reduce((acc, dependency) => {
  if (this._resolver.isCoreModule(dependency)) {
  - return null;
  + return acc;
  }
  + let resolvedDependency;
  try {
  - return this._resolver.resolveModule(file, dependency, options);
  - } catch (e) {}
  - return this._resolver.getMockModule(file, dependency);
  - })
  - .filter(Boolean);
  + resolvedDependency = this._resolver.resolveModule(
  + file,
  + dependency,
  + options,
  + );
  + } catch (e) {
  + resolvedDependency = this._resolver.getMockModule(file, dependency);
  + }
  +
  + if (resolvedDependency) {
  + acc.push(resolvedDependency);
  + }
  +
  + return acc;
  + }, []);
  }
  resolveInverse(
  @@ -64,20 +74,22 @@ class DependencyResolver {
  const visitedModules = new Set();
  while (changed.size) {
  changed = new Set(
  - moduleMap
  - .filter(
  - module =>
  - !visitedModules.has(module.file) &&
  - module.dependencies.some(dep => dep && changed.has(dep)),
  - )
  - .map(module => {
  + moduleMap.reduce((acc, module) => {
  + if (
  + visitedModules.has(module.file) ||
  + !module.dependencies.some(dep => dep && changed.has(dep))
  + ) {
  + return acc;
  + }
  +
  const file = module.file;
  if (filter(file)) {
  relatedPaths.add(file);
  }
  visitedModules.add(file);
  - return module.file;
  - }),
  + acc.push(module.file);
  + return acc;
  + }, []),
  );
  }
  return relatedPaths;
  