summaryrefslogtreecommitdiff
path: root/cli/node/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/node/mod.rs')
-rw-r--r--cli/node/mod.rs29
1 files changed, 1 insertions, 28 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs
index 7bb28d984..9ab4574ef 100644
--- a/cli/node/mod.rs
+++ b/cli/node/mod.rs
@@ -25,6 +25,7 @@ use deno_runtime::deno_node::legacy_main_resolve;
use deno_runtime::deno_node::package_exports_resolve;
use deno_runtime::deno_node::package_imports_resolve;
use deno_runtime::deno_node::package_resolve;
+use deno_runtime::deno_node::path_to_declaration_path;
use deno_runtime::deno_node::NodeModuleKind;
use deno_runtime::deno_node::PackageJson;
use deno_runtime::deno_node::PathClean;
@@ -548,34 +549,6 @@ fn mode_conditions(mode: NodeResolutionMode) -> &'static [&'static str] {
}
}
-/// Checks if the resolved file has a corresponding declaration file.
-fn path_to_declaration_path(
- path: PathBuf,
- referrer_kind: NodeModuleKind,
-) -> PathBuf {
- let lowercase_path = path.to_string_lossy().to_lowercase();
- if lowercase_path.ends_with(".d.ts")
- || lowercase_path.ends_with(".d.cts")
- || lowercase_path.ends_with(".d.ts")
- {
- return path;
- }
- let specific_dts_path = match referrer_kind {
- NodeModuleKind::Cjs => path.with_extension("d.cts"),
- NodeModuleKind::Esm => path.with_extension("d.mts"),
- };
- if specific_dts_path.exists() {
- specific_dts_path
- } else {
- let dts_path = path.with_extension("d.ts");
- if dts_path.exists() {
- dts_path
- } else {
- path
- }
- }
-}
-
pub fn node_resolve_binary_export(
pkg_req: &NpmPackageReq,
bin_name: Option<&str>,