summaryrefslogtreecommitdiff
path: root/resolvers/node/sync.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-28 19:17:48 -0400
committerGitHub <noreply@github.com>2024-09-28 19:17:48 -0400
commit5faf769ac61b627d14710cdf487de7cd4eb3f9d3 (patch)
tree2cc4ab975522b3c8845ab3040c010fd998a769a6 /resolvers/node/sync.rs
parent3138478f66823348eb745c7f0c2d34eed378a3f0 (diff)
refactor: extract out sloppy imports resolution from CLI crate (#25920)
This is slow progress towards creating a `deno_resolver` crate. Waiting on: * https://github.com/denoland/deno/pull/25918 * https://github.com/denoland/deno/pull/25916
Diffstat (limited to 'resolvers/node/sync.rs')
-rw-r--r--resolvers/node/sync.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/resolvers/node/sync.rs b/resolvers/node/sync.rs
new file mode 100644
index 000000000..3c4729aa2
--- /dev/null
+++ b/resolvers/node/sync.rs
@@ -0,0 +1,23 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
+pub use inner::*;
+
+#[cfg(feature = "sync")]
+mod inner {
+ #![allow(clippy::disallowed_types)]
+
+ pub use std::sync::Arc as MaybeArc;
+
+ pub use core::marker::Send as MaybeSend;
+ pub use core::marker::Sync as MaybeSync;
+}
+
+#[cfg(not(feature = "sync"))]
+mod inner {
+ pub use std::rc::Rc as MaybeArc;
+
+ pub trait MaybeSync {}
+ impl<T> MaybeSync for T where T: ?Sized {}
+ pub trait MaybeSend {}
+ impl<T> MaybeSend for T where T: ?Sized {}
+}