Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-react-jsx

Package Overview
Dependencies
56
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.16.7 to 7.17.3

46

lib/create-plugin.js

@@ -71,3 +71,3 @@ "use strict";

if (isThisAllowed(path)) {
if (isThisAllowed(path.scope)) {
attributes.push(_core.types.jsxAttribute(_core.types.jsxIdentifier("__self"), _core.types.jsxExpressionContainer(_core.types.thisExpression())));

@@ -212,14 +212,2 @@ }

function getThisFunctionParent(path) {
let scope = path.scope;
do {
if (scope.path.isFunctionParent() && !scope.path.isArrowFunctionExpression()) {
return scope.path;
}
} while (scope = scope.parent);
return null;
}
function isDerivedClass(classPath) {

@@ -229,18 +217,26 @@ return classPath.node.superClass !== null;

function isThisAllowed(path) {
const parentMethodOrFunction = getThisFunctionParent(path);
function isThisAllowed(scope) {
do {
const {
path
} = scope;
if (parentMethodOrFunction === null) {
return true;
}
if (path.isFunctionParent() && !path.isArrowFunctionExpression()) {
if (!path.isMethod()) {
return true;
}
if (!parentMethodOrFunction.isMethod()) {
return true;
}
if (path.node.kind !== "constructor") {
return true;
}
if (parentMethodOrFunction.node.kind !== "constructor") {
return true;
}
return !isDerivedClass(path.parentPath.parentPath);
}
return !isDerivedClass(parentMethodOrFunction.parentPath.parentPath);
if (path.isTSModuleBlock()) {
return false;
}
} while (scope = scope.parent);
return true;
}

@@ -247,0 +243,0 @@

{
"name": "@babel/plugin-transform-react-jsx",
"version": "7.16.7",
"version": "7.17.3",
"description": "Turn JSX into React function calls",

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

"@babel/plugin-syntax-jsx": "^7.16.7",
"@babel/types": "^7.16.7"
"@babel/types": "^7.17.0"
},

@@ -31,5 +31,5 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "^7.16.7",
"@babel/core": "^7.17.3",
"@babel/helper-plugin-test-runner": "^7.16.7",
"@babel/traverse": "^7.16.7"
"@babel/traverse": "^7.17.3"
},

@@ -36,0 +36,0 @@ "engines": {

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