@vue/compiler-vapor 3.6.0-beta.2 → 3.6.0-beta.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-vapor v3.6.0-beta.2
2
+ * @vue/compiler-vapor v3.6.0-beta.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -28,7 +28,29 @@ const newBlock = (node) => ({
28
28
  });
29
29
  function wrapTemplate(node, dirs) {
30
30
  if (node.tagType === 3) {
31
- return node;
31
+ const otherStructuralDirs = ["if", "else-if", "else", "for"];
32
+ const hasOtherStructuralDir = node.props.some(
33
+ (prop) => prop.type === 7 && otherStructuralDirs.includes(prop.name) && !dirs.includes(prop.name)
34
+ );
35
+ if (!hasOtherStructuralDir) {
36
+ return node;
37
+ }
38
+ const reserved2 = [];
39
+ const pass2 = [];
40
+ node.props.forEach((prop) => {
41
+ if (prop.type === 7 && dirs.includes(prop.name)) {
42
+ reserved2.push(prop);
43
+ } else {
44
+ pass2.push(prop);
45
+ }
46
+ });
47
+ return shared.extend({}, node, {
48
+ type: 1,
49
+ tag: "template",
50
+ props: reserved2,
51
+ tagType: 3,
52
+ children: [shared.extend({}, node, { props: pass2 })]
53
+ });
32
54
  }
33
55
  const reserved = [];
34
56
  const pass = [];
@@ -107,10 +129,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
107
129
  }
108
130
  return exp.isStatic ? exp.content : null;
109
131
  }
110
- function isInTransition(context) {
111
- const parentNode = context.parent && context.parent.node;
112
- return !!(parentNode && isTransitionNode(parentNode));
113
- }
114
132
  function isTransitionNode(node) {
115
133
  return node.type === 1 && isTransitionTag(node.tag);
116
134
  }
@@ -561,14 +579,12 @@ const IRNodeTypes = {
561
579
  "12": "SLOT_OUTLET_NODE",
562
580
  "DIRECTIVE": 13,
563
581
  "13": "DIRECTIVE",
564
- "DECLARE_OLD_REF": 14,
565
- "14": "DECLARE_OLD_REF",
566
- "IF": 15,
567
- "15": "IF",
568
- "FOR": 16,
569
- "16": "FOR",
570
- "GET_TEXT_CHILD": 17,
571
- "17": "GET_TEXT_CHILD"
582
+ "IF": 14,
583
+ "14": "IF",
584
+ "FOR": 15,
585
+ "15": "FOR",
586
+ "GET_TEXT_CHILD": 16,
587
+ "16": "GET_TEXT_CHILD"
572
588
  };
