postcss-custom-media
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -0,1 +1,6 @@ | ||
# 5.0.1 - 2016-02-03 | ||
- Fixed: circular dependencies are properly detected | ||
([#17](https://github.com/postcss/postcss-custom-media/pull/17)) | ||
# 5.0.0 - 2015-08-25 | ||
@@ -2,0 +7,0 @@ |
26
index.js
@@ -8,7 +8,7 @@ var postcss = require("postcss") | ||
*/ | ||
function resolveValue(value, map, result) { | ||
if (!EXTENSION_RE.test(value)) { | ||
return value | ||
function resolveValue(query, depChain, map, result) { | ||
if (!EXTENSION_RE.test(query.value)) { | ||
return query.value | ||
} | ||
return value.replace(EXTENSION_RE, function(orig, name) { | ||
var val = query.value.replace(EXTENSION_RE, function(orig, name) { | ||
if (!map[name]) { | ||
@@ -23,10 +23,14 @@ return orig | ||
if (mq.deps.indexOf(name) !== -1) { | ||
if (depChain.indexOf(name) !== -1) { | ||
mq.circular = true | ||
return orig | ||
} | ||
mq.deps.push(name) | ||
mq.value = resolveValue(mq.value, map, result) | ||
depChain.push(name) | ||
mq.value = resolveValue(mq, depChain, map, result) | ||
return mq.value | ||
}) | ||
if (val === query.value) { | ||
query.circular = true | ||
} | ||
return val | ||
} | ||
@@ -66,3 +70,2 @@ | ||
value: params.join(" "), | ||
deps: [], | ||
circular: false, | ||
@@ -81,3 +84,2 @@ resolved: false, | ||
value: extensions[name], | ||
deps: [], | ||
circular: false, | ||
@@ -89,3 +91,3 @@ resolved: false, | ||
Object.keys(map).forEach(function(name) { | ||
map[name].value = resolveValue(map[name].value, map, result) | ||
map[name].value = resolveValue(map[name], [ name ], map, result) | ||
map[name].resolved = true | ||
@@ -106,3 +108,3 @@ }) | ||
"'. The entire rule has been removed from the output.", | ||
{node: rule} | ||
{ node: rule } | ||
) | ||
@@ -117,3 +119,3 @@ toRemove.push(rule) | ||
"'. The entire rule has been removed from the output.", | ||
{node: rule} | ||
{ node: rule } | ||
) | ||
@@ -120,0 +122,0 @@ toRemove.push(rule) |
{ | ||
"name": "postcss-custom-media", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "PostCSS plugin to transform W3C CSS Custom Media Queries to more compatible CSS", | ||
@@ -25,8 +25,16 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^1.0.0", | ||
"eslint": "^1.10.3", | ||
"eslint-config-i-am-meticulous": "^2.0.0", | ||
"npmpub": "^3.0.1", | ||
"tape": "^4.0.0" | ||
}, | ||
"scripts": { | ||
"test": "eslint . && tape test" | ||
"lint": "eslint --fix .", | ||
"tests": "tape test", | ||
"test": "npm run lint && npm run tests", | ||
"release": "npmpub" | ||
}, | ||
"eslintConfig": { | ||
"extends": "eslint-config-i-am-meticulous/es5" | ||
} | ||
} |
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
8755
131
4