@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.
@@ -1,13 +1,14 @@
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
  **/
6
6
  /*! #__NO_SIDE_EFFECTS__ */
7
7
  // @__NO_SIDE_EFFECTS__
8
- function makeMap(str, expectsLowerCase) {
9
- const set = new Set(str.split(","));
10
- return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
8
+ function makeMap(str) {
9
+ const map = /* @__PURE__ */ Object.create(null);
10
+ for (const key of str.split(",")) map[key] = 1;
11
+ return (val) => val in map;
11
12
  }
12
13
 
13
14
  const EMPTY_OBJ = Object.freeze({}) ;
@@ -678,7 +679,7 @@ function cleanupDeps(sub) {
678
679
  }
679
680
  function isDirty(sub) {
680
681
  for (let link = sub.deps; link; link = link.nextDep) {
681
- if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
682
+ if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) || link.dep.version !== link.version) {
682
683
  return true;
683
684
  }
684
685
  }
@@ -688,9 +689,6 @@ function isDirty(sub) {
688
689
  return false;
689
690
  }
690
691
  function refreshComputed(computed) {
691
- if (computed.flags & 2) {
692
- return false;
693
- }
694
692
  if (computed.flags & 4 && !(computed.flags & 16)) {
695
693
  return;
696
694
  }
@@ -957,9 +955,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
957
955
  globalVersion++;
958
956
  return;
959
957
  }
960
- let deps = [];
958
+ const run = (dep) => {
959
+ if (dep) {
960
+ {
961
+ dep.trigger({
962
+ target,
963
+ type,
964
+ key,
965
+ newValue,
966
+ oldValue,
967
+ oldTarget
968
+ });
969
+ }
970
+ }
971
+ };
972
+ startBatch();
961
973
  if (type === "clear") {
962
- deps = [...depsMap.values()];
974
+ depsMap.forEach(run);
963
975
  } else {
964
976
  const targetIsArray = isArray(target);
965
977
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -967,57 +979,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
967
979
  const newLength = Number(newValue);
968
980
  depsMap.forEach((dep, key2) => {
969
981
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
970
- deps.push(dep);
982
+ run(dep);
971
983
  }
972
984
  });
973
985
  } else {
974
- const push = (dep) => dep && deps.push(dep);
975
986
  if (key !== void 0) {
976
- push(depsMap.get(key));
987
+ run(depsMap.get(key));
977
988
  }
978
989
  if (isArrayIndex) {
979
- push(depsMap.get(ARRAY_ITERATE_KEY));
990
+ run(depsMap.get(ARRAY_ITERATE_KEY));
980
991
  }
981
992
  switch (type) {
982
993
  case "add":
983
994
  if (!targetIsArray) {
984
- push(depsMap.get(ITERATE_KEY));
995
+ run(depsMap.get(ITERATE_KEY));
985
996
  if (isMap(target)) {
986
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
997
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
987
998
  }
988
999
  } else if (isArrayIndex) {
989
- push(depsMap.get("length"));
1000
+ run(depsMap.get("length"));
990
1001
  }
991
1002
  break;
992
1003
  case "delete":
993
1004
  if (!targetIsArray) {
994
- push(depsMap.get(ITERATE_KEY));
1005
+ run(depsMap.get(ITERATE_KEY));
995
1006
  if (isMap(target)) {
996
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1007
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
997
1008
  }
998
1009
  }
999
1010
  break;
1000
1011
  case "set":
1001
1012
  if (isMap(target)) {
1002
- push(depsMap.get(ITERATE_KEY));
1013
+ run(depsMap.get(ITERATE_KEY));
1003
1014
  }
1004
1015
  break;
1005
1016
  }
1006
1017
  }
1007
1018
  }
1008
- startBatch();
1009
- for (const dep of deps) {
1010
- {
1011
- dep.trigger({
1012
- target,
1013
- type,
1014
- key,
1015
- newValue,
1016
- oldValue,
1017
- oldTarget
1018
- });
1019
- }
1020
- }
1021
1019
  endBatch();
1022
1020
  }
1023
1021
  function getDepFromReactive(object, key) {
@@ -1755,7 +1753,7 @@ function toRaw(observed) {
1755
1753
  return raw ? toRaw(raw) : observed;
1756
1754
  }
1757
1755
  function markRaw(value) {
1758
- if (Object.isExtensible(value)) {
1756
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1759
1757
  def(value, "__v_skip", true);
1760
1758
  }
1761
1759
  return value;
@@ -1965,8 +1963,8 @@ class ComputedRefImpl {
1965
1963
  * @internal
1966
1964
  */
1967
1965
  notify() {
1966
+ this.flags |= 16;
1968
1967
  if (activeSub !== this) {
1969
- this.flags |= 16;
1970
1968
  this.dep.notify();
1971
1969
  }
1972
1970
  }
@@ -2654,23 +2652,19 @@ function flushJobs(seen) {
2654
2652
  }
2655
2653
  }
2656
2654
  function checkRecursiveUpdates(seen, fn) {
2657
- if (!seen.has(fn)) {
2658
- seen.set(fn, 1);
2659
- } else {
2660
- const count = seen.get(fn);
2661
- if (count > RECURSION_LIMIT) {
2662
- const instance = fn.i;
2663
- const componentName = instance && getComponentName(instance.type);
2664
- handleError(
2665
- `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.`,
2666
- null,
2667
- 10
2668
- );
2669
- return true;
2670
- } else {
2671
- seen.set(fn, count + 1);
2672
- }
2655
+ const count = seen.get(fn) || 0;
2656
+ if (count > RECURSION_LIMIT) {
2657
+ const instance = fn.i;
2658
+ const componentName = instance && getComponentName(instance.type);
2659
+ handleError(
2660
+ `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.`,
2661
+ null,
2662
+ 10
2663
+ );
2664
+ return true;
2673
2665
  }
2666
+ seen.set(fn, count + 1);
2667
+ return false;
2674
2668
  }
2675
2669
 
2676
2670
  let isHmrUpdating = false;
@@ -5846,13 +5840,15 @@ function renderList(source, renderItem, cache, index) {
5846
5840
  const sourceIsArray = isArray(source);
5847
5841
  if (sourceIsArray || isString(source)) {
5848
5842
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5843
+ let needsWrap = false;
5849
5844
  if (sourceIsReactiveArray) {
5845
+ needsWrap = !isShallow(source);
5850
5846
  source = shallowReadArray(source);
5851
5847
  }
5852
5848
  ret = new Array(source.length);
5853
5849
  for (let i = 0, l = source.length; i < l; i++) {
5854
5850
  ret[i] = renderItem(
5855
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5851
+ needsWrap ? toReactive(source[i]) : source[i],
5856
5852
  i,
5857
5853
  void 0,
5858
5854
  cached && cached[i]
@@ -7103,7 +7099,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7103
7099
  return vm;
7104
7100
  }
7105
7101
  }
7106
- Vue.version = `2.6.14-compat:${"3.5.3"}`;
7102
+ Vue.version = `2.6.14-compat:${"3.5.4"}`;
7107
7103
  Vue.config = singletonApp.config;
7108
7104
  Vue.use = (plugin, ...options) => {
7109
7105
  if (plugin && isFunction(plugin.install)) {
@@ -12216,7 +12212,7 @@ function isMemoSame(cached, memo) {
12216
12212
  return true;
12217
12213
  }
12218
12214
 
12219
- const version = "3.5.3";
12215
+ const version = "3.5.4";
12220
12216
  const warn = warn$1 ;
12221
12217
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12222
12218
  const devtools = devtools$1 ;
@@ -17098,10 +17094,8 @@ function createRootCodegen(root, context) {
17098
17094
  }
17099
17095
  } else if (children.length > 1) {
17100
17096
  let patchFlag = 64;
17101
- let patchFlagText = PatchFlagNames[64];
17102
17097
  if (children.filter((c) => c.type !== 3).length === 1) {
17103
17098
  patchFlag |= 2048;
17104
- patchFlagText += `, ${PatchFlagNames[2048]}`;
17105
17099
  }
17106
17100
  root.codegenNode = createVNodeCall(
17107
17101
  context,
@@ -18009,10 +18003,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
18009
18003
  return vnodeCall;
18010
18004
  } else {
18011
18005
  let patchFlag = 64;
18012
- let patchFlagText = PatchFlagNames[64];
18013
18006
  if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
18014
18007
  patchFlag |= 2048;
18015
- patchFlagText += `, ${PatchFlagNames[2048]}`;
18016
18008
  }
18017
18009
  return createVNodeCall(
18018
18010
  context,
@@ -19987,10 +19979,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
19987
19979
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
19988
19980
  );
19989
19981
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
19990
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
19991
- `onkeyup,onkeydown,onkeypress`,
19992
- true
19993
- );
19982
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
19994
19983
  const resolveModifiers = (key, modifiers, context, loc) => {
19995
19984
  const keyModifiers = [];
19996
19985
  const nonKeyModifiers = [];
@@ -20008,7 +19997,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20008
19997
  } else {
20009
19998
  if (maybeKeyModifier(modifier)) {
20010
19999
  if (isStaticExp(key)) {
20011
- if (isKeyboardEvent(key.content)) {
20000
+ if (isKeyboardEvent(key.content.toLowerCase())) {
20012
20001
  keyModifiers.push(modifier);
20013
20002
  } else {
20014
20003
  nonKeyModifiers.push(modifier);
@@ -20061,7 +20050,7 @@ const transformOn = (dir, node, context) => {
20061
20050
  ]);
20062
20051
  }
20063
20052
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
20064
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
20053
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
20065
20054
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
20066
20055
  handlerExp,
20067
20056
  JSON.stringify(keyModifiers)