next.js
046e0c4a - turbopack-css: demote recoverable CSS parse warnings to Warning severity (#91524)

Commit
26 days ago
turbopack-css: demote recoverable CSS parse warnings to Warning severity (#91524) ### What? Extends the CSS parse warning severity improvements in `turbopack/crates/turbopack-css/src/process.rs`. Canary (#90025, #91513) already: - Added a `severity` field to `ParsingIssue` and a `fn severity()` override - Demoted `UnsupportedPseudoClass` / `UnsupportedPseudoElement` selector errors from `Error` to `Warning` - Still **silently dropped** all other unrecognized parser warning kinds (`_ => { // Ignore }`) This PR completes the work: 1. **Surfaces all previously-ignored parser warnings as `IssueSeverity::Warning`** — the `_ => { // Ignore }` arm now emits a `ParsingIssue` at `Warning` severity instead of discarding it. 2. **Refactors the warning loop** — the nested severity match inside the existing `match err.kind` arm is replaced with a single top-level `let severity = match err.kind { … }` followed by an unconditional emit. This is cleaner and makes the severity logic easier to follow. Hard parse/transform errors (`Err(e)` from `parse_css_stylesheet`, minify errors, CSS module pure-selector errors) are unchanged — they remain `IssueSeverity::Error`. ### Why? Silently dropping parser warnings hides useful diagnostic information from developers. Surfacing them as `Warning` gives visibility without marking the build as broken. The restructure also avoids a redundant `UnsupportedPseudoClass`/`UnsupportedPseudoElement` check inside a nested match — the top-level arm order (specific pseudo variants before the catch-all `SelectorError(..)`) handles precedence correctly. ### How? - Removed the now-unused `error::SelectorError` short import (fully-qualified paths are used in the match). - Replaced the `match err.kind { <arms that emit> … _ => { // Ignore } }` pattern with: 1. `let severity = match err.kind { UnsupportedPseudo* => Warning, hard errors => Error, _ => Warning };` 2. Unconditional `IssueSource` construction and `ParsingIssue { severity, … }.emit()`. Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
Author
Parents
Loading