postcss-nested
Advanced tools
Comparing version 4.1.1 to 4.1.2
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 4.1.2 | ||
* Improve error messsage on broken selector | ||
## 4.1.1 | ||
@@ -5,0 +8,0 @@ * Add `&(:hover)` support (by Ben Delarre). |
16
index.js
var postcss = require('postcss') | ||
var parser = require('postcss-selector-parser') | ||
function parse (str) { | ||
function parse (str, rule) { | ||
var nodes | ||
@@ -9,3 +9,11 @@ var saver = parser(function (parsed) { | ||
}) | ||
saver.processSync(str) | ||
try { | ||
saver.processSync(str) | ||
} catch (e) { | ||
if (str.indexOf(':') !== -1) { | ||
throw rule ? rule.error('Missed semicolon') : e | ||
} else { | ||
throw rule ? rule.error(e.message) : e | ||
} | ||
} | ||
return nodes.at(0) | ||
@@ -37,6 +45,6 @@ } | ||
parent.selectors.forEach(function (i) { | ||
var parentNode = parse(i) | ||
var parentNode = parse(i, parent) | ||
child.selectors.forEach(function (j) { | ||
var node = parse(j) | ||
var node = parse(j, child) | ||
var replaced = replace(node, parentNode) | ||
@@ -43,0 +51,0 @@ if (!replaced) { |
{ | ||
"name": "postcss-nested", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "PostCSS plugin to unwrap nested rules like how Sass does it", | ||
@@ -16,5 +16,5 @@ "keywords": [ | ||
"dependencies": { | ||
"postcss": "^7.0.6", | ||
"postcss-selector-parser": "^5.0.0-rc.4" | ||
"postcss": "^7.0.14", | ||
"postcss-selector-parser": "^5.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10204
145
Updatedpostcss@^7.0.14