Socket
Socket
Sign inDemoInstall

@mozaic-ds/postcss-media-queries-packer-on-demand

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mozaic-ds/postcss-media-queries-packer-on-demand - npm Package Compare versions

Comparing version 1.0.1 to 1.11.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [1.11.0](https://github.com/adeo/mozaic-design-system/compare/v1.10.0...v1.11.0) (2021-06-09)
**Note:** Version bump only for package @mozaic-ds/postcss-media-queries-packer-on-demand
## [1.0.1](https://github.com/adeo/mozaic-design-system/compare/v1.0.1-beta.22...v1.0.1) (2020-12-09)

@@ -8,0 +16,0 @@

97

index.js

@@ -9,9 +9,9 @@ const postcss = require('postcss')

const parseQueryList = queryList => {
const parseQueryList = (queryList) => {
const queries = []
list.comma(queryList).forEach(query => {
list.comma(queryList).forEach((query) => {
const expressions = {}
list.space(query).forEach(expression => {
list.space(query).forEach((expression) => {
let newExpression = expression.toLowerCase()

@@ -44,3 +44,3 @@

const inspectLength = length => {
const inspectLength = (length) => {
if (length === '0') {

@@ -86,6 +86,6 @@ return 0

const pickMinimumMinWidth = expressions => {
const pickMinimumMinWidth = (expressions) => {
const minWidths = []
expressions.forEach(feature => {
expressions.forEach((feature) => {
let minWidth = feature['min-width']

@@ -114,3 +114,3 @@

queryLists.forEach(queryList => {
queryLists.forEach((queryList) => {
mapQueryLists.push(parseQueryList(queryList))

@@ -125,3 +125,3 @@ })

.sort((a, b) => a.value - b.value)
.map(e => queryLists[e.index])
.map((e) => queryLists[e.index])
}

@@ -140,3 +140,3 @@

node.each(rule => {
node.each((rule) => {
newAtRule.append(rule)

@@ -153,3 +153,3 @@ })

if (typeof past === 'object') {
node.each(rule => {
node.each((rule) => {
past.append(rule.clone())

@@ -165,42 +165,47 @@ })

module.exports = postcss.plugin(
'postcss-media-queries-packer-on-demand',
options => root => {
const opts = {
sort: false,
...options,
}
root.each(node => {
if (node.type === 'comment' && node.text === 'mqp:start') {
startPacking = true
node.remove()
}
module.exports = (options = {}) => {
const opts = {
sort: false,
...options,
}
if (node.type === 'comment' && node.text === 'mqp:end') {
startPacking = false
}
return {
postcssPlugin: 'postcss-media-queries-packer-on-demand',
Once(root) {
root.each((node) => {
if (node.type === 'comment' && node.text === 'mqp:start') {
startPacking = true
node.remove()
}
if (
node.type === 'atrule' &&
node.name === 'media' &&
startPacking === true
) {
addToAtRules(node)
}
if (node.type === 'comment' && node.text === 'mqp:end') {
startPacking = false
}
if (
node.type === 'comment' &&
node.text === 'mqp:end' &&
startPacking === false
) {
sortQueryLists(queryLists, opts.sort).forEach(queryList => {
node.before(queries[queryList])
})
if (
node.type === 'atrule' &&
node.name === 'media' &&
startPacking === true
) {
addToAtRules(node)
}
node.remove()
queries = {}
queryLists = []
}
})
if (
node.type === 'comment' &&
node.text === 'mqp:end' &&
startPacking === false
) {
sortQueryLists(queryLists, opts.sort).forEach((queryList) => {
node.before(queries[queryList])
})
node.remove()
queries = {}
queryLists = []
}
})
},
}
)
}
module.exports.postcss = true
{
"name": "@mozaic-ds/postcss-media-queries-packer-on-demand",
"version": "1.0.1",
"version": "1.11.0",
"description": "PostCSS plugin that group media queries on demand",
"keywords": [
"css",
"postcss",
"css",
"postcss-plugin",

@@ -17,11 +17,9 @@ "media-queries"

"license": "MIT",
"dependencies": {
"postcss": "^7.0.18"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.6.2",
"jest": "^24.9.0"
"@babel/plugin-transform-runtime": "^7.14.3",
"jest": "^27.0.3",
"postcss": "^8.3.0"
},
"engines": {
"node": ">=8.0.0"
"node": ">=12"
},

@@ -28,0 +26,0 @@ "jest": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc