mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
feat(npm): functionality to support child_process.fork (#15891)
This commit is contained in:
parent
23125b275f
commit
d677ba67f5
18 changed files with 232 additions and 21 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue