@vue/compat 3.5.18 → 3.5.19

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.19
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(
@@ -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;
@@ -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
  };
@@ -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.19"}`;
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.19";
10003
9996
  const warn$1 = NOOP;
10004
9997
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10005
9998
  const devtools = void 0;
@@ -10840,10 +10833,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
10840
10833
  VueCustomElement.def = Comp;
10841
10834
  return VueCustomElement;
10842
10835
  }
10843
- /*! #__NO_SIDE_EFFECTS__ */
10844
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10836
+
10837
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10845
10838
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
10846
- };
10839
+ });
10847
10840
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
10848
10841
  };
10849
10842
  class VueElement extends BaseClass {
@@ -11646,13 +11639,13 @@ const modifierGuards = {
11646
11639
  const withModifiers = (fn, modifiers) => {
11647
11640
  const cache = fn._withMods || (fn._withMods = {});
11648
11641
  const cacheKey = modifiers.join(".");
11649
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
11642
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
11650
11643
  for (let i = 0; i < modifiers.length; i++) {
11651
11644
  const guard = modifierGuards[modifiers[i]];
11652
11645
  if (guard && guard(event, modifiers)) return;
11653
11646
  }
11654
11647
  return fn(event, ...args);
11655
- });
11648
+ }));
11656
11649
  };
11657
11650
  const keyNames = {
11658
11651
  esc: "escape",
@@ -11676,7 +11669,7 @@ const withKeys = (fn, modifiers) => {
11676
11669
  }
11677
11670
  const cache = fn._withKeys || (fn._withKeys = {});
11678
11671
  const cacheKey = modifiers.join(".");
11679
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
11672
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
11680
11673
  if (!("key" in event)) {
11681
11674
  return;
11682
11675
  }
@@ -11706,7 +11699,7 @@ const withKeys = (fn, modifiers) => {
11706
11699
  }
11707
11700
  }
11708
11701
  }
11709
- });
11702
+ }));
11710
11703
  };
11711
11704
 
11712
11705
  const rendererOptions = /* @__PURE__ */ extend$1({ patchProp }, nodeOps);
@@ -11720,13 +11713,13 @@ function ensureHydrationRenderer() {
11720
11713
  enabledHydration = true;
11721
11714
  return renderer;
11722
11715
  }
11723
- const render = (...args) => {
11716
+ const render = ((...args) => {
11724
11717
  ensureRenderer().render(...args);
11725
- };
11726
- const hydrate = (...args) => {
11718
+ });
11719
+ const hydrate = ((...args) => {
11727
11720
  ensureHydrationRenderer().hydrate(...args);
11728
- };
11729
- const createApp = (...args) => {
11721
+ });
11722
+ const createApp = ((...args) => {
11730
11723
  const app = ensureRenderer().createApp(...args);
11731
11724
  const { mount } = app;
11732
11725
  app.mount = (containerOrSelector) => {
@@ -11747,8 +11740,8 @@ const createApp = (...args) => {
11747
11740
  return proxy;
11748
11741
  };
11749
11742
  return app;
11750
- };
11751
- const createSSRApp = (...args) => {
11743
+ });
11744
+ const createSSRApp = ((...args) => {
11752
11745
  const app = ensureHydrationRenderer().createApp(...args);
11753
11746
  const { mount } = app;
11754
11747
  app.mount = (containerOrSelector) => {
@@ -11758,7 +11751,7 @@ const createSSRApp = (...args) => {
11758
11751
  }
11759
11752
  };
11760
11753
  return app;
11761
- };
11754
+ });
11762
11755
  function resolveRootNamespace(container) {
11763
11756
  if (container instanceof SVGElement) {
11764
11757
  return "svg";
@@ -14628,7 +14621,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14628
14621
  }
14629
14622
  }
14630
14623
  let cachedAsArray = false;
14631
- const slotCacheKeys = [];
14632
14624
  if (toCache.length === children.length && node.type === 1) {
14633
14625
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14634
14626
  node.codegenNode.children = getCacheExpression(
@@ -14638,7 +14630,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14638
14630
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14639
14631
  const slot = getSlotNode(node.codegenNode, "default");
14640
14632
  if (slot) {
14641
- slotCacheKeys.push(context.cached.length);
14642
14633
  slot.returns = getCacheExpression(
14643
14634
  createArrayExpression(slot.returns)
14644
14635
  );
@@ -14648,7 +14639,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14648
14639
  const slotName = findDir(node, "slot", true);
14649
14640
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14650
14641
  if (slot) {
14651
- slotCacheKeys.push(context.cached.length);
14652
14642
  slot.returns = getCacheExpression(
14653
14643
  createArrayExpression(slot.returns)
14654
14644
  );
@@ -14658,23 +14648,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14658
14648
  }
14659
14649
  if (!cachedAsArray) {
14660
14650
  for (const child of toCache) {
14661
- slotCacheKeys.push(context.cached.length);
14662
14651
  child.codegenNode = context.cache(child.codegenNode);
14663
14652
  }
14664
14653
  }
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
14654
  function getCacheExpression(value) {
14674
14655
  const exp = context.cache(value);
14675
- if (inFor && context.hmr) {
14676
- exp.needArraySpread = true;
14677
- }
14656
+ exp.needArraySpread = true;
14678
14657
  return exp;
14679
14658
  }
14680
14659
  function getSlotNode(node2, name) {
@@ -16217,7 +16196,7 @@ function processIf(node, dir, context, processCodegen) {
16217
16196
  continue;
16218
16197
  }
16219
16198
  if (sibling && sibling.type === 9) {
16220
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16199
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16221
16200
  context.onError(
16222
16201
  createCompilerError(30, node.loc)
16223
16202
  );
@@ -18066,7 +18045,7 @@ const seen = /* @__PURE__ */ new WeakSet();
18066
18045
  const transformMemo = (node, context) => {
18067
18046
  if (node.type === 1) {
18068
18047
  const dir = findDir(node, "memo");
18069
- if (!dir || seen.has(node)) {
18048
+ if (!dir || seen.has(node) || context.inSSR) {
18070
18049
  return;
18071
18050
  }
18072
18051
  seen.add(node);