Jacky Zhao
2023-05-31 21c007e2fcf73fe4ef04dd07db7116afed46047a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { PerfTimer } from "../perf"
import { QuartzFilterPlugin } from "../plugins/types"
import { ProcessedContent } from "../plugins/vfile"
 
export function filterContent(plugins: QuartzFilterPlugin[], content: ProcessedContent[], verbose: boolean): ProcessedContent[] {
  const perf = new PerfTimer()
  const initialLength = content.length
  for (const plugin of plugins) {
    content = content.filter(plugin.shouldPublish)
  }
 
  if (verbose) {
    console.log(`Filtered out ${initialLength - content.length} files in ${perf.timeSince()}`)
  }
  return content
}