diff options
author | Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com> | 2024-08-21 15:23:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 15:23:32 -0700 |
commit | 48da3c17ea905f50b82948e6f94795e1589f852e (patch) | |
tree | e65d5da97ef0cd4b9f67972b8ba647420d39952e /cli/module_loader.rs | |
parent | 9aaad3064a412b24e88e308750e038d4e1df6f3c (diff) |
fix(add): Handle packages without root exports (#25102)
Fixes #24607.
This PR makes the logic that caches top level dependencies (things
present in import map) smarter, so we handle JSR dependencies without
root exports.
Diffstat (limited to 'cli/module_loader.rs')
-rw-r--r-- | cli/module_loader.rs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/cli/module_loader.rs b/cli/module_loader.rs index 9f5208936..3208d1365 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -18,7 +18,6 @@ use crate::cache::CodeCache; use crate::cache::FastInsecureHasher; use crate::cache::ParsedSourceCache; use crate::emit::Emitter; -use crate::factory::CliFactory; use crate::graph_container::MainModuleGraphContainer; use crate::graph_container::ModuleGraphContainer; use crate::graph_container::ModuleGraphUpdatePermit; @@ -70,54 +69,6 @@ use deno_runtime::deno_permissions::PermissionsContainer; use deno_semver::npm::NpmPackageReqReference; use node_resolver::NodeResolutionMode; -pub async fn load_top_level_deps(factory: &CliFactory) -> Result<(), AnyError> { - let npm_resolver = factory.npm_resolver().await?; - let cli_options = factory.cli_options()?; - if let Some(npm_resolver) = npm_resolver.as_managed() { - if !npm_resolver.ensure_top_level_package_json_install().await? { - if let Some(lockfile) = cli_options.maybe_lockfile() { - lockfile.error_if_changed()?; - } - - npm_resolver.cache_packages().await?; - } - } - // cache as many entries in the import map as we can - let resolver = factory.workspace_resolver().await?; - if let Some(import_map) = resolver.maybe_import_map() { - let roots = import_map - .imports() - .entries() - .filter_map(|entry| { - if entry.key.ends_with('/') { - None - } else { - entry.value.cloned() - } - }) - .collect::<Vec<_>>(); - let mut graph_permit = factory - .main_module_graph_container() - .await? - .acquire_update_permit() - .await; - let graph = graph_permit.graph_mut(); - factory - .module_load_preparer() - .await? - .prepare_module_load( - graph, - &roots, - false, - factory.cli_options()?.ts_type_lib_window(), - deno_runtime::deno_permissions::PermissionsContainer::allow_all(), - ) - .await?; - } - - Ok(()) -} - pub struct ModuleLoadPreparer { options: Arc<CliOptions>, lockfile: Option<Arc<CliLockfile>>, |