Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-react-display-name

Package Overview
Dependencies
54
Maintainers
6
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.2.0 to 7.7.4

52

lib/index.js

@@ -8,35 +8,11 @@ "use strict";

function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var _helperPluginUtils = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
return data;
};
var _path = _interopRequireDefault(require("path"));
return data;
}
var _core = require("@babel/core");
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = (0, _helperPluginUtils().declare)(api => {
var _default = (0, _helperPluginUtils.declare)(api => {
api.assertVersion(7);

@@ -51,5 +27,5 @@

const key = _core().types.toComputedKey(prop);
const key = _core.types.toComputedKey(prop);
if (_core().types.isLiteral(key, {
if (_core.types.isLiteral(key, {
value: "displayName"

@@ -63,7 +39,7 @@ })) {

if (safe) {
props.unshift(_core().types.objectProperty(_core().types.identifier("displayName"), _core().types.stringLiteral(id)));
props.unshift(_core.types.objectProperty(_core.types.identifier("displayName"), _core.types.stringLiteral(id)));
}
}
const isCreateClassCallExpression = _core().types.buildMatchMemberExpression("React.createClass");
const isCreateClassCallExpression = _core.types.buildMatchMemberExpression("React.createClass");

@@ -73,3 +49,3 @@ const isCreateClassAddon = callee => callee.name === "createReactClass";

function isCreateClass(node) {
if (!node || !_core().types.isCallExpression(node)) return false;
if (!node || !_core.types.isCallExpression(node)) return false;

@@ -83,3 +59,3 @@ if (!isCreateClassCallExpression(node.callee) && !isCreateClassAddon(node.callee)) {

const first = args[0];
if (!_core().types.isObjectExpression(first)) return false;
if (!_core.types.isObjectExpression(first)) return false;
return true;

@@ -97,6 +73,6 @@ }

let displayName = _path().default.basename(filename, _path().default.extname(filename));
let displayName = _path.default.basename(filename, _path.default.extname(filename));
if (displayName === "index") {
displayName = _path().default.basename(_path().default.dirname(filename));
displayName = _path.default.basename(_path.default.dirname(filename));
}

@@ -129,7 +105,7 @@

if (_core().types.isMemberExpression(id)) {
if (_core.types.isMemberExpression(id)) {
id = id.property;
}
if (_core().types.isIdentifier(id)) {
if (_core.types.isIdentifier(id)) {
addDisplayName(id.name, node);

@@ -136,0 +112,0 @@ }

{
"name": "@babel/plugin-transform-react-display-name",
"version": "7.2.0",
"version": "7.7.4",
"description": "Add displayName to React.createClass calls",

@@ -21,5 +21,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name",

"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
}
"@babel/core": "^7.7.4",
"@babel/helper-plugin-test-runner": "^7.7.4"
},
"gitHead": "75767d87cb147709b9bd9b99bf44daa6688874a9"
}

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