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AAS,KAAM,EAAU,EA4BlC","file":"/npm/vue-hot-reload-loader@0.2.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/vue-hot-reload-loader@0.2.0/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 acorn = require('acorn')\nconst estraverse = require('estraverse')\nconst genCode = require('escodegen')\nconst genId = require('./gen-id')\n\nconst sourceMap = require('source-map')\nconst SourceMapConsumer = sourceMap.SourceMapConsumer\n\nmodule.exports = async function(contents, sourcemap) {\n  const id = genId(this.resourcePath, process.cwd())\n  let hasComponent = false\n\n  const parseOptions = { sourceType: 'module', ecmaVersion: 9 }\n\n  if (this.sourceMap) {\n    parseOptions.locations = true\n    parseOptions.sourceFile = this.resourcePath\n  }\n\n  const ast = acorn.parse(contents, parseOptions)\n\n  const res = estraverse.replace(ast, {\n    enter(node, parent) {\n      if (node.type === 'ExportDefaultDeclaration') {\n        hasComponent = true\n\n        const component = node.declaration\n\n        const componentId = {\n          type: 'Identifier',\n          name: '__component__'\n        }\n\n        node.declaration = componentId\n        parent.body.push(node)\n\n        return {\n          type: 'VariableDeclaration',\n          declarations: [\n            {\n              type: 'VariableDeclarator',\n              id: componentId,\n              init: component\n            }\n          ],\n          kind: 'var'\n        }\n      }\n    }\n  })\n\n  if (!hasComponent) {\n    this.callback(null, contents, sourcemap)\n    return\n  }\n\n  if (this.sourceMap) {\n    const generatedContents = genCode.generate(res, {\n      sourceMap: this.resourcePath,\n      sourceMapWithCode: true,\n      sourceContent: contents\n    })\n\n    // apply the original sourcemap to the sourcemap generated by escodegen.\n    const sourceMapGenerator = generatedContents.map\n\n    if (sourcemap) {\n      const originalSmc = await new SourceMapConsumer(sourcemap)\n      sourceMapGenerator.applySourceMap(originalSmc)\n      originalSmc.destroy()\n    }\n\n    const outSourcemap = sourceMapGenerator.toJSON()\n\n    this.callback(null, generatedContents.code + genHotReload(id), outSourcemap)\n  } else {\n    const generatedContents = genCode.generate(res)\n\n    this.callback(null, generatedContents + genHotReload(id))\n  }\n}\n\nfunction genHotReload(id) {\n  return `\nif (module.hot) {(function(options) {\n  if (typeof options === 'function') {\n    options = __component__.options\n  }\n\n  var api = require('vue-hot-reload-api')\n  var Vue = require('vue')\n\n  api.install(Vue)\n\n  if (api.compatible) {\n    module.hot.accept()\n    if (!module.hot.data) {\n      api.createRecord(\"${id}\", options)\n    } else {\n      api.reload(\"${id}\", options)\n    }\n  }})(__component__)\n}`\n}\n"]}