@donmahallem/lerna2codecov 0.1.6 → 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 +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -759,7 +759,7 @@ const naiveLength = () => 1;
|
|
|
759
759
|
//
|
|
760
760
|
// cache is a Map (or PseudoMap) that matches the keys to
|
|
761
761
|
// the Yallist.Node object.
|
|
762
|
-
class LRUCache {
|
|
762
|
+
class LRUCache$1 {
|
|
763
763
|
constructor (options) {
|
|
764
764
|
if (typeof options === 'number')
|
|
765
765
|
options = { max: options };
|
|
@@ -1066,12 +1066,12 @@ const forEachStep = (self, fn, node, thisp) => {
|
|
|
1066
1066
|
fn.call(thisp, hit.value, hit.key, self);
|
|
1067
1067
|
};
|
|
1068
1068
|
|
|
1069
|
-
var lruCache = LRUCache;
|
|
1069
|
+
var lruCache$1 = LRUCache$1;
|
|
1070
1070
|
|
|
1071
1071
|
const url$1 = require$$0$1;
|
|
1072
1072
|
const gitHosts = gitHostInfo;
|
|
1073
1073
|
const GitHost = hostedGitInfo.exports = gitHost;
|
|
1074
|
-
const LRU$1 = lruCache;
|
|
1074
|
+
const LRU$1 = lruCache$1;
|
|
1075
1075
|
const cache$1 = new LRU$1({ max: 1000 });
|
|
1076
1076
|
|
|
1077
1077
|
const protocolToRepresentationMap = {
|
|
@@ -1313,7 +1313,7 @@ const SEMVER_SPEC_VERSION = '2.0.0';
|
|
|
1313
1313
|
|
|
1314
1314
|
const MAX_LENGTH$2 = 256;
|
|
1315
1315
|
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
|
|
1316
|
-
|
|
1316
|
+
/* istanbul ignore next */ 9007199254740991;
|
|
1317
1317
|
|
|
1318
1318
|
// Max safe segment length for coercion.
|
|
1319
1319
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
@@ -1322,7 +1322,7 @@ var constants$1 = {
|
|
|
1322
1322
|
SEMVER_SPEC_VERSION,
|
|
1323
1323
|
MAX_LENGTH: MAX_LENGTH$2,
|
|
1324
1324
|
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
1325
|
-
MAX_SAFE_COMPONENT_LENGTH
|
|
1325
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
1326
1326
|
};
|
|
1327
1327
|
|
|
1328
1328
|
const debug$4 = (
|
|
@@ -1348,7 +1348,7 @@ let R = 0;
|
|
|
1348
1348
|
|
|
1349
1349
|
const createToken = (name, value, isGlobal) => {
|
|
1350
1350
|
const index = R++;
|
|
1351
|
-
debug(index, value);
|
|
1351
|
+
debug(name, index, value);
|
|
1352
1352
|
t[name] = index;
|
|
1353
1353
|
src[index] = value;
|
|
1354
1354
|
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
@@ -1516,8 +1516,8 @@ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
|
1516
1516
|
// Star ranges basically just allow anything at all.
|
|
1517
1517
|
createToken('STAR', '(<|>)?=?\\s*\\*');
|
|
1518
1518
|
// >=0.0.0 is like a star
|
|
1519
|
-
createToken('GTE0', '^\\s*>=\\s*0
|
|
1520
|
-
createToken('GTE0PRE', '^\\s*>=\\s*0
|
|
1519
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
|
1520
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
1521
1521
|
}(re$5, re$5.exports));
|
|
1522
1522
|
|
|
1523
1523
|
// parse out just the options we care about so we always get a consistent
|
|
@@ -1526,9 +1526,9 @@ const opts = ['includePrerelease', 'loose', 'rtl'];
|
|
|
1526
1526
|
const parseOptions$4 = options =>
|
|
1527
1527
|
!options ? {}
|
|
1528
1528
|
: typeof options !== 'object' ? { loose: true }
|
|
1529
|
-
: opts.filter(k => options[k]).reduce((
|
|
1530
|
-
|
|
1531
|
-
return
|
|
1529
|
+
: opts.filter(k => options[k]).reduce((o, k) => {
|
|
1530
|
+
o[k] = true;
|
|
1531
|
+
return o
|
|
1532
1532
|
}, {});
|
|
1533
1533
|
var parseOptions_1 = parseOptions$4;
|
|
1534
1534
|
|
|
@@ -1553,7 +1553,7 @@ const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
|
1553
1553
|
|
|
1554
1554
|
var identifiers = {
|
|
1555
1555
|
compareIdentifiers: compareIdentifiers$1,
|
|
1556
|
-
rcompareIdentifiers
|
|
1556
|
+
rcompareIdentifiers,
|
|
1557
1557
|
};
|
|
1558
1558
|
|
|
1559
1559
|
const debug$3 = debug_1;
|
|
@@ -1844,7 +1844,7 @@ class SemVer$e {
|
|
|
1844
1844
|
|
|
1845
1845
|
var semver$4 = SemVer$e;
|
|
1846
1846
|
|
|
1847
|
-
const {MAX_LENGTH} = constants$1;
|
|
1847
|
+
const { MAX_LENGTH } = constants$1;
|
|
1848
1848
|
const { re: re$3, t: t$3 } = re$5.exports;
|
|
1849
1849
|
const SemVer$d = semver$4;
|
|
1850
1850
|
|
|
@@ -2015,17 +2015,21 @@ const lte$1 = lte_1;
|
|
|
2015
2015
|
const cmp$1 = (a, op, b, loose) => {
|
|
2016
2016
|
switch (op) {
|
|
2017
2017
|
case '===':
|
|
2018
|
-
if (typeof a === 'object')
|
|
2018
|
+
if (typeof a === 'object') {
|
|
2019
2019
|
a = a.version;
|
|
2020
|
-
|
|
2020
|
+
}
|
|
2021
|
+
if (typeof b === 'object') {
|
|
2021
2022
|
b = b.version;
|
|
2023
|
+
}
|
|
2022
2024
|
return a === b
|
|
2023
2025
|
|
|
2024
2026
|
case '!==':
|
|
2025
|
-
if (typeof a === 'object')
|
|
2027
|
+
if (typeof a === 'object') {
|
|
2026
2028
|
a = a.version;
|
|
2027
|
-
|
|
2029
|
+
}
|
|
2030
|
+
if (typeof b === 'object') {
|
|
2028
2031
|
b = b.version;
|
|
2032
|
+
}
|
|
2029
2033
|
return a !== b
|
|
2030
2034
|
|
|
2031
2035
|
case '':
|
|
@@ -2056,7 +2060,7 @@ var cmp_1 = cmp$1;
|
|
|
2056
2060
|
|
|
2057
2061
|
const SemVer$6 = semver$4;
|
|
2058
2062
|
const parse$1 = parse_1;
|
|
2059
|
-
const {re: re$2, t: t$2} = re$5.exports;
|
|
2063
|
+
const { re: re$2, t: t$2 } = re$5.exports;
|
|
2060
2064
|
|
|
2061
2065
|
const coerce = (version, options) => {
|
|
2062
2066
|
if (version instanceof SemVer$6) {
|
|
@@ -2099,13 +2103,838 @@ const coerce = (version, options) => {
|
|
|
2099
2103
|
re$2[t$2.COERCERTL].lastIndex = -1;
|
|
2100
2104
|
}
|
|
2101
2105
|
|
|
2102
|
-
if (match === null)
|
|
2106
|
+
if (match === null) {
|
|
2103
2107
|
return null
|
|
2108
|
+
}
|
|
2104
2109
|
|
|
2105
2110
|
return parse$1(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
|
|
2106
2111
|
};
|
|
2107
2112
|
var coerce_1 = coerce;
|
|
2108
2113
|
|
|
2114
|
+
const perf = typeof performance === 'object' && performance &&
|
|
2115
|
+
typeof performance.now === 'function' ? performance : Date;
|
|
2116
|
+
|
|
2117
|
+
const hasAbortController = typeof AbortController !== 'undefined';
|
|
2118
|
+
|
|
2119
|
+
// minimal backwards-compatibility polyfill
|
|
2120
|
+
const AC = hasAbortController ? AbortController : Object.assign(
|
|
2121
|
+
class AbortController {
|
|
2122
|
+
constructor () { this.signal = new AC.AbortSignal; }
|
|
2123
|
+
abort () { this.signal.aborted = true; }
|
|
2124
|
+
},
|
|
2125
|
+
{ AbortSignal: class AbortSignal { constructor () { this.aborted = false; }}}
|
|
2126
|
+
);
|
|
2127
|
+
|
|
2128
|
+
const warned = new Set();
|
|
2129
|
+
const deprecatedOption = (opt, instead) => {
|
|
2130
|
+
const code = `LRU_CACHE_OPTION_${opt}`;
|
|
2131
|
+
if (shouldWarn(code)) {
|
|
2132
|
+
warn(code, `${opt} option`, `options.${instead}`, LRUCache);
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
const deprecatedMethod = (method, instead) => {
|
|
2136
|
+
const code = `LRU_CACHE_METHOD_${method}`;
|
|
2137
|
+
if (shouldWarn(code)) {
|
|
2138
|
+
const { prototype } = LRUCache;
|
|
2139
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, method);
|
|
2140
|
+
warn(code, `${method} method`, `cache.${instead}()`, get);
|
|
2141
|
+
}
|
|
2142
|
+
};
|
|
2143
|
+
const deprecatedProperty = (field, instead) => {
|
|
2144
|
+
const code = `LRU_CACHE_PROPERTY_${field}`;
|
|
2145
|
+
if (shouldWarn(code)) {
|
|
2146
|
+
const { prototype } = LRUCache;
|
|
2147
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, field);
|
|
2148
|
+
warn(code, `${field} property`, `cache.${instead}`, get);
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2151
|
+
|
|
2152
|
+
const emitWarning = (...a) => {
|
|
2153
|
+
typeof process === 'object' &&
|
|
2154
|
+
process &&
|
|
2155
|
+
typeof process.emitWarning === 'function'
|
|
2156
|
+
? process.emitWarning(...a)
|
|
2157
|
+
: console.error(...a);
|
|
2158
|
+
};
|
|
2159
|
+
|
|
2160
|
+
const shouldWarn = code => !warned.has(code);
|
|
2161
|
+
|
|
2162
|
+
const warn = (code, what, instead, fn) => {
|
|
2163
|
+
warned.add(code);
|
|
2164
|
+
const msg = `The ${what} is deprecated. Please use ${instead} instead.`;
|
|
2165
|
+
emitWarning(msg, 'DeprecationWarning', code, fn);
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
2169
|
+
|
|
2170
|
+
/* istanbul ignore next - This is a little bit ridiculous, tbh.
|
|
2171
|
+
* The maximum array length is 2^32-1 or thereabouts on most JS impls.
|
|
2172
|
+
* And well before that point, you're caching the entire world, I mean,
|
|
2173
|
+
* that's ~32GB of just integers for the next/prev links, plus whatever
|
|
2174
|
+
* else to hold that many keys and values. Just filling the memory with
|
|
2175
|
+
* zeroes at init time is brutal when you get that big.
|
|
2176
|
+
* But why not be complete?
|
|
2177
|
+
* Maybe in the future, these limits will have expanded. */
|
|
2178
|
+
const getUintArray = max => !isPosInt(max) ? null
|
|
2179
|
+
: max <= Math.pow(2, 8) ? Uint8Array
|
|
2180
|
+
: max <= Math.pow(2, 16) ? Uint16Array
|
|
2181
|
+
: max <= Math.pow(2, 32) ? Uint32Array
|
|
2182
|
+
: max <= Number.MAX_SAFE_INTEGER ? ZeroArray
|
|
2183
|
+
: null;
|
|
2184
|
+
|
|
2185
|
+
class ZeroArray extends Array {
|
|
2186
|
+
constructor (size) {
|
|
2187
|
+
super(size);
|
|
2188
|
+
this.fill(0);
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
class Stack {
|
|
2193
|
+
constructor (max) {
|
|
2194
|
+
if (max === 0) {
|
|
2195
|
+
return []
|
|
2196
|
+
}
|
|
2197
|
+
const UintArray = getUintArray(max);
|
|
2198
|
+
this.heap = new UintArray(max);
|
|
2199
|
+
this.length = 0;
|
|
2200
|
+
}
|
|
2201
|
+
push (n) {
|
|
2202
|
+
this.heap[this.length++] = n;
|
|
2203
|
+
}
|
|
2204
|
+
pop () {
|
|
2205
|
+
return this.heap[--this.length]
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
class LRUCache {
|
|
2210
|
+
constructor (options = {}) {
|
|
2211
|
+
const {
|
|
2212
|
+
max = 0,
|
|
2213
|
+
ttl,
|
|
2214
|
+
ttlResolution = 1,
|
|
2215
|
+
ttlAutopurge,
|
|
2216
|
+
updateAgeOnGet,
|
|
2217
|
+
updateAgeOnHas,
|
|
2218
|
+
allowStale,
|
|
2219
|
+
dispose,
|
|
2220
|
+
disposeAfter,
|
|
2221
|
+
noDisposeOnSet,
|
|
2222
|
+
noUpdateTTL,
|
|
2223
|
+
maxSize = 0,
|
|
2224
|
+
sizeCalculation,
|
|
2225
|
+
fetchMethod,
|
|
2226
|
+
} = options;
|
|
2227
|
+
|
|
2228
|
+
// deprecated options, don't trigger a warning for getting them if
|
|
2229
|
+
// the thing being passed in is another LRUCache we're copying.
|
|
2230
|
+
const {
|
|
2231
|
+
length,
|
|
2232
|
+
maxAge,
|
|
2233
|
+
stale,
|
|
2234
|
+
} = options instanceof LRUCache ? {} : options;
|
|
2235
|
+
|
|
2236
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
2237
|
+
throw new TypeError('max option must be a nonnegative integer')
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
2241
|
+
if (!UintArray) {
|
|
2242
|
+
throw new Error('invalid max value: ' + max)
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
this.max = max;
|
|
2246
|
+
this.maxSize = maxSize;
|
|
2247
|
+
this.sizeCalculation = sizeCalculation || length;
|
|
2248
|
+
if (this.sizeCalculation) {
|
|
2249
|
+
if (!this.maxSize) {
|
|
2250
|
+
throw new TypeError('cannot set sizeCalculation without setting maxSize')
|
|
2251
|
+
}
|
|
2252
|
+
if (typeof this.sizeCalculation !== 'function') {
|
|
2253
|
+
throw new TypeError('sizeCalculation set to non-function')
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
this.fetchMethod = fetchMethod || null;
|
|
2258
|
+
if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
|
|
2259
|
+
throw new TypeError('fetchMethod must be a function if specified')
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
this.keyMap = new Map();
|
|
2263
|
+
this.keyList = new Array(max).fill(null);
|
|
2264
|
+
this.valList = new Array(max).fill(null);
|
|
2265
|
+
this.next = new UintArray(max);
|
|
2266
|
+
this.prev = new UintArray(max);
|
|
2267
|
+
this.head = 0;
|
|
2268
|
+
this.tail = 0;
|
|
2269
|
+
this.free = new Stack(max);
|
|
2270
|
+
this.initialFill = 1;
|
|
2271
|
+
this.size = 0;
|
|
2272
|
+
|
|
2273
|
+
if (typeof dispose === 'function') {
|
|
2274
|
+
this.dispose = dispose;
|
|
2275
|
+
}
|
|
2276
|
+
if (typeof disposeAfter === 'function') {
|
|
2277
|
+
this.disposeAfter = disposeAfter;
|
|
2278
|
+
this.disposed = [];
|
|
2279
|
+
} else {
|
|
2280
|
+
this.disposeAfter = null;
|
|
2281
|
+
this.disposed = null;
|
|
2282
|
+
}
|
|
2283
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
2284
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
2285
|
+
|
|
2286
|
+
if (this.maxSize !== 0) {
|
|
2287
|
+
if (!isPosInt(this.maxSize)) {
|
|
2288
|
+
throw new TypeError('maxSize must be a positive integer if specified')
|
|
2289
|
+
}
|
|
2290
|
+
this.initializeSizeTracking();
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
this.allowStale = !!allowStale || !!stale;
|
|
2294
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
2295
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
2296
|
+
this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0
|
|
2297
|
+
? ttlResolution : 1;
|
|
2298
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
2299
|
+
this.ttl = ttl || maxAge || 0;
|
|
2300
|
+
if (this.ttl) {
|
|
2301
|
+
if (!isPosInt(this.ttl)) {
|
|
2302
|
+
throw new TypeError('ttl must be a positive integer if specified')
|
|
2303
|
+
}
|
|
2304
|
+
this.initializeTTLTracking();
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
// do not allow completely unbounded caches
|
|
2308
|
+
if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
|
|
2309
|
+
throw new TypeError('At least one of max, maxSize, or ttl is required')
|
|
2310
|
+
}
|
|
2311
|
+
if (!this.ttlAutopurge && !this.max && !this.maxSize) {
|
|
2312
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
2313
|
+
if (shouldWarn(code)) {
|
|
2314
|
+
warned.add(code);
|
|
2315
|
+
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' +
|
|
2316
|
+
'result in unbounded memory consumption.';
|
|
2317
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
if (stale) {
|
|
2322
|
+
deprecatedOption('stale', 'allowStale');
|
|
2323
|
+
}
|
|
2324
|
+
if (maxAge) {
|
|
2325
|
+
deprecatedOption('maxAge', 'ttl');
|
|
2326
|
+
}
|
|
2327
|
+
if (length) {
|
|
2328
|
+
deprecatedOption('length', 'sizeCalculation');
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
getRemainingTTL (key) {
|
|
2333
|
+
return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
initializeTTLTracking () {
|
|
2337
|
+
this.ttls = new ZeroArray(this.max);
|
|
2338
|
+
this.starts = new ZeroArray(this.max);
|
|
2339
|
+
|
|
2340
|
+
this.setItemTTL = (index, ttl) => {
|
|
2341
|
+
this.starts[index] = ttl !== 0 ? perf.now() : 0;
|
|
2342
|
+
this.ttls[index] = ttl;
|
|
2343
|
+
if (ttl !== 0 && this.ttlAutopurge) {
|
|
2344
|
+
const t = setTimeout(() => {
|
|
2345
|
+
if (this.isStale(index)) {
|
|
2346
|
+
this.delete(this.keyList[index]);
|
|
2347
|
+
}
|
|
2348
|
+
}, ttl + 1);
|
|
2349
|
+
/* istanbul ignore else - unref() not supported on all platforms */
|
|
2350
|
+
if (t.unref) {
|
|
2351
|
+
t.unref();
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
this.updateItemAge = (index) => {
|
|
2357
|
+
this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0;
|
|
2358
|
+
};
|
|
2359
|
+
|
|
2360
|
+
// debounce calls to perf.now() to 1s so we're not hitting
|
|
2361
|
+
// that costly call repeatedly.
|
|
2362
|
+
let cachedNow = 0;
|
|
2363
|
+
const getNow = () => {
|
|
2364
|
+
const n = perf.now();
|
|
2365
|
+
if (this.ttlResolution > 0) {
|
|
2366
|
+
cachedNow = n;
|
|
2367
|
+
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
2368
|
+
/* istanbul ignore else - not available on all platforms */
|
|
2369
|
+
if (t.unref) {
|
|
2370
|
+
t.unref();
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
return n
|
|
2374
|
+
};
|
|
2375
|
+
|
|
2376
|
+
this.getRemainingTTL = (key) => {
|
|
2377
|
+
const index = this.keyMap.get(key);
|
|
2378
|
+
if (index === undefined) {
|
|
2379
|
+
return 0
|
|
2380
|
+
}
|
|
2381
|
+
return this.ttls[index] === 0 || this.starts[index] === 0 ? Infinity
|
|
2382
|
+
: ((this.starts[index] + this.ttls[index]) - (cachedNow || getNow()))
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
this.isStale = (index) => {
|
|
2386
|
+
return this.ttls[index] !== 0 && this.starts[index] !== 0 &&
|
|
2387
|
+
((cachedNow || getNow()) - this.starts[index] > this.ttls[index])
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
updateItemAge (index) {}
|
|
2391
|
+
setItemTTL (index, ttl) {}
|
|
2392
|
+
isStale (index) { return false }
|
|
2393
|
+
|
|
2394
|
+
initializeSizeTracking () {
|
|
2395
|
+
this.calculatedSize = 0;
|
|
2396
|
+
this.sizes = new ZeroArray(this.max);
|
|
2397
|
+
this.removeItemSize = index => this.calculatedSize -= this.sizes[index];
|
|
2398
|
+
this.requireSize = (k, v, size, sizeCalculation) => {
|
|
2399
|
+
if (!isPosInt(size)) {
|
|
2400
|
+
if (sizeCalculation) {
|
|
2401
|
+
if (typeof sizeCalculation !== 'function') {
|
|
2402
|
+
throw new TypeError('sizeCalculation must be a function')
|
|
2403
|
+
}
|
|
2404
|
+
size = sizeCalculation(v, k);
|
|
2405
|
+
if (!isPosInt(size)) {
|
|
2406
|
+
throw new TypeError('sizeCalculation return invalid (expect positive integer)')
|
|
2407
|
+
}
|
|
2408
|
+
} else {
|
|
2409
|
+
throw new TypeError('invalid size value (must be positive integer)')
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
return size
|
|
2413
|
+
};
|
|
2414
|
+
this.addItemSize = (index, v, k, size) => {
|
|
2415
|
+
this.sizes[index] = size;
|
|
2416
|
+
const maxSize = this.maxSize - this.sizes[index];
|
|
2417
|
+
while (this.calculatedSize > maxSize) {
|
|
2418
|
+
this.evict(true);
|
|
2419
|
+
}
|
|
2420
|
+
this.calculatedSize += this.sizes[index];
|
|
2421
|
+
};
|
|
2422
|
+
this.delete = k => {
|
|
2423
|
+
if (this.size !== 0) {
|
|
2424
|
+
const index = this.keyMap.get(k);
|
|
2425
|
+
if (index !== undefined) {
|
|
2426
|
+
this.calculatedSize -= this.sizes[index];
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2429
|
+
return LRUCache.prototype.delete.call(this, k)
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
removeItemSize (index) {}
|
|
2433
|
+
addItemSize (index, v, k, size) {}
|
|
2434
|
+
requireSize (k, v, size, sizeCalculation) {
|
|
2435
|
+
if (size || sizeCalculation) {
|
|
2436
|
+
throw new TypeError('cannot set size without setting maxSize on cache')
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
*indexes ({ allowStale = this.allowStale } = {}) {
|
|
2441
|
+
if (this.size) {
|
|
2442
|
+
for (let i = this.tail; true; ) {
|
|
2443
|
+
if (!this.isValidIndex(i)) {
|
|
2444
|
+
break
|
|
2445
|
+
}
|
|
2446
|
+
if (allowStale || !this.isStale(i)) {
|
|
2447
|
+
yield i;
|
|
2448
|
+
}
|
|
2449
|
+
if (i === this.head) {
|
|
2450
|
+
break
|
|
2451
|
+
} else {
|
|
2452
|
+
i = this.prev[i];
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
*rindexes ({ allowStale = this.allowStale } = {}) {
|
|
2459
|
+
if (this.size) {
|
|
2460
|
+
for (let i = this.head; true; ) {
|
|
2461
|
+
if (!this.isValidIndex(i)) {
|
|
2462
|
+
break
|
|
2463
|
+
}
|
|
2464
|
+
if (allowStale || !this.isStale(i)) {
|
|
2465
|
+
yield i;
|
|
2466
|
+
}
|
|
2467
|
+
if (i === this.tail) {
|
|
2468
|
+
break
|
|
2469
|
+
} else {
|
|
2470
|
+
i = this.next[i];
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
isValidIndex (index) {
|
|
2477
|
+
return this.keyMap.get(this.keyList[index]) === index
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
*entries () {
|
|
2481
|
+
for (const i of this.indexes()) {
|
|
2482
|
+
yield [this.keyList[i], this.valList[i]];
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
*rentries () {
|
|
2486
|
+
for (const i of this.rindexes()) {
|
|
2487
|
+
yield [this.keyList[i], this.valList[i]];
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
*keys () {
|
|
2492
|
+
for (const i of this.indexes()) {
|
|
2493
|
+
yield this.keyList[i];
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
*rkeys () {
|
|
2497
|
+
for (const i of this.rindexes()) {
|
|
2498
|
+
yield this.keyList[i];
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
*values () {
|
|
2503
|
+
for (const i of this.indexes()) {
|
|
2504
|
+
yield this.valList[i];
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
*rvalues () {
|
|
2508
|
+
for (const i of this.rindexes()) {
|
|
2509
|
+
yield this.valList[i];
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
[Symbol.iterator] () {
|
|
2514
|
+
return this.entries()
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
find (fn, getOptions = {}) {
|
|
2518
|
+
for (const i of this.indexes()) {
|
|
2519
|
+
if (fn(this.valList[i], this.keyList[i], this)) {
|
|
2520
|
+
return this.get(this.keyList[i], getOptions)
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
forEach (fn, thisp = this) {
|
|
2526
|
+
for (const i of this.indexes()) {
|
|
2527
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
rforEach (fn, thisp = this) {
|
|
2532
|
+
for (const i of this.rindexes()) {
|
|
2533
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
get prune () {
|
|
2538
|
+
deprecatedMethod('prune', 'purgeStale');
|
|
2539
|
+
return this.purgeStale
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
purgeStale () {
|
|
2543
|
+
let deleted = false;
|
|
2544
|
+
for (const i of this.rindexes({ allowStale: true })) {
|
|
2545
|
+
if (this.isStale(i)) {
|
|
2546
|
+
this.delete(this.keyList[i]);
|
|
2547
|
+
deleted = true;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
return deleted
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
dump () {
|
|
2554
|
+
const arr = [];
|
|
2555
|
+
for (const i of this.indexes()) {
|
|
2556
|
+
const key = this.keyList[i];
|
|
2557
|
+
const value = this.valList[i];
|
|
2558
|
+
const entry = { value };
|
|
2559
|
+
if (this.ttls) {
|
|
2560
|
+
entry.ttl = this.ttls[i];
|
|
2561
|
+
}
|
|
2562
|
+
if (this.sizes) {
|
|
2563
|
+
entry.size = this.sizes[i];
|
|
2564
|
+
}
|
|
2565
|
+
arr.unshift([key, entry]);
|
|
2566
|
+
}
|
|
2567
|
+
return arr
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
load (arr) {
|
|
2571
|
+
this.clear();
|
|
2572
|
+
for (const [key, entry] of arr) {
|
|
2573
|
+
this.set(key, entry.value, entry);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
dispose (v, k, reason) {}
|
|
2578
|
+
|
|
2579
|
+
set (k, v, {
|
|
2580
|
+
ttl = this.ttl,
|
|
2581
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
2582
|
+
size = 0,
|
|
2583
|
+
sizeCalculation = this.sizeCalculation,
|
|
2584
|
+
noUpdateTTL = this.noUpdateTTL,
|
|
2585
|
+
} = {}) {
|
|
2586
|
+
size = this.requireSize(k, v, size, sizeCalculation);
|
|
2587
|
+
let index = this.size === 0 ? undefined : this.keyMap.get(k);
|
|
2588
|
+
if (index === undefined) {
|
|
2589
|
+
// addition
|
|
2590
|
+
index = this.newIndex();
|
|
2591
|
+
this.keyList[index] = k;
|
|
2592
|
+
this.valList[index] = v;
|
|
2593
|
+
this.keyMap.set(k, index);
|
|
2594
|
+
this.next[this.tail] = index;
|
|
2595
|
+
this.prev[index] = this.tail;
|
|
2596
|
+
this.tail = index;
|
|
2597
|
+
this.size ++;
|
|
2598
|
+
this.addItemSize(index, v, k, size);
|
|
2599
|
+
noUpdateTTL = false;
|
|
2600
|
+
} else {
|
|
2601
|
+
// update
|
|
2602
|
+
const oldVal = this.valList[index];
|
|
2603
|
+
if (v !== oldVal) {
|
|
2604
|
+
if (this.isBackgroundFetch(oldVal)) {
|
|
2605
|
+
oldVal.__abortController.abort();
|
|
2606
|
+
} else {
|
|
2607
|
+
if (!noDisposeOnSet) {
|
|
2608
|
+
this.dispose(oldVal, k, 'set');
|
|
2609
|
+
if (this.disposeAfter) {
|
|
2610
|
+
this.disposed.push([oldVal, k, 'set']);
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
this.removeItemSize(index);
|
|
2615
|
+
this.valList[index] = v;
|
|
2616
|
+
this.addItemSize(index, v, k, size);
|
|
2617
|
+
}
|
|
2618
|
+
this.moveToTail(index);
|
|
2619
|
+
}
|
|
2620
|
+
if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
|
|
2621
|
+
this.initializeTTLTracking();
|
|
2622
|
+
}
|
|
2623
|
+
if (!noUpdateTTL) {
|
|
2624
|
+
this.setItemTTL(index, ttl);
|
|
2625
|
+
}
|
|
2626
|
+
if (this.disposeAfter) {
|
|
2627
|
+
while (this.disposed.length) {
|
|
2628
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
return this
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
newIndex () {
|
|
2635
|
+
if (this.size === 0) {
|
|
2636
|
+
return this.tail
|
|
2637
|
+
}
|
|
2638
|
+
if (this.size === this.max && this.max !== 0) {
|
|
2639
|
+
return this.evict(false)
|
|
2640
|
+
}
|
|
2641
|
+
if (this.free.length !== 0) {
|
|
2642
|
+
return this.free.pop()
|
|
2643
|
+
}
|
|
2644
|
+
// initial fill, just keep writing down the list
|
|
2645
|
+
return this.initialFill++
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
pop () {
|
|
2649
|
+
if (this.size) {
|
|
2650
|
+
const val = this.valList[this.head];
|
|
2651
|
+
this.evict(true);
|
|
2652
|
+
return val
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
evict (free) {
|
|
2657
|
+
const head = this.head;
|
|
2658
|
+
const k = this.keyList[head];
|
|
2659
|
+
const v = this.valList[head];
|
|
2660
|
+
if (this.isBackgroundFetch(v)) {
|
|
2661
|
+
v.__abortController.abort();
|
|
2662
|
+
} else {
|
|
2663
|
+
this.dispose(v, k, 'evict');
|
|
2664
|
+
if (this.disposeAfter) {
|
|
2665
|
+
this.disposed.push([v, k, 'evict']);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
this.removeItemSize(head);
|
|
2669
|
+
// if we aren't about to use the index, then null these out
|
|
2670
|
+
if (free) {
|
|
2671
|
+
this.keyList[head] = null;
|
|
2672
|
+
this.valList[head] = null;
|
|
2673
|
+
this.free.push(head);
|
|
2674
|
+
}
|
|
2675
|
+
this.head = this.next[head];
|
|
2676
|
+
this.keyMap.delete(k);
|
|
2677
|
+
this.size --;
|
|
2678
|
+
return head
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
has (k, { updateAgeOnHas = this.updateAgeOnHas } = {}) {
|
|
2682
|
+
const index = this.keyMap.get(k);
|
|
2683
|
+
if (index !== undefined) {
|
|
2684
|
+
if (!this.isStale(index)) {
|
|
2685
|
+
if (updateAgeOnHas) {
|
|
2686
|
+
this.updateItemAge(index);
|
|
2687
|
+
}
|
|
2688
|
+
return true
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
return false
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
// like get(), but without any LRU updating or TTL expiration
|
|
2695
|
+
peek (k, { allowStale = this.allowStale } = {}) {
|
|
2696
|
+
const index = this.keyMap.get(k);
|
|
2697
|
+
if (index !== undefined && (allowStale || !this.isStale(index))) {
|
|
2698
|
+
return this.valList[index]
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
backgroundFetch (k, index, options) {
|
|
2703
|
+
const v = index === undefined ? undefined : this.valList[index];
|
|
2704
|
+
if (this.isBackgroundFetch(v)) {
|
|
2705
|
+
return v
|
|
2706
|
+
}
|
|
2707
|
+
const ac = new AC();
|
|
2708
|
+
const fetchOpts = {
|
|
2709
|
+
signal: ac.signal,
|
|
2710
|
+
options,
|
|
2711
|
+
};
|
|
2712
|
+
const p = Promise.resolve(this.fetchMethod(k, v, fetchOpts)).then(v => {
|
|
2713
|
+
if (!ac.signal.aborted) {
|
|
2714
|
+
this.set(k, v, fetchOpts.options);
|
|
2715
|
+
}
|
|
2716
|
+
return v
|
|
2717
|
+
});
|
|
2718
|
+
p.__abortController = ac;
|
|
2719
|
+
p.__staleWhileFetching = v;
|
|
2720
|
+
if (index === undefined) {
|
|
2721
|
+
this.set(k, p, fetchOpts.options);
|
|
2722
|
+
index = this.keyMap.get(k);
|
|
2723
|
+
} else {
|
|
2724
|
+
this.valList[index] = p;
|
|
2725
|
+
}
|
|
2726
|
+
return p
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
isBackgroundFetch (p) {
|
|
2730
|
+
return p && typeof p === 'object' && typeof p.then === 'function' &&
|
|
2731
|
+
Object.prototype.hasOwnProperty.call(p, '__staleWhileFetching')
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
// this takes the union of get() and set() opts, because it does both
|
|
2735
|
+
async fetch (k, {
|
|
2736
|
+
allowStale = this.allowStale,
|
|
2737
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
2738
|
+
ttl = this.ttl,
|
|
2739
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
2740
|
+
size = 0,
|
|
2741
|
+
sizeCalculation = this.sizeCalculation,
|
|
2742
|
+
noUpdateTTL = this.noUpdateTTL,
|
|
2743
|
+
} = {}) {
|
|
2744
|
+
if (!this.fetchMethod) {
|
|
2745
|
+
return this.get(k, {allowStale, updateAgeOnGet})
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
const options = {
|
|
2749
|
+
allowStale,
|
|
2750
|
+
updateAgeOnGet,
|
|
2751
|
+
ttl,
|
|
2752
|
+
noDisposeOnSet,
|
|
2753
|
+
size,
|
|
2754
|
+
sizeCalculation,
|
|
2755
|
+
noUpdateTTL,
|
|
2756
|
+
};
|
|
2757
|
+
|
|
2758
|
+
let index = this.keyMap.get(k);
|
|
2759
|
+
if (index === undefined) {
|
|
2760
|
+
return this.backgroundFetch(k, index, options)
|
|
2761
|
+
} else {
|
|
2762
|
+
// in cache, maybe already fetching
|
|
2763
|
+
const v = this.valList[index];
|
|
2764
|
+
if (this.isBackgroundFetch(v)) {
|
|
2765
|
+
return allowStale && v.__staleWhileFetching !== undefined
|
|
2766
|
+
? v.__staleWhileFetching : v
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
if (!this.isStale(index)) {
|
|
2770
|
+
this.moveToTail(index);
|
|
2771
|
+
if (updateAgeOnGet) {
|
|
2772
|
+
this.updateItemAge(index);
|
|
2773
|
+
}
|
|
2774
|
+
return v
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
// ok, it is stale, and not already fetching
|
|
2778
|
+
// refresh the cache.
|
|
2779
|
+
const p = this.backgroundFetch(k, index, options);
|
|
2780
|
+
return allowStale && p.__staleWhileFetching !== undefined
|
|
2781
|
+
? p.__staleWhileFetching : p
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
get (k, {
|
|
2786
|
+
allowStale = this.allowStale,
|
|
2787
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
2788
|
+
} = {}) {
|
|
2789
|
+
const index = this.keyMap.get(k);
|
|
2790
|
+
if (index !== undefined) {
|
|
2791
|
+
const value = this.valList[index];
|
|
2792
|
+
const fetching = this.isBackgroundFetch(value);
|
|
2793
|
+
if (this.isStale(index)) {
|
|
2794
|
+
// delete only if not an in-flight background fetch
|
|
2795
|
+
if (!fetching) {
|
|
2796
|
+
this.delete(k);
|
|
2797
|
+
return allowStale ? value : undefined
|
|
2798
|
+
} else {
|
|
2799
|
+
return allowStale ? value.__staleWhileFetching : undefined
|
|
2800
|
+
}
|
|
2801
|
+
} else {
|
|
2802
|
+
// if we're currently fetching it, we don't actually have it yet
|
|
2803
|
+
// it's not stale, which means this isn't a staleWhileRefetching,
|
|
2804
|
+
// so we just return undefined
|
|
2805
|
+
if (fetching) {
|
|
2806
|
+
return undefined
|
|
2807
|
+
}
|
|
2808
|
+
this.moveToTail(index);
|
|
2809
|
+
if (updateAgeOnGet) {
|
|
2810
|
+
this.updateItemAge(index);
|
|
2811
|
+
}
|
|
2812
|
+
return value
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
connect (p, n) {
|
|
2818
|
+
this.prev[n] = p;
|
|
2819
|
+
this.next[p] = n;
|
|
2820
|
+
}
|
|
2821
|
+
|
|
2822
|
+
moveToTail (index) {
|
|
2823
|
+
// if tail already, nothing to do
|
|
2824
|
+
// if head, move head to next[index]
|
|
2825
|
+
// else
|
|
2826
|
+
// move next[prev[index]] to next[index] (head has no prev)
|
|
2827
|
+
// move prev[next[index]] to prev[index]
|
|
2828
|
+
// prev[index] = tail
|
|
2829
|
+
// next[tail] = index
|
|
2830
|
+
// tail = index
|
|
2831
|
+
if (index !== this.tail) {
|
|
2832
|
+
if (index === this.head) {
|
|
2833
|
+
this.head = this.next[index];
|
|
2834
|
+
} else {
|
|
2835
|
+
this.connect(this.prev[index], this.next[index]);
|
|
2836
|
+
}
|
|
2837
|
+
this.connect(this.tail, index);
|
|
2838
|
+
this.tail = index;
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
get del () {
|
|
2843
|
+
deprecatedMethod('del', 'delete');
|
|
2844
|
+
return this.delete
|
|
2845
|
+
}
|
|
2846
|
+
delete (k) {
|
|
2847
|
+
let deleted = false;
|
|
2848
|
+
if (this.size !== 0) {
|
|
2849
|
+
const index = this.keyMap.get(k);
|
|
2850
|
+
if (index !== undefined) {
|
|
2851
|
+
deleted = true;
|
|
2852
|
+
if (this.size === 1) {
|
|
2853
|
+
this.clear();
|
|
2854
|
+
} else {
|
|
2855
|
+
this.removeItemSize(index);
|
|
2856
|
+
const v = this.valList[index];
|
|
2857
|
+
if (this.isBackgroundFetch(v)) {
|
|
2858
|
+
v.__abortController.abort();
|
|
2859
|
+
} else {
|
|
2860
|
+
this.dispose(v, k, 'delete');
|
|
2861
|
+
if (this.disposeAfter) {
|
|
2862
|
+
this.disposed.push([v, k, 'delete']);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
this.keyMap.delete(k);
|
|
2866
|
+
this.keyList[index] = null;
|
|
2867
|
+
this.valList[index] = null;
|
|
2868
|
+
if (index === this.tail) {
|
|
2869
|
+
this.tail = this.prev[index];
|
|
2870
|
+
} else if (index === this.head) {
|
|
2871
|
+
this.head = this.next[index];
|
|
2872
|
+
} else {
|
|
2873
|
+
this.next[this.prev[index]] = this.next[index];
|
|
2874
|
+
this.prev[this.next[index]] = this.prev[index];
|
|
2875
|
+
}
|
|
2876
|
+
this.size --;
|
|
2877
|
+
this.free.push(index);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
if (this.disposed) {
|
|
2882
|
+
while (this.disposed.length) {
|
|
2883
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
return deleted
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
clear () {
|
|
2890
|
+
for (const index of this.rindexes({ allowStale: true })) {
|
|
2891
|
+
const v = this.valList[index];
|
|
2892
|
+
if (this.isBackgroundFetch(v)) {
|
|
2893
|
+
v.__abortController.abort();
|
|
2894
|
+
} else {
|
|
2895
|
+
const k = this.keyList[index];
|
|
2896
|
+
this.dispose(v, k, 'delete');
|
|
2897
|
+
if (this.disposeAfter) {
|
|
2898
|
+
this.disposed.push([v, k, 'delete']);
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
this.keyMap.clear();
|
|
2904
|
+
this.valList.fill(null);
|
|
2905
|
+
this.keyList.fill(null);
|
|
2906
|
+
if (this.ttls) {
|
|
2907
|
+
this.ttls.fill(0);
|
|
2908
|
+
this.starts.fill(0);
|
|
2909
|
+
}
|
|
2910
|
+
if (this.sizes) {
|
|
2911
|
+
this.sizes.fill(0);
|
|
2912
|
+
}
|
|
2913
|
+
this.head = 0;
|
|
2914
|
+
this.tail = 0;
|
|
2915
|
+
this.initialFill = 1;
|
|
2916
|
+
this.free.length = 0;
|
|
2917
|
+
this.calculatedSize = 0;
|
|
2918
|
+
this.size = 0;
|
|
2919
|
+
if (this.disposed) {
|
|
2920
|
+
while (this.disposed.length) {
|
|
2921
|
+
this.disposeAfter(...this.disposed.shift());
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
get reset () {
|
|
2926
|
+
deprecatedMethod('reset', 'clear');
|
|
2927
|
+
return this.clear
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
get length () {
|
|
2931
|
+
deprecatedProperty('length', 'size');
|
|
2932
|
+
return this.size
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
var lruCache = LRUCache;
|
|
2937
|
+
|
|
2109
2938
|
// hoisted class for cyclic dependency
|
|
2110
2939
|
class Range$a {
|
|
2111
2940
|
constructor (range, options) {
|
|
@@ -2137,9 +2966,9 @@ class Range$a {
|
|
|
2137
2966
|
// First, split based on boolean or ||
|
|
2138
2967
|
this.raw = range;
|
|
2139
2968
|
this.set = range
|
|
2140
|
-
.split(
|
|
2969
|
+
.split('||')
|
|
2141
2970
|
// map the range to a 2d array of comparators
|
|
2142
|
-
.map(
|
|
2971
|
+
.map(r => this.parseRange(r.trim()))
|
|
2143
2972
|
// throw out any comparator lists that are empty
|
|
2144
2973
|
// this generally means that it was not a valid range, which is allowed
|
|
2145
2974
|
// in loose mode, but will still throw if the WHOLE range is invalid.
|
|
@@ -2154,9 +2983,9 @@ class Range$a {
|
|
|
2154
2983
|
// keep the first one, in case they're all null sets
|
|
2155
2984
|
const first = this.set[0];
|
|
2156
2985
|
this.set = this.set.filter(c => !isNullSet(c[0]));
|
|
2157
|
-
if (this.set.length === 0)
|
|
2986
|
+
if (this.set.length === 0) {
|
|
2158
2987
|
this.set = [first];
|
|
2159
|
-
else if (this.set.length > 1) {
|
|
2988
|
+
} else if (this.set.length > 1) {
|
|
2160
2989
|
// if we have any that are *, then the range is just *
|
|
2161
2990
|
for (const c of this.set) {
|
|
2162
2991
|
if (c.length === 1 && isAny(c[0])) {
|
|
@@ -2192,8 +3021,9 @@ class Range$a {
|
|
|
2192
3021
|
const memoOpts = Object.keys(this.options).join(',');
|
|
2193
3022
|
const memoKey = `parseRange:${memoOpts}:${range}`;
|
|
2194
3023
|
const cached = cache.get(memoKey);
|
|
2195
|
-
if (cached)
|
|
3024
|
+
if (cached) {
|
|
2196
3025
|
return cached
|
|
3026
|
+
}
|
|
2197
3027
|
|
|
2198
3028
|
const loose = this.options.loose;
|
|
2199
3029
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
@@ -2202,7 +3032,7 @@ class Range$a {
|
|
|
2202
3032
|
debug$2('hyphen replace', range);
|
|
2203
3033
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
2204
3034
|
range = range.replace(re$1[t$1.COMPARATORTRIM], comparatorTrimReplace);
|
|
2205
|
-
debug$2('comparator trim', range
|
|
3035
|
+
debug$2('comparator trim', range);
|
|
2206
3036
|
|
|
2207
3037
|
// `~ 1.2.3` => `~1.2.3`
|
|
2208
3038
|
range = range.replace(re$1[t$1.TILDETRIM], tildeTrimReplace);
|
|
@@ -2216,30 +3046,37 @@ class Range$a {
|
|
|
2216
3046
|
// At this point, the range is completely trimmed and
|
|
2217
3047
|
// ready to be split into comparators.
|
|
2218
3048
|
|
|
2219
|
-
|
|
2220
|
-
const rangeList = range
|
|
3049
|
+
let rangeList = range
|
|
2221
3050
|
.split(' ')
|
|
2222
3051
|
.map(comp => parseComparator(comp, this.options))
|
|
2223
3052
|
.join(' ')
|
|
2224
3053
|
.split(/\s+/)
|
|
2225
3054
|
// >=0.0.0 is equivalent to *
|
|
2226
|
-
.map(comp => replaceGTE0(comp, this.options))
|
|
3055
|
+
.map(comp => replaceGTE0(comp, this.options));
|
|
3056
|
+
|
|
3057
|
+
if (loose) {
|
|
2227
3058
|
// in loose mode, throw out any that are not valid comparators
|
|
2228
|
-
.filter(
|
|
2229
|
-
|
|
3059
|
+
rangeList = rangeList.filter(comp => {
|
|
3060
|
+
debug$2('loose invalid filter', comp, this.options);
|
|
3061
|
+
return !!comp.match(re$1[t$1.COMPARATORLOOSE])
|
|
3062
|
+
});
|
|
3063
|
+
}
|
|
3064
|
+
debug$2('range list', rangeList);
|
|
2230
3065
|
|
|
2231
3066
|
// if any comparators are the null set, then replace with JUST null set
|
|
2232
3067
|
// if more than one comparator, remove any * comparators
|
|
2233
3068
|
// also, don't include the same comparator more than once
|
|
2234
|
-
rangeList.length;
|
|
2235
3069
|
const rangeMap = new Map();
|
|
2236
|
-
|
|
2237
|
-
|
|
3070
|
+
const comparators = rangeList.map(comp => new Comparator$3(comp, this.options));
|
|
3071
|
+
for (const comp of comparators) {
|
|
3072
|
+
if (isNullSet(comp)) {
|
|
2238
3073
|
return [comp]
|
|
3074
|
+
}
|
|
2239
3075
|
rangeMap.set(comp.value, comp);
|
|
2240
3076
|
}
|
|
2241
|
-
if (rangeMap.size > 1 && rangeMap.has(''))
|
|
3077
|
+
if (rangeMap.size > 1 && rangeMap.has('')) {
|
|
2242
3078
|
rangeMap.delete('');
|
|
3079
|
+
}
|
|
2243
3080
|
|
|
2244
3081
|
const result = [...rangeMap.values()];
|
|
2245
3082
|
cache.set(memoKey, result);
|
|
@@ -2304,7 +3141,7 @@ const {
|
|
|
2304
3141
|
t: t$1,
|
|
2305
3142
|
comparatorTrimReplace,
|
|
2306
3143
|
tildeTrimReplace,
|
|
2307
|
-
caretTrimReplace
|
|
3144
|
+
caretTrimReplace,
|
|
2308
3145
|
} = re$5.exports;
|
|
2309
3146
|
|
|
2310
3147
|
const isNullSet = c => c.value === '<0.0.0-0';
|
|
@@ -2353,8 +3190,8 @@ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
|
|
|
2353
3190
|
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
|
2354
3191
|
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
|
2355
3192
|
const replaceTildes = (comp, options) =>
|
|
2356
|
-
comp.trim().split(/\s+/).map((
|
|
2357
|
-
return replaceTilde(
|
|
3193
|
+
comp.trim().split(/\s+/).map((c) => {
|
|
3194
|
+
return replaceTilde(c, options)
|
|
2358
3195
|
}).join(' ');
|
|
2359
3196
|
|
|
2360
3197
|
const replaceTilde = (comp, options) => {
|
|
@@ -2392,8 +3229,8 @@ const replaceTilde = (comp, options) => {
|
|
|
2392
3229
|
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
2393
3230
|
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
2394
3231
|
const replaceCarets = (comp, options) =>
|
|
2395
|
-
comp.trim().split(/\s+/).map((
|
|
2396
|
-
return replaceCaret(
|
|
3232
|
+
comp.trim().split(/\s+/).map((c) => {
|
|
3233
|
+
return replaceCaret(c, options)
|
|
2397
3234
|
}).join(' ');
|
|
2398
3235
|
|
|
2399
3236
|
const replaceCaret = (comp, options) => {
|
|
@@ -2451,8 +3288,8 @@ const replaceCaret = (comp, options) => {
|
|
|
2451
3288
|
|
|
2452
3289
|
const replaceXRanges = (comp, options) => {
|
|
2453
3290
|
debug$2('replaceXRanges', comp, options);
|
|
2454
|
-
return comp.split(/\s+/).map((
|
|
2455
|
-
return replaceXRange(
|
|
3291
|
+
return comp.split(/\s+/).map((c) => {
|
|
3292
|
+
return replaceXRange(c, options)
|
|
2456
3293
|
}).join(' ')
|
|
2457
3294
|
};
|
|
2458
3295
|
|
|
@@ -2513,8 +3350,9 @@ const replaceXRange = (comp, options) => {
|
|
|
2513
3350
|
}
|
|
2514
3351
|
}
|
|
2515
3352
|
|
|
2516
|
-
if (gtlt === '<')
|
|
3353
|
+
if (gtlt === '<') {
|
|
2517
3354
|
pr = '-0';
|
|
3355
|
+
}
|
|
2518
3356
|
|
|
2519
3357
|
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2520
3358
|
} else if (xm) {
|
|
@@ -2623,6 +3461,7 @@ class Comparator$2 {
|
|
|
2623
3461
|
static get ANY () {
|
|
2624
3462
|
return ANY$2
|
|
2625
3463
|
}
|
|
3464
|
+
|
|
2626
3465
|
constructor (comp, options) {
|
|
2627
3466
|
options = parseOptions(options);
|
|
2628
3467
|
|
|
@@ -2699,7 +3538,7 @@ class Comparator$2 {
|
|
|
2699
3538
|
if (!options || typeof options !== 'object') {
|
|
2700
3539
|
options = {
|
|
2701
3540
|
loose: !!options,
|
|
2702
|
-
includePrerelease: false
|
|
3541
|
+
includePrerelease: false,
|
|
2703
3542
|
};
|
|
2704
3543
|
}
|
|
2705
3544
|
|
|
@@ -2747,7 +3586,7 @@ class Comparator$2 {
|
|
|
2747
3586
|
var comparator = Comparator$2;
|
|
2748
3587
|
|
|
2749
3588
|
const parseOptions = parseOptions_1;
|
|
2750
|
-
const {re, t} = re$5.exports;
|
|
3589
|
+
const { re, t } = re$5.exports;
|
|
2751
3590
|
const cmp = cmp_1;
|
|
2752
3591
|
const debug$1 = debug_1;
|
|
2753
3592
|
const SemVer$4 = semver$4;
|
|
@@ -2873,8 +3712,9 @@ const minVersion = (range, loose) => {
|
|
|
2873
3712
|
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
|
2874
3713
|
}
|
|
2875
3714
|
});
|
|
2876
|
-
if (setMin && (!minver || gt$1(minver, setMin)))
|
|
3715
|
+
if (setMin && (!minver || gt$1(minver, setMin))) {
|
|
2877
3716
|
minver = setMin;
|
|
3717
|
+
}
|
|
2878
3718
|
}
|
|
2879
3719
|
|
|
2880
3720
|
if (minver && range.test(minver)) {
|
|
@@ -2899,7 +3739,7 @@ var valid = validRange;
|
|
|
2899
3739
|
|
|
2900
3740
|
const SemVer = semver$4;
|
|
2901
3741
|
const Comparator$1 = comparator;
|
|
2902
|
-
const {ANY: ANY$1} = Comparator$1;
|
|
3742
|
+
const { ANY: ANY$1 } = Comparator$1;
|
|
2903
3743
|
const Range$2 = range;
|
|
2904
3744
|
const satisfies$2 = satisfies_1;
|
|
2905
3745
|
const gt = gt_1;
|
|
@@ -3003,38 +3843,41 @@ const satisfies$1 = satisfies_1;
|
|
|
3003
3843
|
const compare$1 = compare_1;
|
|
3004
3844
|
var simplify = (versions, range, options) => {
|
|
3005
3845
|
const set = [];
|
|
3006
|
-
let
|
|
3846
|
+
let first = null;
|
|
3007
3847
|
let prev = null;
|
|
3008
3848
|
const v = versions.sort((a, b) => compare$1(a, b, options));
|
|
3009
3849
|
for (const version of v) {
|
|
3010
3850
|
const included = satisfies$1(version, range, options);
|
|
3011
3851
|
if (included) {
|
|
3012
3852
|
prev = version;
|
|
3013
|
-
if (!
|
|
3014
|
-
|
|
3853
|
+
if (!first) {
|
|
3854
|
+
first = version;
|
|
3855
|
+
}
|
|
3015
3856
|
} else {
|
|
3016
3857
|
if (prev) {
|
|
3017
|
-
set.push([
|
|
3858
|
+
set.push([first, prev]);
|
|
3018
3859
|
}
|
|
3019
3860
|
prev = null;
|
|
3020
|
-
|
|
3861
|
+
first = null;
|
|
3021
3862
|
}
|
|
3022
3863
|
}
|
|
3023
|
-
if (
|
|
3024
|
-
set.push([
|
|
3864
|
+
if (first) {
|
|
3865
|
+
set.push([first, null]);
|
|
3866
|
+
}
|
|
3025
3867
|
|
|
3026
3868
|
const ranges = [];
|
|
3027
3869
|
for (const [min, max] of set) {
|
|
3028
|
-
if (min === max)
|
|
3870
|
+
if (min === max) {
|
|
3029
3871
|
ranges.push(min);
|
|
3030
|
-
else if (!max && min === v[0])
|
|
3872
|
+
} else if (!max && min === v[0]) {
|
|
3031
3873
|
ranges.push('*');
|
|
3032
|
-
else if (!max)
|
|
3874
|
+
} else if (!max) {
|
|
3033
3875
|
ranges.push(`>=${min}`);
|
|
3034
|
-
else if (min === v[0])
|
|
3876
|
+
} else if (min === v[0]) {
|
|
3035
3877
|
ranges.push(`<=${max}`);
|
|
3036
|
-
else
|
|
3878
|
+
} else {
|
|
3037
3879
|
ranges.push(`${min} - ${max}`);
|
|
3880
|
+
}
|
|
3038
3881
|
}
|
|
3039
3882
|
const simplified = ranges.join(' || ');
|
|
3040
3883
|
const original = typeof range.raw === 'string' ? range.raw : String(range);
|
|
@@ -3084,8 +3927,9 @@ const compare = compare_1;
|
|
|
3084
3927
|
// - Else return true
|
|
3085
3928
|
|
|
3086
3929
|
const subset = (sub, dom, options = {}) => {
|
|
3087
|
-
if (sub === dom)
|
|
3930
|
+
if (sub === dom) {
|
|
3088
3931
|
return true
|
|
3932
|
+
}
|
|
3089
3933
|
|
|
3090
3934
|
sub = new Range(sub, options);
|
|
3091
3935
|
dom = new Range(dom, options);
|
|
@@ -3095,73 +3939,84 @@ const subset = (sub, dom, options = {}) => {
|
|
|
3095
3939
|
for (const simpleDom of dom.set) {
|
|
3096
3940
|
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
3097
3941
|
sawNonNull = sawNonNull || isSub !== null;
|
|
3098
|
-
if (isSub)
|
|
3942
|
+
if (isSub) {
|
|
3099
3943
|
continue OUTER
|
|
3944
|
+
}
|
|
3100
3945
|
}
|
|
3101
3946
|
// the null set is a subset of everything, but null simple ranges in
|
|
3102
3947
|
// a complex range should be ignored. so if we saw a non-null range,
|
|
3103
3948
|
// then we know this isn't a subset, but if EVERY simple range was null,
|
|
3104
3949
|
// then it is a subset.
|
|
3105
|
-
if (sawNonNull)
|
|
3950
|
+
if (sawNonNull) {
|
|
3106
3951
|
return false
|
|
3952
|
+
}
|
|
3107
3953
|
}
|
|
3108
3954
|
return true
|
|
3109
3955
|
};
|
|
3110
3956
|
|
|
3111
3957
|
const simpleSubset = (sub, dom, options) => {
|
|
3112
|
-
if (sub === dom)
|
|
3958
|
+
if (sub === dom) {
|
|
3113
3959
|
return true
|
|
3960
|
+
}
|
|
3114
3961
|
|
|
3115
3962
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
3116
|
-
if (dom.length === 1 && dom[0].semver === ANY)
|
|
3963
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3117
3964
|
return true
|
|
3118
|
-
else if (options.includePrerelease)
|
|
3119
|
-
sub = [
|
|
3120
|
-
else
|
|
3121
|
-
sub = [
|
|
3965
|
+
} else if (options.includePrerelease) {
|
|
3966
|
+
sub = [new Comparator('>=0.0.0-0')];
|
|
3967
|
+
} else {
|
|
3968
|
+
sub = [new Comparator('>=0.0.0')];
|
|
3969
|
+
}
|
|
3122
3970
|
}
|
|
3123
3971
|
|
|
3124
3972
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
3125
|
-
if (options.includePrerelease)
|
|
3973
|
+
if (options.includePrerelease) {
|
|
3126
3974
|
return true
|
|
3127
|
-
else
|
|
3128
|
-
dom = [
|
|
3975
|
+
} else {
|
|
3976
|
+
dom = [new Comparator('>=0.0.0')];
|
|
3977
|
+
}
|
|
3129
3978
|
}
|
|
3130
3979
|
|
|
3131
3980
|
const eqSet = new Set();
|
|
3132
3981
|
let gt, lt;
|
|
3133
3982
|
for (const c of sub) {
|
|
3134
|
-
if (c.operator === '>' || c.operator === '>=')
|
|
3983
|
+
if (c.operator === '>' || c.operator === '>=') {
|
|
3135
3984
|
gt = higherGT(gt, c, options);
|
|
3136
|
-
else if (c.operator === '<' || c.operator === '<=')
|
|
3985
|
+
} else if (c.operator === '<' || c.operator === '<=') {
|
|
3137
3986
|
lt = lowerLT(lt, c, options);
|
|
3138
|
-
else
|
|
3987
|
+
} else {
|
|
3139
3988
|
eqSet.add(c.semver);
|
|
3989
|
+
}
|
|
3140
3990
|
}
|
|
3141
3991
|
|
|
3142
|
-
if (eqSet.size > 1)
|
|
3992
|
+
if (eqSet.size > 1) {
|
|
3143
3993
|
return null
|
|
3994
|
+
}
|
|
3144
3995
|
|
|
3145
3996
|
let gtltComp;
|
|
3146
3997
|
if (gt && lt) {
|
|
3147
3998
|
gtltComp = compare(gt.semver, lt.semver, options);
|
|
3148
|
-
if (gtltComp > 0)
|
|
3999
|
+
if (gtltComp > 0) {
|
|
3149
4000
|
return null
|
|
3150
|
-
else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
|
|
4001
|
+
} else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
|
|
3151
4002
|
return null
|
|
4003
|
+
}
|
|
3152
4004
|
}
|
|
3153
4005
|
|
|
3154
4006
|
// will iterate one or zero times
|
|
3155
4007
|
for (const eq of eqSet) {
|
|
3156
|
-
if (gt && !satisfies(eq, String(gt), options))
|
|
4008
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
3157
4009
|
return null
|
|
4010
|
+
}
|
|
3158
4011
|
|
|
3159
|
-
if (lt && !satisfies(eq, String(lt), options))
|
|
4012
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
3160
4013
|
return null
|
|
4014
|
+
}
|
|
3161
4015
|
|
|
3162
4016
|
for (const c of dom) {
|
|
3163
|
-
if (!satisfies(eq, String(c), options))
|
|
4017
|
+
if (!satisfies(eq, String(c), options)) {
|
|
3164
4018
|
return false
|
|
4019
|
+
}
|
|
3165
4020
|
}
|
|
3166
4021
|
|
|
3167
4022
|
return true
|
|
@@ -3197,10 +4052,12 @@ const simpleSubset = (sub, dom, options) => {
|
|
|
3197
4052
|
}
|
|
3198
4053
|
if (c.operator === '>' || c.operator === '>=') {
|
|
3199
4054
|
higher = higherGT(gt, c, options);
|
|
3200
|
-
if (higher === c && higher !== gt)
|
|
4055
|
+
if (higher === c && higher !== gt) {
|
|
3201
4056
|
return false
|
|
3202
|
-
|
|
4057
|
+
}
|
|
4058
|
+
} else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
|
|
3203
4059
|
return false
|
|
4060
|
+
}
|
|
3204
4061
|
}
|
|
3205
4062
|
if (lt) {
|
|
3206
4063
|
if (needDomLTPre) {
|
|
@@ -3213,37 +4070,44 @@ const simpleSubset = (sub, dom, options) => {
|
|
|
3213
4070
|
}
|
|
3214
4071
|
if (c.operator === '<' || c.operator === '<=') {
|
|
3215
4072
|
lower = lowerLT(lt, c, options);
|
|
3216
|
-
if (lower === c && lower !== lt)
|
|
4073
|
+
if (lower === c && lower !== lt) {
|
|
3217
4074
|
return false
|
|
3218
|
-
|
|
4075
|
+
}
|
|
4076
|
+
} else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
|
|
3219
4077
|
return false
|
|
4078
|
+
}
|
|
3220
4079
|
}
|
|
3221
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0)
|
|
4080
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
3222
4081
|
return false
|
|
4082
|
+
}
|
|
3223
4083
|
}
|
|
3224
4084
|
|
|
3225
4085
|
// if there was a < or >, and nothing in the dom, then must be false
|
|
3226
4086
|
// UNLESS it was limited by another range in the other direction.
|
|
3227
4087
|
// Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
|
|
3228
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0)
|
|
4088
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
3229
4089
|
return false
|
|
4090
|
+
}
|
|
3230
4091
|
|
|
3231
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0)
|
|
4092
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
3232
4093
|
return false
|
|
4094
|
+
}
|
|
3233
4095
|
|
|
3234
4096
|
// we needed a prerelease range in a specific tuple, but didn't get one
|
|
3235
4097
|
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
|
|
3236
4098
|
// because it includes prereleases in the 1.2.3 tuple
|
|
3237
|
-
if (needDomGTPre || needDomLTPre)
|
|
4099
|
+
if (needDomGTPre || needDomLTPre) {
|
|
3238
4100
|
return false
|
|
4101
|
+
}
|
|
3239
4102
|
|
|
3240
4103
|
return true
|
|
3241
4104
|
};
|
|
3242
4105
|
|
|
3243
4106
|
// >=1.2.3 is lower than >1.2.3
|
|
3244
4107
|
const higherGT = (a, b, options) => {
|
|
3245
|
-
if (!a)
|
|
4108
|
+
if (!a) {
|
|
3246
4109
|
return b
|
|
4110
|
+
}
|
|
3247
4111
|
const comp = compare(a.semver, b.semver, options);
|
|
3248
4112
|
return comp > 0 ? a
|
|
3249
4113
|
: comp < 0 ? b
|
|
@@ -3253,8 +4117,9 @@ const higherGT = (a, b, options) => {
|
|
|
3253
4117
|
|
|
3254
4118
|
// <=1.2.3 is higher than <1.2.3
|
|
3255
4119
|
const lowerLT = (a, b, options) => {
|
|
3256
|
-
if (!a)
|
|
4120
|
+
if (!a) {
|
|
3257
4121
|
return b
|
|
4122
|
+
}
|
|
3258
4123
|
const comp = compare(a.semver, b.semver, options);
|
|
3259
4124
|
return comp < 0 ? a
|
|
3260
4125
|
: comp > 0 ? b
|
|
@@ -3844,13 +4709,13 @@ function patch$1 (fs) {
|
|
|
3844
4709
|
fs.lstatSync = statFixSync(fs.lstatSync);
|
|
3845
4710
|
|
|
3846
4711
|
// if lchmod/lchown do not exist, then make them no-ops
|
|
3847
|
-
if (!fs.lchmod) {
|
|
4712
|
+
if (fs.chmod && !fs.lchmod) {
|
|
3848
4713
|
fs.lchmod = function (path, mode, cb) {
|
|
3849
4714
|
if (cb) process.nextTick(cb);
|
|
3850
4715
|
};
|
|
3851
4716
|
fs.lchmodSync = function () {};
|
|
3852
4717
|
}
|
|
3853
|
-
if (!fs.lchown) {
|
|
4718
|
+
if (fs.chown && !fs.lchown) {
|
|
3854
4719
|
fs.lchown = function (path, uid, gid, cb) {
|
|
3855
4720
|
if (cb) process.nextTick(cb);
|
|
3856
4721
|
};
|
|
@@ -3867,32 +4732,38 @@ function patch$1 (fs) {
|
|
|
3867
4732
|
// CPU to a busy looping process, which can cause the program causing the lock
|
|
3868
4733
|
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
3869
4734
|
if (platform === "win32") {
|
|
3870
|
-
fs.rename =
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
backoff
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
4735
|
+
fs.rename = typeof fs.rename !== 'function' ? fs.rename
|
|
4736
|
+
: (function (fs$rename) {
|
|
4737
|
+
function rename (from, to, cb) {
|
|
4738
|
+
var start = Date.now();
|
|
4739
|
+
var backoff = 0;
|
|
4740
|
+
fs$rename(from, to, function CB (er) {
|
|
4741
|
+
if (er
|
|
4742
|
+
&& (er.code === "EACCES" || er.code === "EPERM")
|
|
4743
|
+
&& Date.now() - start < 60000) {
|
|
4744
|
+
setTimeout(function() {
|
|
4745
|
+
fs.stat(to, function (stater, st) {
|
|
4746
|
+
if (stater && stater.code === "ENOENT")
|
|
4747
|
+
fs$rename(from, to, CB);
|
|
4748
|
+
else
|
|
4749
|
+
cb(er);
|
|
4750
|
+
});
|
|
4751
|
+
}, backoff);
|
|
4752
|
+
if (backoff < 100)
|
|
4753
|
+
backoff += 10;
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4756
|
+
if (cb) cb(er);
|
|
4757
|
+
});
|
|
4758
|
+
}
|
|
4759
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
|
|
4760
|
+
return rename
|
|
4761
|
+
})(fs.rename);
|
|
3892
4762
|
}
|
|
3893
4763
|
|
|
3894
4764
|
// if read() returns EAGAIN, then just try it again.
|
|
3895
|
-
fs.read =
|
|
4765
|
+
fs.read = typeof fs.read !== 'function' ? fs.read
|
|
4766
|
+
: (function (fs$read) {
|
|
3896
4767
|
function read (fd, buffer, offset, length, position, callback_) {
|
|
3897
4768
|
var callback;
|
|
3898
4769
|
if (callback_ && typeof callback_ === 'function') {
|
|
@@ -3913,7 +4784,8 @@ function patch$1 (fs) {
|
|
|
3913
4784
|
return read
|
|
3914
4785
|
})(fs.read);
|
|
3915
4786
|
|
|
3916
|
-
fs.readSync =
|
|
4787
|
+
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
|
|
4788
|
+
: (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
3917
4789
|
var eagCounter = 0;
|
|
3918
4790
|
while (true) {
|
|
3919
4791
|
try {
|
|
@@ -3972,7 +4844,7 @@ function patch$1 (fs) {
|
|
|
3972
4844
|
}
|
|
3973
4845
|
|
|
3974
4846
|
function patchLutimes (fs) {
|
|
3975
|
-
if (constants.hasOwnProperty("O_SYMLINK")) {
|
|
4847
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
3976
4848
|
fs.lutimes = function (path, at, mt, cb) {
|
|
3977
4849
|
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
3978
4850
|
if (er) {
|
|
@@ -4006,7 +4878,7 @@ function patch$1 (fs) {
|
|
|
4006
4878
|
return ret
|
|
4007
4879
|
};
|
|
4008
4880
|
|
|
4009
|
-
} else {
|
|
4881
|
+
} else if (fs.futimes) {
|
|
4010
4882
|
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb); };
|
|
4011
4883
|
fs.lutimesSync = function () {};
|
|
4012
4884
|
}
|
|
@@ -4454,16 +5326,35 @@ function patch (fs) {
|
|
|
4454
5326
|
|
|
4455
5327
|
var fs$readdir = fs.readdir;
|
|
4456
5328
|
fs.readdir = readdir;
|
|
5329
|
+
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
4457
5330
|
function readdir (path, options, cb) {
|
|
4458
5331
|
if (typeof options === 'function')
|
|
4459
5332
|
cb = options, options = null;
|
|
4460
5333
|
|
|
5334
|
+
var go$readdir = noReaddirOptionVersions.test(process.version)
|
|
5335
|
+
? function go$readdir (path, options, cb, startTime) {
|
|
5336
|
+
return fs$readdir(path, fs$readdirCallback(
|
|
5337
|
+
path, options, cb, startTime
|
|
5338
|
+
))
|
|
5339
|
+
}
|
|
5340
|
+
: function go$readdir (path, options, cb, startTime) {
|
|
5341
|
+
return fs$readdir(path, options, fs$readdirCallback(
|
|
5342
|
+
path, options, cb, startTime
|
|
5343
|
+
))
|
|
5344
|
+
};
|
|
5345
|
+
|
|
4461
5346
|
return go$readdir(path, options, cb)
|
|
4462
5347
|
|
|
4463
|
-
function
|
|
4464
|
-
return
|
|
5348
|
+
function fs$readdirCallback (path, options, cb, startTime) {
|
|
5349
|
+
return function (err, files) {
|
|
4465
5350
|
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
4466
|
-
enqueue([
|
|
5351
|
+
enqueue([
|
|
5352
|
+
go$readdir,
|
|
5353
|
+
[path, options, cb],
|
|
5354
|
+
err,
|
|
5355
|
+
startTime || Date.now(),
|
|
5356
|
+
Date.now()
|
|
5357
|
+
]);
|
|
4467
5358
|
else {
|
|
4468
5359
|
if (files && files.sort)
|
|
4469
5360
|
files.sort();
|
|
@@ -4471,7 +5362,7 @@ function patch (fs) {
|
|
|
4471
5362
|
if (typeof cb === 'function')
|
|
4472
5363
|
cb.call(this, err, files);
|
|
4473
5364
|
}
|
|
4474
|
-
}
|
|
5365
|
+
}
|
|
4475
5366
|
}
|
|
4476
5367
|
}
|
|
4477
5368
|
|
|
@@ -7173,7 +8064,7 @@ let tokenize;
|
|
|
7173
8064
|
return "keyword";
|
|
7174
8065
|
}
|
|
7175
8066
|
|
|
7176
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.
|
|
8067
|
+
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
|
|
7177
8068
|
return "jsxIdentifier";
|
|
7178
8069
|
}
|
|
7179
8070
|
|
|
@@ -10498,6 +11389,6 @@ async function updateConfig(project, codecovCfg, opts) {
|
|
|
10498
11389
|
}
|
|
10499
11390
|
|
|
10500
11391
|
export { updateConfig };
|
|
10501
|
-
// BUILD: Mon
|
|
11392
|
+
// BUILD: Mon Apr 11 2022 12:12:53 GMT+0000 (Coordinated Universal Time)
|
|
10502
11393
|
|
|
10503
11394
|
//# sourceMappingURL=index.js.map
|