Comparing version 8.4.5 to 8.4.6
@@ -81,5 +81,8 @@ 'use strict' | ||
this._root = root | ||
return root | ||
if (this.error) { | ||
throw this.error | ||
} else { | ||
this._root = root | ||
return root | ||
} | ||
} | ||
@@ -86,0 +89,0 @@ |
@@ -142,6 +142,8 @@ 'use strict' | ||
if (end && colon) { | ||
while (tokens.length) { | ||
token = tokens[tokens.length - 1][0] | ||
if (token !== 'space' && token !== 'comment') break | ||
this.tokenizer.back(tokens.pop()) | ||
if (!customProperty) { | ||
while (tokens.length) { | ||
token = tokens[tokens.length - 1][0] | ||
if (token !== 'space' && token !== 'comment') break | ||
this.tokenizer.back(tokens.pop()) | ||
} | ||
} | ||
@@ -212,3 +214,11 @@ this.decl(tokens, customProperty) | ||
} | ||
let firstSpaces = this.spacesAndCommentsFromStart(tokens) | ||
let firstSpaces = [] | ||
let next | ||
while (tokens.length) { | ||
next = tokens[0][0] | ||
if (next !== 'space' && next !== 'comment') break | ||
firstSpaces.push(tokens.shift()) | ||
} | ||
this.precheckMissedSemicolon(tokens) | ||
@@ -247,8 +257,8 @@ | ||
let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') | ||
this.raw(node, 'value', tokens) | ||
if (hasWord) { | ||
node.raws.between += firstSpaces | ||
} else { | ||
node.value = firstSpaces + node.value | ||
node.raws.between += firstSpaces.map(i => i[1]).join('') | ||
firstSpaces = [] | ||
} | ||
this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) | ||
@@ -401,3 +411,3 @@ if (node.value.includes(':') && !customProperty) { | ||
raw(node, prop, tokens) { | ||
raw(node, prop, tokens, customProperty) { | ||
let token, type | ||
@@ -408,3 +418,2 @@ let length = tokens.length | ||
let next, prev | ||
let pattern = /^([#.|])?(\w)+/i | ||
@@ -414,13 +423,8 @@ for (let i = 0; i < length; i += 1) { | ||
type = token[0] | ||
if (type === 'comment' && node.type === 'rule') { | ||
if (type === 'space' && i === length - 1 && !customProperty) { | ||
clean = false | ||
} else if (type === 'comment') { | ||
prev = tokens[i - 1] | ||
next = tokens[i + 1] | ||
if ( | ||
prev[0] !== 'space' && | ||
next[0] !== 'space' && | ||
pattern.test(prev[1]) && | ||
pattern.test(next[1]) | ||
) { | ||
if (prev && next && prev[0] !== 'space' && next[0] !== 'space') { | ||
value += token[1] | ||
@@ -430,8 +434,2 @@ } else { | ||
} | ||
continue | ||
} | ||
if (type === 'comment' || (type === 'space' && i === length - 1)) { | ||
clean = false | ||
} else { | ||
@@ -438,0 +436,0 @@ value += token[1] |
@@ -10,3 +10,3 @@ 'use strict' | ||
constructor(plugins = []) { | ||
this.version = '8.4.5' | ||
this.version = '8.4.6' | ||
this.plugins = this.normalize(plugins) | ||
@@ -13,0 +13,0 @@ } |
{ | ||
"name": "postcss", | ||
"version": "8.4.5", | ||
"version": "8.4.6", | ||
"description": "Tool for transforming styles with JS plugins", | ||
@@ -68,5 +68,5 @@ "engines": { | ||
"dependencies": { | ||
"nanoid": "^3.1.30", | ||
"nanoid": "^3.2.0", | ||
"picocolors": "^1.0.0", | ||
"source-map-js": "^1.0.1" | ||
"source-map-js": "^1.0.2" | ||
}, | ||
@@ -73,0 +73,0 @@ "browser": { |
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
185858
6489
Updatednanoid@^3.2.0
Updatedsource-map-js@^1.0.2