refactor: use deno_graph for npm specifiers (#17858)

This changes npm specifiers to be handled by deno_graph and resolved to
an npm package name and version when the specifier is encountered. It
also slightly changes how npm specifier resolution occurs—previously it
would collect all the npm specifiers and resolve them all at once, but
now it resolves them on the fly as they are encountered in the module
graph.

https://github.com/denoland/deno_graph/pull/232

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
David Sherret 2023-02-22 14:15:25 -05:00 committed by GitHub
parent 0f9daaeacb
commit a6ca4d0d61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 1340 additions and 1731 deletions

View file

@ -937,6 +937,8 @@ impl Inner {
self.documents.update_config(
self.maybe_import_map.clone(),
self.maybe_config_file.as_ref(),
self.npm_resolver.api().clone(),
self.npm_resolver.resolution().clone(),
);
self.assets.intitialize(self.snapshot()).await;
@ -1124,6 +1126,8 @@ impl Inner {
self.documents.update_config(
self.maybe_import_map.clone(),
self.maybe_config_file.as_ref(),
self.npm_resolver.api().clone(),
self.npm_resolver.resolution().clone(),
);
self.send_diagnostics_update();
@ -1170,6 +1174,8 @@ impl Inner {
self.documents.update_config(
self.maybe_import_map.clone(),
self.maybe_config_file.as_ref(),
self.npm_resolver.api().clone(),
self.npm_resolver.resolution().clone(),
);
self.refresh_npm_specifiers().await;
self.diagnostics_server.invalidate_all();