@vue/compat 3.5.13 → 3.5.14

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.13
2
+ * @vue/compat v3.5.14
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -396,6 +396,10 @@ class EffectScope {
396
396
  * @internal
397
397
  */
398
398
  this._active = true;
399
+ /**
400
+ * @internal track `on` calls, allow `on` call multiple times
401
+ */
402
+ this._on = 0;
399
403
  /**
400
404
  * @internal
401
405
  */
@@ -466,14 +470,20 @@ class EffectScope {
466
470
  * @internal
467
471
  */
468
472
  on() {
469
- activeEffectScope = this;
473
+ if (++this._on === 1) {
474
+ this.prevScope = activeEffectScope;
475
+ activeEffectScope = this;
476
+ }
470
477
  }
471
478
  /**
472
479
  * This should only be called on non-detached scopes
473
480
  * @internal
474
481
  */
475
482
  off() {
476
- activeEffectScope = this.parent;
483
+ if (this._on > 0 && --this._on === 0) {
484
+ activeEffectScope = this.prevScope;
485
+ this.prevScope = void 0;
486
+ }
477
487
  }
478
488
  stop(fromParent) {
479
489
  if (this._active) {
@@ -555,7 +565,7 @@ class ReactiveEffect {
555
565
  }
556
566
  resume() {
557
567
  if (this.flags & 64) {
558
- this.flags &= ~64;
568
+ this.flags &= -65;
559
569
  if (pausedQueueEffects.has(this)) {
560
570
  pausedQueueEffects.delete(this);
561
571
  this.trigger();
@@ -595,7 +605,7 @@ class ReactiveEffect {
595
605
  cleanupDeps(this);
596
606
  activeSub = prevEffect;
597
607
  shouldTrack = prevShouldTrack;
598
- this.flags &= ~2;
608
+ this.flags &= -3;
599
609
  }
600
610
  }
601
611
  stop() {
@@ -606,7 +616,7 @@ class ReactiveEffect {
606
616
  this.deps = this.depsTail = void 0;
607
617
  cleanupEffect(this);
608
618
  this.onStop && this.onStop();
609
- this.flags &= ~1;
619
+ this.flags &= -2;
610
620
  }
611
621
  }
612
622
  trigger() {
@@ -656,7 +666,7 @@ function endBatch() {
656
666
  while (e) {
657
667
  const next = e.next;
658
668
  e.next = void 0;
659
- e.flags &= ~8;
669
+ e.flags &= -9;
660
670
  e = next;
661
671
  }
662
672
  }
@@ -667,7 +677,7 @@ function endBatch() {
667
677
  while (e) {
668
678
  const next = e.next;
669
679
  e.next = void 0;
670
- e.flags &= ~8;
680
+ e.flags &= -9;
671
681
  if (e.flags & 1) {
672
682
  try {
673
683
  ;
@@ -723,17 +733,16 @@ function refreshComputed(computed) {
723
733
  if (computed.flags & 4 && !(computed.flags & 16)) {
724
734
  return;
725
735
  }
726
- computed.flags &= ~16;
736
+ computed.flags &= -17;
727
737
  if (computed.globalVersion === globalVersion) {
728
738
  return;
729
739
  }
730
740
  computed.globalVersion = globalVersion;
731
- const dep = computed.dep;
732
- computed.flags |= 2;
733
- if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
734
- computed.flags &= ~2;
741
+ if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
735
742
  return;
736
743
  }
744
+ computed.flags |= 2;
745
+ const dep = computed.dep;
737
746
  const prevSub = activeSub;
738
747
  const prevShouldTrack = shouldTrack;
739
748
  activeSub = computed;
@@ -742,6 +751,7 @@ function refreshComputed(computed) {
742
751
  prepareDeps(computed);
743
752
  const value = computed.fn(computed._value);
744
753
  if (dep.version === 0 || hasChanged(value, computed._value)) {
754
+ computed.flags |= 128;
745
755
  computed._value = value;
746
756
  dep.version++;
747
757
  }
@@ -752,7 +762,7 @@ function refreshComputed(computed) {
752
762
  activeSub = prevSub;
753
763
  shouldTrack = prevShouldTrack;
754
764
  cleanupDeps(computed);
755
- computed.flags &= ~2;
765
+ computed.flags &= -3;
756
766
  }
757
767
  }
758
768
  function removeSub(link, soft = false) {
@@ -771,7 +781,7 @@ function removeSub(link, soft = false) {
771
781
  if (dep.subs === link) {
772
782
  dep.subs = prevSub;
773
783
  if (!prevSub && dep.computed) {
774
- dep.computed.flags &= ~4;
784
+ dep.computed.flags &= -5;
775
785
  for (let l = dep.computed.deps; l; l = l.nextDep) {
776
786
  removeSub(l, true);
777
787
  }
@@ -1708,14 +1718,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1708
1718
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1709
1719
  return target;
1710
1720
  }
1711
- const existingProxy = proxyMap.get(target);
1712
- if (existingProxy) {
1713
- return existingProxy;
1714
- }
1715
1721
  const targetType = getTargetType(target);
1716
1722
  if (targetType === 0 /* INVALID */) {
1717
1723
  return target;
1718
1724
  }
1725
+ const existingProxy = proxyMap.get(target);
1726
+ if (existingProxy) {
1727
+ return existingProxy;
1728
+ }
1719
1729
  const proxy = new Proxy(
1720
1730
  target,
1721
1731
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2570,11 +2580,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2570
2580
  queue.splice(i, 1);
2571
2581
  i--;
2572
2582
  if (cb.flags & 4) {
2573
- cb.flags &= ~1;
2583
+ cb.flags &= -2;
2574
2584
  }
2575
2585
  cb();
2576
2586
  if (!(cb.flags & 4)) {
2577
- cb.flags &= ~1;
2587
+ cb.flags &= -2;
2578
2588
  }
2579
2589
  }
2580
2590
  }
@@ -2599,10 +2609,10 @@ function flushPostFlushCbs(seen) {
2599
2609
  continue;
2600
2610
  }
2601
2611
  if (cb.flags & 4) {
2602
- cb.flags &= ~1;
2612
+ cb.flags &= -2;
2603
2613
  }
2604
2614
  if (!(cb.flags & 8)) cb();
2605
- cb.flags &= ~1;
2615
+ cb.flags &= -2;
2606
2616
  }
2607
2617
  activePostFlushCbs = null;
2608
2618
  postFlushIndex = 0;
@@ -2638,7 +2648,7 @@ function flushJobs(seen) {
2638
2648
  for (; flushIndex < queue.length; flushIndex++) {
2639
2649
  const job = queue[flushIndex];
2640
2650
  if (job) {
2641
- job.flags &= ~1;
2651
+ job.flags &= -2;
2642
2652
  }
2643
2653
  }
2644
2654
  flushIndex = -1;
@@ -3658,7 +3668,7 @@ const TeleportImpl = {
3658
3668
  namespace,
3659
3669
  slotScopeIds
3660
3670
  );
3661
- traverseStaticChildren(n1, n2, true);
3671
+ traverseStaticChildren(n1, n2, !!!(process.env.NODE_ENV !== "production"));
3662
3672
  } else if (!optimized) {
3663
3673
  patchChildren(
3664
3674
  n1,
@@ -4178,7 +4188,7 @@ function getInnerChild$1(vnode) {
4178
4188
  }
4179
4189
  return vnode;
4180
4190
  }
4181
- if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
4191
+ if (vnode.component) {
4182
4192
  return vnode.component.subTree;
4183
4193
  }
4184
4194
  const { shapeFlag, children } = vnode;
@@ -5358,6 +5368,9 @@ const KeepAliveImpl = {
5358
5368
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
5359
5369
  devtoolsComponentAdded(instance2);
5360
5370
  }
5371
+ if (!!(process.env.NODE_ENV !== "production") && true) {
5372
+ instance2.__keepAliveStorageContainer = storageContainer;
5373
+ }
5361
5374
  };
5362
5375
  function unmount(vnode) {
5363
5376
  resetShapeFlag(vnode);
@@ -5445,7 +5458,7 @@ const KeepAliveImpl = {
5445
5458
  );
5446
5459
  const { include, exclude, max } = props;
5447
5460
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5448
- vnode.shapeFlag &= ~256;
5461
+ vnode.shapeFlag &= -257;
5449
5462
  current = vnode;
5450
5463
  return rawVNode;
5451
5464
  }
@@ -5536,8 +5549,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5536
5549
  }, target);
5537
5550
  }
5538
5551
  function resetShapeFlag(vnode) {
5539
- vnode.shapeFlag &= ~256;
5540
- vnode.shapeFlag &= ~512;
5552
+ vnode.shapeFlag &= -257;
5553
+ vnode.shapeFlag &= -513;
5541
5554
  }
5542
5555
  function getInnerChild(vnode) {
5543
5556
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@@ -5939,14 +5952,16 @@ function renderList(source, renderItem, cache, index) {
5939
5952
  if (sourceIsArray || isString(source)) {
5940
5953
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5941
5954
  let needsWrap = false;
5955
+ let isReadonlySource = false;
5942
5956
  if (sourceIsReactiveArray) {
5943
5957
  needsWrap = !isShallow(source);
5958
+ isReadonlySource = isReadonly(source);
5944
5959
  source = shallowReadArray(source);
5945
5960
  }
5946
5961
  ret = new Array(source.length);
5947
5962
  for (let i = 0, l = source.length; i < l; i++) {
5948
5963
  ret[i] = renderItem(
5949
- needsWrap ? toReactive(source[i]) : source[i],
5964
+ needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
5950
5965
  i,
5951
5966
  void 0,
5952
5967
  cached && cached[i]
@@ -7200,7 +7215,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7200
7215
  return vm;
7201
7216
  }
7202
7217
  }
7203
- Vue.version = `2.6.14-compat:${"3.5.13"}`;
7218
+ Vue.version = `2.6.14-compat:${"3.5.14"}`;
7204
7219
  Vue.config = singletonApp.config;
7205
7220
  Vue.use = (plugin, ...options) => {
7206
7221
  if (plugin && isFunction(plugin.install)) {
@@ -7696,11 +7711,9 @@ function createAppAPI(render, hydrate) {
7696
7711
  }
7697
7712
  if (!!(process.env.NODE_ENV !== "production")) {
7698
7713
  context.reload = () => {
7699
- render(
7700
- cloneVNode(vnode),
7701
- rootContainer,
7702
- namespace
7703
- );
7714
+ const cloned = cloneVNode(vnode);
7715
+ cloned.el = null;
7716
+ render(cloned, rootContainer, namespace);
7704
7717
  };
7705
7718
  }
7706
7719
  if (isHydrate && hydrate) {
@@ -8298,7 +8311,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
8298
8311
  return rawSlot;
8299
8312
  }
8300
8313
  const normalized = withCtx((...args) => {
8301
- if (!!(process.env.NODE_ENV !== "production") && currentInstance && (!ctx || ctx.root === currentInstance.root)) {
8314
+ if (!!(process.env.NODE_ENV !== "production") && currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
8302
8315
  warn$1(
8303
8316
  `Slot "${key}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`
8304
8317
  );
@@ -8337,7 +8350,7 @@ const normalizeVNodeSlots = (instance, children) => {
8337
8350
  };
8338
8351
  const assignSlots = (slots, children, optimized) => {
8339
8352
  for (const key in children) {
8340
- if (optimized || key !== "_") {
8353
+ if (optimized || !isInternalKey(key)) {
8341
8354
  slots[key] = children[key];
8342
8355
  }
8343
8356
  }
@@ -9062,8 +9075,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9062
9075
  endMeasure(instance, `init`);
9063
9076
  }
9064
9077
  }
9078
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
9065
9079
  if (instance.asyncDep) {
9066
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) initialVNode.el = null;
9067
9080
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
9068
9081
  if (!initialVNode.el) {
9069
9082
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9649,7 +9662,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9649
9662
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
9650
9663
  } else {
9651
9664
  const { leave, delayLeave, afterLeave } = transition;
9652
- const remove2 = () => hostInsert(el, container, anchor);
9665
+ const remove2 = () => {
9666
+ if (vnode.ctx.isUnmounted) {
9667
+ hostRemove(el);
9668
+ } else {
9669
+ hostInsert(el, container, anchor);
9670
+ }
9671
+ };
9653
9672
  const performLeave = () => {
9654
9673
  leave(el, () => {
9655
9674
  remove2();
@@ -9682,7 +9701,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9682
9701
  optimized = false;
9683
9702
  }
9684
9703
  if (ref != null) {
9704
+ pauseTracking();
9685
9705
  setRef(ref, null, parentSuspense, vnode, true);
9706
+ resetTracking();
9686
9707
  }
9687
9708
  if (cacheIndex != null) {
9688
9709
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -9794,12 +9815,27 @@ function baseCreateRenderer(options, createHydrationFns) {
9794
9815
  if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
9795
9816
  unregisterHMR(instance);
9796
9817
  }
9797
- const { bum, scope, job, subTree, um, m, a } = instance;
9818
+ const {
9819
+ bum,
9820
+ scope,
9821
+ job,
9822
+ subTree,
9823
+ um,
9824
+ m,
9825
+ a,
9826
+ parent,
9827
+ slots: { __: slotCacheKeys }
9828
+ } = instance;
9798
9829
  invalidateMount(m);
9799
9830
  invalidateMount(a);
9800
9831
  if (bum) {
9801
9832
  invokeArrayFns(bum);
9802
9833
  }
9834
+ if (parent && isArray(slotCacheKeys)) {
9835
+ slotCacheKeys.forEach((v) => {
9836
+ parent.renderCache[v] = void 0;
9837
+ });
9838
+ }
9803
9839
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9804
9840
  instance.emit("hook:beforeDestroy");
9805
9841
  }
@@ -9904,8 +9940,8 @@ function toggleRecurse({ effect, job }, allowed) {
9904
9940
  effect.flags |= 32;
9905
9941
  job.flags |= 4;
9906
9942
  } else {
9907
- effect.flags &= ~32;
9908
- job.flags &= ~4;
9943
+ effect.flags &= -33;
9944
+ job.flags &= -5;
9909
9945
  }
9910
9946
  }
9911
9947
  function needTransition(parentSuspense, transition) {
@@ -9929,9 +9965,12 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9929
9965
  if (c2.type === Text) {
9930
9966
  c2.el = c1.el;
9931
9967
  }
9932
- if (!!(process.env.NODE_ENV !== "production") && c2.type === Comment && !c2.el) {
9968
+ if (c2.type === Comment && !c2.el) {
9933
9969
  c2.el = c1.el;
9934
9970
  }
9971
+ if (!!(process.env.NODE_ENV !== "production")) {
9972
+ c2.el && (c2.el.__vnode = c2);
9973
+ }
9935
9974
  }
9936
9975
  }
9937
9976
  }
@@ -11362,8 +11401,8 @@ function isSameVNodeType(n1, n2) {
11362
11401
  if (!!(process.env.NODE_ENV !== "production") && n2.shapeFlag & 6 && n1.component) {
11363
11402
  const dirtyInstances = hmrDirtyComponents.get(n2.type);
11364
11403
  if (dirtyInstances && dirtyInstances.has(n1.component)) {
11365
- n1.shapeFlag &= ~256;
11366
- n2.shapeFlag &= ~512;
11404
+ n1.shapeFlag &= -257;
11405
+ n2.shapeFlag &= -513;
11367
11406
  return false;
11368
11407
  }
11369
11408
  }
@@ -11836,7 +11875,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
11836
11875
  const { props, children } = instance.vnode;
11837
11876
  const isStateful = isStatefulComponent(instance);
11838
11877
  initProps(instance, props, isStateful, isSSR);
11839
- initSlots(instance, children, optimized);
11878
+ initSlots(instance, children, optimized || isSSR);
11840
11879
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
11841
11880
  isSSR && setInSSRSetupState(false);
11842
11881
  return setupResult;
@@ -12191,13 +12230,15 @@ function initCustomFormatter() {
12191
12230
  if (obj.__isVue) {
12192
12231
  return ["div", vueStyle, `VueInstance`];
12193
12232
  } else if (isRef(obj)) {
12233
+ pauseTracking();
12234
+ const value = obj.value;
12235
+ resetTracking();
12194
12236
  return [
12195
12237
  "div",
12196
12238
  {},
12197
12239
  ["span", vueStyle, genRefFlag(obj)],
12198
12240
  "<",
12199
- // avoid debugger accessing value affecting behavior
12200
- formatValue("_value" in obj ? obj._value : obj),
12241
+ formatValue(value),
12201
12242
  `>`
12202
12243
  ];
12203
12244
  } else if (isReactive(obj)) {
@@ -12378,7 +12419,7 @@ function isMemoSame(cached, memo) {
12378
12419
  return true;
12379
12420
  }
12380
12421
 
12381
- const version = "3.5.13";
12422
+ const version = "3.5.14";
12382
12423
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12383
12424
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12384
12425
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -13284,7 +13325,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
13284
13325
  }
13285
13326
  return false;
13286
13327
  }
13287
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
13328
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13288
13329
  return false;
13289
13330
  }
13290
13331
  if (key === "form") {
@@ -13776,6 +13817,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13776
13817
  instance.vnode.el,
13777
13818
  moveClass
13778
13819
  )) {
13820
+ prevChildren = [];
13779
13821
  return;
13780
13822
  }
13781
13823
  prevChildren.forEach(callPendingCbs);
@@ -13799,6 +13841,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13799
13841
  };
13800
13842
  el.addEventListener("transitionend", cb);
13801
13843
  });
13844
+ prevChildren = [];
13802
13845
  });
13803
13846
  return () => {
13804
13847
  const rawProps = toRaw(props);
@@ -16290,7 +16333,7 @@ const tokenizer = new Tokenizer(stack, {
16290
16333
  "COMPILER_V_BIND_SYNC",
16291
16334
  currentOptions,
16292
16335
  currentProp.loc,
16293
- currentProp.rawName
16336
+ currentProp.arg.loc.source
16294
16337
  )) {
16295
16338
  currentProp.name = "model";
16296
16339
  currentProp.modifiers.splice(syncIndex, 1);
@@ -16866,6 +16909,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16866
16909
  }
16867
16910
  }
16868
16911
  let cachedAsArray = false;
16912
+ const slotCacheKeys = [];
16869
16913
  if (toCache.length === children.length && node.type === 1) {
16870
16914
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
16871
16915
  node.codegenNode.children = getCacheExpression(
@@ -16875,6 +16919,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16875
16919
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
16876
16920
  const slot = getSlotNode(node.codegenNode, "default");
16877
16921
  if (slot) {
16922
+ slotCacheKeys.push(context.cached.length);
16878
16923
  slot.returns = getCacheExpression(
16879
16924
  createArrayExpression(slot.returns)
16880
16925
  );
@@ -16884,6 +16929,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16884
16929
  const slotName = findDir(node, "slot", true);
16885
16930
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
16886
16931
  if (slot) {
16932
+ slotCacheKeys.push(context.cached.length);
16887
16933
  slot.returns = getCacheExpression(
16888
16934
  createArrayExpression(slot.returns)
16889
16935
  );
@@ -16893,9 +16939,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16893
16939
  }
16894
16940
  if (!cachedAsArray) {
16895
16941
  for (const child of toCache) {
16942
+ slotCacheKeys.push(context.cached.length);
16896
16943
  child.codegenNode = context.cache(child.codegenNode);
16897
16944
  }
16898
16945
  }
16946
+ 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) {
16947
+ node.codegenNode.children.properties.push(
16948
+ createObjectProperty(
16949
+ `__`,
16950
+ createSimpleExpression(JSON.stringify(slotCacheKeys), false)
16951
+ )
16952
+ );
16953
+ }
16899
16954
  function getCacheExpression(value) {
16900
16955
  const exp = context.cache(value);
16901
16956
  if (inFor && context.hmr) {
@@ -19599,8 +19654,7 @@ const transformModel$1 = (dir, node, context) => {
19599
19654
  context.onError(createCompilerError(44, exp.loc));
19600
19655
  return createTransformProps();
19601
19656
  }
19602
- const maybeRef = false;
19603
- if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
19657
+ if (!expString.trim() || !isMemberExpression(exp) && true) {
19604
19658
  context.onError(
19605
19659
  createCompilerError(42, exp.loc)
19606
19660
  );