Skip to content

Commit

Permalink
fix: do not error when subpath has an @ symbol (#27290)
Browse files Browse the repository at this point in the history
Closes #27243
  • Loading branch information
dsherret authored and bartlomieju committed Dec 11, 2024
1 parent d6c98c0 commit 71ee3d7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ deno_npm = "=0.26.0"
deno_path_util = "=0.2.1"
deno_permissions = { version = "0.41.0", path = "./runtime/permissions" }
deno_runtime = { version = "0.190.0", path = "./runtime" }
deno_semver = "=0.6.0"
deno_semver = "=0.6.1"
deno_terminal = "0.2.0"
napi_sym = { version = "0.111.0", path = "./ext/napi/sym" }
test_util = { package = "test_server", path = "./tests/util/server" }
Expand Down
10 changes: 4 additions & 6 deletions cli/tools/registry/pm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@ pub async fn add(
let mut package_reqs = Vec::with_capacity(add_flags.packages.len());

for entry_text in add_flags.packages.iter() {
let req = AddRmPackageReq::parse(entry_text).with_context(|| {
format!("Failed to parse package required: {}", entry_text)
})?;
let req = AddRmPackageReq::parse(entry_text)
.with_context(|| format!("Failed to parse package: {}", entry_text))?;

match req {
Ok(add_req) => package_reqs.push(add_req),
Expand Down Expand Up @@ -805,9 +804,8 @@ pub async fn remove(
let mut removed_packages = vec![];

for package in &remove_flags.packages {
let req = AddRmPackageReq::parse(package).with_context(|| {
format!("Failed to parse package required: {}", package)
})?;
let req = AddRmPackageReq::parse(package)
.with_context(|| format!("Failed to parse package: {}", package))?;
let mut parsed_pkg_name = None;
for config in configs.iter_mut().flatten() {
match &req {
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/add/add_with_subpath/wrong_constraint_jsr.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Failed to parse package required: jsr:@std/testing/bdd@1
error: Failed to parse package: jsr:@std/testing/bdd@1

Caused by:
Invalid package specifier 'jsr:@std/testing/bdd@1'. Did you mean to write 'jsr:@std/testing@1/bdd'?
Invalid package specifier 'jsr:@std/testing/bdd@1'. Did you mean to write 'jsr:@std/testing@1/bdd'? If not, add a version requirement to the specifier.
4 changes: 2 additions & 2 deletions tests/specs/add/add_with_subpath/wrong_constraint_npm.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Failed to parse package required: npm:preact/hooks@10
error: Failed to parse package: npm:preact/hooks@10

Caused by:
Invalid package specifier 'npm:preact/hooks@10'. Did you mean to write 'npm:preact@10/hooks'?
Invalid package specifier 'npm:preact/hooks@10'. Did you mean to write 'npm:preact@10/hooks'? If not, add a version requirement to the specifier.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Invalid package specifier 'npm:react-dom/server@18.2.0'. Did you mean to write 'npm:react-dom@18.2.0/server'?
error: Invalid package specifier 'npm:react-dom/server@18.2.0'. Did you mean to write 'npm:react-dom@18.2.0/server'? If not, add a version requirement to the specifier.
at [WILDCARD]/error_version_after_subpath/main.js:1:8

0 comments on commit 71ee3d7

Please sign in to comment.