@donmahallem/lerna2codecov 0.2.2 → 0.2.3

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.
Files changed (236) hide show
  1. package/dist/cjs/_virtual/git-host-info.cjs +8 -0
  2. package/dist/cjs/_virtual/git-host-info.cjs.map +1 -0
  3. package/dist/cjs/_virtual/index3.cjs +2 -2
  4. package/dist/cjs/_virtual/index4.cjs +2 -2
  5. package/dist/cjs/node_modules/@lerna/package/index.cjs +3 -4
  6. package/dist/cjs/node_modules/@lerna/package/index.cjs.map +1 -1
  7. package/dist/cjs/node_modules/hosted-git-info/git-host-info.cjs +89 -183
  8. package/dist/cjs/node_modules/hosted-git-info/git-host-info.cjs.map +1 -1
  9. package/dist/cjs/node_modules/hosted-git-info/git-host.cjs +165 -109
  10. package/dist/cjs/node_modules/hosted-git-info/git-host.cjs.map +1 -1
  11. package/dist/cjs/node_modules/hosted-git-info/index.cjs +157 -238
  12. package/dist/cjs/node_modules/hosted-git-info/index.cjs.map +1 -1
  13. package/dist/cjs/node_modules/load-json-file/index.cjs +7 -7
  14. package/dist/cjs/node_modules/lru-cache/index.cjs +343 -332
  15. package/dist/cjs/node_modules/lru-cache/index.cjs.map +1 -1
  16. package/dist/cjs/node_modules/npm-package-arg/npa.cjs +95 -141
  17. package/dist/cjs/node_modules/npm-package-arg/npa.cjs.map +1 -1
  18. package/dist/cjs/node_modules/semver/classes/comparator.cjs +6 -7
  19. package/dist/cjs/node_modules/semver/classes/comparator.cjs.map +1 -1
  20. package/dist/cjs/node_modules/semver/classes/range.cjs +6 -7
  21. package/dist/cjs/node_modules/semver/classes/range.cjs.map +1 -1
  22. package/dist/cjs/node_modules/semver/classes/semver.cjs +301 -292
  23. package/dist/cjs/node_modules/semver/classes/semver.cjs.map +1 -1
  24. package/dist/cjs/node_modules/semver/functions/clean.cjs +18 -8
  25. package/dist/cjs/node_modules/semver/functions/clean.cjs.map +1 -1
  26. package/dist/cjs/node_modules/semver/functions/cmp.cjs +60 -50
  27. package/dist/cjs/node_modules/semver/functions/cmp.cjs.map +1 -1
  28. package/dist/cjs/node_modules/semver/functions/coerce.cjs +67 -58
  29. package/dist/cjs/node_modules/semver/functions/coerce.cjs.map +1 -1
  30. package/dist/cjs/node_modules/semver/functions/compare-build.cjs +18 -8
  31. package/dist/cjs/node_modules/semver/functions/compare-build.cjs.map +1 -1
  32. package/dist/cjs/node_modules/semver/functions/compare-loose.cjs +15 -5
  33. package/dist/cjs/node_modules/semver/functions/compare-loose.cjs.map +1 -1
  34. package/dist/cjs/node_modules/semver/functions/compare.cjs +15 -5
  35. package/dist/cjs/node_modules/semver/functions/compare.cjs.map +1 -1
  36. package/dist/cjs/node_modules/semver/functions/diff.cjs +35 -25
  37. package/dist/cjs/node_modules/semver/functions/diff.cjs.map +1 -1
  38. package/dist/cjs/node_modules/semver/functions/eq.cjs +15 -5
  39. package/dist/cjs/node_modules/semver/functions/eq.cjs.map +1 -1
  40. package/dist/cjs/node_modules/semver/functions/gt.cjs +15 -5
  41. package/dist/cjs/node_modules/semver/functions/gt.cjs.map +1 -1
  42. package/dist/cjs/node_modules/semver/functions/gte.cjs +15 -5
  43. package/dist/cjs/node_modules/semver/functions/gte.cjs.map +1 -1
  44. package/dist/cjs/node_modules/semver/functions/inc.cjs +27 -17
  45. package/dist/cjs/node_modules/semver/functions/inc.cjs.map +1 -1
  46. package/dist/cjs/node_modules/semver/functions/lt.cjs +15 -5
  47. package/dist/cjs/node_modules/semver/functions/lt.cjs.map +1 -1
  48. package/dist/cjs/node_modules/semver/functions/lte.cjs +15 -5
  49. package/dist/cjs/node_modules/semver/functions/lte.cjs.map +1 -1
  50. package/dist/cjs/node_modules/semver/functions/major.cjs +14 -4
  51. package/dist/cjs/node_modules/semver/functions/major.cjs.map +1 -1
  52. package/dist/cjs/node_modules/semver/functions/minor.cjs +14 -4
  53. package/dist/cjs/node_modules/semver/functions/minor.cjs.map +1 -1
  54. package/dist/cjs/node_modules/semver/functions/neq.cjs +15 -5
  55. package/dist/cjs/node_modules/semver/functions/neq.cjs.map +1 -1
  56. package/dist/cjs/node_modules/semver/functions/parse.cjs +48 -39
  57. package/dist/cjs/node_modules/semver/functions/parse.cjs.map +1 -1
  58. package/dist/cjs/node_modules/semver/functions/patch.cjs +14 -4
  59. package/dist/cjs/node_modules/semver/functions/patch.cjs.map +1 -1
  60. package/dist/cjs/node_modules/semver/functions/prerelease.cjs +18 -8
  61. package/dist/cjs/node_modules/semver/functions/prerelease.cjs.map +1 -1
  62. package/dist/cjs/node_modules/semver/functions/rcompare.cjs +15 -5
  63. package/dist/cjs/node_modules/semver/functions/rcompare.cjs.map +1 -1
  64. package/dist/cjs/node_modules/semver/functions/rsort.cjs +15 -5
  65. package/dist/cjs/node_modules/semver/functions/rsort.cjs.map +1 -1
  66. package/dist/cjs/node_modules/semver/functions/satisfies.cjs +21 -11
  67. package/dist/cjs/node_modules/semver/functions/satisfies.cjs.map +1 -1
  68. package/dist/cjs/node_modules/semver/functions/sort.cjs +15 -5
  69. package/dist/cjs/node_modules/semver/functions/sort.cjs.map +1 -1
  70. package/dist/cjs/node_modules/semver/functions/valid.cjs +18 -8
  71. package/dist/cjs/node_modules/semver/functions/valid.cjs.map +1 -1
  72. package/dist/cjs/node_modules/semver/index.cjs +60 -51
  73. package/dist/cjs/node_modules/semver/index.cjs.map +1 -1
  74. package/dist/cjs/node_modules/semver/internal/constants.cjs +25 -15
  75. package/dist/cjs/node_modules/semver/internal/constants.cjs.map +1 -1
  76. package/dist/cjs/node_modules/semver/internal/debug.cjs +19 -9
  77. package/dist/cjs/node_modules/semver/internal/debug.cjs.map +1 -1
  78. package/dist/cjs/node_modules/semver/internal/identifiers.cjs +35 -25
  79. package/dist/cjs/node_modules/semver/internal/identifiers.cjs.map +1 -1
  80. package/dist/cjs/node_modules/semver/internal/parse-options.cjs +22 -12
  81. package/dist/cjs/node_modules/semver/internal/parse-options.cjs.map +1 -1
  82. package/dist/cjs/node_modules/semver/internal/re.cjs +172 -161
  83. package/dist/cjs/node_modules/semver/internal/re.cjs.map +1 -1
  84. package/dist/cjs/node_modules/semver/ranges/gtr.cjs +16 -6
  85. package/dist/cjs/node_modules/semver/ranges/gtr.cjs.map +1 -1
  86. package/dist/cjs/node_modules/semver/ranges/intersects.cjs +18 -8
  87. package/dist/cjs/node_modules/semver/ranges/intersects.cjs.map +1 -1
  88. package/dist/cjs/node_modules/semver/ranges/ltr.cjs +16 -6
  89. package/dist/cjs/node_modules/semver/ranges/ltr.cjs.map +1 -1
  90. package/dist/cjs/node_modules/semver/ranges/max-satisfying.cjs +35 -25
  91. package/dist/cjs/node_modules/semver/ranges/max-satisfying.cjs.map +1 -1
  92. package/dist/cjs/node_modules/semver/ranges/min-satisfying.cjs +35 -25
  93. package/dist/cjs/node_modules/semver/ranges/min-satisfying.cjs.map +1 -1
  94. package/dist/cjs/node_modules/semver/ranges/min-version.cjs +66 -56
  95. package/dist/cjs/node_modules/semver/ranges/min-version.cjs.map +1 -1
  96. package/dist/cjs/node_modules/semver/ranges/outside.cjs +86 -76
  97. package/dist/cjs/node_modules/semver/ranges/outside.cjs.map +1 -1
  98. package/dist/cjs/node_modules/semver/ranges/simplify.cjs +59 -49
  99. package/dist/cjs/node_modules/semver/ranges/simplify.cjs.map +1 -1
  100. package/dist/cjs/node_modules/semver/ranges/subset.cjs +259 -249
  101. package/dist/cjs/node_modules/semver/ranges/subset.cjs.map +1 -1
  102. package/dist/cjs/node_modules/semver/ranges/to-comparators.cjs +17 -7
  103. package/dist/cjs/node_modules/semver/ranges/to-comparators.cjs.map +1 -1
  104. package/dist/cjs/node_modules/semver/ranges/valid.cjs +22 -12
  105. package/dist/cjs/node_modules/semver/ranges/valid.cjs.map +1 -1
  106. package/dist/cjs/node_modules/supports-color/index.cjs +3 -3
  107. package/dist/cjs/node_modules/validate-npm-package-name/index.cjs +118 -108
  108. package/dist/cjs/node_modules/validate-npm-package-name/index.cjs.map +1 -1
  109. package/dist/cjs/node_modules/write-pkg/index.cjs +3 -3
  110. package/dist/cjs/node_modules/write-pkg/node_modules/make-dir/index.cjs +3 -3
  111. package/dist/cjs/node_modules/write-pkg/node_modules/make-dir/index.cjs.map +1 -1
  112. package/dist/cjs/node_modules/write-pkg/node_modules/write-file-atomic/index.cjs +3 -3
  113. package/dist/cjs/node_modules/write-pkg/node_modules/write-json-file/index.cjs +3 -3
  114. package/dist/cjs/node_modules/yallist/yallist.cjs +435 -425
  115. package/dist/cjs/node_modules/yallist/yallist.cjs.map +1 -1
  116. package/dist/cjs/update-config.cjs +2 -2
  117. package/dist/esm/_virtual/git-host-info.mjs +4 -0
  118. package/dist/esm/_virtual/git-host-info.mjs.map +1 -0
  119. package/dist/esm/_virtual/index3.mjs +2 -2
  120. package/dist/esm/_virtual/index4.mjs +2 -2
  121. package/dist/esm/node_modules/@lerna/package/index.mjs +2 -3
  122. package/dist/esm/node_modules/@lerna/package/index.mjs.map +1 -1
  123. package/dist/esm/node_modules/hosted-git-info/git-host-info.mjs +87 -183
  124. package/dist/esm/node_modules/hosted-git-info/git-host-info.mjs.map +1 -1
  125. package/dist/esm/node_modules/hosted-git-info/git-host.mjs +165 -111
  126. package/dist/esm/node_modules/hosted-git-info/git-host.mjs.map +1 -1
  127. package/dist/esm/node_modules/hosted-git-info/index.mjs +159 -242
  128. package/dist/esm/node_modules/hosted-git-info/index.mjs.map +1 -1
  129. package/dist/esm/node_modules/load-json-file/index.mjs +2 -2
  130. package/dist/esm/node_modules/load-json-file/index.mjs.map +1 -1
  131. package/dist/esm/node_modules/lru-cache/index.mjs +343 -334
  132. package/dist/esm/node_modules/lru-cache/index.mjs.map +1 -1
  133. package/dist/esm/node_modules/npm-package-arg/npa.mjs +93 -139
  134. package/dist/esm/node_modules/npm-package-arg/npa.mjs.map +1 -1
  135. package/dist/esm/node_modules/semver/classes/comparator.mjs +11 -12
  136. package/dist/esm/node_modules/semver/classes/comparator.mjs.map +1 -1
  137. package/dist/esm/node_modules/semver/classes/range.mjs +21 -22
  138. package/dist/esm/node_modules/semver/classes/range.mjs.map +1 -1
  139. package/dist/esm/node_modules/semver/classes/semver.mjs +301 -294
  140. package/dist/esm/node_modules/semver/classes/semver.mjs.map +1 -1
  141. package/dist/esm/node_modules/semver/functions/clean.mjs +16 -8
  142. package/dist/esm/node_modules/semver/functions/clean.mjs.map +1 -1
  143. package/dist/esm/node_modules/semver/functions/cmp.mjs +69 -61
  144. package/dist/esm/node_modules/semver/functions/cmp.mjs.map +1 -1
  145. package/dist/esm/node_modules/semver/functions/coerce.mjs +66 -59
  146. package/dist/esm/node_modules/semver/functions/coerce.mjs.map +1 -1
  147. package/dist/esm/node_modules/semver/functions/compare-build.mjs +17 -9
  148. package/dist/esm/node_modules/semver/functions/compare-build.mjs.map +1 -1
  149. package/dist/esm/node_modules/semver/functions/compare-loose.mjs +13 -5
  150. package/dist/esm/node_modules/semver/functions/compare-loose.mjs.map +1 -1
  151. package/dist/esm/node_modules/semver/functions/compare.mjs +14 -6
  152. package/dist/esm/node_modules/semver/functions/compare.mjs.map +1 -1
  153. package/dist/esm/node_modules/semver/functions/diff.mjs +33 -25
  154. package/dist/esm/node_modules/semver/functions/diff.mjs.map +1 -1
  155. package/dist/esm/node_modules/semver/functions/eq.mjs +13 -5
  156. package/dist/esm/node_modules/semver/functions/eq.mjs.map +1 -1
  157. package/dist/esm/node_modules/semver/functions/gt.mjs +13 -5
  158. package/dist/esm/node_modules/semver/functions/gt.mjs.map +1 -1
  159. package/dist/esm/node_modules/semver/functions/gte.mjs +13 -5
  160. package/dist/esm/node_modules/semver/functions/gte.mjs.map +1 -1
  161. package/dist/esm/node_modules/semver/functions/inc.mjs +26 -18
  162. package/dist/esm/node_modules/semver/functions/inc.mjs.map +1 -1
  163. package/dist/esm/node_modules/semver/functions/lt.mjs +13 -5
  164. package/dist/esm/node_modules/semver/functions/lt.mjs.map +1 -1
  165. package/dist/esm/node_modules/semver/functions/lte.mjs +13 -5
  166. package/dist/esm/node_modules/semver/functions/lte.mjs.map +1 -1
  167. package/dist/esm/node_modules/semver/functions/major.mjs +13 -5
  168. package/dist/esm/node_modules/semver/functions/major.mjs.map +1 -1
  169. package/dist/esm/node_modules/semver/functions/minor.mjs +13 -5
  170. package/dist/esm/node_modules/semver/functions/minor.mjs.map +1 -1
  171. package/dist/esm/node_modules/semver/functions/neq.mjs +13 -5
  172. package/dist/esm/node_modules/semver/functions/neq.mjs.map +1 -1
  173. package/dist/esm/node_modules/semver/functions/parse.mjs +48 -41
  174. package/dist/esm/node_modules/semver/functions/parse.mjs.map +1 -1
  175. package/dist/esm/node_modules/semver/functions/patch.mjs +13 -5
  176. package/dist/esm/node_modules/semver/functions/patch.mjs.map +1 -1
  177. package/dist/esm/node_modules/semver/functions/prerelease.mjs +16 -8
  178. package/dist/esm/node_modules/semver/functions/prerelease.mjs.map +1 -1
  179. package/dist/esm/node_modules/semver/functions/rcompare.mjs +13 -5
  180. package/dist/esm/node_modules/semver/functions/rcompare.mjs.map +1 -1
  181. package/dist/esm/node_modules/semver/functions/rsort.mjs +13 -5
  182. package/dist/esm/node_modules/semver/functions/rsort.mjs.map +1 -1
  183. package/dist/esm/node_modules/semver/functions/satisfies.mjs +19 -11
  184. package/dist/esm/node_modules/semver/functions/satisfies.mjs.map +1 -1
  185. package/dist/esm/node_modules/semver/functions/sort.mjs +13 -5
  186. package/dist/esm/node_modules/semver/functions/sort.mjs.map +1 -1
  187. package/dist/esm/node_modules/semver/functions/valid.mjs +16 -8
  188. package/dist/esm/node_modules/semver/functions/valid.mjs.map +1 -1
  189. package/dist/esm/node_modules/semver/index.mjs +96 -89
  190. package/dist/esm/node_modules/semver/index.mjs.map +1 -1
  191. package/dist/esm/node_modules/semver/internal/constants.mjs +23 -15
  192. package/dist/esm/node_modules/semver/internal/constants.mjs.map +1 -1
  193. package/dist/esm/node_modules/semver/internal/debug.mjs +17 -9
  194. package/dist/esm/node_modules/semver/internal/debug.mjs.map +1 -1
  195. package/dist/esm/node_modules/semver/internal/identifiers.mjs +28 -20
  196. package/dist/esm/node_modules/semver/internal/identifiers.mjs.map +1 -1
  197. package/dist/esm/node_modules/semver/internal/parse-options.mjs +20 -12
  198. package/dist/esm/node_modules/semver/internal/parse-options.mjs.map +1 -1
  199. package/dist/esm/node_modules/semver/internal/re.mjs +175 -166
  200. package/dist/esm/node_modules/semver/internal/re.mjs.map +1 -1
  201. package/dist/esm/node_modules/semver/ranges/gtr.mjs +14 -6
  202. package/dist/esm/node_modules/semver/ranges/gtr.mjs.map +1 -1
  203. package/dist/esm/node_modules/semver/ranges/intersects.mjs +16 -8
  204. package/dist/esm/node_modules/semver/ranges/intersects.mjs.map +1 -1
  205. package/dist/esm/node_modules/semver/ranges/ltr.mjs +14 -6
  206. package/dist/esm/node_modules/semver/ranges/ltr.mjs.map +1 -1
  207. package/dist/esm/node_modules/semver/ranges/max-satisfying.mjs +34 -26
  208. package/dist/esm/node_modules/semver/ranges/max-satisfying.mjs.map +1 -1
  209. package/dist/esm/node_modules/semver/ranges/min-satisfying.mjs +34 -26
  210. package/dist/esm/node_modules/semver/ranges/min-satisfying.mjs.map +1 -1
  211. package/dist/esm/node_modules/semver/ranges/min-version.mjs +65 -57
  212. package/dist/esm/node_modules/semver/ranges/min-version.mjs.map +1 -1
  213. package/dist/esm/node_modules/semver/ranges/outside.mjs +85 -77
  214. package/dist/esm/node_modules/semver/ranges/outside.mjs.map +1 -1
  215. package/dist/esm/node_modules/semver/ranges/simplify.mjs +57 -49
  216. package/dist/esm/node_modules/semver/ranges/simplify.mjs.map +1 -1
  217. package/dist/esm/node_modules/semver/ranges/subset.mjs +257 -249
  218. package/dist/esm/node_modules/semver/ranges/subset.mjs.map +1 -1
  219. package/dist/esm/node_modules/semver/ranges/to-comparators.mjs +15 -7
  220. package/dist/esm/node_modules/semver/ranges/to-comparators.mjs.map +1 -1
  221. package/dist/esm/node_modules/semver/ranges/valid.mjs +20 -12
  222. package/dist/esm/node_modules/semver/ranges/valid.mjs.map +1 -1
  223. package/dist/esm/node_modules/supports-color/index.mjs +2 -2
  224. package/dist/esm/node_modules/validate-npm-package-name/index.mjs +114 -107
  225. package/dist/esm/node_modules/validate-npm-package-name/index.mjs.map +1 -1
  226. package/dist/esm/node_modules/write-pkg/index.mjs +2 -2
  227. package/dist/esm/node_modules/write-pkg/index.mjs.map +1 -1
  228. package/dist/esm/node_modules/write-pkg/node_modules/make-dir/index.mjs +2 -2
  229. package/dist/esm/node_modules/write-pkg/node_modules/make-dir/index.mjs.map +1 -1
  230. package/dist/esm/node_modules/write-pkg/node_modules/write-file-atomic/index.mjs +2 -2
  231. package/dist/esm/node_modules/write-pkg/node_modules/write-file-atomic/index.mjs.map +1 -1
  232. package/dist/esm/node_modules/write-pkg/node_modules/write-json-file/index.mjs +2 -2
  233. package/dist/esm/node_modules/write-pkg/node_modules/write-json-file/index.mjs.map +1 -1
  234. package/dist/esm/node_modules/yallist/yallist.mjs +433 -425
  235. package/dist/esm/node_modules/yallist/yallist.mjs.map +1 -1
  236. package/package.json +4 -4
@@ -1,339 +1,350 @@
1
1
  'use strict';
2
2
 
3
- const yallist = require('../yallist/yallist.cjs');
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- // A linked list to keep track of recently-used-ness
6
- const Yallist = yallist;
7
-
8
- const MAX = Symbol('max');
9
- const LENGTH = Symbol('length');
10
- const LENGTH_CALCULATOR = Symbol('lengthCalculator');
11
- const ALLOW_STALE = Symbol('allowStale');
12
- const MAX_AGE = Symbol('maxAge');
13
- const DISPOSE = Symbol('dispose');
14
- const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
15
- const LRU_LIST = Symbol('lruList');
16
- const CACHE = Symbol('cache');
17
- const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
18
-
19
- const naiveLength = () => 1;
20
-
21
- // lruList is a yallist where the head is the youngest
22
- // item, and the tail is the oldest. the list contains the Hit
23
- // objects as the entries.
24
- // Each Hit object has a reference to its Yallist.Node. This
25
- // never changes.
26
- //
27
- // cache is a Map (or PseudoMap) that matches the keys to
28
- // the Yallist.Node object.
29
- class LRUCache {
30
- constructor (options) {
31
- if (typeof options === 'number')
32
- options = { max: options };
33
-
34
- if (!options)
35
- options = {};
36
-
37
- if (options.max && (typeof options.max !== 'number' || options.max < 0))
38
- throw new TypeError('max must be a non-negative number')
39
- // Kind of weird to have a default max of Infinity, but oh well.
40
- this[MAX] = options.max || Infinity;
41
-
42
- const lc = options.length || naiveLength;
43
- this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
44
- this[ALLOW_STALE] = options.stale || false;
45
- if (options.maxAge && typeof options.maxAge !== 'number')
46
- throw new TypeError('maxAge must be a number')
47
- this[MAX_AGE] = options.maxAge || 0;
48
- this[DISPOSE] = options.dispose;
49
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
50
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
51
- this.reset();
52
- }
53
-
54
- // resize the cache when the max changes.
55
- set max (mL) {
56
- if (typeof mL !== 'number' || mL < 0)
57
- throw new TypeError('max must be a non-negative number')
58
-
59
- this[MAX] = mL || Infinity;
60
- trim(this);
61
- }
62
- get max () {
63
- return this[MAX]
64
- }
65
-
66
- set allowStale (allowStale) {
67
- this[ALLOW_STALE] = !!allowStale;
68
- }
69
- get allowStale () {
70
- return this[ALLOW_STALE]
71
- }
72
-
73
- set maxAge (mA) {
74
- if (typeof mA !== 'number')
75
- throw new TypeError('maxAge must be a non-negative number')
76
-
77
- this[MAX_AGE] = mA;
78
- trim(this);
79
- }
80
- get maxAge () {
81
- return this[MAX_AGE]
82
- }
83
-
84
- // resize the cache when the lengthCalculator changes.
85
- set lengthCalculator (lC) {
86
- if (typeof lC !== 'function')
87
- lC = naiveLength;
88
-
89
- if (lC !== this[LENGTH_CALCULATOR]) {
90
- this[LENGTH_CALCULATOR] = lC;
91
- this[LENGTH] = 0;
92
- this[LRU_LIST].forEach(hit => {
93
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
94
- this[LENGTH] += hit.length;
95
- });
96
- }
97
- trim(this);
98
- }
99
- get lengthCalculator () { return this[LENGTH_CALCULATOR] }
100
-
101
- get length () { return this[LENGTH] }
102
- get itemCount () { return this[LRU_LIST].length }
103
-
104
- rforEach (fn, thisp) {
105
- thisp = thisp || this;
106
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
107
- const prev = walker.prev;
108
- forEachStep(this, fn, walker, thisp);
109
- walker = prev;
110
- }
111
- }
112
-
113
- forEach (fn, thisp) {
114
- thisp = thisp || this;
115
- for (let walker = this[LRU_LIST].head; walker !== null;) {
116
- const next = walker.next;
117
- forEachStep(this, fn, walker, thisp);
118
- walker = next;
119
- }
120
- }
121
-
122
- keys () {
123
- return this[LRU_LIST].toArray().map(k => k.key)
124
- }
125
-
126
- values () {
127
- return this[LRU_LIST].toArray().map(k => k.value)
128
- }
129
-
130
- reset () {
131
- if (this[DISPOSE] &&
132
- this[LRU_LIST] &&
133
- this[LRU_LIST].length) {
134
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
135
- }
136
-
137
- this[CACHE] = new Map(); // hash of items by key
138
- this[LRU_LIST] = new Yallist(); // list of items in order of use recency
139
- this[LENGTH] = 0; // length of items in the list
140
- }
141
-
142
- dump () {
143
- return this[LRU_LIST].map(hit =>
144
- isStale(this, hit) ? false : {
145
- k: hit.key,
146
- v: hit.value,
147
- e: hit.now + (hit.maxAge || 0)
148
- }).toArray().filter(h => h)
149
- }
150
-
151
- dumpLru () {
152
- return this[LRU_LIST]
153
- }
154
-
155
- set (key, value, maxAge) {
156
- maxAge = maxAge || this[MAX_AGE];
157
-
158
- if (maxAge && typeof maxAge !== 'number')
159
- throw new TypeError('maxAge must be a number')
160
-
161
- const now = maxAge ? Date.now() : 0;
162
- const len = this[LENGTH_CALCULATOR](value, key);
163
-
164
- if (this[CACHE].has(key)) {
165
- if (len > this[MAX]) {
166
- del(this, this[CACHE].get(key));
167
- return false
168
- }
169
-
170
- const node = this[CACHE].get(key);
171
- const item = node.value;
172
-
173
- // dispose of the old one before overwriting
174
- // split out into 2 ifs for better coverage tracking
175
- if (this[DISPOSE]) {
176
- if (!this[NO_DISPOSE_ON_SET])
177
- this[DISPOSE](key, item.value);
178
- }
179
-
180
- item.now = now;
181
- item.maxAge = maxAge;
182
- item.value = value;
183
- this[LENGTH] += len - item.length;
184
- item.length = len;
185
- this.get(key);
186
- trim(this);
187
- return true
188
- }
189
-
190
- const hit = new Entry(key, value, len, now, maxAge);
191
-
192
- // oversized objects fall out of cache automatically.
193
- if (hit.length > this[MAX]) {
194
- if (this[DISPOSE])
195
- this[DISPOSE](key, value);
196
-
197
- return false
198
- }
199
-
200
- this[LENGTH] += hit.length;
201
- this[LRU_LIST].unshift(hit);
202
- this[CACHE].set(key, this[LRU_LIST].head);
203
- trim(this);
204
- return true
205
- }
206
-
207
- has (key) {
208
- if (!this[CACHE].has(key)) return false
209
- const hit = this[CACHE].get(key).value;
210
- return !isStale(this, hit)
211
- }
212
-
213
- get (key) {
214
- return get(this, key, true)
215
- }
216
-
217
- peek (key) {
218
- return get(this, key, false)
219
- }
220
-
221
- pop () {
222
- const node = this[LRU_LIST].tail;
223
- if (!node)
224
- return null
225
-
226
- del(this, node);
227
- return node.value
228
- }
229
-
230
- del (key) {
231
- del(this, this[CACHE].get(key));
232
- }
233
-
234
- load (arr) {
235
- // reset the cache
236
- this.reset();
237
-
238
- const now = Date.now();
239
- // A previous serialized cache has the most recent items first
240
- for (let l = arr.length - 1; l >= 0; l--) {
241
- const hit = arr[l];
242
- const expiresAt = hit.e || 0;
243
- if (expiresAt === 0)
244
- // the item was created without expiration in a non aged cache
245
- this.set(hit.k, hit.v);
246
- else {
247
- const maxAge = expiresAt - now;
248
- // dont add already expired items
249
- if (maxAge > 0) {
250
- this.set(hit.k, hit.v, maxAge);
251
- }
252
- }
253
- }
254
- }
255
-
256
- prune () {
257
- this[CACHE].forEach((value, key) => get(this, key, false));
258
- }
259
- }
5
+ const yallist = require('../yallist/yallist.cjs');
260
6
 
