@vue/compat 3.3.7 → 3.3.9

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.
@@ -107,7 +107,7 @@ var Vue = (function () {
107
107
  [4]: `STYLE`,
108
108
  [8]: `PROPS`,
109
109
  [16]: `FULL_PROPS`,
110
- [32]: `HYDRATE_EVENTS`,
110
+ [32]: `NEED_HYDRATION`,
111
111
  [64]: `STABLE_FRAGMENT`,
112
112
  [128]: `KEYED_FRAGMENT`,
113
113
  [256]: `UNKEYED_FRAGMENT`,
@@ -1004,7 +1004,7 @@ var Vue = (function () {
1004
1004
  toRaw(this)
1005
1005
  );
1006
1006
  }
1007
- return type === "delete" ? false : this;
1007
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1008
1008
  };
1009
1009
  }
1010
1010
  function createInstrumentations() {
@@ -2732,9 +2732,19 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2732
2732
  try {
2733
2733
  if (vnode.shapeFlag & 4) {
2734
2734
  const proxyToUse = withProxy || proxy;
2735
+ const thisProxy = setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2736
+ get(target, key, receiver) {
2737
+ warn(
2738
+ `Property '${String(
2739
+ key
2740
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2741
+ );
2742
+ return Reflect.get(target, key, receiver);
2743
+ }
2744
+ }) : proxyToUse;
2735
2745
  result = normalizeVNode(
2736
2746
  render.call(
2737
- proxyToUse,
2747
+ thisProxy,
2738
2748
  proxyToUse,
2739
2749
  renderCache,
2740
2750
  props,
@@ -2985,6 +2995,65 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
2985
2995
  }
2986
2996
  }
2987
2997
 
2998
+ const COMPONENTS = "components";
2999
+ const DIRECTIVES = "directives";
3000
+ const FILTERS = "filters";
3001
+ function resolveComponent(name, maybeSelfReference) {
3002
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3003
+ }
3004
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3005
+ function resolveDynamicComponent(component) {
3006
+ if (isString(component)) {
3007
+ return resolveAsset(COMPONENTS, component, false) || component;
3008
+ } else {
3009
+ return component || NULL_DYNAMIC_COMPONENT;
3010
+ }
3011
+ }
3012
+ function resolveDirective(name) {
3013
+ return resolveAsset(DIRECTIVES, name);
3014
+ }
3015
+ function resolveFilter$1(name) {
3016
+ return resolveAsset(FILTERS, name);
3017
+ }
3018
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3019
+ const instance = currentRenderingInstance || currentInstance;
3020
+ if (instance) {
3021
+ const Component = instance.type;
3022
+ if (type === COMPONENTS) {
3023
+ const selfName = getComponentName(
3024
+ Component,
3025
+ false
3026
+ /* do not include inferred name to avoid breaking existing code */
3027
+ );
3028
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3029
+ return Component;
3030
+ }
3031
+ }
3032
+ const res = (
3033
+ // local registration
3034
+ // check instance[type] first which is resolved for options API
3035
+ resolve(instance[type] || Component[type], name) || // global registration
3036
+ resolve(instance.appContext[type], name)
3037
+ );
3038
+ if (!res && maybeSelfReference) {
3039
+ return Component;
3040
+ }
3041
+ if (warnMissing && !res) {
3042
+ const extra = type === COMPONENTS ? `
3043
+ If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
3044
+ warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
3045
+ }
3046
+ return res;
3047
+ } else {
3048
+ warn(
3049
+ `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
3050
+ );
3051
+ }
3052
+ }
3053
+ function resolve(registry, name) {
3054
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3055
+ }
3056
+
2988
3057
  const isSuspense = (type) => type.__isSuspense;
2989
3058
  const SuspenseImpl = {
2990
3059
  name: "Suspense",
@@ -3519,7 +3588,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3519
3588
  }
3520
3589
  if (isArray(s)) {
3521
3590
  const singleChild = filterSingleRoot(s);
3522
- if (!singleChild) {
3591
+ if (!singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
3523
3592
  warn(`<Suspense> slots expect a single root node.`);
3524
3593
  }
3525
3594
  s = singleChild;
@@ -3705,6 +3774,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3705
3774
  let onCleanup = (fn) => {
3706
3775
  cleanup = effect.onStop = () => {
3707
3776
  callWithErrorHandling(fn, instance, 4);
3777
+ cleanup = effect.onStop = void 0;
3708
3778
  };
3709
3779
  };
3710
3780
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4181,7 +4251,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4181
4251
  }
4182
4252
  }
4183
4253
  function getKeepAliveChild(vnode) {
4184
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4254
+ return isKeepAlive(vnode) ? (
4255
+ // #7121 ensure get the child component subtree in case
4256
+ // it's been replaced during HMR
4257
+ vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4258
+ ) : vnode;
4185
4259
  }
4186
4260
  function setTransitionHooks(vnode, hooks) {
4187
4261
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -4696,65 +4770,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4696
4770
  return listeners;
4697
4771
  }
4698
4772
 
4699
- const COMPONENTS = "components";
4700
- const DIRECTIVES = "directives";
4701
- const FILTERS = "filters";
4702
- function resolveComponent(name, maybeSelfReference) {
4703
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
4704
- }
4705
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
4706
- function resolveDynamicComponent(component) {
4707
- if (isString(component)) {
4708
- return resolveAsset(COMPONENTS, component, false) || component;
4709
- } else {
4710
- return component || NULL_DYNAMIC_COMPONENT;
4711
- }
4712
- }
4713
- function resolveDirective(name) {
4714
- return resolveAsset(DIRECTIVES, name);
4715
- }
4716
- function resolveFilter$1(name) {
4717
- return resolveAsset(FILTERS, name);
4718
- }
4719
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
4720
- const instance = currentRenderingInstance || currentInstance;
4721
- if (instance) {
4722
- const Component = instance.type;
4723
- if (type === COMPONENTS) {
4724
- const selfName = getComponentName(
4725
- Component,
4726
- false
4727
- /* do not include inferred name to avoid breaking existing code */
4728
- );
4729
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
4730
- return Component;
4731
- }
4732
- }
4733
- const res = (
4734
- // local registration
4735
- // check instance[type] first which is resolved for options API
4736
- resolve(instance[type] || Component[type], name) || // global registration
4737
- resolve(instance.appContext[type], name)
4738
- );
4739
- if (!res && maybeSelfReference) {
4740
- return Component;
4741
- }
4742
- if (warnMissing && !res) {
4743
- const extra = type === COMPONENTS ? `
4744
- If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
4745
- warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
4746
- }
4747
- return res;
4748
- } else {
4749
- warn(
4750
- `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
4751
- );
4752
- }
4753
- }
4754
- function resolve(registry, name) {
4755
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
4756
- }
4757
-
4758
4773
  function convertLegacyRenderFn(instance) {
4759
4774
  const Component2 = instance.type;
4760
4775
  const render = Component2.render;
@@ -6257,7 +6272,7 @@ If this is a native custom element, make sure to exclude it from component resol
6257
6272
  return vm;
6258
6273
  }
6259
6274
  }
6260
- Vue.version = `2.6.14-compat:${"3.3.7"}`;
6275
+ Vue.version = `2.6.14-compat:${"3.3.9"}`;
6261
6276
  Vue.config = singletonApp.config;
6262
6277
  Vue.use = (p, ...options) => {
6263
6278
  if (p && isFunction(p.install)) {
@@ -7285,6 +7300,9 @@ If you want to remount the same app, move your app creation logic into a factory
7285
7300
  };
7286
7301
  }
7287
7302
  function getInvalidTypeMessage(name, value, expectedTypes) {
7303
+ if (expectedTypes.length === 0) {
7304
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7305
+ }
7288
7306
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7289
7307
  const expectedType = expectedTypes[0];
7290
7308
  const receivedType = toRawType(value);
@@ -7556,6 +7574,20 @@ If you want to remount the same app, move your app creation logic into a factory
7556
7574
  const { type, ref, shapeFlag, patchFlag } = vnode;
7557
7575
  let domType = node.nodeType;
7558
7576
  vnode.el = node;
7577
+ {
7578
+ if (!("__vnode" in node)) {
7579
+ Object.defineProperty(node, "__vnode", {
7580
+ value: vnode,
7581
+ enumerable: false
7582
+ });
7583
+ }
7584
+ if (!("__vueParentComponent" in node)) {
7585
+ Object.defineProperty(node, "__vueParentComponent", {
7586
+ value: parentComponent,
7587
+ enumerable: false
7588
+ });
7589
+ }
7590
+ }
7559
7591
  if (patchFlag === -2) {
7560
7592
  optimized = false;
7561
7593
  vnode.dynamicChildren = null;
@@ -7586,15 +7618,15 @@ If you want to remount the same app, move your app creation logic into a factory
7586
7618
  }
7587
7619
  break;
7588
7620
  case Comment:
7589
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7590
- if (node.tagName.toLowerCase() === "template") {
7591
- const content = vnode.el.content.firstChild;
7592
- replaceNode(content, node, parentComponent);
7593
- vnode.el = node = content;
7594
- nextNode = nextSibling(node);
7595
- } else {
7596
- nextNode = onMismatch();
7597
- }
7621
+ if (isTemplateNode(node)) {
7622
+ nextNode = nextSibling(node);
7623
+ replaceNode(
7624
+ vnode.el = node.content.firstChild,
7625
+ node,
7626
+ parentComponent
7627
+ );
7628
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
7629
+ nextNode = onMismatch();
7598
7630
  } else {
7599
7631
  nextNode = nextSibling(node);
7600
7632
  }
@@ -7717,15 +7749,16 @@ If you want to remount the same app, move your app creation logic into a factory
7717
7749
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7718
7750
  optimized = optimized || !!vnode.dynamicChildren;
7719
7751
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7720
- const forcePatchValue = type === "input" && dirs || type === "option";
7752
+ const forcePatch = type === "input" || type === "option";
7721
7753
  {
7722
7754
  if (dirs) {
7723
7755
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7724
7756
  }
7725
7757
  if (props) {
7726
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7758
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7727
7759
  for (const key in props) {
7728
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7760
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7761
+ key[0] === ".") {
7729
7762
  patchProp(
7730
7763
  el,
7731
7764
  key,
@@ -7938,8 +7971,7 @@ If you want to remount the same app, move your app creation logic into a factory
7938
7971
  let parent = parentComponent;
7939
7972
  while (parent) {
7940
7973
  if (parent.vnode.el === oldNode) {
7941
- parent.vnode.el = newNode;
7942
- parent.subTree.el = newNode;
7974
+ parent.vnode.el = parent.subTree.el = newNode;
7943
7975
  }
7944
7976
  parent = parent.parent;
7945
7977
  }
@@ -9517,6 +9549,7 @@ If you want to remount the same app, move your app creation logic into a factory
9517
9549
  }
9518
9550
  };
9519
9551
  const TeleportImpl = {
9552
+ name: "Teleport",
9520
9553
  __isTeleport: true,
9521
9554
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9522
9555
  const {
@@ -9996,7 +10029,7 @@ If you want to remount the same app, move your app creation logic into a factory
9996
10029
  if (shapeFlag & 4 && isProxy(type)) {
9997
10030
  type = toRaw(type);
9998
10031
  warn(
9999
- `Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10032
+ `Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
10000
10033
  `
10001
10034
  Component that was made reactive: `,
10002
10035
  type
@@ -10826,7 +10859,7 @@ Component that was made reactive: `,
10826
10859
  return true;
10827
10860
  }
10828
10861
 
10829
- const version = "3.3.7";
10862
+ const version = "3.3.9";
10830
10863
  const ssrUtils = null;
10831
10864
  const resolveFilter = resolveFilter$1 ;
10832
10865
  const _compatUtils = {
@@ -12055,21 +12088,20 @@ Component that was made reactive: `,
12055
12088
  el[assignKey] = getModelAssigner(vnode);
12056
12089
  if (el.composing)
12057
12090
  return;
12091
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12092
+ const newValue = value == null ? "" : value;
12093
+ if (elValue === newValue) {
12094
+ return;
12095
+ }
12058
12096
  if (document.activeElement === el && el.type !== "range") {
12059
12097
  if (lazy) {
12060
12098
  return;
12061
12099
  }
12062
- if (trim && el.value.trim() === value) {
12063
- return;
12064
- }
12065
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12100
+ if (trim && el.value.trim() === newValue) {
12066
12101
  return;
12067
12102
  }
12068
12103
  }
12069
- const newValue = value == null ? "" : value;
12070
- if (el.value !== newValue) {
12071
- el.value = newValue;
12072
- }
12104
+ el.value = newValue;
12073
12105
  }
12074
12106
  };
12075
12107
  const vModelCheckbox = {
@@ -13202,6 +13234,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13202
13234
  return node;
13203
13235
  }
13204
13236
  }
13237
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13205
13238
 
13206
13239
  const deprecationData = {
13207
13240
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -15599,7 +15632,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15599
15632
  onExit();
15600
15633
  };
15601
15634
  }
15602
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15603
15635
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15604
15636
  const stripParensRE = /^\(|\)$/g;
15605
15637
  function parseForExpression(input, context) {
@@ -16197,7 +16229,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16197
16229
  )
16198
16230
  );
16199
16231
  } else {
16200
- const { name, arg, exp, loc } = prop;
16232
+ const { name, arg, exp, loc, modifiers } = prop;
16201
16233
  const isVBind = name === "bind";
16202
16234
  const isVOn = name === "on";
16203
16235
  if (name === "slot") {
@@ -16290,6 +16322,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16290
16322
  }
16291
16323
  continue;
16292
16324
  }
16325
+ if (isVBind && modifiers.includes("prop")) {
16326
+ patchFlag |= 32;
16327
+ }
16293
16328
  const directiveTransform = context.directiveTransforms[name];
16294
16329
  if (directiveTransform) {
16295
16330
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -17322,8 +17357,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17322
17357
  );
17323
17358
  }
17324
17359
  function checkDuplicatedValue() {
17325
- const value = findProp(node, "value");
17326
- if (value) {
17360
+ const value = findDir(node, "bind");
17361
+ if (value && isStaticArgOf(value.arg, "value")) {
17327
17362
  context.onError(
17328
17363
  createDOMCompilerError(
17329
17364
  60,