postcss-value-parser
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -42,6 +42,10 @@ var openParentheses = '('.charCodeAt(0); | ||
prev.after = token; | ||
} else if (code === slash && value.charCodeAt(next + 1) !== star || code === comma || code === colon) { | ||
} else if (code === comma || code === colon || code === slash && value.charCodeAt(next + 1) !== star) { | ||
before = token; | ||
} else { | ||
tokens.push({ type: 'space', sourceIndex: pos, value: token }); | ||
tokens.push({ | ||
type: 'space', | ||
sourceIndex: pos, | ||
value: token | ||
}); | ||
} | ||
@@ -55,3 +59,7 @@ | ||
quote = code === singleQuote ? '\'' : '"'; | ||
token = { type: 'string', sourceIndex: pos, quote: quote }; | ||
token = { | ||
type: 'string', | ||
sourceIndex: pos, | ||
quote: quote | ||
}; | ||
do { | ||
@@ -80,3 +88,6 @@ escape = false; | ||
} else if (code === slash && value.charCodeAt(pos + 1) === star) { | ||
token = { type: 'comment', sourceIndex: pos}; | ||
token = { | ||
type: 'comment', | ||
sourceIndex: pos | ||
}; | ||
@@ -86,3 +97,3 @@ next = value.indexOf('*/', pos); | ||
token.unclosed = true; | ||
next = value.length; | ||
next = value.length; | ||
} | ||
@@ -92,3 +103,3 @@ | ||
tokens.push(token); | ||
pos = next + 2; | ||
@@ -101,3 +112,9 @@ code = value.charCodeAt(pos); | ||
tokens.push({ type: 'div', sourceIndex: pos - before.length, value: token, before: before, after: '' }); | ||
tokens.push({ | ||
type: 'div', | ||
sourceIndex: pos - before.length, | ||
value: token, | ||
before: before, | ||
after: '' | ||
}); | ||
before = ''; | ||
@@ -116,6 +133,11 @@ | ||
} while (code <= 32); | ||
token = { type: 'function', sourceIndex: pos - name.length, value: name, before: value.slice(pos + 1, next) }; | ||
token = { | ||
type: 'function', | ||
sourceIndex: pos - name.length, | ||
value: name, | ||
before: value.slice(pos + 1, next) | ||
}; | ||
pos = next; | ||
if (name === 'url' && code !== singleQuote && code !== doubleQuote && (code !== slash || value.charCodeAt(pos + 1) !== star)) { | ||
if (name === 'url' && code !== singleQuote && code !== doubleQuote) { | ||
next -= 1; | ||
@@ -144,3 +166,7 @@ do { | ||
if (pos !== whitespacePos + 1) { | ||
token.nodes = [{ type: 'word', sourceIndex: pos, value: value.slice(pos, whitespacePos + 1) }]; | ||
token.nodes = [{ | ||
type: 'word', | ||
sourceIndex: pos, | ||
value: value.slice(pos, whitespacePos + 1) | ||
}]; | ||
} else { | ||
@@ -151,3 +177,7 @@ token.nodes = []; | ||
token.after = ''; | ||
token.nodes.push({ type: 'space', sourceIndex: whitespacePos + 1, value: value.slice(whitespacePos + 1, next) }); | ||
token.nodes.push({ | ||
type: 'space', | ||
sourceIndex: whitespacePos + 1, | ||
value: value.slice(whitespacePos + 1, next) | ||
}); | ||
} else { | ||
@@ -192,5 +222,9 @@ token.after = value.slice(whitespacePos + 1, next); | ||
code <= 32 || | ||
code === singleQuote || code === doubleQuote || | ||
code === slash && value.charCodeAt(next + 1) !== star || code === comma || code === colon || | ||
code === openParentheses || code === closeParentheses && balanced | ||
code === singleQuote || | ||
code === doubleQuote || | ||
code === comma || | ||
code === colon || | ||
code === slash && value.charCodeAt(next + 1) !== star || | ||
code === openParentheses || | ||
code === closeParentheses && balanced | ||
)); | ||
@@ -202,3 +236,7 @@ token = value.slice(pos, next); | ||
} else { | ||
tokens.push({ type: 'word', sourceIndex: pos, value: token }); | ||
tokens.push({ | ||
type: 'word', | ||
sourceIndex: pos, | ||
value: token | ||
}); | ||
} | ||
@@ -205,0 +243,0 @@ |
{ | ||
"name": "postcss-value-parser", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Transforms css values and at-rule params into the tree", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
19997
323