Skip to content

Commit 7eaf32f

Browse files
committed
deps: semver@7.3.6
1 parent acb329d commit 7eaf32f

21 files changed

+201
-517
lines changed

node_modules/semver/bin/semver.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ const semver = require('../')
2727

2828
let reverse = false
2929

30-
const options = {}
30+
let options = {}
3131

3232
const main = () => {
33-
if (!argv.length) return help()
33+
if (!argv.length) {
34+
return help()
35+
}
3436
while (argv.length) {
3537
let a = argv.shift()
3638
const indexOfEqualSign = a.indexOf('=')
@@ -85,26 +87,31 @@ const main = () => {
8587
}
8688
}
8789

88-
const options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
90+
options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
8991

9092
versions = versions.map((v) => {
9193
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
9294
}).filter((v) => {
9395
return semver.valid(v)
9496
})
95-
if (!versions.length) return fail()
96-
if (inc && (versions.length !== 1 || range.length)) { return failInc() }
97+
if (!versions.length) {
98+
return fail()
99+
}
100+
if (inc && (versions.length !== 1 || range.length)) {
101+
return failInc()
102+
}
97103

98104
for (let i = 0, l = range.length; i < l; i++) {
99105
versions = versions.filter((v) => {
100106
return semver.satisfies(v, range[i], options)
101107
})
102-
if (!versions.length) return fail()
108+
if (!versions.length) {
109+
return fail()
110+
}
103111
}
104112
return success(versions)
105113
}
106114

107-
108115
const failInc = () => {
109116
console.error('--inc can only be used on a single version with no range')
110117
fail()
@@ -120,7 +127,9 @@ const success = () => {
120127
return semver.clean(v, options)
121128
}).map((v) => {
122129
return inc ? semver.inc(v, inc, options, identifier) : v
123-
}).forEach((v, i, _) => { console.log(v) })
130+
}).forEach((v, i, _) => {
131+
console.log(v)
132+
})
124133
}
125134

