Skip to content

Commit

Permalink
Make client references actual references
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Nov 25, 2024
1 parent adfdd09 commit 97642a2
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use turbo_tasks::{ResolvedVc, Vc};
use turbopack_core::{
asset::{Asset, AssetContent},
ident::AssetIdent,
module::{Module, Modules},
module::Module,
reference::{ModuleReferences, SingleModuleReference},
};
use turbopack_ecmascript::chunk::EcmascriptChunkPlaceable;

Expand Down Expand Up @@ -46,7 +47,17 @@ impl EcmascriptClientReferenceModule {

#[turbo_tasks::function]
fn ecmascript_client_reference_modifier() -> Vc<RcStr> {
Vc::cell("ecmascript client reference".into())
Vc::cell("ecmascript client reference module".into())
}

#[turbo_tasks::function]
fn ecmascript_client_reference_client_ref_modifier() -> Vc<RcStr> {
Vc::cell("ecmascript client reference to client".into())
}

#[turbo_tasks::function]
fn ecmascript_client_reference_ssr_ref_modifier() -> Vc<RcStr> {
Vc::cell("ecmascript client reference to ssr".into())
}

#[turbo_tasks::value_impl]
Expand All @@ -58,10 +69,19 @@ impl Module for EcmascriptClientReferenceModule {
}

#[turbo_tasks::function]
fn additional_layers_modules(&self) -> Vc<Modules> {
fn references(&self) -> Vc<ModuleReferences> {
let client_module = ResolvedVc::upcast(self.client_module);
let ssr_module = ResolvedVc::upcast(self.ssr_module);
Vc::cell(vec![client_module, ssr_module])
Vc::cell(vec![
Vc::upcast(SingleModuleReference::new(
*client_module,
ecmascript_client_reference_client_ref_modifier(),
)),
Vc::upcast(SingleModuleReference::new(
*ssr_module,
ecmascript_client_reference_ssr_ref_modifier(),
)),
])
}
}

Expand Down

0 comments on commit 97642a2

Please sign in to comment.