@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
  });
@@ -1715,8 +1715,13 @@ function findInsertionIndex(id) {
1715
1715
  let end = queue.length;
1716
1716
  while (start < end) {
1717
1717
  const middle = start + end >>> 1;
1718
- const middleJobId = getId(queue[middle]);
1719
- middleJobId < id ? start = middle + 1 : end = middle;
1718
+ const middleJob = queue[middle];
1719
+ const middleJobId = getId(middleJob);
1720
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1721
+ start = middle + 1;
1722
+ } else {
1723
+ end = middle;
1724
+ }
1720
1725
  }
1721
1726
  return start;
1722
1727
  }
@@ -3307,14 +3312,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3307
3312
  parentComponent: parentComponent2,
3308
3313
  container: container2
3309
3314
  } = suspense;
3315
+ let delayEnter = false;
3310
3316
  if (suspense.isHydrating) {
3311
3317
  suspense.isHydrating = false;
3312
3318
  } else if (!resume) {
3313
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3319
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3314
3320
  if (delayEnter) {
3315
3321
  activeBranch.transition.afterLeave = () => {
3316
3322
  if (pendingId === suspense.pendingId) {
3317
3323
  move(pendingBranch, container2, anchor2, 0);
3324
+ queuePostFlushCb(effects);
3318
3325
  }
3319
3326
  };
3320
3327
  }
@@ -3340,7 +3347,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3340
3347
  }
3341
3348
  parent = parent.parent;
3342
3349
  }
3343
- if (!hasUnresolvedAncestor) {
3350
+ if (!hasUnresolvedAncestor && !delayEnter) {
3344
3351
  queuePostFlushCb(effects);
3345
3352
  }
3346
3353
  suspense.effects = [];
@@ -4997,7 +5004,7 @@ function defineLegacyVNodeProperties(vnode) {
4997
5004
  }
4998
5005
  }
4999
5006
 
5000
- const normalizedFunctionalComponentMap = /* @__PURE__ */ new Map();
5007
+ const normalizedFunctionalComponentMap = /* @__PURE__ */ new WeakMap();
5001
5008
  const legacySlotProxyHandlers = {
5002
5009
  get(target, key) {
5003
5010
  const slot = target[key];
@@ -6295,7 +6302,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6295
6302
  return vm;
6296
6303
  }
6297
6304
  }
6298
- Vue.version = `2.6.14-compat:${"3.3.5"}`;
6305
+ Vue.version = `2.6.14-compat:${"3.3.7"}`;
6299
6306
  Vue.config = singletonApp.config;
6300
6307
  Vue.use = (p, ...options) => {
6301
6308
  if (p && isFunction(p.install)) {
@@ -6709,7 +6716,7 @@ function createAppAPI(render, hydrate) {
6709
6716
  }
6710
6717
  });
6711
6718
  }
6712
- const installedPlugins = /* @__PURE__ */ new Set();
6719
+ const installedPlugins = /* @__PURE__ */ new WeakSet();
6713
6720
  let isMounted = false;
