Skip to content

Commit 332f023

Browse files
committed
Merge branch 'canary' into jamesdaniels_onBuildCompleteFixes
2 parents 58f892b + 1f144f0 commit 332f023

File tree

341 files changed

+14064
-15399
lines changed

Some content is hidden

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

341 files changed

+14064
-15399
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ turbo-tasks-fetch = { path = "turbopack/crates/turbo-tasks-fetch" }
308308
turbo-tasks-fs = { path = "turbopack/crates/turbo-tasks-fs" }
309309
turbo-tasks-hash = { path = "turbopack/crates/turbo-tasks-hash" }
310310
turbo-tasks-macros = { path = "turbopack/crates/turbo-tasks-macros" }
311-
turbo-tasks-macros-shared = { path = "turbopack/crates/turbo-tasks-macros-shared" }
312311
turbo-tasks-testing = { path = "turbopack/crates/turbo-tasks-testing" }
313312
turbopack = { path = "turbopack/crates/turbopack" }
314313
turbopack-bench = { path = "turbopack/crates/turbopack-bench" }
@@ -371,7 +370,7 @@ tungstenite = "0.20.1"
371370
allsorts = { version = "0.14.0", default-features = false, features = [
372371
"flate2_rust",
373372
] }
374-
anyhow = "1.0.98"
373+
anyhow = "1.0.100"
375374
async-compression = { version = "0.3.13", default-features = false, features = [
376375
"gzip",
377376
"tokio",

crates/next-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bench = false
1313
workspace = true
1414

1515
[dependencies]
16-
anyhow = { workspace = true, features = ["backtrace"] }
16+
anyhow = { workspace = true }
1717
byteorder = { workspace = true }
1818
either = { workspace = true }
1919
futures = { workspace = true }
@@ -27,7 +27,7 @@ serde_json = { workspace = true }
2727
swc_core = { workspace = true }
2828
tracing = { workspace = true }
2929
turbo-rcstr = { workspace = true }
30-
turbo-tasks = { workspace = true, features = ["non_operation_vc_strongly_consistent"] }
30+
turbo-tasks = { workspace = true }
3131
turbo-tasks-env = { workspace = true }
3232
turbo-tasks-fs = { workspace = true }
3333
turbo-unix-path = { workspace = true }

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ pub async fn get_app_client_references_chunks(
5050
// .client_references
5151
// .iter()
5252
// .map(|client_reference| async move {
53-
// let client_reference_ty = client_reference.ty();
5453
// Ok((
55-
// client_reference_ty,
56-
// match client_reference_ty {
54+
// client_reference.ty,
55+
// match client_reference.ty {
5756
// ClientReferenceType::EcmascriptClientReference(
5857
// ecmascript_client_reference,
5958
// ) => {
@@ -141,13 +140,13 @@ pub async fn get_app_client_references_chunks(
141140
.or_default();
142141
}
143142
for client_reference in app_client_references.client_references.iter() {
144-
if let Some(server_component) = client_reference.server_component() {
143+
if let Some(server_component) = client_reference.server_component {
145144
client_references_by_server_component
146145
.entry(server_component)
147146
.or_default()
148-
.push(client_reference.ty());
147+
.push(client_reference.ty);
149148
} else {
150-
framework_reference_types.push(client_reference.ty());
149+
framework_reference_types.push(client_reference.ty);
151150
}
152151
}
153152
// Framework components need to go into first layout segment

crates/next-core/src/next_client_reference/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ pub use ecmascript_client_reference::{
1111
ecmascript_client_reference_transition::NextEcmascriptClientReferenceTransition,
1212
};
1313
pub use visit_client_reference::{
14-
ClientReference, ClientReferenceGraphResult, ClientReferenceType, ClientReferenceTypes,
15-
ServerEntries, VisitedClientReferenceGraphNodes, find_server_entries,
14+
ClientReference, ClientReferenceGraphResult, ClientReferenceType, ServerEntries,
15+
find_server_entries,
1616
};

crates/next-core/src/next_client_reference/visit_client_reference.rs

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
use std::future::Future;
22

33
use anyhow::Result;
4-
use rustc_hash::FxHashSet;
54
use serde::{Deserialize, Serialize};
65
use tracing::{Instrument, Level, Span};
76
use turbo_rcstr::RcStr;
87
use turbo_tasks::{
9-
FxIndexSet, NonLocalValue, ReadRef, ResolvedVc, TryJoinIterExt, Vc,
8+
NonLocalValue, ReadRef, ResolvedVc, TryJoinIterExt, Vc,
109
debug::ValueDebugFormat,
1110
graph::{AdjacencyMap, GraphTraversal, Visit, VisitControlFlow},
1211
trace::TraceRawVcs,
@@ -43,19 +42,6 @@ pub struct ClientReference {
4342
pub ty: ClientReferenceType,
4443
}
4544

46-
impl ClientReference {
47-
pub fn server_component(&self) -> Option<ResolvedVc<NextServerComponentModule>> {
48-
self.server_component
49-
}
50-
51-
pub fn ty(&self) -> ClientReferenceType {
52-
self.ty
53-
}
54-
}
55-
56-
#[turbo_tasks::value(transparent)]
57-
pub struct ClientReferences(Vec<ClientReference>);
58-
5945
#[derive(
6046
Copy,
6147
Clone,
@@ -82,33 +68,6 @@ pub struct ClientReferenceGraphResult {
8268
pub server_utils: Vec<ResolvedVc<NextServerUtilityModule>>,
8369
}
8470

85-
#[turbo_tasks::value(shared)]
86-
pub struct VisitedClientReferenceGraphNodes(FxHashSet<FindServerEntriesNode>);
87-
88-
#[turbo_tasks::value_impl]
89-
impl VisitedClientReferenceGraphNodes {
90-
#[turbo_tasks::function]
91-
pub fn empty() -> Vc<Self> {
92-
VisitedClientReferenceGraphNodes(Default::default()).cell()
93-
}
94-
}
95-
96-
#[turbo_tasks::value(transparent)]
97-
pub struct ClientReferenceTypes(FxIndexSet<ClientReferenceType>);
98-
99-
#[turbo_tasks::value_impl]
100-
impl ClientReferenceGraphResult {
101-
#[turbo_tasks::function]
102-
pub fn types(&self) -> Vc<ClientReferenceTypes> {
103-
Vc::cell(
104-
self.client_references
105-
.iter()
106-
.map(|r| r.ty())
107-
.collect::<FxIndexSet<_>>(),
108-
)
109-
}
110-
}
111-
11271
#[turbo_tasks::value(shared)]
11372
#[derive(Clone, Debug)]
11473
pub struct ServerEntries {

crates/next-core/src/next_font/google/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_hash::FxHashMap;
88
use serde::{Deserialize, Serialize};
99
use turbo_rcstr::{RcStr, rcstr};
1010
use turbo_tasks::{Completion, FxIndexMap, ResolvedVc, Vc};
11-
use turbo_tasks_bytes::stream::SingleValue;
1211
use turbo_tasks_env::{CommandLineProcessEnv, ProcessEnv};
1312
use turbo_tasks_fetch::{FetchClientConfig, HttpResponseBody};
1413
use turbo_tasks_fs::{
@@ -768,10 +767,9 @@ async fn get_mock_stylesheet(
768767
)
769768
.await?;
770769

771-
match &val.try_into_single().await? {
772-
SingleValue::Single(val) => {
773-
let val: FxHashMap<RcStr, Option<RcStr>> =
774-
parse_json_with_source_context(val.to_str()?)?;
770+
match &*val {
771+
Some(val) => {
772+
let val: FxHashMap<RcStr, Option<RcStr>> = parse_json_with_source_context(val)?;
775773
Ok(val
776774
.get(&stylesheet_url)
777775
.context("url not found")?

crates/next-core/src/next_font/local/stylesheet.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ pub(super) async fn build_font_face_definitions(
6262
};
6363
let query_str = qstring::QString::from(serde_json::to_string(&query)?.as_str());
6464

65+
// Check if `font-family` is explicitly defined in `declarations`
66+
let has_custom_font_family = options.declarations.as_ref().is_some_and(|declarations| {
67+
declarations
68+
.iter()
69+
.any(|declaration| declaration.prop == "font-family")
70+
});
71+
6572
definitions.push_str(&formatdoc!(
6673
r#"
6774
@font-face {{
68-
{}
69-
font-family: '{}';
75+
{}{}
7076
src: url('@vercel/turbopack-next/internal/font/local/font?{}') format('{}');
7177
font-display: {};
7278
{}{}
@@ -79,20 +85,24 @@ pub(super) async fn build_font_face_definitions(
7985
.map(|declaration| format!("{}: {};", declaration.prop, declaration.value))
8086
.join("\n")
8187
),
82-
scoped_font_family,
88+
if has_custom_font_family {
89+
"".to_owned()
90+
} else {
91+
format!("\nfont-family: '{}';", scoped_font_family)
92+
},
8393
query_str,
8494
ext_to_format(&font.ext)?,
8595
options.display,
8696
&font
8797
.weight
8898
.as_ref()
8999
.or(options.default_weight.as_ref())
90-
.map_or_else(|| "".to_owned(), |w| format!("font-weight: {w};")),
100+
.map_or_else(|| "".to_owned(), |w| format!("\nfont-weight: {w};")),
91101
&font
92102
.style
93103
.as_ref()
94104
.or(options.default_style.as_ref())
95-
.map_or_else(|| "".to_owned(), |s| format!("font-style: {s};")),
105+
.map_or_else(|| "".to_owned(), |s| format!("\nfont-style: {s};")),
96106
));
97107
}
98108

crates/next-core/src/next_manifests/client_reference_manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async fn build_manifest(
185185
.client_references
186186
.iter()
187187
.map(async |r| {
188-
Ok(match r.ty() {
188+
Ok(match r.ty {
189189
ClientReferenceType::EcmascriptClientReference(r) => Some((r, r.await?)),
190190
ClientReferenceType::CssClientReference(_) => None,
191191
})

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,7 @@ pub async fn get_server_chunking_context_with_client_assets(
10631063
builder = builder.source_map_source_type(if next_mode.is_development() {
10641064
SourceMapSourceType::AbsoluteFileUri
10651065
} else {
1066-
// TODO(lukesandberg): switch to relative once next is compatible.
1067-
SourceMapSourceType::TurbopackUri
1066+
SourceMapSourceType::RelativeUri
10681067
});
10691068
if next_mode.is_production() {
10701069
builder = builder
@@ -1149,8 +1148,7 @@ pub async fn get_server_chunking_context(
11491148
builder = builder.source_map_source_type(SourceMapSourceType::AbsoluteFileUri);
11501149
} else {
11511150
builder = builder
1152-
// TODO(lukesandberg): switch to relative once next is compatible.
1153-
.source_map_source_type(SourceMapSourceType::TurbopackUri)
1151+
.source_map_source_type(SourceMapSourceType::RelativeUri)
11541152
.chunking_config(
11551153
Vc::<EcmascriptChunkType>::default().to_resolved().await?,
11561154
ChunkingConfig {

0 commit comments

Comments
 (0)