@vue/compat 3.5.2 → 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.2
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
  }
@@ -954,9 +955,23 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
954
955
  globalVersion++;
955
956
  return;
956
957
  }
957
- 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();
958
973
  if (type === "clear") {
959
- deps = [...depsMap.values()];
974
+ depsMap.forEach(run);
960
975
  } else {
961
976
  const targetIsArray = isArray(target);
962
977
  const isArrayIndex = targetIsArray && isIntegerKey(key);
@@ -964,57 +979,43 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
964
979
  const newLength = Number(newValue);
965
980
  depsMap.forEach((dep, key2) => {
966
981
  if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
967
- deps.push(dep);
982
+ run(dep);
968
983
  }
969
984
  });
970
985
  } else {
971
- const push = (dep) => dep && deps.push(dep);
972
986
  if (key !== void 0) {
973
- push(depsMap.get(key));
987
+ run(depsMap.get(key));
974
988
  }
975
989
  if (isArrayIndex) {
976
- push(depsMap.get(ARRAY_ITERATE_KEY));
990
+ run(depsMap.get(ARRAY_ITERATE_KEY));
977
991
  }
978
992
  switch (type) {
979
993
  case "add":
980
994
  if (!targetIsArray) {
981
- push(depsMap.get(ITERATE_KEY));
995
+ run(depsMap.get(ITERATE_KEY));
982
996
  if (isMap(target)) {
983
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
997
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
984
998
  }
985
999
  } else if (isArrayIndex) {
986
- push(depsMap.get("length"));
1000
+ run(depsMap.get("length"));
987
1001
  }
988
1002
  break;
989
1003
  case "delete":
990
1004
  if (!targetIsArray) {
991
- push(depsMap.get(ITERATE_KEY));
1005
+ run(depsMap.get(ITERATE_KEY));
992
1006
  if (isMap(target)) {
993
- push(depsMap.get(MAP_KEY_ITERATE_KEY));
1007
+ run(depsMap.get(MAP_KEY_ITERATE_KEY));
994
1008
  }
995
1009
  }
996
1010
  break;
997
1011
  case "set":
998
1012
  if (isMap(target)) {
999
- push(depsMap.get(ITERATE_KEY));
1013
+ run(depsMap.get(ITERATE_KEY));
1000
1014
  }
1001
1015
  break;
1002
1016
  }
1003
1017
  }
1004
1018
  }
1005
- startBatch();
1006
- for (const dep of deps) {
1007
- {
1008
- dep.trigger({
1009
- target,
1010
- type,
1011
- key,
1012
- newValue,
1013
- oldValue,
1014
- oldTarget
1015
- });
1016
- }
1017
- }
1018
1019
  endBatch();
1019
1020
  }
