Skip to content

Commit

Permalink
remove EcmascriptChunkingContext
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed May 17, 2024
1 parent 8f38e5c commit 4d3a98e
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions crates/turbopack-ecmascript/src/references/external_module.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fmt::Display, io::Write};

use anyhow::{Context, Result};
use anyhow::Result;
use serde::{Deserialize, Serialize};
use turbo_tasks::{trace::TraceRawVcs, TaskInput, Vc};
use turbo_tasks_fs::{glob::Glob, rope::RopeBuilder, FileContent, FileSystem, VirtualFileSystem};
Expand All @@ -15,11 +15,11 @@ use turbopack_core::{
use crate::{
chunk::{
EcmascriptChunkItem, EcmascriptChunkItemContent, EcmascriptChunkPlaceable,
EcmascriptChunkType, EcmascriptChunkingContext, EcmascriptExports,
EcmascriptChunkType, EcmascriptExports,
},
references::async_module::{AsyncModule, OptionAsyncModule},
utils::StringifyJs,
EcmascriptModuleContent,
EcmascriptModuleContent, EcmascriptOptions,
};

#[turbo_tasks::function]
Expand Down Expand Up @@ -123,14 +123,6 @@ impl ChunkableModule for CachedExternalModule {
self: Vc<Self>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
) -> Result<Vc<Box<dyn ChunkItem>>> {
let chunking_context =
Vc::try_resolve_downcast::<Box<dyn EcmascriptChunkingContext>>(chunking_context)
.await?
.context(
"chunking context must impl EcmascriptChunkingContext to use \
WebAssemblyModuleAsset",
)?;

Ok(Vc::upcast(
CachedExternalModuleChunkItem {
module: self,
Expand Down Expand Up @@ -181,7 +173,7 @@ impl EcmascriptChunkPlaceable for CachedExternalModule {
#[turbo_tasks::value]
pub struct CachedExternalModuleChunkItem {
module: Vc<CachedExternalModule>,
chunking_context: Vc<Box<dyn EcmascriptChunkingContext>>,
chunking_context: Vc<Box<dyn ChunkingContext>>,
}

#[turbo_tasks::value_impl]
Expand All @@ -208,7 +200,7 @@ impl ChunkItem for CachedExternalModuleChunkItem {

#[turbo_tasks::function]
fn chunking_context(&self) -> Vc<Box<dyn ChunkingContext>> {
Vc::upcast(self.chunking_context)
self.chunking_context
}

#[turbo_tasks::function]
Expand All @@ -222,7 +214,7 @@ impl ChunkItem for CachedExternalModuleChunkItem {
#[turbo_tasks::value_impl]
impl EcmascriptChunkItem for CachedExternalModuleChunkItem {
#[turbo_tasks::function]
fn chunking_context(&self) -> Vc<Box<dyn EcmascriptChunkingContext>> {
fn chunking_context(&self) -> Vc<Box<dyn ChunkingContext>> {
self.chunking_context
}

Expand All @@ -244,6 +236,7 @@ impl EcmascriptChunkItem for CachedExternalModuleChunkItem {
Ok(EcmascriptChunkItemContent::new(
self.module.content(),
self.chunking_context,
EcmascriptOptions::default().cell(),
async_module_options,
))
}
Expand Down

0 comments on commit 4d3a98e

Please sign in to comment.