Skip to content

Commit 881a4c0

Browse files
committed
WIP: Turbopack: Implement bincode Encode/Decode traits on all turbo task values
1 parent de89eb5 commit 881a4c0

File tree

178 files changed

+2509
-429
lines changed

Some content is hidden

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

178 files changed

+2509
-429
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
@@ -456,11 +456,12 @@ serde_bytes = "0.11.15"
456456
serde_path_to_error = "0.1.16"
457457
serde_qs = "0.13.0"
458458
serde_with = "3.12.0"
459-
smallvec = { version = "1.13.1", features = [
459+
smallvec = { version = "1.15.1", features = [
460460
"serde",
461461
"const_generics",
462462
"union",
463463
"const_new",
464+
"impl_bincode",
464465
] }
465466
swc_sourcemap = "9.3.4"
466467
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::{
@@ -1493,6 +1494,8 @@ pub fn project_compilation_events_subscribe(
14931494
Serialize,
14941495
TaskInput,
14951496
TraceRawVcs,
1497+
Encode,
1498+
Decode,
14961499
)]
14971500
pub struct StackFrame {
14981501
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, features = ["non_operation_vc_strongly_consistent"] }
3133
turbo-tasks-env = { 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
all_assets_from_entries,
45
app_structure::{
@@ -1034,13 +1035,27 @@ pub fn app_entry_point_to_route(
10341035
#[turbo_tasks::value(transparent)]
10351036
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
10361037

1037-
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1038+
#[derive(
1039+
Copy,
1040+
Clone,
1041+
Serialize,
1042+
Deserialize,
1043+
PartialEq,
1044+
Eq,
1045+
Debug,
1046+
TraceRawVcs,
1047+
NonLocalValue,
1048+
Encode,
1049+
Decode,
1050+
)]
10381051
enum AppPageEndpointType {
10391052
Html,
10401053
Rsc,
10411054
}
10421055

1043-
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1056+
#[derive(
1057+
Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode,
1058+
)]
10441059
enum AppEndpointType {
10451060
Page {
10461061
ty: AppPageEndpointType,

0 commit comments

Comments
 (0)