@vue/compat 3.5.3 → 3.5.4

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.3
2
+ * @vue/compat v3.5.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -12,9 +12,10 @@ var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
14
14
  // @__NO_SIDE_EFFECTS__
15
- function makeMap(str, expectsLowerCase) {
16
- const set = new Set(str.split(","));
17
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
15
+ function makeMap(str) {
16
+ const map = /* @__PURE__ */ Object.create(null);
17
+ for (const key of str.split(",")) map[key] = 1;
18
+ return (val) => val in map;
18
19
  }
19
20
 
20
21
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -728,7 +729,7 @@ function cleanupDeps(sub) {
728
729
  }
729
730
  function isDirty(sub) {
730
731
  for (let link = sub.deps; link; link = link.nextDep) {
731
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
732
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
732
733
  return true;
733
734
  }
734
735
  }
@@ -738,9 +739,6 @@ function isDirty(sub) {
738
739
  return false;
739
740
  }
740
741
  function refreshComputed(computed) {
741
- if (computed.flags & 2) {
742
- return false;
743
- }
744
742
  if (computed.flags & 4 && !(computed.flags & 16)) {
745
743
  return;
746
744
  }
@@ -1007,9 +1005,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1007
1005
  globalVersion++;
1008
1006
  return;
1009
1007
  }
1010
- let deps = [];
1008
+ const run = (dep) => {
1009
+ if (dep) {
1010
+ {
1011
+ dep.trigger({
1012
+ target,
1013
+ type,
1014
+ key,
1015
+ newValue,
1016
+ oldValue,
1017
+ oldTarget
1018
+ });
1019
+ }
1020
+ }
1021
+ };
1022
+ startBatch();
1011
1023
  if (type === "clear") {
1012
- deps = [...depsMap.values()];
1024
+ depsMap.forEach(run);
1013
1025
  } else {
1014
1026
  const targetIsArray = isArray(target);
1015
1027
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -1017,57 +1029,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
1017
1029
  const newLength = Number(newValue);
1018
1030
  depsMap.forEach((dep, key2) => {
1019
1031
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
1020
- deps.push(dep);
1032
+ run(dep);
1021
1033
  }
1022
1034
  });
1023
1035
  } else {
1024
- const push = (dep) => dep && deps.push(dep);
1025
1036
  if (key !== void 0) {
1026
- push(depsMap.get(key));
1037
+ run(depsMap.get(key));
1027
1038
  }
1028
1039
  if (isArrayIndex) {
1029
- push(depsMap.get(ARRAY_ITERATE_KEY));
1040
+ run(depsMap.get(ARRAY_ITERATE_KEY));
1030
1041
  }
1031
1042
  switch (type) {
1032
1043
  case "add":
1033
1044
  if (!targetIsArray) {
1034
- push(depsMap.get(ITERATE_KEY));
1045
+ run(depsMap.get(ITERATE_KEY));
1035
1046
  if (isMap(target)) {
1036
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1047
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
1037
1048
  }
1038
1049
  } else if (isArrayIndex) {
1039
- push(depsMap.get("length"));
1050
+ run(depsMap.get("length"));
1040
1051
  }
1041
1052
  break;
1042
1053
  case "delete":
1043
1054
  if (!targetIsArray) {
1044
- push(depsMap.get(ITERATE_KEY));
1055
+ run(depsMap.get(ITERATE_KEY));
1045
1056
  if (isMap(target)) {
1046
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1057
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
1047
1058
  }
1048
1059
  }
1049
1060
  break;
1050
1061
  case "set":
1051
1062
  if (isMap(target)) {
1052
- push(depsMap.get(ITERATE_KEY));
1063
+ run(depsMap.get(ITERATE_KEY));
1053
1064
  }
1054
1065
  break;
1055
1066
  }
1056
1067
  }
1057
1068
  }
1058
- startBatch();
1059
- for (const dep of deps) {
1060
- {
1061
- dep.trigger({
1062
- target,
1063
- type,
1064
- key,
1065
- newValue,
1066
- oldValue,
1067
- oldTarget
1068
- });
1069
- }
1070
- }
1071
1069
  endBatch();
1072
1070
  }
1073
1071
  function getDepFromReactive(object, key) {
@@ -1805,7 +1803,7 @@ function toRaw(observed) {
1805
1803
  return raw ? toRaw(raw) : observed;
1806
1804
  }
1807
1805
  function markRaw(value) {
1808
- if (Object.isExtensible(value)) {
1806
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1809
1807
  def(value, "__v_skip", true);
1810
1808
  }
1811
1809
  return value;
@@ -2015,8 +2013,8 @@ class ComputedRefImpl {
2015
2013
  * @internal
2016
2014
  */
2017
2015
  notify() {
2016
+ this.flags |= 16;
2018
2017
  if (activeSub !== this) {
2019
- this.flags |= 16;
2020
2018
  this.dep.notify();
2021
2019
  }
2022
2020
  }
@@ -2704,23 +2702,19 @@ function flushJobs(seen) {
2704
2702
  }
2705
2703
  }
2706
2704
  function checkRecursiveUpdates(seen, fn) {
2707
- if (!seen.has(fn)) {
2708
- seen.set(fn, 1);
2709
- } else {
2710
- const count = seen.get(fn);
2711
- if (count > RECURSION_LIMIT) {
2712
- const instance = fn.i;
2713
- const componentName = instance && getComponentName(instance.type);
2714
- handleError(
2715
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2716
- null,
2717
- 10
2718
- );
2719
- return true;
2720
- } else {
2721
- seen.set(fn, count + 1);
2722
- }
2705
+ const count = seen.get(fn) || 0;
2706
+ if (count > RECURSION_LIMIT) {
2707
+ const instance = fn.i;
2708
+ const componentName = instance && getComponentName(instance.type);
2709
+ handleError(
2710
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2711
+ null,
2712
+ 10
2713
+ );
2714
+ return true;
2723
2715
  }
2716
+ seen.set(fn, count + 1);
2717
+ return false;
2724
2718
  }
2725
2719
 
2726
2720
  let isHmrUpdating = false;
@@ -5896,13 +5890,15 @@ function renderList(source, renderItem, cache, index) {
5896
5890
  const sourceIsArray = isArray(source);
5897
5891
  if (sourceIsArray || isString(source)) {
5898
5892
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5893
+ let needsWrap = false;
5899
5894
  if (sourceIsReactiveArray) {
5895
+ needsWrap = !isShallow(source);
5900
5896
  source = shallowReadArray(source);
5901
5897
  }
5902
5898
  ret = new Array(source.length);
5903
5899
  for (let i = 0, l = source.length; i < l; i++) {
5904
5900
  ret[i] = renderItem(
5905
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5901
+ needsWrap ? toReactive(source[i]) : source[i],
5906
5902
  i,
5907
5903
  void 0,
5908
5904
  cached && cached[i]
@@ -7153,7 +7149,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7153
7149
  return vm;
7154
7150
  }
7155
7151
  }
7156
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
7152
+ Vue.version = `2.6.14-compat:${"3.5.4"}`;
7157
7153
  Vue.config = singletonApp.config;
7158
7154
  Vue.use = (plugin, ...options) => {
7159
7155
  if (plugin && isFunction(plugin.install)) {
@@ -12266,7 +12262,7 @@ function isMemoSame(cached, memo) {
12266
12262
  return true;
12267
12263
  }
12268
12264
 
12269
- const version = "3.5.3";
12265
+ const version = "3.5.4";
12270
12266
  const warn = warn$1 ;
12271
12267
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12272
12268
  const devtools = devtools$1 ;
@@ -17558,10 +17554,8 @@ function createRootCodegen(root, context) {
17558
17554
  }
17559
17555
  } else if (children.length > 1) {
17560
17556
  let patchFlag = 64;
17561
- let patchFlagText = PatchFlagNames[64];
17562
17557
  if (children.filter((c) => c.type !== 3).length === 1) {
17563
17558
  patchFlag |= 2048;
17564
- patchFlagText += `, ${PatchFlagNames[2048]}`;
17565
17559
  }
17566
17560
  root.codegenNode = createVNodeCall(
17567
17561
  context,
@@ -18823,10 +18817,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
18823
18817
  return vnodeCall;
18824
18818
  } else {
18825
18819
  let patchFlag = 64;
18826
- let patchFlagText = PatchFlagNames[64];
18827
18820
  if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
18828
18821
  patchFlag |= 2048;
18829
- patchFlagText += `, ${PatchFlagNames[2048]}`;
18830
18822
  }
18831
18823
  return createVNodeCall(
18832
18824
  context,
@@ -20977,10 +20969,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
20977
20969
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
20978
20970
  );
20979
20971
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
20980
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
20981
- `onkeyup,onkeydown,onkeypress`,
20982
- true
20983
- );
20972
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
20984
20973
  const resolveModifiers = (key, modifiers, context, loc) => {
20985
20974
  const keyModifiers = [];
20986
20975
  const nonKeyModifiers = [];
@@ -20998,7 +20987,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20998
20987
  } else {
20999
20988
  if (maybeKeyModifier(modifier)) {
21000
20989
  if (isStaticExp(key)) {
21001
- if (isKeyboardEvent(key.content)) {
20990
+ if (isKeyboardEvent(key.content.toLowerCase())) {
21002
20991
  keyModifiers.push(modifier);
21003
20992
  } else {
21004
20993
  nonKeyModifiers.push(modifier);
@@ -21051,7 +21040,7 @@ const transformOn = (dir, node, context) => {
21051
21040
  ]);
21052
21041
  }
21053
21042
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
21054
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
21043
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
21055
21044
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
21056
21045
  handlerExp,
21057
21046
  JSON.stringify(keyModifiers)
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.3
2
+ * @vue/compat v3.5.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -12,9 +12,10 @@ var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
14
14
  // @__NO_SIDE_EFFECTS__
15
- function makeMap(str, expectsLowerCase) {
16
- const set = new Set(str.split(","));
17
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
15
+ function makeMap(str) {
16
+ const map = /* @__PURE__ */ Object.create(null);
17
+ for (const key of str.split(",")) map[key] = 1;
18
+ return (val) => val in map;
18
19
  }
19
20
 
20
21
  const EMPTY_OBJ = {};
@@ -634,7 +635,7 @@ function cleanupDeps(sub) {
634
635
  }
635
636
  function isDirty(sub) {
636
637
  for (let link = sub.deps; link; link = link.nextDep) {
637
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
638
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
638
639
  return true;
639
640
  }
640
641
  }
@@ -644,9 +645,6 @@ function isDirty(sub) {
644
645
  return false;
645
646
  }
646
647
  function refreshComputed(computed) {
647
- if (computed.flags & 2) {
648
- return false;
649
- }
650
648
  if (computed.flags & 4 && !(computed.flags & 16)) {
651
649
  return;
652
650
  }
@@ -880,9 +878,16 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
880
878
  globalVersion++;
881
879
  return;
882
880
  }
883
- let deps = [];
881
+ const run = (dep) => {
882
+ if (dep) {
883
+ {
884
+ dep.trigger();
885
+ }
886
+ }
887
+ };
888
+ startBatch();
884
889
  if (type === "clear") {
885
- deps = [...depsMap.values()];
890
+ depsMap.forEach(run);
886
891
  } else {
887
892
  const targetIsArray = isArray(target);
888
893
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -890,50 +895,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
890
895
  const newLength = Number(newValue);
891
896
  depsMap.forEach((dep, key2) => {
892
897
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
893
- deps.push(dep);
898
+ run(dep);
894
899
  }
895
900
  });
896
901
  } else {
897
- const push = (dep) => dep && deps.push(dep);
898
902
  if (key !== void 0) {
899
- push(depsMap.get(key));
903
+ run(depsMap.get(key));
900
904
  }
901
905
  if (isArrayIndex) {
902
- push(depsMap.get(ARRAY_ITERATE_KEY));
906
+ run(depsMap.get(ARRAY_ITERATE_KEY));
903
907
  }
904
908
  switch (type) {
905
909
  case "add":
906
910
  if (!targetIsArray) {
907
- push(depsMap.get(ITERATE_KEY));
911
+ run(depsMap.get(ITERATE_KEY));
908
912
  if (isMap(target)) {
909
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
913
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
910
914
  }
911
915
  } else if (isArrayIndex) {
912
- push(depsMap.get("length"));
916
+ run(depsMap.get("length"));
913
917
  }
914
918
  break;
915
919
  case "delete":
916
920
  if (!targetIsArray) {
917
- push(depsMap.get(ITERATE_KEY));
921
+ run(depsMap.get(ITERATE_KEY));
918
922
  if (isMap(target)) {
919
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
923
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
920
924
  }
921
925
  }
922
926
  break;
923
927
  case "set":
924
928
  if (isMap(target)) {
925
- push(depsMap.get(ITERATE_KEY));
929
+ run(depsMap.get(ITERATE_KEY));
926
930
  }
927
931
  break;
928
932
  }
929
933
  }
930
934
  }
931
- startBatch();
932
- for (const dep of deps) {
933
- {
934
- dep.trigger();
935
- }
936
- }
937
935
  endBatch();
938
936
  }
939
937
  function getDepFromReactive(object, key) {
@@ -1631,7 +1629,7 @@ function toRaw(observed) {
1631
1629
  return raw ? toRaw(raw) : observed;
1632
1630
  }
1633
1631
  function markRaw(value) {
1634
- if (Object.isExtensible(value)) {
1632
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1635
1633
  def(value, "__v_skip", true);
1636
1634
  }
1637
1635
  return value;
@@ -1823,8 +1821,8 @@ class ComputedRefImpl {
1823
1821
  * @internal
1824
1822
  */
1825
1823
  notify() {
1824
+ this.flags |= 16;
1826
1825
  if (activeSub !== this) {
1827
- this.flags |= 16;
1828
1826
  this.dep.notify();
1829
1827
  }
1830
1828
  }
@@ -4748,13 +4746,15 @@ function renderList(source, renderItem, cache, index) {
4748
4746
  const sourceIsArray = isArray(source);
4749
4747
  if (sourceIsArray || isString(source)) {
4750
4748
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
4749
+ let needsWrap = false;
4751
4750
  if (sourceIsReactiveArray) {
4751
+ needsWrap = !isShallow(source);
4752
4752
  source = shallowReadArray(source);
4753
4753
  }
4754
4754
  ret = new Array(source.length);
4755
4755
  for (let i = 0, l = source.length; i < l; i++) {
4756
4756
  ret[i] = renderItem(
4757
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
4757
+ needsWrap ? toReactive(source[i]) : source[i],
4758
4758
  i,
4759
4759
  void 0,
4760
4760
  cached && cached[i]
@@ -5743,7 +5743,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5743
5743
  return vm;
5744
5744
  }
5745
5745
  }
5746
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
5746
+ Vue.version = `2.6.14-compat:${"3.5.4"}`;
5747
5747
  Vue.config = singletonApp.config;
5748
5748
  Vue.use = (plugin, ...options) => {
5749
5749
  if (plugin && isFunction(plugin.install)) {
@@ -9863,7 +9863,7 @@ function isMemoSame(cached, memo) {
9863
9863
  return true;
9864
9864
  }
9865
9865
 
9866
- const version = "3.5.3";
9866
+ const version = "3.5.4";
9867
9867
  const warn$1 = NOOP;
9868
9868
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9869
9869
  const devtools = void 0;
@@ -18204,10 +18204,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
18204
18204
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
18205
18205
  );
18206
18206
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
18207
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
18208
- `onkeyup,onkeydown,onkeypress`,
18209
- true
18210
- );
18207
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
18211
18208
  const resolveModifiers = (key, modifiers, context, loc) => {
18212
18209
  const keyModifiers = [];
18213
18210
  const nonKeyModifiers = [];
@@ -18223,7 +18220,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
18223
18220
  } else {
18224
18221
  if (maybeKeyModifier(modifier)) {
18225
18222
  if (isStaticExp(key)) {
18226
- if (isKeyboardEvent(key.content)) {
18223
+ if (isKeyboardEvent(key.content.toLowerCase())) {
18227
18224
  keyModifiers.push(modifier);
18228
18225
  } else {
18229
18226
  nonKeyModifiers.push(modifier);
@@ -18276,7 +18273,7 @@ const transformOn = (dir, node, context) => {
18276
18273
  ]);
18277
18274
  }
18278
18275
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
18279
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
18276
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
18280
18277
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
18281
18278
  handlerExp,
18282
18279
  JSON.stringify(keyModifiers)