function estimateWastedBytes(content, matches) {
  // Split up results based on polyfill / transform. Only transforms start with @.
  const polyfillResults = matches.filter(m => !m.name.startsWith('@'));
  const transformResults = matches.filter(m => m.name.startsWith('@'));

  let estimatedWastedBytesFromPolyfills = 0;
  const modulesSeen = new Set();
  for (const result of polyfillResults) {
    const modules = graph.dependencies[result.name];
    if (!modules) continue; // Shouldn't happen.
    for (const module of modules) {
      modulesSeen.add(module);
    }
  }

  estimatedWastedBytesFromPolyfills += [...modulesSeen].reduce((acc, moduleIndex) => {
    return acc + graph.moduleSizes[moduleIndex];
  }, 0);
  estimatedWastedBytesFromPolyfills = Math.min(estimatedWastedBytesFromPolyfills, graph.maxSize);

  let estimatedWastedBytesFromTransforms = 0;

  for (const result of transformResults) {
    const pattern = getTransformPatterns().find(p => p.name === result.name);
    if (!pattern || !pattern.estimateBytes || !content) continue;
    estimatedWastedBytesFromTransforms += pattern.estimateBytes(content);
  }

  const estimatedWastedBytes =
    estimatedWastedBytesFromPolyfills + estimatedWastedBytesFromTransforms;
  return estimatedWastedBytes;
}
@param {string} content
@param {PatternMatchResult[]} matches
@return {number}