@vue/compat 3.5.18 → 3.5.20

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.18
2
+ * @vue/compat v3.5.20
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -63,10 +63,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
63
63
  );
64
64
  const cacheStringFunction = (fn) => {
65
65
  const cache = /* @__PURE__ */ Object.create(null);
66
- return (str) => {
66
+ return ((str) => {
67
67
  const hit = cache[str];
68
68
  return hit || (cache[str] = fn(str));
69
- };
69
+ });
70
70
  };
71
71
  const camelizeRE = /-(\w)/g;
72
72
  const camelize = cacheStringFunction(
@@ -1062,7 +1062,7 @@ const arrayInstrumentations = {
1062
1062
  join(separator) {
1063
1063
  return reactiveReadArray(this).join(separator);
1064
1064
  },
1065
- // keys() iterator only reads `length`, no optimisation required
1065
+ // keys() iterator only reads `length`, no optimization required
1066
1066
  lastIndexOf(...args) {
1067
1067
  return searchProxy(this, "lastIndexOf", args);
1068
1068
  },
@@ -1263,7 +1263,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1263
1263
  }
1264
1264
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1265
1265
  if (isOldValueReadonly) {
1266
- return false;
1266
+ return true;
1267
1267
  } else {
1268
1268
  oldValue.value = value;
1269
1269
  return true;
@@ -1389,7 +1389,7 @@ function createInstrumentations(readonly, shallow) {
1389
1389
  get size() {
1390
1390
  const target = this["__v_raw"];
1391
1391
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1392
- return Reflect.get(target, "size", target);
1392
+ return target.size;
1393
1393
  },
1394
1394
  has(key) {
1395
1395
  const target = this["__v_raw"];
@@ -3420,7 +3420,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3420
3420
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3421
3421
  const setupState = owner.setupState;
3422
3422
  const rawSetupState = toRaw(setupState);
3423
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3423
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
3424
3424
  return hasOwn(rawSetupState, key);
3425
3425
  };
3426
3426
  if (oldRef != null && oldRef !== ref) {
@@ -3430,7 +3430,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3430
3430
  setupState[oldRef] = null;
3431
3431
  }
3432
3432
  } else if (isRef(oldRef)) {
3433
- oldRef.value = null;
3433
+ {
3434
+ oldRef.value = null;
3435
+ }
3436
+ const oldRawRefAtom = oldRawRef;
3437
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
3434
3438
  }
3435
3439
  }
3436
3440
  if (isFunction(ref)) {
@@ -3441,7 +3445,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3441
3445
  if (_isString || _isRef) {
3442
3446
  const doSet = () => {
3443
3447
  if (rawRef.f) {
3444
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3448
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value ;
3445
3449
  if (isUnmount) {
3446
3450
  isArray(existing) && remove(existing, refValue);
3447
3451
  } else {
@@ -3452,8 +3456,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3452
3456
  setupState[ref] = refs[ref];
3453
3457
  }
3454
3458
  } else {
3455
- ref.value = [refValue];
3456
- if (rawRef.k) refs[rawRef.k] = ref.value;
3459
+ const newVal = [refValue];
3460
+ {
3461
+ ref.value = newVal;
3462
+ }
3463
+ if (rawRef.k) refs[rawRef.k] = newVal;
3457
3464
  }
3458
3465
  } else if (!existing.includes(refValue)) {
3459
3466
  existing.push(refValue);
@@ -3465,7 +3472,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3465
3472
  setupState[ref] = value;
3466
3473
  }
3467
3474
  } else if (_isRef) {
3468
- ref.value = value;
3475
+ {
3476
+ ref.value = value;
3477
+ }
3469
3478
  if (rawRef.k) refs[rawRef.k] = value;
3470
3479
  } else ;
3471
3480
  };
@@ -4995,7 +5004,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
4995
5004
  }
4996
5005
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
4997
5006
  }
