message: Add `terser` filter
diff: @@ -20,14 +20,15 @@ export default function (userOptions = {}) {
  return (site) => {
  site.loadAssets(options.extensions, textLoader);
  site.process(options.extensions, processor);
  + site.filter("terser", filter, true);
  +
  + // Options passed to terser
  + const terserOptions = { ...options.options };
  async function processor(file) {
  const content = file.content;
  const filename = file.dest.path + file.dest.ext;
  - // Options passed to terser
  - const terserOptions = { ...options.options };
  -
  if (options.sourceMap) {
  terserOptions.sourceMap = {
  filename: filename,
  @@ -50,5 +51,10 @@ export default function (userOptions = {}) {
  error("terser", `Error in file ${filename}`, err);
  }
  }
  +
  + async function filter(code) {
  + const output = await minify(code, terserOptions);
  + return output.code;
  + }
  };
  }
  