@vue/compiler-dom 3.5.0-alpha.2 → 3.5.0-alpha.4
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.
- package/dist/compiler-dom.cjs.js +36 -24
- package/dist/compiler-dom.cjs.prod.js +34 -20
- package/dist/compiler-dom.esm-browser.js +251 -222
- package/dist/compiler-dom.esm-browser.prod.js +8 -4
- package/dist/compiler-dom.esm-bundler.js +4 -7
- package/dist/compiler-dom.global.js +251 -222
- package/dist/compiler-dom.global.prod.js +8 -4
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.5.0-alpha.
|
|
2
|
+
* @vue/compiler-dom v3.5.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -75,6 +75,9 @@ var VueCompilerDOM = (function (exports) {
|
|
|
75
75
|
|
|
76
76
|
const range = 2;
|
|
77
77
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
|
78
|
+
start = Math.max(0, Math.min(start, source.length));
|
|
79
|
+
end = Math.max(0, Math.min(end, source.length));
|
|
80
|
+
if (start > end) return "";
|
|
78
81
|
let lines = source.split(/(\r?\n)/);
|
|
79
82
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
|
80
83
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
|
@@ -84,8 +87,7 @@ var VueCompilerDOM = (function (exports) {
|
|
|
84
87
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
|
85
88
|
if (count >= start) {
|
|
86
89
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
|
87
|
-
if (j < 0 || j >= lines.length)
|
|
88
|
-
continue;
|
|
90
|
+
if (j < 0 || j >= lines.length) continue;
|
|
89
91
|
const line = j + 1;
|
|
90
92
|
res.push(
|
|
91
93
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
|
@@ -303,8 +305,8 @@ var VueCompilerDOM = (function (exports) {
|
|
|
303
305
|
"0": "NOT_CONSTANT",
|
|
304
306
|
"CAN_SKIP_PATCH": 1,
|
|
305
307
|
"1": "CAN_SKIP_PATCH",
|
|
306
|
-
"
|
|
307
|
-
"2": "
|
|
308
|
+
"CAN_CACHE": 2,
|
|
309
|
+
"2": "CAN_CACHE",
|
|
308
310
|
"CAN_STRINGIFY": 3,
|
|
309
311
|
"3": "CAN_STRINGIFY"
|
|
310
312
|
};
|
|
@@ -323,7 +325,7 @@ var VueCompilerDOM = (function (exports) {
|
|
|
323
325
|
directives: [],
|
|
324
326
|
hoists: [],
|
|
325
327
|
imports: [],
|
|
326
|
-
cached:
|
|
328
|
+
cached: [],
|
|
327
329
|
temps: 0,
|
|
328
330
|
codegenNode: void 0,
|
|
329
331
|
loc: locStub
|
|
@@ -428,12 +430,13 @@ var VueCompilerDOM = (function (exports) {
|
|
|
428
430
|
loc: locStub
|
|
429
431
|
};
|
|
430
432
|
}
|
|
431
|
-
function createCacheExpression(index, value,
|
|
433
|
+
function createCacheExpression(index, value, needPauseTracking = false) {
|
|
432
434
|
return {
|
|
433
435
|
type: 20,
|
|
434
436
|
index,
|
|
435
437
|
value,
|
|
436
|
-
|
|
438
|
+
needPauseTracking,
|
|
439
|
+
needArraySpread: false,
|
|
437
440
|
loc: locStub
|
|
438
441
|
};
|
|
439
442
|
}
|
|
@@ -1374,8 +1377,7 @@ var VueCompilerDOM = (function (exports) {
|
|
|
1374
1377
|
Details: ${link}` : ``}`;
|
|
1375
1378
|
const err = new SyntaxError(msg);
|
|
1376
1379
|
err.code = key;
|
|
1377
|
-
if (loc)
|
|
1378
|
-
err.loc = loc;
|
|
1380
|
+
if (loc) err.loc = loc;
|
|
1379
1381
|
context.onWarn(err);
|
|
1380
1382
|
}
|
|
1381
1383
|
|
|
@@ -1611,16 +1613,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1611
1613
|
function walkBlockDeclarations(block, onIdent) {
|
|
1612
1614
|
for (const stmt of block.body) {
|
|
1613
1615
|
if (stmt.type === "VariableDeclaration") {
|
|
1614
|
-
if (stmt.declare)
|
|
1615
|
-
continue;
|
|
1616
|
+
if (stmt.declare) continue;
|
|
1616
1617
|
for (const decl of stmt.declarations) {
|
|
1617
1618
|
for (const id of extractIdentifiers(decl.id)) {
|
|
1618
1619
|
onIdent(id);
|
|
1619
1620
|
}
|
|
1620
1621
|
}
|
|
1621
1622
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
1622
|
-
if (stmt.declare || !stmt.id)
|
|
1623
|
-
continue;
|
|
1623
|
+
if (stmt.declare || !stmt.id) continue;
|
|
1624
1624
|
onIdent(stmt.id);
|
|
1625
1625
|
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
1626
1626
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
@@ -1657,8 +1657,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1657
1657
|
break;
|
|
1658
1658
|
case "ArrayPattern":
|
|
1659
1659
|
param.elements.forEach((element) => {
|
|
1660
|
-
if (element)
|
|
1661
|
-
extractIdentifiers(element, nodes);
|
|
1660
|
+
if (element) extractIdentifiers(element, nodes);
|
|
1662
1661
|
});
|
|
1663
1662
|
break;
|
|
1664
1663
|
case "RestElement":
|
|
@@ -1712,7 +1711,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1712
1711
|
return BASE_TRANSITION;
|
|
1713
1712
|
}
|
|
1714
1713
|
}
|
|
1715
|
-
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
1714
|
+
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1716
1715
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1717
1716
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1718
1717
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1823,8 +1822,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1823
1822
|
for (let i = 0; i < node.props.length; i++) {
|
|
1824
1823
|
const p = node.props[i];
|
|
1825
1824
|
if (p.type === 6) {
|
|
1826
|
-
if (dynamicOnly)
|
|
1827
|
-
continue;
|
|
1825
|
+
if (dynamicOnly) continue;
|
|
1828
1826
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
1829
1827
|
return p;
|
|
1830
1828
|
}
|
|
@@ -1976,6 +1974,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1976
1974
|
return hasScopeRef(node.content, ids);
|
|
1977
1975
|
case 2:
|
|
1978
1976
|
case 3:
|
|
1977
|
+
case 20:
|
|
1979
1978
|
return false;
|
|
1980
1979
|
default:
|
|
1981
1980
|
return false;
|
|
@@ -1988,7 +1987,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1988
1987
|
return node;
|
|
1989
1988
|
}
|
|
1990
1989
|
}
|
|
1991
|
-
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
1990
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
1992
1991
|
|
|
1993
1992
|
const defaultParserOptions = {
|
|
1994
1993
|
parseMode: "base",
|
|
@@ -2141,8 +2140,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2141
2140
|
}
|
|
2142
2141
|
},
|
|
2143
2142
|
ondirarg(start, end) {
|
|
2144
|
-
if (start === end)
|
|
2145
|
-
return;
|
|
2143
|
+
if (start === end) return;
|
|
2146
2144
|
const arg = getSlice(start, end);
|
|
2147
2145
|
if (inVPre) {
|
|
2148
2146
|
currentProp.name += arg;
|
|
@@ -2174,14 +2172,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2174
2172
|
},
|
|
2175
2173
|
onattribdata(start, end) {
|
|
2176
2174
|
currentAttrValue += getSlice(start, end);
|
|
2177
|
-
if (currentAttrStartIndex < 0)
|
|
2178
|
-
currentAttrStartIndex = start;
|
|
2175
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2179
2176
|
currentAttrEndIndex = end;
|
|
2180
2177
|
},
|
|
2181
2178
|
onattribentity(char, start, end) {
|
|
2182
2179
|
currentAttrValue += char;
|
|
2183
|
-
if (currentAttrStartIndex < 0)
|
|
2184
|
-
currentAttrStartIndex = start;
|
|
2180
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2185
2181
|
currentAttrEndIndex = end;
|
|
2186
2182
|
},
|
|
2187
2183
|
onattribnameend(end) {
|
|
@@ -2328,8 +2324,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2328
2324
|
const loc = input.loc;
|
|
2329
2325
|
const exp = input.content;
|
|
2330
2326
|
const inMatch = exp.match(forAliasRE);
|
|
2331
|
-
if (!inMatch)
|
|
2332
|
-
return;
|
|
2327
|
+
if (!inMatch) return;
|
|
2333
2328
|
const [, LHS, RHS] = inMatch;
|
|
2334
2329
|
const createAliasExpression = (content, offset, asParam = false) => {
|
|
2335
2330
|
const start = loc.start.offset + offset;
|
|
@@ -2522,14 +2517,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2522
2517
|
}
|
|
2523
2518
|
function lookAhead(index, c) {
|
|
2524
2519
|
let i = index;
|
|
2525
|
-
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2526
|
-
i++;
|
|
2520
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
|
|
2527
2521
|
return i;
|
|
2528
2522
|
}
|
|
2529
2523
|
function backTrack(index, c) {
|
|
2530
2524
|
let i = index;
|
|
2531
|
-
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
2532
|
-
i--;
|
|
2525
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
2533
2526
|
return i;
|
|
2534
2527
|
}
|
|
2535
2528
|
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
@@ -2739,9 +2732,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2739
2732
|
return root;
|
|
2740
2733
|
}
|
|
2741
2734
|
|
|
2742
|
-
function
|
|
2735
|
+
function cacheStatic(root, context) {
|
|
2743
2736
|
walk(
|
|
2744
2737
|
root,
|
|
2738
|
+
void 0,
|
|
2745
2739
|
context,
|
|
2746
2740
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
2747
2741
|
// fallthrough attributes.
|
|
@@ -2752,26 +2746,24 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2752
2746
|
const { children } = root;
|
|
2753
2747
|
return children.length === 1 && child.type === 1 && !isSlotOutlet(child);
|
|
2754
2748
|
}
|
|
2755
|
-
function walk(node, context, doNotHoistNode = false) {
|
|
2749
|
+
function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
2756
2750
|
const { children } = node;
|
|
2757
|
-
const
|
|
2758
|
-
let hoistedCount = 0;
|
|
2751
|
+
const toCache = [];
|
|
2759
2752
|
for (let i = 0; i < children.length; i++) {
|
|
2760
2753
|
const child = children[i];
|
|
2761
2754
|
if (child.type === 1 && child.tagType === 0) {
|
|
2762
2755
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2763
2756
|
if (constantType > 0) {
|
|
2764
2757
|
if (constantType >= 2) {
|
|
2765
|
-
child.codegenNode.patchFlag = -1
|
|
2766
|
-
|
|
2767
|
-
hoistedCount++;
|
|
2758
|
+
child.codegenNode.patchFlag = -1;
|
|
2759
|
+
toCache.push(child);
|
|
2768
2760
|
continue;
|
|
2769
2761
|
}
|
|
2770
2762
|
} else {
|
|
2771
2763
|
const codegenNode = child.codegenNode;
|
|
2772
2764
|
if (codegenNode.type === 13) {
|
|
2773
|
-
const flag =
|
|
2774
|
-
if ((
|
|
2765
|
+
const flag = codegenNode.patchFlag;
|
|
2766
|
+
if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
2775
2767
|
const props = getNodeProps(child);
|
|
2776
2768
|
if (props) {
|
|
2777
2769
|
codegenNode.props = context.hoist(props);
|
|
@@ -2782,39 +2774,84 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2782
2774
|
}
|
|
2783
2775
|
}
|
|
2784
2776
|
}
|
|
2777
|
+
} else if (child.type === 12) {
|
|
2778
|
+
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2779
|
+
if (constantType >= 2) {
|
|
2780
|
+
toCache.push(child);
|
|
2781
|
+
continue;
|
|
2782
|
+
}
|
|
2785
2783
|
}
|
|
2786
2784
|
if (child.type === 1) {
|
|
2787
2785
|
const isComponent = child.tagType === 1;
|
|
2788
2786
|
if (isComponent) {
|
|
2789
2787
|
context.scopes.vSlot++;
|
|
2790
2788
|
}
|
|
2791
|
-
walk(child, context);
|
|
2789
|
+
walk(child, node, context, false, inFor);
|
|
2792
2790
|
if (isComponent) {
|
|
2793
2791
|
context.scopes.vSlot--;
|
|
2794
2792
|
}
|
|
2795
2793
|
} else if (child.type === 11) {
|
|
2796
|
-
walk(child, context, child.children.length === 1);
|
|
2794
|
+
walk(child, node, context, child.children.length === 1, true);
|
|
2797
2795
|
} else if (child.type === 9) {
|
|
2798
2796
|
for (let i2 = 0; i2 < child.branches.length; i2++) {
|
|
2799
2797
|
walk(
|
|
2800
2798
|
child.branches[i2],
|
|
2799
|
+
node,
|
|
2801
2800
|
context,
|
|
2802
|
-
child.branches[i2].children.length === 1
|
|
2801
|
+
child.branches[i2].children.length === 1,
|
|
2802
|
+
inFor
|
|
2803
2803
|
);
|
|
2804
2804
|
}
|
|
2805
2805
|
}
|
|
2806
2806
|
}
|
|
2807
|
-
|
|
2808
|
-
|
|
2807
|
+
let cachedAsArray = false;
|
|
2808
|
+
if (toCache.length === children.length && node.type === 1) {
|
|
2809
|
+
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
2810
|
+
node.codegenNode.children = getCacheExpression(
|
|
2811
|
+
createArrayExpression(node.codegenNode.children)
|
|
2812
|
+
);
|
|
2813
|
+
cachedAsArray = true;
|
|
2814
|
+
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2815
|
+
const slot = getSlotNode(node.codegenNode, "default");
|
|
2816
|
+
if (slot) {
|
|
2817
|
+
slot.returns = getCacheExpression(
|
|
2818
|
+
createArrayExpression(slot.returns)
|
|
2819
|
+
);
|
|
2820
|
+
cachedAsArray = true;
|
|
2821
|
+
}
|
|
2822
|
+
} else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 15) {
|
|
2823
|
+
const slotName = findDir(node, "slot", true);
|
|
2824
|
+
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
|
|
2825
|
+
if (slot) {
|
|
2826
|
+
slot.returns = getCacheExpression(
|
|
2827
|
+
createArrayExpression(slot.returns)
|
|
2828
|
+
);
|
|
2829
|
+
cachedAsArray = true;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2809
2832
|
}
|
|
2810
|
-
if (
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2833
|
+
if (!cachedAsArray) {
|
|
2834
|
+
for (const child of toCache) {
|
|
2835
|
+
child.codegenNode = context.cache(child.codegenNode);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
function getCacheExpression(value) {
|
|
2839
|
+
const exp = context.cache(value);
|
|
2840
|
+
if (inFor && context.hmr) {
|
|
2841
|
+
exp.needArraySpread = true;
|
|
2842
|
+
}
|
|
2843
|
+
return exp;
|
|
2844
|
+
}
|
|
2845
|
+
function getSlotNode(node2, name) {
|
|
2846
|
+
if (node2.children && !isArray(node2.children) && node2.children.type === 15) {
|
|
2847
|
+
const slot = node2.children.properties.find(
|
|
2848
|
+
(p) => p.key === name || p.key.content === name
|
|
2849
|
+
);
|
|
2850
|
+
return slot && slot.value;
|
|
2816
2851
|
}
|
|
2817
|
-
|
|
2852
|
+
}
|
|
2853
|
+
if (toCache.length && context.transformHoist) {
|
|
2854
|
+
context.transformHoist(children, context, node);
|
|
2818
2855
|
}
|
|
2819
2856
|
}
|
|
2820
2857
|
function getConstantType(node, context) {
|
|
@@ -2832,11 +2869,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2832
2869
|
if (codegenNode.type !== 13) {
|
|
2833
2870
|
return 0;
|
|
2834
2871
|
}
|
|
2835
|
-
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
2872
|
+
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2836
2873
|
return 0;
|
|
2837
2874
|
}
|
|
2838
|
-
|
|
2839
|
-
if (!flag) {
|
|
2875
|
+
if (codegenNode.patchFlag === void 0) {
|
|
2840
2876
|
let returnType2 = 3;
|
|
2841
2877
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
2842
2878
|
if (generatedPropsType === 0) {
|
|
@@ -2919,6 +2955,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2919
2955
|
}
|
|
2920
2956
|
}
|
|
2921
2957
|
return returnType;
|
|
2958
|
+
case 20:
|
|
2959
|
+
return 2;
|
|
2922
2960
|
default:
|
|
2923
2961
|
return 0;
|
|
2924
2962
|
}
|
|
@@ -2978,15 +3016,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2978
3016
|
return codegenNode.props;
|
|
2979
3017
|
}
|
|
2980
3018
|
}
|
|
2981
|
-
function getPatchFlag(node) {
|
|
2982
|
-
const flag = node.patchFlag;
|
|
2983
|
-
return flag ? parseInt(flag, 10) : void 0;
|
|
2984
|
-
}
|
|
2985
3019
|
|
|
2986
3020
|
function createTransformContext(root, {
|
|
2987
3021
|
filename = "",
|
|
2988
3022
|
prefixIdentifiers = false,
|
|
2989
|
-
hoistStatic
|
|
3023
|
+
hoistStatic = false,
|
|
2990
3024
|
hmr = false,
|
|
2991
3025
|
cacheHandlers = false,
|
|
2992
3026
|
nodeTransforms = [],
|
|
@@ -3013,7 +3047,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3013
3047
|
filename,
|
|
3014
3048
|
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
|
|
3015
3049
|
prefixIdentifiers,
|
|
3016
|
-
hoistStatic
|
|
3050
|
+
hoistStatic,
|
|
3017
3051
|
hmr,
|
|
3018
3052
|
cacheHandlers,
|
|
3019
3053
|
nodeTransforms,
|
|
@@ -3040,9 +3074,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3040
3074
|
directives: /* @__PURE__ */ new Set(),
|
|
3041
3075
|
hoists: [],
|
|
3042
3076
|
imports: [],
|
|
3077
|
+
cached: [],
|
|
3043
3078
|
constantCache: /* @__PURE__ */ new WeakMap(),
|
|
3044
3079
|
temps: 0,
|
|
3045
|
-
cached: 0,
|
|
3046
3080
|
identifiers: /* @__PURE__ */ Object.create(null),
|
|
3047
3081
|
scopes: {
|
|
3048
3082
|
vFor: 0,
|
|
@@ -3112,8 +3146,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3112
3146
|
removeIdentifiers(exp) {
|
|
3113
3147
|
},
|
|
3114
3148
|
hoist(exp) {
|
|
3115
|
-
if (isString(exp))
|
|
3116
|
-
exp = createSimpleExpression(exp);
|
|
3149
|
+
if (isString(exp)) exp = createSimpleExpression(exp);
|
|
3117
3150
|
context.hoists.push(exp);
|
|
3118
3151
|
const identifier = createSimpleExpression(
|
|
3119
3152
|
`_hoisted_${context.hoists.length}`,
|
|
@@ -3125,7 +3158,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3125
3158
|
return identifier;
|
|
3126
3159
|
},
|
|
3127
3160
|
cache(exp, isVNode = false) {
|
|
3128
|
-
|
|
3161
|
+
const cacheExp = createCacheExpression(
|
|
3162
|
+
context.cached.length,
|
|
3163
|
+
exp,
|
|
3164
|
+
isVNode
|
|
3165
|
+
);
|
|
3166
|
+
context.cached.push(cacheExp);
|
|
3167
|
+
return cacheExp;
|
|
3129
3168
|
}
|
|
3130
3169
|
};
|
|
3131
3170
|
{
|
|
@@ -3137,7 +3176,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3137
3176
|
const context = createTransformContext(root, options);
|
|
3138
3177
|
traverseNode(root, context);
|
|
3139
3178
|
if (options.hoistStatic) {
|
|
3140
|
-
|
|
3179
|
+
cacheStatic(root, context);
|
|
3141
3180
|
}
|
|
3142
3181
|
if (!options.ssr) {
|
|
3143
3182
|
createRootCodegen(root, context);
|
|
@@ -3180,7 +3219,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3180
3219
|
helper(FRAGMENT),
|
|
3181
3220
|
void 0,
|
|
3182
3221
|
root.children,
|
|
3183
|
-
patchFlag
|
|
3222
|
+
patchFlag,
|
|
3184
3223
|
void 0,
|
|
3185
3224
|
void 0,
|
|
3186
3225
|
true,
|
|
@@ -3196,8 +3235,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3196
3235
|
};
|
|
3197
3236
|
for (; i < parent.children.length; i++) {
|
|
3198
3237
|
const child = parent.children[i];
|
|
3199
|
-
if (isString(child))
|
|
3200
|
-
continue;
|
|
3238
|
+
if (isString(child)) continue;
|
|
3201
3239
|
context.grandParent = context.parent;
|
|
3202
3240
|
context.parent = parent;
|
|
3203
3241
|
context.childIndex = i;
|
|
@@ -3268,8 +3306,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3268
3306
|
props.splice(i, 1);
|
|
3269
3307
|
i--;
|
|
3270
3308
|
const onExit = fn(node, prop, context);
|
|
3271
|
-
if (onExit)
|
|
3272
|
-
exitFns.push(onExit);
|
|
3309
|
+
if (onExit) exitFns.push(onExit);
|
|
3273
3310
|
}
|
|
3274
3311
|
}
|
|
3275
3312
|
return exitFns;
|
|
@@ -3341,8 +3378,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3341
3378
|
}
|
|
3342
3379
|
function generate(ast, options = {}) {
|
|
3343
3380
|
const context = createCodegenContext(ast, options);
|
|
3344
|
-
if (options.onContextCreated)
|
|
3345
|
-
options.onContextCreated(context);
|
|
3381
|
+
if (options.onContextCreated) options.onContextCreated(context);
|
|
3346
3382
|
const {
|
|
3347
3383
|
mode,
|
|
3348
3384
|
push,
|
|
@@ -3484,14 +3520,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3484
3520
|
return;
|
|
3485
3521
|
}
|
|
3486
3522
|
context.pure = true;
|
|
3487
|
-
const { push, newline
|
|
3523
|
+
const { push, newline } = context;
|
|
3488
3524
|
newline();
|
|
3489
3525
|
for (let i = 0; i < hoists.length; i++) {
|
|
3490
3526
|
const exp = hoists[i];
|
|
3491
3527
|
if (exp) {
|
|
3492
|
-
push(
|
|
3493
|
-
`const _hoisted_${i + 1} = ${``}`
|
|
3494
|
-
);
|
|
3528
|
+
push(`const _hoisted_${i + 1} = `);
|
|
3495
3529
|
genNode(exp, context);
|
|
3496
3530
|
newline();
|
|
3497
3531
|
}
|
|
@@ -3624,8 +3658,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3624
3658
|
}
|
|
3625
3659
|
function genInterpolation(node, context) {
|
|
3626
3660
|
const { push, helper, pure } = context;
|
|
3627
|
-
if (pure)
|
|
3628
|
-
push(PURE_ANNOTATION);
|
|
3661
|
+
if (pure) push(PURE_ANNOTATION);
|
|
3629
3662
|
push(`${helper(TO_DISPLAY_STRING)}(`);
|
|
3630
3663
|
genNode(node.content, context);
|
|
3631
3664
|
push(`)`);
|
|
@@ -3677,6 +3710,17 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3677
3710
|
disableTracking,
|
|
3678
3711
|
isComponent
|
|
3679
3712
|
} = node;
|
|
3713
|
+
let patchFlagString;
|
|
3714
|
+
if (patchFlag) {
|
|
3715
|
+
{
|
|
3716
|
+
if (patchFlag < 0) {
|
|
3717
|
+
patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
3718
|
+
} else {
|
|
3719
|
+
const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
|
|
3720
|
+
patchFlagString = patchFlag + ` /* ${flagNames} */`;
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3680
3724
|
if (directives) {
|
|
3681
3725
|
push(helper(WITH_DIRECTIVES) + `(`);
|
|
3682
3726
|
}
|
|
@@ -3689,7 +3733,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3689
3733
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
3690
3734
|
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
3691
3735
|
genNodeList(
|
|
3692
|
-
genNullableArgs([tag, props, children,
|
|
3736
|
+
genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
|
|
3693
3737
|
context
|
|
3694
3738
|
);
|
|
3695
3739
|
push(`)`);
|
|
@@ -3705,8 +3749,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3705
3749
|
function genNullableArgs(args) {
|
|
3706
3750
|
let i = args.length;
|
|
3707
3751
|
while (i--) {
|
|
3708
|
-
if (args[i] != null)
|
|
3709
|
-
break;
|
|
3752
|
+
if (args[i] != null) break;
|
|
3710
3753
|
}
|
|
3711
3754
|
return args.slice(0, i + 1).map((arg) => arg || `null`);
|
|
3712
3755
|
}
|
|
@@ -3823,16 +3866,21 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3823
3866
|
}
|
|
3824
3867
|
function genCacheExpression(node, context) {
|
|
3825
3868
|
const { push, helper, indent, deindent, newline } = context;
|
|
3869
|
+
const { needPauseTracking, needArraySpread } = node;
|
|
3870
|
+
if (needArraySpread) {
|
|
3871
|
+
push(`[...(`);
|
|
3872
|
+
}
|
|
3826
3873
|
push(`_cache[${node.index}] || (`);
|
|
3827
|
-
if (
|
|
3874
|
+
if (needPauseTracking) {
|
|
3828
3875
|
indent();
|
|
3829
3876
|
push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
|
|
3830
3877
|
newline();
|
|
3878
|
+
push(`(`);
|
|
3831
3879
|
}
|
|
3832
3880
|
push(`_cache[${node.index}] = `);
|
|
3833
3881
|
genNode(node.value, context);
|
|
3834
|
-
if (
|
|
3835
|
-
push(
|
|
3882
|
+
if (needPauseTracking) {
|
|
3883
|
+
push(`).cacheIndex = ${node.index},`);
|
|
3836
3884
|
newline();
|
|
3837
3885
|
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
3838
3886
|
newline();
|
|
@@ -3840,6 +3888,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
3840
3888
|
deindent();
|
|
3841
3889
|
}
|
|
3842
3890
|
push(`)`);
|
|
3891
|
+
if (needArraySpread) {
|
|
3892
|
+
push(`)]`);
|
|
3893
|
+
}
|
|
3843
3894
|
}
|
|
3844
3895
|
|
|
3845
3896
|
const prohibitedKeywordRE = new RegExp(
|
|
@@ -4016,8 +4067,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4016
4067
|
sibling.branches.push(branch);
|
|
4017
4068
|
const onExit = processCodegen && processCodegen(sibling, branch, false);
|
|
4018
4069
|
traverseNode(branch, context);
|
|
4019
|
-
if (onExit)
|
|
4020
|
-
onExit();
|
|
4070
|
+
if (onExit) onExit();
|
|
4021
4071
|
context.currentNode = null;
|
|
4022
4072
|
} else {
|
|
4023
4073
|
context.onError(
|
|
@@ -4086,7 +4136,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4086
4136
|
helper(FRAGMENT),
|
|
4087
4137
|
createObjectExpression([keyProperty]),
|
|
4088
4138
|
children,
|
|
4089
|
-
patchFlag
|
|
4139
|
+
patchFlag,
|
|
4090
4140
|
void 0,
|
|
4091
4141
|
void 0,
|
|
4092
4142
|
true,
|
|
@@ -4139,6 +4189,80 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4139
4189
|
}
|
|
4140
4190
|
}
|
|
4141
4191
|
|
|
4192
|
+
const transformBind = (dir, _node, context) => {
|
|
4193
|
+
const { modifiers, loc } = dir;
|
|
4194
|
+
const arg = dir.arg;
|
|
4195
|
+
let { exp } = dir;
|
|
4196
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4197
|
+
{
|
|
4198
|
+
exp = void 0;
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
if (!exp) {
|
|
4202
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
4203
|
+
context.onError(
|
|
4204
|
+
createCompilerError(
|
|
4205
|
+
52,
|
|
4206
|
+
arg.loc
|
|
4207
|
+
)
|
|
4208
|
+
);
|
|
4209
|
+
return {
|
|
4210
|
+
props: [
|
|
4211
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4212
|
+
]
|
|
4213
|
+
};
|
|
4214
|
+
}
|
|
4215
|
+
transformBindShorthand(dir);
|
|
4216
|
+
exp = dir.exp;
|
|
4217
|
+
}
|
|
4218
|
+
if (arg.type !== 4) {
|
|
4219
|
+
arg.children.unshift(`(`);
|
|
4220
|
+
arg.children.push(`) || ""`);
|
|
4221
|
+
} else if (!arg.isStatic) {
|
|
4222
|
+
arg.content = `${arg.content} || ""`;
|
|
4223
|
+
}
|
|
4224
|
+
if (modifiers.includes("camel")) {
|
|
4225
|
+
if (arg.type === 4) {
|
|
4226
|
+
if (arg.isStatic) {
|
|
4227
|
+
arg.content = camelize(arg.content);
|
|
4228
|
+
} else {
|
|
4229
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4230
|
+
}
|
|
4231
|
+
} else {
|
|
4232
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4233
|
+
arg.children.push(`)`);
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
if (!context.inSSR) {
|
|
4237
|
+
if (modifiers.includes("prop")) {
|
|
4238
|
+
injectPrefix(arg, ".");
|
|
4239
|
+
}
|
|
4240
|
+
if (modifiers.includes("attr")) {
|
|
4241
|
+
injectPrefix(arg, "^");
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4244
|
+
return {
|
|
4245
|
+
props: [createObjectProperty(arg, exp)]
|
|
4246
|
+
};
|
|
4247
|
+
};
|
|
4248
|
+
const transformBindShorthand = (dir, context) => {
|
|
4249
|
+
const arg = dir.arg;
|
|
4250
|
+
const propName = camelize(arg.content);
|
|
4251
|
+
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4252
|
+
};
|
|
4253
|
+
const injectPrefix = (arg, prefix) => {
|
|
4254
|
+
if (arg.type === 4) {
|
|
4255
|
+
if (arg.isStatic) {
|
|
4256
|
+
arg.content = prefix + arg.content;
|
|
4257
|
+
} else {
|
|
4258
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4259
|
+
}
|
|
4260
|
+
} else {
|
|
4261
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
4262
|
+
arg.children.push(`)`);
|
|
4263
|
+
}
|
|
4264
|
+
};
|
|
4265
|
+
|
|
4142
4266
|
const transformFor = createStructuralDirectiveTransform(
|
|
4143
4267
|
"for",
|
|
4144
4268
|
(node, dir, context) => {
|
|
@@ -4149,9 +4273,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4149
4273
|
]);
|
|
4150
4274
|
const isTemplate = isTemplateNode(node);
|
|
4151
4275
|
const memo = findDir(node, "memo");
|
|
4152
|
-
const keyProp = findProp(node, `key
|
|
4153
|
-
|
|
4154
|
-
|
|
4276
|
+
const keyProp = findProp(node, `key`, false, true);
|
|
4277
|
+
if (keyProp && keyProp.type === 7 && !keyProp.exp) {
|
|
4278
|
+
transformBindShorthand(keyProp);
|
|
4279
|
+
}
|
|
4280
|
+
const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4281
|
+
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4155
4282
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
4156
4283
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
4157
4284
|
forNode.codegenNode = createVNodeCall(
|
|
@@ -4159,7 +4286,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4159
4286
|
helper(FRAGMENT),
|
|
4160
4287
|
void 0,
|
|
4161
4288
|
renderExp,
|
|
4162
|
-
fragmentFlag
|
|
4289
|
+
fragmentFlag,
|
|
4163
4290
|
void 0,
|
|
4164
4291
|
void 0,
|
|
4165
4292
|
true,
|
|
@@ -4199,7 +4326,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4199
4326
|
helper(FRAGMENT),
|
|
4200
4327
|
keyProperty ? createObjectExpression([keyProperty]) : void 0,
|
|
4201
4328
|
node.children,
|
|
4202
|
-
64
|
|
4329
|
+
64,
|
|
4203
4330
|
void 0,
|
|
4204
4331
|
void 0,
|
|
4205
4332
|
true,
|
|
@@ -4253,8 +4380,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4253
4380
|
renderExp.arguments.push(
|
|
4254
4381
|
loop,
|
|
4255
4382
|
createSimpleExpression(`_cache`),
|
|
4256
|
-
createSimpleExpression(String(context.cached
|
|
4383
|
+
createSimpleExpression(String(context.cached.length))
|
|
4257
4384
|
);
|
|
4385
|
+
context.cached.push(null);
|
|
4258
4386
|
} else {
|
|
4259
4387
|
renderExp.arguments.push(
|
|
4260
4388
|
createFunctionExpression(
|
|
@@ -4300,13 +4428,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4300
4428
|
const onExit = processCodegen && processCodegen(forNode);
|
|
4301
4429
|
return () => {
|
|
4302
4430
|
scopes.vFor--;
|
|
4303
|
-
if (onExit)
|
|
4304
|
-
onExit();
|
|
4431
|
+
if (onExit) onExit();
|
|
4305
4432
|
};
|
|
4306
4433
|
}
|
|
4307
4434
|
function finalizeForParseResult(result, context) {
|
|
4308
|
-
if (result.finalized)
|
|
4309
|
-
return;
|
|
4435
|
+
if (result.finalized) return;
|
|
4310
4436
|
{
|
|
4311
4437
|
validateBrowserExpression(result.source, context);
|
|
4312
4438
|
if (result.key) {
|
|
@@ -4339,8 +4465,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4339
4465
|
function createParamsList(args) {
|
|
4340
4466
|
let i = args.length;
|
|
4341
4467
|
while (i--) {
|
|
4342
|
-
if (args[i])
|
|
4343
|
-
break;
|
|
4468
|
+
if (args[i]) break;
|
|
4344
4469
|
}
|
|
4345
4470
|
return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
|
|
4346
4471
|
}
|
|
@@ -4463,9 +4588,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4463
4588
|
break;
|
|
4464
4589
|
}
|
|
4465
4590
|
}
|
|
4466
|
-
if (prev && isTemplateNode(prev) && findDir(prev,
|
|
4467
|
-
children.splice(i, 1);
|
|
4468
|
-
i--;
|
|
4591
|
+
if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
|
|
4469
4592
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
4470
4593
|
while (conditional.alternate.type === 19) {
|
|
4471
4594
|
conditional = conditional.alternate;
|
|
@@ -4602,13 +4725,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4602
4725
|
}
|
|
4603
4726
|
break;
|
|
4604
4727
|
case 9:
|
|
4605
|
-
if (hasForwardedSlots(child.branches))
|
|
4606
|
-
return true;
|
|
4728
|
+
if (hasForwardedSlots(child.branches)) return true;
|
|
4607
4729
|
break;
|
|
4608
4730
|
case 10:
|
|
4609
4731
|
case 11:
|
|
4610
|
-
if (hasForwardedSlots(child.children))
|
|
4611
|
-
return true;
|
|
4732
|
+
if (hasForwardedSlots(child.children)) return true;
|
|
4612
4733
|
break;
|
|
4613
4734
|
}
|
|
4614
4735
|
}
|
|
@@ -4633,7 +4754,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4633
4754
|
const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
4634
4755
|
let vnodeProps;
|
|
4635
4756
|
let vnodeChildren;
|
|
4636
|
-
let vnodePatchFlag;
|
|
4637
4757
|
let patchFlag = 0;
|
|
4638
4758
|
let vnodeDynamicProps;
|
|
4639
4759
|
let dynamicPropNames;
|
|
@@ -4644,7 +4764,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4644
4764
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
4645
4765
|
// This is technically web-specific, but splitting the logic out of core
|
|
4646
4766
|
// leads to too much unnecessary complexity.
|
|
4647
|
-
(tag === "svg" || tag === "foreignObject")
|
|
4767
|
+
(tag === "svg" || tag === "foreignObject" || tag === "math")
|
|
4648
4768
|
);
|
|
4649
4769
|
if (props.length > 0) {
|
|
4650
4770
|
const propsBuildResult = buildProps(
|
|
@@ -4704,25 +4824,15 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4704
4824
|
vnodeChildren = node.children;
|
|
4705
4825
|
}
|
|
4706
4826
|
}
|
|
4707
|
-
if (
|
|
4708
|
-
|
|
4709
|
-
if (patchFlag < 0) {
|
|
4710
|
-
vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
4711
|
-
} else {
|
|
4712
|
-
const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
|
|
4713
|
-
vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
|
|
4714
|
-
}
|
|
4715
|
-
}
|
|
4716
|
-
if (dynamicPropNames && dynamicPropNames.length) {
|
|
4717
|
-
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4718
|
-
}
|
|
4827
|
+
if (dynamicPropNames && dynamicPropNames.length) {
|
|
4828
|
+
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4719
4829
|
}
|
|
4720
4830
|
node.codegenNode = createVNodeCall(
|
|
4721
4831
|
context,
|
|
4722
4832
|
vnodeTag,
|
|
4723
4833
|
vnodeProps,
|
|
4724
4834
|
vnodeChildren,
|
|
4725
|
-
|
|
4835
|
+
patchFlag === 0 ? void 0 : patchFlag,
|
|
4726
4836
|
vnodeDynamicProps,
|
|
4727
4837
|
vnodeDirectives,
|
|
4728
4838
|
!!shouldUseBlock,
|
|
@@ -4767,8 +4877,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4767
4877
|
}
|
|
4768
4878
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
4769
4879
|
if (builtIn) {
|
|
4770
|
-
if (!ssr)
|
|
4771
|
-
context.helper(builtIn);
|
|
4880
|
+
if (!ssr) context.helper(builtIn);
|
|
4772
4881
|
return builtIn;
|
|
4773
4882
|
}
|
|
4774
4883
|
context.helper(RESOLVE_COMPONENT);
|
|
@@ -4797,8 +4906,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4797
4906
|
);
|
|
4798
4907
|
properties = [];
|
|
4799
4908
|
}
|
|
4800
|
-
if (arg)
|
|
4801
|
-
mergeArgs.push(arg);
|
|
4909
|
+
if (arg) mergeArgs.push(arg);
|
|
4802
4910
|
};
|
|
4803
4911
|
const pushRefVForMarker = () => {
|
|
4804
4912
|
if (context.scopes.vFor > 0) {
|
|
@@ -5135,8 +5243,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5135
5243
|
}
|
|
5136
5244
|
}
|
|
5137
5245
|
const { loc } = dir;
|
|
5138
|
-
if (dir.exp)
|
|
5139
|
-
dirArgs.push(dir.exp);
|
|
5246
|
+
if (dir.exp) dirArgs.push(dir.exp);
|
|
5140
5247
|
if (dir.arg) {
|
|
5141
5248
|
if (!dir.exp) {
|
|
5142
5249
|
dirArgs.push(`void 0`);
|
|
@@ -5166,8 +5273,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5166
5273
|
let propsNamesString = `[`;
|
|
5167
5274
|
for (let i = 0, l = props.length; i < l; i++) {
|
|
5168
5275
|
propsNamesString += JSON.stringify(props[i]);
|
|
5169
|
-
if (i < l - 1)
|
|
5170
|
-
propsNamesString += ", ";
|
|
5276
|
+
if (i < l - 1) propsNamesString += ", ";
|
|
5171
5277
|
}
|
|
5172
5278
|
return propsNamesString + `]`;
|
|
5173
5279
|
}
|
|
@@ -5261,7 +5367,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5261
5367
|
};
|
|
5262
5368
|
}
|
|
5263
5369
|
|
|
5264
|
-
const fnExpRE = /^\s*(
|
|
5370
|
+
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
5265
5371
|
const transformOn$1 = (dir, node, context, augmentor) => {
|
|
5266
5372
|
const { loc, modifiers, arg } = dir;
|
|
5267
5373
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -5342,75 +5448,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5342
5448
|
return ret;
|
|
5343
5449
|
};
|
|
5344
5450
|
|
|
5345
|
-
const transformBind = (dir, _node, context) => {
|
|
5346
|
-
const { modifiers, loc } = dir;
|
|
5347
|
-
const arg = dir.arg;
|
|
5348
|
-
let { exp } = dir;
|
|
5349
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5350
|
-
{
|
|
5351
|
-
exp = void 0;
|
|
5352
|
-
}
|
|
5353
|
-
}
|
|
5354
|
-
if (!exp) {
|
|
5355
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
5356
|
-
context.onError(
|
|
5357
|
-
createCompilerError(
|
|
5358
|
-
52,
|
|
5359
|
-
arg.loc
|
|
5360
|
-
)
|
|
5361
|
-
);
|
|
5362
|
-
return {
|
|
5363
|
-
props: [
|
|
5364
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
5365
|
-
]
|
|
5366
|
-
};
|
|
5367
|
-
}
|
|
5368
|
-
const propName = camelize(arg.content);
|
|
5369
|
-
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5370
|
-
}
|
|
5371
|
-
if (arg.type !== 4) {
|
|
5372
|
-
arg.children.unshift(`(`);
|
|
5373
|
-
arg.children.push(`) || ""`);
|
|
5374
|
-
} else if (!arg.isStatic) {
|
|
5375
|
-
arg.content = `${arg.content} || ""`;
|
|
5376
|
-
}
|
|
5377
|
-
if (modifiers.includes("camel")) {
|
|
5378
|
-
if (arg.type === 4) {
|
|
5379
|
-
if (arg.isStatic) {
|
|
5380
|
-
arg.content = camelize(arg.content);
|
|
5381
|
-
} else {
|
|
5382
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5383
|
-
}
|
|
5384
|
-
} else {
|
|
5385
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5386
|
-
arg.children.push(`)`);
|
|
5387
|
-
}
|
|
5388
|
-
}
|
|
5389
|
-
if (!context.inSSR) {
|
|
5390
|
-
if (modifiers.includes("prop")) {
|
|
5391
|
-
injectPrefix(arg, ".");
|
|
5392
|
-
}
|
|
5393
|
-
if (modifiers.includes("attr")) {
|
|
5394
|
-
injectPrefix(arg, "^");
|
|
5395
|
-
}
|
|
5396
|
-
}
|
|
5397
|
-
return {
|
|
5398
|
-
props: [createObjectProperty(arg, exp)]
|
|
5399
|
-
};
|
|
5400
|
-
};
|
|
5401
|
-
const injectPrefix = (arg, prefix) => {
|
|
5402
|
-
if (arg.type === 4) {
|
|
5403
|
-
if (arg.isStatic) {
|
|
5404
|
-
arg.content = prefix + arg.content;
|
|
5405
|
-
} else {
|
|
5406
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5407
|
-
}
|
|
5408
|
-
} else {
|
|
5409
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
5410
|
-
arg.children.push(`)`);
|
|
5411
|
-
}
|
|
5412
|
-
};
|
|
5413
|
-
|
|
5414
5451
|
const transformText = (node, context) => {
|
|
5415
5452
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5416
5453
|
return () => {
|
|
@@ -5574,8 +5611,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5574
5611
|
}
|
|
5575
5612
|
if (node.type === 5) {
|
|
5576
5613
|
rewriteFilter(node.content, context);
|
|
5577
|
-
}
|
|
5578
|
-
if (node.type === 1) {
|
|
5614
|
+
} else if (node.type === 1) {
|
|
5579
5615
|
node.props.forEach((prop) => {
|
|
5580
5616
|
if (prop.type === 7 && prop.name !== "for" && prop.exp) {
|
|
5581
5617
|
rewriteFilter(prop.exp, context);
|
|
@@ -5589,8 +5625,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5589
5625
|
} else {
|
|
5590
5626
|
for (let i = 0; i < node.children.length; i++) {
|
|
5591
5627
|
const child = node.children[i];
|
|
5592
|
-
if (typeof child !== "object")
|
|
5593
|
-
continue;
|
|
5628
|
+
if (typeof child !== "object") continue;
|
|
5594
5629
|
if (child.type === 4) {
|
|
5595
5630
|
parseFilter(child, context);
|
|
5596
5631
|
} else if (child.type === 8) {
|
|
@@ -5616,17 +5651,13 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5616
5651
|
prev = c;
|
|
5617
5652
|
c = exp.charCodeAt(i);
|
|
5618
5653
|
if (inSingle) {
|
|
5619
|
-
if (c === 39 && prev !== 92)
|
|
5620
|
-
inSingle = false;
|
|
5654
|
+
if (c === 39 && prev !== 92) inSingle = false;
|
|
5621
5655
|
} else if (inDouble) {
|
|
5622
|
-
if (c === 34 && prev !== 92)
|
|
5623
|
-
inDouble = false;
|
|
5656
|
+
if (c === 34 && prev !== 92) inDouble = false;
|
|
5624
5657
|
} else if (inTemplateString) {
|
|
5625
|
-
if (c === 96 && prev !== 92)
|
|
5626
|
-
inTemplateString = false;
|
|
5658
|
+
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
5627
5659
|
} else if (inRegex) {
|
|
5628
|
-
if (c === 47 && prev !== 92)
|
|
5629
|
-
inRegex = false;
|
|
5660
|
+
if (c === 47 && prev !== 92) inRegex = false;
|
|
5630
5661
|
} else if (c === 124 && // pipe
|
|
5631
5662
|
exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
|
|
5632
5663
|
if (expression === void 0) {
|
|
@@ -5670,8 +5701,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5670
5701
|
let p;
|
|
5671
5702
|
for (; j >= 0; j--) {
|
|
5672
5703
|
p = exp.charAt(j);
|
|
5673
|
-
if (p !== " ")
|
|
5674
|
-
break;
|
|
5704
|
+
if (p !== " ") break;
|
|
5675
5705
|
}
|
|
5676
5706
|
if (!p || !validDivisionCharRE.test(p)) {
|
|
5677
5707
|
inRegex = true;
|
|
@@ -5698,6 +5728,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5698
5728
|
expression = wrapFilter(expression, filters[i], context);
|
|
5699
5729
|
}
|
|
5700
5730
|
node.content = expression;
|
|
5731
|
+
node.ast = void 0;
|
|
5701
5732
|
}
|
|
5702
5733
|
}
|
|
5703
5734
|
function wrapFilter(exp, filter, context) {
|
|
@@ -5732,8 +5763,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5732
5763
|
dir.exp,
|
|
5733
5764
|
createFunctionExpression(void 0, codegenNode),
|
|
5734
5765
|
`_cache`,
|
|
5735
|
-
String(context.cached
|
|
5766
|
+
String(context.cached.length)
|
|
5736
5767
|
]);
|
|
5768
|
+
context.cached.push(null);
|
|
5737
5769
|
}
|
|
5738
5770
|
};
|
|
5739
5771
|
}
|
|
@@ -6169,8 +6201,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6169
6201
|
const transformOn = (dir, node, context) => {
|
|
6170
6202
|
return transformOn$1(dir, node, context, (baseResult) => {
|
|
6171
6203
|
const { modifiers } = dir;
|
|
6172
|
-
if (!modifiers.length)
|
|
6173
|
-
return baseResult;
|
|
6204
|
+
if (!modifiers.length) return baseResult;
|
|
6174
6205
|
let { key, value: handlerExp } = baseResult.props[0];
|
|
6175
6206
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
|
6176
6207
|
if (nonKeyModifiers.includes("right")) {
|
|
@@ -6281,12 +6312,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6281
6312
|
return onlyValidParents[child].has(parent);
|
|
6282
6313
|
}
|
|
6283
6314
|
if (parent in knownInvalidChildren) {
|
|
6284
|
-
if (knownInvalidChildren[parent].has(child))
|
|
6285
|
-
return false;
|
|
6315
|
+
if (knownInvalidChildren[parent].has(child)) return false;
|
|
6286
6316
|
}
|
|
6287
6317
|
if (child in knownInvalidParents) {
|
|
6288
|
-
if (knownInvalidParents[child].has(parent))
|
|
6289
|
-
return false;
|
|
6318
|
+
if (knownInvalidParents[child].has(parent)) return false;
|
|
6290
6319
|
}
|
|
6291
6320
|
return true;
|
|
6292
6321
|
}
|