4998
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
5007
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
4999
5008
  return createSlots(
5000
5009
  raw || { $stable: !hasDynamicKeys },
5001
5010
  mapKeyToName(fns)
@@ -5156,7 +5165,7 @@ function installCompatInstanceProperties(map) {
5156
5165
  _b: () => legacyBindObjectProps,
5157
5166
  _v: () => createTextVNode,
5158
5167
  _e: () => createCommentVNode,
5159
- _u: () => legacyresolveScopedSlots,
5168
+ _u: () => legacyResolveScopedSlots,
5160
5169
  _g: () => legacyBindObjectListeners,
5161
5170
  _d: () => legacyBindDynamicKeys,
5162
5171
  _p: () => legacyPrependModifier
@@ -5293,10 +5302,10 @@ const PublicInstanceProxyHandlers = {
5293
5302
  return true;
5294
5303
  },
5295
5304
  has({
5296
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5305
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5297
5306
  }, key) {
5298
- let normalizedProps;
5299
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
5307
+ let normalizedProps, cssModules;
5308
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
5300
5309
  },
5301
5310
  defineProperty(target, key, descriptor) {
5302
5311
  if (descriptor.get != null) {
@@ -5832,7 +5841,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5832
5841
  return vm;
5833
5842
  }
5834
5843
  }
5835
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
5844
+ Vue.version = `2.6.14-compat:${"3.5.20"}`;
5836
5845
  Vue.config = singletonApp.config;
5837
5846
  Vue.use = (plugin, ...options) => {
5838
5847
  if (plugin && isFunction(plugin.install)) {
@@ -5846,22 +5855,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
5846
5855
  singletonApp.mixin(m);
5847
5856
  return Vue;
5848
5857
  };
5849
- Vue.component = (name, comp) => {
5858
+ Vue.component = ((name, comp) => {
5850
5859
  if (comp) {
5851
5860
  singletonApp.component(name, comp);
5852
5861
  return Vue;
5853
5862
  } else {
5854
5863
  return singletonApp.component(name);
5855
5864
  }
5856
- };
5857
- Vue.directive = (name, dir) => {
5865
+ });
5866
+ Vue.directive = ((name, dir) => {
5858
5867
  if (dir) {
5859
5868
  singletonApp.directive(name, dir);
5860
5869
  return Vue;
5861
5870
  } else {
5862
5871
  return singletonApp.directive(name);
5863
5872
  }
5864
- };
5873
+ });
5865
5874
  Vue.options = { _base: Vue };
5866
5875
  let cid = 1;
5867
5876
  Vue.cid = cid;
@@ -5924,14 +5933,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
5924
5933
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
5925
5934
  return reactive(target);
5926
5935
  };
5927
- Vue.filter = (name, filter) => {
5936
+ Vue.filter = ((name, filter) => {
5928
5937
  if (filter) {
5929
5938
  singletonApp.filter(name, filter);
5930
5939
  return Vue;
5931
5940
  } else {
5932
5941
  return singletonApp.filter(name);
5933
5942
  }
5934
- };
5943
+ });
5935
5944
  const util = {
5936
5945
  warn: NOOP,
5937
5946
  extend: extend$1,
@@ -6671,7 +6680,7 @@ function validatePropName(key) {
6671
6680
  return false;
6672
6681
  }
6673
6682
 
6674
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6683
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6675
6684
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6676
6685
  const normalizeSlot = (key, rawSlot, ctx) => {
6677
6686
  if (rawSlot._n) {
@@ -6711,8 +6720,6 @@ const assignSlots = (slots, children, optimized) => {
6711
6720
  const initSlots = (instance, children, optimized) => {
6712
6721
  const slots = instance.slots = createInternalObject();
6713
6722
  if (instance.vnode.shapeFlag & 32) {
6714
- const cacheIndexes = children.__;
6715
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6716
6723
  const type = children._;
6717
6724
  if (type) {
6718
6725
  assignSlots(slots, children, optimized);
@@ -7832,6 +7839,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7832
7839
  }
7833
7840
  };
7834
7841
  const performLeave = () => {
7842
+ if (el._isLeaving) {
7843
+ el[leaveCbKey](
7844
+ true
7845
+ /* cancelled */
7846
+ );
7847
+ }
7835
7848
  leave(el, () => {
7836
7849
  remove2();
7837
7850
  afterLeave && afterLeave();
@@ -7966,27 +7979,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7966
7979
  hostRemove(end);
7967
7980
  };
7968
7981
  const unmountComponent = (instance, parentSuspense, doRemove) => {
7969
- const {
7970
- bum,
7971
- scope,
7972
- job,
7973
- subTree,
7974
- um,
7975
- m,
7976
- a,
7977
- parent,
7978
- slots: { __: slotCacheKeys }
7979
- } = instance;
7982
+ const { bum, scope, job, subTree, um, m, a } = instance;
7980
7983
  invalidateMount(m);
7981
7984
  invalidateMount(a);
7982
7985
  if (bum) {
7983
7986
  invokeArrayFns(bum);
7984
7987
  }
7985
- if (parent && isArray(slotCacheKeys)) {
7986
- slotCacheKeys.forEach((v) => {
7987
- parent.renderCache[v] = void 0;
7988
- });
7989
- }
7990
7988
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
7991
7989
  instance.emit("hook:beforeDestroy");
7992
7990
  }
@@ -8007,12 +8005,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8007
8005
  queuePostRenderEffect(() => {
8008
8006
  instance.isUnmounted = true;
8009
8007
  }, parentSuspense);
8010
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8011
- parentSuspense.deps--;
8012
- if (parentSuspense.deps === 0) {
8013
- parentSuspense.resolve();
8014
- }
8015
- }
8016
8008
  };
8017
8009
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8018
8010
  for (let i = start; i < children.length; i++) {
@@ -8110,7 +8102,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8110
8102
  if (!shallow && c2.patchFlag !== -2)
8111
8103
  traverseStaticChildren(c1, c2);
8112
8104
  }
8113
- if (c2.type === Text) {
8105
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8106
+ c2.patchFlag !== -1) {
8114
8107
  c2.el = c1.el;
8115
8108
  }
8116
8109
  if (c2.type === Comment && !c2.el) {
@@ -9999,7 +9992,7 @@ function isMemoSame(cached, memo) {
9999
9992
  return true;
10000
9993
  }
10001
9994
 
10002
- const version = "3.5.18";
9995
+ const version = "3.5.20";
10003
9996
  const warn$1 = NOOP;
10004
9997
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10005
9998
  const devtools = void 0;
@@ -10439,6 +10432,8 @@ function patchClass(el, value, isSVG) {
10439
10432
  const vShowOriginalDisplay = Symbol("_vod");
10440
10433
  const vShowHidden = Symbol("_vsh");
10441
10434
  const vShow = {
10435
+ // used for prop mismatch check during hydration
10436
+ name: "show",
10442
10437
  beforeMount(el, { value }, { transition }) {
10443
10438
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10444
10439
  if (transition && value) {
@@ -10840,10 +10835,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
10840
10835
  VueCustomElement.def = Comp;
10841
10836
  return VueCustomElement;
10842
10837
  }
10843
- /*! #__NO_SIDE_EFFECTS__ */
10844
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10838
+
10839
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10845
10840
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
10846
- };
10841
+ });
10847
10842
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10848
10843
  };
10849
10844
  class VueElement extends BaseClass {
@@ -11646,13 +11641,13 @@ const modifierGuards = {
11646
11641
  const withModifiers = (fn, modifiers) => {
11647
11642
  const cache = fn._withMods || (fn._withMods = {});
11648
11643
  const cacheKey = modifiers.join(".");
11649
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
11644
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
11650
11645
  for (let i = 0; i < modifiers.length; i++) {
11651
11646
  const guard = modifierGuards[modifiers[i]];
11652
11647
  if (guard && guard(event, modifiers)) return;
11653
11648
  }
11654
11649
  return fn(event, ...args);
11655
- });
11650
+ }));
11656
11651
  };
11657
11652
  const keyNames = {
11658
11653
  esc: "escape",
@@ -11676,7 +11671,7 @@ const withKeys = (fn, modifiers) => {
11676
11671
  }
11677
11672
  const cache = fn._withKeys || (fn._withKeys = {});
11678
11673
  const cacheKey = modifiers.join(".");
11679
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
11674
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
11680
11675
  if (!("key" in event)) {
11681
11676
  return;
11682
11677
  }
@@ -11706,7 +11701,7 @@ const withKeys = (fn, modifiers) => {
11706
11701
  }
11707
11702
  }
11708
11703
  }
11709
- });
11704
+ }));
11710
11705
  };
