Skip to content

Commit 799fcd5

Browse files
committed
feat(turbopack): add resolve plugin condition variant of Always and Never
1 parent 312ba15 commit 799fcd5

File tree

1 file changed

+2
-34
lines changed
  • turbopack/crates/turbopack-core/src/resolve

1 file changed

+2
-34
lines changed

turbopack/crates/turbopack-core/src/resolve/plugin.rs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,6 @@ impl AfterResolvePluginCondition {
4040
}
4141
}
4242

43-
#[turbo_tasks::value(transparent)]
44-
pub struct OptionAfterResolvePluginCondition(Option<ResolvedVc<AfterResolvePluginCondition>>);
45-
46-
#[turbo_tasks::value_impl]
47-
impl OptionAfterResolvePluginCondition {
48-
#[turbo_tasks::function]
49-
pub fn none() -> Vc<Self> {
50-
Vc::cell(None)
51-
}
52-
53-
#[turbo_tasks::function]
54-
pub fn some(condition: ResolvedVc<AfterResolvePluginCondition>) -> Vc<Self> {
55-
Vc::cell(Some(condition))
56-
}
57-
}
58-
5943
/// A condition which determines if the hooks of a resolve plugin gets called.
6044
#[turbo_tasks::value]
6145
pub enum BeforeResolvePluginCondition {
@@ -96,26 +80,10 @@ impl BeforeResolvePluginCondition {
9680
}
9781
}
9882

99-
#[turbo_tasks::value(transparent)]
100-
pub struct OptionBeforeResolvePluginCondition(Option<ResolvedVc<BeforeResolvePluginCondition>>);
101-
102-
#[turbo_tasks::value_impl]
103-
impl OptionBeforeResolvePluginCondition {
104-
#[turbo_tasks::function]
105-
pub fn none() -> Vc<Self> {
106-
Vc::cell(None)
107-
}
108-
109-
#[turbo_tasks::function]
110-
pub fn some(condition: ResolvedVc<BeforeResolvePluginCondition>) -> Vc<Self> {
111-
Vc::cell(Some(condition))
112-
}
113-
}
114-
11583
#[turbo_tasks::value_trait]
11684
pub trait BeforeResolvePlugin {
11785
#[turbo_tasks::function]
118-
fn before_resolve_condition(self: Vc<Self>) -> Vc<OptionBeforeResolvePluginCondition>;
86+
fn before_resolve_condition(self: Vc<Self>) -> Vc<BeforeResolvePluginCondition>;
11987

12088
#[turbo_tasks::function]
12189
fn before_resolve(
@@ -130,7 +98,7 @@ pub trait BeforeResolvePlugin {
13098
pub trait AfterResolvePlugin {
13199
/// A condition which determines if the hooks gets called.
132100
#[turbo_tasks::function]
133-
fn after_resolve_condition(self: Vc<Self>) -> Vc<OptionAfterResolvePluginCondition>;
101+
fn after_resolve_condition(self: Vc<Self>) -> Vc<AfterResolvePluginCondition>;
134102

135103
/// This hook gets called when a full filepath has been resolved and the
136104
/// condition matches. If a value is returned it replaces the resolve

0 commit comments

Comments
 (0)