@vue/compiler-core 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-core.cjs.js +162 -134
- package/dist/compiler-core.cjs.prod.js +162 -134
- package/dist/compiler-core.d.ts +9 -11
- package/dist/compiler-core.esm-bundler.js +120 -115
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-core v3.6.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { isString, NOOP, isObject, extend, NO, isSymbol, isArray, EMPTY_OBJ, capitalize, camelize,
|
|
6
|
+
import { isString, NOOP, isObject, extend, NO, isSymbol, PatchFlagNames, isArray, EMPTY_OBJ, capitalize, camelize, makeMap, slotFlagsText, isOn, isBuiltInDirective, isReservedProp, toHandlerKey, getModifierPropName } from '@vue/shared';
|
|
7
7
|
export { generateCodeFrame } from '@vue/shared';
|
|
8
8
|
|
|
9
9
|
const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
|
|
@@ -128,14 +128,6 @@ function registerRuntimeHelpers(helpers) {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const Namespaces = {
|
|
132
|
-
"HTML": 0,
|
|
133
|
-
"0": "HTML",
|
|
134
|
-
"SVG": 1,
|
|
135
|
-
"1": "SVG",
|
|
136
|
-
"MATH_ML": 2,
|
|
137
|
-
"2": "MATH_ML"
|
|
138
|
-
};
|
|
139
131
|
const NodeTypes = {
|
|
140
132
|
"ROOT": 0,
|
|
141
133
|
"0": "ROOT",
|
|
@@ -1514,7 +1506,8 @@ function walkFunctionParams(node, onIdent) {
|
|
|
1514
1506
|
}
|
|
1515
1507
|
}
|
|
1516
1508
|
function walkBlockDeclarations(block, onIdent) {
|
|
1517
|
-
|
|
1509
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
1510
|
+
for (const stmt of body) {
|
|
1518
1511
|
if (stmt.type === "VariableDeclaration") {
|
|
1519
1512
|
if (stmt.declare) continue;
|
|
1520
1513
|
for (const decl of stmt.declarations) {
|
|
@@ -1527,6 +1520,8 @@ function walkBlockDeclarations(block, onIdent) {
|
|
|
1527
1520
|
onIdent(stmt.id);
|
|
1528
1521
|
} else if (isForStatement(stmt)) {
|
|
1529
1522
|
walkForStatement(stmt, true, onIdent);
|
|
1523
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
1524
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
1530
1525
|
}
|
|
1531
1526
|
}
|
|
1532
1527
|
}
|
|
@@ -1543,6 +1538,20 @@ function walkForStatement(stmt, isVar, onIdent) {
|
|
|
1543
1538
|
}
|
|
1544
1539
|
}
|
|
1545
1540
|
}
|
|
1541
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
1542
|
+
for (const cs of stmt.cases) {
|
|
1543
|
+
for (const stmt2 of cs.consequent) {
|
|
1544
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
1545
|
+
for (const decl of stmt2.declarations) {
|
|
1546
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1547
|
+
onIdent(id);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
walkBlockDeclarations(cs, onIdent);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1546
1555
|
function extractIdentifiers(param, nodes = []) {
|
|
1547
1556
|
switch (param.type) {
|
|
1548
1557
|
case "Identifier":
|
|
@@ -1673,7 +1682,7 @@ function isCoreComponent(tag) {
|
|
|
1673
1682
|
return BASE_TRANSITION;
|
|
1674
1683
|
}
|
|
1675
1684
|
}
|
|
1676
|
-
const nonIdentifierRE =
|
|
1685
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1677
1686
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1678
1687
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1679
1688
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1743,7 +1752,7 @@ const isMemberExpressionBrowser = (exp) => {
|
|
|
1743
1752
|
};
|
|
1744
1753
|
const isMemberExpressionNode = NOOP ;
|
|
1745
1754
|
const isMemberExpression = isMemberExpressionBrowser ;
|
|
1746
|
-
const fnExpRE = /^\s*(async\s*)?(
|
|
1755
|
+
const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
1747
1756
|
const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
|
|
1748
1757
|
const isFnExpressionNode = NOOP ;
|
|
1749
1758
|
const isFnExpression = isFnExpressionBrowser ;
|
|
@@ -1812,6 +1821,9 @@ function hasDynamicKeyVBind(node) {
|
|
|
1812
1821
|
function isText$1(node) {
|
|
1813
1822
|
return node.type === 5 || node.type === 2;
|
|
1814
1823
|
}
|
|
1824
|
+
function isVPre(p) {
|
|
1825
|
+
return p.type === 7 && p.name === "pre";
|
|
1826
|
+
}
|
|
1815
1827
|
function isVSlot(p) {
|
|
1816
1828
|
return p.type === 7 && p.name === "slot";
|
|
1817
1829
|
}
|
|
@@ -2111,7 +2123,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2111
2123
|
ondirarg(start, end) {
|
|
2112
2124
|
if (start === end) return;
|
|
2113
2125
|
const arg = getSlice(start, end);
|
|
2114
|
-
if (inVPre) {
|
|
2126
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2115
2127
|
currentProp.name += arg;
|
|
2116
2128
|
setLocEnd(currentProp.nameLoc, end);
|
|
2117
2129
|
} else {
|
|
@@ -2126,7 +2138,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2126
2138
|
},
|
|
2127
2139
|
ondirmodifier(start, end) {
|
|
2128
2140
|
const mod = getSlice(start, end);
|
|
2129
|
-
if (inVPre) {
|
|
2141
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2130
2142
|
currentProp.name += "." + mod;
|
|
2131
2143
|
setLocEnd(currentProp.nameLoc, end);
|
|
2132
2144
|
} else if (currentProp.name === "slot") {
|
|
@@ -2754,6 +2766,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2754
2766
|
} else if (child.type === 12) {
|
|
2755
2767
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2756
2768
|
if (constantType >= 2) {
|
|
2769
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
2770
|
+
child.codegenNode.arguments.push(
|
|
2771
|
+
-1 + (!!(process.env.NODE_ENV !== "production") ? ` /* ${PatchFlagNames[-1]} */` : ``)
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2757
2774
|
toCache.push(child);
|
|
2758
2775
|
continue;
|
|
2759
2776
|
}
|
|
@@ -2782,7 +2799,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2782
2799
|
}
|
|
2783
2800
|
}
|
|
2784
2801
|
let cachedAsArray = false;
|
|
2785
|
-
const slotCacheKeys = [];
|
|
2786
2802
|
if (toCache.length === children.length && node.type === 1) {
|
|
2787
2803
|
if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
|
|
2788
2804
|
node.codegenNode.children = getCacheExpression(
|
|
@@ -2792,7 +2808,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2792
2808
|
} else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
|
|
2793
2809
|
const slot = getSlotNode(node.codegenNode, "default");
|
|
2794
2810
|
if (slot) {
|
|
2795
|
-
slotCacheKeys.push(context.cached.length);
|
|
2796
2811
|
slot.returns = getCacheExpression(
|
|
2797
2812
|
createArrayExpression(slot.returns)
|
|
2798
2813
|
);
|
|
@@ -2802,7 +2817,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2802
2817
|
const slotName = findDir(node, "slot", true);
|
|
2803
2818
|
const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
|
|
2804
2819
|
if (slot) {
|
|
2805
|
-
slotCacheKeys.push(context.cached.length);
|
|
2806
2820
|
slot.returns = getCacheExpression(
|
|
2807
2821
|
createArrayExpression(slot.returns)
|
|
2808
2822
|
);
|
|
@@ -2812,23 +2826,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2812
2826
|
}
|
|
2813
2827
|
if (!cachedAsArray) {
|
|
2814
2828
|
for (const child of toCache) {
|
|
2815
|
-
slotCacheKeys.push(context.cached.length);
|
|
2816
2829
|
child.codegenNode = context.cache(child.codegenNode);
|
|
2817
2830
|
}
|
|
2818
2831
|
}
|
|
2819
|
-
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) {
|
|
2820
|
-
node.codegenNode.children.properties.push(
|
|
2821
|
-
createObjectProperty(
|
|
2822
|
-
`__`,
|
|
2823
|
-
createSimpleExpression(JSON.stringify(slotCacheKeys), false)
|
|
2824
|
-
)
|
|
2825
|
-
);
|
|
2826
|
-
}
|
|
2827
2832
|
function getCacheExpression(value) {
|
|
2828
2833
|
const exp = context.cache(value);
|
|
2829
|
-
|
|
2830
|
-
exp.needArraySpread = true;
|
|
2831
|
-
}
|
|
2834
|
+
exp.needArraySpread = true;
|
|
2832
2835
|
return exp;
|
|
2833
2836
|
}
|
|
2834
2837
|
function getSlotNode(node2, name) {
|
|
@@ -3982,7 +3985,7 @@ function stringifyExpression(exp) {
|
|
|
3982
3985
|
}
|
|
3983
3986
|
|
|
3984
3987
|
const transformIf = createStructuralDirectiveTransform(
|
|
3985
|
-
/^(if|else|else-if)$/,
|
|
3988
|
+
/^(?:if|else|else-if)$/,
|
|
3986
3989
|
(node, dir, context) => {
|
|
3987
3990
|
return processIf(node, dir, context, (ifNode, branch, isRoot) => {
|
|
3988
3991
|
const siblings = context.parent.children;
|
|
@@ -4051,7 +4054,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
4051
4054
|
continue;
|
|
4052
4055
|
}
|
|
4053
4056
|
if (sibling && sibling.type === 9) {
|
|
4054
|
-
if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4057
|
+
if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
|
|
4055
4058
|
context.onError(
|
|
4056
4059
|
createCompilerError(30, node.loc)
|
|
4057
4060
|
);
|
|
@@ -4200,80 +4203,6 @@ function getParentCondition(node) {
|
|
|
4200
4203
|
}
|
|
4201
4204
|
}
|
|
4202
4205
|
|
|
4203
|
-
const transformBind = (dir, _node, context) => {
|
|
4204
|
-
const { modifiers, loc } = dir;
|
|
4205
|
-
const arg = dir.arg;
|
|
4206
|
-
let { exp } = dir;
|
|
4207
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4208
|
-
{
|
|
4209
|
-
exp = void 0;
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
if (!exp) {
|
|
4213
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
4214
|
-
context.onError(
|
|
4215
|
-
createCompilerError(
|
|
4216
|
-
52,
|
|
4217
|
-
arg.loc
|
|
4218
|
-
)
|
|
4219
|
-
);
|
|
4220
|
-
return {
|
|
4221
|
-
props: [
|
|
4222
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4223
|
-
]
|
|
4224
|
-
};
|
|
4225
|
-
}
|
|
4226
|
-
transformBindShorthand(dir);
|
|
4227
|
-
exp = dir.exp;
|
|
4228
|
-
}
|
|
4229
|
-
if (arg.type !== 4) {
|
|
4230
|
-
arg.children.unshift(`(`);
|
|
4231
|
-
arg.children.push(`) || ""`);
|
|
4232
|
-
} else if (!arg.isStatic) {
|
|
4233
|
-
arg.content = `${arg.content} || ""`;
|
|
4234
|
-
}
|
|
4235
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4236
|
-
if (arg.type === 4) {
|
|
4237
|
-
if (arg.isStatic) {
|
|
4238
|
-
arg.content = camelize(arg.content);
|
|
4239
|
-
} else {
|
|
4240
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4241
|
-
}
|
|
4242
|
-
} else {
|
|
4243
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4244
|
-
arg.children.push(`)`);
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
|
-
if (!context.inSSR) {
|
|
4248
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
4249
|
-
injectPrefix(arg, ".");
|
|
4250
|
-
}
|
|
4251
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
4252
|
-
injectPrefix(arg, "^");
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
return {
|
|
4256
|
-
props: [createObjectProperty(arg, exp)]
|
|
4257
|
-
};
|
|
4258
|
-
};
|
|
4259
|
-
const transformBindShorthand = (dir, context) => {
|
|
4260
|
-
const arg = dir.arg;
|
|
4261
|
-
const propName = camelize(arg.content);
|
|
4262
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4263
|
-
};
|
|
4264
|
-
const injectPrefix = (arg, prefix) => {
|
|
4265
|
-
if (arg.type === 4) {
|
|
4266
|
-
if (arg.isStatic) {
|
|
4267
|
-
arg.content = prefix + arg.content;
|
|
4268
|
-
} else {
|
|
4269
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4270
|
-
}
|
|
4271
|
-
} else {
|
|
4272
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
4273
|
-
arg.children.push(`)`);
|
|
4274
|
-
}
|
|
4275
|
-
};
|
|
4276
|
-
|
|
4277
4206
|
const transformFor = createStructuralDirectiveTransform(
|
|
4278
4207
|
"for",
|
|
4279
4208
|
(node, dir, context) => {
|
|
@@ -4285,10 +4214,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4285
4214
|
const isTemplate = isTemplateNode(node);
|
|
4286
4215
|
const memo = findDir(node, "memo");
|
|
4287
4216
|
const keyProp = findProp(node, `key`, false, true);
|
|
4288
|
-
|
|
4289
|
-
if (isDirKey && !keyProp.exp) {
|
|
4290
|
-
transformBindShorthand(keyProp);
|
|
4291
|
-
}
|
|
4217
|
+
keyProp && keyProp.type === 7;
|
|
4292
4218
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4293
4219
|
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4294
4220
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
@@ -4588,7 +4514,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4588
4514
|
);
|
|
4589
4515
|
} else if (vElse = findDir(
|
|
4590
4516
|
slotElement,
|
|
4591
|
-
/^else(
|
|
4517
|
+
/^else(?:-if)?$/,
|
|
4592
4518
|
true
|
|
4593
4519
|
/* allowEmpty */
|
|
4594
4520
|
)) {
|
|
@@ -4600,7 +4526,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4600
4526
|
break;
|
|
4601
4527
|
}
|
|
4602
4528
|
}
|
|
4603
|
-
if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
|
|
4529
|
+
if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
|
|
4604
4530
|
let conditional = dynamicSlots[dynamicSlots.length - 1];
|
|
4605
4531
|
while (conditional.alternate.type === 19) {
|
|
4606
4532
|
conditional = conditional.alternate;
|
|
@@ -5460,6 +5386,58 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
5460
5386
|
return ret;
|
|
5461
5387
|
};
|
|
5462
5388
|
|
|
5389
|
+
const transformBind = (dir, _node, context) => {
|
|
5390
|
+
const { modifiers, loc } = dir;
|
|
5391
|
+
const arg = dir.arg;
|
|
5392
|
+
let { exp } = dir;
|
|
5393
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5394
|
+
{
|
|
5395
|
+
exp = void 0;
|
|
5396
|
+
}
|
|
5397
|
+
}
|
|
5398
|
+
if (arg.type !== 4) {
|
|
5399
|
+
arg.children.unshift(`(`);
|
|
5400
|
+
arg.children.push(`) || ""`);
|
|
5401
|
+
} else if (!arg.isStatic) {
|
|
5402
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
5403
|
+
}
|
|
5404
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
5405
|
+
if (arg.type === 4) {
|
|
5406
|
+
if (arg.isStatic) {
|
|
5407
|
+
arg.content = camelize(arg.content);
|
|
5408
|
+
} else {
|
|
5409
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5410
|
+
}
|
|
5411
|
+
} else {
|
|
5412
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5413
|
+
arg.children.push(`)`);
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5416
|
+
if (!context.inSSR) {
|
|
5417
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
5418
|
+
injectPrefix(arg, ".");
|
|
5419
|
+
}
|
|
5420
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
5421
|
+
injectPrefix(arg, "^");
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
return {
|
|
5425
|
+
props: [createObjectProperty(arg, exp)]
|
|
5426
|
+
};
|
|
5427
|
+
};
|
|
5428
|
+
const injectPrefix = (arg, prefix) => {
|
|
5429
|
+
if (arg.type === 4) {
|
|
5430
|
+
if (arg.isStatic) {
|
|
5431
|
+
arg.content = prefix + arg.content;
|
|
5432
|
+
} else {
|
|
5433
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5434
|
+
}
|
|
5435
|
+
} else {
|
|
5436
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
5437
|
+
arg.children.push(`)`);
|
|
5438
|
+
}
|
|
5439
|
+
};
|
|
5440
|
+
|
|
5463
5441
|
const transformText = (node, context) => {
|
|
5464
5442
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5465
5443
|
return () => {
|
|
@@ -5596,7 +5574,7 @@ const transformModel = (dir, node, context) => {
|
|
|
5596
5574
|
];
|
|
5597
5575
|
if (dir.modifiers.length && node.tagType === 1) {
|
|
5598
5576
|
const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
|
|
5599
|
-
const modifiersKey = arg ? isStaticExp(arg) ?
|
|
5577
|
+
const modifiersKey = arg ? isStaticExp(arg) ? getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
|
|
5600
5578
|
props.push(
|
|
5601
5579
|
createObjectProperty(
|
|
5602
5580
|
modifiersKey,
|
|
@@ -5768,7 +5746,7 @@ const seen = /* @__PURE__ */ new WeakSet();
|
|
|
5768
5746
|
const transformMemo = (node, context) => {
|
|
5769
5747
|
if (node.type === 1) {
|
|
5770
5748
|
const dir = findDir(node, "memo");
|
|
5771
|
-
if (!dir || seen.has(node)) {
|
|
5749
|
+
if (!dir || seen.has(node) || context.inSSR) {
|
|
5772
5750
|
return;
|
|
5773
5751
|
}
|
|
5774
5752
|
seen.add(node);
|
|
@@ -5790,9 +5768,36 @@ const transformMemo = (node, context) => {
|
|
|
5790
5768
|
}
|
|
5791
5769
|
};
|
|
5792
5770
|
|
|
5771
|
+
const transformVBindShorthand = (node, context) => {
|
|
5772
|
+
if (node.type === 1) {
|
|
5773
|
+
for (const prop of node.props) {
|
|
5774
|
+
if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
|
|
5775
|
+
prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
|
|
5776
|
+
const arg = prop.arg;
|
|
5777
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
5778
|
+
context.onError(
|
|
5779
|
+
createCompilerError(
|
|
5780
|
+
52,
|
|
5781
|
+
arg.loc
|
|
5782
|
+
)
|
|
5783
|
+
);
|
|
5784
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
5785
|
+
} else {
|
|
5786
|
+
const propName = camelize(arg.content);
|
|
5787
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
5788
|
+
propName[0] === "-") {
|
|
5789
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
};
|
|
5796
|
+
|
|
5793
5797
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
5794
5798
|
return [
|
|
5795
5799
|
[
|
|
5800
|
+
transformVBindShorthand,
|
|
5796
5801
|
transformOnce,
|
|
5797
5802
|
transformIf,
|
|
5798
5803
|
transformMemo,
|
|
@@ -5867,4 +5872,4 @@ const BindingTypes = {
|
|
|
5867
5872
|
|
|
5868
5873
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
5869
5874
|
|
|
5870
|
-
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE,
|
|
5875
|
+
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, NewlineType, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, defaultOnError, defaultOnWarn, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getSelfName, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isConstantNode, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isLiteralWhitelisted, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticNode, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVPre, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformVBindShorthand, traverseNode, unwrapTSNode, validFirstIdentCharRE, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.6.0-alpha.
|
|
3
|
+
"version": "3.6.0-alpha.4",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/parser": "^7.
|
|
49
|
+
"@babel/parser": "^7.28.5",
|
|
50
50
|
"entities": "^4.5.0",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.1",
|
|
53
|
-
"@vue/shared": "3.6.0-alpha.
|
|
53
|
+
"@vue/shared": "3.6.0-alpha.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.
|
|
56
|
+
"@babel/types": "^7.28.5"
|
|
57
57
|
}
|
|
58
58
|
}
|