marko 6.0.97 → 6.0.98

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.
@@ -6306,7 +6306,7 @@ var for_default = {
6306
6306
  const params = node.body.params;
6307
6307
  const statements = [];
6308
6308
  const bodyStatements = node.body.body;
6309
- const singleNodeOptimization = bodySection.content === null || bodySection.content.singleChild && bodySection.content.startType !== 4 /* Text */;
6309
+ const singleChild = bodySection.content?.singleChild && bodySection.content.startType !== 4 /* Text */;
6310
6310
  const branchSerializeReason = getSerializeReason(
6311
6311
  bodySection,
6312
6312
  kBranchSerializeReason
@@ -6327,7 +6327,7 @@ var for_default = {
6327
6327
  const statefulSerializeArg = getSerializeGuard(
6328
6328
  tagSection,
6329
6329
  getSerializeReason(tagSection, kStatefulReason),
6330
- !(skipParentEnd || singleNodeOptimization)
6330
+ !(skipParentEnd || singleChild)
6331
6331
  );
6332
6332
  const markerSerializeArg = getSerializeGuard(
6333
6333
  tagSection,
@@ -6350,7 +6350,7 @@ var for_default = {
6350
6350
  getParentTag(tag).node.extra[kSkipEndTag] = true;
6351
6351
  forTagArgs.push(import_compiler32.types.stringLiteral(`</${onlyChildParentTagName}>`));
6352
6352
  }
6353
- if (singleNodeOptimization) {
6353
+ if (singleChild) {
6354
6354
  if (!skipParentEnd) {
6355
6355
  forTagArgs.push(import_compiler32.types.numericLiteral(0));
6356
6356
  }
@@ -10488,10 +10488,8 @@ var IfTag = {
10488
10488
  binding: nodeBinding,
10489
10489
  prefix: getAccessorPrefix().ConditionalScope
10490
10490
  };
10491
- let singleNodeOptimization = true;
10492
10491
  for (const [branchTag, branchBodySection] of branches) {
10493
10492
  if (branchBodySection) {
10494
- singleNodeOptimization &&= branchBodySection.content === null || branchBodySection.content?.singleChild && branchBodySection.content.startType !== 4 /* Text */;
10495
10493
  branchBodySection.isBranch = true;
10496
10494
  branchBodySection.upstreamExpression = ifTagExtra;
10497
10495
  branchBodySection.sectionAccessor = sectionAccessor;
@@ -10501,7 +10499,6 @@ var IfTag = {
10501
10499
  }
10502
10500
  }
10503
10501
  mergeReferences(ifTagSection, ifTag.node, mergeReferenceNodes);
10504
- ifTagExtra.singleNodeOptimization = singleNodeOptimization;
10505
10502
  addSerializeExpr(ifTagSection, ifTagExtra, kStatefulReason2);
10506
10503
  }
10507
10504
  },
@@ -10532,8 +10529,6 @@ var IfTag = {
10532
10529
  const branches = getBranches(tag);
10533
10530
  const [ifTag] = branches[0];
10534
10531
  const ifTagSection = getSection(ifTag);
10535
- const ifTagExtra = ifTag.node.extra;
10536
- const singleNodeOptimization = ifTagExtra.singleNodeOptimization;
10537
10532
  const nodeBinding = getOptimizedOnlyChildNodeBinding(
10538
10533
  ifTag,
10539
10534
  ifTagSection
@@ -10546,6 +10541,13 @@ var IfTag = {
10546
10541
  const nextTag = tag.getNextSibling();
10547
10542
  let branchSerializeReasons;
10548
10543
  let statement;
10544
+ let singleChild = true;
10545
+ for (const [, branchBody] of branches) {
10546
+ if (!(branchBody?.content?.singleChild && branchBody.content.startType !== 4 /* Text */)) {
10547
+ singleChild = false;
10548
+ break;
10549
+ }
10550
+ }
10549
10551
  for (let i = branches.length; i--; ) {
10550
10552
  const [branchTag, branchBody] = branches[i];
10551
10553
  const bodyStatements = branchTag.node.body.body;
@@ -10594,7 +10596,7 @@ var IfTag = {
10594
10596
  const statefulSerializeArg = getSerializeGuard(
10595
10597
  ifTagSection,
10596
10598
  getSerializeReason(ifTagSection, kStatefulReason2),
10597
- !(skipParentEnd || singleNodeOptimization)
10599
+ !(skipParentEnd || singleChild)
10598
10600
  );
10599
10601
  const markerSerializeArg = getSerializeGuard(
10600
10602
  ifTagSection,
@@ -10618,8 +10620,8 @@ var IfTag = {
10618
10620
  ),
10619
10621
  markerSerializeArg,
10620
10622
  statefulSerializeArg,
10621
- skipParentEnd ? import_compiler48.types.stringLiteral(`</${onlyChildParentTagName}>`) : singleNodeOptimization ? import_compiler48.types.numericLiteral(0) : void 0,
10622
- singleNodeOptimization ? import_compiler48.types.numericLiteral(1) : void 0
10623
+ skipParentEnd ? import_compiler48.types.stringLiteral(`</${onlyChildParentTagName}>`) : singleChild ? import_compiler48.types.numericLiteral(0) : void 0,
10624
+ singleChild ? import_compiler48.types.numericLiteral(1) : void 0
10623
10625
  )
10624
10626
  );
10625
10627
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.97",
3
+ "version": "6.0.98",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",