From be849526b64896e3d8e8a7e20d9bd9f842390a2d Mon Sep 17 00:00:00 2001 From: stelzo Date: Tue, 25 Feb 2025 21:40:38 +0100 Subject: [PATCH] rm falsely classified docs --- crates/typst-kit/src/package.rs | 94 --------------------------------- 1 file changed, 94 deletions(-) diff --git a/crates/typst-kit/src/package.rs b/crates/typst-kit/src/package.rs index 3a7aac2d..1aef72c6 100644 --- a/crates/typst-kit/src/package.rs +++ b/crates/typst-kit/src/package.rs @@ -38,23 +38,6 @@ pub struct PackageStorage { impl PackageStorage { /// Creates a new package storage for the given package paths. Falls back to /// the recommended XDG directories if they are `None`. - /*pub fn new( - package_vendor_path: Option, - package_cache_path: Option, - package_path: Option, - downloader: Downloader, - workdir: Option, - ) -> Self { - Self::with_index( - package_vendor_path, - package_cache_path, - package_path, - downloader, - OnceCell::new(), - workdir, - ) - }*/ - pub fn new( package_vendor_path: Option, package_cache_path: Option, @@ -76,31 +59,6 @@ impl PackageStorage { } } - /// Creates a new package storage with a pre-defined index. - /// - /// Useful for testing. - /*fn with_index( - package_vendor_path: Option, - package_cache_path: Option, - package_path: Option, - downloader: Downloader, - index: OnceCell>, - workdir: Option, - ) -> Self { - Self { - package_vendor_path: package_vendor_path - .or_else(|| workdir.map(|workdir| workdir.join(DEFAULT_VENDOR_SUBDIR))), - package_cache_path: package_cache_path.or_else(|| { - dirs::cache_dir().map(|cache_dir| cache_dir.join(DEFAULT_PACKAGES_SUBDIR)) - }), - package_path: package_path.or_else(|| { - dirs::data_dir().map(|data_dir| data_dir.join(DEFAULT_PACKAGES_SUBDIR)) - }), - downloader, - index, - } - }*/ - /// Returns the path at which non-local packages should be stored when /// downloaded. pub fn package_cache_path(&self) -> Option<&Path> { @@ -228,55 +186,3 @@ impl PackageStorage { } } } - -/* -/// Minimal information required about a package to determine its latest -/// version. -#[derive(Deserialize)] -struct MinimalPackageInfo { - name: String, - version: PackageVersion, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn lazy_deser_index() { - let storage = PackageStorage::with_index( - None, - None, - Downloader::new("typst/test"), - OnceCell::with_value(vec![ - serde_json::json!({ - "name": "charged-ieee", - "version": "0.1.0", - "entrypoint": "lib.typ", - }), - serde_json::json!({ - "name": "unequivocal-ams", - // This version number is currently not valid, so this package - // can't be parsed. - "version": "0.2.0-dev", - "entrypoint": "lib.typ", - }), - ]), - ); - - let ieee_version = storage.determine_latest_version(&VersionlessPackageSpec { - namespace: "preview".into(), - name: "charged-ieee".into(), - }); - assert_eq!(ieee_version, Ok(PackageVersion { major: 0, minor: 1, patch: 0 })); - - let ams_version = storage.determine_latest_version(&VersionlessPackageSpec { - namespace: "preview".into(), - name: "unequivocal-ams".into(), - }); - assert_eq!( - ams_version, - Err("failed to find package @preview/unequivocal-ams".into()) - ) - } -}*/