|
|
|
@ -6182,7 +6182,7 @@ function onceStrict (fn) {
|
|
|
|
|
|
|
|
|
|
const debug = __nccwpck_require__(427)
|
|
|
|
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293)
|
|
|
|
|
const { safeRe: re, t } = __nccwpck_require__(9523)
|
|
|
|
|
const { safeRe: re, safeSrc: src, t } = __nccwpck_require__(9523)
|
|
|
|
|
|
|
|
|
|
const parseOptions = __nccwpck_require__(785)
|
|
|
|
|
const { compareIdentifiers } = __nccwpck_require__(2463)
|
|
|
|
@ -6340,7 +6340,7 @@ class SemVer {
|
|
|
|
|
do {
|
|
|
|
|
const a = this.build[i]
|
|
|
|
|
const b = other.build[i]
|
|
|
|
|
debug('prerelease compare', i, a, b)
|
|
|
|
|
debug('build compare', i, a, b)
|
|
|
|
|
if (a === undefined && b === undefined) {
|
|
|
|
|
return 0
|
|
|
|
|
} else if (b === undefined) {
|
|
|
|
@ -6358,6 +6358,20 @@ class SemVer {
|
|
|
|
|
// preminor will bump the version up to the next minor release, and immediately
|
|
|
|
|
// down to pre-release. premajor and prepatch work the same way.
|
|
|
|
|
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 r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)
|
|
|
|
|
const match = `-${identifier}`.match(r)
|
|
|
|
|
if (!match || match[1] !== identifier) {
|
|
|
|
|
throw new Error(`invalid identifier: ${identifier}`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (release) {
|
|
|
|
|
case 'premajor':
|
|
|
|
|
this.prerelease.length = 0
|
|
|
|
@ -6388,6 +6402,12 @@ class SemVer {
|
|
|
|
|
}
|
|
|
|
|
this.inc('pre', identifier, identifierBase)
|
|
|
|
|
break
|
|
|
|
|
case 'release':
|
|
|
|
|
if (this.prerelease.length === 0) {
|
|
|
|
|
throw new Error(`version ${this.raw} is not a prerelease`)
|
|
|
|
|
}
|
|
|
|
|
this.prerelease.length = 0
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case 'major':
|
|
|
|
|
// If this is a pre-major version, bump up to the same major version.
|
|
|
|
@ -6431,10 +6451,6 @@ class SemVer {
|
|
|
|
|
case 'pre': {
|
|
|
|
|
const base = Number(identifierBase) ? 1 : 0
|
|
|
|
|
|
|
|
|
|
if (!identifier && identifierBase === false) {
|
|
|
|
|
throw new Error('invalid increment argument: identifier is empty')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.prerelease.length === 0) {
|
|
|
|
|
this.prerelease = [base]
|
|
|
|
|
} else {
|
|
|
|
@ -6634,6 +6650,7 @@ exports = module.exports = {}
|
|
|
|
|
const re = exports.re = []
|
|
|
|
|
const safeRe = exports.safeRe = []
|
|
|
|
|
const src = exports.src = []
|
|
|
|
|
const safeSrc = exports.safeSrc = []
|
|
|
|
|
const t = exports.t = {}
|
|
|
|
|
let R = 0
|
|
|
|
|
|
|
|
|
@ -6666,6 +6683,7 @@ const createToken = (name, value, isGlobal) => {
|
|
|
|
|
debug(name, index, value)
|
|
|
|
|
t[name] = index
|
|
|
|
|
src[index] = value
|
|
|
|
|
safeSrc[index] = safe
|
|
|
|
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
|
|
|
|
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
|
|
|
|
|
}
|
|
|
|
@ -6778,12 +6796,17 @@ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
|
|
|
|
|
|
|
|
|
// Coercion.
|
|
|
|
|
// Extract anything that could conceivably be a part of a valid semver
|
|
|
|
|
createToken('COERCE', `${'(^|[^\\d])' +
|
|
|
|
|
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
|
|
|
|
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
|
|
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
|
|
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
|
|
|
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
|
|
|
|
|
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
|
|
|
|
|
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
|
|
|
|
`(?:${src[t.PRERELEASE]})?` +
|
|
|
|
|
`(?:${src[t.BUILD]})?` +
|
|
|
|
|
`(?:$|[^\\d])`)
|
|
|
|
|
createToken('COERCERTL', src[t.COERCE], true)
|
|
|
|
|
createToken('COERCERTLFULL', src[t.COERCEFULL], true)
|
|
|
|
|
|
|
|
|
|
// Tilde ranges.
|
|
|
|
|
// Meaning is "reasonably at or greater than"
|
|
|
|
|