refactor(npm): use deno_npm and deno_semver (#18602)

This commit is contained in:
David Sherret 2023-04-06 18:46:44 -04:00 committed by GitHub
parent 1586c52b5b
commit d07aa4a072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 759 additions and 5852 deletions

View file

@ -8,14 +8,14 @@ mod lockfile;
pub mod package_json;
pub use self::import_map::resolve_import_map_from_specifier;
use self::lockfile::snapshot_from_lockfile;
use self::package_json::PackageJsonDeps;
use ::import_map::ImportMap;
use deno_core::resolve_url_or_path;
use deno_graph::npm::NpmPackageReqReference;
use deno_npm::resolution::NpmResolutionSnapshot;
use deno_semver::npm::NpmPackageReqReference;
use indexmap::IndexMap;
use crate::npm::NpmRegistryApi;
use crate::npm::NpmResolutionSnapshot;
pub use config_file::BenchConfig;
pub use config_file::CompilerOptions;
pub use config_file::ConfigFile;
@ -65,6 +65,7 @@ use std::sync::Arc;
use crate::cache::DenoDir;
use crate::file_fetcher::FileFetcher;
use crate::npm::NpmProcessState;
use crate::npm::NpmRegistry;
use crate::util::fs::canonicalize_path_maybe_not_exists;
use crate::version;
@ -745,7 +746,7 @@ impl CliOptions {
pub async fn resolve_npm_resolution_snapshot(
&self,
api: &NpmRegistryApi,
api: &NpmRegistry,
) -> Result<Option<NpmResolutionSnapshot>, AnyError> {
if let Some(state) = &*NPM_PROCESS_STATE {
// TODO(bartlomieju): remove this clone
@ -755,7 +756,7 @@ impl CliOptions {
if let Some(lockfile) = self.maybe_lock_file() {
if !lockfile.lock().overwrite {
return Ok(Some(
NpmResolutionSnapshot::from_lockfile(lockfile.clone(), api)
snapshot_from_lockfile(lockfile.clone(), api)
.await
.with_context(|| {
format!(