diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-14 13:18:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-14 17:18:01 +0000 |
| commit | 1930c09b04bbf2150a601c0fe47c44750d8c2b57 (patch) | |
| tree | 3cda81496abf8d6b339c9ba51e4900ff05388ca8 /core | |
| parent | 485e12062c95326815df0df59007cc31dd93bf8d (diff) | |
refactor(core): remove "resolve_url_or_path_deprecated" (#18174)
Remove remaining usages of "resolve_url_or_path_deprecated" in favor
of "resolve_url_or_path" with explicit calls to
"std::env::current_dir()".
Towards landing https://github.com/denoland/deno/pull/15454
Diffstat (limited to 'core')
| -rw-r--r-- | core/lib.rs | 1 | ||||
| -rw-r--r-- | core/module_specifier.rs | 27 | ||||
| -rw-r--r-- | core/ops_builtin_v8.rs | 10 |
3 files changed, 12 insertions, 26 deletions
diff --git a/core/lib.rs b/core/lib.rs index b48a77f69..08df6e44d 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -72,7 +72,6 @@ pub use crate::module_specifier::resolve_import; pub use crate::module_specifier::resolve_path; pub use crate::module_specifier::resolve_url; pub use crate::module_specifier::resolve_url_or_path; -pub use crate::module_specifier::resolve_url_or_path_deprecated; pub use crate::module_specifier::ModuleResolutionError; pub use crate::module_specifier::ModuleSpecifier; pub use crate::module_specifier::DUMMY_SPECIFIER; diff --git a/core/module_specifier.rs b/core/module_specifier.rs index 6c6dbad95..94ccd298c 100644 --- a/core/module_specifier.rs +++ b/core/module_specifier.rs @@ -121,24 +121,6 @@ pub fn resolve_url( /// as it may be passed to deno as a command line argument. /// The string is interpreted as a URL if it starts with a valid URI scheme, /// e.g. 'http:' or 'file:' or 'git+ssh:'. If not, it's interpreted as a -/// file path; if it is a relative path it's resolved relative to the current -/// working directory. -pub fn resolve_url_or_path_deprecated( - specifier: &str, -) -> Result<ModuleSpecifier, ModuleResolutionError> { - if specifier_has_uri_scheme(specifier) { - resolve_url(specifier) - } else { - let cwd = current_dir() - .map_err(|_| ModuleResolutionError::InvalidPath(specifier.into()))?; - resolve_path(specifier, &cwd) - } -} - -/// Takes a string representing either an absolute URL or a file path, -/// as it may be passed to deno as a command line argument. -/// The string is interpreted as a URL if it starts with a valid URI scheme, -/// e.g. 'http:' or 'file:' or 'git+ssh:'. If not, it's interpreted as a /// file path; if it is a relative path it's resolved relative to passed /// `current_dir`. pub fn resolve_url_or_path( @@ -361,7 +343,7 @@ mod tests { } #[test] - fn test_resolve_url_or_path_deprecated() { + fn test_resolve_url_or_path() { // Absolute URL. let mut tests: Vec<(&str, String)> = vec