@vue/compiler-core 3.6.0-rc.1 → 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.1
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
  **/
@@ -3156,7 +3156,7 @@ function getSelfName(filename) {
3156
3156
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
3157
3157
  return nameMatch ? (0, _vue_shared.capitalize)((0, _vue_shared.camelize)(nameMatch[1])) : null;
3158
3158
  }
3159
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
3159
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
3160
3160
  const context = {
3161
3161
  filename,
3162
3162
  selfName: getSelfName(filename),
@@ -3178,7 +3178,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
3178
3178
  bindingMetadata,
3179
3179
  inline,
3180
3180
  isTS,
3181
- eventDelegation,
3182
3181
  onError,
3183
3182
  onWarn,
3184
3183
  compatConfig,
@@ -4259,15 +4258,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
4259
4258
  else {
4260
4259
  childBlock = children[0].codegenNode;
4261
4260
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
4262
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
4261
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
4262
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
4263
4263
  removeHelper(OPEN_BLOCK);
4264
4264
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4265
4265
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
4266
- childBlock.isBlock = !isStableFragment;
4266
+ childBlock.isBlock = shouldUseBlock;
4267
4267
  if (childBlock.isBlock) {
4268
4268
  helper(OPEN_BLOCK);
4269
4269
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4270
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
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
+ }
4271
4277
  }
4272
4278
  if (memo) {
4273
4279
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -4525,12 +4531,16 @@ const transformElement = (node, context) => {
4525
4531
  let vnodeDynamicProps;
4526
4532
  let dynamicPropNames;
4527
4533
  let vnodeDirectives;
4534
+ let needsPatch = false;
4535
+ let isBlockRequired = false;
4528
4536
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
4529
4537
  if (props.length > 0) {
4530
4538
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
4531
4539
  vnodeProps = propsBuildResult.props;
4532
4540
  patchFlag = propsBuildResult.patchFlag;
4533
4541
  dynamicPropNames = propsBuildResult.dynamicPropNames;
4542
+ needsPatch = propsBuildResult.needsPatch;
4543
+ isBlockRequired = propsBuildResult.isBlockRequired;
4534
4544
  const directives = propsBuildResult.directives;
4535
4545
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
4536
4546
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -4559,7 +4569,10 @@ const transformElement = (node, context) => {
4559
4569
  } else vnodeChildren = node.children;
4560
4570
  }
4561
4571
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4562
- 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;
4563
4576
  };
4564
4577
  };
4565
4578
  function resolveComponentType(node, context, ssr = false) {
@@ -4644,6 +4657,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4644
4657
  const runtimeDirectives = [];
4645
4658
  const hasChildren = children.length > 0;
4646
4659
  let shouldUseBlock = false;
4660
+ let isBlockRequired = false;
4647
4661
  let patchFlag = 0;
4648
4662
  let hasRef = false;
4649
4663
  let hasClassBinding = false;
@@ -4668,12 +4682,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4668
4682
  const isEventHandler = (0, _vue_shared.isOn)(name);
4669
4683
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !(0, _vue_shared.isReservedProp)(name)) hasHydrationEventBinding = true;
4670
4684
  if (isEventHandler && (0, _vue_shared.isReservedProp)(name)) hasVnodeHook = true;
4685
+ if (name === "ref") hasRef = true;
4671
4686
  if (isEventHandler && value.type === 14) value = value.arguments[0];
4672
4687
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
4673
- if (name === "ref") hasRef = true;
4674
- else if (name === "class") hasClassBinding = true;
4688
+ if (name === "class") hasClassBinding = true;
4675
4689
  else if (name === "style") hasStyleBinding = true;
4676
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4690
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4677
4691
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4678
4692
  } else hasDynamicKeys = true;
4679
4693
  };
@@ -4706,7 +4720,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4706
4720
  if (name === "once" || name === "memo") continue;
4707
4721
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
4708
4722
  if (isVOn && ssr) continue;
4709
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
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
+ }
4710
4728
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
4711
4729
  if (!arg && (isVBind || isVOn)) {
4712
4730
  hasDynamicKeys = true;
@@ -4748,7 +4766,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4748
4766
  }
4749
4767
  } else if (!(0, _vue_shared.isBuiltInDirective)(name)) {
4750
4768
  runtimeDirectives.push(prop);
4751
- if (hasChildren) shouldUseBlock = true;
4769
+ if (hasChildren) {
4770
+ shouldUseBlock = true;
4771
+ isBlockRequired = true;
4772
+ }
4752
4773
  }
4753
4774
  }
4754
4775
  }
