From 80e2dfe87222d12237289e6c8204dfc6c3975cc3 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 27 Aug 2024 21:19:59 -0400 Subject: [PATCH] fix: use normalized version constraints (#38) --- Cargo.lock | 4 +- Cargo.toml | 2 +- src/error.rs | 50 +++++++++---------- src/lib.rs | 42 +++++++--------- src/printer.rs | 49 ++++++++++++------ tests/specs/config_changes/DenoIssue22250.txt | 4 +- .../config_changes/NoConfigMaintains.txt | 14 +++--- .../config_changes/NoConfigMaintains_v4.txt | 14 +++--- .../NoConfigWorkspaceMaintains.txt | 14 +++--- .../config_changes/NoNpmMaintainsNpm.txt | 6 +-- .../NoNpmWorkspaceMaintainsNpm.txt | 16 +++--- .../config_changes/RemovedConfigRemoves.txt | 2 +- .../config_changes/RemovedDenoJsonRemoves.txt | 6 +-- .../RemovedPackageJsonRemoves.txt | 10 ++-- .../config_changes/RemovingOakThenDax.txt | 12 ++--- .../config_changes/RemovingWorkspaceDep.txt | 8 +-- .../RemovingWorkspaceMember.txt | 8 +-- .../ShiftingDepsDifferentWorkspaceMember.txt | 8 +-- ...s_v3_jsr_same_dep_different_specifiers.txt | 15 +++--- .../transforms/upgrades_v3_real_example_1.txt | 38 +++++++------- 20 files changed, 169 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48e6f23..18e2c0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "deno_semver" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bbee630608a10a9da8802e5945eccfeb01e7b7676fe4dc4e37825b61dc234bc" +checksum = "eef522937758930b9d6897631fa94bc69bcbbe78613c939ab2054ca96191afbd" dependencies = [ "monch", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 09819da..c1d0992 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ path = "tests/spec_test.rs" harness = false [dependencies] -deno_semver = "0.5.11" +deno_semver = "0.5.12" serde = { version = "1.0.149", features = ["derive"] } serde_json = "1.0.85" thiserror = "1.0.40" diff --git a/src/error.rs b/src/error.rs index d391178..e5477f8 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,37 +1,33 @@ // Copyright 2018-2024 the Deno authors. MIT license. +use deno_semver::jsr::JsrDepPackageReqParseError; use deno_semver::package::PackageNv; use thiserror::Error; use crate::transforms::TransformError; -#[derive(Debug)] +#[derive(Debug, Error)] +#[error("Failed reading lockfile at '{file_path}'")] pub struct LockfileError { pub file_path: String, - pub reason: LockfileErrorReason, -} - -impl std::error::Error for LockfileError {} - -impl std::fmt::Display for LockfileError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match &self.reason { - LockfileErrorReason::Empty => write!(f, "Unable to read lockfile. Lockfile was empty at '{}'.", self.file_path), - LockfileErrorReason::ParseError(e) => write!(f, "Unable to parse contents of lockfile '{}': {:#}.", self.file_path, e), - LockfileErrorReason::DeserializationError(e) => write!(f, "Unable to deserialize lockfile '{}': {:#}.", self.file_path, e), - LockfileErrorReason::UnsupportedVersion { version } => write!(f, "Unsupported lockfile version '{}'. Try upgrading Deno or recreating the lockfile at '{}'.", version, self.file_path), - LockfileErrorReason::TransformError(e) => write!(f, "Unable to upgrade old lockfile '{}': {:#}.", self.file_path, e), - } - } + #[source] + pub source: LockfileErrorReason, } -#[derive(Debug)] +#[derive(Debug, Error)] pub enum LockfileErrorReason { + #[error("Lockfile was empty")] Empty, + #[error("Failed parsing. Lockfile may be corrupt")] ParseError(serde_json::Error), - DeserializationError(DeserializationError), + #[error("Failed deserializing. Lockfile may be corrupt")] + DeserializationError(#[source] DeserializationError), + #[error("Unsupported lockfile version '{version}'. Try upgrading Deno or recreating the lockfile")] UnsupportedVersion { version: String }, - TransformError(TransformError), + #[error( + "Failed upgrading lockfile to latest version. Lockfile may be corrupt" + )] + TransformError(#[source] TransformError), } impl From for LockfileErrorReason { @@ -44,19 +40,21 @@ impl From for LockfileErrorReason { pub enum DeserializationError { #[error("Invalid {0} section: {1:#}")] FailedDeserializing(&'static str, serde_json::Error), - #[error("Invalid npm package '{0}'. Lockfile may be corrupt or you might be using an old version of Deno.")] + #[error("Invalid npm package '{0}'")] InvalidNpmPackageId(String), - #[error("Invalid npm package dependency '{0}'. Lockfile may be corrupt or you might be using an old version of Deno.")] + #[error("Invalid npm package dependency '{0}'")] InvalidNpmPackageDependency(String), - #[error("Invalid package specifier '{0}'. Lockfile may be corrupt or you might be using an old version of Deno.")] - InvalidPackageSpecifier(String), - #[error("Invalid package specifier version '{version}' for '{specifier}'. Lockfile may be corrupt or you might be using an old version of Deno.")] + #[error(transparent)] + InvalidPackageSpecifier(#[from] JsrDepPackageReqParseError), + #[error("Invalid package specifier version '{version}' for '{specifier}'")] InvalidPackageSpecifierVersion { specifier: String, version: String }, - #[error("Invalid jsr dependency '{dependency}' for '{package}'. Lockfile may be corrupt or you might be using an old version of Deno.")] + #[error("Invalid jsr dependency '{dependency}' for '{package}'")] InvalidJsrDependency { package: PackageNv, dependency: String, }, - #[error("npm package '{0}' was not found and could not have its version resolved. Lockfile may be corrupt.")] + #[error( + "npm package '{0}' was not found and could not have its version resolved" + )] MissingPackage(String), } diff --git a/src/lib.rs b/src/lib.rs index 07dcbbb..73f4d2f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -243,10 +243,7 @@ impl LockfileContent { let mut specifiers = HashMap::with_capacity(deserialized_specifiers.len()); for (key, value) in deserialized_specifiers { - let dep = JsrDepPackageReq::from_str(&key).map_err(|_err| { - // todo(dsherret): surface internal error here - DeserializationError::InvalidPackageSpecifier(key.to_string()) - })?; + let dep = JsrDepPackageReq::from_str(&key)?; specifiers.insert(dep, value); } @@ -458,14 +455,14 @@ impl Lockfile { if opts.content.trim().is_empty() { return Err(Box::new(LockfileError { file_path: opts.file_path.display().to_string(), - reason: LockfileErrorReason::Empty, + source: LockfileErrorReason::Empty, })); } let content = load_content(opts.content).map_err(|reason| LockfileError { file_path: opts.file_path.display().to_string(), - reason, + source: reason, })?; Ok(Lockfile { overwrite: opts.overwrite, @@ -850,18 +847,18 @@ mod tests { #[test] fn future_version_unsupported() { let file_path = PathBuf::from("lockfile.json"); - assert_eq!( - Lockfile::new( - NewLockfileOptions { - file_path, - content: "{ \"version\": \"2000\" }", - overwrite: false, - } - ) - .err() - .unwrap().to_string(), - "Unsupported lockfile version '2000'. Try upgrading Deno or recreating the lockfile at 'lockfile.json'.".to_string() - ); + let err = Lockfile::new(NewLockfileOptions { + file_path, + content: "{ \"version\": \"2000\" }", + overwrite: false, + }) + .unwrap_err(); + match err.source { + LockfileErrorReason::UnsupportedVersion { version } => { + assert_eq!(version, "2000") + } + _ => unreachable!(), + } } #[test] @@ -1154,8 +1151,8 @@ mod tests { r#"{ "version": "4", "specifiers": { - "jsr:@foo/bar@^2": "jsr:@foo/bar@2.1.2", - "jsr:path": "jsr:@std/path@0.75.1" + "jsr:@foo/bar@2": "jsr:@foo/bar@2.1.2", + "jsr:path@*": "jsr:@std/path@0.75.1" } } "#, @@ -1283,9 +1280,6 @@ mod tests { }) .err() .unwrap(); - assert_eq!( - err.to_string(), - "Unable to read lockfile. Lockfile was empty at 'lockfile.json'." - ); + assert!(matches!(err.source, LockfileErrorReason::Empty)); } } diff --git a/src/printer.rs b/src/printer.rs index dd4bed0..2da67d2 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -29,15 +29,28 @@ struct SerializedNpmPkg<'a> { dependencies: Vec>, } +// WARNING: It's important to implement Ord/PartialOrd on the final +// normalized string so that sorting works according to the final +// output and so that's why this is used rather than JsrDepPackageReq +// directly. +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Serialize)] +struct SerializedJsrDepPackageReq(String); + +impl SerializedJsrDepPackageReq { + pub fn new(dep_req: &JsrDepPackageReq) -> Self { + Self(dep_req.to_string_normalized()) + } +} + #[derive(Debug, Default, Serialize)] #[serde(rename_all = "camelCase")] -struct SerializedLockfilePackageJsonContent<'a> { +struct SerializedLockfilePackageJsonContent { #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] - pub dependencies: Vec<&'a JsrDepPackageReq>, + pub dependencies: Vec, } -impl<'a> SerializedLockfilePackageJsonContent<'a> { +impl SerializedLockfilePackageJsonContent { pub fn is_empty(&self) -> bool { self.dependencies.is_empty() } @@ -45,18 +58,18 @@ impl<'a> SerializedLockfilePackageJsonContent<'a> { #[derive(Debug, Default, Serialize)] #[serde(rename_all = "camelCase")] -struct SerializedWorkspaceMemberConfigContent<'a> { +struct SerializedWorkspaceMemberConfigContent { #[serde(skip_serializing_if = "Vec::is_empty")] #[serde(default)] - pub dependencies: Vec<&'a JsrDepPackageReq>, + pub dependencies: Vec, #[serde( skip_serializing_if = "SerializedLockfilePackageJsonContent::is_empty" )] #[serde(default)] - pub package_json: SerializedLockfilePackageJsonContent<'a>, + pub package_json: SerializedLockfilePackageJsonContent, } -impl<'a> SerializedWorkspaceMemberConfigContent<'a> { +impl SerializedWorkspaceMemberConfigContent { pub fn is_empty(&self) -> bool { self.dependencies.is_empty() && self.package_json.is_empty() } @@ -66,10 +79,10 @@ impl<'a> SerializedWorkspaceMemberConfigContent<'a> { #[serde(rename_all = "camelCase")] struct SerializedWorkspaceConfigContent<'a> { #[serde(default, flatten)] - pub root: SerializedWorkspaceMemberConfigContent<'a>, + pub root: SerializedWorkspaceMemberConfigContent, #[serde(skip_serializing_if = "BTreeMap::is_empty")] #[serde(default)] - pub members: BTreeMap<&'a str, SerializedWorkspaceMemberConfigContent<'a>>, + pub members: BTreeMap<&'a str, SerializedWorkspaceMemberConfigContent>, } impl<'a> SerializedWorkspaceConfigContent<'a> { @@ -83,7 +96,7 @@ struct LockfileV4<'a> { // order these based on auditability version: &'static str, #[serde(skip_serializing_if = "BTreeMap::is_empty")] - specifiers: BTreeMap, + specifiers: BTreeMap, #[serde(skip_serializing_if = "BTreeMap::is_empty")] jsr: BTreeMap<&'a PackageNv, SerializedJsrPkg<'a>>, #[serde(skip_serializing_if = "BTreeMap::is_empty")] @@ -137,7 +150,7 @@ pub fn print_v4_content(content: &LockfileContent) -> String { if has_single_specifier { format!("{}{}", dep.kind.scheme_with_colon(), dep.req.name) } else { - dep.to_string() + dep.to_string_normalized() } }) .collect::>(); @@ -211,7 +224,11 @@ pub fn print_v4_content(content: &LockfileContent) -> String { fn handle_pkg_json_content( content: &LockfilePackageJsonContent, ) -> SerializedLockfilePackageJsonContent { - let mut dependencies = content.dependencies.iter().collect::>(); + let mut dependencies = content + .dependencies + .iter() + .map(SerializedJsrDepPackageReq::new) + .collect::>(); dependencies.sort(); SerializedLockfilePackageJsonContent { dependencies } } @@ -221,7 +238,11 @@ pub fn print_v4_content(content: &LockfileContent) -> String { ) -> SerializedWorkspaceMemberConfigContent { SerializedWorkspaceMemberConfigContent { dependencies: { - let mut member = member.dependencies.iter().collect::>(); + let mut member = member + .dependencies + .iter() + .map(SerializedJsrDepPackageReq::new) + .collect::>(); member.sort(); member }, @@ -246,7 +267,7 @@ pub fn print_v4_content(content: &LockfileContent) -> String { let mut specifiers = BTreeMap::new(); for (key, value) in &content.packages.specifiers { // insert a string to ensure proper sorting - specifiers.insert(key.to_string(), value); + specifiers.insert(SerializedJsrDepPackageReq::new(key), value); } let lockfile = LockfileV4 { diff --git a/tests/specs/config_changes/DenoIssue22250.txt b/tests/specs/config_changes/DenoIssue22250.txt index 92b6e24..c7a8d10 100644 --- a/tests/specs/config_changes/DenoIssue22250.txt +++ b/tests/specs/config_changes/DenoIssue22250.txt @@ -944,7 +944,7 @@ { "version": "4", "specifiers": { - "npm:@spotify/web-api-ts-sdk": "1.2.0", + "npm:@spotify/web-api-ts-sdk@*": "1.2.0", "npm:autoprefixer@10.4.16": "10.4.16_postcss@8.4.31", "npm:cssnano@6.0.1": "6.0.1_postcss@8.4.31", "npm:postcss@8.4.31": "8.4.31" @@ -1414,7 +1414,7 @@ }, "workspace": { "dependencies": [ - "npm:@spotify/web-api-ts-sdk" + "npm:@spotify/web-api-ts-sdk@*" ] } } diff --git a/tests/specs/config_changes/NoConfigMaintains.txt b/tests/specs/config_changes/NoConfigMaintains.txt index 09985b0..befa34d 100644 --- a/tests/specs/config_changes/NoConfigMaintains.txt +++ b/tests/specs/config_changes/NoConfigMaintains.txt @@ -206,11 +206,11 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_a": "0.0.1", - "jsr:@scope/package_b": "0.0.1", - "jsr:@scope/package_c": "0.0.1", - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_a@*": "0.0.1", + "jsr:@scope/package_b@*": "0.0.1", + "jsr:@scope/package_c@*": "0.0.1", + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_a@0.0.1": { @@ -376,11 +376,11 @@ }, "workspace": { "dependencies": [ - "jsr:@scope/package_a" + "jsr:@scope/package_a@*" ], "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } diff --git a/tests/specs/config_changes/NoConfigMaintains_v4.txt b/tests/specs/config_changes/NoConfigMaintains_v4.txt index bf01220..2ea624f 100644 --- a/tests/specs/config_changes/NoConfigMaintains_v4.txt +++ b/tests/specs/config_changes/NoConfigMaintains_v4.txt @@ -190,11 +190,11 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_a@^0.0": "0.0.1", - "jsr:@scope/package_b": "0.0.1", - "jsr:@scope/package_c": "0.0.1", - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_a@0.0": "0.0.1", + "jsr:@scope/package_b@*": "0.0.1", + "jsr:@scope/package_c@*": "0.0.1", + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_a@0.0.1": { @@ -360,11 +360,11 @@ }, "workspace": { "dependencies": [ - "jsr:@scope/package_a" + "jsr:@scope/package_a@*" ], "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } diff --git a/tests/specs/config_changes/NoConfigWorkspaceMaintains.txt b/tests/specs/config_changes/NoConfigWorkspaceMaintains.txt index 6e0a8b4..4dbd875 100644 --- a/tests/specs/config_changes/NoConfigWorkspaceMaintains.txt +++ b/tests/specs/config_changes/NoConfigWorkspaceMaintains.txt @@ -210,11 +210,11 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_a": "0.0.1", - "jsr:@scope/package_b": "0.0.1", - "jsr:@scope/package_c": "0.0.1", - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_a@*": "0.0.1", + "jsr:@scope/package_b@*": "0.0.1", + "jsr:@scope/package_c@*": "0.0.1", + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_a@0.0.1": { @@ -382,11 +382,11 @@ "members": { "package_a": { "dependencies": [ - "jsr:@scope/package_a" + "jsr:@scope/package_a@*" ], "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } diff --git a/tests/specs/config_changes/NoNpmMaintainsNpm.txt b/tests/specs/config_changes/NoNpmMaintainsNpm.txt index a18db45..f1a9cbf 100644 --- a/tests/specs/config_changes/NoNpmMaintainsNpm.txt +++ b/tests/specs/config_changes/NoNpmMaintainsNpm.txt @@ -206,8 +206,8 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_orphan@0.0.1": { @@ -356,7 +356,7 @@ "workspace": { "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } diff --git a/tests/specs/config_changes/NoNpmWorkspaceMaintainsNpm.txt b/tests/specs/config_changes/NoNpmWorkspaceMaintainsNpm.txt index 0720539..a4dae73 100644 --- a/tests/specs/config_changes/NoNpmWorkspaceMaintainsNpm.txt +++ b/tests/specs/config_changes/NoNpmWorkspaceMaintainsNpm.txt @@ -217,11 +217,11 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_a": "0.0.1", - "jsr:@scope/package_b": "0.0.1", - "jsr:@scope/package_c": "0.0.1", - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_a@*": "0.0.1", + "jsr:@scope/package_b@*": "0.0.1", + "jsr:@scope/package_c@*": "0.0.1", + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_a@0.0.1": { @@ -389,11 +389,11 @@ "members": { "package_a": { "dependencies": [ - "jsr:@scope/package_a" + "jsr:@scope/package_a@*" ], "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } @@ -409,7 +409,7 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_orphan": "0.0.1" + "jsr:@scope/package_orphan@*": "0.0.1" }, "jsr": { "@scope/package_orphan@0.0.1": { diff --git a/tests/specs/config_changes/RemovedConfigRemoves.txt b/tests/specs/config_changes/RemovedConfigRemoves.txt index e0c2fc7..da34727 100644 --- a/tests/specs/config_changes/RemovedConfigRemoves.txt +++ b/tests/specs/config_changes/RemovedConfigRemoves.txt @@ -206,7 +206,7 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_orphan": "0.0.1" + "jsr:@scope/package_orphan@*": "0.0.1" }, "jsr": { "@scope/package_orphan@0.0.1": { diff --git a/tests/specs/config_changes/RemovedDenoJsonRemoves.txt b/tests/specs/config_changes/RemovedDenoJsonRemoves.txt index 83b7945..3df147f 100644 --- a/tests/specs/config_changes/RemovedDenoJsonRemoves.txt +++ b/tests/specs/config_changes/RemovedDenoJsonRemoves.txt @@ -211,8 +211,8 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_orphan": "0.0.1", - "npm:ts-morph": "21.0.1" + "jsr:@scope/package_orphan@*": "0.0.1", + "npm:ts-morph@*": "21.0.1" }, "jsr": { "@scope/package_orphan@0.0.1": { @@ -361,7 +361,7 @@ "workspace": { "packageJson": { "dependencies": [ - "npm:ts-morph" + "npm:ts-morph@*" ] } } diff --git a/tests/specs/config_changes/RemovedPackageJsonRemoves.txt b/tests/specs/config_changes/RemovedPackageJsonRemoves.txt index 9c523b7..2e8f31d 100644 --- a/tests/specs/config_changes/RemovedPackageJsonRemoves.txt +++ b/tests/specs/config_changes/RemovedPackageJsonRemoves.txt @@ -209,10 +209,10 @@ { "version": "4", "specifiers": { - "jsr:@scope/package_a": "0.0.1", - "jsr:@scope/package_b": "0.0.1", - "jsr:@scope/package_c": "0.0.1", - "jsr:@scope/package_orphan": "0.0.1" + "jsr:@scope/package_a@*": "0.0.1", + "jsr:@scope/package_b@*": "0.0.1", + "jsr:@scope/package_c@*": "0.0.1", + "jsr:@scope/package_orphan@*": "0.0.1" }, "jsr": { "@scope/package_a@0.0.1": { @@ -244,7 +244,7 @@ }, "workspace": { "dependencies": [ - "jsr:@scope/package_a" + "jsr:@scope/package_a@*" ] } } diff --git a/tests/specs/config_changes/RemovingOakThenDax.txt b/tests/specs/config_changes/RemovingOakThenDax.txt index 8402f1a..d2f4a84 100644 --- a/tests/specs/config_changes/RemovingOakThenDax.txt +++ b/tests/specs/config_changes/RemovingOakThenDax.txt @@ -161,7 +161,7 @@ { "version": "4", "specifiers": { - "jsr:@dsherret/dax": "0.0.1", + "jsr:@dsherret/dax@*": "0.0.1", "jsr:@dsherret/which@0.0.1": "0.0.1", "jsr:@std/assert@0.210": "0.210.0", "jsr:@std/bytes@0.210": "0.210.0", @@ -173,8 +173,8 @@ "jsr:@std/path@0.210.0": "0.210.0", "jsr:@std/streams@0.210": "0.210.0", "jsr:@std/streams@0.210.0": "0.210.0", - "jsr:@zome_unreferenced/package": "0.1.0", - "jsr:@zome_unreferenced/package_b": "0.1.0" + "jsr:@zome_unreferenced/package@*": "0.1.0", + "jsr:@zome_unreferenced/package_b@*": "0.1.0" }, "jsr": { "@dsherret/dax@0.0.1": { @@ -240,7 +240,7 @@ }, "workspace": { "dependencies": [ - "jsr:@dsherret/dax" + "jsr:@dsherret/dax@*" ] } } @@ -255,8 +255,8 @@ { "version": "4", "specifiers": { - "jsr:@zome_unreferenced/package": "0.1.0", - "jsr:@zome_unreferenced/package_b": "0.1.0" + "jsr:@zome_unreferenced/package@*": "0.1.0", + "jsr:@zome_unreferenced/package_b@*": "0.1.0" }, "jsr": { "@zome_unreferenced/package@0.1.0": { diff --git a/tests/specs/config_changes/RemovingWorkspaceDep.txt b/tests/specs/config_changes/RemovingWorkspaceDep.txt index cbb8474..9c73d6a 100644 --- a/tests/specs/config_changes/RemovingWorkspaceDep.txt +++ b/tests/specs/config_changes/RemovingWorkspaceDep.txt @@ -173,7 +173,7 @@ { "version": "4", "specifiers": { - "jsr:@dsherret/dax": "0.0.1", + "jsr:@dsherret/dax@*": "0.0.1", "jsr:@dsherret/which@0.0.1": "0.0.1", "jsr:@std/assert@0.210": "0.210.0", "jsr:@std/bytes@0.210": "0.210.0", @@ -185,8 +185,8 @@ "jsr:@std/path@0.210.0": "0.210.0", "jsr:@std/streams@0.210": "0.210.0", "jsr:@std/streams@0.210.0": "0.210.0", - "jsr:@zome_unreferenced/package": "0.1.0", - "jsr:@zome_unreferenced/package_b": "0.1.0" + "jsr:@zome_unreferenced/package@*": "0.1.0", + "jsr:@zome_unreferenced/package_b@*": "0.1.0" }, "jsr": { "@dsherret/dax@0.0.1": { @@ -252,7 +252,7 @@ }, "workspace": { "dependencies": [ - "jsr:@dsherret/dax" + "jsr:@dsherret/dax@*" ], "members": { "package_a": {} diff --git a/tests/specs/config_changes/RemovingWorkspaceMember.txt b/tests/specs/config_changes/RemovingWorkspaceMember.txt index 7bad1e0..5ff8029 100644 --- a/tests/specs/config_changes/RemovingWorkspaceMember.txt +++ b/tests/specs/config_changes/RemovingWorkspaceMember.txt @@ -167,7 +167,7 @@ { "version": "4", "specifiers": { - "jsr:@dsherret/dax": "0.0.1", + "jsr:@dsherret/dax@*": "0.0.1", "jsr:@dsherret/which@0.0.1": "0.0.1", "jsr:@std/assert@0.210": "0.210.0", "jsr:@std/bytes@0.210": "0.210.0", @@ -179,8 +179,8 @@ "jsr:@std/path@0.210.0": "0.210.0", "jsr:@std/streams@0.210": "0.210.0", "jsr:@std/streams@0.210.0": "0.210.0", - "jsr:@zome_unreferenced/package": "0.1.0", - "jsr:@zome_unreferenced/package_b": "0.1.0" + "jsr:@zome_unreferenced/package@*": "0.1.0", + "jsr:@zome_unreferenced/package_b@*": "0.1.0" }, "jsr": { "@dsherret/dax@0.0.1": { @@ -246,7 +246,7 @@ }, "workspace": { "dependencies": [ - "jsr:@dsherret/dax" + "jsr:@dsherret/dax@*" ] } } diff --git a/tests/specs/config_changes/ShiftingDepsDifferentWorkspaceMember.txt b/tests/specs/config_changes/ShiftingDepsDifferentWorkspaceMember.txt index 62da03d..bf69994 100644 --- a/tests/specs/config_changes/ShiftingDepsDifferentWorkspaceMember.txt +++ b/tests/specs/config_changes/ShiftingDepsDifferentWorkspaceMember.txt @@ -43,7 +43,7 @@ { "version": "4", "specifiers": { - "jsr:@dsherret/dax": "0.0.1", + "jsr:@dsherret/dax@*": "0.0.1", "jsr:@dsherret/which@0.0.1": "0.0.1" }, "jsr": { @@ -61,7 +61,7 @@ "members": { "package_a": { "dependencies": [ - "jsr:@dsherret/dax" + "jsr:@dsherret/dax@*" ] } } @@ -84,7 +84,7 @@ { "version": "4", "specifiers": { - "jsr:@dsherret/dax": "0.0.1", + "jsr:@dsherret/dax@*": "0.0.1", "jsr:@dsherret/which@0.0.1": "0.0.1" }, "jsr": { @@ -102,7 +102,7 @@ "members": { "package_b": { "dependencies": [ - "jsr:@dsherret/dax" + "jsr:@dsherret/dax@*" ] } } diff --git a/tests/specs/transforms/upgrades_v3_jsr_same_dep_different_specifiers.txt b/tests/specs/transforms/upgrades_v3_jsr_same_dep_different_specifiers.txt index cf065fa..7929ef0 100644 --- a/tests/specs/transforms/upgrades_v3_jsr_same_dep_different_specifiers.txt +++ b/tests/specs/transforms/upgrades_v3_jsr_same_dep_different_specifiers.txt @@ -5,6 +5,9 @@ "specifiers": { "jsr:@std/assert@^0.218.2": "jsr:@std/assert@0.218.2", "jsr:@std/assert@^0.218": "jsr:@std/assert@0.218.2", + "jsr:@std/assert@0.218": "jsr:@std/assert@0.218.2", + "jsr:@std/assert@~0.218": "jsr:@std/assert@0.218.2", + "jsr:@std/assert@~0.218.2": "jsr:@std/assert@0.218.2", "jsr:@std/path@^0.218.2": "jsr:@std/path@0.218.2" }, "jsr": { @@ -32,9 +35,9 @@ { "version": "4", "specifiers": { - "jsr:@std/assert@^0.218": "0.218.2", - "jsr:@std/assert@^0.218.2": "0.218.2", - "jsr:@std/path@^0.218.2": "0.218.2" + "jsr:@std/assert@0.218": "0.218.2", + "jsr:@std/assert@~0.218.2": "0.218.2", + "jsr:@std/path@~0.218.2": "0.218.2" }, "jsr": { "@std/assert@0.218.2": { @@ -43,14 +46,14 @@ "@std/path@0.218.2": { "integrity": "abcd", "dependencies": [ - "jsr:@std/assert@^0.218" + "jsr:@std/assert@0.218" ] } }, "workspace": { "dependencies": [ - "jsr:@std/assert@^0.218.2", - "jsr:@std/path@^0.218.2" + "jsr:@std/assert@~0.218.2", + "jsr:@std/path@~0.218.2" ] } } diff --git a/tests/specs/transforms/upgrades_v3_real_example_1.txt b/tests/specs/transforms/upgrades_v3_real_example_1.txt index 6c045f2..c31480b 100644 --- a/tests/specs/transforms/upgrades_v3_real_example_1.txt +++ b/tests/specs/transforms/upgrades_v3_real_example_1.txt @@ -344,20 +344,20 @@ { "version": "4", "specifiers": { - "jsr:@deno/cache-dir@^0.8.0": "0.8.0", - "jsr:@deno/dnt@^0.41.2": "0.41.2", - "jsr:@deno/graph@^0.69.7": "0.69.10", - "jsr:@std/assert@^0.218.2": "0.218.2", - "jsr:@std/assert@^0.225.2": "0.225.3", - "jsr:@std/bytes@^0.218.2": "0.218.2", - "jsr:@std/fmt@^0.218.2": "0.218.2", - "jsr:@std/fs@^0.218.2": "0.218.2", - "jsr:@std/io@^0.218.2": "0.218.2", - "jsr:@std/path@^0.218.2": "0.218.2", - "jsr:@std/path@^0.225.1": "0.225.1", + "jsr:@deno/cache-dir@0.8": "0.8.0", + "jsr:@deno/dnt@~0.41.2": "0.41.2", + "jsr:@deno/graph@~0.69.7": "0.69.10", + "jsr:@std/assert@~0.218.2": "0.218.2", + "jsr:@std/assert@~0.225.2": "0.225.3", + "jsr:@std/bytes@~0.218.2": "0.218.2", + "jsr:@std/fmt@~0.218.2": "0.218.2", + "jsr:@std/fs@~0.218.2": "0.218.2", + "jsr:@std/io@~0.218.2": "0.218.2", + "jsr:@std/path@~0.218.2": "0.218.2", + "jsr:@std/path@~0.225.1": "0.225.1", "npm:@ts-morph/bootstrap@0.22": "0.22.0", "npm:code-block-writer@^13.0.1": "13.0.1", - "npm:jsonc-parser": "3.2.1" + "npm:jsonc-parser@*": "3.2.1" }, "jsr": { "@deno/cache-dir@0.8.0": { @@ -374,7 +374,7 @@ "jsr:@deno/cache-dir", "jsr:@std/fmt", "jsr:@std/fs", - "jsr:@std/path@^0.218.2", + "jsr:@std/path@~0.218.2", "npm:@ts-morph/bootstrap", "npm:code-block-writer" ] @@ -397,8 +397,8 @@ "@std/fs@0.218.2": { "integrity": "dd9431453f7282e8c577cc22c9e6d036055a9a980b5549f887d6012969fabcca", "dependencies": [ - "jsr:@std/assert@^0.218.2", - "jsr:@std/path@^0.218.2" + "jsr:@std/assert@~0.218.2", + "jsr:@std/path@~0.218.2" ] }, "@std/io@0.218.2": { @@ -410,13 +410,13 @@ "@std/path@0.218.2": { "integrity": "b568fd923d9e53ad76d17c513e7310bda8e755a3e825e6289a0ce536404e2662", "dependencies": [ - "jsr:@std/assert@^0.218.2" + "jsr:@std/assert@~0.218.2" ] }, "@std/path@0.225.1": { "integrity": "8c3220635a73730eb51fe43de9e10b79e2724a5bb8638b9355d35ae012fd9429", "dependencies": [ - "jsr:@std/assert@^0.225.2" + "jsr:@std/assert@~0.225.2" ] } }, @@ -657,8 +657,8 @@ }, "workspace": { "dependencies": [ - "jsr:@deno/dnt@^0.41.2", - "jsr:@std/path@^0.225.1" + "jsr:@deno/dnt@~0.41.2", + "jsr:@std/path@~0.225.1" ], "packageJson": { "dependencies": [