marko 6.1.7 → 6.1.8

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
@@ -564,9 +564,8 @@ function enableBranches() {
564
564
  skipDestroyedRenders();
565
565
  }
566
566
  }
567
- function ready(readyId, runtimeId) {
567
+ function ready(readyId) {
568
568
  (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
569
- init(runtimeId);
570
569
  for (const renderId in curRenders) runResumeEffects(curRenders[renderId]);
571
570
  }
572
571
  function initEmbedded(readyId, runtimeId) {
@@ -583,7 +582,8 @@ function initEmbedded(readyId, runtimeId) {
583
582
  subtree: true
584
583
  });
585
584
  }
586
- ready(readyId, runtimeId);
585
+ ready(readyId);
586
+ init(runtimeId);
587
587
  }
588
588
  function init(runtimeId = "M") {
589
589
  if (curRenders) {
@@ -562,9 +562,8 @@ function enableBranches() {
562
562
  skipDestroyedRenders();
563
563
  }
564
564
  }
565
- function ready(readyId, runtimeId) {
565
+ function ready(readyId) {
566
566
  (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
567
- init(runtimeId);
568
567
  for (const renderId in curRenders) runResumeEffects(curRenders[renderId]);
569
568
  }
570
569
  function initEmbedded(readyId, runtimeId) {
@@ -581,7 +580,8 @@ function initEmbedded(readyId, runtimeId) {
581
580
  subtree: true
582
581
  });
583
582
  }
584
- ready(readyId, runtimeId);
583
+ ready(readyId);
584
+ init(runtimeId);
585
585
  }
586
586
  function init(runtimeId = "M") {
587
587
  if (curRenders) {
@@ -24,7 +24,7 @@ export interface RenderData {
24
24
  p?: Record<string | number, AwaitCounter>;
25
25
  }
26
26
  export declare function enableBranches(): void;
27
- export declare function ready(readyId: string, runtimeId?: string): void;
27
+ export declare function ready(readyId: string): void;
28
28
  export declare function initEmbedded(readyId: string, runtimeId?: string): void;
29
29
  export declare function init(runtimeId?: string): void;
30
30
  export declare let isResuming: undefined | 0 | 1;
package/dist/dom.js CHANGED
@@ -415,8 +415,8 @@ function createCloneableHTML(html, ns) {
415
415
  function enableBranches() {
416
416
  branchesEnabled || (branchesEnabled = 1, skipDestroyedRenders());
417
417
  }
418
- function ready(readyId, runtimeId) {
419
- (readyIds ||= /* @__PURE__ */ new Set()).add(readyId), init(runtimeId);
418
+ function ready(readyId) {
419
+ (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
420
420
  for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
421
421
  }
422
422
  function initEmbedded(readyId, runtimeId) {
@@ -428,7 +428,7 @@ function initEmbedded(readyId, runtimeId) {
428
428
  }).observe(document, {
429
429
  childList: !0,
430
430
  subtree: !0
431
- })), ready(readyId, runtimeId);
431
+ })), ready(readyId), init(runtimeId);
432
432
  }
433
433
  function init(runtimeId = "M") {
434
434
  if (curRenders) return;
package/dist/dom.mjs CHANGED
@@ -414,8 +414,8 @@ function createCloneableHTML(html, ns) {
414
414
  function enableBranches() {
415
415
  branchesEnabled || (branchesEnabled = 1, skipDestroyedRenders());
416
416
  }
417
- function ready(readyId, runtimeId) {
418
- (readyIds ||= /* @__PURE__ */ new Set()).add(readyId), init(runtimeId);
417
+ function ready(readyId) {
418
+ (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
419
419
  for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
420
420
  }
421
421
  function initEmbedded(readyId, runtimeId) {
@@ -427,7 +427,7 @@ function initEmbedded(readyId, runtimeId) {
427
427
  }).observe(document, {
428
428
  childList: !0,
429
429
  subtree: !0
430
- })), ready(readyId, runtimeId);
430
+ })), ready(readyId), init(runtimeId);
431
431
  }
432
432
  function init(runtimeId = "M") {
433
433
  if (curRenders) return;
@@ -940,35 +940,6 @@ function mapToString(data, sep, cb) {
940
940
  }
941
941
  return "";
942
942
  }
