Add support for latest release (#269)

6ed3c52 · Benjamin Schultzer · 2024-06-15 15:18

14 files +85158 -833

Files changed

modified README.md
+2 −0
@@ -44,6 +44,8 @@ For pre-release versions, such as `v1.11.0-rc.0`, use the full version
44 44 specifier (`v1.11.0-rc.0`) and set option `version-type` to `strict`. Pre-release versions are
45 45 opt-in, so `1.11.x` will not match a pre-release.
46 46
47 +Use `latest` for the latest version; the latest version is calculated based on all the retrieved versions. Please take a look at the test cases for examples.
48 +
47 49 ### Compatibility between Operating System and Erlang/OTP
48 50
49 51 This list presents the known working version combos between the target operating system
modified dist/index.js
+100 −804
@@ -5990,8 +5990,8 @@ class Range {
5990 5990
5991 5991 module.exports = Range
5992 5992
5993 const LRU = __nccwpck_require__(1196)
5994 const cache = new LRU({ max: 1000 })
5993 +const LRU = __nccwpck_require__(5339)
5994 +const cache = new LRU()
5995 5995
5996 5996 const parseOptions = __nccwpck_require__(785)
5997 5997 const Comparator = __nccwpck_require__(1532)
@@ -6262,9 +6262,10 @@ const replaceGTE0 = (comp, options) => {
6262 6262 // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
6263 6263 // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
6264 6264 // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
6265 +// TODO build?
6265 6266 const hyphenReplace = incPr => ($0,
6266 6267 from, fM, fm, fp, fpr, fb,
6267 to, tM, tm, tp, tpr, tb) => {
6268 + to, tM, tm, tp, tpr) => {
6268 6269 if (isX(fM)) {
6269 6270 from = ''
6270 6271 } else if (isX(fm)) {
@@ -6496,7 +6497,7 @@ class SemVer {
6496 6497 do {
6497 6498 const a = this.build[i]
6498 6499 const b = other.build[i]
6499 debug('prerelease compare', i, a, b)
6500 + debug('build compare', i, a, b)
6500 6501 if (a === undefined && b === undefined) {
6501 6502 return 0
6502 6503 } else if (b === undefined) {
@@ -6738,35 +6739,43 @@ const coerce = (version, options) => {
6738 6739
6739 6740 let match = null
6740 6741 if (!options.rtl) {
6741 match = version.match(re[t.COERCE])
6742 + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
6742 6743 } else {
6743 6744 // Find the right-most coercible string that does not share
6744 6745 // a terminus with a more left-ward coercible string.
6745 6746 // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
6747 + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
6746 6748 //
6747 6749 // Walk through the string checking with a /g regexp
6748 6750 // Manually set the index so as to pick up overlapping matches.
6749 6751 // Stop when we get a match that ends at the string end, since no
6750 6752 // coercible string can be more right-ward without the same terminus.
6753 + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
6751 6754 let next
6752 while ((next = re[t.COERCERTL].exec(version)) &&
6755 + while ((next = coerceRtlRegex.exec(version)) &&
6753 6756 (!match || match.index + match[0].length !== version.length)
6754 6757 ) {
6755 6758 if (!match ||
6756 6759 next.index + next[0].length !== match.index + match[0].length) {
6757 6760 match = next
6758 6761 }
6759 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
6762 + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
6760 6763 }
6761 6764 // leave it in a clean state
6762 re[t.COERCERTL].lastIndex = -1
6765 + coerceRtlRegex.lastIndex = -1
6763 6766 }
6764 6767
6765 6768 if (match === null) {
6766 6769 return null
6767 6770 }
6768 6771
6769 return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
6772 + const major = match[2]
6773 + const minor = match[3] || '0'
6774 + const patch = match[4] || '0'
6775 + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
6776 + const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
6777 +
6778 + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
6770 6779 }
6771 6780 module.exports = coerce
6772 6781
@@ -7275,6 +7284,53 @@ module.exports = {
7275 7284 }
7276 7285
7277 7286
7287 +/***/ }),
7288 +
7289 +/***/ 5339:
7290 +/***/ ((module) => {
7291 +
7292 +class LRUCache {
7293 + constructor () {
7294 + this.max = 1000
7295 + this.map = new Map()
7296 + }
7297 +
7298 + get (key) {
7299 + const value = this.map.get(key)
7300 + if (value === undefined) {
7301 + return undefined
7302 + } else {
7303 + // Remove the key from the map and add it to the end
7304 + this.map.delete(key)
7305 + this.map.set(key, value)
7306 + return value
7307 + }
7308 + }
7309 +
7310 + delete (key) {
7311 + return this.map.delete(key)
7312 + }
7313 +
7314 + set (key, value) {
7315 + const deleted = this.delete(key)
7316 +
7317 + if (!deleted && value !== undefined) {
7318 + // If cache is full, delete the least recently used item
7319 + if (this.map.size >= this.max) {
7320 + const firstKey = this.map.keys().next().value
7321 + this.delete(firstKey)
7322 + }
7323 +
7324 + this.map.set(key, value)
7325 + }
7326 +
7327 + return this
7328 + }
7329 +}
7330 +
7331 +module.exports = LRUCache
7332 +
7333 +
7278 7334 /***/ }),
7279 7335
7280 7336 /***/ 785:
@@ -7458,12 +7514,17 @@ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
7458 7514
7459 7515 // Coercion.
7460 7516 // Extract anything that could conceivably be a part of a valid semver
7461 createToken('COERCE', `${'(^|[^\\d])' +
7517 +createToken('COERCEPLAIN', `${'(^|[^\\d])' +
7462 7518 '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
7463 7519 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
7464 `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
7520 + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
7521 +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
7522 +createToken('COERCEFULL', src[t.COERCEPLAIN] +
7523 + `(?:${src[t.PRERELEASE]})?` +
7524 + `(?:${src[t.BUILD]})?` +
7465 7525 `(?:$|[^\\d])`)
7466 7526 createToken('COERCERTL', src[t.COERCE], true)
7527 +createToken('COERCERTLFULL', src[t.COERCEFULL], true)
7467 7528
7468 7529 // Tilde ranges.
7469 7530 // Meaning is "reasonably at or greater than"
@@ -7516,348 +7577,6 @@ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
7516 7577 createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
7517 7578
7518 7579
7519 /***/ }),
7520
7521 /***/ 1196:
7522 /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7523
7524 "use strict";
7525
7526
7527 // A linked list to keep track of recently-used-ness
7528 const Yallist = __nccwpck_require__(665)
7529
7530 const MAX = Symbol('max')
7531 const LENGTH = Symbol('length')
7532 const LENGTH_CALCULATOR = Symbol('lengthCalculator')
7533 const ALLOW_STALE = Symbol('allowStale')
7534 const MAX_AGE = Symbol('maxAge')
7535 const DISPOSE = Symbol('dispose')
7536 const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
7537 const LRU_LIST = Symbol('lruList')
7538 const CACHE = Symbol('cache')
7539 const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
7540
7541 const naiveLength = () => 1
7542
7543 // lruList is a yallist where the head is the youngest
7544 // item, and the tail is the oldest. the list contains the Hit
7545 // objects as the entries.
7546 // Each Hit object has a reference to its Yallist.Node. This
7547 // never changes.
7548 //
7549 // cache is a Map (or PseudoMap) that matches the keys to
7550 // the Yallist.Node object.
7551 class LRUCache {
7552 constructor (options) {
7553 if (typeof options === 'number')
7554 options = { max: options }
7555
7556 if (!options)
7557 options = {}
7558
7559 if (options.max && (typeof options.max !== 'number' || options.max < 0))
7560 throw new TypeError('max must be a non-negative number')
7561 // Kind of weird to have a default max of Infinity, but oh well.
7562 const max = this[MAX] = options.max || Infinity
7563
7564 const lc = options.length || naiveLength
7565 this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
7566 this[ALLOW_STALE] = options.stale || false
7567 if (options.maxAge && typeof options.maxAge !== 'number')
7568 throw new TypeError('maxAge must be a number')
7569 this[MAX_AGE] = options.maxAge || 0
7570 this[DISPOSE] = options.dispose
7571 this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
7572 this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
7573 this.reset()
7574 }
7575
7576 // resize the cache when the max changes.
7577 set max (mL) {
7578 if (typeof mL !== 'number' || mL < 0)
7579 throw new TypeError('max must be a non-negative number')
7580
7581 this[MAX] = mL || Infinity
7582 trim(this)
7583 }
7584 get max () {
7585 return this[MAX]
7586 }
7587
7588 set allowStale (allowStale) {
7589 this[ALLOW_STALE] = !!allowStale
7590 }
7591 get allowStale () {
7592 return this[ALLOW_STALE]
7593 }
7594
7595 set maxAge (mA) {
7596 if (typeof mA !== 'number')
7597 throw new TypeError('maxAge must be a non-negative number')
7598
7599 this[MAX_AGE] = mA
7600 trim(this)
7601 }
7602 get maxAge () {
7603 return this[MAX_AGE]
7604 }
7605
7606 // resize the cache when the lengthCalculator changes.
7607 set lengthCalculator (lC) {
7608 if (typeof lC !== 'function')
7609 lC = naiveLength
7610
7611 if (lC !== this[LENGTH_CALCULATOR]) {
7612 this[LENGTH_CALCULATOR] = lC
7613 this[LENGTH] = 0
7614 this[LRU_LIST].forEach(hit => {
7615 hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
7616 this[LENGTH] += hit.length
7617 })
7618 }
7619 trim(this)
7620 }
7621 get lengthCalculator () { return this[LENGTH_CALCULATOR] }
7622
7623 get length () { return this[LENGTH] }
7624 get itemCount () { return this[LRU_LIST].length }
7625
7626 rforEach (fn, thisp) {
7627 thisp = thisp || this
7628 for (let walker = this[LRU_LIST].tail; walker !== null;) {
7629 const prev = walker.prev
7630 forEachStep(this, fn, walker, thisp)
7631 walker = prev
7632 }
7633 }
7634
7635 forEach (fn, thisp) {
7636 thisp = thisp || this
7637 for (let walker = this[LRU_LIST].head; walker !== null;) {
7638 const next = walker.next
7639 forEachStep(this, fn, walker, thisp)
7640 walker = next
7641 }
7642 }
7643
7644 keys () {
7645 return this[LRU_LIST].toArray().map(k => k.key)
7646 }
7647
7648 values () {
7649 return this[LRU_LIST].toArray().map(k => k.value)
7650 }
7651
7652 reset () {
7653 if (this[DISPOSE] &&
7654 this[LRU_LIST] &&
7655 this[LRU_LIST].length) {
7656 this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
7657 }
7658
7659 this[CACHE] = new Map() // hash of items by key
7660 this[LRU_LIST] = new Yallist() // list of items in order of use recency
7661 this[LENGTH] = 0 // length of items in the list
7662 }
7663
7664 dump () {
7665 return this[LRU_LIST].map(hit =>
7666 isStale(this, hit) ? false : {
7667 k: hit.key,
7668 v: hit.value,
7669 e: hit.now + (hit.maxAge || 0)
7670 }).toArray().filter(h => h)
7671 }
7672
7673 dumpLru () {
7674 return this[LRU_LIST]
7675 }
7676
7677 set (key, value, maxAge) {
7678 maxAge = maxAge || this[MAX_AGE]
7679
7680 if (maxAge && typeof maxAge !== 'number')
7681 throw new TypeError('maxAge must be a number')
7682
7683 const now = maxAge ? Date.now() : 0
7684 const len = this[LENGTH_CALCULATOR](value, key)
7685
7686 if (this[CACHE].has(key)) {
7687 if (len > this[MAX]) {
7688 del(this, this[CACHE].get(key))
7689 return false
7690 }
7691
7692 const node = this[CACHE].get(key)
7693 const item = node.value
7694
7695 // dispose of the old one before overwriting
7696 // split out into 2 ifs for better coverage tracking
7697 if (this[DISPOSE]) {
7698 if (!this[NO_DISPOSE_ON_SET])
7699 this[DISPOSE](key, item.value)
7700 }
7701
7702 item.now = now
7703 item.maxAge = maxAge
7704 item.value = value
7705 this[LENGTH] += len - item.length
7706 item.length = len
7707 this.get(key)
7708 trim(this)
7709 return true
7710 }
7711
7712 const hit = new Entry(key, value, len, now, maxAge)
7713
7714 // oversized objects fall out of cache automatically.
7715 if (hit.length > this[MAX]) {
7716 if (this[DISPOSE])
7717 this[DISPOSE](key, value)
7718
7719 return false
7720 }
7721
7722 this[LENGTH] += hit.length
7723 this[LRU_LIST].unshift(hit)
7724 this[CACHE].set(key, this[LRU_LIST].head)
7725 trim(this)
7726 return true
7727 }
7728
7729 has (key) {
7730 if (!this[CACHE].has(key)) return false
7731 const hit = this[CACHE].get(key).value
7732 return !isStale(this, hit)
7733 }
7734
7735 get (key) {
7736 return get(this, key, true)
7737 }
7738
7739 peek (key) {
7740 return get(this, key, false)
7741 }
7742
7743 pop () {
7744 const node = this[LRU_LIST].tail
7745 if (!node)
7746 return null
7747
7748 del(this, node)
7749 return node.value
7750 }
7751
7752 del (key) {
7753 del(this, this[CACHE].get(key))
7754 }
7755
7756 load (arr) {
7757 // reset the cache
7758 this.reset()
7759
7760 const now = Date.now()
7761 // A previous serialized cache has the most recent items first
7762 for (let l = arr.length - 1; l >= 0; l--) {
7763 const hit = arr[l]
7764 const expiresAt = hit.e || 0
7765 if (expiresAt === 0)
7766 // the item was created without expiration in a non aged cache
7767 this.set(hit.k, hit.v)
7768 else {
7769 const maxAge = expiresAt - now
7770 // dont add already expired items
7771 if (maxAge > 0) {
7772 this.set(hit.k, hit.v, maxAge)
7773 }
7774 }
7775 }
7776 }
7777
7778 prune () {
7779 this[CACHE].forEach((value, key) => get(this, key, false))
7780 }
7781 }
7782
7783 const get = (self, key, doUse) => {
7784 const node = self[CACHE].get(key)
7785 if (node) {
7786 const hit = node.value
7787 if (isStale(self, hit)) {
7788 del(self, node)
7789 if (!self[ALLOW_STALE])
7790 return undefined
7791 } else {
7792 if (doUse) {
7793 if (self[UPDATE_AGE_ON_GET])
7794 node.value.now = Date.now()
7795 self[LRU_LIST].unshiftNode(node)
7796 }
7797 }
7798 return hit.value
7799 }
7800 }
7801
7802 const isStale = (self, hit) => {
7803 if (!hit || (!hit.maxAge && !self[MAX_AGE]))
7804 return false
7805
7806 const diff = Date.now() - hit.now
7807 return hit.maxAge ? diff > hit.maxAge
7808 : self[MAX_AGE] && (diff > self[MAX_AGE])
7809 }
7810
7811 const trim = self => {
7812 if (self[LENGTH] > self[MAX]) {
7813 for (let walker = self[LRU_LIST].tail;
7814 self[LENGTH] > self[MAX] && walker !== null;) {
7815 // We know that we're about to delete this one, and also
7816 // what the next least recently used key will be, so just
7817 // go ahead and set it now.
7818 const prev = walker.prev
7819 del(self, walker)
7820 walker = prev
7821 }
7822 }
7823 }
7824
7825 const del = (self, node) => {
7826 if (node) {
7827 const hit = node.value
7828 if (self[DISPOSE])
7829 self[DISPOSE](hit.key, hit.value)
7830
7831 self[LENGTH] -= hit.length
7832 self[CACHE].delete(hit.key)
7833 self[LRU_LIST].removeNode(node)
7834 }
7835 }
7836
7837 class Entry {
7838 constructor (key, value, length, now, maxAge) {
7839 this.key = key
7840 this.value = value
7841 this.length = length
7842 this.now = now
7843 this.maxAge = maxAge || 0
7844 }
7845 }
7846
7847 const forEachStep = (self, fn, node, thisp) => {
7848 let hit = node.value
7849 if (isStale(self, hit)) {
7850 del(self, node)
7851 if (!self[ALLOW_STALE])
7852 hit = undefined
7853 }
7854 if (hit)
7855 fn.call(thisp, hit.value, hit.key, self)
7856 }
7857
7858 module.exports = LRUCache
7859
7860
7861 7580 /***/ }),
7862 7581
7863 7582 /***/ 9380:
@@ -9379,456 +9098,6 @@ function version(uuid) {
9379 9098 var _default = version;
9380 9099 exports["default"] = _default;
9381 9100
9382 /***/ }),
9383
9384 /***/ 4091:
9385 /***/ ((module) => {
9386
9387 "use strict";
9388
9389 module.exports = function (Yallist) {
9390 Yallist.prototype[Symbol.iterator] = function* () {
9391 for (let walker = this.head; walker; walker = walker.next) {
9392 yield walker.value
9393 }
9394 }
9395 }
9396
9397
9398 /***/ }),
9399
9400 /***/ 665:
9401 /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
9402
9403 "use strict";
9404
9405 module.exports = Yallist
9406
9407 Yallist.Node = Node
9408 Yallist.create = Yallist
9409
9410 function Yallist (list) {
9411 var self = this
9412 if (!(self instanceof Yallist)) {
9413 self = new Yallist()
9414 }
9415
9416 self.tail = null
9417 self.head = null
9418 self.length = 0
9419
9420 if (list && typeof list.forEach === 'function') {
9421 list.forEach(function (item) {
9422 self.push(item)
9423 })
9424 } else if (arguments.length > 0) {
9425 for (var i = 0, l = arguments.length; i < l; i++) {
9426 self.push(arguments[i])
9427 }
9428 }
9429
9430 return self
9431 }
9432
9433 Yallist.prototype.removeNode = function (node) {
9434 if (node.list !== this) {
9435 throw new Error('removing node which does not belong to this list')
9436 }
9437
9438 var next = node.next
9439 var prev = node.prev
9440
9441 if (next) {
9442 next.prev = prev
9443 }
9444
9445 if (prev) {
9446 prev.next = next
9447 }
9448
9449 if (node === this.head) {
9450 this.head = next
9451 }
9452 if (node === this.tail) {
9453 this.tail = prev
9454 }
9455
9456 node.list.length--
9457 node.next = null
9458 node.prev = null
9459 node.list = null
9460
9461 return next
9462 }
9463
9464 Yallist.prototype.unshiftNode = function (node) {
9465 if (node === this.head) {
9466 return
9467 }
9468
9469 if (node.list) {
9470 node.list.removeNode(node)
9471 }
9472
9473 var head = this.head
9474 node.list = this
9475 node.next = head
9476 if (head) {
9477 head.prev = node
9478 }
9479
9480 this.head = node
9481 if (!this.tail) {
9482 this.tail = node
9483 }
9484 this.length++
9485 }
9486
9487 Yallist.prototype.pushNode = function (node) {
9488 if (node === this.tail) {
9489 return
9490 }
9491
9492 if (node.list) {
9493 node.list.removeNode(node)
9494 }
9495
9496 var tail = this.tail
9497 node.list = this
9498 node.prev = tail
9499 if (tail) {
9500 tail.next = node
9501 }
9502
9503 this.tail = node
9504 if (!this.head) {
9505 this.head = node
9506 }
9507 this.length++
9508 }
9509
9510 Yallist.prototype.push = function () {
9511 for (var i = 0, l = arguments.length; i < l; i++) {
9512 push(this, arguments[i])
9513 }
9514 return this.length
9515 }
9516
9517 Yallist.prototype.unshift = function () {
9518 for (var i = 0, l = arguments.length; i < l; i++) {
9519 unshift(this, arguments[i])
9520 }
9521 return this.length
9522 }
9523
9524 Yallist.prototype.pop = function () {
9525 if (!this.tail) {
9526 return undefined
9527 }
9528
9529 var res = this.tail.value
9530 this.tail = this.tail.prev
9531 if (this.tail) {
9532 this.tail.next = null
9533 } else {
9534 this.head = null
9535 }
9536 this.length--
9537 return res
9538 }
9539
9540 Yallist.prototype.shift = function () {
9541 if (!this.head) {
9542 return undefined
9543 }
9544
9545 var res = this.head.value
9546 this.head = this.head.next
9547 if (this.head) {
9548 this.head.prev = null
9549 } else {
9550 this.tail = null
9551 }
9552 this.length--
9553 return res
9554 }
9555
9556 Yallist.prototype.forEach = function (fn, thisp) {
9557 thisp = thisp || this
9558 for (var walker = this.head, i = 0; walker !== null; i++) {
9559 fn.call(thisp, walker.value, i, this)
9560 walker = walker.next
9561 }
9562 }
9563
9564 Yallist.prototype.forEachReverse = function (fn, thisp) {
9565 thisp = thisp || this
9566 for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
9567 fn.call(thisp, walker.value, i, this)
9568 walker = walker.prev
9569 }
9570 }
9571
9572 Yallist.prototype.get = function (n) {
9573 for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
9574 // abort out of the list early if we hit a cycle
9575 walker = walker.next
9576 }
9577 if (i === n && walker !== null) {
9578 return walker.value
9579 }
9580 }
9581
9582 Yallist.prototype.getReverse = function (n) {
9583 for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
9584 // abort out of the list early if we hit a cycle
9585 walker = walker.prev
9586 }
9587 if (i === n && walker !== null) {
9588 return walker.value
9589 }
9590 }
9591
9592 Yallist.prototype.map = function (fn, thisp) {
9593 thisp = thisp || this
9594 var res = new Yallist()
9595 for (var walker = this.head; walker !== null;) {
9596 res.push(fn.call(thisp, walker.value, this))
9597 walker = walker.next
9598 }
9599 return res
9600 }
9601
9602 Yallist.prototype.mapReverse = function (fn, thisp) {
9603 thisp = thisp || this
9604 var res = new Yallist()
9605 for (var walker = this.tail; walker !== null;) {
9606 res.push(fn.call(thisp, walker.value, this))
9607 walker = walker.prev
9608 }
9609 return res
9610 }
9611
9612 Yallist.prototype.reduce = function (fn, initial) {
9613 var acc
9614 var walker = this.head
9615 if (arguments.length > 1) {
9616 acc = initial
9617 } else if (this.head) {
9618 walker = this.head.next
9619 acc = this.head.value
9620 } else {
9621 throw new TypeError('Reduce of empty list with no initial value')
9622 }
9623
9624 for (var i = 0; walker !== null; i++) {
9625 acc = fn(acc, walker.value, i)
9626 walker = walker.next
9627 }
9628
9629 return acc
9630 }
9631
9632 Yallist.prototype.reduceReverse = function (fn, initial) {
9633 var acc
9634 var walker = this.tail
9635 if (arguments.length > 1) {
9636 acc = initial
9637 } else if (this.tail) {
9638 walker = this.tail.prev
9639 acc = this.tail.value
9640 } else {
9641 throw new TypeError('Reduce of empty list with no initial value')
9642 }
9643
9644 for (var i = this.length - 1; walker !== null; i--) {
9645 acc = fn(acc, walker.value, i)
9646 walker = walker.prev
9647 }
9648
9649 return acc
9650 }
9651
9652 Yallist.prototype.toArray = function () {
9653 var arr = new Array(this.length)
9654 for (var i = 0, walker = this.head; walker !== null; i++) {
9655 arr[i] = walker.value
9656 walker = walker.next
9657 }
9658 return arr
9659 }
9660
9661 Yallist.prototype.toArrayReverse = function () {
9662 var arr = new Array(this.length)
9663 for (var i = 0, walker = this.tail; walker !== null; i++) {
9664 arr[i] = walker.value
9665 walker = walker.prev
9666 }
9667 return arr
9668 }
9669
9670 Yallist.prototype.slice = function (from, to) {
9671 to = to || this.length
9672 if (to < 0) {
9673 to += this.length
9674 }
9675 from = from || 0
9676 if (from < 0) {
9677 from += this.length
9678 }
9679 var ret = new Yallist()
9680 if (to < from || to < 0) {
9681 return ret
9682 }
9683 if (from < 0) {
9684 from = 0
9685 }
9686 if (to > this.length) {
9687 to = this.length
9688 }
9689 for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
9690 walker = walker.next
9691 }
9692 for (; walker !== null && i < to; i++, walker = walker.next) {
9693 ret.push(walker.value)
9694 }
9695 return ret
9696 }
9697
9698 Yallist.prototype.sliceReverse = function (from, to) {
9699 to = to || this.length
9700 if (to < 0) {
9701 to += this.length
9702 }
9703 from = from || 0
9704 if (from < 0) {
9705 from += this.length
9706 }
9707 var ret = new Yallist()
9708 if (to < from || to < 0) {
9709 return ret
9710 }
9711 if (from < 0) {
9712 from = 0
9713 }
9714 if (to > this.length) {
9715 to = this.length
9716 }
9717 for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
9718 walker = walker.prev
9719 }
9720 for (; walker !== null && i > from; i--, walker = walker.prev) {
9721 ret.push(walker.value)
9722 }
9723 return ret
9724 }
9725
9726 Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
9727 if (start > this.length) {
9728 start = this.length - 1
9729 }
9730 if (start < 0) {
9731 start = this.length + start;
9732 }
9733
9734 for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
9735 walker = walker.next
9736 }
9737
9738 var ret = []
9739 for (var i = 0; walker && i < deleteCount; i++) {
9740 ret.push(walker.value)
9741 walker = this.removeNode(walker)
9742 }
9743 if (walker === null) {
9744 walker = this.tail
9745 }
9746
9747 if (walker !== this.head && walker !== this.tail) {
9748 walker = walker.prev
9749 }
9750
9751 for (var i = 0; i < nodes.length; i++) {
9752 walker = insert(this, walker, nodes[i])
9753 }
9754 return ret;
9755 }
9756
9757 Yallist.prototype.reverse = function () {
9758 var head = this.head
9759 var tail = this.tail
9760 for (var walker = head; walker !== null; walker = walker.prev) {
9761 var p = walker.prev
9762 walker.prev = walker.next
9763 walker.next = p
9764 }
9765 this.head = tail
9766 this.tail = head
9767 return this
9768 }
9769
9770 function insert (self, node, value) {
9771 var inserted = node === self.head ?
9772 new Node(value, null, node, self) :
9773 new Node(value, node, node.next, self)
9774
9775 if (inserted.next === null) {
9776 self.tail = inserted
9777 }
9778 if (inserted.prev === null) {
9779 self.head = inserted
9780 }
9781
9782 self.length++
9783
9784 return inserted
9785 }
9786
9787 function push (self, item) {
9788 self.tail = new Node(item, self.tail, null, self)
9789 if (!self.head) {
9790 self.head = self.tail
9791 }
9792 self.length++
9793 }
9794
9795 function unshift (self, item) {
9796 self.head = new Node(item, null, self.head, self)
9797 if (!self.tail) {
9798 self.tail = self.head
9799 }
9800 self.length++
9801 }
9802
9803 function Node (value, prev, next, list) {
9804 if (!(this instanceof Node)) {
9805 return new Node(value, prev, next, list)
9806 }
9807
9808 this.list = list
9809 this.value = value
9810
9811 if (prev) {
9812 prev.next = this
9813 this.prev = prev
9814 } else {
9815 this.prev = null
9816 }
9817
9818 if (next) {
9819 next.prev = this
9820 this.next = next
9821 } else {
9822 this.next = null
9823 }
9824 }
9825
9826 try {
9827 // add if support for Symbol.iterator is present
9828 __nccwpck_require__(4091)(Yallist)
9829 } catch (er) {}
9830
9831
9832 9101 /***/ }),
9833 9102
9834 9103 /***/ 7037:
@@ -10209,7 +9478,34 @@ function isStrictVersion() {
10209 9478 return getInput('version-type', false) === 'strict'
10210 9479 }
10211 9480
9481 +function gt(left, right) {
9482 + return semver.gt(parseVersion(left), parseVersion(right))
9483 +}
9484 +
9485 +function validVersion(v) {
9486 + return (
9487 + v.match(/main|master|nightly|latest/g) == null &&
9488 + !v.startsWith('a') &&
9489 + !v.startsWith('b')
9490 + )
9491 +}
9492 +
9493 +function parseVersion(v) {
9494 + v = v.includes('rc') ? v : v.split('.')
9495 + if (v instanceof Array) {
9496 + v = `${[v.shift(), v.shift(), v.shift()].join('.')}+${v.join('.')}`
9497 + }
9498 + return semver.coerce(v, { includePrerelease: true, loose: true })
9499 +}
9500 +
10212 9501 function getVersionFromSpec(spec0, versions0) {
9502 + let latest
9503 + Object.keys(versions0).forEach((v) => {
9504 + if (validVersion(v)) {
9505 + latest = latest && gt(latest, v) ? latest : v
9506 + }
9507 + })
9508 + versions0.latest = latest
10213 9509 const spec = maybeRemoveVPrefix(spec0)
10214 9510
10215 9511 const altVersions = {}
@@ -10306,7 +9602,7 @@ function isRC(ver) {
10306 9602 }
10307 9603
10308 9604 function isKnownBranch(ver) {
10309 return ['main', 'master', 'maint'].includes(ver)
9605 + return ['main', 'master', 'maint', 'latest'].includes(ver)
10310 9606 }
10311 9607
10312 9608 function getRunnerOSVersion() {
modified package-lock.json
+4 −23
@@ -11,7 +11,7 @@
11 11 "@actions/exec": "1.1.1",
12 12 "@actions/http-client": "2.1.0",
13 13 "@actions/tool-cache": "2.0.1",
14 "semver": "7.5.4"
14 + "semver": "7.6.2"
15 15 },
16 16 "devDependencies": {
17 17 "@vercel/ncc": "0.36.1",
@@ -2358,12 +2358,9 @@
2358 2358 "dev": true
2359 2359 },
2360 2360 "node_modules/semver": {
2361 "version": "7.5.4",
2362 "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
2363 "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
2364 "dependencies": {
2365 "lru-cache": "^6.0.0"
2366 },
2361 + "version": "7.6.2",
2362 + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
2363 + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
2367 2364 "bin": {
2368 2365 "semver": "bin/semver.js"
2369 2366 },
@@ -2377,17 +2374,6 @@
2377 2374 "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",
2378 2375 "dev": true
2379 2376 },
2380 "node_modules/semver/node_modules/lru-cache": {
2381 "version": "6.0.0",
2382 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
2383 "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
2384 "dependencies": {
2385 "yallist": "^4.0.0"
2386 },
2387 "engines": {
2388 "node": ">=10"
2389 }
2390 },
2391 2377 "node_modules/serialize-error": {
2392 2378 "version": "7.0.1",
2393 2379 "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",
@@ -2869,11 +2855,6 @@
2869 2855 "node": ">=10"
2870 2856 }
2871 2857 },
2872 "node_modules/yallist": {
2873 "version": "4.0.0",
2874 "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
2875 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
2876 },
2877 2858 "node_modules/yaml-lint": {
2878 2859 "version": "1.7.0",
2879 2860 "resolved": "https://registry.npmjs.org/yaml-lint/-/yaml-lint-1.7.0.tgz",
modified package.json
+1 −1
@@ -20,7 +20,7 @@
20 20 "@actions/exec": "1.1.1",
21 21 "@actions/http-client": "2.1.0",
22 22 "@actions/tool-cache": "2.0.1",
23 "semver": "7.5.4"
23 + "semver": "7.6.2"
24 24 },
25 25 "devDependencies": {
26 26 "@vercel/ncc": "0.36.1",
modified src/setup-beam.js
+28 −1
@@ -378,7 +378,34 @@ function isStrictVersion() {
378 378 return getInput('version-type', false) === 'strict'
379 379 }
380 380
381 +function gt(left, right) {
382 + return semver.gt(parseVersion(left), parseVersion(right))
383 +}
384 +
385 +function validVersion(v) {
386 + return (
387 + v.match(/main|master|nightly|latest/g) == null &&
388 + !v.startsWith('a') &&
389 + !v.startsWith('b')
390 + )
391 +}
392 +
393 +function parseVersion(v) {
394 + v = v.includes('rc') ? v : v.split('.')
395 + if (v instanceof Array) {
396 + v = `${[v.shift(), v.shift(), v.shift()].join('.')}+${v.join('.')}`
397 + }
398 + return semver.coerce(v, { includePrerelease: true, loose: true })
399 +}
400 +
381 401 function getVersionFromSpec(spec0, versions0) {
402 + let latest
403 + Object.keys(versions0).forEach((v) => {
404 + if (validVersion(v)) {
405 + latest = latest && gt(latest, v) ? latest : v
406 + }
407 + })
408 + versions0.latest = latest
382 409 const spec = maybeRemoveVPrefix(spec0)
383 410
384 411 const altVersions = {}
@@ -475,7 +502,7 @@ function isRC(ver) {
475 502 }
476 503
477 504 function isKnownBranch(ver) {
478 return ['main', 'master', 'maint'].includes(ver)
505 + return ['main', 'master', 'maint', 'latest'].includes(ver)
479 506 }
480 507
481 508 function getRunnerOSVersion() {
added test/elixir/builds.txt
+524 −0

Click to load diff…

added test/gleam/releases.json
+46890 −0

Click to load diff…

added test/otp/releases.json
+31454 −0

Click to load diff…

added test/otp/ubuntu-18.04/builds.txt
+435 −0

Click to load diff…

added test/otp/ubuntu-20.04/builds.txt
+338 −0

Click to load diff…

added test/otp/ubuntu-22.04/builds.txt
+80 −0

Click to load diff…

added test/otp/ubuntu-24.04/builds.txt
+71 −0

Click to load diff…

added test/rebar3/releases.json
+5117 −0

Click to load diff…

modified test/setup-beam.test.js
+114 −4

Click to load diff…

Parents: 9ac0f7c