@babel/plugin-transform-react-jsx
Advanced tools
| import jsx from '@babel/plugin-syntax-jsx'; | ||
| import { declare } from '@babel/helper-plugin-utils'; | ||
| import { types, template } from '@babel/core'; | ||
| import { isModule, addNamed, addNamespace } from '@babel/helper-module-imports'; | ||
| import annotateAsPure from '@babel/helper-annotate-as-pure'; | ||
| const DEFAULT = { | ||
| importSource: "react", | ||
| runtime: "automatic", | ||
| pragma: "React.createElement", | ||
| pragmaFrag: "React.Fragment" | ||
| }; | ||
| const JSX_SOURCE_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxImportSource\s+(\S+)\s*$/m; | ||
| const JSX_RUNTIME_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxRuntime\s+(\S+)\s*$/m; | ||
| const JSX_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsx\s+(\S+)\s*$/m; | ||
| const JSX_FRAG_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxFrag\s+(\S+)\s*$/m; | ||
| const get = (pass, name) => pass.get(`@babel/plugin-react-jsx/${name}`); | ||
| const set = (pass, name, v) => pass.set(`@babel/plugin-react-jsx/${name}`, v); | ||
| function hasProto(node) { | ||
| return node.properties.some(value => types.isObjectProperty(value, { | ||
| computed: false, | ||
| shorthand: false | ||
| }) && (types.isIdentifier(value.key, { | ||
| name: "__proto__" | ||
| }) || types.isStringLiteral(value.key, { | ||
| value: "__proto__" | ||
| }))); | ||
| } | ||
| function createPlugin({ | ||
| name, | ||
| development | ||
| }) { | ||
| return declare((_, options) => { | ||
| const { | ||
| pure: PURE_ANNOTATION, | ||
| throwIfNamespace = true, | ||
| filter, | ||
| runtime: RUNTIME_DEFAULT = "automatic", | ||
| importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource, | ||
| pragma: PRAGMA_DEFAULT = DEFAULT.pragma, | ||
| pragmaFrag: PRAGMA_FRAG_DEFAULT = DEFAULT.pragmaFrag | ||
| } = options; | ||
| if ("useSpread" in options) { | ||
| throw new Error('@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.'); | ||
| } | ||
| if ("useBuiltIns" in options) { | ||
| const useBuiltInsFormatted = JSON.stringify(options.useBuiltIns); | ||
| throw new Error(`@babel/plugin-transform-react-jsx: Since "useBuiltIns" is removed in Babel 8, you can remove it from the config. | ||
| - Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with | ||
| \`useBuiltIns: ${useBuiltInsFormatted}\`, you can use the following config | ||
| { | ||
| "plugins": [ | ||
| "@babel/plugin-transform-react-jsx" | ||
| ["@babel/plugin-transform-object-rest-spread", { "loose": true, "useBuiltIns": ${useBuiltInsFormatted} }] | ||
| ] | ||
| }`); | ||
| } | ||
| if (filter != null && RUNTIME_DEFAULT === "automatic") { | ||
| throw new Error('@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"`.'); | ||
| } | ||
| let commentsNode = null; | ||
| return { | ||
| name, | ||
| inherits: jsx, | ||
| visitor: { | ||
| JSXNamespacedName(path) { | ||
| if (throwIfNamespace) { | ||
| throw path.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \ | ||
| You can set \`throwIfNamespace: false\` to bypass this warning.`); | ||
| } | ||
| }, | ||
| JSXSpreadChild(path) { | ||
| throw path.buildCodeFrameError("Spread children are not supported in React."); | ||
| }, | ||
| Program: { | ||
| enter(path, state) { | ||
| const { | ||
| file | ||
| } = state; | ||
| let runtime = RUNTIME_DEFAULT; | ||
| let source = IMPORT_SOURCE_DEFAULT; | ||
| let pragma = PRAGMA_DEFAULT; | ||
| let pragmaFrag = PRAGMA_FRAG_DEFAULT; | ||
| let sourceSet = !!options.importSource; | ||
| let pragmaSet = !!options.pragma; | ||
| let pragmaFragSet = !!options.pragmaFrag; | ||
| if (file.ast.comments) { | ||
| for (const comment of file.ast.comments) { | ||
| const sourceMatches = JSX_SOURCE_ANNOTATION_REGEX.exec(comment.value); | ||
| if (sourceMatches) { | ||
| source = sourceMatches[1]; | ||
| sourceSet = true; | ||
| } | ||
| const runtimeMatches = JSX_RUNTIME_ANNOTATION_REGEX.exec(comment.value); | ||
| if (runtimeMatches) { | ||
| runtime = runtimeMatches[1]; | ||
| } | ||
| const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value); | ||
| if (jsxMatches) { | ||
| pragma = jsxMatches[1]; | ||
| pragmaSet = true; | ||
| } | ||
| const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value); | ||
| if (jsxFragMatches) { | ||
| pragmaFrag = jsxFragMatches[1]; | ||
| pragmaFragSet = true; | ||
| } | ||
| } | ||
| } | ||
| set(state, "runtime", runtime); | ||
| if (runtime === "classic") { | ||
| if (sourceSet) { | ||
| throw path.buildCodeFrameError(`importSource cannot be set when runtime is classic.`); | ||
| } | ||
| const createElement = toMemberExpression(pragma); | ||
| const fragment = toMemberExpression(pragmaFrag); | ||
| set(state, "id/createElement", () => types.cloneNode(createElement)); | ||
| set(state, "id/fragment", () => types.cloneNode(fragment)); | ||
| set(state, "defaultPure", pragma === DEFAULT.pragma); | ||
| } else if (runtime === "automatic") { | ||
| if (pragmaSet || pragmaFragSet) { | ||
| throw path.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`); | ||
| } | ||
| const define = (name, id) => set(state, name, createImportLazily(state, path, id, source)); | ||
| define("id/jsx", development ? "jsxDEV" : "jsx"); | ||
| define("id/jsxs", development ? "jsxDEV" : "jsxs"); | ||
| define("id/createElement", "createElement"); | ||
| define("id/fragment", "Fragment"); | ||
| set(state, "defaultPure", source === DEFAULT.importSource); | ||
| } else { | ||
| throw path.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`); | ||
| } | ||
| if (development) { | ||
| function isDerivedClass(classNode) { | ||
| return classNode.superClass !== null; | ||
| } | ||
| function isThisAllowed(parents) { | ||
| let i = parents.length - 1; | ||
| do { | ||
| const { | ||
| node | ||
| } = parents[i]; | ||
| if (types.isFunctionParent(node) && !types.isArrowFunctionExpression(node)) { | ||
| if (!types.isMethod(node)) { | ||
| return true; | ||
| } | ||
| if (node.kind !== "constructor") { | ||
| return true; | ||
| } | ||
| return !isDerivedClass(parents[i - 2].node); | ||
| } | ||
| if (types.isTSModuleBlock(node)) { | ||
| return false; | ||
| } | ||
| } while (i-- > 0); | ||
| return true; | ||
| } | ||
| let fileNameIdentifier; | ||
| function makeSource(node) { | ||
| const location = node.loc; | ||
| if (!location) { | ||
| return path.scope.buildUndefinedNode(); | ||
| } | ||
| if (!fileNameIdentifier) { | ||
| fileNameIdentifier = path.scope.generateUidIdentifier("_jsxFileName"); | ||
| } | ||
| return makeTrace(types.cloneNode(fileNameIdentifier), location.start.line, location.start.column); | ||
| } | ||
| function makeTrace(fileNameIdentifier, lineNumber, column0Based) { | ||
| const fileLineLiteral = lineNumber != null ? types.numericLiteral(lineNumber) : types.nullLiteral(); | ||
| const fileColumnLiteral = column0Based != null ? types.numericLiteral(column0Based + 1) : types.nullLiteral(); | ||
| return template.expression.ast`{ | ||
| fileName: ${fileNameIdentifier}, | ||
| lineNumber: ${fileLineLiteral}, | ||
| columnNumber: ${fileColumnLiteral}, | ||
| }`; | ||
| } | ||
| types.traverse(path.node, { | ||
| enter(node, parents) { | ||
| if (!types.isJSXOpeningElement(node)) { | ||
| return; | ||
| } | ||
| const attributes = node.attributes; | ||
| if (isThisAllowed(parents)) { | ||
| attributes.push(types.jsxAttribute(types.jsxIdentifier("__self"), types.jsxExpressionContainer(types.thisExpression()))); | ||
| } | ||
| attributes.push(types.jsxAttribute(types.jsxIdentifier("__source"), types.jsxExpressionContainer(makeSource(node)))); | ||
| } | ||
| }); | ||
| if (fileNameIdentifier) { | ||
| const { | ||
| filename = "" | ||
| } = state; | ||
| path.scope.push({ | ||
| id: fileNameIdentifier, | ||
| init: types.stringLiteral(filename) | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| JSXFragment: { | ||
| exit(path, file) { | ||
| let callExpr; | ||
| if (get(file, "runtime") === "classic") { | ||
| callExpr = buildCreateElementFragmentCall(path, file); | ||
| } else { | ||
| callExpr = buildJSXFragmentCall(path, file); | ||
| } | ||
| path.replaceWith(types.inherits(callExpr, path.node)); | ||
| } | ||
| }, | ||
| JSXElement: { | ||
| exit(path, file) { | ||
| let callExpr; | ||
| if (get(file, "runtime") === "classic" || shouldUseCreateElement(path)) { | ||
| callExpr = buildCreateElementCall(path, file); | ||
| } else { | ||
| callExpr = buildJSXElementCall(path, file); | ||
| } | ||
| path.replaceWith(types.inherits(callExpr, path.node)); | ||
| } | ||
| }, | ||
| JSXAttribute(path) { | ||
| if (types.isJSXElement(path.node.value)) { | ||
| path.node.value = types.jsxExpressionContainer(path.node.value); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| function call(pass, name, args) { | ||
| const node = types.callExpression(get(pass, `id/${name}`)(), args); | ||
| if (PURE_ANNOTATION ?? get(pass, "defaultPure")) annotateAsPure(node); | ||
| return node; | ||
| } | ||
| function shouldUseCreateElement(path) { | ||
| const openingPath = path.get("openingElement"); | ||
| const attributes = openingPath.node.attributes; | ||
| let seenPropsSpread = false; | ||
| for (let i = 0; i < attributes.length; i++) { | ||
| const attr = attributes[i]; | ||
| if (seenPropsSpread && types.isJSXAttribute(attr) && attr.name.name === "key") { | ||
| return true; | ||
| } else if (types.isJSXSpreadAttribute(attr)) { | ||
| seenPropsSpread = true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| function convertJSXIdentifier(node, parent) { | ||
| if (types.isJSXIdentifier(node)) { | ||
| if (node.name === "this" && types.isReferenced(node, parent)) { | ||
| return types.thisExpression(); | ||
| } else if (types.isValidIdentifier(node.name, false)) { | ||
| node.type = "Identifier"; | ||
| return node; | ||
| } else { | ||
| return types.stringLiteral(node.name); | ||
| } | ||
| } else if (types.isJSXMemberExpression(node)) { | ||
| return types.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node)); | ||
| } else if (types.isJSXNamespacedName(node)) { | ||
| return types.stringLiteral(`${node.namespace.name}:${node.name.name}`); | ||
| } | ||
| return node; | ||
| } | ||
| function convertAttributeValue(node) { | ||
| if (types.isJSXExpressionContainer(node)) { | ||
| return node.expression; | ||
| } else { | ||
| return node; | ||
| } | ||
| } | ||
| function processComments(attribs) { | ||
| commentsNode = null; | ||
| if (attribs.length && attribs[0].isJSXSpreadAttribute()) { | ||
| const node = attribs[0].node.argument; | ||
| if (node.leadingComments || node.trailingComments) { | ||
| commentsNode = types.cloneNode(node); | ||
| } | ||
| } | ||
| } | ||
| function accumulateAttribute(array, attribute) { | ||
| if (types.isJSXSpreadAttribute(attribute.node)) { | ||
| const arg = attribute.node.argument; | ||
| if (types.isObjectExpression(arg) && !hasProto(arg)) { | ||
| array.push(...arg.properties); | ||
| } else { | ||
| array.push(types.spreadElement(arg)); | ||
| } | ||
| return array; | ||
| } | ||
| const value = convertAttributeValue(attribute.node.name.name !== "key" ? attribute.node.value || types.booleanLiteral(true) : attribute.node.value); | ||
| if (attribute.node.name.name === "key" && value === null) { | ||
| throw attribute.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.'); | ||
| } | ||
| if (types.isStringLiteral(value) && !types.isJSXExpressionContainer(attribute.node.value)) { | ||
| value.value = value.value.replace(/\n\s+/g, " "); | ||
| delete value.extra?.raw; | ||
| } | ||
| if (types.isJSXNamespacedName(attribute.node.name)) { | ||
| attribute.node.name = types.stringLiteral(attribute.node.name.namespace.name + ":" + attribute.node.name.name.name); | ||
| } else if (types.isValidIdentifier(attribute.node.name.name, false)) { | ||
| attribute.node.name.type = "Identifier"; | ||
| } else { | ||
| attribute.node.name = types.stringLiteral(attribute.node.name.name); | ||
| } | ||
| array.push(types.inherits(types.objectProperty(attribute.node.name, value), attribute.node)); | ||
| return array; | ||
| } | ||
| function buildChildrenProperty(children) { | ||
| let childrenNode; | ||
| if (children.length === 1) { | ||
| childrenNode = children[0]; | ||
| } else if (children.length > 1) { | ||
| childrenNode = types.arrayExpression(children); | ||
| } else { | ||
| return undefined; | ||
| } | ||
| return types.objectProperty(types.identifier("children"), childrenNode); | ||
| } | ||
| function buildJSXElementCall(path, file) { | ||
| const openingPath = path.get("openingElement"); | ||
| const args = [getTag(openingPath)]; | ||
| const attribsArray = []; | ||
| const extracted = Object.create(null); | ||
| for (const attr of openingPath.get("attributes")) { | ||
| if (attr.isJSXAttribute() && types.isJSXIdentifier(attr.node.name)) { | ||
| const { | ||
| name | ||
| } = attr.node.name; | ||
| switch (name) { | ||
| case "__source": | ||
| case "__self": | ||
| if (extracted[name]) throw sourceSelfError(path, name); | ||
| case "key": | ||
| { | ||
| const keyValue = convertAttributeValue(attr.node.value); | ||
| if (keyValue === null) { | ||
| throw attr.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.'); | ||
| } | ||
| extracted[name] = keyValue; | ||
| break; | ||
| } | ||
| default: | ||
| attribsArray.push(attr); | ||
| } | ||
| } else { | ||
| attribsArray.push(attr); | ||
| } | ||
| } | ||
| const children = types.react.buildChildren(path.node); | ||
| let attribs; | ||
| if (attribsArray.length || children.length) { | ||
| attribs = buildJSXOpeningElementAttributes(attribsArray, children); | ||
| if (commentsNode) { | ||
| types.inheritsComments(attribs, commentsNode); | ||
| } | ||
| } else { | ||
| attribs = types.objectExpression([]); | ||
| } | ||
| args.push(attribs); | ||
| if (development) { | ||
| args.push(extracted.key ?? path.scope.buildUndefinedNode(), types.booleanLiteral(children.length > 1)); | ||
| if (extracted.__source) { | ||
| args.push(extracted.__source); | ||
| if (extracted.__self) args.push(extracted.__self); | ||
| } else if (extracted.__self) { | ||
| args.push(path.scope.buildUndefinedNode(), extracted.__self); | ||
| } | ||
| } else if (extracted.key !== undefined) { | ||
| args.push(extracted.key); | ||
| } | ||
| return call(file, children.length > 1 ? "jsxs" : "jsx", args); | ||
| } | ||
| function buildJSXOpeningElementAttributes(attribs, children) { | ||
| processComments(attribs); | ||
| const props = attribs.reduce(accumulateAttribute, []); | ||
| if (children?.length > 0) { | ||
| props.push(buildChildrenProperty(children)); | ||
| } | ||
| return types.objectExpression(props); | ||
| } | ||
| function buildJSXFragmentCall(path, file) { | ||
| const args = [get(file, "id/fragment")()]; | ||
| const children = types.react.buildChildren(path.node); | ||
| args.push(types.objectExpression(children.length > 0 ? [buildChildrenProperty(children)] : [])); | ||
| if (development) { | ||
| args.push(path.scope.buildUndefinedNode(), types.booleanLiteral(children.length > 1)); | ||
| } | ||
| return call(file, children.length > 1 ? "jsxs" : "jsx", args); | ||
| } | ||
| function buildCreateElementFragmentCall(path, file) { | ||
| if (filter && !filter(path.node, file)) return; | ||
| return call(file, "createElement", [get(file, "id/fragment")(), types.nullLiteral(), ...types.react.buildChildren(path.node)]); | ||
| } | ||
| function buildCreateElementCall(path, file) { | ||
| const openingPath = path.get("openingElement"); | ||
| return call(file, "createElement", [getTag(openingPath), buildCreateElementOpeningElementAttributes(file, path, openingPath.get("attributes")), ...types.react.buildChildren(path.node)]); | ||
| } | ||
| function getTag(openingPath) { | ||
| const tagExpr = convertJSXIdentifier(openingPath.node.name, openingPath.node); | ||
| let tagName; | ||
| if (types.isIdentifier(tagExpr)) { | ||
| tagName = tagExpr.name; | ||
| } else if (types.isStringLiteral(tagExpr)) { | ||
| tagName = tagExpr.value; | ||
| } | ||
| if (types.react.isCompatTag(tagName)) { | ||
| return types.stringLiteral(tagName); | ||
| } else { | ||
| return tagExpr; | ||
| } | ||
| } | ||
| function buildCreateElementOpeningElementAttributes(file, path, attribs) { | ||
| const runtime = get(file, "runtime"); | ||
| const props = []; | ||
| const found = Object.create(null); | ||
| processComments(attribs); | ||
| for (const attr of attribs) { | ||
| const { | ||
| node | ||
| } = attr; | ||
| const name = types.isJSXAttribute(node) && types.isJSXIdentifier(node.name) && node.name.name; | ||
| if (runtime === "automatic" && (name === "__source" || name === "__self")) { | ||
| if (found[name]) throw sourceSelfError(path, name); | ||
| found[name] = true; | ||
| } | ||
| accumulateAttribute(props, attr); | ||
| } | ||
| const ret = props.length === 1 && types.isSpreadElement(props[0]) && !types.isObjectExpression(props[0].argument) ? props[0].argument : props.length > 0 ? types.objectExpression(props) : types.nullLiteral(); | ||
| if (commentsNode) { | ||
| types.inheritsComments(ret, commentsNode); | ||
| } | ||
| return ret; | ||
| } | ||
| }); | ||
| function getSource(source, importName) { | ||
| switch (importName) { | ||
| case "Fragment": | ||
| return `${source}/${development ? "jsx-dev-runtime" : "jsx-runtime"}`; | ||
| case "jsxDEV": | ||
| return `${source}/jsx-dev-runtime`; | ||
| case "jsx": | ||
| case "jsxs": | ||
| return `${source}/jsx-runtime`; | ||
| case "createElement": | ||
| return source; | ||
| } | ||
| } | ||
| function createImportLazily(pass, path, importName, source) { | ||
| return () => { | ||
| const actualSource = getSource(source, importName); | ||
| if (isModule(path)) { | ||
| let reference = get(pass, `imports/${importName}`); | ||
| if (reference) return types.cloneNode(reference); | ||
| reference = addNamed(path, importName, actualSource, { | ||
| importedInterop: "uncompiled", | ||
| importPosition: "after" | ||
| }); | ||
| set(pass, `imports/${importName}`, reference); | ||
| return reference; | ||
| } else { | ||
| let reference = get(pass, `requires/${actualSource}`); | ||
| if (reference) { | ||
| reference = types.cloneNode(reference); | ||
| } else { | ||
| reference = addNamespace(path, actualSource, { | ||
| importedInterop: "uncompiled" | ||
| }); | ||
| set(pass, `requires/${actualSource}`, reference); | ||
| } | ||
| return types.memberExpression(reference, types.identifier(importName)); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| function toMemberExpression(id) { | ||
| return id.split(".").map(name => types.identifier(name)).reduce((object, property) => types.memberExpression(object, property)); | ||
| } | ||
| function sourceSelfError(path, name) { | ||
| const pluginName = `transform-react-jsx-${name.slice(2)}`; | ||
| return path.buildCodeFrameError(`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.`); | ||
| } | ||
| export { createPlugin as c }; | ||
| //# sourceMappingURL=create-plugin-BE8EwviF.js.map |
| {"version":3,"file":"create-plugin-BE8EwviF.js","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, NodePath } from \"@babel/core\";\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}\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 = \"automatic\",\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 (\"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\n let commentsNode: t.Node | null = null;\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 // Returns whether the class has specified a superclass.\n function isDerivedClass(classNode: Class) {\n return classNode.superClass !== null;\n }\n\n // Returns whether `this` is allowed at given scope.\n function isThisAllowed(parents: t.TraversalAncestors) {\n let i = parents.length - 1;\n\n // This specifically skips arrow functions as they do not rewrite `this`.\n do {\n const { node } = parents[i];\n if (\n t.isFunctionParent(node) &&\n !t.isArrowFunctionExpression(node)\n ) {\n if (!t.isMethod(node)) {\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 (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(parents[i - 2].node as Class);\n }\n if (t.isTSModuleBlock(node)) {\n // If the closest parent is a TS Module block, `this` will not be allowed.\n return false;\n }\n } while (i-- > 0);\n // We are not in a method or function. It is fine to use `this`.\n return true;\n }\n\n let fileNameIdentifier: Identifier;\n function makeSource(node: t.Node) {\n const location = node.loc;\n if (!location) {\n // the element was generated and doesn't have location information\n return path.scope.buildUndefinedNode();\n }\n\n if (!fileNameIdentifier) {\n fileNameIdentifier =\n path.scope.generateUidIdentifier(\"_jsxFileName\");\n }\n\n return makeTrace(\n t.cloneNode(fileNameIdentifier),\n location.start.line,\n location.start.column,\n );\n }\n\n function makeTrace(\n fileNameIdentifier: Identifier,\n lineNumber?: number,\n column0Based?: number,\n ) {\n const fileLineLiteral =\n lineNumber != null\n ? t.numericLiteral(lineNumber)\n : t.nullLiteral();\n\n const fileColumnLiteral =\n column0Based != null\n ? t.numericLiteral(column0Based + 1)\n : t.nullLiteral();\n\n return template.expression.ast`{\n fileName: ${fileNameIdentifier},\n lineNumber: ${fileLineLiteral},\n columnNumber: ${fileColumnLiteral},\n }`;\n }\n\n t.traverse(path.node, {\n enter(node, parents) {\n if (!t.isJSXOpeningElement(node)) {\n return;\n }\n const attributes = node.attributes;\n if (isThisAllowed(parents)) {\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(node)),\n ),\n );\n },\n });\n\n if (fileNameIdentifier) {\n const { filename = \"\" } = state;\n\n path.scope.push({\n id: fileNameIdentifier,\n init: t.stringLiteral(filename),\n });\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 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 <div {...props} key={key} /> to distinguish it\n // from <div key={key} {...props} />. 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<JSXElement>) {\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 processComments(\n attribs: NodePath<JSXAttribute | JSXSpreadAttribute>[],\n ) {\n commentsNode = null;\n if (attribs.length && attribs[0].isJSXSpreadAttribute()) {\n const node = attribs[0].node.argument;\n if (node.leadingComments || node.trailingComments) {\n commentsNode = t.cloneNode(node);\n }\n }\n }\n\n function accumulateAttribute(\n array: ObjectExpression[\"properties\"],\n attribute: NodePath<JSXAttribute | JSXSpreadAttribute>,\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<JSXElement>, 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 if (commentsNode) {\n t.inheritsComments(attribs, commentsNode);\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<JSXAttribute | JSXSpreadAttribute>[],\n children: Expression[],\n ) {\n processComments(attribs);\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<JSXFragment>,\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<JSXFragment>,\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<JSXElement>,\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<JSXOpeningElement>) {\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<JSXElement>,\n attribs: NodePath<JSXAttribute | JSXSpreadAttribute>[],\n ) {\n const runtime = get(file, \"runtime\");\n\n const props: ObjectExpression[\"properties\"] = [];\n const found = Object.create(null);\n\n processComments(attribs);\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 const ret =\n 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 if (commentsNode) {\n t.inheritsComments(ret, commentsNode);\n }\n return ret;\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<Program>,\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 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"],"names":["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","Error","useBuiltInsFormatted","JSON","stringify","useBuiltIns","commentsNode","inherits","jsx","visitor","JSXNamespacedName","path","buildCodeFrameError","JSXSpreadChild","Program","enter","state","file","source","sourceSet","pragmaSet","pragmaFragSet","ast","comments","comment","sourceMatches","exec","runtimeMatches","jsxMatches","jsxFragMatches","createElement","toMemberExpression","fragment","cloneNode","define","id","createImportLazily","isDerivedClass","classNode","superClass","isThisAllowed","parents","i","length","isFunctionParent","isArrowFunctionExpression","isMethod","kind","isTSModuleBlock","fileNameIdentifier","makeSource","location","loc","scope","buildUndefinedNode","generateUidIdentifier","makeTrace","start","line","column","lineNumber","column0Based","fileLineLiteral","numericLiteral","nullLiteral","fileColumnLiteral","template","expression","traverse","isJSXOpeningElement","attributes","push","jsxAttribute","jsxIdentifier","jsxExpressionContainer","thisExpression","filename","init","stringLiteral","JSXFragment","exit","callExpr","buildCreateElementFragmentCall","buildJSXFragmentCall","replaceWith","JSXElement","shouldUseCreateElement","buildCreateElementCall","buildJSXElementCall","JSXAttribute","isJSXElement","call","args","callExpression","annotateAsPure","openingPath","seenPropsSpread","attr","isJSXAttribute","isJSXSpreadAttribute","convertJSXIdentifier","parent","isJSXIdentifier","isReferenced","isValidIdentifier","type","isJSXMemberExpression","memberExpression","object","property","isJSXNamespacedName","namespace","convertAttributeValue","isJSXExpressionContainer","processComments","attribs","argument","leadingComments","trailingComments","accumulateAttribute","array","attribute","arg","isObjectExpression","spreadElement","booleanLiteral","replace","extra","raw","objectProperty","buildChildrenProperty","children","childrenNode","arrayExpression","undefined","identifier","getTag","attribsArray","extracted","Object","create","sourceSelfError","keyValue","react","buildChildren","buildJSXOpeningElementAttributes","inheritsComments","objectExpression","__source","__self","props","reduce","buildCreateElementOpeningElementAttributes","tagExpr","tagName","isCompatTag","found","ret","isSpreadElement","getSource","importName","actualSource","isModule","reference","addNamed","importedInterop","importPosition","addNamespace","split","map","pluginName","slice"],"mappings":";;;;;;AAqBA,MAAMA,OAAO,GAAG;AACdC,EAAAA,YAAY,EAAE,OAAO;AACrBC,EAAAA,OAAO,EAAE,WAAW;AACpBC,EAAAA,MAAM,EAAE,qBAAqB;AAC7BC,EAAAA,UAAU,EAAE,gBAAA;AACd,CAAC,CAAA;AAED,MAAMC,2BAA2B,GAC/B,6CAA6C,CAAA;AAC/C,MAAMC,4BAA4B,GAAG,wCAAwC,CAAA;AAE7E,MA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G,CAAC,CACVC,GAAG,CAACpM,IAAI,IAAIQ,KAAC,CAAC0J,UAAU,CAAClK,IAAI,CAAC,CAAC,CAG/BkL,MAAM,CAAC,CAAC3C,MAAM,EAAEC,QAAQ,KAAKhI,KAAC,CAAC8H,gBAAgB,CAACC,MAAM,EAAEC,QAAQ,CAAC,CAAC,CAAA;AAEzE,CAAA;AAEA,SAASgC,eAAeA,CAAClI,IAAc,EAAEtC,IAAY,EAAE;EACrD,MAAMqM,UAAU,GAAG,CAAuBrM,oBAAAA,EAAAA,IAAI,CAACsM,KAAK,CAAC,CAAC,CAAC,CAAE,CAAA,CAAA;EAEzD,OAAOhK,IAAI,CAACC,mBAAmB,CAC7B,aAAavC,IAAI,CAAA,sDAAA,EAAyDqM,UAAU,CAAA,6LAAA,CACtF,CAAC,CAAA;AACH;;;;"} |
@@ -1,3 +0,9 @@ | ||
| import createPlugin from "./create-plugin.js"; | ||
| export default createPlugin({ | ||
| import { c as createPlugin } from './create-plugin-BE8EwviF.js'; | ||
| import '@babel/plugin-syntax-jsx'; | ||
| import '@babel/helper-plugin-utils'; | ||
| import '@babel/core'; | ||
| import '@babel/helper-module-imports'; | ||
| import '@babel/helper-annotate-as-pure'; | ||
| var development = createPlugin({ | ||
| name: "transform-react-jsx/development", | ||
@@ -7,2 +13,3 @@ development: true | ||
| export { development as default }; | ||
| //# sourceMappingURL=development.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"names":["createPlugin","name","development"],"sources":["../src/development.ts"],"sourcesContent":["import createPlugin from \"./create-plugin.ts\";\n\nexport default createPlugin({\n name: \"transform-react-jsx/development\",\n development: true,\n});\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,oBAAoB;AAE7C,eAAeA,YAAY,CAAC;EAC1BC,IAAI,EAAE,iCAAiC;EACvCC,WAAW,EAAE;AACf,CAAC,CAAC","ignoreList":[]} | ||
| {"version":3,"file":"development.js","sources":["../src/development.ts"],"sourcesContent":["import createPlugin from \"./create-plugin.ts\";\n\nexport default createPlugin({\n name: \"transform-react-jsx/development\",\n development: true,\n});\n"],"names":["createPlugin","name","development"],"mappings":";;;;;;;AAEA,kBAAeA,YAAY,CAAC;AAC1BC,EAAAA,IAAI,EAAE,iCAAiC;AACvCC,EAAAA,WAAW,EAAE,IAAA;AACf,CAAC,CAAC;;;;"} |
+9
-2
@@ -1,3 +0,9 @@ | ||
| import createPlugin from "./create-plugin.js"; | ||
| export default createPlugin({ | ||
| import { c as createPlugin } from './create-plugin-BE8EwviF.js'; | ||
| import '@babel/plugin-syntax-jsx'; | ||
| import '@babel/helper-plugin-utils'; | ||
| import '@babel/core'; | ||
| import '@babel/helper-module-imports'; | ||
| import '@babel/helper-annotate-as-pure'; | ||
| var index = createPlugin({ | ||
| name: "transform-react-jsx", | ||
@@ -7,2 +13,3 @@ development: false | ||
| export { index as default }; | ||
| //# sourceMappingURL=index.js.map |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"names":["createPlugin","name","development"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport createPlugin from \"./create-plugin.ts\";\n\nexport default createPlugin({\n name: \"transform-react-jsx\",\n development: false,\n});\n\nexport type { Options } from \"./create-plugin.ts\";\n"],"mappings":"AAEA,OAAOA,YAAY,MAAM,oBAAoB;AAE7C,eAAeA,YAAY,CAAC;EAC1BC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EAAE;AACf,CAAC,CAAC","ignoreList":[]} | ||
| {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport createPlugin from \"./create-plugin.ts\";\n\nexport default createPlugin({\n name: \"transform-react-jsx\",\n development: false,\n});\n\nexport type { Options } from \"./create-plugin.ts\";\n"],"names":["createPlugin","name","development"],"mappings":";;;;;;;AAIA,YAAeA,YAAY,CAAC;AAC1BC,EAAAA,IAAI,EAAE,qBAAqB;AAC3BC,EAAAA,WAAW,EAAE,KAAA;AACf,CAAC,CAAC;;;;"} |
+9
-9
| { | ||
| "name": "@babel/plugin-transform-react-jsx", | ||
| "version": "8.0.0-beta.4", | ||
| "version": "8.0.0-rc.1", | ||
| "description": "Turn JSX into React function calls", | ||
@@ -20,7 +20,7 @@ "repository": { | ||
| "dependencies": { | ||
| "@babel/helper-annotate-as-pure": "^8.0.0-beta.4", | ||
| "@babel/helper-module-imports": "^8.0.0-beta.4", | ||
| "@babel/helper-plugin-utils": "^8.0.0-beta.4", | ||
| "@babel/plugin-syntax-jsx": "^8.0.0-beta.4", | ||
| "@babel/types": "^8.0.0-beta.4" | ||
| "@babel/helper-annotate-as-pure": "^8.0.0-rc.1", | ||
| "@babel/helper-module-imports": "^8.0.0-rc.1", | ||
| "@babel/helper-plugin-utils": "^8.0.0-rc.1", | ||
| "@babel/plugin-syntax-jsx": "^8.0.0-rc.1", | ||
| "@babel/types": "^8.0.0-rc.1" | ||
| }, | ||
@@ -31,5 +31,5 @@ "peerDependencies": { | ||
| "devDependencies": { | ||
| "@babel/core": "^8.0.0-beta.4", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-beta.4", | ||
| "@babel/traverse": "^8.0.0-beta.4" | ||
| "@babel/core": "^8.0.0-rc.1", | ||
| "@babel/helper-plugin-test-runner": "^8.0.0-rc.1", | ||
| "@babel/traverse": "^8.0.0-rc.1" | ||
| }, | ||
@@ -36,0 +36,0 @@ "engines": { |
| import jsx from "@babel/plugin-syntax-jsx"; | ||
| import { declare } from "@babel/helper-plugin-utils"; | ||
| import { template, types as t } from "@babel/core"; | ||
| import { addNamed, addNamespace, isModule } from "@babel/helper-module-imports"; | ||
| import annotateAsPure from "@babel/helper-annotate-as-pure"; | ||
| const DEFAULT = { | ||
| importSource: "react", | ||
| runtime: "automatic", | ||
| pragma: "React.createElement", | ||
| pragmaFrag: "React.Fragment" | ||
| }; | ||
| const JSX_SOURCE_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxImportSource\s+(\S+)\s*$/m; | ||
| const JSX_RUNTIME_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxRuntime\s+(\S+)\s*$/m; | ||
| const JSX_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsx\s+(\S+)\s*$/m; | ||
| const JSX_FRAG_ANNOTATION_REGEX = /^\s*(?:\*\s*)?@jsxFrag\s+(\S+)\s*$/m; | ||
| const get = (pass, name) => pass.get(`@babel/plugin-react-jsx/${name}`); | ||
| const set = (pass, name, v) => pass.set(`@babel/plugin-react-jsx/${name}`, v); | ||
| function hasProto(node) { | ||
| return node.properties.some(value => t.isObjectProperty(value, { | ||
| computed: false, | ||
| shorthand: false | ||
| }) && (t.isIdentifier(value.key, { | ||
| name: "__proto__" | ||
| }) || t.isStringLiteral(value.key, { | ||
| value: "__proto__" | ||
| }))); | ||
| } | ||
| export default function createPlugin({ | ||
| name, | ||
| development | ||
| }) { | ||
| return declare((_, options) => { | ||
| const { | ||
| pure: PURE_ANNOTATION, | ||
| throwIfNamespace = true, | ||
| filter, | ||
| runtime: RUNTIME_DEFAULT = "automatic", | ||
| importSource: IMPORT_SOURCE_DEFAULT = DEFAULT.importSource, | ||
| pragma: PRAGMA_DEFAULT = DEFAULT.pragma, | ||
| pragmaFrag: PRAGMA_FRAG_DEFAULT = DEFAULT.pragmaFrag | ||
| } = options; | ||
| if ("useSpread" in options) { | ||
| throw new Error('@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.'); | ||
| } | ||
| if ("useBuiltIns" in options) { | ||
| const useBuiltInsFormatted = JSON.stringify(options.useBuiltIns); | ||
| throw new Error(`@babel/plugin-transform-react-jsx: Since "useBuiltIns" is removed in Babel 8, you can remove it from the config. | ||
| - Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with | ||
| \`useBuiltIns: ${useBuiltInsFormatted}\`, you can use the following config | ||
| { | ||
| "plugins": [ | ||
| "@babel/plugin-transform-react-jsx" | ||
| ["@babel/plugin-transform-object-rest-spread", { "loose": true, "useBuiltIns": ${useBuiltInsFormatted} }] | ||
| ] | ||
| }`); | ||
| } | ||
| if (filter != null && RUNTIME_DEFAULT === "automatic") { | ||
| throw new Error('@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"`.'); | ||
| } | ||
| let commentsNode = null; | ||
| return { | ||
| name, | ||
| inherits: jsx, | ||
| visitor: { | ||
| JSXNamespacedName(path) { | ||
| if (throwIfNamespace) { | ||
| throw path.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \ | ||
| You can set \`throwIfNamespace: false\` to bypass this warning.`); | ||
| } | ||
| }, | ||
| JSXSpreadChild(path) { | ||
| throw path.buildCodeFrameError("Spread children are not supported in React."); | ||
| }, | ||
| Program: { | ||
| enter(path, state) { | ||
| const { | ||
| file | ||
| } = state; | ||
| let runtime = RUNTIME_DEFAULT; | ||
| let source = IMPORT_SOURCE_DEFAULT; | ||
| let pragma = PRAGMA_DEFAULT; | ||
| let pragmaFrag = PRAGMA_FRAG_DEFAULT; | ||
| let sourceSet = !!options.importSource; | ||
| let pragmaSet = !!options.pragma; | ||
| let pragmaFragSet = !!options.pragmaFrag; | ||
| if (file.ast.comments) { | ||
| for (const comment of file.ast.comments) { | ||
| const sourceMatches = JSX_SOURCE_ANNOTATION_REGEX.exec(comment.value); | ||
| if (sourceMatches) { | ||
| source = sourceMatches[1]; | ||
| sourceSet = true; | ||
| } | ||
| const runtimeMatches = JSX_RUNTIME_ANNOTATION_REGEX.exec(comment.value); | ||
| if (runtimeMatches) { | ||
| runtime = runtimeMatches[1]; | ||
| } | ||
| const jsxMatches = JSX_ANNOTATION_REGEX.exec(comment.value); | ||
| if (jsxMatches) { | ||
| pragma = jsxMatches[1]; | ||
| pragmaSet = true; | ||
| } | ||
| const jsxFragMatches = JSX_FRAG_ANNOTATION_REGEX.exec(comment.value); | ||
| if (jsxFragMatches) { | ||
| pragmaFrag = jsxFragMatches[1]; | ||
| pragmaFragSet = true; | ||
| } | ||
| } | ||
| } | ||
| set(state, "runtime", runtime); | ||
| if (runtime === "classic") { | ||
| if (sourceSet) { | ||
| throw path.buildCodeFrameError(`importSource cannot be set when runtime is classic.`); | ||
| } | ||
| const createElement = toMemberExpression(pragma); | ||
| const fragment = toMemberExpression(pragmaFrag); | ||
| set(state, "id/createElement", () => t.cloneNode(createElement)); | ||
| set(state, "id/fragment", () => t.cloneNode(fragment)); | ||
| set(state, "defaultPure", pragma === DEFAULT.pragma); | ||
| } else if (runtime === "automatic") { | ||
| if (pragmaSet || pragmaFragSet) { | ||
| throw path.buildCodeFrameError(`pragma and pragmaFrag cannot be set when runtime is automatic.`); | ||
| } | ||
| const define = (name, id) => set(state, name, createImportLazily(state, path, id, source)); | ||
| define("id/jsx", development ? "jsxDEV" : "jsx"); | ||
| define("id/jsxs", development ? "jsxDEV" : "jsxs"); | ||
| define("id/createElement", "createElement"); | ||
| define("id/fragment", "Fragment"); | ||
| set(state, "defaultPure", source === DEFAULT.importSource); | ||
| } else { | ||
| throw path.buildCodeFrameError(`Runtime must be either "classic" or "automatic".`); | ||
| } | ||
| if (development) { | ||
| function isDerivedClass(classNode) { | ||
| return classNode.superClass !== null; | ||
| } | ||
| function isThisAllowed(parents) { | ||
| let i = parents.length - 1; | ||
| do { | ||
| const { | ||
| node | ||
| } = parents[i]; | ||
| if (t.isFunctionParent(node) && !t.isArrowFunctionExpression(node)) { | ||
| if (!t.isMethod(node)) { | ||
| return true; | ||
| } | ||
| if (node.kind !== "constructor") { | ||
| return true; | ||
| } | ||
| return !isDerivedClass(parents[i - 2].node); | ||
| } | ||
| if (t.isTSModuleBlock(node)) { | ||
| return false; | ||
| } | ||
| } while (i-- > 0); | ||
| return true; | ||
| } | ||
| let fileNameIdentifier; | ||
| function makeSource(node) { | ||
| const location = node.loc; | ||
| if (!location) { | ||
| return path.scope.buildUndefinedNode(); | ||
| } | ||
| if (!fileNameIdentifier) { | ||
| fileNameIdentifier = path.scope.generateUidIdentifier("_jsxFileName"); | ||
| } | ||
| return makeTrace(t.cloneNode(fileNameIdentifier), location.start.line, location.start.column); | ||
| } | ||
| function makeTrace(fileNameIdentifier, lineNumber, column0Based) { | ||
| const fileLineLiteral = lineNumber != null ? t.numericLiteral(lineNumber) : t.nullLiteral(); | ||
| const fileColumnLiteral = column0Based != null ? t.numericLiteral(column0Based + 1) : t.nullLiteral(); | ||
| return template.expression.ast`{ | ||
| fileName: ${fileNameIdentifier}, | ||
| lineNumber: ${fileLineLiteral}, | ||
| columnNumber: ${fileColumnLiteral}, | ||
| }`; | ||
| } | ||
| t.traverse(path.node, { | ||
| enter(node, parents) { | ||
| if (!t.isJSXOpeningElement(node)) { | ||
| return; | ||
| } | ||
| const attributes = node.attributes; | ||
| if (isThisAllowed(parents)) { | ||
| attributes.push(t.jsxAttribute(t.jsxIdentifier("__self"), t.jsxExpressionContainer(t.thisExpression()))); | ||
| } | ||
| attributes.push(t.jsxAttribute(t.jsxIdentifier("__source"), t.jsxExpressionContainer(makeSource(node)))); | ||
| } | ||
| }); | ||
| if (fileNameIdentifier) { | ||
| const { | ||
| filename = "" | ||
| } = state; | ||
| path.scope.push({ | ||
| id: fileNameIdentifier, | ||
| init: t.stringLiteral(filename) | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| JSXFragment: { | ||
| exit(path, file) { | ||
| let callExpr; | ||
| if (get(file, "runtime") === "classic") { | ||
| callExpr = buildCreateElementFragmentCall(path, file); | ||
| } else { | ||
| callExpr = buildJSXFragmentCall(path, file); | ||
| } | ||
| path.replaceWith(t.inherits(callExpr, path.node)); | ||
| } | ||
| }, | ||
| JSXElement: { | ||
| exit(path, file) { | ||
| let callExpr; | ||
| if (get(file, "runtime") === "classic" || shouldUseCreateElement(path)) { | ||
| callExpr = buildCreateElementCall(path, file); | ||
| } else { | ||
| callExpr = buildJSXElementCall(path, file); | ||
| } | ||
| path.replaceWith(t.inherits(callExpr, path.node)); | ||
| } | ||
| }, | ||
| JSXAttribute(path) { | ||
| if (t.isJSXElement(path.node.value)) { | ||
| path.node.value = t.jsxExpressionContainer(path.node.value); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| function call(pass, name, args) { | ||
| const node = t.callExpression(get(pass, `id/${name}`)(), args); | ||
| if (PURE_ANNOTATION ?? get(pass, "defaultPure")) annotateAsPure(node); | ||
| return node; | ||
| } | ||
| function shouldUseCreateElement(path) { | ||
| const openingPath = path.get("openingElement"); | ||
| const attributes = openingPath.node.attributes; | ||
| let seenPropsSpread = false; | ||
| for (let i = 0; i < attributes.length; i++) { | ||
| const attr = attributes[i]; | ||
| if (seenPropsSpread && t.isJSXAttribute(attr) && attr.name.name === "key") { | ||
| return true; | ||
| } else if (t.isJSXSpreadAttribute(attr)) { | ||
| seenPropsSpread = true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| function convertJSXIdentifier(node, parent) { | ||
| if (t.isJSXIdentifier(node)) { | ||
| if (node.name === "this" && t.isReferenced(node, parent)) { | ||
| return t.thisExpression(); | ||
| } else if (t.isValidIdentifier(node.name, false)) { | ||
| node.type = "Identifier"; | ||
| return node; | ||
| } else { | ||
| return t.stringLiteral(node.name); | ||
| } | ||
| } else if (t.isJSXMemberExpression(node)) { | ||
| return t.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node)); | ||
| } else if (t.isJSXNamespacedName(node)) { | ||
| return t.stringLiteral(`${node.namespace.name}:${node.name.name}`); | ||
| } | ||
| return node; | ||
| } | ||
| function convertAttributeValue(node) { | ||
| if (t.isJSXExpressionContainer(node)) { | ||
| return node.expression; | ||
| } else { | ||
| return node; | ||
| } | ||
| } | ||
| function processComments(attribs) { | ||
| commentsNode = null; | ||
| if (attribs.length && attribs[0].isJSXSpreadAttribute()) { | ||
| const node = attribs[0].node.argument; | ||
| if (node.leadingComments || node.trailingComments) { | ||
| commentsNode = t.cloneNode(node); | ||
| } | ||
| } | ||
| } | ||
| function accumulateAttribute(array, attribute) { | ||
| if (t.isJSXSpreadAttribute(attribute.node)) { | ||
| const arg = attribute.node.argument; | ||
| if (t.isObjectExpression(arg) && !hasProto(arg)) { | ||
| array.push(...arg.properties); | ||
| } else { | ||
| array.push(t.spreadElement(arg)); | ||
| } | ||
| return array; | ||
| } | ||
| const value = convertAttributeValue(attribute.node.name.name !== "key" ? attribute.node.value || t.booleanLiteral(true) : attribute.node.value); | ||
| if (attribute.node.name.name === "key" && value === null) { | ||
| throw attribute.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.'); | ||
| } | ||
| if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(attribute.node.value)) { | ||
| value.value = value.value.replace(/\n\s+/g, " "); | ||
| delete value.extra?.raw; | ||
| } | ||
| if (t.isJSXNamespacedName(attribute.node.name)) { | ||
| attribute.node.name = t.stringLiteral(attribute.node.name.namespace.name + ":" + attribute.node.name.name.name); | ||
| } else if (t.isValidIdentifier(attribute.node.name.name, false)) { | ||
| attribute.node.name.type = "Identifier"; | ||
| } else { | ||
| attribute.node.name = t.stringLiteral(attribute.node.name.name); | ||
| } | ||
| array.push(t.inherits(t.objectProperty(attribute.node.name, value), attribute.node)); | ||
| return array; | ||
| } | ||
| function buildChildrenProperty(children) { | ||
| let childrenNode; | ||
| if (children.length === 1) { | ||
| childrenNode = children[0]; | ||
| } else if (children.length > 1) { | ||
| childrenNode = t.arrayExpression(children); | ||
| } else { | ||
| return undefined; | ||
| } | ||
| return t.objectProperty(t.identifier("children"), childrenNode); | ||
| } | ||
| function buildJSXElementCall(path, file) { | ||
| const openingPath = path.get("openingElement"); | ||
| const args = [getTag(openingPath)]; | ||
| const attribsArray = []; | ||
| const extracted = Object.create(null); | ||
| for (const attr of openingPath.get("attributes")) { | ||
| if (attr.isJSXAttribute() && t.isJSXIdentifier(attr.node.name)) { | ||
| const { | ||
| name | ||
| } = attr.node.name; | ||
| switch (name) { | ||
| case "__source": | ||
| case "__self": | ||
| if (extracted[name]) throw sourceSelfError(path, name); | ||
| case "key": | ||
| { | ||
| const keyValue = convertAttributeValue(attr.node.value); | ||
| if (keyValue === null) { | ||
| throw attr.buildCodeFrameError('Please provide an explicit key value. Using "key" as a shorthand for "key={true}" is not allowed.'); | ||
| } | ||
| extracted[name] = keyValue; | ||
| break; | ||
| } | ||
| default: | ||
| attribsArray.push(attr); | ||
| } | ||
| } else { | ||
| attribsArray.push(attr); | ||
| } | ||
| } | ||
| const children = t.react.buildChildren(path.node); | ||
| let attribs; | ||
| if (attribsArray.length || children.length) { | ||
| attribs = buildJSXOpeningElementAttributes(attribsArray, children); | ||
| if (commentsNode) { | ||
| t.inheritsComments(attribs, commentsNode); | ||
| } | ||
| } else { | ||
| attribs = t.objectExpression([]); | ||
| } | ||
| args.push(attribs); | ||
| if (development) { | ||
| args.push(extracted.key ?? path.scope.buildUndefinedNode(), t.booleanLiteral(children.length > 1)); | ||
| if (extracted.__source) { | ||
| args.push(extracted.__source); | ||
| if (extracted.__self) args.push(extracted.__self); | ||
| } else if (extracted.__self) { | ||
| args.push(path.scope.buildUndefinedNode(), extracted.__self); | ||
| } | ||
| } else if (extracted.key !== undefined) { | ||
| args.push(extracted.key); | ||
| } | ||
| return call(file, children.length > 1 ? "jsxs" : "jsx", args); | ||
| } | ||
| function buildJSXOpeningElementAttributes(attribs, children) { | ||
| processComments(attribs); | ||
| const props = attribs.reduce(accumulateAttribute, []); | ||
| if (children?.length > 0) { | ||
| props.push(buildChildrenProperty(children)); | ||
| } | ||
| return t.objectExpression(props); | ||
| } | ||
| function buildJSXFragmentCall(path, file) { | ||
| const args = [get(file, "id/fragment")()]; | ||
| const children = t.react.buildChildren(path.node); | ||
| args.push(t.objectExpression(children.length > 0 ? [buildChildrenProperty(children)] : [])); | ||
| if (development) { | ||
| args.push(path.scope.buildUndefinedNode(), t.booleanLiteral(children.length > 1)); | ||
| } | ||
| return call(file, children.length > 1 ? "jsxs" : "jsx", args); | ||
| } | ||
| function buildCreateElementFragmentCall(path, file) { | ||
| if (filter && !filter(path.node, file)) return; | ||
| return call(file, "createElement", [get(file, "id/fragment")(), t.nullLiteral(), ...t.react.buildChildren(path.node)]); | ||
| } | ||
| function buildCreateElementCall(path, file) { | ||
| const openingPath = path.get("openingElement"); | ||
| return call(file, "createElement", [getTag(openingPath), buildCreateElementOpeningElementAttributes(file, path, openingPath.get("attributes")), ...t.react.buildChildren(path.node)]); | ||
| } | ||
| function getTag(openingPath) { | ||
| const tagExpr = convertJSXIdentifier(openingPath.node.name, openingPath.node); | ||
| let tagName; | ||
| if (t.isIdentifier(tagExpr)) { | ||
| tagName = tagExpr.name; | ||
| } else if (t.isStringLiteral(tagExpr)) { | ||
| tagName = tagExpr.value; | ||
| } | ||
| if (t.react.isCompatTag(tagName)) { | ||
| return t.stringLiteral(tagName); | ||
| } else { | ||
| return tagExpr; | ||
| } | ||
| } | ||
| function buildCreateElementOpeningElementAttributes(file, path, attribs) { | ||
| const runtime = get(file, "runtime"); | ||
| const props = []; | ||
| const found = Object.create(null); | ||
| processComments(attribs); | ||
| for (const attr of attribs) { | ||
| const { | ||
| node | ||
| } = attr; | ||
| const name = t.isJSXAttribute(node) && t.isJSXIdentifier(node.name) && node.name.name; | ||
| if (runtime === "automatic" && (name === "__source" || name === "__self")) { | ||
| if (found[name]) throw sourceSelfError(path, name); | ||
| found[name] = true; | ||
| } | ||
| accumulateAttribute(props, attr); | ||
| } | ||
| const ret = props.length === 1 && t.isSpreadElement(props[0]) && !t.isObjectExpression(props[0].argument) ? props[0].argument : props.length > 0 ? t.objectExpression(props) : t.nullLiteral(); | ||
| if (commentsNode) { | ||
| t.inheritsComments(ret, commentsNode); | ||
| } | ||
| return ret; | ||
| } | ||
| }); | ||
| function getSource(source, importName) { | ||
| switch (importName) { | ||
| case "Fragment": | ||
| return `${source}/${development ? "jsx-dev-runtime" : "jsx-runtime"}`; | ||
| case "jsxDEV": | ||
| return `${source}/jsx-dev-runtime`; | ||
| case "jsx": | ||
| case "jsxs": | ||
| return `${source}/jsx-runtime`; | ||
| case "createElement": | ||
| return source; | ||
| } | ||
| } | ||
| function createImportLazily(pass, path, importName, source) { | ||
| return () => { | ||
| const actualSource = getSource(source, importName); | ||
| if (isModule(path)) { | ||
| let reference = get(pass, `imports/${importName}`); | ||
| if (reference) return t.cloneNode(reference); | ||
| reference = addNamed(path, importName, actualSource, { | ||
| importedInterop: "uncompiled", | ||
| importPosition: "after" | ||
| }); | ||
| set(pass, `imports/${importName}`, reference); | ||
| return reference; | ||
| } else { | ||
| let reference = get(pass, `requires/${actualSource}`); | ||
| if (reference) { | ||
| reference = t.cloneNode(reference); | ||
| } else { | ||
| reference = addNamespace(path, actualSource, { | ||
| importedInterop: "uncompiled" | ||
| }); | ||
| set(pass, `requires/${actualSource}`, reference); | ||
| } | ||
| return t.memberExpression(reference, t.identifier(importName)); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| function toMemberExpression(id) { | ||
| return id.split(".").map(name => t.identifier(name)).reduce((object, property) => t.memberExpression(object, property)); | ||
| } | ||
| function sourceSelfError(path, name) { | ||
| const pluginName = `transform-react-jsx-${name.slice(2)}`; | ||
| return path.buildCodeFrameError(`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.`); | ||
| } | ||
| //# sourceMappingURL=create-plugin.js.map |
| {"version":3,"names":["jsx","declare","template","types","t","addNamed","addNamespace","isModule","annotateAsPure","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","isObjectProperty","computed","shorthand","isIdentifier","key","isStringLiteral","createPlugin","development","_","options","pure","PURE_ANNOTATION","throwIfNamespace","filter","RUNTIME_DEFAULT","IMPORT_SOURCE_DEFAULT","PRAGMA_DEFAULT","PRAGMA_FRAG_DEFAULT","Error","useBuiltInsFormatted","JSON","stringify","useBuiltIns","commentsNode","inherits","visitor","JSXNamespacedName","path","buildCodeFrameError","JSXSpreadChild","Program","enter","state","file","source","sourceSet","pragmaSet","pragmaFragSet","ast","comments","comment","sourceMatches","exec","runtimeMatches","jsxMatches","jsxFragMatches","createElement","toMemberExpression","fragment","cloneNode","define","id","createImportLazily","isDerivedClass","classNode","superClass","isThisAllowed","parents","i","length","isFunctionParent","isArrowFunctionExpression","isMethod","kind","isTSModuleBlock","fileNameIdentifier","makeSource","location","loc","scope","buildUndefinedNode","generateUidIdentifier","makeTrace","start","line","column","lineNumber","column0Based","fileLineLiteral","numericLiteral","nullLiteral","fileColumnLiteral","expression","traverse","isJSXOpeningElement","attributes","push","jsxAttribute","jsxIdentifier","jsxExpressionContainer","thisExpression","filename","init","stringLiteral","JSXFragment","exit","callExpr","buildCreateElementFragmentCall","buildJSXFragmentCall","replaceWith","JSXElement","shouldUseCreateElement","buildCreateElementCall","buildJSXElementCall","JSXAttribute","isJSXElement","call","args","callExpression","openingPath","seenPropsSpread","attr","isJSXAttribute","isJSXSpreadAttribute","convertJSXIdentifier","parent","isJSXIdentifier","isReferenced","isValidIdentifier","type","isJSXMemberExpression","memberExpression","object","property","isJSXNamespacedName","namespace","convertAttributeValue","isJSXExpressionContainer","processComments","attribs","argument","leadingComments","trailingComments","accumulateAttribute","array","attribute","arg","isObjectExpression","spreadElement","booleanLiteral","replace","extra","raw","objectProperty","buildChildrenProperty","children","childrenNode","arrayExpression","undefined","identifier","getTag","attribsArray","extracted","Object","create","sourceSelfError","keyValue","react","buildChildren","buildJSXOpeningElementAttributes","inheritsComments","objectExpression","__source","__self","props","reduce","buildCreateElementOpeningElementAttributes","tagExpr","tagName","isCompatTag","found","ret","isSpreadElement","getSource","importName","actualSource","reference","importedInterop","importPosition","split","map","pluginName","slice"],"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, NodePath } from \"@babel/core\";\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}\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 = \"automatic\",\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 (\"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\n let commentsNode: t.Node | null = null;\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 // Returns whether the class has specified a superclass.\n function isDerivedClass(classNode: Class) {\n return classNode.superClass !== null;\n }\n\n // Returns whether `this` is allowed at given scope.\n function isThisAllowed(parents: t.TraversalAncestors) {\n let i = parents.length - 1;\n\n // This specifically skips arrow functions as they do not rewrite `this`.\n do {\n const { node } = parents[i];\n if (\n t.isFunctionParent(node) &&\n !t.isArrowFunctionExpression(node)\n ) {\n if (!t.isMethod(node)) {\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 (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(parents[i - 2].node as Class);\n }\n if (t.isTSModuleBlock(node)) {\n // If the closest parent is a TS Module block, `this` will not be allowed.\n return false;\n }\n } while (i-- > 0);\n // We are not in a method or function. It is fine to use `this`.\n return true;\n }\n\n let fileNameIdentifier: Identifier;\n function makeSource(node: t.Node) {\n const location = node.loc;\n if (!location) {\n // the element was generated and doesn't have location information\n return path.scope.buildUndefinedNode();\n }\n\n if (!fileNameIdentifier) {\n fileNameIdentifier =\n path.scope.generateUidIdentifier(\"_jsxFileName\");\n }\n\n return makeTrace(\n t.cloneNode(fileNameIdentifier),\n location.start.line,\n location.start.column,\n );\n }\n\n function makeTrace(\n fileNameIdentifier: Identifier,\n lineNumber?: number,\n column0Based?: number,\n ) {\n const fileLineLiteral =\n lineNumber != null\n ? t.numericLiteral(lineNumber)\n : t.nullLiteral();\n\n const fileColumnLiteral =\n column0Based != null\n ? t.numericLiteral(column0Based + 1)\n : t.nullLiteral();\n\n return template.expression.ast`{\n fileName: ${fileNameIdentifier},\n lineNumber: ${fileLineLiteral},\n columnNumber: ${fileColumnLiteral},\n }`;\n }\n\n t.traverse(path.node, {\n enter(node, parents) {\n if (!t.isJSXOpeningElement(node)) {\n return;\n }\n const attributes = node.attributes;\n if (isThisAllowed(parents)) {\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(node)),\n ),\n );\n },\n });\n\n if (fileNameIdentifier) {\n const { filename = \"\" } = state;\n\n path.scope.push({\n id: fileNameIdentifier,\n init: t.stringLiteral(filename),\n });\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 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 <div {...props} key={key} /> to distinguish it\n // from <div key={key} {...props} />. 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<JSXElement>) {\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 processComments(\n attribs: NodePath<JSXAttribute | JSXSpreadAttribute>[],\n ) {\n commentsNode = null;\n if (attribs.length && attribs[0].isJSXSpreadAttribute()) {\n const node = attribs[0].node.argument;\n if (node.leadingComments || node.trailingComments) {\n commentsNode = t.cloneNode(node);\n }\n }\n }\n\n function accumulateAttribute(\n array: ObjectExpression[\"properties\"],\n attribute: NodePath<JSXAttribute | JSXSpreadAttribute>,\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<JSXElement>, 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 if (commentsNode) {\n t.inheritsComments(attribs, commentsNode);\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<JSXAttribute | JSXSpreadAttribute>[],\n children: Expression[],\n ) {\n processComments(attribs);\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<JSXFragment>,\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<JSXFragment>,\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<JSXElement>,\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<JSXOpeningElement>) {\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<JSXElement>,\n attribs: NodePath<JSXAttribute | JSXSpreadAttribute>[],\n ) {\n const runtime = get(file, \"runtime\");\n\n const props: ObjectExpression[\"properties\"] = [];\n const found = Object.create(null);\n\n processComments(attribs);\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 const ret =\n 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 if (commentsNode) {\n t.inheritsComments(ret, commentsNode);\n }\n return ret;\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<Program>,\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 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,OAAOA,GAAG,MAAM,0BAA0B;AAC1C,SAASC,OAAO,QAAQ,4BAA4B;AACpD,SAASC,QAAQ,EAAEC,KAAK,IAAIC,CAAC,QAAQ,aAAa;AAElD,SAASC,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,8BAA8B;AAC/E,OAAOC,cAAc,MAAM,gCAAgC;AAgB3D,MAAMC,OAAO,GAAG;EACdC,YAAY,EAAE,OAAO;EACrBC,OAAO,EAAE,WAAW;EACpBC,MAAM,EAAE,qBAAqB;EAC7BC,UAAU,EAAE;AACd,CAAC;AAED,MAAMC,2BAA2B,GAC/B,6CAA6C;AAC/C,MAAMC,4BAA4B,GAAG,wCAAwC;AAE7E,MAAMC,oBAAoB,GAAG,iCAAiC;AAC9D,MAAMC,yBAAyB,GAAG,qCAAqC;AAEvE,MAAMC,GAAG,GAAGA,CAACC,IAAgB,EAAEC,IAAY,KACzCD,IAAI,CAACD,GAAG,CAAC,2BAA2BE,IAAI,EAAE,CAAC;AAC7C,MAAMC,GAAG,GAAGA,CAACF,IAAgB,EAAEC,IAAY,EAAEE,CAAM,KACjDH,IAAI,CAACE,GAAG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yB,UAAU,CAAC,CAAC;MAChE;IACF,CAAC;EACH;AACF;AAEA,SAAS/H,kBAAkBA,CAACI,EAAU,EAAiC;EACrE,OACEA,EAAE,CACCgI,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAC5L,IAAI,IAAIhB,CAAC,CAAC6K,UAAU,CAAC7J,IAAI,CAAC,CAAC,CAG/B6K,MAAM,CAAC,CAAC3C,MAAM,EAAEC,QAAQ,KAAKnJ,CAAC,CAACiJ,gBAAgB,CAACC,MAAM,EAAEC,QAAQ,CAAC,CAAC;AAEzE;AAEA,SAASgC,eAAeA,CAAChI,IAAc,EAAEnC,IAAY,EAAE;EACrD,MAAM6L,UAAU,GAAG,uBAAuB7L,IAAI,CAAC8L,KAAK,CAAC,CAAC,CAAC,EAAE;EAEzD,OAAO3J,IAAI,CAACC,mBAAmB,CAC7B,aAAapC,IAAI,yDAAyD6L,UAAU,+LACtF,CAAC;AACH","ignoreList":[]} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
79758
4.49%524
2.54%1
Infinity%