summaryrefslogtreecommitdiff
path: root/cli/graph_util.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-10-03 17:45:01 +0200
committerGitHub <noreply@github.com>2022-10-03 17:45:01 +0200
commit8e1b2fca59d71d2e6ab404238d7b38975adb3665 (patch)
treeea3c136201536177c2e22d20bd3798d36f6879c9 /cli/graph_util.rs
parenta4a628dc6f9b8410957126db01a138aa36827be5 (diff)
fix(npm): panic on invalid package name (#16123)
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r--cli/graph_util.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs
index f73fd5559..dca7a16b7 100644
--- a/cli/graph_util.rs
+++ b/cli/graph_util.rs
@@ -81,11 +81,10 @@ impl GraphData {
continue;
}
if specifier.scheme() == "npm" {
- // the loader enforces npm specifiers are valid, so it's ok to unwrap here
- let reference =
- NpmPackageReference::from_specifier(&specifier).unwrap();
- self.npm_packages.insert(reference.req);
- continue;
+ if let Ok(reference) = NpmPackageReference::from_specifier(&specifier) {
+ self.npm_packages.insert(reference.req);
+ continue;
+ }
}
if let Some(found) = graph.redirects.get(&specifier) {
let module_entry = ModuleEntry::Redirect(found.clone());