@vue/compat 3.3.5 → 3.3.7

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.
package/dist/vue.cjs.js CHANGED
@@ -678,7 +678,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
678
678
  } else if (key === "length" && isArray(target)) {
679
679
  const newLength = Number(newValue);
680
680
  depsMap.forEach((dep, key2) => {
681
- if (key2 === "length" || key2 >= newLength) {
681
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
682
682
  deps.push(dep);
683
683
  }
684
684
  });
@@ -1774,8 +1774,13 @@ function findInsertionIndex(id) {
1774
1774
  let end = queue.length;
1775
1775
  while (start < end) {
1776
1776
  const middle = start + end >>> 1;
1777
- const middleJobId = getId(queue[middle]);
1778
- middleJobId < id ? start = middle + 1 : end = middle;
1777
+ const middleJob = queue[middle];
1778
+ const middleJobId = getId(middleJob);
1779
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1780
+ start = middle + 1;
1781
+ } else {
1782
+ end = middle;
1783
+ }
1779
1784
  }
1780
1785
  return start;
1781
1786
  }
@@ -3363,14 +3368,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3363
3368
  parentComponent: parentComponent2,
3364
3369
  container: container2
3365
3370
  } = suspense;
3371
+ let delayEnter = false;
3366
3372
  if (suspense.isHydrating) {
3367
3373
  suspense.isHydrating = false;
3368
3374
  } else if (!resume) {
3369
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3375
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3370
3376
  if (delayEnter) {
3371
3377
  activeBranch.transition.afterLeave = () => {
3372
3378
  if (pendingId === suspense.pendingId) {
3373
3379
  move(pendingBranch, container2, anchor2, 0);
3380
+ queuePostFlushCb(effects);
3374
3381
  }
3375
3382
  };
3376
3383
  }
@@ -3396,7 +3403,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3396
3403
  }
3397
3404
  parent = parent.parent;
3398
3405
  }
3399
- if (!hasUnresolvedAncestor) {
3406
+ if (!hasUnresolvedAncestor && !delayEnter) {
3400
3407
  queuePostFlushCb(effects);
3401
3408
  }
3402
3409
  suspense.effects = [];
@@ -5051,7 +5058,7 @@ function defineLegacyVNodeProperties(vnode) {
5051
5058
  }
5052
5059
  }
5053
5060
 
5054
- const normalizedFunctionalComponentMap = /* @__PURE__ */ new Map();
5061
+ const normalizedFunctionalComponentMap = /* @__PURE__ */ new WeakMap();
5055
5062
  const legacySlotProxyHandlers = {
5056
5063
  get(target, key) {
5057
5064
  const slot = target[key];
@@ -6347,7 +6354,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6347
6354
  return vm;
6348
6355
  }
6349
6356
  }
6350
- Vue.version = `2.6.14-compat:${"3.3.5"}`;
6357
+ Vue.version = `2.6.14-compat:${"3.3.7"}`;
6351
6358
  Vue.config = singletonApp.config;
6352
6359
  Vue.use = (p, ...options) => {
6353
6360
  if (p && isFunction(p.install)) {
@@ -6760,7 +6767,7 @@ function createAppAPI(render, hydrate) {
6760
6767
  }
6761
6768
  });
6762
6769
  }
6763
- const installedPlugins = /* @__PURE__ */ new Set();
6770
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
6764
6771
  let isMounted = false;
