@donmahallem/lerna2codecov 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1014 -123
- package/dist/cjs/index.js.map +1 -1
- package/dist/cli/cli.js +1014 -123
- package/dist/cli/cli.js.map +1 -1
- package/dist/esm/index.js +1014 -123
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -776,7 +776,7 @@ const naiveLength = () => 1;
|
|
|
776
776
|
//
|
|
777
777
|
// cache is a Map (or PseudoMap) that matches the keys to
|
|
778
778
|
// the Yallist.Node object.
|
|
779
|
-
class LRUCache {
|
|
779
|
+
class LRUCache$1 {
|
|
780
780
|
constructor (options) {
|
|
781
781
|
if (typeof options === 'number')
|
|
782
782
|
options = { max: options };
|
|
@@ -1083,12 +1083,12 @@ const forEachStep = (self, fn, node, thisp) => {
|
|
|
1083
1083
|
fn.call(thisp, hit.value, hit.key, self);
|
|
1084
1084
|
};
|
|
1085
1085
|
|
|
1086
|
-
var lruCache = LRUCache;
|
|
1086
|
+
var lruCache$1 = LRUCache$1;
|
|
1087
1087
|
|
|
1088
1088
|
const url$1 = require$$0__default["default"];
|
|
1089
1089
|
const gitHosts = gitHostInfo;
|
|
1090
1090
|
const GitHost = hostedGitInfo.exports = gitHost;
|
|
1091
|
-
const LRU$1 = lruCache;
|
|
1091
|
+
const LRU$1 = lruCache$1;
|
|
1092
1092
|
const cache$1 = new LRU$1({ max: 1000 });
|
|
1093
1093
|
|
|
1094
1094
|
const protocolToRepresentationMap = {
|
|
@@ -1330,7 +1330,7 @@ const SEMVER_SPEC_VERSION = '2.0.0';
|
|
|
1330
1330
|
|
|
1331
1331
|
const MAX_LENGTH$2 = 256;
|
|
1332
1332
|
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
|
|
1333
|
-
|
|
1333
|
+
/* istanbul ignore next */ 9007199254740991;
|
|
1334
1334
|
|
|
1335
1335
|
// Max safe segment length for coercion.
|
|
1336
1336
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
@@ -1339,7 +1339,7 @@ var constants$1 = {
|
|
|
1339
1339
|
SEMVER_SPEC_VERSION,
|
|
1340
1340
|
MAX_LENGTH: MAX_LENGTH$2,
|
|
1341
1341
|
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
1342
|
-
MAX_SAFE_COMPONENT_LENGTH
|
|
1342
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
1343
1343
|
};
|
|
1344
1344
|
|
|
1345
1345
|
const debug$4 = (
|
|
@@ -1365,7 +1365,7 @@ let R = 0;
|
|
|
1365
1365
|
|
|
1366
1366
|
const createToken = (name, value, isGlobal) => {
|
|
1367
1367
|
const index = R++;
|
|
1368
|
-
debug(index, value);
|
|
1368
|
+
debug(name, index, value);
|
|
1369
1369
|
t[name] = index;
|
|
1370
1370
|
src[index] = value;
|
|
1371
1371
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
@@ -1533,8 +1533,8 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
|
1533
1533
|
// Star ranges basically just allow anything at all.
|
|
1534
1534
|
createToken('STAR', '(<|>)?=?\\s*\\*');
|
|
1535
1535
|
// >=0.0.0 is like a star
|
|
1536
|
-
createToken('GTE0', '^\\s*>=\\s*0
|
|
1537
|
-
createToken('GTE0PRE', '^\\s*>=\\s*0
|
|
1536
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
|
1537
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
1538
1538
|
}(re$5, re$5.exports));
|
|
1539
1539
|
|
|
1540
1540
|
// parse out just the options we care about so we always get a consistent
|
|
@@ -1543,9 +1543,9 @@ const opts = ['includePrerelease', 'loose', 'rtl'];
|
|
|
1543
1543
|
const parseOptions$4 = options =>
|
|
1544
1544
|
!options ? {}
|
|
1545
1545
|
: typeof options !== 'object' ? { loose: true }
|
|
1546
|
-
: opts.filter(k => options[k]).reduce((
|
|
1547
|
-
|
|
1548
|
-
return
|
|
1546
|
+
: opts.filter(k => options[k]).reduce((o, k) => {
|
|
1547
|
+
o[k] = true;
|
|
1548
|
+
return o
|
|
1549
1549
|
}, {});
|
|
1550
1550
|
var parseOptions_1 = parseOptions$4;
|
|
1551
1551
|
|
|
@@ -1570,7 +1570,7 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
|
1570
1570
|
|
|
1571
1571
|
var identifiers = {
|
|
1572
1572
|
compareIdentifiers: compareIdentifiers$1,
|
|
1573
|
-
rcompareIdentifiers
|
|
1573
|
+
rcompareIdentifiers,
|
|
1574
1574
|
};
|
|
1575
1575
|
|
|
1576
1576
|
const debug$3 = debug_1;
|
|
@@ -1861,7 +1861,7 @@ class SemVer$e {
|
|
|
1861
1861
|
|
|
1862
1862
|
var semver$4 = SemVer$e;
|
|
1863
1863
|
|
|
1864
|
-
const {MAX_LENGTH} = constants$1;
|
|
1864
|
+
const { MAX_LENGTH } = constants$1;
|
|
1865
1865
|
const { re: re$3, t: t$3 } = re$5.exports;
|
|
1866
1866
|
const SemVer$d = semver$4;
|
|
1867
1867
|
|
|
@@ -2032,17 +2032,21 @@ const lte$1 = lte_1;
|
|
|
2032
2032
|
const cmp$1 = (a, op, b, loose) => {
|
|
2033
2033
|
switch (op) {
|
|
2034
2034
|
case '===':
|
|
2035
|
-
if (typeof a === 'object')
|
|
2035
|
+
if (typeof a === 'object') {
|
|
2036
2036
|
a = a.version;
|
|
2037
|
-
|
|
2037
|
+
}
|
|
2038
|
+
if (typeof b === 'object') {
|
|
2038
2039
|
b = b.version;
|
|
2040
|
+
}
|
|
2039
2041
|
return a === b
|
|
2040
2042
|
|
|
2041
2043
|
case '!==':
|
|
2042
|
-
if (typeof a === 'object')
|
|
2044
|
+
if (typeof a === 'object') {
|
|
2043
2045
|
a = a.version;
|
|
2044
|
-
|
|
2046
|
+
}
|
|
2047
|
+
if (typeof b === 'object') {
|
|
2045
2048
|
b = b.version;
|
|
2049
|
+
}
|
|
2046
2050
|
return a !== b
|
|
2047
2051
|
|
|
2048
2052
|
case '':
|
|
@@ -2073,7 +2077,7 @@ var cmp_1 = cmp$1;
|
|
|
2073
2077
|
|
|
2074
2078
|
const SemVer$6 = semver$4;
|
|
2075
2079
|
const parse$1 = parse_1;
|
|
2076
|
-
const {re: re$2, t: t$2} = re$5.exports;
|
|
2080
|
+
const { re: re$2, t: t$2 } = re$5.exports;
|
|
2077
2081
|
|
|
2078
2082
|
const coerce = (version, options) => {
|
|
2079
2083
|
if (version instanceof SemVer$6) {
|
|
@@ -2116,13 +2120,838 @@ const coerce = (version, options) => {
|
|
|
2116
2120
|
re$2[t$2.COERCERTL].lastIndex = -1;
|
|
2117
2121
|
}
|
|
2118
2122
|
|
|
2119
|
-
if (match === null)
|
|
2123
|
+
if (match === null) {
|
|
2120
2124
|
return null
|
|
2125
|
+
}
|
|
2121
2126
|
|
|
2122
2127
|
return parse$1(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
|
2123
2128
|
};
|
|
2124
2129
|
var coerce_1 = coerce;
|
|
2125
2130
|
|
|
2131
|
+
const perf = typeof performance === 'object' && performance &&
|
|
2132
|
+
typeof performance.now === 'function' ? performance : Date;
|
|
2133
|
+
|
|
2134
|
+
const hasAbortController = typeof AbortController !== 'undefined';
|
|
2135
|
+
|
|
2136
|
+
// minimal backwards-compatibility polyfill
|
|
2137
|
+
const AC = hasAbortController ? AbortController : Object.assign(
|
|
2138
|
+
class AbortController {
|
|
2139
|
+
constructor () { this.signal = new AC.AbortSignal; }
|
|
2140
|
+
abort () { this.signal.aborted = true; }
|
|
2141
|
+
},
|
|
2142
|
+
{ AbortSignal: class AbortSignal { constructor () { this.aborted = false; }}}
|
|
2143
|
+
);
|
|
2144
|
+
|
|
2145
|
+
const warned = new Set();
|
|
2146
|
+
const deprecatedOption = (opt, instead) => {
|
|
2147
|
+
const code = `LRU_CACHE_OPTION_${opt}`;
|
|
2148
|
+
if (shouldWarn(code)) {
|
|
2149
|
+
warn(code, `${opt} option`, `options.${instead}`, LRUCache);
|
|
2150
|
+
}
|
|
2151
|
+
};
|
|
2152
|
+
const deprecatedMethod = (method, instead) => {
|
|
2153
|
+
const code = `LRU_CACHE_METHOD_${method}`;
|
|
2154
|
+
if (shouldWarn(code)) {
|
|
2155
|
+
const { prototype } = LRUCache;
|
|
2156
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, method);
|
|
2157
|
+
warn(code, `${method} method`, `cache.${instead}()`, get);
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
const deprecatedProperty = (field, instead) => {
|
|
2161
|
+
const code = `LRU_CACHE_PROPERTY_${field}`;
|
|
2162
|
+
if (shouldWarn(code)) {
|
|
2163
|
+
const { prototype } = LRUCache;
|
|
2164
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, field);
|
|
2165
|
+
warn(code, `${field} property`, `cache.${instead}`, get);
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
|
|
2169
|
+
const emitWarning = (...a) => {
|
|
2170
|
+
typeof process === 'object' &&
|
|
2171
|
+
process &&
|
|
2172
|
+
typeof process.emitWarning === 'function'
|
|
2173
|
+
? process.emitWarning(...a)
|
|
2174
|
+
: console.error(...a);
|
|
2175
|
+
};
|
|
2176
|
+
|
|
2177
|
+
const shouldWarn = code => !warned.has(code);
|
|
2178
|
+
|
|
2179
|
+
const warn = (code, what, instead, fn) => {
|
|
2180
|
+
warned.add(code);
|
|
2181
|
+
const msg = `The ${what} is deprecated. Please use ${instead} instead.`;
|
|
2182
|
+
emitWarning(msg, 'DeprecationWarning', code, fn);
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
2186
|
+
|
|
2187
|
+
/* istanbul ignore next - This is a little bit ridiculous, tbh.
|
|
2188
|
+
* The maximum array length is 2^32-1 or thereabouts on most JS impls.
|
|
2189
|
+
* And well before that point, you're caching the entire world, I mean,
|
|
2190
|
+
* that's ~32GB of just integers for the next/prev links, plus whatever
|
|
2191
|
+
* else to hold that many keys and values. Just filling the memory with
|
|
2192
|
+
* zeroes at init time is brutal when you get that big.
|
|
2193
|
+
* But why not be complete?
|
|
2194
|
+
* Maybe in the future, these limits will have expanded. */
|
|
2195
|
+
const getUintArray = max => !isPosInt(max) ? null
|
|
2196
|
+
: max <= Math.pow(2, 8) ? Uint8Array
|
|
2197
|
+
: max <= Math.pow(2, 16) ? Uint16Array
|
|
2198
|
+
: max <= Math.pow(2, 32) ? Uint32Array
|
|
2199
|
+
: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
|
|
2200
|
+
: null;
|
|
2201
|
+
|
|
2202
|
+
class ZeroArray extends Array {
|
|
2203
|
+
constructor (size) {
|
|
2204
|
+
super(size);
|
|
2205
|
+
this.fill(0);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
class Stack {
|
|
2210
|
+
constructor (max) {
|
|
2211
|
+
if (max === 0) {
|
|
2212
|
+
return []
|
|
2213
|
+
}
|
|
2214
|
+
const UintArray = getUintArray(max);
|
|
2215
|
+
this.heap = new UintArray(max);
|
|
2216
|
+
this.length = 0;
|
|
2217
|
+
}
|
|
2218
|
+
push (n) {
|
|
2219
|
+
this.heap[this.length++] = n;
|
|
2220
|
+
}
|
|
2221
|
+
pop () {
|
|
2222
|
+
return this.heap[--this.length]
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
class LRUCache {
|
|
2227
|
+
constructor (options = {}) {
|
|
2228
|
+
const {
|
|
2229
|
+
max = 0,
|
|
2230
|
+
ttl,
|
|
2231
|
+
ttlResolution = 1,
|
|
2232
|
+
ttlAutopurge,
|
|
2233
|
+
updateAgeOnGet,
|
|
2234
|
+
updateAgeOnHas,
|
|
2235
|
+
allowStale,
|
|
2236
|
+
dispose,
|
|
2237
|
+
disposeAfter,
|
|
2238
|
+
noDisposeOnSet,
|
|
2239
|
+
noUpdateTTL,
|
|
2240
|
+
maxSize = 0,
|
|
2241
|
+
sizeCalculation,
|
|
2242
|
+
fetchMethod,
|
|
2243
|
+
} = options;
|
|
2244
|
+
|
|
2245
|
+
// deprecated options, don't trigger a warning for getting them if
|
|
2246
|
+
// the thing being passed in is another LRUCache we're copying.
|
|
2247
|
+
const {
|
|
2248
|
+
length,
|
|
2249
|
+
maxAge,
|
|
2250
|
+
stale,
|
|
2251
|
+
} = options instanceof LRUCache ? {} : options;
|
|
2252
|
+
|
|
2253
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
2254
|
+
throw new TypeError('max option must be a nonnegative integer')
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
2258
|
+
if (!UintArray) {
|
|
2259
|
+
throw new Error('invalid max value: ' + max)
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
this.max = max;
|
|
2263
|
+
this.maxSize = maxSize;
|
|
2264
|
+
this.sizeCalculation = sizeCalculation || length;
|
|
2265
|
+
if (this.sizeCalculation) {
|
|
2266
|
+
if (!this.maxSize) {
|
|
2267
|
+
throw new TypeError('cannot set sizeCalculation without setting maxSize')
|
|
2268
|
+
}
|
|
2269
|
+
if (typeof this.sizeCalculation !== 'function') {
|
|
2270
|
+
throw new TypeError('sizeCalculation set to non-function')
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
this.fetchMethod = fetchMethod || null;
|
|
2275
|
+
if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
|
|
2276
|
+
throw new TypeError('fetchMethod must be a function if specified')
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
this.keyMap = new Map();
|
|
2280
|
+
this.keyList = new Array(max).fill(null);
|
|
2281
|
+
this.valList = new Array(max).fill(null);
|
|
2282
|
+
this.next = new UintArray(max);
|
|
2283
|
+
this.prev = new UintArray(max);
|
|
2284
|
+
this.head = 0;
|
|
2285
|
+
this.tail = 0;
|
|
2286
|
+
this.free = new Stack(max);
|
|
2287
|
+
this.initialFill = 1;
|
|
2288
|
+
this.size = 0;
|
|
2289
|
+
|
|
2290
|
+
if (typeof dispose === 'function') {
|
|
2291
|
+
this.dispose = dispose;
|
|
2292
|
+
}
|
|
2293
|
+
if (typeof disposeAfter === 'function') {
|
|
2294
|
+
this.disposeAfter = disposeAfter;
|
|
2295
|
+
this.disposed = [];
|
|
2296
|
+
} else {
|
|
2297
|
+
this.disposeAfter = null;
|
|
2298
|
+
this.disposed = null;
|
|
2299
|
+
}
|
|
2300
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
2301
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
2302
|
+
|
|
2303
|
+
if (this.maxSize !== 0) {
|
|
2304
|
+
if (!isPosInt(this.maxSize)) {
|
|
2305
|
+
throw new TypeError('maxSize must be a positive integer if specified')
|
|
2306
|
+
}
|
|
2307
|
+
this.initializeSizeTracking();
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
this.allowStale = !!allowStale || !!stale;
|
|
2311
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
2312
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
2313
|
+
this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
|
|
2314
|
+
? ttlResolution : 1;
|
|
2315
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
2316
|
+
this.ttl = ttl || maxAge || 0;
|
|
2317
|
+
if (this.ttl) {
|
|
2318
|
+
if (!isPosInt(this.ttl)) {
|
|
2319
|
+
throw new TypeError('ttl must be a positive integer if specified')
|
|
2320
|
+
}
|
|
2321
|
+
this.initializeTTLTracking();
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
// do not allow completely unbounded caches
|
|
2325
|
+
if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
|
|
2326
|
+
throw new TypeError('At least one of max, maxSize, or ttl is required')
|
|
2327
|
+
}
|
|
2328
|
+
if (!this.ttlAutopurge && !this.max && !this.maxSize) {
|
|
2329
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
2330
|
+
if (shouldWarn(code)) {
|
|
2331
|
+
warned.add(code);
|
|
2332
|
+
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
|
|
2333
|
+
'result in unbounded memory consumption.';
|
|
2334
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
if (stale) {
|
|
2339
|
+
deprecatedOption('stale', 'allowStale');
|
|
2340
|
+
}
|
|
2341
|
+
if (maxAge) {
|
|
2342
|
+
deprecatedOption('maxAge', 'ttl');
|
|
2343
|
+
}
|
|
2344
|
+
if (length) {
|
|
2345
|
+
deprecatedOption('length', 'sizeCalculation');
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
getRemainingTTL (key) {
|
|
2350
|
+
return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
initializeTTLTracking () {
|
|
2354
|
+
this.ttls = new ZeroArray(this.max);
|
|
2355
|
+
this.starts = new ZeroArray(this.max);
|
|
2356
|
+
|
|
2357
|
+
this.setItemTTL = (index, ttl) => {
|
|
2358
|
+
this.starts[index] = ttl !== 0 ? perf.now() : 0;
|
|
2359
|
+
this.ttls[index] = ttl;
|
|
2360
|
+
if (ttl !== 0 && this.ttlAutopurge) {
|
|
2361
|
+
const t = setTimeout(() => {
|
|
2362
|
+
if (this.isStale(index)) {
|
|
2363
|
+
this.delete(this.keyList[index]);
|
|
2364
|
+
}
|
|
2365
|
+
}, ttl + 1);
|
|
2366
|
+
/* istanbul ignore else - unref() not supported on all platforms */
|
|
2367
|
+
if (t.unref) {
|
|
2368
|
+
t.unref();
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
this.updateItemAge = (index) => {
|
|
2374
|
+
this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0;
|
|
2375
|
+
};
|
|
2376
|
+
|
|
2377
|
+
// debounce calls to perf.now() to 1s so we're not hitting
|
|
2378
|
+
// that costly call repeatedly.
|
|
2379
|
+
let cachedNow = 0;
|
|
2380
|
+
const getNow = () => {
|
|
2381
|
+
const n = perf.now();
|
|
2382
|
+
if (this.ttlResolution > 0) {
|
|
2383
|
+
cachedNow = n;
|
|
2384
|
+
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
2385
|
+
/* istanbul ignore else - not available on all platforms */
|
|
2386
|
+
if (t.unref) {
|
|
2387
|
+
t.unref();
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
return n
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
this.getRemainingTTL = (key) => {
|
|
2394
|
+
const index = this.keyMap.get(key);
|
|
2395
|
+
if (index === undefined) {
|
|
2396
|
+
return 0
|
|
2397
|
+
}
|
|
2398
|
+
return this.ttls[index] === 0 || this.starts[index] === 0 ? Infinity
|
|
2399
|
+
: ((this.starts[index] + this.ttls[index]) - (cachedNow || getNow()))
|
|
2400
|
+
};
|
|
2401
|
+
|
|
2402
|
+
this.isStale = (index) => {
|
|
2403
|
+
return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
|
|
2404
|
+
((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
updateItemAge (index) {}
|
|
2408
|
+
setItemTTL (index, ttl) {}
|
|
2409
|
+
isStale (index) { return false }
|
|
2410
|
+
|
|
2411
|
+
initializeSizeTracking () {
|
|
2412
|
+
this.calculatedSize = 0;
|
|
2413
|
+
this.sizes = new ZeroArray(this.max);
|
|
2414
|
+
this.removeItemSize = index => this.calculatedSize -= this.sizes[index];
|
|
2415
|
+
this.requireSize = (k, v, size, sizeCalculation) => {
|
|
2416
|
+
if (!isPosInt(size)) {
|
|
2417
|
+
if (sizeCalculation) {
|
|
2418
|
+
if (typeof sizeCalculation !== 'function') {
|
|
2419
|
+
throw new TypeError('sizeCalculation must be a function')
|
|
2420
|
+
}
|
|
2421
|
+
size = sizeCalculation(v, k);
|
|
2422
|
+
if (!isPosInt(size)) {
|
|
2423
|
+
throw new TypeError('sizeCalculation return invalid (expect positive integer)')
|
|
2424
|
+
}
|
|
2425
|
+
} else {
|
|
2426
|
+
throw new TypeError('invalid size value (must be positive integer)')
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
return size
|
|
2430
|
+
};
|
|
2431
|
+
this.addItemSize = (index, v, k, size) => {
|
|
2432
|
+
this.sizes[index] = size;
|
|
2433
|
+
const maxSize = this.maxSize - this.sizes[index];
|
|
2434
|
+
while (this.calculatedSize > maxSize) {
|
|
2435
|
+
this.evict(true);
|
|
2436
|
+
}
|
|
2437
|
+
this.calculatedSize += this.sizes[index];
|
|
2438
|
+
};
|
|
2439
|
+
this.delete = k => {
|
|
2440
|
+
if (this.size !== 0) {
|
|
2441
|
+
const index = this.keyMap.get(k);
|
|
2442
|
+
if (index !== undefined) {
|
|
2443
|
+
this.calculatedSize -= this.sizes[index];
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
return LRUCache.prototype.delete.call(this, k)
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
removeItemSize (index) {}
|
|
2450
|
+
addItemSize (index, v, k, size) {}
|
|
2451
|
+
requireSize (k, v, size, sizeCalculation) {
|
|
2452
|
+
if (size || sizeCalculation) {
|
|
2453
|
+
throw new TypeError('cannot set size without setting maxSize on cache')
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
*indexes ({ allowStale = this.allowStale } = {}) {
|
|
2458
|
+
if (this.size) {
|
|
2459
|
+
for (let i = this.tail; true; ) {
|
|
2460
|
+
if (!this.isValidIndex(i)) {
|
|
2461
|
+
break
|
|
2462
|
+
}
|
|
2463
|
+
if (allowStale || !this.isStale(i)) {
|
|
2464
|
+
yield i;
|
|
2465
|
+
}
|
|
2466
|
+
if (i === this.head) {
|
|
2467
|
+
break
|
|
2468
|
+
} else {
|
|
2469
|
+
i = this.prev[i];
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
*rindexes ({ allowStale = this.allowStale } = {}) {
|
|
2476
|
+
if (this.size) {
|
|
2477
|
+
for (let i = this.head; true; ) {
|
|
2478
|
+
if (!this.isValidIndex(i)) {
|
|
2479
|
+
break
|
|
2480
|
+
}
|
|
2481
|
+
if (allowStale || !this.isStale(i)) {
|
|
2482
|
+
yield i;
|
|
2483
|
+
}
|
|
2484
|
+
if (i === this.tail) {
|
|
2485
|
+
break
|
|
2486
|
+
} else {
|
|
2487
|
+
i = this.next[i];
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
isValidIndex (index) {
|
|
2494
|
+
return this.keyMap.get(this.keyList[index]) === index
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
*entries () {
|
|
2498
|
+
for (const i of this.indexes()) {
|
|
2499
|
+
yield [this.keyList[i], this.valList[i]];
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
*rentries () {
|
|
2503
|
+
for (const i of this.rindexes()) {
|
|
2504
|
+
yield [this.keyList[i], this.valList[i]];
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
*keys () {
|
|
2509
|
+
for (const i of this.indexes()) {
|
|
2510
|
+
yield this.keyList[i];
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
*rkeys () {
|
|
2514
|
+
for (const i of this.rindexes()) {
|
|
2515
|
+
yield this.keyList[i];
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
*values () {
|
|
2520
|
+
for (const i of this.indexes()) {
|
|
2521
|
+
yield this.valList[i];
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
*rvalues () {
|
|
2525
|
+
for (const i of this.rindexes()) {
|
|
2526
|
+
yield this.valList[i];
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
[Symbol.iterator] () {
|
|
2531
|
+
return this.entries()
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
find (fn, getOptions = {}) {
|
|
2535
|
+
for (const i of this.indexes()) {
|
|
2536
|
+
if (fn(this.valList[i], this.keyList[i], this)) {
|
|
2537
|
+
return this.get(this.keyList[i], getOptions)
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
forEach (fn, thisp = this) {
|
|
2543
|
+
for (const i of this.indexes()) {
|
|
2544
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
rforEach (fn, thisp = this) {
|
|
2549
|
+
for (const i of this.rindexes()) {
|
|
2550
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
get prune () {
|
|
2555
|
+
deprecatedMethod('prune', 'purgeStale');
|
|
2556
|
+
return this.purgeStale
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
purgeStale () {
|
|
2560
|
+
let deleted = false;
|
|
2561
|
+
for (const i of this.rindexes({ allowStale: true })) {
|
|
2562
|
+
if (this.isStale(i)) {
|
|
2563
|
+
this.delete(this.keyList[i]);
|
|
2564
|
+
deleted = true;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
return deleted
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
dump () {
|
|
2571
|
+
const arr = [];
|
|
2572
|
+
for (const i of this.indexes()) {
|
|
2573
|
+
const key = this.keyList[i];
|
|
2574
|
+
const value = this.valList[i];
|
|
2575
|
+
const entry = { value };
|
|
2576
|
+
if (this.ttls) {
|
|
2577
|
+
entry.ttl = this.ttls[i];
|
|
2578
|
+
}
|
|
2579
|
+
if (this.sizes) {
|
|
2580
|
+
entry.size = this.sizes[i];
|
|
2581
|
+
}
|
|
2582
|
+
arr.unshift([key, entry]);
|
|
2583
|
+
}
|
|
2584
|
+
return arr
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
load (arr) {
|
|
2588
|
+
this.clear();
|
|
2589
|
+
for (const [key, entry] of arr) {
|
|
2590
|
+
this.set(key, entry.value, entry);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
dispose (v, k, reason) {}
|
|
2595
|
+
|
|
2596
|
+
set (k, v, {
|
|
2597
|
+
ttl = this.ttl,
|
|
2598
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
2599
|
+
size = 0,
|
|
2600
|
+
sizeCalculation = this.sizeCalculation,
|
|
2601
|
+
noUpdateTTL = this.noUpdateTTL,
|
|
2602
|
+
} = {}) {
|
|
2603
|
+
size = this.requireSize(k, v, size, sizeCalculation);
|
|
2604
|
+
let index = this.size === 0 ? undefined : this.keyMap.get(k);
|
|
2605
|
+
if (index === undefined) {
|
|
2606
|
+
// addition
|
|
2607
|
+
index = this.newIndex();
|
|
2608
|
+
this.keyList[index] = k;
|
|
2609
|
+
this.valList[index] = v;
|
|
2610
|
+
this.keyMap.set(k, index);
|
|
2611
|
+
this.next[this.tail] = index;
|
|
2612
|
+
this.prev[index] = this.tail;
|
|
2613
|
+
this.tail = index;
|
|
2614
|
+
this.size ++;
|
|
2615
|
+
this.addItemSize(index, v, k, size);
|
|
2616
|
+
noUpdateTTL = false;
|
|
2617
|
+
} else {
|
|
2618
|
+
// update
|
|
2619
|
+
const oldVal = this.valList[index];
|
|
2620
|
+
if (v !== oldVal) {
|
|
2621
|
+
if (this.isBackgroundFetch(oldVal)) {
|
|
2622
|
+
oldVal.__abortController.abort();
|
|
2623
|
+
} else {
|
|
2624
|
+
if (!noDisposeOnSet) {
|
|
2625
|
+
this.dispose(oldVal, k, 'set');
|
|
2626
|
+
if (this.disposeAfter) {
|
|
2627
|
+
this.disposed.push([oldVal, k, 'set']);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
this.removeItemSize(index);
|
|
2632
|
+
this.valList[index] = v;
|
|
2633
|
+
this.addItemSize(index, v, k, size);
|
|
2634
|
+
}
|
|
2635
|
+
this.moveToTail(index);
|
|
2636
|
+
}
|
|
2637
|
+
if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
|
|
2638
|
+
this.initializeTTLTracking();
|
|
2639
|
+
}
|
|
2640
|
+
if (!noUpdateTTL) {
|
|
2641
|
+
this.setItemTTL(index, ttl);
|
|
2642
|
+
}
|
|
2643
|
+
if (this.disposeAfter) {
|
|
2644
|
+
while (this.disposed.length) {
|
|
2645
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
return this
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
newIndex () {
|
|
2652
|
+
if (this.size === 0) {
|
|
2653
|
+
return this.tail
|
|
2654
|
+
}
|
|
2655
|
+
if (this.size === this.max && this.max !== 0) {
|
|
2656
|
+
return this.evict(false)
|
|
2657
|
+
}
|
|
2658
|
+
if (this.free.length !== 0) {
|
|
2659
|
+
return this.free.pop()
|
|
2660
|
+
}
|
|
2661
|
+
// initial fill, just keep writing down the list
|
|
2662
|
+
return this.initialFill++
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
pop () {
|
|
2666
|
+
if (this.size) {
|
|
2667
|
+
const val = this.valList[this.head];
|
|
2668
|
+
this.evict(true);
|
|
2669
|
+
return val
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
evict (free) {
|
|
2674
|
+
const head = this.head;
|
|
2675
|
+
const k = this.keyList[head];
|
|
2676
|
+
const v = this.valList[head];
|
|
2677
|
+
if (this.isBackgroundFetch(v)) {
|
|
2678
|
+
v.__abortController.abort();
|
|
2679
|
+
} else {
|
|
2680
|
+
this.dispose(v, k, 'evict');
|
|
2681
|
+
if (this.disposeAfter) {
|
|
2682
|
+
this.disposed.push([v, k, 'evict']);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
this.removeItemSize(head);
|
|
2686
|
+
// if we aren't about to use the index, then null these out
|
|
2687
|
+
if (free) {
|
|
2688
|
+
this.keyList[head] = null;
|
|
2689
|
+
this.valList[head] = null;
|
|
2690
|
+
this.free.push(head);
|
|
2691
|
+
}
|
|
2692
|
+
this.head = this.next[head];
|
|
2693
|
+
this.keyMap.delete(k);
|
|
2694
|
+
this.size --;
|
|
2695
|
+
return head
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
has (k, { updateAgeOnHas = this.updateAgeOnHas } = {}) {
|
|
2699
|
+
const index = this.keyMap.get(k);
|
|
2700
|
+
if (index !== undefined) {
|
|
2701
|
+
if (!this.isStale(index)) {
|
|
2702
|
+
if (updateAgeOnHas) {
|
|
2703
|
+
this.updateItemAge(index);
|
|
2704
|
+
}
|
|
2705
|
+
return true
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
return false
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
// like get(), but without any LRU updating or TTL expiration
|
|
2712
|
+
peek (k, { allowStale = this.allowStale } = {}) {
|
|
2713
|
+
const index = this.keyMap.get(k);
|
|
2714
|
+
if (index !== undefined && (allowStale || !this.isStale(index))) {
|
|
2715
|
+
return this.valList[index]
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
backgroundFetch (k, index, options) {
|
|
2720
|
+
const v = index === undefined ? undefined : this.valList[index];
|
|
2721
|
+
if (this.isBackgroundFetch(v)) {
|
|
2722
|
+
return v
|
|
2723
|
+
}
|
|
2724
|
+
const ac = new AC();
|
|
2725
|
+
const fetchOpts = {
|
|
2726
|
+
signal: ac.signal,
|
|
2727
|
+
options,
|
|
2728
|
+
};
|
|
2729
|
+
const p = Promise.resolve(this.fetchMethod(k, v, fetchOpts)).then(v => {
|
|
2730
|
+
if (!ac.signal.aborted) {
|
|
2731
|
+
this.set(k, v, fetchOpts.options);
|
|
2732
|
+
}
|
|
2733
|
+
return v
|
|
2734
|
+
});
|
|
2735
|
+
p.__abortController = ac;
|
|
2736
|
+
p.__staleWhileFetching = v;
|
|
2737
|
+
if (index === undefined) {
|
|
2738
|
+
this.set(k, p, fetchOpts.options);
|
|
2739
|
+
index = this.keyMap.get(k);
|
|
2740
|
+
} else {
|
|
2741
|
+
this.valList[index] = p;
|
|
2742
|
+
}
|
|
2743
|
+
return p
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
isBackgroundFetch (p) {
|
|
2747
|
+
return p && typeof p === 'object' && typeof p.then === 'function' &&
|
|
2748
|
+
Object.prototype.hasOwnProperty.call(p, '__staleWhileFetching')
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
// this takes the union of get() and set() opts, because it does both
|
|
2752
|
+
async fetch (k, {
|
|
2753
|
+
allowStale = this.allowStale,
|
|
2754
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
2755
|
+
ttl = this.ttl,
|
|
2756
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
2757
|
+
size = 0,
|
|
2758
|
+
sizeCalculation = this.sizeCalculation,
|
|
2759
|
+
noUpdateTTL = this.noUpdateTTL,
|
|
2760
|
+
} = {}) {
|
|
2761
|
+
if (!this.fetchMethod) {
|
|
2762
|
+
return this.get(k, {allowStale, updateAgeOnGet})
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
const options = {
|
|
2766
|
+
allowStale,
|
|
2767
|
+
updateAgeOnGet,
|
|
2768
|
+
ttl,
|
|
2769
|
+
noDisposeOnSet,
|
|
2770
|
+
size,
|
|
2771
|
+
sizeCalculation,
|
|
2772
|
+
noUpdateTTL,
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2775
|
+
let index = this.keyMap.get(k);
|
|
2776
|
+
if (index === undefined) {
|
|
2777
|
+
return this.backgroundFetch(k, index, options)
|
|
2778
|
+
} else {
|
|
2779
|
+
// in cache, maybe already fetching
|
|
2780
|
+
const v = this.valList[index];
|
|
2781
|
+
if (this.isBackgroundFetch(v)) {
|
|
2782
|
+
return allowStale && v.__staleWhileFetching !== undefined
|
|
2783
|
+
? v.__staleWhileFetching : v
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
if (!this.isStale(index)) {
|
|
2787
|
+
this.moveToTail(index);
|
|
2788
|
+
if (updateAgeOnGet) {
|
|
2789
|
+
this.updateItemAge(index);
|
|
2790
|
+
}
|
|
2791
|
+
return v
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
// ok, it is stale, and not already fetching
|
|
2795
|
+
// refresh the cache.
|
|
2796
|
+
const p = this.backgroundFetch(k, index, options);
|
|
2797
|
+
return allowStale && p.__staleWhileFetching !== undefined
|
|
2798
|
+
? p.__staleWhileFetching : p
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
get (k, {
|
|
2803
|
+
allowStale = this.allowStale,
|
|
2804
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
2805
|
+
} = {}) {
|
|
2806
|
+
const index = this.keyMap.get(k);
|
|
2807
|
+
if (index !== undefined) {
|
|
2808
|
+
const value = this.valList[index];
|
|
2809
|
+
const fetching = this.isBackgroundFetch(value);
|
|
2810
|
+
if (this.isStale(index)) {
|
|
2811
|
+
// delete only if not an in-flight background fetch
|
|
2812
|
+
if (!fetching) {
|
|
2813
|
+
this.delete(k);
|
|
2814
|
+
return allowStale ? value : undefined
|
|
2815
|
+
} else {
|
|
2816
|
+
return allowStale ? value.__staleWhileFetching : undefined
|
|
2817
|
+
}
|
|
2818
|
+
} else {
|
|
2819
|
+
// if we're currently fetching it, we don't actually have it yet
|
|
2820
|
+
// it's not stale, which means this isn't a staleWhileRefetching,
|
|
2821
|
+
// so we just return undefined
|
|
2822
|
+
if (fetching) {
|
|
2823
|
+
return undefined
|
|
2824
|
+
}
|
|
2825
|
+
this.moveToTail(index);
|
|
2826
|
+
if (updateAgeOnGet) {
|
|
2827
|
+
this.updateItemAge(index);
|
|
2828
|
+
}
|
|
2829
|
+
return value
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
connect (p, n) {
|
|
2835
|
+
this.prev[n] = p;
|
|
2836
|
+
this.next[p] = n;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
moveToTail (index) {
|
|
2840
|
+
// if tail already, nothing to do
|
|
2841
|
+
// if head, move head to next[index]
|
|
2842
|
+
// else
|
|
2843
|
+
// move next[prev[index]] to next[index] (head has no prev)
|
|
2844
|
+
// move prev[next[index]] to prev[index]
|
|
2845
|
+
// prev[index] = tail
|
|
2846
|
+
// next[tail] = index
|
|
2847
|
+
// tail = index
|
|
2848
|
+
if (index !== this.tail) {
|
|
2849
|
+
if (index === this.head) {
|
|
2850
|
+
this.head = this.next[index];
|
|
2851
|
+
} else {
|
|
2852
|
+
this.connect(this.prev[index], this.next[index]);
|
|
2853
|
+
}
|
|
2854
|
+
this.connect(this.tail, index);
|
|
2855
|
+
this.tail = index;
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
get del () {
|
|
2860
|
+
deprecatedMethod('del', 'delete');
|
|
2861
|
+
return this.delete
|
|
2862
|
+
}
|
|
2863
|
+
delete (k) {
|
|
2864
|
+
let deleted = false;
|
|
2865
|
+
if (this.size !== 0) {
|
|
2866
|
+
const index = this.keyMap.get(k);
|
|
2867
|
+
if (index !== undefined) {
|
|
2868
|
+
deleted = true;
|
|
2869
|
+
if (this.size === 1) {
|
|
2870
|
+
this.clear();
|
|
2871
|
+
} else {
|
|
2872
|
+
this.removeItemSize(index);
|
|
2873
|
+
const v = this.valList[index];
|
|
2874
|
+
if (this.isBackgroundFetch(v)) {
|
|
2875
|
+
v.__abortController.abort();
|
|
2876
|
+
} else {
|
|
2877
|
+
this.dispose(v, k, 'delete');
|
|
2878
|
+
if (this.disposeAfter) {
|
|
2879
|
+
this.disposed.push([v, k, 'delete']);
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
this.keyMap.delete(k);
|
|
2883
|
+
this.keyList[index] = null;
|
|
2884
|
+
this.valList[index] = null;
|
|
2885
|
+
if (index === this.tail) {
|
|
2886
|
+
this.tail = this.prev[index];
|
|
2887
|
+
} else if (index === this.head) {
|
|
2888
|
+
this.head = this.next[index];
|
|
2889
|
+
} else {
|
|
2890
|
+
this.next[this.prev[index]] = this.next[index];
|
|
2891
|
+
this.prev[this.next[index]] = this.prev[index];
|
|
2892
|
+
}
|
|
2893
|
+
this.size --;
|
|
2894
|
+
this.free.push(index);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
if (this.disposed) {
|
|
2899
|
+
while (this.disposed.length) {
|
|
2900
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
return deleted
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
clear () {
|
|
2907
|
+
for (const index of this.rindexes({ allowStale: true })) {
|
|
2908
|
+
const v = this.valList[index];
|
|
2909
|
+
if (this.isBackgroundFetch(v)) {
|
|
2910
|
+
v.__abortController.abort();
|
|
2911
|
+
} else {
|
|
2912
|
+
const k = this.keyList[index];
|
|
2913
|
+
this.dispose(v, k, 'delete');
|
|
2914
|
+
if (this.disposeAfter) {
|
|
2915
|
+
this.disposed.push([v, k, 'delete']);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
this.keyMap.clear();
|
|
2921
|
+
this.valList.fill(null);
|
|
2922
|
+
this.keyList.fill(null);
|
|
2923
|
+
if (this.ttls) {
|
|
2924
|
+
this.ttls.fill(0);
|
|
2925
|
+
this.starts.fill(0);
|
|
2926
|
+
}
|
|
2927
|
+
if (this.sizes) {
|
|
2928
|
+
this.sizes.fill(0);
|
|
2929
|
+
}
|
|
2930
|
+
this.head = 0;
|
|
2931
|
+
this.tail = 0;
|
|
2932
|
+
this.initialFill = 1;
|
|
2933
|
+
this.free.length = 0;
|
|
2934
|
+
this.calculatedSize = 0;
|
|
2935
|
+
this.size = 0;
|
|
2936
|
+
if (this.disposed) {
|
|
2937
|
+
while (this.disposed.length) {
|
|
2938
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
get reset () {
|
|
2943
|
+
deprecatedMethod('reset', 'clear');
|
|
2944
|
+
return this.clear
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
get length () {
|
|
2948
|
+
deprecatedProperty('length', 'size');
|
|
2949
|
+
return this.size
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
var lruCache = LRUCache;
|
|
2954
|
+
|
|
2126
2955
|
// hoisted class for cyclic dependency
|
|
2127
2956
|
class Range$a {
|
|
2128
2957
|
constructor (range, options) {
|
|
@@ -2154,9 +2983,9 @@ class Range$a {
|
|
|
2154
2983
|
// First, split based on boolean or ||
|
|
2155
2984
|
this.raw = range;
|
|
2156
2985
|
this.set = range
|
|
2157
|
-
.split(
|
|
2986
|
+
.split('||')
|
|
2158
2987
|
// map the range to a 2d array of comparators
|
|
2159
|
-
.map(
|
|
2988
|
+
.map(r => this.parseRange(r.trim()))
|
|
2160
2989
|
// throw out any comparator lists that are empty
|
|
2161
2990
|
// this generally means that it was not a valid range, which is allowed
|
|
2162
2991
|
// in loose mode, but will still throw if the WHOLE range is invalid.
|
|
@@ -2171,9 +3000,9 @@ class Range$a {
|
|
|
2171
3000
|
// keep the first one, in case they're all null sets
|
|
2172
3001
|
const first = this.set[0];
|
|
2173
3002
|
this.set = this.set.filter(c => !isNullSet(c[0]));
|
|
2174
|
-
if (this.set.length === 0)
|
|
3003
|
+
if (this.set.length === 0) {
|
|
2175
3004
|
this.set = [first];
|
|
2176
|
-
else if (this.set.length > 1) {
|
|
3005
|
+
} else if (this.set.length > 1) {
|
|
2177
3006
|
// if we have any that are *, then the range is just *
|
|
2178
3007
|
for (const c of this.set) {
|
|
2179
3008
|
if (c.length === 1 && isAny(c[0])) {
|
|
@@ -2209,8 +3038,9 @@ class Range$a {
|
|
|
2209
3038
|
const memoOpts = Object.keys(this.options).join(',');
|
|
2210
3039
|
const memoKey = `parseRange:${memoOpts}:${range}`;
|
|
2211
3040
|
const cached = cache.get(memoKey);
|
|
2212
|
-
if (cached)
|
|
3041
|
+
if (cached) {
|
|
2213
3042
|
return cached
|
|
3043
|
+
}
|
|
2214
3044
|
|
|
2215
3045
|
const loose = this.options.loose;
|
|
2216
3046
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
@@ -2219,7 +3049,7 @@ class Range$a {
|
|
|
2219
3049
|
debug$2('hyphen replace', range);
|
|
2220
3050
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
2221
3051
|
range = range.replace(re$1[t$1.COMPARATORTRIM], comparatorTrimReplace);
|
|
2222
|
-
debug$2('comparator trim', range
|
|
3052
|
+
debug$2('comparator trim', range);
|
|
2223
3053
|
|
|
2224
3054
|
// `~ 1.2.3` => `~1.2.3`
|
|
2225
3055
|
range = range.replace(re$1[t$1.TILDETRIM], tildeTrimReplace);
|
|
@@ -2233,30 +3063,37 @@ class Range$a {
|
|
|
2233
3063
|
// At this point, the range is completely trimmed and
|
|
2234
3064
|
// ready to be split into comparators.
|
|
2235
3065
|
|
|
2236
|
-
|
|
2237
|
-
const rangeList = range
|
|
3066
|
+
let rangeList = range
|
|
2238
3067
|
.split(' ')
|
|
2239
3068
|
.map(comp => parseComparator(comp, this.options))
|
|
2240
3069
|
.join(' ')
|
|
2241
3070
|
.split(/\s+/)
|
|
2242
3071
|
// >=0.0.0 is equivalent to *
|
|
2243
|
-
.map(comp => replaceGTE0(comp, this.options))
|
|
3072
|
+
.map(comp => replaceGTE0(comp, this.options));
|
|
3073
|
+
|
|
3074
|
+
if (loose) {
|
|
2244
3075
|
// in loose mode, throw out any that are not valid comparators
|
|
2245
|
-
.filter(
|
|
2246
|
-
|
|
3076
|
+
rangeList = rangeList.filter(comp => {
|
|
3077
|
+
debug$2('loose invalid filter', comp, this.options);
|
|
3078
|
+
return !!comp.match(re$1[t$1.COMPARATORLOOSE])
|
|
3079
|
+
});
|
|
3080
|
+
}
|
|
3081
|
+
debug$2('range list', rangeList);
|
|
2247
3082
|
|
|
2248
3083
|
// if any comparators are the null set, then replace with JUST null set
|
|
2249
3084
|
// if more than one comparator, remove any * comparators
|
|
2250
3085
|
// also, don't include the same comparator more than once
|
|
2251
|
-
rangeList.length;
|
|
2252
3086
|
const rangeMap = new Map();
|
|
2253
|
-
|
|
2254
|
-
|
|
3087
|
+
const comparators = rangeList.map(comp => new Comparator$3(comp, this.options));
|
|
3088
|
+
for (const comp of comparators) {
|
|
3089
|
+
if (isNullSet(comp)) {
|
|
2255
3090
|
return [comp]
|
|
3091
|
+
}
|
|
2256
3092
|
rangeMap.set(comp.value, comp);
|
|
2257
3093
|
}
|
|
2258
|
-
if (rangeMap.size > 1 && rangeMap.has(''))
|
|
3094
|
+
if (rangeMap.size > 1 && rangeMap.has('')) {
|
|
2259
3095
|
rangeMap.delete('');
|
|
3096
|
+
}
|
|
2260
3097
|
|
|
2261
3098
|
const result = [...rangeMap.values()];
|
|
2262
3099
|
cache.set(memoKey, result);
|
|
@@ -2321,7 +3158,7 @@ const {
|
|
|
2321
3158
|
t: t$1,
|
|
2322
3159
|
comparatorTrimReplace,
|
|
2323
3160
|
tildeTrimReplace,
|
|
2324
|
-
caretTrimReplace
|
|
3161
|
+
caretTrimReplace,
|
|
2325
3162
|
} = re$5.exports;
|
|
2326
3163
|
|
|
2327
3164
|
const isNullSet = c => c.value === '<0.0.0-0';
|
|
@@ -2370,8 +3207,8 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
|
|
|
2370
3207
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
|
2371
3208
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
|
2372
3209
|
const replaceTildes = (comp, options) =>
|
|
2373
|
-
comp.trim().split(/\s+/).map((
|
|
2374
|
-
return replaceTilde(
|
|
3210
|
+
comp.trim().split(/\s+/).map((c) => {
|
|
3211
|
+
return replaceTilde(c, options)
|
|
2375
3212
|
}).join(' ');
|
|
2376
3213
|
|
|
2377
3214
|
const replaceTilde = (comp, options) => {
|
|
@@ -2409,8 +3246,8 @@ const replaceTilde = (comp, options) => {
|
|
|
2409
3246
|
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
2410
3247
|
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
2411
3248
|
const replaceCarets = (comp, options) =>
|
|
2412
|
-
comp.trim().split(/\s+/).map((
|
|
2413
|
-
return replaceCaret(
|
|
3249
|
+
comp.trim().split(/\s+/).map((c) => {
|
|
3250
|
+
return replaceCaret(c, options)
|
|
2414
3251
|
}).join(' ');
|
|
2415
3252
|
|
|
2416
3253
|
const replaceCaret = (comp, options) => {
|
|
@@ -2468,8 +3305,8 @@ const replaceCaret = (comp, options) => {
|
|
|
2468
3305
|
|
|
2469
3306
|
const replaceXRanges = (comp, options) => {
|
|
2470
3307
|
debug$2('replaceXRanges', comp, options);
|
|
2471
|
-
return comp.split(/\s+/).map((
|
|
2472
|
-
return replaceXRange(
|
|
3308
|
+
return comp.split(/\s+/).map((c) => {
|
|
3309
|
+
return replaceXRange(c, options)
|
|
2473
3310
|
}).join(' ')
|
|
2474
3311
|
};
|
|
2475
3312
|
|
|
@@ -2530,8 +3367,9 @@ const replaceXRange = (comp, options) => {
|
|
|
2530
3367
|
}
|
|
2531
3368
|
}
|
|
2532
3369
|
|
|
2533
|
-
if (gtlt === '<')
|
|
3370
|
+
if (gtlt === '<') {
|
|
2534
3371
|
pr = '-0';
|
|
3372
|
+
}
|
|
2535
3373
|
|
|
2536
3374
|
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2537
3375
|
} else if (xm) {
|
|
@@ -2640,6 +3478,7 @@ class Comparator$2 {
|
|
|
2640
3478
|
static get ANY () {
|
|
2641
3479
|
return ANY$2
|
|
2642
3480
|
}
|
|
3481
|
+
|
|
2643
3482
|
constructor (comp, options) {
|
|
2644
3483
|
options = parseOptions(options);
|
|
2645
3484
|
|
|
@@ -2716,7 +3555,7 @@ class Comparator$2 {
|
|
|
2716
3555
|
if (!options || typeof options !== 'object') {
|
|
2717
3556
|
options = {
|
|
2718
3557
|
loose: !!options,
|
|
2719
|
-
includePrerelease: false
|
|
3558
|
+
includePrerelease: false,
|
|
2720
3559
|
};
|
|
2721
3560
|
}
|
|
2722
3561
|
|
|
@@ -2764,7 +3603,7 @@ class Comparator$2 {
|
|
|
2764
3603
|
var comparator = Comparator$2;
|
|
2765
3604
|
|
|
2766
3605
|
const parseOptions = parseOptions_1;
|
|
2767
|
-
const {re, t} = re$5.exports;
|
|
3606
|
+
const { re, t } = re$5.exports;
|
|
2768
3607
|
const cmp = cmp_1;
|
|
2769
3608
|
const debug$1 = debug_1;
|
|
2770
3609
|
const SemVer$4 = semver$4;
|
|
@@ -2890,8 +3729,9 @@ const minVersion = (range, loose) => {
|
|
|
2890
3729
|
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
|
2891
3730
|
}
|
|
2892
3731
|
});
|
|
2893
|
-
if (setMin && (!minver || gt$1(minver, setMin)))
|
|
3732
|
+
if (setMin && (!minver || gt$1(minver, setMin))) {
|
|
2894
3733
|
minver = setMin;
|
|
3734
|
+
}
|
|
2895
3735
|
}
|
|
2896
3736
|
|
|
2897
3737
|
if (minver && range.test(minver)) {
|
|
@@ -2916,7 +3756,7 @@ var valid = validRange;
|
|
|
2916
3756
|
|
|
2917
3757
|
const SemVer = semver$4;
|
|
2918
3758
|
const Comparator$1 = comparator;
|
|
2919
|
-
const {ANY: ANY$1} = Comparator$1;
|
|
3759
|
+
const { ANY: ANY$1 } = Comparator$1;
|
|
2920
3760
|
const Range$2 = range;
|
|
2921
3761
|
const satisfies$2 = satisfies_1;
|
|
2922
3762
|
const gt = gt_1;
|
|
@@ -3020,38 +3860,41 @@ const satisfies$1 = satisfies_1;
|
|
|
3020
3860
|
const compare$1 = compare_1;
|
|
3021
3861
|
var simplify = (versions, range, options) => {
|
|
3022
3862
|
const set = [];
|
|
3023
|
-
let
|
|
3863
|
+
let first = null;
|
|
3024
3864
|
let prev = null;
|
|
3025
3865
|
const v = versions.sort((a, b) => compare$1(a, b, options));
|
|
3026
3866
|
for (const version of v) {
|
|
3027
3867
|
const included = satisfies$1(version, range, options);
|
|
3028
3868
|
if (included) {
|
|
3029
3869
|
prev = version;
|
|
3030
|
-
if (!
|
|
3031
|
-
|
|
3870
|
+
if (!first) {
|
|
3871
|
+
first = version;
|
|
3872
|
+
}
|
|
3032
3873
|
} else {
|
|
3033
3874
|
if (prev) {
|
|
3034
|
-
set.push([
|
|
3875
|
+
set.push([first, prev]);
|
|
3035
3876
|
}
|
|
3036
3877
|
prev = null;
|
|
3037
|
-
|
|
3878
|
+
first = null;
|
|
3038
3879
|
}
|
|
3039
3880
|
}
|
|
3040
|
-
if (
|
|
3041
|
-
set.push([
|
|
3881
|
+
if (first) {
|
|
3882
|
+
set.push([first, null]);
|
|
3883
|
+
}
|
|
3042
3884
|
|
|
3043
3885
|
const ranges = [];
|
|
3044
3886
|
for (const [min, max] of set) {
|
|
3045
|
-
if (min === max)
|
|
3887
|
+
if (min === max) {
|
|
3046
3888
|
ranges.push(min);
|
|
3047
|
-
else if (!max && min === v[0])
|
|
3889
|
+
} else if (!max && min === v[0]) {
|
|
3048
3890
|
ranges.push('*');
|
|
3049
|
-
else if (!max)
|
|
3891
|
+
} else if (!max) {
|
|
3050
3892
|
ranges.push(`>=${min}`);
|
|
3051
|
-
else if (min === v[0])
|
|
3893
|
+
} else if (min === v[0]) {
|
|
3052
3894
|
ranges.push(`<=${max}`);
|
|
3053
|
-
else
|
|
3895
|
+
} else {
|
|
3054
3896
|
ranges.push(`${min} - ${max}`);
|
|
3897
|
+
}
|
|
3055
3898
|
}
|
|
3056
3899
|
const simplified = ranges.join(' || ');
|
|
3057
3900
|
const original = typeof range.raw === 'string' ? range.raw : String(range);
|
|
@@ -3101,8 +3944,9 @@ const compare = compare_1;
|
|
|
3101
3944
|
// - Else return true
|
|
3102
3945
|
|
|
3103
3946
|
const subset = (sub, dom, options = {}) => {
|
|
3104
|
-
if (sub === dom)
|
|
3947
|
+
if (sub === dom) {
|
|
3105
3948
|
return true
|
|
3949
|
+
}
|
|
3106
3950
|
|
|
3107
3951
|
sub = new Range(sub, options);
|
|
3108
3952
|
dom = new Range(dom, options);
|
|
@@ -3112,73 +3956,84 @@ const subset = (sub, dom, options = {}) => {
|
|
|
3112
3956
|
for (const simpleDom of dom.set) {
|
|
3113
3957
|
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
3114
3958
|
sawNonNull = sawNonNull || isSub !== null;
|
|
3115
|
-
if (isSub)
|
|
3959
|
+
if (isSub) {
|
|
3116
3960
|
continue OUTER
|
|
3961
|
+
}
|
|
3117
3962
|
}
|
|
3118
3963
|
// the null set is a subset of everything, but null simple ranges in
|
|
3119
3964
|
// a complex range should be ignored. so if we saw a non-null range,
|
|
3120
3965
|
// then we know this isn't a subset, but if EVERY simple range was null,
|
|
3121
3966
|
// then it is a subset.
|
|
3122
|
-
if (sawNonNull)
|
|
3967
|
+
if (sawNonNull) {
|
|
3123
3968
|
return false
|
|
3969
|
+
}
|
|
3124
3970
|
}
|
|
3125
3971
|
return true
|
|
3126
3972
|
};
|
|
3127
3973
|
|
|
3128
3974
|
const simpleSubset = (sub, dom, options) => {
|
|
3129
|
-
if (sub === dom)
|
|
3975
|
+
if (sub === dom) {
|
|
3130
3976
|
return true
|
|
3977
|
+
}
|
|
3131
3978
|
|
|
3132
3979
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
3133
|
-
if (dom.length === 1 && dom[0].semver === ANY)
|
|
3980
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3134
3981
|
return true
|
|
3135
|
-
else if (options.includePrerelease)
|
|
3136
|
-
sub = [
|
|
3137
|
-
else
|
|
3138
|
-
sub = [
|
|
3982
|
+
} else if (options.includePrerelease) {
|
|
3983
|
+
sub = [new Comparator('>=0.0.0-0')];
|
|
3984
|
+
} else {
|
|
3985
|
+
sub = [new Comparator('>=0.0.0')];
|
|
3986
|
+
}
|
|
3139
3987
|
}
|
|
3140
3988
|
|
|
3141
3989
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3142
|
-
if (options.includePrerelease)
|
|
3990
|
+
if (options.includePrerelease) {
|
|
3143
3991
|
return true
|
|
3144
|
-
else
|
|
3145
|
-
dom = [
|
|
3992
|
+
} else {
|
|
3993
|
+
dom = [new Comparator('>=0.0.0')];
|
|
3994
|
+
}
|
|
3146
3995
|
}
|
|
3147
3996
|
|
|
3148
3997
|
const eqSet = new Set();
|
|
3149
3998
|
let gt, lt;
|
|
3150
3999
|
for (const c of sub) {
|
|
3151
|
-
if (c.operator === '>' || c.operator === '>=')
|
|
4000
|
+
if (c.operator === '>' || c.operator === '>=') {
|
|
3152
4001
|
gt = higherGT(gt, c, options);
|
|
3153
|
-
else if (c.operator === '<' || c.operator === '<=')
|
|
4002
|
+
} else if (c.operator === '<' || c.operator === '<=') {
|
|
3154
4003
|
lt = lowerLT(lt, c, options);
|
|
3155
|
-
else
|
|
4004
|
+
} else {
|
|
3156
4005
|
eqSet.add(c.semver);
|
|
4006
|
+
}
|
|
3157
4007
|
}
|
|
3158
4008
|
|
|
3159
|
-
if (eqSet.size > 1)
|
|
4009
|
+
if (eqSet.size > 1) {
|
|
3160
4010
|
return null
|
|
4011
|
+
}
|
|
3161
4012
|
|
|
3162
4013
|
let gtltComp;
|
|
3163
4014
|
if (gt && lt) {
|
|
3164
4015
|
gtltComp = compare(gt.semver, lt.semver, options);
|
|
3165
|
-
if (gtltComp > 0)
|
|
4016
|
+
if (gtltComp > 0) {
|
|
3166
4017
|
return null
|
|
3167
|
-
else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
|
|
4018
|
+
} else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
|
|
3168
4019
|
return null
|
|
4020
|
+
}
|
|
3169
4021
|
}
|
|
3170
4022
|
|
|
3171
4023
|
// will iterate one or zero times
|
|
3172
4024
|
for (const eq of eqSet) {
|
|
3173
|
-
if (gt && !satisfies(eq, String(gt), options))
|
|
4025
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
3174
4026
|
return null
|
|
4027
|
+
}
|
|
3175
4028
|
|
|
3176
|
-
if (lt && !satisfies(eq, String(lt), options))
|
|
4029
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
3177
4030
|
return null
|
|
4031
|
+
}
|
|
3178
4032
|
|
|
3179
4033
|
for (const c of dom) {
|
|
3180
|
-
if (!satisfies(eq, String(c), options))
|
|
4034
|
+
if (!satisfies(eq, String(c), options)) {
|
|
3181
4035
|
return false
|
|
4036
|
+
}
|
|
3182
4037
|
}
|
|
3183
4038
|
|
|
3184
4039
|
return true
|
|
@@ -3214,10 +4069,12 @@ const simpleSubset = (sub, dom, options) => {
|
|
|
3214
4069
|
}
|
|
3215
4070
|
if (c.operator === '>' || c.operator === '>=') {
|
|
3216
4071
|
higher = higherGT(gt, c, options);
|
|
3217
|
-
if (higher === c && higher !== gt)
|
|
4072
|
+
if (higher === c && higher !== gt) {
|
|
3218
4073
|
return false
|
|
3219
|
-
|
|
4074
|
+
}
|
|
4075
|
+
} else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
|
|
3220
4076
|
return false
|
|
4077
|
+
}
|
|
3221
4078
|
}
|
|
3222
4079
|
if (lt) {
|
|
3223
4080
|
if (needDomLTPre) {
|
|
@@ -3230,37 +4087,44 @@ const simpleSubset = (sub, dom, options) => {
|
|
|
3230
4087
|
}
|
|
3231
4088
|
if (c.operator === '<' || c.operator === '<=') {
|
|
3232
4089
|
lower = lowerLT(lt, c, options);
|
|
3233
|
-
if (lower === c && lower !== lt)
|
|
4090
|
+
if (lower === c && lower !== lt) {
|
|
3234
4091
|
return false
|
|
3235
|
-
|
|
4092
|
+
}
|
|
4093
|
+
} else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
|
|
3236
4094
|
return false
|
|
4095
|
+
}
|
|
3237
4096
|
}
|
|
3238
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0)
|
|
4097
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
3239
4098
|
return false
|
|
4099
|
+
}
|
|
3240
4100
|
}
|
|
3241
4101
|
|
|
3242
4102
|
// if there was a < or >, and nothing in the dom, then must be false
|
|
3243
4103
|
// UNLESS it was limited by another range in the other direction.
|
|
3244
4104
|
// Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
|
|
3245
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0)
|
|
4105
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
3246
4106
|
return false
|
|
4107
|
+
}
|
|
3247
4108
|
|
|
3248
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0)
|
|
4109
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
3249
4110
|
return false
|
|
4111
|
+
}
|
|
3250
4112
|
|
|
3251
4113
|
// we needed a prerelease range in a specific tuple, but didn't get one
|
|
3252
4114
|
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
|
|
3253
4115
|
// because it includes prereleases in the 1.2.3 tuple
|
|
3254
|
-
if (needDomGTPre || needDomLTPre)
|
|
4116
|
+
if (needDomGTPre || needDomLTPre) {
|
|
3255
4117
|
return false
|
|
4118
|
+
}
|
|
3256
4119
|
|
|
3257
4120
|
return true
|
|
3258
4121
|
};
|
|
3259
4122
|
|
|
3260
4123
|
// >=1.2.3 is lower than >1.2.3
|
|
3261
4124
|
const higherGT = (a, b, options) => {
|
|
3262
|
-
if (!a)
|
|
4125
|
+
if (!a) {
|
|
3263
4126
|
return b
|
|
4127
|
+
}
|
|
3264
4128
|
const comp = compare(a.semver, b.semver, options);
|
|
3265
4129
|
return comp > 0 ? a
|
|
3266
4130
|
: comp < 0 ? b
|
|
@@ -3270,8 +4134,9 @@ const higherGT = (a, b, options) => {
|
|
|
3270
4134
|
|
|
3271
4135
|
// <=1.2.3 is higher than <1.2.3
|
|
3272
4136
|
const lowerLT = (a, b, options) => {
|
|
3273
|
-
if (!a)
|
|
4137
|
+
if (!a) {
|
|
3274
4138
|
return b
|
|
4139
|
+
}
|
|
3275
4140
|
const comp = compare(a.semver, b.semver, options);
|
|
3276
4141
|
return comp < 0 ? a
|
|
3277
4142
|
: comp > 0 ? b
|
|
@@ -3861,13 +4726,13 @@ function patch$1 (fs) {
|
|
|
3861
4726
|
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
3862
4727
|
|
|
3863
4728
|
// if lchmod/lchown do not exist, then make them no-ops
|
|
3864
|
-
if (!fs.lchmod) {
|
|
4729
|
+
if (fs.chmod && !fs.lchmod) {
|
|
3865
4730
|
fs.lchmod = function (path, mode, cb) {
|
|
3866
4731
|
if (cb) process.nextTick(cb);
|
|
3867
4732
|
};
|
|
3868
4733
|
fs.lchmodSync = function () {};
|
|
3869
4734
|
}
|
|
3870
|
-
if (!fs.lchown) {
|
|
4735
|
+
if (fs.chown && !fs.lchown) {
|
|
3871
4736
|
fs.lchown = function (path, uid, gid, cb) {
|
|
3872
4737
|
if (cb) process.nextTick(cb);
|
|
3873
4738
|
};
|
|
@@ -3884,32 +4749,38 @@ function patch$1 (fs) {
|
|
|
3884
4749
|
// CPU to a busy looping process, which can cause the program causing the lock
|
|
3885
4750
|
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
3886
4751
|
if (platform === "win32") {
|
|
3887
|
-
fs.rename =
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
backoff
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
4752
|
+
fs.rename = typeof fs.rename !== 'function' ? fs.rename
|
|
4753
|
+
: (function (fs$rename) {
|
|
4754
|
+
function rename (from, to, cb) {
|
|
4755
|
+
var start = Date.now();
|
|
4756
|
+
var backoff = 0;
|
|
4757
|
+
fs$rename(from, to, function CB (er) {
|
|
4758
|
+
if (er
|
|
4759
|
+
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
4760
|
+
&& Date.now() - start < 60000) {
|
|
4761
|
+
setTimeout(function() {
|
|
4762
|
+
fs.stat(to, function (stater, st) {
|
|
4763
|
+
if (stater && stater.code === "ENOENT")
|
|
4764
|
+
fs$rename(from, to, CB);
|
|
4765
|
+
else
|
|
4766
|
+
cb(er);
|
|
4767
|
+
});
|
|
4768
|
+
}, backoff);
|
|
4769
|
+
if (backoff < 100)
|
|
4770
|
+
backoff += 10;
|
|
4771
|
+
return;
|
|
4772
|
+
}
|
|
4773
|
+
if (cb) cb(er);
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
4777
|
+
return rename
|
|
4778
|
+
})(fs.rename);
|
|
3909
4779
|
}
|
|
3910
4780
|
|
|
3911
4781
|
// if read() returns EAGAIN, then just try it again.
|
|
3912
|
-
fs.read =
|
|
4782
|
+
fs.read = typeof fs.read !== 'function' ? fs.read
|
|
4783
|
+
: (function (fs$read) {
|
|
3913
4784
|
function read (fd, buffer, offset, length, position, callback_) {
|
|
3914
4785
|
var callback;
|
|
3915
4786
|
if (callback_ && typeof callback_ === 'function') {
|
|
@@ -3930,7 +4801,8 @@ function patch$1 (fs) {
|
|
|
3930
4801
|
return read
|
|
3931
4802
|
})(fs.read);
|
|
3932
4803
|
|
|
3933
|
-
fs.readSync =
|
|
4804
|
+
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
|
|
4805
|
+
: (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
3934
4806
|
var eagCounter = 0;
|
|
3935
4807
|
while (true) {
|
|
3936
4808
|
try {
|
|
@@ -3989,7 +4861,7 @@ function patch$1 (fs) {
|
|
|
3989
4861
|
}
|
|
3990
4862
|
|
|
3991
4863
|
function patchLutimes (fs) {
|
|
3992
|
-
if (constants.hasOwnProperty("O_SYMLINK")) {
|
|
4864
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
3993
4865
|
fs.lutimes = function (path, at, mt, cb) {
|
|
3994
4866
|
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
3995
4867
|
if (er) {
|
|
@@ -4023,7 +4895,7 @@ function patch$1 (fs) {
|
|
|
4023
4895
|
return ret
|
|
4024
4896
|
};
|
|
4025
4897
|
|
|
4026
|
-
} else {
|
|
4898
|
+
} else if (fs.futimes) {
|
|
4027
4899
|
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb); };
|
|
4028
4900
|
fs.lutimesSync = function () {};
|
|
4029
4901
|
}
|
|
@@ -4471,16 +5343,35 @@ function patch (fs) {
|
|
|
4471
5343
|
|
|
4472
5344
|
var fs$readdir = fs.readdir;
|
|
4473
5345
|
fs.readdir = readdir;
|
|
5346
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
4474
5347
|
function readdir (path, options, cb) {
|
|
4475
5348
|
if (typeof options === 'function')
|
|
4476
5349
|
cb = options, options = null;
|
|
4477
5350
|
|
|
5351
|
+
var go$readdir = noReaddirOptionVersions.test(process.version)
|
|
5352
|
+
? function go$readdir (path, options, cb, startTime) {
|
|
5353
|
+
return fs$readdir(path, fs$readdirCallback(
|
|
5354
|
+
path, options, cb, startTime
|
|
5355
|
+
))
|
|
5356
|
+
}
|
|
5357
|
+
: function go$readdir (path, options, cb, startTime) {
|
|
5358
|
+
return fs$readdir(path, options, fs$readdirCallback(
|
|
5359
|
+
path, options, cb, startTime
|
|
5360
|
+
))
|
|
5361
|
+
};
|
|
5362
|
+
|
|
4478
5363
|
return go$readdir(path, options, cb)
|
|
4479
5364
|
|
|
4480
|
-
function
|
|
4481
|
-
return
|
|
5365
|
+
function fs$readdirCallback (path, options, cb, startTime) {
|
|
5366
|
+
return function (err, files) {
|
|
4482
5367
|
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
4483
|
-
enqueue([
|
|
5368
|
+
enqueue([
|
|
5369
|
+
go$readdir,
|
|
5370
|
+
[path, options, cb],
|
|
5371
|
+
err,
|
|
5372
|
+
startTime || Date.now(),
|
|
5373
|
+
Date.now()
|
|
5374
|
+
]);
|
|
4484
5375
|
else {
|
|
4485
5376
|
if (files && files.sort)
|
|
4486
5377
|
files.sort();
|
|
@@ -4488,7 +5379,7 @@ function patch (fs) {
|
|
|
4488
5379
|
if (typeof cb === 'function')
|
|
4489
5380
|
cb.call(this, err, files);
|
|
4490
5381
|
}
|
|
4491
|
-
}
|
|
5382
|
+
}
|
|
4492
5383
|
}
|
|
4493
5384
|
}
|
|
4494
5385
|
|
|
@@ -7190,7 +8081,7 @@ let tokenize;
|
|
|
7190
8081
|
return "keyword";
|
|
7191
8082
|
}
|
|
7192
8083
|
|
|
7193
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.
|
|
8084
|
+
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
|
|
7194
8085
|
return "jsxIdentifier";
|
|
7195
8086
|
}
|
|
7196
8087
|
|
|
@@ -10515,6 +11406,6 @@ async function updateConfig(project, codecovCfg, opts) {
|
|
|
10515
11406
|
}
|
|
10516
11407
|
|
|
10517
11408
|
exports.updateConfig = updateConfig;
|
|
10518
|
-
// BUILD:
|
|
11409
|
+
// BUILD: Mon Apr 11 2022 12:12:52 GMT+0000 (Coordinated Universal Time)
|
|
10519
11410
|
|
|
10520
11411
|
//# sourceMappingURL=index.js.map
|