postcss 8.4.6 → 8.4.9
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.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/lib/node.d.ts +2 -2
- package/lib/parser.js +25 -5
- package/lib/processor.js +1 -1
- package/package.json +12 -6
package/lib/node.d.ts
CHANGED
@@ -3,7 +3,7 @@ import Comment, { CommentProps } from './comment.js'
|
|
3
3
|
import { Stringifier, Syntax } from './postcss.js'
|
4
4
|
import AtRule, { AtRuleProps } from './at-rule.js'
|
5
5
|
import Rule, { RuleProps } from './rule.js'
|
6
|
-
import { WarningOptions } from './warning.js'
|
6
|
+
import Warning, { WarningOptions } from './warning.js'
|
7
7
|
import CssSyntaxError from './css-syntax-error.js'
|
8
8
|
import Result from './result.js'
|
9
9
|
import Input from './input.js'
|
@@ -241,7 +241,7 @@ export default abstract class Node {
|
|
241
241
|
*
|
242
242
|
* @return Created warning object.
|
243
243
|
*/
|
244
|
-
warn(result: Result, text: string, opts?: WarningOptions):
|
244
|
+
warn(result: Result, text: string, opts?: WarningOptions): Warning
|
245
245
|
|
246
246
|
/**
|
247
247
|
* Removes the node from its parent and cleans the parent properties
|
package/lib/parser.js
CHANGED
@@ -7,6 +7,19 @@ let AtRule = require('./at-rule')
|
|
7
7
|
let Root = require('./root')
|
8
8
|
let Rule = require('./rule')
|
9
9
|
|
10
|
+
const SAFE_COMMENT_NEIGHBOR = {
|
11
|
+
empty: true,
|
12
|
+
space: true
|
13
|
+
}
|
14
|
+
|
15
|
+
function findLastWithPosition(tokens) {
|
16
|
+
for (let i = tokens.length - 1; i >= 0; i--) {
|
17
|
+
let token = tokens[i]
|
18
|
+
let pos = token[3] || token[2]
|
19
|
+
if (pos) return pos
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
10
23
|
class Parser {
|
11
24
|
constructor(input) {
|
12
25
|
this.input = input
|
@@ -172,7 +185,10 @@ class Parser {
|
|
172
185
|
this.semicolon = true
|
173
186
|
tokens.pop()
|
174
187
|
}
|
175
|
-
|
188
|
+
|
189
|
+
node.source.end = this.getPosition(
|
190
|
+
last[3] || last[2] || findLastWithPosition(tokens)
|
191
|
+
)
|
176
192
|
|
177
193
|
while (tokens[0][0] !== 'word') {
|
178
194
|
if (tokens.length === 1) this.unknownWord(tokens)
|
@@ -418,10 +434,14 @@ class Parser {
|
|
418
434
|
if (type === 'space' && i === length - 1 && !customProperty) {
|
419
435
|
clean = false
|
420
436
|
} else if (type === 'comment') {
|
421
|
-
prev = tokens[i - 1]
|
422
|
-
next = tokens[i + 1]
|
423
|
-
if (prev &&
|
424
|
-
value
|
437
|
+
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
|
438
|
+
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
|
439
|
+
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
|
440
|
+
if (value.slice(-1) === ',') {
|
441
|
+
clean = false
|
442
|
+
} else {
|
443
|
+
value += token[1]
|
444
|
+
}
|
425
445
|
} else {
|
426
446
|
clean = false
|
427
447
|
}
|
package/lib/processor.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "postcss",
|
3
|
-
"version": "8.4.
|
3
|
+
"version": "8.4.9",
|
4
4
|
"description": "Tool for transforming styles with JS plugins",
|
5
5
|
"engines": {
|
6
6
|
"node": "^10 || ^12 || >=14"
|
@@ -53,10 +53,16 @@
|
|
53
53
|
"manipulation",
|
54
54
|
"transpiler"
|
55
55
|
],
|
56
|
-
"funding":
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
"funding": [
|
57
|
+
{
|
58
|
+
"type": "opencollective",
|
59
|
+
"url": "https://opencollective.com/postcss/"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type": "tidelift",
|
63
|
+
"url": "https://tidelift.com/funding/github/npm/postcss"
|
64
|
+
}
|
65
|
+
],
|
60
66
|
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
61
67
|
"license": "MIT",
|
62
68
|
"homepage": "https://postcss.org/",
|
@@ -65,7 +71,7 @@
|
|
65
71
|
"url": "https://github.com/postcss/postcss/issues"
|
66
72
|
},
|
67
73
|
"dependencies": {
|
68
|
-
"nanoid": "^3.
|
74
|
+
"nanoid": "^3.3.1",
|
69
75
|
"picocolors": "^1.0.0",
|
70
76
|
"source-map-js": "^1.0.2"
|
71
77
|
},
|