@vue/compiler-core 3.2.11 → 3.2.12

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.
@@ -4604,7 +4604,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
4604
4604
  // acrtual ref instead.
4605
4605
  if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
4606
4606
  valueNode = createFunctionExpression(['_value', '_refs']);
4607
- valueNode.body = createBlockStatement(processInlineRef(context.bindingMetadata, value.content));
4607
+ valueNode.body = createBlockStatement(processInlineRef(context, value.content));
4608
4608
  }
4609
4609
  }
4610
4610
  // skip is on <component>, or is="vue:xxx"
@@ -4924,14 +4924,18 @@ function stringifyDynamicPropNames(props) {
4924
4924
  function isComponentTag(tag) {
4925
4925
  return tag[0].toLowerCase() + tag.slice(1) === 'component';
4926
4926
  }
4927
- function processInlineRef(bindings, raw) {
4927
+ function processInlineRef(context, raw) {
4928
4928
  const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
4929
- const type = bindings[raw];
4929
+ const { bindingMetadata, helperString } = context;
4930
+ const type = bindingMetadata[raw];
4930
4931
  if (type === "setup-ref" /* SETUP_REF */) {
4931
4932
  body.push(createSimpleExpression(`${raw}.value = _value`));
4932
4933
  }
4934
+ else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
4935
+ body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
4936
+ }
4933
4937
  else if (type === "setup-let" /* SETUP_LET */) {
4934
- body.push(createSimpleExpression(`${raw} = _value`));
4938
+ body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
4935
4939
  }
4936
4940
  return body;
4937
4941
  }
@@ -5026,7 +5030,7 @@ function processSlotOutlet(node, context) {
5026
5030
  };
5027
5031
  }
5028
5032
 
5029
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
5033
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5030
5034
  const transformOn = (dir, node, context, augmentor) => {
5031
5035
  const { loc, modifiers, arg } = dir;
5032
5036
  if (!dir.exp && !modifiers.length) {
@@ -4503,7 +4503,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
4503
4503
  // acrtual ref instead.
4504
4504
  if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
4505
4505
  valueNode = createFunctionExpression(['_value', '_refs']);
4506
- valueNode.body = createBlockStatement(processInlineRef(context.bindingMetadata, value.content));
4506
+ valueNode.body = createBlockStatement(processInlineRef(context, value.content));
4507
4507
  }
4508
4508
  }
4509
4509
  // skip is on <component>, or is="vue:xxx"
@@ -4800,14 +4800,18 @@ function stringifyDynamicPropNames(props) {
4800
4800
  function isComponentTag(tag) {
4801
4801
  return tag[0].toLowerCase() + tag.slice(1) === 'component';
4802
4802
  }
4803
- function processInlineRef(bindings, raw) {
4803
+ function processInlineRef(context, raw) {
4804
4804
  const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
4805
- const type = bindings[raw];
4805
+ const { bindingMetadata, helperString } = context;
4806
+ const type = bindingMetadata[raw];
4806
4807
  if (type === "setup-ref" /* SETUP_REF */) {
4807
4808
  body.push(createSimpleExpression(`${raw}.value = _value`));
4808
4809
  }
4810
+ else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
4811
+ body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
4812
+ }
4809
4813
  else if (type === "setup-let" /* SETUP_LET */) {
4810
- body.push(createSimpleExpression(`${raw} = _value`));
4814
+ body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
4811
4815
  }
4812
4816
  return body;
4813
4817
  }
@@ -4899,7 +4903,7 @@ function processSlotOutlet(node, context) {
4899
4903
  };
4900
4904
  }
4901
4905
 
4902
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
4906
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
4903
4907
  const transformOn = (dir, node, context, augmentor) => {
4904
4908
  const { loc, modifiers, arg } = dir;
4905
4909
  if (!dir.exp && !modifiers.length) {
@@ -4290,7 +4290,7 @@ function processSlotOutlet(node, context) {
4290
4290
  };
4291
4291
  }
4292
4292
 
4293
- const fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^\s*function(?:\s+[\w$]+)?\s*\(/;
4293
+ const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
4294
4294
  const transformOn = (dir, node, context, augmentor) => {
4295
4295
  const { loc, modifiers, arg } = dir;
4296
4296
  if (!dir.exp && !modifiers.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.2.11",
3
+ "version": "3.2.12",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.11",
35
+ "@vue/shared": "3.2.12",
36
36
  "@babel/parser": "^7.15.0",
37
37
  "@babel/types": "^7.15.0",
38
38
  "estree-walker": "^2.0.2",