@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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -117,6 +117,12 @@ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
117
117
  function genPropsAccessExp(name) {
118
118
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
119
119
  }
120
+ function genCacheKey(source, options) {
121
+ return source + JSON.stringify(
122
+ options,
123
+ (_, val) => typeof val === "function" ? val.toString() : val
124
+ );
125
+ }
120
126
 
121
127
  const PatchFlagNames = {
122
128
  [1]: `TEXT`,
@@ -692,11 +698,14 @@ function endBatch() {
692
698
  let error;
693
699
  while (batchedSub) {
694
700
  let e = batchedSub;
695
- batchedSub = void 0;
701
+ let next;
696
702
  while (e) {
697
- const next = e.next;
698
- e.next = void 0;
699
703
  e.flags &= ~8;
704
+ e = e.next;
705
+ }
706
+ e = batchedSub;
707
+ batchedSub = void 0;
708
+ while (e) {
700
709
  if (e.flags & 1) {
701
710
  try {
702
711
  ;
@@ -705,6 +714,8 @@ function endBatch() {
705
714
  if (!error) error = err;
706
715
  }
707
716
  }
717
+ next = e.next;
718
+ e.next = void 0;
708
719
  e = next;
709
720
  }
710
721
  }
@@ -717,7 +728,7 @@ function prepareDeps(sub) {
717
728
  link.dep.activeLink = link;
718
729
  }
719
730
  }
720
- function cleanupDeps(sub, fromComputed = false) {
731
+ function cleanupDeps(sub) {
721
732
  let head;
722
733
  let tail = sub.depsTail;
723
734
  let link = tail;
@@ -725,7 +736,7 @@ function cleanupDeps(sub, fromComputed = false) {
725
736
  const prev = link.prevDep;
726
737
  if (link.version === -1) {
727
738
  if (link === tail) tail = prev;
728
- removeSub(link, fromComputed);
739
+ removeSub(link);
729
740
  removeDep(link);
730
741
  } else {
731
742
  head = link;
@@ -780,11 +791,11 @@ function refreshComputed(computed) {
780
791
  } finally {
781
792
  activeSub = prevSub;
782
793
  shouldTrack = prevShouldTrack;
783
- cleanupDeps(computed, true);
794
+ cleanupDeps(computed);
784
795
  computed.flags &= ~2;
785
796
  }
786
797
  }
787
- function removeSub(link, fromComputed = false) {
798
+ function removeSub(link, soft = false) {
788
799
  const { dep, prevSub, nextSub } = link;
789
800
  if (prevSub) {
790
801
  prevSub.nextSub = nextSub;
@@ -800,17 +811,15 @@ function removeSub(link, fromComputed = false) {
800
811
  if (dep.subsHead === link) {
801
812
  dep.subsHead = nextSub;
802
813
  }
803
- if (!dep.subs) {
804
- if (dep.computed) {
805
- dep.computed.flags &= ~4;
806
- for (let l = dep.computed.deps; l; l = l.nextDep) {
807
- removeSub(l, true);
808
- }
809
- } else if (dep.map && !fromComputed) {
810
- dep.map.delete(dep.key);
811
- if (!dep.map.size) targetMap.delete(dep.target);
814
+ if (!dep.subs && dep.computed) {
815
+ dep.computed.flags &= ~4;
816
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
817
+ removeSub(l, true);
812
818
  }
813
819
  }
820
+ if (!soft && !--dep.sc && dep.map) {
821
+ dep.map.delete(dep.key);
822
+ }
814
823
  }
815
824
  function removeDep(link) {
816
825
  const { prevDep, nextDep } = link;
@@ -895,6 +904,10 @@ class Dep {
895
904
  this.target = void 0;
896
905
  this.map = void 0;
897
906
  this.key = void 0;
907
+ /**
908
+ * Subscriber counter
909
+ */
910
+ this.sc = 0;
898
911
  {
899
912
  this.subsHead = void 0;
900
913
  }
@@ -913,9 +926,7 @@ class Dep {
913
926
  activeSub.depsTail.nextDep = link;
914
927
  activeSub.depsTail = link;
915
928
  }
916
- if (activeSub.flags & 4) {
917
- addSub(link);
918
- }
929
+ addSub(link);
919
930
  } else if (link.version === -1) {
920
931
  link.version = this.version;
921
932
  if (link.nextDep) {
@@ -979,22 +990,25 @@ class Dep {
979
990
  }
980
991
  }
981
992
  function addSub(link) {
982
- const computed = link.dep.computed;
983
- if (computed && !link.dep.subs) {
984
- computed.flags |= 4 | 16;
985
- for (let l = computed.deps; l; l = l.nextDep) {
986
- addSub(l);
993
+ link.dep.sc++;
994
+ if (link.sub.flags & 4) {
995
+ const computed = link.dep.computed;
996
+ if (computed && !link.dep.subs) {
997
+ computed.flags |= 4 | 16;
998
+ for (let l = computed.deps; l; l = l.nextDep) {
999
+ addSub(l);
1000
+ }
987
1001
  }
1002
+ const currentTail = link.dep.subs;
1003
+ if (currentTail !== link) {
1004
+ link.prevSub = currentTail;
1005
+ if (currentTail) currentTail.nextSub = link;
1006
+ }
1007
+ if (link.dep.subsHead === void 0) {
1008
+ link.dep.subsHead = link;
1009
+ }
1010
+ link.dep.subs = link;
988
1011
  }
989
- const currentTail = link.dep.subs;
990
- if (currentTail !== link) {
991
- link.prevSub = currentTail;
992
- if (currentTail) currentTail.nextSub = link;
993
- }
994
- if (link.dep.subsHead === void 0) {
995
- link.dep.subsHead = link;
996
- }
997
- link.dep.subs = link;
998
1012
  }
999
1013
  const targetMap = /* @__PURE__ */ new WeakMap();
1000
1014
  const ITERATE_KEY = Symbol(
@@ -1098,8 +1112,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1098
1112
  endBatch();
1099
1113
  }
1100
1114
  function getDepFromReactive(object, key) {
1101
- var _a;
1102
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
1115
+ const depMap = targetMap.get(object);
1116
+ return depMap && depMap.get(key);
1103
1117
  }
1104
1118
 
1105
1119
  function reactiveReadArray(array) {
@@ -4282,6 +4296,7 @@ function useId() {
4282
4296
  `useId() is called when there is no active component instance to be associated with.`
4283
4297
  );
4284
4298
  }
4299
+ return "";
4285
4300
  }
4286
4301
  function markAsyncBoundary(instance) {
4287
4302
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -7203,7 +7218,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7203
7218
  return vm;
7204
7219
  }
7205
7220
  }
7206
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
7221
+ Vue.version = `2.6.14-compat:${"3.5.9"}`;
7207
7222
  Vue.config = singletonApp.config;
7208
7223
  Vue.use = (plugin, ...options) => {
7209
7224
  if (plugin && isFunction(plugin.install)) {
@@ -11561,7 +11576,7 @@ function normalizeVNode(child) {
11561
11576
  // #3666, avoid reference pollution when reusing vnode
11562
11577
  child.slice()
11563
11578
  );
11564
- } else if (typeof child === "object") {
11579
+ } else if (isVNode(child)) {
11565
11580
  return cloneIfMounted(child);
11566
11581
  } else {
11567
11582
  return createVNode(Text, null, String(child));
@@ -12318,7 +12333,7 @@ function isMemoSame(cached, memo) {
12318
12333
  return true;
12319
12334
  }
12320
12335
 
12321
- const version = "3.5.8";
12336
+ const version = "3.5.9";
12322
12337
  const warn = warn$1 ;
12323
12338
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12324
12339
  const devtools = devtools$1 ;
@@ -13859,7 +13874,7 @@ const vModelCheckbox = {
13859
13874
  setChecked(el, binding, vnode);
13860
13875
  }
13861
13876
  };
13862
- function setChecked(el, { value, oldValue }, vnode) {
13877
+ function setChecked(el, { value }, vnode) {
13863
13878
  el._modelValue = value;
13864
13879
  let checked;
13865
13880
  if (isArray(value)) {
@@ -13909,19 +13924,19 @@ const vModelSelect = {
13909
13924
  },
13910
13925
  // set value in mounted & updated because <select> relies on its children
13911
13926
  // <option>s.
13912
- mounted(el, { value, modifiers: { number } }) {
13927
+ mounted(el, { value }) {
13913
13928
  setSelected(el, value);
13914
13929
  },
13915
13930
  beforeUpdate(el, _binding, vnode) {
13916
13931
  el[assignKey] = getModelAssigner(vnode);
13917
13932
  },
13918
- updated(el, { value, modifiers: { number } }) {
13933
+ updated(el, { value }) {
13919
13934
  if (!el._assigning) {
13920
13935
  setSelected(el, value);
13921
13936
  }
13922
13937
  }
13923
13938
  };
13924
- function setSelected(el, value, number) {
13939
+ function setSelected(el, value) {
13925
13940
  const isMultiple = el.multiple;
13926
13941
  const isArrayValue = isArray(value);
13927
13942
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -21635,7 +21650,7 @@ function compileToFunction(template, options) {
21635
21650
  return NOOP;
21636
21651
  }
21637
21652
  }
21638
- const key = template;
21653
+ const key = genCacheKey(template, options);
21639
21654
  const cached = compileCache[key];
21640
21655
  if (cached) {
21641
21656
  return cached;
@@ -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
  **/
@@ -117,6 +117,12 @@ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
117
117
  function genPropsAccessExp(name) {
118
118
  return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
119
119
  }
120
+ function genCacheKey(source, options) {
121
+ return source + JSON.stringify(
122
+ options,
123
+ (_, val) => typeof val === "function" ? val.toString() : val
124
+ );
125
+ }
120
126
 
121
127
  const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
122
128
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
@@ -598,11 +604,14 @@ function endBatch() {
598
604
  let error;
599
605
  while (batchedSub) {
600
606
  let e = batchedSub;
601
- batchedSub = void 0;
607
+ let next;
602
608
  while (e) {
603
- const next = e.next;
604
- e.next = void 0;
605
609
  e.flags &= ~8;
610
+ e = e.next;
611
+ }
612
+ e = batchedSub;
613
+ batchedSub = void 0;
614
+ while (e) {
606
615
  if (e.flags & 1) {
607
616
  try {
608
617
  ;
@@ -611,6 +620,8 @@ function endBatch() {
611
620
  if (!error) error = err;
612
621
  }
613
622
  }
623
+ next = e.next;
624
+ e.next = void 0;
614
625
  e = next;
615
626
  }
616
627
  }
@@ -623,7 +634,7 @@ function prepareDeps(sub) {
623
634
  link.dep.activeLink = link;
624
635
  }
625
636
  }
626
- function cleanupDeps(sub, fromComputed = false) {
637
+ function cleanupDeps(sub) {
627
638
  let head;
628
639
  let tail = sub.depsTail;
629
640
  let link = tail;
@@ -631,7 +642,7 @@ function cleanupDeps(sub, fromComputed = false) {
631
642
  const prev = link.prevDep;
632
643
  if (link.version === -1) {
633
644
  if (link === tail) tail = prev;
634
- removeSub(link, fromComputed);
645
+ removeSub(link);
635
646
  removeDep(link);
636
647
  } else {
637
648
  head = link;
@@ -686,11 +697,11 @@ function refreshComputed(computed) {
686
697
  } finally {
687
698
  activeSub = prevSub;
688
699
  shouldTrack = prevShouldTrack;
689
- cleanupDeps(computed, true);
700
+ cleanupDeps(computed);
690
701
  computed.flags &= ~2;
691
702
  }
692
703
  }
693
- function removeSub(link, fromComputed = false) {
704
+ function removeSub(link, soft = false) {
694
705
  const { dep, prevSub, nextSub } = link;
695
706
  if (prevSub) {
696
707
  prevSub.nextSub = nextSub;
@@ -703,17 +714,15 @@ function removeSub(link, fromComputed = false) {
703
714
  if (dep.subs === link) {
704
715
  dep.subs = prevSub;
705
716
  }
706
- if (!dep.subs) {
707
- if (dep.computed) {
708
- dep.computed.flags &= ~4;
709
- for (let l = dep.computed.deps; l; l = l.nextDep) {
710
- removeSub(l, true);
711
- }
712
- } else if (dep.map && !fromComputed) {
713
- dep.map.delete(dep.key);
714
- if (!dep.map.size) targetMap.delete(dep.target);
717
+ if (!dep.subs && dep.computed) {
718
+ dep.computed.flags &= ~4;
719
+ for (let l = dep.computed.deps; l; l = l.nextDep) {
720
+ removeSub(l, true);
715
721
  }
716
722
  }
723
+ if (!soft && !--dep.sc && dep.map) {
724
+ dep.map.delete(dep.key);
725
+ }
717
726
  }
718
727
  function removeDep(link) {
719
728
  const { prevDep, nextDep } = link;
@@ -798,6 +807,10 @@ class Dep {
798
807
  this.target = void 0;
799
808
  this.map = void 0;
800
809
  this.key = void 0;
810
+ /**
811
+ * Subscriber counter
812
+ */
813
+ this.sc = 0;
801
814
  }
802
815
  track(debugInfo) {
803
816
  if (!activeSub || !shouldTrack || activeSub === this.computed) {
@@ -813,9 +826,7 @@ class Dep {
813
826
  activeSub.depsTail.nextDep = link;
814
827
  activeSub.depsTail = link;
815
828
  }
816
- if (activeSub.flags & 4) {
817
- addSub(link);
818
- }
829
+ addSub(link);
819
830
  } else if (link.version === -1) {
820
831
  link.version = this.version;
821
832
  if (link.nextDep) {
@@ -856,19 +867,22 @@ class Dep {
856
867
  }
857
868
  }
858
869
  function addSub(link) {
859
- const computed = link.dep.computed;
860
- if (computed && !link.dep.subs) {
861
- computed.flags |= 4 | 16;
862
- for (let l = computed.deps; l; l = l.nextDep) {
863
- addSub(l);
870
+ link.dep.sc++;
871
+ if (link.sub.flags & 4) {
872
+ const computed = link.dep.computed;
873
+ if (computed && !link.dep.subs) {
874
+ computed.flags |= 4 | 16;
875
+ for (let l = computed.deps; l; l = l.nextDep) {
876
+ addSub(l);
877
+ }
864
878
  }
879
+ const currentTail = link.dep.subs;
880
+ if (currentTail !== link) {
881
+ link.prevSub = currentTail;
882
+ if (currentTail) currentTail.nextSub = link;
883
+ }
884
+ link.dep.subs = link;
865
885
  }
866
- const currentTail = link.dep.subs;
867
- if (currentTail !== link) {
868
- link.prevSub = currentTail;
869
- if (currentTail) currentTail.nextSub = link;
870
- }
871
- link.dep.subs = link;
872
886
  }
873
887
  const targetMap = /* @__PURE__ */ new WeakMap();
874
888
  const ITERATE_KEY = Symbol(
@@ -961,8 +975,8 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
961
975
  endBatch();
962
976
  }
963
977
  function getDepFromReactive(object, key) {
964
- var _a;
965
- return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
978
+ const depMap = targetMap.get(object);
979
+ return depMap && depMap.get(key);
966
980
  }
967
981
 
968
982
  function reactiveReadArray(array) {
@@ -3359,6 +3373,7 @@ function useId() {
3359
3373
  if (i) {
3360
3374
  return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
3361
3375
  }
3376
+ return "";
3362
3377
  }
3363
3378
  function markAsyncBoundary(instance) {
3364
3379
  instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0];
@@ -5792,7 +5807,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5792
5807
  return vm;
5793
5808
  }
5794
5809
  }
5795
- Vue.version = `2.6.14-compat:${"3.5.8"}`;
5810
+ Vue.version = `2.6.14-compat:${"3.5.9"}`;
5796
5811
  Vue.config = singletonApp.config;
5797
5812
  Vue.use = (plugin, ...options) => {
5798
5813
  if (plugin && isFunction(plugin.install)) {
@@ -9476,7 +9491,7 @@ function normalizeVNode(child) {
9476
9491
  // #3666, avoid reference pollution when reusing vnode
9477
9492
  child.slice()
9478
9493
  );
9479
- } else if (typeof child === "object") {
9494
+ } else if (isVNode(child)) {
9480
9495
  return cloneIfMounted(child);
9481
9496
  } else {
9482
9497
  return createVNode(Text, null, String(child));
@@ -9913,7 +9928,7 @@ function isMemoSame(cached, memo) {
9913
9928
  return true;
9914
9929
  }
9915
9930
 
9916
- const version = "3.5.8";
9931
+ const version = "3.5.9";
9917
9932
  const warn$1 = NOOP;
9918
9933
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9919
9934
  const devtools = void 0;
@@ -11354,7 +11369,7 @@ const vModelCheckbox = {
11354
11369
  setChecked(el, binding, vnode);
11355
11370
  }
11356
11371
  };
11357
- function setChecked(el, { value, oldValue }, vnode) {
11372
+ function setChecked(el, { value }, vnode) {
11358
11373
  el._modelValue = value;
11359
11374
  let checked;
11360
11375
  if (isArray(value)) {
@@ -11404,19 +11419,19 @@ const vModelSelect = {
11404
11419
  },
11405
11420
  // set value in mounted & updated because <select> relies on its children
11406
11421
  // <option>s.
11407
- mounted(el, { value, modifiers: { number } }) {
11422
+ mounted(el, { value }) {
11408
11423
  setSelected(el, value);
11409
11424
  },
11410
11425
  beforeUpdate(el, _binding, vnode) {
11411
11426
  el[assignKey] = getModelAssigner(vnode);
11412
11427
  },
11413
- updated(el, { value, modifiers: { number } }) {
11428
+ updated(el, { value }) {
11414
11429
  if (!el._assigning) {
11415
11430
  setSelected(el, value);
11416
11431
  }
11417
11432
  }
11418
11433
  };
11419
- function setSelected(el, value, number) {
11434
+ function setSelected(el, value) {
11420
11435
  const isMultiple = el.multiple;
11421
11436
  const isArrayValue = isArray(value);
11422
11437
  if (isMultiple && !isArrayValue && !isSet(value)) {
@@ -18637,7 +18652,7 @@ function compileToFunction(template, options) {
18637
18652
  return NOOP;
18638
18653
  }
18639
18654
  }
18640
- const key = template;
18655
+ const key = genCacheKey(template, options);
18641
18656
  const cached = compileCache[key];
18642
18657
  if (cached) {
18643
18658
  return cached;