@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.
@@ -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 = [];
@@ -4951,7 +4958,7 @@ function defineLegacyVNodeProperties(vnode) {
4951
4958
  }
4952
4959
  }
4953
4960
 
4954
- const normalizedFunctionalComponentMap = /* @__PURE__ */ new Map();
4961
+ const normalizedFunctionalComponentMap = /* @__PURE__ */ new WeakMap();
4955
4962
  const legacySlotProxyHandlers = {
4956
4963
  get(target, key) {
4957
4964
  const slot = target[key];
@@ -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.5"}`;
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)) {
@@ -6660,7 +6667,7 @@ function createAppAPI(render, hydrate) {
6660
6667
  }
6661
6668
  });
6662
6669
  }
6663
- const installedPlugins = /* @__PURE__ */ new Set();
6670
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
6664
6671
  let isMounted = false;
6665
6672
  const app = context.app = {
6666
6673
  _uid: uid$1++,
@@ -7401,7 +7408,7 @@ const updateSlots = (instance, children, optimized) => {
7401
7408
  }
7402
7409
  if (needDeletionCheck) {
7403
7410
  for (const key in slots) {
7404
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7411
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
7405
7412
  delete slots[key];
7406
7413
  }
7407
7414
  }
@@ -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;
@@ -9598,19 +9646,18 @@ const TeleportImpl = {
9598
9646
  if (target) {
9599
9647
  hostRemove(targetAnchor);
9600
9648
  }
9601
- if (doRemove || !isTeleportDisabled(props)) {
9602
- hostRemove(anchor);
9603
- if (shapeFlag & 16) {
9604
- for (let i = 0; i < children.length; i++) {
9605
- const child = children[i];
9606
- unmount(
9607
- child,
9608
- parentComponent,
9609
- parentSuspense,
9610
- true,
9611
- !!child.dynamicChildren
9612
- );
9613
- }
9649
+ doRemove && hostRemove(anchor);
9650
+ if (shapeFlag & 16) {
9651
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
9652
+ for (let i = 0; i < children.length; i++) {
9653
+ const child = children[i];
9654
+ unmount(
9655
+ child,
9656
+ parentComponent,
9657
+ parentSuspense,
9658
+ shouldRemove,
9659
+ !!child.dynamicChildren
9660
+ );
9614
9661
  }
9615
9662
  }
9616
9663
  },
@@ -9694,7 +9741,7 @@ function updateCssVars(vnode) {
9694
9741
  const ctx = vnode.ctx;
9695
9742
  if (ctx && ctx.ut) {
9696
9743
  let node = vnode.children[0].el;
9697
- while (node !== vnode.targetAnchor) {
9744
+ while (node && node !== vnode.targetAnchor) {
9698
9745
  if (node.nodeType === 1)
9699
9746
  node.setAttribute("data-v-owner", ctx.uid);
9700
9747
  node = node.nextSibling;
@@ -9703,7 +9750,7 @@ function updateCssVars(vnode) {
9703
9750
  }
9704
9751
  }
9705
9752
 
9706
- const normalizedAsyncComponentMap = /* @__PURE__ */ new Map();
9753
+ const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
9707
9754
  function convertLegacyAsyncComponent(comp) {
9708
9755
  if (normalizedAsyncComponentMap.has(comp)) {
9709
9756
  return normalizedAsyncComponentMap.get(comp);
@@ -10782,7 +10829,7 @@ function isMemoSame(cached, memo) {
10782
10829
  return true;
10783
10830
  }
10784
10831
 
10785
- const version = "3.3.5";
10832
+ const version = "3.3.7";
10786
10833
  const ssrUtils = null;
10787
10834
  const resolveFilter = resolveFilter$1 ;
10788
10835
  const _compatUtils = {
@@ -14084,9 +14131,13 @@ function walk(node, context, doNotHoistNode = false) {
14084
14131
  context.transformHoist(children, context, node);
14085
14132
  }
14086
14133
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14087
- node.codegenNode.children = context.hoist(
14134
+ const hoisted = context.hoist(
14088
14135
  createArrayExpression(node.codegenNode.children)
14089
14136
  );
14137
+ if (context.hmr) {
14138
+ hoisted.content = `[...${hoisted.content}]`;
14139
+ }
14140
+ node.codegenNode.children = hoisted;
14090
14141
  }
14091
14142
  }
14092
14143
  function getConstantType(node, context) {
@@ -14259,6 +14310,7 @@ function createTransformContext(root, {
14259
14310
  filename = "",
14260
14311
  prefixIdentifiers = false,
14261
14312
  hoistStatic: hoistStatic2 = false,
14313
+ hmr = false,
14262
14314
  cacheHandlers = false,
14263
14315
  nodeTransforms = [],
14264
14316
  directiveTransforms = {},
@@ -14284,6 +14336,7 @@ function createTransformContext(root, {
14284
14336
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14285
14337
  prefixIdentifiers,
14286
14338
  hoistStatic: hoistStatic2,
14339
+ hmr,
14287
14340
  cacheHandlers,
14288
14341
  nodeTransforms,
14289
14342
  directiveTransforms,
@@ -14309,7 +14362,7 @@ function createTransformContext(root, {
14309
14362
  directives: /* @__PURE__ */ new Set(),
14310
14363
  hoists: [],
14311
14364
  imports: [],
14312
- constantCache: /* @__PURE__ */ new Map(),
14365
+ constantCache: /* @__PURE__ */ new WeakMap(),
14313
14366
  temps: 0,
14314
14367
  cached: 0,
14315
14368
  identifiers: /* @__PURE__ */ Object.create(null),
@@ -15667,7 +15720,7 @@ const trackSlotScopes = (node, context) => {
15667
15720
  }
15668
15721
  }
15669
15722
  };
15670
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
15723
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
15671
15724
  props,
15672
15725
  children,
15673
15726
  false,
@@ -15689,7 +15742,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15689
15742
  slotsProperties.push(
15690
15743
  createObjectProperty(
15691
15744
  arg || createSimpleExpression("default", true),
15692
- buildSlotFn(exp, children, loc)
15745
+ buildSlotFn(exp, void 0, children, loc)
15693
15746
  )
15694
15747
  );
15695
15748
  }
@@ -15726,10 +15779,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15726
15779
  } else {
15727
15780
  hasDynamicSlots = true;
15728
15781
  }
15729
- 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
+ );
15730
15789
  let vIf;
15731
15790
  let vElse;
15732
- let vFor;
15733
15791
  if (vIf = findDir(slotElement, "if")) {
15734
15792
  hasDynamicSlots = true;
15735
15793
  dynamicSlots.push(
@@ -15774,7 +15832,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15774
15832
  createCompilerError(30, vElse.loc)
15775
15833
  );
15776
15834
  }
15777
- } else if (vFor = findDir(slotElement, "for")) {
15835
+ } else if (vFor) {
15778
15836
  hasDynamicSlots = true;
15779
15837
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
15780
15838
  if (parseResult) {
@@ -15815,7 +15873,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15815
15873
  }
15816
15874
  if (!onComponentSlot) {
15817
15875
  const buildDefaultSlotProperty = (props, children2) => {
15818
- const fn = buildSlotFn(props, children2, loc);
15876
+ const fn = buildSlotFn(props, void 0, children2, loc);
15819
15877
  if (context.compatConfig) {
15820
15878
  fn.isNonScopedSlot = true;
15821
15879
  }