6765
6772
  const app = context.app = {
6766
6773
  _uid: uid$1++,
@@ -7501,7 +7508,7 @@ const updateSlots = (instance, children, optimized) => {
7501
7508
  }
7502
7509
  if (needDeletionCheck) {
7503
7510
  for (const key in slots) {
7504
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7511
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
7505
7512
  delete slots[key];
7506
7513
  }
7507
7514
  }
@@ -7677,7 +7684,14 @@ function createHydrationFunctions(rendererInternals) {
7677
7684
  break;
7678
7685
  case Comment:
7679
7686
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7680
- nextNode = onMismatch();
7687
+ if (node.tagName.toLowerCase() === "template") {
7688
+ const content = vnode.el.content.firstChild;
7689
+ replaceNode(content, node, parentComponent);
7690
+ vnode.el = node = content;
7691
+ nextNode = nextSibling(node);
7692
+ } else {
7693
+ nextNode = onMismatch();
7694
+ }
7681
7695
  } else {
7682
7696
  nextNode = nextSibling(node);
7683
7697
  }
@@ -7719,7 +7733,7 @@ function createHydrationFunctions(rendererInternals) {
7719
7733
  break;
7720
7734
  default:
7721
7735
  if (shapeFlag & 1) {
7722
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7736
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7723
7737
  nextNode = onMismatch();
7724
7738
  } else {
7725
7739
  nextNode = hydrateElement(
@@ -7734,6 +7748,13 @@ function createHydrationFunctions(rendererInternals) {
7734
7748
  } else if (shapeFlag & 6) {
7735
7749
  vnode.slotScopeIds = slotScopeIds;
7736
7750
  const container = parentNode(node);
7751
+ if (isFragmentStart) {
7752
+ nextNode = locateClosingAnchor(node);
7753
+ } else if (isComment(node) && node.data === "teleport start") {
7754
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7755
+ } else {
7756
+ nextNode = nextSibling(node);
7757
+ }
7737
7758
  mountComponent(
7738
7759
  vnode,
7739
7760
  container,
@@ -7743,10 +7764,6 @@ function createHydrationFunctions(rendererInternals) {
7743
7764
  isSVGContainer(container),
7744
7765
  optimized
7745
7766
  );
7746
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7747
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7748
- nextNode = nextSibling(nextNode);
7749
- }
7750
7767
  if (isAsyncWrapper(vnode)) {
7751
7768
  let subTree;
7752
7769
  if (isFragmentStart) {
@@ -7796,7 +7813,7 @@ function createHydrationFunctions(rendererInternals) {
7796
7813
  };
7797
7814
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7798
7815
  optimized = optimized || !!vnode.dynamicChildren;
7799
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7816
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7800
7817
  const forcePatchValue = type === "input" && dirs || type === "option";
7801
7818
  {
7802
7819
  if (dirs) {
@@ -7833,12 +7850,23 @@ function createHydrationFunctions(rendererInternals) {
7833
7850
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7834
7851
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7835
7852
  }
7853
+ let needCallTransitionHooks = false;
7854
+ if (isTemplateNode(el)) {
7855
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7856
+ const content = el.content.firstChild;
7857
+ if (needCallTransitionHooks) {
7858
+ transition.beforeEnter(content);
7859
+ }
7860
+ replaceNode(content, el, parentComponent);
7861
+ vnode.el = el = content;
7862
+ }
7836
7863
  if (dirs) {
7837
7864
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7838
7865
  }
7839
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7866
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7840
7867
  queueEffectWithSuspense(() => {
7841
7868
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7869
+ needCallTransitionHooks && transition.enter(el);
7842
7870
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7843
7871
  }, parentSuspense);
7844
7872
  }
@@ -7956,7 +7984,7 @@ function createHydrationFunctions(rendererInternals) {
7956
7984
  );
7957
7985
  vnode.el = null;
7958
7986
  if (isFragment) {
7959
- const end = locateClosingAsyncAnchor(node);
7987
+ const end = locateClosingAnchor(node);
7960
7988
  while (true) {
7961
7989
  const next2 = nextSibling(node);
7962
7990
  if (next2 && next2 !== end) {
@@ -7981,14 +8009,14 @@ function createHydrationFunctions(rendererInternals) {
7981
8009
  );
7982
8010
  return next;
7983
8011
  };
7984
- const locateClosingAsyncAnchor = (node) => {
8012
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7985
8013
  let match = 0;
7986
8014
  while (node) {
7987
8015
  node = nextSibling(node);
7988
8016
  if (node && isComment(node)) {
7989
- if (node.data === "[")
8017
+ if (node.data === open)
7990
8018
  match++;
7991
- if (node.data === "]") {
8019
+ if (node.data === close) {
7992
8020
  if (match === 0) {
7993
8021
  return nextSibling(node);
7994
8022
  } else {
@@ -7999,6 +8027,23 @@ function createHydrationFunctions(rendererInternals) {
7999
8027
  }
8000
8028
  return node;
8001
8029
  };
8030
+ const replaceNode = (newNode, oldNode, parentComponent) => {
8031
+ const parentNode2 = oldNode.parentNode;
8032
+ if (parentNode2) {
8033
+ parentNode2.replaceChild(newNode, oldNode);
8034
+ }
8035
+ let parent = parentComponent;
8036
+ while (parent) {
8037
+ if (parent.vnode.el === oldNode) {
8038
+ parent.vnode.el = newNode;
8039
+ parent.subTree.el = newNode;
8040
+ }
8041
+ parent = parent.parent;
8042
+ }
8043
+ };
8044
+ const isTemplateNode = (node) => {
8045
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
8046
+ };
8002
8047
  return [hydrate, hydrateNode];
8003
8048
  }
8004
8049
 
@@ -8326,7 +8371,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8326
8371
  if (dirs) {
8327
8372
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8328
8373
  }
8329
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8374
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8330
8375
  if (needCallTransitionHooks) {
8331
8376
  transition.beforeEnter(el);
8332
8377
  }
@@ -9243,8 +9288,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9243
9288
  moveStaticNode(vnode, container, anchor);
9244
9289
  return;
9245
9290
  }
9246
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9247
- if (needTransition) {
9291
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9292
+ if (needTransition2) {
9248
9293
  if (moveType === 0) {
9249
9294
  transition.beforeEnter(el);
9250
9295
  hostInsert(el, container, anchor);
@@ -9473,6 +9518,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9473
9518
  function toggleRecurse({ effect, update }, allowed) {
9474
9519
  effect.allowRecurse = update.allowRecurse = allowed;
9475
9520
  }
9521
+ function needTransition(parentSuspense, transition) {
9522
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9523
+ }
9476
9524
  function traverseStaticChildren(n1, n2, shallow = false) {
9477
9525
  const ch1 = n1.children;
9478
9526
  const ch2 = n2.children;
@@ -9698,19 +9746,18 @@ const TeleportImpl = {
9698
9746
  if (target) {
9699
9747
  hostRemove(targetAnchor);
9700
9748
  }
9701
- if (doRemove || !isTeleportDisabled(props)) {
9702
- hostRemove(anchor);
9703
- if (shapeFlag & 16) {
9704
- for (let i = 0; i < children.length; i++) {
9705
- const child = children[i];
9706
- unmount(
9707
- child,
9708
- parentComponent,
9709
- parentSuspense,
9710
- true,
9711
- !!child.dynamicChildren
9712
- );
9713
- }
9749
+ doRemove && hostRemove(anchor);
9750
+ if (shapeFlag & 16) {
9751
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
9752
+ for (let i = 0; i < children.length; i++) {
9753
+ const child = children[i];
9754
+ unmount(
9755
+ child,
9756
+ parentComponent,
9757
+ parentSuspense,
9758
+ shouldRemove,
9759
+ !!child.dynamicChildren
9760
+ );
9714
9761
  }
9715
9762
  }
9716
9763
  },
@@ -9794,7 +9841,7 @@ function updateCssVars(vnode) {
9794
9841
  const ctx = vnode.ctx;
9795
9842
  if (ctx && ctx.ut) {
9796
9843
  let node = vnode.children[0].el;
9797
- while (node !== vnode.targetAnchor) {
9844
+ while (node && node !== vnode.targetAnchor) {
9798
9845
  if (node.nodeType === 1)
9799
9846
  node.setAttribute("data-v-owner", ctx.uid);
9800
9847
  node = node.nextSibling;
@@ -9803,7 +9850,7 @@ function updateCssVars(vnode) {
9803
9850
  }
9804
9851
  }
9805
9852
 
9806
- const normalizedAsyncComponentMap = /* @__PURE__ */ new Map();
9853
+ const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
9807
9854
  function convertLegacyAsyncComponent(comp) {
9808
9855
  if (normalizedAsyncComponentMap.has(comp)) {
9809
9856
  return normalizedAsyncComponentMap.get(comp);
@@ -10894,7 +10941,7 @@ function isMemoSame(cached, memo) {
10894
10941
  return true;
10895
10942
  }
10896
10943
 
10897
- const version = "3.3.5";
10944
+ const version = "3.3.7";
10898
10945
  const _ssrUtils = {
10899
10946
  createComponentInstance,
10900
10947
  setupComponent,
@@ -14169,9 +14216,13 @@ function walk(node, context, doNotHoistNode = false) {
14169
14216
  context.transformHoist(children, context, node);
14170
14217
  }
14171
14218
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14172
- node.codegenNode.children = context.hoist(
14219
+ const hoisted = context.hoist(
14173
14220
  createArrayExpression(node.codegenNode.children)
14174
14221
  );
14222
+ if (context.hmr) {
14223
+ hoisted.content = `[...${hoisted.content}]`;
14224
+ }
14225
+ node.codegenNode.children = hoisted;
14175
14226
  }
14176
14227
  }
14177
14228
  function getConstantType(node, context) {
@@ -14344,6 +14395,7 @@ function createTransformContext(root, {
14344
14395
  filename = "",
14345
14396
  prefixIdentifiers = false,
14346
14397
  hoistStatic: hoistStatic2 = false,
14398
+ hmr = false,
14347
14399
  cacheHandlers = false,
14348
14400
  nodeTransforms = [],
14349
14401
  directiveTransforms = {},
@@ -14369,6 +14421,7 @@ function createTransformContext(root, {
14369
14421
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14370
14422
  prefixIdentifiers,
14371
14423
  hoistStatic: hoistStatic2,
14424
+ hmr,
14372
14425
  cacheHandlers,
14373
14426
  nodeTransforms,
14374
14427
  directiveTransforms,
@@ -14394,7 +14447,7 @@ function createTransformContext(root, {
14394
14447
  directives: /* @__PURE__ */ new Set(),
14395
14448
  hoists: [],
14396
14449
  imports: [],
14397
- constantCache: /* @__PURE__ */ new Map(),
14450
+ constantCache: /* @__PURE__ */ new WeakMap(),
14398
14451
  temps: 0,
14399
14452
  cached: 0,
14400
14453
  identifiers: /* @__PURE__ */ Object.create(null),
@@ -16413,7 +16466,7 @@ const trackVForSlotScopes = (node, context) => {
16413
16466
  }
16414
16467
  }
16415
16468
  };
16416
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
16469
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
16417
16470
  props,
16418
16471
  children,
16419
16472
  false,
@@ -16438,7 +16491,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16438
16491
  slotsProperties.push(
16439
16492
  createObjectProperty(
16440
16493
  arg || createSimpleExpression("default", true),
16441
- buildSlotFn(exp, children, loc)
16494
+ buildSlotFn(exp, void 0, children, loc)
16442
16495
  )
16443
16496
  );
16444
16497
  }
@@ -16475,10 +16528,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16475
16528
  } else {
16476
16529
  hasDynamicSlots = true;
16477
16530
  }
16478
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
16531
+ const vFor = findDir(slotElement, "for");
16532
+ const slotFunction = buildSlotFn(
16533
+ slotProps,
16534
+ vFor == null ? void 0 : vFor.exp,
16535
+ slotChildren,
16536
+ slotLoc
16537
+ );
16479
16538
  let vIf;
16480
16539
  let vElse;
16481
- let vFor;
16482
16540
  if (vIf = findDir(slotElement, "if")) {
16483
16541
  hasDynamicSlots = true;
16484
16542
  dynamicSlots.push(
@@ -16523,7 +16581,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16523
16581
  createCompilerError(30, vElse.loc)
16524
16582
  );
16525
16583
  }
16526
- } else if (vFor = findDir(slotElement, "for")) {
16584
+ } else if (vFor) {
16527
16585
  hasDynamicSlots = true;
16528
16586
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
16529
16587
  if (parseResult) {
@@ -16564,7 +16622,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16564
16622
  }
16565
16623
  if (!onComponentSlot) {
16566
16624
  const buildDefaultSlotProperty = (props, children2) => {
16567
- const fn = buildSlotFn(props, children2, loc);
16625
+ const fn = buildSlotFn(props, void 0, children2, loc);
16568
16626
  if (context.compatConfig) {
16569
16627
  fn.isNonScopedSlot = true;
16570
16628
  }