Skip to main content

normalize_npm_specifier

Function normalize_npm_specifier 

Source
pub fn normalize_npm_specifier(rest: &str) -> String
Expand description

Normalize the body of a Deno npm: specifier into a plain npm package reference by dropping the @<version> selector while preserving the package name (including scope) and any subpath.

rest is the substring after the npm: scheme. Deno npm: specifiers are <package>[@<version>][/<subpath>], so the version selector is the first @ that follows the package name (after the scope’s own @scope/ for scoped packages). Examples: @supabase/supabase-js@2 -> @supabase/supabase-js, preact@10/hooks -> preact/hooks, express@^4.18.0 -> express, foo -> foo.