marko 6.0.0-next.3.62 → 6.0.0-next.3.63

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.
@@ -564,6 +564,7 @@ var State = class {
564
564
  ids = 0;
565
565
  flush = 0;
566
566
  flushed = false;
567
+ wroteUndefined = false;
567
568
  buf = [];
568
569
  refs = /* @__PURE__ */ new WeakMap();
569
570
  assigned = /* @__PURE__ */ new Set();
@@ -689,7 +690,12 @@ function writeRoot(state, root) {
689
690
  for (const chunk of buf) {
690
691
  result += chunk;
691
692
  }
692
- return "_=>" + result;
693
+ if (state.wroteUndefined) {
694
+ state.wroteUndefined = false;
695
+ return "(_,$)=>" + result;
696
+ } else {
697
+ return "_=>" + result;
698
+ }
693
699
  }
694
700
  function writeAssigned(state) {
695
701
  if (state.assigned.size) {
@@ -981,13 +987,23 @@ function writePlainObject(state, val, ref) {
981
987
  return true;
982
988
  }
983
989
  function writeArray(state, val, ref) {
984
- state.buf.push("[");
985
- writeProp(state, val[0], ref, "0");
986
- for (let i = 1; i < val.length; i++) {
987
- state.buf.push(",");
988
- writeProp(state, val[i], ref, "" + i);
990
+ let sep = "[";
991
+ for (let i = 0; i < val.length; i++) {
992
+ const item = val[i];
993
+ state.buf.push(sep);
994
+ sep = ",";
995
+ if (item === void 0) {
996
+ state.wroteUndefined = true;
997
+ state.buf.push("$");
998
+ } else {
999
+ writeProp(state, item, ref, "" + i);
1000
+ }
1001
+ }
1002
+ if (sep === "[") {
1003
+ state.buf.push("[]");
1004
+ } else {
1005
+ state.buf.push("]");
989
1006
  }
990
- state.buf.push("]");
991
1007
  return true;
992
1008
  }
993
1009
  function writeDate(state, val) {
@@ -1016,23 +1032,6 @@ function writeMap(state, val, ref) {
1016
1032
  state.buf.push("new Map");
1017
1033
  return true;
1018
1034
  }
1019
- const items = [];
1020
- let assigns;
1021
- for (let [itemKey, itemValue] of val) {
1022
- if (itemKey === val) {
1023
- itemKey = void 0;
1024
- (assigns ||= []).push("i[" + items.length + "][0]");
1025
- }
1026
- if (itemValue === val) {
1027
- itemValue = void 0;
1028
- (assigns ||= []).push("i[" + items.length + "][1]");
1029
- }
1030
- if (itemValue === void 0) {
1031
- items.push([itemKey]);
1032
- } else {
1033
- items.push([itemKey, itemValue]);
1034
- }
1035
- }
1036
1035
  const arrayRef = new Reference(
1037
1036
  ref,
1038
1037
  null,
@@ -1040,11 +1039,56 @@ function writeMap(state, val, ref) {
1040
1039
  null,
1041
1040
  nextRefAccess(state)
1042
1041
  );
1043
- state.buf.push(
1044
- (assigns ? "((m,i)=>(" + assignsToString(assigns, "m") + ",i.forEach(i=>m.set(i[0],i[1])),m))(new Map," : "new Map(") + arrayRef.id + "="
1045
- );
1046
- writeArray(state, items, arrayRef);
1047
- state.buf.push(")");
1042
+ const items = [];
1043
+ let assigns;
1044
+ let i = 0;
1045
+ if (val.size < 25) {
1046
+ for (let [itemKey, itemValue] of val) {
1047
+ if (itemKey === val) {
1048
+ itemKey = void 0;
1049
+ (assigns ||= []).push("a[" + i + "][0]");
1050
+ }
1051
+ if (itemValue === val) {
1052
+ itemValue = void 0;
1053
+ (assigns ||= []).push("a[" + i + "][1]");
1054
+ }
1055
+ i = items.push(
1056
+ itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
1057
+ );
1058
+ }
1059
+ if (assigns) {
1060
+ state.buf.push(
1061
+ "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
1062
+ );
1063
+ } else {
1064
+ state.buf.push("new Map(" + arrayRef.id + "=");
1065
+ }
1066
+ writeArray(state, items, arrayRef);
1067
+ state.buf.push(")");
1068
+ } else {
1069
+ for (let [itemKey, itemValue] of val) {
1070
+ if (itemKey === val) {
1071
+ itemKey = 0;
1072
+ (assigns ||= []).push("a[" + i + "]");
1073
+ }
1074
+ if (itemValue === val) {
1075
+ itemValue = 0;
1076
+ (assigns ||= []).push("a[" + (i + 1) + "]");
1077
+ }
1078
+ i = items.push(itemKey, itemValue);
1079
+ }
1080
+ if (assigns) {
1081
+ state.buf.push(
1082
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
1083
+ );
1084
+ } else {
1085
+ state.buf.push(
1086
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
1087
+ );
1088
+ }
1089
+ writeArray(state, items, arrayRef);
1090
+ state.buf.push(")");
1091
+ }
1048
1092
  return true;
1049
1093
  }
1050
1094
  function writeSet(state, val, ref) {
@@ -1054,12 +1098,13 @@ function writeSet(state, val, ref) {
1054
1098
  }
1055
1099
  const items = [];
1056
1100
  let assigns;
1101
+ let i = 0;
1057
1102
  for (let item of val) {
1058
1103
  if (item === val) {
1059
- item = void 0;
1060
- (assigns ||= []).push("i[" + items.length + "]");
1104
+ item = 0;
1105
+ (assigns ||= []).push("i[" + i + "]");
1061
1106
  }
1062
- items.push(item);
1107
+ i = items.push(item);
1063
1108
  }
1064
1109
  const arrayRef = new Reference(
1065
1110
  ref,
@@ -1151,7 +1196,7 @@ function writeFormData(state, val) {
1151
1196
  let valStr = "";
1152
1197
  for (const [key, value] of val) {
1153
1198
  if (typeof value === "string") {
1154
- valStr += sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]";
1199
+ valStr += sep + quote(key, 0) + "," + quote(value, 0);
1155
1200
  sep = ",";
1156
1201
  }
1157
1202
  }
@@ -1159,7 +1204,7 @@ function writeFormData(state, val) {
1159
1204
  state.buf.push("new FormData");
1160
1205
  } else {
1161
1206
  state.buf.push(
1162
- "((f,i)=>(f,i.forEach(i=>f.append(i[0],i[1])),f))(new FormData," + valStr + "])"
1207
+ valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
1163
1208
  );
1164
1209
  }
1165
1210
  return true;
@@ -480,6 +480,7 @@ var State = class {
480
480
  ids = 0;
481
481
  flush = 0;
482
482
  flushed = false;
483
+ wroteUndefined = false;
483
484
  buf = [];
484
485
  refs = /* @__PURE__ */ new WeakMap();
485
486
  assigned = /* @__PURE__ */ new Set();
@@ -605,7 +606,12 @@ function writeRoot(state, root) {
605
606
  for (const chunk of buf) {
606
607
  result += chunk;
607
608
  }
608
- return "_=>" + result;
609
+ if (state.wroteUndefined) {
610
+ state.wroteUndefined = false;
611
+ return "(_,$)=>" + result;
612
+ } else {
613
+ return "_=>" + result;
614
+ }
609
615
  }
610
616
  function writeAssigned(state) {
611
617
  if (state.assigned.size) {
@@ -897,13 +903,23 @@ function writePlainObject(state, val, ref) {
897
903
  return true;
898
904
  }
899
905
  function writeArray(state, val, ref) {
900
- state.buf.push("[");
901
- writeProp(state, val[0], ref, "0");
902
- for (let i = 1; i < val.length; i++) {
903
- state.buf.push(",");
904
- writeProp(state, val[i], ref, "" + i);
906
+ let sep = "[";
907
+ for (let i = 0; i < val.length; i++) {
908
+ const item = val[i];
909
+ state.buf.push(sep);
910
+ sep = ",";
911
+ if (item === void 0) {
912
+ state.wroteUndefined = true;
913
+ state.buf.push("$");
914
+ } else {
915
+ writeProp(state, item, ref, "" + i);
916
+ }
917
+ }
918
+ if (sep === "[") {
919
+ state.buf.push("[]");
920
+ } else {
921
+ state.buf.push("]");
905
922
  }
906
- state.buf.push("]");
907
923
  return true;
908
924
  }
909
925
  function writeDate(state, val) {
@@ -932,23 +948,6 @@ function writeMap(state, val, ref) {
932
948
  state.buf.push("new Map");
933
949
  return true;
934
950
  }
935
- const items = [];
936
- let assigns;
937
- for (let [itemKey, itemValue] of val) {
938
- if (itemKey === val) {
939
- itemKey = void 0;
940
- (assigns ||= []).push("i[" + items.length + "][0]");
941
- }
942
- if (itemValue === val) {
943
- itemValue = void 0;
944
- (assigns ||= []).push("i[" + items.length + "][1]");
945
- }
946
- if (itemValue === void 0) {
947
- items.push([itemKey]);
948
- } else {
949
- items.push([itemKey, itemValue]);
950
- }
951
- }
952
951
  const arrayRef = new Reference(
953
952
  ref,
954
953
  null,
@@ -956,11 +955,56 @@ function writeMap(state, val, ref) {
956
955
  null,
957
956
  nextRefAccess(state)
958
957
  );
959
- state.buf.push(
960
- (assigns ? "((m,i)=>(" + assignsToString(assigns, "m") + ",i.forEach(i=>m.set(i[0],i[1])),m))(new Map," : "new Map(") + arrayRef.id + "="
961
- );
962
- writeArray(state, items, arrayRef);
963
- state.buf.push(")");
958
+ const items = [];
959
+ let assigns;
960
+ let i = 0;
961
+ if (val.size < 25) {
962
+ for (let [itemKey, itemValue] of val) {
963
+ if (itemKey === val) {
964
+ itemKey = void 0;
965
+ (assigns ||= []).push("a[" + i + "][0]");
966
+ }
967
+ if (itemValue === val) {
968
+ itemValue = void 0;
969
+ (assigns ||= []).push("a[" + i + "][1]");
970
+ }
971
+ i = items.push(
972
+ itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
973
+ );
974
+ }
975
+ if (assigns) {
976
+ state.buf.push(
977
+ "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
978
+ );
979
+ } else {
980
+ state.buf.push("new Map(" + arrayRef.id + "=");
981
+ }
982
+ writeArray(state, items, arrayRef);
983
+ state.buf.push(")");
984
+ } else {
985
+ for (let [itemKey, itemValue] of val) {
986
+ if (itemKey === val) {
987
+ itemKey = 0;
988
+ (assigns ||= []).push("a[" + i + "]");
989
+ }
990
+ if (itemValue === val) {
991
+ itemValue = 0;
992
+ (assigns ||= []).push("a[" + (i + 1) + "]");
993
+ }
994
+ i = items.push(itemKey, itemValue);
995
+ }
996
+ if (assigns) {
997
+ state.buf.push(
998
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
999
+ );
1000
+ } else {
1001
+ state.buf.push(
1002
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
1003
+ );
1004
+ }
1005
+ writeArray(state, items, arrayRef);
1006
+ state.buf.push(")");
1007
+ }
964
1008
  return true;
965
1009
  }
966
1010
  function writeSet(state, val, ref) {
@@ -970,12 +1014,13 @@ function writeSet(state, val, ref) {
970
1014
  }
971
1015
  const items = [];
972
1016
  let assigns;
1017
+ let i = 0;
973
1018
  for (let item of val) {
974
1019
  if (item === val) {
975
- item = void 0;
976
- (assigns ||= []).push("i[" + items.length + "]");
1020
+ item = 0;
1021
+ (assigns ||= []).push("i[" + i + "]");
977
1022
  }
978
- items.push(item);
1023
+ i = items.push(item);
979
1024
  }
980
1025
  const arrayRef = new Reference(
981
1026
  ref,
@@ -1067,7 +1112,7 @@ function writeFormData(state, val) {
1067
1112
  let valStr = "";
1068
1113
  for (const [key, value] of val) {
1069
1114
  if (typeof value === "string") {
1070
- valStr += sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]";
1115
+ valStr += sep + quote(key, 0) + "," + quote(value, 0);
1071
1116
  sep = ",";
1072
1117
  }
1073
1118
  }
@@ -1075,7 +1120,7 @@ function writeFormData(state, val) {
1075
1120
  state.buf.push("new FormData");
1076
1121
  } else {
1077
1122
  state.buf.push(
1078
- "((f,i)=>(f,i.forEach(i=>f.append(i[0],i[1])),f))(new FormData," + valStr + "])"
1123
+ valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
1079
1124
  );
1080
1125
  }
1081
1126
  return true;
package/dist/html.js CHANGED
@@ -424,6 +424,7 @@ var REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
424
424
  ids = 0;
425
425
  flush = 0;
426
426
  flushed = !1;
427
+ wroteUndefined = !1;
427
428
  buf = [];
428
429
  refs = /* @__PURE__ */ new WeakMap();
429
430
  assigned = /* @__PURE__ */ new Set();
@@ -511,7 +512,7 @@ function writeRoot(state, root) {
511
512
  hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
512
513
  for (let chunk of buf)
513
514
  result += chunk;
514
- return "_=>" + result;
515
+ return state.wroteUndefined ? (state.wroteUndefined = !1, "(_,$)=>" + result) : "_=>" + result;
515
516
  }
516
517
  function writeAssigned(state) {
517
518
  if (state.assigned.size) {
@@ -711,10 +712,12 @@ function writePlainObject(state, val, ref) {
711
712
  return state.buf.push("{"), writeObjectProps(state, val, ref), state.buf.push("}"), !0;
712
713
  }
713
714
  function writeArray(state, val, ref) {
714
- state.buf.push("["), writeProp(state, val[0], ref, "0");
715
- for (let i = 1; i < val.length; i++)
716
- state.buf.push(","), writeProp(state, val[i], ref, "" + i);
717
- return state.buf.push("]"), !0;
715
+ let sep = "[";
716
+ for (let i = 0; i < val.length; i++) {
717
+ let item = val[i];
718
+ state.buf.push(sep), sep = ",", item === void 0 ? (state.wroteUndefined = !0, state.buf.push("$")) : writeProp(state, item, ref, "" + i);
719
+ }
720
+ return sep === "[" ? state.buf.push("[]") : state.buf.push("]"), !0;
718
721
  }
719
722
  function writeDate(state, val) {
720
723
  return state.buf.push('new Date("' + val.toISOString() + '")'), !0;
@@ -734,26 +737,38 @@ function writePromise(state, val, ref) {
734
737
  function writeMap(state, val, ref) {
735
738
  if (!val.size)
736
739
  return state.buf.push("new Map"), !0;
737
- let items = [], assigns;
738
- for (let [itemKey, itemValue] of val)
739
- itemKey === val && (itemKey = void 0, (assigns ||= []).push("i[" + items.length + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("i[" + items.length + "][1]")), itemValue === void 0 ? items.push([itemKey]) : items.push([itemKey, itemValue]);
740
740
  let arrayRef = new Reference(
741
741
  ref,
742
742
  null,
743
743
  state.flush,
744
744
  null,
745
745
  nextRefAccess(state)
746
- );
747
- return state.buf.push(
748
- (assigns ? "((m,i)=>(" + assignsToString(assigns, "m") + ",i.forEach(i=>m.set(i[0],i[1])),m))(new Map," : "new Map(") + arrayRef.id + "="
749
- ), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
746
+ ), items = [], assigns, i = 0;
747
+ if (val.size < 25) {
748
+ for (let [itemKey, itemValue] of val)
749
+ itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), i = items.push(
750
+ itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
751
+ );
752
+ assigns ? state.buf.push(
753
+ "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
754
+ ) : state.buf.push("new Map(" + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")");
755
+ } else {
756
+ for (let [itemKey, itemValue] of val)
757
+ itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), i = items.push(itemKey, itemValue);
758
+ assigns ? state.buf.push(
759
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
760
+ ) : state.buf.push(
761
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
762
+ ), writeArray(state, items, arrayRef), state.buf.push(")");
763
+ }
764
+ return !0;
750
765
  }
751
766
  function writeSet(state, val, ref) {
752
767
  if (!val.size)
753
768
  return state.buf.push("new Set"), !0;
754
- let items = [], assigns;
769
+ let items = [], assigns, i = 0;
755
770
  for (let item of val)
756
- item === val && (item = void 0, (assigns ||= []).push("i[" + items.length + "]")), items.push(item);
771
+ item === val && (item = 0, (assigns ||= []).push("i[" + i + "]")), i = items.push(item);
757
772
  let arrayRef = new Reference(
758
773
  ref,
759
774
  null,
@@ -806,9 +821,9 @@ function writeHeaders(state, val) {
806
821
  function writeFormData(state, val) {
807
822
  let sep = "[", valStr = "";
808
823
  for (let [key, value] of val)
809
- typeof value == "string" && (valStr += sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]", sep = ",");
824
+ typeof value == "string" && (valStr += sep + quote(key, 0) + "," + quote(value, 0), sep = ",");
810
825
  return sep === "[" ? state.buf.push("new FormData") : state.buf.push(
811
- "((f,i)=>(f,i.forEach(i=>f.append(i[0],i[1])),f))(new FormData," + valStr + "])"
826
+ valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
812
827
  ), !0;
813
828
  }
814
829
  function writeRequest(state, val, ref) {
package/dist/html.mjs CHANGED
@@ -343,6 +343,7 @@ var REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
343
343
  ids = 0;
344
344
  flush = 0;
345
345
  flushed = !1;
346
+ wroteUndefined = !1;
346
347
  buf = [];
347
348
  refs = /* @__PURE__ */ new WeakMap();
348
349
  assigned = /* @__PURE__ */ new Set();
@@ -430,7 +431,7 @@ function writeRoot(state, root) {
430
431
  hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
431
432
  for (let chunk of buf)
432
433
  result += chunk;
433
- return "_=>" + result;
434
+ return state.wroteUndefined ? (state.wroteUndefined = !1, "(_,$)=>" + result) : "_=>" + result;
434
435
  }
435
436
  function writeAssigned(state) {
436
437
  if (state.assigned.size) {
@@ -630,10 +631,12 @@ function writePlainObject(state, val, ref) {
630
631
  return state.buf.push("{"), writeObjectProps(state, val, ref), state.buf.push("}"), !0;
631
632
  }
632
633
  function writeArray(state, val, ref) {
633
- state.buf.push("["), writeProp(state, val[0], ref, "0");
634
- for (let i = 1; i < val.length; i++)
635
- state.buf.push(","), writeProp(state, val[i], ref, "" + i);
636
- return state.buf.push("]"), !0;
634
+ let sep = "[";
635
+ for (let i = 0; i < val.length; i++) {
636
+ let item = val[i];
637
+ state.buf.push(sep), sep = ",", item === void 0 ? (state.wroteUndefined = !0, state.buf.push("$")) : writeProp(state, item, ref, "" + i);
638
+ }
639
+ return sep === "[" ? state.buf.push("[]") : state.buf.push("]"), !0;
637
640
  }
638
641
  function writeDate(state, val) {
639
642
  return state.buf.push('new Date("' + val.toISOString() + '")'), !0;
@@ -653,26 +656,38 @@ function writePromise(state, val, ref) {
653
656
  function writeMap(state, val, ref) {
654
657
  if (!val.size)
655
658
  return state.buf.push("new Map"), !0;
656
- let items = [], assigns;
657
- for (let [itemKey, itemValue] of val)
658
- itemKey === val && (itemKey = void 0, (assigns ||= []).push("i[" + items.length + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("i[" + items.length + "][1]")), itemValue === void 0 ? items.push([itemKey]) : items.push([itemKey, itemValue]);
659
659
  let arrayRef = new Reference(
660
660
  ref,
661
661
  null,
662
662
  state.flush,
663
663
  null,
664
664
  nextRefAccess(state)
665
- );
666
- return state.buf.push(
667
- (assigns ? "((m,i)=>(" + assignsToString(assigns, "m") + ",i.forEach(i=>m.set(i[0],i[1])),m))(new Map," : "new Map(") + arrayRef.id + "="
668
- ), writeArray(state, items, arrayRef), state.buf.push(")"), !0;
665
+ ), items = [], assigns, i = 0;
666
+ if (val.size < 25) {
667
+ for (let [itemKey, itemValue] of val)
668
+ itemKey === val && (itemKey = void 0, (assigns ||= []).push("a[" + i + "][0]")), itemValue === val && (itemValue = void 0, (assigns ||= []).push("a[" + i + "][1]")), i = items.push(
669
+ itemValue === void 0 ? itemKey === void 0 ? [] : [itemKey] : [itemKey, itemValue]
670
+ );
671
+ assigns ? state.buf.push(
672
+ "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map," + arrayRef.id + "="
673
+ ) : state.buf.push("new Map(" + arrayRef.id + "="), writeArray(state, items, arrayRef), state.buf.push(")");
674
+ } else {
675
+ for (let [itemKey, itemValue] of val)
676
+ itemKey === val && (itemKey = 0, (assigns ||= []).push("a[" + i + "]")), itemValue === val && (itemValue = 0, (assigns ||= []).push("a[" + (i + 1) + "]")), i = items.push(itemKey, itemValue);
677
+ assigns ? state.buf.push(
678
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1])," + assignsToString(assigns, "new Map") + "))(" + arrayRef.id + "="
679
+ ) : state.buf.push(
680
+ "(a=>a.reduce((m,v,i)=>i%2?m:m.set(v,a[i+1]),new Map))(" + arrayRef.id + "="
681
+ ), writeArray(state, items, arrayRef), state.buf.push(")");
682
+ }
683
+ return !0;
669
684
  }
670
685
  function writeSet(state, val, ref) {
671
686
  if (!val.size)
672
687
  return state.buf.push("new Set"), !0;
673
- let items = [], assigns;
688
+ let items = [], assigns, i = 0;
674
689
  for (let item of val)
675
- item === val && (item = void 0, (assigns ||= []).push("i[" + items.length + "]")), items.push(item);
690
+ item === val && (item = 0, (assigns ||= []).push("i[" + i + "]")), i = items.push(item);
676
691
  let arrayRef = new Reference(
677
692
  ref,
678
693
  null,
@@ -725,9 +740,9 @@ function writeHeaders(state, val) {
725
740
  function writeFormData(state, val) {
726
741
  let sep = "[", valStr = "";
727
742
  for (let [key, value] of val)
728
- typeof value == "string" && (valStr += sep + "[" + quote(key, 0) + "," + quote(value, 0) + "]", sep = ",");
743
+ typeof value == "string" && (valStr += sep + quote(key, 0) + "," + quote(value, 0), sep = ",");
729
744
  return sep === "[" ? state.buf.push("new FormData") : state.buf.push(
730
- "((f,i)=>(f,i.forEach(i=>f.append(i[0],i[1])),f))(new FormData," + valStr + "])"
745
+ valStr + "].reduce((f,v,i,a)=>i%2&&f.append(v,a[i+1])||f,new FormData)"
731
746
  ), !0;
732
747
  }
733
748
  function writeRequest(state, val, ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.0-next.3.62",
3
+ "version": "6.0.0-next.3.63",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",