Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
7
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.21.4-esm to 7.21.4-esm.1

35

lib/index.js

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

"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 => {
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 => {
api.assertVersion(7);

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

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

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

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

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

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

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

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

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

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

@@ -70,4 +64,3 @@ 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",
"version": "7.21.4-esm.1",
"description": "Turn JSX elements into exploded React objects",

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

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc