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.20.2 to 7.21.3

29

lib/index.js

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

}
const HOISTED = new WeakMap();

@@ -60,3 +59,2 @@ function declares(node, scope) {

if (scope === state.targetScope) return;
if (declares(node, scope)) break;

@@ -77,4 +75,6 @@ scope = scope.parent;

};
if (path.isJSXClosingElement()) return skip();
if (path.isJSXClosingElement()) {
skip();
return;
}
if (path.isJSXIdentifier({

@@ -85,9 +85,8 @@ name: "ref"

})) {
return stop();
stop();
return;
}
if (path.isJSXIdentifier() || path.isJSXMemberExpression() || path.isJSXNamespacedName() || path.isImmutable()) {
return;
}
if (path.isIdentifier()) {

@@ -97,3 +96,2 @@ const binding = path.scope.getBinding(path.node.name);

}
const {

@@ -104,6 +102,9 @@ mutablePropsAllowed

path.traverse(targetScopeVisitor, state);
return skip();
skip();
return;
}
if (!path.isPure()) return stop();
if (!path.isPure()) {
stop();
return;
}
const expressionResult = path.evaluate();

@@ -115,3 +116,4 @@ if (expressionResult.confident) {

if (mutablePropsAllowed || value === null || typeof value !== "object" && typeof value !== "function") {
return skip();
skip();
return;
}

@@ -124,3 +126,2 @@ } else if (_core.types.isIdentifier(expressionResult.deopt)) {

};
const hoistingVisitor = Object.assign({}, immutabilityVisitor, targetScopeVisitor);

@@ -134,3 +135,2 @@ return {

const name = path.node.openingElement.name;
let mutablePropsAllowed = false;

@@ -145,3 +145,2 @@ if (allowMutablePropsOnTags != null) {

}
let jsxScope;

@@ -148,0 +147,0 @@ let current = path;

{
"name": "@babel/plugin-transform-react-constant-elements",
"version": "7.20.2",
"version": "7.21.3",
"description": "Treat React JSX elements as value types and hoist them to the highest scope",

@@ -26,3 +26,3 @@ "repository": {

"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.21.3",
"@babel/helper-plugin-test-runner": "^7.18.6"

@@ -29,0 +29,0 @@ },

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