11711
11706
 
11712
11707
  const rendererOptions = /* @__PURE__ */ extend$1({ patchProp }, nodeOps);
@@ -11720,13 +11715,13 @@ function ensureHydrationRenderer() {
11720
11715
  enabledHydration = true;
11721
11716
  return renderer;
11722
11717
  }
11723
- const render = (...args) => {
11718
+ const render = ((...args) => {
11724
11719
  ensureRenderer().render(...args);
11725
- };
11726
- const hydrate = (...args) => {
11720
+ });
11721
+ const hydrate = ((...args) => {
11727
11722
  ensureHydrationRenderer().hydrate(...args);
11728
- };
11729
- const createApp = (...args) => {
11723
+ });
11724
+ const createApp = ((...args) => {
11730
11725
  const app = ensureRenderer().createApp(...args);
11731
11726
  const { mount } = app;
11732
11727
  app.mount = (containerOrSelector) => {
@@ -11747,8 +11742,8 @@ const createApp = (...args) => {
11747
11742
  return proxy;
11748
11743
  };
11749
11744
  return app;
11750
- };
11751
- const createSSRApp = (...args) => {
11745
+ });
11746
+ const createSSRApp = ((...args) => {
11752
11747
  const app = ensureHydrationRenderer().createApp(...args);
11753
11748
  const { mount } = app;
11754
11749
  app.mount = (containerOrSelector) => {
@@ -11758,7 +11753,7 @@ const createSSRApp = (...args) => {
11758
11753
  }
11759
11754
  };
11760
11755
  return app;
11761
- };
11756
+ });
11762
11757
  function resolveRootNamespace(container) {
11763
11758
  if (container instanceof SVGElement) {
11764
11759
  return "svg";
@@ -14628,7 +14623,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14628
14623
  }
14629
14624
  }
14630
14625
  let cachedAsArray = false;
14631
- const slotCacheKeys = [];
14632
14626
  if (toCache.length === children.length && node.type === 1) {
14633
14627
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14634
14628
  node.codegenNode.children = getCacheExpression(
@@ -14638,7 +14632,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14638
14632
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14639
14633
  const slot = getSlotNode(node.codegenNode, "default");
14640
14634
  if (slot) {
14641
- slotCacheKeys.push(context.cached.length);
14642
14635
  slot.returns = getCacheExpression(
14643
14636
  createArrayExpression(slot.returns)
14644
14637
  );
@@ -14648,7 +14641,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14648
14641
  const slotName = findDir(node, "slot", true);
14649
14642
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14650
14643
  if (slot) {
14651
- slotCacheKeys.push(context.cached.length);
14652
14644
  slot.returns = getCacheExpression(
14653
14645
  createArrayExpression(slot.returns)
14654
14646
  );
@@ -14658,23 +14650,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14658
14650
  }
14659
14651
  if (!cachedAsArray) {
14660
14652
  for (const child of toCache) {
14661
- slotCacheKeys.push(context.cached.length);
14662
14653
  child.codegenNode = context.cache(child.codegenNode);
14663
14654
  }
14664
14655
  }
14665
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14666
- node.codegenNode.children.properties.push(
14667
- createObjectProperty(
14668
- `__`,
14669
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
14670
- )
14671
- );
14672
- }
14673
14656
  function getCacheExpression(value) {
14674
14657
  const exp = context.cache(value);
14675
- if (inFor && context.hmr) {
14676
- exp.needArraySpread = true;
14677
- }
14658
+ exp.needArraySpread = true;
14678
14659
  return exp;
14679
14660
  }
14680
14661
  function getSlotNode(node2, name) {
@@ -16217,7 +16198,7 @@ function processIf(node, dir, context, processCodegen) {
16217
16198
  continue;
16218
16199
  }
16219
16200
  if (sibling && sibling.type === 9) {
16220
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16201
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16221
16202
  context.onError(
16222
16203
  createCompilerError(30, node.loc)
16223
16204
  );
@@ -18066,7 +18047,7 @@ const seen = /* @__PURE__ */ new WeakSet();
18066
18047
  const transformMemo = (node, context) => {
18067
18048
  if (node.type === 1) {
18068
18049
  const dir = findDir(node, "memo");
18069
- if (!dir || seen.has(node)) {
18050
+ if (!dir || seen.has(node) || context.inSSR) {
18070
18051
  return;
18071
18052
  }
18072
18053
  seen.add(node);