html-validate-vue 4.2.1 → 4.2.2
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/index.js +769 -666
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ var require_re = __commonJS({
|
|
|
71
71
|
var R = 0;
|
|
72
72
|
var createToken = (name, value, isGlobal) => {
|
|
73
73
|
const index = R++;
|
|
74
|
-
debug(index, value);
|
|
74
|
+
debug(name, index, value);
|
|
75
75
|
t[name] = index;
|
|
76
76
|
src[index] = value;
|
|
77
77
|
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
@@ -117,8 +117,8 @@ var require_re = __commonJS({
|
|
|
117
117
|
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
118
118
|
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
119
119
|
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
120
|
-
createToken("GTE0", "^\\s*>=\\s*0
|
|
121
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0
|
|
120
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
121
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
@@ -126,9 +126,9 @@ var require_re = __commonJS({
|
|
|
126
126
|
var require_parse_options = __commonJS({
|
|
127
127
|
"node_modules/semver/internal/parse-options.js"(exports2, module2) {
|
|
128
128
|
var opts = ["includePrerelease", "loose", "rtl"];
|
|
129
|
-
var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((
|
|
130
|
-
|
|
131
|
-
return
|
|
129
|
+
var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((o, k) => {
|
|
130
|
+
o[k] = true;
|
|
131
|
+
return o;
|
|
132
132
|
}, {});
|
|
133
133
|
module2.exports = parseOptions;
|
|
134
134
|
}
|
|
@@ -645,16 +645,20 @@ var require_cmp = __commonJS({
|
|
|
645
645
|
var cmp = (a, op, b, loose) => {
|
|
646
646
|
switch (op) {
|
|
647
647
|
case "===":
|
|
648
|
-
if (typeof a === "object")
|
|
648
|
+
if (typeof a === "object") {
|
|
649
649
|
a = a.version;
|
|
650
|
-
|
|
650
|
+
}
|
|
651
|
+
if (typeof b === "object") {
|
|
651
652
|
b = b.version;
|
|
653
|
+
}
|
|
652
654
|
return a === b;
|
|
653
655
|
case "!==":
|
|
654
|
-
if (typeof a === "object")
|
|
656
|
+
if (typeof a === "object") {
|
|
655
657
|
a = a.version;
|
|
656
|
-
|
|
658
|
+
}
|
|
659
|
+
if (typeof b === "object") {
|
|
657
660
|
b = b.version;
|
|
661
|
+
}
|
|
658
662
|
return a !== b;
|
|
659
663
|
case "":
|
|
660
664
|
case "=":
|
|
@@ -708,661 +712,724 @@ var require_coerce = __commonJS({
|
|
|
708
712
|
}
|
|
709
713
|
re[t.COERCERTL].lastIndex = -1;
|
|
710
714
|
}
|
|
711
|
-
if (match === null)
|
|
715
|
+
if (match === null) {
|
|
712
716
|
return null;
|
|
717
|
+
}
|
|
713
718
|
return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
|
|
714
719
|
};
|
|
715
720
|
module2.exports = coerce;
|
|
716
721
|
}
|
|
717
722
|
});
|
|
718
723
|
|
|
719
|
-
// node_modules/
|
|
720
|
-
var
|
|
721
|
-
"node_modules/
|
|
722
|
-
"
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
if (node === this.head) {
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
if (node.list) {
|
|
788
|
-
node.list.removeNode(node);
|
|
789
|
-
}
|
|
790
|
-
var head = this.head;
|
|
791
|
-
node.list = this;
|
|
792
|
-
node.next = head;
|
|
793
|
-
if (head) {
|
|
794
|
-
head.prev = node;
|
|
795
|
-
}
|
|
796
|
-
this.head = node;
|
|
797
|
-
if (!this.tail) {
|
|
798
|
-
this.tail = node;
|
|
799
|
-
}
|
|
800
|
-
this.length++;
|
|
801
|
-
};
|
|
802
|
-
Yallist.prototype.pushNode = function(node) {
|
|
803
|
-
if (node === this.tail) {
|
|
804
|
-
return;
|
|
805
|
-
}
|
|
806
|
-
if (node.list) {
|
|
807
|
-
node.list.removeNode(node);
|
|
808
|
-
}
|
|
809
|
-
var tail = this.tail;
|
|
810
|
-
node.list = this;
|
|
811
|
-
node.prev = tail;
|
|
812
|
-
if (tail) {
|
|
813
|
-
tail.next = node;
|
|
814
|
-
}
|
|
815
|
-
this.tail = node;
|
|
816
|
-
if (!this.head) {
|
|
817
|
-
this.head = node;
|
|
818
|
-
}
|
|
819
|
-
this.length++;
|
|
820
|
-
};
|
|
821
|
-
Yallist.prototype.push = function() {
|
|
822
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
823
|
-
push(this, arguments[i]);
|
|
824
|
-
}
|
|
825
|
-
return this.length;
|
|
826
|
-
};
|
|
827
|
-
Yallist.prototype.unshift = function() {
|
|
828
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
829
|
-
unshift(this, arguments[i]);
|
|
830
|
-
}
|
|
831
|
-
return this.length;
|
|
832
|
-
};
|
|
833
|
-
Yallist.prototype.pop = function() {
|
|
834
|
-
if (!this.tail) {
|
|
835
|
-
return void 0;
|
|
836
|
-
}
|
|
837
|
-
var res = this.tail.value;
|
|
838
|
-
this.tail = this.tail.prev;
|
|
839
|
-
if (this.tail) {
|
|
840
|
-
this.tail.next = null;
|
|
841
|
-
} else {
|
|
842
|
-
this.head = null;
|
|
843
|
-
}
|
|
844
|
-
this.length--;
|
|
845
|
-
return res;
|
|
846
|
-
};
|
|
847
|
-
Yallist.prototype.shift = function() {
|
|
848
|
-
if (!this.head) {
|
|
849
|
-
return void 0;
|
|
850
|
-
}
|
|
851
|
-
var res = this.head.value;
|
|
852
|
-
this.head = this.head.next;
|
|
853
|
-
if (this.head) {
|
|
854
|
-
this.head.prev = null;
|
|
855
|
-
} else {
|
|
856
|
-
this.tail = null;
|
|
857
|
-
}
|
|
858
|
-
this.length--;
|
|
859
|
-
return res;
|
|
860
|
-
};
|
|
861
|
-
Yallist.prototype.forEach = function(fn, thisp) {
|
|
862
|
-
thisp = thisp || this;
|
|
863
|
-
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
864
|
-
fn.call(thisp, walker.value, i, this);
|
|
865
|
-
walker = walker.next;
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
Yallist.prototype.forEachReverse = function(fn, thisp) {
|
|
869
|
-
thisp = thisp || this;
|
|
870
|
-
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
871
|
-
fn.call(thisp, walker.value, i, this);
|
|
872
|
-
walker = walker.prev;
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
Yallist.prototype.get = function(n) {
|
|
876
|
-
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
877
|
-
walker = walker.next;
|
|
878
|
-
}
|
|
879
|
-
if (i === n && walker !== null) {
|
|
880
|
-
return walker.value;
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
Yallist.prototype.getReverse = function(n) {
|
|
884
|
-
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
885
|
-
walker = walker.prev;
|
|
886
|
-
}
|
|
887
|
-
if (i === n && walker !== null) {
|
|
888
|
-
return walker.value;
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
Yallist.prototype.map = function(fn, thisp) {
|
|
892
|
-
thisp = thisp || this;
|
|
893
|
-
var res = new Yallist();
|
|
894
|
-
for (var walker = this.head; walker !== null; ) {
|
|
895
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
896
|
-
walker = walker.next;
|
|
897
|
-
}
|
|
898
|
-
return res;
|
|
899
|
-
};
|
|
900
|
-
Yallist.prototype.mapReverse = function(fn, thisp) {
|
|
901
|
-
thisp = thisp || this;
|
|
902
|
-
var res = new Yallist();
|
|
903
|
-
for (var walker = this.tail; walker !== null; ) {
|
|
904
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
905
|
-
walker = walker.prev;
|
|
906
|
-
}
|
|
907
|
-
return res;
|
|
908
|
-
};
|
|
909
|
-
Yallist.prototype.reduce = function(fn, initial) {
|
|
910
|
-
var acc;
|
|
911
|
-
var walker = this.head;
|
|
912
|
-
if (arguments.length > 1) {
|
|
913
|
-
acc = initial;
|
|
914
|
-
} else if (this.head) {
|
|
915
|
-
walker = this.head.next;
|
|
916
|
-
acc = this.head.value;
|
|
917
|
-
} else {
|
|
918
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
919
|
-
}
|
|
920
|
-
for (var i = 0; walker !== null; i++) {
|
|
921
|
-
acc = fn(acc, walker.value, i);
|
|
922
|
-
walker = walker.next;
|
|
923
|
-
}
|
|
924
|
-
return acc;
|
|
925
|
-
};
|
|
926
|
-
Yallist.prototype.reduceReverse = function(fn, initial) {
|
|
927
|
-
var acc;
|
|
928
|
-
var walker = this.tail;
|
|
929
|
-
if (arguments.length > 1) {
|
|
930
|
-
acc = initial;
|
|
931
|
-
} else if (this.tail) {
|
|
932
|
-
walker = this.tail.prev;
|
|
933
|
-
acc = this.tail.value;
|
|
934
|
-
} else {
|
|
935
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
936
|
-
}
|
|
937
|
-
for (var i = this.length - 1; walker !== null; i--) {
|
|
938
|
-
acc = fn(acc, walker.value, i);
|
|
939
|
-
walker = walker.prev;
|
|
940
|
-
}
|
|
941
|
-
return acc;
|
|
942
|
-
};
|
|
943
|
-
Yallist.prototype.toArray = function() {
|
|
944
|
-
var arr = new Array(this.length);
|
|
945
|
-
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
946
|
-
arr[i] = walker.value;
|
|
947
|
-
walker = walker.next;
|
|
948
|
-
}
|
|
949
|
-
return arr;
|
|
950
|
-
};
|
|
951
|
-
Yallist.prototype.toArrayReverse = function() {
|
|
952
|
-
var arr = new Array(this.length);
|
|
953
|
-
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
954
|
-
arr[i] = walker.value;
|
|
955
|
-
walker = walker.prev;
|
|
956
|
-
}
|
|
957
|
-
return arr;
|
|
958
|
-
};
|
|
959
|
-
Yallist.prototype.slice = function(from, to) {
|
|
960
|
-
to = to || this.length;
|
|
961
|
-
if (to < 0) {
|
|
962
|
-
to += this.length;
|
|
963
|
-
}
|
|
964
|
-
from = from || 0;
|
|
965
|
-
if (from < 0) {
|
|
966
|
-
from += this.length;
|
|
967
|
-
}
|
|
968
|
-
var ret = new Yallist();
|
|
969
|
-
if (to < from || to < 0) {
|
|
970
|
-
return ret;
|
|
971
|
-
}
|
|
972
|
-
if (from < 0) {
|
|
973
|
-
from = 0;
|
|
974
|
-
}
|
|
975
|
-
if (to > this.length) {
|
|
976
|
-
to = this.length;
|
|
977
|
-
}
|
|
978
|
-
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
979
|
-
walker = walker.next;
|
|
724
|
+
// node_modules/semver/node_modules/lru-cache/index.js
|
|
725
|
+
var require_lru_cache = __commonJS({
|
|
726
|
+
"node_modules/semver/node_modules/lru-cache/index.js"(exports2, module2) {
|
|
727
|
+
var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
728
|
+
var hasAbortController = typeof AbortController !== "undefined";
|
|
729
|
+
var AC = hasAbortController ? AbortController : Object.assign(class AbortController {
|
|
730
|
+
constructor() {
|
|
731
|
+
this.signal = new AC.AbortSignal();
|
|
732
|
+
}
|
|
733
|
+
abort() {
|
|
734
|
+
this.signal.aborted = true;
|
|
735
|
+
}
|
|
736
|
+
}, { AbortSignal: class AbortSignal {
|
|
737
|
+
constructor() {
|
|
738
|
+
this.aborted = false;
|
|
739
|
+
}
|
|
740
|
+
} });
|
|
741
|
+
var warned = /* @__PURE__ */ new Set();
|
|
742
|
+
var deprecatedOption = (opt, instead) => {
|
|
743
|
+
const code = `LRU_CACHE_OPTION_${opt}`;
|
|
744
|
+
if (shouldWarn(code)) {
|
|
745
|
+
warn(code, `${opt} option`, `options.${instead}`, LRUCache);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
var deprecatedMethod = (method, instead) => {
|
|
749
|
+
const code = `LRU_CACHE_METHOD_${method}`;
|
|
750
|
+
if (shouldWarn(code)) {
|
|
751
|
+
const { prototype } = LRUCache;
|
|
752
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, method);
|
|
753
|
+
warn(code, `${method} method`, `cache.${instead}()`, get);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
var deprecatedProperty = (field, instead) => {
|
|
757
|
+
const code = `LRU_CACHE_PROPERTY_${field}`;
|
|
758
|
+
if (shouldWarn(code)) {
|
|
759
|
+
const { prototype } = LRUCache;
|
|
760
|
+
const { get } = Object.getOwnPropertyDescriptor(prototype, field);
|
|
761
|
+
warn(code, `${field} property`, `cache.${instead}`, get);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
var emitWarning = (...a) => {
|
|
765
|
+
typeof process === "object" && process && typeof process.emitWarning === "function" ? process.emitWarning(...a) : console.error(...a);
|
|
766
|
+
};
|
|
767
|
+
var shouldWarn = (code) => !warned.has(code);
|
|
768
|
+
var warn = (code, what, instead, fn) => {
|
|
769
|
+
warned.add(code);
|
|
770
|
+
const msg = `The ${what} is deprecated. Please use ${instead} instead.`;
|
|
771
|
+
emitWarning(msg, "DeprecationWarning", code, fn);
|
|
772
|
+
};
|
|
773
|
+
var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
774
|
+
var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
|
|
775
|
+
var ZeroArray = class extends Array {
|
|
776
|
+
constructor(size) {
|
|
777
|
+
super(size);
|
|
778
|
+
this.fill(0);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var Stack = class {
|
|
782
|
+
constructor(max) {
|
|
783
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
784
|
+
this.heap = new UintArray(max);
|
|
785
|
+
this.length = 0;
|
|
786
|
+
}
|
|
787
|
+
push(n) {
|
|
788
|
+
this.heap[this.length++] = n;
|
|
980
789
|
}
|
|
981
|
-
|
|
982
|
-
|
|
790
|
+
pop() {
|
|
791
|
+
return this.heap[--this.length];
|
|
983
792
|
}
|
|
984
|
-
return ret;
|
|
985
793
|
};
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
794
|
+
var LRUCache = class {
|
|
795
|
+
constructor(options = {}) {
|
|
796
|
+
const {
|
|
797
|
+
max = 0,
|
|
798
|
+
ttl,
|
|
799
|
+
ttlResolution = 1,
|
|
800
|
+
ttlAutopurge,
|
|
801
|
+
updateAgeOnGet,
|
|
802
|
+
updateAgeOnHas,
|
|
803
|
+
allowStale,
|
|
804
|
+
dispose,
|
|
805
|
+
disposeAfter,
|
|
806
|
+
noDisposeOnSet,
|
|
807
|
+
noUpdateTTL,
|
|
808
|
+
maxSize = 0,
|
|
809
|
+
sizeCalculation,
|
|
810
|
+
fetchMethod
|
|
811
|
+
} = options;
|
|
812
|
+
const {
|
|
813
|
+
length,
|
|
814
|
+
maxAge,
|
|
815
|
+
stale
|
|
816
|
+
} = options instanceof LRUCache ? {} : options;
|
|
817
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
818
|
+
throw new TypeError("max option must be a nonnegative integer");
|
|
819
|
+
}
|
|
820
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
821
|
+
if (!UintArray) {
|
|
822
|
+
throw new Error("invalid max value: " + max);
|
|
823
|
+
}
|
|
824
|
+
this.max = max;
|
|
825
|
+
this.maxSize = maxSize;
|
|
826
|
+
this.sizeCalculation = sizeCalculation || length;
|
|
827
|
+
if (this.sizeCalculation) {
|
|
828
|
+
if (!this.maxSize) {
|
|
829
|
+
throw new TypeError("cannot set sizeCalculation without setting maxSize");
|
|
830
|
+
}
|
|
831
|
+
if (typeof this.sizeCalculation !== "function") {
|
|
832
|
+
throw new TypeError("sizeCalculation set to non-function");
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
this.fetchMethod = fetchMethod || null;
|
|
836
|
+
if (this.fetchMethod && typeof this.fetchMethod !== "function") {
|
|
837
|
+
throw new TypeError("fetchMethod must be a function if specified");
|
|
838
|
+
}
|
|
839
|
+
this.keyMap = /* @__PURE__ */ new Map();
|
|
840
|
+
this.keyList = new Array(max).fill(null);
|
|
841
|
+
this.valList = new Array(max).fill(null);
|
|
842
|
+
this.next = new UintArray(max);
|
|
843
|
+
this.prev = new UintArray(max);
|
|
844
|
+
this.head = 0;
|
|
845
|
+
this.tail = 0;
|
|
846
|
+
this.free = new Stack(max);
|
|
847
|
+
this.initialFill = 1;
|
|
848
|
+
this.size = 0;
|
|
849
|
+
if (typeof dispose === "function") {
|
|
850
|
+
this.dispose = dispose;
|
|
851
|
+
}
|
|
852
|
+
if (typeof disposeAfter === "function") {
|
|
853
|
+
this.disposeAfter = disposeAfter;
|
|
854
|
+
this.disposed = [];
|
|
855
|
+
} else {
|
|
856
|
+
this.disposeAfter = null;
|
|
857
|
+
this.disposed = null;
|
|
858
|
+
}
|
|
859
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
860
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
861
|
+
if (this.maxSize !== 0) {
|
|
862
|
+
if (!isPosInt(this.maxSize)) {
|
|
863
|
+
throw new TypeError("maxSize must be a positive integer if specified");
|
|
864
|
+
}
|
|
865
|
+
this.initializeSizeTracking();
|
|
866
|
+
}
|
|
867
|
+
this.allowStale = !!allowStale || !!stale;
|
|
868
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
869
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
870
|
+
this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
|
|
871
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
872
|
+
this.ttl = ttl || maxAge || 0;
|
|
873
|
+
if (this.ttl) {
|
|
874
|
+
if (!isPosInt(this.ttl)) {
|
|
875
|
+
throw new TypeError("ttl must be a positive integer if specified");
|
|
876
|
+
}
|
|
877
|
+
this.initializeTTLTracking();
|
|
878
|
+
}
|
|
879
|
+
if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
|
|
880
|
+
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
881
|
+
}
|
|
882
|
+
if (!this.ttlAutopurge && !this.max && !this.maxSize) {
|
|
883
|
+
const code = "LRU_CACHE_UNBOUNDED";
|
|
884
|
+
if (shouldWarn(code)) {
|
|
885
|
+
warned.add(code);
|
|
886
|
+
const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
|
|
887
|
+
emitWarning(msg, "UnboundedCacheWarning", code, LRUCache);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if (stale) {
|
|
891
|
+
deprecatedOption("stale", "allowStale");
|
|
892
|
+
}
|
|
893
|
+
if (maxAge) {
|
|
894
|
+
deprecatedOption("maxAge", "ttl");
|
|
895
|
+
}
|
|
896
|
+
if (length) {
|
|
897
|
+
deprecatedOption("length", "sizeCalculation");
|
|
898
|
+
}
|
|
990
899
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
900
|
+
getRemainingTTL(key) {
|
|
901
|
+
return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0;
|
|
902
|
+
}
|
|
903
|
+
initializeTTLTracking() {
|
|
904
|
+
this.ttls = new ZeroArray(this.max);
|
|
905
|
+
this.starts = new ZeroArray(this.max);
|
|
906
|
+
this.setItemTTL = (index, ttl) => {
|
|
907
|
+
this.starts[index] = ttl !== 0 ? perf.now() : 0;
|
|
908
|
+
this.ttls[index] = ttl;
|
|
909
|
+
if (ttl !== 0 && this.ttlAutopurge) {
|
|
910
|
+
const t = setTimeout(() => {
|
|
911
|
+
if (this.isStale(index)) {
|
|
912
|
+
this.delete(this.keyList[index]);
|
|
913
|
+
}
|
|
914
|
+
}, ttl + 1);
|
|
915
|
+
if (t.unref) {
|
|
916
|
+
t.unref();
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
this.updateItemAge = (index) => {
|
|
921
|
+
this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0;
|
|
922
|
+
};
|
|
923
|
+
let cachedNow = 0;
|
|
924
|
+
const getNow = () => {
|
|
925
|
+
const n = perf.now();
|
|
926
|
+
if (this.ttlResolution > 0) {
|
|
927
|
+
cachedNow = n;
|
|
928
|
+
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
929
|
+
if (t.unref) {
|
|
930
|
+
t.unref();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return n;
|
|
934
|
+
};
|
|
935
|
+
this.getRemainingTTL = (key) => {
|
|
936
|
+
const index = this.keyMap.get(key);
|
|
937
|
+
if (index === void 0) {
|
|
938
|
+
return 0;
|
|
939
|
+
}
|
|
940
|
+
return this.ttls[index] === 0 || this.starts[index] === 0 ? Infinity : this.starts[index] + this.ttls[index] - (cachedNow || getNow());
|
|
941
|
+
};
|
|
942
|
+
this.isStale = (index) => {
|
|
943
|
+
return this.ttls[index] !== 0 && this.starts[index] !== 0 && (cachedNow || getNow()) - this.starts[index] > this.ttls[index];
|
|
944
|
+
};
|
|
994
945
|
}
|
|
995
|
-
|
|
996
|
-
if (to < from || to < 0) {
|
|
997
|
-
return ret;
|
|
946
|
+
updateItemAge(index) {
|
|
998
947
|
}
|
|
999
|
-
|
|
1000
|
-
from = 0;
|
|
948
|
+
setItemTTL(index, ttl) {
|
|
1001
949
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
950
|
+
isStale(index) {
|
|
951
|
+
return false;
|
|
1004
952
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
953
|
+
initializeSizeTracking() {
|
|
954
|
+
this.calculatedSize = 0;
|
|
955
|
+
this.sizes = new ZeroArray(this.max);
|
|
956
|
+
this.removeItemSize = (index) => this.calculatedSize -= this.sizes[index];
|
|
957
|
+
this.requireSize = (k, v, size, sizeCalculation) => {
|
|
958
|
+
if (!isPosInt(size)) {
|
|
959
|
+
if (sizeCalculation) {
|
|
960
|
+
if (typeof sizeCalculation !== "function") {
|
|
961
|
+
throw new TypeError("sizeCalculation must be a function");
|
|
962
|
+
}
|
|
963
|
+
size = sizeCalculation(v, k);
|
|
964
|
+
if (!isPosInt(size)) {
|
|
965
|
+
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
966
|
+
}
|
|
967
|
+
} else {
|
|
968
|
+
throw new TypeError("invalid size value (must be positive integer)");
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return size;
|
|
972
|
+
};
|
|
973
|
+
this.addItemSize = (index, v, k, size) => {
|
|
974
|
+
this.sizes[index] = size;
|
|
975
|
+
const maxSize = this.maxSize - this.sizes[index];
|
|
976
|
+
while (this.calculatedSize > maxSize) {
|
|
977
|
+
this.evict();
|
|
978
|
+
}
|
|
979
|
+
this.calculatedSize += this.sizes[index];
|
|
980
|
+
};
|
|
981
|
+
this.delete = (k) => {
|
|
982
|
+
if (this.size !== 0) {
|
|
983
|
+
const index = this.keyMap.get(k);
|
|
984
|
+
if (index !== void 0) {
|
|
985
|
+
this.calculatedSize -= this.sizes[index];
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
return LRUCache.prototype.delete.call(this, k);
|
|
989
|
+
};
|
|
1007
990
|
}
|
|
1008
|
-
|
|
1009
|
-
ret.push(walker.value);
|
|
991
|
+
removeItemSize(index) {
|
|
1010
992
|
}
|
|
1011
|
-
|
|
1012
|
-
};
|
|
1013
|
-
Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
|
|
1014
|
-
if (start > this.length) {
|
|
1015
|
-
start = this.length - 1;
|
|
993
|
+
addItemSize(index, v, k, size) {
|
|
1016
994
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
995
|
+
requireSize(k, v, size, sizeCalculation) {
|
|
996
|
+
if (size || sizeCalculation) {
|
|
997
|
+
throw new TypeError("cannot set size without setting maxSize on cache");
|
|
998
|
+
}
|
|
1019
999
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1000
|
+
*indexes({ allowStale = this.allowStale } = {}) {
|
|
1001
|
+
if (this.size) {
|
|
1002
|
+
for (let i = this.tail; true; ) {
|
|
1003
|
+
if (!this.isValidIndex(i)) {
|
|
1004
|
+
break;
|
|
1005
|
+
}
|
|
1006
|
+
if (allowStale || !this.isStale(i)) {
|
|
1007
|
+
yield i;
|
|
1008
|
+
}
|
|
1009
|
+
if (i === this.head) {
|
|
1010
|
+
break;
|
|
1011
|
+
} else {
|
|
1012
|
+
i = this.prev[i];
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1022
1016
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1017
|
+
*rindexes({ allowStale = this.allowStale } = {}) {
|
|
1018
|
+
if (this.size) {
|
|
1019
|
+
for (let i = this.head; true; ) {
|
|
1020
|
+
if (!this.isValidIndex(i)) {
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
if (allowStale || !this.isStale(i)) {
|
|
1024
|
+
yield i;
|
|
1025
|
+
}
|
|
1026
|
+
if (i === this.tail) {
|
|
1027
|
+
break;
|
|
1028
|
+
} else {
|
|
1029
|
+
i = this.next[i];
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1027
1033
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1034
|
+
isValidIndex(index) {
|
|
1035
|
+
return this.keyMap.get(this.keyList[index]) === index;
|
|
1030
1036
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1037
|
+
*entries() {
|
|
1038
|
+
for (const i of this.indexes()) {
|
|
1039
|
+
yield [this.keyList[i], this.valList[i]];
|
|
1040
|
+
}
|
|
1033
1041
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1042
|
+
*rentries() {
|
|
1043
|
+
for (const i of this.rindexes()) {
|
|
1044
|
+
yield [this.keyList[i], this.valList[i]];
|
|
1045
|
+
}
|
|
1036
1046
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
var tail = this.tail;
|
|
1042
|
-
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
1043
|
-
var p = walker.prev;
|
|
1044
|
-
walker.prev = walker.next;
|
|
1045
|
-
walker.next = p;
|
|
1046
|
-
}
|
|
1047
|
-
this.head = tail;
|
|
1048
|
-
this.tail = head;
|
|
1049
|
-
return this;
|
|
1050
|
-
};
|
|
1051
|
-
function insert(self, node, value) {
|
|
1052
|
-
var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
|
|
1053
|
-
if (inserted.next === null) {
|
|
1054
|
-
self.tail = inserted;
|
|
1047
|
+
*keys() {
|
|
1048
|
+
for (const i of this.indexes()) {
|
|
1049
|
+
yield this.keyList[i];
|
|
1050
|
+
}
|
|
1055
1051
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1052
|
+
*rkeys() {
|
|
1053
|
+
for (const i of this.rindexes()) {
|
|
1054
|
+
yield this.keyList[i];
|
|
1055
|
+
}
|
|
1058
1056
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
self.tail = new Node(item, self.tail, null, self);
|
|
1064
|
-
if (!self.head) {
|
|
1065
|
-
self.head = self.tail;
|
|
1057
|
+
*values() {
|
|
1058
|
+
for (const i of this.indexes()) {
|
|
1059
|
+
yield this.valList[i];
|
|
1060
|
+
}
|
|
1066
1061
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
if (!self.tail) {
|
|
1072
|
-
self.tail = self.head;
|
|
1062
|
+
*rvalues() {
|
|
1063
|
+
for (const i of this.rindexes()) {
|
|
1064
|
+
yield this.valList[i];
|
|
1065
|
+
}
|
|
1073
1066
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
function Node(value, prev, next, list) {
|
|
1077
|
-
if (!(this instanceof Node)) {
|
|
1078
|
-
return new Node(value, prev, next, list);
|
|
1079
|
-
}
|
|
1080
|
-
this.list = list;
|
|
1081
|
-
this.value = value;
|
|
1082
|
-
if (prev) {
|
|
1083
|
-
prev.next = this;
|
|
1084
|
-
this.prev = prev;
|
|
1085
|
-
} else {
|
|
1086
|
-
this.prev = null;
|
|
1067
|
+
[Symbol.iterator]() {
|
|
1068
|
+
return this.entries();
|
|
1087
1069
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1070
|
+
find(fn, getOptions = {}) {
|
|
1071
|
+
for (const i of this.indexes()) {
|
|
1072
|
+
if (fn(this.valList[i], this.keyList[i], this)) {
|
|
1073
|
+
return this.get(this.keyList[i], getOptions);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1093
1076
|
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
} catch (er) {
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
|
-
// node_modules/lru-cache/index.js
|
|
1103
|
-
var require_lru_cache = __commonJS({
|
|
1104
|
-
"node_modules/lru-cache/index.js"(exports2, module2) {
|
|
1105
|
-
"use strict";
|
|
1106
|
-
var Yallist = require_yallist();
|
|
1107
|
-
var MAX = Symbol("max");
|
|
1108
|
-
var LENGTH = Symbol("length");
|
|
1109
|
-
var LENGTH_CALCULATOR = Symbol("lengthCalculator");
|
|
1110
|
-
var ALLOW_STALE = Symbol("allowStale");
|
|
1111
|
-
var MAX_AGE = Symbol("maxAge");
|
|
1112
|
-
var DISPOSE = Symbol("dispose");
|
|
1113
|
-
var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
|
|
1114
|
-
var LRU_LIST = Symbol("lruList");
|
|
1115
|
-
var CACHE = Symbol("cache");
|
|
1116
|
-
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
|
|
1117
|
-
var naiveLength = () => 1;
|
|
1118
|
-
var LRUCache = class {
|
|
1119
|
-
constructor(options) {
|
|
1120
|
-
if (typeof options === "number")
|
|
1121
|
-
options = { max: options };
|
|
1122
|
-
if (!options)
|
|
1123
|
-
options = {};
|
|
1124
|
-
if (options.max && (typeof options.max !== "number" || options.max < 0))
|
|
1125
|
-
throw new TypeError("max must be a non-negative number");
|
|
1126
|
-
const max = this[MAX] = options.max || Infinity;
|
|
1127
|
-
const lc = options.length || naiveLength;
|
|
1128
|
-
this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
|
|
1129
|
-
this[ALLOW_STALE] = options.stale || false;
|
|
1130
|
-
if (options.maxAge && typeof options.maxAge !== "number")
|
|
1131
|
-
throw new TypeError("maxAge must be a number");
|
|
1132
|
-
this[MAX_AGE] = options.maxAge || 0;
|
|
1133
|
-
this[DISPOSE] = options.dispose;
|
|
1134
|
-
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
|
1135
|
-
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
|
|
1136
|
-
this.reset();
|
|
1137
|
-
}
|
|
1138
|
-
set max(mL) {
|
|
1139
|
-
if (typeof mL !== "number" || mL < 0)
|
|
1140
|
-
throw new TypeError("max must be a non-negative number");
|
|
1141
|
-
this[MAX] = mL || Infinity;
|
|
1142
|
-
trim(this);
|
|
1143
|
-
}
|
|
1144
|
-
get max() {
|
|
1145
|
-
return this[MAX];
|
|
1146
|
-
}
|
|
1147
|
-
set allowStale(allowStale) {
|
|
1148
|
-
this[ALLOW_STALE] = !!allowStale;
|
|
1149
|
-
}
|
|
1150
|
-
get allowStale() {
|
|
1151
|
-
return this[ALLOW_STALE];
|
|
1152
|
-
}
|
|
1153
|
-
set maxAge(mA) {
|
|
1154
|
-
if (typeof mA !== "number")
|
|
1155
|
-
throw new TypeError("maxAge must be a non-negative number");
|
|
1156
|
-
this[MAX_AGE] = mA;
|
|
1157
|
-
trim(this);
|
|
1158
|
-
}
|
|
1159
|
-
get maxAge() {
|
|
1160
|
-
return this[MAX_AGE];
|
|
1161
|
-
}
|
|
1162
|
-
set lengthCalculator(lC) {
|
|
1163
|
-
if (typeof lC !== "function")
|
|
1164
|
-
lC = naiveLength;
|
|
1165
|
-
if (lC !== this[LENGTH_CALCULATOR]) {
|
|
1166
|
-
this[LENGTH_CALCULATOR] = lC;
|
|
1167
|
-
this[LENGTH] = 0;
|
|
1168
|
-
this[LRU_LIST].forEach((hit) => {
|
|
1169
|
-
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
|
1170
|
-
this[LENGTH] += hit.length;
|
|
1171
|
-
});
|
|
1077
|
+
forEach(fn, thisp = this) {
|
|
1078
|
+
for (const i of this.indexes()) {
|
|
1079
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
1172
1080
|
}
|
|
1173
|
-
trim(this);
|
|
1174
1081
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1082
|
+
rforEach(fn, thisp = this) {
|
|
1083
|
+
for (const i of this.rindexes()) {
|
|
1084
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
1085
|
+
}
|
|
1177
1086
|
}
|
|
1178
|
-
get
|
|
1179
|
-
|
|
1087
|
+
get prune() {
|
|
1088
|
+
deprecatedMethod("prune", "purgeStale");
|
|
1089
|
+
return this.purgeStale;
|
|
1180
1090
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1091
|
+
purgeStale() {
|
|
1092
|
+
let deleted = false;
|
|
1093
|
+
for (const i of this.rindexes({ allowStale: true })) {
|
|
1094
|
+
if (this.isStale(i)) {
|
|
1095
|
+
this.delete(this.keyList[i]);
|
|
1096
|
+
deleted = true;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return deleted;
|
|
1183
1100
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
for (
|
|
1187
|
-
const
|
|
1188
|
-
|
|
1189
|
-
|
|
1101
|
+
dump() {
|
|
1102
|
+
const arr = [];
|
|
1103
|
+
for (const i of this.indexes()) {
|
|
1104
|
+
const key = this.keyList[i];
|
|
1105
|
+
const value = this.valList[i];
|
|
1106
|
+
const entry = { value };
|
|
1107
|
+
if (this.ttls) {
|
|
1108
|
+
entry.ttl = this.ttls[i];
|
|
1109
|
+
}
|
|
1110
|
+
if (this.sizes) {
|
|
1111
|
+
entry.size = this.sizes[i];
|
|
1112
|
+
}
|
|
1113
|
+
arr.unshift([key, entry]);
|
|
1190
1114
|
}
|
|
1115
|
+
return arr;
|
|
1191
1116
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
for (
|
|
1195
|
-
|
|
1196
|
-
forEachStep(this, fn, walker, thisp);
|
|
1197
|
-
walker = next;
|
|
1117
|
+
load(arr) {
|
|
1118
|
+
this.clear();
|
|
1119
|
+
for (const [key, entry] of arr) {
|
|
1120
|
+
this.set(key, entry.value, entry);
|
|
1198
1121
|
}
|
|
1199
1122
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1123
|
+
dispose(v, k, reason) {
|
|
1124
|
+
}
|
|
1125
|
+
set(k, v, {
|
|
1126
|
+
ttl = this.ttl,
|
|
1127
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
1128
|
+
size = 0,
|
|
1129
|
+
sizeCalculation = this.sizeCalculation,
|
|
1130
|
+
noUpdateTTL = this.noUpdateTTL
|
|
1131
|
+
} = {}) {
|
|
1132
|
+
size = this.requireSize(k, v, size, sizeCalculation);
|
|
1133
|
+
let index = this.size === 0 ? void 0 : this.keyMap.get(k);
|
|
1134
|
+
if (index === void 0) {
|
|
1135
|
+
index = this.newIndex();
|
|
1136
|
+
this.keyList[index] = k;
|
|
1137
|
+
this.valList[index] = v;
|
|
1138
|
+
this.keyMap.set(k, index);
|
|
1139
|
+
this.next[this.tail] = index;
|
|
1140
|
+
this.prev[index] = this.tail;
|
|
1141
|
+
this.tail = index;
|
|
1142
|
+
this.size++;
|
|
1143
|
+
this.addItemSize(index, v, k, size);
|
|
1144
|
+
noUpdateTTL = false;
|
|
1145
|
+
} else {
|
|
1146
|
+
const oldVal = this.valList[index];
|
|
1147
|
+
if (v !== oldVal) {
|
|
1148
|
+
if (this.isBackgroundFetch(oldVal)) {
|
|
1149
|
+
oldVal.__abortController.abort();
|
|
1150
|
+
} else {
|
|
1151
|
+
if (!noDisposeOnSet) {
|
|
1152
|
+
this.dispose(oldVal, k, "set");
|
|
1153
|
+
if (this.disposeAfter) {
|
|
1154
|
+
this.disposed.push([oldVal, k, "set"]);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
this.removeItemSize(index);
|
|
1159
|
+
this.valList[index] = v;
|
|
1160
|
+
this.addItemSize(index, v, k, size);
|
|
1161
|
+
}
|
|
1162
|
+
this.moveToTail(index);
|
|
1163
|
+
}
|
|
1164
|
+
if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
|
|
1165
|
+
this.initializeTTLTracking();
|
|
1166
|
+
}
|
|
1167
|
+
if (!noUpdateTTL) {
|
|
1168
|
+
this.setItemTTL(index, ttl);
|
|
1169
|
+
}
|
|
1170
|
+
if (this.disposeAfter) {
|
|
1171
|
+
while (this.disposed.length) {
|
|
1172
|
+
this.disposeAfter(...this.disposed.shift());
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return this;
|
|
1202
1176
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1177
|
+
newIndex() {
|
|
1178
|
+
if (this.size === 0) {
|
|
1179
|
+
return this.tail;
|
|
1180
|
+
}
|
|
1181
|
+
if (this.size === this.max) {
|
|
1182
|
+
return this.evict();
|
|
1183
|
+
}
|
|
1184
|
+
if (this.free.length !== 0) {
|
|
1185
|
+
return this.free.pop();
|
|
1186
|
+
}
|
|
1187
|
+
return this.initialFill++;
|
|
1205
1188
|
}
|
|
1206
|
-
|
|
1207
|
-
if (this
|
|
1208
|
-
|
|
1189
|
+
pop() {
|
|
1190
|
+
if (this.size) {
|
|
1191
|
+
const val = this.valList[this.head];
|
|
1192
|
+
this.evict();
|
|
1193
|
+
return val;
|
|
1209
1194
|
}
|
|
1210
|
-
this[CACHE] = /* @__PURE__ */ new Map();
|
|
1211
|
-
this[LRU_LIST] = new Yallist();
|
|
1212
|
-
this[LENGTH] = 0;
|
|
1213
1195
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
set(key, value, maxAge) {
|
|
1225
|
-
maxAge = maxAge || this[MAX_AGE];
|
|
1226
|
-
if (maxAge && typeof maxAge !== "number")
|
|
1227
|
-
throw new TypeError("maxAge must be a number");
|
|
1228
|
-
const now = maxAge ? Date.now() : 0;
|
|
1229
|
-
const len = this[LENGTH_CALCULATOR](value, key);
|
|
1230
|
-
if (this[CACHE].has(key)) {
|
|
1231
|
-
if (len > this[MAX]) {
|
|
1232
|
-
del(this, this[CACHE].get(key));
|
|
1233
|
-
return false;
|
|
1196
|
+
evict() {
|
|
1197
|
+
const head = this.head;
|
|
1198
|
+
const k = this.keyList[head];
|
|
1199
|
+
const v = this.valList[head];
|
|
1200
|
+
if (this.isBackgroundFetch(v)) {
|
|
1201
|
+
v.__abortController.abort();
|
|
1202
|
+
} else {
|
|
1203
|
+
this.dispose(v, k, "evict");
|
|
1204
|
+
if (this.disposeAfter) {
|
|
1205
|
+
this.disposed.push([v, k, "evict"]);
|
|
1234
1206
|
}
|
|
1235
|
-
const node = this[CACHE].get(key);
|
|
1236
|
-
const item = node.value;
|
|
1237
|
-
if (this[DISPOSE]) {
|
|
1238
|
-
if (!this[NO_DISPOSE_ON_SET])
|
|
1239
|
-
this[DISPOSE](key, item.value);
|
|
1240
|
-
}
|
|
1241
|
-
item.now = now;
|
|
1242
|
-
item.maxAge = maxAge;
|
|
1243
|
-
item.value = value;
|
|
1244
|
-
this[LENGTH] += len - item.length;
|
|
1245
|
-
item.length = len;
|
|
1246
|
-
this.get(key);
|
|
1247
|
-
trim(this);
|
|
1248
|
-
return true;
|
|
1249
1207
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1208
|
+
this.removeItemSize(head);
|
|
1209
|
+
this.head = this.next[head];
|
|
1210
|
+
this.keyMap.delete(k);
|
|
1211
|
+
this.size--;
|
|
1212
|
+
return head;
|
|
1213
|
+
}
|
|
1214
|
+
has(k, { updateAgeOnHas = this.updateAgeOnHas } = {}) {
|
|
1215
|
+
const index = this.keyMap.get(k);
|
|
1216
|
+
if (index !== void 0) {
|
|
1217
|
+
if (!this.isStale(index)) {
|
|
1218
|
+
if (updateAgeOnHas) {
|
|
1219
|
+
this.updateItemAge(index);
|
|
1220
|
+
}
|
|
1221
|
+
return true;
|
|
1222
|
+
}
|
|
1255
1223
|
}
|
|
1256
|
-
|
|
1257
|
-
this[LRU_LIST].unshift(hit);
|
|
1258
|
-
this[CACHE].set(key, this[LRU_LIST].head);
|
|
1259
|
-
trim(this);
|
|
1260
|
-
return true;
|
|
1224
|
+
return false;
|
|
1261
1225
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1226
|
+
peek(k, { allowStale = this.allowStale } = {}) {
|
|
1227
|
+
const index = this.keyMap.get(k);
|
|
1228
|
+
if (index !== void 0 && (allowStale || !this.isStale(index))) {
|
|
1229
|
+
return this.valList[index];
|
|
1230
|
+
}
|
|
1267
1231
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1232
|
+
backgroundFetch(k, index, options) {
|
|
1233
|
+
const v = index === void 0 ? void 0 : this.valList[index];
|
|
1234
|
+
if (this.isBackgroundFetch(v)) {
|
|
1235
|
+
return v;
|
|
1236
|
+
}
|
|
1237
|
+
const ac = new AC();
|
|
1238
|
+
const fetchOpts = {
|
|
1239
|
+
signal: ac.signal,
|
|
1240
|
+
options
|
|
1241
|
+
};
|
|
1242
|
+
const p = Promise.resolve(this.fetchMethod(k, v, fetchOpts)).then((v2) => {
|
|
1243
|
+
if (!ac.signal.aborted) {
|
|
1244
|
+
this.set(k, v2, fetchOpts.options);
|
|
1245
|
+
}
|
|
1246
|
+
return v2;
|
|
1247
|
+
});
|
|
1248
|
+
p.__abortController = ac;
|
|
1249
|
+
p.__staleWhileFetching = v;
|
|
1250
|
+
if (index === void 0) {
|
|
1251
|
+
this.set(k, p, fetchOpts.options);
|
|
1252
|
+
index = this.keyMap.get(k);
|
|
1253
|
+
} else {
|
|
1254
|
+
this.valList[index] = p;
|
|
1255
|
+
}
|
|
1256
|
+
return p;
|
|
1257
|
+
}
|
|
1258
|
+
isBackgroundFetch(p) {
|
|
1259
|
+
return p && typeof p === "object" && typeof p.then === "function" && Object.prototype.hasOwnProperty.call(p, "__staleWhileFetching");
|
|
1260
|
+
}
|
|
1261
|
+
async fetch(k, {
|
|
1262
|
+
allowStale = this.allowStale,
|
|
1263
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
1264
|
+
ttl = this.ttl,
|
|
1265
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
1266
|
+
size = 0,
|
|
1267
|
+
sizeCalculation = this.sizeCalculation,
|
|
1268
|
+
noUpdateTTL = this.noUpdateTTL
|
|
1269
|
+
} = {}) {
|
|
1270
|
+
if (!this.fetchMethod) {
|
|
1271
|
+
return this.get(k, { allowStale, updateAgeOnGet });
|
|
1272
|
+
}
|
|
1273
|
+
const options = {
|
|
1274
|
+
allowStale,
|
|
1275
|
+
updateAgeOnGet,
|
|
1276
|
+
ttl,
|
|
1277
|
+
noDisposeOnSet,
|
|
1278
|
+
size,
|
|
1279
|
+
sizeCalculation,
|
|
1280
|
+
noUpdateTTL
|
|
1281
|
+
};
|
|
1282
|
+
let index = this.keyMap.get(k);
|
|
1283
|
+
if (index === void 0) {
|
|
1284
|
+
return this.backgroundFetch(k, index, options);
|
|
1285
|
+
} else {
|
|
1286
|
+
const v = this.valList[index];
|
|
1287
|
+
if (this.isBackgroundFetch(v)) {
|
|
1288
|
+
return allowStale && v.__staleWhileFetching !== void 0 ? v.__staleWhileFetching : v;
|
|
1289
|
+
}
|
|
1290
|
+
if (!this.isStale(index)) {
|
|
1291
|
+
this.moveToTail(index);
|
|
1292
|
+
if (updateAgeOnGet) {
|
|
1293
|
+
this.updateItemAge(index);
|
|
1294
|
+
}
|
|
1295
|
+
return v;
|
|
1296
|
+
}
|
|
1297
|
+
const p = this.backgroundFetch(k, index, options);
|
|
1298
|
+
return allowStale && p.__staleWhileFetching !== void 0 ? p.__staleWhileFetching : p;
|
|
1299
|
+
}
|
|
1270
1300
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1301
|
+
get(k, {
|
|
1302
|
+
allowStale = this.allowStale,
|
|
1303
|
+
updateAgeOnGet = this.updateAgeOnGet
|
|
1304
|
+
} = {}) {
|
|
1305
|
+
const index = this.keyMap.get(k);
|
|
1306
|
+
if (index !== void 0) {
|
|
1307
|
+
const value = this.valList[index];
|
|
1308
|
+
const fetching = this.isBackgroundFetch(value);
|
|
1309
|
+
if (this.isStale(index)) {
|
|
1310
|
+
if (!fetching) {
|
|
1311
|
+
this.delete(k);
|
|
1312
|
+
return allowStale ? value : void 0;
|
|
1313
|
+
} else {
|
|
1314
|
+
return allowStale ? value.__staleWhileFetching : void 0;
|
|
1315
|
+
}
|
|
1316
|
+
} else {
|
|
1317
|
+
if (fetching) {
|
|
1318
|
+
return void 0;
|
|
1319
|
+
}
|
|
1320
|
+
this.moveToTail(index);
|
|
1321
|
+
if (updateAgeOnGet) {
|
|
1322
|
+
this.updateItemAge(index);
|
|
1323
|
+
}
|
|
1324
|
+
return value;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1273
1327
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
return null;
|
|
1278
|
-
del(this, node);
|
|
1279
|
-
return node.value;
|
|
1328
|
+
connect(p, n) {
|
|
1329
|
+
this.prev[n] = p;
|
|
1330
|
+
this.next[p] = n;
|
|
1280
1331
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1332
|
+
moveToTail(index) {
|
|
1333
|
+
if (index !== this.tail) {
|
|
1334
|
+
if (index === this.head) {
|
|
1335
|
+
this.head = this.next[index];
|
|
1336
|
+
} else {
|
|
1337
|
+
this.connect(this.prev[index], this.next[index]);
|
|
1338
|
+
}
|
|
1339
|
+
this.connect(this.tail, index);
|
|
1340
|
+
this.tail = index;
|
|
1341
|
+
}
|
|
1283
1342
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
if (
|
|
1295
|
-
this.
|
|
1343
|
+
get del() {
|
|
1344
|
+
deprecatedMethod("del", "delete");
|
|
1345
|
+
return this.delete;
|
|
1346
|
+
}
|
|
1347
|
+
delete(k) {
|
|
1348
|
+
let deleted = false;
|
|
1349
|
+
if (this.size !== 0) {
|
|
1350
|
+
const index = this.keyMap.get(k);
|
|
1351
|
+
if (index !== void 0) {
|
|
1352
|
+
deleted = true;
|
|
1353
|
+
if (this.size === 1) {
|
|
1354
|
+
this.clear();
|
|
1355
|
+
} else {
|
|
1356
|
+
this.removeItemSize(index);
|
|
1357
|
+
const v = this.valList[index];
|
|
1358
|
+
if (this.isBackgroundFetch(v)) {
|
|
1359
|
+
v.__abortController.abort();
|
|
1360
|
+
} else {
|
|
1361
|
+
this.dispose(v, k, "delete");
|
|
1362
|
+
if (this.disposeAfter) {
|
|
1363
|
+
this.disposed.push([v, k, "delete"]);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
this.keyMap.delete(k);
|
|
1367
|
+
this.keyList[index] = null;
|
|
1368
|
+
this.valList[index] = null;
|
|
1369
|
+
if (index === this.tail) {
|
|
1370
|
+
this.tail = this.prev[index];
|
|
1371
|
+
} else if (index === this.head) {
|
|
1372
|
+
this.head = this.next[index];
|
|
1373
|
+
} else {
|
|
1374
|
+
this.next[this.prev[index]] = this.next[index];
|
|
1375
|
+
this.prev[this.next[index]] = this.prev[index];
|
|
1376
|
+
}
|
|
1377
|
+
this.size--;
|
|
1378
|
+
this.free.push(index);
|
|
1296
1379
|
}
|
|
1297
1380
|
}
|
|
1298
1381
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
var get = (self, key, doUse) => {
|
|
1305
|
-
const node = self[CACHE].get(key);
|
|
1306
|
-
if (node) {
|
|
1307
|
-
const hit = node.value;
|
|
1308
|
-
if (isStale(self, hit)) {
|
|
1309
|
-
del(self, node);
|
|
1310
|
-
if (!self[ALLOW_STALE])
|
|
1311
|
-
return void 0;
|
|
1312
|
-
} else {
|
|
1313
|
-
if (doUse) {
|
|
1314
|
-
if (self[UPDATE_AGE_ON_GET])
|
|
1315
|
-
node.value.now = Date.now();
|
|
1316
|
-
self[LRU_LIST].unshiftNode(node);
|
|
1382
|
+
if (this.disposed) {
|
|
1383
|
+
while (this.disposed.length) {
|
|
1384
|
+
this.disposeAfter(...this.disposed.shift());
|
|
1317
1385
|
}
|
|
1318
1386
|
}
|
|
1319
|
-
return
|
|
1387
|
+
return deleted;
|
|
1320
1388
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1389
|
+
clear() {
|
|
1390
|
+
for (const index of this.rindexes({ allowStale: true })) {
|
|
1391
|
+
const v = this.valList[index];
|
|
1392
|
+
if (this.isBackgroundFetch(v)) {
|
|
1393
|
+
v.__abortController.abort();
|
|
1394
|
+
} else {
|
|
1395
|
+
const k = this.keyList[index];
|
|
1396
|
+
this.dispose(v, k, "delete");
|
|
1397
|
+
if (this.disposeAfter) {
|
|
1398
|
+
this.disposed.push([v, k, "delete"]);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
this.keyMap.clear();
|
|
1403
|
+
this.valList.fill(null);
|
|
1404
|
+
this.keyList.fill(null);
|
|
1405
|
+
if (this.ttls) {
|
|
1406
|
+
this.ttls.fill(0);
|
|
1407
|
+
this.starts.fill(0);
|
|
1408
|
+
}
|
|
1409
|
+
if (this.sizes) {
|
|
1410
|
+
this.sizes.fill(0);
|
|
1411
|
+
}
|
|
1412
|
+
this.head = 0;
|
|
1413
|
+
this.tail = 0;
|
|
1414
|
+
this.initialFill = 1;
|
|
1415
|
+
this.free.length = 0;
|
|
1416
|
+
this.calculatedSize = 0;
|
|
1417
|
+
this.size = 0;
|
|
1418
|
+
if (this.disposed) {
|
|
1419
|
+
while (this.disposed.length) {
|
|
1420
|
+
this.disposeAfter(...this.disposed.shift());
|
|
1421
|
+
}
|
|
1334
1422
|
}
|
|
1335
1423
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
const hit = node.value;
|
|
1340
|
-
if (self[DISPOSE])
|
|
1341
|
-
self[DISPOSE](hit.key, hit.value);
|
|
1342
|
-
self[LENGTH] -= hit.length;
|
|
1343
|
-
self[CACHE].delete(hit.key);
|
|
1344
|
-
self[LRU_LIST].removeNode(node);
|
|
1424
|
+
get reset() {
|
|
1425
|
+
deprecatedMethod("reset", "clear");
|
|
1426
|
+
return this.clear;
|
|
1345
1427
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
this.key = key;
|
|
1350
|
-
this.value = value;
|
|
1351
|
-
this.length = length;
|
|
1352
|
-
this.now = now;
|
|
1353
|
-
this.maxAge = maxAge || 0;
|
|
1428
|
+
get length() {
|
|
1429
|
+
deprecatedProperty("length", "size");
|
|
1430
|
+
return this.size;
|
|
1354
1431
|
}
|
|
1355
1432
|
};
|
|
1356
|
-
var forEachStep = (self, fn, node, thisp) => {
|
|
1357
|
-
let hit = node.value;
|
|
1358
|
-
if (isStale(self, hit)) {
|
|
1359
|
-
del(self, node);
|
|
1360
|
-
if (!self[ALLOW_STALE])
|
|
1361
|
-
hit = void 0;
|
|
1362
|
-
}
|
|
1363
|
-
if (hit)
|
|
1364
|
-
fn.call(thisp, hit.value, hit.key, self);
|
|
1365
|
-
};
|
|
1366
1433
|
module2.exports = LRUCache;
|
|
1367
1434
|
}
|
|
1368
1435
|
});
|
|
@@ -1390,16 +1457,16 @@ var require_range = __commonJS({
|
|
|
1390
1457
|
this.loose = !!options.loose;
|
|
1391
1458
|
this.includePrerelease = !!options.includePrerelease;
|
|
1392
1459
|
this.raw = range;
|
|
1393
|
-
this.set = range.split(
|
|
1460
|
+
this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1394
1461
|
if (!this.set.length) {
|
|
1395
1462
|
throw new TypeError(`Invalid SemVer Range: ${range}`);
|
|
1396
1463
|
}
|
|
1397
1464
|
if (this.set.length > 1) {
|
|
1398
1465
|
const first = this.set[0];
|
|
1399
1466
|
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1400
|
-
if (this.set.length === 0)
|
|
1467
|
+
if (this.set.length === 0) {
|
|
1401
1468
|
this.set = [first];
|
|
1402
|
-
else if (this.set.length > 1) {
|
|
1469
|
+
} else if (this.set.length > 1) {
|
|
1403
1470
|
for (const c of this.set) {
|
|
1404
1471
|
if (c.length === 1 && isAny(c[0])) {
|
|
1405
1472
|
this.set = [c];
|
|
@@ -1424,28 +1491,37 @@ var require_range = __commonJS({
|
|
|
1424
1491
|
const memoOpts = Object.keys(this.options).join(",");
|
|
1425
1492
|
const memoKey = `parseRange:${memoOpts}:${range}`;
|
|
1426
1493
|
const cached = cache.get(memoKey);
|
|
1427
|
-
if (cached)
|
|
1494
|
+
if (cached) {
|
|
1428
1495
|
return cached;
|
|
1496
|
+
}
|
|
1429
1497
|
const loose = this.options.loose;
|
|
1430
1498
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1431
1499
|
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1432
1500
|
debug("hyphen replace", range);
|
|
1433
1501
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1434
|
-
debug("comparator trim", range
|
|
1502
|
+
debug("comparator trim", range);
|
|
1435
1503
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1436
1504
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1437
1505
|
range = range.split(/\s+/).join(" ");
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1506
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1507
|
+
if (loose) {
|
|
1508
|
+
rangeList = rangeList.filter((comp) => {
|
|
1509
|
+
debug("loose invalid filter", comp, this.options);
|
|
1510
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
debug("range list", rangeList);
|
|
1441
1514
|
const rangeMap = /* @__PURE__ */ new Map();
|
|
1442
|
-
|
|
1443
|
-
|
|
1515
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1516
|
+
for (const comp of comparators) {
|
|
1517
|
+
if (isNullSet(comp)) {
|
|
1444
1518
|
return [comp];
|
|
1519
|
+
}
|
|
1445
1520
|
rangeMap.set(comp.value, comp);
|
|
1446
1521
|
}
|
|
1447
|
-
if (rangeMap.size > 1 && rangeMap.has(""))
|
|
1522
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1448
1523
|
rangeMap.delete("");
|
|
1524
|
+
}
|
|
1449
1525
|
const result = [...rangeMap.values()];
|
|
1450
1526
|
cache.set(memoKey, result);
|
|
1451
1527
|
return result;
|
|
@@ -1524,8 +1600,8 @@ var require_range = __commonJS({
|
|
|
1524
1600
|
return comp;
|
|
1525
1601
|
};
|
|
1526
1602
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1527
|
-
var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((
|
|
1528
|
-
return replaceTilde(
|
|
1603
|
+
var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
1604
|
+
return replaceTilde(c, options);
|
|
1529
1605
|
}).join(" ");
|
|
1530
1606
|
var replaceTilde = (comp, options) => {
|
|
1531
1607
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
@@ -1548,8 +1624,8 @@ var require_range = __commonJS({
|
|
|
1548
1624
|
return ret;
|
|
1549
1625
|
});
|
|
1550
1626
|
};
|
|
1551
|
-
var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((
|
|
1552
|
-
return replaceCaret(
|
|
1627
|
+
var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
1628
|
+
return replaceCaret(c, options);
|
|
1553
1629
|
}).join(" ");
|
|
1554
1630
|
var replaceCaret = (comp, options) => {
|
|
1555
1631
|
debug("caret", comp, options);
|
|
@@ -1597,8 +1673,8 @@ var require_range = __commonJS({
|
|
|
1597
1673
|
};
|
|
1598
1674
|
var replaceXRanges = (comp, options) => {
|
|
1599
1675
|
debug("replaceXRanges", comp, options);
|
|
1600
|
-
return comp.split(/\s+/).map((
|
|
1601
|
-
return replaceXRange(
|
|
1676
|
+
return comp.split(/\s+/).map((c) => {
|
|
1677
|
+
return replaceXRange(c, options);
|
|
1602
1678
|
}).join(" ");
|
|
1603
1679
|
};
|
|
1604
1680
|
var replaceXRange = (comp, options) => {
|
|
@@ -1643,8 +1719,9 @@ var require_range = __commonJS({
|
|
|
1643
1719
|
m = +m + 1;
|
|
1644
1720
|
}
|
|
1645
1721
|
}
|
|
1646
|
-
if (gtlt === "<")
|
|
1722
|
+
if (gtlt === "<") {
|
|
1647
1723
|
pr = "-0";
|
|
1724
|
+
}
|
|
1648
1725
|
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1649
1726
|
} else if (xm) {
|
|
1650
1727
|
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
@@ -1941,8 +2018,9 @@ var require_min_version = __commonJS({
|
|
|
1941
2018
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1942
2019
|
}
|
|
1943
2020
|
});
|
|
1944
|
-
if (setMin && (!minver || gt(minver, setMin)))
|
|
2021
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
1945
2022
|
minver = setMin;
|
|
2023
|
+
}
|
|
1946
2024
|
}
|
|
1947
2025
|
if (minver && range.test(minver)) {
|
|
1948
2026
|
return minver;
|
|
@@ -2074,37 +2152,40 @@ var require_simplify = __commonJS({
|
|
|
2074
2152
|
var compare = require_compare();
|
|
2075
2153
|
module2.exports = (versions, range, options) => {
|
|
2076
2154
|
const set = [];
|
|
2077
|
-
let
|
|
2155
|
+
let first = null;
|
|
2078
2156
|
let prev = null;
|
|
2079
2157
|
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2080
2158
|
for (const version of v) {
|
|
2081
2159
|
const included = satisfies2(version, range, options);
|
|
2082
2160
|
if (included) {
|
|
2083
2161
|
prev = version;
|
|
2084
|
-
if (!
|
|
2085
|
-
|
|
2162
|
+
if (!first) {
|
|
2163
|
+
first = version;
|
|
2164
|
+
}
|
|
2086
2165
|
} else {
|
|
2087
2166
|
if (prev) {
|
|
2088
|
-
set.push([
|
|
2167
|
+
set.push([first, prev]);
|
|
2089
2168
|
}
|
|
2090
2169
|
prev = null;
|
|
2091
|
-
|
|
2170
|
+
first = null;
|
|
2092
2171
|
}
|
|
2093
2172
|
}
|
|
2094
|
-
if (
|
|
2095
|
-
set.push([
|
|
2173
|
+
if (first) {
|
|
2174
|
+
set.push([first, null]);
|
|
2175
|
+
}
|
|
2096
2176
|
const ranges = [];
|
|
2097
|
-
for (const [
|
|
2098
|
-
if (
|
|
2099
|
-
ranges.push(
|
|
2100
|
-
else if (!max &&
|
|
2177
|
+
for (const [min, max] of set) {
|
|
2178
|
+
if (min === max) {
|
|
2179
|
+
ranges.push(min);
|
|
2180
|
+
} else if (!max && min === v[0]) {
|
|
2101
2181
|
ranges.push("*");
|
|
2102
|
-
else if (!max)
|
|
2103
|
-
ranges.push(`>=${
|
|
2104
|
-
else if (
|
|
2182
|
+
} else if (!max) {
|
|
2183
|
+
ranges.push(`>=${min}`);
|
|
2184
|
+
} else if (min === v[0]) {
|
|
2105
2185
|
ranges.push(`<=${max}`);
|
|
2106
|
-
else
|
|
2107
|
-
ranges.push(`${
|
|
2186
|
+
} else {
|
|
2187
|
+
ranges.push(`${min} - ${max}`);
|
|
2188
|
+
}
|
|
2108
2189
|
}
|
|
2109
2190
|
const simplified = ranges.join(" || ");
|
|
2110
2191
|
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
@@ -2122,8 +2203,9 @@ var require_subset = __commonJS({
|
|
|
2122
2203
|
var satisfies2 = require_satisfies();
|
|
2123
2204
|
var compare = require_compare();
|
|
2124
2205
|
var subset = (sub, dom, options = {}) => {
|
|
2125
|
-
if (sub === dom)
|
|
2206
|
+
if (sub === dom) {
|
|
2126
2207
|
return true;
|
|
2208
|
+
}
|
|
2127
2209
|
sub = new Range(sub, options);
|
|
2128
2210
|
dom = new Range(dom, options);
|
|
2129
2211
|
let sawNonNull = false;
|
|
@@ -2132,59 +2214,70 @@ var require_subset = __commonJS({
|
|
|
2132
2214
|
for (const simpleDom of dom.set) {
|
|
2133
2215
|
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2134
2216
|
sawNonNull = sawNonNull || isSub !== null;
|
|
2135
|
-
if (isSub)
|
|
2217
|
+
if (isSub) {
|
|
2136
2218
|
continue OUTER;
|
|
2219
|
+
}
|
|
2137
2220
|
}
|
|
2138
|
-
if (sawNonNull)
|
|
2221
|
+
if (sawNonNull) {
|
|
2139
2222
|
return false;
|
|
2223
|
+
}
|
|
2140
2224
|
}
|
|
2141
2225
|
return true;
|
|
2142
2226
|
};
|
|
2143
2227
|
var simpleSubset = (sub, dom, options) => {
|
|
2144
|
-
if (sub === dom)
|
|
2228
|
+
if (sub === dom) {
|
|
2145
2229
|
return true;
|
|
2230
|
+
}
|
|
2146
2231
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2147
|
-
if (dom.length === 1 && dom[0].semver === ANY)
|
|
2232
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2148
2233
|
return true;
|
|
2149
|
-
else if (options.includePrerelease)
|
|
2234
|
+
} else if (options.includePrerelease) {
|
|
2150
2235
|
sub = [new Comparator(">=0.0.0-0")];
|
|
2151
|
-
else
|
|
2236
|
+
} else {
|
|
2152
2237
|
sub = [new Comparator(">=0.0.0")];
|
|
2238
|
+
}
|
|
2153
2239
|
}
|
|
2154
2240
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2155
|
-
if (options.includePrerelease)
|
|
2241
|
+
if (options.includePrerelease) {
|
|
2156
2242
|
return true;
|
|
2157
|
-
else
|
|
2243
|
+
} else {
|
|
2158
2244
|
dom = [new Comparator(">=0.0.0")];
|
|
2245
|
+
}
|
|
2159
2246
|
}
|
|
2160
2247
|
const eqSet = /* @__PURE__ */ new Set();
|
|
2161
2248
|
let gt, lt;
|
|
2162
2249
|
for (const c of sub) {
|
|
2163
|
-
if (c.operator === ">" || c.operator === ">=")
|
|
2250
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2164
2251
|
gt = higherGT(gt, c, options);
|
|
2165
|
-
else if (c.operator === "<" || c.operator === "<=")
|
|
2252
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2166
2253
|
lt = lowerLT(lt, c, options);
|
|
2167
|
-
else
|
|
2254
|
+
} else {
|
|
2168
2255
|
eqSet.add(c.semver);
|
|
2256
|
+
}
|
|
2169
2257
|
}
|
|
2170
|
-
if (eqSet.size > 1)
|
|
2258
|
+
if (eqSet.size > 1) {
|
|
2171
2259
|
return null;
|
|
2260
|
+
}
|
|
2172
2261
|
let gtltComp;
|
|
2173
2262
|
if (gt && lt) {
|
|
2174
2263
|
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2175
|
-
if (gtltComp > 0)
|
|
2264
|
+
if (gtltComp > 0) {
|
|
2176
2265
|
return null;
|
|
2177
|
-
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
|
|
2266
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2178
2267
|
return null;
|
|
2268
|
+
}
|
|
2179
2269
|
}
|
|
2180
2270
|
for (const eq of eqSet) {
|
|
2181
|
-
if (gt && !satisfies2(eq, String(gt), options))
|
|
2271
|
+
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
2182
2272
|
return null;
|
|
2183
|
-
|
|
2273
|
+
}
|
|
2274
|
+
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
2184
2275
|
return null;
|
|
2276
|
+
}
|
|
2185
2277
|
for (const c of dom) {
|
|
2186
|
-
if (!satisfies2(eq, String(c), options))
|
|
2278
|
+
if (!satisfies2(eq, String(c), options)) {
|
|
2187
2279
|
return false;
|
|
2280
|
+
}
|
|
2188
2281
|
}
|
|
2189
2282
|
return true;
|
|
2190
2283
|
}
|
|
@@ -2206,10 +2299,12 @@ var require_subset = __commonJS({
|
|
|
2206
2299
|
}
|
|
2207
2300
|
if (c.operator === ">" || c.operator === ">=") {
|
|
2208
2301
|
higher = higherGT(gt, c, options);
|
|
2209
|
-
if (higher === c && higher !== gt)
|
|
2302
|
+
if (higher === c && higher !== gt) {
|
|
2210
2303
|
return false;
|
|
2211
|
-
|
|
2304
|
+
}
|
|
2305
|
+
} else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
|
|
2212
2306
|
return false;
|
|
2307
|
+
}
|
|
2213
2308
|
}
|
|
2214
2309
|
if (lt) {
|
|
2215
2310
|
if (needDomLTPre) {
|
|
@@ -2219,31 +2314,39 @@ var require_subset = __commonJS({
|
|
|
2219
2314
|
}
|
|
2220
2315
|
if (c.operator === "<" || c.operator === "<=") {
|
|
2221
2316
|
lower = lowerLT(lt, c, options);
|
|
2222
|
-
if (lower === c && lower !== lt)
|
|
2317
|
+
if (lower === c && lower !== lt) {
|
|
2223
2318
|
return false;
|
|
2224
|
-
|
|
2319
|
+
}
|
|
2320
|
+
} else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
|
|
2225
2321
|
return false;
|
|
2322
|
+
}
|
|
2226
2323
|
}
|
|
2227
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0)
|
|
2324
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2228
2325
|
return false;
|
|
2326
|
+
}
|
|
2229
2327
|
}
|
|
2230
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0)
|
|
2328
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2231
2329
|
return false;
|
|
2232
|
-
|
|
2330
|
+
}
|
|
2331
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2233
2332
|
return false;
|
|
2234
|
-
|
|
2333
|
+
}
|
|
2334
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2235
2335
|
return false;
|
|
2336
|
+
}
|
|
2236
2337
|
return true;
|
|
2237
2338
|
};
|
|
2238
2339
|
var higherGT = (a, b, options) => {
|
|
2239
|
-
if (!a)
|
|
2340
|
+
if (!a) {
|
|
2240
2341
|
return b;
|
|
2342
|
+
}
|
|
2241
2343
|
const comp = compare(a.semver, b.semver, options);
|
|
2242
2344
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2243
2345
|
};
|
|
2244
2346
|
var lowerLT = (a, b, options) => {
|
|
2245
|
-
if (!a)
|
|
2347
|
+
if (!a) {
|
|
2246
2348
|
return b;
|
|
2349
|
+
}
|
|
2247
2350
|
const comp = compare(a.semver, b.semver, options);
|
|
2248
2351
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2249
2352
|
};
|
|
@@ -2485,7 +2588,7 @@ var PreferSlotShorthand = class extends import_html_validate3.Rule {
|
|
|
2485
2588
|
}
|
|
2486
2589
|
if (slot = isDeprecatedSlot(attr, value)) {
|
|
2487
2590
|
const context = { slot };
|
|
2488
|
-
const message = `Prefer to use #${slot} over ${attr}="${value}"`;
|
|
2591
|
+
const message = `Prefer to use #${slot} over ${attr}="${value.toString()}"`;
|
|
2489
2592
|
this.report(target, message, location, context);
|
|
2490
2593
|
}
|
|
2491
2594
|
});
|