943
- function filterMap(data, cb) {
944
- if (data !== void 0) {
945
- if (Array.isArray(data)) {
946
- const len = data.length;
947
- let result;
948
- let i = 0;
949
- while (i < len) {
950
- let item = cb(data[i++]);
951
- if (item !== void 0) {
952
- result = item;
953
- while (i < len) {
954
- item = cb(data[i++]);
955
- if (item !== void 0) {
956
- result = [result, item];
957
- while (i < len) {
958
- item = cb(data[i++]);
959
- if (item !== void 0) result.push(item);
960
- }
961
- return result;
962
- }
963
- }
964
- return result;
965
- }
966
- }
967
- return result;
968
- }
969
- return cb(data);
970
- }
971
- }
972
943
  function findSorted(compare, data, item) {
973
944
  let max = data.length;
974
945
  let pos = 0;
@@ -1018,9 +989,10 @@ function addSorted(compare, data, item) {
1018
989
  function unionSortedRepeatable(compare, a, b) {
1019
990
  const aLen = a.length;
1020
991
  const bLen = b.length;
992
+ const result = [];
1021
993
  let aIndex = 0;
1022
994
  let bIndex = 0;
1023
- const result = [];
995
+ let same = true;
1024
996
  while (aIndex < aLen && bIndex < bLen) {
1025
997
  const aValue = a[aIndex];
1026
998
  const bValue = b[bIndex];
@@ -1030,14 +1002,16 @@ function unionSortedRepeatable(compare, a, b) {
1030
1002
  bIndex++;
1031
1003
  result.push(aValue);
1032
1004
  } else if (delta < 0) {
1005
+ same = false;
1033
1006
  aIndex++;
1034
1007
  result.push(aValue);
1035
1008
  } else {
1009
+ same = false;
1036
1010
  bIndex++;
1037
1011
  result.push(bValue);
1038
1012
  }
1039
1013
  }
1040
- if (aLen === bLen && aIndex === aLen) return a;
1014
+ if (same && aLen === bLen) return a;
1041
1015
  while (aIndex < aLen) result.push(a[aIndex++]);
1042
1016
  while (bIndex < bLen) result.push(b[bIndex++]);
1043
1017
  return result;
@@ -3763,7 +3737,7 @@ function getChangeHandler(tag, attr) {
3763
3737
  const bindingIdentifierPath = binding.path.getOuterBindingIdentifierPaths()[binding.identifier.name];
3764
3738
  let changeAttrExpr = bindingIdentifierPath ? bindingIdentifierPath.parentPath === binding.path ? buildChangeHandlerFunction(attr.value, modifier) : bindingIdentifierPath.parentPath.isObjectProperty() ? getChangeHandlerFromObjectPattern(bindingIdentifierPath.parentPath) : void 0 : void 0;
3765
3739
  if (!changeAttrExpr) throw tag.hub.buildError(attr.value, "Unable to bind to value.");
3766
- if (modifier && _marko_compiler.types.isIdentifier(changeAttrExpr)) changeAttrExpr = _marko_compiler.types.logicalExpression("&&", changeAttrExpr, buildChangeHandlerFunction(attr.value, modifier));
3740
+ if (modifier && _marko_compiler.types.isIdentifier(changeAttrExpr)) changeAttrExpr = _marko_compiler.types.logicalExpression("&&", changeAttrExpr, buildModifierForwarder(_marko_compiler.types.cloneNode(changeAttrExpr), modifier));
3767
3741
  const changeHandlerAttr = _marko_compiler.types.markoAttribute(changeAttrName, changeAttrExpr);
3768
3742
  BINDING_CHANGE_HANDLER.set(binding.identifier, changeHandlerAttr);
3769
3743
  return changeHandlerAttr;
@@ -3781,18 +3755,19 @@ function getChangeHandler(tag, attr) {
3781
3755
  const prop = attr.value.property;
3782
3756
  if (!_marko_compiler.types.isPrivateName(attr.value.property)) {
3783
3757
  const memberObj = _marko_compiler.types.cloneNode(attr.value.object);
3784
- const memberProp = prop.type === "Identifier" ? withPreviousLocation(_marko_compiler.types.identifier(prop.name + "Change"), prop) : _marko_compiler.types.binaryExpression("+", _marko_compiler.types.cloneNode(prop), _marko_compiler.types.stringLiteral("Change"));
3758
+ const memberProp = !attr.value.computed && prop.type === "Identifier" ? withPreviousLocation(_marko_compiler.types.identifier(prop.name + "Change"), prop) : _marko_compiler.types.binaryExpression("+", _marko_compiler.types.cloneNode(prop), _marko_compiler.types.stringLiteral("Change"));
3785
3759
  const computed = memberProp.type !== "Identifier";
3786
3760
  let changeAttrExpr = attr.value.optional ? _marko_compiler.types.optionalMemberExpression(memberObj, memberProp, computed, true) : _marko_compiler.types.memberExpression(memberObj, memberProp, computed);
3787
- if (modifier) {
3788
- const newValueId = generateUid("next");
3789
- changeAttrExpr = _marko_compiler.types.logicalExpression("&&", changeAttrExpr, _marko_compiler.types.arrowFunctionExpression([_marko_compiler.types.identifier(newValueId)], _marko_compiler.types.blockStatement([_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(_marko_compiler.types.memberExpression(memberObj, memberProp, computed), [_marko_compiler.types.callExpression(modifier, [_marko_compiler.types.identifier(newValueId)])]))])));
3790
- }
3761
+ if (modifier) changeAttrExpr = _marko_compiler.types.logicalExpression("&&", changeAttrExpr, buildModifierForwarder(_marko_compiler.types.memberExpression(memberObj, memberProp, computed), modifier));
3791
3762
  return _marko_compiler.types.markoAttribute(changeAttrName, changeAttrExpr);
3792
3763
  }
3793
3764
  }
3794
3765
  throw tag.hub.buildError(attr.value, "Attributes may only be bound to identifiers or member expressions");
3795
3766
  }
3767
+ function buildModifierForwarder(changeHandler, modifier) {
3768
+ const newValueId = generateUid("next");
3769
+ return _marko_compiler.types.arrowFunctionExpression([_marko_compiler.types.identifier(newValueId)], _marko_compiler.types.blockStatement([_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(changeHandler, [_marko_compiler.types.callExpression(_marko_compiler.types.cloneNode(modifier), [_marko_compiler.types.identifier(newValueId)])]))]));
3770
+ }
3796
3771
  function buildChangeHandlerFunction(id, modifier) {
3797
3772
  const newId = "_new_" + id.name;
3798
3773
  let newValue = withPreviousLocation(_marko_compiler.types.identifier(newId), id);
@@ -3915,9 +3890,7 @@ var program_default = {
3915
3890
  if (isLoadEntry) {
3916
3891
  const entryFile = program.hub.file;
3917
3892
  const { filename } = entryFile.opts;
3918
- const readyArgs = [_marko_compiler.types.stringLiteral(getReadyId(entryFile))];
3919
- if (runtimeId) readyArgs.push(_marko_compiler.types.stringLiteral(runtimeId));
3920
- program.node.body = [_marko_compiler.types.importDeclaration([_marko_compiler.types.importSpecifier(_marko_compiler.types.identifier("ready"), _marko_compiler.types.identifier("ready"))], _marko_compiler.types.stringLiteral(getRuntimePath("dom"))), _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(_marko_compiler.types.memberExpression(_marko_compiler.types.callExpression(_marko_compiler.types.import(), [_marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.resolveRelativePath)(entryFile, filename))]), _marko_compiler.types.identifier("then")), [_marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.callExpression(_marko_compiler.types.identifier("ready"), readyArgs))]))];
3893
+ program.node.body = [_marko_compiler.types.importDeclaration([_marko_compiler.types.importSpecifier(_marko_compiler.types.identifier("ready"), _marko_compiler.types.identifier("ready"))], _marko_compiler.types.stringLiteral(getRuntimePath("dom"))), _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(_marko_compiler.types.memberExpression(_marko_compiler.types.callExpression(_marko_compiler.types.import(), [_marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.resolveRelativePath)(entryFile, filename))]), _marko_compiler.types.identifier("then")), [_marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.callExpression(_marko_compiler.types.identifier("ready"), [_marko_compiler.types.stringLiteral(getReadyId(entryFile))]))]))];
3921
3894
  program.skip();
3922
3895
  return;
3923
3896
  }
@@ -4213,7 +4186,9 @@ var native_tag_default = {
4213
4186
  for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoPlaceholder(child)) (textPlaceholders ||= []).push(child.value);
4214
4187
  else if (!_marko_compiler.types.isMarkoText(child)) throw tag.hub.buildError(child, `Only text is allowed inside a \`<${tagName}>\`.`);
4215
4188
  }
4216
- if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || isDynamicControllable(getRelatedControllable(tagName, seen))) {
4189
+ relatedControllable ||= getRelatedControllable(tagName, seen);
4190
+ if (relatedControllable && relatedControllable.attrs[1]) hasEventHandlers = true;
4191
+ if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || isDynamicControllable(relatedControllable)) {
4217
4192
  const tagExtra = node.extra ??= {};
4218
4193
  const tagSection = getOrCreateSection(tag);
4219
4194
  const nodeBinding = tagExtra[kNativeTagBinding] = createBinding("#" + getCanonicalTagName(tag), 0, tagSection, void 0, void 0, void 0, void 0, !!node.var);
@@ -4314,16 +4289,7 @@ var native_tag_default = {
4314
4289
  if (isTextOnly || isOpenOnly || hasChildren || staticContentAttr) if (skipExpression) write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), _marko_compiler.types.stringLiteral(tagName))}`;
4315
4290
  else write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), _marko_compiler.types.stringLiteral(tagName))}`;
