Skip to content

Commit c9949cc

Browse files
committed
Turbopack: Remove automatic serde derives from #[turbo_tasks::value] macro
1 parent ac60040 commit c9949cc

File tree

52 files changed

+117
-617
lines changed

Some content is hidden

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

52 files changed

+117
-617
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/next-api/src/app.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use next_core::{
3434
segment_config::{NextSegmentConfig, ParseSegmentMode},
3535
util::{NextRuntime, app_function_name, module_styles_rule_condition, styles_rule_condition},
3636
};
37-
use serde::{Deserialize, Serialize};
3837
use tracing::Instrument;
3938
use turbo_rcstr::{RcStr, rcstr};
4039
use turbo_tasks::{
@@ -1069,27 +1068,13 @@ pub fn app_entry_point_to_route(
10691068
#[turbo_tasks::value(transparent)]
10701069
struct OutputAssetsWithAvailability((ResolvedVc<OutputAssets>, AvailabilityInfo));
10711070

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-
)]
1071+
#[derive(Copy, Clone, PartialEq, Eq, Debug, TraceRawVcs, NonLocalValue, Encode, Decode)]
10851072
enum AppPageEndpointType {
10861073
Html,
10871074
Rsc,
10881075
}
10891076

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

crates/next-api/src/versioned_content_map.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use anyhow::{Result, bail};
22
use bincode::{Decode, Encode};
33
use next_core::emit_assets;
44
use rustc_hash::{FxHashMap, FxHashSet};
5-
use serde::{Deserialize, Serialize};
65
use turbo_rcstr::RcStr;
76
use turbo_tasks::{
87
FxIndexSet, NonLocalValue, OperationValue, OperationVc, ResolvedVc, State, TryFlatJoinIterExt,
@@ -17,17 +16,7 @@ use turbopack_core::{
1716
};
1817

1918
#[derive(
20-
Clone,
21-
TraceRawVcs,
22-
PartialEq,
23-
Eq,
24-
ValueDebugFormat,
25-
Serialize,
26-
Deserialize,
27-
Debug,
28-
NonLocalValue,
29-
Encode,
30-
Decode,
19+
Clone, TraceRawVcs, PartialEq, Eq, ValueDebugFormat, Debug, NonLocalValue, Encode, Decode,
3120
)]
3221
struct MapEntry {
3322
assets_operation: OperationVc<ExpandedOutputAssets>,
@@ -42,17 +31,7 @@ unsafe impl OperationValue for MapEntry {}
4231
struct OptionMapEntry(Option<MapEntry>);
4332

4433
#[derive(
45-
Clone,
46-
TraceRawVcs,
47-
PartialEq,
48-
Eq,
49-
ValueDebugFormat,
50-
Serialize,
51-
Deserialize,
52-
Debug,
53-
NonLocalValue,
54-
Encode,
55-
Decode,
34+
Clone, TraceRawVcs, PartialEq, Eq, ValueDebugFormat, Debug, NonLocalValue, Encode, Decode,
5635
)]
5736
pub struct PathToOutputOperation(
5837
/// We need to use an operation for outputs as it's stored for later usage and we want to
@@ -71,8 +50,6 @@ pub struct PathToOutputOperation(
7150
PartialEq,
7251
Eq,
7352
ValueDebugFormat,
74-
Serialize,
75-
Deserialize,
7653
Debug,
7754
NonLocalValue,
7855
Encode,

crates/next-core/src/app_structure.rs

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use anyhow::{Context, Result, bail};
44
use bincode::{Decode, Encode};
55
use indexmap::map::{Entry, OccupiedEntry};
66
use rustc_hash::FxHashMap;
7-
use serde::{Deserialize, Serialize};
87
use tracing::Instrument;
98
use turbo_rcstr::{RcStr, rcstr};
109
use turbo_tasks::{
@@ -38,31 +37,18 @@ fn normalize_underscore(string: &str) -> String {
3837
#[turbo_tasks::value]
3938
#[derive(Default, Debug, Clone)]
4039
pub struct AppDirModules {
41-
#[serde(skip_serializing_if = "Option::is_none")]
4240
pub page: Option<FileSystemPath>,
43-
#[serde(skip_serializing_if = "Option::is_none")]
4441
pub layout: Option<FileSystemPath>,
45-
#[serde(skip_serializing_if = "Option::is_none")]
4642
pub error: Option<FileSystemPath>,
47-
#[serde(skip_serializing_if = "Option::is_none")]
4843
pub global_error: Option<FileSystemPath>,
49-
#[serde(skip_serializing_if = "Option::is_none")]
5044
pub global_not_found: Option<FileSystemPath>,
51-
#[serde(skip_serializing_if = "Option::is_none")]
5245
pub loading: Option<FileSystemPath>,
53-
#[serde(skip_serializing_if = "Option::is_none")]
5446
pub template: Option<FileSystemPath>,
55-
#[serde(skip_serializing_if = "Option::is_none")]
5647
pub forbidden: Option<FileSystemPath>,
57-
#[serde(skip_serializing_if = "Option::is_none")]
5848
pub unauthorized: Option<FileSystemPath>,
59-
#[serde(skip_serializing_if = "Option::is_none")]
6049
pub not_found: Option<FileSystemPath>,
61-
#[serde(skip_serializing_if = "Option::is_none")]
6250
pub default: Option<FileSystemPath>,
63-
#[serde(skip_serializing_if = "Option::is_none")]
6451
pub route: Option<FileSystemPath>,
65-
#[serde(skip_serializing_if = "Metadata::is_empty", default)]
6652
pub metadata: Metadata,
6753
}
6854

@@ -87,9 +73,7 @@ impl AppDirModules {
8773
}
8874

8975
/// A single metadata file plus an optional "alt" text file.
90-
#[derive(
91-
Clone, Debug, Serialize, Deserialize, PartialEq, Eq, TraceRawVcs, NonLocalValue, Encode, Decode,
92-
)]
76+
#[derive(Clone, Debug, PartialEq, Eq, TraceRawVcs, NonLocalValue, Encode, Decode)]
9377
pub enum MetadataWithAltItem {
9478
Static {
9579
path: FileSystemPath,
@@ -102,18 +86,7 @@ pub enum MetadataWithAltItem {
10286

10387
/// A single metadata file.
10488
#[derive(
105-
Clone,
106-
Debug,
107-
Hash,
108-
Serialize,
109-
Deserialize,
110-
PartialEq,
111-
Eq,
112-
TaskInput,
113-
TraceRawVcs,
114-
NonLocalValue,
115-
Encode,
116-
Decode,
89+
Clone, Debug, Hash, PartialEq, Eq, TaskInput, TraceRawVcs, NonLocalValue, Encode, Decode,
11790
)]
11891
pub enum MetadataItem {
11992
Static { path: FileSystemPath },
@@ -159,29 +132,12 @@ impl From<MetadataWithAltItem> for MetadataItem {
159132
}
160133

161134
/// Metadata file that can be placed in any segment of the app directory.
162-
#[derive(
163-
Default,
164-
Clone,
165-
Debug,
166-
Serialize,
167-
Deserialize,
168-
PartialEq,
169-
Eq,
170-
TraceRawVcs,
171-
NonLocalValue,
172-
Encode,
173-
Decode,
174-
)]
135+
#[derive(Default, Clone, Debug, PartialEq, Eq, TraceRawVcs, NonLocalValue, Encode, Decode)]
175136
pub struct Metadata {
176-
#[serde(skip_serializing_if = "Vec::is_empty", default)]
177137
pub icon: Vec<MetadataWithAltItem>,
178-
#[serde(skip_serializing_if = "Vec::is_empty", default)]
179138
pub apple: Vec<MetadataWithAltItem>,
180-
#[serde(skip_serializing_if = "Vec::is_empty", default)]
181139
pub twitter: Vec<MetadataWithAltItem>,
182-
#[serde(skip_serializing_if = "Vec::is_empty", default)]
183140
pub open_graph: Vec<MetadataWithAltItem>,
184-
#[serde(skip_serializing_if = "Option::is_none")]
185141
pub sitemap: Option<MetadataItem>,
186142
// The page indicates where the metadata is defined and captured.
187143
// The steps for capturing metadata (get_directory_tree) and constructing
@@ -190,7 +146,6 @@ pub struct Metadata {
190146
// the actual path incorrectly with fillMetadataSegment.
191147
//
192148
// This is only being used for the static metadata files.
193-
#[serde(skip_serializing_if = "Option::is_none")]
194149
pub base_page: Option<AppPage>,
195150
}
196151

@@ -216,11 +171,8 @@ impl Metadata {
216171
#[turbo_tasks::value]
217172
#[derive(Default, Clone, Debug)]
218173
pub struct GlobalMetadata {
219-
#[serde(skip_serializing_if = "Option::is_none")]
220174
pub favicon: Option<MetadataItem>,
221-
#[serde(skip_serializing_if = "Option::is_none")]
222175
pub robots: Option<MetadataItem>,
223-
#[serde(skip_serializing_if = "Option::is_none")]
224176
pub manifest: Option<MetadataItem>,
225177
}
226178

@@ -534,8 +486,6 @@ impl ValueDefault for FileSystemPathVec {
534486
PartialEq,
535487
Eq,
536488
Hash,
537-
Serialize,
538-
Deserialize,
539489
TraceRawVcs,
540490
ValueDebugFormat,
541491
Debug,

crates/next-core/src/next_app/app_page_entry.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ use turbopack_core::{
1515
};
1616
use turbopack_ecmascript::runtime_functions::{TURBOPACK_LOAD, TURBOPACK_REQUIRE};
1717

18-
use super::app_entry::AppEntry;
1918
use crate::{
2019
app_page_loader_tree::{AppPageLoaderTreeModule, GLOBAL_ERROR},
2120
app_structure::AppPageLoaderTree,
22-
next_app::{AppPage, AppPath},
21+
next_app::{AppPage, AppPath, app_entry::AppEntry},
2322
next_config::NextConfig,
2423
next_edge::entry::wrap_edge_entry,
2524
next_server_component::NextServerComponentTransition,

crates/next-core/src/next_client/context.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::collections::BTreeSet;
22

33
use anyhow::Result;
44
use bincode::{Decode, Encode};
5-
use serde::{Deserialize, Serialize};
65
use turbo_rcstr::{RcStr, rcstr};
76
use turbo_tasks::{ResolvedVc, TaskInput, Vc, trace::TraceRawVcs};
87
use turbo_tasks_fs::FileSystemPath;
@@ -408,19 +407,7 @@ pub async fn get_client_module_options_context(
408407
Ok(module_options_context)
409408
}
410409

411-
#[derive(
412-
Clone,
413-
Debug,
414-
PartialEq,
415-
Eq,
416-
Hash,
417-
TaskInput,
418-
TraceRawVcs,
419-
Serialize,
420-
Deserialize,
421-
Encode,
422-
Decode,
423-
)]
410+
#[derive(Clone, Debug, PartialEq, Eq, Hash, TaskInput, TraceRawVcs, Encode, Decode)]
424411
pub struct ClientChunkingContextOptions {
425412
pub mode: Vc<NextMode>,
426413
pub root_path: FileSystemPath,

0 commit comments

Comments
 (0)