mirror of
https://github.com/denoland/deno.git
synced 2025-07-25 14:13:59 +00:00
refactor: Move lockfile to a separate crate (#17503)
Moves the lockfile implementation to a separate crate so other projects like Deploy can use it as well.
This commit is contained in:
parent
cd19231306
commit
bf237c6241
11 changed files with 659 additions and 604 deletions
|
@ -184,19 +184,6 @@ pub struct NpmPackageVersionDistInfo {
|
|||
}
|
||||
|
||||
impl NpmPackageVersionDistInfo {
|
||||
#[cfg(test)]
|
||||
pub fn new(
|
||||
tarball: String,
|
||||
shasum: String,
|
||||
integrity: Option<String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
tarball,
|
||||
shasum,
|
||||
integrity,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn integrity(&self) -> Cow<String> {
|
||||
self
|
||||
.integrity
|
||||
|
|
|
@ -397,10 +397,13 @@ impl NpmResolution {
|
|||
pub fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> {
|
||||
let snapshot = self.snapshot.read();
|
||||
for (package_req, package_id) in snapshot.package_reqs.iter() {
|
||||
lockfile.insert_npm_specifier(package_req, package_id);
|
||||
lockfile.insert_npm_specifier(
|
||||
package_req.to_string(),
|
||||
package_id.as_serialized(),
|
||||
);
|
||||
}
|
||||
for package in snapshot.all_packages() {
|
||||
lockfile.check_or_insert_npm_package(&package)?;
|
||||
lockfile.check_or_insert_npm_package(package.into())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue