Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Nov 29, 2024
1 parent e09b357 commit 613776b
Show file tree
Hide file tree
Showing 107 changed files with 790 additions and 502 deletions.
13 changes: 9 additions & 4 deletions crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ impl Issue for NextSegmentConfigParsingIssue {
format from which some properties can be statically parsed at compiled-time."
.into(),
)
.cell(),
.resolved_cell(),
))
}

#[turbo_tasks::function]
fn detail(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(*self.detail))
Vc::cell(Some(self.detail))
}

#[turbo_tasks::function]
Expand All @@ -219,8 +219,13 @@ impl Issue for NextSegmentConfigParsingIssue {
}

#[turbo_tasks::function]
fn source(&self) -> Vc<OptionIssueSource> {
Vc::cell(Some(self.source.resolve_source_map(self.ident.path())))
async fn source(&self) -> Result<Vc<OptionIssueSource>> {
Ok(Vc::cell(Some(
self.source
.resolve_source_map(self.ident.path())
.to_resolved()
.await?,
)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/next-core/src/app_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,6 @@ impl Issue for DirectoryTreeIssue {

#[turbo_tasks::function]
fn description(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(*self.message))
Vc::cell(Some(self.message))
}
}
10 changes: 6 additions & 4 deletions crates/next-core/src/hmr_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ impl Module for HmrEntryModule {
}

#[turbo_tasks::function]
fn references(&self) -> Vc<ModuleReferences> {
Vc::cell(vec![Vc::upcast(HmrEntryModuleReference::new(Vc::upcast(
*self.module,
)))])
async fn references(&self) -> Result<Vc<ModuleReferences>> {
Ok(Vc::cell(vec![ResolvedVc::upcast(
HmrEntryModuleReference::new(Vc::upcast(*self.module))
.to_resolved()
.await?,
)]))
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/next-core/src/next_app/app_client_references_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub async fn get_app_client_references_chunks(
let client_chunk_group = client_chunk_group.await?;

let client_chunks =
current_client_chunks.concatenate(client_chunk_group.assets);
current_client_chunks.concatenate(*client_chunk_group.assets);
let client_chunks = client_chunks.to_resolved().await?;

if is_layout {
Expand All @@ -286,7 +286,7 @@ pub async fn get_app_client_references_chunks(
if let Some(ssr_chunk_group) = ssr_chunk_group {
let ssr_chunk_group = ssr_chunk_group.await?;

let ssr_chunks = current_ssr_chunks.concatenate(ssr_chunk_group.assets);
let ssr_chunks = current_ssr_chunks.concatenate(*ssr_chunk_group.assets);
let ssr_chunks = ssr_chunks.to_resolved().await?;

if is_layout {
Expand Down
2 changes: 1 addition & 1 deletion crates/next-core/src/next_app/app_client_shared_chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub async fn get_app_client_shared_chunk_group(
) -> Result<Vc<ChunkGroupResult>> {
if app_client_runtime_entries.await?.is_empty() {
return Ok(ChunkGroupResult {
assets: OutputAssets::empty(),
assets: OutputAssets::empty().to_resolved().await?,
availability_info: AvailabilityInfo::Root,
}
.cell());
Expand Down
4 changes: 2 additions & 2 deletions crates/next-core/src/next_app/include_modules_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ impl Module for IncludeModulesModule {
self.modules
.iter()
.map(|&module| async move {
Ok(Vc::upcast(
IncludedModuleReference::new(*module).resolve().await?,
Ok(ResolvedVc::upcast(
IncludedModuleReference::new(*module).to_resolved().await?,
))
})
.try_join()
Expand Down
4 changes: 2 additions & 2 deletions crates/next-core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ impl Issue for NextSourceConfigParsingIssue {
format from which some properties can be statically parsed at compiled-time."
.into(),
)
.cell(),
.resolved_cell(),
))
}

#[turbo_tasks::function]
fn detail(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(*self.detail))
Vc::cell(Some(self.detail))
}
}

Expand Down
4 changes: 2 additions & 2 deletions turbopack/crates/turbo-tasks-fetch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ impl Issue for FetchIssue {
}
FetchErrorKind::Other => format!("There was an issue requesting {}", url).into(),
})
.cell(),
.resolved_cell(),
)))
}

#[turbo_tasks::function]
fn detail(&self) -> Vc<OptionStyledString> {
Vc::cell(Some(*self.detail))
Vc::cell(Some(self.detail))
}
}
10 changes: 5 additions & 5 deletions turbopack/crates/turbopack-browser/src/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl ChunkingContext for BrowserChunkingContext {
async fn chunk_group(
self: Vc<Self>,
ident: Vc<AssetIdent>,
module: Vc<Box<dyn ChunkableModule>>,
module: ResolvedVc<Box<dyn ChunkableModule>>,
availability_info: Value<AvailabilityInfo>,
) -> Result<Vc<ChunkGroupResult>> {
let span = tracing::info_span!("chunking", ident = ident.to_string().await?.to_string());
Expand All @@ -396,7 +396,7 @@ impl ChunkingContext for BrowserChunkingContext {
availability_info,
} = make_chunk_group(
Vc::upcast(self),
[Vc::upcast(module)],
[ResolvedVc::upcast(module)],
input_availability_info,
)
.await?;
Expand Down Expand Up @@ -435,7 +435,7 @@ impl ChunkingContext for BrowserChunkingContext {
}

Ok(ChunkGroupResult {
assets: Vc::cell(assets),
assets: ResolvedVc::cell(assets),
availability_info,
}
.cell())
Expand Down Expand Up @@ -463,7 +463,7 @@ impl ChunkingContext for BrowserChunkingContext {

let entries = evaluatable_assets_ref
.iter()
.map(|&evaluatable| Vc::upcast(evaluatable));
.map(|&evaluatable| ResolvedVc::upcast(evaluatable));

let MakeChunkGroupResult {
chunks,
Expand Down Expand Up @@ -498,7 +498,7 @@ impl ChunkingContext for BrowserChunkingContext {
);

Ok(ChunkGroupResult {
assets: Vc::cell(assets),
assets: ResolvedVc::cell(assets),
availability_info,
}
.cell())
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbopack-browser/src/ecmascript/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl Introspectable for EcmascriptDevChunk {
async fn children(&self) -> Result<Vc<IntrospectableChildren>> {
let mut children = FxIndexSet::default();
let chunk = ResolvedVc::upcast::<Box<dyn Introspectable>>(self.chunk);
children.insert((Vc::cell("chunk".into()), *chunk));
children.insert((ResolvedVc::cell("chunk".into()), *chunk));
Ok(Vc::cell(children))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ async fn item_code(
let error_message = format!("{}", PrettyPrintError(&error));
let js_error_message = serde_json::to_string(&error_message)?;
CodeGenerationIssue {
severity: IssueSeverity::Error.cell(),
path: item.asset_ident().path(),
severity: IssueSeverity::Error.resolved_cell(),
path: item.asset_ident().path().to_resolved().await?,
title: StyledString::Text("Code generation for chunk item errored".into())
.cell(),
message: StyledString::Text(error_message.into()).cell(),
.resolved_cell(),
message: StyledString::Text(error_message.into()).resolved_cell(),
}
.cell()
.emit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl EcmascriptDevEvaluateChunk {
let chunking_context = this.chunking_context;
move |entry| async move {
if let Some(placeable) =
Vc::try_resolve_sidecast::<Box<dyn EcmascriptChunkPlaceable>>(*entry)
ResolvedVc::try_sidecast::<Box<dyn EcmascriptChunkPlaceable>>(*entry)
.await?
{
Ok(Some(
Expand Down Expand Up @@ -207,17 +207,19 @@ impl OutputAsset for EcmascriptDevEvaluateChunk {
async fn ident(&self) -> Result<Vc<AssetIdent>> {
let mut ident = self.ident.await?.clone_value();

ident.add_modifier(modifier());
ident.add_modifier(modifier().to_resolved().await?);

let evaluatable_assets = self.evaluatable_assets.await?;
ident.modifiers.extend(
evaluatable_assets
.iter()
.map(|entry| entry.ident().to_string()),
.map(|entry| entry.ident().to_string().to_resolved())
.try_join()
.await?,
);

for chunk in &*self.other_chunks.await? {
ident.add_modifier(chunk.ident().to_string());
ident.add_modifier(chunk.ident().to_string().to_resolved().await?);
}

let ident = AssetIdent::new(Value::new(ident));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ impl OutputAsset for EcmascriptDevChunkList {
#[turbo_tasks::function]
async fn ident(&self) -> Result<Vc<AssetIdent>> {
let mut ident = self.ident.await?.clone_value();
ident.add_modifier(modifier());
ident.add_modifier(modifier().to_resolved().await?);

match self.source {
EcmascriptDevChunkListSource::Entry => {}
EcmascriptDevChunkListSource::Dynamic => {
ident.add_modifier(dynamic_modifier());
ident.add_modifier(dynamic_modifier().to_resolved().await?);
}
}

Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbopack-browser/src/react_refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Issue for ReactRefreshResolvingIssue {
StyledString::Code("@next/react-refresh-utils".into()),
StyledString::Text(" modules.".into()),
])
.cell(),
.resolved_cell(),
))
}
}
2 changes: 1 addition & 1 deletion turbopack/crates/turbopack-cli-utils/src/runtime_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl RuntimeEntry {
if let Some(entry) =
ResolvedVc::try_sidecast::<Box<dyn EvaluatableAsset>>(module).await?
{
runtime_entries.push(*entry);
runtime_entries.push(entry);
} else {
bail!(
"runtime reference resolved to an asset ({}) that cannot be evaluated",
Expand Down
3 changes: 2 additions & 1 deletion turbopack/crates/turbopack-core/src/chunk/chunk_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct MakeChunkGroupResult {
/// Creates a chunk group from a set of entries.
pub async fn make_chunk_group(
chunking_context: Vc<Box<dyn ChunkingContext>>,
chunk_group_entries: impl IntoIterator<Item = Vc<Box<dyn Module>>>,
chunk_group_entries: impl IntoIterator<Item = ResolvedVc<Box<dyn Module>>>,
availability_info: AvailabilityInfo,
) -> Result<MakeChunkGroupResult> {
let ChunkContentResult {
Expand Down Expand Up @@ -144,6 +144,7 @@ pub async fn make_chunk_group(
let async_loader_external_module_references = async_loader_references
.iter()
.flat_map(|references| references.iter().copied())
.map(|v| *v)
.collect();

let mut referenced_output_assets = references_to_output_assets(external_module_references)
Expand Down
12 changes: 6 additions & 6 deletions turbopack/crates/turbopack-core/src/chunk/chunking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use once_cell::sync::Lazy;
use regex::Regex;
use tracing::Level;
use turbo_rcstr::RcStr;
use turbo_tasks::{FxIndexMap, ReadRef, TryJoinIterExt, ValueToString, Vc};
use turbo_tasks::{FxIndexMap, ReadRef, ResolvedVc, TryJoinIterExt, ValueToString, Vc};

use super::{
AsyncModuleInfo, Chunk, ChunkItem, ChunkItemsWithAsyncModuleInfo, ChunkType, ChunkingContext,
Expand All @@ -18,8 +18,8 @@ use crate::output::OutputAssets;

#[turbo_tasks::value]
struct ChunkItemInfo {
ty: Vc<Box<dyn ChunkType>>,
name: Vc<RcStr>,
ty: ResolvedVc<Box<dyn ChunkType>>,
name: ResolvedVc<RcStr>,
size: usize,
}

Expand All @@ -30,12 +30,12 @@ async fn chunk_item_info(
async_info: Option<Vc<AsyncModuleInfo>>,
) -> Result<Vc<ChunkItemInfo>> {
let asset_ident = chunk_item.asset_ident().to_string();
let ty = chunk_item.ty().resolve().await?;
let ty = chunk_item.ty().to_resolved().await?;
let chunk_item_size = ty.chunk_item_size(chunking_context, chunk_item, async_info);
Ok(ChunkItemInfo {
ty,
size: *chunk_item_size.await?,
name: asset_ident.resolve().await?,
name: asset_ident.to_resolved().await?,
}
.cell())
}
Expand Down Expand Up @@ -125,7 +125,7 @@ type ChunkItemWithInfo = (
);

struct SplitContext<'a> {
ty: Vc<Box<dyn ChunkType>>,
ty: ResolvedVc<Box<dyn ChunkType>>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
chunks: &'a mut Vec<Vc<Box<dyn Chunk>>>,
referenced_output_assets: &'a mut Vc<OutputAssets>,
Expand Down
8 changes: 4 additions & 4 deletions turbopack/crates/turbopack-core/src/chunk/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub enum MinifyType {

#[turbo_tasks::value(shared)]
pub struct ChunkGroupResult {
pub assets: Vc<OutputAssets>,
pub assets: ResolvedVc<OutputAssets>,
pub availability_info: AvailabilityInfo,
}

Expand Down Expand Up @@ -291,7 +291,7 @@ async fn root_chunk_group_assets(
chunking_context: Vc<Box<dyn ChunkingContext>>,
module: Vc<Box<dyn ChunkableModule>>,
) -> Result<Vc<OutputAssets>> {
Ok(chunking_context.root_chunk_group(module).await?.assets)
Ok(*chunking_context.root_chunk_group(module).await?.assets)
}

#[turbo_tasks::function]
Expand All @@ -301,7 +301,7 @@ async fn evaluated_chunk_group_assets(
evaluatable_assets: Vc<EvaluatableAssets>,
availability_info: Value<AvailabilityInfo>,
) -> Result<Vc<OutputAssets>> {
Ok(chunking_context
Ok(*chunking_context
.evaluated_chunk_group(ident, evaluatable_assets, availability_info)
.await?
.assets)
Expand Down Expand Up @@ -334,7 +334,7 @@ async fn chunk_group_assets(
module: Vc<Box<dyn ChunkableModule>>,
availability_info: Value<AvailabilityInfo>,
) -> Result<Vc<OutputAssets>> {
Ok(chunking_context
Ok(*chunking_context
.chunk_group(module.ident(), module, availability_info)
.await?
.assets)
Expand Down
8 changes: 4 additions & 4 deletions turbopack/crates/turbopack-core/src/chunk/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pub struct ChunkData {
}

#[turbo_tasks::value(transparent)]
pub struct ChunkDataOption(Option<Vc<ChunkData>>);
pub struct ChunkDataOption(Option<ResolvedVc<ChunkData>>);

// NOTE(alexkirsz) Our convention for naming vector types is to add an "s" to
// the end of the type name, but in this case it would be both gramatically
// incorrect and clash with the variable names everywhere.
// TODO(WEB-101) Should fix this.
#[turbo_tasks::value(transparent)]
pub struct ChunksData(Vec<Vc<ChunkData>>);
pub struct ChunksData(Vec<ResolvedVc<ChunkData>>);

#[turbo_tasks::function]
fn module_chunk_reference_description() -> Vc<RcStr> {
Expand Down Expand Up @@ -59,7 +59,7 @@ impl ChunkData {
module_chunks: Vec::new(),
references: OutputAssets::empty().to_resolved().await?,
}
.cell(),
.resolved_cell(),
)));
};

Expand Down Expand Up @@ -114,7 +114,7 @@ impl ChunkData {
module_chunks,
references: ResolvedVc::cell(module_chunks_references),
}
.cell(),
.resolved_cell(),
)))
}

Expand Down
Loading

0 comments on commit 613776b

Please sign in to comment.