mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor(compile): store the npm snapshot in the eszip (#19343)
This commit is contained in:
parent
976c381045
commit
55f0150854
13 changed files with 104 additions and 67 deletions
|
@ -18,7 +18,6 @@ use deno_npm::resolution::NpmResolutionSnapshotCreateOptions;
|
|||
use deno_npm::resolution::PackageNotFoundFromReferrerError;
|
||||
use deno_npm::resolution::PackageNvNotFoundError;
|
||||
use deno_npm::resolution::PackageReqNotFoundError;
|
||||
use deno_npm::resolution::SerializedNpmResolutionSnapshot;
|
||||
use deno_npm::resolution::ValidSerializedNpmResolutionSnapshot;
|
||||
use deno_npm::NpmPackageCacheFolderId;
|
||||
use deno_npm::NpmPackageId;
|
||||
|
@ -50,7 +49,7 @@ impl std::fmt::Debug for NpmResolution {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let snapshot = self.snapshot.read();
|
||||
f.debug_struct("NpmResolution")
|
||||
.field("snapshot", &snapshot.as_serialized())
|
||||
.field("snapshot", &snapshot.as_valid_serialized().as_serialized())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
@ -263,8 +262,20 @@ impl NpmResolution {
|
|||
self.snapshot.read().clone()
|
||||
}
|
||||
|
||||
pub fn serialized_snapshot(&self) -> SerializedNpmResolutionSnapshot {
|
||||
self.snapshot.read().as_serialized()
|
||||
pub fn serialized_valid_snapshot(
|
||||
&self,
|
||||
) -> ValidSerializedNpmResolutionSnapshot {
|
||||
self.snapshot.read().as_valid_serialized()
|
||||
}
|
||||
|
||||
pub fn serialized_valid_snapshot_for_system(
|
||||
&self,
|
||||
system_info: &NpmSystemInfo,
|
||||
) -> ValidSerializedNpmResolutionSnapshot {
|
||||
self
|
||||
.snapshot
|
||||
.read()
|
||||
.as_valid_serialized_for_system(system_info)
|
||||
}
|
||||
|
||||
pub fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue