{"version":3,"sources":["jsdelivr-header.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/actions/copy.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/actions/move.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/actions/delete.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/actions/mkdir.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/actions/archive.js","/npm/filemanager-webpack-plugin-fixed@2.0.9/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,o2BCNA,IAAM,GAAK,QAAQ,MACb,KAAO,QAAQ,QACf,IAAM,QAAQ,aACd,QAAU,QAAQ,YAClB,QAAU,QAAQ,YAQxB,SAAS,WAAW,EAAS,G,IACnB,EAAY,EAAZ,Q,OAEH,EAAQ,QAAW,EAAQ,YASzB,W,OACL,IAAI,SAAQ,SAAC,EAAS,GAMJ,OAHE,gBACQ,KAAK,EAAQ,QAGrC,GAAG,MAAM,EAAQ,QAAQ,SAAC,EAAM,G,GAC1B,EAAM,OAAO,EAAO,GAExB,GAAG,MAAM,EAAQ,aAAa,SAAC,EAAM,G,GAC/B,EAAO,SAAU,C,IACb,EACJ,GAAU,EAAO,cACb,EAAQ,YAAc,IAAM,KAAK,SAAS,EAAQ,QAClD,EAAQ,YAEV,GACF,QAAQ,IAAR,6CAAA,OAC+C,EAAQ,OADvD,qBAAA,OACiF,I,IAS7E,EAAW,KAAK,MAAM,GAEtB,EAAW,SAAC,EAAK,GACrB,QAAQ,KAAK,EAAK,GAAM,SAAA,GAClB,GAAK,EAAO,GAChB,G,KAIiB,KAAjB,EAAS,IACX,QAAQ,GAAa,MAAK,SAAA,GACxB,EAAS,EAAQ,OAAQ,EAAc,IAAM,KAAK,SAAS,EAAQ,Q,IAGrE,EAAS,EAAQ,OAAQ,E,KAEtB,CAEL,cADkB,EAAQ,QAAwC,MAA9B,EAAQ,OAAO,QAAQ,GAAa,IAAM,IAAM,OAC3D,EAAQ,YAAa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cAAc,YAAa,EAAc,G,UAI3C,UACH,EAAe,CACb,OAAQ,EAAK,YAAY,EAAW,QACpC,YAAa,EAAW,YACxB,OAAQ,EAAW,OAAS,EAAW,OAAS,MAChD,QAAS,EAAW,QAAU,EAAW,QAAU,CAAE,KAAM,CAAE,MAAO,KAGtE,EAAK,cAAc,cAAe,EAAc,G,OAUjD,C,+BAGH,G,IACE,EAAO,KAEP,EAAO,SAAA,G,IAET,EAAK,aAAa,U,CAClB,MAAO,GACP,EAAY,OAAO,KAAK,E,GAItB,EAAY,SAAC,EAAa,GAC9B,EAAK,SAAW,EAAY,K,IAG1B,EAAK,aAAa,Q,CAClB,MAAO,GACP,EAAY,OAAO,KAAK,E,CAG1B,G,EAGE,EAAS,OACX,EAAS,MAAM,YAAY,IAAI,cAAe,GAC9C,EAAS,MAAM,UAAU,SAAS,YAAa,KAE/C,EAAS,OAAO,cAAe,GAC/B,EAAS,OAAO,aAAc,G","file":"/npm/filemanager-webpack-plugin-fixed@2.0.9/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/filemanager-webpack-plugin-fixed@2.0.9/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 fs = require('fs');\nconst path = require('path');\nconst cpx = require('cpx-fixed');\nconst fsExtra = require('fs-extra');\nconst makeDir = require('make-dir');\n\n/**\n * Execute copy action\n *\n * @param {Object} command - Command data for given action\n * @return {Function|null} - Function that returns a promise or null\n */\nfunction copyAction(command, options) {\n  const { verbose } = options;\n\n  if (!command.source || !command.destination) {\n    if (verbose) {\n      console.log(\n        '  - FileManagerPlugin: Warning - copy parameter has to be formated as follows: { source: <string>, destination: <string> }',\n      );\n    }\n    return null;\n  }\n\n  return () =>\n    new Promise((resolve, reject) => {\n      // if source is a file, just copyFile()\n      // if source is a NOT a glob pattern, simply append **/*\n      const fileRegex = /(\\*|\\{+|\\}+)/g;\n      const matches = fileRegex.exec(command.source);\n\n      if (matches === null) {\n        fs.lstat(command.source, (sErr, sStats) => {\n          if (sErr) return reject(sErr);\n\n          fs.lstat(command.destination, (dErr, dStats) => {\n            if (sStats.isFile()) {\n              const destination =\n                dStats && dStats.isDirectory()\n                  ? command.destination + '/' + path.basename(command.source)\n                  : command.destination;\n\n              if (verbose) {\n                console.log(\n                  `  - FileManagerPlugin: Start copy source: ${command.source} to destination: ${destination}`,\n                );\n              }\n\n              /*\n               * If the supplied destination is a directory copy inside.\n               * If the supplied destination is a directory that does not exist yet create it & copy inside\n               */\n\n              const pathInfo = path.parse(destination);\n\n              const execCopy = (src, dest) => {\n                fsExtra.copy(src, dest, err => {\n                  if (err) reject(err);\n                  resolve();\n                });\n              };\n\n              if (pathInfo.ext === '') {\n                makeDir(destination).then(mPath => {\n                  execCopy(command.source, destination + '/' + path.basename(command.source));\n                });\n              } else {\n                execCopy(command.source, destination);\n              }\n            } else {\n              const sourceDir = command.source + (command.source.substr(-1) !== '/' ? '/' : '') + '**/*';\n              copyDirectory(sourceDir, command.destination, resolve, reject, options);\n            }\n          });\n        });\n      } else {\n        copyDirectory(command.source, command.destination, resolve, reject, options);\n      }\n    });\n}\n\n/**\n * Execute copy directory\n *\n * @param {string} source - source file path\n * @param {string} destination - destination file path\n * @param {Function} resolve - function used to resolve a Promise\n * @param {Function} reject - function used to reject a Promise\n * @return {void}\n */\nfunction copyDirectory(source, destination, resolve, reject, options) {\n  const { verbose } = options;\n\n  /* cpx options */\n  const cpxOptions = {\n    clean: false,\n    includeEmptyDirs: true,\n    update: false,\n  };\n\n  if (verbose) {\n    console.log(`  - FileManagerPlugin: Start copy source file: ${source} to destination file: ${destination}`);\n  }\n\n  cpx.copy(source, destination, cpxOptions, err => {\n    if (err && options.verbose) {\n      console.log('  - FileManagerPlugin: Error - copy failed', err);\n      reject(err);\n    }\n\n    if (verbose) {\n      console.log(`  - FileManagerPlugin: Finished copy source: ${source} to destination: ${destination}`);\n    }\n\n    resolve();\n  });\n}\n\nexport default copyAction;\n","const fs = require('fs');\nconst mv = require('mv');\n\n/**\n * Execute move action\n *\n * @param {Object} command - Command data for given action\n * @return {Function|null} - Function that returns a promise or null\n */\nfunction moveAction(command, options) {\n  const { verbose } = options;\n\n  if (!command.source || !command.destination) {\n    if (verbose) {\n      console.log(\n        '  - FileManagerPlugin: Warning - move parameter has to be formated as follows: { source: <string>, destination: <string> }',\n      );\n    }\n    return null;\n  }\n\n  if (fs.existsSync(command.source)) {\n    return () =>\n      new Promise((resolve, reject) => {\n        if (verbose) {\n          console.log(\n            `  - FileManagerPlugin: Start move source: ${command.source} to destination: ${command.destination}`,\n          );\n        }\n\n        mv(command.source, command.destination, { mkdirp: false }, err => {\n          if (err) {\n            if (verbose) {\n              console.log('  - FileManagerPlugin: Error - move failed', err);\n            }\n            reject(err);\n          }\n\n          if (verbose) {\n            console.log(\n              `  - FileManagerPlugin: Finished move source: ${command.source} to destination: ${command.destination}`,\n            );\n          }\n\n          resolve();\n        });\n      });\n  } else {\n    process.emitWarning('  - FileManagerPlugin: Could not move ' + command.source + ': path does not exist');\n    return null;\n  }\n}\n\nexport default moveAction;\n","const fs = require('fs');\nconst rimraf = require('rimraf');\n\n/**\n * Execute delete action\n *\n * @param {Object} command - Command data for given action\n * @return {Function|null} - Function that returns a promise or null\n */\nfunction deleteAction(command, options) {\n  const { verbose } = options;\n\n  return () =>\n    new Promise((resolve, reject) => {\n      if (verbose) {\n        console.log(`  - FileManagerPlugin: Starting delete path ${command.source}`);\n      }\n\n      if (typeof command.source !== 'string') {\n        if (verbose) {\n          console.log('  - FileManagerPlugin: Warning - delete parameter has to be type of string. Process canceled.');\n        }\n        reject();\n      }\n\n      rimraf(command.source, {}, response => {\n        if (verbose && response === null) {\n          console.log(`  - FileManagerPlugin: Finished delete path ${command.source}`);\n        }\n        resolve();\n      });\n    });\n}\n\nexport default deleteAction;\n","const makeDir = require('make-dir');\n\n/**\n * Execute mkdir action\n *\n * @param {Object} command - Command data for given action\n * @return {Function|null} - Function that returns a promise or null\n */\nfunction mkdirAction(command, options) {\n  const { verbose } = options;\n\n  return () => {\n    if (verbose) {\n      console.log(`  - FileManagerPlugin: Creating path ${command.source}`);\n    }\n\n    if (typeof command.source !== 'string') {\n      if (verbose) {\n        console.log('  - FileManagerPlugin: Warning - mkdir parameter has to be type of string. Process canceled.');\n      }\n      return null;\n    }\n\n    return makeDir(command.source);\n  };\n}\n\nexport default mkdirAction;\n","const fs = require('fs-extra');\nconst path = require('path');\nconst archiver = require('archiver');\n\n/**\n * Execute mkdir action\n *\n * @param {Object} command - Command data for given action\n * @return {Function|null} - Function that returns a promise or null\n */\nfunction archiveAction(command, options) {\n  const { verbose } = options;\n\n  return () =>\n    new Promise((resolve, reject) => {\n      if (!command.source || !command.destination) {\n        if (verbose) {\n          console.log(\n            '  - FileManagerPlugin: Warning - archive parameter has to be formated as follows: { source: <string>, destination: <string> }',\n          );\n        }\n        reject();\n      }\n\n      const fileRegex = /(\\*|\\{+|\\}+)/g;\n      const matches = fileRegex.exec(command.source);\n\n      const isGlob = matches !== null;\n\n      fs.lstat(command.source, (sErr, sStats) => {\n        const output = fs.createWriteStream(command.destination);\n        const archive = archiver(command.format, command.options);\n\n        archive.on('error', err => reject(err));\n        archive.pipe(output);\n\n        // Exclude destination file from archive\n        const destFile = path.basename(command.destination);\n        const globOptions = Object.assign({ ignore: destFile }, command.options.globOptions || {});\n\n        if (isGlob) archive.glob(command.source, globOptions);\n        else if (sStats.isFile()) archive.file(command.source, { name: path.basename(command.source) });\n        else if (sStats.isDirectory())\n          archive.glob('**/*', {\n            cwd: command.source,\n            ignore: destFile,\n          });\n        archive.finalize().then(() => resolve());\n      });\n    });\n}\n\nexport default archiveAction;\n","import { copyAction, moveAction, mkdirAction, archiveAction, deleteAction } from './actions';\n\nclass FileManagerPlugin {\n  constructor(options) {\n    this.options = this.setOptions(options);\n  }\n\n  setOptions(userOptions) {\n    const defaultOptions = {\n      verbose: false,\n      moveWithMkdirp: false,\n      onStart: {},\n      onEnd: {},\n    };\n\n    for (const key in defaultOptions) {\n      if (userOptions.hasOwnProperty(key)) {\n        defaultOptions[key] = userOptions[key];\n      }\n    }\n\n    return defaultOptions;\n  }\n\n  checkOptions(stage) {\n    if (this.options.verbose && Object.keys(this.options[stage]).length) {\n      console.log(`FileManagerPlugin: processing ${stage} event`);\n    }\n\n    let operationList = [];\n\n    if (this.options[stage] && Array.isArray(this.options[stage])) {\n      this.options[stage].map(opts => operationList.push(...this.parseFileOptions(opts, true)));\n    } else {\n      operationList.push(...this.parseFileOptions(this.options[stage]));\n    }\n\n    if (operationList.length) {\n      operationList.reduce((previous, fn) => {\n        return previous.then(retVal => fn(retVal)).catch(err => console.log(err));\n      }, Promise.resolve());\n    }\n  }\n\n  replaceHash(filename) {\n    return filename.replace('[hash]', this.fileHash);\n  }\n\n  processAction(action, params, commandOrder) {\n    const result = action(params, this.options);\n\n    if (result !== null) {\n      commandOrder.push(result);\n    }\n  }\n\n  parseFileOptions(options, preserveOrder = false) {\n    let commandOrder = [];\n\n    Object.keys(options).forEach(actionType => {\n      const actionOptions = options[actionType];\n      let actionParams = null;\n\n      actionOptions.forEach(actionItem => {\n        switch (actionType) {\n          case 'copy':\n            actionParams = Object.assign(\n              { source: this.replaceHash(actionItem.source) },\n              actionItem.destination && { destination: actionItem.destination },\n            );\n\n            this.processAction(copyAction, actionParams, commandOrder);\n\n            break;\n\n          case 'move':\n            actionParams = Object.assign(\n              { source: this.replaceHash(actionItem.source) },\n              actionItem.destination && { destination: actionItem.destination },\n            );\n\n            this.processAction(moveAction, actionParams, commandOrder);\n\n            break;\n\n          case 'delete':\n            if (!Array.isArray(actionOptions) || typeof actionItem !== 'string') {\n              throw Error(`  - FileManagerPlugin: Fail - delete parameters has to be an array of strings`);\n            }\n\n            actionParams = Object.assign({ source: this.replaceHash(actionItem) });\n            this.processAction(deleteAction, actionParams, commandOrder);\n\n            break;\n\n          case 'mkdir':\n            actionParams = { source: this.replaceHash(actionItem) };\n            this.processAction(mkdirAction, actionParams, commandOrder);\n\n            break;\n\n          case 'archive':\n            actionParams = {\n              source: this.replaceHash(actionItem.source),\n              destination: actionItem.destination,\n              format: actionItem.format ? actionItem.format : 'zip',\n              options: actionItem.options ? actionItem.options : { zlib: { level: 9 } },\n            };\n\n            this.processAction(archiveAction, actionParams, commandOrder);\n\n            break;\n\n          default:\n            break;\n        }\n      });\n    });\n\n    return commandOrder;\n  }\n\n  apply(compiler) {\n    const that = this;\n\n    const comp = compilation => {\n      try {\n        that.checkOptions('onStart');\n      } catch (error) {\n        compilation.errors.push(error);\n      }\n    };\n\n    const afterEmit = (compilation, cb) => {\n      that.fileHash = compilation.hash;\n\n      try {\n        that.checkOptions('onEnd');\n      } catch (error) {\n        compilation.errors.push(error);\n      }\n\n      cb();\n    };\n\n    if (compiler.hooks) {\n      compiler.hooks.compilation.tap('compilation', comp);\n      compiler.hooks.afterEmit.tapAsync('afterEmit', afterEmit);\n    } else {\n      compiler.plugin('compilation', comp);\n      compiler.plugin('after-emit', afterEmit);\n    }\n  }\n}\n\nexport default FileManagerPlugin;\n"]}