1020
1021
  function getDepFromReactive(object, key) {
@@ -1752,7 +1753,7 @@ function toRaw(observed) {
1752
1753
  return raw ? toRaw(raw) : observed;
1753
1754
  }
1754
1755
  function markRaw(value) {
1755
- if (Object.isExtensible(value)) {
1756
+ if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1756
1757
  def(value, "__v_skip", true);
1757
1758
  }
1758
1759
  return value;
@@ -2651,23 +2652,19 @@ function flushJobs(seen) {
2651
2652
  }
2652
2653
  }
2653
2654
  function checkRecursiveUpdates(seen, fn) {
2654
- if (!seen.has(fn)) {
2655
- seen.set(fn, 1);
2656
- } else {
2657
- const count = seen.get(fn);
2658
- if (count > RECURSION_LIMIT) {
2659
- const instance = fn.i;
2660
- const componentName = instance && getComponentName(instance.type);
2661
- handleError(
2662
- `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.`,
2663
- null,
2664
- 10
2665
- );
2666
- return true;
2667
- } else {
2668
- seen.set(fn, count + 1);
2669
- }
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;
2670
2665
  }
2666
+ seen.set(fn, count + 1);
2667
+ return false;
2671
2668
  }
2672
2669
 
2673
2670
  let isHmrUpdating = false;
@@ -4150,6 +4147,7 @@ function getInnerChild$1(vnode) {
4150
4147
  }
4151
4148
  function setTransitionHooks(vnode, hooks) {
4152
4149
  if (vnode.shapeFlag & 6 && vnode.component) {
4150
+ vnode.transition = hooks;
4153
4151
  setTransitionHooks(vnode.component.subTree, hooks);
4154
4152
  } else if (vnode.shapeFlag & 128) {
4155
4153
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
@@ -4194,7 +4192,7 @@ function defineComponent(options, extraOptions) {
4194
4192
  function useId() {
4195
4193
  const i = getCurrentInstance();
4196
4194
  if (i) {
4197
- return (i.appContext.config.idPrefix || "v") + ":" + i.ids[0] + i.ids[1]++;
4195
+ return (i.appContext.config.idPrefix || "v") + "-" + i.ids[0] + i.ids[1]++;
4198
4196
  } else {
4199
4197
  warn$1(
4200
4198
  `useId() is called when there is no active component instance to be associated with.`
@@ -5842,13 +5840,15 @@ function renderList(source, renderItem, cache, index) {
5842
5840
  const sourceIsArray = isArray(source);
5843
5841
  if (sourceIsArray || isString(source)) {
5844
5842
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5843
+ let needsWrap = false;
5845
5844
  if (sourceIsReactiveArray) {
5845
+ needsWrap = !isShallow(source);
5846
5846
  source = shallowReadArray(source);
5847
5847
  }
5848
5848
  ret = new Array(source.length);
5849
5849
  for (let i = 0, l = source.length; i < l; i++) {
5850
5850
  ret[i] = renderItem(
5851
- sourceIsReactiveArray ? toReactive(source[i]) : source[i],
5851
+ needsWrap ? toReactive(source[i]) : source[i],
5852
5852
  i,
5853
5853
  void 0,
5854
5854
  cached && cached[i]
@@ -7099,7 +7099,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7099
7099
  return vm;
7100
7100
  }
7101
7101
  }
7102
- Vue.version = `2.6.14-compat:${"3.5.2"}`;
7102
+ Vue.version = `2.6.14-compat:${"3.5.4"}`;
7103
7103
  Vue.config = singletonApp.config;
7104
7104
  Vue.use = (plugin, ...options) => {
7105
7105
  if (plugin && isFunction(plugin.install)) {
@@ -9004,7 +9004,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9004
9004
  endMeasure(instance, `hydrate`);
9005
9005
  }
9006
9006
  };
9007
- if (isAsyncWrapperVNode) {
9007
+ if (isAsyncWrapperVNode && type.__asyncHydrate) {
9008
9008
  type.__asyncHydrate(
9009
9009
  el,
9010
9010
  instance,
@@ -10212,8 +10212,7 @@ function renderComponentRoot(instance) {
10212
10212
  data,
10213
10213
  setupState,
10214
10214
  ctx,
10215
- inheritAttrs,
10216
- isMounted
10215
+ inheritAttrs
10217
10216
  } = instance;
10218
10217
  const prev = setCurrentRenderingInstance(instance);
10219
10218
  let result;
@@ -10354,7 +10353,7 @@ function renderComponentRoot(instance) {
10354
10353
  `Component inside <Transition> renders non-element root node that cannot be animated.`
10355
10354
  );
10356
10355
  }
10357
- root.transition = isMounted ? vnode.component.subTree.transition : vnode.transition;
10356
+ setTransitionHooks(root, vnode.transition);
10358
10357
  }
10359
10358
  if (setRoot) {
10360
10359
  setRoot(root);
@@ -12213,7 +12212,7 @@ function isMemoSame(cached, memo) {
12213
12212
  return true;
12214
12213
  }
12215
12214
 
12216
- const version = "3.5.2";
12215
+ const version = "3.5.4";
12217
12216
  const warn = warn$1 ;
12218
12217
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12219
12218
  const devtools = devtools$1 ;
@@ -12226,7 +12225,9 @@ const _ssrUtils = {
12226
12225
  isVNode: isVNode,
12227
12226
  normalizeVNode,
12228
12227
  getComponentPublicInstance,
12229
- ensureValidVNode
12228
+ ensureValidVNode,
12229
+ pushWarningContext,
12230
+ popWarningContext
12230
12231
  };
12231
12232
  const ssrUtils = _ssrUtils ;
12232
12233
  const resolveFilter = resolveFilter$1 ;
@@ -17093,10 +17094,8 @@ function createRootCodegen(root, context) {
17093
17094
  }
17094
17095
  } else if (children.length > 1) {
17095
17096
  let patchFlag = 64;
17096
- let patchFlagText = PatchFlagNames[64];
17097
17097
  if (children.filter((c) => c.type !== 3).length === 1) {
17098
17098
  patchFlag |= 2048;
17099
- patchFlagText += `, ${PatchFlagNames[2048]}`;
17100
17099
  }
17101
17100
  root.codegenNode = createVNodeCall(
17102
17101
  context,
@@ -18004,10 +18003,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
18004
18003
  return vnodeCall;
18005
18004
  } else {
18006
18005
  let patchFlag = 64;
18007
- let patchFlagText = PatchFlagNames[64];
18008
18006
  if (!branch.isTemplateIf && children.filter((c) => c.type !== 3).length === 1) {
18009
18007
  patchFlag |= 2048;
18010
- patchFlagText += `, ${PatchFlagNames[2048]}`;
18011
18008
  }
18012
18009
  return createVNodeCall(
18013
18010
  context,
@@ -19982,10 +19979,7 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
19982
19979
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
19983
19980
  );
19984
19981
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
19985
- const isKeyboardEvent = /* @__PURE__ */ makeMap(
19986
- `onkeyup,onkeydown,onkeypress`,
19987
- true
19988
- );
19982
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
19989
19983
  const resolveModifiers = (key, modifiers, context, loc) => {
19990
19984
  const keyModifiers = [];
19991
19985
  const nonKeyModifiers = [];
@@ -20003,7 +19997,7 @@ const resolveModifiers = (key, modifiers, context, loc) => {
20003
19997
  } else {
20004
19998
  if (maybeKeyModifier(modifier)) {
20005
19999
  if (isStaticExp(key)) {
20006
- if (isKeyboardEvent(key.content)) {
20000
+ if (isKeyboardEvent(key.content.toLowerCase())) {
20007
20001
  keyModifiers.push(modifier);
20008
20002
  } else {
20009
20003
  nonKeyModifiers.push(modifier);
@@ -20056,7 +20050,7 @@ const transformOn = (dir, node, context) => {
20056
20050
  ]);
20057
20051
  }
20058
20052
  if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
20059
- (!isStaticExp(key) || isKeyboardEvent(key.content))) {
20053
+ (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) {
20060
20054
  handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
20061
20055
  handlerExp,
20062
20056
  JSON.stringify(keyModifiers)