@@ -4765,7 +4786,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4765
4786
  if (dynamicPropNames.length) patchFlag |= 8;
4766
4787
  if (hasHydrationEventBinding) patchFlag |= 32;
4767
4788
  }
4768
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
4789
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
4790
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
4769
4791
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
4770
4792
  case 15:
4771
4793
  let classKeyIndex = -1;
@@ -4795,7 +4817,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4795
4817
  directives: runtimeDirectives,
4796
4818
  patchFlag,
4797
4819
  dynamicPropNames,
4798
- shouldUseBlock
4820
+ shouldUseBlock,
4821
+ needsPatch,
4822
+ isBlockRequired
4799
4823
  };
4800
4824
  }
4801
4825
  function dedupeProperties(properties) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.6.0-rc.1
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
  **/
@@ -3135,7 +3135,7 @@ function getSelfName(filename) {
3135
3135
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
3136
3136
  return nameMatch ? (0, _vue_shared.capitalize)((0, _vue_shared.camelize)(nameMatch[1])) : null;
3137
3137
  }
3138
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
3138
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = _vue_shared.NOOP, isCustomElement = _vue_shared.NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = _vue_shared.EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
3139
3139
  const context = {
3140
3140
  filename,
3141
3141
  selfName: getSelfName(filename),
@@ -3157,7 +3157,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
3157
3157
  bindingMetadata,
3158
3158
  inline,
3159
3159
  isTS,
3160
- eventDelegation,
3161
3160
  onError,
3162
3161
  onWarn,
3163
3162
  compatConfig,
@@ -4217,15 +4216,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
4217
4216
  else {
4218
4217
  childBlock = children[0].codegenNode;
4219
4218
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
4220
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
4219
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
4220
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
4221
4221
  removeHelper(OPEN_BLOCK);
4222
4222
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4223
4223
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
4224
- childBlock.isBlock = !isStableFragment;
4224
+ childBlock.isBlock = shouldUseBlock;
4225
4225
  if (childBlock.isBlock) {
4226
4226
  helper(OPEN_BLOCK);
4227
4227
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
4228
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
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
+ }
4229
4235
  }
4230
4236
  if (memo) {
4231
4237
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -4483,12 +4489,16 @@ const transformElement = (node, context) => {
4483
4489
  let vnodeDynamicProps;
4484
4490
  let dynamicPropNames;
4485
4491
  let vnodeDirectives;
4492
+ let needsPatch = false;
4493
+ let isBlockRequired = false;
4486
4494
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
4487
4495
  if (props.length > 0) {
4488
4496
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
4489
4497
  vnodeProps = propsBuildResult.props;
4490
4498
  patchFlag = propsBuildResult.patchFlag;
4491
4499
  dynamicPropNames = propsBuildResult.dynamicPropNames;
4500
+ needsPatch = propsBuildResult.needsPatch;
4501
+ isBlockRequired = propsBuildResult.isBlockRequired;
4492
4502
  const directives = propsBuildResult.directives;
4493
4503
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
4494
4504
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -4512,7 +4522,10 @@ const transformElement = (node, context) => {
4512
4522
  } else vnodeChildren = node.children;
4513
4523
  }
4514
4524
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
4515
- 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;
4516
4529
  };
4517
4530
  };
4518
4531
  function resolveComponentType(node, context, ssr = false) {
@@ -4597,6 +4610,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4597
4610
  const runtimeDirectives = [];
4598
4611
  const hasChildren = children.length > 0;
4599
4612
  let shouldUseBlock = false;
4613
+ let isBlockRequired = false;
4600
4614
  let patchFlag = 0;
4601
4615
  let hasRef = false;
4602
4616
  let hasClassBinding = false;
@@ -4621,12 +4635,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4621
4635
  const isEventHandler = (0, _vue_shared.isOn)(name);
4622
4636
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !(0, _vue_shared.isReservedProp)(name)) hasHydrationEventBinding = true;
4623
4637
  if (isEventHandler && (0, _vue_shared.isReservedProp)(name)) hasVnodeHook = true;
4638
+ if (name === "ref") hasRef = true;
4624
4639
  if (isEventHandler && value.type === 14) value = value.arguments[0];
4625
4640
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
4626
- if (name === "ref") hasRef = true;
4627
- else if (name === "class") hasClassBinding = true;
4641
+ if (name === "class") hasClassBinding = true;
4628
4642
  else if (name === "style") hasStyleBinding = true;
4629
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4643
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4630
4644
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
4631
4645
  } else hasDynamicKeys = true;
4632
4646
  };
@@ -4659,7 +4673,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4659
4673
  if (name === "once" || name === "memo") continue;
4660
4674
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
4661
4675
  if (isVOn && ssr) continue;
4662
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
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
+ }
4663
4681
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
4664
4682
  if (!arg && (isVBind || isVOn)) {
4665
4683
  hasDynamicKeys = true;
@@ -4694,7 +4712,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4694
4712
  }
4695
4713
  } else if (!(0, _vue_shared.isBuiltInDirective)(name)) {
4696
4714
  runtimeDirectives.push(prop);
4697
- if (hasChildren) shouldUseBlock = true;
4715
+ if (hasChildren) {
4716
+ shouldUseBlock = true;
4717
+ isBlockRequired = true;
4718
+ }
4698
4719
  }
4699
4720
  }
4700
4721
  }
@@ -4711,7 +4732,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4711
4732
  if (dynamicPropNames.length) patchFlag |= 8;
4712
4733
  if (hasHydrationEventBinding) patchFlag |= 32;
4713
4734
  }
4714
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
4735
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
4736
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
4715
4737
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
4716
4738
  case 15:
4717
4739
  let classKeyIndex = -1;
@@ -4741,7 +4763,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
4741
4763
  directives: runtimeDirectives,
4742
4764
  patchFlag,
4743
4765
  dynamicPropNames,
4744
- shouldUseBlock
4766
+ shouldUseBlock,
4767
+ needsPatch,
4768
+ isBlockRequired
4745
4769
  };
4746
4770
  }
