Unverified Commit 69dd6a49 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

turbopack-css: ignore false-positive EndOfInput for name-only @container (#98261)

Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent 62005c33
...@@ -9664,6 +9664,7 @@ dependencies = [ ...@@ -9664,6 +9664,7 @@ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
"bincode", "bincode",
"cssparser",
"indoc", "indoc",
"lightningcss", "lightningcss",
"parcel_selectors", "parcel_selectors",
......
...@@ -16,6 +16,8 @@ workspace = true ...@@ -16,6 +16,8 @@ workspace = true
anyhow = { workspace = true } anyhow = { workspace = true }
async-trait = { workspace = true } async-trait = { workspace = true }
bincode = { workspace = true } bincode = { workspace = true }
# Must match the version used by `lightningcss`, so its parsers accept our `cssparser::Parser`.
cssparser = "0.37.0"
indoc = { workspace = true } indoc = { workspace = true }
lightningcss = { workspace = true } lightningcss = { workspace = true }
parcel_selectors = { workspace = true } parcel_selectors = { workspace = true }
......
/* /*
* https://github.com/vercel/next.js/issues/98261 * https://github.com/vercel/next.js/issues/98261
* *
* A name-only `@container <name>` rule is valid CSS, but with `error_recovery` * A name-only `@container <name>` rule is valid CSS. With `error_recovery`
* enabled lightningcss (1.0.0-alpha.72) still warns `EndOfInput` for the empty * enabled, lightningcss (1.0.0-alpha.72) reports a false-positive
* container condition, which is reported as a parse error issue. The rule itself * `EndOfInput` warning for it and keeps an empty condition. turbopack-css
* is kept in the output. Once lightningcss is fixed, the issue snapshot should * drops that warning and normalizes the condition, so this file must produce
* disappear. * no issue for it and print it as `@container scroll-content {`.
*/ */
@supports (container-type: inline-size scroll-state) { @supports (container-type: inline-size scroll-state) {
@container scroll-content { @container scroll-content {
...@@ -26,3 +26,16 @@ ...@@ -26,3 +26,16 @@
color: blue; color: blue;
} }
} }
/* Invalid container names must still be reported. */
@container none {
.reserved-name {
color: green;
}
}
@container inherit {
.css-wide-keyword {
color: green;
}
}
error - [parse] /turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css:11:28 Parsing CSS source code failed error - [parse] /turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css:37:10 Parsing CSS source code failed
7 | * is kept in the output. Once lightningcss is fixed, the issue snapshot should 33 | color: green;
8 | * disappear. 34 | }
9 | */ 35 | }
10 | @supports (container-type: inline-size scroll-state) { 36 |
+ v + v
11 + @container scroll-content { 37 + @container inherit {
+ ^ + ^
12 | .named-only { 38 | .css-wide-keyword {
13 | max-width: 100cqw; 39 | color: green;
14 | } 40 | }
15 | } 41 | }
Unexpected end of input Unexpected token Ident("inherit")
Import trace: Import trace:
test: test:
......
error - [parse] /turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css:31:10 Parsing CSS source code failed
27 | }
28 | }
29 |
30 | /* Invalid container names must still be reported. */
+ v
31 + @container none {
+ ^
32 | .reserved-name {
33 | color: green;
34 | }
35 | }
Unexpected token Ident("none")
Import trace:
test:
./turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css
./turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/index.js
\ No newline at end of file
/* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css [test] (css) */ /* [project]/turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css [test] (css) */
@supports (container-type: inline-size scroll-state) { @supports (container-type: inline-size scroll-state) {
@container scroll-content { @container scroll-content {
.named-only { .named-only {
max-width: 100cqw; max-width: 100cqw;
} }
...@@ -19,4 +19,16 @@ ...@@ -19,4 +19,16 @@
} }
} }
@container none {
.reserved-name {
color: green;
}
}
@container inherit {
.css-wide-keyword {
color: green;
}
}
/*# sourceMappingURL=1jsg_tests_snapshot_css_named-container-query_input_style_1i4y8ac_sk8d1.css.map*/ /*# sourceMappingURL=1jsg_tests_snapshot_css_named-container-query_input_style_1i4y8ac_sk8d1.css.map*/
\ No newline at end of file
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
"version": 3, "version": 3,
"sources": [], "sources": [],
"sections": [ "sections": [
{"offset": {"line": 1, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css"],"sourcesContent":["/*\n * https://github.com/vercel/next.js/issues/98261\n *\n * A name-only `@container <name>` rule is valid CSS, but with `error_recovery`\n * enabled lightningcss (1.0.0-alpha.72) still warns `EndOfInput` for the empty\n * container condition, which is reported as a parse error issue. The rule itself\n * is kept in the output. Once lightningcss is fixed, the issue snapshot should\n * disappear.\n */\n@supports (container-type: inline-size scroll-state) {\n @container scroll-content {\n .named-only {\n max-width: 100cqw;\n }\n }\n}\n\n@container sidebar (min-width: 400px) {\n .named-with-condition {\n color: red;\n }\n}\n\n@container scroll-state(scrollable: top) {\n .scroll-state {\n color: blue;\n }\n}\n"],"names":[],"mappings":"AASA;EACE;IACE;;;;;;AAMJ;EACE;;;;;AAKF;EACE"}}] {"offset": {"line": 1, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/named-container-query/input/style.css"],"sourcesContent":["/*\n * https://github.com/vercel/next.js/issues/98261\n *\n * A name-only `@container <name>` rule is valid CSS. With `error_recovery`\n * enabled, lightningcss (1.0.0-alpha.72) reports a false-positive\n * `EndOfInput` warning for it and keeps an empty condition. turbopack-css\n * drops that warning and normalizes the condition, so this file must produce\n * no issue for it and print it as `@container scroll-content {`.\n */\n@supports (container-type: inline-size scroll-state) {\n @container scroll-content {\n .named-only {\n max-width: 100cqw;\n }\n }\n}\n\n@container sidebar (min-width: 400px) {\n .named-with-condition {\n color: red;\n }\n}\n\n@container scroll-state(scrollable: top) {\n .scroll-state {\n color: blue;\n }\n}\n\n/* Invalid container names must still be reported. */\n@container none {\n .reserved-name {\n color: green;\n }\n}\n\n@container inherit {\n .css-wide-keyword {\n color: green;\n }\n}\n"],"names":[],"mappings":"AASA;EACE;IACE;;;;;;AAMJ;EACE;;;;;AAKF;EACE;;;;;AAMF;EACE;;;;;AAKF;EACE"}}]
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment