@vue/compat 3.3.8 → 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.
@@ -104,7 +104,7 @@ const PatchFlagNames = {
104
104
  [4]: `STYLE`,
105
105
  [8]: `PROPS`,
106
106
  [16]: `FULL_PROPS`,
107
- [32]: `HYDRATE_EVENTS`,
107
+ [32]: `NEED_HYDRATION`,
108
108
  [64]: `STABLE_FRAGMENT`,
109
109
  [128]: `KEYED_FRAGMENT`,
110
110
  [256]: `UNKEYED_FRAGMENT`,
@@ -1005,7 +1005,7 @@ function createReadonlyMethod(type) {
1005
1005
  toRaw(this)
1006
1006
  );
1007
1007
  }
1008
- return type === "delete" ? false : this;
1008
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
1009
1009
  };
1010
1010
  }
1011
1011
  function createInstrumentations() {
@@ -2746,9 +2746,19 @@ function renderComponentRoot(instance) {
2746
2746
  try {
2747
2747
  if (vnode.shapeFlag & 4) {
2748
2748
  const proxyToUse = withProxy || proxy;
2749
+ const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
2750
+ get(target, key, receiver) {
2751
+ warn(
2752
+ `Property '${String(
2753
+ key
2754
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
2755
+ );
2756
+ return Reflect.get(target, key, receiver);
2757
+ }
2758
+ }) : proxyToUse;
2749
2759
  result = normalizeVNode(
2750
2760
  render.call(
2751
- proxyToUse,
2761
+ thisProxy,
2752
2762
  proxyToUse,
2753
2763
  renderCache,
2754
2764
  props,
@@ -3778,6 +3788,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
3778
3788
  let onCleanup = (fn) => {
3779
3789
  cleanup = effect.onStop = () => {
3780
3790
  callWithErrorHandling(fn, instance, 4);
3791
+ cleanup = effect.onStop = void 0;
3781
3792
  };
3782
3793
  };
3783
3794
  let ssrCleanup;
@@ -4277,7 +4288,11 @@ function emptyPlaceholder(vnode) {
4277
4288
  }
4278
4289
  }
4279
4290
  function getKeepAliveChild(vnode) {
4280
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
4291
+ return isKeepAlive(vnode) ? (
4292
+ // #7121 ensure get the child component subtree in case
4293
+ // it's been replaced during HMR
4294
+ !!(process.env.NODE_ENV !== "production") && vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
4295
+ ) : vnode;
4281
4296
  }
4282
4297
  function setTransitionHooks(vnode, hooks) {
4283
4298
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -6302,7 +6317,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6302
6317
  return vm;
6303
6318
  }
6304
6319
  }
6305
- Vue.version = `2.6.14-compat:${"3.3.8"}`;
6320
+ Vue.version = `2.6.14-compat:${"3.3.9"}`;
6306
6321
  Vue.config = singletonApp.config;
6307
6322
  Vue.use = (p, ...options) => {
6308
6323
  if (p && isFunction(p.install)) {
@@ -7333,6 +7348,9 @@ function assertType(value, type) {
7333
7348
  };
7334
7349
  }
7335
7350
  function getInvalidTypeMessage(name, value, expectedTypes) {
7351
+ if (expectedTypes.length === 0) {
7352
+ return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
7353
+ }
7336
7354
  let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
7337
7355
  const expectedType = expectedTypes[0];
7338
7356
  const receivedType = toRawType(value);
@@ -7604,6 +7622,20 @@ function createHydrationFunctions(rendererInternals) {
7604
7622
  const { type, ref, shapeFlag, patchFlag } = vnode;
7605
7623
  let domType = node.nodeType;
7606
7624
  vnode.el = node;
7625
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
7626
+ if (!("__vnode" in node)) {
7627
+ Object.defineProperty(node, "__vnode", {
7628
+ value: vnode,
7629
+ enumerable: false
7630
+ });
7631
+ }
7632
+ if (!("__vueParentComponent" in node)) {
7633
+ Object.defineProperty(node, "__vueParentComponent", {
7634
+ value: parentComponent,
7635
+ enumerable: false
7636
+ });
7637
+ }
7638
+ }
7607
7639
  if (patchFlag === -2) {
7608
7640
  optimized = false;
7609
7641
  vnode.dynamicChildren = null;
@@ -7765,15 +7797,16 @@ function createHydrationFunctions(rendererInternals) {
7765
7797
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
7766
7798
  optimized = optimized || !!vnode.dynamicChildren;
7767
7799
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
7768
- const forcePatchValue = type === "input" && dirs || type === "option";
7769
- if (!!(process.env.NODE_ENV !== "production") || forcePatchValue || patchFlag !== -1) {
7800
+ const forcePatch = type === "input" || type === "option";
7801
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
7770
7802
  if (dirs) {
7771
7803
  invokeDirectiveHook(vnode, null, parentComponent, "created");
7772
7804
  }
7773
7805
  if (props) {
7774
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
7806
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
7775
7807
  for (const key in props) {
7776
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
7808
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
7809
+ key[0] === ".") {
7777
7810
  patchProp(
7778
7811
  el,
7779
7812
  key,
@@ -9598,6 +9631,7 @@ const resolveTarget = (props, select) => {
9598
9631
  }
9599
9632
  };
9600
9633
  const TeleportImpl = {
9634
+ name: "Teleport",
9601
9635
  __isTeleport: true,
9602
9636
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9603
9637
  const {
@@ -10077,7 +10111,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
10077
10111
  if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
10078
10112
  type = toRaw(type);
10079
10113
  warn(
10080
- `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\`.`,
10114
+ `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\`.`,
10081
10115
  `
10082
10116
  Component that was made reactive: `,
10083
10117
  type
@@ -10941,7 +10975,7 @@ function isMemoSame(cached, memo) {
10941
10975
  return true;
10942
10976
  }
10943
10977
 
10944
- const version = "3.3.8";
10978
+ const version = "3.3.9";
10945
10979
  const _ssrUtils = {
10946
10980
  createComponentInstance,
10947
10981
  setupComponent,
@@ -12197,21 +12231,20 @@ const vModelText = {
12197
12231
  el[assignKey] = getModelAssigner(vnode);
12198
12232
  if (el.composing)
12199
12233
  return;
12234
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
12235
+ const newValue = value == null ? "" : value;
12236
+ if (elValue === newValue) {
12237
+ return;
12238
+ }
12200
12239
  if (document.activeElement === el && el.type !== "range") {
12201
12240
  if (lazy) {
12202
12241
  return;
12203
12242
  }
12204
- if (trim && el.value.trim() === value) {
12205
- return;
12206
- }
12207
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12243
+ if (trim && el.value.trim() === newValue) {
12208
12244
  return;
12209
12245
  }
12210
12246
  }
12211
- const newValue = value == null ? "" : value;
12212
- if (el.value !== newValue) {
12213
- el.value = newValue;
12214
- }
12247
+ el.value = newValue;
12215
12248
  }
12216
12249
  };
12217
12250
  const vModelCheckbox = {
@@ -13379,6 +13412,7 @@ function getMemoedVNodeCall(node) {
13379
13412
  return node;
13380
13413
  }
13381
13414
  }
13415
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13382
13416
 
13383
13417
  const deprecationData = {
13384
13418
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -15777,7 +15811,6 @@ function processFor(node, dir, context, processCodegen) {
15777
15811
  onExit();
15778
15812
  };
15779
15813
  }
15780
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15781
15814
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15782
15815
  const stripParensRE = /^\(|\)$/g;
15783
15816
  function parseForExpression(input, context) {
@@ -16377,7 +16410,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16377
16410
  )
16378
16411
  );
16379
16412
  } else {
16380
- const { name, arg, exp, loc } = prop;
16413
+ const { name, arg, exp, loc, modifiers } = prop;
16381
16414
  const isVBind = name === "bind";
16382
16415
  const isVOn = name === "on";
16383
16416
  if (name === "slot") {
@@ -16470,6 +16503,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
16470
16503
  }
16471
16504
  continue;
16472
16505
  }
16506
+ if (isVBind && modifiers.includes("prop")) {
16507
+ patchFlag |= 32;
16508
+ }
16473
16509
  const directiveTransform = context.directiveTransforms[name];
16474
16510
  if (directiveTransform) {
16475
16511
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -17502,8 +17538,8 @@ const transformModel = (dir, node, context) => {
17502
17538
  );
17503
17539
  }
17504
17540
  function checkDuplicatedValue() {
17505
- const value = findProp(node, "value");
17506
- if (value) {
17541
+ const value = findDir(node, "bind");
17542
+ if (value && isStaticArgOf(value.arg, "value")) {
17507
17543
  context.onError(
17508
17544
  createDOMCompilerError(
17509
17545
  60,
@@ -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,
@@ -3764,6 +3774,7 @@ If this is a native custom element, make sure to exclude it from component resol
3764
3774
  let onCleanup = (fn) => {
3765
3775
  cleanup = effect.onStop = () => {
3766
3776
  callWithErrorHandling(fn, instance, 4);
3777
+ cleanup = effect.onStop = void 0;
3767
3778
  };
3768
3779
  };
3769
3780
  let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
@@ -4240,7 +4251,11 @@ If this is a native custom element, make sure to exclude it from component resol
4240
4251
  }
4241
4252
  }
4242
4253
  function getKeepAliveChild(vnode) {
4243
- 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;
4244
4259
  }
4245
4260
  function setTransitionHooks(vnode, hooks) {
4246
4261
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -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.8"}`;
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;
@@ -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,
@@ -9516,6 +9549,7 @@ If you want to remount the same app, move your app creation logic into a factory
9516
9549
  }
9517
9550
  };
9518
9551
  const TeleportImpl = {
9552
+ name: "Teleport",
9519
9553
  __isTeleport: true,
9520
9554
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
9521
9555
  const {
@@ -9995,7 +10029,7 @@ If you want to remount the same app, move your app creation logic into a factory
9995
10029
  if (shapeFlag & 4 && isProxy(type)) {
9996
10030
  type = toRaw(type);
9997
10031
  warn(
9998
- `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\`.`,
9999
10033
  `
10000
10034
  Component that was made reactive: `,
10001
10035
  type
@@ -10825,7 +10859,7 @@ Component that was made reactive: `,
10825
10859
  return true;
10826
10860
  }
10827
10861
 
10828
- const version = "3.3.8";
10862
+ const version = "3.3.9";
10829
10863
  const ssrUtils = null;
10830
10864
  const resolveFilter = resolveFilter$1 ;
10831
10865
  const _compatUtils = {
@@ -12054,21 +12088,20 @@ Component that was made reactive: `,
12054
12088
  el[assignKey] = getModelAssigner(vnode);
12055
12089
  if (el.composing)
12056
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
+ }
12057
12096
  if (document.activeElement === el && el.type !== "range") {
12058
12097
  if (lazy) {
12059
12098
  return;
12060
12099
  }
12061
- if (trim && el.value.trim() === value) {
12062
- return;
12063
- }
12064
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
12100
+ if (trim && el.value.trim() === newValue) {
12065
12101
  return;
12066
12102
  }
12067
12103
  }
12068
- const newValue = value == null ? "" : value;
12069
- if (el.value !== newValue) {
12070
- el.value = newValue;
12071
- }
12104
+ el.value = newValue;
12072
12105
  }
12073
12106
  };
12074
12107
  const vModelCheckbox = {
@@ -13201,6 +13234,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13201
13234
  return node;
13202
13235
  }
13203
13236
  }
13237
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13204
13238
 
13205
13239
  const deprecationData = {
13206
13240
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -15598,7 +15632,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
15598
15632
  onExit();
15599
15633
  };
15600
15634
  }
15601
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15602
15635
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
15603
15636
  const stripParensRE = /^\(|\)$/g;
15604
15637
  function parseForExpression(input, context) {
@@ -16196,7 +16229,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16196
16229
  )
16197
16230
  );
16198
16231
  } else {
16199
- const { name, arg, exp, loc } = prop;
16232
+ const { name, arg, exp, loc, modifiers } = prop;
16200
16233
  const isVBind = name === "bind";
16201
16234
  const isVOn = name === "on";
16202
16235
  if (name === "slot") {
@@ -16289,6 +16322,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16289
16322
  }
16290
16323
  continue;
16291
16324
  }
16325
+ if (isVBind && modifiers.includes("prop")) {
16326
+ patchFlag |= 32;
16327
+ }
16292
16328
  const directiveTransform = context.directiveTransforms[name];
16293
16329
  if (directiveTransform) {
16294
16330
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -17321,8 +17357,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17321
17357
  );
17322
17358
  }
17323
17359
  function checkDuplicatedValue() {
17324
- const value = findProp(node, "value");
17325
- if (value) {
17360
+ const value = findDir(node, "bind");
17361
+ if (value && isStaticArgOf(value.arg, "value")) {
17326
17362
  context.onError(
17327
17363
  createDOMCompilerError(
17328
17364
  60,