@@ -63991,7 +63991,7 @@ const testSet = (set, version, options) => {
63991
63991
63992
63992
const debug = __nccwpck_require__(427)
63993
63993
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293)
63994
- const { safeRe: re, t } = __nccwpck_require__(9523)
63994
+ const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(9523)
63995
63995
63996
63996
const parseOptions = __nccwpck_require__(785)
63997
63997
const { compareIdentifiers } = __nccwpck_require__(2463)
@@ -64001,7 +64001,7 @@ class SemVer {
64001
64001
64002
64002
if (version instanceof SemVer) {
64003
64003
if (version.loose === !!options.loose &&
64004
- version.includePrerelease === !!options.includePrerelease) {
64004
+ version.includePrerelease === !!options.includePrerelease) {
64005
64005
return version
64006
64006
} else {
64007
64007
version = version.version
@@ -64167,6 +64167,20 @@ class SemVer {
64167
64167
// preminor will bump the version up to the next minor release, and immediately
64168
64168
// down to pre-release. premajor and prepatch work the same way.
64169
64169
inc (release, identifier, identifierBase) {
64170
+ if (release.startsWith('pre')) {
64171
+ if (!identifier && identifierBase === false) {
64172
+ throw new Error('invalid increment argument: identifier is empty')
64173
+ }
64174
+ // Avoid an invalid semver results
64175
+ if (identifier) {
64176
+ const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)
64177
+ const match = `-${identifier}`.match(r)
64178
+ if (!match || match[1] !== identifier) {
64179
+ throw new Error(`invalid identifier: ${identifier}`)
64180
+ }
64181
+ }
64182
+ }
64183
+
64170
64184
switch (release) {
64171
64185
case 'premajor':
64172
64186
this.prerelease.length = 0
@@ -64197,6 +64211,12 @@ class SemVer {
64197
64211
}
64198
64212
this.inc('pre', identifier, identifierBase)
64199
64213
break
64214
+ case 'release':
64215
+ if (this.prerelease.length === 0) {
64216
+ throw new Error(`version ${this.raw} is not a prerelease`)
64217
+ }
64218
+ this.prerelease.length = 0
64219
+ break
64200
64220
64201
64221
case 'major':
64202
64222
// If this is a pre-major version, bump up to the same major version.
@@ -64240,10 +64260,6 @@ class SemVer {
64240
64260
case 'pre': {
64241
64261
const base = Number(identifierBase) ? 1 : 0
64242
64262
64243
- if (!identifier && identifierBase === false) {
64244
- throw new Error('invalid increment argument: identifier is empty')
64245
- }
64246
-
64247
64263
if (this.prerelease.length === 0) {
64248
64264
this.prerelease = [base]
64249
64265
} else {
@@ -64502,20 +64518,13 @@ const diff = (version1, version2) => {
64502
64518
return 'major'
64503
64519
}
64504
64520
64505
- // Otherwise it can be determined by checking the high version
64506
-
64507
- if (highVersion.patch) {
64508
- // anything higher than a patch bump would result in the wrong version
64521
+ // If the main part has no difference
64522
+ if (lowVersion.compareMain(highVersion) === 0) {
64523
+ if (lowVersion.minor && !lowVersion.patch) {
64524
+ return 'minor'
64525
+ }
64509
64526
return 'patch'
64510
64527
}
64511
-
64512
- if (highVersion.minor) {
64513
- // anything higher than a minor bump would result in the wrong version
64514
- return 'minor'
64515
- }
64516
-
64517
- // bumping major/minor/patch all have same result
64518
- return 'major'
64519
64528
}
64520
64529
64521
64530
// add the `pre` prefix if we are going to a prerelease version
@@ -65022,6 +65031,7 @@ exports = module.exports = {}
65022
65031
const re = exports.re = []
65023
65032
const safeRe = exports.safeRe = []
65024
65033
const src = exports.src = []
65034
+ const safeSrc = exports.safeSrc = []
65025
65035
const t = exports.t = {}
65026
65036
let R = 0
65027
65037
@@ -65054,6 +65064,7 @@ const createToken = (name, value, isGlobal) => {
65054
65064
debug(name, index, value)
65055
65065
t[name] = index
65056
65066
src[index] = value
65067
+ safeSrc[index] = safe
65057
65068
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
65058
65069
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
65059
65070
}
0 commit comments