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

npm-package-arg

Package Overview
Dependencies
Maintainers
5
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 9.0.2 to 9.1.0

44

lib/npa.js

@@ -12,2 +12,3 @@ 'use strict'

const { homedir } = require('os')
const log = require('proc-log')

@@ -124,2 +125,3 @@ const isWindows = process.platform === 'win32' || global.FAKE_WINDOWS

this.gitCommittish = opts.gitCommittish
this.gitSubdir = opts.gitSubdir
this.hosted = opts.hosted

@@ -160,9 +162,43 @@ }

function setGitCommittish (res, committish) {
if (committish != null && committish.length >= 7 && committish.slice(0, 7) === 'semver:') {
res.gitRange = decodeURIComponent(committish.slice(7))
if (!committish) {
res.gitCommittish = null
} else {
res.gitCommittish = committish === '' ? null : committish
return res
}
// for each :: separated item:
for (const part of committish.split('::')) {
// if the item has no : the n it is a commit-ish
if (!part.includes(':')) {
if (res.gitRange) {
throw new Error('cannot override existing semver range with a committish')
}
if (res.gitCommittish) {
throw new Error('cannot override existing committish with a second committish')
}
res.gitCommittish = part
continue
}
// split on name:value
const [name, value] = part.split(':')
// if name is semver do semver lookup of ref or tag
if (name === 'semver') {
if (res.gitCommittish) {
throw new Error('cannot override existing committish with a semver range')
}
if (res.gitRange) {
throw new Error('cannot override existing semver range with a second semver range')
}
res.gitRange = decodeURIComponent(value)
continue
}
if (name === 'path') {
if (res.gitSubdir) {
throw new Error('cannot override existing path with a second path')
}
res.gitSubdir = `/${value}`
continue
}
log.warn('npm-package-arg', `ignoring unknown key "${name}"`)
}
return res

@@ -169,0 +205,0 @@ }

7

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

@@ -15,2 +15,3 @@ "main": "./lib/npa.js",

"hosted-git-info": "^5.0.0",
"proc-log": "^2.0.1",
"semver": "^7.3.5",

@@ -21,3 +22,3 @@ "validate-npm-package-name": "^4.0.0"

"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.2.1",
"@npmcli/template-oss": "3.5.0",
"tap": "^16.0.1"

@@ -57,4 +58,4 @@ },

"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.2.1"
"version": "3.5.0"
}
}
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