{"version":3,"sources":["jsdelivr-header.js","/npm/rollup-plugin-commit@0.0.3/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAE,MAAS,QAAQ,iBAEzB,SAAS,UAAU,GACjB,GAAI,EAAK,SAAS,KAAM,CACtB,MAAM,EAAI,EAAK,YAAY,KAC3B,OAAO,EAAK,OAAO,EAAI,EACzB,CACA,OAAO,CACT,CAEA,SAAS,cAAc,EAAK,GAC1B,MAAM,EAAM,IAAI,KACV,EAAO,GAAG,EAAI,iBAAiB,EAAI,aAAa,EAAI,WACpD,EAAO,GAAG,EAAI,cAAc,EAAI,eACtC,OAAO,EAAI,QAAQ,SAAU,GAAM,QAAQ,SAAU,GAAM,QAAQ,SAAU,EAC/E,CAEA,SAAS,mBAAmB,GAC1B,MAAM,EAAU,EAAQ,SAAW,GAC7B,EAAU,EAAQ,SAAW,oCACnC,MAAO,CACL,KAAM,uBACN,WAAA,CAAY,GACV,MAAM,EAAS,EAAQ,MAAK,GAAU,QAAQ,EAAQ,UAAU,OAChE,GAAI,EAAQ,CACV,MAAM,EAAY,GAAO,CAAC,EAAO,EAAQ,IAAW,EAC9C,QAAQ,MAAM,GAAU,aAAa,MAAO,SAAc,EAAM,QAAQ,EAAU,KAAO,EAAU,MACnG,QAAQ,IAAI,GAAU,OAAO,qBAAsB,OACzD,KACE,WAAW,mBAEI,SAAc,cAAc,EAAS,UAAU,OAC9D,EAAS,cAEb,CACF,EAEJ,CAEA,OAAO,QAAU","file":"/npm/rollup-plugin-commit@0.0.3/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/rollup-plugin-commit@0.0.3/src/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 { exec } = require('child_process');\n\nfunction cleanName(name) {\n  if (name.includes('/')) {\n    const i = name.lastIndexOf('/');\n    return name.substr(i + 1);\n  }\n  return name;\n}\n\nfunction commitMessage(tpl, file) {\n  const now = new Date();\n  const date = `${now.getFullYear()}.${now.getDate()}.${now.getDay()}`;\n  const time = `${now.getHours()}:${now.getMinutes()}`;\n  return tpl.replace('{file}', file).replace('{date}', date).replace('{time}', time);\n}\n\nfunction rollupPluginCommit(options) {\n  const targets = options.targets || [];\n  const message = options.message || 'Updates to {file} @ {date} {time}';\n  return {\n    name: 'rollup-plugin-commit',\n    writeBundle(options) {\n      const target = targets.find(target => Boolean(options[cleanName(target)]));\n      if (target) {\n        const callback = (op) => (error, stdout, stderr) => (error)\n            ? console.error(stderr || `Failed to ${op} \"${target}\" \\n ${error.cmd}. ${stdout ? ('\\n' + stdout) : ''}`)\n            : console.log(stdout || `Git ${op} successful for \"${target}\".`);\n        exec(\n          `git add ${target} ${\n            '&&'\n          } git commit ${target} -m \"${commitMessage(message, cleanName(target))}\"`,\n          callback('add/commit')\n        );\n      }\n    }\n  };\n}\n\nmodule.exports = rollupPluginCommit;\n"]}