@vue/compat 3.5.33 → 3.5.35

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.33
2
+ * @vue/compat v3.5.35
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -427,12 +427,18 @@ class EffectScope {
427
427
  */
428
428
  this.cleanups = [];
429
429
  this._isPaused = false;
430
+ this._warnOnRun = true;
430
431
  this.__v_skip = true;
431
- this.parent = activeEffectScope;
432
432
  if (!detached && activeEffectScope) {
433
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
434
- this
435
- ) - 1;
433
+ if (activeEffectScope.active) {
434
+ this.parent = activeEffectScope;
435
+ this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
436
+ this
437
+ ) - 1;
438
+ } else {
439
+ this._active = false;
440
+ this._warnOnRun = false;
441
+ }
436
442
  }
437
443
  }
438
444
  get active() {
@@ -480,7 +486,7 @@ class EffectScope {
480
486
  } finally {
481
487
  activeEffectScope = currentEffectScope;
482
488
  }
483
- } else {
489
+ } else if (this._warnOnRun) {
484
490
  warn$2(`cannot run an inactive effect scope.`);
485
491
  }
486
492
  }
@@ -586,8 +592,12 @@ class ReactiveEffect {
586
592
  */
587
593
  this.cleanup = void 0;
588
594
  this.scheduler = void 0;
589
- if (activeEffectScope && activeEffectScope.active) {
590
- activeEffectScope.effects.push(this);
595
+ if (activeEffectScope) {
596
+ if (activeEffectScope.active) {
597
+ activeEffectScope.effects.push(this);
598
+ } else {
599
+ this.flags &= -2;
600
+ }
591
601
  }
592
602
  }
593
603
  pause() {
@@ -1735,9 +1745,6 @@ function targetTypeMap(rawType) {
1735
1745
  return 0 /* INVALID */;
1736
1746
  }
1737
1747
  }
1738
- function getTargetType(value) {
1739
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
1740
- }
1741
1748
  // @__NO_SIDE_EFFECTS__
1742
1749
  function reactive(target) {
1743
1750
  if (/* @__PURE__ */ isReadonly(target)) {
@@ -1795,14 +1802,17 @@ function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandl
1795
1802
  if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
1796
1803
  return target;
1797
1804
  }
1798
- const targetType = getTargetType(target);
1799
- if (targetType === 0 /* INVALID */) {
1805
+ if (target["__v_skip"] || !Object.isExtensible(target)) {
1800
1806
  return target;
1801
1807
  }
1802
1808
  const existingProxy = proxyMap.get(target);
1803
1809
  if (existingProxy) {
1804
1810
  return existingProxy;
1805
1811
  }
1812
+ const targetType = targetTypeMap(toRawType(target));
1813
+ if (targetType === 0 /* INVALID */) {
1814
+ return target;
1815
+ }
1806
1816
  const proxy = new Proxy(
1807
1817
  target,
1808
1818
  targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
@@ -3954,19 +3964,18 @@ const TeleportImpl = {
3954
3964
  target,
3955
3965
  props
3956
3966
  } = vnode;
3957
- let shouldRemove = doRemove || !isTeleportDisabled(props);
3967
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
3958
3968
  const pendingMount = pendingMounts.get(vnode);
3959
3969
  if (pendingMount) {
3960
3970
  pendingMount.flags |= 8;
3961
3971
  pendingMounts.delete(vnode);
3962
- shouldRemove = false;
3963
3972
  }
3964
3973
  if (target) {
3965
3974
  hostRemove(targetStart);
3966
3975
  hostRemove(targetAnchor);
3967
3976
  }
3968
3977
  doRemove && hostRemove(anchor);
3969
- if (shapeFlag & 16) {
3978
+ if (!pendingMount && shapeFlag & 16) {
3970
3979
  for (let i = 0; i < children.length; i++) {
3971
3980
  const child = children[i];
3972
3981
  unmount(
@@ -4937,20 +4946,16 @@ function createHydrationFunctions(rendererInternals) {
4937
4946
  slotScopeIds,
4938
4947
  optimized
4939
4948
  );
4940
- let hasWarned = false;
4941
- while (next) {
4942
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4943
- if (!hasWarned) {
4944
- warn$1(
4945
- `Hydration children mismatch on`,
4946
- el,
4947
- `
4949
+ if (next && !isMismatchAllowed(el, 1 /* CHILDREN */)) {
4950
+ warn$1(
4951
+ `Hydration children mismatch on`,
4952
+ el,
4953
+ `
4948
4954
  Server rendered element contains more child nodes than client vdom.`
4949
- );
4950
- hasWarned = true;
4951
- }
4952
- logMismatchError();
4953
- }
4955
+ );
4956
+ logMismatchError();
4957
+ }
4958
+ while (next) {
4954
4959
  const cur = next;
4955
4960
  next = next.nextSibling;
4956
4961
  remove(cur);
@@ -5013,7 +5018,7 @@ Server rendered element contains more child nodes than client vdom.`
5013
5018
  optimized = optimized || !!parentVNode.dynamicChildren;
5014
5019
  const children = parentVNode.children;
5015
5020
  const l = children.length;
5016
- let hasWarned = false;
5021
+ let hasCheckedMismatch = false;
5017
5022
  for (let i = 0; i < l; i++) {
5018
5023
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
5019
5024
  const isText = vnode.type === Text;
@@ -5041,17 +5046,17 @@ Server rendered element contains more child nodes than client vdom.`
5041
5046
  } else if (isText && !vnode.children) {
5042
5047
  insert(vnode.el = createText(""), container);
5043
5048
  } else {
5044
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5045
- if (!hasWarned) {
5049
+ if (!hasCheckedMismatch) {
5050
+ hasCheckedMismatch = true;
5051
+ if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5046
5052
  warn$1(
5047
5053
  `Hydration children mismatch on`,
5048
5054
  container,
5049
5055
  `
5050
5056
  Server rendered element contains fewer child nodes than client vdom.`
5051
5057
  );
5052
- hasWarned = true;
5058
+ logMismatchError();
5053
5059
  }
5054
- logMismatchError();
5055
5060
  }
5056
5061
  patch(
5057
5062
  null,
@@ -7537,7 +7542,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7537
7542
  return vm;
7538
7543
  }
7539
7544
  }
7540
- Vue.version = `2.6.14-compat:${"3.5.33"}`;
7545
+ Vue.version = `2.6.14-compat:${"3.5.35"}`;
7541
7546
  Vue.config = singletonApp.config;
7542
7547
  Vue.use = (plugin, ...options) => {
7543
7548
  if (plugin && isFunction(plugin.install)) {
@@ -9172,7 +9177,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9172
9177
  const receivedType = toRawType(value);
9173
9178
  const expectedValue = styleValue(value, expectedType);
9174
9179
  const receivedValue = styleValue(value, receivedType);
9175
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
9180
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) {
9176
9181
  message += ` with value ${expectedValue}`;
9177
9182
  }
9178
9183
  message += `, got ${receivedType} `;
@@ -9182,7 +9187,9 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
9182
9187
  return message;
9183
9188
  }
9184
9189
  function styleValue(value, type) {
9185
- if (type === "String") {
9190
+ if (isSymbol(value)) {
9191
+ return value.toString();
9192
+ } else if (type === "String") {
9186
9193
  return `"${value}"`;
9187
9194
  } else if (type === "Number") {
9188
9195
  return `${Number(value)}`;
@@ -9194,8 +9201,11 @@ function isExplicable(type) {
9194
9201
  const explicitTypes = ["string", "number", "boolean"];
9195
9202
  return explicitTypes.some((elem) => type.toLowerCase() === elem);
9196
9203
  }
9197
- function isBoolean(...args) {
9198
- return args.some((elem) => elem.toLowerCase() === "boolean");
9204
+ function isCoercible(...args) {
9205
+ return args.every((elem) => {
9206
+ const value = elem.toLowerCase();
9207
+ return value !== "boolean" && value !== "symbol";
9208
+ });
9199
9209
  }
9200
9210
 
9201
9211
  const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
@@ -10538,9 +10548,13 @@ function baseCreateRenderer(options, createHydrationFns) {
10538
10548
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10539
10549
  if (needTransition2) {
10540
10550
  if (moveType === 0) {
10541
- transition.beforeEnter(el);
10542
- hostInsert(el, container, anchor);
10543
- queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10551
+ if (transition.persisted && !el[leaveCbKey]) {
10552
+ hostInsert(el, container, anchor);
10553
+ } else {
10554
+ transition.beforeEnter(el);
10555
+ hostInsert(el, container, anchor);
10556
+ queuePostRenderEffect(() => transition.enter(el), parentSuspense);
10557
+ }
10544
10558
  } else {
10545
10559
  const { leave, delayLeave, afterLeave } = transition;
10546
10560
  const remove2 = () => {
@@ -10551,16 +10565,21 @@ function baseCreateRenderer(options, createHydrationFns) {
10551
10565
  }
10552
10566
  };
10553
10567
  const performLeave = () => {
10568
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
10554
10569
  if (el._isLeaving) {
10555
10570
  el[leaveCbKey](
10556
10571
  true
10557
10572
  /* cancelled */
10558
10573
  );
10559
10574
  }
10560
- leave(el, () => {
10575
+ if (transition.persisted && !wasLeaving) {
10561
10576
  remove2();
10562
- afterLeave && afterLeave();
10563
- });
10577
+ } else {
10578
+ leave(el, () => {
10579
+ remove2();
10580
+ afterLeave && afterLeave();
10581
+ });
10582
+ }
10564
10583
  };
10565
10584
  if (delayLeave) {
10566
10585
  delayLeave(el, remove2, performLeave);
@@ -11249,13 +11268,14 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11249
11268
  suspense.isHydrating = false;
11250
11269
  } else if (!resume) {
11251
11270
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
11271
+ let hasUpdatedAnchor = false;
11252
11272
  if (delayEnter) {
11253
11273
  activeBranch.transition.afterLeave = () => {
11254
11274
  if (pendingId === suspense.pendingId) {
11255
11275
  move(
11256
11276
  pendingBranch,
11257
11277
  container2,
11258
- anchor === initialAnchor ? next(activeBranch) : anchor,
11278
+ anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor,
11259
11279
  0
11260
11280
  );
11261
11281
  queuePostFlushCb(effects);
@@ -11268,6 +11288,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11268
11288
  if (activeBranch && !suspense.isFallbackMountPending) {
11269
11289
  if (parentNode(activeBranch.el) === container2) {
11270
11290
  anchor = next(activeBranch);
11291
+ hasUpdatedAnchor = true;
11271
11292
  }
11272
11293
  unmount(activeBranch, parentComponent2, suspense, true);
11273
11294
  if (!delayEnter && isInFallback && vnode2.ssFallback) {
@@ -12653,7 +12674,7 @@ function isMemoSame(cached, memo) {
12653
12674
  return true;
12654
12675
  }
12655
12676
 
12656
- const version = "3.5.33";
12677
+ const version = "3.5.35";
12657
12678
  const warn = warn$1 ;
12658
12679
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12659
12680
  const devtools = devtools$1 ;
@@ -13498,12 +13519,37 @@ function createInvoker(initialValue, instance) {
13498
13519
  } else if (e._vts <= invoker.attached) {
13499
13520
  return;
13500
13521
  }
13501
- callWithAsyncErrorHandling(
13502
- patchStopImmediatePropagation(e, invoker.value),
13503
- instance,
13504
- 5,
13505
- [e]
13506
- );
13522
+ const value = invoker.value;
13523
+ if (isArray(value)) {
13524
+ const originalStop = e.stopImmediatePropagation;
13525
+ e.stopImmediatePropagation = () => {
13526
+ originalStop.call(e);
13527
+ e._stopped = true;
13528
+ };
13529
+ const handlers = value.slice();
13530
+ const args = [e];
13531
+ for (let i = 0; i < handlers.length; i++) {
13532
+ if (e._stopped) {
13533
+ break;
13534
+ }
13535
+ const handler = handlers[i];
13536
+ if (handler) {
13537
+ callWithAsyncErrorHandling(
13538
+ handler,
13539
+ instance,
13540
+ 5,
13541
+ args
13542
+ );
13543
+ }
13544
+ }
13545
+ } else {
13546
+ callWithAsyncErrorHandling(
13547
+ value,
13548
+ instance,
13549
+ 5,
13550
+ [e]
13551
+ );
13552
+ }
13507
13553
  };
13508
13554
  invoker.value = initialValue;
13509
13555
  invoker.attached = getNow();
@@ -13519,20 +13565,6 @@ Expected function or array of functions, received type ${typeof value}.`
13519
13565
  );
13520
13566
  return NOOP;
13521
13567
  }
13522
- function patchStopImmediatePropagation(e, value) {
13523
- if (isArray(value)) {
13524
- const originalStop = e.stopImmediatePropagation;
13525
- e.stopImmediatePropagation = () => {
13526
- originalStop.call(e);
13527
- e._stopped = true;
13528
- };
13529
- return value.map(
13530
- (fn) => (e2) => !e2._stopped && fn && fn(e2)
13531
- );
13532
- } else {
13533
- return value;
13534
- }
13535
- }
13536
13568
 
13537
13569
  const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
13538
13570
  key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
@@ -18706,7 +18738,7 @@ const transformFor = createStructuralDirectiveTransform(
18706
18738
  const keyProp = findProp(node, `key`, false, true);
18707
18739
  keyProp && keyProp.type === 7;
18708
18740
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18709
- const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18741
+ const keyProperty = keyExp ? createObjectProperty(`key`, keyExp) : null;
18710
18742
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
18711
18743
  const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
18712
18744
  forNode.codegenNode = createVNodeCall(