@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
  }
@@ -1704,14 +1714,14 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1704
1714
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1705
1715
  return target;
1706
1716
  }
1707
- const existingProxy = proxyMap.get(target);
1708
- if (existingProxy) {
1709
- return existingProxy;
1710
- }
1711
1717
  const targetType = getTargetType(target);
1712
1718
  if (targetType === 0 /* INVALID */) {
1713
1719
  return target;
1714
1720
  }
1721
+ const existingProxy = proxyMap.get(target);
1722
+ if (existingProxy) {
1723
+ return existingProxy;
1724
+ }
1715
1725
  const proxy = new Proxy(
1716
1726
  target,
1717
1727
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -2555,11 +2565,11 @@ function flushPreFlushCbs(instance, seen, i = flushIndex + 1) {
2555
2565
  queue.splice(i, 1);
2556
2566
  i--;
2557
2567
  if (cb.flags & 4) {
2558
- cb.flags &= ~1;
2568
+ cb.flags &= -2;
2559
2569
  }
2560
2570
  cb();
2561
2571
  if (!(cb.flags & 4)) {
2562
- cb.flags &= ~1;
2572
+ cb.flags &= -2;
2563
2573
  }
2564
2574
  }
2565
2575
  }
@@ -2584,10 +2594,10 @@ function flushPostFlushCbs(seen) {
2584
2594
  continue;
2585
2595
  }
2586
2596
  if (cb.flags & 4) {
2587
- cb.flags &= ~1;
2597
+ cb.flags &= -2;
2588
2598
  }
2589
2599
  if (!(cb.flags & 8)) cb();
2590
- cb.flags &= ~1;
2600
+ cb.flags &= -2;
2591
2601
  }
2592
2602
  activePostFlushCbs = null;
2593
2603
  postFlushIndex = 0;
@@ -2623,7 +2633,7 @@ function flushJobs(seen) {
2623
2633
  for (; flushIndex < queue.length; flushIndex++) {
2624
2634
  const job = queue[flushIndex];
2625
2635
  if (job) {
2626
- job.flags &= ~1;
2636
+ job.flags &= -2;
2627
2637
  }
2628
2638
  }
2629
2639
  flushIndex = -1;
@@ -3640,7 +3650,7 @@ const TeleportImpl = {
3640
3650
  namespace,
3641
3651
  slotScopeIds
3642
3652
  );
3643
- traverseStaticChildren(n1, n2, true);
3653
+ traverseStaticChildren(n1, n2, false);
3644
3654
  } else if (!optimized) {
3645
3655
  patchChildren(
3646
3656
  n1,
@@ -5328,6 +5338,9 @@ const KeepAliveImpl = {
5328
5338
  {
5329
5339
  devtoolsComponentAdded(instance2);
5330
5340
  }
5341
+ {
5342
+ instance2.__keepAliveStorageContainer = storageContainer;
5343
+ }
5331
5344
  };
5332
5345
  function unmount(vnode) {
5333
5346
  resetShapeFlag(vnode);
@@ -5415,7 +5428,7 @@ const KeepAliveImpl = {
5415
5428
  );
5416
5429
  const { include, exclude, max } = props;
5417
5430
  if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
5418
- vnode.shapeFlag &= ~256;
5431
+ vnode.shapeFlag &= -257;
5419
5432
  current = vnode;
5420
5433
  return rawVNode;
5421
5434
  }
@@ -5506,8 +5519,8 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5506
5519
  }, target);
5507
5520
  }
5508
5521
  function resetShapeFlag(vnode) {
5509
- vnode.shapeFlag &= ~256;
5510
- vnode.shapeFlag &= ~512;
5522
+ vnode.shapeFlag &= -257;
5523
+ vnode.shapeFlag &= -513;
5511
5524
  }
5512
5525
  function getInnerChild(vnode) {
5513
5526
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
@@ -5909,14 +5922,16 @@ function renderList(source, renderItem, cache, index) {
5909
5922
  if (sourceIsArray || isString(source)) {
5910
5923
  const sourceIsReactiveArray = sourceIsArray && isReactive(source);
5911
5924
  let needsWrap = false;
5925
+ let isReadonlySource = false;
5912
5926
  if (sourceIsReactiveArray) {
5913
5927
  needsWrap = !isShallow(source);
5928
+ isReadonlySource = isReadonly(source);
5914
5929
  source = shallowReadArray(source);
5915
5930
  }
5916
5931
  ret = new Array(source.length);
5917
5932
  for (let i = 0, l = source.length; i < l; i++) {
5918
5933
  ret[i] = renderItem(
5919
- needsWrap ? toReactive(source[i]) : source[i],
5934
+ needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],
5920
5935
  i,
5921
5936
  void 0,
5922
5937
  cached && cached[i]
@@ -7168,7 +7183,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7168
7183
  return vm;
7169
7184
  }
7170
7185
  }
7171
- Vue.version = `2.6.14-compat:${"3.5.13"}`;
7186
+ Vue.version = `2.6.14-compat:${"3.5.14"}`;
7172
7187
  Vue.config = singletonApp.config;
7173
7188
  Vue.use = (plugin, ...options) => {
7174
7189
  if (plugin && isFunction(plugin.install)) {
@@ -7662,11 +7677,9 @@ function createAppAPI(render, hydrate) {
7662
7677
  }
7663
7678
  {
7664
7679
  context.reload = () => {
7665
- render(
7666
- cloneVNode(vnode),
7667
- rootContainer,
7668
- namespace
7669
- );
7680
+ const cloned = cloneVNode(vnode);
7681
+ cloned.el = null;
7682
+ render(cloned, rootContainer, namespace);
7670
7683
  };
7671
7684
  }
7672
7685
  if (isHydrate && hydrate) {
@@ -8264,7 +8277,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
8264
8277
  return rawSlot;
8265
8278
  }
8266
8279
  const normalized = withCtx((...args) => {
8267
- if (currentInstance && (!ctx || ctx.root === currentInstance.root)) {
8280
+ if (currentInstance && !(ctx === null && currentRenderingInstance) && !(ctx && ctx.root !== currentInstance.root)) {
8268
8281
  warn$1(
8269
8282
  `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.`
8270
8283
  );
@@ -8303,7 +8316,7 @@ const normalizeVNodeSlots = (instance, children) => {
8303
8316
  };
8304
8317
  const assignSlots = (slots, children, optimized) => {
8305
8318
  for (const key in children) {
8306
- if (optimized || key !== "_") {
8319
+ if (optimized || !isInternalKey(key)) {
8307
8320
  slots[key] = children[key];
8308
8321
  }
8309
8322
  }
@@ -8990,8 +9003,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8990
9003
  endMeasure(instance, `init`);
8991
9004
  }
8992
9005
  }
9006
+ if (isHmrUpdating) initialVNode.el = null;
8993
9007
  if (instance.asyncDep) {
8994
- if (isHmrUpdating) initialVNode.el = null;
8995
9008
  parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8996
9009
  if (!initialVNode.el) {
8997
9010
  const placeholder = instance.subTree = createVNode(Comment);
@@ -9577,7 +9590,13 @@ function baseCreateRenderer(options, createHydrationFns) {
9577
9590
  queuePostRenderEffect(() => transition.enter(el), parentSuspense);
9578
9591
  } else {
9579
9592
  const { leave, delayLeave, afterLeave } = transition;
9580
- const remove2 = () => hostInsert(el, container, anchor);
9593
+ const remove2 = () => {
9594
+ if (vnode.ctx.isUnmounted) {
9595
+ hostRemove(el);
9596
+ } else {
9597
+ hostInsert(el, container, anchor);
9598
+ }
9599
+ };
9581
9600
  const performLeave = () => {
9582
9601
  leave(el, () => {
9583
9602
  remove2();
@@ -9610,7 +9629,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9610
9629
  optimized = false;
9611
9630
  }
9612
9631
  if (ref != null) {
9632
+ pauseTracking();
9613
9633
  setRef(ref, null, parentSuspense, vnode, true);
9634
+ resetTracking();
9614
9635
  }
9615
9636
  if (cacheIndex != null) {
9616
9637
  parentComponent.renderCache[cacheIndex] = void 0;
@@ -9722,12 +9743,27 @@ function baseCreateRenderer(options, createHydrationFns) {
9722
9743
  if (instance.type.__hmrId) {
9723
9744
  unregisterHMR(instance);
9724
9745
  }
9725
- const { bum, scope, job, subTree, um, m, a } = instance;
9746
+ const {
9747
+ bum,
9748
+ scope,
9749
+ job,
9750
+ subTree,
9751
+ um,
9752
+ m,
9753
+ a,
9754
+ parent,
9755
+ slots: { __: slotCacheKeys }
9756
+ } = instance;
9726
9757
  invalidateMount(m);
9727
9758
  invalidateMount(a);
9728
9759
  if (bum) {
9729
9760
  invokeArrayFns(bum);
9730
9761
  }
9762
+ if (parent && isArray(slotCacheKeys)) {
9763
+ slotCacheKeys.forEach((v) => {
9764
+ parent.renderCache[v] = void 0;
9765
+ });
9766
+ }
9731
9767
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
9732
9768
  instance.emit("hook:beforeDestroy");
9733
9769
  }
@@ -9832,8 +9868,8 @@ function toggleRecurse({ effect, job }, allowed) {
9832
9868
  effect.flags |= 32;
9833
9869
  job.flags |= 4;
9834
9870
  } else {
9835
- effect.flags &= ~32;
9836
- job.flags &= ~4;
9871
+ effect.flags &= -33;
9872
+ job.flags &= -5;
9837
9873
  }
9838
9874
  }
9839
9875
  function needTransition(parentSuspense, transition) {
@@ -9860,6 +9896,9 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9860
9896
  if (c2.type === Comment && !c2.el) {
9861
9897
  c2.el = c1.el;
9862
9898
  }
9899
+ {
9900
+ c2.el && (c2.el.__vnode = c2);
9901
+ }
9863
9902
  }
9864
9903
  }
9865
9904
  }
@@ -11290,8 +11329,8 @@ function isSameVNodeType(n1, n2) {
11290
11329
  if (n2.shapeFlag & 6 && n1.component) {
11291
11330
  const dirtyInstances = hmrDirtyComponents.get(n2.type);
11292
11331
  if (dirtyInstances && dirtyInstances.has(n1.component)) {
11293
- n1.shapeFlag &= ~256;
11294
- n2.shapeFlag &= ~512;
11332
+ n1.shapeFlag &= -257;
11333
+ n2.shapeFlag &= -513;
11295
11334
  return false;
11296
11335
  }
11297
11336
  }
@@ -11762,7 +11801,7 @@ function setupComponent(instance, isSSR = false, optimized = false) {
11762
11801
  const { props, children } = instance.vnode;
11763
11802
  const isStateful = isStatefulComponent(instance);
11764
11803
  initProps(instance, props, isStateful, isSSR);
11765
- initSlots(instance, children, optimized);
11804
+ initSlots(instance, children, optimized || isSSR);
11766
11805
  const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
11767
11806
  isSSR && setInSSRSetupState(false);
11768
11807
  return setupResult;
@@ -12105,13 +12144,15 @@ function initCustomFormatter() {
12105
12144
  if (obj.__isVue) {
12106
12145
  return ["div", vueStyle, `VueInstance`];
12107
12146
  } else if (isRef(obj)) {
12147
+ pauseTracking();
12148
+ const value = obj.value;
12149
+ resetTracking();
12108
12150
  return [
12109
12151
  "div",
12110
12152
  {},
12111
12153
  ["span", vueStyle, genRefFlag(obj)],
12112
12154
  "<",
12113
- // avoid debugger accessing value affecting behavior
12114
- formatValue("_value" in obj ? obj._value : obj),
12155
+ formatValue(value),
12115
12156
  `>`
12116
12157
  ];
12117
12158
  } else if (isReactive(obj)) {
@@ -12292,7 +12333,7 @@ function isMemoSame(cached, memo) {
12292
12333
  return true;
12293
12334
  }
12294
12335
 
12295
- const version = "3.5.13";
12336
+ const version = "3.5.14";
12296
12337
  const warn = warn$1 ;
12297
12338
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12298
12339
  const devtools = devtools$1 ;
@@ -13198,7 +13239,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
13198
13239
  }
13199
13240
  return false;
13200
13241
  }
13201
- if (key === "spellcheck" || key === "draggable" || key === "translate") {
13242
+ if (key === "spellcheck" || key === "draggable" || key === "translate" || key === "autocorrect") {
13202
13243
  return false;
13203
13244
  }
13204
13245
  if (key === "form") {
@@ -13690,6 +13731,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13690
13731
  instance.vnode.el,
13691
13732
  moveClass
13692
13733
  )) {
13734
+ prevChildren = [];
13693
13735
  return;
13694
13736
  }
13695
13737
  prevChildren.forEach(callPendingCbs);
@@ -13713,6 +13755,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13713
13755
  };
13714
13756
  el.addEventListener("transitionend", cb);
13715
13757
  });
13758
+ prevChildren = [];
13716
13759
  });
13717
13760
  return () => {
13718
13761
  const rawProps = toRaw(props);
@@ -16210,7 +16253,7 @@ const tokenizer = new Tokenizer(stack, {
16210
16253
  "COMPILER_V_BIND_SYNC",
16211
16254
  currentOptions,
16212
16255
  currentProp.loc,
16213
- currentProp.rawName
16256
+ currentProp.arg.loc.source
16214
16257
  )) {
16215
16258
  currentProp.name = "model";
16216
16259
  currentProp.modifiers.splice(syncIndex, 1);
@@ -16786,6 +16829,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16786
16829
  }
16787
16830
  }
16788
16831
  let cachedAsArray = false;
16832
+ const slotCacheKeys = [];
16789
16833
  if (toCache.length === children.length && node.type === 1) {
16790
16834
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
16791
16835
  node.codegenNode.children = getCacheExpression(
@@ -16795,6 +16839,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16795
16839
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
16796
16840
  const slot = getSlotNode(node.codegenNode, "default");
16797
16841
  if (slot) {
16842
+ slotCacheKeys.push(context.cached.length);
16798
16843
  slot.returns = getCacheExpression(
16799
16844
  createArrayExpression(slot.returns)
16800
16845
  );
@@ -16804,6 +16849,7 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16804
16849
  const slotName = findDir(node, "slot", true);
16805
16850
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
16806
16851
  if (slot) {
16852
+ slotCacheKeys.push(context.cached.length);
16807
16853
  slot.returns = getCacheExpression(
16808
16854
  createArrayExpression(slot.returns)
16809
16855
  );
@@ -16813,9 +16859,18 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
16813
16859
  }
16814
16860
  if (!cachedAsArray) {
16815
16861
  for (const child of toCache) {
16862
+ slotCacheKeys.push(context.cached.length);
16816
16863
  child.codegenNode = context.cache(child.codegenNode);
16817
16864
  }
16818
16865
  }
16866
+ 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) {
16867
+ node.codegenNode.children.properties.push(
16868
+ createObjectProperty(
16869
+ `__`,
16870
+ createSimpleExpression(JSON.stringify(slotCacheKeys), false)
16871
+ )
16872
+ );
16873
+ }
16819
16874
  function getCacheExpression(value) {
16820
16875
  const exp = context.cache(value);
16821
16876
  if (inFor && context.hmr) {
@@ -19516,8 +19571,7 @@ const transformModel$1 = (dir, node, context) => {
19516
19571
  context.onError(createCompilerError(44, exp.loc));
19517
19572
  return createTransformProps();
19518
19573
  }
19519
- const maybeRef = false;
19520
- if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
19574
+ if (!expString.trim() || !isMemberExpression(exp) && true) {
19521
19575
  context.onError(
19522
19576
  createCompilerError(42, exp.loc)
19523
19577
  );