marko 6.0.72 → 6.0.74

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
@@ -1004,7 +1004,7 @@ function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
1004
1004
  const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
1005
1005
  const ownerSignal = (scope) => {
1006
1006
  const ifScope = scope[scopeAccessor];
1007
- if (ifScope && !ifScope.___creating && (scope[branchAccessor] ?? branch) === branch) {
1007
+ if (ifScope && !ifScope.___creating && (scope[branchAccessor] || 0) === branch) {
1008
1008
  queueRender(ifScope, childSignal, -1);
1009
1009
  }
1010
1010
  };
@@ -905,7 +905,7 @@ function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
905
905
  const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
906
906
  const ownerSignal = (scope) => {
907
907
  const ifScope = scope[scopeAccessor];
908
- if (ifScope && !ifScope.___creating && (scope[branchAccessor] ?? branch) === branch) {
908
+ if (ifScope && !ifScope.___creating && (scope[branchAccessor] || 0) === branch) {
909
909
  queueRender(ifScope, childSignal, -1);
910
910
  }
911
911
  };
@@ -1043,7 +1043,9 @@ function writePromise(state, val, ref) {
1043
1043
  if (!boundary) return false;
1044
1044
  const pId = nextRefAccess(state);
1045
1045
  const pRef = new Reference(ref, null, state.flush, null, pId);
1046
- state.buf.push("new Promise((f,r)=>" + pId + "={f,r})");
1046
+ state.buf.push(
1047
+ "(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"
1048
+ );
1047
1049
  val.then(
1048
1050
  (v) => writeAsyncCall(state, boundary, pRef, "f", v, pId),
1049
1051
  (v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)
@@ -2012,7 +2014,11 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
2012
2014
  const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
2013
2015
  if (shouldWriteBranch) {
2014
2016
  writeScope(scopeId, {
2015
- ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
2017
+ // TODO: technically conditional renderer should only be written when either the
2018
+ // condition is stateful, or if there are direct closures.
2019
+ // It may make sense to pass in another arg for this.
2020
+ ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: branchIndex || void 0,
2021
+ // we convert 0 to undefined since the runtime defaults branch to 0.
2016
2022
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
2017
2023
  });
2018
2024
  }
@@ -957,7 +957,9 @@ function writePromise(state, val, ref) {
957
957
  if (!boundary) return false;
958
958
  const pId = nextRefAccess(state);
959
959
  const pRef = new Reference(ref, null, state.flush, null, pId);
960
- state.buf.push("new Promise((f,r)=>" + pId + "={f,r})");
960
+ state.buf.push(
961
+ "(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"
962
+ );
961
963
  val.then(
962
964
  (v) => writeAsyncCall(state, boundary, pRef, "f", v, pId),
963
965
  (v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)
@@ -1926,7 +1928,11 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
1926
1928
  const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1927
1929
  if (shouldWriteBranch) {
1928
1930
  writeScope(scopeId, {
1929
- ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1931
+ // TODO: technically conditional renderer should only be written when either the
1932
+ // condition is stateful, or if there are direct closures.
1933
+ // It may make sense to pass in another arg for this.
1934
+ ["ConditionalRenderer:" /* ConditionalRenderer */ + accessor]: branchIndex || void 0,
1935
+ // we convert 0 to undefined since the runtime defaults branch to 0.
1930
1936
  ["ConditionalScope:" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1931
1937
  });
1932
1938
  }
package/dist/dom.js CHANGED
@@ -643,7 +643,7 @@ function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
643
643
  function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
644
644
  let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
645
645
  let ifScope = scope[scopeAccessor];
646
- ifScope && !ifScope.q && (scope[branchAccessor] ?? branch) === branch && queueRender(ifScope, childSignal, -1);
646
+ ifScope && !ifScope.q && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, childSignal, -1);
647
647
  };
648
648
  return ownerSignal._ = childSignal, ownerSignal;
649
649
  }
package/dist/dom.mjs CHANGED
@@ -547,7 +547,7 @@ function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
547
547
  function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
548
548
  let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
549
549
  let ifScope = scope[scopeAccessor];
550
- ifScope && !ifScope.q && (scope[branchAccessor] ?? branch) === branch && queueRender(ifScope, childSignal, -1);
550
+ ifScope && !ifScope.q && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, childSignal, -1);
551
551
  };
552
552
  return ownerSignal._ = childSignal, ownerSignal;
553
553
  }
package/dist/html.js CHANGED
@@ -736,7 +736,9 @@ function writePromise(state, val, ref) {
736
736
  let { boundary } = state;
737
737
  if (!boundary) return !1;
738
738
  let pId = nextRefAccess(state), pRef = new Reference(ref, null, state.flush, null, pId);
739
- return state.buf.push("new Promise((f,r)=>" + pId + "={f,r})"), val.then(
739
+ return state.buf.push(
740
+ "(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"
741
+ ), val.then(
740
742
  (v) => writeAsyncCall(state, boundary, pRef, "f", v, pId),
741
743
  (v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)
742
744
  ), boundary.startAsync(), !0;
@@ -1304,7 +1306,11 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
1304
1306
  resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
1305
1307
  let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1306
1308
  shouldWriteBranch && writeScope(scopeId, {
1307
- ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1309
+ // TODO: technically conditional renderer should only be written when either the
1310
+ // condition is stateful, or if there are direct closures.
1311
+ // It may make sense to pass in another arg for this.
1312
+ ["c" /* ConditionalRenderer */ + accessor]: branchIndex || void 0,
1313
+ // we convert 0 to undefined since the runtime defaults branch to 0.
1308
1314
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1309
1315
  }), writeBranchEnd(
1310
1316
  scopeId,
package/dist/html.mjs CHANGED
@@ -653,7 +653,9 @@ function writePromise(state, val, ref) {
653
653
  let { boundary } = state;
654
654
  if (!boundary) return !1;
655
655
  let pId = nextRefAccess(state), pRef = new Reference(ref, null, state.flush, null, pId);
656
- return state.buf.push("new Promise((f,r)=>" + pId + "={f,r})"), val.then(
656
+ return state.buf.push(
657
+ "(p=>p=new Promise((f,r)=>" + pId + "={f,r(e){p.catch(_=>0);r(e)}}))()"
658
+ ), val.then(
657
659
  (v) => writeAsyncCall(state, boundary, pRef, "f", v, pId),
658
660
  (v) => writeAsyncCall(state, boundary, pRef, "r", v, pId)
659
661
  ), boundary.startAsync(), !0;
@@ -1221,7 +1223,11 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
1221
1223
  resumeMarker && resumeBranch && !singleNode && $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
1222
1224
  let branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1223
1225
  shouldWriteBranch && writeScope(scopeId, {
1224
- ["c" /* ConditionalRenderer */ + accessor]: resumeMarker ? branchIndex : void 0,
1226
+ // TODO: technically conditional renderer should only be written when either the
1227
+ // condition is stateful, or if there are direct closures.
1228
+ // It may make sense to pass in another arg for this.
1229
+ ["c" /* ConditionalRenderer */ + accessor]: branchIndex || void 0,
1230
+ // we convert 0 to undefined since the runtime defaults branch to 0.
1225
1231
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1226
1232
  }), writeBranchEnd(
1227
1233
  scopeId,
@@ -10163,7 +10163,10 @@ var try_default = {
10163
10163
  "The [`<try>` tag](https://markojs.com/docs/reference/core-tag#try) requires [body content](https://markojs.com/docs/reference/language#tag-content)."
10164
10164
  );
10165
10165
  }
10166
- startSection(tag.get("body"));
10166
+ const bodySection = startSection(tag.get("body"));
10167
+ if (bodySection) {
10168
+ bodySection.upstreamExpression = tagExtra;
10169
+ }
10167
10170
  },
10168
10171
  translate: translateByTarget({
10169
10172
  html: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.72",
3
+ "version": "6.0.74",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",