-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a GlobalInformation struct, which is made available through the…
… ChunkingContext trait. Constructing a new GlobalInformation object takes a Project parameter, giving the constructor access to global information
- Loading branch information
Lichu Acuña
committed
Aug 1, 2024
1 parent
d24b396
commit 544f700
Showing
9 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::collections::HashMap; | ||
|
||
use turbo_tasks::{RcStr, Vc}; | ||
|
||
use super::ModuleId; | ||
use crate::ident::AssetIdent; | ||
|
||
#[turbo_tasks::value] | ||
#[derive(Clone, Debug)] | ||
pub struct GlobalInformation { | ||
pub test_str: Vc<RcStr>, | ||
pub module_id_map: HashMap<AssetIdent, ModuleId>, | ||
} | ||
|
||
impl GlobalInformation { | ||
pub fn get_module_id(&self, asset_ident: &AssetIdent) -> ModuleId { | ||
self.module_id_map.get(asset_ident).cloned().expect( | ||
"No module ID found for the given asset identifier. This is an internal Turbopack \ | ||
error. Please report it.", | ||
) | ||
} | ||
} | ||
|
||
#[turbo_tasks::value(transparent)] | ||
pub struct OptionGlobalInformation(Option<GlobalInformation>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters