html-validate-vue 4.1.0 → 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/README.md +5 -4
- package/dist/index.js +849 -689
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,21 +21,18 @@ var __spreadValues = (a, b) => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
24
|
var __commonJS = (cb, mod) => function __require() {
|
|
26
25
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
27
26
|
};
|
|
28
|
-
var
|
|
29
|
-
if (
|
|
30
|
-
for (let key of __getOwnPropNames(
|
|
31
|
-
if (!__hasOwnProp.call(
|
|
32
|
-
__defProp(
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
32
|
}
|
|
34
|
-
return
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (module2, isNodeMode) => {
|
|
37
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
33
|
+
return to;
|
|
38
34
|
};
|
|
35
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
39
36
|
|
|
40
37
|
// node_modules/semver/internal/constants.js
|
|
41
38
|
var require_constants = __commonJS({
|
|
@@ -74,7 +71,7 @@ var require_re = __commonJS({
|
|
|
74
71
|
var R = 0;
|
|
75
72
|
var createToken = (name, value, isGlobal) => {
|
|
76
73
|
const index = R++;
|
|
77
|
-
debug(index, value);
|
|
74
|
+
debug(name, index, value);
|
|
78
75
|
t[name] = index;
|
|
79
76
|
src[index] = value;
|
|
80
77
|
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
@@ -120,8 +117,8 @@ var require_re = __commonJS({
|
|
|
120
117
|
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
121
118
|
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
122
119
|
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
123
|
-
createToken("GTE0", "^\\s*>=\\s*0
|
|
124
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0
|
|
120
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
121
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
125
122
|
}
|
|
126
123
|
});
|
|
127
124
|
|
|
@@ -129,9 +126,9 @@ var require_re = __commonJS({
|
|
|
129
126
|
var require_parse_options = __commonJS({
|
|
130
127
|
"node_modules/semver/internal/parse-options.js"(exports2, module2) {
|
|
131
128
|
var opts = ["includePrerelease", "loose", "rtl"];
|
|
132
|
-
var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((
|
|
133
|
-
|
|
134
|
-
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;
|
|
135
132
|
}, {});
|
|
136
133
|
module2.exports = parseOptions;
|
|
137
134
|
}
|
|
@@ -487,12 +484,12 @@ var require_diff = __commonJS({
|
|
|
487
484
|
const v1 = parse(version1);
|
|
488
485
|
const v2 = parse(version2);
|
|
489
486
|
const hasPre = v1.prerelease.length || v2.prerelease.length;
|
|
490
|
-
const
|
|
487
|
+
const prefix2 = hasPre ? "pre" : "";
|
|
491
488
|
const defaultResult = hasPre ? "prerelease" : "";
|
|
492
489
|
for (const key in v1) {
|
|
493
490
|
if (key === "major" || key === "minor" || key === "patch") {
|
|
494
491
|
if (v1[key] !== v2[key]) {
|
|
495
|
-
return
|
|
492
|
+
return prefix2 + key;
|
|
496
493
|
}
|
|
497
494
|
}
|
|
498
495
|
}
|
|
@@ -648,16 +645,20 @@ var require_cmp = __commonJS({
|
|
|
648
645
|
var cmp = (a, op, b, loose) => {
|
|
649
646
|
switch (op) {
|
|
650
647
|
case "===":
|
|
651
|
-
if (typeof a === "object")
|
|
648
|
+
if (typeof a === "object") {
|
|
652
649
|
a = a.version;
|
|
653
|
-
|
|
650
|
+
}
|
|
651
|
+
if (typeof b === "object") {
|
|
654
652
|
b = b.version;
|
|
653
|
+
}
|
|
655
654
|
return a === b;
|
|
656
655
|
case "!==":
|
|
657
|
-
if (typeof a === "object")
|
|
656
|
+
if (typeof a === "object") {
|
|
658
657
|
a = a.version;
|
|
659
|
-
|
|
658
|
+
}
|
|
659
|
+
if (typeof b === "object") {
|
|
660
660
|
b = b.version;
|
|
661
|
+
}
|
|
661
662
|
return a !== b;
|
|
662
663
|
case "":
|
|
663
664
|
case "=":
|
|
@@ -711,661 +712,724 @@ var require_coerce = __commonJS({
|
|
|
711
712
|
}
|
|
712
713
|
re[t.COERCERTL].lastIndex = -1;
|
|
713
714
|
}
|
|
714
|
-
if (match === null)
|
|
715
|
+
if (match === null) {
|
|
715
716
|
return null;
|
|
717
|
+
}
|
|
716
718
|
return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
|
|
717
719
|
};
|
|
718
720
|
module2.exports = coerce;
|
|
719
721
|
}
|
|
720
722
|
});
|
|
721
723
|
|
|
722
|
-
// node_modules/
|
|
723
|
-
var
|
|
724
|
-
"node_modules/
|
|
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
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
if (node === this.head) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
if (node.list) {
|
|
791
|
-
node.list.removeNode(node);
|
|
792
|
-
}
|
|
793
|
-
var head = this.head;
|
|
794
|
-
node.list = this;
|
|
795
|
-
node.next = head;
|
|
796
|
-
if (head) {
|
|
797
|
-
head.prev = node;
|
|
798
|
-
}
|
|
799
|
-
this.head = node;
|
|
800
|
-
if (!this.tail) {
|
|
801
|
-
this.tail = node;
|
|
802
|
-
}
|
|
803
|
-
this.length++;
|
|
804
|
-
};
|
|
805
|
-
Yallist.prototype.pushNode = function(node) {
|
|
806
|
-
if (node === this.tail) {
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
if (node.list) {
|
|
810
|
-
node.list.removeNode(node);
|
|
811
|
-
}
|
|
812
|
-
var tail = this.tail;
|
|
813
|
-
node.list = this;
|
|
814
|
-
node.prev = tail;
|
|
815
|
-
if (tail) {
|
|
816
|
-
tail.next = node;
|
|
817
|
-
}
|
|
818
|
-
this.tail = node;
|
|
819
|
-
if (!this.head) {
|
|
820
|
-
this.head = node;
|
|
821
|
-
}
|
|
822
|
-
this.length++;
|
|
823
|
-
};
|
|
824
|
-
Yallist.prototype.push = function() {
|
|
825
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
826
|
-
push(this, arguments[i]);
|
|
827
|
-
}
|
|
828
|
-
return this.length;
|
|
829
|
-
};
|
|
830
|
-
Yallist.prototype.unshift = function() {
|
|
831
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
832
|
-
unshift(this, arguments[i]);
|
|
833
|
-
}
|
|
834
|
-
return this.length;
|
|
835
|
-
};
|
|
836
|
-
Yallist.prototype.pop = function() {
|
|
837
|
-
if (!this.tail) {
|
|
838
|
-
return void 0;
|
|
839
|
-
}
|
|
840
|
-
var res = this.tail.value;
|
|
841
|
-
this.tail = this.tail.prev;
|
|
842
|
-
if (this.tail) {
|
|
843
|
-
this.tail.next = null;
|
|
844
|
-
} else {
|
|
845
|
-
this.head = null;
|
|
846
|
-
}
|
|
847
|
-
this.length--;
|
|
848
|
-
return res;
|
|
849
|
-
};
|
|
850
|
-
Yallist.prototype.shift = function() {
|
|
851
|
-
if (!this.head) {
|
|
852
|
-
return void 0;
|
|
853
|
-
}
|
|
854
|
-
var res = this.head.value;
|
|
855
|
-
this.head = this.head.next;
|
|
856
|
-
if (this.head) {
|
|
857
|
-
this.head.prev = null;
|
|
858
|
-
} else {
|
|
859
|
-
this.tail = null;
|
|
860
|
-
}
|
|
861
|
-
this.length--;
|
|
862
|
-
return res;
|
|
863
|
-
};
|
|
864
|
-
Yallist.prototype.forEach = function(fn, thisp) {
|
|
865
|
-
thisp = thisp || this;
|
|
866
|
-
for (var walker = this.head, i = 0; walker !== null; i++) {
|
|
867
|
-
fn.call(thisp, walker.value, i, this);
|
|
868
|
-
walker = walker.next;
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
Yallist.prototype.forEachReverse = function(fn, thisp) {
|
|
872
|
-
thisp = thisp || this;
|
|
873
|
-
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
|
874
|
-
fn.call(thisp, walker.value, i, this);
|
|
875
|
-
walker = walker.prev;
|
|
876
|
-
}
|
|
877
|
-
};
|
|
878
|
-
Yallist.prototype.get = function(n) {
|
|
879
|
-
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
|
880
|
-
walker = walker.next;
|
|
881
|
-
}
|
|
882
|
-
if (i === n && walker !== null) {
|
|
883
|
-
return walker.value;
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
Yallist.prototype.getReverse = function(n) {
|
|
887
|
-
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
|
888
|
-
walker = walker.prev;
|
|
889
|
-
}
|
|
890
|
-
if (i === n && walker !== null) {
|
|
891
|
-
return walker.value;
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
Yallist.prototype.map = function(fn, thisp) {
|
|
895
|
-
thisp = thisp || this;
|
|
896
|
-
var res = new Yallist();
|
|
897
|
-
for (var walker = this.head; walker !== null; ) {
|
|
898
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
899
|
-
walker = walker.next;
|
|
900
|
-
}
|
|
901
|
-
return res;
|
|
902
|
-
};
|
|
903
|
-
Yallist.prototype.mapReverse = function(fn, thisp) {
|
|
904
|
-
thisp = thisp || this;
|
|
905
|
-
var res = new Yallist();
|
|
906
|
-
for (var walker = this.tail; walker !== null; ) {
|
|
907
|
-
res.push(fn.call(thisp, walker.value, this));
|
|
908
|
-
walker = walker.prev;
|
|
909
|
-
}
|
|
910
|
-
return res;
|
|
911
|
-
};
|
|
912
|
-
Yallist.prototype.reduce = function(fn, initial) {
|
|
913
|
-
var acc;
|
|
914
|
-
var walker = this.head;
|
|
915
|
-
if (arguments.length > 1) {
|
|
916
|
-
acc = initial;
|
|
917
|
-
} else if (this.head) {
|
|
918
|
-
walker = this.head.next;
|
|
919
|
-
acc = this.head.value;
|
|
920
|
-
} else {
|
|
921
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
922
|
-
}
|
|
923
|
-
for (var i = 0; walker !== null; i++) {
|
|
924
|
-
acc = fn(acc, walker.value, i);
|
|
925
|
-
walker = walker.next;
|
|
926
|
-
}
|
|
927
|
-
return acc;
|
|
928
|
-
};
|
|
929
|
-
Yallist.prototype.reduceReverse = function(fn, initial) {
|
|
930
|
-
var acc;
|
|
931
|
-
var walker = this.tail;
|
|
932
|
-
if (arguments.length > 1) {
|
|
933
|
-
acc = initial;
|
|
934
|
-
} else if (this.tail) {
|
|
935
|
-
walker = this.tail.prev;
|
|
936
|
-
acc = this.tail.value;
|
|
937
|
-
} else {
|
|
938
|
-
throw new TypeError("Reduce of empty list with no initial value");
|
|
939
|
-
}
|
|
940
|
-
for (var i = this.length - 1; walker !== null; i--) {
|
|
941
|
-
acc = fn(acc, walker.value, i);
|
|
942
|
-
walker = walker.prev;
|
|
943
|
-
}
|
|
944
|
-
return acc;
|
|
945
|
-
};
|
|
946
|
-
Yallist.prototype.toArray = function() {
|
|
947
|
-
var arr = new Array(this.length);
|
|
948
|
-
for (var i = 0, walker = this.head; walker !== null; i++) {
|
|
949
|
-
arr[i] = walker.value;
|
|
950
|
-
walker = walker.next;
|
|
951
|
-
}
|
|
952
|
-
return arr;
|
|
953
|
-
};
|
|
954
|
-
Yallist.prototype.toArrayReverse = function() {
|
|
955
|
-
var arr = new Array(this.length);
|
|
956
|
-
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
|
957
|
-
arr[i] = walker.value;
|
|
958
|
-
walker = walker.prev;
|
|
959
|
-
}
|
|
960
|
-
return arr;
|
|
961
|
-
};
|
|
962
|
-
Yallist.prototype.slice = function(from, to) {
|
|
963
|
-
to = to || this.length;
|
|
964
|
-
if (to < 0) {
|
|
965
|
-
to += this.length;
|
|
966
|
-
}
|
|
967
|
-
from = from || 0;
|
|
968
|
-
if (from < 0) {
|
|
969
|
-
from += this.length;
|
|
970
|
-
}
|
|
971
|
-
var ret = new Yallist();
|
|
972
|
-
if (to < from || to < 0) {
|
|
973
|
-
return ret;
|
|
974
|
-
}
|
|
975
|
-
if (from < 0) {
|
|
976
|
-
from = 0;
|
|
977
|
-
}
|
|
978
|
-
if (to > this.length) {
|
|
979
|
-
to = this.length;
|
|
980
|
-
}
|
|
981
|
-
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
|
982
|
-
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;
|
|
983
789
|
}
|
|
984
|
-
|
|
985
|
-
|
|
790
|
+
pop() {
|
|
791
|
+
return this.heap[--this.length];
|
|
986
792
|
}
|
|
987
|
-
return ret;
|
|
988
793
|
};
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
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
|
+
}
|
|
993
899
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
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
|
+
};
|
|
997
945
|
}
|
|
998
|
-
|
|
999
|
-
if (to < from || to < 0) {
|
|
1000
|
-
return ret;
|
|
946
|
+
updateItemAge(index) {
|
|
1001
947
|
}
|
|
1002
|
-
|
|
1003
|
-
from = 0;
|
|
948
|
+
setItemTTL(index, ttl) {
|
|
1004
949
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
950
|
+
isStale(index) {
|
|
951
|
+
return false;
|
|
1007
952
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
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
|
+
};
|
|
1010
990
|
}
|
|
1011
|
-
|
|
1012
|
-
ret.push(walker.value);
|
|
991
|
+
removeItemSize(index) {
|
|
1013
992
|
}
|
|
1014
|
-
|
|
1015
|
-
};
|
|
1016
|
-
Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
|
|
1017
|
-
if (start > this.length) {
|
|
1018
|
-
start = this.length - 1;
|
|
993
|
+
addItemSize(index, v, k, size) {
|
|
1019
994
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
995
|
+
requireSize(k, v, size, sizeCalculation) {
|
|
996
|
+
if (size || sizeCalculation) {
|
|
997
|
+
throw new TypeError("cannot set size without setting maxSize on cache");
|
|
998
|
+
}
|
|
1022
999
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
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
|
+
}
|
|
1025
1016
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
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
|
+
}
|
|
1030
1033
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1034
|
+
isValidIndex(index) {
|
|
1035
|
+
return this.keyMap.get(this.keyList[index]) === index;
|
|
1033
1036
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1037
|
+
*entries() {
|
|
1038
|
+
for (const i of this.indexes()) {
|
|
1039
|
+
yield [this.keyList[i], this.valList[i]];
|
|
1040
|
+
}
|
|
1036
1041
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1042
|
+
*rentries() {
|
|
1043
|
+
for (const i of this.rindexes()) {
|
|
1044
|
+
yield [this.keyList[i], this.valList[i]];
|
|
1045
|
+
}
|
|
1039
1046
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
var tail = this.tail;
|
|
1045
|
-
for (var walker = head; walker !== null; walker = walker.prev) {
|
|
1046
|
-
var p = walker.prev;
|
|
1047
|
-
walker.prev = walker.next;
|
|
1048
|
-
walker.next = p;
|
|
1049
|
-
}
|
|
1050
|
-
this.head = tail;
|
|
1051
|
-
this.tail = head;
|
|
1052
|
-
return this;
|
|
1053
|
-
};
|
|
1054
|
-
function insert(self, node, value) {
|
|
1055
|
-
var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
|
|
1056
|
-
if (inserted.next === null) {
|
|
1057
|
-
self.tail = inserted;
|
|
1047
|
+
*keys() {
|
|
1048
|
+
for (const i of this.indexes()) {
|
|
1049
|
+
yield this.keyList[i];
|
|
1050
|
+
}
|
|
1058
1051
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1052
|
+
*rkeys() {
|
|
1053
|
+
for (const i of this.rindexes()) {
|
|
1054
|
+
yield this.keyList[i];
|
|
1055
|
+
}
|
|
1061
1056
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
self.tail = new Node(item, self.tail, null, self);
|
|
1067
|
-
if (!self.head) {
|
|
1068
|
-
self.head = self.tail;
|
|
1057
|
+
*values() {
|
|
1058
|
+
for (const i of this.indexes()) {
|
|
1059
|
+
yield this.valList[i];
|
|
1060
|
+
}
|
|
1069
1061
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
if (!self.tail) {
|
|
1075
|
-
self.tail = self.head;
|
|
1062
|
+
*rvalues() {
|
|
1063
|
+
for (const i of this.rindexes()) {
|
|
1064
|
+
yield this.valList[i];
|
|
1065
|
+
}
|
|
1076
1066
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
function Node(value, prev, next, list) {
|
|
1080
|
-
if (!(this instanceof Node)) {
|
|
1081
|
-
return new Node(value, prev, next, list);
|
|
1082
|
-
}
|
|
1083
|
-
this.list = list;
|
|
1084
|
-
this.value = value;
|
|
1085
|
-
if (prev) {
|
|
1086
|
-
prev.next = this;
|
|
1087
|
-
this.prev = prev;
|
|
1088
|
-
} else {
|
|
1089
|
-
this.prev = null;
|
|
1067
|
+
[Symbol.iterator]() {
|
|
1068
|
+
return this.entries();
|
|
1090
1069
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
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
|
+
}
|
|
1096
1076
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
} catch (er) {
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
});
|
|
1104
|
-
|
|
1105
|
-
// node_modules/lru-cache/index.js
|
|
1106
|
-
var require_lru_cache = __commonJS({
|
|
1107
|
-
"node_modules/lru-cache/index.js"(exports2, module2) {
|
|
1108
|
-
"use strict";
|
|
1109
|
-
var Yallist = require_yallist();
|
|
1110
|
-
var MAX = Symbol("max");
|
|
1111
|
-
var LENGTH = Symbol("length");
|
|
1112
|
-
var LENGTH_CALCULATOR = Symbol("lengthCalculator");
|
|
1113
|
-
var ALLOW_STALE = Symbol("allowStale");
|
|
1114
|
-
var MAX_AGE = Symbol("maxAge");
|
|
1115
|
-
var DISPOSE = Symbol("dispose");
|
|
1116
|
-
var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
|
|
1117
|
-
var LRU_LIST = Symbol("lruList");
|
|
1118
|
-
var CACHE = Symbol("cache");
|
|
1119
|
-
var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
|
|
1120
|
-
var naiveLength = () => 1;
|
|
1121
|
-
var LRUCache = class {
|
|
1122
|
-
constructor(options) {
|
|
1123
|
-
if (typeof options === "number")
|
|
1124
|
-
options = { max: options };
|
|
1125
|
-
if (!options)
|
|
1126
|
-
options = {};
|
|
1127
|
-
if (options.max && (typeof options.max !== "number" || options.max < 0))
|
|
1128
|
-
throw new TypeError("max must be a non-negative number");
|
|
1129
|
-
const max = this[MAX] = options.max || Infinity;
|
|
1130
|
-
const lc = options.length || naiveLength;
|
|
1131
|
-
this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
|
|
1132
|
-
this[ALLOW_STALE] = options.stale || false;
|
|
1133
|
-
if (options.maxAge && typeof options.maxAge !== "number")
|
|
1134
|
-
throw new TypeError("maxAge must be a number");
|
|
1135
|
-
this[MAX_AGE] = options.maxAge || 0;
|
|
1136
|
-
this[DISPOSE] = options.dispose;
|
|
1137
|
-
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
|
1138
|
-
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
|
|
1139
|
-
this.reset();
|
|
1140
|
-
}
|
|
1141
|
-
set max(mL) {
|
|
1142
|
-
if (typeof mL !== "number" || mL < 0)
|
|
1143
|
-
throw new TypeError("max must be a non-negative number");
|
|
1144
|
-
this[MAX] = mL || Infinity;
|
|
1145
|
-
trim(this);
|
|
1146
|
-
}
|
|
1147
|
-
get max() {
|
|
1148
|
-
return this[MAX];
|
|
1149
|
-
}
|
|
1150
|
-
set allowStale(allowStale) {
|
|
1151
|
-
this[ALLOW_STALE] = !!allowStale;
|
|
1152
|
-
}
|
|
1153
|
-
get allowStale() {
|
|
1154
|
-
return this[ALLOW_STALE];
|
|
1155
|
-
}
|
|
1156
|
-
set maxAge(mA) {
|
|
1157
|
-
if (typeof mA !== "number")
|
|
1158
|
-
throw new TypeError("maxAge must be a non-negative number");
|
|
1159
|
-
this[MAX_AGE] = mA;
|
|
1160
|
-
trim(this);
|
|
1161
|
-
}
|
|
1162
|
-
get maxAge() {
|
|
1163
|
-
return this[MAX_AGE];
|
|
1164
|
-
}
|
|
1165
|
-
set lengthCalculator(lC) {
|
|
1166
|
-
if (typeof lC !== "function")
|
|
1167
|
-
lC = naiveLength;
|
|
1168
|
-
if (lC !== this[LENGTH_CALCULATOR]) {
|
|
1169
|
-
this[LENGTH_CALCULATOR] = lC;
|
|
1170
|
-
this[LENGTH] = 0;
|
|
1171
|
-
this[LRU_LIST].forEach((hit) => {
|
|
1172
|
-
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
|
1173
|
-
this[LENGTH] += hit.length;
|
|
1174
|
-
});
|
|
1077
|
+
forEach(fn, thisp = this) {
|
|
1078
|
+
for (const i of this.indexes()) {
|
|
1079
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
1175
1080
|
}
|
|
1176
|
-
trim(this);
|
|
1177
1081
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1082
|
+
rforEach(fn, thisp = this) {
|
|
1083
|
+
for (const i of this.rindexes()) {
|
|
1084
|
+
fn.call(thisp, this.valList[i], this.keyList[i], this);
|
|
1085
|
+
}
|
|
1180
1086
|
}
|
|
1181
|
-
get
|
|
1182
|
-
|
|
1087
|
+
get prune() {
|
|
1088
|
+
deprecatedMethod("prune", "purgeStale");
|
|
1089
|
+
return this.purgeStale;
|
|
1183
1090
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
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;
|
|
1186
1100
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
for (
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
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]);
|
|
1193
1114
|
}
|
|
1115
|
+
return arr;
|
|
1194
1116
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
for (
|
|
1198
|
-
|
|
1199
|
-
forEachStep(this, fn, walker, thisp);
|
|
1200
|
-
walker = next;
|
|
1117
|
+
load(arr) {
|
|
1118
|
+
this.clear();
|
|
1119
|
+
for (const [key, entry] of arr) {
|
|
1120
|
+
this.set(key, entry.value, entry);
|
|
1201
1121
|
}
|
|
1202
1122
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
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;
|
|
1205
1176
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
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++;
|
|
1208
1188
|
}
|
|
1209
|
-
|
|
1210
|
-
if (this
|
|
1211
|
-
|
|
1189
|
+
pop() {
|
|
1190
|
+
if (this.size) {
|
|
1191
|
+
const val = this.valList[this.head];
|
|
1192
|
+
this.evict();
|
|
1193
|
+
return val;
|
|
1212
1194
|
}
|
|
1213
|
-
this[CACHE] = /* @__PURE__ */ new Map();
|
|
1214
|
-
this[LRU_LIST] = new Yallist();
|
|
1215
|
-
this[LENGTH] = 0;
|
|
1216
1195
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
set(key, value, maxAge) {
|
|
1228
|
-
maxAge = maxAge || this[MAX_AGE];
|
|
1229
|
-
if (maxAge && typeof maxAge !== "number")
|
|
1230
|
-
throw new TypeError("maxAge must be a number");
|
|
1231
|
-
const now = maxAge ? Date.now() : 0;
|
|
1232
|
-
const len = this[LENGTH_CALCULATOR](value, key);
|
|
1233
|
-
if (this[CACHE].has(key)) {
|
|
1234
|
-
if (len > this[MAX]) {
|
|
1235
|
-
del(this, this[CACHE].get(key));
|
|
1236
|
-
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"]);
|
|
1237
1206
|
}
|
|
1238
|
-
const node = this[CACHE].get(key);
|
|
1239
|
-
const item = node.value;
|
|
1240
|
-
if (this[DISPOSE]) {
|
|
1241
|
-
if (!this[NO_DISPOSE_ON_SET])
|
|
1242
|
-
this[DISPOSE](key, item.value);
|
|
1243
|
-
}
|
|
1244
|
-
item.now = now;
|
|
1245
|
-
item.maxAge = maxAge;
|
|
1246
|
-
item.value = value;
|
|
1247
|
-
this[LENGTH] += len - item.length;
|
|
1248
|
-
item.length = len;
|
|
1249
|
-
this.get(key);
|
|
1250
|
-
trim(this);
|
|
1251
|
-
return true;
|
|
1252
1207
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
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
|
+
}
|
|
1258
1223
|
}
|
|
1259
|
-
|
|
1260
|
-
this[LRU_LIST].unshift(hit);
|
|
1261
|
-
this[CACHE].set(key, this[LRU_LIST].head);
|
|
1262
|
-
trim(this);
|
|
1263
|
-
return true;
|
|
1224
|
+
return false;
|
|
1264
1225
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
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
|
+
}
|
|
1270
1231
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
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
|
+
}
|
|
1273
1300
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
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
|
+
}
|
|
1276
1327
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
return null;
|
|
1281
|
-
del(this, node);
|
|
1282
|
-
return node.value;
|
|
1328
|
+
connect(p, n) {
|
|
1329
|
+
this.prev[n] = p;
|
|
1330
|
+
this.next[p] = n;
|
|
1283
1331
|
}
|
|
1284
|
-
|
|
1285
|
-
|
|
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
|
+
}
|
|
1286
1342
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (
|
|
1298
|
-
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);
|
|
1299
1379
|
}
|
|
1300
1380
|
}
|
|
1301
1381
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
var get = (self, key, doUse) => {
|
|
1308
|
-
const node = self[CACHE].get(key);
|
|
1309
|
-
if (node) {
|
|
1310
|
-
const hit = node.value;
|
|
1311
|
-
if (isStale(self, hit)) {
|
|
1312
|
-
del(self, node);
|
|
1313
|
-
if (!self[ALLOW_STALE])
|
|
1314
|
-
return void 0;
|
|
1315
|
-
} else {
|
|
1316
|
-
if (doUse) {
|
|
1317
|
-
if (self[UPDATE_AGE_ON_GET])
|
|
1318
|
-
node.value.now = Date.now();
|
|
1319
|
-
self[LRU_LIST].unshiftNode(node);
|
|
1382
|
+
if (this.disposed) {
|
|
1383
|
+
while (this.disposed.length) {
|
|
1384
|
+
this.disposeAfter(...this.disposed.shift());
|
|
1320
1385
|
}
|
|
1321
1386
|
}
|
|
1322
|
-
return
|
|
1387
|
+
return deleted;
|
|
1323
1388
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
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
|
+
}
|
|
1337
1422
|
}
|
|
1338
1423
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
const hit = node.value;
|
|
1343
|
-
if (self[DISPOSE])
|
|
1344
|
-
self[DISPOSE](hit.key, hit.value);
|
|
1345
|
-
self[LENGTH] -= hit.length;
|
|
1346
|
-
self[CACHE].delete(hit.key);
|
|
1347
|
-
self[LRU_LIST].removeNode(node);
|
|
1424
|
+
get reset() {
|
|
1425
|
+
deprecatedMethod("reset", "clear");
|
|
1426
|
+
return this.clear;
|
|
1348
1427
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
this.key = key;
|
|
1353
|
-
this.value = value;
|
|
1354
|
-
this.length = length;
|
|
1355
|
-
this.now = now;
|
|
1356
|
-
this.maxAge = maxAge || 0;
|
|
1428
|
+
get length() {
|
|
1429
|
+
deprecatedProperty("length", "size");
|
|
1430
|
+
return this.size;
|
|
1357
1431
|
}
|
|
1358
1432
|
};
|
|
1359
|
-
var forEachStep = (self, fn, node, thisp) => {
|
|
1360
|
-
let hit = node.value;
|
|
1361
|
-
if (isStale(self, hit)) {
|
|
1362
|
-
del(self, node);
|
|
1363
|
-
if (!self[ALLOW_STALE])
|
|
1364
|
-
hit = void 0;
|
|
1365
|
-
}
|
|
1366
|
-
if (hit)
|
|
1367
|
-
fn.call(thisp, hit.value, hit.key, self);
|
|
1368
|
-
};
|
|
1369
1433
|
module2.exports = LRUCache;
|
|
1370
1434
|
}
|
|
1371
1435
|
});
|
|
@@ -1393,16 +1457,16 @@ var require_range = __commonJS({
|
|
|
1393
1457
|
this.loose = !!options.loose;
|
|
1394
1458
|
this.includePrerelease = !!options.includePrerelease;
|
|
1395
1459
|
this.raw = range;
|
|
1396
|
-
this.set = range.split(
|
|
1460
|
+
this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1397
1461
|
if (!this.set.length) {
|
|
1398
1462
|
throw new TypeError(`Invalid SemVer Range: ${range}`);
|
|
1399
1463
|
}
|
|
1400
1464
|
if (this.set.length > 1) {
|
|
1401
1465
|
const first = this.set[0];
|
|
1402
1466
|
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1403
|
-
if (this.set.length === 0)
|
|
1467
|
+
if (this.set.length === 0) {
|
|
1404
1468
|
this.set = [first];
|
|
1405
|
-
else if (this.set.length > 1) {
|
|
1469
|
+
} else if (this.set.length > 1) {
|
|
1406
1470
|
for (const c of this.set) {
|
|
1407
1471
|
if (c.length === 1 && isAny(c[0])) {
|
|
1408
1472
|
this.set = [c];
|
|
@@ -1427,28 +1491,37 @@ var require_range = __commonJS({
|
|
|
1427
1491
|
const memoOpts = Object.keys(this.options).join(",");
|
|
1428
1492
|
const memoKey = `parseRange:${memoOpts}:${range}`;
|
|
1429
1493
|
const cached = cache.get(memoKey);
|
|
1430
|
-
if (cached)
|
|
1494
|
+
if (cached) {
|
|
1431
1495
|
return cached;
|
|
1496
|
+
}
|
|
1432
1497
|
const loose = this.options.loose;
|
|
1433
1498
|
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1434
1499
|
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1435
1500
|
debug("hyphen replace", range);
|
|
1436
1501
|
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1437
|
-
debug("comparator trim", range
|
|
1502
|
+
debug("comparator trim", range);
|
|
1438
1503
|
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1439
1504
|
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1440
1505
|
range = range.split(/\s+/).join(" ");
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
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);
|
|
1444
1514
|
const rangeMap = /* @__PURE__ */ new Map();
|
|
1445
|
-
|
|
1446
|
-
|
|
1515
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1516
|
+
for (const comp of comparators) {
|
|
1517
|
+
if (isNullSet(comp)) {
|
|
1447
1518
|
return [comp];
|
|
1519
|
+
}
|
|
1448
1520
|
rangeMap.set(comp.value, comp);
|
|
1449
1521
|
}
|
|
1450
|
-
if (rangeMap.size > 1 && rangeMap.has(""))
|
|
1522
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1451
1523
|
rangeMap.delete("");
|
|
1524
|
+
}
|
|
1452
1525
|
const result = [...rangeMap.values()];
|
|
1453
1526
|
cache.set(memoKey, result);
|
|
1454
1527
|
return result;
|
|
@@ -1527,8 +1600,8 @@ var require_range = __commonJS({
|
|
|
1527
1600
|
return comp;
|
|
1528
1601
|
};
|
|
1529
1602
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1530
|
-
var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((
|
|
1531
|
-
return replaceTilde(
|
|
1603
|
+
var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
1604
|
+
return replaceTilde(c, options);
|
|
1532
1605
|
}).join(" ");
|
|
1533
1606
|
var replaceTilde = (comp, options) => {
|
|
1534
1607
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
@@ -1551,8 +1624,8 @@ var require_range = __commonJS({
|
|
|
1551
1624
|
return ret;
|
|
1552
1625
|
});
|
|
1553
1626
|
};
|
|
1554
|
-
var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((
|
|
1555
|
-
return replaceCaret(
|
|
1627
|
+
var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => {
|
|
1628
|
+
return replaceCaret(c, options);
|
|
1556
1629
|
}).join(" ");
|
|
1557
1630
|
var replaceCaret = (comp, options) => {
|
|
1558
1631
|
debug("caret", comp, options);
|
|
@@ -1600,8 +1673,8 @@ var require_range = __commonJS({
|
|
|
1600
1673
|
};
|
|
1601
1674
|
var replaceXRanges = (comp, options) => {
|
|
1602
1675
|
debug("replaceXRanges", comp, options);
|
|
1603
|
-
return comp.split(/\s+/).map((
|
|
1604
|
-
return replaceXRange(
|
|
1676
|
+
return comp.split(/\s+/).map((c) => {
|
|
1677
|
+
return replaceXRange(c, options);
|
|
1605
1678
|
}).join(" ");
|
|
1606
1679
|
};
|
|
1607
1680
|
var replaceXRange = (comp, options) => {
|
|
@@ -1646,8 +1719,9 @@ var require_range = __commonJS({
|
|
|
1646
1719
|
m = +m + 1;
|
|
1647
1720
|
}
|
|
1648
1721
|
}
|
|
1649
|
-
if (gtlt === "<")
|
|
1722
|
+
if (gtlt === "<") {
|
|
1650
1723
|
pr = "-0";
|
|
1724
|
+
}
|
|
1651
1725
|
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1652
1726
|
} else if (xm) {
|
|
1653
1727
|
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
@@ -1944,8 +2018,9 @@ var require_min_version = __commonJS({
|
|
|
1944
2018
|
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1945
2019
|
}
|
|
1946
2020
|
});
|
|
1947
|
-
if (setMin && (!minver || gt(minver, setMin)))
|
|
2021
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
1948
2022
|
minver = setMin;
|
|
2023
|
+
}
|
|
1949
2024
|
}
|
|
1950
2025
|
if (minver && range.test(minver)) {
|
|
1951
2026
|
return minver;
|
|
@@ -2077,37 +2152,40 @@ var require_simplify = __commonJS({
|
|
|
2077
2152
|
var compare = require_compare();
|
|
2078
2153
|
module2.exports = (versions, range, options) => {
|
|
2079
2154
|
const set = [];
|
|
2080
|
-
let
|
|
2155
|
+
let first = null;
|
|
2081
2156
|
let prev = null;
|
|
2082
2157
|
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2083
2158
|
for (const version of v) {
|
|
2084
2159
|
const included = satisfies2(version, range, options);
|
|
2085
2160
|
if (included) {
|
|
2086
2161
|
prev = version;
|
|
2087
|
-
if (!
|
|
2088
|
-
|
|
2162
|
+
if (!first) {
|
|
2163
|
+
first = version;
|
|
2164
|
+
}
|
|
2089
2165
|
} else {
|
|
2090
2166
|
if (prev) {
|
|
2091
|
-
set.push([
|
|
2167
|
+
set.push([first, prev]);
|
|
2092
2168
|
}
|
|
2093
2169
|
prev = null;
|
|
2094
|
-
|
|
2170
|
+
first = null;
|
|
2095
2171
|
}
|
|
2096
2172
|
}
|
|
2097
|
-
if (
|
|
2098
|
-
set.push([
|
|
2173
|
+
if (first) {
|
|
2174
|
+
set.push([first, null]);
|
|
2175
|
+
}
|
|
2099
2176
|
const ranges = [];
|
|
2100
|
-
for (const [
|
|
2101
|
-
if (
|
|
2102
|
-
ranges.push(
|
|
2103
|
-
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]) {
|
|
2104
2181
|
ranges.push("*");
|
|
2105
|
-
else if (!max)
|
|
2106
|
-
ranges.push(`>=${
|
|
2107
|
-
else if (
|
|
2182
|
+
} else if (!max) {
|
|
2183
|
+
ranges.push(`>=${min}`);
|
|
2184
|
+
} else if (min === v[0]) {
|
|
2108
2185
|
ranges.push(`<=${max}`);
|
|
2109
|
-
else
|
|
2110
|
-
ranges.push(`${
|
|
2186
|
+
} else {
|
|
2187
|
+
ranges.push(`${min} - ${max}`);
|
|
2188
|
+
}
|
|
2111
2189
|
}
|
|
2112
2190
|
const simplified = ranges.join(" || ");
|
|
2113
2191
|
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
@@ -2125,8 +2203,9 @@ var require_subset = __commonJS({
|
|
|
2125
2203
|
var satisfies2 = require_satisfies();
|
|
2126
2204
|
var compare = require_compare();
|
|
2127
2205
|
var subset = (sub, dom, options = {}) => {
|
|
2128
|
-
if (sub === dom)
|
|
2206
|
+
if (sub === dom) {
|
|
2129
2207
|
return true;
|
|
2208
|
+
}
|
|
2130
2209
|
sub = new Range(sub, options);
|
|
2131
2210
|
dom = new Range(dom, options);
|
|
2132
2211
|
let sawNonNull = false;
|
|
@@ -2135,59 +2214,70 @@ var require_subset = __commonJS({
|
|
|
2135
2214
|
for (const simpleDom of dom.set) {
|
|
2136
2215
|
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2137
2216
|
sawNonNull = sawNonNull || isSub !== null;
|
|
2138
|
-
if (isSub)
|
|
2217
|
+
if (isSub) {
|
|
2139
2218
|
continue OUTER;
|
|
2219
|
+
}
|
|
2140
2220
|
}
|
|
2141
|
-
if (sawNonNull)
|
|
2221
|
+
if (sawNonNull) {
|
|
2142
2222
|
return false;
|
|
2223
|
+
}
|
|
2143
2224
|
}
|
|
2144
2225
|
return true;
|
|
2145
2226
|
};
|
|
2146
2227
|
var simpleSubset = (sub, dom, options) => {
|
|
2147
|
-
if (sub === dom)
|
|
2228
|
+
if (sub === dom) {
|
|
2148
2229
|
return true;
|
|
2230
|
+
}
|
|
2149
2231
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2150
|
-
if (dom.length === 1 && dom[0].semver === ANY)
|
|
2232
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2151
2233
|
return true;
|
|
2152
|
-
else if (options.includePrerelease)
|
|
2234
|
+
} else if (options.includePrerelease) {
|
|
2153
2235
|
sub = [new Comparator(">=0.0.0-0")];
|
|
2154
|
-
else
|
|
2236
|
+
} else {
|
|
2155
2237
|
sub = [new Comparator(">=0.0.0")];
|
|
2238
|
+
}
|
|
2156
2239
|
}
|
|
2157
2240
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2158
|
-
if (options.includePrerelease)
|
|
2241
|
+
if (options.includePrerelease) {
|
|
2159
2242
|
return true;
|
|
2160
|
-
else
|
|
2243
|
+
} else {
|
|
2161
2244
|
dom = [new Comparator(">=0.0.0")];
|
|
2245
|
+
}
|
|
2162
2246
|
}
|
|
2163
2247
|
const eqSet = /* @__PURE__ */ new Set();
|
|
2164
2248
|
let gt, lt;
|
|
2165
2249
|
for (const c of sub) {
|
|
2166
|
-
if (c.operator === ">" || c.operator === ">=")
|
|
2250
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2167
2251
|
gt = higherGT(gt, c, options);
|
|
2168
|
-
else if (c.operator === "<" || c.operator === "<=")
|
|
2252
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2169
2253
|
lt = lowerLT(lt, c, options);
|
|
2170
|
-
else
|
|
2254
|
+
} else {
|
|
2171
2255
|
eqSet.add(c.semver);
|
|
2256
|
+
}
|
|
2172
2257
|
}
|
|
2173
|
-
if (eqSet.size > 1)
|
|
2258
|
+
if (eqSet.size > 1) {
|
|
2174
2259
|
return null;
|
|
2260
|
+
}
|
|
2175
2261
|
let gtltComp;
|
|
2176
2262
|
if (gt && lt) {
|
|
2177
2263
|
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2178
|
-
if (gtltComp > 0)
|
|
2264
|
+
if (gtltComp > 0) {
|
|
2179
2265
|
return null;
|
|
2180
|
-
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
|
|
2266
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2181
2267
|
return null;
|
|
2268
|
+
}
|
|
2182
2269
|
}
|
|
2183
2270
|
for (const eq of eqSet) {
|
|
2184
|
-
if (gt && !satisfies2(eq, String(gt), options))
|
|
2271
|
+
if (gt && !satisfies2(eq, String(gt), options)) {
|
|
2185
2272
|
return null;
|
|
2186
|
-
|
|
2273
|
+
}
|
|
2274
|
+
if (lt && !satisfies2(eq, String(lt), options)) {
|
|
2187
2275
|
return null;
|
|
2276
|
+
}
|
|
2188
2277
|
for (const c of dom) {
|
|
2189
|
-
if (!satisfies2(eq, String(c), options))
|
|
2278
|
+
if (!satisfies2(eq, String(c), options)) {
|
|
2190
2279
|
return false;
|
|
2280
|
+
}
|
|
2191
2281
|
}
|
|
2192
2282
|
return true;
|
|
2193
2283
|
}
|
|
@@ -2209,10 +2299,12 @@ var require_subset = __commonJS({
|
|
|
2209
2299
|
}
|
|
2210
2300
|
if (c.operator === ">" || c.operator === ">=") {
|
|
2211
2301
|
higher = higherGT(gt, c, options);
|
|
2212
|
-
if (higher === c && higher !== gt)
|
|
2302
|
+
if (higher === c && higher !== gt) {
|
|
2213
2303
|
return false;
|
|
2214
|
-
|
|
2304
|
+
}
|
|
2305
|
+
} else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c), options)) {
|
|
2215
2306
|
return false;
|
|
2307
|
+
}
|
|
2216
2308
|
}
|
|
2217
2309
|
if (lt) {
|
|
2218
2310
|
if (needDomLTPre) {
|
|
@@ -2222,31 +2314,39 @@ var require_subset = __commonJS({
|
|
|
2222
2314
|
}
|
|
2223
2315
|
if (c.operator === "<" || c.operator === "<=") {
|
|
2224
2316
|
lower = lowerLT(lt, c, options);
|
|
2225
|
-
if (lower === c && lower !== lt)
|
|
2317
|
+
if (lower === c && lower !== lt) {
|
|
2226
2318
|
return false;
|
|
2227
|
-
|
|
2319
|
+
}
|
|
2320
|
+
} else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c), options)) {
|
|
2228
2321
|
return false;
|
|
2322
|
+
}
|
|
2229
2323
|
}
|
|
2230
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0)
|
|
2324
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2231
2325
|
return false;
|
|
2326
|
+
}
|
|
2232
2327
|
}
|
|
2233
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0)
|
|
2328
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2234
2329
|
return false;
|
|
2235
|
-
|
|
2330
|
+
}
|
|
2331
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2236
2332
|
return false;
|
|
2237
|
-
|
|
2333
|
+
}
|
|
2334
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2238
2335
|
return false;
|
|
2336
|
+
}
|
|
2239
2337
|
return true;
|
|
2240
2338
|
};
|
|
2241
2339
|
var higherGT = (a, b, options) => {
|
|
2242
|
-
if (!a)
|
|
2340
|
+
if (!a) {
|
|
2243
2341
|
return b;
|
|
2342
|
+
}
|
|
2244
2343
|
const comp = compare(a.semver, b.semver, options);
|
|
2245
2344
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2246
2345
|
};
|
|
2247
2346
|
var lowerLT = (a, b, options) => {
|
|
2248
|
-
if (!a)
|
|
2347
|
+
if (!a) {
|
|
2249
2348
|
return b;
|
|
2349
|
+
}
|
|
2250
2350
|
const comp = compare(a.semver, b.semver, options);
|
|
2251
2351
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2252
2352
|
};
|
|
@@ -2319,6 +2419,7 @@ function createConfig(options) {
|
|
|
2319
2419
|
"void-style": ["error", { style: "selfclose" }],
|
|
2320
2420
|
"no-self-closing": "off",
|
|
2321
2421
|
"vue/available-slots": "error",
|
|
2422
|
+
"vue/prefer-slot-shorthand": "error",
|
|
2322
2423
|
"vue/required-slots": "error"
|
|
2323
2424
|
}
|
|
2324
2425
|
};
|
|
@@ -2436,8 +2537,66 @@ var AvailableSlots = class extends import_html_validate2.Rule {
|
|
|
2436
2537
|
}
|
|
2437
2538
|
};
|
|
2438
2539
|
|
|
2439
|
-
// src/rules/
|
|
2540
|
+
// src/rules/prefer-slot-shorthand.ts
|
|
2440
2541
|
var import_html_validate3 = require("html-validate");
|
|
2542
|
+
var prefix = "v-slot:";
|
|
2543
|
+
function isVSlot(attr) {
|
|
2544
|
+
if (!attr.startsWith(prefix)) {
|
|
2545
|
+
return null;
|
|
2546
|
+
}
|
|
2547
|
+
if (attr.length <= prefix.length) {
|
|
2548
|
+
return null;
|
|
2549
|
+
}
|
|
2550
|
+
const slot = attr.slice(prefix.length);
|
|
2551
|
+
if (slot.match(/^\[.*\]$/)) {
|
|
2552
|
+
return null;
|
|
2553
|
+
}
|
|
2554
|
+
return slot;
|
|
2555
|
+
}
|
|
2556
|
+
function isDeprecatedSlot(attr, value) {
|
|
2557
|
+
if (attr !== "slot") {
|
|
2558
|
+
return null;
|
|
2559
|
+
}
|
|
2560
|
+
if (value instanceof import_html_validate3.DynamicValue) {
|
|
2561
|
+
return null;
|
|
2562
|
+
}
|
|
2563
|
+
if (value === null || value === "") {
|
|
2564
|
+
return null;
|
|
2565
|
+
}
|
|
2566
|
+
return value.toString();
|
|
2567
|
+
}
|
|
2568
|
+
var PreferSlotShorthand = class extends import_html_validate3.Rule {
|
|
2569
|
+
documentation(context) {
|
|
2570
|
+
var _a;
|
|
2571
|
+
const slot = (_a = context == null ? void 0 : context.slot) != null ? _a : "my-slot";
|
|
2572
|
+
return {
|
|
2573
|
+
description: [
|
|
2574
|
+
`Prefer to use \`#${slot}\` over \`v-slot:${slot}\`.`,
|
|
2575
|
+
"",
|
|
2576
|
+
"Vue.js supports a shorthand syntax for slots using `#` instead of `v-slot:` or the deprecated `slot` attribute, e.g. using `#header` instead of `v-slot:header`."
|
|
2577
|
+
].join("\n")
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
setup() {
|
|
2581
|
+
this.on("attr", (event) => {
|
|
2582
|
+
const { key: attr, value, target, keyLocation: location } = event;
|
|
2583
|
+
let slot;
|
|
2584
|
+
if (slot = isVSlot(attr)) {
|
|
2585
|
+
const context = { slot };
|
|
2586
|
+
const message = `Prefer to use #${slot} over ${attr}`;
|
|
2587
|
+
this.report(target, message, location, context);
|
|
2588
|
+
}
|
|
2589
|
+
if (slot = isDeprecatedSlot(attr, value)) {
|
|
2590
|
+
const context = { slot };
|
|
2591
|
+
const message = `Prefer to use #${slot} over ${attr}="${value.toString()}"`;
|
|
2592
|
+
this.report(target, message, location, context);
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
};
|
|
2597
|
+
|
|
2598
|
+
// src/rules/required-slots.ts
|
|
2599
|
+
var import_html_validate4 = require("html-validate");
|
|
2441
2600
|
function difference2(a, b) {
|
|
2442
2601
|
const result = new Set(a);
|
|
2443
2602
|
for (const elem of b) {
|
|
@@ -2445,7 +2604,7 @@ function difference2(a, b) {
|
|
|
2445
2604
|
}
|
|
2446
2605
|
return result;
|
|
2447
2606
|
}
|
|
2448
|
-
var RequiredSlots = class extends
|
|
2607
|
+
var RequiredSlots = class extends import_html_validate4.Rule {
|
|
2449
2608
|
documentation(context) {
|
|
2450
2609
|
if (context) {
|
|
2451
2610
|
return {
|
|
@@ -2492,12 +2651,13 @@ var RequiredSlots = class extends import_html_validate3.Rule {
|
|
|
2492
2651
|
// src/rules/index.ts
|
|
2493
2652
|
var rules = {
|
|
2494
2653
|
"vue/available-slots": AvailableSlots,
|
|
2654
|
+
"vue/prefer-slot-shorthand": PreferSlotShorthand,
|
|
2495
2655
|
"vue/required-slots": RequiredSlots
|
|
2496
2656
|
};
|
|
2497
2657
|
var rules_default = rules;
|
|
2498
2658
|
|
|
2499
2659
|
// src/hooks/attribute.ts
|
|
2500
|
-
var
|
|
2660
|
+
var import_html_validate5 = require("html-validate");
|
|
2501
2661
|
function* processAttribute(attr) {
|
|
2502
2662
|
yield attr;
|
|
2503
2663
|
if (!attr.value) {
|
|
@@ -2507,14 +2667,14 @@ function* processAttribute(attr) {
|
|
|
2507
2667
|
if (bind) {
|
|
2508
2668
|
yield Object.assign({}, attr, {
|
|
2509
2669
|
key: bind[1],
|
|
2510
|
-
value: new
|
|
2670
|
+
value: new import_html_validate5.DynamicValue(attr.value),
|
|
2511
2671
|
originalAttribute: attr.key
|
|
2512
2672
|
});
|
|
2513
2673
|
}
|
|
2514
2674
|
}
|
|
2515
2675
|
|
|
2516
2676
|
// src/hooks/element.ts
|
|
2517
|
-
var
|
|
2677
|
+
var import_html_validate6 = require("html-validate");
|
|
2518
2678
|
function isBound(node) {
|
|
2519
2679
|
return node.hasAttribute("v-html");
|
|
2520
2680
|
}
|
|
@@ -2575,7 +2735,7 @@ function processElement(node) {
|
|
|
2575
2735
|
loadComponentMeta(this, node);
|
|
2576
2736
|
}
|
|
2577
2737
|
if (isBound(node) || isSlot(node)) {
|
|
2578
|
-
node.appendText(new
|
|
2738
|
+
node.appendText(new import_html_validate6.DynamicValue(""), node.location);
|
|
2579
2739
|
}
|
|
2580
2740
|
}
|
|
2581
2741
|
|
|
@@ -2591,9 +2751,9 @@ function* transformHTML(source) {
|
|
|
2591
2751
|
transformHTML.api = 1;
|
|
2592
2752
|
|
|
2593
2753
|
// src/transform/js.transform.ts
|
|
2594
|
-
var
|
|
2754
|
+
var import_html_validate7 = require("html-validate");
|
|
2595
2755
|
function transformJS(source) {
|
|
2596
|
-
const te =
|
|
2756
|
+
const te = import_html_validate7.TemplateExtractor.fromString(source.data, source.filename);
|
|
2597
2757
|
return Array.from(te.extractObjectProperty("template"), (cur) => {
|
|
2598
2758
|
cur.originalData = source.originalData || source.data;
|
|
2599
2759
|
cur.hooks = {
|
|
@@ -2697,7 +2857,7 @@ var schema_default = {
|
|
|
2697
2857
|
|
|
2698
2858
|
// src/version-check.ts
|
|
2699
2859
|
var import_semver = __toESM(require_semver2());
|
|
2700
|
-
var
|
|
2860
|
+
var import_html_validate8 = require("html-validate");
|
|
2701
2861
|
var pkg = require("../package.json");
|
|
2702
2862
|
function doVersionCheck(peerDependency, version) {
|
|
2703
2863
|
const printVersion = version || "< 1.16.0";
|
|
@@ -2712,10 +2872,10 @@ function doVersionCheck(peerDependency, version) {
|
|
|
2712
2872
|
}
|
|
2713
2873
|
function versionCheck() {
|
|
2714
2874
|
const range = pkg.peerDependencies["html-validate"];
|
|
2715
|
-
if (
|
|
2716
|
-
(0,
|
|
2875
|
+
if (import_html_validate8.compatibilityCheck) {
|
|
2876
|
+
(0, import_html_validate8.compatibilityCheck)(pkg.name, range);
|
|
2717
2877
|
} else {
|
|
2718
|
-
const version =
|
|
2878
|
+
const version = import_html_validate8.version;
|
|
2719
2879
|
doVersionCheck(range, version);
|
|
2720
2880
|
}
|
|
2721
2881
|
}
|