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jC,GAGN","file":"/npm/babel-plugin-minify-remove-undefined@0.5.3/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/babel-plugin-minify-remove-undefined@0.5.3/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","\"use strict\";\n\nrequire(\"./setup\");\nconst evaluate = require(\"babel-helper-evaluate-path\");\n\nfunction isPureAndUndefined(\n  rval,\n  { tdz, scope = { hasBinding: () => false } } = {}\n) {\n  if (rval.isIdentifier() && rval.node.name === \"undefined\") {\n    // deopt right away if undefined is a local binding\n    if (scope.hasBinding(rval.node.name, true /* no globals */)) {\n      return false;\n    }\n    return true;\n  }\n\n  if (!rval.isPure()) {\n    return false;\n  }\n  const evaluation = evaluate(rval, { tdz });\n  return evaluation.confident === true && evaluation.value === undefined;\n}\n\nfunction getLoopParent(path, scopeParent) {\n  const parent = path.findParent(p => p.isLoop() || p === scopeParent);\n  // don't traverse higher than the function the var is defined in.\n  return parent === scopeParent ? null : parent;\n}\n\nfunction getFunctionParent(path, scopeParent) {\n  const parent = path.findParent(p => p.isFunction());\n  // don't traverse higher than the function the var is defined in.\n  return parent === scopeParent ? null : parent;\n}\n\nfunction getFunctionReferences(path, scopeParent, references = new Set()) {\n  for (\n    let func = getFunctionParent(path, scopeParent);\n    func;\n    func = getFunctionParent(func, scopeParent)\n  ) {\n    const id = func.node.id;\n    const binding = id && func.scope.getBinding(id.name);\n\n    if (!binding) {\n      continue;\n    }\n\n    binding.referencePaths.forEach(path => {\n      if (!references.has(path)) {\n        references.add(path);\n        getFunctionReferences(path, scopeParent, references);\n      }\n    });\n  }\n  return references;\n}\n\nfunction hasViolation(declarator, scope, start) {\n  const binding = scope.getBinding(declarator.node.id.name);\n  if (!binding) {\n    return true;\n  }\n\n  const scopeParent = declarator.getFunctionParent();\n\n  const violation = binding.constantViolations.some(v => {\n    // https://github.com/babel/minify/issues/630\n    if (!v.node) {\n      return false;\n    }\n    // return 'true' if we cannot guarantee the violation references\n    // the initialized identifier after\n    const violationStart = v.node.start;\n    if (violationStart === undefined || violationStart < start) {\n      return true;\n    }\n\n    const references = getFunctionReferences(v, scopeParent);\n    for (const ref of references) {\n      if (ref.node.start === undefined || ref.node.start < start) {\n        return true;\n      }\n    }\n\n    for (\n      let loop = getLoopParent(declarator, scopeParent);\n      loop;\n      loop = getLoopParent(loop, scopeParent)\n    ) {\n      if (loop.node.end === undefined || loop.node.end > violationStart) {\n        return true;\n      }\n    }\n  });\n\n  return violation;\n}\n\nmodule.exports = function() {\n  return {\n    name: \"transform-remove-undefined\",\n    visitor: {\n      SequenceExpression(path, { opts: { tdz } = {} }) {\n        const expressions = path.get(\"expressions\");\n\n        for (let i = 0; i < expressions.length; i++) {\n          const expr = expressions[i];\n          if (!isPureAndUndefined(expr, { tdz, scope: path.scope })) continue;\n\n          // last value\n          if (i === expressions.length - 1) {\n            if (path.parentPath.isExpressionStatement()) {\n              expr.remove();\n            }\n          } else {\n            expr.remove();\n          }\n        }\n      },\n\n      ReturnStatement(path, { opts: { tdz } = {} }) {\n        if (path.node.argument !== null) {\n          if (\n            isPureAndUndefined(path.get(\"argument\"), {\n              tdz,\n              scope: path.scope\n            })\n          ) {\n            path.node.argument = null;\n          }\n        }\n      },\n\n      VariableDeclaration(path, { opts: { tdz } = {} }) {\n        switch (path.node.kind) {\n          case \"const\":\n            break;\n          case \"let\":\n            for (const declarator of path.get(\"declarations\")) {\n              if (isPureAndUndefined(declarator.get(\"init\"), { tdz })) {\n                declarator.node.init = null;\n              }\n            }\n            break;\n          case \"var\":\n            const start = path.node.start;\n            if (start === undefined) {\n              // This is common for plugin-generated nodes\n              break;\n            }\n            const scope = path.scope;\n            for (const declarator of path.get(\"declarations\")) {\n              if (\n                isPureAndUndefined(declarator.get(\"init\")) &&\n                !hasViolation(declarator, scope, start)\n              ) {\n                declarator.node.init = null;\n              }\n            }\n            break;\n        }\n      }\n    }\n  };\n};\n"]}