marko 6.0.89 → 6.0.90

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.
package/dist/debug/dom.js CHANGED
@@ -1673,6 +1673,7 @@ function longestIncreasingSubsequence(a) {
1673
1673
  function _await(nodeAccessor, renderer) {
1674
1674
  const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
1675
1675
  const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
1676
+ enableBranches();
1676
1677
  return (scope, promise) => {
1677
1678
  const referenceNode = scope[nodeAccessor];
1678
1679
  const tryWithPlaceholder = findBranchWithKey(
@@ -1573,6 +1573,7 @@ function longestIncreasingSubsequence(a) {
1573
1573
  function _await(nodeAccessor, renderer) {
1574
1574
  const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
1575
1575
  const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
1576
+ enableBranches();
1576
1577
  return (scope, promise) => {
1577
1578
  const referenceNode = scope[nodeAccessor];
1578
1579
  const tryWithPlaceholder = findBranchWithKey(
@@ -749,20 +749,28 @@ function writeAssigned(state) {
749
749
  }
750
750
  if (state.mutations.length) {
751
751
  for (const mutation of state.mutations) {
752
+ const hasSeen = state.refs.get(mutation.object)?.id;
752
753
  const objectStartIndex = state.buf.push(
753
- state.buf.length === 0 ? "(" : ",("
754
+ state.buf.length === 0 ? "" : ","
754
755
  );
755
756
  if (writeProp(state, mutation.object, null, "")) {
756
757
  const objectRef = state.refs.get(mutation.object);
757
- if (objectRef && !objectRef.id) {
758
- objectRef.id = nextRefAccess(state);
759
- state.buf[objectStartIndex] = objectRef.id + "=" + state.buf[objectStartIndex];
758
+ if (objectRef) {
759
+ if (!objectRef.id) {
760
+ objectRef.id = nextRefAccess(state);
761
+ state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex];
762
+ state.buf.push(")");
763
+ } else if (!hasSeen) {
764
+ state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex];
765
+ state.buf.push(")");
766
+ }
760
767
  }
761
768
  } else {
762
769
  state.buf.push("void 0");
763
770
  }
771
+ const isCall = mutation.type === 0 /* call */;
764
772
  const valueStartIndex = state.buf.push(
765
- mutation.type === 0 /* call */ ? ")" + (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
773
+ isCall ? (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
766
774
  );
767
775
  if (writeProp(state, mutation.value, null, "")) {
768
776
  const valueRef = state.refs.get(mutation.value);
@@ -773,7 +781,9 @@ function writeAssigned(state) {
773
781
  } else {
774
782
  state.buf.push("void 0");
775
783
  }
776
- state.buf.push(")");
784
+ if (isCall) {
785
+ state.buf.push(")");
786
+ }
777
787
  }
778
788
  state.mutations = [];
779
789
  if (state.assigned.size) {
@@ -660,20 +660,28 @@ function writeAssigned(state) {
660
660
  }
661
661
  if (state.mutations.length) {
662
662
  for (const mutation of state.mutations) {
663
+ const hasSeen = state.refs.get(mutation.object)?.id;
663
664
  const objectStartIndex = state.buf.push(
664
- state.buf.length === 0 ? "(" : ",("
665
+ state.buf.length === 0 ? "" : ","
665
666
  );
666
667
  if (writeProp(state, mutation.object, null, "")) {
667
668
  const objectRef = state.refs.get(mutation.object);
668
- if (objectRef && !objectRef.id) {
669
- objectRef.id = nextRefAccess(state);
670
- state.buf[objectStartIndex] = objectRef.id + "=" + state.buf[objectStartIndex];
669
+ if (objectRef) {
670
+ if (!objectRef.id) {
671
+ objectRef.id = nextRefAccess(state);
672
+ state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex];
673
+ state.buf.push(")");
674
+ } else if (!hasSeen) {
675
+ state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex];
676
+ state.buf.push(")");
677
+ }
671
678
  }
672
679
  } else {
673
680
  state.buf.push("void 0");
674
681
  }
682
+ const isCall = mutation.type === 0 /* call */;
675
683
  const valueStartIndex = state.buf.push(
676
- mutation.type === 0 /* call */ ? ")" + (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
684
+ isCall ? (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
677
685
  );
678
686
  if (writeProp(state, mutation.value, null, "")) {
679
687
  const valueRef = state.refs.get(mutation.value);
@@ -684,7 +692,9 @@ function writeAssigned(state) {
684
692
  } else {
685
693
  state.buf.push("void 0");
686
694
  }
687
- state.buf.push(")");
695
+ if (isCall) {
696
+ state.buf.push(")");
697
+ }
688
698
  }
689
699
  state.mutations = [];
690
700
  if (state.assigned.size) {
package/dist/dom.js CHANGED
@@ -1091,7 +1091,7 @@ function longestIncreasingSubsequence(a) {
1091
1091
  // src/dom/control-flow.ts
1092
1092
  function _await(nodeAccessor, renderer) {
1093
1093
  let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
1094
- return (scope, promise) => {
1094
+ return enableBranches(), (scope, promise) => {
1095
1095
  let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
1096
1096
  scope,
1097
1097
  "d" /* PlaceholderContent */
package/dist/dom.mjs CHANGED
@@ -994,7 +994,7 @@ function longestIncreasingSubsequence(a) {
994
994
  // src/dom/control-flow.ts
995
995
  function _await(nodeAccessor, renderer) {
996
996
  let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
997
- return (scope, promise) => {
997
+ return enableBranches(), (scope, promise) => {
998
998
  let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
999
999
  scope,
1000
1000
  "d" /* PlaceholderContent */
package/dist/html.js CHANGED
@@ -539,23 +539,23 @@ function writeAssigned(state) {
539
539
  }
540
540
  if (state.mutations.length) {
541
541
  for (let mutation of state.mutations) {
542
- let objectStartIndex = state.buf.push(
543
- state.buf.length === 0 ? "(" : ",("
542
+ let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(
543
+ state.buf.length === 0 ? "" : ","
544
544
  );
545
545
  if (writeProp(state, mutation.object, null, "")) {
546
546
  let objectRef = state.refs.get(mutation.object);
547
- objectRef && !objectRef.id && (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = objectRef.id + "=" + state.buf[objectStartIndex]);
547
+ objectRef && (objectRef.id ? hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")) : (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")));
548
548
  } else
549
549
  state.buf.push("void 0");
550
- let valueStartIndex = state.buf.push(
551
- mutation.type === 0 /* call */ ? ")" + (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
550
+ let isCall = mutation.type === 0 /* call */, valueStartIndex = state.buf.push(
551
+ isCall ? (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
552
552
  );
553
553
  if (writeProp(state, mutation.value, null, "")) {
554
554
  let valueRef = state.refs.get(mutation.value);
555
555
  valueRef && !valueRef.id && (valueRef.id = nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
556
556
  } else
557
557
  state.buf.push("void 0");
558
- state.buf.push(")");
558
+ isCall && state.buf.push(")");
559
559
  }
560
560
  state.mutations = [], state.assigned.size && writeAssigned(state);
561
561
  }
package/dist/html.mjs CHANGED
@@ -453,23 +453,23 @@ function writeAssigned(state) {
453
453
  }
454
454
  if (state.mutations.length) {
455
455
  for (let mutation of state.mutations) {
456
- let objectStartIndex = state.buf.push(
457
- state.buf.length === 0 ? "(" : ",("
456
+ let hasSeen = state.refs.get(mutation.object)?.id, objectStartIndex = state.buf.push(
457
+ state.buf.length === 0 ? "" : ","
458
458
  );
459
459
  if (writeProp(state, mutation.object, null, "")) {
460
460
  let objectRef = state.refs.get(mutation.object);
461
- objectRef && !objectRef.id && (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = objectRef.id + "=" + state.buf[objectStartIndex]);
461
+ objectRef && (objectRef.id ? hasSeen || (state.buf[objectStartIndex] = "(" + state.buf[objectStartIndex], state.buf.push(")")) : (objectRef.id = nextRefAccess(state), state.buf[objectStartIndex] = "(" + objectRef.id + "=" + state.buf[objectStartIndex], state.buf.push(")")));
462
462
  } else
463
463
  state.buf.push("void 0");
464
- let valueStartIndex = state.buf.push(
465
- mutation.type === 0 /* call */ ? ")" + (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
464
+ let isCall = mutation.type === 0 /* call */, valueStartIndex = state.buf.push(
465
+ isCall ? (mutation.property === void 0 ? "" : toAccess(toObjectKey(mutation.property))) + "(" + (mutation.spread ? "..." : "") : toAccess(toObjectKey(mutation.property)) + "="
466
466
  );
467
467
  if (writeProp(state, mutation.value, null, "")) {
468
468
  let valueRef = state.refs.get(mutation.value);
469
469
  valueRef && !valueRef.id && (valueRef.id = nextRefAccess(state), state.buf[valueStartIndex] = valueRef.id + "=" + state.buf[valueStartIndex]);
470
470
  } else
471
471
  state.buf.push("void 0");
472
- state.buf.push(")");
472
+ isCall && state.buf.push(")");
473
473
  }
474
474
  state.mutations = [], state.assigned.size && writeAssigned(state);
475
475
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.89",
3
+ "version": "6.0.90",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",