6714
6721
  const app = context.app = {
6715
6722
  _uid: uid$1++,
@@ -7452,7 +7459,7 @@ const updateSlots = (instance, children, optimized) => {
7452
7459
  }
7453
7460
  if (needDeletionCheck) {
7454
7461
  for (const key in slots) {
7455
- if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
7462
+ if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
7456
7463
  delete slots[key];
7457
7464
  }
7458
7465
  }
@@ -7628,7 +7635,14 @@ function createHydrationFunctions(rendererInternals) {
7628
7635
  break;
7629
7636
  case Comment:
7630
7637
  if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7631
- nextNode = onMismatch();
7638
+ if (node.tagName.toLowerCase() === "template") {
7639
+ const content = vnode.el.content.firstChild;
7640
+ replaceNode(content, node, parentComponent);
7641
+ vnode.el = node = content;
7642
+ nextNode = nextSibling(node);
7643
+ } else {
7644
+ nextNode = onMismatch();
7645
+ }
7632
7646
  } else {
7633
7647
  nextNode = nextSibling(node);
7634
7648
  }
@@ -7670,7 +7684,7 @@ function createHydrationFunctions(rendererInternals) {
7670
7684
  break;
7671
7685
  default:
7672
7686
  if (shapeFlag & 1) {
7673
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7687
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7674
7688
  nextNode = onMismatch();
7675
7689
  } else {
7676
7690
  nextNode = hydrateElement(
@@ -7685,6 +7699,13 @@ function createHydrationFunctions(rendererInternals) {
7685
7699
  } else if (shapeFlag & 6) {
7686
7700
  vnode.slotScopeIds = slotScopeIds;
7687
7701
  const container = parentNode(node);
7702
+ if (isFragmentStart) {
7703
+ nextNode = locateClosingAnchor(node);
7704
+ } else if (isComment(node) && node.data === "teleport start") {
7705
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7706
+ } else {
7707
+ nextNode = nextSibling(node);
7708
+ }
7688
7709
  mountComponent(
7689
7710
  vnode,
7690
7711
  container,
@@ -7694,10 +7715,6 @@ function createHydrationFunctions(rendererInternals) {
7694
7715
  isSVGContainer(container),
7695
7716
  optimized
7696
7717
  );
7697
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7698
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7699
- nextNode = nextSibling(nextNode);
7700
- }
7701
7718
  if (isAsyncWrapper(vnode)) {
7702
7719
  let subTree;
7703
7720
  if (isFragmentStart) {
@@ -7747,7 +7764,7 @@ function createHydrationFunctions(rendererInternals) {
7747
7764
  };
7748
7765
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7749
7766
  optimized = optimized || !!vnode.dynamicChildren;
7750
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7767
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7751
7768
  const forcePatchValue = type === "input" && dirs || type === "option";
7752
7769
  if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
7753
7770
  if (dirs) {
@@ -7784,12 +7801,23 @@ function createHydrationFunctions(rendererInternals) {
7784
7801
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7785
7802
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7786
7803
  }
7804
+ let needCallTransitionHooks = false;
7805
+ if (isTemplateNode(el)) {
7806
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7807
+ const content = el.content.firstChild;
7808
+ if (needCallTransitionHooks) {
7809
+ transition.beforeEnter(content);
7810
+ }
7811
+ replaceNode(content, el, parentComponent);
7812
+ vnode.el = el = content;
7813
+ }
7787
7814
  if (dirs) {
7788
7815
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7789
7816
  }
7790
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7817
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7791
7818
  queueEffectWithSuspense(() => {
7792
7819
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7820
+ needCallTransitionHooks && transition.enter(el);
7793
7821
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7794
7822
  }, parentSuspense);
7795
7823
  }
@@ -7907,7 +7935,7 @@ function createHydrationFunctions(rendererInternals) {
7907
7935
  );
7908
7936
  vnode.el = null;
7909
7937
  if (isFragment) {
7910
- const end = locateClosingAsyncAnchor(node);
7938
+ const end = locateClosingAnchor(node);
7911
7939
  while (true) {
7912
7940
  const next2 = nextSibling(node);
7913
7941
  if (next2 && next2 !== end) {
@@ -7932,14 +7960,14 @@ function createHydrationFunctions(rendererInternals) {
7932
7960
  );
7933
7961
  return next;
7934
7962
  };
7935
- const locateClosingAsyncAnchor = (node) => {
7963
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7936
7964
  let match = 0;
7937
7965
  while (node) {
7938
7966
  node = nextSibling(node);
7939
7967
  if (node && isComment(node)) {
7940
- if (node.data === "[")
7968
+ if (node.data === open)
7941
7969
  match++;
7942
- if (node.data === "]") {
7970
+ if (node.data === close) {
7943
7971
  if (match === 0) {
7944
7972
  return nextSibling(node);
7945
7973
  } else {
@@ -7950,6 +7978,23 @@ function createHydrationFunctions(rendererInternals) {
7950
7978
  }
7951
7979
  return node;
7952
7980
  };
7981
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7982
+ const parentNode2 = oldNode.parentNode;
7983
+ if (parentNode2) {
7984
+ parentNode2.replaceChild(newNode, oldNode);
7985
+ }
7986
+ let parent = parentComponent;
7987
+ while (parent) {
7988
+ if (parent.vnode.el === oldNode) {
7989
+ parent.vnode.el = newNode;
7990
+ parent.subTree.el = newNode;
7991
+ }
7992
+ parent = parent.parent;
7993
+ }
7994
+ };
7995
+ const isTemplateNode = (node) => {
7996
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7997
+ };
7953
7998
  return [hydrate, hydrateNode];
7954
7999
  }
7955
8000
 
@@ -8300,7 +8345,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8300
8345
  if (dirs) {
8301
8346
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8302
8347
  }
8303
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8348
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8304
8349
  if (needCallTransitionHooks) {
8305
8350
  transition.beforeEnter(el);
8306
8351
  }
@@ -9228,8 +9273,8 @@ function baseCreateRenderer(options, createHydrationFns) {
9228
9273
  moveStaticNode(vnode, container, anchor);
9229
9274
  return;
9230
9275
  }
9231
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9232
- if (needTransition) {
9276
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9277
+ if (needTransition2) {
9233
9278
  if (moveType === 0) {
9234
9279
  transition.beforeEnter(el);
9235
9280
  hostInsert(el, container, anchor);
@@ -9458,6 +9503,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9458
9503
  function toggleRecurse({ effect, update }, allowed) {
9459
9504
  effect.allowRecurse = update.allowRecurse = allowed;
9460
9505
  }
9506
+ function needTransition(parentSuspense, transition) {
9507
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9508
+ }
9461
9509
  function traverseStaticChildren(n1, n2, shallow = false) {
9462
9510
  const ch1 = n1.children;
9463
9511
  const ch2 = n2.children;
@@ -9683,19 +9731,18 @@ const TeleportImpl = {
9683
9731
  if (target) {
9684
9732
  hostRemove(targetAnchor);
9685
9733
  }
9686
- if (doRemove || !isTeleportDisabled(props)) {
9687
- hostRemove(anchor);
9688
- if (shapeFlag & 16) {
9689
- for (let i = 0; i < children.length; i++) {
9690
- const child = children[i];
9691
- unmount(
9692
- child,
9693
- parentComponent,
9694
- parentSuspense,
9695
- true,
9696
- !!child.dynamicChildren
9697
- );
9698
- }
9734
+ doRemove && hostRemove(anchor);
9735
+ if (shapeFlag & 16) {
9736
+ const shouldRemove = doRemove || !isTeleportDisabled(props);
9737
+ for (let i = 0; i < children.length; i++) {
9738
+ const child = children[i];
9739
+ unmount(
9740
+ child,
9741
+ parentComponent,
9742
+ parentSuspense,
9743
+ shouldRemove,
9744
+ !!child.dynamicChildren
9745
+ );
9699
9746
  }
9700
9747
  }
9701
9748
  },
@@ -9779,7 +9826,7 @@ function updateCssVars(vnode) {
9779
9826
  const ctx = vnode.ctx;
9780
9827
  if (ctx && ctx.ut) {
9781
9828
  let node = vnode.children[0].el;
9782
- while (node !== vnode.targetAnchor) {
9829
+ while (node && node !== vnode.targetAnchor) {
9783
9830
  if (node.nodeType === 1)
9784
9831
  node.setAttribute("data-v-owner", ctx.uid);
9785
9832
  node = node.nextSibling;
@@ -9788,7 +9835,7 @@ function updateCssVars(vnode) {
9788
9835
  }
9789
9836
  }
9790
9837
 
9791
- const normalizedAsyncComponentMap = /* @__PURE__ */ new Map();
9838
+ const normalizedAsyncComponentMap = /* @__PURE__ */ new WeakMap();
9792
9839
  function convertLegacyAsyncComponent(comp) {
9793
9840
  if (normalizedAsyncComponentMap.has(comp)) {
9794
9841
  return normalizedAsyncComponentMap.get(comp);
@@ -10895,7 +10942,7 @@ function isMemoSame(cached, memo) {
10895
10942
  return true;
10896
10943
  }
10897
10944
 
10898
- const version = "3.3.5";
10945
+ const version = "3.3.7";
10899
10946
  const _ssrUtils = {
10900
10947
  createComponentInstance,
10901
10948
  setupComponent,
@@ -14247,9 +14294,13 @@ function walk(node, context, doNotHoistNode = false) {
14247
14294
  context.transformHoist(children, context, node);
14248
14295
  }
14249
14296
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14250
- node.codegenNode.children = context.hoist(
14297
+ const hoisted = context.hoist(
14251
14298
  createArrayExpression(node.codegenNode.children)
14252
14299
  );
14300
+ if (context.hmr) {
14301
+ hoisted.content = `[...${hoisted.content}]`;
14302
+ }
14303
+ node.codegenNode.children = hoisted;
14253
14304
  }
14254
14305
  }
14255
14306
  function getConstantType(node, context) {
@@ -14423,6 +14474,7 @@ function createTransformContext(root, {
14423
14474
  filename = "",
14424
14475
  prefixIdentifiers = false,
14425
14476
  hoistStatic: hoistStatic2 = false,
14477
+ hmr = false,
14426
14478
  cacheHandlers = false,
14427
14479
  nodeTransforms = [],
14428
14480
  directiveTransforms = {},
@@ -14448,6 +14500,7 @@ function createTransformContext(root, {
14448
14500
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14449
14501
  prefixIdentifiers,
14450
14502
  hoistStatic: hoistStatic2,
14503
+ hmr,
14451
14504
  cacheHandlers,
14452
14505
  nodeTransforms,
14453
14506
  directiveTransforms,
@@ -14473,7 +14526,7 @@ function createTransformContext(root, {
14473
14526
  directives: /* @__PURE__ */ new Set(),
14474
14527
  hoists: [],
14475
14528
  imports: [],
14476
- constantCache: /* @__PURE__ */ new Map(),
14529
+ constantCache: /* @__PURE__ */ new WeakMap(),
14477
14530
  temps: 0,
14478
14531
  cached: 0,
14479
14532
  identifiers: /* @__PURE__ */ Object.create(null),
@@ -15831,7 +15884,7 @@ const trackSlotScopes = (node, context) => {
15831
15884
  }
15832
15885
  }
15833
15886
  };
15834
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
15887
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
15835
15888
  props,
15836
15889
  children,
15837
15890
  false,
@@ -15853,7 +15906,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15853
15906
  slotsProperties.push(
15854
15907
  createObjectProperty(
15855
15908
  arg || createSimpleExpression("default", true),
15856
- buildSlotFn(exp, children, loc)
15909
+ buildSlotFn(exp, void 0, children, loc)
15857
15910
  )
15858
15911
  );
15859
15912
  }
@@ -15890,10 +15943,15 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15890
15943
  } else {
15891
15944
  hasDynamicSlots = true;
15892
15945
  }
15893
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
15946
+ const vFor = findDir(slotElement, "for");
15947
+ const slotFunction = buildSlotFn(
15948
+ slotProps,
15949
+ vFor == null ? void 0 : vFor.exp,
15950
+ slotChildren,
15951
+ slotLoc
15952
+ );
15894
15953
  let vIf;
15895
15954
  let vElse;
15896
- let vFor;
15897
15955
  if (vIf = findDir(slotElement, "if")) {
15898
15956
  hasDynamicSlots = true;
15899
15957
  dynamicSlots.push(
@@ -15938,7 +15996,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15938
15996
  createCompilerError(30, vElse.loc)
15939
15997
  );
15940
15998
  }
15941
- } else if (vFor = findDir(slotElement, "for")) {
15999
+ } else if (vFor) {
15942
16000
  hasDynamicSlots = true;
15943
16001
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
15944
16002
  if (parseResult) {
@@ -15979,7 +16037,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
15979
16037
  }
15980
16038
  if (!onComponentSlot) {
15981
16039
  const buildDefaultSlotProperty = (props, children2) => {
15982
- const fn = buildSlotFn(props, children2, loc);
16040
+ const fn = buildSlotFn(props, void 0, children2, loc);
15983
16041
  if (context.compatConfig) {
15984
16042
  fn.isNonScopedSlot = true;
15985
16043
  }