4747
4771
  function dedupeProperties(properties) {
@@ -154,7 +154,6 @@ export declare function createTransformContext(root: RootNode, {
154
154
  bindingMetadata,
155
155
  inline,
156
156
  isTS,
157
- eventDelegation,
158
157
  onError,
159
158
  onWarn,
160
159
  compatConfig
@@ -173,6 +172,8 @@ export declare function buildProps(node: ElementNode, context: TransformContext,
173
172
  patchFlag: number;
174
173
  dynamicPropNames: string[];
175
174
  shouldUseBlock: boolean;
175
+ needsPatch: boolean;
176
+ isBlockRequired: boolean;
176
177
  };
177
178
  export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
178
179
  //#endregion
@@ -406,6 +407,10 @@ export interface VNodeCall extends Node {
406
407
  patchFlag: PatchFlags | undefined;
407
408
  dynamicProps: string | SimpleExpressionNode | undefined;
408
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;
409
414
  isBlock: boolean;
410
415
  disableTracking: boolean;
411
416
  isComponent: boolean;
@@ -929,12 +934,6 @@ export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHa
929
934
  * correctly, e.g. #6938, #7138
930
935
  */
931
936
  hmr?: boolean;
932
- /**
933
- * Vapor only: control whether eligible static DOM events are compiled to
934
- * document-level delegated events.
935
- * @default true
936
- */
937
- eventDelegation?: boolean;
938
937
  }
939
938
  export interface CodegenOptions extends SharedTransformCodegenOptions {
940
939
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.6.0-rc.1
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
  **/
@@ -2494,7 +2494,7 @@ function getSelfName(filename) {
2494
2494
  const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
2495
2495
  return nameMatch ? capitalize(camelize(nameMatch[1])) : null;
2496
2496
  }
2497
- function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, eventDelegation = true, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
2497
+ function createTransformContext(root, { filename = "", prefixIdentifiers = false, hoistStatic = false, hmr = false, cacheHandlers = false, nodeTransforms = [], directiveTransforms = {}, transformHoist = null, isBuiltInComponent = NOOP, isCustomElement = NOOP, expressionPlugins = [], scopeId = null, slotted = true, ssr = false, inSSR = false, ssrCssVars = ``, bindingMetadata = EMPTY_OBJ, inline = false, isTS = false, onError = defaultOnError, onWarn = defaultOnWarn, compatConfig }) {
2498
2498
  const context = {
2499
2499
  filename,
2500
2500
  selfName: getSelfName(filename),
@@ -2516,7 +2516,6 @@ function createTransformContext(root, { filename = "", prefixIdentifiers = false
2516
2516
  bindingMetadata,
2517
2517
  inline,
2518
2518
  isTS,
2519
- eventDelegation,
2520
2519
  onError,
2521
2520
  onWarn,
2522
2521
  compatConfig,
@@ -3348,15 +3347,22 @@ const transformFor = createStructuralDirectiveTransform("for", (node, dir, conte
3348
3347
  else {
3349
3348
  childBlock = children[0].codegenNode;
3350
3349
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
3351
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
3350
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
3351
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
3352
3352
  removeHelper(OPEN_BLOCK);
3353
3353
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3354
3354
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
3355
- childBlock.isBlock = !isStableFragment;
3355
+ childBlock.isBlock = shouldUseBlock;
3356
3356
  if (childBlock.isBlock) {
3357
3357
  helper(OPEN_BLOCK);
3358
3358
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
3359
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
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
+ }
3360
3366
  }
3361
3367
  if (memo) {
3362
3368
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -3601,12 +3607,16 @@ const transformElement = (node, context) => {
3601
3607
  let vnodeDynamicProps;
3602
3608
  let dynamicPropNames;
3603
3609
  let vnodeDirectives;
3610
+ let needsPatch = false;
3611
+ let isBlockRequired = false;
3604
3612
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
3605
3613
  if (props.length > 0) {
3606
3614
  const propsBuildResult = buildProps(node, context, void 0, isComponent, isDynamicComponent);
3607
3615
  vnodeProps = propsBuildResult.props;
3608
3616
  patchFlag = propsBuildResult.patchFlag;
3609
3617
  dynamicPropNames = propsBuildResult.dynamicPropNames;
3618
+ needsPatch = propsBuildResult.needsPatch;
3619
+ isBlockRequired = propsBuildResult.isBlockRequired;
3610
3620
  const directives = propsBuildResult.directives;
3611
3621
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
3612
3622
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -3635,7 +3645,10 @@ const transformElement = (node, context) => {
3635
3645
  } else vnodeChildren = node.children;
3636
3646
  }
3637
3647
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
3638
- 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;
3639
3652
  };
3640
3653
  };
3641
3654
  function resolveComponentType(node, context, ssr = false) {
@@ -3669,6 +3682,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3669
3682
  const runtimeDirectives = [];
3670
3683
  const hasChildren = children.length > 0;
3671
3684
  let shouldUseBlock = false;
3685
+ let isBlockRequired = false;
3672
3686
  let patchFlag = 0;
3673
3687
  let hasRef = false;
3674
3688
  let hasClassBinding = false;
@@ -3693,12 +3707,12 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3693
3707
  const isEventHandler = isOn(name);
3694
3708
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp(name)) hasHydrationEventBinding = true;
3695
3709
  if (isEventHandler && isReservedProp(name)) hasVnodeHook = true;
3710
+ if (name === "ref") hasRef = true;
3696
3711
  if (isEventHandler && value.type === 14) value = value.arguments[0];
3697
3712
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
3698
- if (name === "ref") hasRef = true;
3699
- else if (name === "class") hasClassBinding = true;
3713
+ if (name === "class") hasClassBinding = true;
3700
3714
  else if (name === "style") hasStyleBinding = true;
3701
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3715
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3702
3716
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
3703
3717
  } else hasDynamicKeys = true;
3704
3718
  };
@@ -3724,7 +3738,11 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3724
3738
  if (name === "once" || name === "memo") continue;
3725
3739
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled("COMPILER_IS_ON_ELEMENT", context))) continue;
3726
3740
  if (isVOn && ssr) continue;
3727
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
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
+ }
3728
3746
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
3729
3747
  if (!arg && (isVBind || isVOn)) {
3730
3748
  hasDynamicKeys = true;
@@ -3768,7 +3786,10 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3768
3786
  }
3769
3787
  } else if (!isBuiltInDirective(name)) {
3770
3788
  runtimeDirectives.push(prop);
3771
- if (hasChildren) shouldUseBlock = true;
3789
+ if (hasChildren) {
3790
+ shouldUseBlock = true;
3791
+ isBlockRequired = true;
3792
+ }
3772
3793
  }
3773
3794
  }
3774
3795
  }
@@ -3785,7 +3806,8 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3785
3806
  if (dynamicPropNames.length) patchFlag |= 8;
3786
3807
  if (hasHydrationEventBinding) patchFlag |= 32;
3787
3808
  }
3788
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
3809
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
3810
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
3789
3811
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
3790
3812
  case 15:
3791
3813
  let classKeyIndex = -1;
@@ -3815,7 +3837,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
3815
3837
  directives: runtimeDirectives,
3816
3838
  patchFlag,
3817
3839
  dynamicPropNames,
3818
- shouldUseBlock
3840
+ shouldUseBlock,
3841
+ needsPatch,
3842
+ isBlockRequired
3819
3843
  };
3820
3844
  }
3821
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.1",
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.7",
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.1"
53
+ "@vue/shared": "3.6.0-rc.3"
54
54
  },
55
55
  "devDependencies": {
56
- "@babel/types": "^7.29.7"
56
+ "@babel/types": "^7.29.8"
57
57
  }
58
58
  }