{"version":3,"names":["_pluginSyntaxJsx","require","_helperPluginUtils","_core","_helperModuleImports","_helperAnnotateAsPure","DEFAULT","importSource","runtime","pragma","pragmaFrag","JSX_SOURCE_ANNOTATION_REGEX","JSX_RUNTIME_ANNOTATION_REGEX","JSX_ANNOTATION_REGEX","JSX_FRAG_ANNOTATION_REGEX","get","pass","name","set","v","hasProto","node","properties","some","value","t","isObjectProperty","computed","shorthand","isIdentifier","key","isStringLiteral","createPlugin","development","declare","_","options","pure","PURE_ANNOTATION","throwIfNamespace","filter","RUNTIME_DEFAULT","IMPORT_SOURCE_DEFAULT","PRAGMA_DEFAULT","PRAGMA_FRAG_DEFAULT","useSpread","useBuiltIns","Error","injectMetaPropertiesVisitor","JSXOpeningElement","path","state","attributes","isThisAllowed","scope","push","jsxAttribute","jsxIdentifier","jsxExpressionContainer","thisExpression","makeSource","pushContainer","inherits","jsx","visitor","JSXNamespacedName","buildCodeFrameError","JSXSpreadChild","Program","enter","file","source","sourceSet","pragmaSet","pragmaFragSet","ast","comments","comment","sourceMatches","exec","runtimeMatches","jsxMatches","jsxFragMatches","createElement","toMemberExpression","fragment","cloneNode","define","id","createImportLazily","traverse","JSXFragment","exit","callExpr","buildCreateElementFragmentCall","buildJSXFragmentCall","replaceWith","JSXElement","shouldUseCreateElement","buildCreateElementCall","buildJSXElementCall","JSXAttribute","isJSXElement","isDerivedClass","classPath","superClass","isFunctionParent","isArrowFunctionExpression","isMethod","kind","parentPath","isTSModuleBlock","parent","call","args","callExpression","annotateAsPure","openingPath","seenPropsSpread","i","length","attr","isJSXAttribute","isJSXSpreadAttribute","convertJSXIdentifier","isJSXIdentifier","isReferenced","isValidIdentifier","type","stringLiteral","isJSXMemberExpression","memberExpression","object","property","isJSXNamespacedName","namespace","convertAttributeValue","isJSXExpressionContainer","expression","accumulateAttribute","array","attribute","arg","argument","isObjectExpression","spreadElement","booleanLiteral","_value$extra","replace","extra","raw","objectProperty","buildChildrenProperty","children","childrenNode","arrayExpression","undefined","identifier","getTag","attribsArray","extracted","Object","create","sourceSelfError","keyValue","react","buildChildren","attribs","buildJSXOpeningElementAttributes","objectExpression","_extracted$key","buildUndefinedNode","__source","__self","props","reduce","nullLiteral","buildCreateElementOpeningElementAttributes","tagExpr","tagName","isCompatTag","objs","start","forEach","prop","isSpreadElement","slice","unshift","helper","addHelper","found","getSource","importName","actualSource","isModule","reference","addNamed","importedInterop","importPosition","addNamespace","split","map","location","loc","fileNameIdentifier","filename","generateUidIdentifier","getProgramParent","init","makeTrace","line","column","lineNumber","column0Based","fileLineLiteral","numericLiteral","fileColumnLiteral","template","pluginName"],"sources":["../src/create-plugin.ts"],"sourcesContent":["import jsx from \"@babel/plugin-syntax-jsx\";\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport { template, types as t } from \"@babel/core\";\nimport type { PluginPass } from \"@babel/core\";\nimport type { NodePath, Scope, Visitor } from \"@babel/traverse\";\nimport { addNamed, addNamespace, isModule } from \"@babel/helper-module-imports\";\nimport annotateAsPure from \"@babel/helper-annotate-as-pure\";\nimport type {\n CallExpression,\n Class,\n Expression,\n Identifier,\n JSXAttribute,\n JSXElement,\n JSXFragment,\n JSXOpeningElement,\n JSXSpreadAttribute,\n MemberExpression,\n ObjectExpression,\n Program,\n} from \"@babel/types\";\n\nconst DEFAULT = {\n importSource: \"react\",\n runtime: \"automatic\",\n pragma: \"React.createElement\",\n pragmaFrag: \"React.Fragment\",\n};\n\nconst JSX_SOURCE_ANNOTATION_REGEX =\n /^\\s*\\*?\\s*@jsxImportSource\\s+([^\\s]+)\\s*$/m;\nconst JSX_RUNTIME_ANNOTATION_REGEX = /^\\s*\\*?\\s*@jsxRuntime\\s+([^\\s]+)\\s*$/m;\n\nconst JSX_ANNOTATION_REGEX = /^\\s*\\*?\\s*@jsx\\s+([^\\s]+)\\s*$/m;\nconst JSX_FRAG_ANNOTATION_REGEX = /^\\s*\\*?\\s*@jsxFrag\\s+([^\\s]+)\\s*$/m;\n\nconst get = (pass: PluginPass, name: string) =>\n pass.get(`@babel/plugin-react-jsx/${name}`);\nconst set = (pass: PluginPass, name: string, v: any) =>\n pass.set(`@babel/plugin-react-jsx/${name}`, v);\n\nfunction hasProto(node: t.ObjectExpression) {\n return node.properties.some(\n value =>\n t.isObjectProperty(value, { computed: false, shorthand: false }) &&\n (t.isIdentifier(value.key, { name: \"__proto__\" }) ||\n t.isStringLiteral(value.key, { value: \"__proto__\" })),\n );\n}\n\nexport interface Options {\n filter?: (node: t.Node, pass: PluginPass) => boolean;\n importSource?: string;\n pragma?: string;\n pragmaFrag?: string;\n pure?: string;\n runtime?: \"automatic\" | \"classic\";\n throwIfNamespace?: boolean;\n useBuiltIns: boolean;\n useSpread?: boolean;\n}\nexport default function createPlugin({\n name,\n development,\n}: {\n name: string;\n development: boolean;\n}) {\n return declare((_, options: Options) => {\n const {\n pure: PURE_ANNOTATION,\n\n throwIfNamespace = true,\n\n filter,\n\n runtime: RUNTIME_DEFAULT = process.env.BABEL_8_BREAKING\n ? \"automatic\"\n : development\n ? \"automatic\"\n : \"classic\",\n\n importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource,\n pragma: PRAGMA_DEFAULT = DEFAULT.pragma,\n pragmaFrag: PRAGMA_FRAG_DEFAULT = DEFAULT.pragmaFrag,\n } = options;\n\n if (process.env.BABEL_8_BREAKING) {\n if (\"useSpread\" in options) {\n throw new Error(\n '@babel/plugin-transform-react-jsx: Since Babel 8, an inline object with spread elements is always used, and the \"useSpread\" option is no longer available. Please remove it from your config.',\n );\n }\n\n if (\"useBuiltIns\" in options) {\n const useBuiltInsFormatted = JSON.stringify(options.useBuiltIns);\n throw new Error(\n `@babel/plugin-transform-react-jsx: Since \"useBuiltIns\" is removed in Babel 8, you can remove it from the config.\n- Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with\n\\`useBuiltIns: ${useBuiltInsFormatted}\\`, you can use the following config\n{\n \"plugins\": [\n \"@babel/plugin-transform-react-jsx\"\n [\"@babel/plugin-transform-object-rest-spread\", { \"loose\": true, \"useBuiltIns\": ${useBuiltInsFormatted} }]\n ]\n}`,\n );\n }\n\n if (filter != null && RUNTIME_DEFAULT === \"automatic\") {\n throw new Error(\n '@babel/plugin-transform-react-jsx: \"filter\" option can not be used with automatic runtime. If you are upgrading from Babel 7, please specify `runtime: \"classic\"`.',\n );\n }\n } else {\n // eslint-disable-next-line no-var\n var { useSpread = false, useBuiltIns = false } = options;\n\n if (RUNTIME_DEFAULT === \"classic\") {\n if (typeof useSpread !== \"boolean\") {\n throw new Error(\n \"transform-react-jsx currently only accepts a boolean option for \" +\n \"useSpread (defaults to false)\",\n );\n }\n\n if (typeof useBuiltIns !== \"boolean\") {\n throw new Error(\n \"transform-react-jsx currently only accepts a boolean option for \" +\n \"useBuiltIns (defaults to false)\",\n );\n }\n\n if (useSpread && useBuiltIns) {\n throw new Error(\n \"transform-react-jsx currently only accepts useBuiltIns or useSpread \" +\n \"but not both\",\n );\n }\n }\n }\n\n const injectMetaPropertiesVisitor: Visitor = {\n JSXOpeningElement(path, state) {\n const attributes = [];\n if (isThisAllowed(path.scope)) {\n attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier(\"__self\"),\n t.jsxExpressionContainer(t.thisExpression()),\n ),\n );\n }\n attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier(\"__source\"),\n t.jsxExpressionContainer(makeSource(path, state)),\n ),\n );\n path.pushContainer(\"attributes\", attributes);\n },\n };\n\n return {\n name,\n inherits: jsx,\n visitor: {\n JSXNamespacedName(path) {\n if (throwIfNamespace) {\n throw path.buildCodeFrameError(\n `Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \\\nYou can set \\`throwIfNamespace: false\\` to bypass this warning.`,\n );\n }\n },\n\n JSXSpreadChild(path) {\n throw path.buildCodeFrameError(\n \"Spread children are not supported in React.\",\n );\n },\n\n Program: {\n enter(path, state) {\n const { file } = state;\n let runtime: string = RUNTIME_DEFAULT;\n\n let source: string = IMPORT_SOURCE_DEFAULT;\n let pragma: string = PRAGMA_DEFAULT;\n let pragmaFrag: string = PRAGMA_FRAG_DEFAULT;\n\n let sourceSet = !!options.importSource;\n let pragmaSet = !!options.pragma;\n let pragmaFragSet = !!options.pragmaFrag;\n\n if (file.ast.comments) {\n for (const comment of file.ast.comments) {\n const sourceMatches = JSX_SOURCE_ANNOTATION_REGEX.exec(\n comment.value,\n );\n if (sourceMatches) {\n source = sourceMatches[1];\n sourceSet = true;\n }\n\n const runtimeMatches = JSX_RUNTIME_ANNOTATION_REGEX.exec(\n comment.value,\n );\n if (runtimeMatches) {\n runtime = runtimeMatches[1];\n }\n\n const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value);\n if (jsxMatches) {\n pragma = jsxMatches[1];\n pragmaSet = true;\n }\n const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(\n comment.value,\n );\n if (jsxFragMatches) {\n pragmaFrag = jsxFragMatches[1];\n pragmaFragSet = true;\n }\n }\n }\n\n set(state, \"runtime\", runtime);\n if (runtime === \"classic\") {\n if (sourceSet) {\n throw path.buildCodeFrameError(\n `importSource cannot be set when runtime is classic.`,\n );\n }\n\n const createElement = toMemberExpression(pragma);\n const fragment = toMemberExpression(pragmaFrag);\n\n set(state, \"id/createElement\", () => t.cloneNode(createElement));\n set(state, \"id/fragment\", () => t.cloneNode(fragment));\n\n set(state, \"defaultPure\", pragma === DEFAULT.pragma);\n } else if (runtime === \"automatic\") {\n if (pragmaSet || pragmaFragSet) {\n throw path.buildCodeFrameError(\n `pragma and pragmaFrag cannot be set when runtime is automatic.`,\n );\n }\n\n const define = (name: string, id: string) =>\n set(state, name, createImportLazily(state, path, id, source));\n\n define(\"id/jsx\", development ? \"jsxDEV\" : \"jsx\");\n define(\"id/jsxs\", development ? \"jsxDEV\" : \"jsxs\");\n define(\"id/createElement\", \"createElement\");\n define(\"id/fragment\", \"Fragment\");\n\n set(state, \"defaultPure\", source === DEFAULT.importSource);\n } else {\n throw path.buildCodeFrameError(\n `Runtime must be either \"classic\" or \"automatic\".`,\n );\n }\n\n if (development) {\n path.traverse(injectMetaPropertiesVisitor, state);\n }\n },\n\n // TODO(Babel 8): Decide if this should be removed or brought back.\n // see: https://github.com/babel/babel/pull/12253#discussion_r513086528\n //\n // exit(path, state) {\n // if (\n // get(state, \"runtime\") === \"classic\" &&\n // get(state, \"pragmaSet\") &&\n // get(state, \"usedFragment\") &&\n // !get(state, \"pragmaFragSet\")\n // ) {\n // throw new Error(\n // \"transform-react-jsx: pragma has been set but \" +\n // \"pragmaFrag has not been set\",\n // );\n // }\n // },\n },\n\n JSXFragment: {\n exit(path, file) {\n let callExpr;\n if (get(file, \"runtime\") === \"classic\") {\n callExpr = buildCreateElementFragmentCall(path, file);\n } else {\n callExpr = buildJSXFragmentCall(path, file);\n }\n\n path.replaceWith(t.inherits(callExpr, path.node));\n },\n },\n\n JSXElement: {\n exit(path, file) {\n let callExpr;\n if (\n get(file, \"runtime\") === \"classic\" ||\n shouldUseCreateElement(path)\n ) {\n callExpr = buildCreateElementCall(path, file);\n } else {\n callExpr = buildJSXElementCall(path, file);\n }\n\n path.replaceWith(t.inherits(callExpr, path.node));\n },\n },\n\n JSXAttribute(path) {\n if (t.isJSXElement(path.node.value)) {\n path.node.value = t.jsxExpressionContainer(path.node.value);\n }\n },\n },\n };\n\n // Returns whether the class has specified a superclass.\n function isDerivedClass(classPath: NodePath) {\n return classPath.node.superClass !== null;\n }\n\n // Returns whether `this` is allowed at given scope.\n function isThisAllowed(scope: Scope) {\n // This specifically skips arrow functions as they do not rewrite `this`.\n do {\n const { path } = scope;\n if (path.isFunctionParent() && !path.isArrowFunctionExpression()) {\n if (!path.isMethod()) {\n // If the closest parent is a regular function, `this` will be rebound, therefore it is fine to use `this`.\n return true;\n }\n // Current node is within a method, so we need to check if the method is a constructor.\n if (path.node.kind !== \"constructor\") {\n // We are not in a constructor, therefore it is always fine to use `this`.\n return true;\n }\n // Now we are in a constructor. If it is a derived class, we do not reference `this`.\n return !isDerivedClass(path.parentPath.parentPath as NodePath);\n }\n if (path.isTSModuleBlock()) {\n // If the closest parent is a TS Module block, `this` will not be allowed.\n return false;\n }\n } while ((scope = scope.parent));\n // We are not in a method or function. It is fine to use `this`.\n return true;\n }\n\n function call(\n pass: PluginPass,\n name: string,\n args: CallExpression[\"arguments\"],\n ) {\n const node = t.callExpression(get(pass, `id/${name}`)(), args);\n if (PURE_ANNOTATION ?? get(pass, \"defaultPure\")) annotateAsPure(node);\n return node;\n }\n\n // We want to use React.createElement, even in the case of\n // jsx, for
to distinguish it\n // from
. This is an intermediary\n // step while we deprecate key spread from props. Afterwards,\n // we will stop using createElement in the transform.\n function shouldUseCreateElement(path: NodePath) {\n const openingPath = path.get(\"openingElement\");\n const attributes = openingPath.node.attributes;\n\n let seenPropsSpread = false;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes[i];\n if (\n seenPropsSpread &&\n t.isJSXAttribute(attr) &&\n attr.name.name === \"key\"\n ) {\n return true;\n } else if (t.isJSXSpreadAttribute(attr)) {\n seenPropsSpread = true;\n }\n }\n return false;\n }\n\n function convertJSXIdentifier(\n node: t.JSXIdentifier | t.JSXMemberExpression | t.JSXNamespacedName,\n parent: t.JSXOpeningElement | t.JSXMemberExpression,\n ): t.ThisExpression | t.StringLiteral | t.MemberExpression | t.Identifier {\n if (t.isJSXIdentifier(node)) {\n if (node.name === \"this\" && t.isReferenced(node, parent)) {\n return t.thisExpression();\n } else if (t.isValidIdentifier(node.name, false)) {\n // @ts-expect-error cast AST type to Identifier\n node.type = \"Identifier\";\n return node as unknown as t.Identifier;\n } else {\n return t.stringLiteral(node.name);\n }\n } else if (t.isJSXMemberExpression(node)) {\n return t.memberExpression(\n convertJSXIdentifier(node.object, node),\n convertJSXIdentifier(node.property, node),\n );\n } else if (t.isJSXNamespacedName(node)) {\n /**\n * If the flag \"throwIfNamespace\" is false\n * print XMLNamespace like string literal\n */\n return t.stringLiteral(`${node.namespace.name}:${node.name.name}`);\n }\n\n // todo: this branch should be unreachable\n return node;\n }\n\n function convertAttributeValue(\n node: t.JSXAttribute[\"value\"] | t.BooleanLiteral,\n ) {\n if (t.isJSXExpressionContainer(node)) {\n return node.expression;\n } else {\n return node;\n }\n }\n\n function accumulateAttribute(\n array: ObjectExpression[\"properties\"],\n attribute: NodePath,\n ) {\n if (t.isJSXSpreadAttribute(attribute.node)) {\n const arg = attribute.node.argument;\n // Collect properties into props array if spreading object expression\n if (t.isObjectExpression(arg) && !hasProto(arg)) {\n array.push(...arg.properties);\n } else {\n array.push(t.spreadElement(arg));\n }\n return array;\n }\n\n const value = convertAttributeValue(\n attribute.node.name.name !== \"key\"\n ? attribute.node.value || t.booleanLiteral(true)\n : attribute.node.value,\n );\n\n if (attribute.node.name.name === \"key\" && value === null) {\n throw attribute.buildCodeFrameError(\n 'Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed.',\n );\n }\n\n if (\n t.isStringLiteral(value) &&\n !t.isJSXExpressionContainer(attribute.node.value)\n ) {\n value.value = value.value.replace(/\\n\\s+/g, \" \");\n\n // \"raw\" JSXText should not be used from a StringLiteral because it needs to be escaped.\n delete value.extra?.raw;\n }\n\n if (t.isJSXNamespacedName(attribute.node.name)) {\n // @ts-expect-error mutating AST\n attribute.node.name = t.stringLiteral(\n attribute.node.name.namespace.name +\n \":\" +\n attribute.node.name.name.name,\n );\n } else if (t.isValidIdentifier(attribute.node.name.name, false)) {\n // @ts-expect-error mutating AST\n attribute.node.name.type = \"Identifier\";\n } else {\n // @ts-expect-error mutating AST\n attribute.node.name = t.stringLiteral(attribute.node.name.name);\n }\n\n array.push(\n t.inherits(\n t.objectProperty(\n // @ts-expect-error The attribute.node.name is an Identifier now\n attribute.node.name,\n value,\n ),\n attribute.node,\n ),\n );\n return array;\n }\n\n function buildChildrenProperty(children: Expression[]) {\n let childrenNode;\n if (children.length === 1) {\n childrenNode = children[0];\n } else if (children.length > 1) {\n childrenNode = t.arrayExpression(children);\n } else {\n return undefined;\n }\n\n return t.objectProperty(t.identifier(\"children\"), childrenNode);\n }\n\n // Builds JSX into:\n // Production: React.jsx(type, arguments, key)\n // Development: React.jsxDEV(type, arguments, key, isStaticChildren, source, self)\n function buildJSXElementCall(path: NodePath, file: PluginPass) {\n const openingPath = path.get(\"openingElement\");\n const args: t.Expression[] = [getTag(openingPath)];\n\n const attribsArray = [];\n const extracted = Object.create(null);\n\n // for React.jsx, key, __source (dev), and __self (dev) is passed in as\n // a separate argument rather than in the args object. We go through the\n // props and filter out these three keywords so we can pass them in\n // as separate arguments later\n for (const attr of openingPath.get(\"attributes\")) {\n if (attr.isJSXAttribute() && t.isJSXIdentifier(attr.node.name)) {\n const { name } = attr.node.name;\n switch (name) {\n case \"__source\":\n case \"__self\":\n if (extracted[name]) throw sourceSelfError(path, name);\n /* falls through */\n case \"key\": {\n const keyValue = convertAttributeValue(attr.node.value);\n if (keyValue === null) {\n throw attr.buildCodeFrameError(\n 'Please provide an explicit key value. Using \"key\" as a shorthand for \"key={true}\" is not allowed.',\n );\n }\n\n extracted[name] = keyValue;\n break;\n }\n default:\n attribsArray.push(attr);\n }\n } else {\n attribsArray.push(attr);\n }\n }\n\n const children = t.react.buildChildren(path.node);\n\n let attribs: t.ObjectExpression;\n\n if (attribsArray.length || children.length) {\n attribs = buildJSXOpeningElementAttributes(\n attribsArray,\n //@ts-expect-error The children here contains JSXSpreadChild,\n // which will be thrown later\n children,\n );\n } else {\n // attributes should never be null\n attribs = t.objectExpression([]);\n }\n\n args.push(attribs);\n\n if (development) {\n // isStaticChildren, __source, and __self are only used in development\n // automatically include __source and __self in this plugin\n // so we can eliminate the need for separate Babel plugins in Babel 8\n args.push(\n extracted.key ?? path.scope.buildUndefinedNode(),\n t.booleanLiteral(children.length > 1),\n );\n if (extracted.__source) {\n args.push(extracted.__source);\n if (extracted.__self) args.push(extracted.__self);\n } else if (extracted.__self) {\n args.push(path.scope.buildUndefinedNode(), extracted.__self);\n }\n } else if (extracted.key !== undefined) {\n args.push(extracted.key);\n }\n\n return call(file, children.length > 1 ? \"jsxs\" : \"jsx\", args);\n }\n\n // Builds props for React.jsx. This function adds children into the props\n // and ensures that props is always an object\n function buildJSXOpeningElementAttributes(\n attribs: NodePath[],\n children: Expression[],\n ) {\n const props = attribs.reduce(accumulateAttribute, []);\n\n // In React.jsx, children is no longer a separate argument, but passed in\n // through the argument object\n if (children?.length > 0) {\n props.push(buildChildrenProperty(children));\n }\n\n return t.objectExpression(props);\n }\n\n // Builds JSX Fragment <> into\n // Production: React.jsx(type, arguments)\n // Development: React.jsxDEV(type, { children })\n function buildJSXFragmentCall(\n path: NodePath,\n file: PluginPass,\n ) {\n const args = [get(file, \"id/fragment\")()];\n\n const children = t.react.buildChildren(path.node);\n\n args.push(\n t.objectExpression(\n children.length > 0\n ? [\n buildChildrenProperty(\n //@ts-expect-error The children here contains JSXSpreadChild,\n // which will be thrown later\n children,\n ),\n ]\n : [],\n ),\n );\n\n if (development) {\n args.push(\n path.scope.buildUndefinedNode(),\n t.booleanLiteral(children.length > 1),\n );\n }\n\n return call(file, children.length > 1 ? \"jsxs\" : \"jsx\", args);\n }\n\n // Builds JSX Fragment <> into\n // React.createElement(React.Fragment, null, ...children)\n function buildCreateElementFragmentCall(\n path: NodePath,\n file: PluginPass,\n ) {\n if (filter && !filter(path.node, file)) return;\n\n return call(file, \"createElement\", [\n get(file, \"id/fragment\")(),\n t.nullLiteral(),\n ...t.react.buildChildren(path.node),\n ]);\n }\n\n // Builds JSX into:\n // Production: React.createElement(type, arguments, children)\n // Development: React.createElement(type, arguments, children, source, self)\n function buildCreateElementCall(\n path: NodePath,\n file: PluginPass,\n ) {\n const openingPath = path.get(\"openingElement\");\n\n return call(file, \"createElement\", [\n getTag(openingPath),\n buildCreateElementOpeningElementAttributes(\n file,\n path,\n openingPath.get(\"attributes\"),\n ),\n // @ts-expect-error JSXSpreadChild has been transformed in convertAttributeValue\n ...t.react.buildChildren(path.node),\n ]);\n }\n\n function getTag(openingPath: NodePath) {\n const tagExpr = convertJSXIdentifier(\n openingPath.node.name,\n openingPath.node,\n );\n\n let tagName: string;\n if (t.isIdentifier(tagExpr)) {\n tagName = tagExpr.name;\n } else if (t.isStringLiteral(tagExpr)) {\n tagName = tagExpr.value;\n }\n\n if (t.react.isCompatTag(tagName)) {\n return t.stringLiteral(tagName);\n } else {\n return tagExpr;\n }\n }\n\n /**\n * The logic for this is quite terse. It's because we need to\n * support spread elements. We loop over all attributes,\n * breaking on spreads, we then push a new object containing\n * all prior attributes to an array for later processing.\n */\n function buildCreateElementOpeningElementAttributes(\n file: PluginPass,\n path: NodePath,\n attribs: NodePath[],\n ) {\n const runtime = get(file, \"runtime\");\n if (!process.env.BABEL_8_BREAKING) {\n if (runtime !== \"automatic\") {\n const objs = [];\n const props = attribs.reduce(accumulateAttribute, []);\n\n if (!useSpread) {\n // Convert syntax to use multiple objects instead of spread\n let start = 0;\n props.forEach((prop, i) => {\n if (t.isSpreadElement(prop)) {\n if (i > start) {\n objs.push(t.objectExpression(props.slice(start, i)));\n }\n objs.push(prop.argument);\n start = i + 1;\n }\n });\n if (props.length > start) {\n objs.push(t.objectExpression(props.slice(start)));\n }\n } else if (props.length) {\n objs.push(t.objectExpression(props));\n }\n\n if (!objs.length) {\n return t.nullLiteral();\n }\n\n if (objs.length === 1) {\n if (\n !(\n t.isSpreadElement(props[0]) &&\n // If an object expression is spread element's argument\n // it is very likely to contain __proto__ and we should stop\n // optimizing spread element\n t.isObjectExpression(props[0].argument)\n )\n ) {\n return objs[0];\n }\n }\n\n // looks like we have multiple objects\n if (!t.isObjectExpression(objs[0])) {\n objs.unshift(t.objectExpression([]));\n }\n\n const helper = useBuiltIns\n ? t.memberExpression(t.identifier(\"Object\"), t.identifier(\"assign\"))\n : file.addHelper(\"extends\");\n\n // spread it\n return t.callExpression(helper, objs);\n }\n }\n\n const props: ObjectExpression[\"properties\"] = [];\n const found = Object.create(null);\n\n for (const attr of attribs) {\n const { node } = attr;\n const name =\n t.isJSXAttribute(node) &&\n t.isJSXIdentifier(node.name) &&\n node.name.name;\n\n if (\n runtime === \"automatic\" &&\n (name === \"__source\" || name === \"__self\")\n ) {\n if (found[name]) throw sourceSelfError(path, name);\n found[name] = true;\n }\n\n accumulateAttribute(props, attr);\n }\n\n return props.length === 1 &&\n t.isSpreadElement(props[0]) &&\n // If an object expression is spread element's argument\n // it is very likely to contain __proto__ and we should stop\n // optimizing spread element\n !t.isObjectExpression(props[0].argument)\n ? props[0].argument\n : props.length > 0\n ? t.objectExpression(props)\n : t.nullLiteral();\n }\n });\n\n function getSource(source: string, importName: string) {\n switch (importName) {\n case \"Fragment\":\n return `${source}/${development ? \"jsx-dev-runtime\" : \"jsx-runtime\"}`;\n case \"jsxDEV\":\n return `${source}/jsx-dev-runtime`;\n case \"jsx\":\n case \"jsxs\":\n return `${source}/jsx-runtime`;\n case \"createElement\":\n return source;\n }\n }\n\n function createImportLazily(\n pass: PluginPass,\n path: NodePath,\n importName: string,\n source: string,\n ): () => Identifier | MemberExpression {\n return () => {\n const actualSource = getSource(source, importName);\n if (isModule(path)) {\n let reference = get(pass, `imports/${importName}`);\n if (reference) return t.cloneNode(reference);\n\n reference = addNamed(path, importName, actualSource, {\n importedInterop: \"uncompiled\",\n importPosition: \"after\",\n });\n set(pass, `imports/${importName}`, reference);\n\n return reference;\n } else {\n let reference = get(pass, `requires/${actualSource}`);\n if (reference) {\n reference = t.cloneNode(reference);\n } else {\n reference = addNamespace(path, actualSource, {\n importedInterop: \"uncompiled\",\n });\n set(pass, `requires/${actualSource}`, reference);\n }\n\n return t.memberExpression(reference, t.identifier(importName));\n }\n };\n }\n}\n\nfunction toMemberExpression(id: string): Identifier | MemberExpression {\n return (\n id\n .split(\".\")\n .map(name => t.identifier(name))\n // @ts-expect-error - The Array#reduce does not have a signature\n // where the type of initial value differs from callback return type\n .reduce((object, property) => t.memberExpression(object, property))\n );\n}\n\nfunction makeSource(path: NodePath, state: PluginPass) {\n const location = path.node.loc;\n if (!location) {\n // the element was generated and doesn't have location information\n return path.scope.buildUndefinedNode();\n }\n\n // @ts-expect-error todo: avoid mutating PluginPass\n if (!state.fileNameIdentifier) {\n const { filename = \"\" } = state;\n\n const fileNameIdentifier = path.scope.generateUidIdentifier(\"_jsxFileName\");\n path.scope.getProgramParent().push({\n id: fileNameIdentifier,\n init: t.stringLiteral(filename),\n });\n // @ts-expect-error todo: avoid mutating PluginPass\n state.fileNameIdentifier = fileNameIdentifier;\n }\n\n return makeTrace(\n t.cloneNode(\n // @ts-expect-error todo: avoid mutating PluginPass\n state.fileNameIdentifier,\n ),\n location.start.line,\n location.start.column,\n );\n}\n\nfunction makeTrace(\n fileNameIdentifier: Identifier,\n lineNumber?: number,\n column0Based?: number,\n) {\n const fileLineLiteral =\n lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral();\n\n const fileColumnLiteral =\n column0Based != null ? t.numericLiteral(column0Based + 1) : t.nullLiteral();\n\n return template.expression.ast`{\n fileName: ${fileNameIdentifier},\n lineNumber: ${fileLineLiteral},\n columnNumber: ${fileColumnLiteral},\n }`;\n}\n\nfunction sourceSelfError(path: NodePath, name: string) {\n const pluginName = `transform-react-jsx-${name.slice(2)}`;\n\n return path.buildCodeFrameError(\n `Duplicate ${name} prop found. You are most likely using the deprecated ${pluginName} Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.`,\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AAgBA,MAAMK,OAAO,GAAG;EACdC,YAAY,EAAE,OAAO;EACrBC,OAAO,EAAE,WAAW;EACpBC,MAAM,EAAE,qBAAqB;EAC7BC,UAAU,EAAE;AACd,CAAC;AAED,MAAMC,2BAA2B,GAC/B,4CAA4C;AAC9C,MAAMC,4BAA4B,GAAG,uCAAuC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