126135
const help = () => console.log(

node_modules/semver/classes/comparator.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class Comparator {
44
static get ANY () {
55
return ANY
66
}
7+
78
constructor (comp, options) {
89
options = parseOptions(options)
910

@@ -80,7 +81,7 @@ class Comparator {
8081
if (!options || typeof options !== 'object') {
8182
options = {
8283
loose: !!options,
83-
includePrerelease: false
84+
includePrerelease: false,
8485
}
8586
}
8687

@@ -128,7 +129,7 @@ class Comparator {
128129
module.exports = Comparator
129130

130131
const parseOptions = require('../internal/parse-options')
131-
const {re, t} = require('../internal/re')
132+
const { re, t } = require('../internal/re')
132133
const cmp = require('../functions/cmp')
133134
const debug = require('../internal/debug')
134135
const SemVer = require('./semver')

node_modules/semver/classes/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
SemVer: require('./semver.js'),
33
Range: require('./range.js'),
4-
Comparator: require('./comparator.js')
4+
Comparator: require('./comparator.js'),
55
}

node_modules/semver/classes/range.js

+31-22
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class Range {
2929
// First, split based on boolean or ||
3030
this.raw = range
3131
this.set = range
32-
.split(/\s*\|\|\s*/)
32+
.split('||')
3333
// map the range to a 2d array of comparators
34-
.map(range => this.parseRange(range.trim()))
34+
.map(r => this.parseRange(r.trim()))
3535
// throw out any comparator lists that are empty
3636
// this generally means that it was not a valid range, which is allowed
3737
// in loose mode, but will still throw if the WHOLE range is invalid.
@@ -46,9 +46,9 @@ class Range {
4646
// keep the first one, in case they're all null sets
4747
const first = this.set[0]
4848
this.set = this.set.filter(c => !isNullSet(c[0]))
49-
if (this.set.length === 0)
49+
if (this.set.length === 0) {
5050
this.set = [first]
51-
else if (this.set.length > 1) {
51+
} else if (this.set.length > 1) {
5252
// if we have any that are *, then the range is just *
5353
for (const c of this.set) {
5454
if (c.length === 1 && isAny(c[0])) {
@@ -84,8 +84,9 @@ class Range {
8484
const memoOpts = Object.keys(this.options).join(',')
8585
const memoKey = `parseRange:${memoOpts}:${range}`
8686
const cached = cache.get(memoKey)
87-
if (cached)
87+
if (cached) {
8888
return cached
89+
}
8990

9091
const loose = this.options.loose
9192
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
@@ -94,7 +95,7 @@ class Range {
9495
debug('hyphen replace', range)
9596
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
9697
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
97-
debug('comparator trim', range, re[t.COMPARATORTRIM])
98+
debug('comparator trim', range)
9899

99100
// `~ 1.2.3` => `~1.2.3`
100101
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
@@ -108,30 +109,37 @@ class Range {
108109
// At this point, the range is completely trimmed and
109110
// ready to be split into comparators.
110111

111-
const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
112-
const rangeList = range
112+
let rangeList = range
113113
.split(' ')
114114
.map(comp => parseComparator(comp, this.options))
115115
.join(' ')
116116
.split(/\s+/)
117117
// >=0.0.0 is equivalent to *
118118
.map(comp => replaceGTE0(comp, this.options))
119+
120+
if (loose) {
119121
// in loose mode, throw out any that are not valid comparators
120-
.filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
121-
.map(comp => new Comparator(comp, this.options))
122+
rangeList = rangeList.filter(comp => {
123+
debug('loose invalid filter', comp, this.options)
124+
return !!comp.match(re[t.COMPARATORLOOSE])
125+
})
126+
}
127+
debug('range list', rangeList)
122128

123129
// if any comparators are the null set, then replace with JUST null set
124130
// if more than one comparator, remove any * comparators
125131
// also, don't include the same comparator more than once
126-
const l = rangeList.length
127132
const rangeMap = new Map()
128-
for (const comp of rangeList) {
129-
if (isNullSet(comp))
133+
const comparators = rangeList.map(comp => new Comparator(comp, this.options))
134+
for (const comp of comparators) {
135+
if (isNullSet(comp)) {
130136
return [comp]
137+
}
131138
rangeMap.set(comp.value, comp)
132139
}
133-
if (rangeMap.size > 1 && rangeMap.has(''))
140+
if (rangeMap.size > 1 && rangeMap.has('')) {
134141
rangeMap.delete('')
142+
}
135143

136144
const result = [...rangeMap.values()]
137145
cache.set(memoKey, result)
@@ -196,7 +204,7 @@ const {
196204
t,
197205
comparatorTrimReplace,
198206
tildeTrimReplace,
199-
caretTrimReplace
207+
caretTrimReplace,
200208
} = require('../internal/re')
201209

202210
const isNullSet = c => c.value === '<0.0.0-0'
@@ -245,8 +253,8 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
245253
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
246254
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
247255
const replaceTildes = (comp, options) =>
248-
comp.trim().split(/\s+/).map((comp) => {
249-
return replaceTilde(comp, options)
256+
comp.trim().split(/\s+/).map((c) => {
257+
return replaceTilde(c, options)
250258
}).join(' ')
251259

252260
const replaceTilde = (comp, options) => {
@@ -284,8 +292,8 @@ const replaceTilde = (comp, options) => {
284292
// ^1.2.3 --> >=1.2.3 <2.0.0-0
285293
// ^1.2.0 --> >=1.2.0 <2.0.0-0
286294
const replaceCarets = (comp, options) =>
287-
comp.trim().split(/\s+/).map((comp) => {
288-
return replaceCaret(comp, options)
295+
comp.trim().split(/\s+/).map((c) => {
296+
return replaceCaret(c, options)
289297
}).join(' ')
290298

291299
const replaceCaret = (comp, options) => {
@@ -343,8 +351,8 @@ const replaceCaret = (comp, options) => {
343351

344352
const replaceXRanges = (comp, options) => {
345353
debug('replaceXRanges', comp, options)
346-
return comp.split(/\s+/).map((comp) => {
347-
return replaceXRange(comp, options)
354+
return comp.split(/\s+/).map((c) => {
355+
return replaceXRange(c, options)
348356
}).join(' ')
349357
}
350358

@@ -405,8 +413,9 @@ const replaceXRange = (comp, options) => {
405413
}
406414
}
407415

408-
if (gtlt === '<')
416+
if (gtlt === '<') {
409417
pr = '-0'
418+
}
410419

411420
ret = `${gtlt + M}.${m}.${p}${pr}`
412421
} else if (xm) {

node_modules/semver/functions/cmp.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@ const lte = require('./lte')
88
const cmp = (a, op, b, loose) => {
99
switch (op) {
1010
case '===':
11-
if (typeof a === 'object')
11+
if (typeof a === 'object') {
1212
a = a.version
13-
if (typeof b === 'object')
13+
}
14+
if (typeof b === 'object') {
1415
b = b.version
16+
}
1517
return a === b
1618

1719
case '!==':
18-
if (typeof a === 'object')
20+
if (typeof a === 'object') {
1921
a = a.version
20-
if (typeof b === 'object')
22+
}
23+
if (typeof b === 'object') {
2124
b = b.version
25+
}
2226
return a !== b
2327

2428
case '':

node_modules/semver/functions/coerce.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const SemVer = require('../classes/semver')
22
const parse = require('./parse')
3-
const {re, t} = require('../internal/re')
3+
const { re, t } = require('../internal/re')
44

55
const coerce = (version, options) => {
66
if (version instanceof SemVer) {
@@ -43,8 +43,9 @@ const coerce = (version, options) => {
4343
re[t.COERCERTL].lastIndex = -1
4444
}
4545

46-
if (match === null)
46+
if (match === null) {
4747
return null
48+
}
4849

4950
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
5051
}

node_modules/semver/functions/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {MAX_LENGTH} = require('../internal/constants')
1+
const { MAX_LENGTH } = require('../internal/constants')
22
const { re, t } = require('../internal/re')
33
const SemVer = require('../classes/semver')
44

node_modules/semver/internal/constants.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const SEMVER_SPEC_VERSION = '2.0.0'
44

55
const MAX_LENGTH = 256
66
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
7-
/* istanbul ignore next */ 9007199254740991
7+
/* istanbul ignore next */ 9007199254740991
88

99
// Max safe segment length for coercion.
1010
const MAX_SAFE_COMPONENT_LENGTH = 16
@@ -13,5 +13,5 @@ module.exports = {
1313
SEMVER_SPEC_VERSION,
1414
MAX_LENGTH,
1515
MAX_SAFE_INTEGER,
16-
MAX_SAFE_COMPONENT_LENGTH
16+
MAX_SAFE_COMPONENT_LENGTH,
1717
}

node_modules/semver/internal/identifiers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
1919

2020
module.exports = {
2121
compareIdentifiers,
22-
rcompareIdentifiers
22+
rcompareIdentifiers,
2323
}

node_modules/semver/internal/parse-options.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const opts = ['includePrerelease', 'loose', 'rtl']
44
const parseOptions = options =>
55
!options ? {}
66
: typeof options !== 'object' ? { loose: true }
7-
: opts.filter(k => options[k]).reduce((options, k) => {
8-
options[k] = true
9-
return options
7+
: opts.filter(k => options[k]).reduce((o, k) => {
8+
o[k] = true
9+
return o
1010
}, {})
1111
module.exports = parseOptions

node_modules/semver/internal/re.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let R = 0
1010

1111
const createToken = (name, value, isGlobal) => {
1212
const index = R++
13-
debug(index, value)
13+
debug(name, index, value)
1414
t[name] = index
1515
src[index] = value
1616
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
@@ -178,5 +178,5 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
178178
// Star ranges basically just allow anything at all.
179179
createToken('STAR', '(<|>)?=?\\s*\\*')
180180
// >=0.0.0 is like a star
181-
createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
182-
createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
181+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
182+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')

node_modules/semver/node_modules/lru-cache/LICENSE

-15
This file was deleted.

0 commit comments

Comments
 (0)