4316
4291
  }
4317
- if (isOpenOnly) switch (tagDef.htmlType) {
4318
- case "svg":
4319
- case "math":
4320
- write`/>`;
4321
- break;
4322
- default:
4323
- write`>`;
4324
- break;
4325
- }
4326
- else if (isTextOnly) write`>`;
4292
+ if (isOpenOnly || isTextOnly) write`>`;
4327
4293
  else if (staticContentAttr) {
4328
4294
  write`>`;
4329
4295
  tagExtra[kTagContentAttr] = true;
@@ -4440,16 +4406,7 @@ var native_tag_default = {
4440
4406
  addStatement("effect", tagSection, tagExtra.referencedBindings, _marko_compiler.types.expressionStatement(callRuntime("_attrs_script", scopeIdentifier, visitAccessor)), false);
4441
4407
  }
4442
4408
  if (staticContentAttr) addStatement("render", tagSection, staticContentAttr.value.extra?.referencedBindings, _marko_compiler.types.expressionStatement(callRuntime("_attr_content", scopeIdentifier, visitAccessor, staticContentAttr.value)), void 0, true);
4443
- if (isOpenOnly) switch (tagDef.htmlType) {
4444
- case "svg":
4445
- case "math":
4446
- write`/>`;
4447
- break;
4448
- default:
4449
- write`>`;
4450
- break;
4451
- }
4452
- else write`>`;
4409
+ write`>`;
4453
4410
  enter(tag);
4454
4411
  },
4455
4412
  exit(tag) {
@@ -4946,7 +4903,7 @@ function getBaseArgsInForTag(type, attrs) {
4946
4903
  //#region src/translator/util/translate-attrs.ts
4947
4904
  const contentProps = /* @__PURE__ */ new WeakSet();
4948
4905
  function translateAttrs(tag, propTree = true, skip, statements = [], contentKey = "content") {
4949
- const properties = [];
4906
+ const contentProperties = [];
4950
4907
  const attrTagLookup = tag.node.extra?.attributeTags;
4951
4908
  const seen = new Set(skip);
4952
4909
  if (attrTagLookup) {
@@ -4956,7 +4913,7 @@ function translateAttrs(tag, propTree = true, skip, statements = [], contentKey
4956
4913
  seen.add(attrTagMeta.name);
4957
4914
  if (attrTagMeta.dynamic) {
4958
4915
  statements.push(_marko_compiler.types.variableDeclaration("let", [_marko_compiler.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))]));
4959
- properties.push(toObjectProperty(attrTagMeta.name, getAttrTagIdentifier(attrTagMeta)));
4916
+ contentProperties.push(toObjectProperty(attrTagMeta.name, getAttrTagIdentifier(attrTagMeta)));
4960
4917
  }
4961
4918
  }
4962
4919
  }
@@ -4970,10 +4927,10 @@ function translateAttrs(tag, propTree = true, skip, statements = [], contentKey
4970
4927
  else {
4971
4928
  const translatedAttrTag = translateAttrs(child, getKnownFromPropTree(propTree, attrTagMeta.name), void 0, statements, contentKey);
4972
4929
  if (attrTagMeta.repeated) {
4973
- const prevProp = findObjectProperty(attrTagMeta.name, properties);
4930
+ const prevProp = findObjectProperty(attrTagMeta.name, contentProperties);
4974
4931
  if (prevProp) prevProp.value = callRuntime("attrTags", prevProp.value, propsToExpression(translatedAttrTag.properties));
4975
- else properties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
4976
- } else properties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
4932
+ else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
4933
+ } else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
4977
4934
  }
4978
4935
  } else i = addDynamicAttrTagStatements(attrTags, i, attrTagLookup, statements, propTree, contentKey);
