@vue/compiler-dom 3.5.21 → 3.5.23
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 +4 -1
- package/dist/compiler-dom.cjs.prod.js +4 -1
- package/dist/compiler-dom.esm-browser.js +100 -81
- package/dist/compiler-dom.esm-browser.prod.js +11 -11
- package/dist/compiler-dom.esm-bundler.js +1 -1
- package/dist/compiler-dom.global.js +101 -80
- package/dist/compiler-dom.global.prod.js +9 -9
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.5.
|
|
2
|
+
* @vue/compiler-dom v3.5.23
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1650,7 +1650,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
function walkBlockDeclarations(block, onIdent) {
|
|
1653
|
-
|
|
1653
|
+
const body = block.type === "SwitchCase" ? block.consequent : block.body;
|
|
1654
|
+
for (const stmt of body) {
|
|
1654
1655
|
if (stmt.type === "VariableDeclaration") {
|
|
1655
1656
|
if (stmt.declare) continue;
|
|
1656
1657
|
for (const decl of stmt.declarations) {
|
|
@@ -1663,6 +1664,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1663
1664
|
onIdent(stmt.id);
|
|
1664
1665
|
} else if (isForStatement(stmt)) {
|
|
1665
1666
|
walkForStatement(stmt, true, onIdent);
|
|
1667
|
+
} else if (stmt.type === "SwitchStatement") {
|
|
1668
|
+
walkSwitchStatement(stmt, true, onIdent);
|
|
1666
1669
|
}
|
|
1667
1670
|
}
|
|
1668
1671
|
}
|
|
@@ -1679,6 +1682,20 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
1679
1682
|
}
|
|
1680
1683
|
}
|
|
1681
1684
|
}
|
|
1685
|
+
function walkSwitchStatement(stmt, isVar, onIdent) {
|
|
1686
|
+
for (const cs of stmt.cases) {
|
|
1687
|
+
for (const stmt2 of cs.consequent) {
|
|
1688
|
+
if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
|
|
1689
|
+
for (const decl of stmt2.declarations) {
|
|
1690
|
+
for (const id of extractIdentifiers(decl.id)) {
|
|
1691
|
+
onIdent(id);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
walkBlockDeclarations(cs, onIdent);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1682
1699
|
function extractIdentifiers(param, nodes = []) {
|
|
1683
1700
|
switch (param.type) {
|
|
1684
1701
|
case "Identifier":
|
|
@@ -4258,80 +4275,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4258
4275
|
}
|
|
4259
4276
|
}
|
|
4260
4277
|
|
|
4261
|
-
const transformBind = (dir, _node, context) => {
|
|
4262
|
-
const { modifiers, loc } = dir;
|
|
4263
|
-
const arg = dir.arg;
|
|
4264
|
-
let { exp } = dir;
|
|
4265
|
-
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
4266
|
-
{
|
|
4267
|
-
exp = void 0;
|
|
4268
|
-
}
|
|
4269
|
-
}
|
|
4270
|
-
if (!exp) {
|
|
4271
|
-
if (arg.type !== 4 || !arg.isStatic) {
|
|
4272
|
-
context.onError(
|
|
4273
|
-
createCompilerError(
|
|
4274
|
-
52,
|
|
4275
|
-
arg.loc
|
|
4276
|
-
)
|
|
4277
|
-
);
|
|
4278
|
-
return {
|
|
4279
|
-
props: [
|
|
4280
|
-
createObjectProperty(arg, createSimpleExpression("", true, loc))
|
|
4281
|
-
]
|
|
4282
|
-
};
|
|
4283
|
-
}
|
|
4284
|
-
transformBindShorthand(dir);
|
|
4285
|
-
exp = dir.exp;
|
|
4286
|
-
}
|
|
4287
|
-
if (arg.type !== 4) {
|
|
4288
|
-
arg.children.unshift(`(`);
|
|
4289
|
-
arg.children.push(`) || ""`);
|
|
4290
|
-
} else if (!arg.isStatic) {
|
|
4291
|
-
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4292
|
-
}
|
|
4293
|
-
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4294
|
-
if (arg.type === 4) {
|
|
4295
|
-
if (arg.isStatic) {
|
|
4296
|
-
arg.content = camelize(arg.content);
|
|
4297
|
-
} else {
|
|
4298
|
-
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
4299
|
-
}
|
|
4300
|
-
} else {
|
|
4301
|
-
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
4302
|
-
arg.children.push(`)`);
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
if (!context.inSSR) {
|
|
4306
|
-
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
4307
|
-
injectPrefix(arg, ".");
|
|
4308
|
-
}
|
|
4309
|
-
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
4310
|
-
injectPrefix(arg, "^");
|
|
4311
|
-
}
|
|
4312
|
-
}
|
|
4313
|
-
return {
|
|
4314
|
-
props: [createObjectProperty(arg, exp)]
|
|
4315
|
-
};
|
|
4316
|
-
};
|
|
4317
|
-
const transformBindShorthand = (dir, context) => {
|
|
4318
|
-
const arg = dir.arg;
|
|
4319
|
-
const propName = camelize(arg.content);
|
|
4320
|
-
dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
4321
|
-
};
|
|
4322
|
-
const injectPrefix = (arg, prefix) => {
|
|
4323
|
-
if (arg.type === 4) {
|
|
4324
|
-
if (arg.isStatic) {
|
|
4325
|
-
arg.content = prefix + arg.content;
|
|
4326
|
-
} else {
|
|
4327
|
-
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
4328
|
-
}
|
|
4329
|
-
} else {
|
|
4330
|
-
arg.children.unshift(`'${prefix}' + (`);
|
|
4331
|
-
arg.children.push(`)`);
|
|
4332
|
-
}
|
|
4333
|
-
};
|
|
4334
|
-
|
|
4335
4278
|
const transformFor = createStructuralDirectiveTransform(
|
|
4336
4279
|
"for",
|
|
4337
4280
|
(node, dir, context) => {
|
|
@@ -4343,10 +4286,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
4343
4286
|
const isTemplate = isTemplateNode(node);
|
|
4344
4287
|
const memo = findDir(node, "memo");
|
|
4345
4288
|
const keyProp = findProp(node, `key`, false, true);
|
|
4346
|
-
|
|
4347
|
-
if (isDirKey && !keyProp.exp) {
|
|
4348
|
-
transformBindShorthand(keyProp);
|
|
4349
|
-
}
|
|
4289
|
+
keyProp && keyProp.type === 7;
|
|
4350
4290
|
let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
|
|
4351
4291
|
const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
|
|
4352
4292
|
const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
|
|
@@ -5518,6 +5458,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5518
5458
|
return ret;
|
|
5519
5459
|
};
|
|
5520
5460
|
|
|
5461
|
+
const transformBind = (dir, _node, context) => {
|
|
5462
|
+
const { modifiers, loc } = dir;
|
|
5463
|
+
const arg = dir.arg;
|
|
5464
|
+
let { exp } = dir;
|
|
5465
|
+
if (exp && exp.type === 4 && !exp.content.trim()) {
|
|
5466
|
+
{
|
|
5467
|
+
exp = void 0;
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
if (arg.type !== 4) {
|
|
5471
|
+
arg.children.unshift(`(`);
|
|
5472
|
+
arg.children.push(`) || ""`);
|
|
5473
|
+
} else if (!arg.isStatic) {
|
|
5474
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
5475
|
+
}
|
|
5476
|
+
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
5477
|
+
if (arg.type === 4) {
|
|
5478
|
+
if (arg.isStatic) {
|
|
5479
|
+
arg.content = camelize(arg.content);
|
|
5480
|
+
} else {
|
|
5481
|
+
arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
|
|
5482
|
+
}
|
|
5483
|
+
} else {
|
|
5484
|
+
arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
|
|
5485
|
+
arg.children.push(`)`);
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
if (!context.inSSR) {
|
|
5489
|
+
if (modifiers.some((mod) => mod.content === "prop")) {
|
|
5490
|
+
injectPrefix(arg, ".");
|
|
5491
|
+
}
|
|
5492
|
+
if (modifiers.some((mod) => mod.content === "attr")) {
|
|
5493
|
+
injectPrefix(arg, "^");
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
return {
|
|
5497
|
+
props: [createObjectProperty(arg, exp)]
|
|
5498
|
+
};
|
|
5499
|
+
};
|
|
5500
|
+
const injectPrefix = (arg, prefix) => {
|
|
5501
|
+
if (arg.type === 4) {
|
|
5502
|
+
if (arg.isStatic) {
|
|
5503
|
+
arg.content = prefix + arg.content;
|
|
5504
|
+
} else {
|
|
5505
|
+
arg.content = `\`${prefix}\${${arg.content}}\``;
|
|
5506
|
+
}
|
|
5507
|
+
} else {
|
|
5508
|
+
arg.children.unshift(`'${prefix}' + (`);
|
|
5509
|
+
arg.children.push(`)`);
|
|
5510
|
+
}
|
|
5511
|
+
};
|
|
5512
|
+
|
|
5521
5513
|
const transformText = (node, context) => {
|
|
5522
5514
|
if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
|
|
5523
5515
|
return () => {
|
|
@@ -5848,9 +5840,36 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
5848
5840
|
}
|
|
5849
5841
|
};
|
|
5850
5842
|
|
|
5843
|
+
const transformVBindShorthand = (node, context) => {
|
|
5844
|
+
if (node.type === 1) {
|
|
5845
|
+
for (const prop of node.props) {
|
|
5846
|
+
if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
|
|
5847
|
+
prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
|
|
5848
|
+
const arg = prop.arg;
|
|
5849
|
+
if (arg.type !== 4 || !arg.isStatic) {
|
|
5850
|
+
context.onError(
|
|
5851
|
+
createCompilerError(
|
|
5852
|
+
52,
|
|
5853
|
+
arg.loc
|
|
5854
|
+
)
|
|
5855
|
+
);
|
|
5856
|
+
prop.exp = createSimpleExpression("", true, arg.loc);
|
|
5857
|
+
} else {
|
|
5858
|
+
const propName = camelize(arg.content);
|
|
5859
|
+
if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
|
|
5860
|
+
propName[0] === "-") {
|
|
5861
|
+
prop.exp = createSimpleExpression(propName, false, arg.loc);
|
|
5862
|
+
}
|
|
5863
|
+
}
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
};
|
|
5868
|
+
|
|
5851
5869
|
function getBaseTransformPreset(prefixIdentifiers) {
|
|
5852
5870
|
return [
|
|
5853
5871
|
[
|
|
5872
|
+
transformVBindShorthand,
|
|
5854
5873
|
transformOnce,
|
|
5855
5874
|
transformIf,
|
|
5856
5875
|
transformMemo,
|
|
@@ -6758,8 +6777,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6758
6777
|
exports.transformModel = transformModel$1;
|
|
6759
6778
|
exports.transformOn = transformOn$1;
|
|
6760
6779
|
exports.transformStyle = transformStyle;
|
|
6780
|
+
exports.transformVBindShorthand = transformVBindShorthand;
|
|
6761
6781
|
exports.traverseNode = traverseNode;
|
|
6762
6782
|
exports.unwrapTSNode = unwrapTSNode;
|
|
6783
|
+
exports.validFirstIdentCharRE = validFirstIdentCharRE;
|
|
6763
6784
|
exports.walkBlockDeclarations = walkBlockDeclarations;
|
|
6764
6785
|
exports.walkFunctionParams = walkFunctionParams;
|
|
6765
6786
|
exports.walkIdentifiers = walkIdentifiers;
|