Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-package-arg

Package Overview
Dependencies
Maintainers
4
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-package-arg - npm Package Compare versions

Comparing version 5.0.1 to 5.1.0

33

npa.js

@@ -195,2 +195,18 @@ 'use strict'

function matchGitScp (spec) {
// git ssh specifiers are overloaded to also use scp-style git
// specifiers, so we have to parse those out and treat them special.
// They are NOT true URIs, so we can't hand them to `url.parse`.
//
// This regex looks for things that look like:
// git+ssh://git@my.custom.git.com:username/project.git#deadbeef
//
// ...and various combinations. The username in the beginning is *required*.
const matched = spec.match(/^git\+ssh:\/\/((?:[^@]+)@(?:[^:/]+):[/]?(?:(?:[^/]+[/])?[^/]+?)(?:[.]git)?)(?:#(.*))?$/i)
return matched && {
fetchSpec: matched[1],
gitCommittish: matched[2]
}
}
function fromURL (res) {

@@ -207,11 +223,16 @@ if (!url) url = require('url')

case 'git+ftp:':
case 'git+file:':
case 'git+ssh:':
case 'git+file:':
res.type = 'git'
setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '')
urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '')
delete urlparse.hash
res.fetchSpec = url.format(urlparse)
const match = urlparse.protocol === 'git+ssh:' && matchGitScp(res.rawSpec)
if (match) {
res.fetchSpec = match.fetchSpec
res.gitCommittish = match.gitCommittish
} else {
setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '')
urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '')
delete urlparse.hash
res.fetchSpec = url.format(urlparse)
}
break
case 'http:':

@@ -218,0 +239,0 @@ case 'https:':

2

package.json
{
"name": "npm-package-arg",
"version": "5.0.1",
"version": "5.1.0",
"description": "Parse the things that can be arguments to `npm install`",

@@ -5,0 +5,0 @@ "main": "npa.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc