marko 6.0.90 → 6.0.92

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
@@ -223,10 +223,24 @@ function createDelegator() {
223
223
  }
224
224
  function handleDelegated(ev) {
225
225
  let target = !rendering && ev.target;
226
+ if (true) {
227
+ Object.defineProperty(ev, "currentTarget", {
228
+ configurable: true,
229
+ get() {
230
+ console.error(
231
+ "Event.currentTarget is not supported in Marko's delegated events. Instead use an element reference or the second parameter of the event handler."
232
+ );
233
+ return null;
234
+ }
235
+ });
236
+ }
226
237
  while (target) {
227
238
  target["$" + ev.type]?.(ev, target);
228
239
  target = ev.bubbles && !ev.cancelBubble && target.parentNode;
229
240
  }
241
+ if (true) {
242
+ delete ev.currentTarget;
243
+ }
230
244
  }
231
245
 
232
246
  // src/dom/resolve-cursor-position.ts
@@ -1991,6 +2005,14 @@ function loop(nodeAccessor, renderer, forEach) {
1991
2005
  const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
1992
2006
  const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
1993
2007
  forEach(value, (key, args) => {
2008
+ if (true) {
2009
+ if (newMap.has(key)) {
2010
+ console.error(
2011
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
2012
+ key
2013
+ );
2014
+ }
2015
+ }
1994
2016
  const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1995
2017
  params?.(branch, args);
1996
2018
  newMap.set(key, branch);
@@ -123,10 +123,24 @@ function createDelegator() {
123
123
  }
124
124
  function handleDelegated(ev) {
125
125
  let target = !rendering && ev.target;
126
+ if (true) {
127
+ Object.defineProperty(ev, "currentTarget", {
128
+ configurable: true,
129
+ get() {
130
+ console.error(
131
+ "Event.currentTarget is not supported in Marko's delegated events. Instead use an element reference or the second parameter of the event handler."
132
+ );
133
+ return null;
134
+ }
135
+ });
136
+ }
126
137
  while (target) {
127
138
  target["$" + ev.type]?.(ev, target);
128
139
  target = ev.bubbles && !ev.cancelBubble && target.parentNode;
129
140
  }
141
+ if (true) {
142
+ delete ev.currentTarget;
143
+ }
130
144
  }
131
145
 
132
146
  // src/dom/resolve-cursor-position.ts
@@ -1891,6 +1905,14 @@ function loop(nodeAccessor, renderer, forEach) {
1891
1905
  const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
1892
1906
  const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
1893
1907
  forEach(value, (key, args) => {
1908
+ if (true) {
1909
+ if (newMap.has(key)) {
1910
+ console.error(
1911
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1912
+ key
1913
+ );
1914
+ }
1915
+ }
1894
1916
  const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1895
1917
  params?.(branch, args);
1896
1918
  newMap.set(key, branch);
@@ -1872,6 +1872,15 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1872
1872
  const loopScopes = /* @__PURE__ */ new Map();
1873
1873
  forOf(list, (item, index) => {
1874
1874
  const branchId = _peek_scope_id();
1875
+ const itemKey = forOfBy(by, item, index);
1876
+ if (true) {
1877
+ if (by && loopScopes.has(itemKey)) {
1878
+ console.error(
1879
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1880
+ itemKey
1881
+ );
1882
+ }
1883
+ }
1875
1884
  if (resumeMarker) {
1876
1885
  if (singleNode) {
1877
1886
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1884,7 +1893,7 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1884
1893
  }
1885
1894
  withBranchId(branchId, () => {
1886
1895
  cb(item, index);
1887
- loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1896
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1888
1897
  });
1889
1898
  });
1890
1899
  if (loopScopes.size) {
@@ -1913,6 +1922,15 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1913
1922
  const loopScopes = /* @__PURE__ */ new Map();
1914
1923
  forIn(obj, (key, value) => {
1915
1924
  const branchId = _peek_scope_id();
1925
+ const itemKey = forInBy(by, key, value);
1926
+ if (true) {
1927
+ if (by && loopScopes.has(itemKey)) {
1928
+ console.error(
1929
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1930
+ itemKey
1931
+ );
1932
+ }
1933
+ }
1916
1934
  if (resumeMarker) {
1917
1935
  if (singleNode) {
1918
1936
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1925,7 +1943,7 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1925
1943
  }
1926
1944
  withBranchId(branchId, () => {
1927
1945
  cb(key, value);
1928
- loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1946
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1929
1947
  });
1930
1948
  });
1931
1949
  if (loopScopes.size) {
@@ -1954,6 +1972,15 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1954
1972
  const loopScopes = /* @__PURE__ */ new Map();
1955
1973
  forTo(to, from, step, (i) => {
1956
1974
  const branchId = _peek_scope_id();
1975
+ const itemKey = forStepBy(by, i);
1976
+ if (true) {
1977
+ if (by && loopScopes.has(itemKey)) {
1978
+ console.error(
1979
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1980
+ itemKey
1981
+ );
1982
+ }
1983
+ }
1957
1984
  if (resumeMarker) {
1958
1985
  if (singleNode) {
1959
1986
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1966,7 +1993,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1966
1993
  }
1967
1994
  withBranchId(branchId, () => {
1968
1995
  cb(i);
1969
- loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1996
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1970
1997
  });
1971
1998
  });
1972
1999
  if (loopScopes.size) {
@@ -1995,6 +2022,15 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1995
2022
  const loopScopes = /* @__PURE__ */ new Map();
1996
2023
  forUntil(to, from, step, (i) => {
1997
2024
  const branchId = _peek_scope_id();
2025
+ const itemKey = forStepBy(by, i);
2026
+ if (true) {
2027
+ if (by && loopScopes.has(itemKey)) {
2028
+ console.error(
2029
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
2030
+ itemKey
2031
+ );
2032
+ }
2033
+ }
1998
2034
  if (resumeMarker) {
1999
2035
  if (singleNode) {
2000
2036
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -2007,7 +2043,7 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
2007
2043
  }
2008
2044
  withBranchId(branchId, () => {
2009
2045
  cb(i);
2010
- loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
2046
+ loopScopes.set(itemKey, writeScope(branchId, {}));
2011
2047
  });
2012
2048
  });
2013
2049
  if (loopScopes.size) {
@@ -1783,6 +1783,15 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1783
1783
  const loopScopes = /* @__PURE__ */ new Map();
1784
1784
  forOf(list, (item, index) => {
1785
1785
  const branchId = _peek_scope_id();
1786
+ const itemKey = forOfBy(by, item, index);
1787
+ if (true) {
1788
+ if (by && loopScopes.has(itemKey)) {
1789
+ console.error(
1790
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1791
+ itemKey
1792
+ );
1793
+ }
1794
+ }
1786
1795
  if (resumeMarker) {
1787
1796
  if (singleNode) {
1788
1797
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1795,7 +1804,7 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1795
1804
  }
1796
1805
  withBranchId(branchId, () => {
1797
1806
  cb(item, index);
1798
- loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1807
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1799
1808
  });
1800
1809
  });
1801
1810
  if (loopScopes.size) {
@@ -1824,6 +1833,15 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1824
1833
  const loopScopes = /* @__PURE__ */ new Map();
1825
1834
  forIn(obj, (key, value) => {
1826
1835
  const branchId = _peek_scope_id();
1836
+ const itemKey = forInBy(by, key, value);
1837
+ if (true) {
1838
+ if (by && loopScopes.has(itemKey)) {
1839
+ console.error(
1840
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1841
+ itemKey
1842
+ );
1843
+ }
1844
+ }
1827
1845
  if (resumeMarker) {
1828
1846
  if (singleNode) {
1829
1847
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1836,7 +1854,7 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1836
1854
  }
1837
1855
  withBranchId(branchId, () => {
1838
1856
  cb(key, value);
1839
- loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1857
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1840
1858
  });
1841
1859
  });
1842
1860
  if (loopScopes.size) {
@@ -1865,6 +1883,15 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1865
1883
  const loopScopes = /* @__PURE__ */ new Map();
1866
1884
  forTo(to, from, step, (i) => {
1867
1885
  const branchId = _peek_scope_id();
1886
+ const itemKey = forStepBy(by, i);
1887
+ if (true) {
1888
+ if (by && loopScopes.has(itemKey)) {
1889
+ console.error(
1890
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1891
+ itemKey
1892
+ );
1893
+ }
1894
+ }
1868
1895
  if (resumeMarker) {
1869
1896
  if (singleNode) {
1870
1897
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1877,7 +1904,7 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1877
1904
  }
1878
1905
  withBranchId(branchId, () => {
1879
1906
  cb(i);
1880
- loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1907
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1881
1908
  });
1882
1909
  });
1883
1910
  if (loopScopes.size) {
@@ -1906,6 +1933,15 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1906
1933
  const loopScopes = /* @__PURE__ */ new Map();
1907
1934
  forUntil(to, from, step, (i) => {
1908
1935
  const branchId = _peek_scope_id();
1936
+ const itemKey = forStepBy(by, i);
1937
+ if (true) {
1938
+ if (by && loopScopes.has(itemKey)) {
1939
+ console.error(
1940
+ `A <for> tag's \`by\` attribute must return a unique value for each item, but a duplicate was found matching:`,
1941
+ itemKey
1942
+ );
1943
+ }
1944
+ }
1909
1945
  if (resumeMarker) {
1910
1946
  if (singleNode) {
1911
1947
  flushBranchIds = " " + branchId + flushBranchIds;
@@ -1918,7 +1954,7 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1918
1954
  }
1919
1955
  withBranchId(branchId, () => {
1920
1956
  cb(i);
1921
- loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1957
+ loopScopes.set(itemKey, writeScope(branchId, {}));
1922
1958
  });
1923
1959
  });
1924
1960
  if (loopScopes.size) {
package/dist/html.js CHANGED
@@ -1217,11 +1217,11 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1217
1217
  if (serializeBranch !== 0) {
1218
1218
  let loopScopes = /* @__PURE__ */ new Map();
1219
1219
  forOf(list, (item, index) => {
1220
- let branchId = _peek_scope_id();
1220
+ let branchId = _peek_scope_id(), itemKey = forOfBy(by, item, index);
1221
1221
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1222
1222
  state.mark("[" /* BranchStart */, flushBranchIds)
1223
1223
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1224
- cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1224
+ cb(item, index), loopScopes.set(itemKey, writeScope(branchId, {}));
1225
1225
  });
1226
1226
  }), loopScopes.size && writeScope(scopeId, {
1227
1227
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1243,11 +1243,11 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1243
1243
  if (serializeBranch !== 0) {
1244
1244
  let loopScopes = /* @__PURE__ */ new Map();
1245
1245
  forIn(obj, (key, value) => {
1246
- let branchId = _peek_scope_id();
1246
+ let branchId = _peek_scope_id(), itemKey = forInBy(by, key, value);
1247
1247
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1248
1248
  state.mark("[" /* BranchStart */, flushBranchIds)
1249
1249
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1250
- cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1250
+ cb(key, value), loopScopes.set(itemKey, writeScope(branchId, {}));
1251
1251
  });
1252
1252
  }), loopScopes.size && writeScope(scopeId, {
1253
1253
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1269,11 +1269,11 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1269
1269
  if (serializeBranch !== 0) {
1270
1270
  let loopScopes = /* @__PURE__ */ new Map();
1271
1271
  forTo(to, from, step, (i) => {
1272
- let branchId = _peek_scope_id();
1272
+ let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
1273
1273
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1274
1274
  state.mark("[" /* BranchStart */, flushBranchIds)
1275
1275
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1276
- cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1276
+ cb(i), loopScopes.set(itemKey, writeScope(branchId, {}));
1277
1277
  });
1278
1278
  }), loopScopes.size && writeScope(scopeId, {
1279
1279
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1295,11 +1295,11 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1295
1295
  if (serializeBranch !== 0) {
1296
1296
  let loopScopes = /* @__PURE__ */ new Map();
1297
1297
  forUntil(to, from, step, (i) => {
1298
- let branchId = _peek_scope_id();
1298
+ let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
1299
1299
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1300
1300
  state.mark("[" /* BranchStart */, flushBranchIds)
1301
1301
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1302
- cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1302
+ cb(i), loopScopes.set(itemKey, writeScope(branchId, {}));
1303
1303
  });
1304
1304
  }), loopScopes.size && writeScope(scopeId, {
1305
1305
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
package/dist/html.mjs CHANGED
@@ -1131,11 +1131,11 @@ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMark
1131
1131
  if (serializeBranch !== 0) {
1132
1132
  let loopScopes = /* @__PURE__ */ new Map();
1133
1133
  forOf(list, (item, index) => {
1134
- let branchId = _peek_scope_id();
1134
+ let branchId = _peek_scope_id(), itemKey = forOfBy(by, item, index);
1135
1135
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1136
1136
  state.mark("[" /* BranchStart */, flushBranchIds)
1137
1137
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1138
- cb(item, index), loopScopes.set(forOfBy(by, item, index), writeScope(branchId, {}));
1138
+ cb(item, index), loopScopes.set(itemKey, writeScope(branchId, {}));
1139
1139
  });
1140
1140
  }), loopScopes.size && writeScope(scopeId, {
1141
1141
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1157,11 +1157,11 @@ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarke
1157
1157
  if (serializeBranch !== 0) {
1158
1158
  let loopScopes = /* @__PURE__ */ new Map();
1159
1159
  forIn(obj, (key, value) => {
1160
- let branchId = _peek_scope_id();
1160
+ let branchId = _peek_scope_id(), itemKey = forInBy(by, key, value);
1161
1161
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1162
1162
  state.mark("[" /* BranchStart */, flushBranchIds)
1163
1163
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1164
- cb(key, value), loopScopes.set(forInBy(by, key, value), writeScope(branchId, {}));
1164
+ cb(key, value), loopScopes.set(itemKey, writeScope(branchId, {}));
1165
1165
  });
1166
1166
  }), loopScopes.size && writeScope(scopeId, {
1167
1167
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1183,11 +1183,11 @@ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, ser
1183
1183
  if (serializeBranch !== 0) {
1184
1184
  let loopScopes = /* @__PURE__ */ new Map();
1185
1185
  forTo(to, from, step, (i) => {
1186
- let branchId = _peek_scope_id();
1186
+ let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
1187
1187
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1188
1188
  state.mark("[" /* BranchStart */, flushBranchIds)
1189
1189
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1190
- cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1190
+ cb(i), loopScopes.set(itemKey, writeScope(branchId, {}));
1191
1191
  });
1192
1192
  }), loopScopes.size && writeScope(scopeId, {
1193
1193
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -1209,11 +1209,11 @@ function _for_until(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1209
1209
  if (serializeBranch !== 0) {
1210
1210
  let loopScopes = /* @__PURE__ */ new Map();
1211
1211
  forUntil(to, from, step, (i) => {
1212
- let branchId = _peek_scope_id();
1212
+ let branchId = _peek_scope_id(), itemKey = forStepBy(by, i);
1213
1213
  resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(
1214
1214
  state.mark("[" /* BranchStart */, flushBranchIds)
1215
1215
  ), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
1216
- cb(i), loopScopes.set(forStepBy(by, i), writeScope(branchId, {}));
1216
+ cb(i), loopScopes.set(itemKey, writeScope(branchId, {}));
1217
1217
  });
1218
1218
  }), loopScopes.size && writeScope(scopeId, {
1219
1219
  ["m" /* LoopScopeMap */ + accessor]: loopScopes
@@ -2591,8 +2591,8 @@ var import_compiler13 = require("@marko/compiler");
2591
2591
  function normalizeStringExpression(parts) {
2592
2592
  const strs = [];
2593
2593
  const exprs = [];
2594
- let curStr = parts[0];
2595
- for (let i = 1; i < parts.length; i++) {
2594
+ let curStr = "";
2595
+ for (let i = 0; i < parts.length; i++) {
2596
2596
  let content = parts[i];
2597
2597
  if (typeof content === "object") {
2598
2598
  if (import_compiler13.types.isStringLiteral(content)) {
@@ -4166,7 +4166,8 @@ function replaceEffectNode(node) {
4166
4166
  function replaceBindingReadNode(node) {
4167
4167
  switch (node.type) {
4168
4168
  case "Identifier":
4169
- case "MemberExpression": {
4169
+ case "MemberExpression":
4170
+ case "OptionalMemberExpression": {
4170
4171
  return getReadReplacement(node);
4171
4172
  }
4172
4173
  }
@@ -4576,7 +4577,8 @@ function replaceNode(node, container) {
4576
4577
  function replaceBindingReadNode2(node) {
4577
4578
  switch (node.type) {
4578
4579
  case "Identifier":
4579
- case "MemberExpression": {
4580
+ case "MemberExpression":
4581
+ case "OptionalMemberExpression": {
4580
4582
  const { extra } = node;
4581
4583
  if (extra && !(extra.read && !extra.read.binding.declared || extra.binding && !extra.binding.declared)) {
4582
4584
  return getReadReplacement(node);
@@ -4781,20 +4783,19 @@ function getChangeHandler(tag, attr) {
4781
4783
  changeAttrName,
4782
4784
  withPreviousLocation(import_compiler25.types.identifier(changeHandlerId), attr.value)
4783
4785
  );
4784
- } else if (import_compiler25.types.isMemberExpression(attr.value)) {
4786
+ } else if (import_compiler25.types.isMemberExpression(attr.value) || import_compiler25.types.isOptionalMemberExpression(attr.value)) {
4785
4787
  const prop = attr.value.property;
4786
4788
  if (!import_compiler25.types.isPrivateName(attr.value.property)) {
4789
+ const memberObj = import_compiler25.types.cloneNode(attr.value.object);
4790
+ const memberProp = prop.type === "Identifier" ? withPreviousLocation(import_compiler25.types.identifier(prop.name + "Change"), prop) : import_compiler25.types.binaryExpression(
4791
+ "+",
4792
+ import_compiler25.types.cloneNode(prop),
4793
+ import_compiler25.types.stringLiteral("Change")
4794
+ );
4795
+ const computed = memberProp.type !== "Identifier";
4787
4796
  return import_compiler25.types.markoAttribute(
4788
4797
  changeAttrName,
4789
- import_compiler25.types.memberExpression(
4790
- import_compiler25.types.cloneNode(attr.value.object),
4791
- prop.type === "Identifier" ? withPreviousLocation(import_compiler25.types.identifier(prop.name + "Change"), prop) : import_compiler25.types.binaryExpression(
4792
- "+",
4793
- import_compiler25.types.cloneNode(prop),
4794
- import_compiler25.types.stringLiteral("Change")
4795
- ),
4796
- prop.type !== "Identifier"
4797
- )
4798
+ attr.value.optional ? import_compiler25.types.optionalMemberExpression(memberObj, memberProp, computed, true) : import_compiler25.types.memberExpression(memberObj, memberProp, computed)
4798
4799
  );
4799
4800
  }
4800
4801
  }
@@ -8077,7 +8078,8 @@ function trackReference(referencePath, binding) {
8077
8078
  let propPath = binding.name;
8078
8079
  while (true) {
8079
8080
  const { parent } = root;
8080
- if (!import_compiler35.types.isMemberExpression(parent)) break;
8081
+ if (!import_compiler35.types.isMemberExpression(parent) && !import_compiler35.types.isOptionalMemberExpression(parent))
8082
+ break;
8081
8083
  const prop = getMemberExpressionPropString(parent);
8082
8084
  if (prop === void 0) break;
8083
8085
  if (reference.upstreamAlias && reference.excludeProperties !== void 0 && !propsUtil.has(reference.excludeProperties, prop)) {
@@ -1,3 +1,3 @@
1
1
  import { types as t } from "@marko/compiler";
2
2
  import { type Binding } from "./references";
3
- export declare function getDeclaredBindingExpression(binding: Binding): t.Identifier | t.OptionalMemberExpression | t.MemberExpression;
3
+ export declare function getDeclaredBindingExpression(binding: Binding): t.Identifier | t.MemberExpression | t.OptionalMemberExpression;
@@ -108,7 +108,7 @@ export declare function getDebugName(binding: Binding): string;
108
108
  export declare function getDebugNames(refs: ReferencedBindings): string;
109
109
  export declare function getSectionInstancesAccessor(section: Section): string;
110
110
  export declare function getSectionInstancesAccessorLiteral(section: Section): t.StringLiteral | t.NumericLiteral | undefined;
111
- export declare function getReadReplacement(node: t.Identifier | t.MemberExpression): t.Node | undefined;
111
+ export declare function getReadReplacement(node: t.Identifier | t.MemberExpression | t.OptionalMemberExpression): t.Node | undefined;
112
112
  export interface ReferencedExtra extends t.NodeExtra {
113
113
  section: Section;
114
114
  fnExtra?: FnExtra;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.0.90",
3
+ "version": "6.0.92",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",