Skip to content

Commit 78f878b

Browse files
committed
fix integration of analysis add a special case for modules with no imports, so those can be trimmed during graph construction
1 parent cefe2b3 commit 78f878b

File tree

4 files changed

+244
-152
lines changed

4 files changed

+244
-152
lines changed

turbopack/crates/turbopack-core/src/module.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use serde::{Deserialize, Serialize};
12
use turbo_rcstr::RcStr;
2-
use turbo_tasks::{ResolvedVc, TaskInput, ValueToString, Vc};
3+
use turbo_tasks::{NonLocalValue, ResolvedVc, TaskInput, ValueToString, Vc, trace::TraceRawVcs};
34
use turbo_tasks_fs::glob::Glob;
45

56
use crate::{asset::Asset, ident::AssetIdent, reference::ModuleReferences, source::OptionSource};
@@ -11,6 +12,20 @@ pub enum StyleType {
1112
GlobalStyle,
1213
}
1314

15+
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, NonLocalValue, TraceRawVcs)]
16+
pub enum ModuleSideEffects {
17+
/// Analysis determined that the module evaluation is side effect free
18+
/// the module may still be side effectful based on its imports.
19+
ModuleEvaluationIsSideEffectFree,
20+
/// Is known to be side effect free either due to static analysis or some kind of configuration.
21+
/// ```js
22+
/// "use turbopack no side effects"
23+
/// ```
24+
SideEffectFree,
25+
// Neither of the above, so we should assume it has side effects.
26+
SideEffectful,
27+
}
28+
1429
/// A module. This usually represents parsed source code, which has references
1530
/// to other modules.
1631
#[turbo_tasks::value_trait]

0 commit comments

Comments
 (0)