4979
4936
  }
@@ -4984,22 +4941,22 @@ function translateAttrs(tag, propTree = true, skip, statements = [], contentKey
4984
4941
  const contentProp = _marko_compiler.types.objectProperty(_marko_compiler.types.identifier(contentKey), contentExpression);
4985
4942
  seen.add(contentKey);
4986
4943
  contentProps.add(contentProp);
4987
- properties.push(contentProp);
4944
+ contentProperties.push(contentProp);
4988
4945
  }
4989
4946
  }
4990
4947
  const { attributes } = tag.node;
4948
+ const attrProperties = [];
4991
4949
  for (let i = attributes.length; i--;) {
4992
4950
  const attr = attributes[i];
4993
4951
  const { value } = attr;
4994
- if (_marko_compiler.types.isMarkoSpreadAttribute(attr)) properties.push(_marko_compiler.types.spreadElement(value));
4952
+ if (_marko_compiler.types.isMarkoSpreadAttribute(attr)) attrProperties.push(_marko_compiler.types.spreadElement(value));
4995
4953
  else if (!seen.has(attr.name) && getKnownFromPropTree(propTree, attr.name)) {
4996
4954
  seen.add(attr.name);
4997
- properties.push(toObjectProperty(attr.name, value));
4955
+ attrProperties.push(toObjectProperty(attr.name, value));
4998
4956
  }
4999
4957
  }
5000
- properties.reverse();
5001
4958
  return {
5002
- properties,
4959
+ properties: attrProperties.reverse().concat(contentProperties),
5003
4960
  statements
5004
4961
  };
5005
4962
  }
@@ -5449,10 +5406,9 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
5449
5406
  const tagInputIdentifier = info.getBindingIdentifier(propTree.binding, `${importAlias}_params`);
5450
5407
  const translatedAttrs = translateAttrs(tag);
5451
5408
  if (translatedAttrs.statements.length) addStatement("render", info.tagSection, referencedBindings, translatedAttrs.statements);
5452
- let renderArgs = [createScopeReadExpression(info.childScopeBinding, info.tagSection)];
5453
- if (tag.node.arguments) renderArgs = [...renderArgs, ...tag.node.arguments];
5454
- if (!tag.node.arguments?.length || translatedAttrs.properties.length) renderArgs.push(propsToExpression(translatedAttrs.properties));
5455
- addStatement("render", info.tagSection, referencedBindings, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(tagInputIdentifier, [_marko_compiler.types.arrayExpression(renderArgs)])));
5409
+ const renderParams = tag.node.arguments ? [...tag.node.arguments] : [];
5410
+ if (!tag.node.arguments?.length || translatedAttrs.properties.length) renderParams.push(propsToExpression(translatedAttrs.properties));
5411
+ addStatement("render", info.tagSection, referencedBindings, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(tagInputIdentifier, [createScopeReadExpression(info.childScopeBinding, info.tagSection), _marko_compiler.types.arrayExpression(renderParams)])));
5456
5412
  return;
5457
5413
  }
5458
5414
  let i = 0;
@@ -5629,7 +5585,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
5629
5585
  const propBinding = knownSpread.binding.propertyAliases.get(prop);
5630
5586
  addStatement("render", info.tagSection, propBinding, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(attrExportIdentifier, [createScopeReadExpression(info.childScopeBinding, info.tagSection), createScopeReadExpression(propBinding, info.tagSection)])), void 0, true);
5631
5587
  }
