Skip to content

Commit 06d12f7

Browse files
committed
WIP: Turbopack: Implement bincode Encode/Decode traits on all turbo task values
1 parent c17d228 commit 06d12f7

File tree

180 files changed

+2625
-468
lines changed

Some content is hidden

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

180 files changed

+2625
-468
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
@@ -455,11 +455,12 @@ serde_bytes = "0.11.15"
455455
serde_path_to_error = "0.1.16"
456456
serde_qs = "0.13.0"
457457
serde_with = "3.12.0"
458-
smallvec = { version = "1.13.1", features = [
458+
smallvec = { version = "1.15.1", features = [
459459
"serde",
460460
"const_generics",
461461
"union",
462462
"const_new",
463+
"impl_bincode",
463464
] }
464465
swc_sourcemap = "9.3.4"
465466
strsim = "0.11.1"
@@ -485,4 +486,5 @@ inventory = "0.3.21"
485486

486487
[patch.crates-io]
487488
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
489+
virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" }
488490
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::{
@@ -1529,6 +1530,8 @@ pub fn project_compilation_events_subscribe(
15291530
Serialize,
15301531
TaskInput,
15311532
TraceRawVcs,
1533+
Encode,
1534+
Decode,
15321535
)]
15331536
pub struct StackFrame {
15341537
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,
@@ -1059,13 +1060,27 @@ pub fn app_entry_point_to_route(
10591060
#[turbo_tasks::value(transparent)]
10601061
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
10611062

1062-
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1063+
#[derive(
1064+
Copy,
1065+
Clone,
1066+
Serialize,
1067+
Deserialize,
1068+
PartialEq,
1069+
Eq,
1070+
Debug,
1071+
TraceRawVcs,
1072+
NonLocalValue,
1073+
Encode,
1074+
Decode,
1075+
)]
10631076
enum AppPageEndpointType {
10641077
Html,
10651078
Rsc,
10661079
}
10671080

1068-
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1081+
#[derive(
1082+
Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode,
1083+
)]
10691084
enum AppEndpointType {
10701085
Page {
10711086
ty: AppPageEndpointType,

0 commit comments

Comments
 (0)