Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd2ec7e

Browse files
committed
fix: broken when PostCSS >= 8.4.6
1 parent b585b23 commit dd2ec7e

File tree

5 files changed

+15
-33
lines changed

5 files changed

+15
-33
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ function transform(rule) {
6060
return
6161
}
6262

63+
// In PostCSS version 8.4.6, this will contain comments that need to be removed manually
64+
rule.params = rule.params.replace(/\/\*.*\*\//gs, '')
65+
6366
// The value doesn't support negative values
6467
// But -0 is always equivalent to 0 in CSS, and so is also accepted as a valid <mq-boolean> value.
65-
6668
rule.params = rule.params.replace(/\(\s*([a-z-]+?)\s*([<>])(=?)\s*((?:-?\d*\.?(?:\s*\/?\s*)?\d+[a-z]*)?)\s*\)/gi, function($0, $1, $2, $3, $4) {
6769
if (feature_name.indexOf($1) > -1) {
6870
return create_query($1, $2, $3, $4);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"node": ">=10.0.0"
2828
},
2929
"peerDependencies": {
30-
"postcss": "8.4.5"
30+
"postcss": "8.4.6"
3131
},
3232
"devDependencies": {
33-
"postcss": "8.4.5",
33+
"postcss": "8.4.6",
3434
"tape": "^5.3.1"
3535
}
3636
}

test/fixtures/comment.css

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
@media screen and /* comment */ (/* comment */width >= 500px) /* comment */ and (width/* comment */ <= 1200px) /* comment */{
2-
.bar {
3-
display: block;
4-
}
5-
}
6-
7-
@media screen and /* comment */(500px/* comment */ <= /* comment */width <= 1200px/* comment */) /* comment */{
8-
.bar {
9-
display: block;
10-
}
11-
}
1+
@media screen and /* comment */ (/* comment */width >= 500px /* comment */) /* comment */ and (width/* comment */ <= 1200px) /* comment */{}

test/fixtures/comment.output.css

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
@media screen and (min-width: 500px) and (max-width: 1200px) /* comment */{
2-
.bar {
3-
display: block;
4-
}
5-
}
6-
7-
@media screen and (min-width: 500px) and (max-width: 1200px) /* comment */{
8-
.bar {
9-
display: block;
10-
}
11-
}
1+
@media screen and (min-width: 500px) and (max-width: 1200px) /* comment */{}

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ minimist@^1.2.6:
504504
resolved "https://registry.npmmirror.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
505505
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
506506

507-
nanoid@^3.1.30:
507+
nanoid@^3.2.0:
508508
version "3.3.4"
509509
resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
510510
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
@@ -564,14 +564,14 @@ picocolors@^1.0.0:
564564
resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
565565
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
566566

567-
568-
version "8.4.5"
569-
resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.5.tgz#bae665764dfd4c6fcc24dc0fdf7e7aa00cc77f95"
570-
integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==
567+
568+
version "8.4.6"
569+
resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.6.tgz#c5ff3c3c457a23864f32cb45ac9b741498a09ae1"
570+
integrity sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==
571571
dependencies:
572-
nanoid "^3.1.30"
572+
nanoid "^3.2.0"
573573
picocolors "^1.0.0"
574-
source-map-js "^1.0.1"
574+
source-map-js "^1.0.2"
575575

576576
regexp.prototype.flags@^1.3.0:
577577
version "1.3.1"
@@ -614,7 +614,7 @@ side-channel@^1.0.3, side-channel@^1.0.4:
614614
get-intrinsic "^1.0.2"
615615
object-inspect "^1.9.0"
616616

617-
source-map-js@^1.0.1:
617+
source-map-js@^1.0.2:
618618
version "1.0.2"
619619
resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
620620
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==

0 commit comments

Comments
 (0)