🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

semver

Package Overview
Dependencies
Maintainers
6
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver - npm Package Compare versions

Comparing version

to
7.7.0

3

bin/semver.js

@@ -64,2 +64,3 @@ #!/usr/bin/env node

case 'premajor': case 'preminor': case 'prepatch':
case 'release':
inc = argv.shift()

@@ -153,3 +154,3 @@ break

be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
prepatch, prerelease, or release. Default level is 'patch'.
Only one version may be specified.

@@ -156,0 +157,0 @@

@@ -13,3 +13,3 @@ const debug = require('../internal/debug')

if (version.loose === !!options.loose &&
version.includePrerelease === !!options.includePrerelease) {
version.includePrerelease === !!options.includePrerelease) {
return version

@@ -180,2 +180,15 @@ } else {

inc (release, identifier, identifierBase) {
if (release.startsWith('pre')) {
if (!identifier && identifierBase === false) {
throw new Error('invalid increment argument: identifier is empty')
}
// Avoid an invalid semver results
if (identifier) {
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
if (!match || match[1] !== identifier) {
throw new Error(`invalid identifier: ${identifier}`)
}
}
}
switch (release) {

@@ -211,2 +224,8 @@ case 'premajor':

break
case 'release':
if (this.prerelease.length === 0) {
throw new Error(`version ${this.raw} is not a prerelease`)
}
this.prerelease.length = 0
break

@@ -255,6 +274,2 @@ case 'major':

if (!identifier && identifierBase === false) {
throw new Error('invalid increment argument: identifier is empty')
}
if (this.prerelease.length === 0) {

@@ -261,0 +276,0 @@ this.prerelease = [base]

@@ -30,16 +30,9 @@ const parse = require('./parse.js')

// Otherwise it can be determined by checking the high version
if (highVersion.patch) {
// anything higher than a patch bump would result in the wrong version
// If the main part has no difference
if (lowVersion.compareMain(highVersion) === 0) {
if (lowVersion.minor && !lowVersion.patch) {
return 'minor'
}
return 'patch'
}
if (highVersion.minor) {
// anything higher than a minor bump would result in the wrong version
return 'minor'
}
// bumping major/minor/patch all have same result
return 'major'
}

@@ -46,0 +39,0 @@

{
"name": "semver",
"version": "7.6.3",
"version": "7.7.0",
"description": "The semantic version parser used by npm.",

@@ -9,11 +9,12 @@ "main": "index.js",

"snap": "tap",
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
"lint": "npm run eslint",
"postlint": "template-oss-check",
"lintfix": "npm run lint -- --fix",
"lintfix": "npm run eslint -- --fix",
"posttest": "npm run lint",
"template-oss-apply": "template-oss-apply --force"
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.22.0",
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.4",
"benchmark": "^2.1.4",

@@ -55,3 +56,3 @@ "tap": "^16.0.0"

"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.22.0",
"version": "4.23.4",
"engines": ">=10",

@@ -58,0 +59,0 @@ "distPaths": [

@@ -103,3 +103,3 @@ semver(1) -- The semantic versioner for npm

be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
prepatch, prerelease, or release. Default level is 'patch'.
Only one version may be specified.

@@ -145,2 +145,4 @@

A leading `"="` or `"v"` character is stripped off and ignored.
Support for stripping a leading "v" is kept for compatibility with `v1.0.0` of the SemVer
specification but should not be used anymore.

@@ -242,2 +244,9 @@ ## Ranges

To get out of the prerelease phase, use the `release` option:
```bash
$ semver 1.2.4-beta.1 -i release
1.2.4
```
#### Prerelease Identifier Base

@@ -421,6 +430,6 @@

* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, release, options, identifier, identifierBase)`:
* `inc(v, releaseType, options, identifier, identifierBase)`:
Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, or `prerelease`), or null if it's not valid
`prepatch`, `prerelease`, or `release`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major

@@ -433,2 +442,3 @@ version and down to a prerelease of that major version.

increments it.
* `release` will remove any prerelease part of the version.
* `identifier` can be used to prefix `premajor`, `preminor`,

@@ -485,3 +495,3 @@ `prepatch`, or `prerelease` version increments. `identifierBase`

* `validRange(range)`: Return the valid range or null if it's not valid
* `validRange(range)`: Return the valid range or null if it's not valid.
* `satisfies(version, range)`: Return true if the version satisfies the

@@ -488,0 +498,0 @@ range.