@vue/compat 3.2.12 → 3.2.13

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.
@@ -1485,7 +1485,8 @@ class ComputedRefImpl {
1485
1485
  function computed(getterOrOptions, debugOptions) {
1486
1486
  let getter;
1487
1487
  let setter;
1488
- if (isFunction(getterOrOptions)) {
1488
+ const onlyGetter = isFunction(getterOrOptions);
1489
+ if (onlyGetter) {
1489
1490
  getter = getterOrOptions;
1490
1491
  setter = () => {
1491
1492
  console.warn('Write operation failed: computed value is readonly');
@@ -1496,7 +1497,7 @@ function computed(getterOrOptions, debugOptions) {
1496
1497
  getter = getterOrOptions.get;
1497
1498
  setter = getterOrOptions.set;
1498
1499
  }
1499
- const cRef = new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
1500
+ const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
1500
1501
  if (debugOptions) {
1501
1502
  cRef.effect.onTrack = debugOptions.onTrack;
1502
1503
  cRef.effect.onTrigger = debugOptions.onTrigger;
@@ -1951,7 +1952,7 @@ const deprecationData = {
1951
1952
  ["PRIVATE_APIS" /* PRIVATE_APIS */]: {
1952
1953
  message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
1953
1954
  `If you are seeing this warning only due to a dependency, you can ` +
1954
- `suppress this warning via { PRIVATE_APIS: 'supress-warning' }.`
1955
+ `suppress this warning via { PRIVATE_APIS: 'suppress-warning' }.`
1955
1956
  }
1956
1957
  };
1957
1958
  const instanceWarned = Object.create(null);
@@ -5272,7 +5273,7 @@ function createCompatVue(createApp, createSingletonApp) {
5272
5273
  return vm;
5273
5274
  }
5274
5275
  }
5275
- Vue.version = "3.2.12";
5276
+ Vue.version = "3.2.13";
5276
5277
  Vue.config = singletonApp.config;
5277
5278
  Vue.use = (p, ...options) => {
5278
5279
  if (p && isFunction(p.install)) {
@@ -5803,7 +5804,7 @@ function createAppAPI(render, hydrate) {
5803
5804
  app._instance = vnode.component;
5804
5805
  devtoolsInitApp(app, version);
5805
5806
  }
5806
- return vnode.component.proxy;
5807
+ return getExposeProxy(vnode.component) || vnode.component.proxy;
5807
5808
  }
5808
5809
  else {
5809
5810
  warn$1(`App has already been mounted.\n` +
@@ -6012,14 +6013,14 @@ function createHydrationFunctions(rendererInternals) {
6012
6013
  for (const key in props) {
6013
6014
  if ((forcePatchValue && key.endsWith('value')) ||
6014
6015
  (isOn(key) && !isReservedProp(key))) {
6015
- patchProp(el, key, null, props[key]);
6016
+ patchProp(el, key, null, props[key], false, undefined, parentComponent);
6016
6017
  }
6017
6018
  }
6018
6019
  }
6019
6020
  else if (props.onClick) {
6020
6021
  // Fast path for click listeners (which is most often) to avoid
6021
6022
  // iterating through props.
6022
- patchProp(el, 'onClick', null, props.onClick);
6023
+ patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
6023
6024
  }
6024
6025
  }
6025
6026
  // vnode / directive hooks
@@ -10425,7 +10426,7 @@ function createPathGetter(ctx, path) {
10425
10426
  return cur;
10426
10427
  };
10427
10428
  }
10428
- function traverse(value, seen = new Set()) {
10429
+ function traverse(value, seen) {
10429
10430
  if (!isObject(value) || value["__v_skip" /* SKIP */]) {
10430
10431
  return value;
10431
10432
  }
@@ -10841,7 +10842,7 @@ function isMemoSame(cached, memo) {
10841
10842
  }
10842
10843
 
10843
10844
  // Core API ------------------------------------------------------------------
10844
- const version = "3.2.12";
10845
+ const version = "3.2.13";
10845
10846
  /**
10846
10847
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10847
10848
  * @internal
@@ -12825,7 +12826,7 @@ const errorMessages = {
12825
12826
  // transform errors
12826
12827
  [28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
12827
12828
  [29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
12828
- [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
12829
+ [30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
12829
12830
  [31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
12830
12831
  [32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
12831
12832
  [33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
@@ -13103,7 +13104,7 @@ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
13103
13104
  * inside square brackets), but it's ok since these are only used on template
13104
13105
  * expressions and false positives are invalid expressions in the first place.
13105
13106
  */
13106
- const isMemberExpression = (path) => {
13107
+ const isMemberExpressionBrowser = (path) => {
13107
13108
  // remove whitespaces around . or [ first
13108
13109
  path = path.trim().replace(whitespaceRE, s => s.trim());
13109
13110
  let state = 0 /* inMemberExp */;
@@ -13173,6 +13174,8 @@ const isMemberExpression = (path) => {
13173
13174
  }
13174
13175
  return !currentOpenBracketCount && !currentOpenParensCount;
13175
13176
  };
13177
+ const isMemberExpression = isMemberExpressionBrowser
13178
+ ;
13176
13179
  function getInnerRange(loc, offset, length) {
13177
13180
  const source = loc.source.substr(offset, length);
13178
13181
  const newLoc = {
@@ -14319,7 +14322,7 @@ function walk$1(node, context, doNotHoistNode = false) {
14319
14322
  // This is only a concern for pre-stringification (via transformHoist by
14320
14323
  // @vue/compiler-dom), but doing it here allows us to perform only one full
14321
14324
  // walk of the AST and allow `stringifyStatic` to stop walking as soon as its
14322
- // stringficiation threshold is met.
14325
+ // stringification threshold is met.
14323
14326
  let canStringify = true;
14324
14327
  const { children } = node;
14325
14328
  const originalCount = children.length;
@@ -14565,7 +14568,7 @@ function getGeneratedPropsConstantType(node, context) {
14565
14568
  else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
14566
14569
  // some helper calls can be hoisted,
14567
14570
  // such as the `normalizeProps` generated by the compiler for pre-normalize class,
14568
- // in this case we need to respect the ConstanType of the helper's argments
14571
+ // in this case we need to respect the ConstantType of the helper's argments
14569
14572
  valueType = getConstantTypeOfHelperCall(value, context);
14570
14573
  }
14571
14574
  else {
@@ -15078,13 +15081,14 @@ function genHoists(hoists, context) {
15078
15081
  context.pure = true;
15079
15082
  const { push, newline, helper, scopeId, mode } = context;
15080
15083
  newline();
15081
- hoists.forEach((exp, i) => {
15084
+ for (let i = 0; i < hoists.length; i++) {
15085
+ const exp = hoists[i];
15082
15086
  if (exp) {
15083
- push(`const _hoisted_${i + 1} = `);
15087
+ push(`const _hoisted_${i + 1} = ${``}`);
15084
15088
  genNode(exp, context);
15085
15089
  newline();
15086
15090
  }
15087
- });
15091
+ }
15088
15092
  context.pure = false;
15089
15093
  }
15090
15094
  function isText$1(n) {
@@ -15591,6 +15595,11 @@ function processIf(node, dir, context, processCodegen) {
15591
15595
  continue;
15592
15596
  }
15593
15597
  if (sibling && sibling.type === 9 /* IF */) {
15598
+ // Check if v-else was followed by v-else-if
15599
+ if (dir.name === 'else-if' &&
15600
+ sibling.branches[sibling.branches.length - 1].condition === undefined) {
15601
+ context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
15602
+ }
15594
15603
  // move the node to the if node's branches
15595
15604
  context.removeNode();
15596
15605
  const branch = createIfBranch(node, dir);
@@ -16682,7 +16691,7 @@ function dedupeProperties(properties) {
16682
16691
  const name = prop.key.content;
16683
16692
  const existing = knownProps.get(name);
16684
16693
  if (existing) {
16685
- if (name === 'style' || name === 'class' || name.startsWith('on')) {
16694
+ if (name === 'style' || name === 'class' || isOn(name)) {
16686
16695
  mergeAsArray$1(existing, prop);
16687
16696
  }
16688
16697
  // unexpected duplicate, should have emitted error during parse
@@ -16757,26 +16766,24 @@ const transformSlotOutlet = (node, context) => {
16757
16766
  const { slotName, slotProps } = processSlotOutlet(node, context);
16758
16767
  const slotArgs = [
16759
16768
  context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
16760
- slotName
16769
+ slotName,
16770
+ '{}',
16771
+ 'undefined',
16772
+ 'true'
16761
16773
  ];
16774
+ let expectedLen = 2;
16762
16775
  if (slotProps) {
16763
- slotArgs.push(slotProps);
16776
+ slotArgs[2] = slotProps;
16777
+ expectedLen = 3;
16764
16778
  }
16765
16779
  if (children.length) {
16766
- if (!slotProps) {
16767
- slotArgs.push(`{}`);
16768
- }
16769
- slotArgs.push(createFunctionExpression([], children, false, false, loc));
16780
+ slotArgs[3] = createFunctionExpression([], children, false, false, loc);
16781
+ expectedLen = 4;
16770
16782
  }
16771
16783
  if (context.scopeId && !context.slotted) {
16772
- if (!slotProps) {
16773
- slotArgs.push(`{}`);
16774
- }
16775
- if (!children.length) {
16776
- slotArgs.push(`undefined`);
16777
- }
16778
- slotArgs.push(`true`);
16784
+ expectedLen = 5;
16779
16785
  }
16786
+ slotArgs.splice(expectedLen); // remove unused arguments
16780
16787
  node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
16781
16788
  }
16782
16789
  };
@@ -17078,7 +17085,8 @@ const transformModel = (dir, node, context) => {
17078
17085
  // _unref(exp)
17079
17086
  context.bindingMetadata[rawExp];
17080
17087
  const maybeRef = !true /* SETUP_CONST */;
17081
- if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
17088
+ if (!expString.trim() ||
17089
+ (!isMemberExpression(expString) && !maybeRef)) {
17082
17090
  context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
17083
17091
  return createTransformProps();
17084
17092
  }
@@ -17784,7 +17792,8 @@ const warnTransitionChildren = (node, context) => {
17784
17792
  };
17785
17793
  function hasMultipleChildren(node) {
17786
17794
  // #1352 filter out potential comment nodes.
17787
- const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */));
17795
+ const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
17796
+ !(c.type === 2 /* TEXT */ && !c.content.trim())));
17788
17797
  const child = children[0];
17789
17798
  return (children.length !== 1 ||
17790
17799
  child.type === 11 /* FOR */ ||