
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
babel-plugin-transform-import-styles
Advanced tools
Replaces import './styles.css' or import './styles.less' with a loader which injects styles to HTML head.
Currently works with .css and .less files (compiles .less to .css on the fly).
Afterwards all styles are processed by autoprefixer.
babel 6, node >= 8
npm i --save-dev babel-plugin-transform-import-styles
npm i --save-dev load-styles # puts styles into the head
The following command will convert everything in the src folder to lib using babel and our plugin.
babel src/ -d lib/ --presets stage-0,env,react --plugins transform-import-styles
Every js file that has a statement such as:
import './Component.css'
where Component.css is
.root{color:red}
will be roughly translated to:
require('load-styles')(
`/* myCoolButtons */\n
.root{color:red}`
) // puts styles into the head
String myCoolButtons is taken from package.json -> name of current project.
In browser's HTML head there will be the following block:
<style>
/* myCoolButtons */
.root{color:red}
</style>
Example command to build a library using only babel:
babel src -s -D -d lib --presets es2015,stage-0,react --plugins transform-import-styles --ignore less,css,SCOPE.react.js,DOCUMENTATION.md --source-maps false
It will recursively transpile src directory and put all .css and .less files directly to .js files as descrived earlier. --ignore option is useful when you want to omit certain files in your production-ready build.
Bundling the css with js/react components. It is good for portability.
Support non-relative paths like import 'some-npm-package/whatever/path/style-name.css'.
export { classes } friendlyimport jssObject from './style.css')FAQs
Injects imported styles (.css or .less) into js
The npm package babel-plugin-transform-import-styles receives a total of 180 weekly downloads. As such, babel-plugin-transform-import-styles popularity was classified as not popular.
We found that babel-plugin-transform-import-styles 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
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.