Skip to content
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

Remove can_be_in_same_chunk #8029

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions crates/turbopack-browser/src/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,24 +310,6 @@ impl ChunkingContext for BrowserChunkingContext {
Ok(Vc::cell(source_maps))
}

#[turbo_tasks::function]
async fn can_be_in_same_chunk(
&self,
asset_a: Vc<Box<dyn Module>>,
asset_b: Vc<Box<dyn Module>>,
) -> Result<Vc<bool>> {
let parent_dir = asset_a.ident().path().parent().await?;

let path = asset_b.ident().path().await?;
if let Some(rel_path) = parent_dir.get_path_to(&path) {
if !rel_path.starts_with("node_modules/") && !rel_path.contains("/node_modules/") {
return Ok(Vc::cell(true));
}
}

Ok(Vc::cell(false))
}

#[turbo_tasks::function]
async fn asset_path(
&self,
Expand Down
7 changes: 0 additions & 7 deletions crates/turbopack-core/src/chunk/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
chunk::{ChunkItem, ModuleId},
environment::Environment,
ident::AssetIdent,
module::Module,
output::{OutputAsset, OutputAssets},
};

Expand Down Expand Up @@ -62,12 +61,6 @@ pub trait ChunkingContext {
/// Reference Source Map Assets for chunks
fn reference_chunk_source_maps(self: Vc<Self>, chunk: Vc<Box<dyn OutputAsset>>) -> Vc<bool>;

fn can_be_in_same_chunk(
self: Vc<Self>,
asset_a: Vc<Box<dyn Module>>,
asset_b: Vc<Box<dyn Module>>,
) -> Vc<bool>;

/// Returns a URL (relative or absolute, depending on the asset prefix) to
/// the static asset based on its `ident`.
fn asset_url(self: Vc<Self>, ident: Vc<AssetIdent>) -> Result<Vc<String>>;
Expand Down
18 changes: 0 additions & 18 deletions crates/turbopack-nodejs/src/chunking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,6 @@ impl ChunkingContext for NodeJsChunkingContext {
Vc::cell(true)
}

#[turbo_tasks::function]
async fn can_be_in_same_chunk(
&self,
asset_a: Vc<Box<dyn Module>>,
asset_b: Vc<Box<dyn Module>>,
) -> Result<Vc<bool>> {
let parent_dir = asset_a.ident().path().parent().await?;

let path = asset_b.ident().path().await?;
if let Some(rel_path) = parent_dir.get_path_to(&path) {
if !rel_path.starts_with("node_modules/") && !rel_path.contains("/node_modules/") {
return Ok(Vc::cell(true));
}
}

Ok(Vc::cell(false))
}

#[turbo_tasks::function]
async fn asset_path(
&self,
Expand Down
Loading