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-jsx-auto-classnames
Advanced tools
If the className property uses a jsx object, the classnames dependency is automatically introduced
import xxx from 'classnames'
This plugin is used to automatically add and supplement xxx()
to the className
property of jsx
English | 简体中文
npm i babel-plugin-jsx-auto-classnames --save-dev
or
pnpm add babel-plugin-jsx-auto-classnames -D
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// import JsxAutoClassnames from 'babel-plugin-jsx-auto-classnames'
export default defineConfig({
plugins: [react({
babel: {
// plugins: [JsxAutoClassnames],
plugins: [
['jsx-auto-classnames', {
extensions: ['.jsx', '.tsx'],
excludes: ['src/excludes']
}]
]
}
})]
})
{
"plugins": [
"jsx-auto-classnames"
]
}
<div
className={{
selected: true
}}>
</div>
⬇️
import _classNames from 'classnames'
<div
className={_classNames({
selected: true
})}>
</div>
import xxx from 'classnames'
function App () {
return (
<>
<div
className={xxx({
disabled: true
})}>
</div>
<div
className={{
selected: true
}}>
</div>
</>
)
}
⬇️
import xxx from 'classnames'
function App () {
return (
<>
<div
className={xxx({
disabled: true
})}>
</div>
<div
className={xxx({
selected: true
})}>
</div>
</>
)
}
extensions
string[]
['.jsx', '.tsx']
excludes
string[]
['node_modules']
declare namespace React {
interface HTMLAttributes<any> extends AriaAttributes, DOMAttributes<any> {
className?: Record<string, boolean> | (string | Record<string, boolean>)[]
}
}
excludes
attributesextensions
attributesFAQs
If the className property uses a jsx object, the classnames dependency is automatically introduced
The npm package babel-plugin-jsx-auto-classnames receives a total of 1 weekly downloads. As such, babel-plugin-jsx-auto-classnames popularity was classified as not popular.
We found that babel-plugin-jsx-auto-classnames 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.