@vue/compat 3.3.6 → 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.
@@ -605,7 +605,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
605
605
  } else if (key === "length" && isArray(target)) {
606
606
  const newLength = Number(newValue);
607
607
  depsMap.forEach((dep, key2) => {
608
- if (key2 === "length" || key2 >= newLength) {
608
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
609
609
  deps.push(dep);
610
610
  }
611
611
  });
@@ -1701,8 +1701,13 @@ function findInsertionIndex(id) {
1701
1701
  let end = queue.length;
1702
1702
  while (start < end) {
1703
1703
  const middle = start + end >>> 1;
1704
- const middleJobId = getId(queue[middle]);
1705
- middleJobId < id ? start = middle + 1 : end = middle;
1704
+ const middleJob = queue[middle];
1705
+ const middleJobId = getId(middleJob);
1706
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1707
+ start = middle + 1;
1708
+ } else {
1709
+ end = middle;
1710
+ }
1706
1711
  }
1707
1712
  return start;
1708
1713
  }
@@ -3290,14 +3295,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3290
3295
  parentComponent: parentComponent2,
3291
3296
  container: container2
3292
3297
  } = suspense;
3298
+ let delayEnter = false;
3293
3299
  if (suspense.isHydrating) {
3294
3300
  suspense.isHydrating = false;
3295
3301
  } else if (!resume) {
3296
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3302
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3297
3303
  if (delayEnter) {
3298
3304
  activeBranch.transition.afterLeave = () => {
3299
3305
  if (pendingId === suspense.pendingId) {
3300
3306
  move(pendingBranch, container2, anchor2, 0);
3307
+ queuePostFlushCb(effects);
3301
3308
  }
3302
3309
  };
3303
3310
  }
@@ -3323,7 +3330,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3323
3330
  }
3324
3331
  parent = parent.parent;
3325
3332
  }
3326
- if (!hasUnresolvedAncestor) {
3333
+ if (!hasUnresolvedAncestor && !delayEnter) {
3327
3334
  queuePostFlushCb(effects);
3328
3335
  }
3329
3336
  suspense.effects = [];
@@ -6247,7 +6254,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6247
6254
  return vm;
6248
6255
  }
6249
6256
  }
6250
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6257
+ Vue.version = `2.6.14-compat:${"3.3.7"}`;
6251
6258
  Vue.config = singletonApp.config;
