Skip to content

Commit

Permalink
refactor(turbopack-ecmascript): Use ResolvedVc in CodeGen type
Browse files Browse the repository at this point in the history
  • Loading branch information
bgw committed Jan 10, 2025
1 parent 3bdd0b7 commit 11eabbe
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 118 deletions.
10 changes: 6 additions & 4 deletions turbopack/crates/turbopack-ecmascript/src/code_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use swc_core::ecma::{
visit::{AstParentKind, VisitMut},
};
use turbo_rcstr::RcStr;
use turbo_tasks::{debug::ValueDebugFormat, trace::TraceRawVcs, ResolvedVc, Vc};
use turbo_tasks::{debug::ValueDebugFormat, trace::TraceRawVcs, NonLocalValue, ResolvedVc, Vc};
use turbopack_core::chunk::{AsyncModuleInfo, ChunkingContext};

/// impl of code generation inferred from a ModuleReference.
Expand Down Expand Up @@ -106,13 +106,15 @@ pub trait CodeGenerateableWithAsyncModuleInfo {
) -> Vc<CodeGeneration>;
}

#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, ValueDebugFormat)]
#[derive(
Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TraceRawVcs, ValueDebugFormat, NonLocalValue,
)]
pub enum CodeGen {
CodeGenerateable(Vc<Box<dyn CodeGenerateable>>),
CodeGenerateable(ResolvedVc<Box<dyn CodeGenerateable>>),
CodeGenerateableWithAsyncModuleInfo(ResolvedVc<Box<dyn CodeGenerateableWithAsyncModuleInfo>>),
}

#[turbo_tasks::value(transparent, local)]
#[turbo_tasks::value(transparent)]
pub struct CodeGenerateables(Vec<CodeGen>);

pub fn path_to(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
/// Makes code changes to remove export/import declarations and places the
/// expr/decl in a normal statement. Unnamed expr/decl will be named with the
/// magic identifier "export default"
#[turbo_tasks::value]
#[turbo_tasks::value(shared)]
#[derive(Hash, Debug)]
pub struct EsmModuleItem {
pub path: ResolvedVc<AstPath>,
Expand Down
Loading

0 comments on commit 11eabbe

Please sign in to comment.