rsnext/packages/next-swc
Will Binns-Smith 5926753a2f Issue Reporters (vercel/turbo#3707)
Big thanks to @jridgewell for helping me out with a number of Rust-isms
with this change.

This expands `handle_issues` and the `NextDevServerBuilder` to accept an
arbitrary `IssueReporter` -- a trait implementing `report_issues` which
receives captured issues to send somewhere.

This replaces using a fixed `ConsoleUi` to send issues to stdout/stderr,
though `ConsoleUi` now implements `IssueReporter` and is the default
implementation of an issue reporter if no other is provided. It also
moves the responsibility of detecting fatal errors out of `ConsoleUi`
and into `handle_issues` itself.

This lays the foundation for alternative reporters, such as a test
reporter to snapshot or assert against issues emitted, or a
newline-delimited JSON reporter for other tools to consume.

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

---------

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2023-02-13 08:07:19 -08:00
..
crates Issue Reporters (vercel/turbo#3707) 2023-02-13 08:07:19 -08:00