Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-react-jsx-self

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-jsx-self - npm Package Compare versions

Comparing version 7.18.6 to 7.21.0

lib/index.js.map

23

lib/index.js

@@ -7,12 +7,7 @@ "use strict";

exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _core = require("@babel/core");
const TRACE_ID = "__self";
function getThisFunctionParent(path) {
let scope = path.scope;
do {

@@ -22,3 +17,2 @@ const {

} = scope;
if (path.isFunctionParent() && !path.isArrowFunctionExpression()) {

@@ -28,28 +22,20 @@ return path;

} while (scope = scope.parent);
return null;
}
function isDerivedClass(classPath) {
return classPath.node.superClass !== null;
}
function isThisAllowed(path) {
const parentMethodOrFunction = getThisFunctionParent(path);
if (parentMethodOrFunction === null) {
return true;
}
if (!parentMethodOrFunction.isMethod()) {
return true;
}
if (parentMethodOrFunction.node.kind !== "constructor") {
return true;
}
return !isDerivedClass(parentMethodOrFunction.parentPath.parentPath);
}
var _default = (0, _helperPluginUtils.declare)(api => {

@@ -62,12 +48,7 @@ api.assertVersion(7);

}
const node = path.node;
const id = _core.types.jsxIdentifier(TRACE_ID);
const trace = _core.types.thisExpression();
node.attributes.push(_core.types.jsxAttribute(id, _core.types.jsxExpressionContainer(trace)));
}
};

@@ -80,7 +61,7 @@ return {

}
}
};
});
exports.default = _default;
exports.default = _default;
//# sourceMappingURL=index.js.map
{
"name": "@babel/plugin-transform-react-jsx-self",
"version": "7.18.6",
"version": "7.21.0",
"description": "Add a __self prop to all JSX Elements",

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

"dependencies": {
"@babel/helper-plugin-utils": "^7.18.6"
"@babel/helper-plugin-utils": "^7.20.2"
},

@@ -27,3 +27,3 @@ "peerDependencies": {

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

@@ -30,0 +30,0 @@ "@babel/plugin-syntax-jsx": "^7.18.6"

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