Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
aphrodisiac
Advanced tools
This project is a merge of good ideas from aphrodite and JSS. It provides an API of aphrodite but fixes lots of limitations and caveats by using JSS as a rendering engine under the hood.
css()
function invocation. Only the passed rules are converted to a CSS string and injected.{named: false}
)css()
call invocation. It gives you an access to computed styles right after render, no need to use setTimeout()
. It also avoids additional recalcs and repaints, which can cause flickers and general performance overhead.import {StyleSheet, css} from 'aphrodisiac'
const sheet = StyleSheet.create({
button: {
border: '1px solid',
borderRadius: 5,
fontSize: 'inherit',
lineHeight: '2.3em',
padding: '0 1em',
boxShadow: 'inset 0 1px 0 rgba(255, 255, 255, 0.1)',
textShadow: '0 -1px 0 rgba(0, 0, 0, 0.25)',
backgroundRepeat: 'repeat-x',
color: '#fff',
fontWeight: 400,
'& span': {
marginRight: 5,
color: '#fff'
}
},
primary: {
borderColor: '#1177cd #0f6ab6 #0d5c9e',
backgroundImage: 'linear-gradient(to bottom, #2591ed 0%, #1177cd 100%)',
backgroundColor: '#1385e5',
'&:hover': {
backgroundImage: 'linear-gradient(to bottom, #3c9def 0%, #1385e5 100%)'
}
}
})
document.body.innerHTML = `
<button class="${css(sheet.button, sheet.primary)}">
<span>✔</span>Primary
</button>
`
StyleSheet.create(styles)
Create function doesn't render anything, it just registers your styles.
Returns an object, where key names correspond the original styles obejct.
css(rule1, [rule2], [rule3], ...)
Injects a previously defined rule to the dom. This is done in sync, so the CSS rule is immediately available.
Returns a class name.
The format for styles is defined in jss. Aprodisiac uses jss-preset-default, so all default presets are already in place.
aphrodisiac(jss, [options])
You can pass your own JSS instance with your custom setup.
Returns aphrodite's interface.
import aphrodisiac from 'aphrodisiac'
import {create} from 'jss'
const {css, StyleSheet} = aphrodisiac(create())
There are 2 functions you need to know - toString()
and reset()
.
As aphrodisiac can not know that you are rendering a new response, you need to get the CSS (toString()
) when you are processing the first request and call reset()
to clean up the styles your current page has produced.
import {toString, reset} from 'aphrodisiac'
function render() {
const app = renderApp()
const css = toString()
reset()
return `
<head>
<style>
${css}
</style>
<head>
<body>
${app}
</body>
`
}
MIT
0.4.0 / 2016-11-17
FAQs
Aphrodite-like API on top of JSS.
The npm package aphrodisiac receives a total of 1 weekly downloads. As such, aphrodisiac popularity was classified as not popular.
We found that aphrodisiac 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.