5632
- else if (spreadProps) {
5588
+ else if (spreadProps && (remaining.size || propTree.rest && !propTree.rest.props)) {
5633
5589
  const spreadExpr = propsToExpression(spreadProps.reverse());
5634
5590
  let spreadId = spreadExpr;
5635
5591
  if (!isSimpleReference(spreadExpr)) {
@@ -5664,25 +5620,37 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
5664
5620
  function mapParamReasonToExpr(exprs, reason) {
5665
5621
  if (reason) {
5666
5622
  if (reason === true) return true;
5667
- return filterMap(reason, (prop) => {
5668
- if (exprs) {
5669
- let curExpr = exprs;
5670
- let curBinding = prop;
5671
- if (curBinding.property) {
5672
- const props = [];
5673
- do
5674
- props.push(curBinding.property);
5675
- while ((curBinding = curBinding.upstreamAlias) && curBinding.property);
5676
- for (let i = props.length; i--;) {
5677
- const nestedExpr = curExpr.known?.[props[i]];
5678
- if (nestedExpr) curExpr = nestedExpr;
5679
- else break;
5680
- }
5681
- }
5682
- return curExpr.value;
5683
- }
5623
+ const result = /* @__PURE__ */ new Set();
5624
+ forEach(reason, (prop) => {
5625
+ forEach(mapParamBindingToExpr(exprs, prop), (expr) => {
5626
+ result.add(expr);
5627
+ });
5684
5628
  });
5629
+ return fromIter(result);
5630
+ }
5631
+ }
5632
+ function mapParamBindingToExpr(exprs, binding) {
5633
+ const isRest = binding.property === void 0 && binding.excludeProperties !== void 0;
5634
+ const props = [];
5635
+ let curBinding = isRest ? binding.upstreamAlias : binding;
5636
+ while (curBinding && curBinding.property !== void 0) {
5637
+ props.push(curBinding.property);
5638
+ curBinding = curBinding.upstreamAlias;
5639
+ }
5640
+ let curExpr = exprs;
5641
+ for (let i = props.length; i--;) {
5642
+ const nestedExpr = curExpr.known?.[props[i]];
5643
+ if (!nestedExpr) return curExpr.value;
5644
+ curExpr = nestedExpr;
5645
+ }
5646
+ if (isRest) {
5647
+ let result = curExpr.value;
5648
+ if (curExpr.known) {
5649
+ for (const key in curExpr.known) if (!includes(binding.excludeProperties, key)) result = concat(result, curExpr.known[key].value);
5650
+ }
5651
+ return result;
5685
5652
  }
5653
+ return curExpr.value;
5686
5654
  }
5687
5655
  function callStatement(id, ...args) {
5688
5656
  return _marko_compiler.types.expressionStatement(callExpression(id, ...args));
@@ -5756,7 +5724,7 @@ function trackDomVarReferences(tag, binding) {
5756
5724
  const babelBinding = tag.scope.getBinding(tagVar.name);
5757
5725
  const section = getOrCreateSection(tag);
5758
5726
  binding.originalName = tagVar.name;
5759
- if (babelBinding.constantViolations.length) for (const ref of babelBinding.constantViolations) throw ref.type === "MarkoTag" ? ref.get("var").buildCodeFrameError(`Duplicate declaration ${JSON.stringify(binding.name)}`) : ref.buildCodeFrameError("Tag variables on native elements cannot be assigned to.");
5727
+ if (babelBinding.constantViolations.length) for (const ref of babelBinding.constantViolations) throw ref.type === "MarkoTag" ? ref.get("var").buildCodeFrameError(`Duplicate declaration ${JSON.stringify(binding.originalName)}`) : ref.buildCodeFrameError("Tag variables on native elements cannot be assigned to.");
5760
5728
  for (const ref of babelBinding.referencePaths) {
5761
5729
  const refSection = getOrCreateSection(ref);
5762
5730
  const invoked = isInvokedFunction(ref);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.1.7",
3
+ "version": "6.1.8",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -49,7 +49,7 @@
49
49
  "build": "node -r ~ts ./scripts/bundle.mts"
50
50
  },
51
51
  "dependencies": {
52
- "@marko/compiler": "^5.39.64",
52
+ "@marko/compiler": "^5.39.65",
53
53
  "csstype": "^3.2.3",
54
54
  "fastest-levenshtein": "^1.0.16",
55
55
  "magic-string": "^0.30.21"