@vue/compiler-core 3.4.26 → 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 +137 -162
- package/dist/compiler-core.cjs.prod.js +137 -162
- package/dist/compiler-core.d.ts +1 -1
- package/dist/compiler-core.esm-bundler.js +120 -144
- 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
|
**/
|
|
@@ -1313,8 +1313,7 @@ function warnDeprecation(key, context, loc, ...args) {
|
|
|
1313
1313
|
Details: ${link}` : ``}`;
|
|
1314
1314
|
const err = new SyntaxError(msg);
|
|
1315
1315
|
err.code = key;
|
|
1316
|
-
if (loc)
|
|
1317
|
-
err.loc = loc;
|
|
1316
|
+
if (loc) err.loc = loc;
|
|
1318
1317
|
context.onWarn(err);
|
|
1319
1318
|
}
|
|
1320
1319
|
|
|
@@ -1518,7 +1517,8 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
1518
1517
|
if (includeAll || isRefed && !isLocal) {
|
|
1519
1518
|
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
1520
1519
|
}
|
|
1521
|
-
} else if (node.type === "ObjectProperty" &&
|
|
1520
|
+
} else if (node.type === "ObjectProperty" && // eslint-disable-next-line no-restricted-syntax
|
|
1521
|
+
(parent == null ? void 0 : parent.type) === "ObjectPattern") {
|
|
1522
1522
|
node.inPattern = true;
|
|
1523
1523
|
} else if (isFunctionType(node)) {
|
|
1524
1524
|
if (node.scopeIds) {
|
|
@@ -1609,16 +1609,14 @@ function walkFunctionParams(node, onIdent) {
|
|
|
1609
1609
|
function walkBlockDeclarations(block, onIdent) {
|
|
1610
1610
|
for (const stmt of block.body) {
|
|
1611
1611
|
if (stmt.type === "VariableDeclaration") {
|
|
1612
|
-
if (stmt.declare)
|
|
1613
|
-
continue;
|
|
1612
|
+
if (stmt.declare) continue;
|
|
1614
1613
|
for (const decl of stmt.declarations) {
|
|
1615
1614
|
for (const id of extractIdentifiers(decl.id)) {
|
|
1616
1615
|
onIdent(id);
|
|
1617
1616
|
}
|
|
1618
1617
|
}
|
|
1619
1618
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
|
1620
|
-
if (stmt.declare || !stmt.id)
|
|
1621
|
-
continue;
|
|
1619
|
+
if (stmt.declare || !stmt.id) continue;
|
|
1622
1620
|
onIdent(stmt.id);
|
|
1623
1621
|
} else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
|
|
1624
1622
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
@@ -1655,8 +1653,7 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
1655
1653
|
break;
|
|
1656
1654
|
case "ArrayPattern":
|
|
1657
1655
|
param.elements.forEach((element) => {
|
|
1658
|
-
if (element)
|
|
1659
|
-
extractIdentifiers(element, nodes);
|
|
1656
|
+
if (element) extractIdentifiers(element, nodes);
|
|
1660
1657
|
});
|
|
1661
1658
|
break;
|
|
1662
1659
|
case "RestElement":
|
|
@@ -1809,7 +1806,7 @@ function isCoreComponent(tag) {
|
|
|
1809
1806
|
return BASE_TRANSITION;
|
|
1810
1807
|
}
|
|
1811
1808
|
}
|
|
1812
|
-
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
1809
|
+
const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1813
1810
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1814
1811
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1815
1812
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1930,8 +1927,7 @@ function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
|
1930
1927
|
for (let i = 0; i < node.props.length; i++) {
|
|
1931
1928
|
const p = node.props[i];
|
|
1932
1929
|
if (p.type === 6) {
|
|
1933
|
-
if (dynamicOnly)
|
|
1934
|
-
continue;
|
|
1930
|
+
if (dynamicOnly) continue;
|
|
1935
1931
|
if (p.name === name && (p.value || allowEmpty)) {
|
|
1936
1932
|
return p;
|
|
1937
1933
|
}
|
|
@@ -2095,7 +2091,7 @@ function getMemoedVNodeCall(node) {
|
|
|
2095
2091
|
return node;
|
|
2096
2092
|
}
|
|
2097
2093
|
}
|
|
2098
|
-
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
2094
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
2099
2095
|
|
|
2100
2096
|
const defaultParserOptions = {
|
|
2101
2097
|
parseMode: "base",
|
|
@@ -2248,8 +2244,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2248
2244
|
}
|
|
2249
2245
|
},
|
|
2250
2246
|
ondirarg(start, end) {
|
|
2251
|
-
if (start === end)
|
|
2252
|
-
return;
|
|
2247
|
+
if (start === end) return;
|
|
2253
2248
|
const arg = getSlice(start, end);
|
|
2254
2249
|
if (inVPre) {
|
|
2255
2250
|
currentProp.name += arg;
|
|
@@ -2281,14 +2276,12 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2281
2276
|
},
|
|
2282
2277
|
onattribdata(start, end) {
|
|
2283
2278
|
currentAttrValue += getSlice(start, end);
|
|
2284
|
-
if (currentAttrStartIndex < 0)
|
|
2285
|
-
currentAttrStartIndex = start;
|
|
2279
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2286
2280
|
currentAttrEndIndex = end;
|
|
2287
2281
|
},
|
|
2288
2282
|
onattribentity(char, start, end) {
|
|
2289
2283
|
currentAttrValue += char;
|
|
2290
|
-
if (currentAttrStartIndex < 0)
|
|
2291
|
-
currentAttrStartIndex = start;
|
|
2284
|
+
if (currentAttrStartIndex < 0) currentAttrStartIndex = start;
|
|
2292
2285
|
currentAttrEndIndex = end;
|
|
2293
2286
|
},
|
|
2294
2287
|
onattribnameend(end) {
|
|
@@ -2438,8 +2431,7 @@ function parseForExpression(input) {
|
|
|
2438
2431
|
const loc = input.loc;
|
|
2439
2432
|
const exp = input.content;
|
|
2440
2433
|
const inMatch = exp.match(forAliasRE);
|
|
2441
|
-
if (!inMatch)
|
|
2442
|
-
return;
|
|
2434
|
+
if (!inMatch) return;
|
|
2443
2435
|
const [, LHS, RHS] = inMatch;
|
|
2444
2436
|
const createAliasExpression = (content, offset, asParam = false) => {
|
|
2445
2437
|
const start = loc.start.offset + offset;
|
|
@@ -2626,14 +2618,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2626
2618
|
}
|
|
2627
2619
|
function lookAhead(index, c) {
|
|
2628
2620
|
let i = index;
|
|
2629
|
-
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2630
|
-
i++;
|
|
2621
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1) i++;
|
|
2631
2622
|
return i;
|
|
2632
2623
|
}
|
|
2633
2624
|
function backTrack(index, c) {
|
|
2634
2625
|
let i = index;
|
|
2635
|
-
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
2636
|
-
i--;
|
|
2626
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0) i--;
|
|
2637
2627
|
return i;
|
|
2638
2628
|
}
|
|
2639
2629
|
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
@@ -2958,7 +2948,7 @@ function getConstantType(node, context) {
|
|
|
2958
2948
|
if (codegenNode.type !== 13) {
|
|
2959
2949
|
return 0;
|
|
2960
2950
|
}
|
|
2961
|
-
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject") {
|
|
2951
|
+
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2962
2952
|
return 0;
|
|
2963
2953
|
}
|
|
2964
2954
|
const flag = getPatchFlag(codegenNode);
|
|
@@ -3256,8 +3246,7 @@ function createTransformContext(root, {
|
|
|
3256
3246
|
}
|
|
3257
3247
|
},
|
|
3258
3248
|
hoist(exp) {
|
|
3259
|
-
if (shared.isString(exp))
|
|
3260
|
-
exp = createSimpleExpression(exp);
|
|
3249
|
+
if (shared.isString(exp)) exp = createSimpleExpression(exp);
|
|
3261
3250
|
context.hoists.push(exp);
|
|
3262
3251
|
const identifier = createSimpleExpression(
|
|
3263
3252
|
`_hoisted_${context.hoists.length}`,
|
|
@@ -3350,8 +3339,7 @@ function traverseChildren(parent, context) {
|
|
|
3350
3339
|
};
|
|
3351
3340
|
for (; i < parent.children.length; i++) {
|
|
3352
3341
|
const child = parent.children[i];
|
|
3353
|
-
if (shared.isString(child))
|
|
3354
|
-
continue;
|
|
3342
|
+
if (shared.isString(child)) continue;
|
|
3355
3343
|
context.grandParent = context.parent;
|
|
3356
3344
|
context.parent = parent;
|
|
3357
3345
|
context.childIndex = i;
|
|
@@ -3422,8 +3410,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
3422
3410
|
props.splice(i, 1);
|
|
3423
3411
|
i--;
|
|
3424
3412
|
const onExit = fn(node, prop, context);
|
|
3425
|
-
if (onExit)
|
|
3426
|
-
exitFns.push(onExit);
|
|
3413
|
+
if (onExit) exitFns.push(onExit);
|
|
3427
3414
|
}
|
|
3428
3415
|
}
|
|
3429
3416
|
return exitFns;
|
|
@@ -3522,8 +3509,7 @@ function createCodegenContext(ast, {
|
|
|
3522
3509
|
}
|
|
3523
3510
|
function addMapping(loc, name = null) {
|
|
3524
3511
|
const { _names, _mappings } = context.map;
|
|
3525
|
-
if (name !== null && !_names.has(name))
|
|
3526
|
-
_names.add(name);
|
|
3512
|
+
if (name !== null && !_names.has(name)) _names.add(name);
|
|
3527
3513
|
_mappings.add({
|
|
3528
3514
|
originalLine: loc.line,
|
|
3529
3515
|
originalColumn: loc.column - 1,
|
|
@@ -3543,8 +3529,7 @@ function createCodegenContext(ast, {
|
|
|
3543
3529
|
}
|
|
3544
3530
|
function generate(ast, options = {}) {
|
|
3545
3531
|
const context = createCodegenContext(ast, options);
|
|
3546
|
-
if (options.onContextCreated)
|
|
3547
|
-
options.onContextCreated(context);
|
|
3532
|
+
if (options.onContextCreated) options.onContextCreated(context);
|
|
3548
3533
|
const {
|
|
3549
3534
|
mode,
|
|
3550
3535
|
push,
|
|
@@ -3764,8 +3749,9 @@ function genHoists(hoists, context) {
|
|
|
3764
3749
|
const genScopeId = scopeId != null && mode !== "function";
|
|
3765
3750
|
newline();
|
|
3766
3751
|
if (genScopeId) {
|
|
3752
|
+
const param = context.isTS ? "(n: any)" : "n";
|
|
3767
3753
|
push(
|
|
3768
|
-
`const _withScopeId =
|
|
3754
|
+
`const _withScopeId = ${param} => (${helper(
|
|
3769
3755
|
PUSH_SCOPE_ID
|
|
3770
3756
|
)}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`
|
|
3771
3757
|
);
|
|
@@ -3929,8 +3915,7 @@ function genExpression(node, context) {
|
|
|
3929
3915
|
}
|
|
3930
3916
|
function genInterpolation(node, context) {
|
|
3931
3917
|
const { push, helper, pure } = context;
|
|
3932
|
-
if (pure)
|
|
3933
|
-
push(PURE_ANNOTATION);
|
|
3918
|
+
if (pure) push(PURE_ANNOTATION);
|
|
3934
3919
|
push(`${helper(TO_DISPLAY_STRING)}(`);
|
|
3935
3920
|
genNode(node.content, context);
|
|
3936
3921
|
push(`)`);
|
|
@@ -4010,8 +3995,7 @@ function genVNodeCall(node, context) {
|
|
|
4010
3995
|
function genNullableArgs(args) {
|
|
4011
3996
|
let i = args.length;
|
|
4012
3997
|
while (i--) {
|
|
4013
|
-
if (args[i] != null)
|
|
4014
|
-
break;
|
|
3998
|
+
if (args[i] != null) break;
|
|
4015
3999
|
}
|
|
4016
4000
|
return args.slice(0, i + 1).map((arg) => arg || `null`);
|
|
4017
4001
|
}
|
|
@@ -4157,11 +4141,9 @@ function genTemplateLiteral(node, context) {
|
|
|
4157
4141
|
push(e.replace(/(`|\$|\\)/g, "\\$1"), -3 /* Unknown */);
|
|
4158
4142
|
} else {
|
|
4159
4143
|
push("${");
|
|
4160
|
-
if (multilines)
|
|
4161
|
-
indent();
|
|
4144
|
+
if (multilines) indent();
|
|
4162
4145
|
genNode(e, context);
|
|
4163
|
-
if (multilines)
|
|
4164
|
-
deindent();
|
|
4146
|
+
if (multilines) deindent();
|
|
4165
4147
|
push("}");
|
|
4166
4148
|
}
|
|
4167
4149
|
}
|
|
@@ -4535,8 +4517,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
4535
4517
|
sibling.branches.push(branch);
|
|
4536
4518
|
const onExit = processCodegen && processCodegen(sibling, branch, false);
|
|
4537
4519
|
traverseNode(branch, context);
|
|
4538
|
-
if (onExit)
|
|
4539
|
-
onExit();
|
|
4520
|
+
if (onExit) onExit();
|
|
4540
4521
|
context.currentNode = null;
|
|
4541
4522
|
} else {
|
|
4542
4523
|
context.onError(
|
|
@@ -4658,6 +4639,90 @@ function getParentCondition(node) {
|
|
|
4658
4639
|
}
|
|
4659
4640
|
}
|
|
4660
4641
|
|
|
4642
|
+
const transformBind = (dir, _node, context) => {
|
|
4643
|
+
const { modifiers, loc } = dir;
|
|
4644
|
+
const arg = dir.arg;
|
|
4645
|
+
let { exp } = dir;
|
|
4646
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4647
|
+
{
|
|
4648
|
+
context.onError(
|
|
4649
|
+
createCompilerError(34, loc)
|
|
4650
|
+
);
|
|
4651
|
+
return {
|
|
4652
|
+
props: [
|
|
4653
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4654
|
+
]
|
|
4655
|
+
};
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
if (!exp) {
|
|
4659
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
4660
|
+
context.onError(
|
|
4661
|
+
createCompilerError(
|
|
4662
|
+
52,
|
|
4663
|
+
arg.loc
|
|
4664
|
+
)
|
|
4665
|
+
);
|
|
4666
|
+
return {
|
|
4667
|
+
props: [
|
|
4668
|
+
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4669
|
+
]
|
|
4670
|
+
};
|
|
4671
|
+
}
|
|
4672
|
+
transformBindShorthand(dir, context);
|
|
4673
|
+
exp = dir.exp;
|
|
4674
|
+
}
|
|
4675
|
+
if (arg.type !== 4) {
|
|
4676
|
+
arg.children.unshift(`(`);
|
|
4677
|
+
arg.children.push(`) || ""`);
|
|
4678
|
+
} else if (!arg.isStatic) {
|
|
4679
|
+
arg.content = `${arg.content} || ""`;
|
|
4680
|
+
}
|
|
4681
|
+
if (modifiers.includes("camel")) {
|
|
4682
|
+
if (arg.type === 4) {
|
|
4683
|
+
if (arg.isStatic) {
|
|
4684
|
+
arg.content = shared.camelize(arg.content);
|
|
4685
|
+
} else {
|
|
4686
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4687
|
+
}
|
|
4688
|
+
} else {
|
|
4689
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4690
|
+
arg.children.push(`)`);
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
if (!context.inSSR) {
|
|
4694
|
+
if (modifiers.includes("prop")) {
|
|
4695
|
+
injectPrefix(arg, ".");
|
|
4696
|
+
}
|
|
4697
|
+
if (modifiers.includes("attr")) {
|
|
4698
|
+
injectPrefix(arg, "^");
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
return {
|
|
4702
|
+
props: [createObjectProperty(arg, exp)]
|
|
4703
|
+
};
|
|
4704
|
+
};
|
|
4705
|
+
const transformBindShorthand = (dir, context) => {
|
|
4706
|
+
const arg = dir.arg;
|
|
4707
|
+
const propName = shared.camelize(arg.content);
|
|
4708
|
+
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4709
|
+
{
|
|
4710
|
+
dir.exp = processExpression(dir.exp, context);
|
|
4711
|
+
}
|
|
4712
|
+
};
|
|
4713
|
+
const injectPrefix = (arg, prefix) => {
|
|
4714
|
+
if (arg.type === 4) {
|
|
4715
|
+
if (arg.isStatic) {
|
|
4716
|
+
arg.content = prefix + arg.content;
|
|
4717
|
+
} else {
|
|
4718
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4719
|
+
}
|
|
4720
|
+
} else {
|
|
4721
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
4722
|
+
arg.children.push(`)`);
|
|
4723
|
+
}
|
|
4724
|
+
};
|
|
4725
|
+
|
|
4661
4726
|
const transformFor = createStructuralDirectiveTransform(
|
|
4662
4727
|
"for",
|
|
4663
4728
|
(node, dir, context) => {
|
|
@@ -4668,9 +4733,12 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4668
4733
|
]);
|
|
4669
4734
|
const isTemplate = isTemplateNode(node);
|
|
4670
4735
|
const memo = findDir(node, "memo");
|
|
4671
|
-
const keyProp = findProp(node, `key
|
|
4672
|
-
|
|
4673
|
-
|
|
4736
|
+
const keyProp = findProp(node, `key`, false, true);
|
|
4737
|
+
if (keyProp && keyProp.type === 7 && !keyProp.exp) {
|
|
4738
|
+
transformBindShorthand(keyProp, context);
|
|
4739
|
+
}
|
|
4740
|
+
const keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4741
|
+
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4674
4742
|
if (isTemplate) {
|
|
4675
4743
|
if (memo) {
|
|
4676
4744
|
memo.exp = processExpression(
|
|
@@ -4843,13 +4911,11 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
4843
4911
|
key && removeIdentifiers(key);
|
|
4844
4912
|
index && removeIdentifiers(index);
|
|
4845
4913
|
}
|
|
4846
|
-
if (onExit)
|
|
4847
|
-
onExit();
|
|
4914
|
+
if (onExit) onExit();
|
|
4848
4915
|
};
|
|
4849
4916
|
}
|
|
4850
4917
|
function finalizeForParseResult(result, context) {
|
|
4851
|
-
if (result.finalized)
|
|
4852
|
-
return;
|
|
4918
|
+
if (result.finalized) return;
|
|
4853
4919
|
if (context.prefixIdentifiers) {
|
|
4854
4920
|
result.source = processExpression(
|
|
4855
4921
|
result.source,
|
|
@@ -4885,8 +4951,7 @@ function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
|
4885
4951
|
function createParamsList(args) {
|
|
4886
4952
|
let i = args.length;
|
|
4887
4953
|
while (i--) {
|
|
4888
|
-
if (args[i])
|
|
4889
|
-
break;
|
|
4954
|
+
if (args[i]) break;
|
|
4890
4955
|
}
|
|
4891
4956
|
return args.slice(0, i + 1).map((arg, i2) => arg || createSimpleExpression(`_`.repeat(i2 + 1), false));
|
|
4892
4957
|
}
|
|
@@ -5157,13 +5222,11 @@ function hasForwardedSlots(children) {
|
|
|
5157
5222
|
}
|
|
5158
5223
|
break;
|
|
5159
5224
|
case 9:
|
|
5160
|
-
if (hasForwardedSlots(child.branches))
|
|
5161
|
-
return true;
|
|
5225
|
+
if (hasForwardedSlots(child.branches)) return true;
|
|
5162
5226
|
break;
|
|
5163
5227
|
case 10:
|
|
5164
5228
|
case 11:
|
|
5165
|
-
if (hasForwardedSlots(child.children))
|
|
5166
|
-
return true;
|
|
5229
|
+
if (hasForwardedSlots(child.children)) return true;
|
|
5167
5230
|
break;
|
|
5168
5231
|
}
|
|
5169
5232
|
}
|
|
@@ -5199,7 +5262,7 @@ const transformElement = (node, context) => {
|
|
|
5199
5262
|
// updates inside get proper isSVG flag at runtime. (#639, #643)
|
|
5200
5263
|
// This is technically web-specific, but splitting the logic out of core
|
|
5201
5264
|
// leads to too much unnecessary complexity.
|
|
5202
|
-
(tag === "svg" || tag === "foreignObject")
|
|
5265
|
+
(tag === "svg" || tag === "foreignObject" || tag === "math")
|
|
5203
5266
|
);
|
|
5204
5267
|
if (props.length > 0) {
|
|
5205
5268
|
const propsBuildResult = buildProps(
|
|
@@ -5325,8 +5388,7 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
5325
5388
|
}
|
|
5326
5389
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
5327
5390
|
if (builtIn) {
|
|
5328
|
-
if (!ssr)
|
|
5329
|
-
context.helper(builtIn);
|
|
5391
|
+
if (!ssr) context.helper(builtIn);
|
|
5330
5392
|
return builtIn;
|
|
5331
5393
|
}
|
|
5332
5394
|
{
|
|
@@ -5410,8 +5472,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
5410
5472
|
);
|
|
5411
5473
|
properties = [];
|
|
5412
5474
|
}
|
|
5413
|
-
if (arg)
|
|
5414
|
-
mergeArgs.push(arg);
|
|
5475
|
+
if (arg) mergeArgs.push(arg);
|
|
5415
5476
|
};
|
|
5416
5477
|
const pushRefVForMarker = () => {
|
|
5417
5478
|
if (context.scopes.vFor > 0) {
|
|
@@ -5763,8 +5824,7 @@ function buildDirectiveArgs(dir, context) {
|
|
|
5763
5824
|
}
|
|
5764
5825
|
}
|
|
5765
5826
|
const { loc } = dir;
|
|
5766
|
-
if (dir.exp)
|
|
5767
|
-
dirArgs.push(dir.exp);
|
|
5827
|
+
if (dir.exp) dirArgs.push(dir.exp);
|
|
5768
5828
|
if (dir.arg) {
|
|
5769
5829
|
if (!dir.exp) {
|
|
5770
5830
|
dirArgs.push(`void 0`);
|
|
@@ -5794,8 +5854,7 @@ function stringifyDynamicPropNames(props) {
|
|
|
5794
5854
|
let propsNamesString = `[`;
|
|
5795
5855
|
for (let i = 0, l = props.length; i < l; i++) {
|
|
5796
5856
|
propsNamesString += JSON.stringify(props[i]);
|
|
5797
|
-
if (i < l - 1)
|
|
5798
|
-
propsNamesString += ", ";
|
|
5857
|
+
if (i < l - 1) propsNamesString += ", ";
|
|
5799
5858
|
}
|
|
5800
5859
|
return propsNamesString + `]`;
|
|
5801
5860
|
}
|
|
@@ -5892,7 +5951,7 @@ function processSlotOutlet(node, context) {
|
|
|
5892
5951
|
};
|
|
5893
5952
|
}
|
|
5894
5953
|
|
|
5895
|
-
const fnExpRE = /^\s*(
|
|
5954
|
+
const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
5896
5955
|
const transformOn = (dir, node, context, augmentor) => {
|
|
5897
5956
|
const { loc, modifiers, arg } = dir;
|
|
5898
5957
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -5995,85 +6054,6 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
5995
6054
|
return ret;
|
|
5996
6055
|
};
|
|
5997
6056
|
|
|
5998
|
-
const transformBind = (dir, _node, context) => {
|
|
5999
|
-
const { modifiers, loc } = dir;
|
|
6000
|
-
const arg = dir.arg;
|
|
6001
|
-
let { exp } = dir;
|
|
6002
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
6003
|
-
{
|
|
6004
|
-
context.onError(
|
|
6005
|
-
createCompilerError(34, loc)
|
|
6006
|
-
);
|
|
6007
|
-
return {
|
|
6008
|
-
props: [
|
|
6009
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
6010
|
-
]
|
|
6011
|
-
};
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
if (!exp) {
|
|
6015
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
6016
|
-
context.onError(
|
|
6017
|
-
createCompilerError(
|
|
6018
|
-
52,
|
|
6019
|
-
arg.loc
|
|
6020
|
-
)
|
|
6021
|
-
);
|
|
6022
|
-
return {
|
|
6023
|
-
props: [
|
|
6024
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
6025
|
-
]
|
|
6026
|
-
};
|
|
6027
|
-
}
|
|
6028
|
-
const propName = shared.camelize(arg.content);
|
|
6029
|
-
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
6030
|
-
{
|
|
6031
|
-
exp = dir.exp = processExpression(exp, context);
|
|
6032
|
-
}
|
|
6033
|
-
}
|
|
6034
|
-
if (arg.type !== 4) {
|
|
6035
|
-
arg.children.unshift(`(`);
|
|
6036
|
-
arg.children.push(`) || ""`);
|
|
6037
|
-
} else if (!arg.isStatic) {
|
|
6038
|
-
arg.content = `${arg.content} || ""`;
|
|
6039
|
-
}
|
|
6040
|
-
if (modifiers.includes("camel")) {
|
|
6041
|
-
if (arg.type === 4) {
|
|
6042
|
-
if (arg.isStatic) {
|
|
6043
|
-
arg.content = shared.camelize(arg.content);
|
|
6044
|
-
} else {
|
|
6045
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
6046
|
-
}
|
|
6047
|
-
} else {
|
|
6048
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
6049
|
-
arg.children.push(`)`);
|
|
6050
|
-
}
|
|
6051
|
-
}
|
|
6052
|
-
if (!context.inSSR) {
|
|
6053
|
-
if (modifiers.includes("prop")) {
|
|
6054
|
-
injectPrefix(arg, ".");
|
|
6055
|
-
}
|
|
6056
|
-
if (modifiers.includes("attr")) {
|
|
6057
|
-
injectPrefix(arg, "^");
|
|
6058
|
-
}
|
|
6059
|
-
}
|
|
6060
|
-
return {
|
|
6061
|
-
props: [createObjectProperty(arg, exp)]
|
|
6062
|
-
};
|
|
6063
|
-
};
|
|
6064
|
-
const injectPrefix = (arg, prefix) => {
|
|
6065
|
-
if (arg.type === 4) {
|
|
6066
|
-
if (arg.isStatic) {
|
|
6067
|
-
arg.content = prefix + arg.content;
|
|
6068
|
-
} else {
|
|
6069
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
6070
|
-
}
|
|
6071
|
-
} else {
|
|
6072
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
6073
|
-
arg.children.push(`)`);
|
|
6074
|
-
}
|
|
6075
|
-
};
|
|
6076
|
-
|
|
6077
6057
|
const transformText = (node, context) => {
|
|
6078
6058
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
6079
6059
|
return () => {
|
|
@@ -6276,8 +6256,7 @@ function rewriteFilter(node, context) {
|
|
|
6276
6256
|
} else {
|
|
6277
6257
|
for (let i = 0; i < node.children.length; i++) {
|
|
6278
6258
|
const child = node.children[i];
|
|
6279
|
-
if (typeof child !== "object")
|
|
6280
|
-
continue;
|
|
6259
|
+
if (typeof child !== "object") continue;
|
|
6281
6260
|
if (child.type === 4) {
|
|
6282
6261
|
parseFilter(child, context);
|
|
6283
6262
|
} else if (child.type === 8) {
|
|
@@ -6303,17 +6282,13 @@ function parseFilter(node, context) {
|
|
|
6303
6282
|
prev = c;
|
|
6304
6283
|
c = exp.charCodeAt(i);
|
|
6305
6284
|
if (inSingle) {
|
|
6306
|
-
if (c === 39 && prev !== 92)
|
|
6307
|
-
inSingle = false;
|
|
6285
|
+
if (c === 39 && prev !== 92) inSingle = false;
|
|
6308
6286
|
} else if (inDouble) {
|
|
6309
|
-
if (c === 34 && prev !== 92)
|
|
6310
|
-
inDouble = false;
|
|
6287
|
+
if (c === 34 && prev !== 92) inDouble = false;
|
|
6311
6288
|
} else if (inTemplateString) {
|
|
6312
|
-
if (c === 96 && prev !== 92)
|
|
6313
|
-
inTemplateString = false;
|
|
6289
|
+
if (c === 96 && prev !== 92) inTemplateString = false;
|
|
6314
6290
|
} else if (inRegex) {
|
|
6315
|
-
if (c === 47 && prev !== 92)
|
|
6316
|
-
inRegex = false;
|
|
6291
|
+
if (c === 47 && prev !== 92) inRegex = false;
|
|
6317
6292
|
} else if (c === 124 && // pipe
|
|
6318
6293
|
exp.charCodeAt(i + 1) !== 124 && exp.charCodeAt(i - 1) !== 124 && !curly && !square && !paren) {
|
|
6319
6294
|
if (expression === void 0) {
|
|
@@ -6357,8 +6332,7 @@ function parseFilter(node, context) {
|
|
|
6357
6332
|
let p;
|
|
6358
6333
|
for (; j >= 0; j--) {
|
|
6359
6334
|
p = exp.charAt(j);
|
|
6360
|
-
if (p !== " ")
|
|
6361
|
-
break;
|
|
6335
|
+
if (p !== " ") break;
|
|
6362
6336
|
}
|
|
6363
6337
|
if (!p || !validDivisionCharRE.test(p)) {
|
|
6364
6338
|
inRegex = true;
|
|
@@ -6385,6 +6359,7 @@ function parseFilter(node, context) {
|
|
|
6385
6359
|
expression = wrapFilter(expression, filters[i], context);
|
|
6386
6360
|
}
|
|
6387
6361
|
node.content = expression;
|
|
6362
|
+
node.ast = void 0;
|
|
6388
6363
|
}
|
|
6389
6364
|
}
|
|
6390
6365
|
function wrapFilter(exp, filter, context) {
|