261
- const get = (self, key, doUse) => {
262
- const node = self[CACHE].get(key);
263
- if (node) {
264
- const hit = node.value;
265
- if (isStale(self, hit)) {
266
- del(self, node);
267
- if (!self[ALLOW_STALE])
268
- return undefined
269
- } else {
270
- if (doUse) {
271
- if (self[UPDATE_AGE_ON_GET])
272
- node.value.now = Date.now();
273
- self[LRU_LIST].unshiftNode(node);
274
- }
275
- }
276
- return hit.value
277
- }
278
- };
279
-
280
- const isStale = (self, hit) => {
281
- if (!hit || (!hit.maxAge && !self[MAX_AGE]))
282
- return false
283
-
284
- const diff = Date.now() - hit.now;
285
- return hit.maxAge ? diff > hit.maxAge
286
- : self[MAX_AGE] && (diff > self[MAX_AGE])
287
- };
288
-
289
- const trim = self => {
290
- if (self[LENGTH] > self[MAX]) {
291
- for (let walker = self[LRU_LIST].tail;
292
- self[LENGTH] > self[MAX] && walker !== null;) {
293
- // We know that we're about to delete this one, and also
294
- // what the next least recently used key will be, so just
295
- // go ahead and set it now.
296
- const prev = walker.prev;
297
- del(self, walker);
298
- walker = prev;
299
- }
300
- }
301
- };
302
-
303
- const del = (self, node) => {
304
- if (node) {
305
- const hit = node.value;
306
- if (self[DISPOSE])
307
- self[DISPOSE](hit.key, hit.value);
308
-
309
- self[LENGTH] -= hit.length;
310
- self[CACHE].delete(hit.key);
311
- self[LRU_LIST].removeNode(node);
312
- }
313
- };
314
-
315
- class Entry {
316
- constructor (key, value, length, now, maxAge) {
317
- this.key = key;
318
- this.value = value;
319
- this.length = length;
320
- this.now = now;
321
- this.maxAge = maxAge || 0;
322
- }
7
+ var lruCache;
8
+ var hasRequiredLruCache;
9
+
10
+ function requireLruCache () {
11
+ if (hasRequiredLruCache) return lruCache;
12
+ hasRequiredLruCache = 1;
13
+
14
+ // A linked list to keep track of recently-used-ness
15
+ const Yallist = yallist.__require();
16
+
17
+ const MAX = Symbol('max');
18
+ const LENGTH = Symbol('length');
19
+ const LENGTH_CALCULATOR = Symbol('lengthCalculator');
20
+ const ALLOW_STALE = Symbol('allowStale');
21
+ const MAX_AGE = Symbol('maxAge');
22
+ const DISPOSE = Symbol('dispose');
23
+ const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
24
+ const LRU_LIST = Symbol('lruList');
25
+ const CACHE = Symbol('cache');
26
+ const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
27
+
28
+ const naiveLength = () => 1;
29
+
30
+ // lruList is a yallist where the head is the youngest
31
+ // item, and the tail is the oldest. the list contains the Hit
32
+ // objects as the entries.
33
+ // Each Hit object has a reference to its Yallist.Node. This
34
+ // never changes.
35
+ //
36
+ // cache is a Map (or PseudoMap) that matches the keys to
37
+ // the Yallist.Node object.
38
+ class LRUCache {
39
+ constructor (options) {
40
+ if (typeof options === 'number')
41
+ options = { max: options };
42
+
43
+ if (!options)
44
+ options = {};
45
+
46
+ if (options.max && (typeof options.max !== 'number' || options.max < 0))
47
+ throw new TypeError('max must be a non-negative number')
48
+ // Kind of weird to have a default max of Infinity, but oh well.
49
+ this[MAX] = options.max || Infinity;
50
+
51
+ const lc = options.length || naiveLength;
52
+ this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;
53
+ this[ALLOW_STALE] = options.stale || false;
54
+ if (options.maxAge && typeof options.maxAge !== 'number')
55
+ throw new TypeError('maxAge must be a number')
56
+ this[MAX_AGE] = options.maxAge || 0;
57
+ this[DISPOSE] = options.dispose;
58
+ this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
59
+ this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
60
+ this.reset();
61
+ }
62
+
63
+ // resize the cache when the max changes.
64
+ set max (mL) {
65
+ if (typeof mL !== 'number' || mL < 0)
66
+ throw new TypeError('max must be a non-negative number')
67
+
68
+ this[MAX] = mL || Infinity;
69
+ trim(this);
70
+ }
71
+ get max () {
72
+ return this[MAX]
73
+ }
74
+
75
+ set allowStale (allowStale) {
76
+ this[ALLOW_STALE] = !!allowStale;
77
+ }
78
+ get allowStale () {
79
+ return this[ALLOW_STALE]
80
+ }
81
+
82
+ set maxAge (mA) {
83
+ if (typeof mA !== 'number')
84
+ throw new TypeError('maxAge must be a non-negative number')
85
+
86
+ this[MAX_AGE] = mA;
87
+ trim(this);
88
+ }
89
+ get maxAge () {
90
+ return this[MAX_AGE]
91
+ }
92
+
93
+ // resize the cache when the lengthCalculator changes.
94
+ set lengthCalculator (lC) {
95
+ if (typeof lC !== 'function')
96
+ lC = naiveLength;
97
+
98
+ if (lC !== this[LENGTH_CALCULATOR]) {
99
+ this[LENGTH_CALCULATOR] = lC;
100
+ this[LENGTH] = 0;
101
+ this[LRU_LIST].forEach(hit => {
102
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
103
+ this[LENGTH] += hit.length;
104
+ });
105
+ }
106
+ trim(this);
107
+ }
108
+ get lengthCalculator () { return this[LENGTH_CALCULATOR] }
109
+
110
+ get length () { return this[LENGTH] }
111
+ get itemCount () { return this[LRU_LIST].length }
112
+
113
+ rforEach (fn, thisp) {
114
+ thisp = thisp || this;
115
+ for (let walker = this[LRU_LIST].tail; walker !== null;) {
116
+ const prev = walker.prev;
117
+ forEachStep(this, fn, walker, thisp);
118
+ walker = prev;
119
+ }
120
+ }
121
+
122
+ forEach (fn, thisp) {
123
+ thisp = thisp || this;
124
+ for (let walker = this[LRU_LIST].head; walker !== null;) {
125
+ const next = walker.next;
126
+ forEachStep(this, fn, walker, thisp);
127
+ walker = next;
128
+ }
129
+ }
130
+
131
+ keys () {
132
+ return this[LRU_LIST].toArray().map(k => k.key)
133
+ }
134
+
135
+ values () {
136
+ return this[LRU_LIST].toArray().map(k => k.value)
137
+ }
138
+
139
+ reset () {
140
+ if (this[DISPOSE] &&
141
+ this[LRU_LIST] &&
142
+ this[LRU_LIST].length) {
143
+ this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
144
+ }
145
+
146
+ this[CACHE] = new Map(); // hash of items by key
147
+ this[LRU_LIST] = new Yallist(); // list of items in order of use recency
148
+ this[LENGTH] = 0; // length of items in the list
149
+ }
150
+
151
+ dump () {
152
+ return this[LRU_LIST].map(hit =>
153
+ isStale(this, hit) ? false : {
154
+ k: hit.key,
155
+ v: hit.value,
156
+ e: hit.now + (hit.maxAge || 0)
157
+ }).toArray().filter(h => h)
158
+ }
159
+
160
+ dumpLru () {
161
+ return this[LRU_LIST]
162
+ }
163
+
164
+ set (key, value, maxAge) {
165
+ maxAge = maxAge || this[MAX_AGE];
166
+
167
+ if (maxAge && typeof maxAge !== 'number')
168
+ throw new TypeError('maxAge must be a number')
169
+
170
+ const now = maxAge ? Date.now() : 0;
171
+ const len = this[LENGTH_CALCULATOR](value, key);
172
+
173
+ if (this[CACHE].has(key)) {
174
+ if (len > this[MAX]) {
175
+ del(this, this[CACHE].get(key));
176
+ return false
177
+ }
178
+
179
+ const node = this[CACHE].get(key);
180
+ const item = node.value;
181
+
182
+ // dispose of the old one before overwriting
183
+ // split out into 2 ifs for better coverage tracking
184
+ if (this[DISPOSE]) {
185
+ if (!this[NO_DISPOSE_ON_SET])
186
+ this[DISPOSE](key, item.value);
187
+ }
188
+
189
+ item.now = now;
190
+ item.maxAge = maxAge;
191
+ item.value = value;
192
+ this[LENGTH] += len - item.length;
193
+ item.length = len;
194
+ this.get(key);
195
+ trim(this);
196
+ return true
197
+ }
198
+
199
+ const hit = new Entry(key, value, len, now, maxAge);
200
+
201
+ // oversized objects fall out of cache automatically.
202
+ if (hit.length > this[MAX]) {
203
+ if (this[DISPOSE])
204
+ this[DISPOSE](key, value);
205
+
206
+ return false
207
+ }
208
+
209
+ this[LENGTH] += hit.length;
210
+ this[LRU_LIST].unshift(hit);
211
+ this[CACHE].set(key, this[LRU_LIST].head);
212
+ trim(this);
213
+ return true
214
+ }
215
+
216
+ has (key) {
217
+ if (!this[CACHE].has(key)) return false
218
+ const hit = this[CACHE].get(key).value;
219
+ return !isStale(this, hit)
220
+ }
221
+
222
+ get (key) {
223
+ return get(this, key, true)
224
+ }
225
+
226
+ peek (key) {
227
+ return get(this, key, false)
228
+ }
229
+
230
+ pop () {
231
+ const node = this[LRU_LIST].tail;
232
+ if (!node)
233
+ return null
234
+
235
+ del(this, node);
236
+ return node.value
237
+ }
238
+
239
+ del (key) {
240
+ del(this, this[CACHE].get(key));
241
+ }
242
+
243
+ load (arr) {
244
+ // reset the cache
245
+ this.reset();
246
+
247
+ const now = Date.now();
248
+ // A previous serialized cache has the most recent items first
249
+ for (let l = arr.length - 1; l >= 0; l--) {
250
+ const hit = arr[l];
251
+ const expiresAt = hit.e || 0;
252
+ if (expiresAt === 0)
253
+ // the item was created without expiration in a non aged cache
254
+ this.set(hit.k, hit.v);
255
+ else {
256
+ const maxAge = expiresAt - now;
257
+ // dont add already expired items
258
+ if (maxAge > 0) {
259
+ this.set(hit.k, hit.v, maxAge);
260
+ }
261
+ }
262
+ }
263
+ }
264
+
265
+ prune () {
266
+ this[CACHE].forEach((value, key) => get(this, key, false));
267
+ }
268
+ }
269
+
270
+ const get = (self, key, doUse) => {
271
+ const node = self[CACHE].get(key);
272
+ if (node) {
273
+ const hit = node.value;
274
+ if (isStale(self, hit)) {
275
+ del(self, node);
276
+ if (!self[ALLOW_STALE])
277
+ return undefined
278
+ } else {
279
+ if (doUse) {
280
+ if (self[UPDATE_AGE_ON_GET])
281
+ node.value.now = Date.now();
282
+ self[LRU_LIST].unshiftNode(node);
283
+ }
284
+ }
285
+ return hit.value
286
+ }
287
+ };
288
+
289
+ const isStale = (self, hit) => {
290
+ if (!hit || (!hit.maxAge && !self[MAX_AGE]))
291
+ return false
292
+
293
+ const diff = Date.now() - hit.now;
294
+ return hit.maxAge ? diff > hit.maxAge
295
+ : self[MAX_AGE] && (diff > self[MAX_AGE])
296
+ };
297
+
298
+ const trim = self => {
299
+ if (self[LENGTH] > self[MAX]) {
300
+ for (let walker = self[LRU_LIST].tail;
301
+ self[LENGTH] > self[MAX] && walker !== null;) {
302
+ // We know that we're about to delete this one, and also
303
+ // what the next least recently used key will be, so just
304
+ // go ahead and set it now.
305
+ const prev = walker.prev;
306
+ del(self, walker);
307
+ walker = prev;
308
+ }
309
+ }
310
+ };
311
+
312
+ const del = (self, node) => {
313
+ if (node) {
314
+ const hit = node.value;
315
+ if (self[DISPOSE])
316
+ self[DISPOSE](hit.key, hit.value);
317
+
318
+ self[LENGTH] -= hit.length;
319
+ self[CACHE].delete(hit.key);
320
+ self[LRU_LIST].removeNode(node);
321
+ }
322
+ };
323
+
324
+ class Entry {
325
+ constructor (key, value, length, now, maxAge) {
326
+ this.key = key;
327
+ this.value = value;
328
+ this.length = length;
329
+ this.now = now;
330
+ this.maxAge = maxAge || 0;
331
+ }
332
+ }
333
+
334
+ const forEachStep = (self, fn, node, thisp) => {
335
+ let hit = node.value;
336
+ if (isStale(self, hit)) {
337
+ del(self, node);
338
+ if (!self[ALLOW_STALE])
339
+ hit = undefined;
340
+ }
341
+ if (hit)
342
+ fn.call(thisp, hit.value, hit.key, self);
343
+ };
344
+
345
+ lruCache = LRUCache;
346
+ return lruCache;
323
347
  }
324
348
 
325
- const forEachStep = (self, fn, node, thisp) => {
326
- let hit = node.value;
327
- if (isStale(self, hit)) {
328
- del(self, node);
329
- if (!self[ALLOW_STALE])
330
- hit = undefined;
331
- }
332
- if (hit)
333
- fn.call(thisp, hit.value, hit.key, self);
334
- };
335
-
336
- var lruCache = LRUCache;
337
-
338
- module.exports = lruCache;
349
+ exports.__require = requireLruCache;
339
350
  //# sourceMappingURL=index.cjs.map