Skip to content

Commit f46bb43

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

File tree

180 files changed

+2570
-433
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

+2570
-433
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"
@@ -484,4 +485,5 @@ inventory = "0.3.21"
484485

485486
[patch.crates-io]
486487
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }
488+
virtue = { git = "https://github.com/bgw/virtue.git", branch = "bgw/fix-generic-default-parsing" }
487489
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,
@@ -1036,13 +1037,27 @@ pub fn app_entry_point_to_route(
10361037
#[turbo_tasks::value(transparent)]
10371038
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
10381039

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

1045-
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue)]
1058+
#[derive(
1059+
Clone, Serialize, Deserialize, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode,
1060+
)]
10461061
enum AppEndpointType {
10471062
Page {
10481063
ty: AppPageEndpointType,

0 commit comments

Comments
 (0)