diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-09-28 13:04:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 13:04:16 -0400 |
commit | d677ba67f50e5edb0491d8ed1e4171473d662081 (patch) | |
tree | 9f8740666298ac8e1041fa3e169d8f3a9e074448 /cli/npm/resolvers/global.rs | |
parent | 23125b275f282f96a6316d11f97e5603dab0d009 (diff) |
feat(npm): functionality to support child_process.fork (#15891)
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() + } } |