Skip to content

Commit bc9db85

Browse files
Build(deps): Bump postcss-less from 3.1.4 to 4.0.0 (#9471)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: fisker <[email protected]>
1 parent fb07399 commit bc9db85

11 files changed

Lines changed: 136 additions & 42 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
6767
"please-upgrade-node": "3.2.0",
6868
"postcss": "8.1.3",
69-
"postcss-less": "3.1.4",
69+
"postcss-less": "4.0.0",
7070
"postcss-media-query-parser": "0.2.3",
7171
"postcss-scss": "3.0.2",
7272
"postcss-selector-parser": "2.2.3",

src/language-css/parser-postcss.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ function parseNestedCSS(node, options) {
302302

303303
// Custom properties looks like declarations
304304
if (
305-
(options.parser === "css" || options.parser === "scss") &&
306305
node.type === "css-decl" &&
307306
typeof node.prop === "string" &&
308307
node.prop.startsWith("--") &&
@@ -325,7 +324,9 @@ function parseNestedCSS(node, options) {
325324
let parse;
326325
if (options.parser === "scss") {
327326
parse = parseScss;
328-
} else if (options.parser === "css") {
327+
} else if (options.parser === "less") {
328+
parse = parseLess;
329+
} else {
329330
parse = parseCss;
330331
}
331332
let ast;

tests/less/comments/__snapshots__/jsfmt.spec.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,11 @@ printWidth: 80
386386
/* custom properties set & @apply rule */
387387
:root {
388388
/* comments 192 */
389-
--centered /* comments 193 */ : /* comments 194 */ {
389+
--centered/* comments 193 */ : /* comments 194 */ {
390390
display: flex;
391391
align-items: center;
392392
justify-content: center;
393-
}
393+
};
394394
}
395395
396396
================================================================================

tests/less/custom-properties/__snapshots__/jsfmt.spec.js.snap

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ printWidth: 80
2323
--without-semi: {color:red;}
2424
}
2525
26+
:root {
27+
--like-a-apply-rule: {
28+
color:red;} /* no semi here*/
29+
--another-prop: blue;
30+
}
31+
32+
:root {
33+
--like-a-apply-rule: {
34+
color:red;} /* no semi here*/
35+
--another-one-like-a-apply-rule: {
36+
color:red;
37+
};
38+
}
39+
2640
=====================================output=====================================
2741
/* http://tabatkins.github.io/specs/css-apply-rule/#defining */
2842
@@ -31,16 +45,30 @@ printWidth: 80
3145
background-color: hsl(120, 70%, 95%);
3246
border-radius: 4px;
3347
border: 1px solid var(--theme-color late);
34-
}
48+
};
3549
--toolbar-title-theme: {
3650
color: green;
37-
}
51+
};
3852
}
3953
4054
:root {
4155
--without-semi: {
4256
color: red;
43-
}
57+
};
58+
}
59+
60+
:root {
61+
--like-a-apply-rule: {
62+
color:red;} /* no semi here*/
63+
--another-prop: blue;
64+
}
65+
66+
:root {
67+
--like-a-apply-rule: {
68+
color:red;} /* no semi here*/
69+
--another-one-like-a-apply-rule: {
70+
color:red;
71+
};
4472
}
4573
4674
================================================================================

tests/less/custom-properties/apply-rule.less

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,17 @@
1414
:root {
1515
--without-semi: {color:red;}
1616
}
17+
18+
:root {
19+
--like-a-apply-rule: {
20+
color:red;} /* no semi here*/
21+
--another-prop: blue;
22+
}
23+
24+
:root {
25+
--like-a-apply-rule: {
26+
color:red;} /* no semi here*/
27+
--another-one-like-a-apply-rule: {
28+
color:red;
29+
};
30+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`empty-props.less format 1`] = `
4+
====================================options=====================================
5+
parsers: ["less"]
6+
printWidth: 80
7+
| printWidth
8+
=====================================input======================================
9+
:root {
10+
--empty:;
11+
--one-space: ;
12+
--two-space: ;
13+
--many-space: ;
14+
}
15+
16+
=====================================output=====================================
17+
:root {
18+
--empty:;
19+
--one-space: ;
20+
--two-space: ;
21+
--many-space: ;
22+
}
23+
24+
================================================================================
25+
`;
26+
27+
exports[`test.less format 1`] = `
28+
====================================options=====================================
29+
parsers: ["less"]
30+
printWidth: 80
31+
| printWidth
32+
=====================================input======================================
33+
/*
34+
This test is copied from \`postcss@8\` release note
35+
36+
https://github.com/postcss/postcss/releases/tag/8.0.0
37+
*/
38+
39+
:root {
40+
--empty: ;
41+
--JSON: [1, "2", {"three": {"a":1}}, [4]];
42+
--javascript: function(rule) { console.log(rule) };
43+
}
44+
45+
@supports (--element(".minwidth", { "minWidth": 300 })) {
46+
[--self] {
47+
background: greenyellow;
48+
}
49+
}
50+
51+
=====================================output=====================================
52+
/*
53+
This test is copied from \`postcss@8\` release note
54+
55+
https://github.com/postcss/postcss/releases/tag/8.0.0
56+
*/
57+
58+
:root {
59+
--empty: ;
60+
--JSON: [1, "2", {"three": {"a": 1}}, [4]];
61+
--javascript: function(rule) {console.log(rule)};
62+
}
63+
64+
@supports (--element(".minwidth", {"minWidth": 300})) {
65+
[--self] {
66+
background: greenyellow;
67+
}
68+
}
69+
70+
================================================================================
71+
`;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:root {
2+
--empty:;
3+
--one-space: ;
4+
--two-space: ;
5+
--many-space: ;
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
run_spec(__dirname, ["less"]);
File renamed without changes.

tests/misc/errors/less/__snapshots__/jsfmt.spec.js.snap

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ exports[`open-sigle-quote.less error test 1`] = `
2929
4 | "
3030
`;
3131
32-
exports[`postcss-8-improment.less error test 1`] = `
33-
"CssSyntaxError: Missed semicolon (9:20)
34-
7 | :root {
35-
8 | --empty: ;
36-
> 9 | --JSON: [1, \\"2\\", {\\"three\\": {\\"a\\":1}}, [4]];
37-
| ^
38-
10 | --javascript: function(rule) { console.log(rule) };
39-
11 | }
40-
12 | "
41-
`;
42-
4332
exports[`scss-syntax.scss error test 1`] = `
4433
"CssSyntaxError: Unknown word (1:15)
4534
> 1 | a {content: #{$foo}}

0 commit comments

Comments
 (0)