postcss 8.5.14 → 8.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/parser.js +36 -29
- package/lib/processor.js +1 -1
- package/package.json +2 -2
package/lib/parser.js
CHANGED
|
@@ -20,6 +20,12 @@ function findLastWithPosition(tokens) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function tokensToString(tokens, from, to) {
|
|
24
|
+
let result = ''
|
|
25
|
+
for (let i = from; i < to; i++) result += tokens[i][1]
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
class Parser {
|
|
24
30
|
constructor(input) {
|
|
25
31
|
this.input = input
|
|
@@ -132,9 +138,10 @@ class Parser {
|
|
|
132
138
|
if (founded === 2) break
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
|
-
// If the token is a word, e.g. `!important`, `red` or any other valid
|
|
136
|
-
// Then we need to return the colon after that word
|
|
137
|
-
//
|
|
141
|
+
// If the token is a word, e.g. `!important`, `red` or any other valid
|
|
142
|
+
// property's value. Then we need to return the colon after that word
|
|
143
|
+
// token. [3] is the "end" colon of that word. And because we need it
|
|
144
|
+
// after that one we do +1 to get the next one.
|
|
138
145
|
throw this.input.error(
|
|
139
146
|
'Missed semicolon',
|
|
140
147
|
token[0] === 'word' ? token[3] + 1 : token[2]
|
|
@@ -207,50 +214,50 @@ class Parser {
|
|
|
207
214
|
)
|
|
208
215
|
node.source.end.offset++
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
let start = 0
|
|
218
|
+
while (tokens[start][0] !== 'word') {
|
|
219
|
+
if (start === tokens.length - 1) this.unknownWord([tokens[start]])
|
|
220
|
+
start++
|
|
213
221
|
}
|
|
214
|
-
node.
|
|
222
|
+
node.raws.before += tokensToString(tokens, 0, start)
|
|
223
|
+
node.source.start = this.getPosition(tokens[start][2])
|
|
215
224
|
|
|
216
|
-
|
|
217
|
-
while (tokens.length) {
|
|
218
|
-
let type = tokens[
|
|
225
|
+
let propStart = start
|
|
226
|
+
while (start < tokens.length) {
|
|
227
|
+
let type = tokens[start][0]
|
|
219
228
|
if (type === ':' || type === 'space' || type === 'comment') {
|
|
220
229
|
break
|
|
221
230
|
}
|
|
222
|
-
|
|
231
|
+
start++
|
|
223
232
|
}
|
|
233
|
+
node.prop = tokensToString(tokens, propStart, start)
|
|
224
234
|
|
|
225
|
-
|
|
226
|
-
|
|
235
|
+
let betweenStart = start
|
|
227
236
|
let token
|
|
228
|
-
while (tokens.length) {
|
|
229
|
-
token = tokens
|
|
230
|
-
|
|
231
|
-
if (token[0] === ':')
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
} else {
|
|
235
|
-
if (token[0] === 'word' && /\w/.test(token[1])) {
|
|
236
|
-
this.unknownWord([token])
|
|
237
|
-
}
|
|
238
|
-
node.raws.between += token[1]
|
|
237
|
+
while (start < tokens.length) {
|
|
238
|
+
token = tokens[start]
|
|
239
|
+
start++
|
|
240
|
+
if (token[0] === ':') break
|
|
241
|
+
if (token[0] === 'word' && /\w/.test(token[1])) {
|
|
242
|
+
this.unknownWord([token])
|
|
239
243
|
}
|
|
240
244
|
}
|
|
245
|
+
node.raws.between = tokensToString(tokens, betweenStart, start)
|
|
241
246
|
|
|
242
247
|
if (node.prop[0] === '_' || node.prop[0] === '*') {
|
|
243
248
|
node.raws.before += node.prop[0]
|
|
244
249
|
node.prop = node.prop.slice(1)
|
|
245
250
|
}
|
|
246
251
|
|
|
247
|
-
let
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
next = tokens[0][0]
|
|
252
|
+
let firstSpacesStart = start
|
|
253
|
+
while (start < tokens.length) {
|
|
254
|
+
let next = tokens[start][0]
|
|
251
255
|
if (next !== 'space' && next !== 'comment') break
|
|
252
|
-
|
|
256
|
+
start++
|
|
253
257
|
}
|
|
258
|
+
let firstSpaces = tokens.slice(firstSpacesStart, start)
|
|
259
|
+
|
|
260
|
+
tokens = tokens.slice(start)
|
|
254
261
|
|
|
255
262
|
this.precheckMissedSemicolon(tokens)
|
|
256
263
|
|
package/lib/processor.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.15",
|
|
4
4
|
"description": "Tool for transforming styles with JS plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"./package.json": "./package.json"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"nanoid": "^3.3.
|
|
81
|
+
"nanoid": "^3.3.12",
|
|
82
82
|
"picocolors": "^1.1.1",
|
|
83
83
|
"source-map-js": "^1.2.1"
|
|
84
84
|
},
|