Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 7.21.4-esm.4 to 7.22.0

34

lib/index.js

@@ -1,4 +0,10 @@

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

@@ -13,9 +19,9 @@ const {

function declares(node, scope) {
if (t.isJSXIdentifier(node, {
if (_core.types.isJSXIdentifier(node, {
name: "this"
}) || t.isJSXIdentifier(node, {
}) || _core.types.isJSXIdentifier(node, {
name: "arguments"
}) || t.isJSXIdentifier(node, {
}) || _core.types.isJSXIdentifier(node, {
name: "super"
}) || t.isJSXIdentifier(node, {
}) || _core.types.isJSXIdentifier(node, {
name: "new"

@@ -61,2 +67,3 @@ })) {

enter(path, state) {
var _expressionResult$deo;
const stop = () => {

@@ -109,3 +116,3 @@ state.isImmutable = false;

}
} else if (t.isIdentifier(expressionResult.deopt)) {
} else if ((_expressionResult$deo = expressionResult.deopt) != null && _expressionResult$deo.isIdentifier()) {
return;

@@ -127,3 +134,3 @@ }

let lastSegment = name;
while (t.isJSXMemberExpression(lastSegment)) {
while (_core.types.isJSXMemberExpression(lastSegment)) {
lastSegment = lastSegment.property;

@@ -163,10 +170,10 @@ }

targetScope.push({
id: t.identifier(id)
id: _core.types.identifier(id)
});
HOISTED.set(path.node, targetScope);
let replacement = template.expression.ast`
${t.identifier(id)} || (${t.identifier(id)} = ${path.node})
let replacement = _core.template.expression.ast`
${_core.types.identifier(id)} || (${_core.types.identifier(id)} = ${path.node})
`;
if (path.parentPath.isJSXElement() || path.parentPath.isJSXAttribute()) {
replacement = t.jsxExpressionContainer(replacement);
replacement = _core.types.jsxExpressionContainer(replacement);
}

@@ -178,3 +185,4 @@ path.replaceWith(replacement);

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

@@ -1,1 +0,1 @@

{ "type": "module" }
{ "type": "script" }
{
"name": "@babel/plugin-transform-react-constant-elements",
"version": "7.21.4-esm.4",
"version": "7.22.0",
"description": "Treat React JSX elements as value types and hoist them to the highest scope",

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

"dependencies": {
"@babel/helper-plugin-utils": "7.21.4-esm.4"
"@babel/helper-plugin-utils": "^7.21.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.0",
"@babel/helper-plugin-test-runner": "^7.18.6"
},

@@ -34,3 +34,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