diff options
Diffstat (limited to 'cli/npm/resolvers/global.rs')
-rw-r--r-- | cli/npm/resolvers/global.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cli/npm/resolvers/global.rs b/cli/npm/resolvers/global.rs index 94b963898..c1b6818fd 100644 --- a/cli/npm/resolvers/global.rs +++ b/cli/npm/resolvers/global.rs @@ -13,6 +13,7 @@ use deno_core::futures::FutureExt; use deno_core::url::Url; use crate::npm::resolution::NpmResolution; +use crate::npm::resolution::NpmResolutionSnapshot; use crate::npm::resolvers::common::cache_packages; use crate::npm::NpmCache; use crate::npm::NpmPackageId; @@ -31,9 +32,13 @@ pub struct GlobalNpmPackageResolver { } impl GlobalNpmPackageResolver { - pub fn new(cache: NpmCache, api: NpmRegistryApi) -> Self { + pub fn new( + cache: NpmCache, + api: NpmRegistryApi, + initial_snapshot: Option<NpmResolutionSnapshot>, + ) -> Self { let registry_url = api.base_url().to_owned(); - let resolution = Arc::new(NpmResolution::new(api)); + let resolution = Arc::new(NpmResolution::new(api, initial_snapshot)); Self { cache, @@ -105,4 +110,8 @@ impl InnerNpmPackageResolver for GlobalNpmPackageResolver { let registry_path = self.cache.registry_folder(&self.registry_url); ensure_registry_read_permission(®istry_path, path) } + + fn snapshot(&self) -> NpmResolutionSnapshot { + self.resolution.snapshot() + } } |