Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
babel-plugin-react-display-name
Advanced tools
The babel-plugin-react-display-name package is a Babel plugin that automatically adds displayName properties to React components. This is particularly useful for debugging purposes, as it allows React components to be more easily identified in the React Developer Tools.
Automatic displayName addition
This feature automatically adds a displayName property to React components, making them easier to identify in debugging tools. The code sample shows a simple React component before and after the Babel transformation.
/* Babel configuration file (e.g., .babelrc) */
{
"plugins": [
"babel-plugin-react-display-name"
]
}
/* React component file */
import React from 'react';
const MyComponent = () => {
return <div>Hello, World!</div>;
};
export default MyComponent;
/* After Babel transformation */
import React from 'react';
const MyComponent = () => {
return <div>Hello, World!</div>;
};
MyComponent.displayName = 'MyComponent';
export default MyComponent;
The babel-plugin-transform-react-display-name package is another Babel plugin that adds displayName properties to React components. It serves a similar purpose to babel-plugin-react-display-name, helping with debugging by making component names visible in React Developer Tools.
The react-display-name package is a utility that extracts the displayName of a React component. Unlike babel-plugin-react-display-name, it does not automatically add displayName properties but can be used to retrieve the displayName for various purposes.
Add displayName to React.createClass calls
$ npm install babel-plugin-react-display-name
.babelrc
(Recommended).babelrc
{
"plugins": ["react-display-name"]
}
$ babel --plugins react-display-name script.js
require("babel-core").transform("code", {
plugins: ["react-display-name"]
});
FAQs
Add displayName to React.createClass calls
The npm package babel-plugin-react-display-name receives a total of 76,170 weekly downloads. As such, babel-plugin-react-display-name popularity was classified as popular.
We found that babel-plugin-react-display-name demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.