@vue/compat 3.3.6 → 3.3.8

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.
@@ -608,7 +608,7 @@ var Vue = (function () {
608
608
  } else if (key === "length" && isArray(target)) {
609
609
  const newLength = Number(newValue);
610
610
  depsMap.forEach((dep, key2) => {
611
- if (key2 === "length" || key2 >= newLength) {
611
+ if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
612
612
  deps.push(dep);
613
613
  }
614
614
  });
@@ -1704,8 +1704,13 @@ var Vue = (function () {
1704
1704
  let end = queue.length;
1705
1705
  while (start < end) {
1706
1706
  const middle = start + end >>> 1;
1707
- const middleJobId = getId(queue[middle]);
1708
- middleJobId < id ? start = middle + 1 : end = middle;
1707
+ const middleJob = queue[middle];
1708
+ const middleJobId = getId(middleJob);
1709
+ if (middleJobId < id || middleJobId === id && middleJob.pre) {
1710
+ start = middle + 1;
1711
+ } else {
1712
+ end = middle;
1713
+ }
1709
1714
  }
1710
1715
  return start;
1711
1716
  }
@@ -2980,6 +2985,65 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2980
2985
  }
2981
2986
  }
2982
2987
 
2988
+ const COMPONENTS = "components";
2989
+ const DIRECTIVES = "directives";
2990
+ const FILTERS = "filters";
2991
+ function resolveComponent(name, maybeSelfReference) {
2992
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2993
+ }
2994
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2995
+ function resolveDynamicComponent(component) {
2996
+ if (isString(component)) {
2997
+ return resolveAsset(COMPONENTS, component, false) || component;
2998
+ } else {
2999
+ return component || NULL_DYNAMIC_COMPONENT;
3000
+ }
3001
+ }
3002
+ function resolveDirective(name) {
3003
+ return resolveAsset(DIRECTIVES, name);
3004
+ }
3005
+ function resolveFilter$1(name) {
3006
+ return resolveAsset(FILTERS, name);
3007
+ }
3008
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3009
+ const instance = currentRenderingInstance || currentInstance;
3010
+ if (instance) {
3011
+ const Component = instance.type;
3012
+ if (type === COMPONENTS) {
3013
+ const selfName = getComponentName(
3014
+ Component,
3015
+ false
3016
+ /* do not include inferred name to avoid breaking existing code */
3017
+ );
3018
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3019
+ return Component;
3020
+ }
3021
+ }
3022
+ const res = (
3023
+ // local registration
3024
+ // check instance[type] first which is resolved for options API
3025
+ resolve(instance[type] || Component[type], name) || // global registration
3026
+ resolve(instance.appContext[type], name)
3027
+ );
3028
+ if (!res && maybeSelfReference) {
3029
+ return Component;
3030
+ }
3031
+ if (warnMissing && !res) {
3032
+ const extra = type === COMPONENTS ? `
3033
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3034
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3035
+ }
3036
+ return res;
3037
+ } else {
3038
+ warn(
3039
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3040
+ );
3041
+ }
3042
+ }
3043
+ function resolve(registry, name) {
3044
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3045
+ }
3046
+
2983
3047
  const isSuspense = (type) => type.__isSuspense;
2984
3048
  const SuspenseImpl = {
2985
3049
  name: "Suspense",
@@ -3293,14 +3357,16 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3293
3357
  parentComponent: parentComponent2,
3294
3358
  container: container2
3295
3359
  } = suspense;
3360
+ let delayEnter = false;
3296
3361
  if (suspense.isHydrating) {
3297
3362
  suspense.isHydrating = false;
3298
3363
  } else if (!resume) {
3299
- const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3364
+ delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
3300
3365
  if (delayEnter) {
3301
3366
  activeBranch.transition.afterLeave = () => {
3302
3367
  if (pendingId === suspense.pendingId) {
3303
3368
  move(pendingBranch, container2, anchor2, 0);
3369
+ queuePostFlushCb(effects);
3304
3370
  }
3305
3371
  };
3306
3372
  }
@@ -3326,7 +3392,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3326
3392
  }
3327
3393
  parent = parent.parent;
3328
3394
  }
3329
- if (!hasUnresolvedAncestor) {
3395
+ if (!hasUnresolvedAncestor && !delayEnter) {
3330
3396
  queuePostFlushCb(effects);
3331
3397
  }
3332
3398
  suspense.effects = [];
@@ -3512,7 +3578,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3512
3578
  }
3513
3579
  if (isArray(s)) {
3514
3580
  const singleChild = filterSingleRoot(s);
3515
- if (!singleChild) {
3581
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3516
3582
  warn(`<Suspense> slots expect a single root node.`);
3517
3583
  }
3518
3584
  s = singleChild;
@@ -4689,65 +4755,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4689
4755
  return listeners;
4690
4756
  }
4691
4757
 
4692
- const COMPONENTS = "components";
4693
- const DIRECTIVES = "directives";
4694
- const FILTERS = "filters";
4695
- function resolveComponent(name, maybeSelfReference) {
4696
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4697
- }
4698
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4699
- function resolveDynamicComponent(component) {
4700
- if (isString(component)) {
4701
- return resolveAsset(COMPONENTS, component, false) || component;
4702
- } else {
4703
- return component || NULL_DYNAMIC_COMPONENT;
4704
- }
4705
- }
4706
- function resolveDirective(name) {
4707
- return resolveAsset(DIRECTIVES, name);
4708
- }
4709
- function resolveFilter$1(name) {
4710
- return resolveAsset(FILTERS, name);
4711
- }
4712
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4713
- const instance = currentRenderingInstance || currentInstance;
4714
- if (instance) {
4715
- const Component = instance.type;
4716
- if (type === COMPONENTS) {
4717
- const selfName = getComponentName(
4718
- Component,
4719
- false
4720
- /* do not include inferred name to avoid breaking existing code */
4721
- );
4722
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4723
- return Component;
4724
- }
4725
- }
4726
- const res = (
4727
- // local registration
4728
- // check instance[type] first which is resolved for options API
4729
- resolve(instance[type] || Component[type], name) || // global registration
4730
- resolve(instance.appContext[type], name)
4731
- );
4732
- if (!res && maybeSelfReference) {
4733
- return Component;
4734
- }
4735
- if (warnMissing && !res) {
4736
- const extra = type === COMPONENTS ? `
4737
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4738
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4739
- }
4740
- return res;
4741
- } else {
4742
- warn(
4743
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4744
- );
4745
- }
4746
- }
4747
- function resolve(registry, name) {
4748
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4749
- }
4750
-
4751
4758
  function convertLegacyRenderFn(instance) {
4752
4759
  const Component2 = instance.type;
4753
4760
  const render = Component2.render;
@@ -6250,7 +6257,7 @@ If this is a native custom element, make sure to exclude it from component resol
6250
6257
  return vm;
6251
6258
  }