6252
6259
  Vue.use = (p, ...options) => {
6253
6260
  if (p && isFunction(p.install)) {
@@ -7577,7 +7584,14 @@ function createHydrationFunctions(rendererInternals) {
7577
7584
  break;
7578
7585
  case Comment:
7579
7586
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7580
- nextNode = onMismatch();
7587
+ if (node.tagName.toLowerCase() === "template") {
7588
+ const content = vnode.el.content.firstChild;
7589
+ replaceNode(content, node, parentComponent);
7590
+ vnode.el = node = content;
7591
+ nextNode = nextSibling(node);
7592
+ } else {
7593
+ nextNode = onMismatch();
7594
+ }
7581
7595
  } else {
7582
7596
  nextNode = nextSibling(node);
7583
7597
  }
@@ -7619,7 +7633,7 @@ function createHydrationFunctions(rendererInternals) {
7619
7633
  break;
7620
7634
  default:
7621
7635
  if (shapeFlag & 1) {
7622
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7636
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7623
7637
  nextNode = onMismatch();
7624
7638
  } else {
7625
7639
  nextNode = hydrateElement(
@@ -7634,6 +7648,13 @@ function createHydrationFunctions(rendererInternals) {
7634
7648
  } else if (shapeFlag & 6) {
7635
7649
  vnode.slotScopeIds = slotScopeIds;
7636
7650
  const container = parentNode(node);
7651
+ if (isFragmentStart) {
7652
+ nextNode = locateClosingAnchor(node);
7653
+ } else if (isComment(node) && node.data === "teleport start") {
7654
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7655
+ } else {
7656
+ nextNode = nextSibling(node);
7657
+ }
7637
7658
  mountComponent(
7638
7659
  vnode,
7639
7660
  container,
@@ -7643,10 +7664,6 @@ function createHydrationFunctions(rendererInternals) {
7643
7664
  isSVGContainer(container),
7644
7665
  optimized
7645
7666
  );
7646
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7647
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7648
- nextNode = nextSibling(nextNode);
7649
- }
7650
7667
  if (isAsyncWrapper(vnode)) {
7651
7668
  let subTree;
7652
7669
  if (isFragmentStart) {
@@ -7696,7 +7713,7 @@ function createHydrationFunctions(rendererInternals) {
7696
7713
  };
7697
7714
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7698
7715
  optimized = optimized || !!vnode.dynamicChildren;
7699
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7716
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7700
7717
  const forcePatchValue = type === "input" && dirs || type === "option";
7701
7718
  {
7702
7719
  if (dirs) {
@@ -7733,12 +7750,23 @@ function createHydrationFunctions(rendererInternals) {
7733
7750
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7734
7751
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7735
7752
  }
7753
+ let needCallTransitionHooks = false;
7754
+ if (isTemplateNode(el)) {
7755
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7756
+ const content = el.content.firstChild;
7757
+ if (needCallTransitionHooks) {
7758
+ transition.beforeEnter(content);
7759
+ }
7760
+ replaceNode(content, el, parentComponent);
7761
+ vnode.el = el = content;
7762
+ }
7736
7763
  if (dirs) {
7737
7764
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7738
7765
  }
7739
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7766
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7740
7767
  queueEffectWithSuspense(() => {
7741
7768
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7769
+ needCallTransitionHooks && transition.enter(el);
7742
7770
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7743
7771
  }, parentSuspense);
7744
7772
  }
@@ -7856,7 +7884,7 @@ function createHydrationFunctions(rendererInternals) {
7856
7884
  );
7857
7885
  vnode.el = null;
7858
7886
  if (isFragment) {
7859
- const end = locateClosingAsyncAnchor(node);
7887
+ const end = locateClosingAnchor(node);
7860
7888
  while (true) {
7861
7889
  const next2 = nextSibling(node);
7862
7890
  if (next2 && next2 !== end) {
@@ -7881,14 +7909,14 @@ function createHydrationFunctions(rendererInternals) {
7881
7909
  );
7882
7910
  return next;
7883
7911
  };
7884
- const locateClosingAsyncAnchor = (node) => {
7912
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7885
7913
  let match = 0;
7886
7914
  while (node) {
7887
7915
  node = nextSibling(node);
7888
7916
  if (node && isComment(node)) {
7889
- if (node.data === "[")
7917
+ if (node.data === open)
7890
7918
  match++;
7891
- if (node.data === "]") {
7919
+ if (node.data === close) {
7892
7920
  if (match === 0) {
7893
7921
  return nextSibling(node);
7894
7922
  } else {
@@ -7899,6 +7927,23 @@ function createHydrationFunctions(rendererInternals) {
7899
7927
  }
7900
7928
  return node;
7901
7929
  };
7930
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7931
+ const parentNode2 = oldNode.parentNode;
7932
+ if (parentNode2) {
7933
+ parentNode2.replaceChild(newNode, oldNode);
7934
+ }
7935
+ let parent = parentComponent;
7936
+ while (parent) {
7937
+ if (parent.vnode.el === oldNode) {
7938
+ parent.vnode.el = newNode;
7939
+ parent.subTree.el = newNode;
7940
+ }
7941
+ parent = parent.parent;
7942
+ }
7943
+ };
7944
+ const isTemplateNode = (node) => {
7945
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7946
+ };
7902
7947
  return [hydrate, hydrateNode];
7903
7948
  }
7904
7949
 
@@ -8226,7 +8271,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8226
8271
  if (dirs) {
8227
8272
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8228
8273
  }
8229
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8274
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8230
8275
  if (needCallTransitionHooks) {
8231
8276
  transition.beforeEnter(el);
8232
8277
  }
@@ -9143,8 +9188,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9143
9188
  moveStaticNode(vnode, container, anchor);
9144
9189
  return;
9145
9190
  }
9146
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9147
- if (needTransition) {
9191
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9192
+ if (needTransition2) {
9148
9193
  if (moveType === 0) {
9149
9194
  transition.beforeEnter(el);
9150
9195
  hostInsert(el, container, anchor);
@@ -9373,6 +9418,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9373
9418
  function toggleRecurse({ effect, update }, allowed) {
9374
9419
  effect.allowRecurse = update.allowRecurse = allowed;
9375
9420
  }
9421
+ function needTransition(parentSuspense, transition) {
9422
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9423
+ }
9376
9424
  function traverseStaticChildren(n1, n2, shallow = false) {
9377
9425
  const ch1 = n1.children;
9378
9426
  const ch2 = n2.children;
@@ -10781,7 +10829,7 @@ function isMemoSame(cached, memo) {
10781
10829
  return true;
10782
10830
  }
10783
10831
 
10784
- const version = "3.3.6";
10832
+ const version = "3.3.7";
10785
10833
  const ssrUtils = null;
10786
10834
  const resolveFilter = resolveFilter$1 ;
10787
10835
  const _compatUtils = {
@@ -14083,9 +14131,13 @@ function walk(node, context, doNotHoistNode = false) {
14083
14131
  context.transformHoist(children, context, node);
14084
14132
  }
14085
14133
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14086
- node.codegenNode.children = context.hoist(
14134
+ const hoisted = context.hoist(
14087
14135
  createArrayExpression(node.codegenNode.children)
14088
14136
  );
14137
+ if (context.hmr) {
14138
+ hoisted.content = `[...${hoisted.content}]`;
14139
+ }
14140
+ node.codegenNode.children = hoisted;
14089
14141
  }
14090
14142
  }
14091
14143
  function getConstantType(node, context) {
@@ -14258,6 +14310,7 @@ function createTransformContext(root, {
14258
14310
  filename = "",
14259
14311
  prefixIdentifiers = false,
14260
14312
  hoistStatic: hoistStatic2 = false,
14313
+ hmr = false,
14261
14314
  cacheHandlers = false,
14262
14315
  nodeTransforms = [],
14263
14316
  directiveTransforms = {},
@@ -14283,6 +14336,7 @@ function createTransformContext(root, {
14283
14336
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14284
14337
  prefixIdentifiers,
14285
14338
  hoistStatic: hoistStatic2,
14339
+ hmr,
14286
14340
  cacheHandlers,
14287
14341
  nodeTransforms,
14288
14342
  directiveTransforms,
@@ -15666,7 +15720,7 @@ const trackSlotScopes = (node, context) => {
15666
15720
  }
15667
15721
  }
15668
15722
  };
15669
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
15723
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
15670
15724
  props,
15671
15725
  children,
15672
15726
  false,
@@ -15688,7 +15742,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15688
15742
  slotsProperties.push(
15689
15743
  createObjectProperty(
15690
15744
  arg || createSimpleExpression("default", true),
15691
- buildSlotFn(exp, children, loc)
15745
+ buildSlotFn(exp, void 0, children, loc)
15692
15746
  )
15693
15747
  );
15694
15748
  }
@@ -15725,10 +15779,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15725
15779
  } else {
15726
15780
  hasDynamicSlots = true;
15727
15781
  }
15728
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
15782
+ const vFor = findDir(slotElement, "for");
15783
+ const slotFunction = buildSlotFn(
15784
+ slotProps,
15785
+ vFor == null ? void 0 : vFor.exp,
15786
+ slotChildren,
15787
+ slotLoc
15788
+ );
15729
15789
  let vIf;
15730
15790
  let vElse;
15731
- let vFor;
15732
15791
  if (vIf = findDir(slotElement, "if")) {
15733
15792
  hasDynamicSlots = true;
15734
15793
  dynamicSlots.push(
@@ -15773,7 +15832,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15773
15832
  createCompilerError(30, vElse.loc)
15774
15833
  );
15775
15834
  }
15776
- } else if (vFor = findDir(slotElement, "for")) {
15835
+ } else if (vFor) {
15777
15836
  hasDynamicSlots = true;
15778
15837
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
15779
15838
  if (parseResult) {
@@ -15814,7 +15873,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15814
15873
  }
15815
15874
  if (!onComponentSlot) {
15816
15875
  const buildDefaultSlotProperty = (props, children2) => {
15817
- const fn = buildSlotFn(props, children2, loc);
15876
+ const fn = buildSlotFn(props, void 0, children2, loc);
15818
15877
  if (context.compatConfig) {
15819
15878
  fn.isNonScopedSlot = true;
15820
15879
  }