{"version":3,"sources":["jsdelivr-header.js","/npm/html-extract-plugin@0.0.7/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,GAAK,QAAQ,MACb,KAAO,QAAQ,QACnB,SAAS,YAAY,GACnB,KAAK,SAAW,EAAQ,QAC1B,CAEA,YAAY,UAAU,MAAQ,SAAS,GACrC,IAAI,EAAK,KACT,EAAS,OAAO,eAAe,SAAS,GACtC,QAAQ,IAAI,iDACZ,EAAY,OAAO,8CAA8C,SAAS,EAAgB,GACxF,IAAI,EAAU,EAAe,OAAO,QAChC,EAAW,KAAK,QAAQ,EAAG,SAAU,EAAQ,UACjD,GAAG,SAAS,EAAU,QAAQ,SAAS,EAAK,GACtC,IAAI,EAAW,0BAEX,EAAU,EAAK,MAAM,GACzB,EAAe,KAAO,EAAe,KAAK,QAAQ,EAAU,EAAQ,IACpE,EAAe,KAAO,EAAe,KAAK,QAH5B,wBAG8C,SAAW,EAAK,QAAQ,EAAU,IAAM,WACpG,EAAS,KAAM,EACnB,GACJ,GACF,GAEF,EAEA,OAAO,QAAU","file":"/npm/html-extract-plugin@0.0.7/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/html-extract-plugin@0.0.7/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var fs = require('fs');\nvar path = require('path');\nfunction HtmlExtract(options) {\n  this.htmlRoot = options.htmlRoot;//定义html的根目录\n}\n\nHtmlExtract.prototype.apply = function(compiler) {\n  var me = this;\n  compiler.plugin('compilation', function(compilation) {\n    console.log('The compiler is starting a new compilation...');\n    compilation.plugin('html-webpack-plugin-before-html-processing', function(htmlPluginData, callback) {\n      var options = htmlPluginData.plugin.options;\n      var fileName = path.resolve(me.htmlRoot, options.filename);\n      fs.readFile(fileName, 'utf8', function(err, html){\n            var titleReg = /<title>.*\\\\?<\\/title>/ig;\n            var bodyReg = /<body>.*\\\\?<\\/body>/ig;\n            var htmlArr = html.match(titleReg);\n            htmlPluginData.html = htmlPluginData.html.replace(titleReg, htmlArr[0]);\n            htmlPluginData.html = htmlPluginData.html.replace(bodyReg, ('<body>' + html.replace(titleReg, '') + '</body>'));\n            callback(null, htmlPluginData);\n        });\n    });\n  });\n\n};\n\nmodule.exports = HtmlExtract;\n"]}