diff options
Diffstat (limited to 'cli/compat')
-rw-r--r-- | cli/compat/errors.rs | 20 | ||||
-rw-r--r-- | cli/compat/esm_resolver.rs | 2 | ||||
-rw-r--r-- | cli/compat/mod.rs | 12 |
3 files changed, 15 insertions, 19 deletions
diff --git a/cli/compat/errors.rs b/cli/compat/errors.rs index fa9846ed6..d7d1bbd05 100644 --- a/cli/compat/errors.rs +++ b/cli/compat/errors.rs @@ -5,7 +5,7 @@ use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::url::Url; -pub(crate) fn err_invalid_module_specifier( +pub fn err_invalid_module_specifier( request: &str, reason: &str, maybe_base: Option<String>, @@ -22,7 +22,7 @@ pub(crate) fn err_invalid_module_specifier( type_error(msg) } -pub(crate) fn err_invalid_package_config( +pub fn err_invalid_package_config( path: &str, maybe_base: Option<String>, maybe_message: Option<String>, @@ -43,22 +43,18 @@ pub(crate) fn err_invalid_package_config( generic_error(msg) } -pub(crate) fn err_module_not_found( - path: &str, - base: &str, - typ: &str, -) -> AnyError { +pub fn err_module_not_found(path: &str, base: &str, typ: &str) -> AnyError { generic_error(format!( "[ERR_MODULE_NOT_FOUND] Cannot find {} \"{}\" imported from \"{}\"", typ, path, base )) } -pub(crate) fn err_unsupported_dir_import(path: &str, base: &str) -> AnyError { +pub fn err_unsupported_dir_import(path: &str, base: &str) -> AnyError { generic_error(format!("[ERR_UNSUPPORTED_DIR_IMPORT] Directory import '{}' is not supported resolving ES modules imported from {}", path, base)) } -pub(crate) fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError { +pub fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError { let mut msg = "[ERR_UNSUPPORTED_ESM_URL_SCHEME] Only file and data URLS are supported by the default ESM loader" .to_string(); @@ -74,7 +70,7 @@ pub(crate) fn err_unsupported_esm_url_scheme(url: &Url) -> AnyError { generic_error(msg) } -pub(crate) fn err_invalid_package_target( +pub fn err_invalid_package_target( pkg_path: String, key: String, target: String, @@ -102,7 +98,7 @@ pub(crate) fn err_invalid_package_target( generic_error(msg) } -pub(crate) fn err_package_path_not_exported( +pub fn err_package_path_not_exported( pkg_path: String, subpath: String, maybe_base: Option<String>, @@ -125,7 +121,7 @@ pub(crate) fn err_package_path_not_exported( generic_error(msg) } -pub(crate) fn err_package_import_not_defined( +pub fn err_package_import_not_defined( specifier: &str, package_path: Option<String>, base: &str, diff --git a/cli/compat/esm_resolver.rs b/cli/compat/esm_resolver.rs index 004ea9bfa..a36aa51c7 100644 --- a/cli/compat/esm_resolver.rs +++ b/cli/compat/esm_resolver.rs @@ -15,7 +15,7 @@ use regex::Regex; use std::path::PathBuf; #[derive(Debug, Default)] -pub(crate) struct NodeEsmResolver { +pub struct NodeEsmResolver { maybe_import_map_resolver: Option<ImportMapResolver>, } diff --git a/cli/compat/mod.rs b/cli/compat/mod.rs index e133368d2..3f3743d97 100644 --- a/cli/compat/mod.rs +++ b/cli/compat/mod.rs @@ -14,7 +14,7 @@ use once_cell::sync::Lazy; use std::sync::Arc; pub use esm_resolver::check_if_should_use_esm_loader; -pub(crate) use esm_resolver::NodeEsmResolver; +pub use esm_resolver::NodeEsmResolver; // TODO(bartlomieju): this needs to be bumped manually for // each release, a better mechanism is preferable, but it's a quick and dirty @@ -77,20 +77,20 @@ static NODE_COMPAT_URL: Lazy<String> = Lazy::new(|| { static GLOBAL_URL_STR: Lazy<String> = Lazy::new(|| format!("{}node/global.ts", NODE_COMPAT_URL.as_str())); -pub(crate) static GLOBAL_URL: Lazy<Url> = +pub static GLOBAL_URL: Lazy<Url> = Lazy::new(|| Url::parse(&GLOBAL_URL_STR).unwrap()); static MODULE_URL_STR: Lazy<String> = Lazy::new(|| format!("{}node/module.ts", NODE_COMPAT_URL.as_str())); -pub(crate) static MODULE_URL: Lazy<Url> = +pub static MODULE_URL: Lazy<Url> = Lazy::new(|| Url::parse(&MODULE_URL_STR).unwrap()); static COMPAT_IMPORT_URL: Lazy<Url> = Lazy::new(|| Url::parse("flags:compat").unwrap()); /// Provide imports into a module graph when the compat flag is true. -pub(crate) fn get_node_imports() -> Vec<(Url, Vec<String>)> { +pub fn get_node_imports() -> Vec<(Url, Vec<String>)> { vec![(COMPAT_IMPORT_URL.clone(), vec![GLOBAL_URL_STR.clone()])] } @@ -104,7 +104,7 @@ fn try_resolve_builtin_module(specifier: &str) -> Option<Url> { } } -pub(crate) fn load_cjs_module( +pub fn load_cjs_module( js_runtime: &mut JsRuntime, module: &str, main: bool, @@ -123,7 +123,7 @@ pub(crate) fn load_cjs_module( Ok(()) } -pub(crate) fn add_global_require( +pub fn add_global_require( js_runtime: &mut JsRuntime, main_module: &str, ) -> Result<(), AnyError> { |