@vue/compat 3.5.8 → 3.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.8
2
+ * @vue/compat v3.5.9
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -106,6 +106,12 @@ let _globalThis;
106
106
  const getGlobalThis = () => {
107
107
  return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
108
108
  };
109
+ function genCacheKey(source, options) {
110
+ return source + JSON.stringify(
111
+ options,
112
+ (_, val) => typeof val === "function" ? val.toString() : val
113
+ );
114
+ }
109
115
 
110
116
  const PatchFlagNames = {
111
117
  [1]: `TEXT`,
@@ -639,11 +645,14 @@ function endBatch() {
639
645
  let error;
640
646
  while (batchedSub) {
641
647
  let e = batchedSub;
642
- batchedSub = void 0;
648
+ let next;
643
649
  while (e) {
644
- const next = e.next;
645
- e.next = void 0;
646
650
  e.flags &= ~8;
651
+ e = e.next;
652
+ }
653
+ e = batchedSub;
654
+ batchedSub = void 0;
655
+ while (e) {
647
656
  if (e.flags & 1) {
648
657
  try {
649
658
  ;
@@ -652,6 +661,8 @@ function endBatch() {
652
661
  if (!error) error = err;
653
662
  }
654
663
  }
664
+ next = e.next;
665
+ e.next = void 0;
655
666
  e = next;
656
667
  }
657
668
  }
@@ -664,7 +675,7 @@ function prepareDeps(sub) {
664
675
  link.dep.activeLink = link;
665
676
  }
666
677
  }
667
- function cleanupDeps(sub, fromComputed = false) {
678
+ function cleanupDeps(sub) {
668
679
  let head;
669
680
  let tail = sub.depsTail;
670
681
  let link = tail;
@@ -672,7 +683,7 @@ function cleanupDeps(sub, fromComputed = false) {
672
683
  const prev = link.prevDep;
673
684
  if (link.version === -1) {
674
685
  if (link === tail) tail = prev;
675
- removeSub(link, fromComputed);
686
+ removeSub(link);
676
687
  removeDep(link);
677
688
  } else {
678
689
  head = link;
@@ -727,11 +738,11 @@ function refreshComputed(computed) {
727
738
  } finally {
728
739
  activeSub = prevSub;
729
740
  shouldTrack = prevShouldTrack;
730
- cleanupDeps(computed, true);
741
+ cleanupDeps(computed);
731
742
  computed.flags &= ~2;
732
743
  }
733
744
  }
734
- function removeSub(link, fromComputed = false) {
745
+ function removeSub(link, soft = false) {
735
746
  const { dep, prevSub, nextSub } = link;
736
747
  if (prevSub) {
737
748
  prevSub.nextSub = nextSub;
@@ -747,17 +758,15 @@ function removeSub(link, fromComputed = false) {
747
758
  if (dep.subsHead === link) {
748
759
  dep.subsHead = nextSub;
749
760
  }
750
- if (!dep.subs) {
751
- if (dep.computed) {
752
- dep.computed.flags &= ~4;
753
- for (let l = dep.computed.deps; l; l = l.nextDep) {
754
- removeSub(l, true);
755
- }
756
- } else if (dep.map && !fromComputed) {
757
- dep.map.delete(dep.key);
758
- if (!dep.map.size) targetMap.delete(dep.target);
761
+ if (!dep.subs && dep.computed) {
762
+ dep.computed.flags &= ~4;
763
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
764
+ removeSub(l, true);
759
765
  }
760
766
  }
767
+ if (!soft && !--dep.sc && dep.map) {
768
+ dep.map.delete(dep.key);
769
+ }
761
770
  }
762
771
  function removeDep(link) {
763
772
  const { prevDep, nextDep } = link;
@@ -842,6 +851,10 @@ class Dep {
842
851
  this.target = void 0;
843
852
  this.map = void 0;
844
853
  this.key = void 0;
854
+ /**
855
+ * Subscriber counter
856
+ */
857
+ this.sc = 0;
845
858
  {
846
859
  this.subsHead = void 0;
847
860
  }
@@ -860,9 +873,7 @@ class Dep {
860
873
  activeSub.depsTail.nextDep = link;
861
874
  activeSub.depsTail = link;
862
875
  }
863
- if (activeSub.flags & 4) {
864
- addSub(link);
865
- }
876
+ addSub(link);
866
877
  } else if (link.version === -1) {
867
878
  link.version = this.version;
868
879
  if (link.nextDep) {
@@ -926,22 +937,25 @@ class Dep {
926
937
  }
927
938
  }
928
939
  function addSub(link) {
929
- const computed = link.dep.computed;
930
- if (computed && !link.dep.subs) {
931
- computed.flags |= 4 | 16;
932
- for (let l = computed.deps; l; l = l.nextDep) {
933
- addSub(l);
940
+ link.dep.sc++;
941
+ if (link.sub.flags & 4) {
942
+ const computed = link.dep.computed;
943
+ if (computed && !link.dep.subs) {
944
+ computed.flags |= 4 | 16;
945
+ for (let l = computed.deps; l; l = l.nextDep) {
946
+ addSub(l);
947
+ }
934
948
  }
949
+ const currentTail = link.dep.subs;
950
+ if (currentTail !== link) {
951
+ link.prevSub = currentTail;
952
+ if (currentTail) currentTail.nextSub = link;
953
+ }
954
+ if (link.dep.subsHead === void 0) {
955
+ link.dep.subsHead = link;
956
+ }
957
+ link.dep.subs = link;
935
958
  }
936
- const currentTail = link.dep.subs;
937
- if (currentTail !== link) {
938
- link.prevSub = currentTail;
939
- if (currentTail) currentTail.nextSub = link;
940
- }
941
- if (link.dep.subsHead === void 0) {
942
- link.dep.subsHead = link;
943
- }
944
- link.dep.subs = link;
945
959
  }
946
960
  const targetMap = /* @__PURE__ */ new WeakMap();
947
961
  const ITERATE_KEY = Symbol(
@@ -1045,8 +1059,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1045
1059
  endBatch();
1046
1060
  }
1047
1061
  function getDepFromReactive(object, key) {
1048
- var _a;
1049
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
1062
+ const depMap = targetMap.get(object);
1063
+ return depMap && depMap.get(key);
1050
1064
  }
1051
1065
 
1052
1066
  function reactiveReadArray(array) {
@@ -4229,6 +4243,7 @@ function useId() {
4229
4243
  `useId() is called when there is no active component instance to be associated with.`
4230
4244
  );
4231
4245
  }
4246
+ return "";
4232
4247
  }
4233
4248
  function markAsyncBoundary(instance) {
4234
4249
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -7150,7 +7165,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7150
7165
  return vm;
7151
7166
  }
7152
7167
  }
7153
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
7168
+ Vue.version = `2.6.14-compat:${"3.5.9"}`;
7154
7169
  Vue.config = singletonApp.config;
7155
7170
  Vue.use = (plugin, ...options) => {
7156
7171
  if (plugin && isFunction(plugin.install)) {
@@ -11508,7 +11523,7 @@ function normalizeVNode(child) {
11508
11523
  // #3666, avoid reference pollution when reusing vnode
11509
11524
  child.slice()
11510
11525
  );
11511
- } else if (typeof child === "object") {
11526
+ } else if (isVNode(child)) {
11512
11527
  return cloneIfMounted(child);
11513
11528
  } else {
11514
11529
  return createVNode(Text, null, String(child));
@@ -12265,7 +12280,7 @@ function isMemoSame(cached, memo) {
12265
12280
  return true;
12266
12281
  }
12267
12282
 
12268
- const version = "3.5.8";
12283
+ const version = "3.5.9";
12269
12284
  const warn = warn$1 ;
12270
12285
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12271
12286
  const devtools = devtools$1 ;
@@ -13872,7 +13887,7 @@ const vModelCheckbox = {
13872
13887
  setChecked(el, binding, vnode);
13873
13888
  }
13874
13889
  };
13875
- function setChecked(el, { value, oldValue }, vnode) {
13890
+ function setChecked(el, { value }, vnode) {
13876
13891
  el._modelValue = value;
13877
13892
  let checked;
13878
13893
  if (isArray(value)) {
@@ -13922,19 +13937,19 @@ const vModelSelect = {
13922
13937
  },
13923
13938
  // set value in mounted & updated because <select> relies on its children
13924
13939
  // <option>s.
13925
- mounted(el, { value, modifiers: { number } }) {
13940
+ mounted(el, { value }) {
13926
13941
  setSelected(el, value);
13927
13942
  },
13928
13943
  beforeUpdate(el, _binding, vnode) {
13929
13944
  el[assignKey] = getModelAssigner(vnode);
13930
13945
  },
13931
- updated(el, { value, modifiers: { number } }) {
13946
+ updated(el, { value }) {
13932
13947
  if (!el._assigning) {
13933
13948
  setSelected(el, value);
13934
13949
  }
13935
13950
  }
13936
13951
  };
13937
- function setSelected(el, value, number) {
13952
+ function setSelected(el, value) {
13938
13953
  const isMultiple = el.multiple;
13939
13954
  const isArrayValue = isArray(value);
13940
13955
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -20411,7 +20426,7 @@ function compileToFunction(template, options) {
20411
20426
  return NOOP;
20412
20427
  }
20413
20428
  }
20414
- const key = template;
20429
+ const key = genCacheKey(template, options);
20415
20430
  const cached = compileCache[key];
20416
20431
  if (cached) {
20417
20432
  return cached;