{"version":3,"sources":["jsdelivr-header.js","/npm/webpack-cleanup-plugin-next@0.5.2/src/WebpackCleanupPlugin.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,iRCJA,IAAA,QAAA,M,iCACA,QAAA,QAAA,gB,yCAEA,UAAA,QAAA,c,qOAEM,qB,WAEJ,SAAA,IAA0B,IAAd,EAAc,UAAA,OAAA,QAAA,IAAA,UAAA,GAAA,UAAA,GAAJ,GAAI,gBAAA,KAAA,GACxB,KAAK,QAAU,CAChB,C,mDAEK,GAAU,IAAA,EAAA,KACR,EAAa,EAAS,QAAQ,OAAO,KAE3C,EAAS,MAAM,KAAK,IAAI,0BAA0B,SAAC,GACjD,GAAmD,yBAA/C,EAAS,iBAAiB,YAAY,KAA1C,CAIA,IAAM,EAAS,EAAM,SAAS,OAAO,KAAI,SAAA,GAAA,OAAS,EAAM,IAAf,IACnC,GAAU,EAAA,SAAA,SAAM,EAAK,QAAQ,QAAS,GACtC,GAAQ,EAAA,WAAA,SAAS,EAAY,GAE/B,EAAK,QAAQ,SACf,QAAQ,IAAI,+BAAgC,EAAM,QAClD,EAAM,SAAQ,SAAA,GAAA,OAAQ,QAAQ,IAAI,SAAU,EAA9B,IACd,QAAQ,OAER,EAAM,QAAQ,KAAA,QAAG,YAEd,EAAK,QAAQ,OAChB,QAAQ,IAAI,8CAA+C,EAAM,OAdlE,CAgBF,GACF,K,KAIH,OAAO,QAAU","file":"/npm/webpack-cleanup-plugin-next@0.5.2/lib/WebpackCleanupPlugin.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/webpack-cleanup-plugin-next@0.5.2/lib/WebpackCleanupPlugin.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/* eslint no-console: 0 */\n\nimport fs from 'fs';\nimport union from 'lodash.union';\n\nimport getFiles from './getFiles';\n\nclass WebpackCleanupPlugin {\n\n  constructor(options = {}) {\n    this.options = options;\n  }\n\n  apply(compiler) {\n    const outputPath = compiler.options.output.path;\n\n    compiler.hooks.done.tap('webpack-cleanup-plugin', (stats) => {\n      if (compiler.outputFileSystem.constructor.name !== 'NodeOutputFileSystem') {\n        return;\n      }\n\n      const assets = stats.toJson().assets.map(asset => asset.name);\n      const exclude = union(this.options.exclude, assets);\n      const files = getFiles(outputPath, exclude);\n\n      if (this.options.preview) {\n        console.log('%s file(s) would be deleted:', files.length);\n        files.forEach(file => console.log('    %s', file));\n        console.log();\n      } else {\n        files.forEach(fs.unlinkSync);\n      }\n      if (!this.options.quiet) {\n        console.log('\\nWebpackCleanupPlugin: %s file(s) deleted.', files.length);\n      }\n    });\n  }\n\n}\n\nmodule.exports = WebpackCleanupPlugin;\n"]}