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