🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@babel/plugin-transform-react-jsx

Package Overview
Dependencies
Maintainers
6
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-react-jsx - npm Package Compare versions

Comparing version

to
7.13.12

44

lib/create-plugin.js

@@ -272,5 +272,5 @@ "use strict";

function accumulateAttribute(array, node) {
if (_core.types.isJSXSpreadAttribute(node)) {
const arg = node.argument;
function accumulateAttribute(array, attribute) {
if (_core.types.isJSXSpreadAttribute(attribute.node)) {
const arg = attribute.node.argument;

@@ -286,5 +286,9 @@ if (_core.types.isObjectExpression(arg)) {

const value = convertAttributeValue(node.value || _core.types.booleanLiteral(true));
const value = convertAttributeValue(attribute.node.name.name !== "key" ? attribute.node.value || _core.types.booleanLiteral(true) : attribute.node.value);
if (_core.types.isStringLiteral(value) && !_core.types.isJSXExpressionContainer(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 (_core.types.isStringLiteral(value) && !_core.types.isJSXExpressionContainer(attribute.node.value)) {
var _value$extra;

@@ -296,11 +300,11 @@

if (_core.types.isJSXNamespacedName(node.name)) {
node.name = _core.types.stringLiteral(node.name.namespace.name + ":" + node.name.name.name);
} else if (_core.types.isValidIdentifier(node.name.name, false)) {
node.name.type = "Identifier";
if (_core.types.isJSXNamespacedName(attribute.node.name)) {
attribute.node.name = _core.types.stringLiteral(attribute.node.name.namespace.name + ":" + attribute.node.name.name.name);
} else if (_core.types.isValidIdentifier(attribute.node.name.name, false)) {
attribute.node.name.type = "Identifier";
} else {
node.name = _core.types.stringLiteral(node.name.name);
attribute.node.name = _core.types.stringLiteral(attribute.node.name.name);
}
array.push(_core.types.inherits(_core.types.objectProperty(node.name, value), node));
array.push(_core.types.inherits(_core.types.objectProperty(attribute.node.name, value), attribute.node));
return array;

@@ -341,10 +345,18 @@ }

case "key":
extracted[name] = convertAttributeValue(attr.node.value);
break;
{
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:
attribs.push(attr.node);
attribs.push(attr);
}
} else {
attribs.push(attr.node);
attribs.push(attr);
}

@@ -405,3 +417,3 @@ }

const openingPath = path.get("openingElement");
return call(file, "createElement", [getTag(openingPath), buildCreateElementOpeningElementAttributes(file, path, openingPath.node.attributes), ..._core.types.react.buildChildren(path.node)]);
return call(file, "createElement", [getTag(openingPath), buildCreateElementOpeningElementAttributes(file, path, openingPath.get("attributes")), ..._core.types.react.buildChildren(path.node)]);
}

@@ -408,0 +420,0 @@

{
"name": "@babel/plugin-transform-react-jsx",
"version": "7.12.17",
"version": "7.13.12",
"description": "Turn JSX into React function calls",

@@ -21,6 +21,6 @@ "repository": {

"@babel/helper-annotate-as-pure": "^7.12.13",
"@babel/helper-module-imports": "^7.12.13",
"@babel/helper-plugin-utils": "^7.12.13",
"@babel/helper-module-imports": "^7.13.12",
"@babel/helper-plugin-utils": "^7.13.0",
"@babel/plugin-syntax-jsx": "^7.12.13",
"@babel/types": "^7.12.17"
"@babel/types": "^7.13.12"
},

@@ -31,5 +31,5 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "7.12.17",
"@babel/helper-plugin-test-runner": "7.12.13"
"@babel/core": "7.13.10",
"@babel/helper-plugin-test-runner": "7.13.10"
}
}