New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

postcss-unwrap-mq

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-unwrap-mq - npm Package Compare versions

Comparing version

to
0.3.0

30

index.js

@@ -1,24 +0,28 @@

let postcss = require('postcss')
module.exports = postcss.plugin('postcss-unwrap-mq', (opts = { }) => {
module.exports = (opts = {}) => {
// eslint-disable-next-line prefer-let/prefer-let
const {
regex
regex = undefined
} = opts
return (root, result) => {
if (!regex) {
return
if (!regex) {
return {
postcssPlugin: 'postcss-unwrap-mq',
}
}
root.walkAtRules('media', atrule => {
const test = new RegExp(regex)
const matched = test.test(atrule.params)
return {
postcssPlugin: 'postcss-unwrap-mq',
AtRule(atrule) {
// eslint-disable-next-line security/detect-non-literal-regexp
let test = new RegExp(regex)
let matched = test.test(atrule.params)
if (matched) {
atrule.walkRules(rule => {
root.insertBefore(atrule, rule)
atrule.parent.insertBefore(atrule, rule)
})
atrule.remove()
}
})
}
}
})
}
module.exports.postcss = true
{
"name": "postcss-unwrap-mq",
"version": "0.2.0",
"version": "0.3.0",
"description": "PostCSS plugin to extract matched media queries to their parents",

@@ -5,0 +5,0 @@ "keywords": [