refactor(npm): reorganize initialization of compat layer (#16471)

Ensures that "std/node" graph is analyzed only once.
This commit is contained in:
Bartek Iwańczuk 2022-10-28 21:53:55 +02:00 committed by GitHub
parent e202f890f0
commit 2c674dcd20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 23 deletions

View file

@ -292,17 +292,6 @@ async fn load_and_type_check(
for file in files {
let specifier = resolve_url_or_path(file)?;
// TODO(bartlomieju): in the future (after all relevant deno subcommands
// have support for npm: specifiers), it would be good to unify this code
// in `ProcState::prepare_module_load`.
if let Ok(package_ref) = NpmPackageReference::from_specifier(&specifier) {
ps.npm_resolver
.add_package_reqs(vec![package_ref.req.clone()])
.await?;
ps.prepare_node_std_graph().await?;
continue;
}
ps.prepare_module_load(
vec![specifier],
false,