Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
babel-plugin-transform-import-css
Advanced tools
Readme
Injects class map imported from css-modules into js.
Plugin respects webpack css-modules API and postcss config.
npm add -SD babel-plugin-transform-import-css
.babelrc example:
{
"sourceMaps": "inline",
"presets": [
"@babel/env",
"react"
],
"plugins": [
["transform-import-css", {
"generateScopedName": "lib-[name]-[local]-[hash:base64:4]"
}]
]
}
Every js file that has a statement such as:
import classes from './Component.css'
// ... some code
will be transpiled to:
var classes = {
root: 'lib-foo-root-SFs0',
// ... some classes ...
}
require('load-styles')('.root{color:red}; ...some css...') // puts styles into the head
// ... some code
generateScopedName
— css-modules scope template. Default: [name]__[local]___[hash:base64:5]
configPath
— postcss config path. Default: auto detectext
— postcss files' extension. Typical use: ext: '.pcss'
. Default: '.css'
Note. Plugin rely on some @babel/ peerDependencies, that are typically included in your project by @babel/core self.
Bundling the css with npm packed library of js/react components. It is good for portability.
configPath
and ext
optionsrequire('load-styles')(css)
inserting in that cases.postcss-load-config
lib can't be used due to synchronous nature of the babel).export { classes }
friendlyimport jssObject from './style.css'
)Russian Fintech startup
FAQs
Injects imported styles (css-modules) into js
We found that babel-plugin-transform-import-css 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.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.