Skip to content

Commit

Permalink
ok could this work
Browse files Browse the repository at this point in the history
  • Loading branch information
theswerd committed Jan 9, 2025
1 parent 86ca545 commit 656da92
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl CliFactory {
self.pkg_json_resolver().clone(),
self.sys(),
node_resolver::ConditionsFromResolutionMode::new(
&node_resolver::deno_conditions_from_resolution_mode,
node_resolver::deno_conditions_from_resolution_mode,
),
)))
}
Expand Down
2 changes: 1 addition & 1 deletion cli/lsp/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ impl<'a> ResolverFactory<'a> {
self.pkg_json_resolver.clone(),
self.sys.clone(),
node_resolver::ConditionsFromResolutionMode::new(
&node_resolver::deno_conditions_from_resolution_mode,
node_resolver::deno_conditions_from_resolution_mode,
),
)))
})
Expand Down
2 changes: 1 addition & 1 deletion cli/standalone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ pub async fn run(
pkg_json_resolver.clone(),
sys.clone(),
node_resolver::ConditionsFromResolutionMode::new(
&node_resolver::deno_conditions_from_resolution_mode,
node_resolver::deno_conditions_from_resolution_mode,
),
));
let cjs_tracker = Arc::new(CjsTracker::new(
Expand Down
12 changes: 6 additions & 6 deletions resolvers/node/resolution.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2018-2025 the Deno authors. MIT license.

use crate::sync::MaybeArc;
use std::borrow::Cow;
use std::fmt::Debug;
use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;

use anyhow::bail;
use anyhow::Error as AnyError;
Expand Down Expand Up @@ -66,7 +66,7 @@ pub fn deno_conditions_from_resolution_mode(
}

pub struct ConditionsFromResolutionMode {
pub func: Arc<dyn Fn(ResolutionMode) -> &'static [&'static str]>,
pub func: MaybeArc<dyn Fn(ResolutionMode) -> &'static [&'static str]>,
}

impl Debug for ConditionsFromResolutionMode {
Expand All @@ -76,10 +76,10 @@ impl Debug for ConditionsFromResolutionMode {
}

impl ConditionsFromResolutionMode {
pub fn new(
func: Arc<dyn Fn(ResolutionMode) -> &'static [&'static str]>,
) -> Self {
Self { func }
pub fn new(func: dyn Fn(ResolutionMode) -> &'static [&'static str]) -> Self {
Self {
func: MaybeArc::new(func),
}
}
}

Expand Down

0 comments on commit 656da92

Please sign in to comment.