Skip to content

Commit 8d161a4

Browse files
lukekarryswraithgar
authored andcommitted
deps: semver@7.6.1
1 parent 268303c commit 8d161a4

File tree

12 files changed

+67
-434
lines changed

12 files changed

+67
-434
lines changed

DEPENDENCIES.md

-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ graph LR;
417417
libnpmversion-->require-inject;
418418
libnpmversion-->semver;
419419
libnpmversion-->tap;
420-
lru-cache-->yallist;
421420
make-fetch-happen-->cacache;
422421
make-fetch-happen-->http-cache-semantics;
423422
make-fetch-happen-->is-lambda;
@@ -729,7 +728,6 @@ graph LR;
729728
read-->mute-stream;
730729
read-package-json-fast-->json-parse-even-better-errors;
731730
read-package-json-fast-->npm-normalize-package-bin;
732-
semver-->lru-cache;
733731
shebang-command-->shebang-regex;
734732
sigstore-->sigstore-bundle["@sigstore/bundle"];
735733
sigstore-->sigstore-core["@sigstore/core"];

node_modules/.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@
178178
!/retry
179179
!/safer-buffer
180180
!/semver
181-
!/semver/node_modules/
182-
/semver/node_modules/*
183-
!/semver/node_modules/lru-cache
184181
!/shebang-command
185182
!/shebang-regex
186183
!/signal-exit

node_modules/semver/bin/semver.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ const main = () => {
119119
return fail()
120120
}
121121
}
122-
return success(versions)
122+
versions
123+
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
124+
.map(v => semver.clean(v, options))
125+
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
126+
.forEach(v => console.log(v))
123127
}
124128

125129
const failInc = () => {
@@ -129,19 +133,6 @@ const failInc = () => {
129133

130134
const fail = () => process.exit(1)
131135

132-
const success = () => {
133-
const compare = reverse ? 'rcompare' : 'compare'
134-
versions.sort((a, b) => {
135-
return semver[compare](a, b, options)
136-
}).map((v) => {
137-
return semver.clean(v, options)
138-
}).map((v) => {
139-
return inc ? semver.inc(v, inc, options, identifier, identifierBase) : v
140-
}).forEach((v, i, _) => {
141-
console.log(v)
142-
})
143-
}
144-
145136
const help = () => console.log(
146137
`SemVer ${version}
147138

node_modules/semver/classes/range.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ class Range {
198198

199199
module.exports = Range
200200

201-
const LRU = require('lru-cache')
202-
const cache = new LRU({ max: 1000 })
201+
const LRU = require('../internal/lrucache')
202+
const cache = new LRU()
203203

204204
const parseOptions = require('../internal/parse-options')
205205
const Comparator = require('./comparator')
@@ -470,9 +470,10 @@ const replaceGTE0 = (comp, options) => {
470470
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
471471
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
472472
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
473+
// TODO build?
473474
const hyphenReplace = incPr => ($0,
474475
from, fM, fm, fp, fpr, fb,
475-
to, tM, tm, tp, tpr, tb) => {
476+
to, tM, tm, tp, tpr) => {
476477
if (isX(fM)) {
477478
from = ''
478479
} else if (isX(fm)) {

node_modules/semver/classes/semver.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class SemVer {
158158
do {
159159
const a = this.build[i]
160160
const b = other.build[i]
161-
debug('prerelease compare', i, a, b)
161+
debug('build compare', i, a, b)
162162
if (a === undefined && b === undefined) {
163163
return 0
164164
} else if (b === undefined) {
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
class LRUCache {
2+
constructor () {
3+
this.max = 1000
4+
this.map = new Map()
5+
}
6+
7+
get (key) {
8+
const value = this.map.get(key)
9+
if (value === undefined) {
10+
return undefined
11+
} else {
12+
// Remove the key from the map and add it to the end
13+
this.map.delete(key)
14+
this.map.set(key, value)
15+
return value
16+
}
17+
}
18+
19+
delete (key) {
20+
if (this.map.has(key)) {
21+
this.map.delete(key)
22+
return true
23+
} else {
24+
return false
25+
}
26+
}
27+
28+
set (key, value) {
29+
const deleted = this.delete(key)
30+
31+
if (!deleted && value !== undefined) {
32+
// If cache is full, delete the least recently used item
33+
if (this.map.size >= this.max) {
34+
const firstKey = this.map.keys().next().value
35+
this.delete(firstKey)
36+
}
37+
38+
this.map.set(key, value)
39+
}
40+
41+
return this
42+
}
43+
}
44+
45+
module.exports = LRUCache

node_modules/semver/node_modules/lru-cache/LICENSE

-15
This file was deleted.

0 commit comments

Comments
 (0)