@vue/compiler-core 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.
|
@@ -356,11 +356,18 @@ function isCoreComponent(tag) {
|
|
|
356
356
|
}
|
|
357
357
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
358
358
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
359
|
-
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[
|
|
359
|
+
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[(.+)\])*$/;
|
|
360
360
|
const isMemberExpression = (path) => {
|
|
361
361
|
if (!path)
|
|
362
362
|
return false;
|
|
363
|
-
|
|
363
|
+
const matched = memberExpRE.exec(path.trim());
|
|
364
|
+
if (!matched)
|
|
365
|
+
return false;
|
|
366
|
+
if (!matched[1])
|
|
367
|
+
return true;
|
|
368
|
+
if (!/[\[\]]/.test(matched[1]))
|
|
369
|
+
return true;
|
|
370
|
+
return isMemberExpression(matched[1].trim());
|
|
364
371
|
};
|
|
365
372
|
function getInnerRange(loc, offset, length) {
|
|
366
373
|
const source = loc.source.substr(offset, length);
|
|
@@ -2818,10 +2825,10 @@ asRawStatements = false) {
|
|
|
2818
2825
|
// let is a local non-ref value, and we need to replicate the
|
|
2819
2826
|
// right hand side value.
|
|
2820
2827
|
// x = y --> isRef(x) ? x.value = y : x = y
|
|
2821
|
-
const rVal = parent
|
|
2828
|
+
const { right: rVal, operator } = parent;
|
|
2822
2829
|
const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
|
|
2823
2830
|
const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
|
|
2824
|
-
return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value
|
|
2831
|
+
return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
|
|
2825
2832
|
}
|
|
2826
2833
|
else if (isUpdateArg) {
|
|
2827
2834
|
// make id replace parent in the code range so the raw update operator
|
|
@@ -355,11 +355,18 @@ function isCoreComponent(tag) {
|
|
|
355
355
|
}
|
|
356
356
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
357
357
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
358
|
-
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[
|
|
358
|
+
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[(.+)\])*$/;
|
|
359
359
|
const isMemberExpression = (path) => {
|
|
360
360
|
if (!path)
|
|
361
361
|
return false;
|
|
362
|
-
|
|
362
|
+
const matched = memberExpRE.exec(path.trim());
|
|
363
|
+
if (!matched)
|
|
364
|
+
return false;
|
|
365
|
+
if (!matched[1])
|
|
366
|
+
return true;
|
|
367
|
+
if (!/[\[\]]/.test(matched[1]))
|
|
368
|
+
return true;
|
|
369
|
+
return isMemberExpression(matched[1].trim());
|
|
363
370
|
};
|
|
364
371
|
function getInnerRange(loc, offset, length) {
|
|
365
372
|
const source = loc.source.substr(offset, length);
|
|
@@ -2762,10 +2769,10 @@ asRawStatements = false) {
|
|
|
2762
2769
|
// let is a local non-ref value, and we need to replicate the
|
|
2763
2770
|
// right hand side value.
|
|
2764
2771
|
// x = y --> isRef(x) ? x.value = y : x = y
|
|
2765
|
-
const rVal = parent
|
|
2772
|
+
const { right: rVal, operator } = parent;
|
|
2766
2773
|
const rExp = rawExp.slice(rVal.start - 1, rVal.end - 1);
|
|
2767
2774
|
const rExpString = stringifyExpression(processExpression(createSimpleExpression(rExp, false), context));
|
|
2768
|
-
return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value
|
|
2775
|
+
return `${context.helperString(IS_REF)}(${raw})${context.isTS ? ` //@ts-ignore\n` : ``} ? ${raw}.value ${operator} ${rExpString} : ${raw}`;
|
|
2769
2776
|
}
|
|
2770
2777
|
else if (isUpdateArg) {
|
|
2771
2778
|
// make id replace parent in the code range so the raw update operator
|
|
@@ -351,11 +351,18 @@ function isCoreComponent(tag) {
|
|
|
351
351
|
}
|
|
352
352
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
353
353
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
354
|
-
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[
|
|
354
|
+
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[(.+)\])*$/;
|
|
355
355
|
const isMemberExpression = (path) => {
|
|
356
356
|
if (!path)
|
|
357
357
|
return false;
|
|
358
|
-
|
|
358
|
+
const matched = memberExpRE.exec(path.trim());
|
|
359
|
+
if (!matched)
|
|
360
|
+
return false;
|
|
361
|
+
if (!matched[1])
|
|
362
|
+
return true;
|
|
363
|
+
if (!/[\[\]]/.test(matched[1]))
|
|
364
|
+
return true;
|
|
365
|
+
return isMemberExpression(matched[1].trim());
|
|
359
366
|
};
|
|
360
367
|
function getInnerRange(loc, offset, length) {
|
|
361
368
|
const source = loc.source.substr(offset, length);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
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.1.
|
|
35
|
+
"@vue/shared": "3.1.1",
|
|
36
36
|
"@babel/parser": "^7.12.0",
|
|
37
37
|
"@babel/types": "^7.12.0",
|
|
38
38
|
"estree-walker": "^2.0.1",
|