Socket
Socket
Sign inDemoInstall

@babel/helper-builder-react-jsx

Package Overview
Dependencies
Maintainers
4
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/helper-builder-react-jsx - npm Package Compare versions

Comparing version 7.16.7 to 7.18.6

36

lib/index.js

@@ -23,3 +23,2 @@ "use strict";

isJSXSpreadAttribute,
isLiteral,
isObjectExpression,

@@ -54,4 +53,4 @@ isReferenced,

visitor.JSXElement = {
exit(path, file) {
const callExpr = buildElementCall(path, file);
exit(path, state) {
const callExpr = buildElementCall(path, state.file);

@@ -65,3 +64,3 @@ if (callExpr) {

visitor.JSXFragment = {
exit(path, file) {
exit(path, state) {
if (opts.compat) {

@@ -71,3 +70,3 @@ throw path.buildCodeFrameError("Fragment tags are only supported in React 16 and up.");

const callExpr = buildFragmentCall(path, file);
const callExpr = buildFragmentCall(path, state.file);

@@ -109,4 +108,2 @@ if (callExpr) {

function convertAttribute(node) {
const value = convertAttributeValue(node.value || booleanLiteral(true));
if (isJSXSpreadAttribute(node)) {

@@ -116,2 +113,4 @@ return spreadElement(node.argument);

const value = convertAttributeValue(node.value || booleanLiteral(true));
if (isStringLiteral(value) && !isJSXExpressionContainer(node.value)) {

@@ -138,3 +137,3 @@ var _value$extra;

const openingPath = path.get("openingElement");
openingPath.parent.children = react.buildChildren(openingPath.parent);
path.node.children = react.buildChildren(path.node);
const tagExpr = convertJSXIdentifier(openingPath.node.name, openingPath.node);

@@ -146,3 +145,3 @@ const args = [];

tagName = tagExpr.name;
} else if (isLiteral(tagExpr)) {
} else if (isStringLiteral(tagExpr)) {
tagName = tagExpr.value;

@@ -162,13 +161,14 @@ }

let attribs = openingPath.node.attributes;
const attribs = openingPath.node.attributes;
let convertedAttributes;
if (attribs.length) {
{
attribs = buildOpeningElementAttributes(attribs, file);
convertedAttributes = buildOpeningElementAttributes(attribs, file);
}
} else {
attribs = nullLiteral();
convertedAttributes = nullLiteral();
}
args.push(attribs, ...path.node.children);
args.push(convertedAttributes, ...path.node.children);

@@ -228,5 +228,6 @@ if (opts.post) {

pushProps(_props, objs);
let convertedAttribs;
if (objs.length === 1) {
attribs = objs[0];
convertedAttribs = objs[0];
} else {

@@ -238,6 +239,6 @@ if (!isObjectExpression(objs[0])) {

const helper = useBuiltIns ? memberExpression(identifier("Object"), identifier("assign")) : file.addHelper("extends");
attribs = callExpression(helper, objs);
convertedAttribs = callExpression(helper, objs);
}
return attribs;
return convertedAttribs;
}

@@ -247,4 +248,3 @@

if (opts.filter && !opts.filter(path.node, file)) return;
const openingPath = path.get("openingElement");
openingPath.parent.children = react.buildChildren(openingPath.parent);
path.node.children = react.buildChildren(path.node);
const args = [];

@@ -251,0 +251,0 @@ const tagName = null;

{
"name": "@babel/helper-builder-react-jsx",
"version": "7.16.7",
"version": "7.18.6",
"description": "Helper function to build react jsx",

@@ -17,7 +17,7 @@ "repository": {

"dependencies": {
"@babel/helper-annotate-as-pure": "^7.16.7",
"@babel/types": "^7.16.7"
"@babel/helper-annotate-as-pure": "^7.18.6",
"@babel/types": "^7.18.6"
},
"devDependencies": {
"@babel/traverse": "^7.16.7"
"@babel/traverse": "^7.18.6"
},

@@ -27,3 +27,4 @@ "engines": {

},
"author": "The Babel Team (https://babel.dev/team)"
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc