Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/plugin-transform-react-inline-elements

Package Overview
Dependencies
Maintainers
4
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-react-inline-elements - npm Package Compare versions

Comparing version 7.21.4-esm.4 to 7.22.5

35

lib/index.js

@@ -1,5 +0,11 @@

import { declare } from "@babel/helper-plugin-utils";
import helper from "@babel/helper-builder-react-jsx";
import { types as t } from "@babel/core";
export default declare(api => {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _helperBuilderReactJsx = require("@babel/helper-builder-react-jsx");
var _core = require("@babel/core");
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);

@@ -9,3 +15,3 @@ function hasRefOrSpread(attrs) {

const attr = attrs[i];
if (t.isJSXSpreadAttribute(attr)) return true;
if (_core.types.isJSXSpreadAttribute(attr)) return true;
if (isJSXAttributeOfName(attr, "ref")) return true;

@@ -16,7 +22,7 @@ }

function isJSXAttributeOfName(attr, name) {
return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name, {
return _core.types.isJSXAttribute(attr) && _core.types.isJSXIdentifier(attr.name, {
name: name
});
}
const visitor = helper({
const visitor = (0, _helperBuilderReactJsx.default)({
filter(node) {

@@ -28,4 +34,4 @@ return node.type === "JSXElement" && !hasRefOrSpread(node.openingElement.attributes);

const args = state.args;
if (t.react.isCompatTag(tagName)) {
args.push(t.stringLiteral(tagName));
if (_core.types.react.isCompatTag(tagName)) {
args.push(_core.types.stringLiteral(tagName));
} else {

@@ -39,4 +45,4 @@ args.push(state.tagExpr);

let hasKey = false;
if (t.isObjectExpression(props)) {
const keyIndex = props.properties.findIndex(prop => t.isIdentifier(prop.key, {
if (_core.types.isObjectExpression(props)) {
const keyIndex = props.properties.findIndex(prop => _core.types.isIdentifier(prop.key, {
name: "key"

@@ -49,7 +55,7 @@ }));

}
} else if (t.isNullLiteral(props)) {
state.args.splice(1, 1, t.objectExpression([]));
} else if (_core.types.isNullLiteral(props)) {
state.args.splice(1, 1, _core.types.objectExpression([]));
}
if (!hasKey && state.args.length > 2) {
state.args.splice(2, 0, t.unaryExpression("void", t.numericLiteral(0)));
state.args.splice(2, 0, _core.types.unaryExpression("void", _core.types.numericLiteral(0)));
}

@@ -64,3 +70,4 @@ state.pure = true;

});
exports.default = _default;
//# sourceMappingURL=index.js.map

14

package.json
{
"name": "@babel/plugin-transform-react-inline-elements",
"version": "7.21.4-esm.4",
"version": "7.22.5",
"description": "Turn JSX elements into exploded React objects",

@@ -20,11 +20,11 @@ "repository": {

"dependencies": {
"@babel/helper-builder-react-jsx": "7.21.4-esm.4",
"@babel/helper-plugin-utils": "7.21.4-esm.4"
"@babel/helper-builder-react-jsx": "^7.22.5",
"@babel/helper-plugin-utils": "^7.22.5"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || ^7.21.4-esm.2"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.21.4-esm.4",
"@babel/helper-plugin-test-runner": "7.21.4-esm.4"
"@babel/core": "^7.22.5",
"@babel/helper-plugin-test-runner": "^7.22.5"
},

@@ -35,3 +35,3 @@ "engines": {

"author": "The Babel Team (https://babel.dev/team)",
"type": "module"
"type": "commonjs"
}

Sorry, the diff of this file is not supported yet

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