@vue/compiler-core 3.6.0-rc.2 → 3.6.0-rc.3
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.6.0-rc.
|
|
2
|
+
* @vue/compiler-core v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -4258,15 +4258,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
4258
4258
|
else {
|
|
4259
4259
|
childBlock = children[0].codegenNode;
|
|
4260
4260
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
4261
|
-
|
|
4261
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
4262
|
+
if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
|
|
4262
4263
|
removeHelper(OPEN_BLOCK);
|
|
4263
4264
|
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
4264
4265
|
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
4265
|
-
childBlock.isBlock =
|
|
4266
|
+
childBlock.isBlock = shouldUseBlock;
|
|
4266
4267
|
if (childBlock.isBlock) {
|
|
4267
4268
|
helper(OPEN_BLOCK);
|
|
4268
4269
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
4269
|
-
} else
|
|
4270
|
+
} else {
|
|
4271
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
4272
|
+
if (childBlock.needsPatch) {
|
|
4273
|
+
var _childBlock$patchFlag;
|
|
4274
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4270
4277
|
}
|
|
4271
4278
|
if (memo) {
|
|
4272
4279
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -4524,12 +4531,16 @@ const transformElement = (node, context) => {
|
|
|
4524
4531
|
let vnodeDynamicProps;
|
|
4525
4532
|
let dynamicPropNames;
|
|
4526
4533
|
let vnodeDirectives;
|
|
4534
|
+
let needsPatch = false;
|
|
4535
|
+
let isBlockRequired = false;
|
|
4527
4536
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
4528
4537
|
if (props.length > 0) {
|
|
4529
4538
|
const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
|
|
4530
4539
|
vnodeProps = propsBuildResult.props;
|
|
4531
4540
|
patchFlag = propsBuildResult.patchFlag;
|
|
4532
4541
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
4542
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
4543
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
4533
4544
|
const directives = propsBuildResult.directives;
|
|
4534
4545
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
4535
4546
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -4558,7 +4569,10 @@ const transformElement = (node, context) => {
|
|
|
4558
4569
|
} else vnodeChildren = node.children;
|
|
4559
4570
|
}
|
|
4560
4571
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4561
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
4572
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
4573
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
4574
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
4575
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
4562
4576
|
};
|
|
4563
4577
|
};
|
|
4564
4578
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -4643,6 +4657,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4643
4657
|
const runtimeDirectives = [];
|
|
4644
4658
|
const hasChildren = children.length > 0;
|
|
4645
4659
|
let shouldUseBlock = false;
|
|
4660
|
+
let isBlockRequired = false;
|
|
4646
4661
|
let patchFlag = 0;
|
|
4647
4662
|
let hasRef = false;
|
|
4648
4663
|
let hasClassBinding = false;
|
|
@@ -4667,12 +4682,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4667
4682
|
const isEventHandler = (0, _vue_shared.isOn)(name);
|
|
4668
4683
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !(0, _vue_shared.isReservedProp)(name)) hasHydrationEventBinding = true;
|
|
4669
4684
|
if (isEventHandler && (0, _vue_shared.isReservedProp)(name)) hasVnodeHook = true;
|
|
4685
|
+
if (name === "ref") hasRef = true;
|
|
4670
4686
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
4671
4687
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
4672
|
-
if (name === "
|
|
4673
|
-
else if (name === "class") hasClassBinding = true;
|
|
4688
|
+
if (name === "class") hasClassBinding = true;
|
|
4674
4689
|
else if (name === "style") hasStyleBinding = true;
|
|
4675
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4690
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4676
4691
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4677
4692
|
} else hasDynamicKeys = true;
|
|
4678
4693
|
};
|
|
@@ -4705,7 +4720,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4705
4720
|
if (name === "once" || name === "memo") continue;
|
|
4706
4721
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
|
|
4707
4722
|
if (isVOn && ssr) continue;
|
|
4708
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
4723
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
4724
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && (0, _vue_shared.camelize)(arg.content) === "vue:beforeUpdate") {
|
|
4725
|
+
shouldUseBlock = true;
|
|
4726
|
+
isBlockRequired = true;
|
|
4727
|
+
}
|
|
4709
4728
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
4710
4729
|
if (!arg && (isVBind || isVOn)) {
|
|
4711
4730
|
hasDynamicKeys = true;
|
|
@@ -4747,7 +4766,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4747
4766
|
}
|
|
4748
4767
|
} else if (!(0, _vue_shared.isBuiltInDirective)(name)) {
|
|
4749
4768
|
runtimeDirectives.push(prop);
|
|
4750
|
-
if (hasChildren)
|
|
4769
|
+
if (hasChildren) {
|
|
4770
|
+
shouldUseBlock = true;
|
|
4771
|
+
isBlockRequired = true;
|
|
4772
|
+
}
|
|
4751
4773
|
}
|
|
4752
4774
|
}
|
|
4753
4775
|
}
|
|
@@ -4764,7 +4786,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4764
4786
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
4765
4787
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
4766
4788
|
}
|
|
4767
|
-
|
|
4789
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
4790
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
4768
4791
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
4769
4792
|
case 15:
|
|
4770
4793
|
let classKeyIndex = -1;
|
|
@@ -4794,7 +4817,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4794
4817
|
directives: runtimeDirectives,
|
|
4795
4818
|
patchFlag,
|
|
4796
4819
|
dynamicPropNames,
|
|
4797
|
-
shouldUseBlock
|
|
4820
|
+
shouldUseBlock,
|
|
4821
|
+
needsPatch,
|
|
4822
|
+
isBlockRequired
|
|
4798
4823
|
};
|
|
4799
4824
|
}
|
|
4800
4825
|
function dedupeProperties(properties) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-core v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -4216,15 +4216,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
4216
4216
|
else {
|
|
4217
4217
|
childBlock = children[0].codegenNode;
|
|
4218
4218
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
4219
|
-
|
|
4219
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
4220
|
+
if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
|
|
4220
4221
|
removeHelper(OPEN_BLOCK);
|
|
4221
4222
|
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
4222
4223
|
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
4223
|
-
childBlock.isBlock =
|
|
4224
|
+
childBlock.isBlock = shouldUseBlock;
|
|
4224
4225
|
if (childBlock.isBlock) {
|
|
4225
4226
|
helper(OPEN_BLOCK);
|
|
4226
4227
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
4227
|
-
} else
|
|
4228
|
+
} else {
|
|
4229
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
4230
|
+
if (childBlock.needsPatch) {
|
|
4231
|
+
var _childBlock$patchFlag;
|
|
4232
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4228
4235
|
}
|
|
4229
4236
|
if (memo) {
|
|
4230
4237
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -4482,12 +4489,16 @@ const transformElement = (node, context) => {
|
|
|
4482
4489
|
let vnodeDynamicProps;
|
|
4483
4490
|
let dynamicPropNames;
|
|
4484
4491
|
let vnodeDirectives;
|
|
4492
|
+
let needsPatch = false;
|
|
4493
|
+
let isBlockRequired = false;
|
|
4485
4494
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
4486
4495
|
if (props.length > 0) {
|
|
4487
4496
|
const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
|
|
4488
4497
|
vnodeProps = propsBuildResult.props;
|
|
4489
4498
|
patchFlag = propsBuildResult.patchFlag;
|
|
4490
4499
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
4500
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
4501
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
4491
4502
|
const directives = propsBuildResult.directives;
|
|
4492
4503
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
4493
4504
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -4511,7 +4522,10 @@ const transformElement = (node, context) => {
|
|
|
4511
4522
|
} else vnodeChildren = node.children;
|
|
4512
4523
|
}
|
|
4513
4524
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
4514
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
4525
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
4526
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
4527
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
4528
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
4515
4529
|
};
|
|
4516
4530
|
};
|
|
4517
4531
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -4596,6 +4610,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4596
4610
|
const runtimeDirectives = [];
|
|
4597
4611
|
const hasChildren = children.length > 0;
|
|
4598
4612
|
let shouldUseBlock = false;
|
|
4613
|
+
let isBlockRequired = false;
|
|
4599
4614
|
let patchFlag = 0;
|
|
4600
4615
|
let hasRef = false;
|
|
4601
4616
|
let hasClassBinding = false;
|
|
@@ -4620,12 +4635,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4620
4635
|
const isEventHandler = (0, _vue_shared.isOn)(name);
|
|
4621
4636
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !(0, _vue_shared.isReservedProp)(name)) hasHydrationEventBinding = true;
|
|
4622
4637
|
if (isEventHandler && (0, _vue_shared.isReservedProp)(name)) hasVnodeHook = true;
|
|
4638
|
+
if (name === "ref") hasRef = true;
|
|
4623
4639
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
4624
4640
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
4625
|
-
if (name === "
|
|
4626
|
-
else if (name === "class") hasClassBinding = true;
|
|
4641
|
+
if (name === "class") hasClassBinding = true;
|
|
4627
4642
|
else if (name === "style") hasStyleBinding = true;
|
|
4628
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4643
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4629
4644
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
4630
4645
|
} else hasDynamicKeys = true;
|
|
4631
4646
|
};
|
|
@@ -4658,7 +4673,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4658
4673
|
if (name === "once" || name === "memo") continue;
|
|
4659
4674
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
|
|
4660
4675
|
if (isVOn && ssr) continue;
|
|
4661
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
4676
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
4677
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && (0, _vue_shared.camelize)(arg.content) === "vue:beforeUpdate") {
|
|
4678
|
+
shouldUseBlock = true;
|
|
4679
|
+
isBlockRequired = true;
|
|
4680
|
+
}
|
|
4662
4681
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
4663
4682
|
if (!arg && (isVBind || isVOn)) {
|
|
4664
4683
|
hasDynamicKeys = true;
|
|
@@ -4693,7 +4712,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4693
4712
|
}
|
|
4694
4713
|
} else if (!(0, _vue_shared.isBuiltInDirective)(name)) {
|
|
4695
4714
|
runtimeDirectives.push(prop);
|
|
4696
|
-
if (hasChildren)
|
|
4715
|
+
if (hasChildren) {
|
|
4716
|
+
shouldUseBlock = true;
|
|
4717
|
+
isBlockRequired = true;
|
|
4718
|
+
}
|
|
4697
4719
|
}
|
|
4698
4720
|
}
|
|
4699
4721
|
}
|
|
@@ -4710,7 +4732,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4710
4732
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
4711
4733
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
4712
4734
|
}
|
|
4713
|
-
|
|
4735
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
4736
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
4714
4737
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
4715
4738
|
case 15:
|
|
4716
4739
|
let classKeyIndex = -1;
|
|
@@ -4740,7 +4763,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
4740
4763
|
directives: runtimeDirectives,
|
|
4741
4764
|
patchFlag,
|
|
4742
4765
|
dynamicPropNames,
|
|
4743
|
-
shouldUseBlock
|
|
4766
|
+
shouldUseBlock,
|
|
4767
|
+
needsPatch,
|
|
4768
|
+
isBlockRequired
|
|
4744
4769
|
};
|
|
4745
4770
|
}
|
|
4746
4771
|
function dedupeProperties(properties) {
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -172,6 +172,8 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
|
|
|
172
172
|
patchFlag: number;
|
|
173
173
|
dynamicPropNames: string[];
|
|
174
174
|
shouldUseBlock: boolean;
|
|
175
|
+
needsPatch: boolean;
|
|
176
|
+
isBlockRequired: boolean;
|
|
175
177
|
};
|
|
176
178
|
export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
|
|
177
179
|
//#endregion
|
|
@@ -405,6 +407,10 @@ export interface VNodeCall extends Node {
|
|
|
405
407
|
patchFlag: PatchFlags | undefined;
|
|
406
408
|
dynamicProps: string | SimpleExpressionNode | undefined;
|
|
407
409
|
directives: DirectiveArguments | undefined;
|
|
410
|
+
/** Whether this vnode must be patched if a later transform makes it non-block. */
|
|
411
|
+
needsPatch?: boolean;
|
|
412
|
+
/** Whether a later transform must preserve this vnode as a block. */
|
|
413
|
+
isBlockRequired?: boolean;
|
|
408
414
|
isBlock: boolean;
|
|
409
415
|
disableTracking: boolean;
|
|
410
416
|
isComponent: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-core v3.6.0-rc.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -3347,15 +3347,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
|
|
|
3347
3347
|
else {
|
|
3348
3348
|
childBlock = children[0].codegenNode;
|
|
3349
3349
|
if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
|
|
3350
|
-
|
|
3350
|
+
const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
|
|
3351
|
+
if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
|
|
3351
3352
|
removeHelper(OPEN_BLOCK);
|
|
3352
3353
|
removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3353
3354
|
} else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3354
|
-
childBlock.isBlock =
|
|
3355
|
+
childBlock.isBlock = shouldUseBlock;
|
|
3355
3356
|
if (childBlock.isBlock) {
|
|
3356
3357
|
helper(OPEN_BLOCK);
|
|
3357
3358
|
helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
|
|
3358
|
-
} else
|
|
3359
|
+
} else {
|
|
3360
|
+
helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
|
|
3361
|
+
if (childBlock.needsPatch) {
|
|
3362
|
+
var _childBlock$patchFlag;
|
|
3363
|
+
childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3359
3366
|
}
|
|
3360
3367
|
if (memo) {
|
|
3361
3368
|
const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
|
|
@@ -3600,12 +3607,16 @@ const transformElement = (node, context) => {
|
|
|
3600
3607
|
let vnodeDynamicProps;
|
|
3601
3608
|
let dynamicPropNames;
|
|
3602
3609
|
let vnodeDirectives;
|
|
3610
|
+
let needsPatch = false;
|
|
3611
|
+
let isBlockRequired = false;
|
|
3603
3612
|
let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
|
|
3604
3613
|
if (props.length > 0) {
|
|
3605
3614
|
const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
|
|
3606
3615
|
vnodeProps = propsBuildResult.props;
|
|
3607
3616
|
patchFlag = propsBuildResult.patchFlag;
|
|
3608
3617
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
3618
|
+
needsPatch = propsBuildResult.needsPatch;
|
|
3619
|
+
isBlockRequired = propsBuildResult.isBlockRequired;
|
|
3609
3620
|
const directives = propsBuildResult.directives;
|
|
3610
3621
|
vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
|
|
3611
3622
|
if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
|
|
@@ -3634,7 +3645,10 @@ const transformElement = (node, context) => {
|
|
|
3634
3645
|
} else vnodeChildren = node.children;
|
|
3635
3646
|
}
|
|
3636
3647
|
if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
|
|
3637
|
-
node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3648
|
+
const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
|
|
3649
|
+
needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
|
|
3650
|
+
if (needsPatch) vnodeCall.needsPatch = true;
|
|
3651
|
+
if (isBlockRequired) vnodeCall.isBlockRequired = true;
|
|
3638
3652
|
};
|
|
3639
3653
|
};
|
|
3640
3654
|
function resolveComponentType(node, context, ssr = false) {
|
|
@@ -3668,6 +3682,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3668
3682
|
const runtimeDirectives = [];
|
|
3669
3683
|
const hasChildren = children.length > 0;
|
|
3670
3684
|
let shouldUseBlock = false;
|
|
3685
|
+
let isBlockRequired = false;
|
|
3671
3686
|
let patchFlag = 0;
|
|
3672
3687
|
let hasRef = false;
|
|
3673
3688
|
let hasClassBinding = false;
|
|
@@ -3692,12 +3707,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3692
3707
|
const isEventHandler = isOn(name);
|
|
3693
3708
|
if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
|
|
3694
3709
|
if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
|
|
3710
|
+
if (name === "ref") hasRef = true;
|
|
3695
3711
|
if (isEventHandler && value.type === 14) value = value.arguments[0];
|
|
3696
3712
|
if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
|
|
3697
|
-
if (name === "
|
|
3698
|
-
else if (name === "class") hasClassBinding = true;
|
|
3713
|
+
if (name === "class") hasClassBinding = true;
|
|
3699
3714
|
else if (name === "style") hasStyleBinding = true;
|
|
3700
|
-
else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3715
|
+
else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3701
3716
|
if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
|
|
3702
3717
|
} else hasDynamicKeys = true;
|
|
3703
3718
|
};
|
|
@@ -3723,7 +3738,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3723
3738
|
if (name === "once" || name === "memo") continue;
|
|
3724
3739
|
if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
|
|
3725
3740
|
if (isVOn && ssr) continue;
|
|
3726
|
-
if (isVBind && isStaticArgOf(arg, "key")
|
|
3741
|
+
if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
|
|
3742
|
+
if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
|
|
3743
|
+
shouldUseBlock = true;
|
|
3744
|
+
isBlockRequired = true;
|
|
3745
|
+
}
|
|
3727
3746
|
if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
|
|
3728
3747
|
if (!arg && (isVBind || isVOn)) {
|
|
3729
3748
|
hasDynamicKeys = true;
|
|
@@ -3767,7 +3786,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3767
3786
|
}
|
|
3768
3787
|
} else if (!isBuiltInDirective(name)) {
|
|
3769
3788
|
runtimeDirectives.push(prop);
|
|
3770
|
-
if (hasChildren)
|
|
3789
|
+
if (hasChildren) {
|
|
3790
|
+
shouldUseBlock = true;
|
|
3791
|
+
isBlockRequired = true;
|
|
3792
|
+
}
|
|
3771
3793
|
}
|
|
3772
3794
|
}
|
|
3773
3795
|
}
|
|
@@ -3784,7 +3806,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3784
3806
|
if (dynamicPropNames.length) patchFlag |= 8;
|
|
3785
3807
|
if (hasHydrationEventBinding) patchFlag |= 32;
|
|
3786
3808
|
}
|
|
3787
|
-
|
|
3809
|
+
const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
|
|
3810
|
+
if (!shouldUseBlock && needsPatch) patchFlag |= 512;
|
|
3788
3811
|
if (!context.inSSR && propsExpression) switch (propsExpression.type) {
|
|
3789
3812
|
case 15:
|
|
3790
3813
|
let classKeyIndex = -1;
|
|
@@ -3814,7 +3837,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
3814
3837
|
directives: runtimeDirectives,
|
|
3815
3838
|
patchFlag,
|
|
3816
3839
|
dynamicPropNames,
|
|
3817
|
-
shouldUseBlock
|
|
3840
|
+
shouldUseBlock,
|
|
3841
|
+
needsPatch,
|
|
3842
|
+
isBlockRequired
|
|
3818
3843
|
};
|
|
3819
3844
|
}
|
|
3820
3845
|
function dedupeProperties(properties) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.6.0-rc.
|
|
3
|
+
"version": "3.6.0-rc.3",
|
|
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.29.
|
|
49
|
+
"@babel/parser": "^7.29.8",
|
|
50
50
|
"entities": "^7.0.1",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.1",
|
|
53
|
-
"@vue/shared": "3.6.0-rc.
|
|
53
|
+
"@vue/shared": "3.6.0-rc.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.29.
|
|
56
|
+
"@babel/types": "^7.29.8"
|
|
57
57
|
}
|
|
58
58
|
}
|