Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
6
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-react-display-name - npm Package Compare versions

Comparing version 7.0.0-beta.43 to 7.0.0-beta.44

54

lib/index.js

@@ -9,5 +9,5 @@ "use strict";

function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
var data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
_helperPluginUtils = function _helperPluginUtils() {
return data;

@@ -20,5 +20,5 @@ };

function _path() {
const data = _interopRequireDefault(require("path"));
var data = _interopRequireDefault(require("path"));
_path = function () {
_path = function _path() {
return data;

@@ -31,5 +31,5 @@ };

function _core() {
const data = require("@babel/core");
var data = require("@babel/core");
_core = function () {
_core = function _core() {
return data;

@@ -43,13 +43,13 @@ };

var _default = (0, _helperPluginUtils().declare)(api => {
var _default = (0, _helperPluginUtils().declare)(function (api) {
api.assertVersion(7);
function addDisplayName(id, call) {
const props = call.arguments[0].properties;
let safe = true;
var props = call.arguments[0].properties;
var safe = true;
for (let i = 0; i < props.length; i++) {
const prop = props[i];
for (var i = 0; i < props.length; i++) {
var prop = props[i];
const key = _core().types.toComputedKey(prop);
var key = _core().types.toComputedKey(prop);

@@ -69,5 +69,7 @@ if (_core().types.isLiteral(key, {

const isCreateClassCallExpression = _core().types.buildMatchMemberExpression("React.createClass");
var isCreateClassCallExpression = _core().types.buildMatchMemberExpression("React.createClass");
const isCreateClassAddon = callee => callee.name === "createReactClass";
var isCreateClassAddon = function isCreateClassAddon(callee) {
return callee.name === "createReactClass";
};

@@ -81,5 +83,5 @@ function isCreateClass(node) {

const args = node.arguments;
var args = node.arguments;
if (args.length !== 1) return false;
const first = args[0];
var first = args[0];
if (!_core().types.isObjectExpression(first)) return false;

@@ -91,9 +93,9 @@ return true;

visitor: {
ExportDefaultDeclaration({
node
}, state) {
ExportDefaultDeclaration: function ExportDefaultDeclaration(_ref, state) {
var node = _ref.node;
if (isCreateClass(node.declaration)) {
const filename = state.filename || "unknown";
var filename = state.filename || "unknown";
let displayName = _path().default.basename(filename, _path().default.extname(filename));
var displayName = _path().default.basename(filename, _path().default.extname(filename));

@@ -107,9 +109,6 @@ if (displayName === "index") {

},
CallExpression(path) {
const {
node
} = path;
CallExpression: function CallExpression(path) {
var node = path.node;
if (!isCreateClass(node)) return;
let id;
var id;
path.find(function (path) {

@@ -138,3 +137,2 @@ if (path.isAssignmentExpression()) {

}
}

@@ -141,0 +139,0 @@ };

{
"name": "@babel/plugin-transform-react-display-name",
"version": "7.0.0-beta.43",
"version": "7.0.0-beta.44",
"description": "Add displayName to React.createClass calls",

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

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.43"
"@babel/helper-plugin-utils": "7.0.0-beta.44"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.43",
"@babel/helper-plugin-test-runner": "7.0.0-beta.43"
"@babel/core": "7.0.0-beta.44",
"@babel/helper-plugin-test-runner": "7.0.0-beta.44"
}
}
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