summaryrefslogtreecommitdiff
path: root/ext/node/ops/require.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-09 12:15:03 -0400
committerGitHub <noreply@github.com>2024-07-09 12:15:03 -0400
commit839caf6fafdf9ca1cdec6cd9cef38296be41145f (patch)
tree691dba21b45e9c5640275304308aa5d8a5d4a7ba /ext/node/ops/require.rs
parent07613a6bf26d9112d47fda9e502425395bd78105 (diff)
refactor: use concrete error types for node resolution (#24470)
This will help clean up some of the code in the CLI because we'll be able to tell how the resolution failed (not part of this PR).
Diffstat (limited to 'ext/node/ops/require.rs')
-rw-r--r--ext/node/ops/require.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/node/ops/require.rs b/ext/node/ops/require.rs
index 3702a9047..d03b3dd9c 100644
--- a/ext/node/ops/require.rs
+++ b/ext/node/ops/require.rs
@@ -421,7 +421,7 @@ where
&pkg.path,
&expansion,
exports,
- &referrer,
+ Some(&referrer),
NodeModuleKind::Cjs,
resolution::REQUIRE_CONDITIONS,
NodeResolutionMode::Execution,
@@ -509,7 +509,7 @@ where
&pkg.path,
&format!(".{expansion}"),
exports,
- &referrer,
+ Some(&referrer),
NodeModuleKind::Cjs,
resolution::REQUIRE_CONDITIONS,
NodeResolutionMode::Execution,
@@ -538,6 +538,7 @@ where
node_resolver
.get_closest_package_json(&Url::from_file_path(filename).unwrap())
.map(|maybe_pkg| maybe_pkg.map(|pkg| (*pkg).clone()))
+ .map_err(AnyError::from)
}
#[op2]
@@ -586,7 +587,7 @@ where
deno_core::url::Url::from_file_path(&referrer_filename).unwrap();
let url = node_resolver.package_imports_resolve(
&request,
- &referrer_url,
+ Some(&referrer_url),
NodeModuleKind::Cjs,
Some(&pkg),
resolution::REQUIRE_CONDITIONS,