@vue/compiler-core 3.4.27 → 3.4.28
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 +136 -161
- package/dist/compiler-core.cjs.prod.js +136 -161
- package/dist/compiler-core.d.ts +1 -1
- package/dist/compiler-core.esm-bundler.js +119 -143
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.28
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1244,8 +1244,7 @@ function warnDeprecation(key, context, loc, ...args) {
|
|
|
1244
1244
|
Details: ${link}` : ``}`;
|
|
1245
1245
|
const err = new SyntaxError(msg);
|
|
1246
1246
|
err.code = key;
|
|
1247
|
-
if (loc)
|
|
1248
|
-
err.loc = loc;
|
|
1247
|
+
if (loc) err.loc = loc;
|
|
1249
1248
|
context.onWarn(err);
|
|
1250
1249
|
}
|
|
1251
1250
|
|
|
@@ -1481,16 +1480,14 @@ function walkFunctionParams(node, onIdent) {
|
|
|
1481
1480
|
function walkBlockDeclarations(block, onIdent) {
|
|
1482
1481
|
for (const stmt of block.body) {
|
|
1483
1482
|
if (stmt.type === "VariableDeclaration") {
|
|
1484
|
-
if (stmt.declare)
|
|
1485
|
-
continue;
|
|
1483
|
+
if (stmt.declare) continue;
|
|
1486
1484
|
for (const decl of stmt.declarations) {
|
|
1487
1485
|
for (const id of extractIdentifiers(decl.id)) {
|
|
1488
1486
|
onIdent(id);
|
|
1489
1487
|
}
|
|
1490
1488
|
}
|
|
1491
1489
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
1492
|
-
if (stmt.declare || !stmt.id)
|
|
1493
|
-
continue;
|
|
1490
|
+
if (stmt.declare || !stmt.id) continue;
|
|
1494
1491
|
onIdent(stmt.id);
|
|
1495
1492
|
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
1496
1493
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
@@ -1527,8 +1524,7 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
1527
1524
|
break;
|
|
1528
1525
|
case "ArrayPattern":
|
|
1529
1526
|
param.elements.forEach((element) => {
|
|
1530
|
-
if (element)
|
|
1531
|
-
extractIdentifiers(element, nodes);
|
|
1527
|
+
if (element) extractIdentifiers(element, nodes);
|
|
1532
1528
|
});
|
|
1533
1529
|
break;
|
|
1534
1530
|
case "RestElement":
|
|
@@ -1582,7 +1578,7 @@ function isCoreComponent(tag) {
|
|
|
1582
1578
|
return BASE_TRANSITION;
|
|
1583
1579
|
}
|
|
1584
1580
|
}
|
|
1585
|
-
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
1581
|
+
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1586
1582
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1587
1583
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1588
1584
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1693,8 +1689,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
1693
1689
|
for (let i = 0; i < node.props.length; i++) {
|
|
1694
1690
|
const p = node.props[i];
|
|
1695
1691
|
if (p.type === 6) {
|
|
1696
|
-
if (dynamicOnly)
|
|
1697
|
-
continue;
|
|
1692
|
+
if (dynamicOnly) continue;
|
|
1698
1693
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
1699
1694
|
return p;
|
|
1700
1695
|
}
|
|
@@ -1859,7 +1854,7 @@ function getMemoedVNodeCall(node) {
|
|
|
1859
1854
|
return node;
|
|
1860
1855
|
}
|
|
1861
1856
|
}
|
|
1862
|
-
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
1857
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
1863
1858
|
|
|
1864
1859
|
const defaultParserOptions = {
|
|
1865
1860
|
parseMode: "base",
|
|
@@ -2012,8 +2007,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2012
2007
|
}
|
|
2013
2008
|
},
|
|
2014
2009
|
ondirarg(start, end) {
|
|
2015
|
-
if (start === end)
|
|
2016
|
-
return;
|
|
2010
|
+
if (start === end) return;
|
|
2017
2011
|
const arg = getSlice(start, end);
|
|
2018
2012
|
if (inVPre) {
|
|
2019
2013
|
currentProp.name += arg;
|
|
@@ -2045,14 +2039,12 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2045
2039
|
},
|
|
2046
2040
|
onattribdata(start, end) {
|
|
2047
2041
|
currentAttrValue += getSlice(start, end);
|
|
2048
|
-
if (currentAttrStartIndex < 0)
|
|
2049
|
-
currentAttrStartIndex = start;
|
|
2042
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2050
2043
|
currentAttrEndIndex = end;
|
|
2051
2044
|
},
|
|
2052
2045
|
onattribentity(char, start, end) {
|
|
2053
2046
|
currentAttrValue += char;
|
|
2054
|
-
if (currentAttrStartIndex < 0)
|
|
2055
|
-
currentAttrStartIndex = start;
|
|
2047
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2056
2048
|
currentAttrEndIndex = end;
|
|
2057
2049
|
},
|
|
2058
2050
|
onattribnameend(end) {
|
|
@@ -2199,8 +2191,7 @@ function parseForExpression(input) {
|
|
|
2199
2191
|
const loc = input.loc;
|
|
2200
2192
|
const exp = input.content;
|
|
2201
2193
|
const inMatch = exp.match(forAliasRE);
|
|
2202
|
-
if (!inMatch)
|
|
2203
|
-
return;
|
|
2194
|
+
if (!inMatch) return;
|
|
2204
2195
|
const [, LHS, RHS] = inMatch;
|
|
2205
2196
|
const createAliasExpression = (content, offset, asParam = false) => {
|
|
2206
2197
|
const start = loc.start.offset + offset;
|
|
@@ -2393,14 +2384,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2393
2384
|
}
|
|
2394
2385
|
function lookAhead(index, c) {
|
|
2395
2386
|
let i = index;
|
|
2396
|
-
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2397
|
-
i++;
|
|
2387
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
|
|
2398
2388
|
return i;
|
|
2399
2389
|
}
|
|
2400
2390
|
function backTrack(index, c) {
|
|
2401
2391
|
let i = index;
|
|
2402
|
-
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
2403
|
-
i--;
|
|
2392
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
2404
2393
|
return i;
|
|
2405
2394
|
}
|
|
2406
2395
|
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
@@ -2703,7 +2692,7 @@ function getConstantType(node, context) {
|
|
|
2703
2692
|
if (codegenNode.type !== 13) {
|
|
2704
2693
|
return 0;
|
|
2705
2694
|
}
|
|
2706
|
-
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
2695
|
+
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2707
2696
|
return 0;
|
|
2708
2697
|
}
|
|
2709
2698
|
const flag = getPatchFlag(codegenNode);
|
|
@@ -2984,8 +2973,7 @@ function createTransformContext(root, {
|
|
|
2984
2973
|
removeIdentifiers(exp) {
|
|
2985
2974
|
},
|
|
2986
2975
|
hoist(exp) {
|
|
2987
|
-
if (isString(exp))
|
|
2988
|
-
exp = createSimpleExpression(exp);
|
|
2976
|
+
if (isString(exp)) exp = createSimpleExpression(exp);
|
|
2989
2977
|
context.hoists.push(exp);
|
|
2990
2978
|
const identifier = createSimpleExpression(
|
|
2991
2979
|
`_hoisted_${context.hoists.length}`,
|
|
@@ -3068,8 +3056,7 @@ function traverseChildren(parent, context) {
|
|
|
3068
3056
|
};
|
|
3069
3057
|
for (; i < parent.children.length; i++) {
|
|
3070
3058
|
const child = parent.children[i];
|
|
3071
|
-
if (isString(child))
|
|
3072
|
-
continue;
|
|
3059
|
+
if (isString(child)) continue;
|
|
3073
3060
|
context.grandParent = context.parent;
|
|
3074
3061
|
context.parent = parent;
|
|
3075
3062
|
context.childIndex = i;
|
|
@@ -3140,8 +3127,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
3140
3127
|
props.splice(i, 1);
|
|
3141
3128
|
i--;
|
|
3142
3129
|
const onExit = fn(node, prop, context);
|
|
3143
|
-
if (onExit)
|
|
3144
|
-
exitFns.push(onExit);
|
|
3130
|
+
if (onExit) exitFns.push(onExit);
|
|
3145
3131
|
}
|
|
3146
3132
|
}
|
|
3147
3133
|
return exitFns;
|
|
@@ -3213,8 +3199,7 @@ function createCodegenContext(ast, {
|
|
|
3213
3199
|
}
|
|
3214
3200
|
function generate(ast, options = {}) {
|
|
3215
3201
|
const context = createCodegenContext(ast, options);
|
|
3216
|
-
if (options.onContextCreated)
|
|
3217
|
-
options.onContextCreated(context);
|
|
3202
|
+
if (options.onContextCreated) options.onContextCreated(context);
|
|
3218
3203
|
const {
|
|
3219
3204
|
mode,
|
|
3220
3205
|
push,
|
|
@@ -3496,8 +3481,7 @@ function genExpression(node, context) {
|
|
|
3496
3481
|
}
|
|
3497
3482
|
function genInterpolation(node, context) {
|
|
3498
3483
|
const { push, helper, pure } = context;
|
|
3499
|
-
if (pure)
|
|
3500
|
-
push(PURE_ANNOTATION);
|
|
3484
|
+
if (pure) push(PURE_ANNOTATION);
|
|
3501
3485
|
push(`${helper(TO_DISPLAY_STRING)}(`);
|
|
3502
3486
|
genNode(node.content, context);
|
|
3503
3487
|
push(`)`);
|
|
@@ -3577,8 +3561,7 @@ function genVNodeCall(node, context) {
|
|
|
3577
3561
|
function genNullableArgs(args) {
|
|
3578
3562
|
let i = args.length;
|
|
3579
3563
|
while (i--) {
|
|
3580
|
-
if (args[i] != null)
|
|
3581
|
-
break;
|
|
3564
|
+
if (args[i] != null) break;
|
|
3582
3565
|
}
|
|
3583
3566
|
return args.slice(0, i + 1).map((arg) => arg || `null`);
|
|
3584
3567
|
}
|
|
@@ -3888,8 +3871,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3888
3871
|
sibling.branches.push(branch);
|
|
3889
3872
|
const onExit = processCodegen && processCodegen(sibling, branch, false);
|
|
3890
3873
|
traverseNode(branch, context);
|
|
3891
|
-
if (onExit)
|
|
3892
|
-
onExit();
|
|
3874
|
+
if (onExit) onExit();
|
|
3893
3875
|
context.currentNode = null;
|
|
3894
3876
|
} else {
|
|
3895
3877
|
context.onError(
|
|
@@ -4011,6 +3993,80 @@ function getParentCondition(node) {
|
|
|
4011
3993
|
}
|
|
4012
3994
|
}
|
|
4013
3995
|
|
|
3996
|
+
const transformBind = (dir, _node, context) => {
|
|
3997
|
+
const { modifiers, loc } = dir;
|
|
3998
|
+
const arg = dir.arg;
|
|
3999
|
+
let { exp } = dir;
|
|
4000
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4001
|
+
{
|
|
4002
|
+
exp = void 0;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
if (!exp) {
|
|
4006
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
4007
|
+
context.onError(
|
|
4008
|
+
createCompilerError(
|
|
4009
|
+
52,
|
|
4010
|
+
arg.loc
|
|
4011
|
+
)
|
|
4012
|
+
);
|
|
4013
|
+
return {
|
|
4014
|
+
props: [
|
|
4015
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4016
|
+
]
|
|
4017
|
+
};
|
|
4018
|
+
}
|
|
4019
|
+
transformBindShorthand(dir);
|
|
4020
|
+
exp = dir.exp;
|
|
4021
|
+
}
|
|
4022
|
+
if (arg.type !== 4) {
|
|
4023
|
+
arg.children.unshift(`(`);
|
|
4024
|
+
arg.children.push(`) || ""`);
|
|
4025
|
+
} else if (!arg.isStatic) {
|
|
4026
|
+
arg.content = `${arg.content} || ""`;
|
|
4027
|
+
}
|
|
4028
|
+
if (modifiers.includes("camel")) {
|
|
4029
|
+
if (arg.type === 4) {
|
|
4030
|
+
if (arg.isStatic) {
|
|
4031
|
+
arg.content = camelize(arg.content);
|
|
4032
|
+
} else {
|
|
4033
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4034
|
+
}
|
|
4035
|
+
} else {
|
|
4036
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4037
|
+
arg.children.push(`)`);
|
|
4038
|
+
}
|
|
4039
|
+
}
|
|
4040
|
+
if (!context.inSSR) {
|
|
4041
|
+
if (modifiers.includes("prop")) {
|
|
4042
|
+
injectPrefix(arg, ".");
|
|
4043
|
+
}
|
|
4044
|
+
if (modifiers.includes("attr")) {
|
|
4045
|
+
injectPrefix(arg, "^");
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
return {
|
|
4049
|
+
props: [createObjectProperty(arg, exp)]
|
|
4050
|
+
};
|
|
4051
|
+
};
|
|
4052
|
+
const transformBindShorthand = (dir, context) => {
|
|
4053
|
+
const arg = dir.arg;
|
|
4054
|
+
const propName = camelize(arg.content);
|
|
4055
|
+
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4056
|
+
};
|
|
4057
|
+
const injectPrefix = (arg, prefix) => {
|
|
4058
|
+
if (arg.type === 4) {
|
|
4059
|
+
if (arg.isStatic) {
|
|
4060
|
+
arg.content = prefix + arg.content;
|
|
4061
|
+
} else {
|
|
4062
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4063
|
+
}
|
|
4064
|
+
} else {
|
|
4065
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
4066
|
+
arg.children.push(`)`);
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4069
|
+
|
|
4014
4070
|
const transformFor = createStructuralDirectiveTransform(
|
|
4015
4071
|
"for",
|
|
4016
4072
|
(node, dir, context) => {
|
|
@@ -4021,9 +4077,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4021
4077
|
]);
|
|
4022
4078
|
const isTemplate = isTemplateNode(node);
|
|
4023
4079
|
const memo = findDir(node, "memo");
|
|
4024
|
-
const keyProp = findProp(node, `key
|
|
4025
|
-
|
|
4026
|
-
|
|
4080
|
+
const keyProp = findProp(node, `key`, false, true);
|
|
4081
|
+
if (keyProp && keyProp.type === 7 && !keyProp.exp) {
|
|
4082
|
+
transformBindShorthand(keyProp);
|
|
4083
|
+
}
|
|
4084
|
+
const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4085
|
+
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4027
4086
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
4028
4087
|
const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256;
|
|
4029
4088
|
forNode.codegenNode = createVNodeCall(
|
|
@@ -4172,13 +4231,11 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
4172
4231
|
const onExit = processCodegen && processCodegen(forNode);
|
|
4173
4232
|
return () => {
|
|
4174
4233
|
scopes.vFor--;
|
|
4175
|
-
if (onExit)
|
|
4176
|
-
onExit();
|
|
4234
|
+
if (onExit) onExit();
|
|
4177
4235
|
};
|
|
4178
4236
|
}
|
|
4179
4237
|
function finalizeForParseResult(result, context) {
|
|
4180
|
-
if (result.finalized)
|
|
4181
|
-
return;
|
|
4238
|
+
if (result.finalized) return;
|
|
4182
4239
|
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
4183
4240
|
validateBrowserExpression(result.source, context);
|
|
4184
4241
|
if (result.key) {
|
|
@@ -4211,8 +4268,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
|
4211
4268
|
function createParamsList(args) {
|
|
4212
4269
|
let i = args.length;
|
|
4213
4270
|
while (i--) {
|
|
4214
|
-
if (args[i])
|
|
4215
|
-
break;
|
|
4271
|
+
if (args[i]) break;
|
|
4216
4272
|
}
|
|
4217
4273
|
return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
|
|
4218
4274
|
}
|
|
@@ -4474,13 +4530,11 @@ function hasForwardedSlots(children) {
|
|
|
4474
4530
|
}
|
|
4475
4531
|
break;
|
|
4476
4532
|
case 9:
|
|
4477
|
-
if (hasForwardedSlots(child.branches))
|
|
4478
|
-
return true;
|
|
4533
|
+
if (hasForwardedSlots(child.branches)) return true;
|
|
4479
4534
|
break;
|
|
4480
4535
|
case 10:
|
|
4481
4536
|
case 11:
|
|
4482
|
-
if (hasForwardedSlots(child.children))
|
|
4483
|
-
return true;
|
|
4537
|
+
if (hasForwardedSlots(child.children)) return true;
|
|
4484
4538
|
break;
|
|
4485
4539
|
}
|
|
4486
4540
|
}
|
|
@@ -4516,7 +4570,7 @@ const transformElement = (node, context) => {
|
|
|
4516
4570
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
4517
4571
|
// This is technically web-specific, but splitting the logic out of core
|
|
4518
4572
|
// leads to too much unnecessary complexity.
|
|
4519
|
-
(tag === "svg" || tag === "foreignObject")
|
|
4573
|
+
(tag === "svg" || tag === "foreignObject" || tag === "math")
|
|
4520
4574
|
);
|
|
4521
4575
|
if (props.length > 0) {
|
|
4522
4576
|
const propsBuildResult = buildProps(
|
|
@@ -4641,8 +4695,7 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
4641
4695
|
}
|
|
4642
4696
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
4643
4697
|
if (builtIn) {
|
|
4644
|
-
if (!ssr)
|
|
4645
|
-
context.helper(builtIn);
|
|
4698
|
+
if (!ssr) context.helper(builtIn);
|
|
4646
4699
|
return builtIn;
|
|
4647
4700
|
}
|
|
4648
4701
|
context.helper(RESOLVE_COMPONENT);
|
|
@@ -4671,8 +4724,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4671
4724
|
);
|
|
4672
4725
|
properties = [];
|
|
4673
4726
|
}
|
|
4674
|
-
if (arg)
|
|
4675
|
-
mergeArgs.push(arg);
|
|
4727
|
+
if (arg) mergeArgs.push(arg);
|
|
4676
4728
|
};
|
|
4677
4729
|
const pushRefVForMarker = () => {
|
|
4678
4730
|
if (context.scopes.vFor > 0) {
|
|
@@ -5009,8 +5061,7 @@ function buildDirectiveArgs(dir, context) {
|
|
|
5009
5061
|
}
|
|
5010
5062
|
}
|
|
5011
5063
|
const { loc } = dir;
|
|
5012
|
-
if (dir.exp)
|
|
5013
|
-
dirArgs.push(dir.exp);
|
|
5064
|
+
if (dir.exp) dirArgs.push(dir.exp);
|
|
5014
5065
|
if (dir.arg) {
|
|
5015
5066
|
if (!dir.exp) {
|
|
5016
5067
|
dirArgs.push(`void 0`);
|
|
@@ -5040,8 +5091,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
5040
5091
|
let propsNamesString = `[`;
|
|
5041
5092
|
for (let i = 0, l = props.length; i < l; i++) {
|
|
5042
5093
|
propsNamesString += JSON.stringify(props[i]);
|
|
5043
|
-
if (i < l - 1)
|
|
5044
|
-
propsNamesString += ", ";
|
|
5094
|
+
if (i < l - 1) propsNamesString += ", ";
|
|
5045
5095
|
}
|
|
5046
5096
|
return propsNamesString + `]`;
|
|
5047
5097
|
}
|
|
@@ -5216,75 +5266,6 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
5216
5266
|
return ret;
|
|
5217
5267
|
};
|
|
5218
5268
|
|
|
5219
|
-
const transformBind = (dir, _node, context) => {
|
|
5220
|
-
const { modifiers, loc } = dir;
|
|
5221
|
-
const arg = dir.arg;
|
|
5222
|
-
let { exp } = dir;
|
|
5223
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5224
|
-
{
|
|
5225
|
-
exp = void 0;
|
|
5226
|
-
}
|
|
5227
|
-
}
|
|
5228
|
-
if (!exp) {
|
|
5229
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
5230
|
-
context.onError(
|
|
5231
|
-
createCompilerError(
|
|
5232
|
-
52,
|
|
5233
|
-
arg.loc
|
|
5234
|
-
)
|
|
5235
|
-
);
|
|
5236
|
-
return {
|
|
5237
|
-
props: [
|
|
5238
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
5239
|
-
]
|
|
5240
|
-
};
|
|
5241
|
-
}
|
|
5242
|
-
const propName = camelize(arg.content);
|
|
5243
|
-
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5244
|
-
}
|
|
5245
|
-
if (arg.type !== 4) {
|
|
5246
|
-
arg.children.unshift(`(`);
|
|
5247
|
-
arg.children.push(`) || ""`);
|
|
5248
|
-
} else if (!arg.isStatic) {
|
|
5249
|
-
arg.content = `${arg.content} || ""`;
|
|
5250
|
-
}
|
|
5251
|
-
if (modifiers.includes("camel")) {
|
|
5252
|
-
if (arg.type === 4) {
|
|
5253
|
-
if (arg.isStatic) {
|
|
5254
|
-
arg.content = camelize(arg.content);
|
|
5255
|
-
} else {
|
|
5256
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5257
|
-
}
|
|
5258
|
-
} else {
|
|
5259
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5260
|
-
arg.children.push(`)`);
|
|
5261
|
-
}
|
|
5262
|
-
}
|
|
5263
|
-
if (!context.inSSR) {
|
|
5264
|
-
if (modifiers.includes("prop")) {
|
|
5265
|
-
injectPrefix(arg, ".");
|
|
5266
|
-
}
|
|
5267
|
-
if (modifiers.includes("attr")) {
|
|
5268
|
-
injectPrefix(arg, "^");
|
|
5269
|
-
}
|
|
5270
|
-
}
|
|
5271
|
-
return {
|
|
5272
|
-
props: [createObjectProperty(arg, exp)]
|
|
5273
|
-
};
|
|
5274
|
-
};
|
|
5275
|
-
const injectPrefix = (arg, prefix) => {
|
|
5276
|
-
if (arg.type === 4) {
|
|
5277
|
-
if (arg.isStatic) {
|
|
5278
|
-
arg.content = prefix + arg.content;
|
|
5279
|
-
} else {
|
|
5280
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5281
|
-
}
|
|
5282
|
-
} else {
|
|
5283
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
5284
|
-
arg.children.push(`)`);
|
|
5285
|
-
}
|
|
5286
|
-
};
|
|
5287
|
-
|
|
5288
5269
|
const transformText = (node, context) => {
|
|
5289
5270
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5290
5271
|
return () => {
|
|
@@ -5463,8 +5444,7 @@ function rewriteFilter(node, context) {
|
|
|
5463
5444
|
} else {
|
|
5464
5445
|
for (let i = 0; i < node.children.length; i++) {
|
|
5465
5446
|
const child = node.children[i];
|
|
5466
|
-
if (typeof child !== "object")
|
|
5467
|
-
continue;
|
|
5447
|
+
if (typeof child !== "object") continue;
|
|
5468
5448
|
if (child.type === 4) {
|
|
5469
5449
|
parseFilter(child, context);
|
|
5470
5450
|
} else if (child.type === 8) {
|
|
@@ -5490,17 +5470,13 @@ function parseFilter(node, context) {
|
|
|
5490
5470
|
prev = c;
|
|
5491
5471
|
c = exp.charCodeAt(i);
|
|
5492
5472
|
if (inSingle) {
|
|
5493
|
-
if (c === 39 && prev !== 92)
|
|
5494
|
-
inSingle = false;
|
|
5473
|
+
if (c === 39 && prev !== 92) inSingle = false;
|
|
5495
5474
|
} else if (inDouble) {
|
|
5496
|
-
if (c === 34 && prev !== 92)
|
|
5497
|
-
inDouble = false;
|
|
5475
|
+
if (c === 34 && prev !== 92) inDouble = false;
|
|
5498
5476
|
} else if (inTemplateString) {
|
|
5499
|
-
if (c === 96 && prev !== 92)
|
|
5500
|
-
inTemplateString = false;
|
|
5477
|
+
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
5501
5478
|
} else if (inRegex) {
|
|
5502
|
-
if (c === 47 && prev !== 92)
|
|
5503
|
-
inRegex = false;
|
|
5479
|
+
if (c === 47 && prev !== 92) inRegex = false;
|
|
5504
5480
|
} else if (c === 124 && // pipe
|
|
5505
5481
|
exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
|
|
5506
5482
|
if (expression === void 0) {
|
|
@@ -5544,8 +5520,7 @@ function parseFilter(node, context) {
|
|
|
5544
5520
|
let p;
|
|
5545
5521
|
for (; j >= 0; j--) {
|
|
5546
5522
|
p = exp.charAt(j);
|
|
5547
|
-
if (p !== " ")
|
|
5548
|
-
break;
|
|
5523
|
+
if (p !== " ") break;
|
|
5549
5524
|
}
|
|
5550
5525
|
if (!p || !validDivisionCharRE.test(p)) {
|
|
5551
5526
|
inRegex = true;
|
|
@@ -5572,6 +5547,7 @@ function parseFilter(node, context) {
|
|
|
5572
5547
|
expression = wrapFilter(expression, filters[i], context);
|
|
5573
5548
|
}
|
|
5574
5549
|
node.content = expression;
|
|
5550
|
+
node.ast = void 0;
|
|
5575
5551
|
}
|
|
5576
5552
|
}
|
|
5577
5553
|
function wrapFilter(exp, filter, context) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.28",
|
|
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.24.
|
|
49
|
+
"@babel/parser": "^7.24.7",
|
|
50
50
|
"entities": "^4.5.0",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.0",
|
|
53
|
-
"@vue/shared": "3.4.
|
|
53
|
+
"@vue/shared": "3.4.28"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.24.
|
|
56
|
+
"@babel/types": "^7.24.7"
|
|
57
57
|
}
|
|
58
58
|
}
|