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AY,MAAM,KACpD,MAAM,EAAU,KAAK,gBACrB,OAAO,KAAK,GAAS,SAAQ,IAC3B,EAAS,QAAQ,MAAM,GAAO,EAAQ,EAAI,GAC1C,GAEN,EAGF,OAAO,QAAU","file":"/npm/webpack-plugin-get-chunk-entries@0.0.1/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/webpack-plugin-get-chunk-entries@0.0.1/lib/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","const { basename, extname } = require(\"path\");\nconst fs = require(\"fs\");\nconst { isRegExp, isString } = require(\"./utils\");\n\nclass GetChunkEntriesPlugin {\n  constructor(options) {\n    this.options = options;\n    this.entry = {};\n  }\n\n  getAllEntries() {\n    const { source } = this.options;\n    return this.inspectPath(source);\n  }\n\n  isFileMatched(filename) {\n    const { filename: targetFilename } = this.options;\n    if (isRegExp(targetFilename)) {\n      return targetFilename.test(filename);\n    }\n\n    return basename(filename) === targetFilename;\n  }\n\n  isExcluded(path) {\n    const { exclude } = this.options;\n    return exclude.some(condition => {\n      if (isRegExp(condition)) {\n        return condition.test(path);\n      }\n      if (isString(condition)) {\n        return basename(path) === condition;\n      }\n      return false;\n    });\n  }\n\n  getPathWithoutExtname(path) {\n    const extension = extname(path);\n    const pathWithoutExt = path.replace(extension, \"\");\n    return pathWithoutExt;\n  }\n\n  getRelativeSourcePath(path) {\n    const { source } = this.options;\n    const relativePath = path.split(source);\n    return relativePath && relativePath.length > 0 ? relativePath.pop() : path;\n  }\n\n  inspectPath(path, entries = {}) {\n    const stats = fs.lstatSync(path);\n\n    if (stats && stats.isDirectory()) {\n      const files = fs.readdirSync(path);\n      files.forEach(filename =>\n        this.inspectPath(`${path}/${filename}`, entries)\n      );\n    }\n\n    if (stats.isFile() && this.isFileMatched(path) && !this.isExcluded(path)) {\n      let key = this.getPathWithoutExtname(path);\n      key = this.getRelativeSourcePath(key);\n      entries[key] = path;\n    }\n\n    return entries;\n  }\n\n  apply(compiler) {\n    compiler.hooks.entryOption.tap(this.constructor.name, () => {\n      const entries = this.getAllEntries();\n      Object.keys(entries).forEach(key => {\n        compiler.options.entry[key] = entries[key];\n      });\n    });\n  }\n}\n\nmodule.exports = GetChunkEntriesPlugin;\n"]}