573
589
  const DynamicFlag = {
574
590
  "NONE": 0,
@@ -582,7 +598,7 @@ const DynamicFlag = {
582
598
  };
583
599
  function isBlockOperation(op) {
584
600
  const type = op.type;
585
- return type === 11 || type === 12 || type === 15 || type === 16;
601
+ return type === 11 || type === 12 || type === 14 || type === 15;
586
602
  }
587
603
 
588
604
  function genInsertNode({ parent, elements, anchor }, { helper }) {
@@ -1733,21 +1749,16 @@ function genSetTemplateRef(oper, context) {
1733
1749
  const [refValue, refKey] = genRefValue(oper.value, context);
1734
1750
  return [
1735
1751
  NEWLINE,
1736
- oper.effect && `r${oper.element} = `,
1737
1752
  ...genCall(
1738
1753
  setTemplateRefIdent,
1739
1754
  // will be generated in root scope
1740
1755
  `n${oper.element}`,
1741
1756
  refValue,
1742
- oper.effect ? `r${oper.element}` : oper.refFor ? "void 0" : void 0,
1743
1757
  oper.refFor && "true",
1744
1758
  refKey
1745
1759
  )
1746
1760
  ];
1747
1761
  }
1748
- function genDeclareOldRef(oper) {
1749
- return [NEWLINE, `let r${oper.id}`];
1750
- }
1751
1762
  function genRefValue(value, context) {
1752
1763
  if (value && context.options.inline) {
1753
1764
  const binding = context.options.bindingMetadata[value.content];
@@ -2135,15 +2146,7 @@ function genDynamicProps(props, context) {
2135
2146
  }
2136
2147
  } else {
2137
2148
  expr = genExpression(p.value, context);
2138
- if (p.handler)
2139
- expr = genCall(
2140
- helper("toHandlers"),
2141
- expr,
2142
- `false`,
2143
- // preserveCaseIfNecessary: false, not needed for component
2144
- `true`
2145
- // wrap handler values in functions
2146
- );
2149
+ if (p.handler) expr = genCall(helper("toHandlers"), expr);
2147
2150
  }
2148
2151
  }
2149
2152
  frags.push(["() => (", ...expr, ")"]);
@@ -2337,10 +2340,10 @@ function hasComponentOrSlotInDynamic(dynamic) {
2337
2340
  if (type === 11 || type === 12) {
2338
2341
  return true;
2339
2342
  }
2340
- if (type === 15) {
2343
+ if (type === 14) {
2341
2344
  if (hasComponentOrSlotInIf(dynamic.operation)) return true;
2342
2345
  }
2343
- if (type === 16) {
2346
+ if (type === 15) {
2344
2347
  if (hasComponentOrSlotInBlock(dynamic.operation.render))
2345
2348
  return true;
2346
2349
  }
@@ -2356,10 +2359,10 @@ function hasComponentOrSlotInOperations(operations) {
2356
2359
  case 11:
2357
2360
  case 12:
2358
2361
  return true;
2359
- case 15:
2362
+ case 14:
2360
2363
  if (hasComponentOrSlotInIf(op)) return true;
2361
2364
  break;
2362
- case 16:
2365
+ case 15:
2363
2366
  if (hasComponentOrSlotInBlock(op.render)) return true;
2364
2367
  break;
2365
2368
  }
@@ -2439,19 +2442,17 @@ function genOperation(oper, context) {
2439
2442
  return genInsertNode(oper, context);
2440
2443
  case 10:
2441
2444
  return genPrependNode(oper, context);
2442
- case 15:
2445
+ case 14:
2443
2446
  return genIf(oper, context);
2444
- case 16:
2447
+ case 15:
2445
2448
  return genFor(oper, context);
2446
2449
  case 11:
2447
2450
  return genCreateComponent(oper, context);
2448
- case 14:
2449
- return genDeclareOldRef(oper);
2450
2451
  case 12:
2451
2452
  return genSlotOutlet(oper, context);
2452
2453
  case 13:
2453
2454
  return genBuiltinDirective(oper, context);
2454
- case 17:
2455
+ case 16:
2455
2456
  return genGetTextChild(oper, context);
2456
2457
  default:
2457
2458
  const exhaustiveCheck = oper;
@@ -2652,7 +2653,7 @@ function genBlock(oper, context, args = [], root) {
2652
2653
  }
2653
2654
  function genBlockContent(block, context, root, genEffectsExtraFrag) {
2654
2655
  const [frag, push] = buildCodeFragment();
2655
- const { dynamic, effect, operation, returns, key } = block;
2656
+ const { dynamic, effect, operation, returns } = block;
2656
2657
  const resetBlock = context.enterBlock(block);
2657
2658
  if (root) {
2658
2659
  for (let name of context.ir.component) {
@@ -2685,12 +2686,6 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
2685
2686
  if (root && context.ir.hasDeferredVShow) {
2686
2687
  push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`);
2687
2688
  }
2688
- if (dynamic.needsKey) {
2689
- for (const child of dynamic.children) {
2690
- const keyValue = key ? genExpression(key, context) : JSON.stringify(child.id);
2691
- push(NEWLINE, `n${child.id}.$key = `, ...keyValue);
2692
- }
2693
- }
2694
2689
  push(NEWLINE, `return `);
2695
2690
  const returnNodes = returns.map((n) => `n${n}`);
2696
2691
  const returnsCode = returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "null"];
@@ -3413,7 +3408,7 @@ const transformVText = (dir, node, context) => {
3413
3408
  const isComponent = node.tagType === 1;
3414
3409
  if (!isComponent) {
3415
3410
  context.registerOperation({
3416
- type: 17,
3411
+ type: 16,
3417
3412
  parent: context.reference()
3418
3413
  });
3419
3414
  }
@@ -3593,10 +3588,6 @@ const transformTemplateRef = (node, context) => {
3593
3588
  return () => {
3594
3589
  const id = context.reference();
3595
3590
  const effect = !isConstantExpression(value);
3596
- effect && context.registerOperation({
3597
- type: 14,
3598
- id
3599
- });
3600
3591
  context.registerEffect([value], {
3601
3592
  type: 8,
3602
3593
  element: id,
@@ -3681,7 +3672,7 @@ function processTextContainer(children, context) {
3681
3672
  } else {
3682
3673
  context.childrenTemplate = [" "];
3683
3674
  context.registerOperation({
3684
- type: 17,
3675
+ type: 16,
3685
3676
  parent: context.reference()
3686
3677
  });
3687
3678
  context.registerEffect(values, {
@@ -3870,7 +3861,7 @@ function processIf(node, dir, context) {
3870
3861
  return () => {
3871
3862
  onExit();
3872
3863
  context.dynamic.operation = {
3873
- type: 15,
3864
+ type: 14,
3874
3865
  id,
3875
3866
  condition: dir.exp,
3876
3867
  positive: branch,
@@ -3885,7 +3876,7 @@ function processIf(node, dir, context) {
3885
3876
  if (siblings) {
3886
3877
  let i = siblings.length;
3887
3878
  while (i--) {
3888
- if (siblings[i].operation && siblings[i].operation.type === 15) {
3879
+ if (siblings[i].operation && siblings[i].operation.type === 14) {
3889
3880
  lastIfNode = siblings[i].operation;
3890
3881
  break;
3891
3882
  }
@@ -3894,14 +3885,14 @@ function processIf(node, dir, context) {
3894
3885
  if (
3895
3886
  // check if v-if is the sibling node
3896
3887
  !siblingIf || // check if IfNode is the last operation and get the root IfNode
3897
- !lastIfNode || lastIfNode.type !== 15
3888
+ !lastIfNode || lastIfNode.type !== 14
3898
3889
  ) {
3899
3890
  context.options.onError(
3900
3891
  compilerDom.createCompilerError(30, node.loc)
3901
3892
  );
3902
3893
  return;
3903
3894
  }
3904
- while (lastIfNode.negative && lastIfNode.negative.type === 15) {
3895
+ while (lastIfNode.negative && lastIfNode.negative.type === 14) {
3905
3896
  lastIfNode = lastIfNode.negative;
3906
3897
  }
3907
3898
  if (dir.name === "else-if" && lastIfNode.negative) {
@@ -3921,7 +3912,7 @@ function processIf(node, dir, context) {
3921
3912
  lastIfNode.negative = branch;
3922
3913
  } else {
3923
3914
  lastIfNode.negative = {
3924
- type: 15,
3915
+ type: 14,
3925
3916
  id: -1,
3926
3917
  condition: dir.exp,
3927
3918
  positive: branch,
@@ -3936,7 +3927,6 @@ function createIfBranch(node, context) {
3936
3927
  const branch = newBlock(node);
3937
3928
  const exitBlock = context.enterBlock(branch);
3938
3929
  context.reference();
3939
- branch.dynamic.needsKey = isInTransition(context);
3940
3930
  return [branch, exitBlock];
3941
3931
  }
3942
3932
 
@@ -3974,7 +3964,7 @@ function processFor(node, dir, context) {
3974
3964
  const { parent } = context;
3975
3965
  const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
3976
3966
  context.dynamic.operation = {
3977
- type: 16,
3967
+ type: 15,
3978
3968
  id,
3979
3969
  source,
3980
3970
  value,
@@ -4135,10 +4125,10 @@ function transformComponentSlot(node, dir, context) {
4135
4125
  markNonTemplate(n, context);
4136
4126
  });
4137
4127
  }
4138
- let slotKey;
4128
+ const [block, onExit] = createSlotBlock(node, dir, context);
4139
4129
  if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
4140
4130
  const nonCommentChild = nonSlotTemplateChildren.find(
4141
- (n) => n.type !== 3
4131
+ (n) => !compilerDom.isCommentOrWhitespace(n)
4142
4132
  );
4143
4133
  if (nonCommentChild) {
4144
4134
  const keyProp = findProp(
@@ -4146,11 +4136,10 @@ function transformComponentSlot(node, dir, context) {
4146
4136
  "key"
4147
4137
  );
4148
4138
  if (keyProp) {
4149
- slotKey = keyProp.exp;
4139
+ block.key = keyProp.exp;
4150
4140
  }
4151
4141
  }
4152
4142
  }
4153
- const [block, onExit] = createSlotBlock(node, dir, context, slotKey);
4154
4143
  const { slots } = context;
4155
4144
  return () => {
4156
4145
  onExit();
@@ -4284,13 +4273,9 @@ function hasStaticSlot(slots, name) {
4284
4273
  if (slot.slotType === 0) return !!slot.slots[name];
4285
4274
  });
4286
4275
  }
4287
- function createSlotBlock(slotNode, dir, context, key = void 0) {
4276
+ function createSlotBlock(slotNode, dir, context) {
4288
4277
  const block = newBlock(slotNode);
4289
4278
  block.props = dir && dir.exp;
4290
- if (key) {
4291
- block.key = key;
4292
- block.dynamic.needsKey = true;
4293
- }
4294
4279
  const exitBlock = context.enterBlock(block);
4295
4280
  return [block, exitBlock];
4296
4281
  }
@@ -75,10 +75,9 @@ export declare enum IRNodeTypes {
75
75
  CREATE_COMPONENT_NODE = 11,
76
76
  SLOT_OUTLET_NODE = 12,
77
77
  DIRECTIVE = 13,
78
- DECLARE_OLD_REF = 14,// consider make it more general
79
- IF = 15,
80
- FOR = 16,
81
- GET_TEXT_CHILD = 17
78
+ IF = 14,
79
+ FOR = 15,
80
+ GET_TEXT_CHILD = 16
82
81
  }
83
82
  export interface BaseIRNode {
84
83
  type: IRNodeTypes;
@@ -230,10 +229,6 @@ export interface CreateComponentIRNode extends BaseIRNode {
230
229
  append?: boolean;
231
230
  last?: boolean;
232
231
  }
233
- export interface DeclareOldRefIRNode extends BaseIRNode {
234
- type: IRNodeTypes.DECLARE_OLD_REF;
235
- id: number;
236
- }
237
232
  export interface SlotOutletIRNode extends BaseIRNode {
238
233
  type: IRNodeTypes.SLOT_OUTLET_NODE;
239
234
  id: number;
@@ -252,7 +247,7 @@ export interface GetTextChildIRNode extends BaseIRNode {
252
247
  parent: number;
253
248
  }
254
249
  export type IRNode = OperationNode | RootIRNode;
255
- export type OperationNode = SetPropIRNode | SetDynamicPropsIRNode | SetTextIRNode | SetEventIRNode | SetDynamicEventsIRNode | SetHtmlIRNode | SetTemplateRefIRNode | InsertNodeIRNode | PrependNodeIRNode | DirectiveIRNode | IfIRNode | ForIRNode | CreateComponentIRNode | DeclareOldRefIRNode | SlotOutletIRNode | GetTextChildIRNode;
250
+ export type OperationNode = SetPropIRNode | SetDynamicPropsIRNode | SetTextIRNode | SetEventIRNode | SetDynamicEventsIRNode | SetHtmlIRNode | SetTemplateRefIRNode | InsertNodeIRNode | PrependNodeIRNode | DirectiveIRNode | IfIRNode | ForIRNode | CreateComponentIRNode | SlotOutletIRNode | GetTextChildIRNode;
256
251
  export declare enum DynamicFlag {
257
252
  NONE = 0,
258
253
  /**
@@ -275,7 +270,6 @@ export interface IRDynamicInfo {
275
270
  children: IRDynamicInfo[];
276
271
  template?: number;
277
272
  hasDynamicChild?: boolean;
278
- needsKey?: boolean;
279
273
  operation?: OperationNode;
280
274
  ifBranch?: boolean;
281
275
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-vapor v3.6.0-beta.2
2
+ * @vue/compiler-vapor v3.6.0-beta.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -23690,7 +23690,29 @@ const newBlock = (node) => ({
23690
23690
  });
23691
23691
  function wrapTemplate(node, dirs) {
23692
23692
  if (node.tagType === 3) {
23693
- return node;
23693
+ const otherStructuralDirs = ["if", "else-if", "else", "for"];
23694
+ const hasOtherStructuralDir = node.props.some(
23695
+ (prop) => prop.type === 7 && otherStructuralDirs.includes(prop.name) && !dirs.includes(prop.name)
23696
+ );
23697
+ if (!hasOtherStructuralDir) {
23698
+ return node;
23699
+ }
23700
+ const reserved2 = [];
23701
+ const pass2 = [];
23702
+ node.props.forEach((prop) => {
23703
+ if (prop.type === 7 && dirs.includes(prop.name)) {
23704
+ reserved2.push(prop);
23705
+ } else {
23706
+ pass2.push(prop);
23707
+ }
23708
+ });
23709
+ return extend({}, node, {
23710
+ type: 1,
23711
+ tag: "template",
23712
+ props: reserved2,
23713
+ tagType: 3,
23714
+ children: [extend({}, node, { props: pass2 })]
23715
+ });
23694
23716
  }
23695
23717
  const reserved = [];
23696
23718
  const pass = [];
@@ -23769,10 +23791,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
23769
23791
  }
23770
23792
  return exp.isStatic ? exp.content : null;
23771
23793
  }
23772
- function isInTransition(context) {
23773
- const parentNode = context.parent && context.parent.node;
23774
- return !!(parentNode && isTransitionNode(parentNode));
23775
- }
23776
23794
  function isTransitionNode(node) {
23777
23795
  return node.type === 1 && isTransitionTag(node.tag);
23778
23796
  }
@@ -24223,14 +24241,12 @@ const IRNodeTypes = {
24223
24241
  "12": "SLOT_OUTLET_NODE",
24224
24242
  "DIRECTIVE": 13,
24225
24243
  "13": "DIRECTIVE",
24226
- "DECLARE_OLD_REF": 14,
24227
- "14": "DECLARE_OLD_REF",
24228
- "IF": 15,
24229
- "15": "IF",
24230
- "FOR": 16,
24231
- "16": "FOR",
24232
- "GET_TEXT_CHILD": 17,
24233
- "17": "GET_TEXT_CHILD"
24244
+ "IF": 14,
24245
+ "14": "IF",
24246
+ "FOR": 15,
24247
+ "15": "FOR",
24248
+ "GET_TEXT_CHILD": 16,
24249
+ "16": "GET_TEXT_CHILD"
24234
24250
  };
24235
24251
  const DynamicFlag = {
24236
24252
  "NONE": 0,
@@ -24244,7 +24260,7 @@ const DynamicFlag = {
24244
24260
  };
24245
24261
  function isBlockOperation(op) {
24246
24262
  const type = op.type;
24247
- return type === 11 || type === 12 || type === 15 || type === 16;
24263
+ return type === 11 || type === 12 || type === 14 || type === 15;
24248
24264
  }
24249
24265
 
24250
24266
  function genInsertNode({ parent, elements, anchor }, { helper }) {
@@ -25395,21 +25411,16 @@ function genSetTemplateRef(oper, context) {
25395
25411
  const [refValue, refKey] = genRefValue(oper.value, context);
25396
25412
  return [
25397
25413
  NEWLINE,
25398
- oper.effect && `r${oper.element} = `,
25399
25414
  ...genCall(
25400
25415
  setTemplateRefIdent,
25401
25416
  // will be generated in root scope
25402
25417
  `n${oper.element}`,
25403
25418
  refValue,
25404
- oper.effect ? `r${oper.element}` : oper.refFor ? "void 0" : void 0,
25405
25419
  oper.refFor && "true",
25406
25420
  refKey
25407
25421
  )
25408
25422
  ];
25409
25423
  }
25410
- function genDeclareOldRef(oper) {
25411
- return [NEWLINE, `let r${oper.id}`];
25412
- }
25413
25424
  function genRefValue(value, context) {
25414
25425
  if (value && context.options.inline) {
25415
25426
  const binding = context.options.bindingMetadata[value.content];
@@ -25797,15 +25808,7 @@ function genDynamicProps(props, context) {
25797
25808
  }
25798
25809
  } else {
25799
25810
  expr = genExpression(p.value, context);
25800
- if (p.handler)
25801
- expr = genCall(
25802
- helper("toHandlers"),
25803
- expr,
25804
- `false`,
25805
- // preserveCaseIfNecessary: false, not needed for component
25806
- `true`
25807
- // wrap handler values in functions
25808
- );
25811
+ if (p.handler) expr = genCall(helper("toHandlers"), expr);
25809
25812
  }
25810
25813
  }
25811
25814
  frags.push(["() => (", ...expr, ")"]);
@@ -25999,10 +26002,10 @@ function hasComponentOrSlotInDynamic(dynamic) {
25999
26002
  if (type === 11 || type === 12) {
26000
26003
  return true;
26001
26004
  }
26002
- if (type === 15) {
26005
+ if (type === 14) {
26003
26006
  if (hasComponentOrSlotInIf(dynamic.operation)) return true;
26004
26007
  }
26005
- if (type === 16) {
26008
+ if (type === 15) {
26006
26009
  if (hasComponentOrSlotInBlock(dynamic.operation.render))
26007
26010
  return true;
26008
26011
  }
@@ -26018,10 +26021,10 @@ function hasComponentOrSlotInOperations(operations) {
26018
26021
  case 11:
26019
26022
  case 12:
26020
26023
  return true;
26021
- case 15:
26024
+ case 14:
26022
26025
  if (hasComponentOrSlotInIf(op)) return true;
26023
26026
  break;
26024
- case 16:
26027
+ case 15:
26025
26028
  if (hasComponentOrSlotInBlock(op.render)) return true;
26026
26029
  break;
26027
26030
  }
@@ -26101,19 +26104,17 @@ function genOperation(oper, context) {
26101
26104
  return genInsertNode(oper, context);
26102
26105
  case 10:
26103
26106
  return genPrependNode(oper, context);
26104
- case 15:
26107
+ case 14:
26105
26108
  return genIf(oper, context);
26106
- case 16:
26109
+ case 15:
26107
26110
  return genFor(oper, context);
26108
26111
  case 11:
26109
26112
  return genCreateComponent(oper, context);
26110
- case 14:
26111
- return genDeclareOldRef(oper);
26112
26113
  case 12:
26113
26114
  return genSlotOutlet(oper, context);
26114
26115
  case 13:
26115
26116
  return genBuiltinDirective(oper, context);
26116
- case 17:
26117
+ case 16:
26117
26118
  return genGetTextChild(oper, context);
26118
26119
  default:
26119
26120
  const exhaustiveCheck = oper;
@@ -26314,7 +26315,7 @@ function genBlock(oper, context, args = [], root) {
26314
26315
  }
26315
26316
  function genBlockContent(block, context, root, genEffectsExtraFrag) {
26316
26317
  const [frag, push] = buildCodeFragment();
26317
- const { dynamic, effect, operation, returns, key } = block;
26318
+ const { dynamic, effect, operation, returns } = block;
26318
26319
  const resetBlock = context.enterBlock(block);
26319
26320
  if (root) {
26320
26321
  for (let name of context.ir.component) {
@@ -26347,12 +26348,6 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
26347
26348
  if (root && context.ir.hasDeferredVShow) {
26348
26349
  push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`);
26349
26350
  }
26350
- if (dynamic.needsKey) {
26351
- for (const child of dynamic.children) {
26352
- const keyValue = key ? genExpression(key, context) : JSON.stringify(child.id);
26353
- push(NEWLINE, `n${child.id}.$key = `, ...keyValue);
26354
- }
26355
- }
26356
26351
  push(NEWLINE, `return `);
26357
26352
  const returnNodes = returns.map((n) => `n${n}`);
26358
26353
  const returnsCode = returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "null"];
@@ -27065,7 +27060,7 @@ const transformVText = (dir, node, context) => {
27065
27060
  const isComponent = node.tagType === 1;
27066
27061
  if (!isComponent) {
27067
27062
  context.registerOperation({
27068
- type: 17,
27063
+ type: 16,
27069
27064
  parent: context.reference()
27070
27065
  });
27071
27066
  }
@@ -27242,10 +27237,6 @@ const transformTemplateRef = (node, context) => {
27242
27237
  return () => {
27243
27238
  const id = context.reference();
27244
27239
  const effect = !isConstantExpression(value);
27245
- effect && context.registerOperation({
27246
- type: 14,
27247
- id
27248
- });
27249
27240
  context.registerEffect([value], {
27250
27241
  type: 8,
27251
27242
  element: id,
@@ -27330,7 +27321,7 @@ function processTextContainer(children, context) {
27330
27321
  } else {
27331
27322
  context.childrenTemplate = [" "];
27332
27323
  context.registerOperation({
27333
- type: 17,
27324
+ type: 16,
27334
27325
  parent: context.reference()
27335
27326
  });
27336
27327
  context.registerEffect(values, {
@@ -27519,7 +27510,7 @@ function processIf(node, dir, context) {
27519
27510
  return () => {
27520
27511
  onExit();
27521
27512
  context.dynamic.operation = {
27522
- type: 15,
27513
+ type: 14,
27523
27514
  id,
27524
27515
  condition: dir.exp,
27525
27516
  positive: branch,
@@ -27534,7 +27525,7 @@ function processIf(node, dir, context) {
27534
27525
  if (siblings) {
27535
27526
  let i = siblings.length;
27536
27527
  while (i--) {
27537
- if (siblings[i].operation && siblings[i].operation.type === 15) {
27528
+ if (siblings[i].operation && siblings[i].operation.type === 14) {
27538
27529
  lastIfNode = siblings[i].operation;
27539
27530
  break;
27540
27531
  }
@@ -27543,14 +27534,14 @@ function processIf(node, dir, context) {
27543
27534
  if (
27544
27535
  // check if v-if is the sibling node
27545
27536
  !siblingIf || // check if IfNode is the last operation and get the root IfNode
27546
- !lastIfNode || lastIfNode.type !== 15
27537
+ !lastIfNode || lastIfNode.type !== 14
27547
27538
  ) {
27548
27539
  context.options.onError(
27549
27540
  createCompilerError(30, node.loc)
27550
27541
  );
27551
27542
  return;
27552
27543
  }
27553
- while (lastIfNode.negative && lastIfNode.negative.type === 15) {
27544
+ while (lastIfNode.negative && lastIfNode.negative.type === 14) {
27554
27545
  lastIfNode = lastIfNode.negative;
27555
27546
  }
27556
27547
  if (dir.name === "else-if" && lastIfNode.negative) {
@@ -27570,7 +27561,7 @@ function processIf(node, dir, context) {
27570
27561
  lastIfNode.negative = branch;
27571
27562
  } else {
27572
27563
  lastIfNode.negative = {
27573
- type: 15,
27564
+ type: 14,
27574
27565
  id: -1,
27575
27566
  condition: dir.exp,
27576
27567
  positive: branch,
@@ -27585,7 +27576,6 @@ function createIfBranch(node, context) {
27585
27576
  const branch = newBlock(node);
27586
27577
  const exitBlock = context.enterBlock(branch);
27587
27578
  context.reference();
27588
- branch.dynamic.needsKey = isInTransition(context);
27589
27579
  return [branch, exitBlock];
27590
27580
  }
27591
27581
 
@@ -27623,7 +27613,7 @@ function processFor(node, dir, context) {
27623
27613
  const { parent } = context;
27624
27614
  const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
27625
27615
  context.dynamic.operation = {
27626
- type: 16,
27616
+ type: 15,
27627
27617
  id,
27628
27618
  source,
27629
27619
  value,
@@ -27784,10 +27774,10 @@ function transformComponentSlot(node, dir, context) {
27784
27774
  markNonTemplate(n, context);
27785
27775
  });
27786
27776
  }
27787
- let slotKey;
27777
+ const [block, onExit] = createSlotBlock(node, dir, context);
27788
27778
  if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
27789
27779
  const nonCommentChild = nonSlotTemplateChildren.find(
27790
- (n) => n.type !== 3
27780
+ (n) => !isCommentOrWhitespace(n)
27791
27781
  );
27792
27782
  if (nonCommentChild) {
27793
27783
  const keyProp = findProp(
@@ -27795,11 +27785,10 @@ function transformComponentSlot(node, dir, context) {
27795
27785
  "key"
27796
27786
  );
27797
27787
  if (keyProp) {
27798
- slotKey = keyProp.exp;
27788
+ block.key = keyProp.exp;
27799
27789
  }
27800
27790
  }
27801
27791
  }
27802
- const [block, onExit] = createSlotBlock(node, dir, context, slotKey);
27803
27792
  const { slots } = context;
27804
27793
  return () => {
27805
27794
  onExit();
@@ -27933,13 +27922,9 @@ function hasStaticSlot(slots, name) {
27933
27922
  if (slot.slotType === 0) return !!slot.slots[name];
27934
27923
  });
27935
27924
  }
27936
- function createSlotBlock(slotNode, dir, context, key = void 0) {
27925
+ function createSlotBlock(slotNode, dir, context) {
27937
27926
  const block = newBlock(slotNode);
27938
27927
  block.props = dir && dir.exp;
27939
- if (key) {
27940
- block.key = key;
27941
- block.dynamic.needsKey = true;
27942
- }
27943
27928
  const exitBlock = context.enterBlock(block);
27944
27929
  return [block, exitBlock];
27945
27930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-vapor",
3
- "version": "3.6.0-beta.2",
3
+ "version": "3.6.0-beta.3",
4
4
  "description": "@vue/compiler-vapor",
5
5
  "main": "dist/compiler-vapor.cjs.js",
6
6
  "module": "dist/compiler-vapor.esm-bundler.js",
@@ -45,7 +45,7 @@
45
45
  "@babel/parser": "^7.28.5",
46
46
  "estree-walker": "^2.0.2",
47
47
  "source-map-js": "^1.2.1",
48
- "@vue/compiler-dom": "3.6.0-beta.2",
49
- "@vue/shared": "3.6.0-beta.2"
48
+ "@vue/shared": "3.6.0-beta.3",
49
+ "@vue/compiler-dom": "3.6.0-beta.3"
50
50
  }
51
51
  }