@vue/compiler-sfc 3.1.0-beta.5 → 3.1.1

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.
@@ -86,7 +86,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
86
86
  const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
87
87
  prefixIdentifiers: true,
88
88
  inline: true,
89
- bindingMetadata: bindings
89
+ bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
90
90
  });
91
91
  const transformed = CompilerDOM.processExpression(exp, context);
92
92
  const transformedString = transformed.type === 4 /* SIMPLE_EXPRESSION */
@@ -1483,7 +1483,7 @@ function compileScript(sfc, options) {
1483
1483
  break;
1484
1484
  }
1485
1485
  }
1486
- for (let i = left.end; i > 0; i++) {
1486
+ for (let i = right.end; i > 0; i++) {
1487
1487
  const char = source[i + startOffset];
1488
1488
  if (char === ')') {
1489
1489
  s.remove(i + startOffset, i + startOffset + 1);
@@ -737,11 +737,18 @@ function isCoreComponent(tag) {
737
737
  }
738
738
  const nonIdentifierRE = /^\d|[^\$\w]/;
739
739
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
740
- const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[[^\]]+\])*$/;
740
+ const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[(.+)\])*$/;
741
741
  const isMemberExpression = (path) => {
742
742
  if (!path)
743
743
  return false;
744
- return memberExpRE.test(path.trim());
744
+ const matched = memberExpRE.exec(path.trim());
745
+ if (!matched)
746
+ return false;
747
+ if (!matched[1])
748
+ return true;
749
+ if (!/[\[\]]/.test(matched[1]))
750
+ return true;
751
+ return isMemberExpression(matched[1].trim());
745
752
  };
746
753
  function getInnerRange(loc, offset, length) {
747
754
  const source = loc.source.substr(offset, length);
@@ -20472,10 +20479,10 @@ asRawStatements = false) {
20472
20479
  // let is a local non-ref value, and we need to replicate the
20473
20480
  // right hand side value.
20474
20481
  // x = y --> isRef(x) ? x.value = y : x = y
20475
- const rVal = parent.right;
20482
+ const { right: rVal, operator } = parent;
20476
20483
  const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
20477
20484
  const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
20478
- return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value = ${rExpString} : ${raw}`;
20485
+ return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
20479
20486
  }
20480
20487
  else if (isUpdateArg) {
20481
20488
  // make id replace parent in the code range so the raw update operator
@@ -25736,7 +25743,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
25736
25743
  const context = createTransformContext(createRoot([]), {
25737
25744
  prefixIdentifiers: true,
25738
25745
  inline: true,
25739
- bindingMetadata: bindings
25746
+ bindingMetadata: bindings.__isScriptSetup === false ? undefined : bindings
25740
25747
  });
25741
25748
  const transformed = processExpression(exp, context);
25742
25749
  const transformedString = transformed.type === 4 /* SIMPLE_EXPRESSION */
@@ -41528,7 +41535,7 @@ function compileScript(sfc, options) {
41528
41535
  break;
41529
41536
  }
41530
41537
  }
41531
- for (let i = left.end; i > 0; i++) {
41538
+ for (let i = right.end; i > 0; i++) {
41532
41539
  const char = source[i + startOffset];
41533
41540
  if (char === ')') {
41534
41541
  s.remove(i + startOffset, i + startOffset + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.1.0-beta.5",
3
+ "version": "3.1.1",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "types": "dist/compiler-sfc.d.ts",
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
33
33
  "peerDependencies": {
34
- "vue": "3.1.0-beta.5"
34
+ "vue": "3.1.1"
35
35
  },
36
36
  "dependencies": {
37
37
  "@babel/parser": "^7.13.9",
38
38
  "@babel/types": "^7.13.0",
39
- "@vue/compiler-core": "3.1.0-beta.5",
40
- "@vue/compiler-dom": "3.1.0-beta.5",
41
- "@vue/compiler-ssr": "3.1.0-beta.5",
42
- "@vue/shared": "3.1.0-beta.5",
39
+ "@vue/compiler-core": "3.1.1",
40
+ "@vue/compiler-dom": "3.1.1",
41
+ "@vue/compiler-ssr": "3.1.1",
42
+ "@vue/shared": "3.1.1",
43
43
  "consolidate": "^0.16.0",
44
44
  "estree-walker": "^2.0.1",
45
45
  "hash-sum": "^2.0.0",