Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-04-06 19:47:28 +0300
committerGar <wraithgar@github.com>2022-04-07 00:29:40 +0300
commite57353c78e798afbd3eb4390a42da5d5076be45d (patch)
treeebe74caf642578e2f1d7bb68cafdb8c1898a194f /node_modules
parent38029edea846ffe81768d7073d4ec09a4b129c24 (diff)
deps: semver@7.3.6
Diffstat (limited to 'node_modules')
-rwxr-xr-xnode_modules/semver/bin/semver.js25
-rw-r--r--node_modules/semver/classes/comparator.js5
-rw-r--r--node_modules/semver/classes/index.js2
-rw-r--r--node_modules/semver/classes/range.js53
-rw-r--r--node_modules/semver/functions/cmp.js12
-rw-r--r--node_modules/semver/functions/coerce.js5
-rw-r--r--node_modules/semver/functions/parse.js2
-rw-r--r--node_modules/semver/internal/constants.js4
-rw-r--r--node_modules/semver/internal/identifiers.js2
-rw-r--r--node_modules/semver/internal/parse-options.js6
-rw-r--r--node_modules/semver/internal/re.js6
-rw-r--r--node_modules/semver/node_modules/lru-cache/LICENSE15
-rw-r--r--node_modules/semver/node_modules/lru-cache/index.js334
-rw-r--r--node_modules/semver/node_modules/lru-cache/package.json34
-rw-r--r--node_modules/semver/package.json59
-rw-r--r--node_modules/semver/ranges/min-version.js3
-rw-r--r--node_modules/semver/ranges/outside.js2
-rw-r--r--node_modules/semver/ranges/simplify.js27
-rw-r--r--node_modules/semver/ranges/subset.js84
19 files changed, 190 insertions, 490 deletions
diff --git a/node_modules/semver/bin/semver.js b/node_modules/semver/bin/semver.js
index 73fe29538..779b8b0cd 100755
--- a/node_modules/semver/bin/semver.js
+++ b/node_modules/semver/bin/semver.js
@@ -27,10 +27,12 @@ const semver = require('../')
let reverse = false
-const options = {}
+let options = {}
const main = () => {
- if (!argv.length) return help()
+ if (!argv.length) {
+ return help()
+ }
while (argv.length) {
let a = argv.shift()
const indexOfEqualSign = a.indexOf('=')
@@ -85,26 +87,31 @@ const main = () => {
}
}
- const options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
+ options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
versions = versions.map((v) => {
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
}).filter((v) => {
return semver.valid(v)
})
- if (!versions.length) return fail()
- if (inc && (versions.length !== 1 || range.length)) { return failInc() }
+ if (!versions.length) {
+ return fail()
+ }
+ if (inc && (versions.length !== 1 || range.length)) {
+ return failInc()
+ }
for (let i = 0, l = range.length; i < l; i++) {
versions = versions.filter((v) => {
return semver.satisfies(v, range[i], options)
})
- if (!versions.length) return fail()
+ if (!versions.length) {
+ return fail()
+ }
}
return success(versions)
}
-
const failInc = () => {
console.error('--inc can only be used on a single version with no range')
fail()
@@ -120,7 +127,9 @@ const success = () => {
return semver.clean(v, options)
}).map((v) => {
return inc ? semver.inc(v, inc, options, identifier) : v
- }).forEach((v, i, _) => { console.log(v) })
+ }).forEach((v, i, _) => {
+ console.log(v)
+ })
}
const help = () => console.log(
diff --git a/node_modules/semver/classes/comparator.js b/node_modules/semver/classes/comparator.js
index dbbef2d8f..62cd204d9 100644
--- a/node_modules/semver/classes/comparator.js
+++ b/node_modules/semver/classes/comparator.js
@@ -4,6 +4,7 @@ class Comparator {
static get ANY () {
return ANY
}
+
constructor (comp, options) {
options = parseOptions(options)
@@ -80,7 +81,7 @@ class Comparator {
if (!options || typeof options !== 'object') {
options = {
loose: !!options,
- includePrerelease: false
+ includePrerelease: false,
}
}
@@ -128,7 +129,7 @@ class Comparator {
module.exports = Comparator
const parseOptions = require('../internal/parse-options')
-const {re, t} = require('../internal/re')
+const { re, t } = require('../internal/re')
const cmp = require('../functions/cmp')
const debug = require('../internal/debug')
const SemVer = require('./semver')
diff --git a/node_modules/semver/classes/index.js b/node_modules/semver/classes/index.js
index 198b84d66..5e3f5c9b1 100644
--- a/node_modules/semver/classes/index.js
+++ b/node_modules/semver/classes/index.js
@@ -1,5 +1,5 @@
module.exports = {
SemVer: require('./semver.js'),
Range: require('./range.js'),
- Comparator: require('./comparator.js')
+ Comparator: require('./comparator.js'),
}
diff --git a/node_modules/semver/classes/range.js b/node_modules/semver/classes/range.js
index aa04f6bff..7dc24bc71 100644
--- a/node_modules/semver/classes/range.js
+++ b/node_modules/semver/classes/range.js
@@ -29,9 +29,9 @@ class Range {
// First, split based on boolean or ||
this.raw = range
this.set = range
- .split(/\s*\|\|\s*/)
+ .split('||')
// map the range to a 2d array of comparators
- .map(range => this.parseRange(range.trim()))
+ .map(r => this.parseRange(r.trim()))
// throw out any comparator lists that are empty
// this generally means that it was not a valid range, which is allowed
// in loose mode, but will still throw if the WHOLE range is invalid.
@@ -46,9 +46,9 @@ class Range {
// keep the first one, in case they're all null sets
const first = this.set[0]
this.set = this.set.filter(c => !isNullSet(c[0]))
- if (this.set.length === 0)
+ if (this.set.length === 0) {
this.set = [first]
- else if (this.set.length > 1) {
+ } else if (this.set.length > 1) {
// if we have any that are *, then the range is just *
for (const c of this.set) {
if (c.length === 1 && isAny(c[0])) {
@@ -84,8 +84,9 @@ class Range {
const memoOpts = Object.keys(this.options).join(',')
const memoKey = `parseRange:${memoOpts}:${range}`
const cached = cache.get(memoKey)
- if (cached)
+ if (cached) {
return cached
+ }
const loose = this.options.loose
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
@@ -94,7 +95,7 @@ class Range {
debug('hyphen replace', range)
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
- debug('comparator trim', range, re[t.COMPARATORTRIM])
+ debug('comparator trim', range)
// `~ 1.2.3` => `~1.2.3`
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
@@ -108,30 +109,37 @@ class Range {
// At this point, the range is completely trimmed and
// ready to be split into comparators.
- const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
- const rangeList = range
+ let rangeList = range
.split(' ')
.map(comp => parseComparator(comp, this.options))
.join(' ')
.split(/\s+/)
// >=0.0.0 is equivalent to *
.map(comp => replaceGTE0(comp, this.options))
+
+ if (loose) {
// in loose mode, throw out any that are not valid comparators
- .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
- .map(comp => new Comparator(comp, this.options))
+ rangeList = rangeList.filter(comp => {
+ debug('loose invalid filter', comp, this.options)
+ return !!comp.match(re[t.COMPARATORLOOSE])
+ })
+ }
+ debug('range list', rangeList)
// if any comparators are the null set, then replace with JUST null set
// if more than one comparator, remove any * comparators
// also, don't include the same comparator more than once
- const l = rangeList.length
const rangeMap = new Map()
- for (const comp of rangeList) {
- if (isNullSet(comp))
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options))
+ for (const comp of comparators) {
+ if (isNullSet(comp)) {
return [comp]
+ }
rangeMap.set(comp.value, comp)
}
- if (rangeMap.size > 1 && rangeMap.has(''))
+ if (rangeMap.size > 1 && rangeMap.has('')) {
rangeMap.delete('')
+ }
const result = [...rangeMap.values()]
cache.set(memoKey, result)
@@ -196,7 +204,7 @@ const {
t,
comparatorTrimReplace,
tildeTrimReplace,
- caretTrimReplace
+ caretTrimReplace,
} = require('../internal/re')
const isNullSet = c => c.value === '<0.0.0-0'
@@ -245,8 +253,8 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
const replaceTildes = (comp, options) =>
- comp.trim().split(/\s+/).map((comp) => {
- return replaceTilde(comp, options)
+ comp.trim().split(/\s+/).map((c) => {
+ return replaceTilde(c, options)
}).join(' ')
const replaceTilde = (comp, options) => {
@@ -284,8 +292,8 @@ const replaceTilde = (comp, options) => {
// ^1.2.3 --> >=1.2.3 <2.0.0-0
// ^1.2.0 --> >=1.2.0 <2.0.0-0
const replaceCarets = (comp, options) =>
- comp.trim().split(/\s+/).map((comp) => {
- return replaceCaret(comp, options)
+ comp.trim().split(/\s+/).map((c) => {
+ return replaceCaret(c, options)
}).join(' ')
const replaceCaret = (comp, options) => {
@@ -343,8 +351,8 @@ const replaceCaret = (comp, options) => {
const replaceXRanges = (comp, options) => {
debug('replaceXRanges', comp, options)
- return comp.split(/\s+/).map((comp) => {
- return replaceXRange(comp, options)
+ return comp.split(/\s+/).map((c) => {
+ return replaceXRange(c, options)
}).join(' ')
}
@@ -405,8 +413,9 @@ const replaceXRange = (comp, options) => {
}
}
- if (gtlt === '<')
+ if (gtlt === '<') {
pr = '-0'
+ }
ret = `${gtlt + M}.${m}.${p}${pr}`
} else if (xm) {
diff --git a/node_modules/semver/functions/cmp.js b/node_modules/semver/functions/cmp.js
index 3b89db779..401190947 100644
--- a/node_modules/semver/functions/cmp.js
+++ b/node_modules/semver/functions/cmp.js
@@ -8,17 +8,21 @@ const lte = require('./lte')
const cmp = (a, op, b, loose) => {
switch (op) {
case '===':
- if (typeof a === 'object')
+ if (typeof a === 'object') {
a = a.version
- if (typeof b === 'object')
+ }
+ if (typeof b === 'object') {
b = b.version
+ }
return a === b
case '!==':
- if (typeof a === 'object')
+ if (typeof a === 'object') {
a = a.version
- if (typeof b === 'object')
+ }
+ if (typeof b === 'object') {
b = b.version
+ }
return a !== b
case '':
diff --git a/node_modules/semver/functions/coerce.js b/node_modules/semver/functions/coerce.js
index 106ca71c9..2e01452fd 100644
--- a/node_modules/semver/functions/coerce.js
+++ b/node_modules/semver/functions/coerce.js
@@ -1,6 +1,6 @@
const SemVer = require('../classes/semver')
const parse = require('./parse')
-const {re, t} = require('../internal/re')
+const { re, t } = require('../internal/re')
const coerce = (version, options) => {
if (version instanceof SemVer) {
@@ -43,8 +43,9 @@ const coerce = (version, options) => {
re[t.COERCERTL].lastIndex = -1
}
- if (match === null)
+ if (match === null) {
return null
+ }
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
}
diff --git a/node_modules/semver/functions/parse.js b/node_modules/semver/functions/parse.js
index 11f20f037..a66663aa5 100644
--- a/node_modules/semver/functions/parse.js
+++ b/node_modules/semver/functions/parse.js
@@ -1,4 +1,4 @@
-const {MAX_LENGTH} = require('../internal/constants')
+const { MAX_LENGTH } = require('../internal/constants')
const { re, t } = require('../internal/re')
const SemVer = require('../classes/semver')
diff --git a/node_modules/semver/internal/constants.js b/node_modules/semver/internal/constants.js
index 49df215ad..4f0de59b5 100644
--- a/node_modules/semver/internal/constants.js
+++ b/node_modules/semver/internal/constants.js
@@ -4,7 +4,7 @@ const SEMVER_SPEC_VERSION = '2.0.0'
const MAX_LENGTH = 256
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
- /* istanbul ignore next */ 9007199254740991
+/* istanbul ignore next */ 9007199254740991
// Max safe segment length for coercion.
const MAX_SAFE_COMPONENT_LENGTH = 16
@@ -13,5 +13,5 @@ module.exports = {
SEMVER_SPEC_VERSION,
MAX_LENGTH,
MAX_SAFE_INTEGER,
- MAX_SAFE_COMPONENT_LENGTH
+ MAX_SAFE_COMPONENT_LENGTH,
}
diff --git a/node_modules/semver/internal/identifiers.js b/node_modules/semver/internal/identifiers.js
index ed1309421..e612d0a3d 100644
--- a/node_modules/semver/internal/identifiers.js
+++ b/node_modules/semver/internal/identifiers.js
@@ -19,5 +19,5 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
module.exports = {
compareIdentifiers,
- rcompareIdentifiers
+ rcompareIdentifiers,
}
diff --git a/node_modules/semver/internal/parse-options.js b/node_modules/semver/internal/parse-options.js
index 42d2ebd6f..bbd9ec77a 100644
--- a/node_modules/semver/internal/parse-options.js
+++ b/node_modules/semver/internal/parse-options.js
@@ -4,8 +4,8 @@ const opts = ['includePrerelease', 'loose', 'rtl']
const parseOptions = options =>
!options ? {}
: typeof options !== 'object' ? { loose: true }
- : opts.filter(k => options[k]).reduce((options, k) => {
- options[k] = true
- return options
+ : opts.filter(k => options[k]).reduce((o, k) => {
+ o[k] = true
+ return o
}, {})
module.exports = parseOptions
diff --git a/node_modules/semver/internal/re.js b/node_modules/semver/internal/re.js
index 54d4176de..ed88398a9 100644
--- a/node_modules/semver/internal/re.js
+++ b/node_modules/semver/internal/re.js
@@ -10,7 +10,7 @@ let R = 0
const createToken = (name, value, isGlobal) => {
const index = R++
- debug(index, value)
+ debug(name, index, value)
t[name] = index
src[index] = value
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
@@ -178,5 +178,5 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
// Star ranges basically just allow anything at all.
createToken('STAR', '(<|>)?=?\\s*\\*')
// >=0.0.0 is like a star
-createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
-createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
+createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
+createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
diff --git a/node_modules/semver/node_modules/lru-cache/LICENSE b/node_modules/semver/node_modules/lru-cache/LICENSE
deleted file mode 100644
index 19129e315..000000000
--- a/node_modules/semver/node_modules/lru-cache/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and Contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/semver/node_modules/lru-cache/index.js b/node_modules/semver/node_modules/lru-cache/index.js
deleted file mode 100644
index 573b6b85b..000000000
--- a/node_modules/semver/node_modules/lru-cache/index.js
+++ /dev/null
@@ -1,334 +0,0 @@
-'use strict'
-
-// A linked list to keep track of recently-used-ness
-const Yallist = require('yallist')
-
-const MAX = Symbol('max')
-const LENGTH = Symbol('length')
-const LENGTH_CALCULATOR = Symbol('lengthCalculator')
-const ALLOW_STALE = Symbol('allowStale')
-const MAX_AGE = Symbol('maxAge')
-const DISPOSE = Symbol('dispose')
-const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
-const LRU_LIST = Symbol('lruList')
-const CACHE = Symbol('cache')
-const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
-
-const naiveLength = () => 1
-
-// lruList is a yallist where the head is the youngest
-// item, and the tail is the oldest. the list contains the Hit
-// objects as the entries.
-// Each Hit object has a reference to its Yallist.Node. This
-// never changes.
-//
-// cache is a Map (or PseudoMap) that matches the keys to
-// the Yallist.Node object.
-class LRUCache {
- constructor (options) {
- if (typeof options === 'number')
- options = { max: options }
-
- if (!options)
- options = {}
-
- if (options.max && (typeof options.max !== 'number' || options.max < 0))
- throw new TypeError('max must be a non-negative number')
- // Kind of weird to have a default max of Infinity, but oh well.
- const max = this[MAX] = options.max || Infinity
-
- const lc = options.length || naiveLength
- this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
- this[ALLOW_STALE] = options.stale || false
- if (options.maxAge && typeof options.maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
- this[MAX_AGE] = options.maxAge || 0
- this[DISPOSE] = options.dispose
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
- this.reset()
- }
-
- // resize the cache when the max changes.
- set max (mL) {
- if (typeof mL !== 'number' || mL < 0)
- throw new TypeError('max must be a non-negative number')
-
- this[MAX] = mL || Infinity
- trim(this)
- }
- get max () {
- return this[MAX]
- }
-
- set allowStale (allowStale) {
- this[ALLOW_STALE] = !!allowStale
- }
- get allowStale () {
- return this[ALLOW_STALE]
- }
-
- set maxAge (mA) {
- if (typeof mA !== 'number')
- throw new TypeError('maxAge must be a non-negative number')
-
- this[MAX_AGE] = mA
- trim(this)
- }
- get maxAge () {
- return this[MAX_AGE]
- }
-
- // resize the cache when the lengthCalculator changes.
- set lengthCalculator (lC) {
- if (typeof lC !== 'function')
- lC = naiveLength
-
- if (lC !== this[LENGTH_CALCULATOR]) {
- this[LENGTH_CALCULATOR] = lC
- this[LENGTH] = 0
- this[LRU_LIST].forEach(hit => {
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
- this[LENGTH] += hit.length
- })
- }
- trim(this)
- }
- get lengthCalculator () { return this[LENGTH_CALCULATOR] }
-
- get length () { return this[LENGTH] }
- get itemCount () { return this[LRU_LIST].length }
-
- rforEach (fn, thisp) {
- thisp = thisp || this
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
- const prev = walker.prev
- forEachStep(this, fn, walker, thisp)
- walker = prev
- }
- }
-
- forEach (fn, thisp) {
- thisp = thisp || this
- for (let walker = this[LRU_LIST].head; walker !== null;) {
- const next = walker.next
- forEachStep(this, fn, walker, thisp)
- walker = next
- }
- }
-
- keys () {
- return this[LRU_LIST].toArray().map(k => k.key)
- }
-
- values () {
- return this[LRU_LIST].toArray().map(k => k.value)
- }
-
- reset () {
- if (this[DISPOSE] &&
- this[LRU_LIST] &&
- this[LRU_LIST].length) {
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
- }
-
- this[CACHE] = new Map() // hash of items by key
- this[LRU_LIST] = new Yallist() // list of items in order of use recency
- this[LENGTH] = 0 // length of items in the list
- }
-
- dump () {
- return this[LRU_LIST].map(hit =>
- isStale(this, hit) ? false : {
- k: hit.key,
- v: hit.value,
- e: hit.now + (hit.maxAge || 0)
- }).toArray().filter(h => h)
- }
-
- dumpLru () {
- return this[LRU_LIST]
- }
-
- set (key, value, maxAge) {
- maxAge = maxAge || this[MAX_AGE]
-
- if (maxAge && typeof maxAge !== 'number')
- throw new TypeError('maxAge must be a number')
-
- const now = maxAge ? Date.now() : 0
- const len = this[LENGTH_CALCULATOR](value, key)
-
- if (this[CACHE].has(key)) {
- if (len > this[MAX]) {
- del(this, this[CACHE].get(key))
- return false
- }
-
- const node = this[CACHE].get(key)
- const item = node.value
-
- // dispose of the old one before overwriting
- // split out into 2 ifs for better coverage tracking
- if (this[DISPOSE]) {
- if (!this[NO_DISPOSE_ON_SET])
- this[DISPOSE](key, item.value)
- }
-
- item.now = now
- item.maxAge = maxAge
- item.value = value
- this[LENGTH] += len - item.length
- item.length = len
- this.get(key)
- trim(this)
- return true
- }
-
- const hit = new Entry(key, value, len, now, maxAge)
-
- // oversized objects fall out of cache automatically.
- if (hit.length > this[MAX]) {
- if (this[DISPOSE])
- this[DISPOSE](key, value)
-
- return false
- }
-
- this[LENGTH] += hit.length
- this[LRU_LIST].unshift(hit)
- this[CACHE].set(key, this[LRU_LIST].head)
- trim(this)
- return true
- }
-
- has (key) {
- if (!this[CACHE].has(key)) return false
- const hit = this[CACHE].get(key).value
- return !isStale(this, hit)
- }
-
- get (key) {
- return get(this, key, true)
- }
-
- peek (key) {
- return get(this, key, false)
- }
-
- pop () {
- const node = this[LRU_LIST].tail
- if (!node)
- return null
-
- del(this, node)
- return node.value
- }
-
- del (key) {
- del(this, this[CACHE].get(key))
- }
-
- load (arr) {
- // reset the cache
- this.reset()
-
- const now = Date.now()
- // A previous serialized cache has the most recent items first
- for (let l = arr.length - 1; l >= 0; l--) {
- const hit = arr[l]
- const expiresAt = hit.e || 0
- if (expiresAt === 0)
- // the item was created without expiration in a non aged cache
- this.set(hit.k, hit.v)
- else {
- const maxAge = expiresAt - now
- // dont add already expired items
- if (maxAge > 0) {
- this.set(hit.k, hit.v, maxAge)
- }
- }
- }
- }
-
- prune () {
- this[CACHE].forEach((value, key) => get(this, key, false))
- }
-}
-
-const get = (self, key, doUse) => {
- const node = self[CACHE].get(key)
- if (node) {
- const hit = node.value
- if (isStale(self, hit)) {
- del(self, node)
- if (!self[ALLOW_STALE])
- return undefined
- } else {
- if (doUse) {
- if (self[UPDATE_AGE_ON_GET])
- node.value.now = Date.now()
- self[LRU_LIST].unshiftNode(node)
- }
- }
- return hit.value
- }
-}
-
-const isStale = (self, hit) => {
- if (!hit || (!hit.maxAge && !self[MAX_AGE]))
- return false
-
- const diff = Date.now() - hit.now
- return hit.maxAge ? diff > hit.maxAge
- : self[MAX_AGE] && (diff > self[MAX_AGE])
-}
-
-const trim = self => {
- if (self[LENGTH] > self[MAX]) {
- for (let walker = self[LRU_LIST].tail;
- self[LENGTH] > self[MAX] && walker !== null;) {
- // We know that we're about to delete this one, and also
- // what the next least recently used key will be, so just
- // go ahead and set it now.
- const prev = walker.prev
- del(self, walker)
- walker = prev
- }
- }
-}
-
-const del = (self, node) => {
- if (node) {
- const hit = node.value
- if (self[DISPOSE])
- self[DISPOSE](hit.key, hit.value)
-
- self[LENGTH] -= hit.length
- self[CACHE].delete(hit.key)
- self[LRU_LIST].removeNode(node)
- }
-}
-
-class Entry {
- constructor (key, value, length, now, maxAge) {
- this.key = key
- this.value = value
- this.length = length
- this.now = now
- this.maxAge = maxAge || 0
- }
-}
-
-const forEachStep = (self, fn, node, thisp) => {
- let hit = node.value
- if (isStale(self, hit)) {
- del(self, node)
- if (!self[ALLOW_STALE])
- hit = undefined
- }
- if (hit)
- fn.call(thisp, hit.value, hit.key, self)
-}
-
-module.exports = LRUCache
diff --git a/node_modules/semver/node_modules/lru-cache/package.json b/node_modules/semver/node_modules/lru-cache/package.json
deleted file mode 100644
index 43b7502c3..000000000
--- a/node_modules/semver/node_modules/lru-cache/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "lru-cache",
- "description": "A cache object that deletes the least-recently-used items.",
- "version": "6.0.0",
- "author": "Isaac Z. Schlueter <i@izs.me>",
- "keywords": [
- "mru",
- "lru",
- "cache"
- ],
- "scripts": {
- "test": "tap",
- "snap": "tap",
- "preversion": "npm test",
- "postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags"
- },
- "main": "index.js",
- "repository": "git://github.com/isaacs/node-lru-cache.git",
- "devDependencies": {
- "benchmark": "^2.1.4",
- "tap": "^14.10.7"
- },
- "license": "ISC",
- "dependencies": {
- "yallist": "^4.0.0"
- },
- "files": [
- "index.js"
- ],
- "engines": {
- "node": ">=10"
- }
-}
diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json
index 4e1154195..b04e0d328 100644
--- a/node_modules/semver/package.json
+++ b/node_modules/semver/package.json
@@ -1,6 +1,6 @@
{
"name": "semver",
- "version": "7.3.5",
+ "version": "7.3.6",
"description": "The semantic version parser used by npm.",
"main": "index.js",
"scripts": {
@@ -8,34 +8,67 @@
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
- "postpublish": "git push origin --follow-tags"
+ "postpublish": "git push origin --follow-tags",
+ "lint": "eslint \"**/*.js\"",
+ "postlint": "template-oss-check",
+ "lintfix": "npm run lint -- --fix",
+ "prepublishOnly": "git push origin --follow-tags",
+ "posttest": "npm run lint",
+ "template-oss-apply": "template-oss-apply --force"
},
"devDependencies": {
- "tap": "^14.10.7"
+ "@npmcli/eslint-config": "^3.0.1",
+ "@npmcli/template-oss": "3.2.2",
+ "tap": "^16.0.0"
},
"license": "ISC",
- "repository": "https://github.com/npm/node-semver",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/npm/node-semver.git"
+ },
"bin": {
"semver": "bin/semver.js"
},
"files": [
- "bin/**/*.js",
- "range.bnf",
- "classes/**/*.js",
- "functions/**/*.js",
- "internal/**/*.js",
- "ranges/**/*.js",
+ "bin/",
+ "classes/",
+ "functions/",
+ "internal/",
+ "ranges/",
"index.js",
- "preload.js"
+ "preload.js",
+ "range.bnf"
],
"tap": {
"check-coverage": true,
"coverage-map": "map.js"
},
"engines": {
- "node": ">=10"
+ "node": "^10.0.0 || ^12.0.0 || ^14.0.0 || >=16.0.0"
},
"dependencies": {
- "lru-cache": "^6.0.0"
+ "lru-cache": "^7.4.0"
+ },
+ "author": "GitHub Inc.",
+ "templateOSS": {
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
+ "version": "3.2.2",
+ "ciVersions": [
+ "10.0.0",
+ "10.x",
+ "12.x",
+ "14.x",
+ "16.x"
+ ],
+ "distPaths": [
+ "bin/",
+ "classes/",
+ "functions/",
+ "internal/",
+ "ranges/",
+ "index.js",
+ "preload.js",
+ "range.bnf"
+ ]
}
}
diff --git a/node_modules/semver/ranges/min-version.js b/node_modules/semver/ranges/min-version.js
index 2fac41291..350e1f783 100644
--- a/node_modules/semver/ranges/min-version.js
+++ b/node_modules/semver/ranges/min-version.js
@@ -47,8 +47,9 @@ const minVersion = (range, loose) => {
throw new Error(`Unexpected operation: ${comparator.operator}`)
}
})
- if (setMin && (!minver || gt(minver, setMin)))
+ if (setMin && (!minver || gt(minver, setMin))) {
minver = setMin
+ }
}
if (minver && range.test(minver)) {
diff --git a/node_modules/semver/ranges/outside.js b/node_modules/semver/ranges/outside.js
index 2a4b0a13f..ae99b10a5 100644
--- a/node_modules/semver/ranges/outside.js
+++ b/node_modules/semver/ranges/outside.js
@@ -1,6 +1,6 @@
const SemVer = require('../classes/semver')
const Comparator = require('../classes/comparator')
-const {ANY} = Comparator
+const { ANY } = Comparator
const Range = require('../classes/range')
const satisfies = require('../functions/satisfies')
const gt = require('../functions/gt')
diff --git a/node_modules/semver/ranges/simplify.js b/node_modules/semver/ranges/simplify.js
index b792f9729..618d5b627 100644
--- a/node_modules/semver/ranges/simplify.js
+++ b/node_modules/semver/ranges/simplify.js
@@ -5,38 +5,41 @@ const satisfies = require('../functions/satisfies.js')
const compare = require('../functions/compare.js')
module.exports = (versions, range, options) => {
const set = []
- let min = null
+ let first = null
let prev = null
const v = versions.sort((a, b) => compare(a, b, options))
for (const version of v) {
const included = satisfies(version, range, options)
if (included) {
prev = version
- if (!min)
- min = version
+ if (!first) {
+ first = version
+ }
} else {
if (prev) {
- set.push([min, prev])
+ set.push([first, prev])
}
prev = null
- min = null
+ first = null
}
}
- if (min)
- set.push([min, null])
+ if (first) {
+ set.push([first, null])
+ }
const ranges = []
for (const [min, max] of set) {
- if (min === max)
+ if (min === max) {
ranges.push(min)
- else if (!max && min === v[0])
+ } else if (!max && min === v[0]) {
ranges.push('*')
- else if (!max)
+ } else if (!max) {
ranges.push(`>=${min}`)
- else if (min === v[0])
+ } else if (min === v[0]) {
ranges.push(`<=${max}`)
- else
+ } else {
ranges.push(`${min} - ${max}`)
+ }
}
const simplified = ranges.join(' || ')
const original = typeof range.raw === 'string' ? range.raw : String(range)
diff --git a/node_modules/semver/ranges/subset.js b/node_modules/semver/ranges/subset.js
index 532fd1364..e0dea43c2 100644
--- a/node_modules/semver/ranges/subset.js
+++ b/node_modules/semver/ranges/subset.js
@@ -41,8 +41,9 @@ const compare = require('../functions/compare.js')
// - Else return true
const subset = (sub, dom, options = {}) => {
- if (sub === dom)
+ if (sub === dom) {
return true
+ }
sub = new Range(sub, options)
dom = new Range(dom, options)
@@ -52,73 +53,84 @@ const subset = (sub, dom, options = {}) => {
for (const simpleDom of dom.set) {
const isSub = simpleSubset(simpleSub, simpleDom, options)
sawNonNull = sawNonNull || isSub !== null
- if (isSub)
+ if (isSub) {
continue OUTER
+ }
}
// the null set is a subset of everything, but null simple ranges in
// a complex range should be ignored. so if we saw a non-null range,
// then we know this isn't a subset, but if EVERY simple range was null,
// then it is a subset.
- if (sawNonNull)
+ if (sawNonNull) {
return false
+ }
}
return true
}
const simpleSubset = (sub, dom, options) => {
- if (sub === dom)
+ if (sub === dom) {
return true
+ }
if (sub.length === 1 && sub[0].semver === ANY) {
- if (dom.length === 1 && dom[0].semver === ANY)
+ if (dom.length === 1 && dom[0].semver === ANY) {
return true
- else if (options.includePrerelease)
- sub = [ new Comparator('>=0.0.0-0') ]
- else
- sub = [ new Comparator('>=0.0.0') ]
+ } else if (options.includePrerelease) {
+ sub = [new Comparator('>=0.0.0-0')]
+ } else {
+ sub = [new Comparator('>=0.0.0')]
+ }
}
if (dom.length === 1 && dom[0].semver === ANY) {
- if (options.includePrerelease)
+ if (options.includePrerelease) {
return true
- else
- dom = [ new Comparator('>=0.0.0') ]
+ } else {
+ dom = [new Comparator('>=0.0.0')]
+ }
}
const eqSet = new Set()
let gt, lt
for (const c of sub) {
- if (c.operator === '>' || c.operator === '>=')
+ if (c.operator === '>' || c.operator === '>=') {
gt = higherGT(gt, c, options)
- else if (c.operator === '<' || c.operator === '<=')
+ } else if (c.operator === '<' || c.operator === '<=') {
lt = lowerLT(lt, c, options)
- else
+ } else {
eqSet.add(c.semver)
+ }
}
- if (eqSet.size > 1)
+ if (eqSet.size > 1) {
return null
+ }
let gtltComp
if (gt && lt) {
gtltComp = compare(gt.semver, lt.semver, options)
- if (gtltComp > 0)
+ if (gtltComp > 0) {
return null
- else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
return null
+ }
}
// will iterate one or zero times
for (const eq of eqSet) {
- if (gt && !satisfies(eq, String(gt), options))
+ if (gt && !satisfies(eq, String(gt), options)) {
return null
+ }
- if (lt && !satisfies(eq, String(lt), options))
+ if (lt && !satisfies(eq, String(lt), options)) {
return null
+ }
for (const c of dom) {
- if (!satisfies(eq, String(c), options))
+ if (!satisfies(eq, String(c), options)) {
return false
+ }
}
return true
@@ -154,10 +166,12 @@ const simpleSubset = (sub, dom, options) => {
}
if (c.operator === '>' || c.operator === '>=') {
higher = higherGT(gt, c, options)
- if (higher === c && higher !== gt)
+ if (higher === c && higher !== gt) {
return false
- } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
+ }
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
return false
+ }
}
if (lt) {
if (needDomLTPre) {
@@ -170,37 +184,44 @@ const simpleSubset = (sub, dom, options) => {
}
if (c.operator === '<' || c.operator === '<=') {
lower = lowerLT(lt, c, options)
- if (lower === c && lower !== lt)
+ if (lower === c && lower !== lt) {
return false
- } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
+ }
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
return false
+ }
}
- if (!c.operator && (lt || gt) && gtltComp !== 0)
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
return false
+ }
}
// if there was a < or >, and nothing in the dom, then must be false
// UNLESS it was limited by another range in the other direction.
// Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
- if (gt && hasDomLT && !lt && gtltComp !== 0)
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
return false
+ }
- if (lt && hasDomGT && !gt && gtltComp !== 0)
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
return false
+ }
// we needed a prerelease range in a specific tuple, but didn't get one
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
// because it includes prereleases in the 1.2.3 tuple
- if (needDomGTPre || needDomLTPre)
+ if (needDomGTPre || needDomLTPre) {
return false
+ }
return true
}
// >=1.2.3 is lower than >1.2.3
const higherGT = (a, b, options) => {
- if (!a)
+ if (!a) {
return b
+ }
const comp = compare(a.semver, b.semver, options)
return comp > 0 ? a
: comp < 0 ? b
@@ -210,8 +231,9 @@ const higherGT = (a, b, options) => {
// <=1.2.3 is higher than <1.2.3
const lowerLT = (a, b, options) => {
- if (!a)
+ if (!a) {
return b
+ }
const comp = compare(a.semver, b.semver, options)
return comp < 0 ? a
: comp > 0 ? b