Skip to content

Commit 00fccfb

Browse files
committed
1 parent 5ab8aac commit 00fccfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+144
-34
lines changed

node_modules/semver/bin/semver.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Exits successfully and prints matching version(s) if
44
// any supplied version is valid and passes all tests.
55

6+
'use strict'
7+
68
const argv = process.argv.slice(2)
79

810
let versions = []
@@ -61,6 +63,7 @@ const main = () => {
6163
switch (argv[0]) {
6264
case 'major': case 'minor': case 'patch': case 'prerelease':
6365
case 'premajor': case 'preminor': case 'prepatch':
66+
case 'release':
6467
inc = argv.shift()
6568
break
6669
default:
@@ -149,7 +152,7 @@ Options:
149152
-i --increment [<level>]
150153
Increment a version by the specified level. Level can
151154
be one of: major, minor, patch, premajor, preminor,
152-
prepatch, or prerelease. Default level is 'patch'.
155+
prepatch, prerelease, or release. Default level is 'patch'.
153156
Only one version may be specified.
154157
155158
--preid <identifier>

node_modules/semver/classes/comparator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const ANY = Symbol('SemVer ANY')
24
// hoisted class for cyclic dependency
35
class Comparator {

node_modules/semver/classes/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
module.exports = {
24
SemVer: require('./semver.js'),
35
Range: require('./range.js'),

node_modules/semver/classes/range.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const SPACE_CHARACTERS = /\s+/g
24

35
// hoisted class for cyclic dependency

node_modules/semver/classes/semver.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const debug = require('../internal/debug')
24
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
35
const { safeRe: re, t } = require('../internal/re')
@@ -10,7 +12,7 @@ class SemVer {
1012

1113
if (version instanceof SemVer) {
1214
if (version.loose === !!options.loose &&
13-
version.includePrerelease === !!options.includePrerelease) {
15+
version.includePrerelease === !!options.includePrerelease) {
1416
return version
1517
} else {
1618
version = version.version
@@ -176,6 +178,19 @@ class SemVer {
176178
// preminor will bump the version up to the next minor release, and immediately
177179
// down to pre-release. premajor and prepatch work the same way.
178180
inc (release, identifier, identifierBase) {
181+
if (release.startsWith('pre')) {
182+
if (!identifier && identifierBase === false) {
183+
throw new Error('invalid increment argument: identifier is empty')
184+
}
185+
// Avoid an invalid semver results
186+
if (identifier) {
187+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
188+
if (!match || match[1] !== identifier) {
189+
throw new Error(`invalid identifier: ${identifier}`)
190+
}
191+
}
192+
}
193+
179194
switch (release) {
180195
case 'premajor':
181196
this.prerelease.length = 0
@@ -206,6 +221,12 @@ class SemVer {
206221
}
207222
this.inc('pre', identifier, identifierBase)
208223
break
224+
case 'release':
225+
if (this.prerelease.length === 0) {
226+
throw new Error(`version ${this.raw} is not a prerelease`)
227+
}
228+
this.prerelease.length = 0
229+
break
209230

210231
case 'major':
211232
// If this is a pre-major version, bump up to the same major version.
@@ -249,10 +270,6 @@ class SemVer {
249270
case 'pre': {
250271
const base = Number(identifierBase) ? 1 : 0
251272

252-
if (!identifier && identifierBase === false) {
253-
throw new Error('invalid increment argument: identifier is empty')
254-
}
255-
256273
if (this.prerelease.length === 0) {
257274
this.prerelease = [base]
258275
} else {

node_modules/semver/functions/clean.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const parse = require('./parse')
24
const clean = (version, options) => {
35
const s = parse(version.trim().replace(/^[=v]+/, ''), options)

node_modules/semver/functions/cmp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const eq = require('./eq')
24
const neq = require('./neq')
35
const gt = require('./gt')

node_modules/semver/functions/coerce.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const SemVer = require('../classes/semver')
24
const parse = require('./parse')
35
const { safeRe: re, t } = require('../internal/re')

node_modules/semver/functions/compare-build.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const SemVer = require('../classes/semver')
24
const compareBuild = (a, b, loose) => {
35
const versionA = new SemVer(a, loose)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const compare = require('./compare')
24
const compareLoose = (a, b) => compare(a, b, true)
35
module.exports = compareLoose

0 commit comments

Comments
 (0)