Skip to content

Commit 211815e

Browse files
committed
Drop AssetIdent::new_internal as a turbo task
This gets a relatively low cache hit rate and we don't believe relying on ResoilvedVc<AssetIdent> for identity is completely reasonable.
1 parent 851630d commit 211815e

File tree

84 files changed

+191
-240
lines changed

Some content is hidden

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

84 files changed

+191
-240
lines changed

crates/next-api/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ impl AppEndpoint {
12401240
{
12411241
let mut ident = AssetIdent::from_path(project.project_path().owned().await?);
12421242
ident.add_modifier(rcstr!("client-shared-chunks"));
1243-
AssetIdent::new(ident)
1243+
ident.cell()
12441244
},
12451245
this.app_project.client_runtime_entries(),
12461246
*module_graphs.full,
@@ -1810,7 +1810,7 @@ impl AppEndpoint {
18101810
this.app_project.project().project_path().owned().await?,
18111811
);
18121812
ident.add_modifier(rcstr!("server-utils"));
1813-
AssetIdent::new(ident)
1813+
ident.cell()
18141814
},
18151815
// TODO this should be ChunkGroup::Shared
18161816
ChunkGroup::Entry(server_utils),

crates/next-api/src/module_graph.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ impl Issue for CssGlobalImportIssue {
466466

467467
#[turbo_tasks::function]
468468
async fn description(&self) -> Result<Vc<OptionStyledString>> {
469-
let parent_path = self.parent_module.ident().path().owned().await?;
470-
let module_path = self.module.ident().path().owned().await?;
469+
let parent_path = self.parent_module.ident().path().await?;
470+
let module_path = self.module.ident().path().await?;
471471
let relative_import_location = parent_path.parent();
472472

473473
let import_path = match relative_import_location.get_relative_path_to(&module_path) {
@@ -495,8 +495,8 @@ impl Issue for CssGlobalImportIssue {
495495
}
496496

497497
#[turbo_tasks::function]
498-
fn file_path(&self) -> Vc<FileSystemPath> {
499-
self.parent_module.ident().path()
498+
async fn file_path(&self) -> Result<Vc<FileSystemPath>> {
499+
Ok(self.parent_module.ident().path().await?.cell())
500500
}
501501

502502
#[turbo_tasks::function]

crates/next-api/src/pages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ impl PageEndpoint {
759759
) && let Some(chunkable) = Vc::try_resolve_downcast(page_loader).await?
760760
{
761761
return Ok(Vc::upcast(HmrEntryModule::new(
762-
AssetIdent::new(AssetIdent::from_path(this.page.await?.base_path.clone())),
762+
AssetIdent::from_path(this.page.await?.base_path.clone()).cell(),
763763
chunkable,
764764
)));
765765
}
@@ -859,7 +859,7 @@ impl PageEndpoint {
859859
.map(|m| ResolvedVc::upcast(*m))
860860
.collect();
861861
let client_chunk_group = client_chunking_context.evaluated_chunk_group(
862-
AssetIdent::new(AssetIdent::from_path(this.page.await?.base_path.clone())),
862+
AssetIdent::from_path(this.page.await?.base_path.clone()).cell(),
863863
ChunkGroup::Entry(evaluatable_assets),
864864
module_graph,
865865
AvailabilityInfo::Root,

crates/next-api/src/server_actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub(crate) async fn build_server_actions_loader(
132132
{
133133
let mut ident = AssetIdent::from_path(path);
134134
ident.add_modifier(rcstr!("server actions loader"));
135-
AssetIdent::new(ident)
135+
ident
136136
},
137137
AssetContent::file(file.into()),
138138
);

crates/next-core/src/base_loader_tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
22
use indoc::formatdoc;
33
use turbo_rcstr::RcStr;
4-
use turbo_tasks::{FxIndexMap, ResolvedVc, ValueToString, Vc};
4+
use turbo_tasks::{FxIndexMap, ResolvedVc, Vc};
55
use turbo_tasks_fs::FileSystemPath;
66
use turbopack::{ModuleAssetContext, transition::Transition};
77
use turbopack_core::{
@@ -115,7 +115,7 @@ impl BaseLoaderTreeBuilder {
115115
self.inner_assets
116116
.insert(format!("MODULE_{i}").into(), module);
117117

118-
let module_path = module.ident().path().to_string().await?;
118+
let module_path = module.ident().path().await?.value_to_string().await?;
119119

120120
Ok(format!(
121121
"[{identifier}, {path}]",

crates/next-core/src/hmr_entry.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ use turbopack_ecmascript::{
2929
/// This produces the 'base' ident for the HMR entry point, which is then modified
3030
#[turbo_tasks::function]
3131
async fn hmr_entry_point_base_ident() -> Result<Vc<AssetIdent>> {
32-
Ok(AssetIdent::new(AssetIdent::from_path(
32+
Ok(AssetIdent::from_path(
3333
VirtualFileSystem::new_with_name(rcstr!("hmr-entry"))
3434
.root()
3535
.await?
3636
.join("hmr-entry.js")?,
37-
)))
37+
)
38+
.cell())
3839
}
3940

4041
#[turbo_tasks::value(shared)]
@@ -60,7 +61,7 @@ impl Module for HmrEntryModule {
6061
async fn ident(&self) -> Result<Vc<AssetIdent>> {
6162
let mut ident = hmr_entry_point_base_ident().owned().await?;
6263
ident.add_asset(rcstr!("ENTRY"), self.ident);
63-
Ok(AssetIdent::new(ident))
64+
Ok(ident.cell())
6465
}
6566

6667
#[turbo_tasks::function]

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use turbo_rcstr::rcstr;
44
use turbo_tasks::{FxIndexMap, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Vc};
55
use turbopack_core::{
66
chunk::{ChunkingContext, availability_info::AvailabilityInfo},
7-
ident::AssetIdent,
87
module::Module,
98
module_graph::{ModuleGraph, chunk_group_info::ChunkGroup},
109
output::OutputAssets,
@@ -216,7 +215,7 @@ pub async fn get_app_client_references_chunks(
216215
{
217216
let mut ident = (*base_ident).clone();
218217
ident.add_modifier(rcstr!("ssr modules"));
219-
AssetIdent::new(ident)
218+
ident.cell()
220219
},
221220
ChunkGroup::IsolatedMerged {
222221
parent: parent_chunk_group,
@@ -258,7 +257,7 @@ pub async fn get_app_client_references_chunks(
258257
{
259258
let mut ident = (*base_ident).clone();
260259
ident.add_modifier(rcstr!("client modules"));
261-
AssetIdent::new(ident)
260+
ident.cell()
262261
},
263262
ChunkGroup::IsolatedMerged {
264263
parent: parent_chunk_group,

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use turbopack::ModuleAssetContext;
88
use turbopack_core::{
99
asset::{Asset, AssetContent},
1010
context::AssetContext,
11-
ident::AssetIdent,
1211
module::Module,
1312
reference_type::ReferenceType,
1413
source::Source,
@@ -107,8 +106,7 @@ pub async fn get_app_page_entry(
107106
let file = File::from(result.build());
108107
let mut ident = source.ident().owned().await?;
109108
ident.query = RcStr::from(format!("?{query}"));
110-
let source =
111-
VirtualSource::new_with_ident(AssetIdent::new(ident), AssetContent::file(file.into()));
109+
let source = VirtualSource::new_with_ident(ident, AssetContent::file(file.into()));
112110

113111
let mut rsc_entry = module_asset_context
114112
.process(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub async fn get_app_route_entry(
5555
let original_name: RcStr = page.to_string().into();
5656
let pathname: RcStr = AppPath::from(page.clone()).to_string().into();
5757

58-
let path = source.ident().path().owned().await?;
58+
let path = source.ident().path().await?;
5959

6060
let inner = rcstr!("INNER_APP_ROUTE");
6161

crates/next-core/src/next_client_reference/css_client_reference/css_client_reference_module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Module for CssClientReferenceModule {
3737
async fn ident(&self) -> Result<Vc<AssetIdent>> {
3838
let mut ident = self.client_module.ident().owned().await?;
3939
ident.add_modifier(rcstr!("css client reference"));
40-
Ok(AssetIdent::new(ident))
40+
Ok(ident.cell())
4141
}
4242

4343
#[turbo_tasks::function]

0 commit comments

Comments
 (0)