Bump semver from 7.3.8 to 7.5.2 (#34)

This commit is contained in:
MaksimZhukov 2023-07-11 15:21:34 +02:00 committed by GitHub
parent 337dee4c7b
commit e8908aab06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 291 additions and 241 deletions

View File

@ -1,9 +1,9 @@
--- ---
name: semver name: semver
version: 7.3.8 version: 7.5.4
type: npm type: npm
summary: The semantic version parser used by npm. summary: The semantic version parser used by npm.
homepage: https://github.com/npm/node-semver#readme homepage:
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE

160
dist/index.js vendored
View File

@ -9327,7 +9327,7 @@ function onceStrict (fn) {
const debug = __nccwpck_require__(427) const debug = __nccwpck_require__(427)
const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293) const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(2293)
const { re, t } = __nccwpck_require__(9523) const { safeRe: re, t } = __nccwpck_require__(9523)
const parseOptions = __nccwpck_require__(785) const parseOptions = __nccwpck_require__(785)
const { compareIdentifiers } = __nccwpck_require__(2463) const { compareIdentifiers } = __nccwpck_require__(2463)
@ -9343,7 +9343,7 @@ class SemVer {
version = version.version version = version.version
} }
} else if (typeof version !== 'string') { } else if (typeof version !== 'string') {
throw new TypeError(`Invalid Version: ${version}`) throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
} }
if (version.length > MAX_LENGTH) { if (version.length > MAX_LENGTH) {
@ -9502,36 +9502,36 @@ class SemVer {
// preminor will bump the version up to the next minor release, and immediately // preminor will bump the version up to the next minor release, and immediately
// down to pre-release. premajor and prepatch work the same way. // down to pre-release. premajor and prepatch work the same way.
inc (release, identifier) { inc (release, identifier, identifierBase) {
switch (release) { switch (release) {
case 'premajor': case 'premajor':
this.prerelease.length = 0 this.prerelease.length = 0
this.patch = 0 this.patch = 0
this.minor = 0 this.minor = 0
this.major++ this.major++
this.inc('pre', identifier) this.inc('pre', identifier, identifierBase)
break break
case 'preminor': case 'preminor':
this.prerelease.length = 0 this.prerelease.length = 0
this.patch = 0 this.patch = 0
this.minor++ this.minor++
this.inc('pre', identifier) this.inc('pre', identifier, identifierBase)
break break
case 'prepatch': case 'prepatch':
// If this is already a prerelease, it will bump to the next version // If this is already a prerelease, it will bump to the next version
// drop any prereleases that might already exist, since they are not // drop any prereleases that might already exist, since they are not
// relevant at this point. // relevant at this point.
this.prerelease.length = 0 this.prerelease.length = 0
this.inc('patch', identifier) this.inc('patch', identifier, identifierBase)
this.inc('pre', identifier) this.inc('pre', identifier, identifierBase)
break break
// If the input is a non-prerelease version, this acts the same as // If the input is a non-prerelease version, this acts the same as
// prepatch. // prepatch.
case 'prerelease': case 'prerelease':
if (this.prerelease.length === 0) { if (this.prerelease.length === 0) {
this.inc('patch', identifier) this.inc('patch', identifier, identifierBase)
} }
this.inc('pre', identifier) this.inc('pre', identifier, identifierBase)
break break
case 'major': case 'major':
@ -9573,9 +9573,15 @@ class SemVer {
break break
// This probably shouldn't be used publicly. // This probably shouldn't be used publicly.
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
case 'pre': 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) { if (this.prerelease.length === 0) {
this.prerelease = [0] this.prerelease = [base]
} else { } else {
let i = this.prerelease.length let i = this.prerelease.length
while (--i >= 0) { while (--i >= 0) {
@ -9586,27 +9592,36 @@ class SemVer {
} }
if (i === -1) { if (i === -1) {
// didn't increment anything // didn't increment anything
this.prerelease.push(0) if (identifier === this.prerelease.join('.') && identifierBase === false) {
throw new Error('invalid increment argument: identifier already exists')
}
this.prerelease.push(base)
} }
} }
if (identifier) { if (identifier) {
// 1.2.0-beta.1 bumps to 1.2.0-beta.2, // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
let prerelease = [identifier, base]
if (identifierBase === false) {
prerelease = [identifier]
}
if (compareIdentifiers(this.prerelease[0], identifier) === 0) { if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
if (isNaN(this.prerelease[1])) { if (isNaN(this.prerelease[1])) {
this.prerelease = [identifier, 0] this.prerelease = prerelease
} }
} else { } else {
this.prerelease = [identifier, 0] this.prerelease = prerelease
} }
} }
break break
}
default: default:
throw new Error(`invalid increment argument: ${release}`) throw new Error(`invalid increment argument: ${release}`)
} }
this.format() this.raw = this.format()
this.raw = this.version if (this.build.length) {
this.raw += `+${this.build.join('.')}`
}
return this return this
} }
} }
@ -9619,35 +9634,18 @@ module.exports = SemVer
/***/ 5925: /***/ 5925:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const { MAX_LENGTH } = __nccwpck_require__(2293)
const { re, t } = __nccwpck_require__(9523)
const SemVer = __nccwpck_require__(8088) const SemVer = __nccwpck_require__(8088)
const parse = (version, options, throwErrors = false) => {
const parseOptions = __nccwpck_require__(785)
const parse = (version, options) => {
options = parseOptions(options)
if (version instanceof SemVer) { if (version instanceof SemVer) {
return version return version
} }
if (typeof version !== 'string') {
return null
}
if (version.length > MAX_LENGTH) {
return null
}
const r = options.loose ? re[t.LOOSE] : re[t.FULL]
if (!r.test(version)) {
return null
}
try { try {
return new SemVer(version, options) return new SemVer(version, options)
} catch (er) { } catch (er) {
return null if (!throwErrors) {
return null
}
throw er
} }
} }
@ -9670,11 +9668,29 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
// Max safe segment length for coercion. // Max safe segment length for coercion.
const MAX_SAFE_COMPONENT_LENGTH = 16 const MAX_SAFE_COMPONENT_LENGTH = 16
// Max safe length for a build identifier. The max length minus 6 characters for
// the shortest version with a build 0.0.0+BUILD.
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
const RELEASE_TYPES = [
'major',
'premajor',
'minor',
'preminor',
'patch',
'prepatch',
'prerelease',
]
module.exports = { module.exports = {
SEMVER_SPEC_VERSION,
MAX_LENGTH, MAX_LENGTH,
MAX_SAFE_INTEGER,
MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_SAFE_INTEGER,
RELEASE_TYPES,
SEMVER_SPEC_VERSION,
FLAG_INCLUDE_PRERELEASE: 0b001,
FLAG_LOOSE: 0b010,
} }
@ -9729,16 +9745,20 @@ module.exports = {
/***/ 785: /***/ 785:
/***/ ((module) => { /***/ ((module) => {
// parse out just the options we care about so we always get a consistent // parse out just the options we care about
// obj with keys in a consistent order. const looseOption = Object.freeze({ loose: true })
const opts = ['includePrerelease', 'loose', 'rtl'] const emptyOpts = Object.freeze({ })
const parseOptions = options => const parseOptions = options => {
!options ? {} if (!options) {
: typeof options !== 'object' ? { loose: true } return emptyOpts
: opts.filter(k => options[k]).reduce((o, k) => { }
o[k] = true
return o if (typeof options !== 'object') {
}, {}) return looseOption
}
return options
}
module.exports = parseOptions module.exports = parseOptions
@ -9747,22 +9767,52 @@ module.exports = parseOptions
/***/ 9523: /***/ 9523:
/***/ ((module, exports, __nccwpck_require__) => { /***/ ((module, exports, __nccwpck_require__) => {
const { MAX_SAFE_COMPONENT_LENGTH } = __nccwpck_require__(2293) const {
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_LENGTH,
} = __nccwpck_require__(2293)
const debug = __nccwpck_require__(427) const debug = __nccwpck_require__(427)
exports = module.exports = {} exports = module.exports = {}
// The actual regexps go on exports.re // The actual regexps go on exports.re
const re = exports.re = [] const re = exports.re = []
const safeRe = exports.safeRe = []
const src = exports.src = [] const src = exports.src = []
const t = exports.t = {} const t = exports.t = {}
let R = 0 let R = 0
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
// used internally via the safeRe object since all inputs in this library get
// normalized first to trim and collapse all extra whitespace. The original
// regexes are exported for userland consumption and lower level usage. A
// future breaking change could export the safer regex only with a note that
// all input should have extra whitespace removed.
const safeRegexReplacements = [
['\\s', 1],
['\\d', MAX_LENGTH],
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
]
const makeSafeRegex = (value) => {
for (const [token, max] of safeRegexReplacements) {
value = value
.split(`${token}*`).join(`${token}{0,${max}}`)
.split(`${token}+`).join(`${token}{1,${max}}`)
}
return value
}
const createToken = (name, value, isGlobal) => { const createToken = (name, value, isGlobal) => {
const safe = makeSafeRegex(value)
const index = R++ const index = R++
debug(name, index, value) debug(name, index, value)
t[name] = index t[name] = index
src[index] = value src[index] = value
re[index] = new RegExp(value, isGlobal ? 'g' : undefined) re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
} }
// The following Regular Expressions can be used for tokenizing, // The following Regular Expressions can be used for tokenizing,
@ -9772,13 +9822,13 @@ const createToken = (name, value, isGlobal) => {
// A single `0`, or a non-zero digit followed by zero or more digits. // A single `0`, or a non-zero digit followed by zero or more digits.
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
// ## Non-numeric Identifier // ## Non-numeric Identifier
// Zero or more digits, followed by a letter or hyphen, and then zero or // Zero or more digits, followed by a letter or hyphen, and then zero or
// more letters, digits, or hyphens. // more letters, digits, or hyphens.
createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
// ## Main Version // ## Main Version
// Three dot-separated numeric identifiers. // Three dot-separated numeric identifiers.
@ -9813,7 +9863,7 @@ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
// ## Build Metadata Identifier // ## Build Metadata Identifier
// Any combination of digits, letters, or hyphens. // Any combination of digits, letters, or hyphens.
createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
// ## Build Metadata // ## Build Metadata
// Plus sign, followed by one or more period-separated build metadata // Plus sign, followed by one or more period-separated build metadata

14
package-lock.json generated
View File

@ -12,7 +12,7 @@
"@actions/core": "^1.2.7", "@actions/core": "^1.2.7",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"semver": "^7.3.5" "semver": "^7.5.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
@ -6598,9 +6598,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.3.8", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dependencies": { "dependencies": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
@ -12424,9 +12424,9 @@
} }
}, },
"semver": { "semver": {
"version": "7.3.8", "version": "7.5.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"requires": { "requires": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
} }

View File

@ -29,7 +29,7 @@
"@actions/core": "^1.2.7", "@actions/core": "^1.2.7",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@actions/http-client": "^1.0.11", "@actions/http-client": "^1.0.11",
"semver": "^7.3.5" "semver": "^7.5.2"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",