6252
6259
  }
6253
- Vue.version = `2.6.14-compat:${"3.3.6"}`;
6260
+ Vue.version = `2.6.14-compat:${"3.3.8"}`;
6254
6261
  Vue.config = singletonApp.config;
6255
6262
  Vue.use = (p, ...options) => {
6256
6263
  if (p && isFunction(p.install)) {
@@ -7579,7 +7586,14 @@ If you want to remount the same app, move your app creation logic into a factory
7579
7586
  }
7580
7587
  break;
7581
7588
  case Comment:
7582
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7589
+ if (isTemplateNode(node)) {
7590
+ nextNode = nextSibling(node);
7591
+ replaceNode(
7592
+ vnode.el = node.content.firstChild,
7593
+ node,
7594
+ parentComponent
7595
+ );
7596
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7583
7597
  nextNode = onMismatch();
7584
7598
  } else {
7585
7599
  nextNode = nextSibling(node);
@@ -7622,7 +7636,7 @@ If you want to remount the same app, move your app creation logic into a factory
7622
7636
  break;
7623
7637
  default:
7624
7638
  if (shapeFlag & 1) {
7625
- if (domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) {
7639
+ if ((domType !== 1 /* ELEMENT */ || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
7626
7640
  nextNode = onMismatch();
7627
7641
  } else {
7628
7642
  nextNode = hydrateElement(
@@ -7637,6 +7651,13 @@ If you want to remount the same app, move your app creation logic into a factory
7637
7651
  } else if (shapeFlag & 6) {
7638
7652
  vnode.slotScopeIds = slotScopeIds;
7639
7653
  const container = parentNode(node);
7654
+ if (isFragmentStart) {
7655
+ nextNode = locateClosingAnchor(node);
7656
+ } else if (isComment(node) && node.data === "teleport start") {
7657
+ nextNode = locateClosingAnchor(node, node.data, "teleport end");
7658
+ } else {
7659
+ nextNode = nextSibling(node);
7660
+ }
7640
7661
  mountComponent(
7641
7662
  vnode,
7642
7663
  container,
@@ -7646,10 +7667,6 @@ If you want to remount the same app, move your app creation logic into a factory
7646
7667
  isSVGContainer(container),
7647
7668
  optimized
7648
7669
  );
7649
- nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node);
7650
- if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") {
7651
- nextNode = nextSibling(nextNode);
7652
- }
7653
7670
  if (isAsyncWrapper(vnode)) {
7654
7671
  let subTree;
7655
7672
  if (isFragmentStart) {
@@ -7699,7 +7716,7 @@ If you want to remount the same app, move your app creation logic into a factory
7699
7716
  };
7700
7717
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7701
7718
  optimized = optimized || !!vnode.dynamicChildren;
7702
- const { type, props, patchFlag, shapeFlag, dirs } = vnode;
7719
+ const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7703
7720
  const forcePatchValue = type === "input" && dirs || type === "option";
7704
7721
  {
7705
7722
  if (dirs) {
@@ -7736,12 +7753,23 @@ If you want to remount the same app, move your app creation logic into a factory
7736
7753
  if (vnodeHooks = props && props.onVnodeBeforeMount) {
7737
7754
  invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7738
7755
  }
7756
+ let needCallTransitionHooks = false;
7757
+ if (isTemplateNode(el)) {
7758
+ needCallTransitionHooks = needTransition(parentSuspense, transition) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;
7759
+ const content = el.content.firstChild;
7760
+ if (needCallTransitionHooks) {
7761
+ transition.beforeEnter(content);
7762
+ }
7763
+ replaceNode(content, el, parentComponent);
7764
+ vnode.el = el = content;
7765
+ }
7739
7766
  if (dirs) {
7740
7767
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7741
7768
  }
7742
- if ((vnodeHooks = props && props.onVnodeMounted) || dirs) {
7769
+ if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {
7743
7770
  queueEffectWithSuspense(() => {
7744
7771
  vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);
7772
+ needCallTransitionHooks && transition.enter(el);
7745
7773
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7746
7774
  }, parentSuspense);
7747
7775
  }
@@ -7859,7 +7887,7 @@ If you want to remount the same app, move your app creation logic into a factory
7859
7887
  );
7860
7888
  vnode.el = null;
7861
7889
  if (isFragment) {
7862
- const end = locateClosingAsyncAnchor(node);
7890
+ const end = locateClosingAnchor(node);
7863
7891
  while (true) {
7864
7892
  const next2 = nextSibling(node);
7865
7893
  if (next2 && next2 !== end) {
@@ -7884,14 +7912,14 @@ If you want to remount the same app, move your app creation logic into a factory
7884
7912
  );
7885
7913
  return next;
7886
7914
  };
7887
- const locateClosingAsyncAnchor = (node) => {
7915
+ const locateClosingAnchor = (node, open = "[", close = "]") => {
7888
7916
  let match = 0;
7889
7917
  while (node) {
7890
7918
  node = nextSibling(node);
7891
7919
  if (node && isComment(node)) {
7892
- if (node.data === "[")
7920
+ if (node.data === open)
7893
7921
  match++;
7894
- if (node.data === "]") {
7922
+ if (node.data === close) {
7895
7923
  if (match === 0) {
7896
7924
  return nextSibling(node);
7897
7925
  } else {
@@ -7902,6 +7930,22 @@ If you want to remount the same app, move your app creation logic into a factory
7902
7930
  }
7903
7931
  return node;
7904
7932
  };
7933
+ const replaceNode = (newNode, oldNode, parentComponent) => {
7934
+ const parentNode2 = oldNode.parentNode;
7935
+ if (parentNode2) {
7936
+ parentNode2.replaceChild(newNode, oldNode);
7937
+ }
7938
+ let parent = parentComponent;
7939
+ while (parent) {
7940
+ if (parent.vnode.el === oldNode) {
7941
+ parent.vnode.el = parent.subTree.el = newNode;
7942
+ }
7943
+ parent = parent.parent;
7944
+ }
7945
+ };
7946
+ const isTemplateNode = (node) => {
7947
+ return node.nodeType === 1 /* ELEMENT */ && node.tagName.toLowerCase() === "template";
7948
+ };
7905
7949
  return [hydrate, hydrateNode];
7906
7950
  }
7907
7951
 
@@ -8229,7 +8273,7 @@ If you want to remount the same app, move your app creation logic into a factory
8229
8273
  if (dirs) {
8230
8274
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8231
8275
  }
8232
- const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
8276
+ const needCallTransitionHooks = needTransition(parentSuspense, transition);
8233
8277
  if (needCallTransitionHooks) {
8234
8278
  transition.beforeEnter(el);
8235
8279
  }
@@ -9146,8 +9190,8 @@ If you want to remount the same app, move your app creation logic into a factory
9146
9190
  moveStaticNode(vnode, container, anchor);
9147
9191
  return;
9148
9192
  }
9149
- const needTransition = moveType !== 2 && shapeFlag & 1 && transition;
9150
- if (needTransition) {
9193
+ const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9194
+ if (needTransition2) {
9151
9195
  if (moveType === 0) {
9152
9196
  transition.beforeEnter(el);
9153
9197
  hostInsert(el, container, anchor);
@@ -9376,6 +9420,9 @@ If you want to remount the same app, move your app creation logic into a factory
9376
9420
  function toggleRecurse({ effect, update }, allowed) {
9377
9421
  effect.allowRecurse = update.allowRecurse = allowed;
9378
9422
  }
9423
+ function needTransition(parentSuspense, transition) {
9424
+ return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
9425
+ }
9379
9426
  function traverseStaticChildren(n1, n2, shallow = false) {
9380
9427
  const ch1 = n1.children;
9381
9428
  const ch2 = n2.children;
@@ -10778,7 +10825,7 @@ Component that was made reactive: `,
10778
10825
  return true;
10779
10826
  }
10780
10827
 
10781
- const version = "3.3.6";
10828
+ const version = "3.3.8";
10782
10829
  const ssrUtils = null;
10783
10830
  const resolveFilter = resolveFilter$1 ;
10784
10831
  const _compatUtils = {
@@ -14068,9 +14115,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14068
14115
  context.transformHoist(children, context, node);
14069
14116
  }
14070
14117
  if (hoistedCount && hoistedCount === originalCount && node.type === 1 && node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14071
- node.codegenNode.children = context.hoist(
14118
+ const hoisted = context.hoist(
14072
14119
  createArrayExpression(node.codegenNode.children)
14073
14120
  );
14121
+ if (context.hmr) {
14122
+ hoisted.content = `[...${hoisted.content}]`;
14123
+ }
14124
+ node.codegenNode.children = hoisted;
14074
14125
  }
14075
14126
  }
14076
14127
  function getConstantType(node, context) {
@@ -14243,6 +14294,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14243
14294
  filename = "",
14244
14295
  prefixIdentifiers = false,
14245
14296
  hoistStatic: hoistStatic2 = false,
14297
+ hmr = false,
14246
14298
  cacheHandlers = false,
14247
14299
  nodeTransforms = [],
14248
14300
  directiveTransforms = {},
@@ -14268,6 +14320,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
14268
14320
  selfName: nameMatch && capitalize(camelize(nameMatch[1])),
14269
14321
  prefixIdentifiers,
14270
14322
  hoistStatic: hoistStatic2,
14323
+ hmr,
14271
14324
  cacheHandlers,
14272
14325
  nodeTransforms,
14273
14326
  directiveTransforms,
@@ -15651,7 +15704,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15651
15704
  }
15652
15705
  }
15653
15706
  };
15654
- const buildClientSlotFn = (props, children, loc) => createFunctionExpression(
15707
+ const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression(
15655
15708
  props,
15656
15709
  children,
15657
15710
  false,
@@ -15673,7 +15726,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15673
15726
  slotsProperties.push(
15674
15727
  createObjectProperty(
15675
15728
  arg || createSimpleExpression("default", true),
15676
- buildSlotFn(exp, children, loc)
15729
+ buildSlotFn(exp, void 0, children, loc)
15677
15730
  )
15678
15731
  );
15679
15732
  }
@@ -15710,10 +15763,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15710
15763
  } else {
15711
15764
  hasDynamicSlots = true;
15712
15765
  }
15713
- const slotFunction = buildSlotFn(slotProps, slotChildren, slotLoc);
15766
+ const vFor = findDir(slotElement, "for");
15767
+ const slotFunction = buildSlotFn(
15768
+ slotProps,
15769
+ vFor == null ? void 0 : vFor.exp,
15770
+ slotChildren,
15771
+ slotLoc
15772
+ );
15714
15773
  let vIf;
15715
15774
  let vElse;
15716
- let vFor;
15717
15775
  if (vIf = findDir(slotElement, "if")) {
15718
15776
  hasDynamicSlots = true;
15719
15777
  dynamicSlots.push(
@@ -15758,7 +15816,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15758
15816
  createCompilerError(30, vElse.loc)
15759
15817
  );
15760
15818
  }
15761
- } else if (vFor = findDir(slotElement, "for")) {
15819
+ } else if (vFor) {
15762
15820
  hasDynamicSlots = true;
15763
15821
  const parseResult = vFor.parseResult || parseForExpression(vFor.exp, context);
15764
15822
  if (parseResult) {
@@ -15799,7 +15857,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15799
15857
  }
15800
15858
  if (!onComponentSlot) {
15801
15859
  const buildDefaultSlotProperty = (props, children2) => {
15802
- const fn = buildSlotFn(props, children2, loc);
15860
+ const fn = buildSlotFn(props, void 0, children2, loc);
15803
15861
  if (context.compatConfig) {
15804
15862
  fn.isNonScopedSlot = true;
15805
15863
  }