@vue/compiler-dom 3.6.0-alpha.2 → 3.6.0-alpha.3
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 +39 -35
- package/dist/compiler-dom.cjs.prod.js +44 -2
- package/dist/compiler-dom.d.ts +3 -1
- package/dist/compiler-dom.esm-browser.js +153 -141
- package/dist/compiler-dom.esm-browser.prod.js +9 -9
- package/dist/compiler-dom.esm-bundler.js +35 -35
- package/dist/compiler-dom.global.js +156 -140
- package/dist/compiler-dom.global.prod.js +9 -9
- package/package.json +3 -3
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-dom v3.6.0-alpha.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
6
|
var VueCompilerDOM = (function (exports) {
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
10
9
|
// @__NO_SIDE_EFFECTS__
|
|
11
10
|
function makeMap(str) {
|
|
12
11
|
const map = /* @__PURE__ */ Object.create(null);
|
|
@@ -34,10 +33,10 @@ var VueCompilerDOM = (function (exports) {
|
|
|
34
33
|
);
|
|
35
34
|
const cacheStringFunction = (fn) => {
|
|
36
35
|
const cache = /* @__PURE__ */ Object.create(null);
|
|
37
|
-
return (str) => {
|
|
36
|
+
return ((str) => {
|
|
38
37
|
const hit = cache[str];
|
|
39
38
|
return hit || (cache[str] = fn(str));
|
|
40
|
-
};
|
|
39
|
+
});
|
|
41
40
|
};
|
|
42
41
|
const camelizeRE = /-(\w)/g;
|
|
43
42
|
const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
|
|
@@ -1650,7 +1649,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1650
1649
|
}
|
|
1651
1650
|
}
|
|
1652
1651
|
function walkBlockDeclarations(block, onIdent) {
|
|
1653
|
-
|
|
1652
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
1653
|
+
for (const stmt of body) {
|
|
1654
1654
|
if (stmt.type === "VariableDeclaration") {
|
|
1655
1655
|
if (stmt.declare) continue;
|
|
1656
1656
|
for (const decl of stmt.declarations) {
|
|
@@ -1663,6 +1663,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1663
1663
|
onIdent(stmt.id);
|
|
1664
1664
|
} else if (isForStatement(stmt)) {
|
|
1665
1665
|
walkForStatement(stmt, true, onIdent);
|
|
1666
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
1667
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
1666
1668
|
}
|
|
1667
1669
|
}
|
|
1668
1670
|
}
|
|
@@ -1679,6 +1681,20 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1679
1681
|
}
|
|
1680
1682
|
}
|
|
1681
1683
|
}
|
|
1684
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
1685
|
+
for (const cs of stmt.cases) {
|
|
1686
|
+
for (const stmt2 of cs.consequent) {
|
|
1687
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
1688
|
+
for (const decl of stmt2.declarations) {
|
|
1689
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1690
|
+
onIdent(id);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
walkBlockDeclarations(cs, onIdent);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1682
1698
|
function extractIdentifiers(param, nodes = []) {
|
|
1683
1699
|
switch (param.type) {
|
|
1684
1700
|
case "Identifier":
|
|
@@ -1809,7 +1825,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1809
1825
|
return BASE_TRANSITION;
|
|
1810
1826
|
}
|
|
1811
1827
|
}
|
|
1812
|
-
const nonIdentifierRE =
|
|
1828
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1813
1829
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1814
1830
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1815
1831
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1879,7 +1895,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1879
1895
|
};
|
|
1880
1896
|
const isMemberExpressionNode = NOOP ;
|
|
1881
1897
|
const isMemberExpression = isMemberExpressionBrowser ;
|
|
1882
|
-
const fnExpRE = /^\s*(async\s*)?(
|
|
1898
|
+
const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
1883
1899
|
const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
|
|
1884
1900
|
const isFnExpressionNode = NOOP ;
|
|
1885
1901
|
const isFnExpression = isFnExpressionBrowser ;
|
|
@@ -1948,6 +1964,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1948
1964
|
function isText$1(node) {
|
|
1949
1965
|
return node.type === 5 || node.type === 2;
|
|
1950
1966
|
}
|
|
1967
|
+
function isVPre(p) {
|
|
1968
|
+
return p.type === 7 && p.name === "pre";
|
|
1969
|
+
}
|
|
1951
1970
|
function isVSlot(p) {
|
|
1952
1971
|
return p.type === 7 && p.name === "slot";
|
|
1953
1972
|
}
|
|
@@ -2246,7 +2265,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2246
2265
|
ondirarg(start, end) {
|
|
2247
2266
|
if (start === end) return;
|
|
2248
2267
|
const arg = getSlice(start, end);
|
|
2249
|
-
if (inVPre) {
|
|
2268
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2250
2269
|
currentProp.name += arg;
|
|
2251
2270
|
setLocEnd(currentProp.nameLoc, end);
|
|
2252
2271
|
} else {
|
|
@@ -2261,7 +2280,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2261
2280
|
},
|
|
2262
2281
|
ondirmodifier(start, end) {
|
|
2263
2282
|
const mod = getSlice(start, end);
|
|
2264
|
-
if (inVPre) {
|
|
2283
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2265
2284
|
currentProp.name += "." + mod;
|
|
2266
2285
|
setLocEnd(currentProp.nameLoc, end);
|
|
2267
2286
|
} else if (currentProp.name === "slot") {
|
|
@@ -2889,6 +2908,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2889
2908
|
} else if (child.type === 12) {
|
|
2890
2909
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2891
2910
|
if (constantType >= 2) {
|
|
2911
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
2912
|
+
child.codegenNode.arguments.push(
|
|
2913
|
+
-1 + (` /* ${PatchFlagNames[-1]} */` )
|
|
2914
|
+
);
|
|
2915
|
+
}
|
|
2892
2916
|
toCache.push(child);
|
|
2893
2917
|
continue;
|
|
2894
2918
|
}
|
|
@@ -2917,7 +2941,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2917
2941
|
}
|
|
2918
2942
|
}
|
|
2919
2943
|
let cachedAsArray = false;
|
|
2920
|
-
const slotCacheKeys = [];
|
|
2921
2944
|
if (toCache.length === children.length && node.type === 1) {
|
|
2922
2945
|
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
2923
2946
|
node.codegenNode.children = getCacheExpression(
|
|
@@ -2927,7 +2950,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2927
2950
|
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2928
2951
|
const slot = getSlotNode(node.codegenNode, "default");
|
|
2929
2952
|
if (slot) {
|
|
2930
|
-
slotCacheKeys.push(context.cached.length);
|
|
2931
2953
|
slot.returns = getCacheExpression(
|
|
2932
2954
|
createArrayExpression(slot.returns)
|
|
2933
2955
|
);
|
|
@@ -2937,7 +2959,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2937
2959
|
const slotName = findDir(node, "slot", true);
|
|
2938
2960
|
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
|
|
2939
2961
|
if (slot) {
|
|
2940
|
-
slotCacheKeys.push(context.cached.length);
|
|
2941
2962
|
slot.returns = getCacheExpression(
|
|
2942
2963
|
createArrayExpression(slot.returns)
|
|
2943
2964
|
);
|
|
@@ -2947,23 +2968,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2947
2968
|
}
|
|
2948
2969
|
if (!cachedAsArray) {
|
|
2949
2970
|
for (const child of toCache) {
|
|
2950
|
-
slotCacheKeys.push(context.cached.length);
|
|
2951
2971
|
child.codegenNode = context.cache(child.codegenNode);
|
|
2952
2972
|
}
|
|
2953
2973
|
}
|
|
2954
|
-
if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2955
|
-
node.codegenNode.children.properties.push(
|
|
2956
|
-
createObjectProperty(
|
|
2957
|
-
`__`,
|
|
2958
|
-
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
|
|
2959
|
-
)
|
|
2960
|
-
);
|
|
2961
|
-
}
|
|
2962
2974
|
function getCacheExpression(value) {
|
|
2963
2975
|
const exp = context.cache(value);
|
|
2964
|
-
|
|
2965
|
-
exp.needArraySpread = true;
|
|
2966
|
-
}
|
|
2976
|
+
exp.needArraySpread = true;
|
|
2967
2977
|
return exp;
|
|
2968
2978
|
}
|
|
2969
2979
|
function getSlotNode(node2, name) {
|
|
@@ -4114,7 +4124,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4114
4124
|
}
|
|
4115
4125
|
|
|
4116
4126
|
const transformIf = createStructuralDirectiveTransform(
|
|
4117
|
-
/^(if|else|else-if)$/,
|
|
4127
|
+
/^(?:if|else|else-if)$/,
|
|
4118
4128
|
(node, dir, context) => {
|
|
4119
4129
|
return processIf(node, dir, context, (ifNode, branch, isRoot) => {
|
|
4120
4130
|
const siblings = context.parent.children;
|
|
@@ -4183,7 +4193,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4183
4193
|
continue;
|
|
4184
4194
|
}
|
|
4185
4195
|
if (sibling && sibling.type === 9) {
|
|
4186
|
-
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4196
|
+
if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4187
4197
|
context.onError(
|
|
4188
4198
|
createCompilerError(30, node.loc)
|
|
4189
4199
|
);
|
|
@@ -4332,80 +4342,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4332
4342
|
}
|
|
4333
4343
|
}
|
|
4334
4344
|
|
|
4335
|
-
const transformBind = (dir, _node, context) => {
|
|
4336
|
-
const { modifiers, loc } = dir;
|
|
4337
|
-
const arg = dir.arg;
|
|
4338
|
-
let { exp } = dir;
|
|
4339
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4340
|
-
{
|
|
4341
|
-
exp = void 0;
|
|
4342
|
-
}
|
|
4343
|
-
}
|
|
4344
|
-
if (!exp) {
|
|
4345
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
4346
|
-
context.onError(
|
|
4347
|
-
createCompilerError(
|
|
4348
|
-
52,
|
|
4349
|
-
arg.loc
|
|
4350
|
-
)
|
|
4351
|
-
);
|
|
4352
|
-
return {
|
|
4353
|
-
props: [
|
|
4354
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4355
|
-
]
|
|
4356
|
-
};
|
|
4357
|
-
}
|
|
4358
|
-
transformBindShorthand(dir);
|
|
4359
|
-
exp = dir.exp;
|
|
4360
|
-
}
|
|
4361
|
-
if (arg.type !== 4) {
|
|
4362
|
-
arg.children.unshift(`(`);
|
|
4363
|
-
arg.children.push(`) || ""`);
|
|
4364
|
-
} else if (!arg.isStatic) {
|
|
4365
|
-
arg.content = `${arg.content} || ""`;
|
|
4366
|
-
}
|
|
4367
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4368
|
-
if (arg.type === 4) {
|
|
4369
|
-
if (arg.isStatic) {
|
|
4370
|
-
arg.content = camelize(arg.content);
|
|
4371
|
-
} else {
|
|
4372
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4373
|
-
}
|
|
4374
|
-
} else {
|
|
4375
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4376
|
-
arg.children.push(`)`);
|
|
4377
|
-
}
|
|
4378
|
-
}
|
|
4379
|
-
if (!context.inSSR) {
|
|
4380
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
4381
|
-
injectPrefix(arg, ".");
|
|
4382
|
-
}
|
|
4383
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
4384
|
-
injectPrefix(arg, "^");
|
|
4385
|
-
}
|
|
4386
|
-
}
|
|
4387
|
-
return {
|
|
4388
|
-
props: [createObjectProperty(arg, exp)]
|
|
4389
|
-
};
|
|
4390
|
-
};
|
|
4391
|
-
const transformBindShorthand = (dir, context) => {
|
|
4392
|
-
const arg = dir.arg;
|
|
4393
|
-
const propName = camelize(arg.content);
|
|
4394
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4395
|
-
};
|
|
4396
|
-
const injectPrefix = (arg, prefix) => {
|
|
4397
|
-
if (arg.type === 4) {
|
|
4398
|
-
if (arg.isStatic) {
|
|
4399
|
-
arg.content = prefix + arg.content;
|
|
4400
|
-
} else {
|
|
4401
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4402
|
-
}
|
|
4403
|
-
} else {
|
|
4404
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
4405
|
-
arg.children.push(`)`);
|
|
4406
|
-
}
|
|
4407
|
-
};
|
|
4408
|
-
|
|
4409
4345
|
const transformFor = createStructuralDirectiveTransform(
|
|
4410
4346
|
"for",
|
|
4411
4347
|
(node, dir, context) => {
|
|
@@ -4417,10 +4353,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4417
4353
|
const isTemplate = isTemplateNode(node);
|
|
4418
4354
|
const memo = findDir(node, "memo");
|
|
4419
4355
|
const keyProp = findProp(node, `key`, false, true);
|
|
4420
|
-
|
|
4421
|
-
if (isDirKey && !keyProp.exp) {
|
|
4422
|
-
transformBindShorthand(keyProp);
|
|
4423
|
-
}
|
|
4356
|
+
keyProp && keyProp.type === 7;
|
|
4424
4357
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4425
4358
|
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4426
4359
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
@@ -4720,7 +4653,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4720
4653
|
);
|
|
4721
4654
|
} else if (vElse = findDir(
|
|
4722
4655
|
slotElement,
|
|
4723
|
-
/^else(
|
|
4656
|
+
/^else(?:-if)?$/,
|
|
4724
4657
|
true
|
|
4725
4658
|
/* allowEmpty */
|
|
4726
4659
|
)) {
|
|
@@ -4732,7 +4665,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4732
4665
|
break;
|
|
4733
4666
|
}
|
|
4734
4667
|
}
|
|
4735
|
-
if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
|
|
4668
|
+
if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
|
|
4736
4669
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
4737
4670
|
while (conditional.alternate.type === 19) {
|
|
4738
4671
|
conditional = conditional.alternate;
|
|
@@ -5592,6 +5525,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5592
5525
|
return ret;
|
|
5593
5526
|
};
|
|
5594
5527
|
|
|
5528
|
+
const transformBind = (dir, _node, context) => {
|
|
5529
|
+
const { modifiers, loc } = dir;
|
|
5530
|
+
const arg = dir.arg;
|
|
5531
|
+
let { exp } = dir;
|
|
5532
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5533
|
+
{
|
|
5534
|
+
exp = void 0;
|
|
5535
|
+
}
|
|
5536
|
+
}
|
|
5537
|
+
if (arg.type !== 4) {
|
|
5538
|
+
arg.children.unshift(`(`);
|
|
5539
|
+
arg.children.push(`) || ""`);
|
|
5540
|
+
} else if (!arg.isStatic) {
|
|
5541
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
5542
|
+
}
|
|
5543
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
5544
|
+
if (arg.type === 4) {
|
|
5545
|
+
if (arg.isStatic) {
|
|
5546
|
+
arg.content = camelize(arg.content);
|
|
5547
|
+
} else {
|
|
5548
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5549
|
+
}
|
|
5550
|
+
} else {
|
|
5551
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5552
|
+
arg.children.push(`)`);
|
|
5553
|
+
}
|
|
5554
|
+
}
|
|
5555
|
+
if (!context.inSSR) {
|
|
5556
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
5557
|
+
injectPrefix(arg, ".");
|
|
5558
|
+
}
|
|
5559
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
5560
|
+
injectPrefix(arg, "^");
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
return {
|
|
5564
|
+
props: [createObjectProperty(arg, exp)]
|
|
5565
|
+
};
|
|
5566
|
+
};
|
|
5567
|
+
const injectPrefix = (arg, prefix) => {
|
|
5568
|
+
if (arg.type === 4) {
|
|
5569
|
+
if (arg.isStatic) {
|
|
5570
|
+
arg.content = prefix + arg.content;
|
|
5571
|
+
} else {
|
|
5572
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5573
|
+
}
|
|
5574
|
+
} else {
|
|
5575
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
5576
|
+
arg.children.push(`)`);
|
|
5577
|
+
}
|
|
5578
|
+
};
|
|
5579
|
+
|
|
5595
5580
|
const transformText = (node, context) => {
|
|
5596
5581
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5597
5582
|
return () => {
|
|
@@ -5900,7 +5885,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5900
5885
|
const transformMemo = (node, context) => {
|
|
5901
5886
|
if (node.type === 1) {
|
|
5902
5887
|
const dir = findDir(node, "memo");
|
|
5903
|
-
if (!dir || seen.has(node)) {
|
|
5888
|
+
if (!dir || seen.has(node) || context.inSSR) {
|
|
5904
5889
|
return;
|
|
5905
5890
|
}
|
|
5906
5891
|
seen.add(node);
|
|
@@ -5922,9 +5907,36 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5922
5907
|
}
|
|
5923
5908
|
};
|
|
5924
5909
|
|
|
5910
|
+
const transformVBindShorthand = (node, context) => {
|
|
5911
|
+
if (node.type === 1) {
|
|
5912
|
+
for (const prop of node.props) {
|
|
5913
|
+
if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
|
|
5914
|
+
prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
|
|
5915
|
+
const arg = prop.arg;
|
|
5916
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
5917
|
+
context.onError(
|
|
5918
|
+
createCompilerError(
|
|
5919
|
+
52,
|
|
5920
|
+
arg.loc
|
|
5921
|
+
)
|
|
5922
|
+
);
|
|
5923
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
5924
|
+
} else {
|
|
5925
|
+
const propName = camelize(arg.content);
|
|
5926
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
5927
|
+
propName[0] === "-") {
|
|
5928
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
};
|
|
5935
|
+
|
|
5925
5936
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
5926
5937
|
return [
|
|
5927
5938
|
[
|
|
5939
|
+
transformVBindShorthand,
|
|
5928
5940
|
transformOnce,
|
|
5929
5941
|
transformIf,
|
|
5930
5942
|
transformMemo,
|
|
@@ -6414,46 +6426,46 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6414
6426
|
if (node.type === 1 && node.tagType === 1) {
|
|
6415
6427
|
const component = context.isBuiltInComponent(node.tag);
|
|
6416
6428
|
if (component === TRANSITION) {
|
|
6417
|
-
return ()
|
|
6418
|
-
if (!node.children.length) {
|
|
6419
|
-
return;
|
|
6420
|
-
}
|
|
6421
|
-
if (hasMultipleChildren(node)) {
|
|
6422
|
-
context.onError(
|
|
6423
|
-
createDOMCompilerError(
|
|
6424
|
-
62,
|
|
6425
|
-
{
|
|
6426
|
-
start: node.children[0].loc.start,
|
|
6427
|
-
end: node.children[node.children.length - 1].loc.end,
|
|
6428
|
-
source: ""
|
|
6429
|
-
}
|
|
6430
|
-
)
|
|
6431
|
-
);
|
|
6432
|
-
}
|
|
6433
|
-
const child = node.children[0];
|
|
6434
|
-
if (child.type === 1) {
|
|
6435
|
-
for (const p of child.props) {
|
|
6436
|
-
if (p.type === 7 && p.name === "show") {
|
|
6437
|
-
node.props.push({
|
|
6438
|
-
type: 6,
|
|
6439
|
-
name: "persisted",
|
|
6440
|
-
nameLoc: node.loc,
|
|
6441
|
-
value: void 0,
|
|
6442
|
-
loc: node.loc
|
|
6443
|
-
});
|
|
6444
|
-
}
|
|
6445
|
-
}
|
|
6446
|
-
}
|
|
6447
|
-
};
|
|
6429
|
+
return postTransformTransition(node, context.onError);
|
|
6448
6430
|
}
|
|
6449
6431
|
}
|
|
6450
6432
|
};
|
|
6451
|
-
function
|
|
6433
|
+
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
|
|
6434
|
+
return () => {
|
|
6435
|
+
if (!node.children.length) {
|
|
6436
|
+
return;
|
|
6437
|
+
}
|
|
6438
|
+
if (hasMultipleChildren(node)) {
|
|
6439
|
+
onError(
|
|
6440
|
+
createDOMCompilerError(62, {
|
|
6441
|
+
start: node.children[0].loc.start,
|
|
6442
|
+
end: node.children[node.children.length - 1].loc.end,
|
|
6443
|
+
source: ""
|
|
6444
|
+
})
|
|
6445
|
+
);
|
|
6446
|
+
}
|
|
6447
|
+
const child = node.children[0];
|
|
6448
|
+
if (child.type === 1) {
|
|
6449
|
+
for (const p of child.props) {
|
|
6450
|
+
if (p.type === 7 && p.name === "show") {
|
|
6451
|
+
node.props.push({
|
|
6452
|
+
type: 6,
|
|
6453
|
+
name: "persisted",
|
|
6454
|
+
nameLoc: node.loc,
|
|
6455
|
+
value: void 0,
|
|
6456
|
+
loc: node.loc
|
|
6457
|
+
});
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
};
|
|
6462
|
+
}
|
|
6463
|
+
function defaultHasMultipleChildren(node) {
|
|
6452
6464
|
const children = node.children = node.children.filter(
|
|
6453
6465
|
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
|
6454
6466
|
);
|
|
6455
6467
|
const child = children[0];
|
|
6456
|
-
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(
|
|
6468
|
+
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
6457
6469
|
}
|
|
6458
6470
|
|
|
6459
6471
|
const ignoreSideEffectTags = (node, context) => {
|
|
@@ -6819,12 +6831,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6819
6831
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
|
6820
6832
|
exports.isTemplateNode = isTemplateNode;
|
|
6821
6833
|
exports.isText = isText$1;
|
|
6834
|
+
exports.isVPre = isVPre;
|
|
6822
6835
|
exports.isVSlot = isVSlot;
|
|
6823
6836
|
exports.isValidHTMLNesting = isValidHTMLNesting;
|
|
6824
6837
|
exports.locStub = locStub;
|
|
6825
6838
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
|
6826
6839
|
exports.parse = parse;
|
|
6827
6840
|
exports.parserOptions = parserOptions;
|
|
6841
|
+
exports.postTransformTransition = postTransformTransition;
|
|
6828
6842
|
exports.processExpression = processExpression;
|
|
6829
6843
|
exports.processFor = processFor;
|
|
6830
6844
|
exports.processIf = processIf;
|
|
@@ -6843,8 +6857,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6843
6857
|
exports.transformModel = transformModel$1;
|
|
6844
6858
|
exports.transformOn = transformOn$1;
|
|
6845
6859
|
exports.transformStyle = transformStyle;
|
|
6860
|
+
exports.transformVBindShorthand = transformVBindShorthand;
|
|
6846
6861
|
exports.traverseNode = traverseNode;
|
|
6847
6862
|
exports.unwrapTSNode = unwrapTSNode;
|
|
6863
|
+
exports.validFirstIdentCharRE = validFirstIdentCharRE;
|
|
6848
6864
|
exports.walkBlockDeclarations = walkBlockDeclarations;
|
|
6849
6865
|
exports.walkFunctionParams = walkFunctionParams;
|
|
6850
6866
|
exports.walkIdentifiers = walkIdentifiers;
|