You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,22 @@
2
2
3
3
## Unreleased
4
4
5
+
* Update how CSS nesting is parsed again
6
+
7
+
CSS nesting syntax has been changed again, and esbuild has been updated to match. Type selectors may now be used with CSS nesting:
8
+
9
+
```css
10
+
.foo {
11
+
div {
12
+
color: red;
13
+
}
14
+
}
15
+
```
16
+
17
+
Previously this was disallowed in the CSS specification because it's ambiguous whether an identifier is a declaration or a nested rule starting with a type selector without requiring unbounded lookahead in the parser. It has now been allowed because the CSS working group has decided that requiring unbounded lookahead is acceptible after all.
18
+
19
+
Note that this change means esbuild no longer considers any existing browser to support CSS nesting since none of the existing browsers support this new syntax. CSS nesting will now always be transformed when targeting a browser. This situation will change in the future as browsers add support for this new syntax.
20
+
5
21
* Make renamed CSS names unique across entry points ([#3295](https://github.com/evanw/esbuild/issues/3295))
6
22
7
23
Previously esbuild's generated names for local names in CSS were only unique within a given entry point (or across all entry points when code splitting was enabled). That meant that building multiple entry points with esbuild could result in local names being renamed to the same identifier even when those entry points were built simultaneously within a single esbuild API call. This problem was especially likely to happen with minification enabled. With this release, esbuild will now avoid renaming local names from two separate entry points to the same name if those entry points were built with a single esbuild API call, even when code splitting is disabled.
expectPrinted(t, ".decl { a { b: c; } }", ".decl {\n a { b: c; };\n}\n",
604
-
"<stdin>: WARNING: A nested style rule cannot start with \"a\" because it looks like the start of a declaration\n"+
605
-
"NOTE: To start a nested style rule with an identifier, you need to wrap the identifier in \":is(...)\" to prevent the rule from being parsed as a declaration.\n")
603
+
expectPrinted(t, ".decl { a { b: c; } }", ".decl {\n a {\n b: c;\n }\n}\n", "")
606
604
expectPrinted(t, ".decl { & a { b: c; } }", ".decl {\n & a {\n b: c;\n }\n}\n", "")
expectPrinted(t, "a { >b {} }", "a {\n > b {\n }\n}\n", "")
792
788
expectPrinted(t, "a { +b {} }", "a {\n + b {\n }\n}\n", "")
793
789
expectPrinted(t, "a { ~b {} }", "a {\n ~ b {\n }\n}\n", "")
794
-
expectPrinted(t, "a { b {} }", "a {\n b {};\n}\n",
795
-
"<stdin>: WARNING: A nested style rule cannot start with \"b\" because it looks like the start of a declaration\n"+
796
-
"NOTE: To start a nested style rule with an identifier, you need to wrap the identifier in \":is(...)\" to prevent the rule from being parsed as a declaration.\n")
797
-
expectPrinted(t, "a { b() {} }", "a {\n b() {};\n}\n", "<stdin>: WARNING: Expected identifier but found \"b(\"\n")
790
+
expectPrinted(t, "a { b {} }", "a {\n b {\n }\n}\n", "")
791
+
expectPrinted(t, "a { b() {} }", "a {\n b() {\n }\n}\n", "<stdin>: WARNING: Unexpected \"b(\"\n")
798
792
799
793
// Note: CSS nesting no longer requires each complex selector to contain "&"
800
794
expectPrinted(t, "a { & b, c {} }", "a {\n & b,\n c {\n }\n}\n", "")
expectPrinted(t, "a { div.major { color: blue } color: red }", "a {\n div.major { color: blue } color: red;\n}\n",
1043
-
"<stdin>: WARNING: A nested style rule cannot start with \"div\" because it looks like the start of a declaration\n"+
1044
-
"NOTE: To start a nested style rule with an identifier, you need to wrap the identifier in \":is(...)\" to prevent the rule from being parsed as a declaration.\n")
1045
-
expectPrinted(t, "a { div:hover { color: blue } color: red }", "a {\n div: hover { color: blue } color: red;\n}\n", "")
1046
-
expectPrinted(t, "a { div:hover { color: blue }; color: red }", "a {\n div: hover { color: blue };\n color: red;\n}\n", "")
1047
-
expectPrinted(t, "a { div:hover { color: blue } ; color: red }", "a {\n div: hover { color: blue };\n color: red;\n}\n", "")
"<stdin>: WARNING: Expected identifier but found whitespace\n<stdin>: WARNING: Expected \"}\" to go with \"{\"\n<stdin>: NOTE: The unbalanced \"{\" is here:\n")
2255
2253
expectPrinted(t, "x { y: z(", "x {\n y: z();\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n")
2256
2254
expectPrinted(t, "x { y: z(abc", "x {\n y: z(abc);\n}\n", "<stdin>: WARNING: Expected \")\" to go with \"(\"\n<stdin>: NOTE: The unbalanced \"(\" is here:\n")
0 commit comments