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

refactor(turborepo): Bumping biome crates and moving to derive for deserialize #7875

Merged
merged 2 commits into from Apr 15, 2024

Conversation

NicholasLYang
Copy link
Contributor

@NicholasLYang NicholasLYang commented Apr 1, 2024

Description

Biome shipped a new derive for their Deserializable trait. This saves us from having to manually implement the trait, barring a few exceptions.

Testing Instructions

Closes TURBO-2740

Copy link

vercel bot commented Apr 1, 2024

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

Name Status Preview Comments Updated (UTC)
examples-basic-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
examples-gatsby-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
examples-native-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 3:22pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Apr 15, 2024 3:22pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Apr 15, 2024 3:22pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Apr 15, 2024 3:22pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Apr 15, 2024 3:22pm

Copy link
Contributor Author

NicholasLYang commented Apr 1, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @NicholasLYang and the rest of your teammates on Graphite Graphite

Copy link
Contributor

github-actions bot commented Apr 1, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Apr 1, 2024

🟢 CI successful 🟢

Thanks

Copy link
Contributor Author

@NicholasLYang NicholasLYang left a comment

Choose a reason for hiding this comment

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

Guide

#[serde(rename_all = "camelCase")]
pub struct SpacesJson {
pub id: Option<UnescapedString>,
#[serde(flatten)]
pub other: Option<serde_json::Value>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see this being used anywhere?

text: Option<Arc<str>>,
#[serde(skip)]
path: Option<Arc<str>>,
span: Spanned<()>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to change this because previous types wouldn't work well with derive.

#[serde(skip_serializing_if = "Spanned::is_none")]
cache: Spanned<Option<bool>>,
#[serde(skip_serializing_if = "Option::is_none")]
cache: Option<Spanned<bool>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above. Plays well with derive

@@ -802,6 +804,7 @@ mod tests {
&root_package_json,
false,
)?;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change


struct ConfigurationOptionsVisitor;

impl DeserializationVisitor for ConfigurationOptionsVisitor {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out we don't ever even use this!

@@ -199,7 +199,7 @@ mod tests {

#[test_case(Spanned { value: 10, range: Some(0..2), path: None, text: None }, "10")]
#[test_case(Spanned { value: "hello world", range: None, path: None, text: Some(Arc::from("hello world")) }, "\"hello world\"")]
#[test_case(Spanned { value: json!({ "name": "George", "age": 100 }), range: None, path: None, text: Some(Arc::from("hello world")) }, "{\"age\":100,\"name\":\"George\"}")]
#[test_case(Spanned { value: json!({ "name": "George", "age": 100 }), range: None, path: None, text: Some(Arc::from("hello world")) }, "{\"name\":\"George\",\"age\":100}")]
Copy link
Member

Choose a reason for hiding this comment

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

Huh, was serde sorting too?

@NicholasLYang NicholasLYang force-pushed the refactor/use-derive-for-deserializable branch from 841ad0f to 9d035d9 Compare April 15, 2024 15:11
@NicholasLYang NicholasLYang merged commit f5de1f9 into main Apr 15, 2024
54 checks passed
@NicholasLYang NicholasLYang deleted the refactor/use-derive-for-deserializable branch April 15, 2024 15:49
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

2 participants