Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbopack: Implement structured styled text and use it in issue descriptions #6388

Merged
merged 16 commits into from
Nov 14, 2023

Conversation

wbinnssmith
Copy link
Member

This implements a basic structure representing styled text and uses it in issue descriptions. This can be used by the cli and web-based error reporting.

Tested with an upcoming Next.js PR

…iptions

This implements a basic structure representing styled text and uses it in issue descriptions. This can be used by the cli and web-based error reporting.

Tested with an upcoming Next.js PR
Copy link

vercel bot commented Nov 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-kitchensink-blog 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 14, 2023 0:43am
examples-native-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 14, 2023 0:43am
examples-nonmonorepo 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 14, 2023 0:43am
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 14, 2023 0:43am
7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am
turbo-site ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 0:43am

@wbinnssmith wbinnssmith requested a review from a team as a code owner November 8, 2023 01:05
wbinnssmith added a commit to vercel/next.js that referenced this pull request Nov 8, 2023
Requires vercel/turbo#6388

This uses the structure implemented in vercel/turbo#6388 to support formatted text when reporting. Right now only the `Line` and basic `String` cases are handled.
@@ -73,6 +73,41 @@ impl Display for IssueSeverity {
}
}

#[derive(Clone, Debug)]
#[turbo_tasks::value(shared)]
pub enum StyledString {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not going to suggest to make any changes, just random thoughts that if we could just pass raw markdown or formatted text and consumer (next-swc) can transparently renders it'd be cool

Copy link
Contributor

github-actions bot commented Nov 8, 2023

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Nov 8, 2023

🟢 CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Nov 8, 2023

Linux Benchmark for 225461c

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 62.36ms ± 4.47ms 66.07ms ± 5.03ms +5.94%
bench_hmr_to_eval/Turbopack CSR/1000 modules 63.63ms ± 5.12ms 66.21ms ± 5.53ms +4.06%
bench_startup/Turbopack CSR/1000 modules 1047.27ms ± 1.95ms 1046.94ms ± 5.31ms -0.03%

Copy link
Contributor

github-actions bot commented Nov 8, 2023

🟢 Turbopack Benchmark CI successful 🟢

Thanks

crates/turbopack-core/src/issue/mod.rs Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
@@ -55,7 +56,7 @@ async fn get_update_stream_item(
plain_issues.push(
FatalStreamIssue {
resource: resource.to_string(),
description: Vc::cell(format!("{}", PrettyPrintError(&e))),
description: StyledString::String(format!("{}", PrettyPrintError(&e))).cell(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want a helper to pretty print an error directly into a styled string, so we can use formatting during pretty printing. But that's something for a follow-up PR

fn description(&self) -> Vc<String> {
Vc::cell(
fn description(&self) -> Vc<StyledString> {
StyledString::String(
"React Refresh will be disabled.\nTo enable React Refresh, install the \
`react-refresh` and `@next/react-refresh-utils` modules."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be nice to have a styled! macro that converts markdown to styled string. But that's probably a lot work...

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Copy link
Contributor

github-actions bot commented Nov 8, 2023

Linux Benchmark for 1a33186

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 66.00ms ± 5.26ms 66.08ms ± 5.23ms +0.12%
bench_hmr_to_eval/Turbopack CSR/1000 modules 66.90ms ± 4.96ms 65.23ms ± 5.46ms -2.49%
bench_startup/Turbopack CSR/1000 modules 1053.25ms ± 2.52ms 1058.43ms ± 9.94ms +0.49%

Copy link
Contributor

github-actions bot commented Nov 9, 2023

Linux Benchmark for 1ac43b8

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 22.09ms ± 0.90ms 22.05ms ± 0.87ms -0.18%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.73ms ± 0.79ms 21.49ms ± 0.85ms -1.09%
bench_startup/Turbopack CSR/1000 modules 1173.42ms ± 7.24ms 1177.38ms ± 14.75ms +0.34%

Copy link
Contributor

Linux Benchmark for 5a8c66d

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 21.49ms ± 0.83ms 21.56ms ± 0.82ms +0.29%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.29ms ± 0.80ms 21.33ms ± 0.87ms +0.16%
bench_startup/Turbopack CSR/1000 modules 1170.59ms ± 5.56ms 1183.91ms ± 16.68ms +1.14%

Copy link
Contributor

Linux Benchmark for ab7a6da

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 22.17ms ± 0.84ms 22.20ms ± 0.88ms +0.15%
bench_hmr_to_eval/Turbopack CSR/1000 modules 23.33ms ± 0.64ms 22.48ms ± 1.12ms -3.62%
bench_startup/Turbopack CSR/1000 modules 1179.97ms ± 7.68ms 1163.54ms ± 7.38ms -1.39%

crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
crates/turbopack-core/src/issue/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

Linux Benchmark for 680691c

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 21.75ms ± 0.87ms 21.65ms ± 0.87ms -0.46%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.27ms ± 0.83ms 21.63ms ± 0.62ms +1.70%
bench_startup/Turbopack CSR/1000 modules 1154.83ms ± 5.58ms 1179.34ms ± 16.00ms +2.12%

@wbinnssmith wbinnssmith merged commit 396a5c2 into main Nov 14, 2023
54 checks passed
@wbinnssmith wbinnssmith deleted the wbinnssmith/styled-string branch November 14, 2023 17:41
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Nov 15, 2023
Requires vercel/turbo#6388

This uses the structure implemented in vercel/turbo#6388 to support formatted text when reporting. Right now only the `Line` and basic `String` cases are handled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants