Skip to content

Commit cfef664

Browse files
committed
refactor(turbopack-core): Use ResolvedVc for IntrospectableModule and IntrospectableSource
1 parent e1a4092 commit cfef664

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎turbopack/crates/turbopack-core/src/introspect/module.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
use anyhow::Result;
22
use turbo_rcstr::RcStr;
3-
use turbo_tasks::{ValueToString, Vc};
3+
use turbo_tasks::{ResolvedVc, ValueToString, Vc};
44

55
use super::{
66
utils::{children_from_module_references, content_to_details},
77
Introspectable, IntrospectableChildren,
88
};
99
use crate::{asset::Asset, module::Module};
1010

11-
#[turbo_tasks::value(local)]
12-
pub struct IntrospectableModule(Vc<Box<dyn Module>>);
11+
#[turbo_tasks::value]
12+
pub struct IntrospectableModule(ResolvedVc<Box<dyn Module>>);
1313

1414
#[turbo_tasks::value_impl]
1515
impl IntrospectableModule {
1616
#[turbo_tasks::function]
17-
pub async fn new(asset: Vc<Box<dyn Module>>) -> Result<Vc<Box<dyn Introspectable>>> {
18-
Ok(Vc::try_resolve_sidecast::<Box<dyn Introspectable>>(asset)
17+
pub async fn new(asset: ResolvedVc<Box<dyn Module>>) -> Result<Vc<Box<dyn Introspectable>>> {
18+
Ok(*ResolvedVc::try_sidecast::<Box<dyn Introspectable>>(asset)
1919
.await?
20-
.unwrap_or_else(|| Vc::upcast(IntrospectableModule(asset).cell())))
20+
.unwrap_or_else(|| ResolvedVc::upcast(IntrospectableModule(asset).resolved_cell())))
2121
}
2222
}
2323

‎turbopack/crates/turbopack-core/src/introspect/source.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
use anyhow::Result;
22
use turbo_rcstr::RcStr;
3-
use turbo_tasks::{ValueToString, Vc};
3+
use turbo_tasks::{ResolvedVc, ValueToString, Vc};
44

55
use super::{utils::content_to_details, Introspectable};
66
use crate::{asset::Asset, source::Source};
77

8-
#[turbo_tasks::value(local)]
9-
pub struct IntrospectableSource(Vc<Box<dyn Source>>);
8+
#[turbo_tasks::value]
9+
pub struct IntrospectableSource(ResolvedVc<Box<dyn Source>>);
1010

1111
#[turbo_tasks::value_impl]
1212
impl IntrospectableSource {
1313
#[turbo_tasks::function]
14-
pub async fn new(asset: Vc<Box<dyn Source>>) -> Result<Vc<Box<dyn Introspectable>>> {
15-
Ok(Vc::try_resolve_sidecast::<Box<dyn Introspectable>>(asset)
14+
pub async fn new(asset: ResolvedVc<Box<dyn Source>>) -> Result<Vc<Box<dyn Introspectable>>> {
15+
Ok(*ResolvedVc::try_sidecast::<Box<dyn Introspectable>>(asset)
1616
.await?
17-
.unwrap_or_else(|| Vc::upcast(IntrospectableSource(asset).cell())))
17+
.unwrap_or_else(|| ResolvedVc::upcast(IntrospectableSource(asset).resolved_cell())))
1818
}
1919
}
2020

0 commit comments

Comments
 (0)