@vue/compiler-core 3.2.34-beta.1 → 3.2.36

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.
@@ -1798,6 +1798,14 @@ function getConstantType(node, context) {
1798
1798
  // static then they don't need to be blocks since there will be no
1799
1799
  // nested updates.
1800
1800
  if (codegenNode.isBlock) {
1801
+ // except set custom directives.
1802
+ for (let i = 0; i < node.props.length; i++) {
1803
+ const p = node.props[i];
1804
+ if (p.type === 7 /* DIRECTIVE */) {
1805
+ constantCache.set(node, 0 /* NOT_CONSTANT */);
1806
+ return 0 /* NOT_CONSTANT */;
1807
+ }
1808
+ }
1801
1809
  context.removeHelper(OPEN_BLOCK);
1802
1810
  context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
1803
1811
  codegenNode.isBlock = false;
@@ -3258,7 +3266,7 @@ function isReferenced(node, parent, grandparent) {
3258
3266
  // no: export { NODE as foo } from "foo";
3259
3267
  case 'ExportSpecifier':
3260
3268
  // @ts-expect-error
3261
- if (grandparent?.source) {
3269
+ if (grandparent === null || grandparent === void 0 ? void 0 : grandparent.source) {
3262
3270
  return false;
3263
3271
  }
3264
3272
  return parent.local === node;
@@ -4344,7 +4352,7 @@ const transformElement = (node, context) => {
4344
4352
  (tag === 'svg' || tag === 'foreignObject'));
4345
4353
  // props
4346
4354
  if (props.length > 0) {
4347
- const propsBuildResult = buildProps(node, context);
4355
+ const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
4348
4356
  vnodeProps = propsBuildResult.props;
4349
4357
  patchFlag = propsBuildResult.patchFlag;
4350
4358
  dynamicPropNames = propsBuildResult.dynamicPropNames;
@@ -4545,9 +4553,8 @@ function resolveSetupReference(name, context) {
4545
4553
  : `$setup[${JSON.stringify(fromMaybeRef)}]`;
4546
4554
  }
4547
4555
  }
4548
- function buildProps(node, context, props = node.props, ssr = false) {
4556
+ function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
4549
4557
  const { tag, loc: elementLoc, children } = node;
4550
- const isComponent = node.tagType === 1 /* COMPONENT */;
4551
4558
  let properties = [];
4552
4559
  const mergeArgs = [];
4553
4560
  const runtimeDirectives = [];
@@ -4566,8 +4573,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
4566
4573
  if (isStaticExp(key)) {
4567
4574
  const name = key.content;
4568
4575
  const isEventHandler = shared.isOn(name);
4569
- if (!isComponent &&
4570
- isEventHandler &&
4576
+ if (isEventHandler &&
4577
+ (!isComponent || isDynamicComponent) &&
4571
4578
  // omit the flag for click handlers because hydration gives click
4572
4579
  // dedicated fast path.
4573
4580
  name.toLowerCase() !== 'onclick' &&
@@ -5038,7 +5045,7 @@ function processSlotOutlet(node, context) {
5038
5045
  }
5039
5046
  }
5040
5047
  if (nonNameProps.length > 0) {
5041
- const { props, directives } = buildProps(node, context, nonNameProps);
5048
+ const { props, directives } = buildProps(node, context, nonNameProps, false, false);
5042
5049
  slotProps = props;
5043
5050
  if (directives.length) {
5044
5051
  context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
@@ -1770,6 +1770,14 @@ function getConstantType(node, context) {
1770
1770
  // static then they don't need to be blocks since there will be no
1771
1771
  // nested updates.
1772
1772
  if (codegenNode.isBlock) {
1773
+ // except set custom directives.
1774
+ for (let i = 0; i < node.props.length; i++) {
1775
+ const p = node.props[i];
1776
+ if (p.type === 7 /* DIRECTIVE */) {
1777
+ constantCache.set(node, 0 /* NOT_CONSTANT */);
1778
+ return 0 /* NOT_CONSTANT */;
1779
+ }
1780
+ }
1773
1781
  context.removeHelper(OPEN_BLOCK);
1774
1782
  context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
1775
1783
  codegenNode.isBlock = false;
@@ -3195,7 +3203,7 @@ function isReferenced(node, parent, grandparent) {
3195
3203
  // no: export { NODE as foo } from "foo";
3196
3204
  case 'ExportSpecifier':
3197
3205
  // @ts-expect-error
3198
- if (grandparent?.source) {
3206
+ if (grandparent === null || grandparent === void 0 ? void 0 : grandparent.source) {
3199
3207
  return false;
3200
3208
  }
3201
3209
  return parent.local === node;
@@ -4260,7 +4268,7 @@ const transformElement = (node, context) => {
4260
4268
  (tag === 'svg' || tag === 'foreignObject'));
4261
4269
  // props
4262
4270
  if (props.length > 0) {
4263
- const propsBuildResult = buildProps(node, context);
4271
+ const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
4264
4272
  vnodeProps = propsBuildResult.props;
4265
4273
  patchFlag = propsBuildResult.patchFlag;
4266
4274
  dynamicPropNames = propsBuildResult.dynamicPropNames;
@@ -4442,9 +4450,8 @@ function resolveSetupReference(name, context) {
4442
4450
  : `$setup[${JSON.stringify(fromMaybeRef)}]`;
4443
4451
  }
4444
4452
  }
4445
- function buildProps(node, context, props = node.props, ssr = false) {
4453
+ function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
4446
4454
  const { tag, loc: elementLoc, children } = node;
4447
- const isComponent = node.tagType === 1 /* COMPONENT */;
4448
4455
  let properties = [];
4449
4456
  const mergeArgs = [];
4450
4457
  const runtimeDirectives = [];
@@ -4463,8 +4470,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
4463
4470
  if (isStaticExp(key)) {
4464
4471
  const name = key.content;
4465
4472
  const isEventHandler = shared.isOn(name);
4466
- if (!isComponent &&
4467
- isEventHandler &&
4473
+ if (isEventHandler &&
4474
+ (!isComponent || isDynamicComponent) &&
4468
4475
  // omit the flag for click handlers because hydration gives click
4469
4476
  // dedicated fast path.
4470
4477
  name.toLowerCase() !== 'onclick' &&
@@ -4909,7 +4916,7 @@ function processSlotOutlet(node, context) {
4909
4916
  }
4910
4917
  }
4911
4918
  if (nonNameProps.length > 0) {
4912
- const { props, directives } = buildProps(node, context, nonNameProps);
4919
+ const { props, directives } = buildProps(node, context, nonNameProps, false, false);
4913
4920
  slotProps = props;
4914
4921
  if (directives.length) {
4915
4922
  context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
@@ -106,7 +106,7 @@ export declare interface BlockStatement extends Node_2 {
106
106
 
107
107
  export declare function buildDirectiveArgs(dir: DirectiveNode, context: TransformContext): ArrayExpression;
108
108
 
109
- export declare function buildProps(node: ElementNode, context: TransformContext, props?: ElementNode['props'], ssr?: boolean): {
109
+ export declare function buildProps(node: ElementNode, context: TransformContext, props: (DirectiveNode | AttributeNode)[] | undefined, isComponent: boolean, isDynamicComponent: boolean, ssr?: boolean): {
110
110
  props: PropsExpression | undefined;
111
111
  directives: DirectiveNode[];
112
112
  patchFlag: number;
@@ -1783,6 +1783,14 @@ function getConstantType(node, context) {
1783
1783
  // static then they don't need to be blocks since there will be no
1784
1784
  // nested updates.
1785
1785
  if (codegenNode.isBlock) {
1786
+ // except set custom directives.
1787
+ for (let i = 0; i < node.props.length; i++) {
1788
+ const p = node.props[i];
1789
+ if (p.type === 7 /* DIRECTIVE */) {
1790
+ constantCache.set(node, 0 /* NOT_CONSTANT */);
1791
+ return 0 /* NOT_CONSTANT */;
1792
+ }
1793
+ }
1786
1794
  context.removeHelper(OPEN_BLOCK);
1787
1795
  context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
1788
1796
  codegenNode.isBlock = false;
@@ -3664,7 +3672,7 @@ const transformElement = (node, context) => {
3664
3672
  (tag === 'svg' || tag === 'foreignObject'));
3665
3673
  // props
3666
3674
  if (props.length > 0) {
3667
- const propsBuildResult = buildProps(node, context);
3675
+ const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
3668
3676
  vnodeProps = propsBuildResult.props;
3669
3677
  patchFlag = propsBuildResult.patchFlag;
3670
3678
  dynamicPropNames = propsBuildResult.dynamicPropNames;
@@ -3806,9 +3814,8 @@ function resolveComponentType(node, context, ssr = false) {
3806
3814
  context.components.add(tag);
3807
3815
  return toValidAssetId(tag, `component`);
3808
3816
  }
3809
- function buildProps(node, context, props = node.props, ssr = false) {
3817
+ function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
3810
3818
  const { tag, loc: elementLoc, children } = node;
3811
- const isComponent = node.tagType === 1 /* COMPONENT */;
3812
3819
  let properties = [];
3813
3820
  const mergeArgs = [];
3814
3821
  const runtimeDirectives = [];
@@ -3827,8 +3834,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
3827
3834
  if (isStaticExp(key)) {
3828
3835
  const name = key.content;
3829
3836
  const isEventHandler = isOn(name);
3830
- if (!isComponent &&
3831
- isEventHandler &&
3837
+ if (isEventHandler &&
3838
+ (!isComponent || isDynamicComponent) &&
3832
3839
  // omit the flag for click handlers because hydration gives click
3833
3840
  // dedicated fast path.
3834
3841
  name.toLowerCase() !== 'onclick' &&
@@ -4285,7 +4292,7 @@ function processSlotOutlet(node, context) {
4285
4292
  }
4286
4293
  }
4287
4294
  if (nonNameProps.length > 0) {
4288
- const { props, directives } = buildProps(node, context, nonNameProps);
4295
+ const { props, directives } = buildProps(node, context, nonNameProps, false, false);
4289
4296
  slotProps = props;
4290
4297
  if (directives.length) {
4291
4298
  context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-core",
3
- "version": "3.2.34-beta.1",
3
+ "version": "3.2.36",
4
4
  "description": "@vue/compiler-core",
5
5
  "main": "index.js",
6
6
  "module": "dist/compiler-core.esm-bundler.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
34
34
  "dependencies": {
35
- "@vue/shared": "3.2.34-beta.1",
35
+ "@vue/shared": "3.2.36",
36
36
  "@babel/parser": "^7.16.4",
37
37
  "estree-walker": "^2.0.2",
38
38
  "source-map": "^0.6.1"