@vue/compiler-dom 3.6.0-alpha.2 → 3.6.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 +42 -38
- package/dist/compiler-dom.cjs.prod.js +47 -5
- package/dist/compiler-dom.d.ts +3 -1
- package/dist/compiler-dom.esm-browser.js +160 -153
- package/dist/compiler-dom.esm-browser.prod.js +9 -9
- package/dist/compiler-dom.esm-bundler.js +38 -38
- package/dist/compiler-dom.global.js +163 -153
- 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.4
|
|
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() : "";
|
|
@@ -53,6 +52,9 @@ var VueCompilerDOM = (function (exports) {
|
|
|
53
52
|
return s;
|
|
54
53
|
}
|
|
55
54
|
);
|
|
55
|
+
const getModifierPropName = (name) => {
|
|
56
|
+
return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
|
|
57
|
+
};
|
|
56
58
|
|
|
57
59
|
const PatchFlagNames = {
|
|
58
60
|
[1]: `TEXT`,
|
|
@@ -264,14 +266,6 @@ var VueCompilerDOM = (function (exports) {
|
|
|
264
266
|
});
|
|
265
267
|
}
|
|
266
268
|
|
|
267
|
-
const Namespaces = {
|
|
268
|
-
"HTML": 0,
|
|
269
|
-
"0": "HTML",
|
|
270
|
-
"SVG": 1,
|
|
271
|
-
"1": "SVG",
|
|
272
|
-
"MATH_ML": 2,
|
|
273
|
-
"2": "MATH_ML"
|
|
274
|
-
};
|
|
275
269
|
const NodeTypes = {
|
|
276
270
|
"ROOT": 0,
|
|
277
271
|
"0": "ROOT",
|
|
@@ -1650,7 +1644,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1650
1644
|
}
|
|
1651
1645
|
}
|
|
1652
1646
|
function walkBlockDeclarations(block, onIdent) {
|
|
1653
|
-
|
|
1647
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
1648
|
+
for (const stmt of body) {
|
|
1654
1649
|
if (stmt.type === "VariableDeclaration") {
|
|
1655
1650
|
if (stmt.declare) continue;
|
|
1656
1651
|
for (const decl of stmt.declarations) {
|
|
@@ -1663,6 +1658,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1663
1658
|
onIdent(stmt.id);
|
|
1664
1659
|
} else if (isForStatement(stmt)) {
|
|
1665
1660
|
walkForStatement(stmt, true, onIdent);
|
|
1661
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
1662
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
1666
1663
|
}
|
|
1667
1664
|
}
|
|
1668
1665
|
}
|
|
@@ -1679,6 +1676,20 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1679
1676
|
}
|
|
1680
1677
|
}
|
|
1681
1678
|
}
|
|
1679
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
1680
|
+
for (const cs of stmt.cases) {
|
|
1681
|
+
for (const stmt2 of cs.consequent) {
|
|
1682
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
1683
|
+
for (const decl of stmt2.declarations) {
|
|
1684
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1685
|
+
onIdent(id);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
walkBlockDeclarations(cs, onIdent);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1682
1693
|
function extractIdentifiers(param, nodes = []) {
|
|
1683
1694
|
switch (param.type) {
|
|
1684
1695
|
case "Identifier":
|
|
@@ -1809,7 +1820,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1809
1820
|
return BASE_TRANSITION;
|
|
1810
1821
|
}
|
|
1811
1822
|
}
|
|
1812
|
-
const nonIdentifierRE =
|
|
1823
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1813
1824
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1814
1825
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1815
1826
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1879,7 +1890,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1879
1890
|
};
|
|
1880
1891
|
const isMemberExpressionNode = NOOP ;
|
|
1881
1892
|
const isMemberExpression = isMemberExpressionBrowser ;
|
|
1882
|
-
const fnExpRE = /^\s*(async\s*)?(
|
|
1893
|
+
const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
1883
1894
|
const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
|
|
1884
1895
|
const isFnExpressionNode = NOOP ;
|
|
1885
1896
|
const isFnExpression = isFnExpressionBrowser ;
|
|
@@ -1948,6 +1959,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1948
1959
|
function isText$1(node) {
|
|
1949
1960
|
return node.type === 5 || node.type === 2;
|
|
1950
1961
|
}
|
|
1962
|
+
function isVPre(p) {
|
|
1963
|
+
return p.type === 7 && p.name === "pre";
|
|
1964
|
+
}
|
|
1951
1965
|
function isVSlot(p) {
|
|
1952
1966
|
return p.type === 7 && p.name === "slot";
|
|
1953
1967
|
}
|
|
@@ -2246,7 +2260,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2246
2260
|
ondirarg(start, end) {
|
|
2247
2261
|
if (start === end) return;
|
|
2248
2262
|
const arg = getSlice(start, end);
|
|
2249
|
-
if (inVPre) {
|
|
2263
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2250
2264
|
currentProp.name += arg;
|
|
2251
2265
|
setLocEnd(currentProp.nameLoc, end);
|
|
2252
2266
|
} else {
|
|
@@ -2261,7 +2275,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2261
2275
|
},
|
|
2262
2276
|
ondirmodifier(start, end) {
|
|
2263
2277
|
const mod = getSlice(start, end);
|
|
2264
|
-
if (inVPre) {
|
|
2278
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2265
2279
|
currentProp.name += "." + mod;
|
|
2266
2280
|
setLocEnd(currentProp.nameLoc, end);
|
|
2267
2281
|
} else if (currentProp.name === "slot") {
|
|
@@ -2889,6 +2903,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2889
2903
|
} else if (child.type === 12) {
|
|
2890
2904
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2891
2905
|
if (constantType >= 2) {
|
|
2906
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
2907
|
+
child.codegenNode.arguments.push(
|
|
2908
|
+
-1 + (` /* ${PatchFlagNames[-1]} */` )
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2892
2911
|
toCache.push(child);
|
|
2893
2912
|
continue;
|
|
2894
2913
|
}
|
|
@@ -2917,7 +2936,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2917
2936
|
}
|
|
2918
2937
|
}
|
|
2919
2938
|
let cachedAsArray = false;
|
|
2920
|
-
const slotCacheKeys = [];
|
|
2921
2939
|
if (toCache.length === children.length && node.type === 1) {
|
|
2922
2940
|
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
2923
2941
|
node.codegenNode.children = getCacheExpression(
|
|
@@ -2927,7 +2945,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2927
2945
|
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2928
2946
|
const slot = getSlotNode(node.codegenNode, "default");
|
|
2929
2947
|
if (slot) {
|
|
2930
|
-
slotCacheKeys.push(context.cached.length);
|
|
2931
2948
|
slot.returns = getCacheExpression(
|
|
2932
2949
|
createArrayExpression(slot.returns)
|
|
2933
2950
|
);
|
|
@@ -2937,7 +2954,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2937
2954
|
const slotName = findDir(node, "slot", true);
|
|
2938
2955
|
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
|
|
2939
2956
|
if (slot) {
|
|
2940
|
-
slotCacheKeys.push(context.cached.length);
|
|
2941
2957
|
slot.returns = getCacheExpression(
|
|
2942
2958
|
createArrayExpression(slot.returns)
|
|
2943
2959
|
);
|
|
@@ -2947,23 +2963,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2947
2963
|
}
|
|
2948
2964
|
if (!cachedAsArray) {
|
|
2949
2965
|
for (const child of toCache) {
|
|
2950
|
-
slotCacheKeys.push(context.cached.length);
|
|
2951
2966
|
child.codegenNode = context.cache(child.codegenNode);
|
|
2952
2967
|
}
|
|
2953
2968
|
}
|
|
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
2969
|
function getCacheExpression(value) {
|
|
2963
2970
|
const exp = context.cache(value);
|
|
2964
|
-
|
|
2965
|
-
exp.needArraySpread = true;
|
|
2966
|
-
}
|
|
2971
|
+
exp.needArraySpread = true;
|
|
2967
2972
|
return exp;
|
|
2968
2973
|
}
|
|
2969
2974
|
function getSlotNode(node2, name) {
|
|
@@ -4114,7 +4119,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4114
4119
|
}
|
|
4115
4120
|
|
|
4116
4121
|
const transformIf = createStructuralDirectiveTransform(
|
|
4117
|
-
/^(if|else|else-if)$/,
|
|
4122
|
+
/^(?:if|else|else-if)$/,
|
|
4118
4123
|
(node, dir, context) => {
|
|
4119
4124
|
return processIf(node, dir, context, (ifNode, branch, isRoot) => {
|
|
4120
4125
|
const siblings = context.parent.children;
|
|
@@ -4183,7 +4188,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4183
4188
|
continue;
|
|
4184
4189
|
}
|
|
4185
4190
|
if (sibling && sibling.type === 9) {
|
|
4186
|
-
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4191
|
+
if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4187
4192
|
context.onError(
|
|
4188
4193
|
createCompilerError(30, node.loc)
|
|
4189
4194
|
);
|
|
@@ -4332,80 +4337,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4332
4337
|
}
|
|
4333
4338
|
}
|
|
4334
4339
|
|
|
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
4340
|
const transformFor = createStructuralDirectiveTransform(
|
|
4410
4341
|
"for",
|
|
4411
4342
|
(node, dir, context) => {
|
|
@@ -4417,10 +4348,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4417
4348
|
const isTemplate = isTemplateNode(node);
|
|
4418
4349
|
const memo = findDir(node, "memo");
|
|
4419
4350
|
const keyProp = findProp(node, `key`, false, true);
|
|
4420
|
-
|
|
4421
|
-
if (isDirKey && !keyProp.exp) {
|
|
4422
|
-
transformBindShorthand(keyProp);
|
|
4423
|
-
}
|
|
4351
|
+
keyProp && keyProp.type === 7;
|
|
4424
4352
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4425
4353
|
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4426
4354
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
@@ -4720,7 +4648,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4720
4648
|
);
|
|
4721
4649
|
} else if (vElse = findDir(
|
|
4722
4650
|
slotElement,
|
|
4723
|
-
/^else(
|
|
4651
|
+
/^else(?:-if)?$/,
|
|
4724
4652
|
true
|
|
4725
4653
|
/* allowEmpty */
|
|
4726
4654
|
)) {
|
|
@@ -4732,7 +4660,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4732
4660
|
break;
|
|
4733
4661
|
}
|
|
4734
4662
|
}
|
|
4735
|
-
if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
|
|
4663
|
+
if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
|
|
4736
4664
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
4737
4665
|
while (conditional.alternate.type === 19) {
|
|
4738
4666
|
conditional = conditional.alternate;
|
|
@@ -5592,6 +5520,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5592
5520
|
return ret;
|
|
5593
5521
|
};
|
|
5594
5522
|
|
|
5523
|
+
const transformBind = (dir, _node, context) => {
|
|
5524
|
+
const { modifiers, loc } = dir;
|
|
5525
|
+
const arg = dir.arg;
|
|
5526
|
+
let { exp } = dir;
|
|
5527
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5528
|
+
{
|
|
5529
|
+
exp = void 0;
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
if (arg.type !== 4) {
|
|
5533
|
+
arg.children.unshift(`(`);
|
|
5534
|
+
arg.children.push(`) || ""`);
|
|
5535
|
+
} else if (!arg.isStatic) {
|
|
5536
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
5537
|
+
}
|
|
5538
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
5539
|
+
if (arg.type === 4) {
|
|
5540
|
+
if (arg.isStatic) {
|
|
5541
|
+
arg.content = camelize(arg.content);
|
|
5542
|
+
} else {
|
|
5543
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5544
|
+
}
|
|
5545
|
+
} else {
|
|
5546
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5547
|
+
arg.children.push(`)`);
|
|
5548
|
+
}
|
|
5549
|
+
}
|
|
5550
|
+
if (!context.inSSR) {
|
|
5551
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
5552
|
+
injectPrefix(arg, ".");
|
|
5553
|
+
}
|
|
5554
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
5555
|
+
injectPrefix(arg, "^");
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
return {
|
|
5559
|
+
props: [createObjectProperty(arg, exp)]
|
|
5560
|
+
};
|
|
5561
|
+
};
|
|
5562
|
+
const injectPrefix = (arg, prefix) => {
|
|
5563
|
+
if (arg.type === 4) {
|
|
5564
|
+
if (arg.isStatic) {
|
|
5565
|
+
arg.content = prefix + arg.content;
|
|
5566
|
+
} else {
|
|
5567
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5568
|
+
}
|
|
5569
|
+
} else {
|
|
5570
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
5571
|
+
arg.children.push(`)`);
|
|
5572
|
+
}
|
|
5573
|
+
};
|
|
5574
|
+
|
|
5595
5575
|
const transformText = (node, context) => {
|
|
5596
5576
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5597
5577
|
return () => {
|
|
@@ -5728,7 +5708,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5728
5708
|
];
|
|
5729
5709
|
if (dir.modifiers.length && node.tagType === 1) {
|
|
5730
5710
|
const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
|
|
5731
|
-
const modifiersKey = arg ? isStaticExp(arg) ?
|
|
5711
|
+
const modifiersKey = arg ? isStaticExp(arg) ? getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
|
|
5732
5712
|
props.push(
|
|
5733
5713
|
createObjectProperty(
|
|
5734
5714
|
modifiersKey,
|
|
@@ -5900,7 +5880,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5900
5880
|
const transformMemo = (node, context) => {
|
|
5901
5881
|
if (node.type === 1) {
|
|
5902
5882
|
const dir = findDir(node, "memo");
|
|
5903
|
-
if (!dir || seen.has(node)) {
|
|
5883
|
+
if (!dir || seen.has(node) || context.inSSR) {
|
|
5904
5884
|
return;
|
|
5905
5885
|
}
|
|
5906
5886
|
seen.add(node);
|
|
@@ -5922,9 +5902,36 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5922
5902
|
}
|
|
5923
5903
|
};
|
|
5924
5904
|
|
|
5905
|
+
const transformVBindShorthand = (node, context) => {
|
|
5906
|
+
if (node.type === 1) {
|
|
5907
|
+
for (const prop of node.props) {
|
|
5908
|
+
if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
|
|
5909
|
+
prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
|
|
5910
|
+
const arg = prop.arg;
|
|
5911
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
5912
|
+
context.onError(
|
|
5913
|
+
createCompilerError(
|
|
5914
|
+
52,
|
|
5915
|
+
arg.loc
|
|
5916
|
+
)
|
|
5917
|
+
);
|
|
5918
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
5919
|
+
} else {
|
|
5920
|
+
const propName = camelize(arg.content);
|
|
5921
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
5922
|
+
propName[0] === "-") {
|
|
5923
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
}
|
|
5928
|
+
}
|
|
5929
|
+
};
|
|
5930
|
+
|
|
5925
5931
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
5926
5932
|
return [
|
|
5927
5933
|
[
|
|
5934
|
+
transformVBindShorthand,
|
|
5928
5935
|
transformOnce,
|
|
5929
5936
|
transformIf,
|
|
5930
5937
|
transformMemo,
|
|
@@ -6067,7 +6074,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6067
6074
|
let ns = parent ? parent.ns : rootNamespace;
|
|
6068
6075
|
if (parent && ns === 2) {
|
|
6069
6076
|
if (parent.tag === "annotation-xml") {
|
|
6070
|
-
if (tag
|
|
6077
|
+
if (isSVGTag(tag)) {
|
|
6071
6078
|
return 1;
|
|
6072
6079
|
}
|
|
6073
6080
|
if (parent.props.some(
|
|
@@ -6084,10 +6091,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6084
6091
|
}
|
|
6085
6092
|
}
|
|
6086
6093
|
if (ns === 0) {
|
|
6087
|
-
if (tag
|
|
6094
|
+
if (isSVGTag(tag)) {
|
|
6088
6095
|
return 1;
|
|
6089
6096
|
}
|
|
6090
|
-
if (tag
|
|
6097
|
+
if (isMathMLTag(tag)) {
|
|
6091
6098
|
return 2;
|
|
6092
6099
|
}
|
|
6093
6100
|
}
|
|
@@ -6414,46 +6421,46 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6414
6421
|
if (node.type === 1 && node.tagType === 1) {
|
|
6415
6422
|
const component = context.isBuiltInComponent(node.tag);
|
|
6416
6423
|
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
|
-
};
|
|
6424
|
+
return postTransformTransition(node, context.onError);
|
|
6448
6425
|
}
|
|
6449
6426
|
}
|
|
6450
6427
|
};
|
|
6451
|
-
function
|
|
6428
|
+
function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
|
|
6429
|
+
return () => {
|
|
6430
|
+
if (!node.children.length) {
|
|
6431
|
+
return;
|
|
6432
|
+
}
|
|
6433
|
+
if (hasMultipleChildren(node)) {
|
|
6434
|
+
onError(
|
|
6435
|
+
createDOMCompilerError(62, {
|
|
6436
|
+
start: node.children[0].loc.start,
|
|
6437
|
+
end: node.children[node.children.length - 1].loc.end,
|
|
6438
|
+
source: ""
|
|
6439
|
+
})
|
|
6440
|
+
);
|
|
6441
|
+
}
|
|
6442
|
+
const child = node.children[0];
|
|
6443
|
+
if (child.type === 1) {
|
|
6444
|
+
for (const p of child.props) {
|
|
6445
|
+
if (p.type === 7 && p.name === "show") {
|
|
6446
|
+
node.props.push({
|
|
6447
|
+
type: 6,
|
|
6448
|
+
name: "persisted",
|
|
6449
|
+
nameLoc: node.loc,
|
|
6450
|
+
value: void 0,
|
|
6451
|
+
loc: node.loc
|
|
6452
|
+
});
|
|
6453
|
+
}
|
|
6454
|
+
}
|
|
6455
|
+
}
|
|
6456
|
+
};
|
|
6457
|
+
}
|
|
6458
|
+
function defaultHasMultipleChildren(node) {
|
|
6452
6459
|
const children = node.children = node.children.filter(
|
|
6453
6460
|
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
|
6454
6461
|
);
|
|
6455
6462
|
const child = children[0];
|
|
6456
|
-
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(
|
|
6463
|
+
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
6457
6464
|
}
|
|
6458
6465
|
|
|
6459
6466
|
const ignoreSideEffectTags = (node, context) => {
|
|
@@ -6711,7 +6718,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6711
6718
|
exports.NORMALIZE_CLASS = NORMALIZE_CLASS;
|
|
6712
6719
|
exports.NORMALIZE_PROPS = NORMALIZE_PROPS;
|
|
6713
6720
|
exports.NORMALIZE_STYLE = NORMALIZE_STYLE;
|
|
6714
|
-
exports.Namespaces = Namespaces;
|
|
6715
6721
|
exports.NewlineType = NewlineType;
|
|
6716
6722
|
exports.NodeTypes = NodeTypes;
|
|
6717
6723
|
exports.OPEN_BLOCK = OPEN_BLOCK;
|
|
@@ -6819,12 +6825,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6819
6825
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
|
6820
6826
|
exports.isTemplateNode = isTemplateNode;
|
|
6821
6827
|
exports.isText = isText$1;
|
|
6828
|
+
exports.isVPre = isVPre;
|
|
6822
6829
|
exports.isVSlot = isVSlot;
|
|
6823
6830
|
exports.isValidHTMLNesting = isValidHTMLNesting;
|
|
6824
6831
|
exports.locStub = locStub;
|
|
6825
6832
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
|
6826
6833
|
exports.parse = parse;
|
|
6827
6834
|
exports.parserOptions = parserOptions;
|
|
6835
|
+
exports.postTransformTransition = postTransformTransition;
|
|
6828
6836
|
exports.processExpression = processExpression;
|
|
6829
6837
|
exports.processFor = processFor;
|
|
6830
6838
|
exports.processIf = processIf;
|
|
@@ -6843,8 +6851,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6843
6851
|
exports.transformModel = transformModel$1;
|
|
6844
6852
|
exports.transformOn = transformOn$1;
|
|
6845
6853
|
exports.transformStyle = transformStyle;
|
|
6854
|
+
exports.transformVBindShorthand = transformVBindShorthand;
|
|
6846
6855
|
exports.traverseNode = traverseNode;
|
|
6847
6856
|
exports.unwrapTSNode = unwrapTSNode;
|
|
6857
|
+
exports.validFirstIdentCharRE = validFirstIdentCharRE;
|
|
6848
6858
|
exports.walkBlockDeclarations = walkBlockDeclarations;
|
|
6849
6859
|
exports.walkFunctionParams = walkFunctionParams;
|
|
6850
6860
|
exports.walkIdentifiers = walkIdentifiers;
|