Skip to content

Commit 97031f9

Browse files
committed
Turbopack: Implement bincode Encode/Decode traits on all turbo task values
1 parent dfc51d0 commit 97031f9

File tree

181 files changed

+2641
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+2641
-480
lines changed

Cargo.lock

Lines changed: 39 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,12 @@ serde_bytes = "0.11.15"
451451
serde_path_to_error = "0.1.16"
452452
serde_qs = "0.13.0"
453453
serde_with = "3.12.0"
454-
smallvec = { version = "1.13.1", features = [
454+
smallvec = { version = "1.15.1", features = [
455455
"serde",
456456
"const_generics",
457457
"union",
458458
"const_new",
459+
"impl_bincode",
459460
] }
460461
swc_sourcemap = "9.3.4"
461462
strsim = "0.11.1"
@@ -481,4 +482,5 @@ inventory = "0.3.21"
481482

482483
[patch.crates-io]
483484
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
485+
virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" }
484486
mdxjs = { git = "https://github.com/mischnic/mdxjs-rs.git", branch = "swc-core-32" }

crates/napi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ignored = [
5656

5757
[dependencies]
5858
anyhow = { workspace = true }
59+
bincode = { workspace = true }
5960
console-subscriber = { workspace = true, optional = true }
6061
dhat = { workspace = true, optional = true }
6162
either = { workspace = true }

crates/napi/src/next_api/project.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{borrow::Cow, io::Write, path::PathBuf, sync::Arc, thread, time::Duration};
22

33
use anyhow::{Context, Result, anyhow, bail};
4+
use bincode::{Decode, Encode};
45
use flate2::write::GzEncoder;
56
use futures_util::TryFutureExt;
67
use napi::{
@@ -1528,6 +1529,8 @@ pub fn project_compilation_events_subscribe(
15281529
Serialize,
15291530
TaskInput,
15301531
TraceRawVcs,
1532+
Encode,
1533+
Decode,
15311534
)]
15321535
pub struct StackFrame {
15331536
pub is_server: bool,

crates/next-api/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ workspace = true
1414

1515
[dependencies]
1616
anyhow = { workspace = true }
17+
bincode = { workspace = true }
1718
byteorder = { workspace = true }
1819
either = { workspace = true }
1920
futures = { workspace = true }
@@ -26,6 +27,7 @@ serde = { workspace = true }
2627
serde_json = { workspace = true }
2728
swc_core = { workspace = true }
2829
tracing = { workspace = true }
30+
turbo-bincode = { workspace = true }
2931
turbo-rcstr = { workspace = true }
3032
turbo-tasks = { workspace = true }
3133
turbo-tasks-hash = { workspace = true }

crates/next-api/src/app.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use anyhow::{Context, Result, bail};
2+
use bincode::{Decode, Encode};
23
use next_core::{
34
app_structure::{
45
AppPageLoaderTree, CollectedRootParams, Entrypoint as AppEntrypoint,
@@ -1068,13 +1069,27 @@ pub fn app_entry_point_to_route(
10681069
#[turbo_tasks::value(transparent)]
10691070
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
10701071

1071-
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1072+
#[derive(
1073+
Copy,
1074+
Clone,
1075+
Serialize,
1076+
Deserialize,
1077+
PartialEq,
1078+
Eq,
1079+
Debug,
1080+
TraceRawVcs,
1081+
NonLocalValue,
1082+
Encode,
1083+
Decode,
1084+
)]
10721085
enum AppPageEndpointType {
10731086
Html,
10741087
Rsc,
10751088
}
10761089

1077-
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1090+
#[derive(
1091+
Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode,
1092+
)]
10781093
enum AppEndpointType {
10791094
Page {
10801095
ty: AppPageEndpointType,

0 commit comments

Comments
 (0)