Jacky Zhao
2023-06-01 fcd81353f88b613e5e93c089e10e530d08695b3f
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
}