You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

babel-plugin-react-pure-component

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-pure-component - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+28
lib/index.js
/**
* Set the displayName of components created with react-pure-component
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = function (_ref) {
var Plugin = _ref.Plugin;
var t = _ref.types;
return new Plugin('pure-component', {
visitor: {
VariableDeclarator: function VariableDeclarator(node) {
if (node.init.type === 'CallExpression' && node.init.callee.type === 'Identifier' && node.init.callee.name === 'pure') {
var displayName = node.id.name;
return [node, t.expressionStatement(t.assignmentExpression('=', t.memberExpression(t.identifier(displayName), t.identifier('displayName')), t.literal(displayName)))];
}
return node;
}
}
});
};
module.exports = exports['default'];
+1
-1
{
"name": "babel-plugin-react-pure-component",
"version": "0.1.1",
"version": "0.1.2",
"description": "Add displayName to components created with react-pure-component",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,3 +5,3 @@ /**

export default function ({ Plugin, types: t }) {
return new Plugin('pure-component', {
return new Plugin('react-pure-component', {
visitor: {

@@ -8,0 +8,0 @@ VariableDeclarator(node) {