@vue/compiler-core 3.4.30 → 3.4.32
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.32
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -305,12 +305,12 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
305
305
|
loc: locStub
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
function createCacheExpression(index, value,
|
|
308
|
+
function createCacheExpression(index, value, isVOnce = false) {
|
|
309
309
|
return {
|
|
310
310
|
type: 20,
|
|
311
311
|
index,
|
|
312
312
|
value,
|
|
313
|
-
|
|
313
|
+
isVOnce,
|
|
314
314
|
loc: locStub
|
|
315
315
|
};
|
|
316
316
|
}
|
|
@@ -2878,7 +2878,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2878
2878
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2879
2879
|
if (constantType > 0) {
|
|
2880
2880
|
if (constantType >= 2) {
|
|
2881
|
-
child.codegenNode.patchFlag = -1
|
|
2881
|
+
child.codegenNode.patchFlag = -1;
|
|
2882
2882
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
2883
2883
|
hoistedCount++;
|
|
2884
2884
|
continue;
|
|
@@ -2886,8 +2886,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2886
2886
|
} else {
|
|
2887
2887
|
const codegenNode = child.codegenNode;
|
|
2888
2888
|
if (codegenNode.type === 13) {
|
|
2889
|
-
const flag =
|
|
2890
|
-
if ((
|
|
2889
|
+
const flag = codegenNode.patchFlag;
|
|
2890
|
+
if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
2891
2891
|
const props = getNodeProps(child);
|
|
2892
2892
|
if (props) {
|
|
2893
2893
|
codegenNode.props = context.hoist(props);
|
|
@@ -2951,8 +2951,7 @@ function getConstantType(node, context) {
|
|
|
2951
2951
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2952
2952
|
return 0;
|
|
2953
2953
|
}
|
|
2954
|
-
|
|
2955
|
-
if (!flag) {
|
|
2954
|
+
if (codegenNode.patchFlag === void 0) {
|
|
2956
2955
|
let returnType2 = 3;
|
|
2957
2956
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
2958
2957
|
if (generatedPropsType === 0) {
|
|
@@ -3094,10 +3093,6 @@ function getNodeProps(node) {
|
|
|
3094
3093
|
return codegenNode.props;
|
|
3095
3094
|
}
|
|
3096
3095
|
}
|
|
3097
|
-
function getPatchFlag(node) {
|
|
3098
|
-
const flag = node.patchFlag;
|
|
3099
|
-
return flag ? parseInt(flag, 10) : void 0;
|
|
3100
|
-
}
|
|
3101
3096
|
|
|
3102
3097
|
function createTransformContext(root, {
|
|
3103
3098
|
filename = "",
|
|
@@ -3323,7 +3318,7 @@ function createRootCodegen(root, context) {
|
|
|
3323
3318
|
helper(FRAGMENT),
|
|
3324
3319
|
void 0,
|
|
3325
3320
|
root.children,
|
|
3326
|
-
patchFlag
|
|
3321
|
+
patchFlag,
|
|
3327
3322
|
void 0,
|
|
3328
3323
|
void 0,
|
|
3329
3324
|
true,
|
|
@@ -3967,6 +3962,17 @@ function genVNodeCall(node, context) {
|
|
|
3967
3962
|
disableTracking,
|
|
3968
3963
|
isComponent
|
|
3969
3964
|
} = node;
|
|
3965
|
+
let patchFlagString;
|
|
3966
|
+
if (patchFlag) {
|
|
3967
|
+
{
|
|
3968
|
+
if (patchFlag < 0) {
|
|
3969
|
+
patchFlagString = patchFlag + ` /* ${shared.PatchFlagNames[patchFlag]} */`;
|
|
3970
|
+
} else {
|
|
3971
|
+
const flagNames = Object.keys(shared.PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => shared.PatchFlagNames[n]).join(`, `);
|
|
3972
|
+
patchFlagString = patchFlag + ` /* ${flagNames} */`;
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3970
3976
|
if (directives) {
|
|
3971
3977
|
push(helper(WITH_DIRECTIVES) + `(`);
|
|
3972
3978
|
}
|
|
@@ -3979,7 +3985,7 @@ function genVNodeCall(node, context) {
|
|
|
3979
3985
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
3980
3986
|
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
3981
3987
|
genNodeList(
|
|
3982
|
-
genNullableArgs([tag, props, children,
|
|
3988
|
+
genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
|
|
3983
3989
|
context
|
|
3984
3990
|
);
|
|
3985
3991
|
push(`)`);
|
|
@@ -4113,15 +4119,16 @@ function genConditionalExpression(node, context) {
|
|
|
4113
4119
|
function genCacheExpression(node, context) {
|
|
4114
4120
|
const { push, helper, indent, deindent, newline } = context;
|
|
4115
4121
|
push(`_cache[${node.index}] || (`);
|
|
4116
|
-
if (node.
|
|
4122
|
+
if (node.isVOnce) {
|
|
4117
4123
|
indent();
|
|
4118
4124
|
push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
|
|
4119
4125
|
newline();
|
|
4126
|
+
push(`(`);
|
|
4120
4127
|
}
|
|
4121
4128
|
push(`_cache[${node.index}] = `);
|
|
4122
4129
|
genNode(node.value, context);
|
|
4123
|
-
if (node.
|
|
4124
|
-
push(
|
|
4130
|
+
if (node.isVOnce) {
|
|
4131
|
+
push(`).cacheIndex = ${node.index},`);
|
|
4125
4132
|
newline();
|
|
4126
4133
|
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
4127
4134
|
newline();
|
|
@@ -4347,7 +4354,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4347
4354
|
node2.name = rewriteIdentifier(node2.name, parent, node2);
|
|
4348
4355
|
ids.push(node2);
|
|
4349
4356
|
} else {
|
|
4350
|
-
if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
|
|
4357
|
+
if (!(needPrefix && isLocal) && (!parent || parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression")) {
|
|
4351
4358
|
node2.isConstant = true;
|
|
4352
4359
|
}
|
|
4353
4360
|
ids.push(node2);
|
|
@@ -4586,7 +4593,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
4586
4593
|
helper(FRAGMENT),
|
|
4587
4594
|
createObjectExpression([keyProperty]),
|
|
4588
4595
|
children,
|
|
4589
|
-
patchFlag
|
|
4596
|
+
patchFlag,
|
|
4590
4597
|
void 0,
|
|
4591
4598
|
void 0,
|
|
4592
4599
|
true,
|
|
@@ -4760,7 +4767,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4760
4767
|
helper(FRAGMENT),
|
|
4761
4768
|
void 0,
|
|
4762
4769
|
renderExp,
|
|
4763
|
-
fragmentFlag
|
|
4770
|
+
fragmentFlag,
|
|
4764
4771
|
void 0,
|
|
4765
4772
|
void 0,
|
|
4766
4773
|
true,
|
|
@@ -4800,7 +4807,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4800
4807
|
helper(FRAGMENT),
|
|
4801
4808
|
keyProperty ? createObjectExpression([keyProperty]) : void 0,
|
|
4802
4809
|
node.children,
|
|
4803
|
-
64
|
|
4810
|
+
64,
|
|
4804
4811
|
void 0,
|
|
4805
4812
|
void 0,
|
|
4806
4813
|
true,
|
|
@@ -5249,7 +5256,6 @@ const transformElement = (node, context) => {
|
|
|
5249
5256
|
const isDynamicComponent = shared.isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
5250
5257
|
let vnodeProps;
|
|
5251
5258
|
let vnodeChildren;
|
|
5252
|
-
let vnodePatchFlag;
|
|
5253
5259
|
let patchFlag = 0;
|
|
5254
5260
|
let vnodeDynamicProps;
|
|
5255
5261
|
let dynamicPropNames;
|
|
@@ -5320,25 +5326,15 @@ const transformElement = (node, context) => {
|
|
|
5320
5326
|
vnodeChildren = node.children;
|
|
5321
5327
|
}
|
|
5322
5328
|
}
|
|
5323
|
-
if (
|
|
5324
|
-
|
|
5325
|
-
if (patchFlag < 0) {
|
|
5326
|
-
vnodePatchFlag = patchFlag + ` /* ${shared.PatchFlagNames[patchFlag]} */`;
|
|
5327
|
-
} else {
|
|
5328
|
-
const flagNames = Object.keys(shared.PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => shared.PatchFlagNames[n]).join(`, `);
|
|
5329
|
-
vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
|
|
5330
|
-
}
|
|
5331
|
-
}
|
|
5332
|
-
if (dynamicPropNames && dynamicPropNames.length) {
|
|
5333
|
-
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
5334
|
-
}
|
|
5329
|
+
if (dynamicPropNames && dynamicPropNames.length) {
|
|
5330
|
+
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
5335
5331
|
}
|
|
5336
5332
|
node.codegenNode = createVNodeCall(
|
|
5337
5333
|
context,
|
|
5338
5334
|
vnodeTag,
|
|
5339
5335
|
vnodeProps,
|
|
5340
5336
|
vnodeChildren,
|
|
5341
|
-
|
|
5337
|
+
patchFlag === 0 ? void 0 : patchFlag,
|
|
5342
5338
|
vnodeDynamicProps,
|
|
5343
5339
|
vnodeDirectives,
|
|
5344
5340
|
!!shouldUseBlock,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.32
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -305,12 +305,12 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
305
305
|
loc: locStub
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
function createCacheExpression(index, value,
|
|
308
|
+
function createCacheExpression(index, value, isVOnce = false) {
|
|
309
309
|
return {
|
|
310
310
|
type: 20,
|
|
311
311
|
index,
|
|
312
312
|
value,
|
|
313
|
-
|
|
313
|
+
isVOnce,
|
|
314
314
|
loc: locStub
|
|
315
315
|
};
|
|
316
316
|
}
|
|
@@ -2837,7 +2837,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2837
2837
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2838
2838
|
if (constantType > 0) {
|
|
2839
2839
|
if (constantType >= 2) {
|
|
2840
|
-
child.codegenNode.patchFlag = -1
|
|
2840
|
+
child.codegenNode.patchFlag = -1;
|
|
2841
2841
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
2842
2842
|
hoistedCount++;
|
|
2843
2843
|
continue;
|
|
@@ -2845,8 +2845,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2845
2845
|
} else {
|
|
2846
2846
|
const codegenNode = child.codegenNode;
|
|
2847
2847
|
if (codegenNode.type === 13) {
|
|
2848
|
-
const flag =
|
|
2849
|
-
if ((
|
|
2848
|
+
const flag = codegenNode.patchFlag;
|
|
2849
|
+
if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
2850
2850
|
const props = getNodeProps(child);
|
|
2851
2851
|
if (props) {
|
|
2852
2852
|
codegenNode.props = context.hoist(props);
|
|
@@ -2910,8 +2910,7 @@ function getConstantType(node, context) {
|
|
|
2910
2910
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2911
2911
|
return 0;
|
|
2912
2912
|
}
|
|
2913
|
-
|
|
2914
|
-
if (!flag) {
|
|
2913
|
+
if (codegenNode.patchFlag === void 0) {
|
|
2915
2914
|
let returnType2 = 3;
|
|
2916
2915
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
2917
2916
|
if (generatedPropsType === 0) {
|
|
@@ -3053,10 +3052,6 @@ function getNodeProps(node) {
|
|
|
3053
3052
|
return codegenNode.props;
|
|
3054
3053
|
}
|
|
3055
3054
|
}
|
|
3056
|
-
function getPatchFlag(node) {
|
|
3057
|
-
const flag = node.patchFlag;
|
|
3058
|
-
return flag ? parseInt(flag, 10) : void 0;
|
|
3059
|
-
}
|
|
3060
3055
|
|
|
3061
3056
|
function createTransformContext(root, {
|
|
3062
3057
|
filename = "",
|
|
@@ -3264,7 +3259,7 @@ function createRootCodegen(root, context) {
|
|
|
3264
3259
|
helper(FRAGMENT),
|
|
3265
3260
|
void 0,
|
|
3266
3261
|
root.children,
|
|
3267
|
-
patchFlag
|
|
3262
|
+
patchFlag,
|
|
3268
3263
|
void 0,
|
|
3269
3264
|
void 0,
|
|
3270
3265
|
true,
|
|
@@ -3896,6 +3891,12 @@ function genVNodeCall(node, context) {
|
|
|
3896
3891
|
disableTracking,
|
|
3897
3892
|
isComponent
|
|
3898
3893
|
} = node;
|
|
3894
|
+
let patchFlagString;
|
|
3895
|
+
if (patchFlag) {
|
|
3896
|
+
{
|
|
3897
|
+
patchFlagString = String(patchFlag);
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3899
3900
|
if (directives) {
|
|
3900
3901
|
push(helper(WITH_DIRECTIVES) + `(`);
|
|
3901
3902
|
}
|
|
@@ -3908,7 +3909,7 @@ function genVNodeCall(node, context) {
|
|
|
3908
3909
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
3909
3910
|
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
3910
3911
|
genNodeList(
|
|
3911
|
-
genNullableArgs([tag, props, children,
|
|
3912
|
+
genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
|
|
3912
3913
|
context
|
|
3913
3914
|
);
|
|
3914
3915
|
push(`)`);
|
|
@@ -4042,15 +4043,16 @@ function genConditionalExpression(node, context) {
|
|
|
4042
4043
|
function genCacheExpression(node, context) {
|
|
4043
4044
|
const { push, helper, indent, deindent, newline } = context;
|
|
4044
4045
|
push(`_cache[${node.index}] || (`);
|
|
4045
|
-
if (node.
|
|
4046
|
+
if (node.isVOnce) {
|
|
4046
4047
|
indent();
|
|
4047
4048
|
push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
|
|
4048
4049
|
newline();
|
|
4050
|
+
push(`(`);
|
|
4049
4051
|
}
|
|
4050
4052
|
push(`_cache[${node.index}] = `);
|
|
4051
4053
|
genNode(node.value, context);
|
|
4052
|
-
if (node.
|
|
4053
|
-
push(
|
|
4054
|
+
if (node.isVOnce) {
|
|
4055
|
+
push(`).cacheIndex = ${node.index},`);
|
|
4054
4056
|
newline();
|
|
4055
4057
|
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
4056
4058
|
newline();
|
|
@@ -4276,7 +4278,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4276
4278
|
node2.name = rewriteIdentifier(node2.name, parent, node2);
|
|
4277
4279
|
ids.push(node2);
|
|
4278
4280
|
} else {
|
|
4279
|
-
if (!(needPrefix && isLocal) && parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression") {
|
|
4281
|
+
if (!(needPrefix && isLocal) && (!parent || parent.type !== "CallExpression" && parent.type !== "NewExpression" && parent.type !== "MemberExpression")) {
|
|
4280
4282
|
node2.isConstant = true;
|
|
4281
4283
|
}
|
|
4282
4284
|
ids.push(node2);
|
|
@@ -4505,7 +4507,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
4505
4507
|
helper(FRAGMENT),
|
|
4506
4508
|
createObjectExpression([keyProperty]),
|
|
4507
4509
|
children,
|
|
4508
|
-
patchFlag
|
|
4510
|
+
patchFlag,
|
|
4509
4511
|
void 0,
|
|
4510
4512
|
void 0,
|
|
4511
4513
|
true,
|
|
@@ -4679,7 +4681,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4679
4681
|
helper(FRAGMENT),
|
|
4680
4682
|
void 0,
|
|
4681
4683
|
renderExp,
|
|
4682
|
-
fragmentFlag
|
|
4684
|
+
fragmentFlag,
|
|
4683
4685
|
void 0,
|
|
4684
4686
|
void 0,
|
|
4685
4687
|
true,
|
|
@@ -4719,7 +4721,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4719
4721
|
helper(FRAGMENT),
|
|
4720
4722
|
keyProperty ? createObjectExpression([keyProperty]) : void 0,
|
|
4721
4723
|
node.children,
|
|
4722
|
-
64
|
|
4724
|
+
64,
|
|
4723
4725
|
void 0,
|
|
4724
4726
|
void 0,
|
|
4725
4727
|
true,
|
|
@@ -5168,7 +5170,6 @@ const transformElement = (node, context) => {
|
|
|
5168
5170
|
const isDynamicComponent = shared.isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
5169
5171
|
let vnodeProps;
|
|
5170
5172
|
let vnodeChildren;
|
|
5171
|
-
let vnodePatchFlag;
|
|
5172
5173
|
let patchFlag = 0;
|
|
5173
5174
|
let vnodeDynamicProps;
|
|
5174
5175
|
let dynamicPropNames;
|
|
@@ -5230,20 +5231,15 @@ const transformElement = (node, context) => {
|
|
|
5230
5231
|
vnodeChildren = node.children;
|
|
5231
5232
|
}
|
|
5232
5233
|
}
|
|
5233
|
-
if (
|
|
5234
|
-
|
|
5235
|
-
vnodePatchFlag = String(patchFlag);
|
|
5236
|
-
}
|
|
5237
|
-
if (dynamicPropNames && dynamicPropNames.length) {
|
|
5238
|
-
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
5239
|
-
}
|
|
5234
|
+
if (dynamicPropNames && dynamicPropNames.length) {
|
|
5235
|
+
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
5240
5236
|
}
|
|
5241
5237
|
node.codegenNode = createVNodeCall(
|
|
5242
5238
|
context,
|
|
5243
5239
|
vnodeTag,
|
|
5244
5240
|
vnodeProps,
|
|
5245
5241
|
vnodeChildren,
|
|
5246
|
-
|
|
5242
|
+
patchFlag === 0 ? void 0 : patchFlag,
|
|
5247
5243
|
vnodeDynamicProps,
|
|
5248
5244
|
vnodeDirectives,
|
|
5249
5245
|
!!shouldUseBlock,
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { PatchFlags } from '@vue/shared';
|
|
2
|
+
export { generateCodeFrame } from '@vue/shared';
|
|
1
3
|
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
|
2
4
|
import { ParserPlugin } from '@babel/parser';
|
|
3
|
-
export { generateCodeFrame } from '@vue/shared';
|
|
4
5
|
|
|
5
6
|
export declare const FRAGMENT: unique symbol;
|
|
6
7
|
export declare const TELEPORT: unique symbol;
|
|
@@ -364,7 +365,7 @@ export interface VNodeCall extends Node {
|
|
|
364
365
|
tag: string | symbol | CallExpression;
|
|
365
366
|
props: PropsExpression | undefined;
|
|
366
367
|
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | undefined;
|
|
367
|
-
patchFlag:
|
|
368
|
+
patchFlag: PatchFlags | undefined;
|
|
368
369
|
dynamicProps: string | SimpleExpressionNode | undefined;
|
|
369
370
|
directives: DirectiveArguments | undefined;
|
|
370
371
|
isBlock: boolean;
|
|
@@ -418,7 +419,7 @@ export interface CacheExpression extends Node {
|
|
|
418
419
|
type: NodeTypes.JS_CACHE_EXPRESSION;
|
|
419
420
|
index: number;
|
|
420
421
|
value: JSChildNode;
|
|
421
|
-
|
|
422
|
+
isVOnce: boolean;
|
|
422
423
|
}
|
|
423
424
|
export interface MemoExpression extends CallExpression {
|
|
424
425
|
callee: typeof WITH_MEMO;
|
|
@@ -514,7 +515,7 @@ export interface ForCodegenNode extends VNodeCall {
|
|
|
514
515
|
tag: typeof FRAGMENT;
|
|
515
516
|
props: undefined;
|
|
516
517
|
children: ForRenderListExpression;
|
|
517
|
-
patchFlag:
|
|
518
|
+
patchFlag: PatchFlags;
|
|
518
519
|
disableTracking: boolean;
|
|
519
520
|
}
|
|
520
521
|
export interface ForRenderListExpression extends CallExpression {
|
|
@@ -537,7 +538,7 @@ type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : C
|
|
|
537
538
|
export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
|
|
538
539
|
export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
|
|
539
540
|
export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
|
|
540
|
-
export declare function createCacheExpression(index: number, value: JSChildNode,
|
|
541
|
+
export declare function createCacheExpression(index: number, value: JSChildNode, isVOnce?: boolean): CacheExpression;
|
|
541
542
|
export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
|
|
542
543
|
export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
|
|
543
544
|
export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
|
|
@@ -1025,7 +1026,7 @@ export declare const forAliasRE: RegExp;
|
|
|
1025
1026
|
/**
|
|
1026
1027
|
* Return value indicates whether the AST walked can be a constant
|
|
1027
1028
|
*/
|
|
1028
|
-
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
|
|
1029
|
+
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1 | null, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
|
|
1029
1030
|
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
|
1030
1031
|
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
1031
1032
|
export declare function isInNewExpression(parentStack: Node$1[]): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.32
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -298,12 +298,12 @@ function createConditionalExpression(test, consequent, alternate, newline = true
|
|
|
298
298
|
loc: locStub
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
function createCacheExpression(index, value,
|
|
301
|
+
function createCacheExpression(index, value, isVOnce = false) {
|
|
302
302
|
return {
|
|
303
303
|
type: 20,
|
|
304
304
|
index,
|
|
305
305
|
value,
|
|
306
|
-
|
|
306
|
+
isVOnce,
|
|
307
307
|
loc: locStub
|
|
308
308
|
};
|
|
309
309
|
}
|
|
@@ -2622,7 +2622,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2622
2622
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2623
2623
|
if (constantType > 0) {
|
|
2624
2624
|
if (constantType >= 2) {
|
|
2625
|
-
child.codegenNode.patchFlag = -1
|
|
2625
|
+
child.codegenNode.patchFlag = -1;
|
|
2626
2626
|
child.codegenNode = context.hoist(child.codegenNode);
|
|
2627
2627
|
hoistedCount++;
|
|
2628
2628
|
continue;
|
|
@@ -2630,8 +2630,8 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2630
2630
|
} else {
|
|
2631
2631
|
const codegenNode = child.codegenNode;
|
|
2632
2632
|
if (codegenNode.type === 13) {
|
|
2633
|
-
const flag =
|
|
2634
|
-
if ((
|
|
2633
|
+
const flag = codegenNode.patchFlag;
|
|
2634
|
+
if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) {
|
|
2635
2635
|
const props = getNodeProps(child);
|
|
2636
2636
|
if (props) {
|
|
2637
2637
|
codegenNode.props = context.hoist(props);
|
|
@@ -2695,8 +2695,7 @@ function getConstantType(node, context) {
|
|
|
2695
2695
|
if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") {
|
|
2696
2696
|
return 0;
|
|
2697
2697
|
}
|
|
2698
|
-
|
|
2699
|
-
if (!flag) {
|
|
2698
|
+
if (codegenNode.patchFlag === void 0) {
|
|
2700
2699
|
let returnType2 = 3;
|
|
2701
2700
|
const generatedPropsType = getGeneratedPropsConstantType(node, context);
|
|
2702
2701
|
if (generatedPropsType === 0) {
|
|
@@ -2839,10 +2838,6 @@ function getNodeProps(node) {
|
|
|
2839
2838
|
return codegenNode.props;
|
|
2840
2839
|
}
|
|
2841
2840
|
}
|
|
2842
|
-
function getPatchFlag(node) {
|
|
2843
|
-
const flag = node.patchFlag;
|
|
2844
|
-
return flag ? parseInt(flag, 10) : void 0;
|
|
2845
|
-
}
|
|
2846
2841
|
|
|
2847
2842
|
function createTransformContext(root, {
|
|
2848
2843
|
filename = "",
|
|
@@ -3040,7 +3035,7 @@ function createRootCodegen(root, context) {
|
|
|
3040
3035
|
helper(FRAGMENT),
|
|
3041
3036
|
void 0,
|
|
3042
3037
|
root.children,
|
|
3043
|
-
patchFlag
|
|
3038
|
+
patchFlag,
|
|
3044
3039
|
void 0,
|
|
3045
3040
|
void 0,
|
|
3046
3041
|
true,
|
|
@@ -3533,6 +3528,19 @@ function genVNodeCall(node, context) {
|
|
|
3533
3528
|
disableTracking,
|
|
3534
3529
|
isComponent
|
|
3535
3530
|
} = node;
|
|
3531
|
+
let patchFlagString;
|
|
3532
|
+
if (patchFlag) {
|
|
3533
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3534
|
+
if (patchFlag < 0) {
|
|
3535
|
+
patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
3536
|
+
} else {
|
|
3537
|
+
const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
|
|
3538
|
+
patchFlagString = patchFlag + ` /* ${flagNames} */`;
|
|
3539
|
+
}
|
|
3540
|
+
} else {
|
|
3541
|
+
patchFlagString = String(patchFlag);
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3536
3544
|
if (directives) {
|
|
3537
3545
|
push(helper(WITH_DIRECTIVES) + `(`);
|
|
3538
3546
|
}
|
|
@@ -3545,7 +3553,7 @@ function genVNodeCall(node, context) {
|
|
|
3545
3553
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
3546
3554
|
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
3547
3555
|
genNodeList(
|
|
3548
|
-
genNullableArgs([tag, props, children,
|
|
3556
|
+
genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
|
|
3549
3557
|
context
|
|
3550
3558
|
);
|
|
3551
3559
|
push(`)`);
|
|
@@ -3679,15 +3687,16 @@ function genConditionalExpression(node, context) {
|
|
|
3679
3687
|
function genCacheExpression(node, context) {
|
|
3680
3688
|
const { push, helper, indent, deindent, newline } = context;
|
|
3681
3689
|
push(`_cache[${node.index}] || (`);
|
|
3682
|
-
if (node.
|
|
3690
|
+
if (node.isVOnce) {
|
|
3683
3691
|
indent();
|
|
3684
3692
|
push(`${helper(SET_BLOCK_TRACKING)}(-1),`);
|
|
3685
3693
|
newline();
|
|
3694
|
+
push(`(`);
|
|
3686
3695
|
}
|
|
3687
3696
|
push(`_cache[${node.index}] = `);
|
|
3688
3697
|
genNode(node.value, context);
|
|
3689
|
-
if (node.
|
|
3690
|
-
push(
|
|
3698
|
+
if (node.isVOnce) {
|
|
3699
|
+
push(`).cacheIndex = ${node.index},`);
|
|
3691
3700
|
newline();
|
|
3692
3701
|
push(`${helper(SET_BLOCK_TRACKING)}(1),`);
|
|
3693
3702
|
newline();
|
|
@@ -3940,7 +3949,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
3940
3949
|
helper(FRAGMENT),
|
|
3941
3950
|
createObjectExpression([keyProperty]),
|
|
3942
3951
|
children,
|
|
3943
|
-
patchFlag
|
|
3952
|
+
patchFlag,
|
|
3944
3953
|
void 0,
|
|
3945
3954
|
void 0,
|
|
3946
3955
|
true,
|
|
@@ -4090,7 +4099,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4090
4099
|
helper(FRAGMENT),
|
|
4091
4100
|
void 0,
|
|
4092
4101
|
renderExp,
|
|
4093
|
-
fragmentFlag
|
|
4102
|
+
fragmentFlag,
|
|
4094
4103
|
void 0,
|
|
4095
4104
|
void 0,
|
|
4096
4105
|
true,
|
|
@@ -4130,7 +4139,7 @@ const transformFor = createStructuralDirectiveTransform(
|
|
|
4130
4139
|
helper(FRAGMENT),
|
|
4131
4140
|
keyProperty ? createObjectExpression([keyProperty]) : void 0,
|
|
4132
4141
|
node.children,
|
|
4133
|
-
64
|
|
4142
|
+
64,
|
|
4134
4143
|
void 0,
|
|
4135
4144
|
void 0,
|
|
4136
4145
|
true,
|
|
@@ -4557,7 +4566,6 @@ const transformElement = (node, context) => {
|
|
|
4557
4566
|
const isDynamicComponent = isObject(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT;
|
|
4558
4567
|
let vnodeProps;
|
|
4559
4568
|
let vnodeChildren;
|
|
4560
|
-
let vnodePatchFlag;
|
|
4561
4569
|
let patchFlag = 0;
|
|
4562
4570
|
let vnodeDynamicProps;
|
|
4563
4571
|
let dynamicPropNames;
|
|
@@ -4628,27 +4636,15 @@ const transformElement = (node, context) => {
|
|
|
4628
4636
|
vnodeChildren = node.children;
|
|
4629
4637
|
}
|
|
4630
4638
|
}
|
|
4631
|
-
if (
|
|
4632
|
-
|
|
4633
|
-
if (patchFlag < 0) {
|
|
4634
|
-
vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`;
|
|
4635
|
-
} else {
|
|
4636
|
-
const flagNames = Object.keys(PatchFlagNames).map(Number).filter((n) => n > 0 && patchFlag & n).map((n) => PatchFlagNames[n]).join(`, `);
|
|
4637
|
-
vnodePatchFlag = patchFlag + ` /* ${flagNames} */`;
|
|
4638
|
-
}
|
|
4639
|
-
} else {
|
|
4640
|
-
vnodePatchFlag = String(patchFlag);
|
|
4641
|
-
}
|
|
4642
|
-
if (dynamicPropNames && dynamicPropNames.length) {
|
|
4643
|
-
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4644
|
-
}
|
|
4639
|
+
if (dynamicPropNames && dynamicPropNames.length) {
|
|
4640
|
+
vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4645
4641
|
}
|
|
4646
4642
|
node.codegenNode = createVNodeCall(
|
|
4647
4643
|
context,
|
|
4648
4644
|
vnodeTag,
|
|
4649
4645
|
vnodeProps,
|
|
4650
4646
|
vnodeChildren,
|
|
4651
|
-
|
|
4647
|
+
patchFlag === 0 ? void 0 : patchFlag,
|
|
4652
4648
|
vnodeDynamicProps,
|
|
4653
4649
|
vnodeDirectives,
|
|
4654
4650
|
!!shouldUseBlock,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.32",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -50,7 +50,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.32"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.24.7"
|