-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a GlobalInformation struct #8912
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ use turbopack_core::{ | |
chunk::{ | ||
availability_info::AvailabilityInfo, | ||
chunk_group::{make_chunk_group, MakeChunkGroupResult}, | ||
global_information::OptionGlobalInformation, | ||
Chunk, ChunkGroupResult, ChunkItem, ChunkableModule, ChunkingContext, | ||
EntryChunkGroupResult, EvaluatableAssets, MinifyType, ModuleId, | ||
}, | ||
|
@@ -122,6 +123,8 @@ pub struct BrowserChunkingContext { | |
minify_type: MinifyType, | ||
/// Whether to use manifest chunks for lazy compilation | ||
manifest_chunks: bool, | ||
/// Global information | ||
global_information: Vc<OptionGlobalInformation>, | ||
} | ||
|
||
impl BrowserChunkingContext { | ||
|
@@ -133,6 +136,7 @@ impl BrowserChunkingContext { | |
asset_root_path: Vc<FileSystemPath>, | ||
environment: Vc<Environment>, | ||
runtime_type: RuntimeType, | ||
global_information: Vc<OptionGlobalInformation>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That shouldn't be passed here (we don't want to force to always pass that). Instead add a |
||
) -> BrowserChunkingContextBuilder { | ||
BrowserChunkingContextBuilder { | ||
chunking_context: BrowserChunkingContext { | ||
|
@@ -151,6 +155,7 @@ impl BrowserChunkingContext { | |
runtime_type, | ||
minify_type: MinifyType::NoMinify, | ||
manifest_chunks: false, | ||
global_information, | ||
}, | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#[turbo_tasks::value] | ||
#[derive(Clone, Debug)] | ||
pub struct GlobalInformation {} | ||
|
||
#[turbo_tasks::value(transparent)] | ||
pub struct OptionGlobalInformation(Option<GlobalInformation>); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ use turbopack_core::{ | |
chunk::{ | ||
availability_info::AvailabilityInfo, | ||
chunk_group::{make_chunk_group, MakeChunkGroupResult}, | ||
global_information::OptionGlobalInformation, | ||
Chunk, ChunkGroupResult, ChunkItem, ChunkableModule, ChunkingContext, | ||
EntryChunkGroupResult, EvaluatableAssets, MinifyType, ModuleId, | ||
}, | ||
|
@@ -84,6 +85,8 @@ pub struct NodeJsChunkingContext { | |
minify_type: MinifyType, | ||
/// Whether to use manifest chunks for lazy compilation | ||
manifest_chunks: bool, | ||
/// Global information | ||
global_information: Vc<OptionGlobalInformation>, | ||
} | ||
|
||
impl NodeJsChunkingContext { | ||
|
@@ -96,6 +99,7 @@ impl NodeJsChunkingContext { | |
asset_root_path: Vc<FileSystemPath>, | ||
environment: Vc<Environment>, | ||
runtime_type: RuntimeType, | ||
global_information: Vc<OptionGlobalInformation>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
) -> NodeJsChunkingContextBuilder { | ||
NodeJsChunkingContextBuilder { | ||
chunking_context: NodeJsChunkingContext { | ||
|
@@ -109,6 +113,7 @@ impl NodeJsChunkingContext { | |
runtime_type, | ||
minify_type: MinifyType::NoMinify, | ||
manifest_chunks: false, | ||
global_information, | ||
}, | ||
} | ||
} | ||
|
@@ -131,6 +136,14 @@ impl NodeJsChunkingContext { | |
|
||
#[turbo_tasks::value_impl] | ||
impl NodeJsChunkingContext { | ||
#[turbo_tasks::function] | ||
async fn chunk_item_id_from_ident( | ||
self: Vc<Self>, | ||
ident: Vc<AssetIdent>, | ||
) -> Result<Vc<ModuleId>> { | ||
Ok(ModuleId::String(ident.to_string().await?.clone_value()).cell()) | ||
} | ||
|
||
#[turbo_tasks::function] | ||
fn new(this: Value<NodeJsChunkingContext>) -> Vc<Self> { | ||
this.into_value().cell() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option<Vc<GlobalInformation>>