@@ -61059,7 +61059,7 @@ const testSet = (set, version, options) => {
61059
61059
61060
61060
const debug = __nccwpck_require__(427)
61061
61061
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293)
61062
- const { safeRe: re, t } = __nccwpck_require__(9523)
61062
+ const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(9523)
61063
61063
61064
61064
const parseOptions = __nccwpck_require__(785)
61065
61065
const { compareIdentifiers } = __nccwpck_require__(2463)
@@ -61069,7 +61069,7 @@ class SemVer {
61069
61069
61070
61070
if (version instanceof SemVer) {
61071
61071
if (version.loose === !!options.loose &&
61072
- version.includePrerelease === !!options.includePrerelease) {
61072
+ version.includePrerelease === !!options.includePrerelease) {
61073
61073
return version
61074
61074
} else {
61075
61075
version = version.version
@@ -61235,6 +61235,20 @@ class SemVer {
61235
61235
// preminor will bump the version up to the next minor release, and immediately
61236
61236
// down to pre-release. premajor and prepatch work the same way.
61237
61237
inc (release, identifier, identifierBase) {
61238
+ if (release.startsWith('pre')) {
61239
+ if (!identifier && identifierBase === false) {
61240
+ throw new Error('invalid increment argument: identifier is empty')
61241
+ }
61242
+ // Avoid an invalid semver results
61243
+ if (identifier) {
61244
+ const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)
61245
+ const match = `-${identifier}`.match(r)
61246
+ if (!match || match[1] !== identifier) {
61247
+ throw new Error(`invalid identifier: ${identifier}`)
61248
+ }
61249
+ }
61250
+ }
61251
+
61238
61252
switch (release) {
61239
61253
case 'premajor':
61240
61254
this.prerelease.length = 0
@@ -61265,6 +61279,12 @@ class SemVer {
61265
61279
}
61266
61280
this.inc('pre', identifier, identifierBase)
61267
61281
break
61282
+ case 'release':
61283
+ if (this.prerelease.length === 0) {
61284
+ throw new Error(`version ${this.raw} is not a prerelease`)
61285
+ }
61286
+ this.prerelease.length = 0
61287
+ break
61268
61288
61269
61289
case 'major':
61270
61290
// If this is a pre-major version, bump up to the same major version.
@@ -61308,10 +61328,6 @@ class SemVer {
61308
61328
case 'pre': {
61309
61329
const base = Number(identifierBase) ? 1 : 0
61310
61330
61311
- if (!identifier && identifierBase === false) {
61312
- throw new Error('invalid increment argument: identifier is empty')
61313
- }
61314
-
61315
61331
if (this.prerelease.length === 0) {
61316
61332
this.prerelease = [base]
61317
61333
} else {
@@ -61570,20 +61586,13 @@ const diff = (version1, version2) => {
61570
61586
return 'major'
61571
61587
}
61572
61588
61573
- // Otherwise it can be determined by checking the high version
61574
-
61575
- if (highVersion.patch) {
61576
- // anything higher than a patch bump would result in the wrong version
61589
+ // If the main part has no difference
61590
+ if (lowVersion.compareMain(highVersion) === 0) {
61591
+ if (lowVersion.minor && !lowVersion.patch) {
61592
+ return 'minor'
61593
+ }
61577
61594
return 'patch'
61578
61595
}
61579
-
61580
- if (highVersion.minor) {
61581
- // anything higher than a minor bump would result in the wrong version
61582
- return 'minor'
61583
- }
61584
-
61585
- // bumping major/minor/patch all have same result
61586
- return 'major'
61587
61596
}
61588
61597
61589
61598
// add the `pre` prefix if we are going to a prerelease version
@@ -62090,6 +62099,7 @@ exports = module.exports = {}
62090
62099
const re = exports.re = []
62091
62100
const safeRe = exports.safeRe = []
62092
62101
const src = exports.src = []
62102
+ const safeSrc = exports.safeSrc = []
62093
62103
const t = exports.t = {}
62094
62104
let R = 0
62095
62105
@@ -62122,6 +62132,7 @@ const createToken = (name, value, isGlobal) => {
62122
62132
debug(name, index, value)
62123
62133
t[name] = index
62124
62134
src[index] = value
62135
+ safeSrc[index] = safe
62125
62136
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
62126
62137
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
62127
62138
}
0 commit comments