ConstThis regex covers the most common npm package naming rules, but does not fully replicate npm's internal validation logic.
Additional runtime validation may still be required for:
node_modulesfavicon.icoSupports validation for both scoped and unscoped npm package names.
Supported formats:
Unscoped packages:
reactreact-dompkg_namepkg.nameScoped packages:
@types/node@my-org/utils@scope/pkg-nameRules:
1 and 214 characters longa-z)0-9).)-)_).-_@scope/name//)~!*?%
Valid npm package name regex.